1 2013-11-22 Cary Coutant <ccoutant@google.com>
3 * configure.ac: Add check for which library is needed for
5 * configure: Regenerate.
7 2013-11-22 Cary Coutant <ccoutant@google.com>
9 * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
11 * testsuite/Makefile.in: Regenerate.
13 2013-11-17 H.J. Lu <hongjiu.lu@intel.com>
15 * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
16 Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
17 R_X86_64_PC32 and R_X86_64_PLT32, respectively.
18 (Target_x86_64<size>::Scan::local): Likewise.
19 (Target_x86_64<size>::Scan::global): Likewise.
20 (Target_x86_64<size>::Relocate::relocate): Likewise.
21 (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
23 (Target_x86_64<size>::Scan::check_non_pic(): Handle
26 * testsuite/Makefile.am (check_PROGRAMS): Add
27 exception_x86_64_bnd_test.
28 (exception_x86_64_bnd_test_SOURCES): New macro.
29 (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
30 (exception_x86_64_bnd_test_LDFLAGS): Likewise.
31 (exception_x86_64_bnd_test_LDADD): Likewise.
32 (exception_x86_64_bnd_1.o): New rule.
33 (exception_x86_64_bnd_2.o): Likewise.
34 * testsuite/Makefile.in: Regenerated.
36 2013-11-15 Alan Modra <amodra@gmail.com>
38 * powerpc.cc (Target_powerpc::glink_section): Provide non-const
40 (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
41 Only call ppc64_local_entry_offset for 64-bit. Restrict
42 symval_for_branch lookup to ELFv1.
43 (Stub_table::add_plt_call_entry): Use unsigned int off.
44 (Output_data_glink::Address, invalid_address): New.
45 (Output_data_glink::add_eh_frame): Move out of line. Add
47 (Output_data_glink::add_global_entry, find_global_entry,
48 global_entry_address): New functions.
49 (Output_data_glink::global_entry_stubs_, end_branch_table_,
50 ge_size): New variables.
51 (Output_data_glink::set_final_data_size): Add global entry
53 (Output_data_glink::do_write): Write global entry stubs.
54 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
55 parameter. Return true for ELFv2. Adjust callers.
56 (Target_powerpc::Scan::local, global): Restrict opd lookup to
57 ELFv1. Similarly for ifunc and dynamic relocation processing
58 specific to ELFv1. Recognize that symbols are defined on
59 their plt entries for ELFv2.
60 (Target_powerpc::symval_for_branch): Assert if called for
62 (Target_powerpc::Relocate::relocate): Use global entry plt
63 stub for symbol value if such exists on ELFv2.
64 (Target_powerpc::Relocate::relocate): Don't call
65 symval_for_branch when ELFv2. Do adjust for local entry
67 (Target_powerpc::do_dynsym_value): Set symbols to global entry
69 (Target_powerpc::do_plt_address_for_global): Similarly.
71 2013-11-14 Cary Coutant <ccoutant@google.com>
73 Revert patch -- this did not fix the problem, and there is
76 2013-11-14 Cary Coutant <ccoutant@google.com>
79 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
80 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
81 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
82 updating fde_offsets_.
83 (Eh_frame_hdr::lock_): New data member.
85 2013-11-14 Cary Coutant <ccoutant@google.com>
87 * dwp.cc (Dwo_file_entry): New type.
88 (File_list): Use Dwo_file_entry.
89 (Dwo_file::verify): New function.
90 (Dwo_file::verify_dwo_list): New function.
91 (Dwo_file::sized_verify_dwo_list): New function.
92 (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
94 (Dwp_options): New enum type.
95 (dwp_options): Add --verify-only.
98 * dwp.h (gold_info): Add declaration.
100 2013-11-14 Cary Coutant <ccoutant@google.com>
103 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
104 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
105 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
106 updating fde_offsets_.
107 (Eh_frame_hdr::lock_): New data member.
109 2013-11-06 Cary Coutant <ccoutant@google.com>
112 * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
113 before reloc sections.
115 2013-11-04 Alan Modra <amodra@gmail.com>
117 * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
118 (Symbol::needs_dynamic_reloc): Test new flag.
119 * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
120 (Target_powerpc::Scan::get_reference_flags): Add target param.
121 Return FUNC_DESC_ABI for 64-bit ELFv1.
122 (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
124 (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
125 (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
127 2013-10-31 Cary Coutant <ccoutant@google.com>
129 Restore support for dwp v2 DWARF package file format.
131 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
132 tu_length parameter. Adjust all callers.
133 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
134 * dwp.cc: Include dwarf.h.
135 (Section_bounds): New struct type.
136 (Unit_set): New struct type.
137 (Dwo_file::Dwo_file): Initialize new data member.
138 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
139 Combine and rename to...
140 (Dwo_file::read_unit_index): ...this.
141 (Dwo_file::sized_read_compunit_index)
142 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
143 (Dwo_file::sized_read_unit_index): ...this.
144 (Dwo_file::copy_section): Remove section_name, is_str_offsets
145 parameters; add section_id parameter.
146 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
147 (Dwo_file::add_unit_set): ...this.
148 (Dwo_file::shndx_map_): Remove.
149 (Dwo_file::sect_offsets_): New data member.
150 (Dwp_output_file::Dwp_output_file): Initialize new data members.
151 (Dwp_output_file::add_section): Rename to...
152 (Dwp_output_file::add_contribution): ...this.
153 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
154 (Dwp_output_file::add_tu_set): Likewise.
155 (Dwp_output_file::Contribution): New type.
156 (Dwp_output_file::Section::contributions): New data member.
157 (Dwp_output_file::Cu_or_tu_set): Remove.
158 (Dwp_output_file::Section::Section): New ctor.
159 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
160 (Dwp_output_file::Dwp_index::Section_table): New type.
161 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
162 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
164 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
165 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
166 (Dwp_output_file::Dwp_index::section_table): New member function.
167 (Dwp_output_file::Dwp_index::section_table_end): New member function.
168 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
169 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
170 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
171 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
172 (Dwp_output_file::Dwp_index::section_table_): New data member.
173 (Dwp_output_file::Dwp_index::section_mask_): New data member.
174 (Dwp_output_file::add_output_section): New member function.
175 (Dwp_output_file::write_new_section): New member function.
176 (Dwp_output_file::write_contributions): New member function.
177 (Dwp_output_file::section_id_map_): New data member.
178 (class Dwo_id_info_reader): Remove.
179 (class Unit_reader): New class.
180 (get_dwarf_section_name): New function.
181 (Dwo_file::read_executable): Adjust initializations of class data.
182 (Dwo_file::read): Add support for v2 package file format.
183 (Dwo_file::read_unit_index): Likewise.
184 (Dwo_file::sized_read_unit_index): Likewise.
185 (Dwo_file::copy_section): Likewise.
186 (Dwo_file::add_unit_set): Likewise.
187 (Dwp_output_file::add_output_section): Likewise.
188 (Dwp_output_file::add_contribution): Likewise.
189 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
191 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
193 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
195 (Dwp_output_file::initialize): Remove unused function.
196 (Dwp_output_file::finalize): Add support for v2 package file format.
197 (Dwp_output_file::write_index): Likewise.
198 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
201 2013-10-31 Cary Coutant <ccoutant@google.com>
203 * configure.ac: Fix check for -fmerge-constants.
204 * configure.ac: Regenerate.
206 2013-10-30 Roland McGrath <mcgrathr@google.com>
208 * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
209 Correct 9-byte nop sequence to match what the assembler generates.
211 2013-10-30 Alan Modra <amodra@gmail.com>
213 * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
214 ppc64_local_entry_offset, ppc64_local_entry_offset,
215 do_read_symbols): New functions.
216 (Powerpc_relobj::e_flags_, st_other_): New vars.
217 (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
218 (Powerpc_dynobj::abiversion, set_abiversion): New functions.
219 (Powerpc_relobj::e_flags_): New var.
220 (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
221 and adjust for ELFv2.
222 (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
223 (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
224 (Powerpc_dynobj::do_find_special_sections): Likewise.
225 (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
226 (Target_powerpc::Branch_info::make_stub): Adjust stub destination
227 to ELFv2 local entry.
228 (Target_powerpc::do_relax): No thread safe barriers needed for
230 (Output_data_plt_powerpc::initial_plt_entry_size_,
231 plt_entry_size): Delete. Replace all uses with
232 first_plt_entry_offset() and plt_entry_size().
233 (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
234 reserved_size parm. Update callers.
235 (Output_data_plt_powerpc::entry_count): Update.
236 (Output_data_plt_powerpc::first_plt_entry_offset): Make private
237 and use Target_powerpc::first_plt_entry_offset().
238 (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
239 rename to plt_entry_size.
240 (Output_data_plt_powerpc::add_ifunc_entry,
241 add_local_ifunc_entry): Adjust reloc for ELFv2.
242 (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
243 (glink_eh_frame_fde_64v2): New.
244 (Stub_table::plt_call_size): Support ELFv2 sizing.
245 (Output_data_glink::add_eh_frame): Use the new FDE.
246 (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
247 (Stub_table::do_write): Write ELFv2 stubs and glink.
248 (Target_powerpc::Relocate::relocate): Replaces nop after call
249 with ld 2,24(1) and adjust local offset destination for ELFv2.
251 2013-10-30 Alan Modra <amodra@gmail.com>
253 * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
254 (Target_powerpc::Scan::global, local): Likewise.
255 (Target_powerpc::Relocate::relocate): Likewise. Check for overflow
256 on all ppc64 @h and @ha relocs.
258 2013-10-14 Alan Modra <amodra@gmail.com>
260 * output.h (Output_data_got::add_constant): Tidy.
261 (Output_data_got::add_constant_pair): New function.
262 * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
263 methods used so as to first call reserve_ent().
265 2013-10-11 Roland McGrath <mcgrathr@google.com>
267 * powerpc.cc (Output_data_got_powerpc): Remove unused methods
268 add_got_entry and add_got_entry_pair.
270 * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
271 (HAVE_PUBNAMES): Likewise.
272 * configure: Regenerate.
274 * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
275 * testsuite/Makefile.in: Regenerate.
277 * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
278 Remove const from declaration.
279 * target.cc (Sized_target::do_adjust_elf_header): Update definition.
280 * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
281 * output.h (Output_file_header): Remove const from member target_
282 and corresponding constructor argument.
283 * output.cc (Output_file_header::Output_file_header): Update prototype.
284 (Output_file_header::do_sized_write): Use this->target_ in place
285 of parameters()->target().
287 * testsuite/undef_symbol.cc (Foo::get_a): New method.
289 * configure.ac (MERGE_CONSTANTS_FLAG): New check.
290 * configure: Regenerate.
291 * Makefile.in: Regenerate.
292 * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
293 * testsuite/merge_string_literals_2.c: Likewise.
294 * testsuite/Makefile.am
295 (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
296 (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
297 literal -fmerge-constants.
298 * testsuite/Makefile.in: Regenerate.
300 * i386.cc (Target_i386): Remove unused member dynbss_.
301 * arm.cc (Target_arm): Likewise.
302 * powerpc.cc (Target_powerpc): Likewise.
303 * sparc.cc (Target_sparc): Likewise.
304 * tilegx.cc (Target_tilegx): Likewise.
305 * x86_64.cc (Target_x86_64): Likewise.
306 * dwarf_reader.h (Dwarf_info_reader): Remove unused members
307 type_signature_, type_offset_.
308 * plugin.h (Plugin_hook): Remove unused member layout_.
309 * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
311 (Read_member): Remove unused members input_objects_, symtab_,
313 (Check_library): Remove unused member symtab_.
314 * archive.h (Lib_group): Remove unused member lib_.
315 * archive.cc (Lib_group::Lib_group): Update initializer.
316 * incremental.h (Incremental_binary): Remove unused member target_.
317 (Incremental_script_entry): Removed unused member script_.
318 * layout.h (Write_symbols_task): Remove unused member input_objects_.
319 * icf.h (Icf): Remove unused member num_tracked_relocs.
321 * gold-threads.h (Once): Conditionalize member was_run_lock_ on
322 [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
324 * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
326 * archive.h: Use struct rather than class for forward declaration
327 of Read_symbols_data.
329 2013-10-07 Cary Coutant <ccoutant@google.com>
332 * testsuite/Makefile.am (icf_test): Fix dependencies.
333 (icf_safe_test): Likewise.
334 (icf_safe_so_test): Likewise.
335 (large_symbol_alignment): Add empty _LDADD rule.
336 * testsuite/Makefile.in: Regenerate.
338 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
341 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
342 relocation for R_X86_64_32 on x32.
344 2013-08-27 Roland McGrath <mcgrathr@google.com>
346 * output.cc (Output_segment::set_section_addresses): Take new
347 Target* argument. If target->isolate_execinstr() and the segment
348 is executable and starts at a target->abi_pagesize() boundary,
349 pad its end out to a target->abi_pagesize() boundary with code fill.
350 * output.h (Output_segment::set_section_addresses): Update decl.
351 * layout.h (Layout::check_output_data_for_reset_values): Take new
352 argument RELAX_OUTPUTS.
353 (Layout): New member relax_output_list_.
354 (Layout::add_relax_output): New method.
355 * layout.cc (Layout::Layout): Update constructor.
356 (Layout::reset_relax_output): New method.
357 (Layout::clean_up_after_relaxation): Call it.
358 (Layout::prepare_for_relaxation): Update caller.
359 (Layout::set_segment_offsets): Update callers of set_section_addresses.
360 Call reset_relax_output before re-processing segments for
361 isolate_execinstr case.
362 (Layout::write_data): Handle relax_output_list_.
363 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
364 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
366 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
369 * object.h: Fix typos.
371 2013-08-16 Roland McGrath <mcgrathr@google.com>
373 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
374 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
376 2013-08-07 Cary Coutant <ccoutant@google.com>
378 Revert support for v2 DWP files:
380 2013-03-01 Cary Coutant <ccoutant@google.com>
382 Add dwp support for v2 DWARF package file format.
383 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
384 tu_length parameter. Adjust all callers.
385 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
386 * dwp.cc: Include dwarf.h.
387 (Section_bounds): New struct type.
388 (Unit_set): New struct type.
389 (Dwo_file::Dwo_file): Initialize new data member.
390 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
391 Combine and rename to...
392 (Dwo_file::read_unit_index): ...this.
393 (Dwo_file::sized_read_compunit_index)
394 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
395 (Dwo_file::sized_read_unit_index): ...this.
396 (Dwo_file::copy_section): Remove section_name, is_str_offsets
397 parameters; add section_id parameter.
398 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
399 (Dwo_file::add_unit_set): ...this.
400 (Dwo_file::shndx_map_): Remove.
401 (Dwo_file::sect_offsets_): New data member.
402 (Dwp_output_file::Dwp_output_file): Initialize new data members.
403 (Dwp_output_file::add_section): Rename to...
404 (Dwp_output_file::add_contribution): ...this.
405 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
406 (Dwp_output_file::add_tu_set): Likewise.
407 (Dwp_output_file::Contribution): New type.
408 (Dwp_output_file::Section::contributions): New data member.
409 (Dwp_output_file::Cu_or_tu_set): Remove.
410 (Dwp_output_file::Section::Section): New ctor.
411 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
412 (Dwp_output_file::Dwp_index::Section_table): New type.
413 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
414 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
416 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
417 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
418 (Dwp_output_file::Dwp_index::section_table): New member function.
419 (Dwp_output_file::Dwp_index::section_table_end): New member function.
420 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
421 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
422 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
423 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
424 (Dwp_output_file::Dwp_index::section_table_): New data member.
425 (Dwp_output_file::Dwp_index::section_mask_): New data member.
426 (Dwp_output_file::add_output_section): New member function.
427 (Dwp_output_file::write_new_section): New member function.
428 (Dwp_output_file::write_contributions): New member function.
429 (Dwp_output_file::section_id_map_): New data member.
430 (class Dwo_id_info_reader): Remove.
431 (class Unit_reader): New class.
432 (get_dwarf_section_name): New function.
433 (Dwo_file::read_executable): Adjust initializations of class data.
434 (Dwo_file::read): Add support for v2 package file format.
435 (Dwo_file::read_unit_index): Likewise.
436 (Dwo_file::sized_read_unit_index): Likewise.
437 (Dwo_file::copy_section): Likewise.
438 (Dwo_file::add_unit_set): Likewise.
439 (Dwp_output_file::add_output_section): Likewise.
440 (Dwp_output_file::add_contribution): Likewise.
441 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
443 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
445 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
447 (Dwp_output_file::initialize): Remove unused function.
448 (Dwp_output_file::finalize): Add support for v2 package file format.
449 (Dwp_output_file::write_index): Likewise.
450 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
453 2013-07-31 Cary Coutant <ccoutant@google.com>
455 * object.cc (Sized_relobj::do_output_section_address): New function.
456 (Sized_relobj): Instantiate explicitly.
457 * object.h (Object::output_section_address): New function.
458 (Object::do_output_section_address): New function.
459 (Sized_relobj::do_output_section_address): New function.
460 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
462 2013-07-30 Cary Coutant <ccoutant@google.com>
463 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
465 * parameters.cc (Parameters::entry): Return target-specific entry
467 * target.h (Target::entry_symbol_name): New function.
468 (Target_info::entry_symbol_name): New data member.
470 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
471 * i386.cc (Target_i386::i386_info): Likewise.
472 (Target_i386_nacl::i386_nacl_info): Likewise.
473 * sparc.cc (Target_sparc::sparc_info): Likewise.
474 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
475 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
476 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
477 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
479 2013-07-22 Sterling Augustine <saugustine@google.com>
481 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
482 Convert parameter shndx to local variable. Add parameters symtab
483 and symtab_size. Scan over section names. Find relocation
484 section corresponding to current section. Create and initialize
485 reloc_mapper_ and reloc_type_.
486 (Dwarf_pubnames_table::read_header): Add assertion. Change
487 unit_length to off_t. Initialize member unit_length_. Fill in field
489 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
490 Initialize new fields unit_length_ and cu_offset_.
491 (Dwarf_pubnames_table::read_section): Update prototype.
492 (Dwarf_pubnames_table::cu_offset): New member function.
493 (Dwarf_pubnames_table::subsection_size): Likewise.
494 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
496 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
497 member functions public.
498 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
499 Update comment. Rework logic. Move repeated parts to...
500 (Gdb_index_info_reader::read_pubtable): ...here. New function.
501 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
502 pubtypes_table_, and stmt_list_offset.
503 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
504 Gdb_index::find_pubtype_offset,
505 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
506 (Gdb_index::pubnames_read): Update prototype and rework logic.
507 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
509 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
510 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
511 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
512 Gdb_index::map_pubtable_to_dies):
514 (Gdb_index::pubnames_read): Update declaration.
515 (Gdb_index::Pubname_offset_map): New type.
516 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
517 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
518 Gdb_index::stmt_list_offset): Declare.
519 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
520 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
521 Gdb_index::pubtypes_offset_): Remove.
523 2013-07-19 Roland McGrath <mcgrathr@google.com>
525 * options.h (General_options): Add -Trodata-segment option.
526 * parameters.cc (Parameters::check_rodata_segment): New function.
527 (Parameters::set_target_once): Call it.
528 * parameters.h (Parameters): Declare it (private member function).
529 * layout.cc (load_seg_unusable_for_headers): New function, broken
530 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
531 then validate rodata segment rather than text segment.
532 (relaxation_loop_body): Call that.
533 (is_text_segment): New function. Don't admit a non-executable
534 segment if TARGET->isolate_execinstr().
535 (set_segment_offsets): Call it. Honor -Trodata-segment option.
537 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
540 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
541 * nacl.h (Sniff_file::View::View): Request aligned view.
543 2013-07-11 Cary Coutant <ccoutant@google.com>
545 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
546 correct BRLT entry size.
548 2013-07-03 Alan Modra <amodra@gmail.com>
550 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
553 2013-07-01 Cary Coutant <ccoutant@google.com>
555 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
557 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
558 (Dwarf_ranges_table::lookup_reloc): New function.
559 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
561 (Dwarf_ranges_table::lookup_reloc): New function.
562 (Dwarf_ranges_table::reloc_type_): New data member.
564 2013-06-27 Jing Yu <jingyu@google.com>
567 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
569 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
570 (Target_powerpc::do_relax): Call the above.
572 2013-06-27 Cary Coutant <ccoutant@google.com>
574 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
575 on garbage collected .opd section.
577 2013-06-27 Alan Modra <amodra@gmail.com>
579 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
581 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
582 (Target_powerpc::do_function_location): Likewise for loc->shndx.
584 2013-06-14 Cary Coutant <ccoutant@google.com>
586 * resolve.cc (Symbol::override_base): Don't override st_type
587 from plugin placeholder symbols.
588 (Symbol_table::resolve): Likewise.
589 (Symbol_table::should_override): Don't complain about TLS mismatch
590 if the TO symbol is a plugin placeholder.
591 * testsuite/Makefile.am (plugin_test_tls): New test.
592 * testsuite/Makefile.in: Regenerate.
593 * testsuite/plugin_test_tls.sh: New test script.
594 * testsuite/two_file_test_2_tls.cc: New test source.
595 * testsuite/two_file_test_tls.cc: New test source.
597 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
599 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
600 the maximum segment alignment is larger than the page size.
601 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
602 correctly aligns the symbols with large alignemnt.
603 * testsuite/Makefile.in: Regenerate.
604 * testsuite/large_symbol_alignment.cc: New file.
606 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
607 Sriraman Tallam <tmsriram@google.com>
609 * options.h (sort_section): New option.
610 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
611 Rename from Input_section_sort_section_name_special_ordering_compare.
612 (Input_section_sort_section_name_compare): New struct.
613 * output.cc (Output_section::Input_section_sort_section_name_compare::
614 operator()): New function.
615 (Output_section::sort_attached_input_sections): Use new sort function
616 for .text if --sort-section=name is specified.
617 * layout.cc (Layout::make_output_section):
618 Add sorting by name when --sort-section=name is specified.
619 * testsuite/Makefile.am (text_section_grouping): Test option
621 * testsuite/Makefile.in: Regenerate.
622 * testsuite/section_sorting_name.cc: New file.
623 * testsuite/section_sorting_name.sh: New file.
625 2013-05-21 Cary Coutant <ccoutant@google.com>
627 * symtab.h (Symbol::is_cxx_vtable): New function.
628 * target-reloc.h (relocate_section): Check for vtable symbol.
629 * testsuite/Makefile.am (missing_key_func.sh): New test case.
630 * testsuite/Makefile.in: Regenerate.
631 * testsuite/missing_key_func.cc: New test source.
632 * testsuite/missing_key_func.sh: New test script.
634 2013-05-21 Cary Coutant <ccoutant@google.com>
636 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
637 type of enclosing symbol.
638 (Relocate_info::location): Check symbol type when describing symbol.
639 * object.h (Symbol_location_info): Remove unused line_number;
640 add enclosing_symbol_type.
641 * testsuite/debug_msg.sh: Adjust expected output.
643 2013-05-13 Cary Coutant <ccoutant@google.com>
645 * configure.ac: Export DEFAULT_TARGET.
646 * configure: Regenerate.
647 * Makefile.in: Regenerate.
648 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
649 * testsuite/Makefile.in: Regenerate.
650 * testsuite/debug_msg.sh: Delete duplicate tests.
651 Don't check undef_int error message match for powerpc where the
652 source file and line number aren't available.
654 2013-05-10 Roland McGrath <mcgrathr@google.com>
656 * options.h (General_options): Add --rosegment-gap option.
657 * options.cc (finalize): --rosegment-gap implies --rosegment.
658 * layout.cc (set_segment_offsets): Let user option override
659 target->rosegment_gap().
661 2013-05-10 Roland McGrath <mcgrathr@google.com>
663 * options.h (General_options): Remove leading space from help
664 messages for -nostdlib and --rosegment.
666 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
669 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
671 2013-05-03 Alan Modra <amodra@gmail.com>
673 * merge.cc (Output_merge_string::do_add_input_section): Correct
674 scan for number of strings. Rename vars to avoid shadowing.
675 Include missing terminator in input_size_.
677 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
679 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
680 Restore empty string handling.
682 2013-05-01 Cary Coutant <ccoutant@google.com>
684 * stringpool.cc (Stringpool_template::new_key_offset): Fix
685 uninitialized warning.
687 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
689 * output.cc (Output_section::add_merge_input_section): Allow
690 to merge sections if the alignment is more than character size.
691 * merge.h (Output_merge_string::Output_merge_string): Remove
693 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
694 only not-null strings. Check the alignment of strings.
696 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
697 alignment as the argument.
698 (Stringpool_template<Stringpool_char>::addralign_): New class member.
699 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
700 Align non-zero length strings according to the addralign_.
701 (Stringpool_template<Stringpool_char>::set_string_offsets):
702 Updating offsets according to the given alignment.
703 * testsuite/Makefile.am (text_section_grouping): Test if string
704 literals are getting merged.
705 * testsuite/Makefile.in: Regenerate.
706 * testsuite/merge_string_literals_1.c: New file.
707 * testsuite/merge_string_literals_2.c: Ditto.
708 * testsuite/merge_string_literals.sh: Ditto.
710 2013-04-26 Ian Lance Taylor <iant@google.com>
712 * target-reloc.h (relocate_section): If the reloc offset is out of
713 range, pass VIEW as NULL to relocate.relocate.
714 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
715 * i386.cc (Target_i386::Relocate::relocate): Likewise.
716 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
717 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
718 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
719 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
721 2013-04-26 Geoff Pike <gpike@chromium.org>
723 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
724 * layout.cc (Hash_task): New class.
725 (Layout::queue_build_id_tasks): New function.
726 (Layout::write_build_id): Handle single-thread portion of build ID
727 computation. (In some cases, all of it is single-threaded.) Replace
728 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
729 functionality in fewer lines of code.
730 * layout.h (Layout::queue_build_id_tasks): New function declaration.
731 * options.h (General_options): make "--build-id" default to tree
732 rather than sha1. Add two new options related to --build-id=tree:
733 --build-id-chunk-size-for-treehash and
734 --build-id-min-file-size-for-treehash.
735 * Makefile.am: add testing of --build-id=tree and related new options
736 (these tests will be invoked by "make check").
737 * Makefile.in: Regenerate.
739 2013-04-25 Alan Modra <amodra@gmail.com>
741 * configure.tgt: Add powerpcle and powerpc64le.
743 2013-04-22 Alan Modra <amodra@gmail.com>
746 * layout.cc (Layout::segment_precedes): Allow more than one
747 segment with the same type and flags.
749 2013-04-15 Cary Coutant <ccoutant@google.com>
751 * layout.cc (Layout::set_relocatable_section_offsets): Don't
752 allocate space in file for BSS sections.
754 2013-04-15 Cary Coutant <ccoutant@google.com>
756 * script-sections.cc (Orphan_output_section): Reset address
757 to zero after each orphaned section for relocatable links.
759 2013-04-15 Cary Coutant <ccoutant@google.com>
761 * symtab.cc (Symbol_table::sized_write_globals): Subtract
762 section starting address for relocatable link.
763 * testsuite/Makefile.am (script_test_11): New test.
764 * testsuite/Makefile.in: Regenerate.
765 * testsuite/script_test_11.c: New source file.
766 * testsuite/script_test_11.t: New linker script.
768 2013-04-13 Alan Modra <amodra@gmail.com>
770 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
771 owner when sections are not adjacent and exceed group size.
772 (Target_powerpc::group_sections): Handle corner case.
773 (Target_powerpc::Branch_info::make_stub): Handle case where
774 stub table doesn't exist due to branches in non-exec sections.
775 (Target_powerpc::Relocate::relocate): Likewise.
777 2013-04-11 Alan Modra <amodra@gmail.com>
780 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
781 .branch_lt to match bfd ld. Adjust comments throughout file.
783 2013-04-04 Ian Lance Taylor <iant@google.com>
786 * object.cc (do_layout_deferred_sections): Handle .eh_frame
787 sections before checking whether they are included in the link.
789 2013-03-29 Sriraman Tallam <tmsriram@google.com>
791 * archive.cc (Archive::get_elf_object_for_member): Create the elf
792 object before calling the plugin claim_file handler. Pass the elf
793 object of the archive to the plugin. Delete the elf object if the
794 plugin claims the file.
796 2013-03-21 Alan Modra <amodra@gmail.com>
798 * layout.cc (Layout::set_segment_offsets): Accept writable .text
801 2013-03-21 Alan Modra <amodra@gmail.com>
803 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
805 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
806 uninitialized" warning.
808 2013-03-20 Alan Modra <amodra@gmail.com>
810 * symtab.h (Symbol::clear_version): New function.
811 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
812 is_needed by weak references. Clear version for symbols defined
813 in as-needed objects that are not needed.
815 2013-03-15 Alan Modra <amodra@gmail.com>
817 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
818 static and public. Add report_err param. Return false for data refs.
819 (Target_powerpc::rela_dyn_section): New overloaded function.
820 (Target_powerpc::plt_, iplt_): Elucidate.
821 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
822 (Output_data_plt_powerpc::do_write): Don't write .iplt.
823 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
824 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
825 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
826 push_branch and make_plt_entry for ifunc syms when
827 reloc_needs_plt_for_ifunc.
828 (Target_powerpc::Relocate::relocate): Don't use plt entry value
829 for ifunc unless reloc_needs_plt_for_ifunc.
831 2013-03-15 Alan Modra <amodra@gmail.com>
833 * gc.h (gc_process_relocs): Don't look through function descriptors.
834 * icf.cc (get_section_contents): Do so here instead.
836 2013-03-13 Alan Modra <amodra@gmail.com>
838 * powerpc.cc (is_branch_reloc): Forward declare.
839 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
840 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
841 false for 64-bit, true for 32-bit non-branch relocs.
842 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
843 * testsuite/Makefile.am (icf_test): Use linker map file instead of
845 (icf_safe_test): Generate linker map file as well as nm output.
846 (icf_safe_so_test): Likewise.
847 * testsuite/Makefile.in: Regenerate.
848 * testsuite/icf_test.sh: Parse linker map file to determine
850 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
851 * testsuite/icf_safe_so_test.sh: Likewise.
852 (X86_32_or_ARM_specific_safe_fold): Merge into..
853 (arch_specific_safe_fold): ..this.
854 (X86_64_specific_safe_fold): Delete unused function.
856 2013-03-12 Alan Modra <amodra@gmail.com>
858 * gc.h (gc_process_relocs): Look through function descriptors
859 to determine shndx, symvalue and addend used by ICF. Tidy
860 variable duplication.
862 2013-03-11 Alan Modra <amodra@gmail.com>
864 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
865 * layout.cc (Layout_task_runner::run): ..to here.
866 * symtab.h (struct Symbol_location): Extract from..
867 (class Symbol_table): ..here.
868 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
869 * target.h (class Target): Add function_location and
870 do_function_location functions.
871 (class Sized_target): Add do_function_location.
872 * object.h (class Sized_relobj_file): Move find_shdr..
873 (class Object): ..to here.
874 * object.cc: Likewise. Update to suit. Instantiate.
875 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
876 * powerpc.cc (class Powerpc_dynobj): New.
877 (Target_powerpc::do_function_location): New function.
878 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
879 (Powerpc_dynobj::do_read_symbols): New function.
880 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
882 2013-03-08 Ian Lance Taylor <iant@google.com>
884 * options.cc (General_options::string_to_object_format): Accept
887 2013-03-08 Alan Modra <amodra@gmail.com>
889 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
891 (struct Post_fde): Move definition to here..
892 * ehframe.cc (struct Post_fde): ..from here.
893 (Cie::write): Don't alloc Post_fde.
894 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
896 2013-03-07 Alan Modra <amodra@gmail.com>
898 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
899 relocation referencing .LC0.
900 * testsuite/discard_locals_test.sh: Remove FIXMEs.
902 2013-03-07 Alan Modra <amodra@gmail.com>
904 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
905 always_inline. Add assembly for powerpc to avoid GOT.
907 2013-03-07 Alan Modra <amodra@gmail.com>
909 * testsuite/script_test_10.sh: Don't test .bss section
912 2013-03-06 Alan Modra <amodra@gmail.com>
914 * powerpc.cc (class Powerpc_relobj): Move some member functions.
915 (Target_powerpc::symval_for_branch): Add symtab param. Update
916 all callers. Handle folded sections.
917 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
919 (Global_symbol_visitor_opd::operator()): Likewise.
921 2013-03-04 Alan Modra <amodra@gmail.com>
923 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
924 * testsuite/Makefile.in: Regenerate.
926 2013-03-01 Cary Coutant <ccoutant@google.com>
928 Add dwp support for v2 DWARF package file format.
929 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
930 tu_length parameter. Adjust all callers.
931 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
932 * dwp.cc: Include dwarf.h.
933 (Section_bounds): New struct type.
934 (Unit_set): New struct type.
935 (Dwo_file::Dwo_file): Initialize new data member.
936 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
937 Combine and rename to...
938 (Dwo_file::read_unit_index): ...this.
939 (Dwo_file::sized_read_compunit_index)
940 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
941 (Dwo_file::sized_read_unit_index): ...this.
942 (Dwo_file::copy_section): Remove section_name, is_str_offsets
943 parameters; add section_id parameter.
944 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
945 (Dwo_file::add_unit_set): ...this.
946 (Dwo_file::shndx_map_): Remove.
947 (Dwo_file::sect_offsets_): New data member.
948 (Dwp_output_file::Dwp_output_file): Initialize new data members.
949 (Dwp_output_file::add_section): Rename to...
950 (Dwp_output_file::add_contribution): ...this.
951 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
952 (Dwp_output_file::add_tu_set): Likewise.
953 (Dwp_output_file::Contribution): New type.
954 (Dwp_output_file::Section::contributions): New data member.
955 (Dwp_output_file::Cu_or_tu_set): Remove.
956 (Dwp_output_file::Section::Section): New ctor.
957 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
958 (Dwp_output_file::Dwp_index::Section_table): New type.
959 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
960 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
962 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
963 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
964 (Dwp_output_file::Dwp_index::section_table): New member function.
965 (Dwp_output_file::Dwp_index::section_table_end): New member function.
966 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
967 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
968 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
969 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
970 (Dwp_output_file::Dwp_index::section_table_): New data member.
971 (Dwp_output_file::Dwp_index::section_mask_): New data member.
972 (Dwp_output_file::add_output_section): New member function.
973 (Dwp_output_file::write_new_section): New member function.
974 (Dwp_output_file::write_contributions): New member function.
975 (Dwp_output_file::section_id_map_): New data member.
976 (class Dwo_id_info_reader): Remove.
977 (class Unit_reader): New class.
978 (get_dwarf_section_name): New function.
979 (Dwo_file::read_executable): Adjust initializations of class data.
980 (Dwo_file::read): Add support for v2 package file format.
981 (Dwo_file::read_unit_index): Likewise.
982 (Dwo_file::sized_read_unit_index): Likewise.
983 (Dwo_file::copy_section): Likewise.
984 (Dwo_file::add_unit_set): Likewise.
985 (Dwp_output_file::add_output_section): Likewise.
986 (Dwp_output_file::add_contribution): Likewise.
987 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
989 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
991 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
993 (Dwp_output_file::initialize): Remove unused function.
994 (Dwp_output_file::finalize): Add support for v2 package file format.
995 (Dwp_output_file::write_index): Likewise.
996 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
999 2013-03-01 Cary Coutant <ccoutant@google.com>
1001 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1002 function into class definition in header file.
1003 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1004 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1006 (Dwarf_info_reader::check_buffer): Move here from .cc file.
1008 2013-02-28 Alan Modra <amodra@gmail.com>
1010 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1011 * target.cc (Target::do_plt_fde_location): New function.
1012 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1013 accessor function, and constructor param.
1014 (struct Post_fde, Post_fdes): Declare.
1015 (Cie::write): Add post_fdes param.
1016 * ehframe.cc (Fde::write): Use plt_fde_location.
1017 (struct Post_fde): Define.
1018 (Cie::write): Stash FDEs added post merge mapping.
1019 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1020 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
1021 (Eh_frame::do_sized_write): Arrange to write post map FDES after
1023 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1024 (Target_powerpc::has_glink): New function.
1025 (Target_powerpc::do_relax): Add eh_frame info for stubs.
1026 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1027 glink_eh_frame_fde_32, default_fde): New data.
1028 (Stub_table::eh_frame_added_): New var.
1029 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1031 (Stub_table::add_eh_frame): New function.
1032 (Output_data_glink::add_eh_frame): New function.
1033 (Target_powerpc::make_glink_section): Call add_eh_frame.
1035 2013-02-15 Ian Lance Taylor <iant@google.com>
1037 * options.h (DEFINE_uint64_alias): Define.
1038 (class General_options): Add -Ttext-segment as an alias for
1041 2013-02-15 Alan Modra <amodra@gmail.com>
1043 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1044 (Stub_table::do_write): ..here, two places.
1045 (Stub_table::plt_call_size): Use it here too.
1047 2013-02-11 Ian Lance Taylor <iant@google.com>
1049 * descriptors.cc (Descriptors::close_all): New function.
1050 * descriptors.h (class Descriptors): Declare close_all.
1051 (close_all_descriptors): New inline function.
1052 * plugin.cc: Include "descriptors.h".
1053 (Plugin_manager::cleanup): Call close_all_descriptors.
1055 2013-02-06 Alan Modra <amodra@gmail.com>
1057 * README: Update coding style link.
1059 2013-01-28 Cary Coutant <ccoutant@google.com>
1061 * dwp.cc (File_list): New typedef.
1062 (Dwo_name_info_reader): New class.
1063 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1064 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1065 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1066 (Dwo_file::read_executable): New function.
1067 (Dwo_file::read): Move common setup code to ...
1068 (Dwo_file::make_object): ... here.
1069 (dwp_options): Add --exec/-e.
1073 2013-01-24 Sriraman Tallam <tmsriram@google.com>
1075 * layout.cc (Layout::layout): Check for option text_reorder.
1076 (Layout::make_output_section): Ditto.
1077 * options.h (text_reorder): New option.
1078 * output.cc (Input_section_sort_compare): Remove special ordering
1081 Input_section_sort_section_name_special_ordering_compare::
1082 operator()): New function.
1083 (Output_section::sort_attached_input_sections): Use new sort function
1085 * output.h (Input_section_sort_section_name_special_ordering_compare):
1087 * testsuite/Makefile.am (text_section_grouping): Test option
1089 * testsuite/Makefile.in: Regenerate.
1090 * testsuite/text_section_grouping.sh: Check order of functions without
1091 default text reordering.
1093 2013-01-18 Mike Frysinger <vapier@gentoo.org>
1095 * options.h (General_options): Change default to true for new_dtags.
1097 2013-01-18 Mike Frysinger <vapier@gentoo.org>
1099 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1100 when enable_new_dtags is false. Only add DT_RUNPATH when
1101 enable_new_dtags is true.
1103 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
1105 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1106 used in declaration and definition consistent.
1107 (Target_powerpc::symval_for_branch): Ditto.
1109 2013-01-16 Sriraman Tallam <tmsriram@google.com>
1111 * testsuite/plugin_final_layout.cc: Fix comment.
1113 2013-01-16 Sriraman Tallam <tmsriram@google.com>
1115 * layout.cc (Layout::layout): Do not do default sorting for
1116 text sections when section ordering is specified.
1117 (make_output_section): Ditto.
1118 * testsuite/plugin_final_layout.cc: Name the function sections
1119 to catch reordering issues.
1121 2013-01-15 Alan Modra <amodra@gmail.com>
1123 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1126 2013-01-15 Alan Modra <amodra@gmail.com>
1128 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1129 * testsuite/Makefile.in: Regenerate.
1131 2013-01-14 Alan Modra <amodra@gmail.com>
1133 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1134 * testsuite/Makefile.in: Regenerate.
1136 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
1139 Fix mingw gold build with plugins enabled
1140 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1141 * configure.ac: Export DLOPEN_LIBS and add headers check.
1142 * plugin.cc: Handle non-dlfcn case.
1143 * Makefile.in: Regenerate.
1144 * config.in: Regenerate.
1145 * configure: Regenerate.
1146 * testsuite/Makefile.in: Regenerate.
1148 2013-01-09 Sriraman Tallam <tmsriram@google.com>
1150 * output.h (sort_attached_input_sections): Change to be public.
1151 * script-sections.cc
1152 (Output_section_definition::set_section_addresses): Sort
1153 attached input sections according to section order before linker
1154 script assigns section addresses.
1155 (Orphan_output_section::set_section_addresses): Sort
1156 attached input sections according to section order before linker
1157 script assigns section addresses.
1158 * Makefile.am (final_layout.sh): Use a simple linker script to
1159 check if section ordering still works.
1160 * Makefile.in: Regenerate.
1162 2013-01-09 Ben Cheng <bccheng@google.com>
1164 * arm.cc (Target_arm::attributes_accept_div): New function.
1165 (Target_arm::attributes_forbid_div): New function.
1166 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1167 attribute using the same new functions as what bfd/elf32_arm.c
1170 2013-01-07 Cary Coutant <ccoutant@google.com>
1173 * output.cc (Output_section::add_input_section): For incremental
1174 updates, don't track input sections that are allocated from patch
1177 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
1178 Ian Lance Taylor <iant@google.com>
1181 * configure.ac (--enable-ld): Removed.
1182 (install_as_default): Set to yes only for --enable-gold=default
1184 * configure: Regenerated.
1186 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
1188 * options.h (General_options): Add -fuse-ld= for GCC linker
1189 option compatibility.
1191 2013-01-04 Cary Coutant <ccoutant@google.com>
1193 * configure.ac: Fix typo restoring CXXFLAGS.
1194 * configure: Regenerate.
1196 2013-01-04 Cary Coutant <ccoutant@google.com>
1198 * testsuite/Makefile.am (CXXLINK_S): New macro.
1199 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1200 * testsuite/Makefile.in: Regenerate.
1202 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
1204 * version.cc (print_version): Update copyright year to 2013.
1206 2012-12-20 Ian Lance Taylor <iant@google.com>
1208 * layout.cc (Layout::special_ordering_of_input_section): New
1210 (Layout::layout): If input section requires special ordering, must
1211 sort input sections.
1212 (Layout::make_output_section): May sort .text input sections.
1213 (Layout::is_section_name_prefix_grouped): Remove.
1214 * layout.h (class Layout): Declare
1215 special_ordering_of_input_section. Don't declare
1216 is_section_name_prefix_grouped.
1217 * output.cc (Output_section::add_input_section): Revert last
1219 (Output_section::Input_section_sort::match_file_name): Don't crash
1220 if called on output section data.
1221 (Output_section::Input_section_sort_compare): Sort based on
1223 (Output_section::Input_section_sort_section_order_index_compare):
1225 (Output_section::sort_attached_input_sections): Likewise.
1227 2012-12-18 Sriraman Tallam <tmsriram@google.com>
1229 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1230 * layout.h (Layout::is_section_name_prefix_grouped): New function.
1231 * output.cc (Output_section::add_input_section): Check if section
1232 name contains special prefix. Keep input sections to sort such
1234 (Output_section::Input_section_sort_section_order_index_compare
1235 ::operator()): Group sections according to prefixes.
1236 (Output_section::sort_attached_input_sections): Add condition to
1237 Input_section_entry constructor call.
1238 * testsuite/Makefile.am (text_section_grouping): New test.
1239 * testsuite/Makefile.in: Regenerate.
1240 * testsuite/text_section_grouping.cc: New file.
1241 * testsuite/text_section_grouping.sh: New file.
1243 2012-12-17 Nick Clifton <nickc@redhat.com>
1245 * Makefile.am: Add copyright notice.
1248 * configure.ac: Likewise.
1249 * ftruncate.c: Likewise.
1250 * Makefile.in: Regenerate.
1252 2012-12-14 Cary Coutant <ccoutant@google.com>
1254 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1255 --no-as-needed flag.
1256 (exception_separate_shared_12_test): Likewise.
1257 (incremental_copy_test): Likewise.
1258 * testsuite/Makefile.in: Regenerate.
1260 2012-12-14 Cary Coutant <ccoutant@google.com>
1262 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1263 (Dwp_output_file::Dwp_index::enter_set): Add assert.
1265 2012-12-12 Alan Modra <amodra@gmail.com>
1267 * powerpc.cc (class Track_tls): New.
1268 (class Relocate, class Scan): Inherit Track_tls.
1269 (Target_powerpc::Scan::local, global): Track tls optimization
1270 and avoid creating plt entry for __tls_get_addr if all uses
1272 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1274 2012-12-12 Alan Modra <amodra@gmail.com>
1276 * options.h (General_options): Add --toc-sort/--no-toc-sort.
1277 Replace no_toc_optimize with toc_optimize.
1278 * output.h (Output_section::input_sections): Provide non-const variant.
1279 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1280 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1282 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1283 (class Sort_toc_sections): New.
1284 (Target_powerpc::do_finalize_sections): Sort toc sections.
1285 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1287 2012-12-10 Roland McGrath <mcgrathr@google.com>
1289 * testsuite/binary_unittest.cc (read_all): New function.
1290 (Sized_binary_test): Use it instead of ::read.
1291 * fileread.cc (do_read): Don't assume pread always reads the whole
1292 amount in a single call.
1294 2012-12-10 Alan Modra <amodra@gmail.com>
1296 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1297 Set EM_PPC64 or EM_PPC here.
1298 (Target_selector_powerpc::do_recognize): Delete.
1300 2012-12-10 Alan Modra <amodra@gmail.com>
1302 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1304 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1306 2012-12-07 Roland McGrath <mcgrathr@google.com>
1308 * testsuite/binary_unittest.cc (Sized_binary_test):
1309 Use open_descriptor rather than ::open.
1311 2012-12-07 Alan Modra <amodra@gmail.com>
1313 * powerpc.cc (Stub_table::do_write): Delete redundant Address
1314 typedef and invalid_address constant.
1315 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1316 instantiate constants.
1318 2012-12-06 Roland McGrath <mcgrathr@google.com>
1320 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1321 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1322 * aclocal.m4: Regenerate.
1323 * configure: Regenerate.
1324 * Makefile.in: Regenerate.
1325 * testsuite/Makefile.in: Regenerate.
1327 2012-12-07 Alan Modra <amodra@gmail.com>
1329 * options.h (General_options): Add no_toc_optimize.
1330 * powerpc.cc (ok_lo_toc_insn): New function.
1331 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1333 2012-12-06 Alan Modra <amodra@gmail.com>
1335 * options.h (General_options): Add plt_align, plt_static_chain,
1336 plt_thread_safe. Update stub_group_size help text.
1337 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1338 for new plt_thread_safe_ var.
1339 (use_plt_offset): Correct comments.
1340 (Target_powerpc::do_relax): Look for thread creation symbols to
1341 determine default plt_thread_safe value. Clear plt call stubs
1342 as well as branch stubs each iteration.
1343 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1345 (l, hi, ha, write_insn): Move earlier.
1346 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1347 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1349 (Stub_table::update_size): Adjust.
1350 (Stub_table::prev_size, set_prev_size): Delete.
1351 (Stub_table::stub_align): Let --plt-align affect result.
1352 (Stub_table::plt_call_size): Calculate sizes for various stubs.
1353 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1354 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1355 (Stub_table::do_write): Support more stub variants.
1357 2012-12-04 Alan Modra <amodra@gmail.com>
1359 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1360 (Target_powerpc::do_define_standard_symbols): New function.
1362 2012-12-03 Alan Modra <amodra@gmail.com>
1364 * output.h: Formatting, whitespace.
1366 2012-12-03 Alan Modra <amodra@gmail.com>
1368 * layout.h (Layout::get_executable_sections): Declare.
1369 * layout.cc (Layout::get_executable_sections): New function.
1370 * arm.cc (Target_arm::group_sections): Use it.
1371 (Arm_output_section::group_sections): Delete now redundant test.
1372 * output.cc (Output_reloc::Output_reloc): Add is_relative.
1373 param to handle relative relocs.
1374 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1375 (Output_data_reloc::add_absolute): Adjust.
1376 (Output_data_reloc::add_relative): New function.
1377 (Output_data::reset_data_size): New function.
1378 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1379 (Output_section::set_addralign): New function.
1380 (Output_section::checkpoint_set_addralign): New function.
1381 (Output_section::clear_section_offsets_need_adjustment): New function.
1382 (Output_section::input_sections): Make public.
1383 * powerpc.cc (class Output_data_brlt_powerpc): New.
1384 (class Stub_table, class Stub_control): New.
1385 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1386 stub_table_, set_stub_table, stub_table): New vectors and accessor
1388 (Target_powerpc::do_may_relax, do_relax, push_branch,
1389 new_stub_table, stub_tables, brlt_section, group_sections,
1390 add_branch_lookup_table, find_branch_lookup_table,
1391 write_branch_lookup_table, make_brlt_section): New functions.
1392 (Target_powerpc::struct Sort_sections, class Branch_info): New.
1393 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1394 branch_info_): New vars.
1395 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1396 make call stubs here.
1397 (Output_data_glink): Remove all call stub handling from this class.
1398 (Target_powerpc::Scan::local, global): Save interesting branch
1399 relocs and relocs for ifunc. Adjust calls to plt entry functions.
1400 (Target_powerpc::do_finalize_sections): Only make reg save/restore
1401 functions on final link.
1402 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1403 Handle long branch destinations too.
1404 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1405 do_plt_address_for_local): Adjust lookup of plt call stubs.
1407 2012-11-30 Alan Modra <amodra@gmail.com>
1409 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1410 relocs against protected symbols when building 32-bit shared libs.
1412 2012-11-30 Alan Modra <amodra@gmail.com>
1414 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1415 param. Call got_section() to make .got. Update all callers
1416 and their callers and so on.
1418 2012-11-30 Alan Modra <amodra@gmail.com>
1420 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1421 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1422 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1423 value if it already exists.
1425 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
1428 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1430 2012-11-14 Roland McGrath <mcgrathr@google.com>
1432 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1433 than bfc instruction for data sandboxing.
1435 2012-11-08 Alan Modra <amodra@gmail.com>
1437 * po/POTFILES.in: Regenerate.
1439 2012-11-05 Alan Modra <amodra@gmail.com>
1441 * configure.ac: Apply 2012-09-10 change to config.in here.
1442 * configure: Regenerate.
1444 2012-11-05 Alan Modra <amodra@gmail.com>
1446 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1447 (struct Opd_ent): Use "Address" rather than "Offset".
1448 (Output_data_got_powerpc::got_base_offset): Return Valtype.
1449 (Target_powerpc::got_section): Make public.
1450 (Target_powerpc::scan_relocs): Move code setting symbols..
1451 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1452 Create _SDA_BASE_ only when referenced.
1454 2012-11-02 Roland McGrath <mcgrathr@google.com>
1456 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1459 2012-11-01 Roland McGrath <mcgrathr@google.com>
1461 * target.h (Sized_target::relocate_relocs): Use Elf_Off
1462 for offset_in_output_section parameter.
1463 (Sized_target::relocate_special_relocatable): Likewise.
1464 * arm.cc (Target_arm::relocate_relocs): Likewise.
1465 (Target_arm::relocate_special_relocatable): Likewise.
1466 * i386.cc (Target_i386::relocate_relocs): Likewise.
1467 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1468 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1469 * target-reloc.h (relocate_relocs): Likewise.
1470 * testsuite/testfile.cc (Target_test): Likewise.
1471 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1472 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1474 * system.h: Move inclusion of <clocale> to after <libintl.h> in
1475 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1477 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1478 parameter, which is unused in the [!F_SETFD] case.
1480 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1481 SYMNDX to off_t before comparing it to this->data_size().
1482 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1483 * incremental.cc (Output_section_incremental_inputs::do_write):
1484 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1486 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1488 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
1490 * gold.cc (Target_arm::do_adjust_elf_header): Add the
1491 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1494 2012-10-29 Cary Coutant <ccoutant@google.com>
1496 * dwp.cc (usage): Add file and exit status parameters;
1497 add --help and --version options.
1498 (print_version): New function.
1499 (main): Add --help and --version options.
1501 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1503 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1504 final_layout_sequence.txt.
1505 * testsuite/Makefile.in: Regenerated.
1507 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1509 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1510 COMPILE generated by automake.
1512 (CXXCOMPILE1): Likewise.
1513 (CXXLINK1): Likewise.
1514 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1516 (CXXCOMPILE): Likewise.
1517 (CXXLINK): Likewise.
1518 * testsuite/Makefile.in: Regenerated.
1520 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1522 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1523 on bad fwrite return.
1525 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1527 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1530 2012-10-23 Cary Coutant <ccoutant@google.com>
1532 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1533 * testsuite/Makefile.in: Regenerate.
1534 * testsuite/dwp_test.h: New source file.
1535 * testsuite/dwp_test_1.cc: New source file.
1536 * testsuite/dwp_test_1.s: New source file.
1537 * testsuite/dwp_test_1.sh: New source file.
1538 * testsuite/dwp_test_1b.cc: New source file.
1539 * testsuite/dwp_test_1b.s: New source file.
1540 * testsuite/dwp_test_2.cc: New source file.
1541 * testsuite/dwp_test_2.s: New source file.
1542 * testsuite/dwp_test_2.sh: New source file.
1543 * testsuite/dwp_test_main.cc: New source file.
1544 * testsuite/dwp_test_main.s: New source file.
1546 2012-10-23 Cary Coutant <ccoutant@google.com>
1548 * dwp.h: New header file.
1549 * dwp.cc: New source file.
1550 * gold.h: Move shared declarations to system.h.
1551 * system.h: New header file.
1552 * Makefile.am: Add dwp.
1553 * Makefile.in: Regenerate.
1555 2012-10-23 Cary Coutant <ccoutant@google.com>
1557 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1558 Dwarf_info_reader::read_from_pointer.
1559 (Dwarf_pubnames_table::read_header): Likewise.
1560 (Dwarf_pubnames_table::next_name): Likewise.
1561 (Dwarf_die::read_attributes): Likewise.
1562 (Dwarf_die::skip_attributes): Likewise.
1563 (Dwarf_info_reader::read_from_pointer): New function template.
1564 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1565 (Dwarf_pubnames_table): Likewise.
1566 (Dwarf_info_reader::read_from_pointer): New function template.
1567 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1568 Dwarf_pubnames_table ctor.
1570 2012-10-23 Cary Coutant <ccoutant@google.com>
1572 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1574 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1576 (Dwarf_info_reader::set_abbrev_shndx): New method.
1577 (Dwarf_info_reader::abbrev_shndx_): New data member.
1579 2012-10-23 Cary Coutant <ccoutant@google.com>
1581 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1582 from object, not parameters.
1583 (Dwarf_info_reader::parse): Likewise.
1584 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1585 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1586 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1589 2012-10-23 Cary Coutant <ccoutant@google.com>
1591 * fileread.cc (Input_file::Input_file): New constructor.
1592 * fileread.h (class Input_file): Add new constructor.
1594 2012-10-18 Alan Modra <amodra@gmail.com>
1597 * object.cc (Relobj::is_section_name_included): Also match
1598 .sdata personality section.
1600 2012-10-18 Alan Modra <amodra@gmail.com>
1602 * target-reloc.h (class Default_comdat_behavior): New, package up..
1603 (get_comdat_behaviour): ..this.
1604 (relocate_section): Add Relocate_comdat_behavior template arg,
1605 adjust code to suit.
1606 * arm.cc (Target_arm::relocate_section): Adjust to suit.
1607 (Target_arm::scan_reloc_section): Likewise.
1608 * i386.cc (Target_i386::relocate_section): Likewise.
1609 * sparc.cc (Target_sparc::relocate_section): Likewise.
1610 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1611 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1612 * powerpc.cc (class Relocate_comdat_behavior): New.
1613 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
1614 gold::relocate_section with new template arg.
1616 2012-10-18 Alan Modra <amodra@gmail.com>
1618 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1619 dynamic relocs for GOT_TPREL got entries, without symbol if
1621 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1622 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1623 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1625 2012-10-17 Alan Modra <amodra@gmail.com>
1628 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1630 2012-10-16 Sriraman Tallam <tmsriram@google.com>
1632 * layout.cc (Layout::include_section): Keep sections marked
1633 SHF_EXCLUDE when doing relocatable links.
1635 2012-10-16 Alan Modra <amodra@gmail.com>
1637 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1638 (Target_powerpc::do_finalize_sections): Call it.
1639 (Output_data_save_res): New class and supporting functions.
1640 (Target_powerpc::symval_for_branch): Only look up .opd entry for
1641 normal symbols defined in object files.
1643 2012-10-12 Alan Modra <amodra@gmail.com>
1645 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1646 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
1647 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1648 section if scan_opd_relocs not yet called.
1649 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1651 2012-10-12 Alan Modra <amodra@gmail.com>
1653 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1654 add_local_ifunc_entry): Revert last change.
1655 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1657 2012-10-05 Alan Modra <amodra@gmail.com>
1659 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1660 do_plt_address_for_global): New functions.
1661 (Output_data_got_powerpc::do_write): Don't segfault when linking
1663 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1664 add_local_ifunc_entry): Return true on adding entry..
1665 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1666 glink->add_entry call. Remove unused symtab param. Adjust calls.
1667 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1668 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
1669 set up symbols here.
1670 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1671 syms here. Do so even when no .iplt. Don't segfault when linking
1673 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
1674 new variants without reloc param.
1675 (Glink_sym_ent::Glink_sym_ent): Likewise.
1676 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1677 reloc when refs will resolve to plt call stub.
1678 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
1679 R_PPC_PLTREL24 to resolve locally.
1680 (Target_powerpc::Scan::global): Correct ifunc handling.
1681 (Target_powerpc::Relocate::relocate): Correct local sym glink
1682 lookup. Don't destroy "value" when we have a plt call stub,
1683 and when checking plt call validity.
1684 (Target_powerpc::do_dynsym_value): Simplify.
1686 2012-10-05 Alan Modra <amodra@gmail.com>
1688 * i386.cc (Output_data_plt_i386::address_for_global,
1689 address_for_local): Add plt offset to returned value. Adjust uses.
1690 * sparc.cc (Output_data_plt_sparc::address_for_global,
1691 address_for_local): Likewise.
1692 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1693 address_for_local): Likewise.
1694 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1695 address_for_local): Likewise.
1696 * target.h (Target::plt_address_for_global, plt_address_for_local):
1698 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1699 (Output_data_got::Got_entry::write): Nor here.
1700 * output.h: Comment fix.
1702 2012-10-02 Jiong Wang <jiwang@tilera.com>
1704 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1705 global_offset_table_ value for larget got.
1706 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1708 2012-09-29 Alan Modra <amodra@gmail.com>
1710 * powerpc.cc (Target_powerpc::iplt_): New output section.
1711 (Target_powerpc::iplt_section, make_iplt_section,
1712 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1713 (Target_powerpc::make_plt_entry): Handle ifunc syms.
1714 Target_powerpc::plt_entry_count): Count iplt entries too.
1715 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1716 reloc section in constructor. New params.
1717 (Target_powerpc::make_plt_section): Create reloc section here instead.
1718 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1720 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1721 (Output_data_glink::add_entry, find_entry): New functions to
1722 deal with local syms.
1723 (Glink_sym_ent): Add support for local syms.
1724 (Output_data_glink::do_write): Handle ifunc plt entries.
1725 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1726 (Target_powerpc::Scan::local, global): Handle ifunc syms.
1727 (Target_powerpc::Relocate::relocate): Likewise.
1728 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1730 2012-09-25 Alan Modra <amodra@gmail.com>
1732 * object.h (Sized_relobj_file::adjust_local_symbol,
1733 do_adjust_local_symbol): New functions.
1734 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1735 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1736 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1737 and irregular opd entry spacing.
1738 (Powerpc_relobj::do_read_relocs): Add opd size checks.
1739 (Global_symbol_visitor_opd): New functor.
1740 (Target_powerpc::do_finalize_sections): Omit global symbols defined
1741 on deleted opd entries.
1743 2012-09-15 Jiong Wang <jiwang@tilera.com>
1745 * tilegx.cc: New file.
1746 * Makefile.am (TARGETSOURCES): Add tilegx.cc
1747 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1748 * configure.tgt: Add entries for tilegx*.
1749 * configure.ac: Likewise.
1750 * Makefile.in: Rebuild.
1751 * configure: Likewise.
1752 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1755 2012-09-13 Alan Modra <amodra@gmail.com>
1757 * target-reloc.h (scan_relocs): Call scan.local for relocs
1758 against symbols in discarded sections. Pass is_discarded
1760 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1761 Add is_discarded param.
1762 * powerpc (Target_powerpc::Scan::local): Likewise. Use
1763 is_discarded to flag opd entry as discarded. Don't emit dyn
1764 relocs on such entries.
1765 (Target_powerpc::Scan::global): Similarly detect and handle
1767 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1768 opd_ent_. Update all uses.
1769 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1770 (Target_powerpc::relocate_section): Zero out discarded opd
1773 2012-09-12 Ian Lance Taylor <iant@google.com>
1776 * output.cc: Rename Output_data_got template parameter from size
1777 to got_size for all functions. Compile all variants of
1779 (Output_data_got::Got_entry::write): Correct use of size for
1780 symbol value. Use local_is_tls rather than casting to
1782 * object.h (class Object): Add local_is_tls and do_local_is_tls.
1783 (class Sized_relobj_file): Add do_local_is_tls.
1784 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1786 2012-09-11 Alan Modra <amodra@gmail.com>
1789 * layout.cc (Layout::set_segment_offsets): When using
1790 common-page-size alignment, ensure we are on a new max-page-size
1792 * output.cc (Output_segment::set_section_addresses): Use
1793 abi_pagesize, not common_pagesize for relro boundary.
1794 (Output_segment::set_offset): Likewise.
1796 2012-09-11 Alan Modra <amodra@gmail.com>
1798 * output.h (Output_data_got::add_global_tls, add_local_tls,
1799 add_local_tls_pair): New functions.
1800 (Output_data_got::add_local_pair_with_rel): Remove second
1801 reloc param. Expand comment.
1802 (Output_data_got::Got_entry): Rename use_plt_offset_ to
1803 use_plt_or_tls_offset_, similarly for constructor param.
1804 (Output_data_got::Got_entry::write): Add got_index param.
1805 * output.cc (Output_data_got::add_global_tls, add_local_tls,
1806 add_local_tls_pair): New functions.
1807 (Output_data_got::Got_entry::write): Handle tls symbols
1808 with use_plt_or_tls_offset_ set specially.
1809 (Output_data_got::add_local_pair_with_rel): Only one reloc.
1810 (Output_data_got::do_write): Replace iterator with index, pass
1811 index to entry write function.
1812 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1813 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1814 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1816 * i386.cc (Target_i386::Scan::local): Likewise.
1817 * sparc.cc (Target_sparc::Scan::local): Likewise.
1818 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1819 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1820 do_tls_offset_for_global): New functions.
1821 (Target_powerpc::Scan::local): Correct TLS relocations and got
1823 (Target_powerpc::Scan::global): Don't emit unnecessary
1824 dynamic relocations on TLS GOT entries.
1826 2012-09-10 Matthias Klose <doko@ubuntu.com>
1828 * config.in: Disable sanity check for kfreebsd.
1830 2012-09-10 Sterling Augustine <saugustine@google.com>
1832 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1833 (Gdb_index::pubtypes_read): New parameter.
1834 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1836 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1839 2012-09-09 Alan Modra <amodra@gmail.com>
1841 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1842 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1843 * gc.h (gc_process_relocs): Call target gc_add_reference.
1844 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1845 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1846 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1848 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1849 to cater for when we don't need code offset. Update use.
1850 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1851 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1852 set_opd_valid): New functions.
1853 (Target_powerpc::do_gc_add_reference): New function.
1854 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1856 (Target_powerpc::do_gc_mark_symbol): New function.
1858 2012-09-06 Cary Coutant <ccoutant@google.com>
1860 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1861 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1862 (Dwarf_die::skip_attributes): Likewise.
1863 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1864 * testsuite/gdb_index_test.cc (inline_func_1): New function.
1866 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1868 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
1870 * testsuite/script_test_3.t: Add .got.plt output section
1872 * testsuite/script_test_4.t: Likewise.
1874 2012-09-05 Alan Modra <amodra@gmail.com>
1876 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1877 update all uses and lose "enum" when using type.
1879 2012-09-05 Alan Modra <amodra@gmail.com>
1881 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1882 * configure: Regenerate.
1883 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1884 (plugin_final_layout.stdout): Likewise.
1885 (memory_test): Set page sizes to 0x1000.
1886 * testsuite/Makefile.in: Regenerate.
1887 * testsuite/discard_locals_test.sh: Add FIXME comment.
1888 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1889 * testsuite/pr14265.t: Add .got output section statement.
1890 * testsuite/script_test_2.t: Likewise.
1891 * testsuite/script_test_3.t: Likewise.
1892 * testsuite/script_test_4.t: Likewise.
1893 * testsuite/script_test_5.t: Likewise.
1894 * testsuite/script_test_6.t: Likewise.
1895 * testsuite/script_test_7.t: Likewise.
1896 * testsuite/script_test_9.t: Likewise.
1898 2012-09-05 Alan Modra <amodra@gmail.com>
1900 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1901 (Powerpc_relocate_functions::Status): New typedef.
1902 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1903 (Target_powerpc::Scan::local): Handle REL64.
1904 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1905 for REL32 and REL64.
1906 (Target_powerpc::symval_for_branch): New function, extracted from..
1907 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
1908 checks. Report overflow errors.
1910 2012-09-05 Alan Modra <amodra@gmail.com>
1912 * object.h (Sized_relobj_file::emit_relocs): Delete.
1913 (Sized_relobj_file::emit_relocs_reltype): Delete.
1914 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1915 relocate_relocs for --emit-relocs.
1916 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1917 * output.h: Update comment.
1918 (Output_segment::first_section): New function.
1919 (Output_segment::first_section_load_address): Use first_section.
1920 * output.cc (Output_segment::first_section): New function extracted..
1921 (Output_segment::first_section_load_address): ..from here. Delete.
1922 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1923 * target.h (Sized_target::relocate_for_relocatable): Likewise.
1924 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1925 adjust call to target.h function.
1926 * i386.cc (Target_i386): Likewise.
1927 * sparc.cc (Target_sparc): Likewise.
1928 * x86_64.cc (Target_x86_64): Likewise.
1929 * powerpc.cc (Target_powerpc): Likewise.
1930 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
1931 first tls section has section symbol for optimised local dynamic
1933 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1934 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1936 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1937 Rename to relocate_relocs. Update error message.
1939 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
1941 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1944 2012-08-31 Alan Modra <amodra@gmail.com>
1946 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1947 (Powerpc_relobj::toc_base_offset): New stub function.
1948 (Target_powerpc): Add tp_offset, dtp_offset. Rename
1949 got_mod_index_offset to tlsld_got_offset. Update all refs.
1950 (Target_powerpc::Relocate::enum skip_tls): New.
1951 (Target_powerpc::call_tls_get_addr_): New var.
1952 (Target_powerpc::is_branch_reloc): Move to file scope.
1953 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1954 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1956 (Target_powerpc::enum Got_type): Delete old values, add new ones.
1957 (powerpc_info): Correct common_pagesize for ppc64.
1958 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1959 (Powerpc_relocate_functions): Add overflow check enums and functions.
1960 Add non-shift version of rela, rela_ua. Delete all rel public
1961 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
1962 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1963 addr16_ha3, addr14 functions.
1964 (Output_data_got_powerpc::add_constant_pair): New function.
1965 (Output_data_got_powerpc::got_base_offset): Likewise.
1966 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1967 (instruction constants): Sort, add some more.
1968 (Output_data_glink::do_write): Add and use Address typedef. Use
1969 object->toc_base_offset() stub for 64-bit.
1970 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1971 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1972 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1973 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
1974 Always treat .opd relocs as against locally defined symbol.
1975 Correct condition for RELATIVE relocs.
1976 (Target_powerpc::do_finalize_sections): Test for NULL sections.
1977 (Target_powerpc::Relocate::relocate): Use plt call stub as value
1978 for 32-bit syms with a plt entry. Correct ppc64 toc base
1979 calculations. Handle TLS relocs, and more. Add overflow
1980 checking and adjust for Powerpc_relocate_functions changes.
1981 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1982 Reinstate --emit-relocs code with FIXME.
1984 2012-08-30 Alan Modra <amodra@gmail.com>
1986 * layout.cc (Layout::set_segment_offsets): Set p_align to
1987 abi_pagesize, not common_pagesize.
1988 (Layout::relaxation_loop_body): Similarly use abi_pagesize
1989 to determine whether file header can go in segment.
1991 2012-08-30 Alan Modra <amodra@gmail.com>
1993 * output.h (Output_reloc::Output_reloc <output section>): Add
1994 is_relative param. Adjust calls.
1995 (Output_reloc::add_output_section_relative): New functions.
1996 * output.cc (Output_reloc::Output_reloc <output section>): Handle
1998 (Output_reloc::symbol_value): Handle SECTION_CODE.
2000 2012-08-24 Sriraman Tallam <tmsriram@google.com>
2002 * gold.cc (queue_middle_tasks): Call layout again when unique
2003 segments for sections is desired.
2004 * layout.cc (Layout::Layout): Initialize new members.
2005 (Layout::get_output_section_flags): New function.
2006 (Layout::choose_output_section): Call get_output_section_flags.
2007 (Layout::layout): Make output section for mapping to a unique segment.
2008 (Layout::insert_section_segment_map): New function.
2009 (Layout::attach_allocated_section_to_segment): Make unique segment for
2010 output sections marked so.
2011 (Layout::segment_precedes): Check for unique segments when sorting.
2012 * layout.h (Layout::Unique_segment_info): New struct.
2013 (Layout::Section_segment_map): New typedef.
2014 (Layout::insert_section_segment_map): New function.
2015 (Layout::get_output_section_flags): New function.
2016 (Layout::is_unique_segment_for_sections_specified): New function.
2017 (Layout::set_unique_segment_for_sections_specified): New function.
2018 (Layout::unique_segment_for_sections_specified_): New member.
2019 (Layout::section_segment_map_): New member.
2020 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2021 Rename is_gc_pass_one to is_pass_one.
2022 Rename is_gc_pass_two to is_pass_two.
2023 Rename is_gc_or_icf to is_two_pass.
2024 Check for which pass based on whether symbols data is present.
2025 Make it two pass when unique segments for sections is desired.
2026 * output.cc (Output_section::Output_section): Initialize new
2028 * output.h (Output_section::is_unique_segment): New function.
2029 (Output_section::set_is_unique_segment): New function.
2030 (Output_section::is_unique_segment_): New member.
2031 (Output_section::extra_segment_flags): New function.
2032 (Output_section::set_extra_segment_flags): New function.
2033 (Output_section::extra_segment_flags_): New member.
2034 (Output_section::segment_alignment): New function.
2035 (Output_section::set_segment_alignment): New function.
2036 (Output_section::segment_alignment_): New member.
2037 (Output_segment::Output_segment): Initialize is_unique_segment_.
2038 (Output_segment::is_unique_segment): New function.
2039 (Output_segment::set_is_unique_segment): New function.
2040 (Output_segment::is_unique_segment_): New member.
2041 * plugin.cc (allow_unique_segment_for_sections): New function.
2042 (unique_segment_for_sections): New function.
2043 (Plugin::load): Add new functions to transfer vector.
2044 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2045 * Makefile.in: Regenerate.
2046 * testsuite/plugin_final_layout.sh: Check if unique segment
2047 functionality works.
2048 * testsuite/plugin_section_order.c (onload): Check if new interfaces
2050 (allow_unique_segment_for_sections): New global.
2051 (unique_segment_for_sections): New global.
2052 (claim_file_hook): Call allow_unique_segment_for_sections.
2053 (all_symbols_read_hook): Call unique_segment_for_sections.
2055 2012-08-22 Cary Coutant <ccoutant@google.com>
2057 * layout.cc (Layout::include_section): Don't assert on GROUP
2058 sections with --emit-relocs.
2060 2012-08-21 Cary Coutant <ccoutant@google.com>
2062 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2063 if --export-dynamic-symbol names an undef symbol.
2065 2012-08-18 Alan Modra <amodra@gmail.com>
2067 * powerpc.cc: Formatting and white space.
2068 (Powerpc_relobj): Rename got2_section_ to special_.
2069 Add opd_ent_shndx_ and opd_ent_off_ vectors.
2070 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2071 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2072 (Target_powerpc): Add Address typedef and invalid_address. Use
2074 (Target_powerpc::is_branch_reloc): New function.
2075 (Powerpc_relocate_functions): Add Address typedef, use throughout.
2076 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2077 for dst_mask, value and addend.
2078 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2079 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2080 (Output_data_glink::do_write): Correct toc base. Don't try to use
2081 uint16_t for 24-bit offset. Use get_output_section_offset and
2083 (Target_powerpc::Scan::local): Handle more relocs.
2084 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2085 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2086 Plug in toc restoring insn after plt calls. Translate branches
2087 to function descriptor symbols to corresponding entry point.
2088 (Target_powerpc::relocate_for_relocatable): Check return from
2089 get_output_section_offset.
2090 * symtab.h: Comment typo.
2092 2012-08-14 Ian Lance Taylor <iant@google.com>
2094 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2095 unsupported_relocal_local to call unsupported_reloc_global.
2097 2012-08-14 Nick Clifton <nickc@redhat.com>
2100 * script-sections.cc (Sections_element::output_section_name): Add
2101 keep return parameter.
2102 (Output_section_element::match_name): Add keep return parameter.
2103 Return the value of the keep_ member.
2104 * script-sections.h (class Output_section): Update
2105 output_section_name prototype.
2106 * layout.cc (Layout::keep_input_section): New public member
2108 (Layout::choose_output_section): Pass keep parameter to
2109 output_section_name.
2110 * layout.h (class Layout): Add keep_input_section.
2111 * object.cc (Sized_relobj_file::do_layout): Check for kept input
2113 * testsuite/Makefile.am: Add a test.
2114 * testsuite/Makefile.in: Regenerate.
2115 * testsuite/pr14265.c: Source file for the test.
2116 * testsuite/pr14265.t: Linker script for the test.
2117 * testsuite/pr14265.sh: Shell script for the test.
2119 2012-08-14 Alan Modra <amodra@gmail.com>
2121 * target.h (Target::output_section_name): New function.
2122 (Target::do_output_section_name): New function.
2123 * layout.cc (Layout::choose_output_section): Call the above.
2124 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2126 2012-08-14 Alan Modra <amodra@gmail.com>
2128 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2129 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2130 for replace_constant call.
2131 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2132 (Output_data_glink::do_print_to_mapfile): New function.
2133 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2134 (Target_powerpc::Relocate::relocate): Likewise.
2136 2012-08-14 Alan Modra <amodra@gmail.com>
2138 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2139 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2140 (Output_data_glink::add_entry,find_entry): Remove shndx param.
2141 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
2142 all references to shndx_. Handle special case for R_PPC_PLTREL24
2144 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2145 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2146 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2148 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2149 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2151 2012-08-12 Alan Modra <amodra@gmail.com>
2153 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
2154 (glink insn constants): Use uint32_t.
2155 (Output_data_glink::add_entry): Use insert, not [] operator.
2157 2012-08-11 Alan Modra <amodra@gmail.com>
2159 * object.h (Sized_relobj_file::find_shdr): New function.
2160 (Sized_relobj_file::find_special_sections): New function.
2161 * object.cc (Sized_relobj_file::find_shdr): New function.
2162 (Sized_relobj_file::find_eh_frame): Use find_shdr.
2163 (Sized_relobj_file::find_special_sections): New function, split out..
2164 (Sized_relobj_file::do_read_symbols): ..from here.
2165 * output.h (Output_data_got::replace_constant): New function.
2166 (Output_data_got::num_entries): New function.
2167 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2168 (Output_data_got::got_offset): Protected rather than private.
2169 (Output_data_got::replace_got_entry): New function.
2170 * output.cc (Output_data_got::replace_got_entry): New function.
2171 * powerpc.cc (class Powerpc_relobj): New.
2172 (class Powerpc_relocate_functions): Delete all psymval variants or
2173 convert to value,addend type. Delete pcrela, pcrela_unaligned.
2174 Implement _ha functions using corresponding _hi function.
2175 (Powerpc_relobj::find_special_sections): New function.
2176 (Target_powerpc::do_make_elf_object): New function.
2177 (class Output_data_got_powerpc): New.
2178 (class Output_data_glink): New.
2179 (class Powerpc_scan_relocatable_reloc): New.
2180 Many more changes througout file.
2182 2012-08-09 Nick Clifton <nickc@redhat.com>
2184 * po/vi.po: Updated Vietnamese translation.
2186 2012-08-07 Ian Lance Taylor <iant@google.com>
2188 * layout.cc (Layout::add_target_dynamic_tags): If
2189 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2192 2012-07-30 Nick Clifton <nickc@redhat.com>
2194 * po/gold.pot: Updated template.
2195 * po/es.po: Updated Spanish translation.
2197 2012-07-18 Cary Coutant <ccoutant@google.com>
2200 * configure.ac: Add check for -gpubnames support.
2201 * configure: Regenerate.
2202 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2203 support; force -gno-pubnames.
2204 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2206 (gdb_index_test_4): New test.
2207 * testsuite/Makefile.in: Regenerate.
2208 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2209 * testsuite/gdb_index_test_2.sh: Likewise.
2210 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2211 * testsuite/gdb_index_test_4.sh: New script.
2212 * testsuite/gdb_index_test_comm.sh: New script with common code;
2213 don't look for space after colon.
2215 2012-07-16 Sriraman Tallam <tmsriram@google.com>
2217 * gold.cc (queue_middle_tasks): Update function order only after
2218 deferred objects due to plugins are processed.
2220 2012-07-11 Ian Lance Taylor <iant@google.com>
2222 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2223 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2224 (Target_arm::scan_reloc_for_stub): Likewise.
2225 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2226 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2227 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2228 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2229 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2231 2012-07-10 Dodji Seketeli <dodji@redhat.com>
2232 Ian Lance Taylor <iant@google.com>
2235 * configure.ac: Test whether std::tr1::hash<off_t> works.
2236 * gold.h: Add a specialization for std::tr1::hash<off_t> if
2238 * output.h (class Output_fill): Add virtual destructor.
2239 * configure, config.in: Rebuild.
2241 2012-06-22 Roland McGrath <mcgrathr@google.com>
2243 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2245 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
2247 * plugin.cc (Plugin::load): Handle position independent executables.
2249 2012-06-06 Cary Coutant <ccoutant@google.com>
2251 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2253 (lines_only_debug_sections): Likewise.
2254 (gdb_fast_lookup_sections): New static array.
2255 (is_gdb_debug_section): Rename formal parameter.
2256 (is_lines_only_debug_section): Likewise.
2257 (is_gdb_fast_lookup_section): New function.
2258 (Layout::include_section): Check for ".zdebug_" prefix; pass
2259 section name suffix to is_gdb_debug_section, et al.; check for
2260 fast-lookup sections when building .gdb_index.
2261 * options.h (--strip-debug-gdb): Update GDB version number.
2263 2012-06-06 Cary Coutant <ccoutant@google.com>
2265 * configure.ac: Add check for fallocate.
2266 * configure: Regenerate.
2267 * config.in: Regenerate.
2269 * options.h (class General_options): Add --mmap-output-file and
2270 --posix-fallocate options.
2271 * output.cc: (posix_fallocate): Remove; replace with...
2272 (gold_fallocate): New function.
2273 (Output_file::map_no_anonymous): Call gold_fallocate.
2274 (Output_file::map): Check --mmap-output-file option.
2276 2012-06-05 Jing Yu <jingyu@google.com>
2278 * gold.h (textdomain): Add do {} to empty while(0).
2279 (bindtextdomain): Likewise.
2281 2012-06-04 Cary Coutant <ccoutant@google.com>
2283 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2286 2012-05-25 Sriraman Tallam <tmsriram@google.com>
2288 * symtab.cc (Symbol_table::define_special_symbol):
2289 Initialize *poldsym to prevent uninitialized variable errors.
2291 2012-05-23 Cary Coutant <ccoutant@google.com>
2293 * layout.cc (Layout::section_name_mapping): Add rules to handle
2294 exact match on .data.rel.ro.local or .data.rel.ro.
2295 (Layout::output_section_name): Check for exact matches.
2297 2012-05-23 Cary Coutant <ccoutant@google.com>
2299 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2302 2012-05-22 Cary Coutant <ccoutant@google.com>
2304 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2305 object before exporting symbol.
2307 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
2309 * testsuite/tls_test.cc: Include "config.h" first.
2310 * testsuite/tls_test_c.c: Likewise.
2312 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
2313 Nick Clifton <nickc@redhat.com>
2316 * configure.in: Add check that sysdep.h has been included before
2317 any system header files.
2318 * configure: Regenerate.
2319 * config.in: Regenerate.
2321 2012-05-14 Cary Coutant <ccoutant@google.com>
2323 * layout.cc (Layout::make_output_section): Mark .tdata section
2325 * testsuite/relro_test.cc: Add a TLS variable.
2327 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
2330 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2331 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2334 2012-05-08 Cary Coutant <ccoutant@google.com>
2336 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2337 (lines_only_debug_sections): Likewise.
2339 2012-05-02 Roland McGrath <mcgrathr@google.com>
2341 * nacl.cc: New file.
2343 * Makefile.am (CCFILES, HFILES): Add them.
2344 * Makefile.in: Regenerate.
2345 * i386.cc (Output_data_plt_i386_nacl): New class.
2346 (Output_data_plt_i386_nacl_exec): New class.
2347 (Output_data_plt_i386_nacl_dyn): New class.
2348 (Target_i386_nacl): New class.
2349 (Target_selector_i386_nacl): New class.
2350 (target_selector_i386): Use it instead of Target_selector_i386.
2351 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2352 (Target_x86_64_nacl): New class.
2353 (Target_selector_x86_64_nacl): New class.
2354 (target_selector_x86_64, target_selector_x32): Use it instead of
2355 Target_selector_x86_64.
2356 * arm.cc (Output_data_plt_arm_nacl): New class.
2357 (Target_arm_nacl): New class.
2358 (Target_selector_arm_nacl): New class.
2359 (target_selector_arm, target_selector_armbe): Use it instead of
2360 Target_selector_arm.
2362 * target-select.cc (select_target): Take new Input_file* and off_t
2363 arguments, pass them on to recognize method of selector.
2364 * object.cc (make_elf_sized_object): Update caller.
2365 * parameters.cc (parameters_force_valid_target): Likewise.
2366 * incremental.cc (make_sized_incremental_binary): Likewise.
2367 * target-select.h: Update decl.
2368 (Target_selector::recognize): Take new Input_file* argument,
2369 pass it on to do_recognize.
2370 (Target_selector::do_recognize): Take new Input_file* argument.
2371 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2372 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2373 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2374 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2376 * target.h (Target::Target_info): New members isolate_execinstr
2378 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2379 * arm.cc (Target_arm::arm_info): Update initializer.
2380 * i386.cc (Target_i386::i386_info): Likewise.
2381 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2382 * sparc.cc (Target_sparc::sparc_info): Likewise.
2383 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2384 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2385 * layout.cc (Layout::attach_allocated_section_to_segment):
2386 Take new const Target* argument. If target->isolate_execinstr(), act
2388 (Layout::find_first_load_seg): Take new const Target* argument;
2389 if target->isolate_execinstr(), reject PF_X segments.
2390 (Layout::relaxation_loop_body): Update caller.
2391 (Layout::set_segment_offsets): If target->isolate_execinstr(),
2392 reset file offset to zero when we hit LOAD_SEG, and then do a second
2393 loop over the segments before LOAD_SEG to reassign offsets after
2394 addresses have been determined. Handle target->rosegment_gap().
2395 (Layout::attach_section_to_segment): Take new const Target* argument;
2396 pass it to attach_allocated_section_to_segment.
2397 (Layout::make_output_section): Update caller.
2398 (Layout::attach_sections_to_segments): Take new const Target* argument;
2399 pass it to attach_section_to_segment.
2400 * gold.cc (queue_middle_tasks): Update caller.
2401 * layout.h (Layout): Update method decls with new arguments.
2403 * arm.cc (Target_arm::Target_arm): Take optional argument for the
2404 Target_info pointer to use.
2405 (Target_arm::do_make_data_plt): New virtual method.
2406 (Target_arm::make_data_plt): New method that calls it.
2407 (Target_arm::make_plt_entry): Use it.
2408 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2409 for the section alignment.
2410 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2412 (Output_data_plt_arm::first_plt_entry_offset): Call it.
2413 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2415 (Output_data_plt_arm::get_plt_entry_size): Call it.
2416 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2417 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2418 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2420 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2421 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2422 method instead of sizeof(plt_entry).
2423 (Output_data_plt_arm::add_entry): Likewise.
2424 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2425 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2427 (Target_arm::plt_entry_size): Likewise.
2428 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2430 (Output_data_plt_arm_standard): ... here, new class.
2431 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2432 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2433 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2435 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2436 Take additional argument for the PLT entry size.
2437 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2438 Use get_plt_entry_size method rather than plt_entry_size variable.
2439 (Output_data_plt_x86_64::reserve_slot): Likewise.
2440 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2441 (Output_data_plt_x86_64::add_entry): Likewise.
2442 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2443 (Output_data_plt_x86_64::address_for_global): Likewise.
2444 (Output_data_plt_x86_64::address_for_local): Likewise.
2445 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2446 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2447 Make method non-static.
2448 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2450 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2451 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2452 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2453 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2455 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2456 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2458 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2459 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2461 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2462 (Output_data_plt_x86_64::plt_entry_size)
2463 (Output_data_plt_x86_64::first_plt_entry)
2464 (Output_data_plt_x86_64::plt_entry)
2465 (Output_data_plt_x86_64::tlsdesc_plt_entry)
2466 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2467 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2468 (Output_data_plt_x86_64_standard): ... here, new class.
2469 (Target_x86_64::Target_x86_64): Take optional argument for the
2470 Target_info pointer to use.
2471 (Target_x86_64::do_make_data_plt): New virtual method.
2472 (Target_x86_64::make_data_plt): New method to call it.
2473 (Target_x86_64::init_got_plt_for_update): Use that.
2474 Call this->plt_->add_eh_frame method here.
2475 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2476 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2477 rather than static method.
2478 (Target_x86_64::plt_entry_size): Likewise.
2479 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2480 rather than plt_entry_size variable. Move guts of PLT filling to...
2481 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2482 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2483 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2485 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2486 additional argument for the section alignment.
2487 Don't do add_eh_frame_for_plt here.
2488 (Output_data_plt_i386::first_plt_entry_offset): Make the method
2489 non-static. Use get_plt_entry_size method rather than plt_entry_size
2491 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2493 (Output_data_plt_i386::get_plt_entry_size): Call it.
2494 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2495 (Output_data_plt_i386::add_eh_frame): New method to call it.
2496 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2498 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2499 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2501 (Output_data_plt_i386::fill_plt_entry): New method to call it.
2502 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2503 method instead of plt_entry_size.
2504 (Output_data_plt_i386::plt_entry_size)
2505 (Output_data_plt_i386::plt_eh_frame_fde_size)
2506 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2507 (Output_data_plt_i386_standard): ... here, new class.
2508 (Output_data_plt_i386_exec): New class.
2509 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2510 (Output_data_plt_i386_exec::first_plt_entry): ... here.
2511 (Output_data_plt_i386::exec_plt_entry): Move to ...
2512 (Output_data_plt_i386_exec::plt_entry): ... here.
2513 (Output_data_plt_i386_dyn): New class.
2514 (Output_data_plt_i386::first_plt_entry): Move to ...
2515 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2516 (Output_data_plt_i386::dyn_plt_entry): Move to ...
2517 (Output_data_plt_i386_dyn::plt_entry): ... here.
2518 (Target_i386::Target_i386): Take optional argument for the Target_info
2520 (Target_i386::do_make_data_plt): New virtual method.
2521 (Target_i386::make_data_plt): New method to call it.
2522 (Target_i386::make_plt_section): Use that.
2523 Call this->plt_->add_eh_frame method here.
2524 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2525 rather than plt_entry_size variable.
2526 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2527 (Output_data_plt_i386::address_for_local): Likewise.
2528 (Output_data_plt_i386::do_write): Likewise.
2529 Move guts of PLT filling to...
2530 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2531 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2532 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2533 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2535 2012-05-01 Cary Coutant <ccoutant@google.com>
2537 * dwarf_reader.cc (Dwarf_die::read_attributes)
2538 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2539 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2540 * reduced_debug_output.cc
2541 (Output_reduced_debug_info_section::get_die_end): Remove
2542 DW_FORM_GNU_ref_index. Add default case.
2544 2012-04-26 Mark Wielaard <mjw@redhat.com>
2546 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2547 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2548 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2549 DW_AT_high_pc as offset from DW_AT_low_pc.
2551 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2552 * testsuite/Makefile.in: Regenerate.
2553 * testsuite/gdb_index_test_3.c: New test source file.
2554 * testsuite/gdb_index_test_3.sh: New test source file.
2556 2012-04-25 Ian Lance Taylor <iant@google.com>
2558 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2560 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2561 as a class, not a struct.
2562 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2563 (Target_arm::apply_cortex_a8_workaround): Likewise.
2564 * gc.h: Declare Reloc_types as a struct, not a class.
2565 * object.h: Declare Symbols_data as a struct.
2566 * reloc.h: Declare Read_relocs_data as a struct.
2567 * target.h: Declare Relocate_info as a struct.
2569 2012-04-24 David S. Miller <davem@davemloft.net>
2571 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2572 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2575 2012-04-24 Cary Coutant <ccoutant@google.com>
2577 * incremental-dump.cc (find_input_containing_global): Replace
2578 magic number with symbolic constant.
2579 (dump_incremental_inputs): Update version number.
2580 * incremental.cc (Output_section_incremental_inputs): Update version
2581 number; import symbolic constants from Incremental_inputs_reader.
2582 (Incremental_inputs::create_data_sections): Align relocations
2583 section correctly for 64-bit targets.
2584 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2585 constants; add padding.
2586 (Output_section_incremental_inputs::write_header): Add assert for
2588 (Output_section_incremental_inputs::write_input_files): Add assert
2589 for input_entry_size.
2590 (Output_section_incremental_inputs::write_info_blocks): Add padding;
2591 add assert for object_info_size, input_section_entry_size,
2592 global_sym_entry_size.
2593 * incremental.h (Incremental_inputs_reader): Add symbolic constants
2594 for data structure sizes; use them.
2595 (Incremental_input_entry_reader): Import symbolic constants from
2596 Incremental_inputs_reader; use them.
2598 2012-04-23 David S. Miller <davem@davemloft.net>
2600 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2602 (Target_sparc::Target_sparc): Initialize new fields.
2603 (Target_sparc::do_make_elf_object): New function.
2604 (Target_sparc::do_adjust_elf_header): New function.
2606 2012-04-23 Cary Coutant <ccoutant@google.com>
2608 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2609 CU range table of gdb index.
2611 2012-04-20 David S. Miller <davem@davemloft.net>
2613 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2616 2012-04-16 David S. Miller <davem@davemloft.net>
2618 * sparc.cc (Target_sparc::got_address): New function.
2619 (Sparc_relocate_functions::gdop_hix22): New function.
2620 (Sparc_relocate_functions::gdop_lox10): New function.
2621 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2623 (Target_sparc::Scan::local): Likewise if the global symbol is not
2624 preemptible and is not IFUNC.
2625 (Target_sparc::Relocate::relocate): Perform GOTDATA code
2626 transformations for local and non-preemptible non-IFUNC global
2629 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2630 writing out 64-bit part of ranges.
2632 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2633 -fpic and -fpie respectively.
2634 * Makefile.in: Regenerate.
2636 * sparc.cc (class Target_sparc): Add rela_ifunc_.
2637 (Target_sparc::Target_sparc): Initialize new field.
2638 (Target_sparc::do_plt_section_for_global): New function.
2639 (Target_sparc::do_plt_section_for_local): New function.
2640 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2641 (Target_sparc::make_plt_section): New function, broken out of
2642 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
2643 (Target_sparc::make_plt_entry): Call make_plt_section.
2644 (Target_sparc::make_local_ifunc_plt_entry): New function.
2645 (Target_sparc::rela_ifunc_section): New function.
2646 (Target_sparc::plt_section): Remove const.
2647 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
2648 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2649 and ifunc_count_ fields.
2650 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2651 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2652 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2653 (Output_data_plt_sparc::rela_ifunc): New function.
2654 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2655 (Output_data_plt_sparc::has_ifunc_section): New function.
2656 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2657 (Output_data_plt_sparc::address_for_global): New function.
2658 (Output_data_plt_sparc::address_for_local): New function.
2659 (Output_data_plt_sparc::plt_index_to_offset): New function.
2660 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2662 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2664 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2665 R_SPARC_JMP_IREL to switch.
2666 (Target_sparc::Scan::check_non_pic): Likewise.
2667 (Target_sparc::Scan::local): Handle IFUNC symbols.
2668 (Target_sparc::Scan::local): Likewise.
2669 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2670 and plt_address_for_local.
2671 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2672 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2674 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2675 (class Output_data_reloc): Adjust calls to Output_reloc_type.
2676 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2677 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2679 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2680 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2682 * sparc.cc (Target_sparc::Scan::global): Likewise.
2683 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2685 2012-04-16 Cary Coutant <ccoutant@google.com>
2687 * archive.cc (Library_base::should_include_member): Check for
2688 --export-dynamic-symbol.
2689 * options.h (class General_options): Add --export-dynamic-symbol.
2690 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2691 --export-dynamic-symbol.
2692 (Symbol_table::gc_mark_undef_symbols): Likewise.
2693 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2695 2012-04-12 David S. Miller <davem@davemloft.net>
2697 * sparc.cc (Reloc::wdisp10): New relocation method.
2698 (Reloc::h34): Likewise.
2699 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2700 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2702 (Target_sparc::Scan::local): Likewise.
2703 (Target_sparc::Scan::global): Likewise.
2704 (Target_sparc::Relocate::relocate): Likewise.
2706 2012-04-09 Cary Coutant <ccoutant@google.com>
2708 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2711 2012-04-06 Ian Lance Taylor <iant@google.com>
2713 * timer.cc: #include <unistd.h>.
2715 2012-04-06 Roland McGrath <mcgrathr@google.com>
2717 * configure.in (AC_CHECK_HEADERS): Add locale.h.
2718 * config.in: Regenerate.
2719 * configure: Regenerate.
2721 2012-04-05 Nick Clifton <nickc@redhat.com>
2723 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2724 (AM_LC_MESSAGES): Add.
2725 * aclocal.m4: Regenerate.
2726 * config.in: Regenerate.
2727 * configure: Regenerate.
2729 2012-03-21 Cary Coutant <ccoutant@google.com>
2731 * Makefile.am: Add gdb-index.cc, gdb-index.h.
2732 * Makefile.in: Regenerate.
2733 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2734 (Sized_elf_reloc_mapper::symbol_section): New function.
2735 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2736 (make_elf_reloc_mapper): New function.
2737 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2738 (Dwarf_abbrev_table::do_read_abbrevs): New function.
2739 (Dwarf_abbrev_table::do_get_abbrev): New function.
2740 (Dwarf_ranges_table::read_ranges_table): New function.
2741 (Dwarf_ranges_table::read_range_list): New function.
2742 (Dwarf_pubnames_table::read_section): New function.
2743 (Dwarf_pubnames_table::read_header): New function.
2744 (Dwarf_pubnames_table::next_name): New function.
2745 (Dwarf_die::Dwarf_die): New function.
2746 (Dwarf_die::read_attributes): New function.
2747 (Dwarf_die::skip_attributes): New function.
2748 (Dwarf_die::set_name): New function.
2749 (Dwarf_die::set_linkage_name): New function.
2750 (Dwarf_die::attribute): New function.
2751 (Dwarf_die::string_attribute): New function.
2752 (Dwarf_die::int_attribute): New function.
2753 (Dwarf_die::uint_attribute): New function.
2754 (Dwarf_die::ref_attribute): New function.
2755 (Dwarf_die::child_offset): New function.
2756 (Dwarf_die::sibling_offset): New function.
2757 (Dwarf_info_reader::check_buffer): New function.
2758 (Dwarf_info_reader::parse): New function.
2759 (Dwarf_info_reader::do_parse): New function.
2760 (Dwarf_info_reader::do_read_string_table): New function.
2761 (Dwarf_info_reader::lookup_reloc): New function.
2762 (Dwarf_info_reader::get_string): New function.
2763 (Dwarf_info_reader::visit_compilation_unit): New function.
2764 (Dwarf_info_reader::visit_type_unit): New function.
2765 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2766 Sized_elf_reloc_mapper.
2767 (Sized_dwarf_line_info::symbol_section): Remove function.
2768 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2769 (Sized_dwarf_line_info::read_line_mappings): Remove object
2770 parameter, adjust callers.
2771 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2772 * dwarf_reader.h: Include <sys/types.h>.
2773 (class Track_relocs): Remove forward declaration.
2774 (class Elf_reloc_mapper): New class.
2775 (class Sized_elf_reloc_mapper): New class.
2776 (class Dwarf_abbrev_table): New class.
2777 (class Dwarf_range_list): New class.
2778 (class Dwarf_ranges_table): New class.
2779 (class Dwarf_pubnames_table): New class.
2780 (class Dwarf_die): New class.
2781 (class Dwarf_info_reader): New class.
2782 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2783 (Sized_dwarf_line_info::symbol_section): Remove member function.
2784 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2786 * gdb-index.cc: New source file.
2787 * gdb-index.h: New source file.
2788 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2789 and .debug_types sections, call Layout::add_to_gdb_index.
2790 (Sized_relobj_incr::do_section_name): Implement.
2791 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2792 return type; Implement.
2793 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2795 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2796 parameter list and return type.
2797 (Sized_incr_dynobj::do_section_contents): Likewise.
2798 * layout.cc: Include gdb-index.h.
2799 (Layout::Layout): Initialize gdb_index_data_.
2800 (Layout::init_fixed_output_section): Check for .gdb_index section.
2801 (Layout::add_to_gdb_index): New function. Instantiate.
2802 * layout.h: Add forward declaration for class Gdb_index.
2803 (Layout::add_to_gdb_index): New member function.
2804 (Layout::gdb_index_data_): New data member.
2805 * main.cc: Include gdb-index.h.
2806 (main): Print statistics for gdb index.
2807 * object.cc (Object::section_contents): Move code into
2808 do_section_contents.
2809 (need_decompressed_section): Check for sections needed when building
2811 (build_compressed_section_map): Likewise.
2812 (Sized_relobj_file::do_read_symbols): Need local symbols when building
2814 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2815 sections; call Layout::add_to_gdb_index.
2816 (Sized_relobj_file::do_decompressed_section_contents): Call
2817 do_section_contents directly.
2818 * object.h (Object::do_section_contents): Adjust parameter list and
2820 (Object::do_decompressed_section_contents): Call do_section_contents
2822 (Sized_relobj_file::do_section_contents): Adjust parameter list and
2824 * options.h (class General_options): Add --gdb-index option.
2825 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2826 list and return type.
2827 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2828 * reloc.h (Track_relocs::checkpoint): New function.
2829 (Track_relocs::reset): New function.
2831 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2833 * testsuite/Makefile.in: Regenerate.
2834 * testsuite/gdb_index_test.cc: New test source file.
2835 * testsuite/gdb_index_test_1.sh: New test source file.
2836 * testsuite/gdb_index_test_2.sh: New test source file.
2838 2012-03-19 Doug Kwan <dougkwan@google.com>
2840 * arm.cc (Target_arm::do_define_standard_symbols): New method.
2841 (Target_arm::do_finalize_sections): Remove code which defines
2842 __exidx_start and __exidx_end. Make symbol table parameter
2843 anonymous as it is not used.
2844 * gold.cc (queue_middle_tasks): Call target hook to define any
2845 target-specific symbols.
2846 * target.h (Target::define_standard_symbols): New method.
2847 (Target::do_define_standard_symbols): Same.
2848 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2849 * testsuite/Makefile.in: Regenerate.
2850 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2852 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2853 relocations are generated for __exidx_start and __exidx_end.
2855 2012-03-16 Doug Kwan <dougkwan@google.com>
2857 * testsuite/Makefile.am: Disable test initpri3b.
2858 * testsuite/Makefile.in: Regenerate.
2860 2012-03-15 Doug Kwan <dougkwan@google.com>
2862 * arm.cc (Target_arm::got_section): Make .got section read-only
2865 2012-03-15 Ian Lance Taylor <iant@google.com>
2868 * layout.cc (Layout::make_output_section): Correctly mark
2869 SHT_INIT_ARRAY, et. al., as relro.
2871 2012-03-14 Doug Kwan <dougkwan@google.com>
2873 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2874 dynamic relocations for protected symbols in shared objects.
2876 2012-03-13 Ian Lance Taylor <iant@google.com>
2878 * resolve.cc (Symbol_table::resolve): When merging common symbols,
2879 keep the larger alignment.
2881 2012-03-12 Cary Coutant <ccoutant@google.com>
2883 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2884 handling of DW_LNE_define_file.
2886 2012-03-12 Cary Coutant <ccoutant@google.com>
2888 * reduced_debug_output.cc
2889 (Output_reduced_debug_info_section::get_die_end): Add new FORM
2892 2012-02-29 Cary Coutant <ccoutant@google.com>
2894 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2896 2012-02-29 Cary Coutant <ccoutant@google.com>
2898 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2899 Call Object::decompressed_section_contents.
2900 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2902 (Sized_dwarf_line_info::buffer_start_): New data member.
2903 * merge.cc (Output_merge_data::do_add_input_section): Call
2904 Object::decompressed_section_contents.
2905 (Output_merge_string::do_add_input_section): Likewise.
2906 * object.cc (need_decompressed_section): New function.
2907 (build_compressed_section_map): Decompress sections needed later.
2908 (Sized_relobj_file::do_decompressed_section_contents): New function.
2909 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2910 * object.h (Object::decompressed_section_contents): New function.
2911 (Object::discard_decompressed_sections): New function.
2912 (Object::do_decompressed_section_contents): New function.
2913 (Object::do_discard_decompressed_sections): New function.
2914 (Compressed_section_info): New type.
2915 (Compressed_section_map): Include decompressed section contents.
2916 (Sized_relobj_file::do_decompressed_section_contents): New function.
2917 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2919 2012-02-16 Cary Coutant <ccoutant@google.com>
2921 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2922 * testsuite/Makefile.in: Regenerate.
2924 2012-02-14 Cary Coutant <ccoutant@google.com>
2926 * options.cc (General_options::finalize): Disallow -pie and -static.
2928 2012-02-03 Doug Kwan <dougkwan@google.com>
2930 * arm.cc (Arm_relocate_functions::abs8,
2931 Arm_relocate_functions::abs16): Use
2932 Bits::has_signed_unsigned_overflow32.
2933 (Arm_relocate_functions::thm_abs8): Correct range of
2935 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2938 2012-02-02 Doug Kwan <dougkwan@google.com>
2940 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2941 position independent outputs, not just shared objects.
2943 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
2945 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2946 * configure: Regenerated.
2948 2012-01-27 Ian Lance Taylor <iant@google.com>
2950 * reloc.h (Bits): New class with static functions, copied from
2951 namespace utils in arm.cc.
2952 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
2955 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2957 * incremental.cc (write_info_blocks): Correct relocation offset.
2959 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2961 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2962 (Relocate::tls_gd_to_le): Likewise.
2964 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2966 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2968 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2970 * configure.ac: Check if -mcmodel=medium works.
2971 * configure: Regenerated.
2973 2012-01-24 Cary Coutant <ccoutant@google.com>
2975 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2977 (read_unsigned_LEB_128_x): ... this new function.
2978 (read_signed_LEB_128): Replaced with inline definition and ...
2979 (read_signed_LEB_128_x): ... this new function.
2980 * int_encoding.h (read_unsigned_LEB_128_x): New function.
2981 (read_unsigned_LEB_128): Add inline definition.
2982 (read_signed_LEB_128_x): New function.
2983 (read_signed_LEB_128): Add inline definition.
2984 * testsuite/Makefile.am (leb128_unittest): New unit test.
2985 * testsuite/Makefile.in: Regenerate.
2986 * testsuite/leb128_unittest.cc: New unit test.
2988 2012-01-23 Ian Lance Taylor <iant@google.com>
2991 * i386.cc (Target_i386::do_code_fill): When using a jmp
2992 instruction, pad with nop instructions.
2993 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2995 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
2997 * x86_64.cc (gc_process_relocs): Add typename on types used in
2999 (scan_relocs): Likewise.
3000 (relocate_section): Likewise.
3001 (apply_relocation): Likewise.
3003 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
3005 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3006 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3009 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
3011 * x86_64.cc: Initial support for x32.
3013 2012-01-03 Cary Coutant <ccoutant@google.com>
3015 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3016 Use abstract base class for GOT.
3017 * gold/output.h (class Output_data_got_base): New abstract base class.
3018 (class Output_data_got): Derive from new base class, adjust ctors.
3019 (Output_data_got::reserve_slot): Make virtual; rename to
3020 do_reserve_slot; Adjust callers.
3021 * gold/target.h (Sized_target::init_got_plt_for_update): Return
3022 pointer to abstract base class.
3023 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3025 2011-12-18 Ian Lance Taylor <iant@google.com>
3027 * object.h (Relobj::local_symbol_value): New function.
3028 (Relobj::local_plt_offset): New function.
3029 (Relobj::local_has_got_offset): New function.
3030 (Relobj::local_got_offset): New function.
3031 (Relobj::set_local_got_offset): New function.
3032 (Relobj::do_local_symbol_value): New pure virtual function.
3033 (Relobj::do_local_plt_offset): Likewise.
3034 (Relobj::do_local_has_got_offset): Likewise.
3035 (Relobj::do_local_got_offset): Likewise.
3036 (Relobj::do_set_local_got_offset): Likewise.
3037 (Sized_relobj::do_local_has_got_offset): Rename from
3038 local_has_got_offset.
3039 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3040 (Sized_relobj::do_set_local_got_offset): Rename from
3041 set_local_got_offset.
3042 (Sized_relobj_file::do_local_plt_offset): Rename from
3044 (Sized_relobj_file::do_local_symbol_value): New function.
3045 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3047 * output.cc (Output_data_got::Got_entry::write): Change object to
3048 Relobj. Use local_symbol_value.
3049 (Output_data_got::add_global_with_rel): Change rel_dyn to
3050 Output_data_reloc_generic*. Use add_global_generic.
3051 (Output_data_got::add_global_with_rela): Remove. Change all
3052 callers to use add_global_with_rel.
3053 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3054 Output_data_reloc_generic*. Use add_global_generic.
3055 (Output_data_got::add_global_pair_with_rela): Remove. Change all
3056 callers to use add_global_pair_with_rel.
3057 (Output_data_got::add_local): Change object to Relobj*.
3058 (Output_data_got::add_local_plt): Likewise.
3059 (Output_data_got::add_local_with_rel): Change object to Relobj*,
3060 change rel_dyn to Output_data_reloc_generic*. Use
3062 (Output_data_got::add_local_with_rela): Remove. Change all
3063 callers to use all_local_with_rel.
3064 (Output_data_got::add_local_pair_with_rel): Change object to
3065 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
3066 add_output_section_generic.
3067 (Output_data_got::add_local_pair_with_rela): Remove. Change all
3068 callers to use add_local_pair_with_rel.
3069 (Output_data_got::reserve_local): Change object to Relobj*.
3070 * output.h: (class Output_data_reloc_generic): Add pure virtual
3071 declarations for add_global_generic, add_local_generic,
3072 add_output_section_generic.
3073 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3074 functions for Output_data_reloc_generic. Update declarations for
3075 changes listed in output.cc.
3076 (class Output_data_got): Change template parameter to got_size.
3077 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
3078 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3080 (Sized_relobj_incr::do_local_plt_offset): New function.
3081 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3084 2011-12-17 Cary Coutant <ccoutant@google.com>
3086 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3087 * resolve.cc (Symbol_table::resolve): Likewise.
3088 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3090 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3092 2011-12-16 Ian Lance Taylor <iant@google.com>
3094 * output.h (Output_data_reloc_generic::add): Only call
3095 add_dynamic_reloc if this is a dynamic reloc section.
3097 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
3100 * target-reloc.h (apply_relocation): Replace <64, false> with
3103 2011-11-25 Nick Clifton <nickc@redhat.com>
3105 * po/it.po: New Italian translation.
3107 2011-11-17 Sterling Augustine <saugustine@google.com>
3109 * script.cc (script_include_directive): Implement.
3110 (read_script_file): New local variables name and search_path. Update
3111 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3112 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3113 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3115 2011-11-11 Sterling Augustine <saugustine@google.com>
3117 * yyscript.y (section_cmd): Add support for INCLUDE directive.
3118 (file_or_sections_cmd): Likewise.
3120 2011-11-11 Doug Kwan <dougkwan@google.com>
3122 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3123 if --just-symbols is given.
3125 2011-11-10 Doug Kwan <dougkwan@google.com>
3128 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3129 when processing data relocs.
3130 * reloc.h (Relocate_functions::rel_unaligned): New method.
3131 (Relocate_functions::pcrel_unaligned): Ditto.
3132 (Relocate_functions::rel32_unaligned): Ditto.
3133 (Relocate_functions::pcrel32_unaligned): Ditto.
3135 2011-11-09 Doug Kwan <dougkwan@google.com>
3138 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3139 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3140 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3141 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3142 (Relocate_functions::rel_unaligned): New.
3143 (Relocate_functions::rel32_unaligned): New.
3144 * target-reloc.h (relocate_for_relocatable): Add code to handle
3145 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3146 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3147 arm_unaligned_reloc_r): New targets.
3148 * testsuite/Makefile.in: Regenerate.
3149 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3152 2011-11-02 Ian Lance Taylor <iant@google.com>
3154 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
3156 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3157 * options.cc (General_options::finalize): Use library search path
3158 from configure script if specified. If not native and no sysroot,
3159 only search TOOLLIBDIR.
3160 * options.h (Search_directory::Search_directory): Change name to
3162 (General_options::add_to_library_path_with_sysroot): Change arg to
3164 * configure, Makefile.in, config.in: Rebuild.
3166 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
3168 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3169 we are working around the ARM1176 Erratum.
3170 * options.h (General_options::fix_arm1176): Add option.
3171 * testsuite/Makefile.am: Add testcases, and keep current ones
3173 * testsuite/Makefile.in: Regenerate.
3174 * testsuite/arm_fix_1176.s: New file.
3175 * testsuite/arm_fix_1176.sh: Likewise.
3177 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
3179 * arm.cc (Target_arm::Target_arm): Remove initialisation of
3181 (Target_arm::may_use_blx): Remove method.
3182 (Target_arm::set_may_use_blx): Likewise.
3183 (Target_arm::may_use_v4t_interworking): New method.
3184 (Target_arm::may_use_v5t_interworking): Likewise.
3185 (Target_arm::may_use_blx_): Remove member variable.
3186 (Arm_relocate_functions::arm_branch_common): Check for v5T
3188 (Arm_relocate_functions::thumb_branch_common): Likewise.
3189 (Reloc_stub::stub_type_for_reloc): Likewise.
3190 (Target_arm::do_finalize_sections): Correct interworking checks.
3191 * testsuite/Makefile.am: Add new tests.
3192 * testsuite/Makefile.in: Regenerate.
3193 * testsuite/arm_farcall_arm_arm.s: New test.
3194 * testsuite/arm_farcall_arm_arm.sh: Likewise.
3195 * testsuite/arm_farcall_arm_thumb.s: Likewise.
3196 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3197 * testsuite/arm_farcall_thumb_arm.s: Likewise.
3198 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3199 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3200 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3202 2011-10-31 Cary Coutant <ccoutant@google.com>
3205 * expression.cc (Expression::eval_with_dot): Add
3206 is_section_dot_assignment parameter.
3207 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
3208 absolute and assigning to dot within a section.
3209 * script-sections.cc
3210 (Output_section_element_assignment::set_section_addresses): Pass
3211 dot_section to set_if_absolute.
3212 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3213 as is_section_dot_assignment flag to eval_with_dot.
3214 (Output_section_element_dot_assignment::set_section_addresses):
3216 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3217 parameter. Also set value if relative to dot_section; set the
3218 symbol's output_section.
3219 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3220 parameter. Adjust all callers.
3221 (Expression::eval_maybe_dot): Likewise.
3222 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3224 * testsuite/script_test_2.t: Test assignment of an absolute value
3225 to dot within an output section element.
3227 2011-10-31 Cary Coutant <ccoutant@google.com>
3229 * options.h (class General_options): Add --[no-]gnu-unique options.
3230 * symtab.cc (Symbol_table::sized_write_globals): Convert
3231 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3233 2011-10-31 Cary Coutant <ccoutant@google.com>
3236 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3237 unnecessary assertion.
3238 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3240 2011-10-31 Sriraman Tallam <tmsriram@google.com>
3242 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3244 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3246 Change to just keep the section associated with symbol.
3247 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3248 they are externally visible and --export-dynamic is turned on.
3249 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3251 2011-10-19 Ian Lance Taylor <iant@google.com>
3254 * script-sections.cc
3255 (Output_section_element_dot_assignment::needs_output_section): New
3258 2011-10-19 Ian Lance Taylor <iant@google.com>
3261 * layout.cc (Layout::segment_precedes): Don't assert failure if a
3262 --section-start option was seen.
3263 * options.h (General_options::any_section_start): New function.
3265 2011-10-18 David S. Miller <davem@davemloft.net>
3268 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3269 member to track relocation locations that have moved during TLS
3270 reloc optimizations.
3271 (Target_sparc::Relocate::Relocate): Initialize to NULL.
3272 (Target_sparc::Relocate::relocate): Adjust view down by 4
3273 bytes if it matches reloc_adjust_addr_.
3274 (Target_sparc::Relocate::relocate_tls): Always move the
3275 __tls_get_addr call delay slot instruction forward 4 bytes when
3276 performing relaxation.
3278 2011-10-18 Cary Coutant <ccoutant@google.com>
3280 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3281 (Output_file::map_no_anonymous): Check for non-zero
3282 return code from posix_fallocate.
3284 2011-10-17 Cary Coutant <ccoutant@google.com>
3287 * plugin.cc (is_visible_from_outside): Check for symbols
3288 referenced from dynamic objects.
3289 * resolve.cc (Symbol_table::resolve): Don't count references
3290 from dynamic objects as references from real ELF files.
3291 * testsuite/plugin_test_2.sh: Adjust expected result.
3293 2011-10-17 Cary Coutant <ccoutant@google.com>
3295 * gold.cc: Include timer.h.
3296 (queue_middle_tasks): Stamp time.
3297 (queue_final_tasks): Likewise.
3298 * main.cc (main): Store timer in parameters. Print timers
3300 * parameters.cc (Parameters::Parameters): Initialize timer_.
3301 (Parameters::set_timer): New function.
3302 (set_parameters_timer): New function.
3303 * parameters.h (Parameters::set_timer): New function.
3304 (Parameters::timer): New function.
3305 (Parameters::timer_): New data member.
3306 (set_parameters_timer): New function.
3307 * timer.cc (Timer::stamp): New function.
3308 (Timer::get_pass_time): New function.
3309 * timer.h (Timer::stamp): New function.
3310 (Timer::get_pass_time): New function.
3311 (Timer::pass_times_): New data member.
3313 2011-10-17 Cary Coutant <ccoutant@google.com>
3315 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3316 task for members of lib groups.
3318 2011-10-17 Cary Coutant <ccoutant@google.com>
3321 * fileread.cc (File_read::find_view): Add assert.
3322 (File_read::make_view): Move bounds check (replace with assert)...
3323 (File_read::find_or_make_view): ... to here.
3325 2011-10-12 Cary Coutant <ccoutant@google.com>
3327 * output.cc (Output_file::open_base_file): Handle case where
3328 ::read returns less than requested size.
3330 2011-10-10 Cary Coutant <ccoutant@google.com>
3332 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3333 Initialize defined_count_.
3334 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3335 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3336 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3337 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3338 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3339 * incremental.h (Sized_relobj_incr::defined_count_): New data
3341 (Sized_incr_dynobj::defined_count_): New data member.
3342 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3343 Return zeroes instead of internal error.
3345 2011-10-10 Cary Coutant <ccoutant@google.com>
3348 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3349 (Output_reloc::symbol_value): Return PLT offset if flag is set.
3350 * output.h (class Output_reloc): Add use_plt_offset flag.
3351 (Output_reloc::type_): Adjust size of bit field.
3352 (Output_reloc::use_plt_offset_): New bit field.
3353 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3354 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3355 flag. Adjust all callers.
3356 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3357 creating RELATIVE relocations.
3359 2011-10-10 Nick Clifton <nickc@redhat.com>
3361 * po/es.po: Updated Spanish translation.
3362 * po/fi.po: Updated Finnish translation.
3364 2011-10-03 Diego Novillo <dnovillo@google.com>
3366 * options.cc (parse_uint): Fix dereference of RETVAL.
3368 2011-09-29 Sriraman Tallam <tmsriram@google.com>
3370 * layout.h (section_order_map_): New member.
3371 (get_section_order_map): New member function.
3372 * output.cc (Output_section::add_input_section): Check for patterns
3373 only when --section-ordering-file is specified.
3374 * gold.cc (queue_middle_tasks): Delay updating order of sections till
3375 output_sections have been formed.
3376 * layout.cc (Layout_Layout): Initialize section_order_map_.
3377 * plugin.cc (update_section_order): Store order in order_map. Do not
3379 * testsuite/Makefile.am: Add test case for plugin_final_layout.
3380 * testsuite/Makefile.in: Regenerate.
3381 * testsuite/plugin_section_order.c: New file.
3382 * testsuite/plugin_final_layout.cc: New file.
3383 * testsuite/plugin_final_layout.sh: New file.
3385 2011-09-29 Cary Coutant <ccoutant@google.com>
3387 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3389 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3390 symbols during incremental update.
3391 (Symbol_table::add_from_dynobj): Likewise.
3393 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3394 Ian Lance Taylor <iant@google.com>
3396 * symtab.cc (Symbol_table::define_special_symbol): Always
3397 canonicalize version string.
3399 2011-09-26 Cary Coutant <ccoutant@google.com>
3401 * gold.cc (queue_initial_tasks): Move option checks ...
3402 * options.cc (General_options::finalize): ... to here. Disable
3403 some options; make others fatal.
3405 2011-09-26 Cary Coutant <ccoutant@google.com>
3408 * plugin.cc (get_symbols_v2): New function.
3409 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3410 (is_referenced_from_outside): New function.
3411 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3412 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3413 (get_symbols): Pass version parameter.
3414 (get_symbols_v2): New function.
3415 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3417 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3418 (onload): Add LDPT_GET_SYMBOLS_V2.
3419 (all_symbols_read_hook): Use get_symbols_v2; check for
3420 LDPR_PREVAILING_DEF_IRONLY_EXP.
3421 * testsuite/plugin_test_3.sh: Update expected results.
3423 2011-09-23 Simon Baldwin <simonb@google.com>
3425 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3426 configuration options.
3427 * configure: Regenerate.
3428 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3429 * Makefile.in: Regenerate.
3430 * testsuite/Makefile.in: Regenerate.
3432 2011-09-19 Sriraman Tallam <tmsriram@google.com>
3434 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3436 2011-09-19 Cary Coutant <ccoutant@google.com>
3438 * incremental.cc (can_incremental_update): Fix typo in comment.
3439 * incremental.h (can_incremental_update): Likewise.
3441 2011-09-18 Cary Coutant <ccoutant@google.com>
3443 * incremental.cc (can_incremental_update): New function.
3444 * incremental.h (can_incremental_update): New function.
3445 * layout.cc (Layout::init_fixed_output_section): Call it.
3446 (Layout::make_output_section): Don't allow patch space in .eh_frame.
3447 * object.cc (Sized_relobj_file::do_layout): Call
3448 can_incremental_update.
3450 2011-09-13 Cary Coutant <ccoutant@google.com>
3452 * configure.ac: Check for glibc support for gnu_indirect_function
3453 support with static linking, setting automake conditional
3455 * Makefile.in: Regenerate.
3456 * configure: Regenerate.
3458 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3459 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3461 * testsuite/Makefile.in: Regenerate.
3463 2011-09-13 Cary Coutant <ccoutant@google.com>
3465 * incremental.cc (Sized_relobj_incr::do_layout): Call
3466 report_comdat_group for kept comdat sections.
3467 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3468 * testsuite/Makefile.in: Regenerate.
3469 * testsuite/incr_comdat_test_1.cc: New source file.
3470 * testsuite/incr_comdat_test_2_v1.cc: New source file.
3471 * testsuite/incr_comdat_test_2_v2.cc: New source file.
3472 * testsuite/incr_comdat_test_2_v3.cc: New source file.
3474 2011-09-13 Ian Lance Taylor <iant@google.com>
3476 * object.cc (Sized_relobj_file::do_layout): Remove unused local
3477 variable external_symbols_offset.
3479 2011-09-12 Ian Lance Taylor <iant@google.com>
3481 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3482 triggered if object has no symbols.
3484 2011-09-09 David S. Miller <davem@davemloft.net>
3486 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3487 (Output_fill_debug_line::do_write): Likewise.
3489 2011-08-29 Cary Coutant <ccoutant@google.com>
3491 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3492 casts to match formatting specs.
3493 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3495 2011-08-26 Cary Coutant <ccoutant@google.com>
3497 * layout.cc (Free_list::allocate): Provide guarantee of minimum
3498 remaining hole size when allocating.
3499 (Layout::make_output_section): Set fill methods for debug sections.
3500 * layout.h (Free_list::Free_list_node): Move from private to
3502 (Free_list::set_min_hole_size): New function.
3503 (Free_list::begin, Free_list::end): New functions.
3504 (Free_list::min_hole_): New data member.
3505 * output.cc: Include dwarf.h.
3506 (Output_fill_debug_info::do_minimum_hole_size): New function.
3507 (Output_fill_debug_info::do_write): New function.
3508 (Output_fill_debug_line::do_minimum_hole_size): New function.
3509 (Output_fill_debug_line::do_write): New function.
3510 (Output_section::Output_section): Initialize new data member.
3511 (Output_section::set_final_data_size): Ensure patch space is larger
3512 than minimum hole size.
3513 (Output_section::do_write): Fill holes in debug sections.
3514 * output.h (Output_fill): New class.
3515 (Output_fill_debug_info): New class.
3516 (Output_fill_debug_line): New class.
3517 (Output_section::set_free_space_fill): New function.
3518 (Output_section::free_space_fill_): New data member.
3519 * testsuite/Makefile.am (incremental_test_3): Add
3520 --incremental-patch option.
3521 (incremental_test_4): Likewise.
3522 (incremental_test_5): Likewise.
3523 (incremental_test_6): Likewise.
3524 (incremental_copy_test): Likewise.
3525 (incremental_common_test_1): Likewise.
3526 * testsuite/Makefile.in: Regenerate.
3528 2011-08-26 Nick Clifton <nickc@redhat.com>
3530 * po/es.po: Updated Spanish translation.
3532 2011-08-01 Cary Coutant <ccoutant@google.com>
3534 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3535 * gold/testsuite/Makefile.in: Regenerate.
3536 * gold/testsuite/justsyms_exec.c: New source file.
3537 * gold/testsuite/justsyms_lib.c: New source file.
3539 2011-08-01 Cary Coutant <ccoutant@google.com>
3541 * layout.cc (Layout::set_segment_offsets): Don't realign text
3542 segment if -Ttext was specified.
3543 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3545 * object.h (Sized_relobj_file::e_type): New function.
3546 (Sized_relobj_file::e_type_): New data member.
3547 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3548 base address for ET_EXEC files.
3549 * target.cc (Target::do_make_elf_object_implementation): Allow
3550 ET_EXEC files with --just-symbols option.
3552 2011-07-28 Cary Coutant <ccoutant@google.com>
3554 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3555 Add thread_number parameter.
3556 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3557 * workqueue-threads.cc
3558 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3559 current thread if its thread number is greater than desired thread
3561 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3562 Add thread_number parameter.
3563 (Workqueue::should_cancel_thread): Likewise.
3564 (Workqueue::find_runnable_or_wait): Pass thread_number to
3565 should_cancel_thread.
3566 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3569 2011-07-22 Sriraman Tallam <tmsriram@google.com>
3571 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3572 only after checking if it cannot be forced local.
3573 * symtab.h (is_externally_visible): Check if the symbol is not forced
3576 2011-07-15 Ian Lance Taylor <iant@google.com>
3578 * options.h (class General_options): Add --print-output-format.
3579 Move -EL next to -EB, for better --help output.
3580 * target-select.cc: Include <cstdio>, "options.h", and
3582 (Target_selector::do_target_bfd_name): New function.
3583 (print_output_format): New function.
3584 * target-select.h (class Target_selector): Update declarations.
3585 (Target_selector::target_bfd_name): New function.
3586 (print_output_format): Declare.
3587 * main.cc: Include "target-select.h".
3588 (main): Handle --print-output-format.
3589 * gold.cc: Include "target-select.h".
3590 (queue_initial_tasks): Handle --print-output-format when there are
3592 * parameters.cc (parameters_force_valid_target): Give a better
3593 error message if -EB/-EL does not match target.
3594 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3597 2011-07-15 Ian Lance Taylor <iant@google.com>
3599 * i386.cc (class Output_data_plt_i386): Add layout_ field.
3600 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3601 (Output_data_plt_i386::do_write): Write address of .dynamic
3602 section to first entry in .got.plt section.
3603 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3604 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3606 (Output_data_plt_x86_64::do_write): Write address of .dynamic
3607 section to first entry in .got.plt section.
3608 * layout.h (Layout::dynamic_section): New function.
3610 2011-07-13 Sriraman Tallam <tmsriram@google.com>
3612 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3614 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3615 input_section_position_, and input_section_glob_.
3616 (read_layout_from_file): Call function section_ordering_specified.
3617 * layout.h (is_section_ordering_specified): New function.
3618 (section_ordering_specified): New function.
3619 (section_ordering_specified_): New boolean member.
3620 * main.cc(main): Call load_plugins after layout object is defined.
3621 * output.cc (Output_section::add_input_section): Use
3622 function section_ordering_specified to check if section ordering is
3624 * output.cc (Output_section::add_relaxed_input_section): Use
3625 function section_ordering_specified to check if section ordering is
3627 (Output_section::update_section_layout): New function.
3628 (Output_section::sort_attached_input_sections): Check if input section
3630 * output.h (Output_section::update_section_layout): New function.
3631 * plugin.cc (get_section_count): New function.
3632 (get_section_type): New function.
3633 (get_section_name): New function.
3634 (get_section_contents): New function.
3635 (update_section_order): New function.
3636 (allow_section_ordering): New function.
3637 (Plugin::load): Add the new interfaces to the transfer vector.
3638 (Plugin_manager::load_plugins): New parameter.
3639 (Plugin_manager::all_symbols_read): New parameter.
3640 (Plugin_manager::claim_file): New parameter. Save the elf object for
3642 (Plugin_manager::get_elf_object): New function.
3643 (Plugin_manager::get_view): Change to directly use the bool to check
3644 if get_view is called from claim_file_hook.
3645 * plugin.h (input_objects): New function
3646 (Plugin__manager::load_plugins): New parameter.
3647 (Plugin_manager::claim_file): New parameter.
3648 (Plugin_manager::get_elf_object): New function.
3649 (Plugin_manager::in_claim_file_handler): New function.
3650 (Plugin_manager::in_claim_file_handler_): New member.
3651 (layout): New function.
3652 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3653 handler with an extra parameter. Make the elf object before calling
3655 * testsuite/plugin_test.c (get_section_count): New function pointer.
3656 (get_section_type): New function pointer.
3657 (get_section_name): New function pointer.
3658 (get_section_contents): New function pointer.
3659 (update_section_order): New function pointer.
3660 (allow_section_ordering): New function pointer.
3661 (onload): Check if the new interfaces exist.
3663 2011-07-13 Ian Lance Taylor <iant@google.com>
3665 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3667 * x86_64.cc (Target_x86_64::got_section): Likewise.
3668 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3669 (relro_now_test_SOURCES): New variable.
3670 (relro_now_test_DEPENDENCIES): New variable.
3671 (relro_now_test_LDFLAGS): New variable.
3672 (relro_now_test_LDADD): New variable.
3673 (relro_now_test.so): New target.
3674 * testsuite/Makefile.in: Rebuild.
3676 2011-07-12 Ian Lance Taylor <iant@google.com>
3679 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3680 GLOB_DAT relocation rather than a RELATIVE relocation for a
3681 protected symbol when creating a shared library.
3682 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3683 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3684 * testsuite/protected_main_1.cc (main): Test that protected
3685 function has same address.
3687 2011-07-11 Ian Lance Taylor <iant@google.com>
3690 * options.h (class General_options): Add -Bgroup.
3691 * options.cc (General_options::finalize): If -Bgroup is set,
3692 default to --unresolved-symbols=report-all.
3693 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3694 * target-reloc.h (issue_undefined_symbol_error): Handle
3695 --unresolved-symbols=report-all.
3697 2011-07-08 Ian Lance Taylor <iant@google.com>
3700 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3701 if linker script discards key sections.
3702 (Layout::create_dynamic_symtab): Likewise.
3703 (Layout::assign_local_dynsym_offsets): Likewise.
3704 (Layout::sized_create_version_sections): Likewise.
3705 (Layout::create_interp): Likewise.
3706 (Layout::finish_dynamic_section): Likewise.
3707 (Layout::set_dynamic_symbol_size): Likewise.
3709 2011-07-08 Ian Lance Taylor <iant@google.com>
3712 * options.h (class General_options): Add --unresolved-symbols.
3713 * target-reloc.h (issue_undefined_symbol_error): Check
3714 --unresolved-symbols. Add comments.
3716 2011-07-08 Ian Lance Taylor <iant@google.com>
3718 * testsuite/odr_violation2.cc (Ordering::operator()): Make
3719 expression more complex.
3721 2011-07-08 Ian Lance Taylor <iant@google.com>
3724 * target-reloc.h (issue_undefined_symbol_error): New inline
3725 function, broken out of relocate_section.
3726 (relocate_section): Call issue_undefined_symbol_error.
3727 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3728 there is no TLS segment if we are about to issue an undefined
3730 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3732 2011-07-08 Ian Lance Taylor <iant@google.com>
3735 * resolve.cc (Symbol_table::should_override): Add fromtype
3736 parameter. Change all callers. Give error when linking together
3737 TLS and non-TLS symbol.
3738 (Symbol_table::should_override_with_special): Add fromtype
3739 parameter. Change all callers.
3740 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3741 there is no TLS segment if we have reported some errors.
3742 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3744 2011-07-08 Ian Lance Taylor <iant@google.com>
3747 * target.h (Target::plt_address_for_global): New function.
3748 (Target::plt_address_for_local): New function.
3749 (Target::plt_section_for_global): Remove.
3750 (Target::plt_section_for_local): Remove.
3751 (Target::do_plt_address_for_global): New virtual function.
3752 (Target::do_plt_address_for_local): New virtual function.
3753 (Target::do_plt_section_for_global): Remove.
3754 (Target::do_plt_section_for_local): Remove.
3755 (Target::register_global_plt_entry): Add Symbol_table and Layout
3757 * output.cc (Output_data_got::Got_entry::write): Use
3758 plt_address_for_global and plt_address_for_local.
3759 * layout.cc (Layout::add_target_dynamic_tags): Use size and
3760 address of output section.
3761 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3762 got_irelative_, and irelative_count_ fields. Update
3764 (Output_data_plt_i386::has_irelative_section): New function.
3765 (Output_data_plt_i386::entry_count): Add irelative_count_.
3766 (Output_data_plt_i386::set_final_data_size): Likewise.
3767 (class Target_i386): Add got_irelative_ and rel_irelative_
3768 fields. Update declarations.
3769 (Target_i386::Target_i386): Initialize new fields.
3770 (Target_i386::do_plt_address_for_global): New function replacing
3771 do_plt_section_for_global.
3772 (Target_i386::do_plt_address_for_local): New function replacing
3773 do_plt_section_for_local.
3774 (Target_i386::got_section): Create got_irelative_.
3775 (Target_i386::rel_irelative_section): New function.
3776 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3777 fields. Don't define __rel_iplt_{start,end}.
3778 (Output_data_plt_i386::add_entry): Add symtab and layout
3779 parameters. Change all callers. Use different PLT and GOT for
3781 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3782 layout parameters. Change all callers. Use different PLT and
3784 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3785 (Output_data_plt_i386::rel_irelative): New function.
3786 (Output_data_plt_i386::address_for_global): New function.
3787 (Output_data_plt_i386::address_for_local): New function.
3788 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
3789 IRELATIVE GOT when changing IFUNC GOT entries.
3790 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3792 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3793 if we didn't create an IRELATIVE GOT.
3794 (Target_i386::Relocate::relocate): Use plt_address_for_global and
3795 plt_address_for_local.
3796 (Target_i386::do_dynsym_value): Use plt_address_for_global.
3797 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3798 got_irelative_, and irelative_count_ fields. Update
3800 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3801 Initialize new fields. Remove symtab parameter. Change all
3803 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3805 (Output_data_plt_x86_64::has_irelative_section): New function.
3806 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3807 (class Target_x86_64): Add got_irelative_ and rel_irelative_
3808 fields. Update declarations.
3809 (Target_x86_64::Target_x86_64): Initialize new fields.
3810 (Target_x86_64::do_plt_address_for_global): New function replacing
3811 do_plt_section_for_global.
3812 (Target_x86_64::do_plt_address_for_local): New function replacing
3813 do_plt_section_for_local.
3814 (Target_x86_64::got_section): Create got_irelative_.
3815 (Target_x86_64::rela_irelative_section): New function.
3816 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
3817 all callers. Don't create __rel_iplt_{start,end}.
3818 (Output_data_plt_x86_64::add_entry): Add symtab and layout
3819 parameters. Change all callers. Use different PLT and GOT for
3821 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3822 layout parameters. Change all callers. Use different PLT and
3824 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3825 parameters. Change all callers. Use different PLT and GOT for
3827 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3828 (Output_data_plt_x86_64::rela_irelative): New function.
3829 (Output_data_plt_x86_64::address_for_global): New function.
3830 (Output_data_plt_x86_64::address_for_local): New function.
3831 (Output_data_plt_x86_64::set_final_data_size): Likewise.
3832 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3833 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3834 (Target_x86_64::register_global_plt_entry): Add symtab and layout
3836 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3838 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3839 symbols if we didn't create an IRELATIVE GOT.
3840 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3841 plt_address_for_local.
3842 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3843 * testsuite/ifuncvar1.c: New test file.
3844 * testsuite/ifuncvar2.c: New test file.
3845 * testsuite/ifuncvar3.c: New test file.
3846 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3847 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3848 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3849 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3850 * testsuite/Makefile.in: Rebuild.
3852 2011-07-07 Cary Coutant <ccoutant@google.com>
3854 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3855 (two_file_test_1_ndebug.o): Likewise.
3856 (two_file_test_1b_ndebug.o): Likewise.
3857 (two_file_test_2_ndebug.o): Likewise.
3858 (two_file_test_main_ndebug.o): Likewise.
3859 (incremental_test_2): Link with no-debug versions.
3861 2011-07-06 Cary Coutant <ccoutant@google.com>
3863 * gold/incremental.cc
3864 (Output_section_incremental_inputs::write_info_blocks): Check for
3865 hidden and internal symbols.
3867 2011-07-06 Cary Coutant <ccoutant@google.com>
3869 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3870 Check disposition for startup file.
3871 (Incremental_inputs::report_command_line): Ignore
3872 --incremental-startup-unchanged option.
3873 * options.cc (General_options::parse_incremental_startup_unchanged):
3875 (General_options::General_options): Initialize new data member.
3876 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3877 (General_options): Add --incremental-startup-unchanged option.
3878 (General_options::incremental_startup_disposition): New function.
3879 (General_options::incremental_startup_disposition_): New data member.
3881 2011-07-06 Cary Coutant <ccoutant@google.com>
3883 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3884 input file index to Script_info ctor.
3885 (Sized_incremental_binary::do_file_has_changed): Find the
3886 command-line argument for files named in scripts.
3887 * incremental.h (Script_info::Script_info): New ctor
3888 with input file index.
3889 (Script_info::input_file_index): New function.
3890 (Script_info::input_file_index_): New data member.
3891 (Incremental_binary::get_library): Add const.
3892 (Incremental_binary::get_script_info): Add const.
3893 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3894 * testsuite/Makefile.am (incremental_test_5): New test case.
3895 (incremental_test_6): New test case.
3896 * testsuite/Makefile.in: Regenerate.
3898 2011-07-06 Cary Coutant <ccoutant@google.com>
3900 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3901 debug output when command lines differ.
3903 2011-07-06 Cary Coutant <ccoutant@google.com>
3905 * incremental.cc (Incremental_inputs::report_command_line): Ignore
3906 --incremental-patch option.
3907 * layout.cc (Free_list::allocate): Extend allocation beyond original
3909 (Layout::make_output_section): Mark sections that should get
3911 * options.cc (parse_percent): New function.
3912 * options.h (parse_percent): New function.
3913 (DEFINE_percent): New macro.
3914 (General_options): Add --incremental-patch option.
3915 * output.cc (Output_section::Output_section): Initialize new data
3917 (Output_section::add_input_section): Print section name when out
3919 (Output_section::add_output_section_data): Likewise.
3920 (Output_section::set_final_data_size): Add patch space when
3921 doing --incremental-full.
3922 (Output_section::do_reset_address_and_file_offset): Remove patch
3924 (Output_segment::set_section_list_addresses): Print debug output
3925 only if --incremental-update.
3926 * output.h (Output_section::set_is_patch_space_allowed): New function.
3927 (Output_section::is_patch_space_allowed_): New data member.
3928 (Output_section::patch_space_): New data member.
3929 * parameters.cc (Parameters::incremental_full): New function.
3930 * parameters.h (Parameters::incremental_full): New function
3931 * testsuite/Makefile.am (incremental_test_2): Add test for
3932 --incremental-patch option.
3933 * testsuite/Makefile.in: Regenerate.
3934 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3935 (t18): Remove function body.
3937 2011-07-05 Doug Kwan <dougkwan@google.com>
3940 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3941 Arm_Address type for relocation result.
3942 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
3944 (Arm_relocate_functions::abs32): Use unaligned access.
3945 (Arm_relocate_functions::rel32): Ditto.
3946 (Arm_relocate_functions::prel31): Ditto.
3947 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3948 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3949 static data relocations.
3950 * testsuite/Makefile.in: Regnerate.
3951 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3953 2011-07-05 Ian Lance Taylor <iant@google.com>
3956 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3957 symbols if necessary.
3958 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3960 2011-07-05 Ian Lance Taylor <iant@google.com>
3963 * resolve.cc (Symbol::override_base_with_special): Simply override
3964 version with special symbol version, ignoring previous version.
3966 2011-07-05 Ian Lance Taylor <iant@google.com>
3968 * object.cc (Sized_relobj_file::include_section_group): Add
3969 information to comment about signature location.
3971 2011-07-02 Ian Lance Taylor <iant@google.com>
3974 * options.h (class General_options): Add -f and -F.
3975 * options.cc (General_options::finalize): Fatal error if -f/-F
3976 are used without -shared.
3977 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3979 2011-07-02 Ian Lance Taylor <iant@google.com>
3981 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3983 2011-07-01 Ian Lance Taylor <iant@google.com>
3987 * resolve.cc (Symbol::override_base_with_special): Don't override
3988 the version if the overriding symbol has a different name.
3989 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
3990 all callers. If we give an error about an undefined version,
3991 define the base version if necessary.
3992 * dynobj.h (class Versions): Update declaration.
3993 * testsuite/weak_alias_test_5.cc: New file.
3994 * testsuite/weak_alias_test.script: New file.
3995 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3996 and versioned_alias have the right value, and call t2.
3997 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3998 weak_alias_test_5.so.
3999 (weak_alias_test_LDADD): Likewise.
4000 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4001 * testsuite/Makefile.in: Rebuild.
4003 2011-07-01 Ian Lance Taylor <iant@google.com>
4006 * options.h (class General_options): Support -z notext.
4007 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4009 (two_file_shared_nonpic.so): Likewise.
4010 (two_file_shared_mixed.so): Likewise.
4011 (two_file_shared_mixed_1.so): Likewise.
4012 (weak_undef_lib_nonpic.so): Likewise.
4013 (alt/weak_undef_lib_nonpic.so): Likewise.
4014 (tls_test_shared_nonpic.so): Likewise.
4015 * testsuite/Makefile.in: Rebuild.
4017 2011-07-01 Ian Lance Taylor <iant@google.com>
4020 * configure.ac: Test whether static linking works, setting
4021 the automake conditional HAVE_STATIC.
4022 * testsuite/Makefile.am: Disable tests using -static if
4023 HAVE_STATIC is not true.
4024 * configure, testsuite/Makefile.in: Rebuild.
4026 2011-07-01 Ian Lance Taylor <iant@google.com>
4029 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4030 Assert if we see DW_EH_PE_indirect.
4031 * target.h (Target::ehframe_datarel_base): New function.
4032 (Target::do_ehframe_datarel_base): New target function.
4033 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4034 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4037 2011-07-01 Ian Lance Taylor <iant@google.com>
4040 * options.h (class General_options): Add
4041 --ld-generated-unwind-info.
4042 * ehframe.cc (Fde::write): Add address parameter. Change all
4043 callers. If associated with PLT, fill in address and size.
4044 (Cie::set_output_offset): Only add merge mapping if there is an
4046 (Cie::write): Add address parameter. Change all callers.
4047 (Eh_frame::add_ehframe_for_plt): New function.
4048 * ehframe.h (class Fde): Update declarations. Move shndx_ and
4049 input_offset_ fields into union u_, with new plt field.
4050 (Fde::Fde): Adjust for new union field.
4051 (Fde::Fde) [Output_data version]: New constructor.
4052 (Fde::add_mapping): Only add merge mapping if there is an object.
4053 (class Cie): Update declarations.
4054 (class Eh_frame): Declare add_ehframe_for_plt.
4055 * layout.cc (Layout::layout_eh_frame): Break out code into
4056 make_eh_frame_section, and call it.
4057 (Layout::make_eh_frame_section): New function.
4058 (Layout::add_eh_frame_for_plt): New function.
4059 * layout.h (class Layout): Update declarations.
4060 * merge.cc (Merge_map::add_mapping): Add assertion.
4061 * i386.cc: Include "dwarf.h".
4062 (class Output_data_plt_i386): Make first_plt_entry,
4063 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
4064 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4065 and plt_eh_frame_fde.
4066 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4067 boundary. Call add_eh_frame_for_plt if appropriate.
4068 * x86_64.cc: Include "dwarf.h".
4069 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
4070 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
4071 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4072 and plt_eh_frame_fde.
4073 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4076 2011-06-29 Ian Lance Taylor <iant@google.com>
4079 * object.cc (Sized_relobj_file::layout_section): Change shdr
4080 parameter to be const.
4081 (Sized_relobj_file::layout_eh_frame_section): New function, broken
4083 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4084 appropriate. Call layout_eh_frame_section.
4085 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4087 * object.h (class Sized_relobj_file): Update declarations.
4089 2011-06-29 Ian Lance Taylor <iant@google.com>
4092 * script.cc (Token::integer_value): Accept trailing M/m/K/k
4094 (Lex::gather_token): Accept trailing M/m/K/k for integers.
4096 2011-06-29 Ian Lance Taylor <iant@google.com>
4099 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4101 * layout.cc (Layout::layout_eh_frame): Likewise.
4103 2011-06-29 Ian Lance Taylor <iant@google.com>
4106 * layout.cc (Layout::symtab_section_shndx): New function.
4107 * layout.h (class Layout): Declare symtab_section_shndx.
4108 * output.cc (Output_section::write_header): Call it.
4110 2011-06-29 Ian Lance Taylor <iant@google.com>
4113 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4114 symbols which are not used in a relocation.
4116 2011-06-28 Ian Lance Taylor <iant@google.com>
4119 * layout.cc (Layout::segment_precedes): Don't crash if a linker
4120 script create indistinguishable segments.
4121 (Layout::set_segment_offsets): Use stable_sort when sorting
4122 segments. Pass this to Compare_segments constructor.
4123 * layout.h (class Layout): Make segment_precedes non-static.
4124 (class Compare_segments): Change from struct to class. Add
4125 layout_ field. Add constructor.
4126 * script-sections.cc
4127 (Script_sections::attach_sections_using_phdrs_clause): Rename
4128 local orphan to is_orphan. Don't report failure to put empty
4129 section in segment. On attachment failure, report name of
4130 section, and attach to first PT_LOAD segment.
4132 2011-06-28 Ian Lance Taylor <iant@google.com>
4135 * target-select.cc (Target_selector::Target_selector): Add
4136 emulation parameter. Change all callers.
4137 (select_target_by_bfd_name): Rename from select_target_by_name.
4139 (select_target_by_emulation): New function.
4140 (supported_emulation_names): New function.
4141 * target-select.h (class Target_selector): Add emulation_ field.
4142 Update declarations.
4143 (Target_selector::recognize_by_bfd_name): Rename from
4144 recognize_by_name. Change all callers.
4145 (Target_selector::supported_bfd_names): Rename from
4146 supported_names. Change all callers.
4147 (Target_selector::recognize_by_emulation): New function.
4148 (Target_selector::supported_emulations): New function.
4149 (Target_selector::emulation): New function.
4150 (Target_selector::do_recognize_by_bfd_name): Rename from
4151 do_recognize_by_name. Change all callers.
4152 (Target_selector::do_supported_bfd_names): Rename from
4153 do_supported_names. Change all callers.
4154 (Target_selector::do_recognize_by_emulation): New function.
4155 (Target_selector::do_supported_emulations): New function.
4156 (select_target_by_bfd_name): Change name in declaration.
4157 (select_target_by_emulation): Declare.
4158 (supported_emulation_names): Declare.
4159 * parameters.cc (parameters_force_valid_target): Try to find
4160 target based on emulation from -m option.
4161 * options.h (class General_options): Change doc string for -m.
4162 * options.cc (help): Print emulations.
4163 (General_options::parse_V): Likewise.
4164 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4165 Add emulation parameter. Change all callers.
4167 2011-06-28 Ian Lance Taylor <iant@google.com>
4169 * target.h (class Target): Add osabi_ field.
4170 (Target::osabi): New function.
4171 (Target::set_osabi): New function.
4172 (Target::Target): Initialize osabi_.
4173 (Target::do_adjust_elf_header): Make pure virtual.
4174 (Sized_target::do_adjust_elf_header): Declare.
4175 * target.cc (Sized_target::do_adjust_elf_header): New function.
4176 (class Sized_target): Instantiate all versions.
4177 * freebsd.h (class Target_freebsd): Remove.
4178 (Target_selector_freebsd::do_recognize): Call set_osabi on
4180 (Target_selector_freebsd::do_recognize_by_name): Likewise.
4181 (Target_selector_freebsd::set_osabi): Remove.
4182 * i386.cc (class Target_i386): Inherit from Sized_target rather
4183 than Target_freebsd.
4184 * x86_64.cc (class Target_x86_64): Likewise.
4186 2011-06-28 Ian Lance Taylor <iant@google.com>
4188 * target.h (Target::can_check_for_function_pointers): Rewrite.
4190 (Target::can_icf_inline_merge_sections): Likewise.
4191 (Target::section_may_have_icf_unsafe_poineters): Likewise.
4192 (Target::Target_info): Add can_icf_inline_merge_sections field.
4193 (Target::do_can_check_for_function_pointers): New virtual
4195 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4196 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4197 from can_check_for_function_pointers, move in file.
4198 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4199 section_may_have_icf_unsafe_poineters, move in file.
4200 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4201 * i386.cc (Target_i386::do_can_check_for_function_pointers):
4202 Rename from can_check_for_function_pointers, move in file.
4203 (Target_i386::can_icf_inline_merge_sections): Remove.
4204 (Target_i386::i386_info): Initialize
4205 can_icf_inline_merge_sections.
4206 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4207 Initialize can_icf_inline_merge_sections.
4208 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4209 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4210 Rename from can_check_for_function_pointers, move in file.
4211 (Target_x86_64::can_icf_inline_merge_sections): Remove.
4212 (Target_x86_64::x86_64_info): Initialize
4213 can_icf_inline_merge_sections.
4214 * testsuite/testfile.cc (Target_test::test_target_info):
4216 * icf.cc (get_section_contents): Correct formatting.
4218 2011-06-27 Ian Lance Taylor <iant@google.com>
4220 * symtab.cc (Symbol::versioned_name): New function.
4221 (Symbol_table::add_to_final_symtab): Use versioned_name when
4223 (Symbol_table::sized_write_symbol): Likewise.
4224 * symtab.h (class Symbol): Declare versioned_name.
4225 * stringpool.h (class Stringpool_template): Add variant of add
4226 which takes a std::basic_string.
4227 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4228 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4229 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4230 (ver_test_12.o): New target.
4231 * testsuite/Makefile.in: Rebuild.
4233 2011-06-27 Doug Kwan <dougkwan@google.com>
4235 * arm.cc (Arm_relocate_functions::thm_jump8,
4236 Arm_relocate_functions::thm_jump11): Use a wider signed
4237 type to compute offset.
4238 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4240 * testsuite/Makefile.in: Regenerate.
4241 * testsuite/arm_branch_in_range.sh: Check test results of
4242 arm_thm_jump11 and arm_thm_jump8.
4243 * testsuite/arm_thm_jump11.s: New test source file.
4244 * testsuite/arm_thm_jump11.t: New linker script.
4245 * testsuite/arm_thm_jump8.s: New test source file.
4246 * testsuite/arm_thm_jump8.t: New linker script.
4248 2011-06-24 Ian Lance Taylor <iant@google.com>
4250 * layout.cc: Include "object.h".
4251 (ctors_sections_in_init_array): New static variable.
4252 (Layout::is_ctors_in_init_array): New function.
4253 (Layout::layout): Add entry to ctors_sections_in_init_array if
4255 * layout.h (class Layout): Declare is_ctors_in_init_array.
4256 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4257 is_ctors_reverse_view is set.
4258 (Sized_relobj_file::write_sections): Add layout parameter. Change
4259 all callers. Set is_ctors_reverse_view field of View_size.
4260 (Sized_relobj_file::reverse_words): New function.
4261 * object.h (Sized_relobj_file::View_size): Add
4262 is_ctors_reverse_view field.
4263 (class Sized_relobj_file): Update declarations.
4264 * testsuite/initpri3.c: New test.
4265 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4267 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4268 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4269 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4270 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4271 * testsuite/Makefile.in: Rebuild.
4273 2011-06-24 Cary Coutant <ccoutant@google.com>
4275 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4276 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4277 (debug_msg_cdebug.err): New targets.
4278 * testsuite/Makefile.in: Regenerate.
4279 * testsuite/debug_msg.sh: Check output of link with compressed debug.
4280 Fix checks for link with shared library.
4282 2011-06-24 Doug Kwan <dougkwan@google.com>
4284 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4285 skip empty text sections.
4286 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4288 2011-06-22 Ian Lance Taylor <iant@google.com>
4291 * options.h (class General_options): Add --ctors-in-init-array.
4292 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4293 friends as SHT_PROGBITS for merging sections.
4294 (Layout::layout): Remove special handling of .init_array and
4295 friends. Don't sort if doing relocatable link. Sort for .ctors
4296 and .dtors if ctors_in_init_array.
4297 (Layout::make_output_section): Force correct section types for
4298 .init_array and friends. Don't sort if doing relocatable link,
4299 Don't sort .ctors and .dtors if ctors_in_init_array.
4300 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4301 (Layout::output_section_name): Add relobj parameter. Change all
4302 callers. Handle .ctors. and .dtors. in code rather than table.
4303 Handle .ctors and .dtors if ctors_in_init_array.
4304 (Layout::match_file_name): New function, moved from output.cc.
4305 * layout.h (class Layout): Update declarations.
4306 * output.cc: Include "layout.h".
4307 (Input_section_sort_entry::get_priority): New function.
4308 (Input_section_sort_entry::match_file_name): Just call
4309 Layout::match_file_name.
4310 (Output_section::Input_section_sort_init_fini_compare::operator()):
4311 Handle .ctors and .dtors. Sort by explicit priority rather than
4313 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4314 * testsuite/initpri2.c: New test.
4315 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4316 (check_PROGRAMS): Add initpri2.
4317 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4318 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4319 * configure, testsuite/Makefile.in: Rebuild.
4321 2011-06-19 Ian Lance Taylor <iant@google.com>
4324 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4325 .interp section to a PT_INTERP segment even if we have seen a
4326 --dynamic-linker option. Don't do it if we have seen a PHDRS
4327 clause in a linker script.
4328 (Layout::finalize): Don't create a .interp section if we've
4329 already create a PT_INTERP segment.
4330 (Layout::create_interp): Always call choose_output_section (revert
4331 patch of 2011-06-17). Don't create PT_INTERP segment.
4332 * script-sections.cc
4333 (Script_sections::create_note_and_tls_segments): Add a .interp
4334 section to a PT_INTERP segment even if we have seen a
4335 --dynamic-linker option.
4337 2011-06-18 Ian Lance Taylor <iant@google.com>
4339 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4340 merely because a non-PT_LOAD segment has a dynamic reloc.
4342 2011-06-18 Ian Lance Taylor <iant@google.com>
4344 * layout.cc (Layout::finish_dynamic_section): Don't create
4345 DT_FLAGS entry if not needed.
4347 2011-06-18 Ian Lance Taylor <iant@google.com>
4350 * layout.cc (Layout::layout_eh_frame): Correct handling of
4351 writable .eh_frame section.
4353 2011-06-17 Ian Lance Taylor <iant@google.com>
4356 * resolve.cc (Symbol_table::resolve): Don't give an error if a
4357 symbol is redefined with the exact same object and value.
4359 2011-06-17 Ian Lance Taylor <iant@google.com>
4362 * layout.h (class Layout): Add interp_segment_ field.
4363 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4364 (Layout::attach_allocated_section_to_segment): If making shared
4365 library, put .interp section in PT_INTERP segment.
4366 (Layout::finalize): Also call create_interp if -dynamic-linker
4368 (Layout::create_interp): Assert that there is no PT_INTERP
4369 segment. If not using a SECTIONS clause, use make_output_section.
4370 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4371 * script-sections.cc
4372 (Script_sections::create_note_and_tls_segments): If making shared
4373 library, put .interp section in PT_INTERP segment.
4375 2011-06-17 Ian Lance Taylor <iant@google.com>
4377 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4378 when making a shared library.
4380 2011-06-17 Ian Lance Taylor <iant@google.com>
4382 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4383 parameter. Change all callers. Don't issue warning about PC32
4384 against locally defined symbol.
4386 2011-06-16 Ian Lance Taylor <iant@google.com>
4388 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4389 occurs in same object.
4391 2011-06-14 Alan Modra <amodra@gmail.com>
4393 * po/POTFILES.in: Regenerate.
4395 2011-06-09 Ian Lance Taylor <iant@google.com>
4397 * script-sections.cc
4398 (Orphan_output_section::set_section_addresses): For a relocatable
4399 link set address to 0.
4401 2011-06-09 Cary Coutant <ccoutant@google.com>
4404 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4405 used with --compress-debug-sections.
4406 * gold/object.cc (Sized_relobj_file::do_layout): Report
4407 uncompressed size of compressed input sections.
4409 2011-06-08 Cary Coutant <ccoutant@google.com>
4412 * testsuite/two_file_test_2_v1.cc: Change initialization of
4413 v2 to keep it in .data.
4415 2011-06-07 Cary Coutant <ccoutant@google.com>
4417 * common.cc (Symbol_table::do_allocate_commons_list): Call
4419 * errors.cc (Errors::fatal): Adjust call to gold_exit.
4420 (Errors::fallback): New function.
4421 (gold_fallback): New function.
4422 * errors.h (Errors::fallback): New function.
4423 * gold.cc (gold_exit): Change status parameter to enum; adjust
4425 (queue_initial_tasks): Call gold_fallback.
4426 * gold.h: Include cstdlib.
4427 (Exit_status): New enum type.
4428 (gold_exit): Change status parameter to enum.
4429 (gold_fallback): New function.
4430 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4431 (Layout::create_symtab_sections): Likewise.
4432 (Layout::create_shdrs): Likewise.
4433 * main.cc (main): Adjust call to gold_exit.
4434 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4435 (Output_data_got::add_got_entry_pair): Likewise.
4436 (Output_section::add_input_section): Likewise.
4437 (Output_section::add_output_section_data): Likewise.
4438 (Output_segment::set_section_list_addresses): Likewise.
4439 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4441 2011-06-07 Cary Coutant <ccoutant@google.com>
4443 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4444 for incremental links.
4445 * output.cc (Output_segment::set_section_list_addresses): Remove
4446 FIXME and test for TLS or BSS.
4448 2011-06-07 Cary Coutant <ccoutant@google.com>
4450 * testsuite/Makefile.am: Add incremental_copy_test,
4451 incremental_common_test_1.
4452 * testsuite/Makefile.in: Regenerate.
4453 * testsuite/common_test_1_v1.c: New source file.
4454 * testsuite/common_test_1_v2.c: New source file.
4455 * testsuite/copy_test_v1.cc: New source file.
4457 2011-06-07 Cary Coutant <ccoutant@google.com>
4459 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4460 update, allocate common from bss section's free list.
4461 * incremental-dump.cc (dump_incremental_inputs): Print flag for
4462 linker-defined symbols.
4463 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4464 Skip GOT and PLT entries that are no longer referenced.
4465 (Output_section_incremental_inputs::write_info_blocks): Mark
4466 linker-defined symbols.
4467 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4468 * output.cc (Output_section::allocate): New function.
4469 * output.h (Output_section::allocate): New function.
4470 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4471 linker-defined symbols.
4472 (Symbol::override_base_with_special): Copy is_predefined_ flag.
4473 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4474 (Symbol::init_base_output_data): Likewise.
4475 (Symbol::init_base_output_segment): Likewise.
4476 (Symbol::init_base_constant): Likewise.
4477 (Sized_symbol::init_output_data): Likewise.
4478 (Sized_symbol::init_output_segment): Likewise.
4479 (Sized_symbol::init_constant): Likewise.
4480 (Symbol_table::do_define_in_output_data): Likewise.
4481 (Symbol_table::do_define_in_output_segment): Likewise.
4482 (Symbol_table::do_define_as_constant): Likewise.
4483 * symtab.h (Symbol::is_predefined): New function.
4484 (Symbol::init_base_output_data): Add is_predefined parameter.
4485 (Symbol::init_base_output_segment): Likewise.
4486 (Symbol::init_base_constant): Likewise.
4487 (Symbol::is_predefined_): New data member.
4488 (Sized_symbol::init_output_data): Add is_predefined parameter.
4489 (Sized_symbol::init_output_segment): Likewise.
4490 (Sized_symbol::init_constant): Likewise.
4491 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4493 2011-06-07 Cary Coutant <ccoutant@google.com>
4495 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4496 instead of emit_copy_reloc.
4497 (Copy_relocs::emit_copy_reloc): Refactor.
4498 (Copy_relocs::make_copy_reloc): New function.
4499 (Copy_relocs::add_copy_reloc): Remove.
4500 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4502 (Copy_relocs::make_copy_reloc): New function.
4503 (Copy_relocs::add_copy_reloc): Remove.
4504 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4505 unchanged input files.
4506 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4507 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4508 Reserve BSS space for COPY relocations.
4509 (Sized_incremental_binary::do_emit_copy_relocs): New function.
4510 (Output_section_incremental_inputs::write_info_blocks): Record
4511 whether a symbol is copied from a shared object.
4512 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4513 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4514 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4515 (Incremental_input_entry_reader::get_output_symbol_index): Add
4517 (Incremental_binary::emit_copy_relocs): New function.
4518 (Incremental_binary::do_emit_copy_relocs): New function.
4519 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4521 (Sized_incremental_binary::add_copy_reloc): New function.
4522 (Sized_incremental_binary::do_emit_copy_relocs): New function.
4523 (Sized_incremental_binary::Copy_reloc): New struct.
4524 (Sized_incremental_binary::Copy_relocs): New typedef.
4525 (Sized_incremental_binary::copy_relocs_): New data member.
4526 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4527 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4528 * target.h (Sized_target::emit_copy_reloc): New function.
4529 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4531 2011-06-02 Cary Coutant <ccoutant@google.com>
4534 * gold/archive.cc (Archive::Archive): Initialize new data member.
4535 (Archive::include_all_members): Return if archive has already been
4537 * gold/archive.h (Archive::include_all_members_): New data member.
4539 2011-06-02 Nick Clifton <nickc@redhat.com>
4541 * dynobj.h: Fix spelling mistake in comment.
4542 * output.cc: Likewise.
4544 2011-05-31 Doug Kwan <dougkwan@google.com>
4548 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4549 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4550 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
4551 redundant arm_exidx_test.so.
4552 * testsuite/Makefile.in: Regenerate.
4553 (check_SCRIPTS): Add pr12826.sh
4554 (check_DATA): Add pr12826.stdout
4555 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4556 * testsuite/pr12826.sh: New file.
4557 * testsuite/pr12826_1.s: Ditto.
4558 * testsuite/pr12826_1.s: Ditto.
4560 2011-05-30 Ian Lance Taylor <iant@google.com>
4562 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4565 2011-05-29 Ian Lance Taylor <iant@google.com>
4568 * testsuite/Makefile.am: Use different file name for two_file_test
4569 temporary file for each incremental test.
4570 * testsuite/Makefile.in: Rebuild.
4572 2011-05-29 Ian Lance Taylor <iant@google.com>
4574 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4575 binary input file is empty.
4577 2011-05-27 Ian Lance Taylor <iant@google.com>
4579 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4580 (ver_test_9.so): Likewise.
4581 * testsuite/Makefile.in: Rebuild.
4583 2011-05-26 Cary Coutant <ccoutant@google.com>
4585 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4586 * incremental.cc (Incremental_inputs::report_input_section): Fix
4587 comment, indentation.
4588 (Incremental_inputs::report_comdat_group): New function.
4589 (Output_section_incremental_inputs::set_final_data_size): Adjust size
4590 of data for incremental input file entry.
4591 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4592 group count, COMDAT group signatures.
4593 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4594 an unchanged input file.
4595 * incremental.h (Incremental_object_entry::Incremental_object_entry):
4596 Initialize new data member.
4597 (Incremental_object_entry::add_comdat_group): New function.
4598 (Incremental_object_entry::get_comdat_group_count): New function.
4599 (Incremental_object_entry::get_comdat_signature_key): New function.
4600 (Incremental_object_entry::groups_): New data member.
4601 (Incremental_inputs::report_comdat_group): New function.
4602 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4603 data for incremental input file entry.
4604 (Incremental_input_entry_reader::get_comdat_group_count): New function.
4605 (Incremental_input_entry_reader::get_input_section): Adjust size of
4606 data for incremental input file entry.
4607 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4608 (Incremental_input_entry_reader::get_comdat_group_signature): New
4610 * object.cc (Sized_relobj::include_section_group): Report kept
4611 COMDAT groups for incremental links.
4613 2011-05-24 David Meyer <pdox@google.com>
4615 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4616 with name parameter. Add found_name parameter.
4617 * fileread.cc (Input_file::find_file): Adjust code accordingly.
4618 * dirsearch.h (class Dirsearch): Update declaration.
4620 2011-05-24 Ian Lance Taylor <iant@google.com>
4622 * archive.cc (Library_base::should_include_member): Pull in object
4623 from archive if it defines the entry symbol.
4624 * parameters.cc (Parameters::entry): New function.
4625 * parameters.h (class Parameters): Declare entry.
4626 * output.h (class Output_file_header): Remove entry_ field.
4627 * output.cc (Output_file_header::Output_file_header): Remove entry
4628 parameter. Change all callers.
4629 (Output_file_header::entry): Use parameters->entry.
4630 * gold.cc (queue_middle_tasks): Likewise.
4631 * plugin.cc (Plugin_hook::run): Likewise.
4633 2011-05-24 Cary Coutant <ccoutant@google.com>
4635 * gold.cc (queue_initial_tasks): Pass incremental base filename
4636 to Output_file::open_base_file; don't print error message.
4637 * incremental-dump.cc (main): Adjust call to
4638 Output_file::open_for_modification.
4639 * incremental-dump.cc (main): Likewise.
4640 * incremental.cc (Incremental_inputs::report_command_line):
4641 Ignore --incremental-base option when comparing command lines.
4642 Ignore parameter when given as separate argument.
4643 * options.h (class General_options): Add --incremental-base.
4644 * output.cc (Output_file::Output_file):
4645 (Output_file::open_base_file): Add base_name and writable parameters;
4646 read base file into new file; print error message here.
4647 (Output_file::map_no_anonymous): Add writable parameter; adjust all
4649 * output.h (Output_file::open_for_modification): Rename to...
4650 (Output_file::open_base_file): ...this; add base_name and
4651 writable parameters; adjust all callers.
4652 (Output_file::map_no_anonymous): Add writable parameter; adjust all
4654 * testsuite/Makefile.am (incremental_test_4): Test
4656 * testsuite/Makefile.in: Regenerate.
4658 2011-05-24 Cary Coutant <ccoutant@google.com>
4660 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4662 * testsuite/Makefile.in: Regenerate.
4663 * testsuite/two_file_test_1_v1.cc: New test source file.
4664 * testsuite/two_file_test_1b_v1.cc: New test source file.
4665 * testsuite/two_file_test_2_v1.cc: New test source file.
4667 2011-05-24 Cary Coutant <ccoutant@google.com>
4669 * dynobj.h (Dynobj::do_dynobj): New function.
4670 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4671 flag and soname for shared objects.
4672 * incremental.cc (Incremental_inputs::report_object): Make
4673 either Incremental_object_entry or Incremental_dynobj_entry; add
4674 soname to string table.
4675 (Incremental_inputs::report_input_section): Add assertion.
4676 (Output_section_incremental_inputs::set_final_data_size): Adjust
4677 type of input file entry for shared libraries; adjust size of
4678 shared library info entry.
4679 (Output_section_incremental_inputs::write_input_files): Write
4680 as_needed flag for shared libraries.
4681 (Output_section_incremental_inputs::write_info_blocks): Adjust type
4682 of input file entry for shared libraries; write soname.
4683 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4684 soname from incremental info.
4685 * incremental.h (enum Incremental_input_flags): Add
4686 INCREMENTAL_INPUT_AS_NEEDED.
4687 (Incremental_input_entry::Incremental_input_entry): Initialize new
4689 (Incremental_input_entry::set_as_needed): New function.
4690 (Incremental_input_entry::as_needed): New function.
4691 (Incremental_input_entry::do_dynobj_entry): New function.
4692 (Incremental_input_entry::as_needed_): New data member.
4693 (Incremental_object_entry::Incremental_object_entry): Don't check
4695 (Incremental_object_entry::do_type): Likewise.
4696 (class Incremental_dynobj_entry): New class.
4697 (Incremental_input_entry_reader::as_needed): New function.
4698 (Incremental_input_entry_reader::get_soname): New function.
4699 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4700 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4701 size of shared library info entry.
4702 * layout.cc (Layout::finish_dynamic_section): Don't test for
4703 incremental link when adding DT_NEEDED entries.
4704 * object.h (Object::Object): Initialize new data member.
4705 (Object::dynobj): New function.
4706 (Object::set_as_needed): New function.
4707 (Object::as_needed): New function.
4708 (Object::do_dynobj): New function.
4709 (Object::as_needed_): New data member.
4711 2011-05-24 Cary Coutant <ccoutant@google.com>
4713 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4714 info; adjust display of GOT entries.
4715 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4716 vector of input objects; remove file_status_.
4717 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4718 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4719 got_plt reader; call target hooks to reserve GOT entries.
4720 (Output_section_incremental_inputs::set_final_data_size): Adjust size
4721 of input file info header and GOT info entry.
4722 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4724 (Got_plt_view_info::got_descriptor): Remove.
4725 (Got_plt_view_info::sym_index): New data member.
4726 (Got_plt_view_info::input_index): New data member.
4727 (Local_got_offset_visitor::visit): Write input file index.
4728 (Global_got_offset_visitor::visit): Write 0 for input file index.
4729 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4730 with sym_index and input_index.
4731 (Output_section_incremental_inputs::write_got_plt): Adjust size of
4732 incremental info GOT entry; replace got_descriptor with input_index.
4733 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4734 map from input file index to object.
4735 (Sized_relobj_incr::do_layout): Replace direct data member reference
4736 with accessor function.
4737 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4738 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4739 Adjust size of input file info header.
4740 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4741 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4742 (Incremental_input_entry_reader::get_input_section): Adjust size of
4743 input file info header.
4744 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4745 of incremental info GOT entry.
4746 (Incremental_got_plt_reader::get_got_desc): Remove.
4747 (Incremental_got_plt_reader::get_got_symndx): New function.
4748 (Incremental_got_plt_reader::get_got_input_index): New function.
4749 (Sized_incremental_binary::Sized_incremental_binary): Remove
4750 file_status_; add input_objects_.
4751 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4752 (Sized_incremental_binary::set_file_is_unchanged): Remove.
4753 (Sized_incremental_binary::file_is_unchanged): Remove.
4754 (Sized_incremental_binary::set_input_object): New function.
4755 (Sized_incremental_binary::input_object): New function.
4756 (Sized_incremental_binary::file_status_): Remove.
4757 (Sized_incremental_binary::input_objects_): New data member.
4758 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4760 (Sized_relobj_incr::invalid_address): Move to base class.
4761 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4763 (Sized_relobj_incr::do_output_section_offset): Likewise.
4764 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4765 (Sized_relobj_incr::section_offsets_): Likewise.
4766 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4768 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4769 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4770 with accessor function.
4771 (Sized_relobj_file::do_layout): Likewise.
4772 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4773 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4774 (Sized_relobj_file::compute_final_local_value): Replace refs to
4775 section_offsets_ with accessor function.
4776 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4777 * object.h (Relobj::Relobj): Initialize new data members.
4778 (Relobj::add_dyn_reloc): New function.
4779 (Relobj::first_dyn_reloc): New function.
4780 (Relobj::dyn_reloc_count): New function.
4781 (Relobj::first_dyn_reloc_): New data member.
4782 (Relobj::dyn_reloc_count_): New data member.
4783 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4785 (Sized_relobj::Address): New typedef.
4786 (Sized_relobj::invalid_address): Move here from child class.
4787 (Sized_relobj::Sized_relobj): Initialize new data members.
4788 (Sized_relobj::sized_relobj): New function.
4789 (Sized_relobj::is_output_section_offset_invalid): Move here from
4791 (Sized_relobj::get_output_section_offset): Likewise.
4792 (Sized_relobj::local_has_got_offset): Likewise.
4793 (Sized_relobj::local_got_offset): Likewise.
4794 (Sized_relobj::set_local_got_offset): Likewise.
4795 (Sized_relobj::do_for_all_local_got_entries): Likewise.
4796 (Sized_relobj::clear_got_offsets): New function.
4797 (Sized_relobj::section_offsets): Move here from child class.
4798 (Sized_relobj::do_output_section_offset): Likewise.
4799 (Sized_relobj::do_set_section_offset): Likewise.
4800 (Sized_relobj::Local_got_offsets): Likewise.
4801 (Sized_relobj::local_got_offsets_): Likewise.
4802 (Sized_relobj::section_offsets_): Likewise.
4803 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4805 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4807 (Sized_relobj_file::sized_relobj): New function
4808 (Sized_relobj_file::local_has_got_offset): Move to base class.
4809 (Sized_relobj_file::local_got_offset): Likewise.
4810 (Sized_relobj_file::set_local_got_offset): Likewise.
4811 (Sized_relobj_file::get_output_section_offset): Likewise.
4812 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4813 (Sized_relobj_file::do_output_section_offset): Likewise.
4814 (Sized_relobj_file::do_set_section_offset): Likewise.
4815 (Sized_relobj_file::Local_got_offsets): Likewise.
4816 (Sized_relobj_file::local_got_offsets_): Likewise.
4817 (Sized_relobj_file::section_offsets_): Likewise.
4818 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4820 (set_needs_dynsym_index): Convert relobj to derived class pointer.
4821 (Output_reloc::get_symbol_index): Likewise.
4822 (Output_reloc::local_section_offset): Likewise.
4823 (Output_reloc::get_address): Likewise.
4824 (Output_reloc::symbol_value): Likewise.
4825 (Output_data_got::reserve_slot): Move to class definition.
4826 (Output_data_got::reserve_local): New function.
4827 (Output_data_got::reserve_slot_for_global): Remove.
4828 (Output_data_got::reserve_global): New function.
4829 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4830 (all constructors, two instantiations).
4831 (Output_reloc::get_relobj): New function (two instantiations).
4832 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4833 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4834 (Output_data_reloc::add_global): Adjust type of relobj.
4835 (Output_data_reloc::add_global_relative): Likewise.
4836 (Output_data_reloc::add_symbolless_global_addend): Likewise.
4837 (Output_data_reloc::add_local): Likewise.
4838 (Output_data_reloc::add_local_relative): Likewise.
4839 (Output_data_reloc::add_symbolless_local_addend): Likewise.
4840 (Output_data_reloc::add_local_section): Likewise.
4841 (Output_data_reloc::add_output_section): Likewise.
4842 (Output_data_reloc::add_absolute): Likewise.
4843 (Output_data_reloc::add_target_specific): Likewise.
4844 (Output_data_got::reserve_slot): Move definition here.
4845 (Output_data_got::reserve_local): New function.
4846 (Output_data_got::reserve_global): New function.
4847 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4848 section_offsets_ with accessor function.
4849 (Sized_relobj_file::write_sections): Likewise.
4850 (Sized_relobj_file::do_relocate_sections): Likewise.
4851 * target.h (Sized_target::reserve_local_got_entry): New function.
4852 (Sized_target::reserve_global_got_entry): New function.
4853 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4854 (Target_x86_64::reserve_global_got_entry): New function.
4855 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4857 2011-05-23 Cary Coutant <ccoutant@google.com>
4859 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4860 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4861 bit when checking got_type.
4862 * incremental.cc (Sized_incremental_binary::setup_readers):
4863 Store symbol table and string table locations; initialize bit vector
4864 of file status flags.
4865 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4867 (Sized_incremental_binary::do_process_got_plt): New function.
4868 (Sized_incremental_binary::get_symtab_view): Use stored locations.
4869 (Output_section_incremental_inputs::set_final_data_size): Record
4870 file index for each input file.
4871 (Output_section_incremental_inputs::write_got_plt): Store file index
4872 instead of input entry offset for each GOT entry.
4874 (Incremental_input_entry::Incremental_input_entry): Initialize new
4876 (Incremental_input_entry::set_offset): Store file index.
4877 (Incremental_input_entry::get_file_index): New function.
4878 (Incremental_input_entry::file_index_): New data member.
4879 (Incremental_binary::process_got_plt): New function.
4880 (Incremental_binary::do_process_got_plt): New function.
4881 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4883 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4884 (Sized_incremental_binary::set_file_is_unchanged): New function.
4885 (Sized_incremental_binary::file_is_unchanged): New function.
4886 (Sized_incremental_binary::do_process_got_plt): New function.
4887 (Sized_incremental_binary::file_status_): New data member.
4888 (Sized_incremental_binary::main_symtab_loc_): New data member.
4889 (Sized_incremental_binary::main_strtab_loc_): New data member.
4890 * output.cc (Output_data_got::Got_entry::write): Add case
4892 (Output_data_got::add_global): Call add_got_entry.
4893 (Output_data_got::add_global_plt): Likewise.
4894 (Output_data_got::add_global_with_rel): Likewise.
4895 (Output_data_got::add_global_with_rela): Likewise.
4896 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4897 (Output_data_got::add_global_pair_with_rela): Likewise.
4898 (Output_data_got::add_local): Call add_got_entry.
4899 (Output_data_got::add_local_plt): Likewise.
4900 (Output_data_got::add_local_with_rel): Likewise.
4901 (Output_data_got::add_local_with_rela): Likewise.
4902 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4903 (Output_data_got::add_local_pair_with_rela): Likewise.
4904 (Output_data_got::reserve_slot): New function.
4905 (Output_data_got::reserve_slot_for_global): New function.
4906 (Output_data_got::add_got_entry): New function.
4907 (Output_data_got::add_got_entry_pair): New function.
4908 (Output_section::add_output_section_data): Edit FIXME.
4910 (Output_section_data_build::Output_section_data_build): New
4911 constructor with size parameter.
4912 (Output_data_space::Output_data_space): Likewise.
4913 (Output_data_got::Output_data_got): Initialize new data member; new
4914 constructor with size parameter.
4915 (Output_data_got::add_constant): Call add_got_entry.
4916 (Output_data_got::reserve_slot): New function.
4917 (Output_data_got::reserve_slot_for_global): New function.
4918 (class Output_data_got::Got_entry): Add RESERVED_CODE.
4919 (Output_data_got::add_got_entry): New function.
4920 (Output_data_got::add_got_entry_pair): New function.
4921 (Output_data_got::free_list_): New data member.
4922 * target.h (Sized_target::init_got_plt_for_update): New function.
4923 (Sized_target::register_global_plt_entry): New function.
4924 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4925 Initialize new data member; call init; add constructor with PLT count.
4926 (Output_data_plt_x86_64::init): New function.
4927 (Output_data_plt_x86_64::add_relocation): New function.
4928 (Output_data_plt_x86_64::reserve_slot): New function.
4929 (Output_data_plt_x86_64::free_list_): New data member.
4930 (Target_x86_64::init_got_plt_for_update): New function.
4931 (Target_x86_64::register_global_plt_entry): New function.
4932 (Output_data_plt_x86_64::add_entry): Allocate from free list for
4933 incremental updates.
4934 (Output_data_plt_x86_64::add_relocation): New function.
4935 * testsuite/object_unittest.cc (Object_test): Set default options.
4937 2011-05-16 Ian Lance Taylor <iant@google.com>
4939 * options.h (class General_options): Make -i a synonym for -r.
4941 2011-05-16 Ian Lance Taylor <iant@google.com>
4943 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4945 2011-05-10 Cary Coutant <ccoutant@google.com>
4947 * object.cc (Sized_relobj::do_count_local_symbols): Check for
4950 2011-05-06 Ian Lance Taylor <iant@google.com>
4952 * layout.cc (Layout::layout): If the output section flags change,
4953 update the ordering.
4955 2011-04-25 Cary Coutant <ccoutant@google.com>
4957 * incremental-dump.cc (dump_incremental_inputs): Print local
4958 symbol info for each input file.
4960 (Output_section_incremental_inputs::set_final_data_size): Add local
4961 symbol info to input file entries in incremental info.
4962 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4963 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4964 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4965 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4967 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4968 (Sized_incr_relobj::do_relocate): Write the local symbols.
4969 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4970 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4971 Adjust size of input file header.
4972 (Incremental_inputs_reader::get_local_symbol_offset): New function.
4973 (Incremental_inputs_reader::get_local_symbol_count): New function.
4974 (Incremental_inputs_reader::get_input_section): Adjust size of input
4976 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4977 (Sized_incr_relobj::This): New typedef.
4978 (Sized_incr_relobj::sym_size): New const data member.
4979 (Sized_incr_relobj::Local_symbol): New struct.
4980 (Sized_incr_relobj::do_output_local_symbol_count): New function.
4981 (Sized_incr_relobj::do_local_symbol_offset): New function.
4982 (Sized_incr_relobj::local_symbol_count_): New data member.
4983 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4984 (Sized_incr_relobj::local_symbol_index_): New data member.
4985 (Sized_incr_relobj::local_symbol_offset_): New data member.
4986 (Sized_incr_relobj::local_dynsym_offset_): New data member.
4987 (Sized_incr_relobj::local_symbols_): New data member.
4988 * object.h (Relobj::output_local_symbol_count): New function.
4989 (Relobj::local_symbol_offset): New function.
4990 (Relobj::do_output_local_symbol_count): New function.
4991 (Relobj::do_local_symbol_offset): New function.
4992 (Sized_relobj::do_output_local_symbol_count): New function.
4993 (Sized_relobj::do_local_symbol_offset): New function.
4995 2011-04-22 Vladimir Simonov <sv@sw.ru>
4997 * descriptors.cc (set_close_on_exec): New function.
4998 (Descriptors::open): Use set_close_on_exec.
4999 * output.cc (S_ISLNK): Define if not defined.
5001 2011-04-22 Cary Coutant <ccoutant@google.com>
5003 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5005 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5006 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5007 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5009 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5010 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5011 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5013 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5015 (Incremental_binary::apply_incremental_relocs): New function.
5016 (Incremental_binary::do_apply_incremental_relocs): New function.
5017 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5019 (Sized_incremental_binary::add_global_symbol): New function.
5020 (Sized_incremental_binary::global_symbol): New function.
5021 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5022 (Sized_incremental_binary::symbol_map_): New data member.
5023 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5024 * target.h (Sized_target::apply_relocation): New function.
5025 * target-reloc.h (apply_relocation): New function.
5026 * x86_64.cc (Target_x86_64::apply_relocation): New function.
5028 2011-04-22 Doug Kwan <dougkwan@google.com>
5030 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5031 flag of a SHT_ARM_EXIDX section.
5032 * testsuite/Makefile.am (arm_exidx_test): New test rules.
5033 * testsuite/Makefile.in: Regenerate.
5034 * testsuite/arm_exidx_test.s: New file.
5035 * testsuite/arm_exidx_test.sh: Same.
5037 2011-04-20 Cary Coutant <ccoutant@google.com>
5040 * archive.h (Incremental_archive_entry::Archive_member):
5041 Initialize arg_serial_ (second constructor).
5043 2011-04-17 Ian Lance Taylor <iant@google.com>
5045 * object.cc (Relocate_info::location): Simplify location string.
5046 * errors.cc (Errors::error_at_location): Don't print program
5048 (Errors::warning_at_location): Likewise.
5049 (Errors::undefined_symbol): Likewise.
5050 * testsuite/debug_msg.sh: Update accordingly.
5052 2011-04-14 Cary Coutant <ccoutant@google.com>
5054 * gold/layout.cc (Layout::symtab_section_offset): New function.
5055 * gold/layout.h (Layout::symtab_section_offset): New function.
5056 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5058 2011-04-12 Ian Lance Taylor <iant@google.com>
5060 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
5061 with MREMAP_MAYMOVE.
5062 * output.h (class Output_file): Add map_is_allocated_ field.
5063 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
5064 not available, provide stubs. If mremap is not available, #define
5066 (MREMAP_MAYMOVE): Define if not defined.
5067 (Output_file::Output_file): Initialize map_is_allocated_.
5068 (Output_file::resize): Check map_is_allocated_.
5069 (Output_file::map_anonymous): If mmap fails, use malloc.
5070 (Output_file::unmap): Don't do anything for an anonymous map.
5071 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
5072 is not available, provide stubs.
5073 (File_read::View::~View): Use free rather than delete[].
5074 (File_read::make_view): Use malloc rather than new[]. If mmap
5076 (File_read::find_or_make_view): Use malloc rather than new[].
5077 * gold.h: Remove HAVE_REMAP code.
5078 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
5079 exists. Rename mremap to gold_mremap. If mmap is not available
5081 * configure, config.in: Rebuild.
5083 2011-04-11 Ian Lance Taylor <iant@google.com>
5085 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5086 initialize local variable v.
5088 2011-04-11 Cary Coutant <ccoutant@google.com>
5090 * archive.cc (Archive::include_member): Adjust call to
5092 (Add_archive_symbols::run): Track argument serial numbers.
5093 (Lib_group::include_member): Likewise.
5094 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5095 * archive.h (Incremental_archive_entry::Archive_member):
5096 Initialize arg_serial_.
5097 (Archive_member::arg_serial_): New data member.
5098 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5099 (Sized_dynobj::do_add_symbols): Track symbols when doing an
5101 (Sized_dynobj::do_for_all_local_got_entries): New function.
5102 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5104 * fileread.cc (get_mtime): New function.
5105 * fileread.h (get_mtime): New function.
5106 * gold.cc (queue_initial_tasks): Check for incremental update.
5107 (process_incremental_input): New function.
5108 (queue_middle_tasks): Don't force valid target for incremental
5110 * incremental-dump.cc (find_input_containing_global): Adjust
5111 size of symbol info entry.
5112 (dump_incremental_inputs): Dump argument serial number and
5113 in_system_directory flag; bias shndx by 1; print symbol names
5114 when dumping per-file symbol lists; use new symbol info readers.
5116 (Output_section_incremental_inputs:update_data_size): New function.
5117 (Sized_incremental_binary::setup_readers): Setup input readers
5118 for each input file; build maps for files added from libraries
5120 (Sized_incremental_binary::check_input_args): New function.
5121 (Sized_incremental_binary::do_check_inputs): Build map of argument
5122 serial numbers to input arguments.
5123 (Sized_incremental_binary::do_file_has_changed): Rename
5124 do_file_is_unchanged to this; compare file modification times.
5125 (Sized_incremental_binary::do_init_layout): New function.
5126 (Sized_incremental_binary::do_reserve_layout): New function.
5127 (Sized_incremental_binary::do_get_input_reader): Remove.
5128 (Sized_incremental_binary::get_symtab_view): New function.
5129 (Incremental_checker::can_incrementally_link_output_file): Remove.
5130 (Incremental_inputs::report_command_line): Exclude --debug options.
5131 (Incremental_inputs::report_archive_begin): Add parameter; track
5132 argument serial numbers; don't put input file entry for archive
5133 before archive members.
5134 (Incremental_inputs::report_archive_end): Put input file entry
5135 for archive after archive members.
5136 (Incremental_inputs::report_object): Add parameter; track argument
5137 serial numbers and in_system_directory flag.
5138 (Incremental_inputs::report_script): Add parameter; track argument
5140 (Output_section_incremental_inputs::set_final_data_size): Adjust
5141 size of symbol info entry; check for forwarding symbols.
5142 (Output_section_incremental_inputs::write_input_files): Write
5143 in_system_directory flag and argument serial number.
5144 (Output_section_incremental_inputs::write_info_blocks): Map section
5145 indices between incremental info and original input file; store
5146 input section index for each symbol.
5147 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5148 change operator() to visit().
5149 (class Global_got_offset_visitor): Likewise.
5150 (class Global_symbol_visitor_got_plt):
5151 (Output_section_incremental_inputs::write_got_plt): Use new visitor
5153 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5154 (Sized_incr_relobj::do_read_symbols): New function.
5155 (Sized_incr_relobj::do_layout): New function.
5156 (Sized_incr_relobj::do_layout_deferred_sections): New function.
5157 (Sized_incr_relobj::do_add_symbols): New function.
5158 (Sized_incr_relobj::do_should_include_member): New function.
5159 (Sized_incr_relobj::do_for_all_global_symbols): New function.
5160 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5161 (Sized_incr_relobj::do_section_size): New function.
5162 (Sized_incr_relobj::do_section_name): New function.
5163 (Sized_incr_relobj::do_section_contents): New function.
5164 (Sized_incr_relobj::do_section_flags): New function.
5165 (Sized_incr_relobj::do_section_entsize): New function.
5166 (Sized_incr_relobj::do_section_address): New function.
5167 (Sized_incr_relobj::do_section_type): New function.
5168 (Sized_incr_relobj::do_section_link): New function.
5169 (Sized_incr_relobj::do_section_info): New function.
5170 (Sized_incr_relobj::do_section_addralign): New function.
5171 (Sized_incr_relobj::do_initialize_xindex): New function.
5172 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5173 (Sized_incr_relobj::do_read_relocs): New function.
5174 (Sized_incr_relobj::do_gc_process_relocs): New function.
5175 (Sized_incr_relobj::do_scan_relocs): New function.
5176 (Sized_incr_relobj::do_count_local_symbols): New function.
5177 (Sized_incr_relobj::do_finalize_local_symbols): New function.
5178 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5179 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5180 (Sized_incr_relobj::do_relocate): New function.
5181 (Sized_incr_relobj::do_set_section_offset): New function.
5182 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5183 (Sized_incr_dynobj::do_read_symbols): New function.
5184 (Sized_incr_dynobj::do_layout): New function.
5185 (Sized_incr_dynobj::do_add_symbols): New function.
5186 (Sized_incr_dynobj::do_should_include_member): New function.
5187 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5188 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5189 (Sized_incr_dynobj::do_section_size): New function.
5190 (Sized_incr_dynobj::do_section_name): New function.
5191 (Sized_incr_dynobj::do_section_contents): New function.
5192 (Sized_incr_dynobj::do_section_flags): New function.
5193 (Sized_incr_dynobj::do_section_entsize): New function.
5194 (Sized_incr_dynobj::do_section_address): New function.
5195 (Sized_incr_dynobj::do_section_type): New function.
5196 (Sized_incr_dynobj::do_section_link): New function.
5197 (Sized_incr_dynobj::do_section_info): New function.
5198 (Sized_incr_dynobj::do_section_addralign): New function.
5199 (Sized_incr_dynobj::do_initialize_xindex): New function.
5200 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5201 (make_sized_incremental_object): New function.
5202 (Incremental_library::copy_unused_symbols): New function.
5203 (Incremental_library::do_for_all_unused_symbols): New function.
5204 * incremental.h (enum Incremental_input_flags): New type.
5205 (class Incremental_checker): Remove.
5206 (Incremental_input_entry::Incremental_input_entry): Add argument
5208 (Incremental_input_entry::arg_serial): New function.
5209 (Incremental_input_entry::set_is_in_system_directory): New function.
5210 (Incremental_input_entry::is_in_system_directory): New function.
5211 (Incremental_input_entry::arg_serial_): New data member.
5212 (Incremental_input_entry::is_in_system_directory_): New data member.
5213 (class Script_info): Move here from script.h.
5214 (Script_info::Script_info): Add filename parameter.
5215 (Script_info::filename): New function.
5216 (Script_info::filename_): New data member.
5217 (Incremental_script_entry::Incremental_script_entry): Add argument
5219 (Incremental_object_entry::Incremental_object_entry): Likewise.
5220 (Incremental_object_entry::add_input_section): Build list of input
5221 sections with map to original shndx.
5222 (Incremental_object_entry::get_input_section_index): New function.
5223 (Incremental_object_entry::shndx_): New data member.
5224 (Incremental_object_entry::name_key_): Rename; adjust all refs.
5225 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5226 (Incremental_archive_entry::Incremental_archive_entry): Add argument
5228 (Incremental_inputs::report_archive_begin): Likewise.
5229 (Incremental_inputs::report_object): Likewise.
5230 (Incremental_inputs::report_script): Likewise.
5231 (class Incremental_global_symbol_reader): New class.
5232 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5233 and store flags and input file type.
5234 (Incremental_input_entry_reader::arg_serial): New function.
5235 (Incremental_input_entry_reader::type): Extract type from flags.
5236 (Incremental_input_entry_reader::is_in_system_directory): New function.
5237 (Incremental_input_entry_reader::get_input_section_count): Call
5238 accessor function for type.
5239 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5240 function for type; adjust size of global symbol entry.
5241 (Incremental_input_entry_reader::get_global_symbol_count): Call
5242 accessor function for type.
5243 (Incremental_input_entry_reader::get_object_count): Likewise.
5244 (Incremental_input_entry_reader::get_object_offset): Likewise.
5245 (Incremental_input_entry_reader::get_member_count): Likewise.
5246 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5247 (Incremental_input_entry_reader::get_member_offset): Likewise.
5248 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5249 (Incremental_input_entry_reader::Global_symbol_info): Remove.
5250 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5251 (Incremental_input_entry_reader::get_global_symbol_reader): New
5253 (Incremental_input_entry_reader::get_output_symbol_index): New
5255 (Incremental_input_entry_reader::type_): Remove.
5256 (Incremental_input_entry_reader::flags_): New data member.
5257 (Incremental_inputs_reader::input_file_offset): New function.
5258 (Incremental_inputs_reader::input_file_index): New function.
5259 (Incremental_inputs_reader::input_file): Call input_file_offset.
5260 (Incremental_inputs_reader::input_file_at_offset): New function.
5261 (Incremental_relocs_reader::get_r_type): Reformat.
5262 (Incremental_relocs_reader::get_r_shndx): Reformat.
5263 (Incremental_relocs_reader::get_r_offset): Reformat.
5264 (Incremental_relocs_reader::data): New function.
5265 (Incremental_binary::Incremental_binary): Initialize new data members.
5266 (Incremental_binary::check_inputs): Add cmdline parameter.
5267 (Incremental_binary::file_is_unchanged): Remove.
5268 (Input_reader::arg_serial): New function.
5269 (Input_reader::get_unused_symbol_count): New function.
5270 (Input_reader::get_unused_symbol): New function.
5271 (Input_reader::do_arg_serial): New function.
5272 (Input_reader::do_get_unused_symbol_count): New function.
5273 (Input_reader::do_get_unused_symbol): New function.
5274 (Incremental_binary::input_file_count): New function.
5275 (Incremental_binary::get_input_reader): Change signature to use
5276 index instead of filename.
5277 (Incremental_binary::file_has_changed): New function.
5278 (Incremental_binary::get_input_argument): New function.
5279 (Incremental_binary::get_library): New function.
5280 (Incremental_binary::get_script_info): New function.
5281 (Incremental_binary::init_layout): New function.
5282 (Incremental_binary::reserve_layout): New function.
5283 (Incremental_binary::output_file): New function.
5284 (Incremental_binary::do_check_inputs): New function.
5285 (Incremental_binary::do_file_is_unchanged): Remove.
5286 (Incremental_binary::do_file_has_changed): New function.
5287 (Incremental_binary::do_init_layout): New function.
5288 (Incremental_binary::do_reserve_layout): New function.
5289 (Incremental_binary::do_input_file_count): New function.
5290 (Incremental_binary::do_get_input_reader): Change signature.
5291 (Incremental_binary::input_args_map_): New data member.
5292 (Incremental_binary::library_map_): New data member.
5293 (Incremental_binary::script_map_): New data member.
5294 (Sized_incremental_binary::Sized_incremental_binary): Initialize
5296 (Sized_incremental_binary::output_section): New function.
5297 (Sized_incremental_binary::inputs_reader): Add const.
5298 (Sized_incremental_binary::symtab_reader): Add const.
5299 (Sized_incremental_binary::relocs_reader): Add const.
5300 (Sized_incremental_binary::got_plt_reader): Add const.
5301 (Sized_incremental_binary::get_symtab_view): New function.
5302 (Sized_incremental_binary::Inputs_reader): New typedef.
5303 (Sized_incremental_binary::Input_entry_reader): New typedef.
5304 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5305 (Sized_incremental_binary::do_file_is_unchanged): Remove.
5306 (Sized_incremental_binary::do_file_has_changed): New function.
5307 (Sized_incremental_binary::do_init_layout): New function.
5308 (Sized_incremental_binary::do_reserve_layout): New function.
5309 (Sized_input_reader::Inputs_reader): Remove.
5310 (Sized_input_reader::Input_entry_reader): Remove.
5311 (Sized_input_reader::do_arg_serial): New function.
5312 (Sized_input_reader::do_get_unused_symbol_count): New function.
5313 (Sized_input_reader::do_get_unused_symbol): New function.
5314 (Sized_incremental_binary::do_input_file_count): New function.
5315 (Sized_incremental_binary::do_get_input_reader): Change signature;
5316 use index instead of filename.
5317 (Sized_incremental_binary::section_map_): New data member.
5318 (Sized_incremental_binary::input_entry_readers_): New data member.
5319 (class Sized_incr_relobj): New class.
5320 (class Sized_incr_dynobj): New class.
5321 (make_sized_incremental_object): New function.
5322 (class Incremental_library): New class.
5323 * layout.cc (Free_list::num_lists): New static data member.
5324 (Free_list::num_nodes): New static data member.
5325 (Free_list::num_removes): New static data member.
5326 (Free_list::num_remove_visits): New static data member.
5327 (Free_list::num_allocates): New static data member.
5328 (Free_list::num_allocate_visits): New static data member.
5329 (Free_list::init): New function.
5330 (Free_list::remove): New function.
5331 (Free_list::allocate): New function.
5332 (Free_list::dump): New function.
5333 (Free_list::print_stats): New function.
5334 (Layout_task_runner::run): Resize output file for incremental updates.
5335 (Layout::Layout): Initialize new data members.
5336 (Layout::set_incremental_base): New function.
5337 (Layout::init_fixed_output_section): New function.
5338 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5339 incremental updates.
5340 (Layout::create_gold_note): Do not create gold note section for
5341 incremental updates.
5342 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5343 for incremental updates.
5344 (Layout::set_section_offsets): For incremental updates, allocate space
5346 (Layout::create_symtab_sections): Layout with offsets relative to
5347 start of section; for incremental updates, allocate space from free
5349 (Layout::create_shdrs): For incremental updates, allocate space from
5351 (Layout::finish_dynamic_section): For incremental updates, do not
5352 check --as-needed (fixed in subsequent patch).
5353 * layout.h (class Free_list): New class.
5354 (Layout::set_incremental_base): New function.
5355 (Layout::incremental_base): New function.
5356 (Layout::init_fixed_output_section): New function.
5357 (Layout::allocate): New function.
5358 (Layout::incremental_base_): New data member.
5359 (Layout::free_list_): New data member.
5360 * main.cc (main): Print Free_list statistics.
5361 * object.cc (Relobj::finalize_incremental_relocs): Add
5362 clear_counts parameter; clear counts only when clear_counts is set.
5363 (Sized_relobj::Sized_relobj): Initialize new base class.
5364 (Sized_relobj::do_layout): Don't report special sections.
5365 (Sized_relobj::do_for_all_local_got_entries): New function.
5366 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5367 symtab_off to all symbol table offsets.
5368 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5369 * object.h (class Got_offset_list): Move to top of file.
5370 (Object::Object): Allow case where input_file == NULL.
5371 (Object::~Object): Likewise.
5372 (Object::input_file): Assert that input_file != NULL.
5373 (Object::lock): Allow case where input_file == NULL.
5374 (Object::unlock): Likewise.
5375 (Object::is_locked): Likewise.
5376 (Object::token): Likewise.
5377 (Object::release): Likewise.
5378 (Object::is_incremental): New function.
5379 (Object::get_mtime): New function.
5380 (Object::for_all_local_got_entries): New function.
5381 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5382 (Object::set_is_in_system_directory): New function.
5383 (Object::is_in_system_directory): New function.
5384 (Object::do_is_incremental): New function.
5385 (Object::do_get_mtime): New function.
5386 (Object::do_for_all_local_got_entries): New function.
5387 (Object::is_in_system_directory_): New data member.
5388 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5389 (class Sized_relobj_base): New class.
5390 (class Sized_relobj): Derive from Sized_relobj_base.
5391 (class Sized_relobj::Symbols): Redeclare from base class.
5392 (class Sized_relobj::local_got_offset_list): Remove.
5393 (class Sized_relobj::Output_sections): Redeclare from base class.
5394 (class Sized_relobj::do_for_all_local_got_entries): New function.
5395 (class Sized_relobj::write_local_symbols): Add offset parameter.
5396 (class Sized_relobj::local_symbol_offset_): Update comment.
5397 (class Sized_relobj::local_dynsym_offset_): Update comment.
5398 * options.cc (Input_arguments::add_file): Remove const.
5399 * options.h (Input_file_argument::Input_file_argument):
5400 Initialize arg_serial_ (all constructors).
5401 (Input_file_argument::set_arg_serial): New function.
5402 (Input_file_argument::arg_serial): New function.
5403 (Input_file_argument::arg_serial_): New data member.
5404 (Input_arguments::Input_arguments): Initialize file_count_.
5405 (Input_arguments::add_file): Remove const.
5406 (Input_arguments::number_of_input_files): New function.
5407 (Input_arguments::file_count_): New data member.
5408 (Command_line::number_of_input_files): Call
5409 Input_arguments::number_of_input_files.
5410 * output.cc (Output_segment_headers::Output_segment_headers):
5412 (Output_section::Input_section::current_data_size): New function.
5413 (Output_section::Output_section): Initialize new data members.
5414 (Output_section::add_input_section): Don't do merge sections for
5415 an incremental link; allocate space from free list for an
5417 (Output_section::add_output_section_data): Allocate space from
5418 free list for an incremental update.
5419 (Output_section::update_data_size): New function.
5420 (Output_section::set_fixed_layout): New function.
5421 (Output_section::reserve): New function.
5422 (Output_segment::set_section_addresses): Remove const.
5423 (Output_segment::set_section_list_addresses): Remove const; allocate
5424 space from free list for an incremental update.
5425 (Output_segment::set_offset): Adjust size of RELRO segment for an
5427 * output.h (Output_data::current_data_size): Move here from
5429 (Output_data::pre_finalize_data_size): New function.
5430 (Output_data::update_data_size): New function.
5431 (Output_section_headers::update_data_size): new function.
5432 (Output_section_data_build::current_data_size): Move to Output_data.
5433 (Output_data_strtab::update_data_size): New function.
5434 (Output_section::current_data_size): Move to Output_data.
5435 (Output_section::set_fixed_layout): New function.
5436 (Output_section::has_fixed_layout): New function.
5437 (Output_section::reserve): New function.
5438 (Output_section::update_data_size): New function.
5439 (Output_section::has_fixed_layout_): New data member.
5440 (Output_section::free_list_): New data member.
5441 (Output_segment::set_section_addresses): Remove const.
5442 (Output_segment::set_section_list_addresses): Remove const.
5443 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5445 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5447 * readsyms.cc (Read_symbols::do_read_symbols): Add library
5448 parameter when calling Add_symbols constructor; store argument
5449 serial number for members of a lib group.
5450 (Add_symbols::locks): Allow case where token == NULL.
5451 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5452 (Read_member::~Read_member): New function.
5453 (Read_member::is_runnable): New function.
5454 (Read_member::locks): New function.
5455 (Read_member::run): New function.
5456 (Check_script::~Check_script): New function.
5457 (Check_script::is_runnable): New function.
5458 (Check_script::locks): New function.
5459 (Check_script::run): New function.
5460 (Check_library::~Check_library): New function.
5461 (Check_library::is_runnable): New function.
5462 (Check_library::locks): New function.
5463 (Check_library::run): New function.
5464 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5465 (Add_symbols::library_): New data member.
5466 (class Read_member): New class.
5467 (class Check_script): New class.
5468 (class Check_library): New class.
5469 * reloc.cc (Read_relocs::is_runnable): Allow case where
5471 (Read_relocs::locks): Likewise.
5472 (Scan_relocs::locks): Likewise.
5473 (Relocate_task::locks): Likewise.
5474 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5476 (Sized_relobj::incremental_relocs_scan): Fix comment.
5477 (Sized_relobj::do_relocate): Pass output file offset to
5478 write_local_symbols.
5479 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5480 from class declaration.
5481 * script.cc (read_input_script): Allocate Script_info; pass
5482 argument serial number to report_script.
5483 * script.h (class Script_info): Move to incremental.h.
5484 * symtab.cc (Symbol_table::add_from_incrobj): New function.
5485 * symtab.h (Symbol_table::add_from_incrobj): New function.
5486 (Symbol_table::set_file_offset): New function.
5488 2011-04-05 Cary Coutant <ccoutant@google.com>
5490 * incremental-dump.cc (dump_incremental_inputs): Change signature
5491 to take a Sized_incremental_binary; change caller. Use readers
5492 in Sized_incremental_binary.
5494 (Sized_incremental_binary::find_incremental_inputs_sections):
5495 Rename do_find_incremental_inputs_sections to this.
5496 (Sized_incremental_binary::setup_readers): New function.
5497 (Sized_incremental_binary::do_check_inputs): Check
5498 has_incremental_info_ flag; move setup code to setup_readers;
5500 (Sized_incremental_binary::do_file_is_unchanged): New function.
5501 (Sized_incremental_binary::do_get_input_reader): New function.
5502 * incremental.h (class Incremental_binary): Move to end of file.
5503 (Incremental_binary::file_is_unchanged): New function.
5504 (Incremental_binary::do_file_is_unchanged): New function.
5505 (Incremental_binary::Input_reader): New class.
5506 (Incremental_binary::get_input_reader): New function.
5507 (class Sized_incremental_binary): Move to end of file.
5508 (Sized_incremental_binary::Sized_incremental_binary): Setup the
5509 input section reader classes.
5510 (Sized_incremental_binary::has_incremental_info): New function.
5511 (Sized_incremental_binary::inputs_reader): New function.
5512 (Sized_incremental_binary::symtab_reader): New function.
5513 (Sized_incremental_binary::relocs_reader): New function.
5514 (Sized_incremental_binary::got_plt_reader): New function.
5515 (Sized_incremental_binary::do_file_is_unchanged): New function.
5516 (Sized_incremental_binary::Sized_input_reader): New class.
5517 (Sized_incremental_binary::get_input_reader): New function.
5518 (Sized_incremental_binary::find_incremental_inputs_sections):
5519 Rename do_find_incremental_inputs_sections to this.
5520 (Sized_incremental_binary::setup_readers): New function.
5521 (Sized_incremental_binary::has_incremental_info_): New data member.
5522 (Sized_incremental_binary::inputs_reader_): New data member.
5523 (Sized_incremental_binary::symtab_reader_): New data member.
5524 (Sized_incremental_binary::relocs_reader_): New data member.
5525 (Sized_incremental_binary::got_plt_reader_): New data member.
5526 (Sized_incremental_binary::current_input_file_): New data member.
5528 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
5531 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5534 2011-03-30 Cary Coutant <ccoutant@google.com>
5536 * archive.cc (Archive::include_member): Adjust call to report_object.
5537 (Add_archive_symbols::run): Add script_info to call to
5538 report_archive_begin.
5539 (Lib_group::include_member): Adjust call to report_object.
5540 (Add_lib_group_symbols::run): Adjust call to report_object.
5541 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5542 blocks. Add object count for script input files.
5543 * incremental.cc (Incremental_inputs::report_archive_begin): Add
5544 script_info parameter; change all callers.
5545 (Incremental_inputs::report_object): Add script_info parameter;
5547 (Incremental_inputs::report_script): Store backpointer to
5548 incremental info entry.
5549 (Output_section_incremental_inputs::set_final_data_size): Record
5550 additional information for scripts.
5551 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5552 * incremental.h (Incremental_script_entry::add_object): New function.
5553 (Incremental_script_entry::get_object_count): New function.
5554 (Incremental_script_entry::get_object): New function.
5555 (Incremental_script_entry::objects_): New data member; adjust
5557 (Incremental_inputs::report_archive_begin): Add script_info parameter.
5558 (Incremental_inputs::report_object): Add script_info parameter.
5559 (Incremental_inputs_reader::get_object_count): New function.
5560 (Incremental_inputs_reader::get_object_offset): New function.
5561 * options.cc (Input_arguments::add_file): Return reference to
5563 * options.h (Input_argument::set_script_info): New function.
5564 (Input_argument::script_info): New function.
5565 (Input_argument::script_info_): New data member; adjust all
5567 (Input_file_group::add_file): Return reference to new input argument.
5568 (Input_file_lib::add_file): Likewise.
5569 (Input_arguments::add_file): Likewise.
5570 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5571 * script.cc (Parser_closure::Parser_closure): Add script_info
5572 parameter; adjust all callers.
5573 (Parser_closure::script_info): New function.
5574 (Parser_closure::script_info_): New data member.
5575 (read_input_script): Report scripts earlier to incremental info.
5576 (script_add_file): Set script_info in Input_argument.
5577 (script_add_library): Likewise.
5578 * script.h (Script_options::Script_info): Rewrite class.
5580 2011-03-29 Cary Coutant <ccoutant@google.com>
5582 * archive.cc (Library_base::should_include_member): Move
5583 method here from class Archive.
5584 (Archive::Archive): Initialize base class.
5585 (Archive::should_include_member): Move to base class.
5586 (Archive::do_for_all_unused_symbols): New function.
5587 (Add_archive_symbols::run): Remove redundant access to
5589 (Lib_group::Lib_group): Initialize base class.
5590 (Lib_group::do_filename): New function.
5591 (Lib_group::include_member): Pass pointer to Lib_group to
5593 (Lib_group::do_for_all_unused_symbols): New function.
5594 (Add_lib_group_symbols::run): Report archive information for
5596 * archive.h (class Library_base): New base class.
5597 (class Archive): Derive from Library_base.
5598 (Archive::filename): Move to base class.
5599 (Archive::set_incremental_info): Likewise.
5600 (Archive::incremental_info): Likewise.
5601 (Archive::Should_include): Likewise.
5602 (Archive::should_include_member): Likewise.
5603 (Archive::Armap_entry): Remove.
5604 (Archive::Unused_symbol_iterator): Remove.
5605 (Archive::unused_symbols_begin): Remove.
5606 (Archive::unused_symbols_end): Remove.
5607 (Archive::do_filename): New function.
5608 (Archive::do_get_mtime): New function.
5609 (Archive::do_for_all_unused_symbols): New function.
5610 (Archive::task_): Move to base class.
5611 (Archive::incremental_info_): Likewise.
5612 (class Lib_group): Derive from Library_base.
5613 (Lib_group::do_filename): New function.
5614 (Lib_group::do_get_mtime): New function.
5615 (Lib_group::do_for_all_unused_symbols): New function.
5616 (Lib_group::task_): Move to base class.
5617 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5619 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5621 * incremental.cc (Incremental_inputs::report_archive_begin):
5622 Use Library_base; call library's get_mtime; add incremental inputs
5623 entry before members.
5624 (class Unused_symbol_visitor): New class.
5625 (Incremental_inputs::report_archive_end): Use Library_base; use
5626 visitor class to record unused symbols; don't add incremental inputs
5627 entry after members.
5628 (Incremental_inputs::report_object): Use Library_base.
5630 (Incremental_archive_entry::Incremental_archive_entry): Remove
5631 unused Archive parameter.
5632 (Incremental_inputs::report_archive_begin): Use Library_base.
5633 (Incremental_inputs::report_archive_end): Likewise.
5634 (Incremental_inputs::report_object): Likewise.
5635 * object.cc (Sized_relobj::do_for_all_global_symbols): New
5637 * object.h (Object::for_all_global_symbols): New function.
5638 (Object::do_for_all_global_symbols): New function.
5639 (Sized_relobj::do_for_all_global_symbols): New function.
5640 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
5642 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
5645 2011-03-27 Ian Lance Taylor <iant@google.com>
5647 * archive.cc (Archive::interpret_header): Return -1 if something
5648 goes wrong. Change callers accordingly.
5650 2011-03-25 Cary Coutant <ccoutant@google.com>
5652 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5653 * testsuite/Makefile.in: Regenerate.
5655 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
5657 * plugin.cc (get_view): New.
5658 (Plugin::load): Pass get_view to the plugin.
5659 (Plugin_manager::get_view): New.
5661 2011-03-21 Ian Lance Taylor <iant@google.com>
5663 * testsuite/final_layout.sh: Rewrite to not use dc.
5664 * testsuite/relro_test.sh: Fail if dc is not present.
5666 2011-03-21 Sriraman Tallam <tmsriram@google.com>
5668 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5670 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5671 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5673 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5674 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5676 2011-03-14 Ian Lance Taylor <iant@google.com>
5678 * script-sections.cc (Sort_output_sections::script_compare):
5679 Rename from is_before, change return type.
5680 (Sort_output_sections::operator()): Adjust accordingly.
5682 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
5685 * testsuite/odr_violation2.cc: Add comment to make all error line
5686 numbers double digits.
5687 * testsuite/debug_msg.sh: Adjust expected errors.
5689 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
5691 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5692 but mark earlier ones as non-canonical
5693 (offset_to_iterator): Update search target and example
5694 (do_addr2line): Return extra lines in a vector*
5695 (format_file_lineno): Extract from do_addr2line
5696 (one_addr2line): Add vector* out-param
5697 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5698 when a lineno entry appeared last for its instruction
5699 (Dwarf_line_info): Add vector* out-param
5700 * object.cc (Relocate_info): Pass NULL for the vector* out-param
5701 * symtab.cc (Odr_violation_compare): Include the lineno in the
5703 (linenos_from_loc): New. Combine the canonical line for an
5704 address with its other lines.
5705 (True_if_intersect): New. Helper functor to make
5706 std::set_intersection a query.
5707 (detect_odr_violations): Compare sets of lines instead of just
5708 one line for each function. This became less deterministic, but
5709 has fewer false positives.
5710 * symtab.h: Declarations.
5711 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5712 mix an optimized and non-optimized object in the same binary
5713 (odr_violation2.so): Same.
5714 * testsuite/Makefile.in: Regenerate from Makefile.am.
5715 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5716 * testsuite/debug_msg.sh: Update line numbers and add
5718 * testsuite/odr_violation1.cc: Use OdrDerived, in a
5719 non-optimized context.
5720 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5721 isn't inlined, and use OdrDerived in an optimized context.
5722 * testsuite/odr_header1.h: Defines OdrDerived, where
5723 optimization will change the
5724 first-instruction-in-the-destructor's file and line number.
5725 * testsuite/odr_header2.h: Defines OdrBase.
5727 2011-03-09 Ian Lance Taylor <iant@google.com>
5729 * fileread.cc (File_read::clear_views): Don't delete the whole
5732 2011-03-08 Ian Lance Taylor <iant@google.com>
5735 * fileread.cc: #include <climits>.
5736 (GOLD_IOV_MAX): Define.
5737 (File_read::read_multiple): Limit number of entries by iov_max.
5738 * fileread.h (class File_read): Always set max_readv_entries to
5741 2011-03-07 Ian Lance Taylor <iant@google.com>
5744 * options.h (class General_options): Add -dy and -dn.
5746 2011-03-02 Cary Coutant <ccoutant@google.com>
5748 * testsuite/script_test_9.t: Add TLS segment.
5750 2011-03-02 Simon Baldwin <simonb@google.com>
5752 * configure.ac: Add check for gnu_indirect_function support in
5753 the toolchain building binutils.
5754 * configure: Rebuild.
5756 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
5758 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5759 plugin only symbols.
5760 (Symbol_table::sized_finalize_symbol) Mark symbol only present
5761 in plugin files as not needed in the symbol table.
5763 2011-02-11 Sriraman Tallam <tmsriram@google.com>
5765 * output.cc (Output_section::add_input_section): Delay fill
5766 generation for section ordering.
5768 2011-02-09 Ian Lance Taylor <iant@google.com>
5771 * object.h (class Sized_relobj): Remove clear_local_symbols.
5772 * reloc.cc (Sized_relobj::do_relocate): Don't call
5773 clear_local_symbols.
5775 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
5777 * plugin.cc (is_visible_from_outside): Return true for symbols
5780 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
5782 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5785 2011-02-02 Sriraman Tallam <tmsriram@google.com>
5787 * icf.h (is_section_foldable_candidate): Change type of parameter
5789 * icf.cc (Icf::find_identical_sections): Change type of local variable
5790 section_name to be std::string.
5791 (is_function_ctor_or_dtor): Change type of parameter to std::string.
5793 2011-01-25 Ian Lance Taylor <iant@google.com>
5795 * script.cc (script_add_extern): Rewrite to use
5796 add_symbol_reference.
5798 2011-01-25 Doug Kwan <dougkwan@google.com>
5800 * icf.cc (get_section_contents): Always lock section's object.
5802 2011-01-24 Ian Lance Taylor <iant@google.com>
5804 * options.h (class General_options): Accept
5805 --no-detect-odr-violations.
5807 2011-01-24 Ian Lance Taylor <iant@google.com>
5809 * version.cc (version_string): Bump to 1.11.
5811 2011-01-24 Ian Lance Taylor <iant@google.com>
5813 * plugin.cc (class Plugin_rescan): Define new class.
5814 (Plugin_manager::claim_file): Set any_claimed_.
5815 (Plugin_manager::save_archive): New function.
5816 (Plugin_manager::save_input_group): New function.
5817 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5819 (Plugin_manager::new_undefined_symbol): New function.
5820 (Plugin_manager::rescan): New function.
5821 (Plugin_manager::rescannable_defines): New function.
5822 (Plugin_manager::add_input_file): Set any_added_.
5823 * plugin.h (class Plugin_manager): define new fields rescannable_,
5824 undefined_symbols_, any_claimed_, and any_added_. Declare
5825 Plugin_rescan as friend. Declare new functions.
5826 (Plugin_manager::Rescannable): Define type.
5827 (Plugin_manager::Rescannable_list): Define type.
5828 (Plugin_manager::Undefined_symbol_list): Define type.
5829 (Plugin_manager::Plugin_manager): Initialize new fields.
5830 * archive.cc (Archive::defines_symbol): New function.
5831 (Add_archive_symbols::run): Pass archive to plugins if any.
5832 * archive.h (class Archive): Declare defines_symbol.
5833 * readsyms.cc (Input_group::~Input_group): New function.
5834 (Finish_group::run): Pass input_group to plugins if any.
5835 * readsyms.h (class Input_group): Declare destructor.
5836 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5839 2011-01-10 Ian Lance Taylor <iant@google.com>
5841 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5843 (Layout::set_segment_offsets): Reset increase_relro before calling
5844 set_section_addresses a second time.
5846 2011-01-04 Cary Coutant <ccoutant@google.com>
5848 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5849 sections before NOBITS sections.
5851 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
5853 * version.cc (print_version): Update copyright to 2011.
5855 2010-12-23 Cary Coutant <ccoutant@google.com>
5857 * output.h (Output_data_reloc::add_output_section): Pass OD instead
5858 of OS to this->add. Add OD parameter to second form of the function.
5860 2010-12-20 Ian Lance Taylor <iant@google.com>
5862 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5863 second of two consecutive entries with same offset.
5865 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5867 * testsuite/Makefile.am (ifuncmain2static_LDADD)
5868 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5869 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5870 to avoid unneeded links against $(LDADD).
5871 * testsuite/Makefile.in: Regenerate.
5873 2010-12-15 Ian Lance Taylor <iant@google.com>
5876 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5877 for R_X86_64_32 and R_X86_64_PC32.
5878 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5879 ver_matching_def_pic.o.
5880 (ver_matching_def_pic.o): New target.
5882 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5884 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5885 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5886 Move definition before File_read::View member definitions.
5887 (File_read::View::~View): Initialize and hold lock before
5888 updating current_mapped_bytes.
5890 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5892 * dwarf_reader.cc: Remove outdated comment.
5893 * gold-threads.cc: Fix typo in error message.
5894 * archive.cc: Fix typos in comments.
5895 * archive.h: Likewise.
5896 * arm-reloc-property.cc: Likewise.
5897 * arm-reloc-property.h: Likewise.
5898 * arm-reloc.def: Likewise.
5900 * attributes.h: Likewise.
5901 * cref.cc: Likewise.
5902 * ehframe.cc: Likewise.
5903 * fileread.h: Likewise.
5905 * i386.cc: Likewise.
5907 * incremental.h: Likewise.
5908 * int_encoding.cc: Likewise.
5909 * layout.h: Likewise.
5910 * main.cc: Likewise.
5911 * merge.h: Likewise.
5912 * object.cc: Likewise.
5913 * object.h: Likewise.
5914 * options.cc: Likewise.
5915 * readsyms.cc: Likewise.
5916 * reduced_debug_output.cc: Likewise.
5917 * reloc.cc: Likewise.
5918 * script-sections.cc: Likewise.
5919 * sparc.cc: Likewise.
5920 * symtab.h: Likewise.
5921 * target-reloc.h: Likewise.
5922 * target.cc: Likewise.
5923 * target.h: Likewise.
5924 * timer.cc: Likewise.
5925 * timer.h: Likewise.
5926 * x86_64.cc: Likewise.
5928 2010-12-09 Cary Coutant <ccoutant@google.com>
5930 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5932 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5933 parameter; change all callers.
5934 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5935 * options.h (warn_execstack): New option.
5937 2010-12-07 Doug Kwan <dougkwan@google.com>
5939 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5940 like function call relocations.
5942 2010-12-07 Ian Lance Taylor <iant@google.com>
5944 * archive.cc (Archive::get_elf_object_for_member): Permit
5945 punconfigured to be NULL.
5946 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5947 (Archive::include_member): Pass NULL to get_elf_object_for_member
5948 if we searched for the archive and this is the first included
5951 2010-12-01 Ian Lance Taylor <iant@google.com>
5953 * dwarf_reader.h (class Sized_dwarf_line_info): Add
5954 track_relocs_type_ field.
5955 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5956 Set track_relocs_type_.
5957 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5958 contents when using RELA relocs.
5959 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5961 * reloc.cc (Track_relocs::next_addend): New function.
5962 * reloc.h (class Track_relocs): Declare next_addend.
5964 2010-12-01 Ian Lance Taylor <iant@google.com>
5966 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5969 2010-12-01 Ian Lance Taylor <iant@google.com>
5971 * README: Update compilers known to work and fail.
5973 2010-11-23 Matthias Klose <doko@ubuntu.com>
5975 * configure.in: For --enable-gold, handle value `default' instead of
5976 `both*'. Always install ld as ld.bfd, install as ld if gold is
5978 * configure: Regenerate.
5980 2010-11-18 Doug Kwan <dougkwan@google.com>
5982 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5983 and right_alignment to be zero. Store result alignment only if it is
5984 greater than existing alignment.
5986 2010-11-16 Cary Coutant <ccoutant@google.com>
5989 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5990 Check for ".zdebug_line".
5992 2010-11-16 Doug Kwan <dougkwan@google.com>
5993 Cary Coutant <ccoutant@google.com>
5995 * output.h (Output_segment::set_section_addresses): Pass increase_relro
5996 by reference; adjust all callers.
5997 * output.cc (Output_segment::set_section_addresses): Adjust references
5998 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6000 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6001 end at page boundary.
6003 2010-11-16 Cary Coutant <ccoutant@google.com>
6006 * layout.cc (Layout::choose_output_section): Transform names of
6007 compressed sections even when using a script with a SECTIONS clause.
6008 (Layout::output_section_name): Remove code to transform
6009 compressed debug section names.
6010 * output.cc (Output_section::add_input_section): Use uncompressed
6011 section size when tracking input sections.
6013 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
6015 * symtab.h (Symbol::NON_PIC_REF): Remove.
6016 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6017 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
6018 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6019 (Symbol::use_plt_offset): Take a flags argument and pass it
6020 directly to needs_dynamic_reloc. Restrict check for undefined
6021 weak symbols to function calls.
6022 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6023 (Target_arm::Scan::global): Use it.
6024 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6025 (Target_arm::Relocate::relocate): Likewise.
6026 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6027 parameter with an r_type parameter. Use get_reference_flags
6029 (Target_arm::Relocate::relocate): Update accordingly.
6030 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6031 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6032 (Target_i386::Scan::global): Likewise.
6033 (Target_i386::Relocate::relocate): Likewise.
6034 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6035 parameter with an r_type parameter. Use get_reference_flags
6037 (Target_i386::Relocate::relocate): Update accordingly.
6038 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6039 (Target_powerpc::Scan::global): Use it.
6040 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6041 (Target_powerpc::Relocate::relocate): Likewise.
6042 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6043 (Target_sparc::Scan::global): Use it.
6044 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6045 (Target_sparc::Relocate::relocate): Likewise.
6046 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6047 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6048 (Target_x86_64::Scan::global): Likewise.
6049 (Target_x86_64::Relocate::relocate): Likewise.
6051 2010-11-08 Doug Kwan <dougkwan@google.com>
6052 Cary Coutant <ccoutant@google.com>
6054 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6055 (Arm_exidx_merge_section::section_contents_): New data member.
6056 (Arm_input_section::Arm_input_section): Initialize original_contents_.
6057 (Arm_input_section::~Arm_input_section): De-allocate memory.
6058 (Arm_input_section::original_contents_): New data member.
6059 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6060 in parameters instead of calling Object::section_contents without
6062 (Arm_output_section::group_section): New parameter TASK. Pass it
6063 to callees that need locking objects.
6064 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
6065 to lock EXIDX input sections. Fix a formatting issue. Call
6066 Arm_exidx_merged_section::build_contents to create merged section
6068 (Arm_output_section::create_stub_group): New parameter TASK. Use it
6069 to lock object of stub table owner.
6070 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6071 TEXT_SIZE to initialize data member TEXT_SIZE_.
6072 (Arm_exidx_input_section::addralign): Fix typo in comment.
6073 (Arm_exidx_input_section::text_size): New method.
6074 (Target_arm::do_relax): New parameter TASK. Pass it to callees
6075 that require locking objects. Lock objects before scanning for stubs
6076 and updating local symbols.
6077 (Arm_input_section<big_endian>::init): Copy contents of original
6079 (Arm_input_section<big_endian>::do_write): Use saved contents of
6080 original input section instead of calling Object::section_contents
6082 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6083 size without calling Object::section_size().
6084 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6085 for size. Allocate a buffer for merged EXIDX entries.
6086 (Arm_exidx_merged_section::build_contents): New method.
6087 (Arm_exidx_merged_section::do_write): Move merge section contents
6088 building code to Arm_exidx_merged_section::build_contetns. Write
6089 out contetns in buffer instead of building it on the fly.
6090 (Arm_relobj::make_exidx_input_section): Also pass text section size
6091 to Arm_exidx_input_section constructor.
6092 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
6093 (Arm_dynobj::do_read_symbols): Fix memory leak.
6094 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6095 * target.h: (class Task): Add forward declaration.
6096 (Target::relax): Add new parameter TASK and pass it to
6098 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
6100 2010-11-05 Cary Coutant <ccoutant@google.com>
6103 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6104 object when reading from the file.
6105 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6107 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6108 when reading section contents.
6109 (get_section_contents): Likewise.
6110 (icf::find_identical_sections): Likewise.
6111 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6112 object when reading from the file.
6113 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6114 the object when doing deferred section layout.
6116 2010-11-03 Nick Clifton <nickc@redhat.com>
6119 * script.h (class Symbol_assignment: name): New member. Returns
6120 the name of the symbol.
6121 * scrfipt.cc (Script_options::is_pending_assignment): New member.
6122 Returns true if the given symbol name is on the list of
6123 assignments wating to be processed.
6124 * archive.cc (should_incldue_member): If the symbol is undefined,
6125 check to see if it is on the list of symbols pending assignment.
6127 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
6129 * script-sections.cc (Script_sections::find_memory_region): Check
6130 for a NULL output section pointer.
6132 2010-10-29 Doug Kwan <dougkwan@google.com>
6134 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6135 Output_section::add_relaxed_input_section.
6136 * output.cc (Output_section::add_relaxed_input_section): Add new
6137 arguments LAYOUT and NAME. Set section order index.
6138 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6139 Copy section order index.
6140 * output.h (Output_section::add_relaxed_input_section): Add new
6141 arguments LAYOUT and NAME.
6143 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6145 * testsuite/Makefile.am: Move gcctestdir/ld rule to
6146 NATIVE_OR_CROSS_LINKER.
6147 * testsuite/Makefile.in: Regenerate.
6149 2010-10-20 Doug Kwan <dougkwan@google.com>
6151 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6152 without SHF_LINK_ORDER flags.
6153 * layout.cc (Layout::choose_output_section): Do not filter
6154 SHF_LINK_ORDER flag in a relocatable link.
6156 2010-10-17 Cary Coutant <ccoutant@google.com>
6158 * output.h (Output_segment::set_section_addresses): Change function
6159 signature. Update all callers.
6160 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6162 (Output_segment::set_section_addresses): Align after last TLS
6163 section. Add padding before last relro section instead of after.
6165 2010-10-17 Doug Kwan <dougkwan@google.com>
6167 * gold/arm.cc (Target_arm::got_section): Use correct order and set
6168 GOT output section to be writable.
6170 2010-10-14 Cary Coutant <ccoutant@google.com>
6172 * debug.h (DEBUG_INCREMENTAL): New flag.
6173 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6174 * gold.cc (queue_initial_tasks): Check parameters for incremental link
6176 * incremental.cc (report_command_line): Ignore all forms of
6178 * layout.cc (Layout::Layout): Check parameters for incremental link
6180 * options.cc (General_options::parse_incremental): New function.
6181 (General_options::parse_no_incremental): New function.
6182 (General_options::parse_incremental_full): New function.
6183 (General_options::parse_incremental_update): New function.
6184 (General_options::incremental_mode_): New data member.
6185 (General_options::finalize): Check incremental_mode_.
6186 * options.h (General_options): Update help text for --incremental.
6187 Add --no-incremental, --incremental-full, --incremental-update.
6188 (General_options::Incremental_mode): New enum type.
6189 (General_options::incremental_mode): New function.
6190 (General_options::incremental_mode_): New data member.
6191 * parameters.cc (Parameters::incremental_mode_): New data member.
6192 (Parameters::set_options): Set incremental_mode_.
6193 (Parameters::set_incremental_full): New function.
6194 (Parameters::incremental): New function.
6195 (Parameters::incremental_update): New function.
6196 (set_parameters_incremental_full): New function.
6197 * parameters.h (Parameters::set_incremental_full): New function.
6198 (Parameters::incremental): New function.
6199 (Parameters::incremental_update): New function.
6200 (Parameters::incremental_mode_): New data member.
6201 (set_parameters_incremental_full): New function.
6202 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6203 incremental link mode.
6204 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6205 (Sized_relobj::do_relocate_sections): Likewise.
6206 * testsuite/Makefile.am (incremental_test): Use --incremental-full
6208 * testsuite/Makefile.in: Regenerate.
6209 * testsuite/incremental_test.sh: Filter all forms of --incremental.
6211 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6213 * script-sections.h (class Script_sections): Make
6214 Sections_elements typedef public.
6215 * script-sections.cc (class Sort_output_sections): Add elements_
6216 field. Add constructor which sets it; change all callers.
6217 (Sort_output_sections::is_before): New function.
6218 (Sort_output_sections::operator()): Call is_before.
6219 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6221 * testsuite/script_test_10.sh: New test. Test script section
6223 * testsuite/script_test_10.t: Likewise.
6224 * testsuite/script_test_10.s: Likewise.
6225 * testsuite/Makefile.am: Wrap the cross linker tests and the
6226 common tests into NATIVE_OR_CROSS_LINKER.
6227 (check_SCRIPTS): Add script_test_10.sh.
6228 (check_DATA): Add script_test_10.stdout.
6229 (script_test_10.o, script_test_10): New targets.
6230 (script_test_10.stdout): New target.
6231 * configure, testsuite/Makefile.in: Regenerate.
6233 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6235 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6236 error for the deprecated relocations.
6237 (Target_arm::Scan::global): Likewise.
6238 (Target_arm::Relocate::relocate): Likewise.
6240 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
6242 * fileread.cc (Input_file::find_file): Initialize *found_name
6243 and *namep when using the fallback search for case 4.
6245 2010-10-11 Cary Coutant <ccoutant@google.com>
6247 * options.h (class General_options): Redefine -z lazy as an alias for
6248 the negation of -z now.
6250 2010-10-11 Ian Lance Taylor <iant@google.com>
6252 * resolve.cc (symbol_to_bits): Report the value of the unsupported
6255 2010-10-06 Nick Clifton <nickc@redhat.com>
6257 * script-sections.cc(class Memory_region): Remove
6258 current_lma_offset_ field. Rename current_vma_offset_ to
6259 current_offset_. Add last_section_ field.
6260 (Memory_region::get_current_vma_address): Rename to
6261 get_current_address.
6262 (Memory_region::get_current_lma_address): Delete.
6263 (Memory_region::increment_vma_offset): Rename to
6265 (Memory_region::increment_lma_offset): Delete.
6266 (Memory_region::attributes_compatible): New method. Returns
6267 true if the provided section is compatible with the region.
6268 (Memory_region::get_last_section): New method. Returns the last
6269 section to use the region.
6270 (Memory_region::set_last_section): New method. Stores the last
6271 section to use the region.
6272 (Script_sections::block_in_region): New method. Returns true if
6273 a block of memory is contained within a region.
6274 (Script_sections::find_memory_region): New method. Locates a
6275 memory region to be used to set a VMA or LMA address.
6276 (Output_section_definition::set_section_addresses): Add code to
6277 check for addresses set by memory regions.
6278 (Output_segment::set_section_addresses): Remove memory region
6280 (Script_sections::create_segment): Add a warning if a header
6281 segment is created outside of any region.
6282 * script-sections.h (class Script_sections): Add prototypes for
6283 find_memory_region and block_in_region methods.
6284 * testsuite/memory_test.s: Use .long instead of .word.
6285 * testsuite/memory_test.t: Add some more output sections.
6286 * testsuite/memory_test.sh: Update expected output.
6288 2010-10-02 Doug Kwan <dougkwan@google.com>
6290 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6291 defintion to symtab.h
6292 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6293 declaration to defintion.
6295 2010-10-01 Nick Clifton <nickc@redhat.com>
6297 * expression.cc (eval): Replace dummy argument with NULL.
6298 (eval_maybe_dot): Check for a NULL result section pointer.
6299 (Symbol_expression::value): Likewise.
6300 (Dot_expression::value): Likewise.
6301 (BINARY_EXPRESSION): Likewise.
6302 (Max_expression::value): Likewise.
6303 (Min_expression::value): Likewise.
6304 (Absolute_expression::value): Likewise.
6305 (Addr_expression::value_from_output_section): Likewise.
6306 (Loaddddr_expression::value_from_output_section): Likewise.
6307 (Segment_start_expression::value): Likewise.
6308 * script-sections.cc
6309 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6311 (Sections_elememt_dot_assignment::set_section_addresses):
6313 (Output_data_expression::do_write_to_buffer): Likewise.
6314 (Output_section_definition::finalize_symbols): Likewise.
6315 (Output_section_definition::set_section_addresses): Likewise.
6317 2010-09-30 Doug Kwan <dougkwan@google.com>
6319 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6321 2010-09-28 Sriraman Tallam <tmsriram@google.com>
6323 * target.h (Target::can_icf_inline_merge_sections): New virtual
6325 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6327 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6329 * icf.cc (get_section_contents): Inline merge sections only when
6332 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6334 * configure: Regenerate.
6336 2010-09-17 Ian Lance Taylor <iant@google.com>
6338 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6339 * testsuite/Makefile.am (memory_test.o): New target.
6340 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6342 * testsuite/Makefile.in: Rebuild.
6344 2010-09-17 Doug Kwan <dougkwan@google.com>
6346 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6347 defintion if relocation uses GOT entries of the symbol.
6348 * testsuite/icf_safe_test.sh: Fix test.
6349 * testsuite/icf_safe_so_test.sh: Fix test.
6351 2010-09-16 Cary Coutant <ccoutant@google.com>
6353 * script_sections.cc (class Memory_region): Remove "NULL" from
6354 vector initializations.
6356 2010-09-15 Cary Coutant <ccoutant@google.com>
6358 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6359 Resolve forwarding symbols.
6361 2010-09-15 Doug Kwan <dougkwan@google.com>
6363 * gold/testsuite/script_test_3.t: Add ARM special sections.
6364 * gold/testsuite/script_test_4.t: Same.
6365 * gold/testsuite/script_test_5.t: Same.
6366 * gold/testsuite/script_test_6.t: Same.
6367 * gold/testsuite/script_test_7.t: Same.
6368 * gold/testsuite/script_test_7.t: Same.
6369 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6371 2010-09-14 Cary Coutant <ccoutant@google.com>
6373 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6374 (Target_x86_64::Relocate::relocate_tls): Replace check for
6375 saw_tls_block_reloc_ with test for executable section.
6377 2010-09-12 Cary Coutant <ccoutant@google.com>
6379 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6380 position-independent executables to shared libraries need dynamic
6382 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6383 position-independent executables.
6384 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6385 * testsuite/Makefile.in: Regenerate.
6387 2010-09-10 Nick Clifton <nickc@redhat.com>
6390 * testsuite/memory_test.t: Discard any sections that are not
6393 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
6396 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6397 "This::" to work around a bug in gcc 4.2.
6399 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6401 2010-09-09 Rafael Espindola <espindola@google.com>
6403 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6404 sections with different PF_X flags in the same segment.
6405 (Layout::find_first_load_seg): Search all segments to find the first
6407 * options.h (rosegment): New.
6409 2010-09-08 Rafael Espindola <espindola@google.com>
6411 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6413 2010-09-08 Doug Kwan <dougkwan@google.com>
6415 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6416 (Arm_relobj::do_relocate_sections): Add new parameter for output
6417 file to match the parent.
6418 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6419 of local symbols instead of input values. Update code to track
6420 changes in gold::relocate_section.
6421 * object.cc (Sized_relobj::compute_final_local_value): New methods.
6422 (Sized_relobj::compute_final_local_value_internal): New methods.
6423 (Sized_relobj::do_finalize_local_symbols): Move code from loop
6424 body into private version of Sized_relobj::compute_final_local_value.
6425 Call the inline method.
6426 * object.h (Symbol_value::Symbol_value): Define destructor. Free
6427 merged symbol value if there is one.
6428 (Symbol_value::has_output_value): New method defintiion.
6429 (Sized_relobj::Compute_final_local_value_status): New enum type.
6430 (Sized_relobj::compute_final_local_value): New methods.
6431 (Sized_relobj::compute_final_local_value_internal): New methods.
6432 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6433 and arm_cortex_a8.sh.
6434 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6435 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6437 * Makefile.in: Regenerate.
6438 * testsuite/arm_bl_out_of_range.s: Update test.
6439 * testsuite/thumb_bl_out_of_range.s: Ditto.
6440 * testsuite/thumb_blx_out_of_range.s: Ditto.
6441 * testsuite/arm_branch_out_of_range.sh: New file.
6442 * testsuite/arm_cortex_a8.sh: Ditto.
6443 * testsuite/arm_cortex_a8_b.s: Ditto.
6444 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6445 * testsuite/arm_cortex_a8_b_local.s: Ditto.
6446 * testsuite/arm_cortex_a8_bl.s: Ditto.
6447 * testsuite/arm_cortex_a8_blx.s: Ditto.
6448 * testsuite/arm_cortex_a8_local.s: Ditto.
6449 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6450 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6452 2010-09-08 Rafael Espindola <espindola@google.com>
6454 * Makefile.am (memory_test.stdout): Run readelf with -W.
6455 * Makefile.in: Regenerate.
6456 * testsuite/memory_test.sh: Make the regexps accept both 32 and
6459 2010-09-08 Rafael Espindola <espindola@google.com>
6461 * script-sections.cc (Script_sections::add_memory_region): Convert
6462 field precision to int.
6463 * script.cc (script_set_section_region, script_set_section_region):
6464 Convert field precision to int.
6466 2010-09-08 Rafael Espindola <espindola@google.com>
6468 * arm.cc (do_finalize_sections): Create the __exidx_start and
6469 __exdix_end symbols even when the section is missing.
6471 2010-09-08 Nick Clifton <nickc@redhat.com>
6473 * README: Remove claim that MEMORY is not supported.
6474 * expression.cc (script_exp_function_origin)
6475 (script_exp_function_length): Move from here to ...
6476 * script.cc: ... here.
6477 (script_set_section_region, script_add_memory)
6478 (script_parse_memory_attr, script_include_directive): New
6480 * script-sections.cc
6481 (class Memory_region): New class.
6482 (class Output_section_definition): Add set_memory_region,
6483 set_section_vma, set_section_lma and get_section_name methods.
6484 (class Script_Sections): Add add_memory_region,
6485 find_memory_region, find_memory_region_origin,
6486 find_memory_region_length and set_memory_region methods.
6487 Have set_section_addresses method walk the list of set memory
6489 Extend the print methos to display memory regions.
6490 * script-sections.h: Add prototypes for new methods.
6491 Add enum for MEMORY region attributes.
6492 * yyscript.y: Add support for parsing MEMORY regions.
6493 * script-c.h: Add prototypes for new functions.
6494 * testsuite/Makefile.am: Add test of MEMORY region functionality.
6495 * testsuite/Makefile.in: Regenerate.
6496 * testsuite/memory_test.sh: New script.
6497 * testsuite/memory_test.s: New assembler source file.
6498 * testsuite/memory_test.t: New linker script.
6500 2010-08-27 Doug Kwan <dougkwan@google.com>
6502 * gold/resolve.cc (Symbol_table::should_override): Let a weak
6503 reference override an existing dynamic weak reference.
6504 * testsuite/Makefile.am: Add new test dyn_weak_ref.
6505 * testsuite/Makefile.in: Regenerate.
6506 * testsuite/dyn_weak_ref.sh: New file.
6507 * testsuite/dyn_weak_ref_1.c: Ditto.
6508 * testsuite/dyn_weak_ref_2.c: Ditto.
6510 2010-08-27 Ian Lance Taylor <iant@google.com>
6512 * incremental.h (class Incremental_input_entry): Add virtual
6515 2010-08-27 Ian Lance Taylor <iant@google.com>
6517 * testsuite/start_lib_test_3.c: Mark t3 as used.
6519 2010-08-27 Nick Clifton <nickc@redhat.com>
6521 * options.cc (version_script): Fix small typo in previous
6524 2010-08-25 Nick Clifton <nickc@redhat.com>
6526 * archive.cc: Formatting fixes: Remove whitespace between
6527 typename and following asterisk. Remove whitespace between
6528 function name and opening parenthesis.
6529 * archive.h: Likewise.
6531 * attributes.cc: Likewise.
6532 * attributes.h: Likewise.
6533 * common.cc: Likewise.
6534 * copy-relocs.cc: Likewise.
6535 * dirsearch.h: Likewise.
6536 * dynobj.cc: Likewise.
6537 * ehframe.cc: Likewise.
6538 * ehframe.h: Likewise.
6539 * expression.cc: Likewise.
6540 * fileread.cc: Likewise.
6541 * fileread.h: Likewise.
6543 * gold-threads.cc: Likewise.
6544 * gold.cc: Likewise.
6545 * i386.cc: Likewise.
6547 * incremental-dump.cc: Likewise.
6548 * incremental.cc: Likewise.
6549 * layout.cc: Likewise.
6550 * layout.h: Likewise.
6551 * main.cc: Likewise.
6552 * merge.cc: Likewise.
6553 * merge.h: Likewise.
6554 * object.cc: Likewise.
6555 * object.h: Likewise.
6556 * options.cc: Likewise.
6557 * options.h: Likewise.
6558 * output.cc: Likewise.
6559 * output.h: Likewise.
6560 * plugin.cc: Likewise.
6561 * plugin.h: Likewise.
6562 * powerpc.cc: Likewise.
6563 * reloc.cc: Likewise.
6564 * script-c.h: Likewise.
6565 * script-sections.cc: Likewise.
6566 * script.cc: Likewise.
6567 * stringpool.cc: Likewise.
6568 * symtab.cc: Likewise.
6569 * symtab.h: Likewise.
6570 * target.cc: Likewise.
6571 * timer.cc: Likewise.
6572 * timer.h: Likewise.
6573 * version.cc: Likewise.
6574 * x86_64.cc: Likewise.
6576 2010-08-24 Nick Clifton <nickc@redhat.com>
6579 * layout.cc (segment_precedes): Sort segments by their physical
6580 addresses, if they have been set.
6582 2010-08-23 Cary Coutant <ccoutant@google.com>
6584 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6586 (Lib_group::include_member): Unlock object after deleting its
6588 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6591 2010-08-19 Neil Vachharajani <nvachhar@google.com>
6592 Cary Coutant <ccoutant@google.com>
6594 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6595 constructor, and set_blocker.
6596 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6598 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6599 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6600 * testsuite/Makefile.am (start_lib_test): New test case.
6601 * testsuite/Makefile.in: Regenerate.
6602 * testsuite/start_lib_test_main.c: New file.
6603 * testsuite/start_lib_test_1.c: New file.
6604 * testsuite/start_lib_test_2.c: New file.
6605 * testsuite/start_lib_test_3.c: New file.
6607 2010-08-19 Ian Lance Taylor <iant@google.com>
6609 * Makefile.in: Rebuild with automake 1.11.1.
6610 * aclocal.m4: Likewise.
6611 * testsuite/Makefile.in: Likewise.
6613 2010-08-19 Ian Lance Taylor <iant@google.com>
6616 * i386.cc (class Output_data_plt_i386): Update declarations.
6617 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
6618 local_ifuncs_ fields.
6619 (Target_i386::do_plt_section_for_global): New function.
6620 (Target_i386::do_plt_section_for_local): New function.
6621 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6622 parameter; change all callers. Initialize global_ifuncs_ and
6623 local_ifuncs_. If doing a static link define __rel_iplt_start and
6625 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6626 (Output_data_plt_i386::add_local_ifunc_entry): New function.
6627 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6629 (Target_i386::make_plt_section): New function, broken out of
6630 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
6631 (Target_i386::make_plt_entry): Call make_plt_section.
6632 (Target_i386::make_local_ifunc_plt_entry): New function.
6633 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6634 (Target_i386::Scan::local): Handle IFUNC symbols. Add
6635 R_386_IRELATIVE to switch.
6636 (Target_i386::Scan::global): Likewise.
6637 (Target_i386::Relocate::relocate): Likewise.
6638 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6640 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6641 (Target_x86_64::do_plt_section_for_global): New function.
6642 (Target_x86_64::do_plt_section_for_local): New function.
6643 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6644 parameter; change all callers. If doing a static link define
6645 __rela_iplt_start and __rela_iplt_end.
6646 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6647 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6648 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6650 (Target_x86_64::make_local_ifunc_plt_entry): New function.
6651 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6653 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6654 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
6655 R_X86_64_IRELATIVE to switch.
6656 (Target_x86_64::Scan::global): Likewise.
6657 (Target_x86_64::Relocate::relocate): Likewise.
6658 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6660 * target.h (class Target): Add plt_section_for_global and
6661 plt_section_for_local functions. Add do_plt_section_for_global
6662 and do_plt_section_for_local virtual functions.
6663 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
6664 clarifying comments.
6665 (Symbol::use_plt_offset): Handle IFUNC symbol.
6666 * object.cc (Sized_relobj::Sized_relobj): Initialize
6668 (Sized_relobj::local_has_plt_offset): New function.
6669 (Sized_relobj::local_plt_offset): New function.
6670 (Sized_relobj::set_local_plt_offset): New function.
6671 (Sized_relobj::do_count): Handle IFUNC symbol.
6672 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
6673 a bit away from input_shndx_ field. Add set_is_func_symbol and
6674 is_ifunc_symbol functions.
6675 (class Sized_relobj): Update declarations. Remove Tls_got_entry
6676 and Local_tls_got_offsets. Define Local_plt_offsets. Add
6677 local_plt_offsets_ field.
6678 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6679 * output.h (class Output_section_data): Add non-const
6680 output_section function.
6681 (class Output_data_got): Update declarations.
6682 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6683 Add use_plt_offset parameter to global and local constructors.
6684 Change all callers. Change local_sym_index_ field to 31 bits.
6685 Change GSYM_CODE and CONSTANT_CODE accordingly.
6686 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6687 doing a static link don't set sh_link field.
6688 (Output_data_got::Got_entry::write): Use PLT offset if
6690 (Output_data_got::add_global_plt): New function.
6691 (Output_data_got::add_local_plt): New function.
6692 * target-reloc.h (relocate_section): Handle IFUNC symbol.
6693 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6694 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6695 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6696 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6698 * testsuite/ifunc-sel.h: New file.
6699 * testsuite/ifuncmain1.c: New file.
6700 * testsuite/ifuncmain1vis.c: New file.
6701 * testsuite/ifuncmod1.c: New file.
6702 * testsuite/ifuncdep2.c: New file.
6703 * testsuite/ifuncmain2.c: New file.
6704 * testsuite/ifuncmain3.c: New file.
6705 * testsuite/ifuncmod3.c: New file.
6706 * testsuite/ifuncmain4.c: New file.
6707 * testsuite/ifuncmain5.c: New file.
6708 * testsuite/ifuncmod5.c: New file.
6709 * testsuite/ifuncmain6pie.c: New file.
6710 * testsuite/ifuncmod6.c: New file.
6711 * testsuite/ifuncmain7.c: New file.
6712 * configure, testsuite/Makefile.in: Rebuild.
6714 2010-08-18 Ian Lance Taylor <iant@google.com>
6717 (Output_section_incremental_inputs::write_input_files): Add cast
6718 to avoid signed/unsigned comparison warning.
6719 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6721 2010-08-12 Cary Coutant <ccoutant@google.com>
6723 * common.cc (Sort_commons::operator()): Remove unnecessary code.
6725 2010-08-13 Ian Lance Taylor <iant@google.com>
6727 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6729 2010-08-12 Cary Coutant <ccoutant@google.com>
6730 Doug Kwan <dougkwan@google.com>
6732 * resolve.cc (Symbol_table::should_override): When a weak dynamic
6733 defintion overrides non-weak undef, remember that the original undef
6735 * symtab.cc (Symbol_table::sized_write_global): For undef without
6736 an original weak binding, set binding to global in output.
6737 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6738 * testsuite/Makefile.in: Regenerate.
6739 * testsuite/strong_ref_weak_def.sh: New file.
6740 * testsuite/strong_ref_weak_def_1.c: Ditto.
6741 * testsuite/strong_ref_weak_def_2.c: Ditto.
6743 2010-08-12 Cary Coutant <ccoutant@google.com>
6745 * testsuite/incremental_test.sh: Rewrite.
6746 * testsuite/incremental_test_1.c: Rewrite.
6747 * testsuite/incremental_test_2.c: Rewrite.
6749 2010-08-12 Cary Coutant <ccoutant@google.com>
6751 * arm.cc (Target_arm::got_size): Add const.
6752 (Target_arm::got_entry_count): New function.
6753 (Target_arm::plt_entry_count): New function.
6754 (Target_arm::first_plt_entry_offset): New function.
6755 (Target_arm::plt_entry_size): New function.
6756 (Output_data_plt_arm::entry_count): New function.
6757 (Output_data_plt_arm::first_plt_entry_offset): New function.
6758 (Output_data_plt_arm::get_plt_entry_size): New function.
6759 * i386.cc (Target_i386::got_size): Add const.
6760 (Target_i386::got_entry_count): New function.
6761 (Target_i386::plt_entry_count): New function.
6762 (Target_i386::first_plt_entry_offset): New function.
6763 (Target_i386::plt_entry_size): New function.
6764 (Output_data_plt_i386::entry_count): New function.
6765 (Output_data_plt_i386::first_plt_entry_offset): New function.
6766 (Output_data_plt_i386::get_plt_entry_size): New function.
6767 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6768 find_incremental_inputs_sections. Dump incremental_got_plt section.
6769 * incremental.cc: Include target.h.
6770 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6771 parameter. Adjust all callers. Find incremental_got_plt section.
6772 (Incremental_inputs::create_data_sections): Create incremental_got_plt
6774 (Output_section_incremental_inputs::set_final_data_size): Calculate
6775 size of incremental_got_plt section.
6776 (Output_section_incremental_inputs::do_write): Write the
6777 incremental_got_plt section.
6778 (Got_plt_view_info): New struct.
6779 (Local_got_offset_visitor): New class.
6780 (Global_got_offset_visitor): New class.
6781 (Global_symbol_visitor_got_plt): New class.
6782 (Output_section_incremental_inputs::write_got_plt): New function.
6783 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6784 Add parameter. Adjust all callers.
6785 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6786 (Incremental_inputs::got_plt_section): New function.
6787 (Incremental_inputs::got_plt_section_): New data member.
6788 (Incremental_got_plt_reader): New class.
6789 * layout.cc (Layout::create_incremental_info_sections): Add the
6790 incremental_got_plt section.
6791 * object.h (Got_offset_list::get_list): New function.
6792 (Got offset_list::for_all_got_offsets): New function.
6793 (Sized_relobj::local_got_offset_list): New function.
6794 * powerpc.cc (Target_powerpc::got_size): Add const.
6795 (Target_powerpc::got_entry_count): New function.
6796 (Target_powerpc::plt_entry_count): New function.
6797 (Target_powerpc::first_plt_entry_offset): New function.
6798 (Target_powerpc::plt_entry_size): New function.
6799 (Output_data_plt_powerpc::entry_count): New function.
6800 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6801 (Output_data_plt_powerpc::get_plt_entry_size): New function.
6802 * sparc.cc (Target_sparc::got_size): Add const.
6803 (Target_sparc::got_entry_count): New function.
6804 (Target_sparc::plt_entry_count): New function.
6805 (Target_sparc::first_plt_entry_offset): New function.
6806 (Target_sparc::plt_entry_size): New function.
6807 (Output_data_plt_sparc::entry_count): New function.
6808 (Output_data_plt_sparc::first_plt_entry_offset): New function.
6809 (Output_data_plt_sparc::get_plt_entry_size): New function.
6810 * symtab.h (Symbol::got_offset_list): New function.
6811 (Symbol_table::for_all_symbols): New function.
6812 * target.h (Sized_target::got_entry_count): New function.
6813 (Sized_target::plt_entry_count): New function.
6814 (Sized_target::plt_entry_size): New function.
6815 * x86_64.cc (Target_x86_64::got_size): Add const.
6816 (Target_x86_64::got_entry_count): New function.
6817 (Target_x86_64::plt_entry_count): New function.
6818 (Target_x86_64::first_plt_entry_offset): New function.
6819 (Target_x86_64::plt_entry_size): New function.
6820 (Output_data_plt_x86_64::entry_count): New function.
6821 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6822 (Output_data_plt_x86_64::get_plt_entry_size): New function.
6824 2010-08-12 Cary Coutant <ccoutant@google.com>
6826 * archive.cc: Include incremental.h.
6827 (Archive::Archive): Initialize incremental_info_.
6828 (Archive::include_member): Record archive members in incremental info.
6829 (Add_archive_symbols::run): Record begin and end of an archive in
6831 (Lib_group::include_member): Record objects in incremental info.
6832 * archive.h (Incremental_archive_entry): Forward declaration.
6833 (Archive::set_incremental_info): New member function.
6834 (Archive::incremental_info): New member function.
6835 (Archive::Unused_symbol_iterator): New class.
6836 (Archive::unused_symbols_begin): New member function.
6837 (Archive::unused_symbols_end): New member function.
6838 (Archive::incremental_info_): New data member.
6839 * incremental-dump.cc (find_input_containing_global): New function.
6840 (dump_incremental_inputs): Dump new incremental info sections.
6841 * incremental.cc: Include symtab.h.
6842 (Output_section_incremental_inputs): New class.
6843 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6844 new incremental info sections.
6845 (Sized_incremental_binary::do_check_inputs): Likewise.
6846 (Incremental_inputs::report_archive): Remove.
6847 (Incremental_inputs::report_archive_begin): New function.
6848 (Incremental_inputs::report_archive_end): New function.
6849 (Incremental_inputs::report_object): New function.
6850 (Incremental_inputs::finalize_inputs): Remove.
6851 (Incremental_inputs::report_input_section): New function.
6852 (Incremental_inputs::report_script): Rewrite.
6853 (Incremental_inputs::finalize): Do nothing but finalize string table.
6854 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6855 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6856 (Incremental_inputs::create_data_sections): New function.
6857 (Incremental_inputs::relocs_entsize): New function.
6858 (Output_section_incremental_inputs::set_final_data_size): New function.
6859 (Output_section_incremental_inputs::do_write): New function.
6860 (Output_section_incremental_inputs::write_header): New function.
6861 (Output_section_incremental_inputs::write_input_files): New function.
6862 (Output_section_incremental_inputs::write_info_blocks): New function.
6863 (Output_section_incremental_inputs::write_symtab): New function.
6864 * incremental.h (Incremental_script_entry): Forward declaration.
6865 (Incremental_object_entry): Forward declaration.
6866 (Incremental_archive_entry): Forward declaration.
6867 (Incremental_inputs): Forward declaration.
6868 (Incremental_inputs_header_data): Remove.
6869 (Incremental_inputs_header): Remove.
6870 (Incremental_inputs_header_write): Remove.
6871 (Incremental_inputs_entry_data): Remove.
6872 (Incremental_inputs_entry): Remove.
6873 (Incremental_inputs_entry_write): Remove.
6874 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6875 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6876 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6877 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6879 (Incremental_input_entry): New class.
6880 (Incremental_script_entry): New class.
6881 (Incremental_object_entry): New class.
6882 (Incremental_archive_entry): New class.
6883 (Incremental_inputs::Incremental_inputs): Initialize new data members.
6884 (Incremental_inputs::report_inputs): Remove.
6885 (Incremental_inputs::report_archive): Remove.
6886 (Incremental_inputs::report_archive_begin): New function.
6887 (Incremental_inputs::report_archive_end): New function.
6888 (Incremental_inputs::report_object): Change prototype.
6889 (Incremental_inputs::report_input_section): New function.
6890 (Incremental_inputs::report_script): Change prototype.
6891 (Incremental_inputs::get_reloc_count): New function.
6892 (Incremental_inputs::set_reloc_count): New function.
6893 (Incremental_inputs::create_data_sections): New function.
6894 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6895 (Incremental_inputs::inputs_section): New function.
6896 (Incremental_inputs::symtab_section): New function.
6897 (Incremental_inputs::relocs_section): New function.
6898 (Incremental_inputs::get_stringpool): Add const.
6899 (Incremental_inputs::command_line): Add const.
6900 (Incremental_inputs::inputs): Remove.
6901 (Incremental_inputs::command_line_key): New function.
6902 (Incremental_inputs::input_file_count): New function.
6903 (Incremental_inputs::input_files): New function.
6904 (Incremental_inputs::relocs_entsize): New function.
6905 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6906 (Incremental_inputs::finalize_inputs): Remove.
6907 (Incremental_inputs::Input_info): Remove.
6908 (Incremental_inputs::lock_): Remove.
6909 (Incremental_inputs::inputs_): Change type.
6910 (Incremental_inputs::inputs_map_): Remove.
6911 (Incremental_inputs::current_object_entry_): New data member.
6912 (Incremental_inputs::inputs_section_): New data member.
6913 (Incremental_inputs::symtab_section_): New data member.
6914 (Incremental_inputs::relocs_section_): New data member.
6915 (Incremental_inputs::reloc_count_): New data member.
6916 (Incremental_inputs_reader): New class.
6917 (Incremental_symtab_reader): New class.
6918 (Incremental_relocs_reader): New class.
6919 * layout.cc (Layout::finalize): Move finalization of incremental info
6920 and creation of incremental info sections to follow finalization of
6921 symbol table. Set offsets for postprocessing sections.
6922 (Layout::create_incremental_info_sections): Call
6923 Incremental_inputs::create_data_sections. Add incremental symtab
6924 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
6925 sections to layout after input sections.
6926 * layout.h (struct Timespec): Forward declaration.
6927 (Layout::incremental_inputs): Add const.
6928 (Layout::create_incremental_info_sections): Add parameter.
6929 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6930 * object.cc: Include incremental.h.
6931 (Relobj::finalize_incremental_relocs): New function.
6932 (Sized_relobj::do_layout): Record input sections in incremental info.
6933 * object.h (Object::output_section): New function.
6934 (Object::output_section_offset): Moved from Relobj.
6935 (Object::get_incremental_reloc_base): New function.
6936 (Object::get_incremental_reloc_count): New function.
6937 (Object::do_output_section): New function.
6938 (Object::do_output_section_offset): Moved from Relobj.
6939 (Object::do_get_incremental_reloc_base): New function.
6940 (Object::do_get_incremental_reloc_count): New function.
6941 (Object::Object): Initialize new data members.
6942 (Relobj::output_section): Renamed do_output_section and moved to
6944 (Relobj::output_section_offset): Moved to Object.
6945 (Relobj::do_get_incremental_reloc_base): New function.
6946 (Relobj::do_get_incremental_reloc_count): New function.
6947 (Relobj::allocate_incremental_reloc_counts): New function.
6948 (Relobj::count_incremental_reloc): New function.
6949 (Relobj::finalize_incremental_relocs): New function.
6950 (Relobj::next_incremental_reloc_index): New function.
6951 (Relobj::reloc_counts_): New data member.
6952 (Relobj::reloc_bases_): New data member.
6953 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
6954 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
6955 (Sized_relobj::incremental_relocs_scan): New function.
6956 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6957 (Sized_relobj::incremental_relocs_write): New function.
6958 (Sized_relobj::incremental_relocs_write_reltype): New function.
6959 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6961 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6962 archives and object files elsewhere.
6963 (Add_symbols::run): Report object files here.
6964 (Finish_group::run): Report end of archive at end of group.
6965 * reloc.cc: Include layout.h, incremental.h.
6966 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6967 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6968 (Sized_relobj::incremental_relocs_scan): New function.
6969 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6970 (Sized_relobj::do_relocate_sections): Write incremental relocations.
6971 (Sized_relobj::incremental_relocs_write): New function.
6972 (Sized_relobj::incremental_relocs_write_reltype): New function.
6973 * script.cc (read_input_script): Rewrite test for incremental link.
6974 Change call to Incremental_inputs::report_script.
6975 * symtab.h (Symbol_table::first_global_index): New function.
6976 (Symbol_table::output_count): New function.
6978 2010-08-12 Doug Kwan <dougkwan@google.com>
6980 * arm.cc (Target_arm::merge_object_attributes): Check command line
6981 options --no-wchar-size-warning and --no-enum-size-warning.
6982 * options.h (General_options): Add ld-compatible options
6983 --no-enum-size-warning and --no-wchar-size-warning.
6985 2010-08-04 Ian Lance Taylor <iant@google.com>
6987 * x86_64.cc (Target_x86_64::Scan::local): Use
6988 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6989 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6990 (Target_x86_64::Scan::global): Likewise.
6991 (Target_x86_64::Relocate::relocate): Likewise.
6992 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6995 2010-08-03 Cary Coutant <ccoutant@google.com>
6997 * merge.cc (Output_merge_string::do_add_input_section): Count strings
6998 to reserve space in merged_strings vector. Keep total input size
7000 (Output_merge_string::do_print_merge_stats): Print total input size.
7001 * merge.h (Output_merge_string): Add input_size_ field.
7002 * stringpool.cc (Stringpool_template::string_length): Move
7003 implementations out of Stringpool_template class and place in
7005 * stringpool.h (string_length): Move out of Stringpool_template.
7007 2010-08-03 Ian Lance Taylor <iant@google.com>
7010 * layout.cc (relaxation_loop_body): If address of load segment is
7011 set, adjust address to include headers if possible.
7013 2010-08-03 Ian Lance Taylor <iant@google.com>
7015 * version.cc (version_string): Bump to 1.10.
7017 2010-08-03 Ian Lance Taylor <iant@google.com>
7020 * layout.h (enum Output_section_order): Define.
7021 (class Layout): Update declarations.
7022 * layout.cc (Layout::get_output_section): Add order parameter.
7023 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7024 is_first_non_relro parameters. Change all callers.
7025 (Layout::choose_output_section): Likewise.
7026 (Layout::add_output_section_data): Likewise.
7027 (Layout::make_output_section): Likewise. Set order.
7028 (Layout::default_section_order): New function.
7029 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7030 * output.cc (Output_section::Output_section): Initialize order_.
7031 Don't initialize deleted fields.
7032 (Output_segment::Output_segment): Don't initialize deleted
7034 (Output_segment::add_output_section_to_load): New function
7035 replacing add_output_section. Change all callers to call this or
7036 add_output_section_to_nonload.
7037 (Output_segment::add_output_section_to_nonload): New function.
7038 (Output_segment::remove_output_section): Rewrite.
7039 (Output_segment::add_initial_output_data): Likewise.
7040 (Output_segment::has_any_data_sections): Likewise.
7041 (Output_segment::is_first_section_relro): Likewise.
7042 (Output_segment::maximum_alignment): Likewise.
7043 (Output_segment::has_dynamic_reloc): New function replacing
7044 dynamic_reloc_count. Change all callers.
7045 (Output_segment::has_dynamic_reloc_list): New function replacing
7046 dynamic_reloc_count_list. Change all callers.
7047 (Output_segment::set_section_addresses): Rewrite.
7048 (Output_segment::set_offset): Rewrite.
7049 (Output_segment::find_first_and_last_list): Remove.
7050 (Output_segment::set_tls_offsets): Rewrite.
7051 (Output_segment::first_section_load_address): Likewise.
7052 (Output_segment::output_section_count): Likewise.
7053 (Output_segment::section_with_lowest_load_address): Likewise.
7054 (Output_segment::write_section_headers): Likewise.
7055 (Output_segment::print_sections_to_map): Likewise.
7056 * output.h (class Output_data): Remove dynamic_reloc_count_
7057 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
7058 (Output_data::add_dynamic_reloc): Rewrite.
7059 (Output_data::has_dynamic_reloc): New function.
7060 (Output_data::dynamic_reloc_count): Remove.
7061 (class Output_section): Add order_ field. Remvoe is_relro_local_,
7062 is_last_relro_, is_first_non_relro_, is_interp_,
7063 is_dynamic_linker_section_ fields. Add order and set_order
7064 functions. Remove is_relro_local, set_is_relro_local,
7065 is_last_relro, set_is_last_relro, is_first_non_relro,
7066 set_is_first_non_relro functions, is_interp, set_is_interp,
7067 is_dynamic_linker_section, and set_is_dynamic_linker_section
7069 (class Output_segment): Change Output_data_list from std::list to
7070 std:;vector. Add output_lists_ field. Remove output_data_ and
7071 output_bss_ fields. Update declarations.
7073 2010-08-02 Ian Lance Taylor <iant@google.com>
7075 * arm.cc (Target_arm::gc_process_relocs): Use typename.
7076 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7077 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7079 2010-08-02 Ian Lance Taylor <iant@google.com>
7082 * script.cc (Script_options::Script_options): Initialize
7083 symbol_definitions_ and symbol_references_.
7084 (Script_options::add_symbol_assignment): Update
7085 symbol_definitions_ and symbol_references_.
7086 (Script_options::add_symbol_reference): New function.
7087 (script_symbol): New function.
7088 * script.h (class Script_options): Add symbol_definitions_ and
7089 symbol_references_ fields.
7090 (Script_options::referenced_const_iterator): New type.
7091 (Script_options::referenced_begin): New function.
7092 (Script_options::referenced_end): New function.
7093 (Script_options::is_referenced): New function.
7094 (Script_options::any_unreferenced): New function.
7095 * script-c.h (script_symbol): Declare.
7096 * yyscript.y (exp): Call script_symbol.
7097 * symtab.cc: Include "script.h".
7098 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7099 Change all callers. Check symbols referenced by scripts.
7100 (Symbol_table::add_undefined_symbols_from_command_line): Add
7101 layout parameter. Change all callers.
7102 (Symbol_table::do_add_undefined_symbols_from_command_line):
7103 Likewise. Break out loop body. Check symbols referenced by
7105 (Symbol_table::add_undefined_symbol_from_command_line): New
7106 function broken out of
7107 do_add_undefined_symbols_from_command_line.
7108 * symtab.h (class Symbol_table): Update declarations.
7109 * archive.cc: Include "layout.h".
7110 (Archive::should_include_member): Add layout parameter. Change
7111 all callers. Check for symbol mentioned in expression.
7112 * archive.h (class Archive): Update declaration.
7113 * object.cc (Sized_relobj::do_should_include_member): Add layout
7115 * object.h (Object::should_include_member): Add layout parameter.
7117 (Object::do_should_include_member): Add layout parameter.
7118 (class Sized_relobj): Update declaration.
7119 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7121 * dynobj.h (class Sized_dynobj): Update declaration.
7122 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7124 * plugin.h (class Sized_pluginobj): Update declaration.
7126 2010-08-02 Ian Lance Taylor <iant@google.com>
7129 * output.cc (Output_segment::set_offset): Search for the first and
7130 last sections rather than assuming that the list is in order.
7131 (Output_segment::find_first_and_last_list): New function.
7132 * output.h (class Output_segment): Update declarations.
7133 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7134 (relro_strip_test_SOURCES): New variable.
7135 (relro_strip_test_DEPENDENCIES): New variable.
7136 (relro_strip_test_LDFLAGS): New variable.
7137 (relro_strip_test_LDADD): New variable.
7138 (relro_strip_test.so): New target.
7140 2010-08-02 Ian Lance Taylor <iant@google.com>
7142 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7143 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7144 (Target_i386::got_tlsdesc_section): New function.
7145 (Target_i386::got_section): Create space for GOT entries for
7146 TLSDESC relocations.
7147 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7149 (Target_i386::Scan::global): Likewise.
7150 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7152 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7153 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7154 (Target_x86_64::got_tlsdesc_section): New function.
7155 (Target_x86_64::got_section): Create space for GOT entries for
7156 TLSDESC relocations.
7157 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7159 (Target_x86_64::Scan::global): Likewise.
7160 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7163 2010-08-02 Ian Lance Taylor <iant@google.com>
7165 * testsuite/final_layout.sh: Use dc to convert from hex to
7168 2010-07-29 Sriraman Tallam <tmsriram@google.com>
7170 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7171 paramter to the call to gold::gc_process_relocs.
7172 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7173 paramter to the call to gold::gc_process_relocs.
7174 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7175 parameter to the call to gold::gc_process_relocs.
7176 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7177 template parameter to the call to gold::gc_process_relocs.
7178 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7179 paramter to the call to gold::gc_process_relocs.
7180 * gc.h (get_embedded_addend_size): New function.
7181 (gc_process_relocs): Save the size of the reloc for use by ICF.
7182 * icf.cc (get_section_contents): Get the addend from the text section
7183 for SHT_REL relocation sections.
7184 * icf.h (Icf::Reloc_addend_size_info): New typedef.
7185 (Icf::Reloc_info): Add new member reloc_addend_size_info.
7186 * int_encoding.h (read_from_pointer): New overloaded function.
7187 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7188 * testsuite/icf_sht_rel_addend_test.sh: New file.
7189 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7190 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7192 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7194 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7195 * Makefile.in: Regenerate.
7196 * testsuite/Makefile.in: Regenerate.
7198 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
7200 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7201 * gold/testsuite/debug_msg.cc: Likewise.
7202 * gold/testsuite/odr_violation1.cc
7203 * gold/testsuite/odr_violation2.cc
7205 2010-07-21 Cary Coutant <ccoutant@google.com>
7207 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7208 string, and length fields.
7209 (Output_merge_string::Merged_strings_list): New type.
7210 (Output_merge_string::Merged_strings_lists): New typedef.
7211 (Output_merge_string): Replace merged_strings_ with
7212 merged_strings_lists_.
7213 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7214 Merged_strings_list per input object and section. Don't store pointer
7215 to the string. Don't store length with each merged string entry.
7216 (Output_merge_string::finalize_merged_data): Loop over list of merged
7217 strings lists. Recompute length of each merged string.
7219 2010-07-15 Cary Coutant <ccoutant@google.com>
7221 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7224 2010-07-14 Ian Lance Taylor <iant@google.com>
7226 * descriptors.cc (Descriptors::open): Report correct name in error
7229 2010-07-13 Doug Kwan <dougkwan@google.com>
7231 * arm.cc (Arm_input_section::Arm_input_section): For a
7232 SHT_ARM_EXIDX section, always keeps the input sections.
7233 (Arm_input_section::set_exidx_section_link): New method.
7234 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7235 has_errors_ to false.
7236 (Arm_exidx_input_section::has_errors,
7237 Arm_exidx_input_section::set_has_errors): New methods.
7238 (Arm_exidx_input_section::has_errors_): New data member.
7239 (Arm_relobj::get_exidx_shndx_list): New method.
7240 (Arm_output_section::append_text_sections_to_list): Do not skip
7241 section without SHF_EXECINSTR.
7242 (Arm_output_section::fix_exidx_coverage): Skip input sections with
7244 (Arm_relobj::make_exidx_input_section): Add new parameter for text
7245 section header. Make error messages more verbose. Check for
7246 a non-executable section linked to an EXIDX section.
7247 (Arm_relobj::do_read_symbols): Remove error checking, which has been
7248 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
7249 check that there is no deferred EXIDX section if we exit early.
7250 Instead of not making an EXIDX section in case of an error, make one
7251 and set the has_errors flag of it.
7252 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7253 in a relocatable link.
7254 (Target_arm::do_relax): Look for the EXIDX output section instead of
7255 assuming that it is called .ARM.exidx.
7256 (Target_arm::fix_exidx_coverage): Add a new parameter for input
7257 section list. Do not check for SHF_EXECINSTR section flags but
7258 skip any input section with errors.
7259 * output.cc (Output_section::Output_section): Initialize
7260 always_keeps_input_sections_ to false.
7261 (Output_section::add_input_section): Check for
7262 always_keeps_input_sections_.
7263 * output.h (Output_section::always_keeps_input_sections,
7264 Output_section::set_always_keeps_input_sections): New methods.
7265 (Output_section::always_keeps_input_sections): New data member.
7267 2010-07-13 Rafael Espindola <espindola@google.com>
7269 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7270 * fileread.h (Input_file): Add try_extra_search_path and find_file.
7272 2010-07-13 Philip Herron <herron.philip@googlemail.com>
7273 Ian Lance Taylor <iant@google.com>
7275 * output.h (Output_section_lookup_maps::add_merge_section):
7276 Correct check of whether value was inserted.
7277 (Output_section_lookup_maps::add_merge_input_section): Likewise.
7278 (Output_section_lookup_maps::add_relaxed_input_section):
7280 * arm.cc (Target_arm::got_section): Remove used local os.
7281 * i386.cc (Target_i386::got_section): Likewise.
7282 * x86_64.cc (Target_x86_64::got_section): Likewise.
7283 * sparc.cc (Target_sparc::got_section): Likewise.
7284 (Target_sparc::relocate): Remove unused local have_got_offset.
7285 * powerpc.cc (Target_powerpc::relocate): Likewise.
7287 2010-07-13 Ian Lance Taylor <iant@google.com>
7289 * compressed_output.cc (zlib_decompress): Fix signature in
7292 * archive.cc (Archive::include_member): Unlock an external member
7293 of a thin archive. Don't bother to delete an object we know is
7296 2010-07-12 Cary Coutant <ccoutant@google.com>
7298 * compressed_output.cc (zlib_decompress): New function.
7299 (get_uncompressed_size): New function.
7300 (decompress_input_section): New function.
7301 * compressed_output.h (get_uncompressed_size): New function.
7302 (decompress_input_section): New function.
7303 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7304 Handle compressed debug sections.
7305 * layout.cc (is_compressed_debug_section): New function.
7306 (Layout::output_section_name): Map compressed section names to
7308 * layout.h (is_compressed_debug_section): New function.
7309 (is_debug_info_section): Recognize compressed debug sections.
7310 * merge.cc: Include compressed_output.h.
7311 (Output_merge_data::do_add_input_section): Handle compressed
7313 (Output_merge_string::do_add_input_section): Handle compressed
7315 * object.cc: Include compressed_output.h.
7316 (Sized_relobj::Sized_relobj): Initialize new data members.
7317 (build_compressed_section_map): New function.
7318 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7319 * object.h (Object::section_is_compressed): New method.
7320 (Object::do_section_is_compressed): New method.
7321 (Sized_relobj::Compressed_section_map): New type.
7322 (Sized_relobj::do_section_is_compressed): New method.
7323 (Sized_relobj::compressed_sections_): New data member.
7324 * output.cc (Output_section::add_input_section): Handle compressed
7326 * reloc.cc: Include compressed_output.h.
7327 (Sized_relobj::write_sections): Handle compressed debug sections.
7329 2010-07-08 Cary Coutant <ccoutant@google.com>
7331 * resolve.cc (Symbol_table::resolve): Remember whether undef was
7332 weak when resolving to a dynamic def.
7333 (Symbol_table::should_override): Add adjust_dyndef flag; set it
7334 for weak undef/dynamic def cases. Adjust callers.
7335 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7336 undef_binding_weak_.
7337 (Symbol_table::sized_write_globals): Adjust symbol binding.
7338 (Symbol_table::sized_write_symbol): Add binding parameter.
7339 * symtab.h (Symbol::set_undef_binding): New method.
7340 (Symbol::is_undef_binding_weak): New method.
7341 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7342 (Symbol_table::should_override): Add new parameter.
7343 (Symbol_table::sized_write_symbol): Add new parameter.
7345 * testsuite/weak_undef_file1.cc: Add new test case.
7346 * testsuite/weak_undef_file2.cc: Fix header comment.
7347 * testsuite/weak_undef_test.cc: Add new test case.
7349 2010-06-29 Doug Kwan <dougkwan@google.com>
7351 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7352 Initialize USE_SYMBOL_.
7353 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7355 (Arm_reloc_property::uses_symbol_): New data member declaration.
7356 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7357 uses symbol value and symbol is undefined but not weakly undefined.
7359 2010-06-28 Rafael Espindola <espindola@google.com>
7361 * plugin.cc (Plugin::load): Use dlerror.
7363 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
7365 * symtab.cc (detect_odr_violations): When reporting an ODR
7366 violation, report an object where the symbol is defined.
7368 2010-06-25 Doug Kwan <dougkwan@google.com>
7370 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7371 (Target_arm::section_may_have_icf_unsafe_pointers): New method
7373 (Target_arm::Scan::local_reloc_may_be_function_pointer,
7374 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7375 target hook to detect function points.
7376 (Target_arm::Scan::possible_function_pointer_reloc): New method.
7377 * icf.h (Icf::check_section_for_function_pointers): Change type of
7378 parameter SECTION_NAME to const reference to std::string. Use
7379 target hook to determine if section may have unsafe pointers.
7380 * target.h (Target::section_may_have_icf_unsafe_pointers): New
7383 2010-06-21 Rafael Espindola <espindola@google.com>
7385 * fileread.cc (Input_file::find_fie): New
7386 (Input_file::open): Use Input_file::find_fie.
7387 * fileread.h (Input_file::find_fie): New
7388 * plugin.cc (set_extra_library_path): New.
7389 (Plugin::load): Add set_extra_library_path to the transfer vector.
7390 (Plugin_manager::set_extra_library_path): New.
7391 (Plugin_manager::add_input_file): Use the extra search path if set.
7392 (set_extra_library_path(): New.
7393 * plugin.h (Plugin_manager): Add set_extra_library_path and
7396 2010-06-19 Cary Coutant <ccoutant@google.com>
7398 * layout.cc (gdb_sections): Add .debug_types.
7399 (lines_only_debug_sections): Likewise.
7401 2010-06-18 Rafael Espindola <espindola@google.com>
7403 * plugin.cc (add_input_file,add_input_library)
7404 (Plugin_manager::add_input_file): Make filename arguments const.
7405 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7408 2010-06-16 Doug Kwan <dougkwan@google.com>
7410 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7411 .ARM.attributes section if we have not merged any input
7412 attributes sections.
7414 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7416 * arm.cc: Allow combining objects with no EABI version
7419 2010-06-15 Rafael Espindola <espindola@google.com>
7421 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7423 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7425 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7426 (struct iovec): Correct !HAVE_READV definition.
7428 2010-06-10 Cary Coutant <ccoutant@google.com>
7430 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7431 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7433 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7436 * symtab.h (Symbol::is_placeholder): New member function.
7437 * target-reloc.h (relocate_section): Check for placeholder symbols.
7439 * testsuite/Makefile.am (plugin_test_8): New test.
7440 (plugin_test_9): New test.
7441 * testsuite/Makefile.in: Regenerate.
7443 2010-06-09 Nick Clifton <nickc@redhat.com>
7445 * yyscript.y (input_list_element): Allow strings prefixed with
7446 the '-' character. Treat these as libraries.
7447 * script.cc (script_add_library): New function. Adds a library
7448 specified by "-l<name>" found in an input script.
7449 * script-c.h: Add prototype for script_add_library.
7451 2010-06-07 Doug Kwan <dougkwan@google.com>
7453 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7454 Restrict stub-group size to be within long conditional branch
7455 range when working around cortex-A8 erratum.
7457 2010-06-07 Damien Diederen <dd@crosstwine.com>
7459 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7462 2010-06-03 Sriraman Tallam <tmsriram@google.com>
7466 (Output_section::Input_section_sort_entry::compare_section_ordering):
7467 Change to return non-zero correctly.
7468 (Output_section::Input_section_sort_section_order_index_compare
7469 ::operator()): Change to fix ambiguity in comparisons.
7471 2010-06-01 Sriraman Tallam <tmsriram@google.com>
7473 * gold.h (is_wildcard_string): New function.
7474 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7475 (Layout::layout_eh_frame): Ditto.
7476 (Layout::find_section_order_index): New method.
7477 (Layout::read_layout_from_file): New method.
7478 * layout.h (Layout::find_section_order_index): New method.
7479 (Layout::read_layout_from_file): New method.
7480 (Layout::input_section_position_): New private member.
7481 (Layout::input_section_glob_): New private member.
7482 * main.cc (main): Call read_layout_from_file here.
7483 * options.h (--section-ordering-file): New option.
7484 * output.cc (Output_section::input_section_order_specified_): New
7486 (Output_section::Output_section): Initialize new member.
7487 (Output_section::add_input_section): Add new parameter.
7488 Keep input sections when --section-ordering-file is used.
7489 (Output_section::set_final_data_size): Sort input sections when
7490 section ordering file is specified.
7491 (Output_section::Input_section_sort_entry): Add new parameter.
7493 (Output_section::Input_section_sort_entry::compare_section_ordering):
7495 (Output_section::Input_section_sort_compare::operator()): Change to
7496 consider section_order_index.
7497 (Output_section::Input_section_sort_init_fini_compare::operator()):
7498 Change to consider section_order_index.
7499 (Output_section::Input_section_sort_section_order_index_compare
7500 ::operator()): New method.
7501 (Output_section::sort_attached_input_sections): Change to sort
7502 according to section order when specified.
7503 (Output_section::add_input_section<32, true>): Add new parameter.
7504 (Output_section::add_input_section<64, true>): Add new parameter.
7505 (Output_section::add_input_section<32, false>): Add new parameter.
7506 (Output_section::add_input_section<64, false>): Add new parameter.
7507 * output.h (Output_section::add_input_section): Add new parameter.
7508 (Output_section::input_section_order_specified): New
7510 (Output_section::set_input_section_order_specified): New method.
7511 (Input_section::Input_section): Initialize section_order_index_.
7512 (Input_section::section_order_index): New method.
7513 (Input_section::set_section_order_index): New method.
7514 (Input_section::section_order_index_): New member.
7515 (Input_section::Input_section_sort_section_order_index_compare): New
7517 (Output_section::input_section_order_specified_): New member.
7518 * script-sections.cc (is_wildcard_string): Delete and move modified
7520 (Output_section_element_input::Output_section_element_input): Modify
7521 call to is_wildcard_string.
7522 (Output_section_element_input::Input_section_pattern
7523 ::Input_section_pattern): Ditto.
7524 (Output_section_element_input::Output_section_element_input): Ditto.
7525 * testsuite/Makefile.am (final_layout): New test case.
7526 * testsuite/Makefile.in: Regenerate.
7527 * testsuite/final_layout.cc: New file.
7528 * testsuite/final_layout.sh: New file.
7530 2010-06-01 Rafael Espindola <espindola@google.com>
7532 * plugin.cc (Plugin::load): Pass the output name to the plugin.
7534 2010-06-01 Rafael Espindola <espindola@google.com>
7536 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7537 visibility of symbols.
7539 2010-05-27 Doug Kwan <dougkwan@google.com>
7541 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7542 from start of output section instead of address for a local symbol
7543 in a merged or relaxed section when doing a relocatable link.
7545 2010-05-26 Rafael Espindola <espindola@google.com>
7548 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7549 adding sections the garbage collector removed.
7550 * gold/testsuite/Makefile.am: Add test.
7551 * gold/testsuite/Makefile.in: Regenerate.
7552 * gold/testsuite/plugin_test_7.sh: New.
7553 * gold/testsuite/plugin_test_7_1.c: New.
7554 * gold/testsuite/plugin_test_7_2.c: New.
7556 2010-05-26 Rafael Espindola <espindola@google.com>
7558 * script-sections.cc (Output_section_definition::set_section_addresses):
7559 Check for --section-start.
7561 2010-05-26 Doug Kwan <dougkwan@google.com>
7563 * arm.cc (Arm_scan_relocatable_relocs): New class.
7564 (Target_arm::relocate_special_relocatable): New method.
7565 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7566 (Arm_relocate_functions::thumb_branch_common): Same.
7567 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7568 instead of Default_scan_relocatable_relocs.
7569 * target-reloc.h (relocate_for_relocatable): Let target handle
7570 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7571 * target.h (Sized_target::relocate_special_relocatable): New method.
7573 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7575 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7577 2010-05-23 Doug Kwan <dougkwan@google.com>
7579 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7581 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7582 with a direct branch, not a conditional branch, to a stub.
7583 * merge.cc (Output_merge_base::record_input_section): New method
7585 (Output_merge_data::do_add_input_section): Record input section if
7586 keeps-input-sections flag is set.
7587 (Output_merge_string::do_add_input_section): Ditto.
7588 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7589 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7591 (Output_merge_base::keeps_input_sections,
7592 Output_merge_base::set_keeps_input_sections,
7593 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7595 (Output_merge_base::Input_sections): New type declaration.
7596 (Output_merge_base::input_sections_begin,
7597 Output_merge_base::input_sections_end,
7598 Output_merge_base::do_set_keeps_input_sections): New method definitions.
7599 (Output_merge_base::bool keeps_input_sections_,
7600 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7601 Output_merge_base::input_sections_): New data members.
7602 (Output_merge_data::do_set_keeps_input_sections): New method
7604 (Output_merge_string::do_set_keeps_input_sections): Ditto.
7605 * output.cc (Output_section::Input_section::relobj): Move method
7606 defintion from class declaration to here and handle merge sections.
7607 (Output_section::Input_section::shndx): Ditto.
7608 (Output_section::Output_section): Remove initializations of removed
7609 data members and initialize new data member LOOKUP_MAPS_.
7610 (Output_section::add_input_section): Set keeps-input-sections flag
7611 for a newly created merge output section as appropriate. Adjust code
7612 to use Output_section_lookup_maps class.
7613 (Output_section::add_relaxed_input_section): Adjst code for lookup
7614 maps code refactoring.
7615 (Output_section::add_merge_input_section): Add a new parameter
7616 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
7617 class. If adding input section to a newly created merge output
7618 section fails, remove the new merge section.
7619 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7620 Adjust code for use of the Output_section_lookup_maps class.
7621 (Output_section::find_merge_section): Ditto.
7622 (Output_section::build_lookup_maps): New method defintion.
7623 (Output_section::find_relaxed_input_section): Adjust code to use
7624 Output_section_lookup_maps class.
7625 (Output_section::get_input_sections): Export merge sections. Adjust
7626 code to use Output_section_lookup_maps class.
7627 (Output_section:::add_script_input_section): Adjust code to use
7628 Output_section_lookup_maps class. Update lookup maps for merge
7630 (Output_section::discard_states): Use Output_section_lookup_maps.
7631 (Output_section::restore_states): Same.
7632 * output.h (Merge_section_properties): Move class defintion out of
7634 (Output_section_lookup_maps): New class.
7635 (Output_section::Input_section::is_merge_section): New method
7637 (Output_section::Input_section::relobj): Move defintion out of class
7638 defintion. Declare method only.
7639 (Output_section::Input_section::shndx): Ditto.
7640 (Output_section::Input_section::output_merge_base): New method defintion.
7641 (Output_section::Input_section::u2_.pomb): New union field.
7642 (Output_section::Merge_section_by_properties_map,
7643 Output_section::Output_section_data_by_input_section_map,
7644 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7646 (Output_section::add_merge_input_section): Add new parameter
7647 KEEPS_INPUT_SECTIONS.
7648 (Output_section::build_lookup_maps): New method declaration.
7649 (Output_section::merge_section_map_,
7650 Output_section::merge_section_by_properties_map_,
7651 Output_section::relaxed_input_section_map_,
7652 Output_section::is_relaxed_input_section_map_valid_): Remove data
7654 (Output_section::lookup_maps_): New data member.
7656 2010-05-21 Doug Kwan <dougkwan@google.com>
7659 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7660 avoid a compilation error.
7662 2010-05-19 Rafael Espindola <espindola@google.com>
7664 * script-sections.cc (Output_section_definition::allocate_to_segment):
7665 Update the phdrs_list even when the output section is NULL.
7666 * testsuite/Makefile.am: Add test.
7667 * testsuite/Makefile.in: Regenerate.
7668 * testsuite/script_test_9.cc: New.
7669 * testsuite/script_test_9.sh: New.
7670 * testsuite/script_test_9.t: New.
7672 2010-05-19 Doug Kwan <dougkwan@google.com>
7674 * arm.cc (Arm_input_section::original_size): New method.
7675 (Arm_input_section::do_addralign): Add a cast.
7676 (Arm_input_section::do_output_offset): Remove static cast.
7677 (Arm_input_section::original_addralign,
7678 Arm_input_section::original_size_): Change type to uint32_t.
7679 (Arm_input_section::init): Add safe casts for section alignment
7681 (Arm_input_section::set_final_data_size): Do not set address and
7682 offset of stub table.
7683 (Arm_output_section::fix_exidx_coverage): Change use of of
7684 Output_section::Simple_input_section to that of
7685 Output_section::Input_section.
7686 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7687 except for the first pass.
7688 * output.cc (Output_section::get_input_sections): Change type of
7689 input_sections to std::list<Input_section>.
7690 (Output_section::add_script_input_section): Rename from
7691 Output_section::add_simple_input_section. Change type of SIS
7692 parameter from Simple_input_section to Input_section.
7693 * output.h (Output_section::Simple_input_section): Remove class.
7694 (Output_section::Input_section): Change class visibility to public.
7695 (Output_section::Input_section::addralign): Use stored alignments
7696 for special input sections if set.
7697 (Output_section::Input_section::set_addralign): New method.
7698 (Output_section::get_input_sections): Change parameter type from
7699 list of Simple_input_section to list of Input_section.
7700 (Output_section::add_script_input_section): Rename from
7701 Output_section::add_simple_input_section. Change first parameter's
7702 type from Simple_input_section to Input_section and remove the
7703 second and third parameters.
7704 * script-sections.cc (Input_section::Input_section_list): Change
7705 type to list of Output_section::Input_section/
7706 (Input_section_info::Input_section_info): Change parameter type of
7707 INPUT_SECTION to Output_section::Input_section.
7708 (Input_section_info::input_section): Change return type.
7709 (Input_section_info::input_section_): Change type to
7710 Output_section::Input_section.
7711 (Output_section_element_input::set_section_addresses): Adjust code
7712 to use Output_section::Input_section instead of
7713 Output_section::Simple_input_section. Adjust code for renaming
7714 of Output_section::add_simple_input_section.
7715 (Orphan_output_section::set_section_addresses): Ditto.
7717 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7719 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7720 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7722 2010-05-18 Rafael Espindola <espindola@google.com>
7724 * options.cc (General_options::finalize): Handle -nostdlib.
7725 * options.h (nostdlib): New option.
7726 * script.cc (script_add_search_dir): Handle -nostdlib.
7728 2010-05-12 Doug Kwan <dougkwan@google.com>
7730 * arm.cc (Target_arm::do_finalize_sections): Create an empty
7731 attributes section only if there no attributes section after merging.
7732 (Target_arm::merge_object_attributes): Move value of
7733 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7734 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7735 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7736 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7737 and arm_attr_merge_7.stdout.
7738 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7739 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7740 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7741 arm_attr_merge_7b.o): New rules.
7742 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7744 * testsuite/Makefile.in: Regenerate.
7745 * testsuite/arm_attr_merge.sh: New file.
7746 * testsuite/arm_attr_merge_[67][ab].s: Same.
7748 2010-05-05 Nick Clifton <nickc@redhat.com>
7750 * po/es.po: Updated Spanish translation.
7752 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
7754 * Makefile.am (install-exec-local): Properly install gold as
7755 default cross linker.
7756 * Makefile.in: Regenerated.
7758 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
7759 Nick Clifton <nickc@redhat.com>
7761 * configure.ac (install_as_default): Define and set to false
7762 unless --enable-gold or --enable-gold=both/gold has been
7764 * configure: Regenerate.
7766 * Makefile.am (install-exec-local): Install the executable as
7767 'ld.gold'. If install_as_default is true then also install it as
7769 * Makefile.in: Regenerated.
7771 2010-04-24 Ian Lance Taylor <iant@google.com>
7773 * layout.cc (Layout::layout_reloc): In relocatable link don't
7774 combine reloc sections for grouped sections.
7776 2010-04-23 Sriraman Tallam <tmsriram@google.com>
7778 * gc.h (gc_process_relocs): Pass information on relocs pointing to
7779 sections that are not ordinary to icf.
7780 * icf.cc (get_section_contents): Handle relocation pointing to section
7781 with no object or shndx information.
7782 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7783 * testsuite/Makefile.in: Regenerate.
7784 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7785 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7787 2010-04-22 Ian Lance Taylor <iant@google.com>
7789 * expression.cc (Expression::Expression_eval_info): Add
7790 result_alignment_pointer field.
7791 (Expression::eval_with_dot): Add result_alignment_pointer
7792 parameter. Change all callers.
7793 (Expression::eval_maybe_dot): Likewise.
7794 (class Binary_expression): Add alignment_pointer parameter to
7795 left_value and right_value. Change all callers.
7796 (BINARY_EXPRESSION): Set result alignment.
7797 (class Trinary_expression): Add alignment_pointer parameter to
7798 arg2_value and arg3_value. Change all callers.
7799 (Trinary_cond::value): Set result alignment.
7800 (Max_expression::value, Min_expression::value): Likewise.
7801 (Align_expression::value): Likewise.
7802 * script-sections.cc (class Sections_element): Add dot_alignment
7803 parameter to set_section_addresses virtual function. Update
7805 (class Output_section_element): Likewise.
7806 (Script_sections::create_segments): Add dot_alignment parameter.
7808 (Script_sections::create_segments_from_phdrs_clause): Likewise.
7809 (Script_sections::set_phdrs_clause_addresses): Likewise.
7810 * script-sections.h: Update declarations.
7811 * script.h: Update declarations.
7812 * output.h (Output_segment::set_minimum_p_align): Don't decrease
7814 * testsuite/script_test_3.t: Set large alignment.
7815 * testsuite/script_test_3.sh: Make sure that at least one LOAD
7816 segment has expected alignment.
7818 2010-04-22 Nick Clifton <nickc@redhat.com>
7820 * po/gold.pot: Updated by the Translation project.
7821 * po/vi.po: Updated Vietnamese translation.
7823 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
7825 * testsuite/Makefile.am (check_PROGRAMS): Add
7826 icf_virtual_function_folding_test.
7827 * testsuite/Makefile.in: Regenerated.
7829 2010-04-15 Andrew Haley <aph@redhat.com>
7831 * options.h (merge_exidx_entries): New option.
7832 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7833 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7834 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7835 (Target_arm::merge_exidx_entries): New function.
7836 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7837 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7838 to Arm_exidx_fixup constructor.
7839 Add new arg, merge_exidx_entries.
7840 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7841 Arm_output_section::fix_exidx_coverage.
7843 2010-04-18 Sriraman Tallam <tmsriram@google.com>
7845 * icf.cc (get_section_contents): Check for preemptible functions.
7846 Ignore addend when appropriate.
7847 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
7849 (add_from_relobj): Check for section folded.
7850 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7851 * symtab.h (should_add_dynsym_entry): Add new parameter.
7852 * target-reloc.h (scan_relocs): Check for section folded.
7853 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7854 Check reloc types for function pointers in shared objects.
7855 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7857 (icf_preemptible_functions_test): New test case.
7858 (icf_string_merge_test): New test case.
7859 * testsuite.Makefile.in: Regenerate.
7860 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7861 bar_glob. Refactor code.
7862 * testsuite/icf_preemptible_functions_test.cc: New file.
7863 * testsuite/icf_preemptible_functions_test.sh: New file.
7864 * testsuite/icf_string_merge_test.cc: New file.
7865 * testsuite/icf_string_merge_test.sh: New file.
7866 * testsuite/icf_virtual_function_folding_test.cc: New file.
7867 * testsuite/icf_virtual_function_folding_test.sh: New file.
7869 2010-04-14 Doug Kwan <dougkwan@google.com>
7871 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7872 for local symbol recounting if we remove a section due to ICF.
7873 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7874 there are no regular objects in input.
7876 2010-04-13 Doug Kwan <dougkwan@google.com>
7878 * arm.cc (Arm_input_section::set_final_data_size): Compute
7879 accurate final data size instead of using current data size.
7881 2010-04-09 Doug Kwan <dougkwan@google.com>
7883 * layout.cc (Layout::choose_output_section): Handle script section
7885 (Layout::make_output_section_for_script): Add section type parameter.
7886 Handle script section types.
7887 * layout.h (Layout::make_output_section_for_script): Add section
7889 * output.cc (Output_section::Output_section): Initialize data member
7891 (Output_section::do_reset_address_and_file_offset): Do not set address
7892 to 0 if section is a NOLOAD section.
7893 * output.h (Output_section::is_noload): New method.
7894 (Output_section::set_is_noload): Ditto.
7895 (Output_section::is_noload_): New data member.
7896 * script-c.h (Script_section_type): New enum type.
7897 (struct Parser_output_section_header): Add new file section_type.
7898 * script-sections.cc (Sections_element::output_section_name): Add
7899 parameter for returning script section type.
7900 (Output_section_definition::output_section_name): Ditto.
7901 (Output_section_definition::section_type)P; New method.
7902 (Output_section_definiton::script_section_type_name): Ditto.
7903 (Output_section_definition::script_section_type_): New data member.
7904 (Output_section_definition::Output_section_definition): Initialize
7905 data member Output_section_definition::script_section_type_.
7906 (Output_section_definition::create_sections): Pass script section type
7907 to Layout::make_output_section_for_script.
7908 (Output_section_definition::output_section_name): Return script
7909 section type to caller.
7910 (Output_section_definition::set_section_address): Do not advance
7911 dot value and load address if section type is NOLOAD. Set address
7912 of NOLOAD sections regardless of section flags.
7913 (Output_section_definition::print): Print section type if it is
7914 not SCRIPT_SECTION_TYPE_NONE.
7915 (Output_section_definition::section_type): New method.
7916 (Output_section_definition::script_section_type_name): Ditto.
7917 (Script_sections::output_section_name): Add new parameter
7918 PSECTION_TYPE for returning script section type. Pass it to
7919 section elements. Handle discard sections.
7920 (Sort_output_sections::operator()): Handle NOLOAD sections.
7921 * script-sections.h (Script_sections::Section_type): New enum type.
7922 (Script_sections::output_section_name): Add a new parameter for
7923 returning script section type.
7924 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7926 * yyscript.y (union): Add new field SECTION_TYPE.
7927 (COPY, DSECT, INFO, NOLOAD): New tokens.
7928 (opt_address_and_section_type): Change type to output_section_header.
7929 (section_type): New non-terminal
7930 (section_header): Handle section type.
7931 (opt_address_and_section_type): Return section type value.
7933 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
7935 * testsuite/plugin_common_test_1.c (foo): Add prototype.
7936 * testsuite/plugin_common_test_2.c (foo): Likewise.
7938 2010-04-08 Doug Kwan <dougkwan@google.com>
7940 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7942 * output.cc (Output_section::add_merge_input_section): Simplify
7943 code and return status of Output_merge_base::add_input_section.
7944 Update merge section map only if Output_merge_base::add_input_section
7947 2010-04-07 Doug Kwan <dougkwan@google.com>
7949 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7950 if section is marked as containing instructions but has no mapping
7952 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7953 correct section index.
7954 (Arm_relobj::find_linked_text_section): Ditto.
7956 2010-04-07 Cary Coutant <ccoutant@google.com>
7958 * archive.cc (include_member): Destroy Read_symbols_data object before
7960 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7961 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7962 (Read_symbols_data::~Read_symbols_data) New destructor.
7963 (Section_relocs::Section_relocs) New constructor.
7964 (Section_relocs::~Section_relocs) New destructor.
7965 (Read_relocs_data::Read_relocs_data) New constructor.
7966 (Read_relocs_data::~Read_relocs_data) New destructor.
7967 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7968 pointers to NULL after deleting.
7970 2010-04-07 Doug Kwan <dougkwan@google.com>
7972 * arm.cc: Replace "endianity" with "endianness" in comments.
7973 (Arm_exidx_cantunwind): Ditto.
7974 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7975 (Arm_relobj::merge_flags_and_attributes): New method.
7976 (Arm_relobj::merge_flags_and_attributes_): New data member.
7977 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7978 (Arm_relobj::scan_sections_for_stubs): Ditto.
7979 (Arm_relobj::do_read_symbols): Check to see if we really want to
7980 merge processor-specific flags and attributes. Exit early if
7981 an object is empty except for section names and the undefined symbol.
7982 (Target_arm::do_finalize_sections): Move check for ELF format to
7983 Arm_relobj::do_read_symbols. Merge processor specific flags and
7984 attributes from a regular object only when we have determined that
7985 it is aapropriate. Do not create an .ARM.attributes section in
7986 output if there is no regular input object.
7987 (Target_arm::merge_processor_specific_flags): Check
7988 --warn-mismatch before printing any error.
7989 (Target_arm::merge_object_attributes): Ditto.
7990 * gold.cc (queue_middle_tasks): Handle the case in which there is
7991 no regular object in input.
7992 * options.cc (General_options::parse_EB): New method.
7993 (General_options::parse_EL): Same.
7994 (General_options::General_options): Initialize endianness_.
7995 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7997 (General_options::Endianness): New enum.
7998 (General_options::endianness): New method.
7999 (General_options::endianness_): New data member.
8000 * parameters.cc (Parameters::set_options): Check target endianness.
8001 (Parameters::set_target_once): Ditto.
8002 (Parameters::check_target_endianness): New method.
8003 (parameters_force_valid_target): If either -EL or -EB is specified,
8004 use it to define endianness of default target.
8005 * parameters.h (Parameters::check_target_endianness): New method
8007 * target.h (class Target): Change "endianity" to "endianness"
8010 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8012 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8013 * configure: Regenerate.
8014 * Makefile.in: Regenerate.
8015 * testsuite/Makefile.in: Regenerate.
8017 2010-04-06 Cary Coutant <ccoutant@google.com>
8020 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8021 prevailing definitions of common symbols.
8022 * testsuite/plugin_test_6.sh: New test case.
8023 * testsuite/plugin_common_test_1.c: New test case.
8024 * testsuite/plugin_common_test_2.c: New test case.
8025 * testsuite/Makefile.am (plugin_test_6): New test case.
8026 * testsuite/Makefile.in: Regenerate.
8028 2010-04-06 Nick Clifton <nickc@redhat.com>
8030 * po/vi.po: New Vietnamese translation.
8032 2010-03-30 Doug Kwan <dougkwan@google.com>
8034 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8036 2010-03-25 Doug Kwan <dougkwan@google.com>
8038 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8039 to avoid a conversion warning on a 32-bit host.
8041 2010-03-24 Ian Lance Taylor <iant@google.com>
8043 * testsuite/script_test_3.t: Add a TLS segment.
8044 * testsuite/Makefile.am (check_PROGRAMS): Add
8045 tls_phdrs_script_test.
8046 (tls_phdrs_script_test_SOURCES): Define.
8047 (tls_phdrs_script_test_DEPENDENCIES): Define.
8048 (tls_phdrs_script_test_LDFLAGS): Define.
8049 (tls_phdrs_script_test_LDADD): Define.
8050 * testsuite/Makefile.in: Rebuild.
8052 2010-03-23 Cary Coutant <ccoutant@google.com>
8054 * fileread.cc (find_or_make_view): Fix comment.
8056 2010-03-23 Ian Lance Taylor <iant@google.com>
8058 * script-sections.cc (class Orphan_section_placement): Define
8059 PLACE_TLS and PLACE_TLS_BSS.
8060 (Orphan_section_placement::Orphan_section_placement): Initialize
8062 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8063 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8064 (tls_script_test_SOURCES): Define.
8065 (tls_script_test_DEPENDENCIES): Define.
8066 (tls_script_test_LDFLAGS): Define.
8067 (tls_script_test_LDADD): Define.
8068 * testsuite/Makefile.in: Rebuild.
8070 2010-03-22 Doug Kwan <dougkwan@google.com>
8072 * arm.cc (Arm_relocate_functions::abs8,
8073 Arm_relocate_functions::abs16): Use correct check for overflow
8074 specified in the ARM ELF specs.
8075 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
8076 target of a BLX instruction specially.
8077 (Reloc_stub::stub_type_for_reloc): Ditto.
8078 (Relocate::relocate): Use symbolic names instead of numeric relocation
8079 codes to report error.
8080 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8082 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8083 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8084 thumb2_blx_out_of_range.stdout
8085 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8086 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8087 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8088 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8089 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8090 thumb2_blx_in_range, thumb2_blx_in_range.o,
8091 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8092 thumb2_blx_out_of_range.o): New rules.
8093 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8094 thumb2_blx_in_range and thumb2_blx_out_of_range.
8095 * testsuite/Makefile.in: Regenerate.
8096 * arm_branch_in_range.sh: Add tests for THUMB BLX.
8097 * testsuite/thumb_blx_in_range.s: New file.
8098 * testsuite/thumb_blx_out_of_range.s: New file.
8100 2010-03-22 Rafael Espindola <espindola@google.com>
8102 * archive.cc (Should_include): Move to archive.h.
8103 (should_include_member): Make it a member of Archive.
8105 (Add_lib_group_symbols): New.
8106 * archive.h: Include options.h.
8107 (Archive_member): Moved from Archive.
8108 (Should_include): Moved from archive.cc.
8110 (Add_lib_group_symbols): New.
8111 * dynobj.cc (do_should_include_member): New.
8112 * dynobj.h (do_should_include_member): New.
8113 * gold.cc (queue_initial_tasks): Update call to queue.
8114 * main.cc (main): Print lib group stats.
8115 * object.cc (do_should_include_member): New.
8116 * object.h: Include archive.h.
8117 (Object::should_include_member): New.
8118 (Object::do_should_include_member): New.
8119 (Sized_relobj::do_should_include_member): New.
8120 * options.cc (General_options::parse_start_lib): New.
8121 (General_options::parse_end_lib): New.
8122 (Input_arguments::add_file): Handle lib groups.
8123 (Input_arguments::start_group): Check we are not in a lib.
8124 (Input_arguments::start_lib): New.
8125 (Input_arguments::end_lib): New.
8126 * options.h (General_options): Add start_lib and end_lib.
8127 (Input_argument::lib_): New.
8128 (Input_argument::lib): New.
8129 (Input_argument::is_lib): New.
8130 (Input_file_lib): New.
8131 (Input_arguments::in_lib_): New.
8132 (Input_arguments::in_lib): New.
8133 (Input_arguments::start_lib): New.
8134 (Input_arguments::end_lib_): New.
8135 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8136 in unused members as preempted.
8137 (Sized_pluginobj::do_should_include_member): New.
8138 * plugin.h (Sized_pluginobj::do_should_include_member): New.
8139 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8141 (Read_symbols::do_whole_lib_group): New.
8142 (Read_symbols::do_lib_group): New.
8143 (Read_symbols::do_read_symbols): Handle lib groups.
8144 (Read_symbols::get_name): Handle lib groups.
8145 * readsyms.h (Read_symbols): Add an archive member pointer.
8146 (Read_symbols::do_whole_lib_group): New.
8147 (Read_symbols::do_lib_group): New.
8148 (Read_symbols::member_): New.
8149 * script.cc (read_input_script): Update call to queue_soon.
8151 2010-03-19 Doug Kwan <dougkwan@google.com>
8153 * arm.cc (Stub_table::Stub_table): Initialize new data members
8154 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8155 (Stub_table::add_reloc_stub): Assign stub offset and update
8156 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8157 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8159 (Stub_table::update_data_size_and_addralign): Use
8160 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8161 instead of going over all reloc stubs.
8162 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8163 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8164 Stringpool_template::offset_ to size of Stringpool_char.
8165 (Stringpool_template::new_key_offset): Remove code to initialize
8166 Stringpool_template::offset_.
8167 * stringpool.h (Stringpool_template::set_no_zero_null): Set
8168 Stringpool_template::offset_ to zero.
8170 2010-03-15 Doug Kwan <dougkwan@google.com>
8172 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8174 (Stringpool_template::new_key_offset): New method.
8175 (Stringpool_template::add_string): Assign offsets when adding new
8177 (Stringpool_template::set_string_offsets): Do not set string offsets
8178 when not optimizing.
8179 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8181 (Chunked_vector::clear): Clear size_.
8182 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8183 (Chunked_vector::size): Return size_.
8184 (Chunked_vector::push_back): Use size_ to find insert position.
8185 (Chunked_vector::size_): New data member.
8186 (Stringpool_template::set_no_zero_null): Assert string set is empty.
8187 (Stringpool_template::new_key_offset): New method declaration.
8188 (Stringpool_template::offset_): New data member.
8190 2010-03-15 Rafael Espindola <espindola@google.com>
8192 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8193 Add_symbols' constructor.
8194 * readsyms.h (Add_symbols): Remove the input_group member.
8196 2010-03-10 Ian Lance Taylor <iant@google.com>
8198 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8199 target to ask whether a reference to a symbol requires a stack
8201 * target.h (Target::is_call_to_non_split): New function.
8202 (Target::do_is_call_to_non_split): Declare virtual function.
8203 * target.cc: Include "symtab.h".
8204 (Target::do_is_call_to_non_split): New function.
8205 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8207 2010-03-10 Cary Coutant <ccoutant@google.com>
8209 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8210 (File_read::open[1]): Remove initial mapping of whole_file_view_.
8211 (File_read::open[2]): Add whole_file_view_ to list of views.
8212 (File_read::make_view): Remove test of whole_file_view_.
8213 (File_read::find_or_make_view): Create whole_file_view_ if
8215 (File_read::clear_views): Replace bool parameter with enum;
8216 adjust all callers. Don't delete views with permanent data;
8217 do delete cached views and views from archives if
8218 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
8219 if clearing the corresponding view.
8220 * fileread.h (File_read::Clear_views_mode): New enum.
8221 (File_read::View::is_permanent_view): New method.
8222 (File_read::clear_views): Replace bool parameter
8223 with enum; adjust all callers.
8224 * options.h (General_options): Change keep_files_mapped option;
8225 add map_whole_files.
8226 * readsyms.cc (Add_symbols::run): Delete sd_ object before
8228 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8231 2010-03-10 David S. Miller <davem@davemloft.net>
8233 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8235 2010-03-09 Sriraman Tallam <tmsriram@google.com>
8237 * icf.cc (get_section_contents): Add '@' marker after processing the
8240 2010-03-08 Doug Kwan <dougkwan@google.com>
8242 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8243 due to a conversion warning.
8244 (Arm_relobj::update_output_local_symbol_count): Check for local
8245 symbol with unset output index.
8247 2010-03-05 Ian Lance Taylor <iant@google.com>
8249 * options.h (class General_options): Add --spare-dynamic-tags.
8250 * output.cc (Output_data_dynamic::set_final_data_size): Implement
8251 --spare-dynamic-tags.
8253 2010-03-05 Ian Lance Taylor <iant@google.com>
8255 * incremental.cc: Include "libiberty.h".
8257 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
8259 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8260 function, is_info_ member.
8261 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8262 (Versions::Versions): Update caller.
8263 (Versions::define_base_version): Likewise.
8264 (Versions::add_def): Likewise.
8266 2010-03-03 Sriraman Tallam <tmsriram@google.com>
8268 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8269 (Scan::possible_function_pointer_reloc): New function.
8270 (Scan::local_reloc_may_be_function_pointer): Change to call
8271 possible_function_pointer_reloc.
8272 (Scan::global_reloc_may_be_function_pointer): Ditto.
8273 * icf.h (Icf::check_section_for_function_pointers): Change to reject
8274 relocations in ".data.rel.ro._ZTV" section.
8275 * testsuite/icf_safe_so_test.sh: Change to pass i386.
8276 * testsuite/icf_safe_so_test.cc: Ditto.
8277 * testsuite/icf_safe_test.cc: Ditto.
8278 * testsuite/icf_safe_test.sh: Ditto.
8280 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8281 Ian Lance Taylor <iant@google.com>
8283 * target-reloc.h (relocate_section): Check the symbol table index
8284 for -1U before setting the local symbol index.
8285 (scan_relocatable_relocs): If copying the relocation, record that
8286 the local symbol is required.
8287 * object.h (Symbol_value::is_output_symtab_index_set): New
8289 (Symbol_value::may_be_discarded_from_output_symtab): New
8291 (Symbol_value::has_output_symtab_entry): New function.
8292 (Symbol_value::needs_output_symtab_entry): Remove.
8293 (Symbol_value::output_symtab_index): Make sure the symbol index is
8295 (Symbol_value::set_output_symtab_index): Make sure the symbol
8296 index is not set. Make sure the new index is valid.
8297 (Symbol_value::set_must_have_output_symtab_entry): New function.
8298 (Symbol_value::has_output_dynsym_entry): New function.
8299 (Symbol_value::set_output_dynsym_index): Make sure the new index
8301 (Sized_relobj::set_must_have_output_symtab_entry): New function.
8302 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8303 local symbol if permitted.
8304 (Sized_relobj::do_finalize_local_symbols): Call
8305 is_output_symtab_index_set rather than needs_output_symtab_entry.
8306 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8307 rather than needs_output_symtab_entry. Call
8308 has_output_dynsym_entry rather than needs_output_dynsym_entry.
8309 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8310 is_output_symtab_index_set rather than needs_output_symtab_entry.
8311 * testsuite/discard_locals_relocatable_test.c: New file.
8312 * testsuite/discard_locals_test.sh: Test -r.
8313 * testsuite/Makefile.am (check_DATA): Add
8314 discard_locals_relocatable_test1.syms,
8315 discard_local_relocatable_test2.syms.
8316 (MOSTLYCLEANFILES): Likewise. Also add
8317 discard_locals_relocatable_test1.lout and
8318 discard_locals_relocatable_test2.out.
8319 (discard_locals_relocatable_test1.syms): New target.
8320 (discard_locals_relocatable_test.o): New target.
8321 (discard_locals_relocatable_test1.out): New target.
8322 (discard_locals_relocatable_test2.syms): New target.
8323 (discard_locals_relocatable_test2.out): New target.
8324 (various): Add missing ../ld-new dependencies.
8325 * testsuite/Makefile.in: Rebuild.
8327 2010-03-03 Nick Clifton <nickc@redhat.com>
8329 * po/fi.po: New Finnish translation.
8331 2010-03-01 Doug Kwan <dougkwan@google.com>
8333 * layout.cc (Layout::Layout): Force section types of .init_array*,
8334 .preinit_array* and .fini_array* sections.
8335 * output.cc (Output_section::Input_section_sort_entry::has_priority):
8336 Fix check of return value of std::string::find.().
8337 (Output_section::Input_section_sort_compare::operator()): Remove
8338 comment about .init_array.
8339 (Output_section::Input_section_sort_init_fini_compare::operator()):
8341 (Output_section::sort_attached_input_sections): Handle .init_array
8342 and .fini_array specially.
8343 * output.h (Output_section::Inut_section_sort_compare): Update
8345 (Output_section::Input_section_sort_init_fini_compare): New struct.
8347 2010-02-26 Doug Kwan <dougkwan@google.com>
8349 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8350 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8351 * testsuite/debug_msg.sh: Avoid matching source line number for
8352 use of global variable undef_int.
8354 2010-02-26 Doug Kwan <dougkwan@google.com>
8356 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8357 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8358 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8359 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8360 * options.cc (General_options::General_options): Initialize member
8362 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8363 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8364 and rm_no_fix_v4bx.stdout
8365 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8366 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8367 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8368 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8369 and arm_no_fix_v4bx.
8370 * Makefile.in: Regenerate.
8371 * testsuite/arm_fix_v4bx.s: New file.
8372 * testsuite/arm_fix_v4bx.sh: Ditto.
8374 2010-02-24 Doug Kwan <dougkwan@google.com>
8376 * arm.cc (Target_arm::got_section): Make the .got section the first
8377 non RELRO section in the data segment.
8378 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8379 suffixes of section names.
8381 2010-02-24 Doug Kwan <dougkwan@google.com>
8383 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8384 flags and attributes merging if an input file is a binary file.
8385 * fileread.cc (Input_file::open): Record format of original file.
8386 * fileread.h (Input_file::Format): New enum type.
8387 (Input_file::Input_file): Initialize data member format_.
8388 (Input_file::format): New method definition.
8389 (Input_file::format_):: New data member.
8391 2010-02-24 Doug Kwan <dougkwan@google.com>
8393 * arm.cc (Arm_output_data_got): New class.
8394 (ARM_TCB_SIZE): New constant
8395 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8396 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8397 If user uses a script with a SECTIONS clause, issue only a warning
8398 for a misplaced EXIDX input section. Otherwise, issue an error.
8399 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8401 (Target_arm::got_mode_index_entry): Handle static linking.
8402 (Target_arm::Scan::local): Ditto.
8403 (Target_arm::Scan::global): Ditto.
8404 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
8405 all incorrectly implemented relocations.
8406 (Target_arm::fix_exidx_coverage): Pass layout to
8407 Arm_output_section::fix_exidx_coverage.
8408 * layout.cc (Layout::section_name_mapping): Remove trailing dots
8409 from ".ARM.exidx." and ".ARM.extab.".
8411 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8413 * arm.cc (Target_arm::do_finalize_sections): Create attribute
8414 section if it does not already exist.
8415 * attributes.cc (Attributes_section_data::Attributes_section_data):
8416 Don't crash if size is zero.
8418 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8419 Ian Lance Taylor <iant@google.com>
8421 * gold.cc (queue_middle_tasks): If no input files were opened,
8423 * workqueue.h (Task_function::Task_function): Assert that there is
8426 2010-02-22 Doug Kwan <dougkwan@google.com>
8428 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8429 * icf.cc (get_section_contents): Cast snprintf arguments to long long
8430 types to avoid warnings due to different uint64_t implementations
8433 2010-02-21 Doug Kwan <dougkwan@google.com>
8435 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8436 handling of the maximum backward branch offset.
8437 (Arm_relocate_functions::thumb_branch_common): Ditto.
8438 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8439 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8440 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8441 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8442 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8443 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8444 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8445 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8446 thumb_bl_out_of_range thumb_bl_out_of_range.o,
8447 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8448 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8449 thumb2_bl_out_of_range.o): New rules.
8450 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8451 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8452 thumb2_bl_out_of_range
8453 * testsuite/Makefile.in: Regenerate.
8454 * testsuite/arm_bl_in_range.s: New file.
8455 * testsuite/arm_bl_out_of_range.s: Ditto.
8456 * testsuite/arm_branch_in_range.sh: Ditto.
8457 * testsuite/arm_branch_range.t: Ditto.
8458 * testsuite/thumb2_branch_range.t: Ditto.
8459 * testsuite/thumb_bl_in_range.s: Ditto.
8460 * testsuite/thumb_bl_out_of_range.s: Ditto.
8461 * testsuite/thumb_branch_range.t: Ditto.
8463 2010-02-20 Sriraman Tallam <tmsriram@google.com>
8465 * gc.h (gc_process_relocs): Change vectors to point to the new list.
8466 Add reloc offset information.
8467 * icf.cc (get_section_contents): Change iterators to point to the new
8468 vectors. Add reloc offset information to the contents.
8469 * icf.h (Icf::Sections_reachable_info): New typedef.
8470 (Icf::Sections_reachable_list): New typedef.
8471 (Icf::Offset_info): New typedef.
8472 (Icf::Reloc_info): New struct typedef.
8473 (Icf::Reloc_info_list): New typedef.
8474 (Icf::symbol_reloc_list): Delete method.
8475 (Icf::addend_reloc_list): Delete method.
8476 (Icf::section_reloc_list): Delete method.
8477 (Icf::reloc_info_list): New method.
8478 (Icf::reloc_info_list_): New member.
8480 2010-02-19 Doug Kwan <dougkwan@google.com>
8482 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8483 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8484 * arm.cc (Arm_relocation_functions): New forward declaration.
8485 (Target_arm::Target_arm): Initialize new data members
8486 got_mod_index_offset_ and tls_base_symbol_defined_.
8487 (Target_arm::Relocate::relocate_tls): New method.
8488 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8489 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8491 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8492 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8493 (Target_arm::got_mod_index_offset_,
8494 Target_arm::tls_base_symbol_defined_): New data members.
8495 (Target_arm::Scan::local, Target::Scan::global,
8496 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8499 2010-02-18 Doug Kwan <dougkwan@google.com>
8501 * arm.cc (Arm_relobj::find_linked_text_section): New method.
8502 (Arm_relobj::make_exidx_input_section): Pass section index of linked
8503 text section as a parameter becuase some broken tools may not set
8504 the link in section header.
8505 (Target_arm::has_got_section): New method.
8506 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8507 without any mapping symbol as data only. Remove warning.
8508 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8509 link in its section header, try to discover the link by inspecting the
8510 REL31 relocation at the beginning of the section.
8511 (Target_arm::Scan::check_non_pic): Report name of offending relocation
8513 (Target_arm::Scan::global): Treat any reference to the symbol
8514 _GLOBAL_OFFSET_TABLE_ as a GOT access.
8516 2010-02-12 Sriraman Tallam <tmsriram@google.com>
8518 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8519 (Scan::global_reloc_may_be_function_pointer): New function.
8520 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8521 (Scan::global_reloc_may_be_function_pointer): New function.
8522 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8523 (Scan::global_reloc_may_be_function_pointer): New function.
8524 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8525 (Scan::global_reloc_may_be_function_pointer): New function.
8526 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8527 (Scan::global_reloc_may_be_function_pointer): New function.
8528 (Scan::possible_function_pointer_reloc): New function.
8529 (Target_x86_64::can_check_for_function_pointers): New function.
8530 * gc.h (gc_process_relocs): Scan relocation types to determine if
8531 function pointers were taken for targets that support it.
8532 * icf.cc (Icf::find_identical_sections): Include functions for
8533 folding in safe ICF whose pointer is not taken.
8534 * icf.h (Secn_fptr_taken_set): New typedef.
8535 (fptr_section_id_): New member.
8536 (section_has_function_pointers): New function.
8537 (set_section_has_function_pointers): New function.
8538 (check_section_for_function_pointers): New function.
8539 * options.h: Fix comment for safe ICF option.
8540 * target.h (can_check_for_function_pointers): New function.
8541 * testsuite/Makefile.am: Add icf_safe_so_test test case.
8542 Modify icf_safe_test for X86-64.
8543 * testsuite/Makefile.in: Regenerate.
8544 * testsuite/icf_safe_so_test.cc: New file.
8545 * testsuite/icf_safe_so_test.sh: New file.
8546 * testsuite/icf_safe_test.cc (kept_func_3): New function.
8547 (main): Change to take pointer to function kept_func_3.
8548 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8549 folding is done correctly for X86-64.
8551 2010-02-12 David S. Miller <davem@davemloft.net>
8553 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8554 is_symbolless parameter.
8555 (Output_reloc<SHT_REL>::is_symbolless): New.
8556 (Output_reloc<SHT_REL>::is_symbolless_): New.
8557 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8558 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8559 (Output_reloc<SHT_RELA>::is_symbolless): New.
8560 (Output_data_reloc::add_global): Handle is_symbolless.
8561 (Output_data_reloc::add_global_relative): Likewise.
8562 (Output_data_reloc::add_local): Likewise.
8563 (Output_data_reloc::add_local_relative): Likewise.
8564 (Output_data_reloc::add_symbolless_global_addend): New.
8565 (Output_data_reloc::add_symbolless_local_addend): New.
8566 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8568 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8569 instead of ->is_relative_
8570 (Output_reloc::write): Likewise.
8571 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8572 (Output_reloc::write_rel): Simplify.
8574 * sparc.cc (Target_sparc::Scan::local): Use
8575 ->add_symbolless_local_addend as needed.
8576 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8577 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
8578 based upon relocation offset.
8580 2010-02-11 Doug Kwan <dougkwan@google.com>
8582 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8583 (Target_arm::Scan::global): Ditto. Also remove a comment before the
8584 beginning of function.
8585 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8586 and MOVT_ABS relocations. Those are non issued in scanning. Fix
8587 parameter is_32bit in calls to should_apply_static_reloc.
8588 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8589 (check_DATA): Add arm_abs_global.stdout.
8590 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8591 arm_abs_global.stdout): New rules.
8592 (MOSTLLYCLEANFILES): Add arm_abs_global
8593 * Makefile.in: Regenerate.
8594 * testsuite/arm_abs_global.s: New file.
8595 * testsuite/arm_abs_global.sh: Ditto.
8596 * testsuite/arm_abs_lib.s: Ditto.
8598 2010-02-11 Ian Lance Taylor <iant@google.com>
8600 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8602 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
8603 Allocate_commons_task first.
8604 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8605 task, rather than symtab_lock_.
8606 (Gc_process_relocs::~Gc_process_relocs): New function.
8607 (Gc_process_relocs::is_runnable): Check this_blocker_.
8608 (Gc_process_relocs::locks): Use next_blocker_ rather than
8610 (Scan_relocs::~Scan_relocs): New function.
8611 (Scan_relocs::is_runnable): Check this_blocker_ rather than
8613 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
8615 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8616 fields. Add this_blocker_ and next_blocker_ fields. Adjust
8617 constructor accordingly.
8618 (class Gc_process_relocs): Likewise.
8619 (class Scan_relocs): Likewise.
8620 * common.h (class Allocate_commons_task): Remove symtab_lock_
8621 field, and corresponding constructor parameter.
8622 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8624 (Allocate_commons_task::locks): Likewise.
8626 2010-02-11 Ian Lance Taylor <iant@google.com>
8628 * gold-threads.h (class Once): Define.
8629 (class Initialize_lock): Rewrite as child of Once.
8630 * gold-threads.cc (class Once_initialize): Define.
8631 (once_pointer_control): New static variable.
8632 (once_pointer, once_arg): New static variables.
8633 (c_run_once): New static function.
8634 (Once::Once, Once::run_once, Once::internal_run): New functions.
8635 (class Initialize_lock_once): Remove.
8636 (initialize_lock_control): Remove.
8637 (initialize_lock_pointer): Remove.
8638 (initialize_lock_once): Remove.
8639 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8640 (Initialize_lock::initialize): Rewrite.
8641 (Initialize_lock::do_run_once): New function.
8642 * archive.cc (Archive::interpret_header): Only clear name if it is
8644 * fileread.cc: Include "gold-threads.h"
8645 (file_counts_lock): New static variable.
8646 (file_counts_initialize_lock): Likewise.
8647 (File_read::release): Only increment counts when using --stats.
8648 Use a lock around the increment.
8649 * parameters.cc (class Set_parameters_target_once): Define.
8650 (set_parameters_target_once): New static variable.
8651 (Parameters::Parameters): Move here from parameters.h.
8652 (Parameters::set_target): Rewrite.
8653 (Parameters::set_target_once): New function.
8654 (Parameters::clear_target): Move here and rewrite.
8655 * parameters.h (class Parameters): Update declarations. Add
8656 set_parameters_target_once_ field.
8657 (Parameters::Parameters): Move to parameters.cc.
8658 (Parameters::clear_target): Likewise.
8659 * readsyms.cc (Read_symbols::do_group): Create a Start_group
8661 (Start_group::~Start_group): New function.
8662 (Start_group::is_runnable): New function.
8663 (Start_group::locks, Start_group::run): New functions.
8664 (Finish_group::run): Change saw_undefined to size_t.
8665 * readsyms.h (class Start_group): Define.
8666 (class Finish_group): Change saw_undefined_ field to size_t.
8667 (Finish_group::Finish_group): Remove saw_undefined and
8668 this_blocker parameters. Change all callers.
8669 (Finish_group::set_saw_undefined): New function.
8670 (Finish_group::set_blocker): New function.
8671 * symtab.h (class Symbol_table): Change saw_undefined to return
8672 size_t. Change saw_undefined_ field to size_t.
8673 * target-select.cc (Set_target_once::do_run_once): New function.
8674 (Target_selector::Target_selector): Initialize set_target_once_
8675 field. Don't initialize lock_ and initialize_lock_ fields.
8676 (Target_selector::instantiate_target): Rewrite.
8677 (Target_selector::set_target): New function.
8678 * target-select.h (class Set_target_once): Define.
8679 (class Target_selector): Update declarations. Make
8680 Set_target_once a friend. Remove lock_ and initialize_lock_
8681 fields. Add set_target_once_ field.
8683 2010-02-10 Ian Lance Taylor <iant@google.com>
8685 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8687 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
8688 (queue_middle_tasks): Add all blockers before queueing any tasks.
8689 (queue_final_tasks): Likewise.
8690 * token.h (Task_token::add_blockers): New function.
8691 * object.h (Input_objects::number_of_relobjs): New function.
8693 2010-02-10 Ian Lance Taylor <iant@google.com>
8695 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8696 shared, not if not position independent.
8697 * x86_64.cc (Relocate::relocate_tls): Likewise.
8698 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8699 (tls_pie_pic_test): New target.
8700 * testsuite/Makefile.in: Rebuild.
8702 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8703 (tls_test_main_pie.o, tls_test_pie.o): New targets.
8704 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8705 * testsuite/Makefile.in: Rebuild.
8707 2010-02-09 David S. Miller <davem@davemloft.net>
8709 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8710 R_SPARC_RELATIVE using ->add_local_relative().
8711 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8713 * output.h (Output_data_dynamic::add_section_size): New method
8714 that takes two Output_data objects.
8715 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8716 entry param. Handle it in initializers.
8717 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8718 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8719 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8721 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8722 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8723 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8724 for dynrel_includes_plt.
8725 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8726 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8727 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8729 (Target_sparc::do_finalize_sections): Update to pass true for
8730 dynrel_includes_plt.
8731 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8732 output before .rela.plt
8733 (Target_powerpc::do_finalize_sections): Update to pass true for
8734 dynrel_includes_plt when 32-bit.
8736 2010-02-08 Doug Kwan <dougkwan@google.com>
8738 * arm.cc (Arm_relobj::simple_input_section_output_address): New
8740 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8741 Arm_relobj::scan_section_for_cortex_a8_stubs,
8742 Arm_relobj::do_relocation_section): Instead of calling
8743 Output_section::output_address, use faster
8744 Arm_relobj::simple_input_section_output_address.
8746 2010-02-08 David S. Miller <davem@davemloft.net>
8748 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8749 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8750 relocation helper function.
8752 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8753 just like R_SPARC_GOT{10,13,22}.
8754 (Target_sparc::Scan::local): Likewise.
8755 (Target_sparc::Relocate:relocate): Likewise.
8757 2010-02-06 Ian Lance Taylor <iant@google.com>
8759 * configure.ac: Rewrite targetobjs duplicate removal code to use
8760 only shell constructs.
8761 * configure: Rebuild.
8763 2010-02-05 Doug Kwan <dougkwan@google.com>
8766 * arm.cc (Arm_relobj::section_is_scannable): New method.
8767 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8768 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8770 2010-02-04 Doug Kwan <dougkwan@google.com>
8773 * arm-reloc-property.cc (cstdio): Include.
8774 * configure.ac (targetobjs): Remove duplicates.
8775 * configure: Regenerate.
8776 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8777 big and little endian version for a given address size.
8779 2010-02-03 Doug Kwan <dougkwan@google.com>
8781 * arm-reloc-property.cc
8782 (Arm_reloc_property_table::reloc_name_in_error_message): New method
8784 * arm-reloc-property.h
8785 (Arm_reloc_property_table::get_implemented_static_reloc_property):
8786 New method definition.
8787 (Arm_reloc_property_table::reloc_name_in_error_message): New method
8789 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8791 (GOT_PREL): Change implemented to Y.
8792 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8793 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8794 (Arm_relocate_functions::movw_abs_nc): Remove method.
8795 (Arm_relocate_functions::movt_abs): Ditto.
8796 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8797 (Arm_relocate_functions::thm_movt_abs): Ditto.
8798 (Arm_relocate_functions::movw_rel_nc): Ditto.
8799 (Arm_relocate_functions::movw_rel): Ditto.
8800 (Arm_relocate_functions::movt_rel): Ditto.
8801 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8802 (Arm_relocate_functions:thm_movw_rel): Ditto.
8803 (Arm_relocate_functions:thm_movt_rel): Ditto.
8804 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8805 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8806 New method definitions.
8807 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8808 (Arm_relocation_functions::arm_grp_ldr): Ditto.
8809 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8810 (Arm_relocation_functions::arm_grp_ldc): Ditto.
8811 (Target_arm::Relocate::relocate): Check for non-static or
8812 unimplemented relocation code and exit early. Change calls to
8813 Target_arm::reloc_uses_thumb_bit and
8814 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8815 instead. Refactor code to handle similar relocations to increase
8816 code sharing. Remove check for unsupported relocation code in switch
8818 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8819 relocation property table to find out size. Change error message to
8820 print out the name of a relocation code instead of the numeric value.
8821 (Target_arm::scan_reloc_for_stub): Use relocation property table
8822 instead of calling Target_arm::reloc_uses_thumb_bit().
8824 2010-02-02 Doug Kwan <dougkwan@google.com>
8826 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8827 types of relaxed input section.
8829 2010-02-02 Doug Kwan <dougkwan@google.com>
8831 * Makefile.am (HFILES): Add arm-reloc-property.h.
8833 (TARGETSOURCES): Add arm-reloc-property.cc
8834 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8835 (libgold_a_SOURCES): $(DEFFILES)
8836 * Makefile.in: Regenerate.
8837 * arm-reloc-property.cc: New file.
8838 * arm-reloc-property.h: New file.
8839 * arm-reloc.def: New file.
8840 * arm.cc: Update comments.
8841 (arm-reloc-property.h): New included header.
8842 (arm_reloc_property_table): New global variable.
8843 (Target_arm::do_select_as_default_target): New method definition.
8844 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8845 arm-reloc-property to targ_extra_obj.
8846 * parameters.cc (set_parameters_target): Call
8847 Target::select_as_default_target().
8848 * target.h (Target::select_as_default_target): New method definition.
8849 (Target::do_select_as_default_target): Same.
8851 2010-02-01 Doug Kwan <dougkwan@google.com>
8853 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8854 first_output_text_section_.
8855 (Arm_exidx_fixup::first_output_text_section): New method definition.
8856 (Arm_exidx_fixup::first_output_text_section_): New data member.
8857 (Arm_exidx_fixup::process_exidx_section): Record the first text
8858 output section seen.
8859 (Arm_output_section::fix_exidx_coverage): Set correct linked section
8860 and entsize in output section header.
8862 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8864 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8865 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8866 (Arm_relocate_functions::thm_alu11): New Method.
8867 (Arm_relocate_functions::thm_pc8): New Method.
8868 (Arm_relocate_functions::thm_pc12): New Method.
8869 (Target_arm::Scan::local): Handle the relocations.
8870 (Target_arm::Scan::global): Likewise.
8871 (Target_arm::Relocate::relocate): Likewise.
8872 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8874 2010-01-29 Doug Kwan <dougkwan@google.com>
8876 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8877 of relocation types as ld.
8879 2010-01-29 Doug Kwan <dougkwan@google.com>
8881 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8883 (Arm_relocate_functions::thumb_branch_common): Ditto.
8884 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8885 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8886 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8887 Arm_relocate_functions::jump24): Remove.
8888 (Target_arm::Relocate::relocate): Adjust code to call
8889 Arm_relocation_functions::arm_branch_common and
8890 Arm_relocation_functions::thumb_branch_common instead of their removed
8891 wrappers. Merge switch-cases together to reduce source code size.
8893 2010-01-29 Doug Kwan <dougkwan@google.com>
8895 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8896 output_local_symbol_count_needs_update_.
8897 (Arm_relobj::output_local_symbol_count_needs_update,
8898 Arm_relobj::set_output_local_symbol_count_needs_update,
8899 Arm_relobj::update_output_local_symbol_count): New methods.
8900 (Arm_relobj::output_local_symbol_count_needs_update_): New data
8902 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8903 of pointed function as in a R_ARM_PREL31 relocation.
8904 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8905 for output local symbol count updating.
8906 (Target_arm::do_relax): Update output local symbol counts in objects
8908 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8910 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8912 * arm.cc: Added support for the ARM relocations:
8913 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8914 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8915 (Arm_relocate_functions::movw_rel_nc): Renamed (was
8917 (Arm_relocate_functions::movw_rel): New method.
8918 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8919 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8921 (Arm_relocate_functions::thm_movw_rel): New method.
8922 (Arm_relocate_functions::thm_movt_rel): Renamed (was
8924 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8926 (Target_arm::Scan::global): Likewise.
8927 (Target_arm::Relocate::relocate): Likewise.
8928 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8931 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8933 * arm.cc: Added support for ARM group relocations.
8934 (Target_arm::reloc_needs_sym_origin): New method.
8935 (Arm_relocate_functions::calc_grp_kn): New method.
8936 (Arm_relocate_functions::calc_grp_residual): New method.
8937 (Arm_relocate_functions::calc_grp_gn): New method.
8938 (Arm_relocate_functions::arm_grp_alu): New Method.
8939 (Arm_relocate_functions::arm_grp_ldr): New Method.
8940 (Arm_relocate_functions::arm_grp_ldrs): New Method.
8941 (Arm_relocate_functions::arm_grp_ldc): New Method.
8942 (Target_arm::Scan::local): Handle the ARM group relocations.
8943 (Target_arm::Scan::global): Likewise.
8944 (Target_arm::Relocate::relocate): Likewise.
8945 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8948 2010-01-26 Doug Kwan <dougkwan@google.com>
8950 * arm.cc (set): Include.
8951 (class Arm_exidx_fixup): Change type of last_input_section_ to const
8953 (Arm_output_section::Text_section_list): New type.
8954 (Arm_output_section::append_text_sections_to_list): New method.
8955 (Arm_output_section::fix_exidx_coverage): Ditto.
8956 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8957 (Arm_relobj::convert_input_section_to_relaxed_section): Use
8958 Relobj::set_section_offset() instead of
8959 Sized_relobj::invalidate_section_offset().
8960 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8961 parameter for section headers. Ignore relocation sections for
8962 unallocated sections and EXIDX sections.
8963 (Target_arm::fix_exidx_coverage): New method.
8964 (Target_arm::output_section_address_less_than): New type.
8965 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8966 linked text section instead of the EXIDX section.
8967 (Arm_output_section::create_stub_group): Add an assertion to check
8968 that this is not an EXIDX output section.
8969 (Arm_output_section::append_text_sections_to_list): New method.
8970 (Arm_output_section::fix_exidx_coverage): Ditto.
8971 (Arm_relobj::scan_sections_for_stubs): Adjust call to
8972 Arm_relobj::section_needs_reloc_stub_scanning.
8973 (Target_arm::do_relax): Fix EXIDX output section coverage in the
8975 (Target_arm::fix_exidx_coverage): New method.
8976 * object.h (Relobj::set_output_section): New method.
8977 (Sized_relobj::invalidate_section_offset): Remove method.
8978 (Sized_relobj::do_invalidate_section_offset): Remove method.
8979 (Sized_relobj::do_set_section_offset): Handle offset value -1.
8981 2010-01-25 Doug Kwan <dougkwan@google.com>
8983 * arm.cc (Arm_exidx_merged_section::do_output_offset):
8984 Fix warning due to signed and unsigned comparison on a 32-bit host.
8986 2010-01-22 Doug Kwan <dougkwan@google.com>
8988 * arm.cc (Target_arm::do_relax): Record an output section for section
8989 offset adjustment it contains any stub table that has changed.
8990 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8991 offsets in an output section if necessary.
8992 * output.cc (Output_section::Output_section): Initialize
8993 section_offsets_need_adjustments_.
8994 (Output_section::add_input_section_for_script): Renamed to
8995 Output_section::add_simple_input_section.
8996 (Output_section::save_states): Add a comment.
8997 (Output_section::discard_states): New method defintion.
8998 (Output_section::adjust_section_offsets): Same.
8999 * output.h (Output_section::add_input_section_for_script): Renamed to
9000 Output_section::add_simple_input_section.
9001 (Output_section::discard_states): New method declaration.
9002 (Output_section::adjust_section_offsets): Same.
9003 (Output_section::section_offsets_need_adjustment,
9004 Output_section::set_section_offsets_need_adjustment): New method
9006 (Output_section::section_offsets_need_adjustment_): New data member.
9007 * script-sections.cc
9008 (Output_section_element_input::set_section_address): Adjust code for
9009 renaming of Output_section::add_input_section_for_script.
9010 (Orphan_output_section::set_section_address): Same.
9012 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9014 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9015 Fix_v4bx enum values .
9016 * gold/options.h (General_options): New option definitions.
9017 (General_options::fix_v4bx): New method.
9018 (General_options::Fix_v4bx): New enum.
9019 * gold/options.cc (General_options::parse_fix_v4bx): New method.
9020 (General_options::parse_fix_v4bx_interworking): New method.
9022 2010-01-22 Doug Kwan <dougkwan@google.com>
9024 * arm.cc (Arm_exidx_fixup): New class.
9026 2010-01-21 Doug Kwan <dougkwan@google.com>
9028 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9030 (Arm_exidx_section_offset_map): New type.
9032 2010-01-21 Doug Kwan <dougkwan@google.com>
9034 * arm.cc (Arm_exidx_input_section): New class.
9035 (Arm_relobj::exidx_input_section_by_link,
9036 Arm_relobj::exidx_input_section_by_shndx,
9037 Arm_relobj::make_exidx_input_section): New methods.
9038 (read_arm_attributes_section): Remove.
9039 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9040 information about them.
9041 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9044 2010-01-20 Doug Kwan <dougkwan@google.com>
9046 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9047 Input_section_specifier to Section_id.
9048 (Target_arm::new_arm_input_section: Adjust code for change of key
9050 (Target_arm::find_arm_input_section): Ditto.
9051 * gc.h (object.h): Include for Section_id nand Section_id_hash.
9052 (Section_id): Remove.
9053 (Garbage_collection::Section_id_hash): Remove.
9054 * icf.h (object.h): Include for Section_id nand Section_id_hash.
9055 (Section_id): Remove.
9056 (Icf::Section_id_hash): Remove.
9057 * object.h (Section_id, Const_section_id, Section_id_hash,
9058 Const_section_id_hash): New type definitions.
9059 * output.cc (Output_section::add_relaxed_input_section): Change to
9060 use Const_section_id instead of Input_section_specifier as key type.
9061 (Output_section::add_merge_input_section): Ditto.
9062 (Output_section::build_relaxation_map): Change to use Section_id
9063 instead of Input_section_specifier as key type.
9064 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9066 (Output_section::convert_input_sections_to_relaxed_sections): Change
9067 to use Const_section_id instead of Input_section_specifier as key type.
9068 (Output_section::find_merge_section): Ditto.
9069 (Output_section::find_relaxed_input_section): Ditto.
9070 * output.h (Input_section_specifier): Remove class.
9071 (Output_section::Output_section_data_by_input_section_map): Change
9072 key type to Const_section_id.
9073 (Output_section::Output_relaxed_input_section_by_input_section_map):
9075 (Output_section::Relaxation_map): Change key type to Section_id.
9077 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9079 * gold/arm.cc: Added support for R_ARM_V4BX relocation
9080 (class Arm_v4bx_stub): New class.
9081 (DEF_STUBS): Updated definition to support v4_veneer_bx.
9082 (Stub_factory::make_arm_v4bx_stub): New method.
9083 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9084 (Stub_table::empty): Handle v4bx stubs.
9085 (Stub_table::add_arm_v4bx_stub): New method.
9086 (Stub_table::find_arm_v4bx_stub): New method.
9087 (Arm_relocate_functions::v4bx): New method.
9088 (Target_arm::fix_v4bx): New method.
9089 (Target_arm::Target_arm): Handle R_ARM_V4BX.
9090 (Stub_table::relocate_stubs): Likewise.
9091 (Stub_table::do_write): Likewise.
9092 (Stub_table::update_data_size_and_addralign): Likewise.
9093 (Stub_table::finalize_stubs): Likewise.
9094 (Target_arm::Scan::local): Likewise.
9095 (Target_arm::Scan::global): Likewise.
9096 (Target_arm::do_finalize_sections): Likewise.
9097 (Target_arm::Relocate::relocate): Likewise.
9098 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9100 (Target_arm::scan_reloc_for_stub): Likewise.
9101 (Target_arm::scan_reloc_section_for_stubs): Likewise.
9103 2010-01-19 Ian Lance Taylor <iant@google.com>
9105 * output.cc (Output_section_headers::do_sized_write): Write large
9106 segment count to sh_info field.
9107 (Output_file_header::do_sized_write): For large segment count,
9108 write PN_XNUM to e_phnum field.
9110 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9112 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9113 (Arm_relocate_functions::thm_jump8): New function.
9114 (Arm_relocate_functions::thm_jump11): New function.
9115 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9117 (Target_arm::Scan::global): Likewise.
9118 (Target_arm::Relocate::relocate): Likewise.
9119 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9122 2010-01-14 Doug Kwan <dougkwan@google.com>
9124 * arm.cc (map, utility): Include headers.
9125 (Target_arm::apply_cortex_a8_workaround): New method.
9126 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9127 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9128 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9129 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9130 the --[no-]fix-cortex-a8 command line options.
9131 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9132 (Target_arm::relocate_stub): Use addend in instruction template.
9133 * options.h (DEFINE_bool): Set the user-set flag.
9134 (General_options): Add --[no-]-fix-cortex options.
9135 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9136 : Update fast look-up map after conversion.
9138 2010-01-14 Sriraman Tallam <tmsriram@google.com>
9140 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9141 in the first pass of do_layout.
9143 2010-01-13 Doug Kwan <dougkwan@google.com>
9145 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9146 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9147 apparent compiler problem of not folding static constant integral
9148 data members of elfcpp::Elf_sizes<32>.
9150 2010-01-13 Doug Kwan <dougkwan@google.com>
9152 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9153 Arm_relobj::section_needs_cortex_a8_stub_scanning,
9154 Arm_relobj::scan_section_for_cortex_a8_erratum,
9155 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9156 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9157 sections to scan for relocation stubs into a new method
9158 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
9159 relocation and Cortex-A8 stub scanning.
9160 (Target_arm::do_relax): Force stubs to be after stubbed sections
9161 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
9162 the beginning of a new relaxation pass. Update a comment.
9163 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9165 2010-01-12 Ian Lance Taylor <iant@google.com>
9167 * target-reloc.h (visibility_error): New inline function.
9168 (relocate_section): Call visibility_error.
9169 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9170 (MOSTLYCLEANFILES): Likewise.
9171 (protected_4_pic.o, protected_3.err): New targets.
9172 * testsuite/protected_4.cc: New file.
9174 2010-01-12 Doug Kwan <dougkwan@google.com>
9176 * arm.cc (Cortex_a8_reloc): New class.
9177 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9178 and cortex_a8_relocs_info_.
9179 (Target_arm::fix_cortex_a8): New method definition.
9180 (Target_arm::Cortex_a8_relocs_info): New type.
9181 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9182 New data member declarations.
9183 (Target_arm::scan_reloc_for_stub): Record information about
9184 relocations for THUMB branches that might be exempted from the
9185 Cortex-A8 workaround.
9186 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9187 at the beginning of a relaxation pass.
9189 2010-01-12 Doug Kwan <dougkwan@google.com>
9191 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9192 (Arm_relobj::Mapping_symbol_position,
9193 Arm_reloj::Mapping_symbol_position_less,
9194 Arm_relobj::Mapping_symbols_info): New types.
9195 (Target_arm::is_mapping_symbol_name): New method definition.
9196 (Arm_relobj::do_count_local_symbols): Save information about mapping
9199 2010-01-11 Doug Kwan <dougkwan@google.com>
9201 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9202 Arm_relocate_functions::thumb32_branch_upper,
9203 Arm_relocate_functions::thumb32_branch_lower,
9204 Arm_relocate_functions::thumb32_cond_branch_offset,
9205 Arm_relocate_functions::thumb32_cond_branch_upper,
9206 Arm_relocate_functions::thumb32_cond_branch_lower,
9207 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9208 branch offset encoding.
9209 (Arm_relocate_functions::thumb_branch_common): Use new branch
9210 offset encoding methods to avoid code duplication.
9211 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9212 (Stub_addend_reader::operator()): Use new branch encoding method
9213 to avoid code duplication.
9215 2010-01-11 Doug Kwan <dougkwan@google.com>
9217 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9218 (Target_arm::do_finalize_sections): Define special EXIDX section
9219 symbols only if referenced.
9220 * gc.h (Garbage_collection::add_reference): New method.
9221 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9224 2010-01-11 Ian Lance Taylor <iant@google.com>
9226 * script.cc (Version_script_info::build_expression_list_lookup):
9227 Change complaing about duplicate wildcard match from error to
9230 * script.cc (class Lazy_demangler): Recreate--revert part of patch
9232 (Version_script_info::Version_script_info): Initialize globs_,
9233 default_version_, default_is_global_, and exact_. Don't
9234 initialize globals_ or locals_.
9235 (Version_script_info::build_lookup_tables): Build local symbols
9237 (Version_script_info::unquote): New function.
9238 (Version_script_info::add_exact_match): New function.
9239 (Version_script_info::build_expression_list_lookup): Remove lookup
9240 parameter. Add is_global parameter. Change all callers. Handle
9241 wildcard pattern specially. Unquote pattern. Call
9243 (Version_script_info::get_name_to_match): New function.
9244 (Version_script_info::get_symbol_version): New function.
9245 (Version_script_info::get_symbol_version_helper): Remove.
9246 (Version_script_info::check_unmatched_names): Call unquote.
9247 * script.h (class Version_script_info): Change get_symbol_version
9248 to be non-inline and add is_global parameter; change all callers.
9249 Rewrite symbol_is_local. Update declarations. Define struct
9250 Version_tree_match, Exact, Globs. Don't define struct Lookup.
9251 Remove globals_ and locals_ members. Add exact_, globs_,
9252 default_version_, is_global_.
9253 (Version_script_info::Glob): Remove pattern, add expression and
9254 is_global. Update constructor. Change all callers.
9255 * dynobj.cc (Versions::finalize): Mark the version symbol as the
9257 (Versions::symbol_section_contents): If a symbol is undefined, or
9258 defined in a dynamic object, set the version index to
9260 * symtab.cc (Symbol_table::add_from_relobj): Don't call
9262 (Symbol_table::add_from_pluginobj): Likewise.
9263 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9265 2010-01-11 Doug Kwan <dougkwan@google.com>
9267 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9268 (incremental_dump_LDADD): Add linking option for libintl.
9269 * Makefile.in: Regenerate.
9271 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
9274 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9276 * testsuite/Makefile.in: Regenerated.
9278 2010-01-10 Doug Kwan <dougkwan@google.com>
9280 * options.h (DEFINE_var): Use parentheses around argument varname__
9281 in macro body to avoid any unintended subsequent substitutions.
9283 2010-01-10 Ian Lance Taylor <iant@google.com>
9285 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9286 candidates before doing symbol resolution.
9288 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9289 ODR candidates if only one is weak.
9291 2010-01-08 Ian Lance Taylor <iant@google.com>
9293 * script.cc (Version_script_info::build_expression_list_lookup):
9294 Don't warn about ambiguous version, just record the ambiguity.
9295 (Version_script_info::get_symbol_version_helper): Give error if
9296 version is ambiguous.
9298 2010-01-08 Doug Kwan <dougkwan@google.com>
9300 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9301 prev_data_size_ and prev_addralign_. Remove initializer for
9302 deleted data member has_been_changed_.
9303 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9304 to determine if the table is empty.
9305 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9307 (Stub_table::add_reloc_stub): Define method in class definition
9308 instead of just declaring it there.
9309 (Stub_table::add_cortex_a8_stub): New method definition.
9310 (Stub_table::update_data_size_and_addralign): Ditto.
9311 (Stub_table::finalize_stubs): Ditto.
9312 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9313 (Stub_table::do_addralign_): Return address alignment in the
9314 (Stub_table::do_reset_address_and_file_offset): Define method in
9315 class definition instead of declaring it there. Set current data
9316 size to be the data size of the previous pass.
9317 (Stub_table::set_final_data_size): Use current data size as the
9319 (Stub_table::relocate_stub): Change parameter type of stub from
9320 Reloc_stub pointer to Stub pointer.
9321 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9322 (Stub_table::Cortex_a8_stub_list): New typedef.
9323 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9324 Stub_table::prev_addralign_): New data member.
9325 (Arm_relobj::Arm_relobj): Initialize data member
9326 section_has_cortex_a8_workaround_.
9327 (Arm_relobj::section_has_cortex_a8_workaround,
9328 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9330 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9332 (Target_arm::relocate_stub): Change parameter type of stub from
9333 Reloc_stub pointer to Stub pointer.
9334 (Insn_template::size, Insn_template::alignment): Handle
9335 THUMB16_SPECIAL_TYPE.
9336 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9337 Stub_table::update_data_size_and_addralign,
9338 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9340 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9341 (Stub_table::do_write): Ditto.
9342 (Target_arm::do_relax): Adjust code for changes in Stub_table.
9344 2010-01-08 Ian Lance Taylor <iant@google.com>
9347 * symtab.h (class Symbol): Remove fields is_target_special_ and
9348 has_plt_offset_. Add field is_defined_in_discarded_section_.
9349 (Symbol::is_defined_in_discarded_section): New function.
9350 (Symbol::set_is_defined_in_discarded_section): New function.
9351 (Symbol::has_plt_offset): Rewrite.
9352 (Symbol::set_plt_offset): Verify that new offset is not -1U.
9353 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9354 Don't initialize is_target_special_ or has_plt_offset_.
9355 Initialize is_defined_in_discarded_section_.
9356 (Symbol_table::add_from_relobj): If appropriate, set
9357 is_defined_in_discarded_section.
9358 * resolve.cc (Symbol::override_base_with_special): Don't test
9359 is_target_special_. Change has_plt_offset_ to has_plt_offset().
9360 * target-reloc.h (relocate_section): Do special handling for
9361 symbols defined in discarded sections for global symbols as well
9364 2010-01-08 Ian Lance Taylor <iant@google.com>
9366 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9367 the SHT_SYMTAB case.
9369 2010-01-08 Ian Lance Taylor <iant@google.com>
9371 * object.cc (Sized_relobj::do_layout): Don't get confused if
9372 layout_eh_frame returns NULL.
9374 2010-01-08 Ian Lance Taylor <iant@google.com>
9377 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9378 dynamic symbol table, use the normal symbol table.
9379 (Sized_dynobj::do_read_symbols): Remove assertion about type of
9382 2010-01-08 Ian Lance Taylor <iant@google.com>
9385 * layout.cc (Layout::include_section): Remove .gnu_debuglink
9388 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
9390 * version.cc (print_version): Change to "Copyright 2010".
9392 2010-01-08 Ian Lance Taylor <iant@google.com>
9396 * i386.cc (class Target_i386): Change return type of plt_section
9398 (class Output_data_plt_i386): Add tls_desc_rel_ field.
9399 (Output_data_plt_i386::Output_data_plt_i386): Initialize
9400 tls_desc_rel_ field.
9401 (Output_data_plt_i386::rel_tls_desc): New function.
9402 (Target_i386::rel_tls_desc_section): New function.
9403 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9404 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9405 R_386_TLS_DESC reloc in rel_tls_desc_section.
9406 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9407 Define struct Tlsdesc_info.
9408 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9409 (Target_x86_64::do_reloc_symbol_index): New function.
9410 (Target_x86_64::add_tlsdesc_info): New function.
9411 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9412 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9414 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
9416 (Output_data_plt_x86_64::rela_tlsdesc): New function.
9417 (Target_x86_64::rela_tlsdesc_section): New function.
9418 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9420 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9421 (Target_x86_64::do_reloc_addend): New function.
9422 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9423 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9424 declarations. Define TARGET_CODE. Add arg field to u1_ union.
9425 (Output_reloc::type): New function.
9426 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9427 (Output_reloc::is_target_specific): New function.
9428 (Output_reloc::target_arg): New function.
9429 (class Output_reloc) [SHT_RELA]: Add four new constructors for
9430 absolute relocs and target specific relocs.
9431 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9432 add_target_specific.
9433 (class Output_data_reloc) [SHT_RELA]: Likewise.
9434 * output.cc (Output_reloc::Output_reloc): Add four new versions
9435 for absolute relocs and target specific relocs.
9436 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9437 (Output_reloc::get_symbol_index): Likewise.
9438 (Output_reloc::local_section_offset): Check that local_sym_index_
9439 is not TARGET_CODE or 0.
9440 (Output_reloc::symbol_value): Likewise.
9441 (Output_reloc::write) [SHT_RELA]: Call target for target specific
9443 * target.h (class Target): Add reloc_symbol_index and reloc_addend
9444 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
9446 * layout.cc (add_target_dynamic_tags): Use output section for
9447 DT_PLTRELSZ and DT_JMPREL.
9449 2010-01-07 Ian Lance Taylor <iant@google.com>
9452 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9454 (class Output_data_reloc_generic): Define.
9455 (class Output_data_reloc_base): Change base class to
9456 Output_data_reloc_generic. Change add() method to call
9457 bump_relative_reloc_count for a relative reloc. Remove
9459 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9461 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9462 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
9464 * layout.h (class Layout): Update declaration.
9466 2010-01-07 Ian Lance Taylor <iant@google.com>
9468 * output.h (class Output_data): Add const version of
9469 output_section and do_output_section.
9470 (class Output_section_data): Add const version of
9472 (class Output_section): Likewise.
9473 * layout.cc (Layout::add_target_dynamic_tags): New function.
9474 * layout.h (class Layout): Update declarations.
9475 * arm.cc (Target_arm::do_finalize_sections): Use
9476 add_target_dynamic_tags.
9477 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9478 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9479 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9480 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9482 2010-01-07 Ian Lance Taylor <iant@google.com>
9485 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9488 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
9489 Ian Lance Taylor <iant@google.com>
9492 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9493 Xindex::read_symtab_xindex.
9495 2010-01-07 Doug Kwan <dougkwan@google.com>
9497 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9498 (Insn_template::thumb16_bcond_insn): New method declaration.
9499 (Insn_template): Fix spelling.
9500 (Stub::thumb16_special): New method declaration.
9501 (Stub::do_write): Define virtual method which was previously pure
9503 (Stub::do_thumb16_special): New method declaration.
9504 (Stub::do_fixed_endian_write): New template member.
9505 (Reloc_stub::do_write): Remove.
9506 (Reloc_stub::do_fixed_endian_write): Remove.
9507 (Cortex_a8_stub): New class definition.
9508 (Stub_factory::make_cortex_a8_stub): New method definition.
9509 (Stub_factory::Stub_factory): Add missing static storage class
9510 qualifier for elf32_arm_stub_a8_veneer_blx.
9512 2010-01-07 Ian Lance Taylor <iant@google.com>
9515 * options.h (class General_options): Add --warn-unresolved-symbols
9516 and --error-unresolved-symbols.
9517 * errors.cc (Errors::undefined_symbol): Implement
9518 --warn-unresolved-symbols.
9520 * options.h (class General_options): Add -z text and -z textoff.
9521 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9523 2010-01-06 Sriraman Tallam <tmsriram@google.com>
9525 * gc.h (Garbage_collection::Cident_section_map): New typedef.
9526 (Garbage_collection::cident_sections): New function.
9527 (Garbage_collection::add_cident_section): New function.
9528 (Garbage_collection::cident_sections_): New member.
9529 (gc_process_relocs): Add references to sections whose names are C
9531 * gold.h (cident_section_start_prefix): New constant.
9532 (cident_section_stop_prefix): New constant.
9533 (is_cident): New function.
9534 * layout.cc (Layout::define_section_symbols): Replace string constants
9535 with the newly defined constants.
9536 * object.cc (Sized_relobj::do_layout): Track sections whose names are
9538 * testsuite/Makefile.am: Add gc_orphan_section_test.
9539 * testsuite/Makefile.in: Regenerate.
9540 * testsuite/gc_orphan_section_test.cc: New file.
9541 * testsuite/gc_orphan_section_test.sh: New file.
9543 2010-01-06 Ian Lance Taylor <iant@google.com>
9546 * options.h (class General_options): Add --warn-shared-textrel.
9547 * layout.cc (Layout::finish_dynamic_section): Implement
9548 --warn-shared-textrel.
9551 * options.h (class General_options): Add --warn-multiple-gp.
9553 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9555 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9556 $(THREADSLIB) and $(LIBDL).
9557 * Makefile.in: Rebuild.
9559 2010-01-06 Ian Lance Taylor <iant@google.com>
9562 * options.cc (General_options::parse_section_start): New function.
9563 (General_options::section_start): New function.
9564 (General_options::General_options): Initialize all members.
9565 * options.h: Include <map>
9566 (class General_options): Add --section-start. Add section_starts_
9568 * layout.cc (Layout::attach_allocated_section_to_segment): If
9569 --section-start was used, set the address of the segment. Remove
9570 local sort_sections.
9571 (Layout::relaxation_loop_body): If the address of the load segment
9572 has been set by --section-start, don't use it.
9573 * output.h (Output_segment::update_flags_for_output_section): New
9575 * output.cc (Output_segment::add_output_section): Call
9576 update_flags_for_output_section.
9578 2010-01-05 Ian Lance Taylor <iant@google.com>
9581 * options.h (class General_options): Add --undefined-version.
9582 * script.cc (struct Version_expression): Add was_matched_by_symbol
9584 (Version_script_info::matched_symbol): New function.
9585 (Version_script_info::get_symbol_version_helper): Call
9587 (Version_script_info::check_unmatched_names): New function.
9588 * script.h (class Version_script_info): Update declarations.
9589 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9591 * options.h (class General_options): Use DEFINE_bool_alias for
9592 allow_multiple_definition.
9593 * resolve.cc (Symbol_table::should_override): Don't test
9594 allow_multiple_definition.
9597 * options.h (class General_options): Add --cref.
9598 * main.cc (main): Print cref table if --cref. Don't close mapfile
9599 until after printing cref table.
9600 * cref.cc: Include "symtab.h".
9601 (class Cref_inputs): Define Cref_table_compare and Cref_table.
9602 (Cref_table_compare::operator()): New function.
9603 (Cref_inputs::gather_cref): New function.
9604 (filecol): New static const.
9605 (Cref_inputs::print_cref): New function.
9606 (Cref::print_cref): New function.
9607 * cref.h: Include <cstdio>.
9608 (class Cref): Update declarations.
9609 * mapfile.h (Mapfile::file): New function.
9610 * object.h (class Object): Define Symbols. Declare virtual
9611 do_get_global_symbols.
9612 (Object::get_global_symbols): New function.
9613 * object.cc (Input_objects::add_object): Pass object to cref_ if
9615 (Input_objects::archive_start): Likewise.
9616 (Input_objects::archive_stop): Likewise.
9617 (Input_objects::print_cref): New function.
9618 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9619 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9621 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9623 * plugin.h (class Sized_pluginobj): Update declarations.
9625 2010-01-05 Ian Lance Taylor <iant@google.com>
9627 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9628 to is_default_version. Rename insdef to insdefault.
9629 (Symbol_table::add_from_relobj): Rename def to is_default_version
9630 and local to is_forced_local.
9631 (Symbol_table::add_from_pluginobj): Likewise.
9632 (Symbol_table::add_from_dynobj): Likewise.
9633 (Symbol_table::define_special_symbol): Rename insdef to
9636 2010-01-04 Ian Lance Taylor <iant@google.com>
9639 * options.h (class General_options): Add
9640 --allow-multiple-definition and -z muldefs.
9641 * resolve.cc (Symbol_table::should_override): Don't warn about a
9642 multiple symbol definition if --allow-multiple-definition or -z
9646 * options.h (class General_options): Add --add-needed and
9647 --copy-dt-needed-entries. Tweak --as-needed help entry.
9648 * object.cc (Input_objects::check_dynamic_dependencies): Give an
9649 error if --copy-dt-needed-entries aka --add-needed is used and
9650 would cause a change in behaviour.
9653 * options.h (class General_options): Add -G as a short version of
9654 --shared. Add no-op options -assert, -g, and -i.
9656 2010-01-04 Sriraman Tallam <tmsriram@google.com>
9658 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9659 check for .text or .gnu.linkonce.t sections.
9660 * icf.cc (Icf::find_identical_sections): Ditto.
9661 Change the detection for mangled function name within the section
9663 * icf.h (is_section_foldable_candidate): New function.
9665 2009-12-30 Ian Lance Taylor <iant@google.com>
9668 * options.h (class General_options): Permit two dashes with
9669 --retain-symbols-file.
9671 2009-12-30 Ian Lance Taylor <iant@google.com>
9674 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9675 don't put the file header and segment headers in the text
9679 * common.cc (Sort_commons::operator()): Stabilize sort when both
9681 (Symbol_table::do_allocate_commons_list): When allocating common
9682 symbols, skip a symbol which is no longer common.
9683 * symtab.h (Symbol::is_common): Test whether the symbol comes from
9684 an object before checking its type.
9685 * testsuite/common_test_2.c: New file.
9686 * testsuite/common_test_3.c: New file.
9687 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9688 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9689 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9690 (common_test_2_pic.o, common_test_2.so): New targets.
9691 (common_test_3_pic.o, common_test_3.so): New targets.
9692 * testsuite/Makefile.in: Rebuild.
9695 * script.cc (read_input_script): If we see a new SECTIONS clause,
9696 and we have added an input section, give an error.
9697 * layout.h (class Layout): Add have_added_input_section function.
9698 Add have_added_input_section_ field.
9699 * layout.cc (Layout::Layout): Initialize
9700 have_added_input_section_.
9701 (Layout::layout): Set have_added_input_section_.
9702 (Layout::layout_eh_frame): Likewise.
9704 2009-12-30 Ian Lance Taylor <iant@google.com>
9707 * options.h (class General_options): Add --sort-common option.
9708 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9709 * common.cc (Sort_common): Add sort_order parameter to
9710 constructor. Add sort_order_ field.
9711 (Sort_commons::operator): Check sort_order_.
9712 (Symbol_table::allocate_commons): Determine the sort order.
9713 (Symbol_table::do_allocate_commons): Add sort_order parameter.
9715 (Symbol_table::do_allocate_commons_list): Likewise.
9717 2009-12-30 Ian Lance Taylor <iant@google.com>
9720 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9721 symbols from this object, don't change the visibility of an
9723 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9725 2009-12-30 Ian Lance Taylor <iant@google.com>
9728 * script.h (class Version_script_info): Define Language enum.
9729 Update declarations. Define Glob, Exact, and Lookup types. Add
9730 new fields globals_, locals_, and is_finalized_.
9731 * script.cc: Various formatting fixes.
9732 (class Parser_closure): Change language_stack_ from a vector of
9733 std::string to one of Version_script_info::Language. Adjust all
9735 (class Lazy_demangler): Remove.
9736 (struct Version_expression): Change language from std::string to
9737 Version_script_info::Language.
9738 (Version_script_info::Version_script_info): New function.
9739 (Version_script_info::~Version_script_info): Don't call clear.
9740 (Version_script_info::finalize): New function.
9741 (Version_script_info::build_lookup_tables): New function.
9742 (Version_script_info::build_expression_list_lookup): New
9744 (Version_script_info::get_symbol_version_helper): Rewrite to use
9746 (Version_script_info::print_expression_list): Adjust to use
9747 Version_script_info::Language.
9748 (script_push_lex_into_version_mode): Check that the version script
9749 has not been finalized.
9750 (version_script_push_lang): Change language string to
9751 Version_script_info::Language.
9752 * options.cc (Command_line::version_script): New function.
9753 * options.h (class General_options): Add finalize_dynamic_list
9754 function. Change version_script from declaration to definition.
9755 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9756 * testsuite/version_script.map: Remove duplicate def of foo.
9757 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9759 * testsuite/Makefile.in: Rebuild.
9761 2009-12-30 Ian Lance Taylor <iant@google.com>
9764 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9765 if the input symbol index is 0, make the output symbol index 0.
9767 2009-12-30 Ian Lance Taylor <iant@google.com>
9770 * options.h (class General_options): Add -x/--discard-all.
9771 * object.cc (Sized_relobj::do_count_local_symbols): Handle
9772 --discard-all. If the local symbol needs a dynamic entry, check
9773 that before handling --discard-locals.
9775 2009-12-30 Ian Lance Taylor <iant@google.com>
9778 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9780 (Output_segment::add_output_section): Don't change the flags if
9784 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9785 GNU hash table if they need a dynamic value. Otherwise, don't add
9786 them if they are defined in a dynamic object or are forced local.
9788 2009-12-29 Ian Lance Taylor <iant@google.com>
9791 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9792 .gnu.hash table for a 32-bit target.
9795 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9796 regular and a dynamic object only needs a dynamic symbol table
9797 entry if it is externally visible.
9800 * i386.cc (class Target_i386): Initialize global_offset_table_ in
9801 constructor. Add global_offset_table_ field.
9802 (Target_i386::got_section): Set global_offset_table_.
9803 (Target_i386::do_finalize_sections): Set global_offset_table_
9805 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9806 in constructor. Add global_offset_table_ field.
9807 (Target_x86_64::got_section): Set global_offset_table_.
9808 (Target_x86_64::do_finalize_sections): Set global_offset_table_
9811 * layout.cc (Layout::Layout): Initialize increase_relro_.
9812 (Layout::get_output_section): Add is_relro, is_last_relro, and
9813 is_first_non_relro parameters. Change all callers.
9814 (Layout::choose_output_section): Likewise.
9815 (Layout::add_output_section_data): Likewise.
9816 (Layout::make_output_section): Likewise.
9817 (Layout::set_segment_offsets): Clear increase_relro when using a
9819 * layout.h (class Layout): Add increase_relro method. Add
9820 increase_relro_ field. Update declarations.
9821 * output.cc (Output_section::Output_section): Initialize
9822 is_last_relro_ and is_first_non_relro_.
9823 (Output_segment::add_output_section): Group relro sections is
9824 do_sort is true. Handle is_last_relro and is_first_non_relro.
9825 (Output_segment::maximum_alignment): Remove relro handling.
9826 (Output_segment::set_section_addresses): Add increase_relro
9827 parameter. Change all callers. Add initial alignment to align
9828 relro sections on separate page. Remove old relro handling.
9829 (Output_segment::set_section_list_addresses): Remove in_relro
9830 parameter. Change all callers.
9831 (Output_segment::set_offset): Add increase parameter. Change all
9832 callers. Remove old relro handling.
9833 * output.h (class Output_section): Add new methods: is_last_relro,
9834 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9835 Add is_last_relro_ and is_first_non_relro_ fields.
9836 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9837 Create separate .got.plt section. Call increase_relro.
9838 * x86_64.cc (Target_x86_64::got_section): Likewise.
9839 * testsuite/relro_script_test.t: Add .got.plt.
9842 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9843 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9844 (Layout::finalize): Call set_dynamic_symbol_size.
9845 (Layout::set_dynamic_symbol_size): New function.
9846 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
9847 set_dynamic_symbol_size.
9850 * output.h (class Output_section): Add is_entsize_zero_ field.
9851 * output.cc (Output_section::Output_section): Initialize
9853 (Output_section::set_entsize): If two different entsizes are
9854 requested, force it to zero.
9855 (Output_section::add_input_section): Set flags for .debug_str
9856 before updating section flags. Set entsize.
9857 (Output_section::update_flags_for_input_section): Set SHF_MERGE
9858 and SHF_STRING if all input sections have those flags.
9860 2009-12-29 Rafael Espindola <espindola@google.com>
9862 * main.cc (main): Fix the sys time reporting.
9863 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9866 2009-12-29 Sriraman Tallam <tmsriram@google.com>
9868 * options.cc (General_options::parse_version): Allow -v to exit
9869 without an error if there is nothing to link.
9871 2009-12-29 Ian Lance Taylor <iant@google.com>
9873 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9874 using a version of gcc before 4.1.
9875 * configure: Rebuild.
9877 2009-12-28 Chris Demetriou <cgd@google.com>
9879 * attributes.cc (Output_attributes_section_data::do_write): Use
9880 std::vector::front rather than std::vector::data.
9882 2009-12-28 Ian Lance Taylor <iant@google.com>
9884 * symtab.h (class Symbol_table): Add enum Defined.
9885 * resolve.cc (Symbol_table::should_override): Add defined
9886 parameter. Change all callers. Test whether object is NULL
9887 before calling a method on it.
9888 (Symbol_table::report_resolve_problem): Add defined parameter.
9890 (Symbol_table::should_override_with_special): Likewise.
9891 * symtab.cc (Symbol_table::define_in_output_data): Add defined
9892 parameter. Change all callers.
9893 (Symbol_table::do_define_in_output_data): Likewise.
9894 (Symbol_table::define_in_output_segment): Likewise.
9895 (Symbol_table::do_define_in_output_segment): Likewise.
9896 (Symbol_table::define_as_constant): Likewise.
9897 (Symbol_table::do_define_as_constant): Likewise.
9898 * script.h (class Symbol_assignment): Add is_defsym parameter to
9899 constructor; change all callers.
9900 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9901 parameter. Change all callers. Add is_defsym_ field.
9902 (class Parser_closure): Add parsing_defsym parameter to
9903 constructor; change all callers. Add parsing_defsym accessor
9904 function. Add parsing_defsym_ field.
9906 2009-12-28 Ian Lance Taylor <iant@google.com>
9908 * gold.cc (queue_middle_tasks): Fix formatting.
9909 * object.cc (Relobj::is_section_name_included): Likewise.
9911 2009-12-23 Ian Lance Taylor <iant@google.com>
9913 * i386.cc (Target_i386::do_calls_non_split): Recognize
9914 -fsplit-stack prologue for a function with a static chain.
9915 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9916 -fsplit-stack prologue when using %r11.
9918 2009-12-21 Sriraman Tallam <tmsriram@google.com>
9920 * options.cc (General_options::parse_version): Make -v continue and do
9921 the link like GNU ld does.
9923 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
9925 * Makefile.am (CCFILES): Add timer.cc.
9926 (HFILES): Add timer.h.
9927 * configure.ac: Check for sysconf and times.
9928 * main.cc: include timer.h.
9929 (main): Use Timer instead of get_run_time.
9932 * workqueue.cc: include timer.h.
9933 (Workqueue::find_and_run_task):
9934 Report user, sys and wall time.
9935 * Makefile.in: Regenerate.
9936 * config.in: Regenerate.
9937 * configure: Regenerate.
9939 2009-12-16 Doug Kwan <dougkwan@google.com>
9941 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9943 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9944 relaxed input sections.
9945 * output.cc (Output_section::find_relaxed_input_section): Change
9946 return type to Output_relaxed_input_section pointer. Adjust code
9947 for new type of relaxed_input_section_map_.
9948 * output.h (Output_section::find_relaxed_input_section): Change
9949 return type to Output_relaxed_input_section pointer.
9950 (Output_section::Output_relaxed_input_section_by_input_section_map):
9952 (Output_section::relaxed_input_section_map_): Change type to
9953 Output_section::Output_relaxed_input_section_by_input_section_map.
9954 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9957 2009-12-15 Ian Lance Taylor <iant@google.com>
9959 * layout.cc (Layout::create_shstrtab): Only write out after input
9960 sections if we are compressing debug sections.
9962 2009-12-15 Ian Lance Taylor <iant@google.com>
9964 * archive.cc (Archive::add_symbols): Only look up a symbol without
9965 a version if there is, in fact, a version.
9967 2009-12-14 Ian Lance Taylor <iant@google.com>
9969 Revert -Wshadow changes, all changes from:
9970 2009-12-11 Doug Kwan <dougkwan@google.com>
9971 2009-12-11 Nick Clifton <nickc@redhat.com>
9972 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9974 2009-12-11 Doug Kwan <dougkwan@google.com>
9976 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9978 * attributes.cc (Object_attribute::size): Ditto.
9979 (Attributes_section_data::size): Ditto.
9980 (Attributes_section_data::Attributes_section_data): Ditto.
9981 (Output_attributes_section_data::do_write): Ditto.
9982 * attributes.h (Object_attribute::set_type): Ditto.
9983 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9985 2009-12-11 Nick Clifton <nickc@redhat.com>
9987 * archive.cc: Fix shadowed variable warnings.
9989 * compressed_output.cc: Likewise.
9990 * compressed_output.h: Likewise.
9991 * configure: Likewise.
9992 * dwarf_reader.cc: Likewise.
9993 * dynobj.cc: Likewise.
9994 * dynobj.h: Likewise.
9995 * ehframe.cc: Likewise.
9996 * ehframe.h: Likewise.
9997 * errors.cc: Likewise.
9998 * expression.cc: Likewise.
9999 * fileread.cc: Likewise.
10000 * fileread.h: Likewise.
10001 * freebsd.h: Likewise.
10002 * i386.cc: Likewise.
10003 * icf.cc: Likewise.
10004 * incremental.h: Likewise.
10005 * layout.cc: Likewise.
10006 * layout.h: Likewise.
10007 * mapfile.cc: Likewise.
10008 * merge.cc: Likewise.
10009 * merge.h: Likewise.
10010 * object.cc: Likewise.
10011 * object.h: Likewise.
10012 * options.h: Likewise.
10013 * output.cc: Likewise.
10014 * output.h: Likewise.
10015 * parameters.cc: Likewise.
10016 * plugin.cc: Likewise.
10017 * powerpc.cc: Likewise.
10018 * reduced_debug_output.cc: Likewise.
10019 * reduced_debug_output.h: Likewise.
10020 * reloc.cc: Likewise.
10021 * reloc.h: Likewise.
10022 * resolve.cc: Likewise.
10023 * script-sections.cc: Likewise.
10024 * script.cc: Likewise.
10025 * script.h: Likewise.
10026 * sparc.cc: Likewise.
10027 * symtab.cc: Likewise.
10028 * symtab.h: Likewise.
10029 * target-select.cc: Likewise.
10030 * target-select.h: Likewise.
10031 * token.h: Likewise.
10032 * workqueue.cc: Likewise.
10033 * workqueue.h: Likewise.
10034 * x86_64.cc: Likewise.
10036 2009-12-10 Doug Kwan <dougkwan@google.com>
10038 * arm.cc (attributes.h): New include.
10039 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10040 (Arm_relobj::~Arm_relobj): Delete object pointed by
10041 attributes_section_data_.
10042 (Arm_relobj::attributes_section_data): New method definition.
10043 (Arm_relobj::attributes_section_data_): New data member declaration.
10044 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10045 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10046 attributes_section_data_.
10047 (Arm_dynobj::attributes_section_data): New method definition.
10048 (Arm_dynobj::attributes_section_data_): New data member declaration.
10049 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
10050 initialization value of may_use_blx_ to false.
10051 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10052 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10053 object attributes to compute results instead of hard-coding.
10054 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10055 Target_arm::get_secondary_compatible_arch,
10056 Target_arm::set_secondary_compatible_arch
10057 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10058 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10059 New method declarations.
10060 (Target_arm::get_aeabi_object_attribute): New method definition.
10061 (Target_arm::attributes_section_data_): New data member declaration.
10062 (read_arm_attributes_section): New template definition.
10063 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10064 (Arm_dynobj::do_read_symbols): Ditto.
10065 (Target_arm::do_finalize_sections): Merge attributes sections from
10066 input. Check for BLX use after attributes section merging.
10067 Fix __exidx_start and __exidx_end visibility. Create an
10068 .ARM.attributes section if necessary.
10069 (Target_arm::get_secondary_compatible_arch,
10070 Target_arm::set_secondary_compatible_arch,
10071 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10072 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10073 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10074 New method definitions.
10076 2009-12-09 Ian Lance Taylor <iant@google.com>
10078 * plugin.cc (Plugin::load): Don't cast from void* to a function
10081 2009-12-09 Ian Lance Taylor <iant@google.com>
10083 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10084 information fields.
10086 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
10088 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10089 Replace two_file_shared_1.so with two_file_shared_2.so.
10090 * testsuite/Makefile.in: Regenerated.
10092 2009-12-08 Doug Kwan <dougkwan@google.com>
10094 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10095 (HFILES): Add attributes.h and int_encoding.h.
10096 * Makefile.in: Regenerate.
10097 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10098 function definitions to int_encoding.cc
10099 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10100 prototypes to int_encoding.h
10101 * reduced_debug_output.cc (int_encoding.h): New include.
10102 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10103 function definitions to int_encoding.cc
10104 (insert_into_vector, read_from_pointer): Move template definitions to
10106 * attributes.cc: New file.
10107 * attributes.h: New file.
10108 * int_encoding.cc: New file.
10109 * int_encoding.h: New file.
10111 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
10114 * incremental-dump.cc (dump_incremental_inputs): New.
10115 (main): Use dump_incremental_inputs.
10117 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
10120 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10121 checking elfcpp::STT_FUNC.
10122 (Target_i386::Relocate::relocate): Likewise.
10123 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10125 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10126 symbols from shared libraries into normal FUNC symbols.
10128 * symtab.h (Symbol): Add is_func and use it.
10130 2009-12-05 Doug Kwan <dougkwan@google.com>
10132 * arm.cc (Target_arm::arm_info): Initialize new fields
10133 attributes_section and attributes_vendor.
10134 * i386.cc (Target_i386::i386_info): Same.
10135 * object.cc (Sized_relobj::do_layout): Skip attribute section.
10136 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10137 fields attributes_section and attributes_vendor.
10138 * sparc.cc (Target_sparc::sparc_info): Same.
10139 * target.h (Target::attributes_section, Target::attributes_vendor,
10140 Target::is_attributes_section, Target::attribute_arg_type,
10141 Target::attributes_order): New method definitions.
10142 (Target::Target_info::attributes_section,
10143 Target::Target_info::attributes_vendor): New fields.
10144 (Target::do_attribute_arg_type, Target::do_attributes_order): New
10145 virtual method definitions.
10146 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10147 attributes_section and attributes_vendor.
10148 * testsuite/testfile.cc (Target_test::test_target_info): Same.
10150 2009-12-05 Doug Kwan <dougkwan@google.com>
10152 * arm.cc: Update comments about interworking and stub generation.
10153 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10154 considered as non-PIC.
10155 (Arm_relocate_functions::base_abs): Fix formatting.
10156 (Arm_relocate_functions::got_prel): Fix comment. Change interface
10157 of function to use GOT entry address instead of offset.
10158 (Target_arm::Scan::global): Issue an error if a symbol would need a
10159 PLT does not get one because it is untyped. Remove code to create
10160 dynamic symbols for relative branches.
10161 (Target_arm::Relocate::relocate: Use 0 instead of false since function
10162 takes unsigned integer instead of boolean.
10164 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
10166 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10167 (two_file_test_LDADD): Likewise.
10168 (common_test_1_LDADD): Likewise.
10169 (exception_test_LDADD) Likewise.
10170 (weak_test_LDADD): Likewise.
10171 (many_sections_test_LDADD): Likewise.
10172 (initpri1_LDADD): Likewise.
10173 (script_test_1_LDADD): Likewise.
10174 (script_test_2_LDADD): Likewise.
10175 (justsyms_LDADD): Likewise.
10176 (binary_test_LDADD): Likewise.
10177 (large_LDADD): Likewise.
10178 * testsuite/Makefile.in: Regenerated.
10180 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
10182 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10183 (Symbol_table::override_with_special): Likewise.
10184 (Symbol_table::add_from_object): Likewise.
10186 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
10188 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10189 Don't set the data_offset twice.
10191 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
10193 * testsuite/Makefile.in: Regenerate.
10195 2009-12-03 Doug Kwan <dougkwan@google.com>
10197 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10198 (Target_arm::do_finalize_sections): Add parameter for symbol table
10199 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
10200 * i386.cc (Target_i386::do_finalize_sections): Add an additional
10201 parameter for symbol table pointer.
10202 * layout.cc (Layout::finalize): Call Target::finalize_sections with
10203 an additional parameter for a pointer to symbol table.
10204 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10205 parameter for a symbol table pointer.
10206 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10207 * target.h (Target::finalize_sections, Target::do_finalize_sections):
10209 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10210 parameter for a symbol table pointer.
10212 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
10214 * incremental.cc (Incremental_inputs_header)
10215 (Incremental_inputs_header_write, Incremental_inputs_entry)
10216 (Incremental_inputs_entry_write): Move ...
10217 * incremental.h (Incremental_inputs_header)
10218 (Incremental_inputs_header_write, Incremental_inputs_entry)
10219 (Incremental_inputs_entry_write): here.
10221 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10223 * incremental.cc (make_sized_incremental_binary): Set the target.
10224 Error if it is incompatible.
10225 * output.h (Output_file): Add filename method.
10227 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10229 * incremental.cc (Incremental_inputs_entry): Remove unused argument
10230 from the get_* methods.
10232 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10234 * incremental-dump.cc (main): Check that the offeset of a script is 0.
10235 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10236 Write 0 for the data_offset of scripts.
10238 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10240 * testsuite/Makefile.am: Add the incremental_test.sh test.
10241 * testsuite/incremental_test.sh: New.
10242 * testsuite/incremental_test_1.c: New.
10243 * testsuite/incremental_test_2.c: New.
10245 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
10247 * incremental-dump.cc (main): Fix typos.
10249 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
10252 * incremental-dump.cc (main): Use llu to print 64 bit values.
10254 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
10255 H.J. Lu <hongjiu.lu@intel.com>
10257 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10259 (incremental_dump_LDADD): Likewise.
10260 * Makefile.in: Regenerated.
10262 2009-11-25 Doug Kwan <dougkwan@google.com>
10266 2009-11-25 Doug Kwan <dougkwan@google.com>
10268 * arm.cc (Target_arm::Target_arm): Move method definition
10269 outside of class definition. Add code to handle
10270 --target1-rel, --target1-abs and --target2= options.
10271 (Target_arm::get_reloc_reloc_type): Change method to be
10272 non-static and const.
10273 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10274 New data member declaration.
10275 (Target_arm::Scan::local, Target_arm::Scan::global,
10276 Target_arm::Relocate::relocate,
10277 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10278 Adjust call to Target_arm::get_real_reloc_type.
10279 (Target_arm::get_real_reloc_type): Use command line options
10280 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10281 * options.h (--target1-rel, --target1-abs, --target2): New
10284 2009-11-25 Doug Kwan <dougkwan@google.com>
10286 * arm.cc (Target_arm::Target_arm): Move method definition outside of
10287 class definition. Add code to handle --target1-rel, --target1-abs
10288 and --target2= options.
10289 (Target_arm::get_reloc_reloc_type): Change method to be non-static
10291 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10292 member declaration.
10293 (Target_arm::Scan::local, Target_arm::Scan::global,
10294 Target_arm::Relocate::relocate,
10295 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10296 call to Target_arm::get_real_reloc_type.
10297 (Target_arm::get_real_reloc_type): Use command line options to
10298 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10299 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10302 2009-11-25 Doug Kwan <dougkwan@google.com>
10304 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10305 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10306 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10308 (Arm_relocate_functions::thm_call): Replace body with a call to
10309 Arm_relocate_functions::thumb_branch_common.
10310 (Arm_relocate_functions::thm_jump24,
10311 Arm_relocate_functions::thm_xpc22): New method definitions.
10312 (Arm_relocate_functions::thumb_branch_common): New method definition.
10313 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10315 (Target_arm::Relocate::relocate): Adjust call to thm_call.
10316 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10318 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10320 * Makefile.am: Build incremental-dump
10321 * Makefile.in: Regenerate.
10322 * incremental-dump.cc: New.
10323 * incremental.cc (Incremental_inputs_header_data,
10324 Incremental_inputs_entry_data): Move to incremental.h
10325 * incremental.h: (Incremental_inputs_header_data,
10326 Incremental_inputs_entry_data): Move from incremental.cc
10328 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10330 * incremental.cc (Incremental_inputs_header,
10331 Incremental_inputs_header_write, Incremental_inputs_entry,
10332 Incremental_inputs_entry_write): Add a typedef with the data type.
10334 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10336 * incremental.cc (Incremental_inputs_header,
10337 Incremental_inputs_header_write, Incremental_inputs_entry,
10338 Incremental_inputs_entry_write): Update comment about which
10339 type has the filed descriptions.
10341 2009-11-15 Doug Kwan <dougkwan@google.com>
10343 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10344 (Arm_relocate_functions::arm_branch_common): Change method defintion
10345 in class definition to a method declaration and update list of formal
10347 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10348 Arm_relocation_functions::jump24): Adjust call to
10349 Arm_relocate_functions::arm_branch_common. Update list of formal
10351 (Arm_relocate_functions::xpc25): New method definition.
10352 (Arm_relocate_functions::arm_branch_common): Move method defintion
10353 out from class definition. Use stubs for mode-switching and extending
10355 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10356 specially. Change code to enable use of stubs in ARM branches.
10358 2009-11-10 Doug Kwan <dougkwan@google.com>
10360 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10361 in method declaration.
10362 (Target_arm::relocate_stub): New method declaration.
10363 (Target_arm::default_target): Change to return a pointer instead of
10365 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10366 Target_arm::default_target.
10367 (Arm_Relobj::do_relocate_sections): Remove options paramater in
10369 (Target_arm::relocate_section): Adjust view.
10370 (Target_arm::relocate_stub): New method definition.
10372 2009-11-10 Doug Kwan <dougkwan@google.com>
10374 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10376 * incremental.cc (open_incremental_binary): Initialized local
10377 variables to avoid warnings.
10378 * object.cc (make_elf_object): Ditto.
10379 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10382 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
10385 * testsuite/plugin_test.c: Include "config.h".
10387 2009-11-09 Doug Kwan <dougkwan@google.com>
10389 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10390 (arm_symbol_value): Remove.
10391 (Arm_relocate_functions::arm_branch_common,
10392 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10393 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10394 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10395 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10396 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10397 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10398 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10399 Arm_relocate_functions::thm_mobw_abs_nc,
10400 Arm_relocate_functions::thm_mov_abs,
10401 Arm_relocate_functions::movw_prel_nc,
10402 Arm_relocate_functions::thm_movt_abs,
10403 Arm_relocate_functions::movt_prel,
10404 Arm_relocate_functions::thm_movw_prel_nc,
10405 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10406 (Target_arm::Relocate::relocate): Only decompose address into two
10407 parts if relocation type uses the thumb-bit and pass the actual
10408 bit instead of a flag indicating that the thumb-bit is used. Adjust
10409 calls to methods in Arm_relocate_functions for this change.
10411 2009-11-08 Ian Lance Taylor <iant@google.com>
10414 * reloc.cc: Instantiate
10415 Sized_relobj::initialize_input_to_output_maps and
10416 Sized_relobj:free_input_to_output_maps.
10418 2009-11-06 Ian Lance Taylor <iant@google.com>
10421 * defstd.cc (in_segment): Set only_if_ref true for "end".
10423 2009-11-06 Doug Kwan <dougkwan@google.com>
10425 * arm.cc (class Reloc_stub): Correct a comment.
10426 (Target_arm::Target_arm): Initialize arm_input_section_map_.
10427 (Target_arm::scan_section_for_stubs): New method declaration.
10428 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10429 Change methods from private to protected.
10430 (Target_arm::do_may_relax): New method definition.
10431 (Target_arm::do_relax, Target_arm::group_sections,
10432 Target_arm::scan_reloc_for_stub,
10433 Target_arm::scan_reloc_section_for_stubs): New method declarations.
10434 (Target_arm::arm_input_section_map_): New data member declaration.
10435 (Target_arm::scan_reloc_for_stub,
10436 Target_arm::scan_reloc_section_for_stubs,
10437 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10438 Target_arm::do_relax): New method definitions.
10440 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
10442 * configure.ac: Check for (struct stat)::st_mtim
10443 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10444 * config.in: Regenerate.
10445 * configure: Regenerate.
10447 2009-11-05 Ian Lance Taylor <iant@google.com>
10450 * output.cc (Output_segment::add_output_section): Add missing
10453 2009-11-04 Ian Lance Taylor <iant@google.com>
10456 * object.h (class Object): Add is_needed and set_is_needed
10457 methods. Add is_needed_ field. Make bool fields into bitfields.
10458 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10459 defined in a dynamic object and referenced by a regular object,
10460 set is_needed for the dynamic object.
10461 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10462 if the file is marked with as_needed and it is not needed.
10464 2009-11-04 Ian Lance Taylor <iant@google.com>
10467 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10468 tags if data is discarded by linker script.
10469 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10470 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10471 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10472 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10474 2009-11-04 Ian Lance Taylor <iant@google.com>
10476 * layout.cc (Layout::get_output_section): Add is_interp and
10477 is_dynamic_linker_section parameters. Change all callers.
10478 (Layout::choose_output_section): Likewise.
10479 (Layout::make_output_section): Likewise.
10480 (Layout::add_output_section_data): Add is_dynamic_linker_section
10481 parameter. Change all callers.
10482 * layout.h (class Layout): Update declarations.
10483 * output.h (class Output_section): Add is_interp, set_is_interp,
10484 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10485 Add is_interp_, is_dynamic_linker_section_ fields. Change
10486 generate_code_fills_at_write_ to a bitfield.
10487 * output.cc (Output_section::Output_sections): Initialize new
10489 (Output_segment::add_output_section): Add do_sort parameter.
10490 Change all callers.
10492 2009-11-03 Ian Lance Taylor <iant@google.com>
10495 * options.h (class General_options): Add --warn-common.
10496 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10497 merging two common symbols.
10498 (Symbol_table::should_override): Handle --warn-common when merging
10499 a common symbol with a defined symbol. Use report_resolve_problem
10500 for multiple definitions.
10501 (Symbol_table::report_resolve_problem): New function.
10502 * symtab.h (class Symbol_table): Declare report_resolve_problem.
10504 2009-11-03 Doug Kwan <dougkwan@google.com>
10506 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10508 (Target_arm::stub_factory): New method definition.
10509 (Target_arm::new_arm_input_section,
10510 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10511 Target_arm::reloc_uses_thumb_bit): New method declarations.
10512 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10513 New type definitions.
10514 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10515 member declarations.
10516 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10517 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10518 New method definitions.
10520 2009-11-03 Ian Lance Taylor <iant@google.com>
10522 * options.h (class General_options): Add --warn_constructors.
10524 2009-11-03 Ian Lance Taylor <iant@google.com>
10527 * defstd.cc (in_section): Add entries for __rel_iplt_start,
10528 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10530 2009-11-03 Ian Lance Taylor <iant@google.com>
10533 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10534 --msgid-bugs-address.
10535 (install-pdf): New target.
10536 (install-data_yes): Look up one directory to find mkinstalldirs.
10538 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
10540 * po/Make-in (.po.gmo): Don't generate .gmo files in source
10543 2009-10-30 Doug Kwan <dougkwan@google.com>
10545 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10547 2009-10-30 Doug Kwan <dougkwan@google.com>
10549 * arm.cc (Stub_addend_reader): New struct template definition
10550 and partial specializations.
10551 (Stub_addend_reader::operator()): New method definition for a
10552 partially specialized template.
10554 2009-10-30 Doug Kwan <dougkwan@google.com>
10556 * arm.cc (Arm_relobj::processor_specific_flags): New method
10558 (Arm_relobj::do_read_symbols): New method declaration.
10559 (Arm_relobj::processor_specific_flags_): New data member declaration.
10560 (Arm_dynobj): New class definition.
10561 (Target_arm::do_finalize_sections): Add input_objects parameter.
10562 (Target_arm::do_adjust_elf_header): New method declaration.
10563 (Target_arm::are_eabi_versions_compatible,
10564 (Target_arm::merge_processor_specific_flags): New method declaration.
10565 (Target_arm::do_make_elf_object): New overloaded method definitions
10567 (Arm_relobj::do_read_symbols): New method definition.
10568 (Arm_dynobj::do_read_symbols): Ditto.
10569 (Target_arm::do_finalize_sections): Add input_objects parameters.
10570 Merge processor-specific flags from all input objects.
10571 (Target_arm::are_eabi_versions_compatible,
10572 Target_arm::merge_processor_specific_flags,
10573 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10574 New method definitions.
10575 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10576 Input_objects pointer type parameter.
10577 * layout.cc (Layout::finalize): Pass input objects to target's.
10578 finalize_sections function.
10579 * output.cc (Output_file_header::do_sized_write): Set ELF file
10580 header's processor-specific flags.
10581 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10582 Input_objects pointer type parameter.
10583 * sparc.cc (Target_sparc::do_finalize_sections): Same.
10584 * target.h (Input_objects): New forward class declaration.
10585 (Target::processor_specific_flags,
10586 Target::are_processor_specific_flags_sect): New method definitions.
10587 (Target::finalize_sections): Add input_objects parameter.
10588 (Target::Target): Initialize processor_specific_flags_ and
10589 are_processor_specific_flags_set_.
10590 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10592 (Target::set_processor_specific_flags): New method definition.
10593 (Target::processor_specific_flags_,
10594 Target::are_processor_specific_flags_set_): New data member
10596 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10597 Input_objects pointer type parameter.
10599 2009-10-30 Doug Kwan <dougkwan@google.com>
10601 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10603 2009-10-28 Ian Lance Taylor <iant@google.com>
10605 * object.h (class Relobj): Drop options parameter from
10606 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10607 do_scan_relocs, do_relocate. Change all callers.
10608 (class Sized_relobj): Drop options parameters from
10609 do_gc_process_relocs, do_scan_relocs, do_relocate,
10610 do_relocate_sections, relocate_sections, emit_relocs_scan,
10611 emit_relocs_scan_reltype. Change all callers.
10612 (struct Relocate_info): Remove options field and all references to
10614 * reloc.h (class Read_relocs): Remove options constructor
10615 parameter and options_ field. Change all callers.
10616 (class Gc_process_relocs, class Scan_relocs): Likewise.
10617 (class Relocate_task): Likewise.
10618 * target-reloc.h (scan_relocs): Remove options parameter. Change
10620 (scan_relocatable_relocs): Likewise.
10621 * target.h (class Sized_target): Remove options parameter from
10622 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
10624 * gc.h (gc_process_relocs): Remove options parameter. Change all
10626 * arm.cc: Update functions to remove options parameters.
10627 * i386.cc: Likewise.
10628 * powerpc.cc: Likewise.
10629 * sparc.cc: Likewise.
10630 * x86_64.cc: Likewise.
10631 * testsuite/testfile.cc: Likewise.
10633 2009-10-28 Doug Kwan <dougkwan@google.com>
10635 * arm.cc (Arm_relobj): New class definition.
10636 (Arm_relobj::scan_sections_for_stubs,
10637 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10638 New method definitions.
10640 2009-10-28 Cary Coutant <ccoutant@google.com>
10642 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10643 (Plugin::cleanup_done_): New member.
10644 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10645 (Plugin_manager::cleanup_done_): Remove.
10646 (Plugin_manager::add_input_file): Edit error message.
10647 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10648 (Plugin_manager::cleanup): Remove use of cleanup_done_.
10650 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
10652 * fileread.cc: (File_read::View::~View): Use the new
10653 data_ownership_ filed.
10654 (File_read::~File_read): Dispose the new whole_file_view_.
10655 (File_read::open): Mmap the whole file if needed.
10656 (File_read::open): Use whole_file_view_ instead of contents_.
10657 (File_read::find_view): Use whole_file_view_ if applicable.
10658 (File_read::do_read): Use whole_file_view_ instead of contents_.
10659 (File_read::make_view): Use whole_file_view_ instead of contents_,
10660 update File_read::View::View call.
10661 (File_read::find_or_make_view): Update File_read::View::View
10663 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10665 (File_read::View::Data_ownership): New enum.
10666 (File_read::View::View): Replace bool mapped_ with Data_ownership
10668 (File_read::View::mapped_): Remove (replaced by data_ownership_).
10669 (File_read::View::data_ownership_): New field.
10670 (File_read::contents_): Remove (replaced by whole_file_view_).
10671 (File_read::whole_file_view_): New field.
10672 * options.h (class General_options): Add --keep-files-mapped.
10674 2009-10-27 Cary Coutant <ccoutant@google.com>
10676 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10677 * testsuite/Makefile.am (plugin_test_5): New test case.
10678 * testsuite/Makefile.in: Regenerate.
10680 2009-10-25 Doug Kwan <dougkwan@google.com>
10682 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10683 from private to protected to allow access by child class.
10684 (Sized_relobj::do_relocate_sections): New method declaration.
10685 (Sized_relobj::relocate_sections): Virtualize.
10686 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10687 Sized_relobj::relocate_sections. Instantiate template explicitly
10688 for different target sizes and endianity.
10690 2009-10-24 Doug Kwan <dougkwan@google.com>
10692 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10693 (Arm_input_section::as_arm_input_section): New method.
10694 (Arm_output_section): New class definition.
10695 (Arm_output_section::create_stub_group,
10696 Arm_output_section::group_sections): New method definitions.
10698 2009-10-22 Doug Kwan <dougkwan@google.com>
10700 * arm.cc (Arm_input_section): New class definition.
10701 (Arm_input_section::init, Arm_input_section:do_write,
10702 Arm_input_section::set_final_data_size,
10703 Arm_input_section::do_reset_address_and_file_offset): New method
10706 2009-10-21 Doug Kwan <dougkwan@google.com>
10708 * arm.cc (Stub_table, Arm_input_section): New forward class
10710 (Stub_table): New class defintion.
10711 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10712 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10713 New method definition.
10715 2009-10-21 Doug Kwan <dougkwan@google.com>
10717 * arm.cc: Update copyright comments.
10718 (Target_arm): New forward class template declaration.
10719 (Arm_address): New type.
10720 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10721 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10722 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10724 (Insn_template): Same.
10725 (DEF_STUBS): New macro.
10726 (Stub_type): New enum type.
10727 (Stub_template): New class definition.
10729 (Reloc_stub): Same.
10730 (Stub_factory): Same.
10731 (Target_arm::Target_arm): Initialize may_use_blx_ and
10732 should_force_pic_veneer_.
10733 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10734 Target_arm::should_force_pic_veneer,
10735 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10736 Target_arm::using_thumb_only, Target_arm:;default_target): New
10738 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10739 New data member declarations.
10740 (Insn_template::size, Insn_template::alignment): New method defintions.
10741 (Stub_template::Stub_template): New method definition.
10742 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10743 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10744 (Stub_factory::Stub_factory): New method definition.
10745 * gold.h (string_hash): New template.
10746 * output.h (Input_section_specifier::hash_value): Use
10748 (Input_section_specifier::string_hash): Remove.
10749 * stringpool.cc (Stringpool_template::string_hash): Use
10752 2009-10-20 Doug Kwan <dougkwan@google.com>
10754 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10755 symbols of relaxed input sections.
10756 * output.h (Output_section::find_relaxed_input_section): Make
10759 2009-10-16 Doug Kwan <dougkwan@google.com>
10761 * dynobj.cc (Versions::Versions): Initialize version_script_.
10762 Only insert base version symbol definition for a shared object
10763 if version script defines any version versions.
10764 (Versions::define_base_version): New method definition.
10765 (Versions::add_def): Check that base version is not needed.
10766 (Versions::add_need): Define base version lazily.
10767 * dynobj.h (Versions::define_base_version): New method declaration.
10768 (Versions::needs_base_version_): New data member declaration.
10769 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10770 (check_DATA): Add no_version_test.stdout.
10771 (libno_version_test.so, no_version_test.o no_version_test.stdout):
10773 * testsuite/Makefile.in: Regenerate.
10774 * testsuite/no_version_test.c: New file.
10775 * testsuite/no_version_test.sh: Ditto.
10777 2009-10-16 Doug Kwan <dougkwan@google.com>
10779 * expression.cc (class Segment_start_expression): New class definition.
10780 (Segment_start_expression::value): New method definition.
10781 (script_exp_function_segment_start): Return a new
10782 Segment_start_expression.
10783 * gold/script-c.h (script_saw_segment_start_expression): New function
10785 * script-sections.cc (Script_sections::Script_sections): Initialize
10786 SAW_SEGMENT_START_EXPRESSION_ to false.
10787 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10788 and -Tbbs options to specify section addresses if given in
10789 command line and no SEGMENT_START expression is seen in a script.
10790 * script-sections.h (Script_sections::saw_segment_start_expression,
10791 Script_sections::set_saw_segment_start_expression): New method
10793 (Script_sections::saw_segment_start_expression_): New data member
10795 * script.cc (script_saw_segment_start_expression): New function.
10796 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10797 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10798 script_test_7.sh and script_test_8.sh.
10799 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10800 script_test_8.stdout.
10801 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10802 (script_test_6, script_test_6.stdout, script_test_7,
10803 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10804 * Makefile.in: Regenerate.
10805 * testsuite/script_test_6.sh: New file.
10806 * testsuite/script_test_6.t: Same.
10807 * testsuite/script_test_7.sh: Same.
10808 * testsuite/script_test_7.t: Same.
10809 * testsuite/script_test_8.sh: Same.
10811 2009-10-16 Doug Kwan <dougkwan@google.com>
10813 * output.cc (Output_segment::set_section_list_address): Cast
10814 expressions to unsigned long long type to avoid format warnings.
10816 2009-10-15 Ian Lance Taylor <iant@google.com>
10818 * script.cc (Script_options::add_symbol_assignment): Always add a
10819 dot assignment to script_sections_.
10820 * script-sections.cc (Script_sections::add_dot_assignment):
10821 Initialize if necessary.
10823 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10824 program headers with no load segment if there is a linker script.
10826 * layout.cc (Layout::set_segment_offsets): Align the file offset
10827 to the segment aligment for -N or -n with no load segment.
10828 * output.cc (Output_segment::add_output_section): Don't crash if
10829 the first section is a TLS section.
10830 (Output_segment::set_section_list_addresses): Print an error
10831 message if the address moves backward in a linker script.
10832 * script-sections.cc
10833 (Output_section_element_input::set_section_addresses): Don't
10834 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10835 (Orphan_output_section::set_section_addresses): Likewise.
10837 2009-10-15 Doug Kwan <dougkwan@google.com>
10839 * layout.cc (Layout::finish_dynamic_section): Generate tags
10840 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10841 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10842 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10844 2009-10-14 Ian Lance Taylor <iant@google.com>
10846 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10848 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10849 data_shdr fields of relinfo.
10850 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10851 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
10852 R_386_TLS_LDO_32, adjust based on section flags.
10853 (Target_i386::Relocate::fix_up_ldo): Remove.
10855 2009-10-13 Ian Lance Taylor <iant@google.com>
10857 Add support for -pie.
10858 * options.h (class General_options): Add -pie and
10860 (General_options::output_is_position_independent): Test -pie.
10861 (General_options::output_is_executable): Return true if not shared
10862 and not relocatable.
10863 (General_options::output_is_pie): Remove.
10864 * options.cc (General_options::finalize): Reject incompatible uses
10866 * gold.cc (queue_middle_tasks): A -pie link is not static.
10867 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10868 * symtab.cc (Symbol::final_value_is_known): Return false if
10869 output_is_position_independent.
10870 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10871 output_is_position_independent.
10872 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10873 output_is_position_independent.
10874 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10875 output_is_position_independent.
10876 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10878 (basic_pie_test.o, basic_pie_test): New targets.
10879 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10880 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10881 (two_file_pie_test): New target.
10882 * testsuite/Makefile.in: Rebuild.
10883 * README: Remove note saying that -pie is not supported.
10885 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
10887 * options.h (class General_options): Add -init and -fini.
10888 * layout.cc (Layout::finish_dynamic_section): Emit
10889 given init and fini functions.
10891 2009-10-13 Sriraman Tallam <tmsriram@google.com>
10893 * gc.h (gc_process_relocs): Check if icf is enabled using new
10895 * gold.cc (queue_initial_tasks): Likewise.
10896 (queue_middle_tasks): Likewise.
10897 * object.cc (do_layout): Likewise.
10898 * symtab.cc (is_section_folded): Likewise.
10899 * main.cc (main): Likewise.
10900 * reloc.cc (Read_relocs::run): Likewise.
10901 (Sized_relobj::do_scan_relocs): Likewise.
10902 * icf.cc (is_function_ctor_or_dtor): New function.
10903 (Icf::find_identical_sections): Check if function is ctor or dtor when
10904 safe icf is chosen.
10905 * options.h (General_options::icf): Change option to be an enum.
10906 (Icf_status): New enum.
10907 (icf_enabled): New method.
10908 (icf_safe_folding): New method.
10909 (set_icf_status): New method.
10910 (icf_status_): New variable.
10911 * (options.cc) (General_options::finalize): Set icf_status_.
10912 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10913 icf_test and icf_keep_unique_test to use the --icf enum flag.
10914 * testsuite/icf_safe_test.sh: New file.
10915 * testsuite/icf_safe_test.cc: New file.
10917 2009-10-12 Sriraman Tallam <tmsriram@google.com>
10919 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10920 includes to gc.h and icf.h.
10921 * arm.cc: Include gc.h.
10922 * gold.cc: Likewise.
10923 * i386.cc: Likewise.
10924 * powerpc.cc: Likewise.
10925 * sparc.cc: Likewise.
10926 * x86_64.cc: Likewise.
10927 * gc.h: Include icf.h.
10929 2009-10-11 Ian Lance Taylor <iant@google.com>
10931 * plugin.cc: Include "gold.h" before other header files.
10933 2009-10-10 Chris Demetriou <cgd@google.com>
10935 * options.h (Input_file_argument::Input_file_type): New enum.
10936 (Input_file_argument::is_lib_): Replace with...
10937 (Input_file_argument::type_): New member.
10938 (Input_file_argument::Input_file_argument): Take Input_file_type
10939 'type' rather than boolean 'is_lib' as second argument.
10940 (Input_file_argument::is_lib): Use type_.
10941 (Input_file_argument::is_searched_file): New function.
10942 (Input_file_argument::may_need_search): Handle is_searched_file.
10943 * options.cc (General_options::parse_library): Support -l:filename.
10944 (General_options::parse_just_symbols): Update for Input_file_argument
10946 (Command_line::process): Likewise.
10947 * archive.cc (Archive::get_file_and_offset): Likewise.
10948 * plugin.cc (Plugin_manager::release_input_file): Likewise.
10949 * script.cc (read_script_file, script_add_file): Likewise.
10950 * fileread.cc (Input_file::Input_file): Likewise.
10951 (Input_file::will_search_for): Handle is_searched_file.
10952 (Input_file::open): Likewise.
10953 * readsyms.cc (Read_symbols::get_name): Likewise.
10954 * testsuite/Makefile.am (searched_file_test): New test.
10955 * testsuite/Makefile.in: Regenerate.
10956 * testsuite/searched_file_test.cc: New file.
10957 * testsuite/searched_file_test_lib.cc: New file.
10959 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10960 Ian Lance Taylor <iant@google.com>
10962 * descriptor.cc: Include <cstdio> and "binary-io.h".
10963 (Descriptors::open): Open the files in binary mode always.
10964 * script.cc (Lex::get_token): Treat \r as whitespace.
10966 2009-10-09 Ian Lance Taylor <iant@google.com>
10968 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10970 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10971 Ian Lance Taylor <iant@google.com>
10973 * configure.ac: Check for readv function also.
10974 * fileread.cc (readv): Define if not HAVE_READV.
10975 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10977 * config.in: Regenerate.
10978 * configure: Regenerate.
10980 2009-10-09 Doug Kwan <dougkwan@google.com>
10982 * layout.cc (Layout::make_output_section): Call target hook to make
10983 ordinary output section.
10984 (Layout::finalize): Adjust parameter list of call the
10985 Target::may_relax().
10986 * layout.h (class Layout::section_list): New method.
10987 * merge.h (Output_merge_base::entsize): Change visibility to public.
10988 (Output_merge_base::is_string, Output_merge_base::do_is_string):
10990 (Output_merge_string::do_is_string): New method.
10991 * object.cc (Sized_relobj::do_setup): renamed from
10992 Sized_relobj::set_up.
10993 * object.h (Sized_relobj::adjust_shndx,
10994 Sized_relobj::initializ_input_to_output_maps,
10995 Sized_relobj::free_input_to_output_maps): Change visibilities to
10997 (Sized_relobj::setup): Virtualize.
10998 (Sized_relobj::do_setup): New method declaration.
10999 (Sized_relobj::invalidate_section_offset,
11000 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11001 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11002 * options.cc (parse_int): New function.
11003 * options.h (parse_int): New declaration.
11004 (DEFINE_int): New macro.
11005 (stub_group_size): New option.
11006 * output.cc (Output_section::Output_section): Initialize memebers
11007 merge_section_map_, merge_section_by_properties_map_,
11008 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11009 (Output_section::add_input_section): Handled deferred code-fill
11010 generation and remove an old comment.
11011 (Output_section::add_relaxed_input_section): New method definition.
11012 (Output_section::add_merge_input_section): Use merge section by
11013 properties map to speed to search. Update merge section maps
11015 (Output_section::build_relaxation_map): New method definition.
11016 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11018 (Output_section::relax_input_section): Renamed to
11019 Output_section::convert_input_sections_to_relaxed_sections and change
11020 interface to take a vector of pointers to relaxed sections.
11021 (Output_section::find_merge_section,
11022 Output_section::find_relaxed_input_section): New method definitions.
11023 (Output_section::is_input_address_mapped,
11024 Output_section::output_offset, Output_section::output_address):
11025 Use output section data maps to speed up searching.
11026 (Output_section::find_starting_output_address): Add comments.
11027 (Output_section::do_write,
11028 Output_section::write_to_postprocessing_buffer): Do code-fill
11029 generation as appropriate.
11030 (Output_section::get_input_sections): Invalidate relaxed input section
11032 (Output_section::restore_states): Adjust type of checkpoint .
11033 Invalidate relaxed input section map.
11034 * output.h (Output_merge_base): New class declaration.
11035 (Input_section_specifier): New class defintion.
11036 (class Output_relaxed_input_section) Change base class to
11037 Output_section_data_build.
11038 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11039 base class initializer.
11040 (Output_section::add_relaxed_input_section): New method declaration.
11041 (Output_section::Input_section): Change visibility to protected.
11042 (Output_section::Input_section::relobj,
11043 Output_section::Input_section::shndx): Handle relaxed input sections.
11044 Output_section::input_sections) Change visibility to protected. Also
11045 define overload to return a non-const pointer.
11046 (Output_section::Merge_section_properties): New class defintion.
11047 (Output_section::Merge_section_by_properties_map,
11048 Output_section::Output_section_data_by_input_section_map,
11049 Output_section::Relaxation_map): New types.
11050 (Output_section::relax_input_section): Rename method to
11051 Output_section::convert_input_sections_to_relaxed_sections and change
11052 interface to take a vector of relaxed section pointers.
11053 (Output_section::find_merge_section,
11054 Output_section::find_relaxed_input_section,
11055 Output_section::build_relaxation_map,
11056 Output_section::convert_input_sections_in_list_to_relaxed_sections):
11057 New method declarations.
11058 (Output_section::merge_section_map_
11059 Output_section::merge_section_by_properties_map_,
11060 Output_section::relaxed_input_section_map_,
11061 Output_section::is_relaxed_input_section_map_valid_,
11062 Output_section::generate_code_fills_at_write_): New data members.
11063 * script-sections.cc
11064 (Output_section_element_input::set_section_addresses): Call
11065 current_data_size and addralign methods of relaxed input sections.
11066 (Orphan_output_section::set_section_addresses): Call current_data_size
11067 and addralign methods of relaxed input sections.
11068 * symtab.cc (Symbol_table::compute_final_value): Extract template
11069 from the body of Symbol_table::sized_finalize_symbol.
11070 (Symbol_table::sized_finalized_symbol): Call
11071 Symbol_table::compute_final_value.
11072 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11073 (Symbol_table::compute_final_value): New templated method declaration.
11074 * target.cc (Target::do_make_output_section): New method defintion.
11075 * target.h (Target::make_output_section): New method declaration.
11076 (Target::relax): Add more parameters for input objects, symbol table
11077 and layout. Adjust call to do_relax.
11078 (Target::do_make_output_section): New method declaration.
11079 (Target::do_relax): Add parameters for input objects, symbol table
11082 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11084 * pread.c: Include stdio.h.
11086 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11088 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11091 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11093 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11094 Change read_shndx type to unsigned int.
11095 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11097 (Sized_dwarf_line_info::read_line_mappings): Likewise.
11098 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11099 Change read_shndx type to unsigned int.
11100 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11102 (Sized_dwarf_line_info::read_line_mappings): Likewise.
11103 * layout.cc (Layout::create_symtab_sections): Cast the result of
11104 local_symcount * symsize to off_t in the gold_assert.
11106 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11108 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11109 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11111 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11112 (Arm_relocate_functions::thm_abs5): New function.
11113 (Arm_relocate_functions::abs12): New function.
11114 (Arm_relocate_functions::abs16): New function.
11115 (Arm_relocate_functions::base_abs): New function.
11116 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11117 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
11118 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11120 (Scan::global): Likewise.
11121 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11122 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11123 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11124 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11127 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11129 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11130 (Arm_relocate_functions::movt_prel): New function.
11131 (Arm_relocate_functions::thm_movw_prel_nc): New function.
11132 (Arm_relocate_functions::thm_movt_prel): New function.
11133 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11134 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11135 (Scan::global, Relocate::relocate): Likewise.
11136 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11138 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
11140 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11141 Incremental_checker.
11142 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11144 (class Incremental_inputs_header): New class.
11145 (Incremental_inputs_header_writer): Edit comment.
11146 (Incremental_inputs_entry): New class.
11147 (Incremental_inputs_entry_writer): Edit comment.
11148 (Sized_incremental_binary::do_find_incremental_inputs_section):
11149 Add *strtab_shndx parameter, fill it.
11150 (Sized_incremental_binary::do_check_inputs): New method.
11151 (Incremental_checker::can_incrementally_link_output_file): Use
11152 Sized_incremental_binary::check_inputs.
11153 (Incremental_inputs::report_command_line): Save command line in
11156 (Incremental_binary::find_incremental_inputs_section): New
11158 (Incremental_binary::do_find_incremental_inputs_section): Add
11159 strtab_shndx parameter.
11160 (Incremental_binary::do_check_inputs): New pure virtual method.
11161 (Sized_incremental_binary::do_check_inputs): Declare.
11162 (Incremental_checker::Incremental_checker): Add incremental_inputs
11163 parameter, use it to initialize incremental_inputs_.
11164 (Incremental_checker::incremental_inputs_): New field.
11165 (Incremental_checker::command_line): New method.
11166 (Incremental_checker::inputs): New method.
11167 (Incremental_checker::command_line_): New field.
11169 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
11171 * incremental.cc: Include <cstdarg> and "target-select.h".
11172 (vexplain_no_incremental): New function.
11173 (explain_no_incremental): New function.
11174 (Incremental_binary::error): New method.
11175 (Sized_incremental_binary::do_find_incremental_inputs_section): New
11177 (make_sized_incremental_binary): New function.
11178 (open_incremental_binary): New function.
11179 (can_incrementally_link_file): Add checks if output is ELF and has
11181 * incremental.h: Include "elfcpp_file.h" and "output.h".
11182 (Incremental_binary): New class.
11183 (Sized_incremental_binary): New class.
11184 (open_incremental_binary): Declare.
11185 * object.cc (is_elf_object): Use
11186 elfcpp::Elf_recognizer::is_elf_file.
11187 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11188 * output.h (Output_file::filesize): New method.
11190 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11192 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11194 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11195 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11197 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11199 (Arm_relocate_functions::movw_abs_nc): New function.
11200 (Arm_relocate_functions::movt_abs): New function.
11201 (Arm_relocate_functions::thm_movw_abs_nc): New function.
11202 (Arm_relocate_functions::thm_movt_abs): New function.
11203 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11204 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11205 (Scan::global): Likewise.
11206 (Relocate::relocate): Likewise.
11207 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11209 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11211 * arm.cc (Arm_relocate_functions::got_prel) New function.
11212 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11213 (Relocate::relocate): Likewise.
11214 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11216 2009-10-06 Ian Lance Taylor <iant@google.com>
11218 * options.h (class General_options): Define
11219 split_stack_adjust_size parameter.
11220 * object.h (class Object): Add uses_split_stack_ and
11221 has_no_split_stack_ fields. Add uses_split_stack and
11222 has_no_split_stack accessor functions. Declare
11223 handle_split_stack_section.
11224 (class Reloc_symbol_changes): Define.
11225 (class Sized_relobj): Define Function_offsets. Declare
11226 split_stack_adjust, split_stack_adjust_reltype, and
11228 * object.cc (Object::handle_split_stack_section): New function.
11229 (Sized_relobj::do_layout): Call handle_split_stack_section.
11230 * dynobj.cc (Sized_dynobj::do_layout): Call
11231 handle_split_stack_section.
11232 * reloc.cc (Sized_relobj::relocate_sections): Call
11233 split_stack_adjust for executable sections in split_stack
11234 objects. Pass reloc_map to relocate_section.
11235 (Sized_relobj::split_stack_adjust): New function.
11236 (Sized_relobj::split_stack_adjust_reltype): New function.
11237 (Sized_relobj::find_functions): New function.
11238 * target-reloc.h: Include "object.h".
11239 (relocate_section): Add reloc_symbol_changes parameter. Change
11241 * target.h (class Target): Add calls_non_split method. Declare
11242 do_calls_non_split virtual method. Declare match_view and
11244 * target.cc: Include "elfcpp.h".
11245 (Target::do_calls_non_split): New function.
11246 (Target::match_view): New function.
11247 (Target::set_view_to_nop): New function.
11248 * gold.cc (queue_middle_tasks): Give an error if mixing
11249 split-stack and non-split-stack objects with -r.
11250 * i386.cc (Target_i386::relocate_section): Add
11251 reloc_symbol_changes parameter.
11252 (Target_i386::do_calls_non_split): New function.
11253 * x86_64.cc (Target_x86_64::relocate_section): Add
11254 reloc_symbol_changes parameter.
11255 (Target_x86_64::do_calls_non_split): New function.
11256 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11258 * powerpc.cc (Target_powerpc::relocate_section): Add
11259 reloc_symbol_changes parameter.
11260 * sparc.cc (Target_sparc::relocate_section): Add
11261 reloc_symbol_changes parameter.
11262 * configure.ac: Call AM_CONDITIONAL for the default target.
11263 * configure: Rebuild.
11264 * testsuite/Makefile.am (TEST_AS): New variable.
11265 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11266 (check_DATA): Add split_i386 and split_x86_64 files.
11267 (SPLIT_DEFSYMS): Define.
11268 (split_i386_[1234n].o): New targets.
11269 (split_i386_[124]): New targets.
11270 (split_i386_[1234r].stdout): New targets.
11271 (split_x86_64_[1234n].o): New targets.
11272 (split_x86_64_[124]): New targets.
11273 (split_x86_64_[1234r].stdout): New targets.
11274 (MOSTLYCLEANFILES): Add new executables.
11275 * testsuite/split_i386.sh: New file.
11276 * testsuite/split_x86_64.sh: New file.
11277 * testsuite/split_i386_1.s: New file.
11278 * testsuite/split_i386_2.s: New file.
11279 * testsuite/split_i386_3.s: New file.
11280 * testsuite/split_i386_4.s: New file.
11281 * testsuite/split_i386_n.s: New file.
11282 * testsuite/split_x86_64_1.s: New file.
11283 * testsuite/split_x86_64_2.s: New file.
11284 * testsuite/split_x86_64_3.s: New file.
11285 * testsuite/split_x86_64_4.s: New file.
11286 * testsuite/split_x86_64_n.s: New file.
11287 * testsuite/testfile.cc (Target_test): Update relocation_section
11289 * testsuite/Makefile.in: Rebuild.
11291 2009-10-06 Ian Lance Taylor <iant@google.com>
11293 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11294 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11295 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
11296 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11297 the address on ldo_addrs_.
11298 (Target_i386::Relocate::fix_up_ldo): New function.
11300 2009-10-06 Rafael Espindola <espindola@google.com>
11302 * plugin.cc (add_input_library): New.
11303 (Plugin::load): Add add_input_library to tv.
11304 (Plugin_manager::add_input_file): Add the is_lib argument.
11305 (add_input_file): Update call to Plugin_manager::add_input_file.
11306 (add_input_library): New.
11307 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11309 2009-09-30 Doug Kwan <dougkwan@google.com>
11311 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11312 symbol and call Symbol::may_need_copy_reloc to determine if
11313 a copy reloc is needed.
11314 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11315 nocopyreloc is given in command line.
11316 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11317 given in command line.
11318 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11319 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11320 of the removed Target_i386::may_need_copy_reloc.
11321 * options.h (copyreloc): New option with default value false.
11322 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11323 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11324 instead of the removed Target_powerpc::may_need_copy_reloc.
11325 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11326 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11327 instead of the removed Target_sparc::may_need_copy_reloc.
11328 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11329 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11330 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11331 instead of the removed Target_x86_64::may_need_copy_reloc.
11333 2009-09-30 Ian Lance Taylor <iant@google.com>
11335 * object.h (class Object): Remove target_ field, and target,
11336 sized_target, and set_target methods.
11337 (Object::sized_target): Remove.
11338 (class Sized_relobj): Update declarations. Remove sized_target.
11339 * object.cc (Sized_relobj::setup): Remove target parameter.
11340 Change all callers.
11341 (Input_objects::add_object): Don't do anything with the target.
11342 (make_elf_sized_object): Add punconfigured parameter. Change all
11343 callers. Set or test parameter target.
11344 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11345 Change all callers.
11346 * parameters.cc (Parameters::set_target): Change parameter type to
11348 (Parameters::default_target): Remove.
11349 (set_parameters_target): Change parameter type to be non-const.
11350 (parameters_force_valid_target): New function.
11351 (parameters_clear_target): New function.
11352 * parameters.h (class Parameters): Update declarations. Remove
11353 default_target method. Add sized_target and clear_target
11354 methods. Change target_ to be non-const.
11355 (set_parameters_target): Update declaration.
11356 (parameters_force_valid_target): Declare.
11357 (parameters_clear_target): Declare.
11358 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11359 as NULL if we aren't searching.
11360 (Add_symbols::run): Don't check for compatible target.
11361 * fileread.cc (Input_file::open_binary): Call
11362 parameters_force_valid_target.
11363 * gold.cc (queue_middle_tasks): Likewise.
11364 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
11365 set_target on object.
11366 * dynobj.h (class Sized_dynobj): Update declarations.
11367 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11368 make_elf_object returns NULL.
11369 (Archive::include_member): Don't check whether object target is
11371 * output.cc (Output_section::add_input_section): Get target from
11373 (Output_section::relax_input_section): Likewise.
11374 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11376 (Sized_relobj::do_scan_relocs): Likewise.
11377 (Sized_relobj::relocate_sections): Likewise.
11378 * resolve.cc (Symbol_table::resolve): Likewise.
11379 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
11380 parameter. Change all callers.
11381 (Symbol_table::add_from_object): Get target from parameters.
11382 (Symbol_table::add_from_relobj): Don't check object target.
11383 (Symbol_table::add_from_dynobj): Likewise.
11384 (Symbol_table::define_special_symbol): Get target from
11386 * symtab.h (class Symbol_table): Update declaration.
11387 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11388 parameter. Change all callers. Clear parameter target.
11389 (Binary_test): Test target here.
11390 * testsuite/object_unittest.cc (gold_testsuite): Remove
11391 target_test_pointer parameter. Change all callers.
11392 (Object_test): Test target here.
11394 2009-09-26 Ian Lance Taylor <iant@google.com>
11396 * testsuite/initpri1.c: Don't try to use constructor priorities if
11397 compiling with gcc before 4.3.
11399 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
11401 * testsuite/retain_symbols_file_test.sh (check_present): Change
11402 output file name to retain_symbols_file_test.stdout.
11403 (check_absent): Likewise.
11405 2009-09-18 Craig Silverstein <csilvers@google.com>
11407 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11408 * options.cc: Include <cerrno> and <fstream>.
11409 (General_options::finalize): Parse -retain-symbols-file tag.
11410 * options.h: New flag.
11411 (General_options): New method should_retain_symbol, new
11412 variable symbols_to_retain.
11413 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11414 should_retain_symbol map.
11415 * testsuite/Makefile.am (retain_symbols_file_test): New test.
11416 * testsuite/Makefile.in: Regenerate.
11417 * testsuite/retain_symbols_file_test.sh: New file.
11419 2009-09-18 Nick Clifton <nickc@redhat.com>
11421 * po/es.po: Updated Spanish translation.
11423 2009-09-17 Doug Kwan <dougkwan@google.com>
11425 * debug.h (DEBUG_RELAXATION): New constant.
11426 (DEBUG_ALL): Add DEBUG_RELAXATION.
11427 (debug_string_to_enum): Add relaxation debug option.
11429 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11430 Layout::Relaxation_debug_check::read_sections,
11431 Layout::Relaxation_debug_check::read_sections): New method definitions.
11432 (Layout::Layout): Initialize data members
11433 record_output_section_data_from_scrips_,
11434 script_output_section_data_list_ and relaxation_debug_check_.
11435 (Layout::save_segments, Layout::restore_segments,
11436 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11437 Layout::relaxation_loop_body): New method definitions.
11438 (Layout::finalize): Support relaxation. Move section layout code to
11439 Layout::relaxation_loop_body.
11440 (Layout::set_asection_address_from_script): Move code for orphan
11441 section placement out.
11442 (Layout::place_orphan_sections_in_script): New method definition.
11443 * layout.h (Output_segment_headers, Output_file_header):
11444 New forward class declarations.
11445 (Layout::~Layout): Define.
11446 (Layout::new_output_section_data_from_script): New method definition.
11447 (Layout::place_orphan_sections_in_script): New method declaration.
11448 (Layout::Segment_states): New type declaration.
11449 (Layout::save_segments, Layout::restore_segments,
11450 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11451 Layout::relaxation_loop_body): New method declarations.
11452 (Layout::Output_section_data_list): New type declaration.
11453 (Layout::Relaxation_debug_check): New class definition.
11454 (Layout::record_output_section_data_from_script_,
11455 Layout::script_output_section_data_list_, Layout::segment_states_,
11456 Layout::relaxation_debug_check_): New data members.
11457 * output.cc: (Output_section_headers::do_size): New method definition.
11458 (Output_section_headers::Output_section_headers): Move size
11459 computation to Output_section_headers::do_size.
11460 (Output_segment_headers::do_size): New method definition.
11461 (Output_file_header::Output_file_header): Move size computation to
11462 Output_file_header::do_size and call it.
11463 (Output_file_header::do_size): New method definition.
11464 (Output_data_group::Output_data_group): Adjust call to
11465 Output_section_data.
11466 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11467 (Output_symtab_xindex::do_write): Add array bound check.
11468 (Output_section::Input_section::print_to_mapfile): Handle
11469 RELAXED_INPUT_SECTION_CODE.
11470 (Output_section::Output_section): Initialize data member checkpoint_.
11471 (Output_section::~Output_section): Delete checkpoint object pointed
11473 (Output_section::add_input_section): Always add an Input_section if
11475 (Output_section::add_merge_input_section): Add assert.
11476 (Output_section::relax_input_section): New method definition.
11477 (Output_section::set_final_data_size): Set load address to zero for
11478 an unallocated section.
11479 (Output_section::do_address_and_file_offset_have_reset_values):
11480 New method definition.
11481 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11482 Handle relaxed input section.
11483 (Output_section::sort_attached_input_sections): Checkpoint input
11484 section list lazily.
11485 (Output_section::get_input_sections): Change type of input_sections to
11486 list of Simple_input_section pointers. Checkpoint input section list
11487 lazily. Also handle relaxed input sections.
11488 (Output_section::add_input_section_for_script): Take a reference to
11489 a Simple_input_section object instead of Relobj pointer and section
11490 index as parameter. Handle relaxed input sections.
11491 (Output_section::save_states, Output_section::restore_states): New
11492 method definitions.
11493 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11494 (Output_data::is_data_size_fixed): New method definition.
11495 (Output_data::reset_addresss_and_file_offset): Do not reset data size
11497 (Output_data::address_and_file_offset_have_reset_values): New method
11499 (Output_data::do_address_and_file_offset_have_reset_values): New method
11501 (Output_data::set_data_size): Check that data size is not fixed.
11502 (Output_data::fix_data_size): New method definition.
11503 (Output_data::is_data_size_fixed_): New data member.
11504 (Output_section_headers::set_final_data_size): New method definition.
11505 (Output_section_headers::do_size): New method declaration.
11506 (Output_segment_headers::set_final_data_size): New method definition.
11507 (Output_segment_headers::do_size): New method declaration.
11508 (Output_file_header::set_final_data_size)::New method definition.
11509 (Output_file_header::do_size)::New method declaration.
11510 (Output_section_data::Output_section_data): Add new parameter
11511 is_data_size_fixed and use it to fix data size.
11512 (Output_data_const::Output_data_const): Adjust call to base class
11513 constructor and fix data size.
11514 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11515 base class constructor and fix data size.
11516 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11517 base class constructor and fix data size.
11518 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11519 class constructor and fix data size.
11520 (Output_data_group::set_final_data_size): New method definition.
11521 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11522 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11523 class constructor and fix data size.
11524 (Output_relaxed_input_section): New class definition.
11525 (Output_section::Simple_input_section): New class definition.
11526 (Output_section::get_input_sections): Adjust parameter list.
11527 (Output_section::add_input_section_for_script): Same.
11528 (Output_section::save_states, Output_section::restore_states,
11529 Output_section::do_address_and_file_offset_have_reset_values,
11530 (Output_section::Input_section::Input_section): Handle
11531 RELAXED_INPUT_SECTION_CODE. Add new overload for
11532 Output_relaxed_input_section.
11533 (Output_section::Input_section::is_input_section,
11534 Output_section::Input_section::set_output_section): Handle relaxed
11536 (Output_section::Input_section::is_relaxed_input_section,
11537 Output_section::Input_section::output_section_data,
11538 Output_section::Input_section::relaxed_input_section): New method
11540 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11542 (Output_section::Input_section::u1_): Update comments.
11543 (Output_section::Input_section::u2_): Add new union member poris.
11544 (Output_section::Checkpoint_output_section): New classs definition.
11545 (Output_section::relax_input_section): New method declaration.
11546 (Output_section::checkpoint_): New data member.
11547 (Output_segment): Update comments.
11548 (Output_segment::Output_segment): Un-privatize copy constructor.
11549 (Output_segment::operator=): Un-privatize.
11550 * script-sections.cc (Output_section_element::Input_section_list):
11551 Change element type to Output_section::Simple_input_section.
11552 (Output_section_element_dot_assignment::set_section_addresses):
11553 Register output section data for relaxation clean up.
11554 (Output_data_exression::Output_data_expression): Adjust call to base
11555 constructor to fix data size.
11556 (Output_section_element_data::set_section_addresses): Register
11557 Output_data_expression object for relaxation clean up.
11558 (struct Input_section_info): Replace Relobj pointer and section index
11559 pair with Output_section::Simple_input_section and Convert struct to a
11561 (Input_section_sorter::operator()): Adjust access to
11562 Input_section_info data member to use accessors.
11563 (Output_section_element_input::set_section_addresses): Use layout
11564 parameter. Adjust code to use Output_section::Simple_input_section
11565 and Input_secction_info classes. Register filler for relaxation
11567 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11568 and section index pair with Output_section::Simple_input_section
11569 class. Adjust code accordingly.
11570 (Phdrs_element::release_segment): New method definition.
11571 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11573 (Script_sections::release_segments): New method definition.
11574 * gold/script-sections.h (Script_sections::release_segments): New
11575 method declaration.
11576 * gold/target.h (Target::may_relax, Target::relax,
11577 Target::do_may_relax, Target::do_relax): New method definitions.
11579 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11581 * arm.cc (has_signed_unsigned_overflow): New function.
11582 (Arm_relocate_functions::abs8): New function.
11583 (Target_arm::Scan::local): Handle R_ARM_ABS8.
11584 (Target_arm::Scan::global): Likewise.
11585 (Target_arm::relocate::relocate): Likewise.
11586 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11589 2009-09-16 Cary Coutant <ccoutant@google.com>
11591 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11592 * testsuite/Makefile.in: Regenerate.
11594 2009-09-11 Nick Clifton <nickc@redhat.com>
11596 * po/gold.pot: Updated by the Translation project.
11598 2009-09-08 Cary Coutant <ccoutant@google.com>
11600 * output.cc (Output_file::open): Add execute permission to empty file.
11601 * testsuite/Makefile.am (permission_test): New test.
11602 * testsuite/Makefile.in: Regenerate.
11604 2009-09-02 Ian Lance Taylor <iant@google.com>
11606 * output.cc (Output_file::resize): Call map_no_anonymous rather
11609 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
11611 * gold.cc: Include "incremental.h".
11612 (queue_initial_tasks): Call Incremental_checker methods.
11613 * incremental.cc: Include "output.h".
11614 (Incremental_checker::can_incrementally_link_output_file): New
11616 * incremental.h (Incremental_checker): New class.
11618 * output.cc (Output_file::open_for_modification): New method.
11619 (Output_file::map_anonymous): Changed return type to bool. Record
11620 map in base_ field.
11621 (Output_file::map_no_anonymous): New method, broken out of map.
11622 (Output_file::map): Use map_no_anonymous and map_anonymous.
11623 * output.h (class Output_file): Update declarations.
11625 2009-08-24 Cary Coutant <ccoutant@google.com>
11627 * options.h (Command_line::Pre_options): New class.
11628 (Command_line::pre_options): New member.
11629 * options.cc (gold::options::ready_to_register): New variable.
11630 (One_option::register_option): Do nothing if not registering options.
11631 Assert if same short option registered twice.
11632 (General_options::General_options): Turn off option registration when
11634 (Command_line::Pre_options::Pre_options): New constructor.
11636 2009-08-24 Cary Coutant <ccoutant@google.com>
11638 * options.h (General_options::no_keep_memory): Remove incorrect
11641 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
11643 * Makefile.am (am__skiplex, am__skipyacc): New.
11644 * Makefile.in: Regenerate.
11646 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
11648 * Makefile.am (AM_CPPFLAGS): Renamed from ...
11649 (INCLUDES): ... this.
11650 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11651 (AM_CPPFLAGS): Renamed from ...
11652 (INCLUDE): ... this.
11653 * Makefile.in, testsuite/Makefile.in: Regenerate.
11655 * Makefile.in: Regenerate.
11656 * aclocal.m4: Likewise.
11657 * config.in: Likewise.
11658 * configure: Likewise.
11659 * testsuite/Makefile.in: Likewise.
11661 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11662 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11663 * Makefile.in: Regenerate.
11664 * testsuite/Makefile.in: Regenerate.
11666 2009-08-19 Cary Coutant <ccoutant@google.com>
11668 * resolve.cc (Symbol_table::resolve): Don't complain about defined
11669 symbols in shared libraries overridden by hidden or internal symbols
11670 in the main program.
11672 2009-08-19 Chris Demetriou <cgd@google.com>
11674 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11675 checking source file names in error messages.
11677 2009-08-18 Doug Kwan <dougkwan@google.com>
11679 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11680 an elcpp::Ehdr as parameter. Adjust call to set_target.
11681 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11682 an elfcpp::Ehdr as parameter.
11683 * object.cc (Object::set_target): Remove the version that looks up
11684 a target and sets it.
11685 (Sized_relobj::setup): Take a Target object instead of
11686 an elfcpp::Ehdr as parameter. Adjust call to set_target.
11687 (make_elf_sized_object): Find target and ask target to
11688 make an ELF object.
11689 * object.h: (Object::set_target): Remove the version that looks up
11690 a target and sets it.
11691 (Sized_relobj::setup): Take a Target object instead of
11692 an elfcpp:Ehdr as parameter.
11693 * target.cc: Include dynobj.h.
11694 (Target::do_make_elf_object_implementation): New.
11695 (Target::do_make_elf_object): New.
11696 * target.h (Target::make_elf_object): New template declaration.
11697 (Target::do_make_elf_object): New method declarations.
11698 (Target::do_make_elf_object_implementation): New template declaration.
11700 2009-08-14 Ian Lance Taylor <iant@google.com>
11702 * gold.h (FUNCTION_NAME): Define.
11703 (gold_unreachable): Use FUNCTION_NAME.
11705 2009-08-12 Sriraman Tallam <tmsriram@google.com>
11707 * icf.cc (Icf::find_identical_sections): Issue a warning when a
11708 symbol in the --keep-unique list is not found.
11710 2009-08-12 Sriraman Tallam <tmsriram@google.com>
11712 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11713 been maked as --keep-unique.
11714 (Icf::unfold_section): New function.
11715 * icf.h (Icf::unfold_section): New function.
11716 * options.h (General_options::keep_unique): New option.
11717 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11718 * testsuite/Makefile.in: Regenerate.
11719 * testsuite/icf_keep_unique_test.sh: New file.
11720 * testsuite/icf_keep_unique_test.cc: New file.
11722 2009-08-12 Cary Coutant <ccoutant@google.com>
11725 * resolve.cc (Symbol_table::resolve): Check for references from
11726 dynamic objects to hidden and internal symbols.
11727 * testsuite/Makefile.am (hidden_test.sh): New test.
11728 * testsuite/Makefile.in: Regenerate.
11729 * testsuite/hidden_test.sh: New script.
11730 * testsuite/hidden_test_1.c: New test source.
11731 * testsuite/hidden_test_main.c: New test source.
11733 2009-08-11 Doug Kwan <dougkwan@google.com>
11735 * arm.cc: Update comments.
11736 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11737 segment to locate the .ARM.exidx section if present.
11739 2009-08-09 Doug Kwan <dougkwan@google.com>
11741 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11744 2009-08-07 Sriraman Tallam <tmsriram@google.com>
11745 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11748 2009-08-06 Sriraman Tallam <tmsriram@google.com>
11750 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11751 valid tls_segment only for non-debug-section relocations.
11752 * testsuite/Makefile.am: Add gc_tls_test.
11753 * testsuite/Makefile.in: Regenerate.
11754 * testsuite/gc_tls_test.cc: New file.
11755 * testsuite/gc_tls_test.sh: New file.
11757 2009-08-05 Sriraman Tallam <tmsriram@google.com>
11759 * icf.cc: New file.
11761 * Makefile.am (CCFILES): Add icf.cc.
11762 (HFILES): Add icf.h
11763 * Makefile.in: Regenerate.
11764 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11765 * gc.h (gc_process_relocs): Populate lists used by icf to contain
11766 section, symbol and addend information for the relocs.
11767 * gold.cc (queue_middle_tasks): Call identical code folding.
11768 * gold.h: Add defines for multimap.
11769 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11770 to the call of finalize_local_symbols.
11771 * main.cc (main): Create object of class Icf.
11772 * object.cc (Sized_relobj::do_layout): Allow this function to be
11773 called twice during icf.
11774 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11775 to sections marked as identical by icf.
11776 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11778 (Sized_relobj::do_section_entsize): New function.
11779 * object.h (Object::section_entsize): New function.
11780 (Object::do_section_entsize): New pure virtual function.
11781 (Relobj::finalize_local_symbols): Add new parameter.
11782 (Relobj::do_section_entsize): New function.
11783 * options.h (General_options::icf): New option.
11784 (General_options::icf_iterations): New option.
11785 (General_options::print_icf_sections): New option.
11786 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11787 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11788 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11790 * symtab.cc (Symbol_table::is_section_folded): New function.
11791 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
11792 to sections marked as identical by icf.
11793 * symtab.h (Symbol_table::set_icf): New function.
11794 (Symbol_table::icf): New function.
11795 (Symbol_table::is_section_folded): New function.
11796 (Symbol_table::icf_): New data member.
11797 * target-reloc.h (relocate_section): Ignore sections folded by icf.
11798 * testsuite/Makefile.am: Add commands to build icf_test.
11799 * testsuite/Makefile.in: Regenerate.
11800 * testsuite/icf_test.sh: New file.
11801 * testsuite/icf_test.cc: New file.
11803 2009-07-24 Chris Demetriou <cgd@google.com>
11805 * layout.cc (is_compressible_debug_section): Fix incorrect
11806 comment about compressed section names.
11808 2009-07-20 Ian Lance Taylor <ian@airs.com>
11811 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11813 2009-07-16 Ian Lance Taylor <iant@google.com>
11816 * layout.h: #include <map>.
11817 (class Kept_section): Change from struct to class. Add accessors
11818 and setters. Add section size to Comdat_group mapping. Change
11819 Comdat_group to std::map. Add is_comdat_ field. Add
11820 linkonce_size field in union.
11821 (class Layout): Update declaration of find_or_add_kept_section.
11822 Don't declare find_kept_object.
11823 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11824 parameter. Add object, shndx, is_comdat, and is_group_name
11825 parameters. Change all callers. Adjust for new Kept_section.
11826 (Layout::find_kept_object): Remove.
11827 * object.cc (Sized_relobj::include_section_group): Update use of
11828 Kept_section. Rename secnum to shndx. Only record
11829 Kept_comdat_section if sections are the same size.
11830 (Sized_relobj::include_linkonce_section): Update use of
11831 Kept_section. Only record Kept_comdat_section if sections are the
11832 same size. Set size of linkonce section.
11833 (Sized_relobj::map_to_kept_section): Update call to
11834 get_kept_comdat_section.
11835 * object.h (class Sized_relobj): Rename fields in
11836 Kept_comdat_section to drop trailing underscores; change object
11837 field to Relobj*. Change Kept_comdat_section_table to store
11838 struct rather than pointer.
11839 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11840 Add kept_object and kept_shndx parameters. Change all callers.
11841 (Sized_relobj::get_kept_comdat_section): Change return type to
11842 bool. Add kept_object and kept_shndx parameters. Change all
11844 * plugin.cc (Pluginobj::include_comdat_group): Update call to
11845 Layout::find_or_add_kept_section.
11847 2009-07-09 Ian Lance Taylor <iant@google.com>
11849 * merge.cc (Object_merge_map::initialize_input_to_output_map):
11850 Reserve space in the hash table.
11852 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
11854 * fileread.cc (File_read::get_mtime): New method.
11855 * fileread.h (Timespec): New structure.
11856 (File_read::get_mtime): New method.
11857 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11858 Renamed from timestamp_nsec.
11859 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11861 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11863 (Incremental_inputs::report_archive): Save mtime; style fix.
11864 (Incremental_inputs::report_obejct): Save mtime; style fix.
11865 (Incremental_inputs::report_script): Save mtime; style fix.
11866 (Incremental_inputs::finalize_inputs): Style fix.
11867 (Incremental_inputs::finalize): Style fix.
11868 (Incremental_inputs::create_input_section_data): Store inputs
11870 * incremental.h (Incremental_inputs::report_script): Add mtime
11872 (Incremental_inputs::Input_info::Input_info): Intialize only one
11874 (Incremental_inputs::Input_info::archive): Move to nameless
11876 (Incremental_inputs::Input_info::obejct): Move to nameless union.
11877 (Incremental_inputs::Input_info::script): Move to nameless union.
11878 (Incremental_inputs::mtime): New field.
11879 * script.cc (read_input_script): Pass file mtime to
11881 * script.h (Script_info::inputs): Style fix.
11883 2009-07-01 Ian Lance Taylor <ian@airs.com>
11885 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11888 2009-06-24 Ian Lance Taylor <iant@google.com>
11891 * layout.cc (Layout::choose_output_section): If we find an
11892 existing section, update the flags.
11893 (Layout::create_notes): New function, broken out of
11895 (Layout::finalize): Don't create note sections.
11896 (Layout::create_note): Don't crash if linker script discards
11898 (Layout::create_gold_note): Likewise.
11899 (Layout::create_build_id): Likewise. Don't set
11900 after_input_sections on the section.
11901 (Layout::create_executable_stack_info): Remove target parameter.
11903 * layout.h (class Layout): Declare create_notes. Update
11904 declaration of create_executable_stack_info.
11905 * gold.cc (queue_middle_tasks): Call create_notes.
11906 * output.cc (Output_section::update_flags_for_input_section): Move
11907 here from output.h. If SHF_ALLOC flag is newly set, mark address
11909 * output.h (Output_data::mark_address_invalid): New function.
11910 (class Output_section): Only declare, not define,
11911 update_flags_for_input_section. Remove set_flags.
11913 2009-06-24 Ian Lance Taylor <iant@google.com>
11915 * script-sections.cc (Output_section_definition::
11916 set_section_addresses): Rename shadowing local load_address to
11919 2009-06-24 Ian Lance Taylor <iant@google.com>
11922 * reloc.cc (relocate_sections): Skip empty relocation sections.
11924 2009-06-23 Ian Lance Taylor <iant@google.com>
11927 * layout.cc (Layout::create_note): Use choose_output_section
11928 rather than make_output_section.
11930 2009-06-23 Ian Lance Taylor <iant@google.com>
11933 * options.cc (General_options::parse_V): Set printed_version_.
11934 (General_options::General_options): Initialize printed_version_.
11935 * options.h (class General_options): Add printed_version_ field.
11936 * gold.cc (queue_initial_tasks): If there are no input files,
11937 don't give a fatal error if we printed the version information.
11938 (queue_middle_tasks): If using -r with a shared object, give a
11939 fatal error rather than an ordinary error.
11941 2009-06-23 Ian Lance Taylor <iant@google.com>
11944 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11945 (Layout::make_output_section): Set have_stabstr_section_ if we see
11946 a .stab*str section.
11947 (Layout::finalize): Call link_stabs_sections.
11948 (Layout::link_stabs_sections): New file.
11949 * layout.h (class Layout): Add have_stabstr_section_ field.
11950 Declare link_stabs_sections.
11952 2009-06-23 Doug Kwan <dougkwan@google.com>
11954 * Makefile.am (libgold_a_LIBADD): New.
11955 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11956 * Makefile.in: Regenerate.
11957 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11958 * configure: Regenerate.
11959 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11960 * fileread.cc: Include sys/state.h
11961 * gold.h: Declare memmem and strndup if found missing.
11962 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11964 2009-06-23 Ian Lance Taylor <iant@google.com>
11966 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11967 * configure: Rebuild.
11969 2009-06-23 Ian Lance Taylor <iant@google.com>
11972 * object.cc (Object::section_contents): Don't try to get a view if
11973 the section has length zero.
11974 (Object::handle_gnu_warning_section): If the section is empty, use
11975 the name of the section as the warning.
11977 2009-06-23 Ian Lance Taylor <iant@google.com>
11980 * stringpool.h (class Stringpool_template): Add optimize_ field.
11981 (Stringpool_template::set_optimize): New function.
11982 * stringpool.cc (Stringpool_template::Stringpool_template):
11983 Initialize optimize_ field.
11984 (Stringpool_template::set_string_offsets): Test local optimize
11985 fild rather than parameter.
11986 * layout.cc (Layout::Layout): Call set_optimize on the section
11989 2009-06-22 Ian Lance Taylor <iant@google.com>
11992 * yyscript.y: Parse TARGET.
11993 * script.cc (script_set_target): New function.
11994 * script-c.h (script_set_target): Declare.
11995 * options.cc (General_options::string_to_object_format): Rename
11996 from string_to_object_format in anonymous namespace. Change
11998 * options.h (class General_options): Declare
11999 string_to_object_format.
12001 2009-06-22 Ian Lance Taylor <iant@google.com>
12003 * script-sections.cc (Script_sections::create_segments): Don't put
12004 program headers in a PT_LOAD segment if -n or -N.
12006 2009-06-22 Ian Lance Taylor <iant@google.com>
12009 * options.h (class General_options): Add -z lazy and -z now. Sort
12010 -z options into alphabetical order.
12011 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12013 2009-06-21 Ian Lance Taylor <iant@google.com>
12015 * layout.cc (Layout::make_output_section): Call
12016 Target::new_output_section.
12017 (Layout::attach_allocated_section_to_segment): Put large section
12018 sections in a separate load segment with the large segment flag
12020 (Layout::segment_precedes): Sort large data segments after other
12022 (align_file_offset): New static function.
12023 (Layout::set_segment_offsets): Use align_file_offset.
12024 * output.h (class Output_section): Add is_small_section_ and
12025 is_large_section_ fields.
12026 (Output_section::is_small_section): New function.
12027 (Output_section::set_is_small_section): New function.
12028 (Output_section::is_large_section): New function.
12029 (Output_section::set_is_large_section): New function.
12030 (Output_section::is_large_data_section): New function.
12031 (class Output_segment): Add is_large_data_segment_ field.
12032 (Output_segment::is_large_data_segment): New function.
12033 (Output_segment::set_is_large_data_segment): New function.
12034 * output.cc (Output_section::Output_section): Initialize new
12036 (Output_segment::Output_segment): Likewise.
12037 (Output_segment::add_output_section): Add assertion that large
12038 data sections always go in large data segments. Force small data
12039 sections to the end of the list of data sections. Force small BSS
12040 sections to the start of the list of BSS sections. For large BSS
12041 sections to the end of the list of BSS sections.
12042 * symtab.h (class Symbol): Declare is_common_shndx.
12043 (Symbol::is_defined): Check Symbol::is_common_shndx.
12044 (Symbol::is_common): Likewise.
12045 (class Symbol_table): Define enum Commons_section_type. Update
12046 declarations. Add small_commons_ and large_commons_ fields.
12047 * symtab.cc (Symbol::is_common_shndx): New function.
12048 (Symbol_table::Symbol_table): Initialize new fields.
12049 (Symbol_table::add_from_object): Put small and large common
12050 symbols in the right list.
12051 (Symbol_table::sized_finalized_symbol): Check
12052 Symbol::is_common_shndx.
12053 (Symbol_table::sized_write_globals): Likewise.
12054 * common.cc (Symbol_table::do_allocate_commons): Allocate new
12055 common symbol lists. Don't call do_allocate_commons_list if the
12057 (Symbol_table::do_allocate_commons_list): Remove is_tls
12058 parameter. Add comons_section_type parameter. Change all
12059 callers. Handle small and large common symbols.
12060 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12061 Symbol::is_common_shndx.
12062 * resolve.cc (symbol_to_bits): Likewise.
12063 * target.h (Target::small_common_shndx): New function.
12064 (Target::small_common_section_flags): New function.
12065 (Target::large_common_shndx): New function.
12066 (Target::large_common_section_flags): New function.
12067 (Target::new_output_section): New function.
12068 (Target::Target_info): Add small_common_shndx, large_common_shndx,
12069 small_common_section_flags, and large_common_section_flags
12071 (Target::do_new_output_section): New virtual function.
12072 * arm.cc (Target_arm::arm_info): Initialize new fields.
12073 * i386.cc (Target_i386::i386_info): Likewise.
12074 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12076 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12077 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12078 (Target_x86_64::do_new_output_section): New function.
12079 * configure.ac: Define conditional MCMODEL_MEDIUM.
12080 * testsuite/Makefile.am (check_PROGRAMS): Add large.
12081 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12082 (large_LDFLAGS): Define.
12083 * testsuite/large.c: New file.
12084 * testsuite/testfile.cc (Target_test::test_target_info):
12085 Initialize new fields.
12086 * configure, testsuite/Makefile.in: Rebuild.
12088 2009-06-05 Doug Kwan <dougkwan@google.com>
12090 * Makefile.am (CCFILES): Add target.cc.
12091 * Makefile.in: Regenerate.
12092 * i386.cc (class Target_i386): Define new virtual method to
12093 override do_is_local_label_name in parent.
12094 * object.cc (Sized_relobj::do_count_local_symbols): Discard
12095 local symbols if --discard-locals or -X is given.
12096 * options.h (class General_options): Declare new options
12097 '--discard-locals' and '-X' for discarding locals.
12098 * target.h (class Target): Define new methods is_local_label_name.
12099 Declare new virtual method do_is_local_label_name.
12100 * target.cc: New file.
12101 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12102 (check_SCRIPTS): Add discard_locals_test.sh.
12103 (check_DATA): Add discard_local_tests.syms.
12104 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12105 (discard_local_tests.syms, discard_locals_test.o): New make rules.
12106 * testsuite/Makefile.in: Regenerate.
12107 * testsuite/discard_locals_test.c: New file.
12108 * testsuite/discard_locals_test.sh: Same.
12110 2009-06-05 Doug Kwan <dougkwan@google.com>
12112 * object.cc (Sized_relobj::Sized_relobj): Initialize
12113 discarded_eh_frame_shndx_ to -1U.
12114 (Sized_relobj::do_layout): Record index of a discard .eh_frame
12116 (Sized_relobj::do_count_local_symbols): Skip local symbols in
12117 a discarded .eh_frame section.
12118 (Sized_relobj::do_finalize_local_symbols): Ditto.
12119 * object.h (class Sized_relobj): Declare new member
12120 discarded_eh_frame_shndx_.
12121 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12122 (local_labels_test.o, local_labels_test): New rules.
12123 * testsuite/Makefile.in: Regenerate.
12125 2009-06-04 Doug Kwan <dougkwan@google.com>
12127 * layout.cc (Layout::section_name_mapping): Add mapping for
12128 special ARM sections.
12130 2009-06-03 Doug Kwan <dougkwan@google.com>
12132 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12133 (utils::has_overflow): Same.
12135 2009-06-03 Ian Lance Taylor <iant@google.com>
12137 * layout.cc (Layout::section_name_mapping): New array, replacing
12138 Layout::linkonce_mapping.
12139 (Layout::section_name_mapping_count): New variable, replacing
12140 Layout::linkonce_mapping_count.
12141 (Layout::linkonce_output_name): Remove.
12142 (Layout::output_section_name): Rewrite.
12143 * layout.h (class Layout): Rename Linkonce_mapping to
12144 Section_name_mapping, linkonce_mapping to section_name_mapping,
12145 linkonce_mapping_count to section_name_mapping_count. Don't
12146 declare linkonce_output_name.
12148 2009-06-03 Doug Kwan <dougkwan@google.com>
12150 * gold/arm.cc (namespace utils): New.
12151 (Target_arm::reloc_is_non_pic): Define new method.
12152 (class Arm_relocate_functions): New.
12153 (Target_arm::Relocate::relocate): Handle relocation types used by
12156 2009-06-03 Ian Lance Taylor <iant@google.com>
12158 * arm.cc (Target_arm::scan::global): Use || instead of |.
12160 2009-06-02 Doug Kwan <dougkwan@google.com>
12162 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
12163 issued_non_pic_error_.
12164 (class Target_arm::Scan): Declare new method check_non_pic.
12165 Define new method symbol_needs_plt_entry.
12166 Declare new data member issued_non_pic_error_.
12167 (class Target_arm::Relocate): Declare new method
12168 should_apply_static_reloc.
12169 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12170 (Target_arm::Scan::check_non_pic): Define new method.
12171 (Target_arm::Scan::local): Handle a small subset of reloc types used
12173 (Target_arm::Scan::local): Same.
12174 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12176 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
12178 * incremental.cc (Incremental_inputs::report_command_line): Filter
12179 out --incremental-* options.
12181 2009-05-29 Doug Kwan <dougkwan@google.com>
12183 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12185 (class Target_arm): Update comment.
12186 (Target_arm::Target_arm): Initialize new data members GOT_,
12187 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12188 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12189 and Target_arm::rel_dyn_section.
12190 Declare new_enum Target_arm::Got_type.
12191 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12193 Update commments for member do_dynsym_value.
12194 (Target_arm::got_size, Target_arm::plt_section,
12195 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12196 new methods inside class defintion.
12197 (Target_arm::got_section): Define new method.
12198 (Target_arm::rel_dyn_section): Same.
12199 (Output_data_plt_arm): New template class.
12200 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12201 (Output_data_plt_arm:do_adjust_output_section): Define new method.
12202 (Output_data_plt_arm::add_entry): Same.
12203 (Output_data_plt_arm::first_plt_entry): Define new
12204 static data member for PLT instruction template.
12205 (Output_data_plt_arm::plt_entry): Same.
12206 (Output_data_plt_arm::do_write): Define new method.
12207 (Target_arm::make_plt_entry): Same.
12208 (Target_arm::do_finalize_sections): Same.
12209 (Target_arm::do_dynsym_value): Same.
12211 2009-05-28 Doug Kwan <dougkwan@google.com>
12213 * Makefile.am (TARGETSOURCES): Add arm.cc.
12214 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12215 * Makefile.in: Regenerate.
12216 * arm.cc: New file.
12217 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12219 2009-05-26 Doug Kwan <dougkwan@google.com>
12221 * options.cc (General_options::parse_exclude_libs). Fix a comment.
12222 (General_options::check_excluded_libs): Strip off directories in
12223 archive name before matching like GNU ld does.
12224 * testsuite/Makefile.am (MOSTLYCLEANFILES,
12225 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12226 (exclude_libs_test_LDFLAGS): Add linker option
12227 -Wl,--exclude-libs,libexclude_libs_test_3
12228 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12229 an explicit archive without using -l.
12230 (alt/libexclude_libs_test_3.a): New make rule.
12231 * testsuite/Makefile.in: Regenerate.
12232 * testsuite/exclude_libs_test.c : Declare lib3_default().
12234 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12235 * exclude_libs_test_3.c: New file.
12237 2009-05-26 Nick Clifton <nickc@redhat.com>
12239 * po/id.po: New Indonesian translation.
12240 * po/gold.pot: Updated template file.
12242 2009-05-22 Sriraman Tallam <tmsriram@google.com>
12244 * testsuite/Makefile.am: Add -ffunction-sections to compile
12245 gc_comdat_test files. Add -Wl,--gc-sections to build
12247 * testsuite/Makefile.in: Regenerate.
12248 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12250 2009-05-21 Sriraman Tallam <tmsriram@google.com>
12252 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12253 kept comdat section was garbage collected.
12254 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12255 * testsuite/Makefile.in: Regenerate.
12256 * testsuite/gc_comdat_test.sh: New file.
12257 * testsuite/gc_comdat_test_1.cc: New file.
12258 * testsuite/gc_comdat_test_2.cc: New file.
12260 2009-05-19 Doug Kwan <dougkwan@google.com>
12262 * archive.cc (Archive::Archive): Move constructor from archive.h
12263 to here. Initialize no_export_.
12264 (Archive::get_elf_object_for_member): Set no_export flag of object.
12265 * archive.h (Archive::Archive): Move constructor body to
12267 (Archive::no_export): New method.
12268 (Archive::no_export_): New field.
12269 * object.h (Object::Object): Initialize no_export_ to false.
12270 (Object::no_export, Object::set_no_export): New methods.
12271 (Object::no_export_): New field.
12272 * options.cc (General_options::parse_exclude_libs): New method.
12273 (General_options::check_excluded_libs) Same.
12274 * options.h (exclude_libs): New option.
12275 (General_options::check_excluded_libs): New method declaration.
12276 (General_options::excluded_libs_): New field.
12277 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12278 default or protected visibility if an object has no-export flag set.
12279 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12280 (check_SCRIPTS): Add exclude_libs_test.sh.
12281 (check_DATA): Add exclude_libs_test.syms.
12282 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12283 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12284 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12285 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12286 (exclude_libs_test.syms, libexclude_libs_test_1.a,
12287 libexclude_libs_test_2.a): New rules.
12288 * testsuite/Makefile.in: Regenerate.
12289 * testsuite/exclude_libs_test.c: New file.
12290 * testsuite/exclude_libs_test.sh: Ditto.
12291 * testsuite/exclude_libs_test_1.c: Ditto.
12292 * testsuite/exclude_libs_test_2.c: Ditto.
12294 2009-05-15 Ian Lance Taylor <iant@google.com>
12296 * configure.ac: Check for declarations for cases where libiberty.h
12297 checks HAVE_DECL_xxx.
12298 * configure, config.in: Rebuild.
12300 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
12302 * gold.h (Incremental_argument_list): Remove (invalid) forward
12304 * incremental.cc (Incremental_inputs::report_achive): New method.
12305 (Incremental_inputs::report_object): New method.
12306 (Incremental_inputs::report_script): New method.
12307 (Incremental_inputs::finalize_inputs): New method.
12308 (Incremental_inputs::finalize): Call finalize_inputs().
12309 (Incremental_inputs::sized_create_incremental_inputs_section_data):
12310 Create inputs entries.
12311 * incremental.h (Incremental_input_type): New enum.
12312 (Incremental_inputs::Incremental_input): Initialize new fields.
12313 (Incremental_inputs::report_inputs): New method.
12314 (Incremental_inputs::report_achive): New method.
12315 (Incremental_inputs::report_object): New method.
12316 (Incremental_inputs::report_script): New method.
12317 (Incremental_inputs::finalize_inputs): New method.
12318 (Incremental_inputs::Input_info): New struct.
12319 (Incremental_inputs::Input_info_map): New typedef.
12320 (Incremental_inputs::lock_): New field.
12321 (Incremental_inputs::Inputs_): New field.
12322 (Incremental_inputs::Inputs_map): New field.
12323 * main.cc (main): Call Incremental_input::report_inputs.
12324 * options.h (Input_argument_list): Typedef moved from
12326 (Input_file_group::Files): Remove, use ::Input_argument_list.
12327 (Input_file_group::Input_argument_list): Remove, use
12328 ::Input_argument_list.
12329 * plugin.cc (Plugin_manager::add_input_file): Add error in
12331 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12333 * script.cc (read_input_script): Call
12334 Incremental_input::report_script.
12335 * script.h (Script_info): New class.
12337 2009-04-27 Ian Lance Taylor <iant@google.com>
12339 * x86_64.cc (do_adjust_output_section): Set entsize to
12342 2009-04-23 Elliott Hughes <enh@google.com>
12344 * output.cc (Output_file::close): After short writes, continue
12345 writing from the correct offset in the buffer being written.
12347 2009-04-23 Chris Demetriou <cgd@google.com>
12349 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12350 * configure: Regenerate.
12351 * config.in: Regenerate.
12352 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12353 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12355 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
12357 * incremental.cc (Incremental_inputs_header_data): Renamed from
12358 Incremental_input_header_data.
12359 (Incremental_inputs_header_data::data_size): New field.
12360 (Incremental_inputs_header_data::put_input_file_count): Renamed
12361 from input_file_count.
12362 (Incremental_inputs_header_data::put_command_line_offset): Renamed
12363 from command_line_offset.
12364 (Incremental_inputs_header_data::put_reserved): Renamed from
12366 (Incremental_inputs_entry_data): Renamed from
12367 Incremental_input_entry_data.
12368 (Incremental_inputs_entry_data::data_size): New field.
12369 (Incremental_inputs::report_command_line): New method.
12370 (Incremental_inputs::finalize): New method.
12371 (Incremental_inputs::create_incremental_inputs_data): New method.
12372 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12373 * incremental.h: New file.
12374 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12375 (Layout::finalize): Create incremental inputs section in
12376 incremental builds.
12377 (Layout::create_incremental_info_sections): New method.
12378 * layout.h (Layout::incremental_inputs): New method.
12379 (Layout::create_incremental_info_sections): New method.
12380 (Layout::incremental_inputs_): New field.
12381 * main.cc (main): Notify Incremental_input of the command line.
12383 2009-04-01 Ian Lance Taylor <iant@google.com>
12384 Mikolaj Zalewski <mikolajz@google.com>
12386 * gold.h (reserve_unordered_map): Define, three versions, one for
12387 each version of Unordered_map.
12388 * layout.cc (Layout::Layout): Remove options parameter. Add
12389 number_of_input_files parameter. Don't initialize options_.
12390 Initialize number_of_input_files_ and resized_signatures_. Move
12391 sections_are_attached_.
12392 (Layout::layout_group): Reserve space for group_signatures_.
12393 (Layout::find_or_add_kept_section): Change name parameter to be a
12394 reference. Resize signatures_ map when it gets large enough.
12395 (Layout::layout_eh_frame): Use parameters->options() instead of
12397 (Layout::make_output_section): Likewise.
12398 (Layout::attach_allocated_section_to_segment): Likewise.
12399 (Layout::finalize, Layout::create_executable_stack): Likewise.
12400 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12401 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12402 * layout.h (class Layout): Update declarations. Remove options_
12403 field. Add number_of_input_files_ and resized_signatures_
12404 fields. Move sections_are_attached_ field.
12405 * main.cc (main): Pass number of input files to Layout
12406 constructor. Don't pass options.
12408 2009-03-30 Ian Lance Taylor <iant@google.com>
12410 * ffsll.c (ffsll): Correct implementation.
12412 2009-03-27 Ian Lance Taylor <iant@google.com>
12414 * ffsll.c: New file.
12415 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12416 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12417 * ftruncate.c (ftruncate): Declare before definition.
12418 * mremap.c (mremap): Likewise.
12419 * pread.c (pread): Likewise.
12420 * configure, Makefile.in, config.in: Rebuild.
12422 * mremap.c: New file.
12423 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12424 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12425 (mremap): Declare if HAVE_MREMAP is not defined.
12426 * configure, Makefile.in, config.in: Rebuild.
12428 2009-03-27 Cary Coutant <ccoutant@google.com>
12430 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12431 position independent.
12432 * sparc.cc (Target_sparc::check_non_pic): Likewise.
12433 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12435 2009-03-24 Cary Coutant <ccoutant@google.com>
12437 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12439 (needs_dynamic_reloc): Likewise.
12441 2009-03-24 Ian Lance Taylor <iant@google.com>
12443 * yyscript.y (file_cmd): Recognize EXTERN.
12444 (extern_name_list, extern_name_list_body): New nonterminals.
12445 * script.cc (script_add_extern): Define.
12446 * script-c.h (script_add_extern): Declare.
12448 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
12450 * object.cc (is_elf_object): Define.
12451 * object.h (is_elf_object): Declare.
12452 * archive.cc (Archive::get_elf_object_for_member): Call
12454 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12456 2009-03-24 Elliott Hughes <enh@google.com>
12458 * output.cc (Output_file::map_anonymous): Define.
12459 (Output_file::map): Use map_anonymous. If the regular mmap fails,
12460 try an anonymous one. Report the size if the mmap fails.
12461 * output.h (class Output_file): Declare map_anonymous.
12463 2009-03-24 Ian Lance Taylor <iant@google.com>
12465 * target-select.cc (instantiate_target): Don't acquire the lock if
12466 the instantiated_target_ field has already been set.
12468 2009-03-23 Ian Lance Taylor <iant@google.com>
12470 * gold-threads.h (class Initialize_lock): Define.
12471 * gold-threads.cc (class Initialize_lock_once): Define.
12472 (initialize_lock_control): New static variable.
12473 (initialize_lock_pointer): New static variable.
12474 (initialize_lock_once): New static function.
12475 (Initialize_lock::Initialize_lock): Define.
12476 (Initialize_lock::initialize): Define.
12477 * target-select.h: Include "gold-threads.h".
12478 (class Target_selector): Add lock_ and initialize_lock_ fields.
12479 Don't define instantiate_target, just declare it.
12480 * target-select.cc (Target_selector::Target_selector): Initialize
12482 (Target_selector::instantiate_target): Define.
12483 * descriptors.h: Include "gold-threads.h".
12484 (class Descriptors): Add initialize_lock_ field.
12485 * descriptors.cc (Descriptors::Descriptors): Initialize new
12487 (Descriptors::open): Use initialize_lock_ field
12488 * errors.h (class Errors): Add initialize_lock_ field.
12489 * errors.cc (Errors::Errors): Initialize new field.
12490 (Errors::initialize_lock): Use initialize_lock_ field.
12491 * powerpc.cc (class Target_selector_powerpc): Remove
12492 instantiated_target_ field. In do_recognize call
12493 instantiate_target rather than do_instantiate_target. In
12494 do_instantiate_target just allocate a new target.
12495 * sparc.cc (class Target_selector_sparc): Likewise.
12497 * freebsd.h: New file.
12498 * i386.cc: Include "freebsd.h".
12499 (Target_i386): Derive from Target_freebsd rather than
12501 (Target_selector_i386): Derive from Target_selector_freebsd rather
12502 than Target_selector.
12503 * x86_64.cc: Include "freebsd.h".
12504 (Target_x86_64): Derive from Target_freebsd rather than
12506 (Target_selector_x86_64): Derive from Target_selector_freebsd
12507 rather than Target_selector.
12508 * target.h (class Target): Add adjust_elf_header and
12509 do_adjust_elf_header.
12510 * output.cc (Output_file_header:: do_sized_write): Call target
12511 adjust_elf_header routine.
12512 * configure.tgt: Set targ_osabi.
12513 * configure.ac: Define GOLD_DEFAULT_OSABI.
12514 * parameters.cc (Parameters::default_target): Pass
12515 GOLD_DEFAULT_OSABI to select_target.
12516 * target-select.h (class Target_selector): Make instantiate_target
12517 protected rather than private.
12518 * Makefile.am (HFILES): Add freebsd.h.
12519 * configure, Makefile.in, config.in: Rebuild.
12521 * merge.cc (do_add_input_section): Correct pend value. Change
12522 message about last entry not being null terminated from error to
12525 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
12527 * incremental.cc: New file.
12528 * Makefile.am (CCFILES): Add incremental.cc.
12529 * Makefile.in: Rebuild.
12531 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
12533 * layout.cc (Layout::output_section_name): Preserve names
12534 of '.note.' sections.
12536 2009-03-19 Ian Lance Taylor <iant@google.com>
12538 * descriptors.cc (Descriptors::open): Check that the options are
12539 valid before using them.
12541 2009-03-18 Ian Lance Taylor <iant@google.com>
12543 * script-sections.h: Include <list>.
12544 (class Script_sections): Change Sections_elements from std::vector
12545 to std::list. Typedef public Elements_iterator. Add
12546 orphan_section_placement_, data_segment_align_start_, and
12547 saw_data_segment_align_ fields. Remove data_segment_align_index_
12549 * script-sections.cc (class Orphan_section_placement): New class.
12550 (class Sections_element): Add virtual functions is_relro and
12551 orphan_section_init. Remove virtual function place_orphan_here.
12552 (class Output_section_definition): Add is_relro and
12553 orphan_section_init. Remove place_orphan_here.
12554 (class Orphan_output_section): Likewise.
12555 (Script_sections::Script_sections): Update for field changes.
12556 (Script_sections::data_segment_align): Set saw_data_segment_align_
12557 and data_segment_align_start_, not data_segment_align_index.
12558 (Script_sections::data_segment_relro_end): Check
12559 saw_data_segment_align_. Use data_segment_align_start_ rather
12560 than data_segment_align_index_.
12561 (Script_sections::place_orphan): Rewrite to use
12562 Orphan_section_placement.
12564 2009-03-17 Ian Lance Taylor <iant@google.com>
12566 * archive.cc (Archive::add_symbols): Check for a version attached
12567 to the symbol name in the archive map.
12568 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12569 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12570 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12571 (ver_test_11.a): New target.
12572 * testsuite/Makefile.in: Rebuild.
12574 * configure.ac: Check for chsize and posix_fallocate. Replace
12576 * ftruncate.c: New file, from gnulib.
12577 * output.cc (posix_fallocate): Define dummy version if not
12578 HAVE_POSIX_FALLOCATE.
12579 (Output_file::map): Call posix_fallocate rather than lseek and
12581 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12582 * configure, Makefile.in, config.in: Rebuild.
12584 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
12586 * layout.h (Layout::create_note): Add section_name parameter.
12587 * layout.cc (Layout::create_note): Likewise.
12588 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12590 2009-03-17 Ian Lance Taylor <iant@google.com>
12592 * descriptors.cc: Include "options.h".
12593 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12594 (Descriptors::open): Always use O_CLOEXEC when opening a new
12595 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
12596 then set FD_CLOEXEC.
12598 * sparc.cc (class Target_sparc): Add has_got_section.
12599 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12600 make sure we have a GOT section.
12602 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12603 (Target_sparc::Scan::local): Likewise.
12604 (Target_sparc::Scan::global): Likewise.
12605 (Target_sparc::Relocate::relocate): Likewise.
12606 (Target_sparc::Relocate::relocate_tls): Likewise.
12608 * symtab.cc (Symbol_table::define_default_version): New function,
12609 broken out of add_from_object.
12610 (Symbol_table::add_from_object): Call define_default_version.
12611 (Symbol_table::define_special_symbol): Add resolve_oldsym
12612 parameter. Change all callers. If the version for a symbol comes
12613 from a version script, resolve it with the symbol with the same
12614 name with no version. Also add the symbol without a version if
12616 (do_define_in_output_data): If resolving with oldsym, don't delete
12618 (do_define_in_output_segment): Likewise.
12619 (do_define_as_constant): Likewise.
12620 * symtab.h (class Symbol_table): Update declarations.
12622 2009-03-13 Ian Lance Taylor <iant@google.com>
12624 * readsyms.cc (Read_symbols::incompatible_warning): New function.
12625 (Read_symbols::requeue): New function.
12626 (Read_symbols::do_read_symbols): If make_elf_object fails because
12627 the target type is not configured, and the file was searched for,
12628 issue a warning and retry with the next directory.
12629 (Add_symbols::run): If the file has an incompatible format, and
12630 it was searched for, requeue the Read_symbols task. On error,
12631 release the object.
12632 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
12633 dirindex parameter to constructor. Change all callers. Declare
12634 incompatible_warning and requeue.
12635 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12636 input_argument_ and input_group_ fields. Add them to
12637 constructor. Change all callers.
12638 (class Read_script): Add dirindex_ field. Add it to constructor.
12639 Change all callers.
12640 * archive.cc (Archive::setup): Remove input_objects parameter.
12641 Change all callers.
12642 (Archive::get_file_and_offset): Likewise.
12643 (Archive::read_all_symbols): Likewise.
12644 (Archive::read_symbols): Likewise.
12645 (Archive::get_elf_object_for_member): Remove input_objects
12646 parameter. Add punconfigured parameter. Change all callers.
12647 (Archive::add_symbols): Change return type to bool. Check return
12648 value of include_member.
12649 (Archive::include_all_members): Likewise.
12650 (Archive::include_member): Change return type to bool. Return
12651 false if first included object has incompatible target. Set
12652 included_member_ field.
12653 (Add_archive_symbols::run): If add_symbols returns false, requeue
12655 * archive.h (class Archive): Add included_member_ field.
12656 Initialize it in constructor. Add input_file and searched_for
12657 methods. Update declarations.
12658 (class Add_archive_symbols): Add dirpath_, dirindex_, and
12659 input_argument_ fields. Add them to constructor. Change all
12661 * script.cc: Include "target-select.h".
12662 (class Parser_closure): Add skip_on_incompatible_target_ and
12663 found_incompatible_target_ fields. Add
12664 skip_on_incompatible_target parameter to constructor. Change all
12665 callers. Add methods skip_on_incompatible_target,
12666 clear_skip_on_incompatible_target, found_incompatible_target, and
12667 set_found_incompatible_target.
12668 (read_input_script): Add dirindex parameter. Change all callers.
12669 If parser finds an incompatible target, requeue Read_symbols
12671 (script_set_symbol): Clear skip_on_incompatible_target in
12673 (script_add_assertion, script_parse_option): Likewise.
12674 (script_start_sections, script_add_phdr): Likewise.
12675 (script_check_output_format): New function.
12676 * script.h (read_input_script): Update declaration.
12677 * script-c.h (script_check_output_format): Declare.
12678 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12679 (ignore_cmd): Remove OUTPUT_FORMAT.
12680 * fileread.cc (Input_file::Input_file): Add explicit this.
12681 (Input_file::will_search_for): New function.
12682 (Input_file::open): Add pindex parameter. Change all callers.
12683 * fileread.h (class Input_file): Add input_file_argument method.
12684 Declare will_search_for. Update declarations.
12685 * object.cc (make_elf_object): Add punconfigured parameter.
12686 Change all callers.
12687 * object.h (class Object): Make input_file public. Add
12688 searched_for method.
12689 (make_elf_object): Update declaration.
12690 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
12692 * dirsearch.h (class Dirsearch): Update declaration.
12693 * options.h (class General_options): Add --warn-search-mismatch.
12694 * parameters.cc (Parameters::is_compatible_target): New function.
12695 * parameters.h (class Parameters): Declare is_compatible_target.
12696 * workqueue.cc (Workqueue::add_blocker): New function.
12697 * workqueue.h (class Workqueue): Declare add_blocker.
12699 * fileread.cc (Input_file::open): Remove options parameter.
12700 Change all callers.
12701 (Input_file::open_binary): Likewise.
12702 * script.cc (read_input_script): Likewise.
12703 * readsyms.h (class Read_symbols): Remove options_ field. Remove
12704 options parameter from constructor. Change all callers.
12705 (class Read_script): Likewise.
12706 * fileread.h (class Input_file): Update declarations.
12707 * script.h (read_input_script): Update declaration.
12709 2009-03-10 Nick Clifton <nickc@redhat.com>
12711 * po/es.po: New Spanish translation.
12713 2009-03-06 Cary Coutant <ccoutant@google.com>
12715 * options.cc (parse_short_option): Keep dash_z from registering itself.
12717 2009-03-03 Ian Lance Taylor <iant@google.com>
12720 * target-reloc.h (relocate_section): Pass output_section to
12722 * i386.cc (Target_i386::should_apply_static_reloc): Add
12723 output_section parameter. Change all callers.
12724 (Target_i386::Relocate::relocate): Add output_section parameter.
12725 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12726 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12727 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12728 * testsuite/two_file_shared.sh: New script.
12729 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12730 (check_DATA): Add two_file_shared.dbg.
12731 (two_file_shared.dbg): New target.
12732 * testsuite/Makefile.in: Rebuild.
12734 2009-03-01 Ian Lance Taylor <iant@google.com>
12736 * configure.ac: Check for byteswap.h.
12737 * configure: Rebuild.
12738 * config.in: Rebuild.
12740 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
12742 * layout.cc (Layout::find_or_add_kept_section): New function.
12743 (Layout::add_comdat): Removed.
12744 * layout.h (struct Kept_section): Move out of class Layout.
12745 Remove trailing underscores from field names. Add group_sections
12746 field. Rename group_ field to is_group. Change all uses.
12747 (class Layout): Declare find_or_add_kept_section, not add_comdat.
12748 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12749 comdat_groups_ field.
12750 (Sized_relobj::include_section_group): Use
12751 find_or_add_kept_section and Kept_section::group_sections.
12752 (Sized_relobj::include_linkonce_section): Likewise.
12753 * object.cc (class Sized_relobj): Don't define Comdat_group or
12754 Comdat_group_table. Remove find_comdat_group and
12755 add_comdat_group. Remove comdat_groups_ field.
12756 * plugin.cc (include_comdat_group): Use
12757 Layout::find_or_add_kept_section.
12759 2009-02-28 Ian Lance Taylor <iant@google.com>
12761 * README: --gc-sections and map files are now supported. Document
12762 some build requirements.
12765 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12766 relocatable link set the value of the section symbol to zero.
12767 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12768 relocatable link don't include the section address in the local
12771 2009-02-27 Ian Lance Taylor <iant@google.com>
12774 * options.h (class Search_directory): Add is_system_directory.
12775 (class General_options): Declare is_in_system_directory.
12776 * options.cc (get_relative_sysroot): Make static.
12777 (get_default_sysroot): Make static.
12778 (General_optoins::is_in_system_directory): New function.
12779 * fileread.cc (Input_file::is_in_system_directory): New function.
12780 * fileread.h (class Input_file): Declare is_in_system_directory.
12781 * object.h (class Object): Add is_in_system_directory.
12782 (class Input_objects): Remove system_library_directory_ field.
12783 * object.cc (Input_objects::add_object): Don't set
12784 system_library_directory_.
12785 (input_objects::found_in_system_library_directory): Remove.
12786 * symtab.cc (Symbol_table::write_globals): Remove input_objects
12787 parameter. Change all callers.
12788 (Symbol_table::sized_write_globals): Likewise.
12789 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12790 Call Object::is_in_system_directory.
12791 * symtab.h (class Symbol_table): Update declarations.
12794 * descriptors.h (Open_descriptor): Add is_on_stack field.
12795 * descriptors.cc (Descriptors::open): If the descriptor is on the
12796 top of the stack, remove it. Initialize is_on_stack field.
12797 (Descriptors::release): Only add pod to stack if it is not on the
12799 (Descriptors::close_some_descriptor): Clear stack_next and
12800 is_on_stack fields.
12803 * output.cc (Output_section::find_starting_output_address): Rename
12804 from starting_output_address; add PADDR parameter; change return
12806 * output.h (class Output_section): Declare
12807 find_starting_output_address instead of starting_output_address.
12808 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12809 section symbol for which we can't find a merge section.
12812 * symtab.cc (Symbol_table::add_from_object): If the visibility is
12813 hidden or internal, force the symbol to be local.
12814 * resolve.cc (Symbol::override_visibility): Define.
12815 (Symbol::override_base): Use override_visibility.
12816 (Symbol_table::resolve): Likewise.
12817 (Symbol::override_base_with_special): Likewise.
12818 (Symbol_table::override_with_special): If the visibility is hidden
12819 or internal, force the symbol to be local.
12820 * symtab.h (class Symbol): Add set_visibility and
12821 override_visibility.
12822 * testsuite/ver_test_1.sh: New file.
12823 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12824 (check_DATA): Add ver_test_1.syms.
12825 (ver_test_1.syms): New target.
12826 * testsuite/Makefile.in: Rebuild.
12828 2009-02-25 Cary Coutant <ccoutant@google.com>
12830 * layout.cc (Layout::choose_output_section): Don't rename sections
12831 when using a linker script that has a SECTIONS clause.
12832 * Makefile.in: Regenerate.
12834 * testsuite/Makefile.am (script_test_5.sh): New test case.
12835 * testsuite/Makefile.in: Regenerate.
12836 * testsuite/script_test_5.cc: New file.
12837 * testsuite/script_test_5.sh: New file.
12838 * testsuite/script_test_5.t: New file.
12840 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
12842 * archive.cc (Archive::include_member): Update calls to add_symbols.
12843 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12844 the Layout argument.
12845 * dynobj.h (do_add_symbols): Add the Layout argument.
12846 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12848 * object.h (Object::add_symbols): Add the Layout argument.
12849 (Object::do_add_symbols): Add the Layout argument.
12850 (Sized_relobj::do_add_symbols): Add the Layout argument.
12851 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12852 Unify the two versions.
12853 (Add_plugin_symbols): Remove.
12854 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12855 (Sized_pluginobj::do_add_symbols): Unify the two versions.
12856 (Add_plugin_symbols): Remove.
12857 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12858 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12859 (Add_symbols::run): Make it work with Pulginobj.
12861 2009-02-06 Ian Lance Taylor <iant@google.com>
12863 * object.cc (Sized_relobj::do_layout): Make info message start
12864 with lower case letter.
12866 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
12868 * binary.cc: Fix file comment.
12870 * options.h (enum Incremental_disposition): Define.
12871 (class General_options): Add new options: --incremental,
12872 --incremental_changed, --incremental_unchanged,
12873 --incremental_unknown. Add incremental_disposition_ and
12874 implicit_incremental_ fields.
12875 (General_options::incremental_disposition): New function.
12876 (class Position_dependent_options): Add incremental_disposition
12878 (Position_dependent_options::copy_from_options): Set incremental
12880 * options.cc (General_options::parse_incremental_changed): New
12882 (General_options::parse_incremental_unchanged): New function.
12883 (General_options::parse_incremental_unknown): New function.
12884 (General_options::General_options): Initialize new fields
12885 incremental_disposition_ and implicit_incremental_.
12886 (General_options::finalize): Check for uasge of --incremental-*
12887 without --incremental.
12889 2009-02-06 Chris Demetriou <cgd@google.com>
12891 * gold.h (gold_undefined_symbol): Change to take only a Symbol
12892 pointer and to report location as the file name associated with
12894 (gold_undefined_symbol_at_location): New function to replace the
12895 old gold_undefined_symbol functionality.
12896 * target-reloc.h (relocate_section): Update to use
12897 gold_undefined_symbol_at_location.
12898 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12899 Call gold_undefined_symbol function rather than gold_error.
12900 * errors.h (Errors::undefined_symbol): Take location as a
12901 string, rather than calculating it from a relocation.
12902 * errors.cc (Errors::fatal): Print "fatal error:" before the
12904 (Errors::error, Errors::error_at_location): Print "error: "
12905 before the formatted message.
12906 (Errors::undefined_symbol): Take location as a string, rather
12907 than calculating it from a relocation.
12908 (gold_undefined_symbol_at_location): New function akin to
12909 old gold_undefined_symbol, calculates location from relocation.
12910 (gold_undefined_symbol): Change to take only a Symbol pointer
12911 and to report location as the file name associated with the symbol.
12912 * testsuite/debug_msg.sh: Update for changed error messages.
12913 * testsuite/undef_symbol.sh: Likewise.
12915 2009-02-04 Duncan Sands <baldrick@free.fr>
12918 * reduced_debug_output.h
12919 (Output_reduced_debug_abbrev_section::failed): Use format for
12921 (Output_reduced_debug_info_section::faild): Likewise.
12923 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
12925 * script.cc (Lazy_demangler): New class.
12926 (Version_script_info::get_symbol_version_helper): Demangle a
12929 2009-01-29 Cary Coutant <ccoutant@google.com>
12931 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12933 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12935 2009-01-28 Ian Lance Taylor <iant@google.com>
12937 * version.cc (version_string): Bump to 1.9.
12939 * gold.h: Include <cstring> and <stdint.h>.
12940 * version.cc: Include <cstdio>.
12941 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12943 * reduced_debug_output.cc (insert_into_vector): Rename from
12944 Insert_into_vector; change all callers. Use Swap_unaligned to
12945 avoid aliasing issue; remove union since it is unnecessary.
12947 2009-01-27 Sriraman Tallam <tmsriram@google.com>
12949 * Makefile.am (CCFILES): Add gc.cc.
12950 (HFILES): Add gc.h.
12951 * Makefile.in: Regenerate.
12952 * gold.cc (Gc_runner): New class.
12953 (queue_initial_tasks): Call garbage collection related tasks
12954 when corresponding options are invoked.
12955 (queue_middle_gc_tasks): New function.
12956 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12957 processed early before laying out sections during garbage collection.
12958 * gold.h (queue_middle_gc_tasks): New function.
12959 (is_prefix_of): Move from "layout.cc".
12960 * i386.cc (Target_i386::gc_process_relocs): New function.
12961 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12962 * main.cc (main): Create object of class "Garbage_collection".
12963 * object.cc (Relobj::copy_symbols_data): New function.
12964 (Relobj::is_section_name_included): New function.
12965 (Sized_relobj::do_layout): Allow this function to be called twice
12966 during garbage collection and defer layout of section during the
12968 * object.h (Relobj::get_symbols_data): New function.
12969 (Relobj::is_section_name_included): New function.
12970 (Relobj::copy_symbols_data): New function.
12971 (Relobj::set_symbols_data): New function.
12972 (Relobj::get_relocs_data): New function.
12973 (Relobj::set_relocs_data): New function.
12974 (Relobj::is_output_section_offset_invalid): New pure virtual function.
12975 (Relobj::gc_process_relocs): New function.
12976 (Relobj::do_gc_process_relocs): New pure virtual function.
12977 (Relobj::sd_): New data member.
12978 (Sized_relobj::is_output_section_offset_invalid): New function.
12979 (Sized_relobj::do_gc_process_relocs): New function.
12980 * options.h (General_options::gc_sections): Modify to not be a no-op.
12981 (General_options::print_gc_sections): New option.
12982 * plugin.cc (Plugin_finish::run): Remove function call to
12983 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
12984 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12985 * reloc.cc (Read_relocs::run): Add task to process relocs and
12986 determine unreferenced sections when doing garbage collection.
12987 (Gc_process_relocs): New class.
12988 (Sized_relobj::do_gc_process_relocs): New function.
12989 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12990 sections that are garbage collected.
12991 * reloc.h (Gc_process_relocs): New class.
12992 * sparc.cc (Target_sparc::gc_process_relocs): New function.
12993 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12994 symbols whose corresponding sections are garbage collected.
12995 (Symbol_table::Symbol_table): Add new parameter for the garbage
12997 (Symbol_table::gc_mark_undef_symbols): New function.
12998 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12999 (Symbol_table::gc_mark_dyn_syms): New function.
13000 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13002 (Symbol_table::add_from_object): Likewise.
13003 (Symbol_table::add_from_relobj): When building shared objects, do not
13004 treat externally visible symbols as garbage.
13005 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13006 table information for static and relocatable links.
13007 * symtab.h (Symbol_table::set_gc): New function.
13008 (Symbol_table::gc): New function.
13009 (Symbol_table::gc_mark_undef_symbols): New function.
13010 (Symbol_table::gc_mark_symbol_for_shlib): New function.
13011 (Symbol_table::gc_mark_dyn_syms): New function.
13012 (Symbol_table::gc_): New data member.
13013 * target.h (Sized_target::gc_process_relocs): New pure virtual
13015 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13016 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13018 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
13020 * options.h (General_options::gc_sections): Define as a no-op for now.
13021 (General_options::no_keep_memory): Ditto.
13022 (General_options::Bshareable): Define.
13023 * options.cc (General_options::finalize): Honor -Bshareable.
13025 2009-01-20 Andreas Schwab <schwab@suse.de>
13027 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13028 read the value in the contents, since we don't use it. Use the
13029 template endianness when writing.
13030 (Relocate::relocate): Use it for R_PPC_REL16_HA.
13032 2009-01-19 Andreas Schwab <schwab@suse.de>
13034 * configure.tgt (powerpc64-*): Fix targ_obj.
13036 2009-01-15 Ian Lance Taylor <iant@google.com>
13038 * object.cc (Sized_relobj::write_local_symbols): Don't write out
13039 local symbols when stripping all symbols.
13041 2009-01-14 Cary Coutant <ccoutant@google.com>
13043 * output.cc (Output_reloc): Add explicit instantiations.
13045 2009-01-14 Cary Coutant <ccoutant@google.com>
13047 * archive.cc (Archive::get_elf_object_for_member): Remove call
13048 to File_read::claim_for_plugin.
13049 * descriptors.cc (Descriptors::open): Remove reference to
13051 (Descriptors::claim_for_plugin): Remove.
13052 * descriptors.h (Descriptors::claim_for_plugin): Remove.
13053 (Descriptors::is_claimed): Remove.
13054 (claim_descriptor_for_plugin): Remove.
13055 * fileread.cc (File_read::claim_for_plugin): Remove.
13056 * fileread.h (File_read::claim_for_plugin): Remove.
13057 (File_read::descriptor): Reopen descriptor if necessary.
13058 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
13059 (Plugin_manager::all_symbols_read): Add task parameter. Change
13061 (Plugin_manager::get_input_file): New function.
13062 (Plugin_manager::release_input_file): New function.
13063 (Pluginobj::Pluginobj): Add filesize parameter and initialize
13064 corresponding data member.
13065 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13066 and pass to base constructor. Change all callers.
13067 (get_input_file, release_input_file): New functions.
13068 (make_sized_plugin_object): Add filesize parameter. Change all callers.
13069 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13070 (Plugin_manager::all_symbols_read): Add task parameter.
13071 (Plugin_manager::get_input_file): New function.
13072 (Plugin_manager::release_input_file): New function.
13073 (Plugin_manager::task_): New data member.
13074 (Pluginobj::Pluginobj): Add filesize parameter.
13075 (Pluginobj::filename): New function.
13076 (Pluginobj::descriptor): New function.
13077 (Pluginobj::filesize): New function.
13078 (Pluginobj::filesize_): New data member.
13079 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13080 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13081 File_read::claim_for_plugin; use Object::unlock to unlock the file.
13083 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13084 with archive libraries.
13085 * testsuite/Makefile.in: Regenerate.
13086 * testsuite/plugin_test.c (struct sym_info): New type.
13087 (get_input_file, release_input_file): New static variables.
13088 (onload): Capture new transfer vector entries.
13089 (claim_file_hook): Stop reading at end of file according to filesize.
13090 Factor out parsing of readelf output into separate function.
13091 (all_symbols_read_hook): Exercise get_input_file and release_input_file
13092 APIs and get the source file name from the symbol table. Convert
13093 source file name to corresponding object file name. Print info
13094 message when adding new input files.
13095 (parse_readelf_line): New function.
13096 * testsuite/plugin_test_1.sh: Add checks for new info messages.
13097 * testsuite/plugin_test_2.sh: Likewise.
13098 * testsuite/plugin_test_3.sh: Likewise.
13099 * testsuite/plugin_test_4.sh: New test case.
13101 2009-01-07 Ian Lance Taylor <iant@google.com>
13103 * version.cc (version_string): Bump to 1.8.
13105 2008-12-23 Cary Coutant <ccoutant@google.com>
13107 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13108 * plugin.cc (Plugin_manager::finish): Rename as
13109 layout_deferred_objects. Move cleanup to separate function.
13110 (Plugin_manager::cleanup): New function.
13111 (Plugin_finish::run): Call layout_deferred_objects and cleanup
13113 * plugin.h (Plugin_manager::finish): Rename as
13114 layout_deferred_objects.
13115 (Plugin_manager::cleanup): New function.
13116 (Plugin_manager::cleanup_done): New field.
13118 2008-12-23 Cary Coutant <ccoutant@google.com>
13120 * plugin.cc (is_visible_from_outside): New function.
13121 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13122 so we don't return "IR only" status for exported symbols or -r links.
13124 * testsuite/Makefile.am (plugin_test_3): New test case.
13125 * testsuite/Makefile.in: Regenerate.
13126 * testsuite/plugin_test_3.sh: New file.
13128 2008-12-22 Cary Coutant <ccoutant@google.com>
13130 * object.cc (Sized_relobj::layout_section): New function.
13131 (Sized_relobj::do_layout): Defer layout of input sections until after
13132 plugin has provided replacement files.
13133 (Sized_relobj::do_layout_deferred_sections): New function.
13134 * object.h (Relobj::set_section_offset): Remove virtual keyword.
13135 (Relobj::layout_deferred_sections): New function.
13136 (Relobj::do_layout_deferred_sections): New function.
13137 (Sized_relobj::do_layout_deferred_sections): New function.
13138 (Sized_relobj::layout_section): New function.
13139 (Sized_relobj::Deferred_layout): New structure.
13140 (Sized_relobj::deferred_layout_): New field.
13141 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13142 Change all callers. Layout deferred sections.
13143 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
13145 (Plugin_hook::run): Move code from do_plugin_hook inline.
13146 (Plugin_hook::do_plugin_hook): Remove.
13147 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13148 (Plugin_manager::finish): Renamed, was cleanup.
13149 (Plugin_manager::should_defer_layout): New function.
13150 (Plugin_manager::add_deferred_layout_object): New function.
13151 (Plugin_manager::Deferred_layout_list): New type.
13152 (Plugin_manager::deferred_layout_objects_): New field.
13153 (Plugin_hook::do_plugin_hook): Remove.
13155 2008-12-17 Ian Lance Taylor <iant@google.com>
13157 * options.h (class General_options): Add --no case for
13160 2008-12-16 Cary Coutant <ccoutant@google.com>
13162 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13164 (Plugin_manager::claim_file): Create plugin object even if
13165 plugin did not call the add_symbols callback.
13166 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13167 asking for more symbols than were added.
13168 * testsuite/Makefile.am (plugin_test_1): Add test case with
13170 (empty.syms): New target.
13171 * testsuite/Makefile.in: Regenerate.
13172 * testsuite/plugin_test.c (claim_file_hook): Add new debug
13173 message. Don't call add_symbols if no globals.
13174 (all_symbols_read_hook): Don't provide replacement for empty
13177 2008-12-12 Ian Lance Taylor <iant@google.com>
13179 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13180 r_type == 0 for a local symbol with r_sym == 0.
13181 (scan_relocatable_relocs): Pass r_sym to
13182 local_non_section_strategy.
13183 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13186 * configure.ac: Update test for TLS descriptors: they are
13187 supported as of glibc 2.9.
13188 * configure: Rebuild.
13190 2008-12-11 Ian Lance Taylor <iant@google.com>
13193 * target-reloc.h (Default_scan_relocatable_relocs): For each
13194 function, map r_type == 0 to RELOC_DISCARD.
13196 2008-12-10 Cary Coutant <ccoutant@google.com>
13198 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13199 object to override a kept COMDAT group from a plugin object.
13201 2008-12-09 Ian Lance Taylor <iant@google.com>
13204 * yyscript.y (file_cmd): Handle INPUT.
13206 * testsuite/initpri1.c: Change all declarations to be full
13207 prototypes by adding void, to avoid compiler warnings.
13209 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
13211 * options.cc (General_options::parse_plugin_opt): New.
13212 (General_options::add_plugin): The argument now is just the filename.
13213 (General_options::add_plugin_option): New.
13214 * options.h (plugin_opt): New.
13215 (add_plugin): Change argument name.
13216 (add_plugin_option): New.
13217 * plugin.cc (Plugin::load): Don't parse the plugin option.
13218 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13219 (Plugin::add_option): New.
13220 (Plugin::args_): Change type.
13221 (Plugin::filename_): New.
13222 (Plugin_manager::add_plugin_option): New.
13223 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13224 * testsuite/Makefile.in: Regenerate.
13226 2008-12-05 Cary Coutant <ccoutant@google.com>
13228 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13229 Handle --strip-lto-sections option.
13230 * options.h (strip_lto_sections): New option.
13232 2008-12-01 Cary Coutant <ccoutant@google.com>
13234 * plugin.cc (ld_plugin_message): Change format parameter to const.
13235 Fix mismatch between new[] and delete.
13237 2008-11-14 Cary Coutant <ccoutant@google.com>
13239 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13242 2008-11-05 Craig Silverstein <csilvers@google.com>
13244 * options.cc (General_options::parse_dynamic_list): New function.
13245 * options.h (General_options): New flags dynamic_list,
13246 dynamic_list_data, dynamic_list_cpp_new, and
13247 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
13248 (General_options::in_dynamic_list): New function.
13249 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13250 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13251 (Lex::can_continue_name): Likewise.
13253 (read_script_file): New parameter script_options.
13254 (read_dynamic_list): New function.
13255 (Script_options::define_dynamic_list): New function.
13256 (dynamic_list_keyword_parsecodes): New variable.
13257 (dynamic_list_keywords): New variable.
13258 * script.h (Script_options::define_dynamic_list): New function
13260 (read_dynamic_list): New function prototype.
13261 * symtab.cc (strprefix): New macro.
13262 (Symbol::should_add_dynsym_entry): Support dynamic_list,
13263 dynamic_list_data, dynamic_list_cpp_new, and
13264 dynamic_list_cpp_typeinfo.
13265 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13266 (dynamic_list_expr): New rule.
13267 (dynamic_list_nodes): Likewise.
13268 (dynamic_list_node): Likewise.
13269 * testsuite/Makefile.am (dynamic_list): New test.
13270 * testsuite/Makefile.in: Regenerated.
13271 * testsuite/dynamic_list.t: New file.
13272 * testsuite/dynamic_list.sh: New file.
13274 2008-11-05 Craig Silverstein <csilvers@google.com>
13276 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13277 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13278 (t11_last): Likewise.
13279 * testsuite/ver_test_6.c (main): Likewise.
13281 2008-10-07 Cary Coutant <ccoutant@google.com>
13283 * options.c (General_options::finalize): Add check for -static and
13285 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13288 2008-10-02 Cary Coutant <ccoutant@google.com>
13290 * plugin.cc (make_sized_plugin_object): Fix conditional
13291 compilation to work when not all targets are enabled.
13293 2008-09-29 Cary Coutant <ccoutant@google.com>
13295 * archive.cc (Archive::get_file_and_offset): Use filename instead
13296 of name to get library path.
13297 (Archive::include_member): Unlock external member of a thin archive.
13299 * testsuite/Makefile.am (TEST_AR): New variable.
13300 (thin_archive_test_1): New test.
13301 (thin_archive_test_2): New test.
13302 * testsuite/Makefile.in: Regenerate.
13303 * testsuite/thin_archive_main.cc: New file.
13304 * testsuite/thin_archive_test_1.cc: New file.
13305 * testsuite/thin_archive_test_2.cc: New file.
13306 * testsuite/thin_archive_test_3.cc: New file.
13307 * testsuite/thin_archive_test_4.cc: New file.
13309 2008-09-29 Cary Coutant <ccoutant@google.com>
13311 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13312 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13314 (Sized_relobj::do_finalize_local_symbols): Likewise.
13315 (Sized_relobj::map_to_kept_section): Likewise.
13316 * object.h (Sized_relobj::invalid_address): New constant.
13317 (Sized_relobj::do_output_section_offset): Check for invalid_address
13319 * output.cc (Output_reloc::local_section_offset): Use constant
13320 invalid_address instead of -1U.
13321 (Output_reloc::get_address): Likewise.
13322 (Output_section::output_address): Change -1U to -1ULL.
13323 * output.h (Output_reloc::invalid_address): New constant.
13324 * reloc.cc (Sized_relobj::write_sections): Use constant
13325 invalid_address instead of -1U.
13326 (Sized_relobj::relocate_sections): Likewise.
13327 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13328 values for merge sections.
13329 * target-reloc.h (relocate_for_relocatable): Use constant
13330 invalid_address instead of -1U.
13332 2008-09-19 Cary Coutant <ccoutant@google.com>
13334 Add plugin functionality for link-time optimization (LTO).
13335 * configure.ac (plugins): Add --enable-plugins option.
13336 * configure: Regenerate.
13337 * config.in: Regenerate.
13338 * Makefile.am (LIBDL): New variable.
13339 (CCFILES): Add plugin.cc.
13340 (HFILES): Add plugin.h.
13341 (ldadd_var): Add LIBDL.
13342 * Makefile.in: Regenerate.
13344 * archive.cc: Include "plugin.h".
13345 (Archive::setup): Don't preread archive symbols when using a plugin.
13346 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
13347 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13349 (Archive::include_member): Add symbols from plugin objects.
13350 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13351 * descriptors.cc (Descriptors::open): Check for file descriptors
13352 abandoned by plugins.
13353 (Descriptors::claim_for_plugin): New function.
13354 * descriptors.h (Descriptors::claim_for_plugin): New function.
13355 (Open_descriptor::is_claimed): New field.
13356 (claim_descriptor_for_plugin): New function.
13357 * fileread.cc (File_read::claim_for_plugin): New function.
13358 * fileread.h (File_read::claim_for_plugin): New function.
13359 (File_read::descriptor): New function.
13360 * gold.cc: Include "plugin.h".
13361 (queue_initial_tasks): Add task to call plugin hooks for generating
13363 * main.cc: Include "plugin.h".
13364 (main): Load plugin libraries.
13365 * object.h (Pluginobj): Declare.
13366 (Object::pluginobj): New function.
13367 (Object::do_pluginobj): New function.
13368 (Object::set_target): New function.
13369 * options.cc: Include "plugin.h".
13370 (General_options::parse_plugin): New function.
13371 (General_options::General_options): Initialize plugins_ field.
13372 (General_options::add_plugin): New function.
13373 * options.h (Plugin_manager): Declare.
13374 (General_options): Add --plugin option.
13375 (General_options::has_plugins): New function.
13376 (General_options::plugins): New function.
13377 (General_options::add_plugin): New function.
13378 (General_options::plugins_): New field.
13379 * plugin.cc: New file.
13380 * plugin.h: New file.
13381 * readsyms.cc: Include "plugin.h".
13382 (Read_symbols::do_read_symbols): Check for archive before checking
13383 for ELF file. Call plugin hooks to claim files.
13384 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13385 from a real object file; force override when processing replacement
13387 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13388 (Symbol::init_base_object): Likewise.
13389 (Symbol::init_base_output_data): Likewise.
13390 (Symbol::init_base_output_segment): Likewise.
13391 (Symbol::init_base_constant): Likewise.
13392 (Symbol::init_base_undefined): Likewise.
13393 (Symbol::output_section): Assert that object is not a plugin.
13394 (Symbol_table::add_from_pluginobj): New function.
13395 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13397 (Symbol_table::sized_write_globals): Likewise.
13398 (Symbol_table::add_from_pluginobj): Instantiate template.
13399 * symtab.h (Sized_pluginobj): Declare.
13400 (Symbol::in_real_elf): New function.
13401 (Symbol::set_in_real_elf): New function.
13402 (Symbol::in_real_elf_): New field.
13403 (Symbol_table::add_from_pluginobj): New function.
13405 * testsuite/Makefile.am (AM_CFLAGS): New variable.
13406 (LIBDL): New variable.
13407 (LDADD): Add LIBDL.
13408 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13409 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13410 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13411 (MOSTLYCLEANFILES): Likewise.
13412 * testsuite/Makefile.in: Regenerate.
13413 * testsuite/plugin_test.c: New file.
13414 * testsuite/plugin_test_1.sh: New file.
13415 * testsuite/plugin_test_2.sh: New file.
13417 2008-09-16 Ian Lance Taylor <iant@google.com>
13419 * target-reloc.h (relocate_section): Check whether a symbol is
13420 defined by the ABI before reporting an undefined symbol error.
13421 * target.h (Target::is_defined_by_abi): Make parameter const.
13422 (Target::do_is_defined_by_abi): Likewise.
13423 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13424 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13425 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13426 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13427 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13428 * testsuite/Makefile.in: Rebuild.
13430 * fileread.cc (make_view): Add casts to avoid warning.
13432 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13434 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13435 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13437 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13439 * options.h (General_options::output_is_executable): New.
13440 (General_options::output_is_pie): New.
13441 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13442 for shared libraries.
13443 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13445 2008-09-11 Chris Demetriou <cgd@google.com>
13447 * options.h (origin): New -z option.
13448 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13449 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13452 2008-09-05 Cary Coutant <ccoutant@google.com>
13454 * fileread.cc (File_read::make_view): Add check for attempt to map
13455 beyond end of file.
13457 2008-09-05 Cary Coutant <ccoutant@google.com>
13459 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13460 explicit instantiations.
13462 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
13465 * options.cc (General_options::finalize): Allow undefined symbols
13466 in shlibs if linking -shared.
13469 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13470 symbols as not needing a dynsym entry.
13472 2008-08-20 Craig Silverstein <csilvers@google.com>
13474 * fileread.cc (File_read::open): Do not lock the file unless it
13475 was successfully opened.
13477 2008-08-14 Cary Coutant <ccoutant@google.com>
13479 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13480 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13481 * testsuite/tls_test.cc (struct int128): 128-bit struct
13482 for testing TLS relocs with non-zero addend.
13483 (v12): New TLS variable.
13485 (t_last): Add check for v12.
13486 * testsuite/tls_test.h (t12): New function.
13487 * testsuite/tls_test_main.cc (thread_routine): Call new test.
13489 2008-08-13 Ian Lance Taylor <iant@google.com>
13491 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13492 set tls_segment_ or relro_segment_.
13493 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13495 * output.h (Output_section::clear_is_relro): New function.
13496 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13497 sections specially even when output_data_ is empty.
13498 (Output_segment::maximum_alignment): When first section is relro,
13499 only force alignment for PT_LOAD segments.
13500 * script.cc (script_data_segment_align): New function.
13501 (script_data_segment_relro_end): New function.
13502 * script-c.h (script_data_segment_align): Declare.
13503 (script_data_segment_relro_end): Declare.
13504 * script-sections.h (class Script_sections): Declare
13505 data_segment_align and data_segment_relro_end. Add fields
13506 segment_align_index_ and saw_relro_end_.
13507 * script-sections.cc (class Sections_element): Add set_is_relro
13508 virtual function. Add new bool* parameter to place_orphan_here.
13509 Add get_output_section virtual function.
13510 (class Output_section_definition): Add set_is_relro. Add new
13511 bool* parameter to place_orphan_here. Add get_output_section.
13512 Add is_relro_ field.
13513 (Output_section_definition::Output_section_definition): Initialize
13514 evaluated_address_, evaluated_load_address, evaluated_addralign_,
13515 and is_relro_ fields.
13516 (Output_section_definition::place_orphan_here): Add is_relro
13518 (Output_section_definition::set_section_addresses): Set relro for
13520 (Output_section_definition::alternate_constraint): Likewise.
13521 (class Orphan_output_section): Add new bool* parameter to
13522 place_orphan_here. Add get_output_section.
13523 (Orphan_output_section::place_orphan_here): Add is_relro
13525 (Script_sections::Script_sections): Initialize
13526 data_segment_align_index_ and saw_relro_end_.
13527 (Script_sections::data_segment_align): New function.
13528 (Script_sections::data_segment_relro_end): New function.
13529 (Script_sections::place_orphan): Set or clear is_relro.
13530 (Script_sections::set_section_addresses): Force alignment of first
13532 * yyscript.y (exp): Call script_data_segment_align and
13533 script_data_segment_relro_end.
13534 * testsuite/relro_script_test.t: New file.
13535 * testsuite/relro_test.cc (using_script): Declare.
13536 (t1, t2): Test using_script.
13537 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13538 (relro_script_test_SOURCES): Define.
13539 (relro_script_test_DEPENDENCIES): Define.
13540 (relro_script_test_LDFLAGS): Define.
13541 (relro_script_test_LDADD): Define.
13542 (relro_script_test.so): New target.
13543 * testsuite/Makefile.in: Rebuild.
13545 2008-08-06 Cary Coutant <ccoutant@google.com>
13547 * archive.cc (Archive::total_archives, Archive::total_members)
13548 (Archive::total_members_loaded): New variables.
13549 (Archive::setup): Add parameter. Add option to preread
13551 (Archive::read_armap): Add counter.
13552 (Archive::get_file_and_offset): New function.
13553 (Archive::get_elf_object_for_member): New function.
13554 (Archive::read_all_symbols): New function.
13555 (Archive::read_symbols): New function.
13556 (Archive::add_symbols): Add counters.
13557 (Archive::include_all_members): Use armap to find members if it's
13559 (Archive::include_member): Skip reading symbols if already read.
13560 Factored code into Archive::get_file_and_offset and
13561 Archive::get_elf_object_for_member. Changed call to
13562 Mapfile::report_include_archive_member.
13563 (Archive::print_stats): New function.
13564 * archive.h: Declare Object and Read_symbols_data classes.
13565 (Archive::Archive): Add initializers for new members.
13566 (Archive::setup): Add parameter.
13567 (Archive::print_stats): New function.
13568 (Archive::total_archives, Archive::total_members)
13569 (Archive::total_members_loaded): New variables.
13570 (Archive::get_file_and_offset): New function.
13571 (Archive::get_elf_object_for_member): New function.
13572 (Archive::read_all_symbols): New function.
13573 (Archive::read_symbols): New function.
13574 (Archive::Archive_member): New class.
13575 (Archive::members_): New member.
13576 (Archive::num_members_): New member.
13577 * main.cc: Include archive.h.
13578 (main): Call Archive::print_stats.
13579 * mapfile.cc (Mapfile::report_include_archive_member): Delete
13580 archive parameter; member_name is now the fully-decorated name.
13581 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13582 * options.h: (General_options): Add --preread-archive-symbols option.
13583 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13586 2008-08-04 Ian Lance Taylor <iant@google.com>
13588 * symtab.h (Symbol::use_plt_offset): New function.
13589 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13590 * powerpc.cc (Relocate::relocate): Likewise.
13591 * sparc.cc (Relocate::relocate): Likewise.
13592 * x86_64.cc (Relocate::relocate): Likewise.
13593 * testsuite/weak_plt.sh: New test.
13594 * testsuite/weak_plt_main.cc: New test.
13595 * testsuite/weak_plt_shared.cc: New test.
13596 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13597 (check_PROGRAMS): Add weak_plt.
13598 (check_DATA): Add weak_plt_shared.so.
13599 (weak_plt_main_pic.o, weak_plt): New targets.
13600 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13601 * testsuite/Makefile.in: Rebuild.
13603 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13605 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13606 * testsuite/Makefile.in: Rebuild.
13608 2008-08-04 Alan Modra <amodra@bigpond.net.au>
13610 * Makefile.am (POTFILES.in): Set LC_ALL=C.
13611 * Makefile.in: Regenerate.
13612 * po/POTFILES.in: Regenerate.
13614 2008-07-29 Ian Lance Taylor <iant@google.com>
13616 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13617 symbols before other symbols.
13618 * testsuite/script_test_2.cc (test_addr): Declare.
13619 (test_addr_alias): Declare.
13620 (main): Check that test_addr and test_addr_alias have the right
13622 * testsuite/script_test_2.t: Define test_addr_alias and
13625 2008-07-24 Ian Lance Taylor <iant@google.com>
13628 * descriptors.cc: New file.
13629 * descriptors.h: New file.
13630 * gold-threads.h (class Hold_optional_lock): New class.
13631 * fileread.cc: Include "descriptors.h".
13632 (File_read::~File_read): Release descriptor rather than closing
13634 (File_read::open) [file]: Call open_descriptor rather than open.
13635 Set is_descriptor_opened_.
13636 (File_read::open) [memory]: Assert that descriptor is not open.
13637 (File_read::reopen_descriptor): New function.
13638 (File_read::release): Release descriptor.
13639 (File_read::do_read): Make non-const. Reopen descriptor.
13640 (File_read::read): Make non-const.
13641 (File_read::make_view): Reopen descriptor.
13642 (File_read::do_readv): Likewise.
13643 * fileread.h (class File_read): Add is_descriptor_opened_ field.
13644 Update declarations.
13645 * layout.cc: Include "descriptors.h".
13646 (Layout::create_build_id): Use open_descriptor rather than open.
13647 * output.cc: Include "descriptors.h".
13648 (Output_file::open): Use open_descriptor rather than open.
13649 * archive.cc (Archive::const_iterator): Change Archive to be
13651 (Archive::begin, Archive::end): Make non-const.
13652 (Archive::count_members): Likewise.
13653 * archive.h (class Archive): Update declarations.
13654 * object.h (Object::read): Make non-const.
13655 * Makefile.am (CCFILES): Add descriptors.cc.
13656 (HFILES): Add descriptors.h.
13657 * Makefile.in: Rebuild.
13660 * gold.h: Always include <clocale>. Add Solaris workarounds
13661 following code in binutils/sysdep.h.
13664 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13665 this->eh_frame_hdr_ is NULL before using it.
13667 * dynobj.cc (Versions::Versions): Update comment.
13669 * dynobj.cc (Versions::Versions): If there is an soname, use it as
13670 the base version name.
13672 * stringpool.cc (Stringpool_template::add_with_length): Set key to
13673 array size plus one.
13674 (Stringpool_template::set_string_offsets): Subtract one from key
13675 before using it as an array index.
13676 (Stringpool_template::get_offset_with_length): Likewise.
13677 (Stringpool_template::write_to_buffer): Likewise.
13678 * stringpool.h (Stringpool_template::get_offset_from_key):
13681 2008-07-23 Ian Lance Taylor <iant@google.com>
13684 * object.h (Merged_symbol_value::value): Do our best to handle a
13688 * script.cc (Version_script_info::get_versions): Don't add empty
13689 version tag to return value.
13690 (Version_script_info::get_symbol_version_helper): Change return
13691 type to bool. Add pversion parameter. Change all callers.
13692 (script_register_vers_node): Don't require a non-NULL tag.
13693 * script.h (class Version_script_info): Update declarations.
13694 (Version_script_info::get_symbol_version): Change return type to
13695 bool. Add version parameter. Change all callers.
13696 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13697 handling. Handle an empty version from a version script.
13698 (Symbol_table::define_special_symbol): Likewise.
13699 * testsuite/ver_test_10.script: New file.
13700 * testsuite/ver_test_10.sh: New file.
13701 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13702 (check_DATA): Add ver_test_10.syms.
13703 (ver_test_10.syms, ver_test_10.so): New target.
13704 * testsuite/Makefile.in: Rebuild.
13706 2008-07-23 Simon Baldwin <simonb@google.com>
13708 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13709 to zero for undefined symbols from dynamic libraries.
13711 2008-07-23 Ian Lance Taylor <iant@google.com>
13713 * symtab.cc (Symbol_table::resolve): Remove version parameter.
13714 Change all callers.
13715 * symtab.h (class Symbol_table): Update declaration.
13716 * testsuite/ver_test_9.cc: New file.
13717 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13718 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13719 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13720 (ver_test_9.so, ver_test_9.o): New targets.
13721 * testsuite/Makefile.in: Rebuild.
13723 2008-07-22 Ian Lance Taylor <iant@google.com>
13725 * options.h (class General_options): Define --check-sections.
13726 * layout.cc (Layout::set_segment_offsets): Handle
13729 * options.h (class General_options): Define -n/--nmagic and
13731 * options.cc (General_options::finalize): For -n/--nmagic or
13732 -N/--omagic, set -static.
13733 * layout.cc (Layout::attach_allocated_section_to_segment): If
13734 -N/--omagic, don't put read-only and read-write sections in
13735 different segments.
13736 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13737 finding a read-only segment.
13738 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13739 don't set the minimum segment alignment to the common page size,
13740 and don't set the file offset to the address modulo the page size.
13741 * script-sections.cc (Script_sections::create_segments): If
13742 -n/--omagic, don't put read-only and read-write sections in
13743 different segments.
13745 * cref.cc: New file.
13746 * cref.h: New file.
13747 * options.h (class General_options): Add --print-symbol-counts.
13748 * main.cc (main): Issue defined symbol report if requested.
13749 * archive.cc (Archive::interpret_header): Make into a const member
13751 (Archive::add_symbols): Call Input_objects::archive_start and
13753 (Archive::const_iterator): Define new class.
13754 (Archive::begin, Archive::end): New functions.
13755 (Archive::include_all_members): Rewrite to use iterator.
13756 (Archive::count_members): New function.
13757 * archive.h (class Archive): Update declarations.
13758 (Archive::filename): New function.
13759 * object.cc: Include "cref.h".
13760 (Sized_relobj::Sized_relobj): Initialize defined_count_.
13761 (Sized_relobj::do_get_global_symbol_counts): New function.
13762 (Input_objects::add_object): Add object to cross-referencer.
13763 (Input_objects::archive_start): New function.
13764 (Input_objects::archive_stop): New function.
13765 (Input_objects::print_symbol_counts): New function.
13766 * object.h: Declare Cref and Archive.
13767 (Object::get_global_symbol_counts): New function.
13768 (Object::do_get_global_symbol_counts): New pure virtual function.
13769 (class Sized_relobj): Add defined_count_ field. Update
13771 (class Input_objects): Add cref_ field. Update constructor.
13772 Update declarations.
13773 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13775 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13777 (Sized_dynobj::do_get_global_symbol_counts): New function.
13778 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13779 defined_count_. Update declarations. Define Symbols typedef.
13780 * symtab.cc (Symbol_table::add_from_relobj): Add defined
13781 parameter. Change all callers.
13782 (Symbol_table::add_from_dynobj): Add sympointers and defined
13783 parameters. Change all callers.
13784 * symtab.h (class Symbol_table): Update declarations.
13785 * Makefile.am (CCFILES): Add cref.cc.
13786 (HFILES): Add cref.h.
13787 * Makefile.in: Rebuild.
13789 2008-07-22 Simon Baldwin <simonb@google.com>
13791 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13792 to zero when writing undefined symbols.
13794 2008-07-22 Ian Lance Taylor <iant@google.com>
13796 * output.cc (Output_section::add_input_section): Don't try to
13797 merge empty merge sections.
13799 2008-07-21 Craig Silverstein <csilvers@google.com>
13801 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13802 Include symbol version in error message.
13804 2008-07-20 Chris Demetriou <cgd@google.com>
13806 * configure.ac (gold_cv_c_random_seed): New configured variable.
13807 (RANDOM_SEED_CFLAGS): New substituted variable.
13808 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13809 * configure: Rebuild.
13810 * Makefile.in: Likewise.
13811 * testsuite/Makefile.in: Likewise.
13813 2008-07-18 Ian Lance Taylor <iant@google.com>
13815 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13816 where we see NAME/NULL and NAME/VERSION as separate symbols.
13817 * testsuite/ver_test_main.cc (main): Call t4.
13818 (t4, t4_2a): Define.
13819 * testsuite/ver_test_2.cc (t4_2): Define.
13820 * testsuite/ver_test_2.script: Put t4_2a in VER2.
13821 * testsuite/ver_test_4.cc (t4_2a): Define.
13822 * testsuite/ver_test_4.script: Put t4_2a in VER2.
13823 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13825 2008-07-17 Ian Lance Taylor <iant@google.com>
13827 * dynobj.cc (Versions::add_def): If we give an error about a
13828 missing version, go ahead and create the version anyhow.
13830 2008-07-10 Ian Lance Taylor <iant@google.com>
13832 Handle output sections with more than 0x7fffffff bytes.
13833 * object.h (class Relobj): Change map_to_output_ to
13834 output_sections_, and just keep a section pointer. Change all
13835 uses. Move comdat group support to Sized_relobj.
13836 (Relobj::is_section_specially_mapped): Remove.
13837 (Relobj::output_section): Remove poff parameter. Change all
13839 (Relobj::output_section_offset): New function.
13840 (Relobj::set_section_offset): Rewrite.
13841 (Relobj::map_to_output): Remove.
13842 (Relobj::output_sections): New function.
13843 (Relobj::do_output_section_offset): New pure virtual function.
13844 (Relobj::do_set_section_offset): Likewise.
13845 (class Sized_relobj): Add section_offsets_ field. Add comdat
13846 group support from Relobj. Update declarations.
13847 (Sized_relobj::get_output_section_offset): New function.
13848 (Sized_relobj::do_output_section_offset): New function.
13849 (Sized_relobj::do_set_section_offset): New function.
13850 * object.cc (Relobj::output_section_address): Remove.
13851 (Sized_relobj::Sized_relobj): Initialize new fields.
13852 (Sized_relobj::include_section_group): Cast find_kept_object to
13854 (Sized_relobj::include_linkonce_section): Likewise.
13855 (Sized_relobj::do_layout): Use separate arrays for output section
13857 (Sized_relobj::do_count_local_symbols): Change map_to_output to
13859 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13860 output_sections and section_offsets.
13861 (Sized_relobj::write_local_symbols): Likewise.
13862 (map_to_kept_section): Compute output address directly.
13863 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13864 output_sections and section_offsets.
13865 (Sized_relobj::write_sections): Likewise.
13866 (Sized_relobj::relocate_sections): Likewise.
13867 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13868 * output.h (class Output_reloc): Update declarations. Change
13869 u2_.relobj to Sized_relobj*.
13870 (class Output_data_reloc): Change add functions to use
13872 * output.cc (Output_reloc::Output_reloc): Change relobj to
13874 (Output_reloc::local_section_offset): Change return type to
13875 Elf_Addr. Use get_output_section_offset.
13876 (Output_reloc::get_address): Likewise.
13877 (Output_section::is_input_address_mapped): Don't call
13878 is_section_specially_mapped.
13879 (Output_section::output_offset): Likewise.
13880 (Output_section::output_address): Likewise.
13881 (Output_section::starting_output_address): Likewise.
13882 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13883 parameter to Sized_relobj*.
13884 (Copy_relocs::need_copy_reloc): Likewise.
13885 (Copy_relocs::save): Likewise.
13886 * copy-relocs.h (class Copy_relocs): Update declarations.
13887 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13888 Sized_relobj*. Change relobj_ field to Sized_relobj*.
13889 * target-reloc.h (relocate_for_relocatable): Change
13890 offset_in_output_section type to Elf_Addr. Change code that uses
13892 * layout.cc (Layout::layout): Always set *off.
13893 * mapfile.cc (Mapfile::print_input_section): Use
13894 output_section_offset.
13895 * i386.cc (Target_i386::copy_reloc): Change object parameter to
13897 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13898 * sparc.cc (Target_sparc::copy_reloc): Likewise.
13899 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13901 2008-07-03 Ian Lance Taylor <iant@google.com>
13903 * layout.cc (Layout::include_section): Do not discard unrecognized
13904 SHT_STRTAB sections.
13906 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
13908 * script.cc (Lex::can_continue_name): Make '?' allowable in
13909 version-script names.
13910 * testsuite/version_script.map: Change glob pattern to use '?'
13912 2008-06-30 Manish Singh <yosh@gimp.org>
13915 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13918 2008-06-30 Ian Lance Taylor <iant@google.com>
13922 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13923 versions]: Don't try to read the value in the contents, since we
13924 don't use it. Use the template endianness when writing.
13926 2008-06-25 Cary Coutant <ccoutant@google.com>
13928 * fileread.cc (File_read::make_view): Assert on zero-length view.
13929 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13930 symbol table when there are no symbols to read.
13932 2008-06-23 Craig Silverstein <csilvers@google.com>
13934 * version.cc (version_string): Bump to 1.7
13936 2008-06-18 Craig Silverstein <csilvers@google.com>
13938 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13939 constant 0xFFFF to type Valtype.
13940 (Powerpc_relocate_functions::rel16_ha): Likewise.
13942 2008-06-17 Ian Lance Taylor <iant@google.com>
13944 * output.h (Output_section::Input_section): Initialize p2align_ to
13945 zero for Output_section_data constructors.
13946 (Output_section::Input_section::addralign): If not an input
13947 section, return the alignment of the Output_section_data.
13948 * testsuite/copy_test.cc: New file.
13949 * testsuite/copy_test_1.cc: New file.
13950 * testsuite/copy_test_2.cc: New file.
13951 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13952 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13953 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13954 (copy_test_1_pic.o, copy_test_1.so): New targets.
13955 (copy_test_2_pic.o, copy_test_2.so): New targets.
13956 * testsuite/Makefile.in: Rebuild.
13958 * script-sections.cc (Script_sections::place_orphan): Initialize
13959 local variable exact.
13961 2008-06-13 David Edelsohn <edelsohn@gnu.org>
13963 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13965 2008-06-12 David Edelsohn <edelsohn@gnu.org>
13966 David S. Miller <davem@davemloft.net>
13968 * powerpc.cc: New file.
13969 * Makefile.am (TARGETSOURCES): Add powerpc.cc
13970 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13971 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13972 * Makefile.in: Rebuild.
13974 2008-06-09 Ian Lance Taylor <iant@google.com>
13976 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13978 (throwing, orig_terminate): New static variables.
13979 (terminate_handler): New static function.
13980 (t2): Set terminate handler.
13982 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
13985 * binary.cc (Binary_to_elf::sized_convert): Fix .data
13988 2008-05-30 Cary Coutant <ccoutant@google.com>
13990 * archive.cc (Archive::include_all_members) Correct to step
13991 over symbol table and extended name table in thin archives.
13993 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
13996 * target-reloc.h (relocate_for_relocatable): Fix new_offset
13999 2008-05-28 Caleb Howe <cshowe@google.com>
14001 * reduced_debug_output.cc: New file.
14002 * reduced_debug_output.h: New file.
14003 * options.h (class General_options): Add --strip-debug-non-line.
14004 * options.cc (General_options::finalize): Add strip_debug_non_line
14005 to the strip heirarchy.
14006 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14008 * layout.cc: Include "reduced_debug_output.h".
14009 (Layout::Layout): Initialize new fields.
14010 (line_only_debug_sections): New static array.
14011 (is_lines_only_debug_sections): New static inline function.
14012 (Layout::include_section): Handle --strip-debug-non-line.
14013 (Layout::make_output_section): If --strip-debug-non-line, build
14014 new output sections for .debug_abbrev and .debug_info.
14015 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14016 gold. Warn about possible overflow.
14017 (read_signed_LEB_128): Likewise.
14018 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14019 (read_signed_LEB_128): Declare.
14020 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14021 (HFILES): Add reduced_debug_output.h.
14022 * Makefile.in: Rebuild.
14024 2008-05-21 Ian Lance Taylor <iant@google.com>
14026 * mapfile.cc: New file.
14027 * mapfile.h: New file.
14028 * options.h (class General_options): Add -M/--print-map and -Map.
14029 * options.cc (General_options::finalize): Make -M equivalent to
14031 * main.cc: Include <cstdio> and "mapfile.h".
14032 (main): Open mapfile if requested.
14033 * gold.cc (class Middle_runner): Add mapfile_ field. Update
14034 constructor. Change caller.
14035 (queue_initial_tasks): Add mapfile parameter. Change caller.
14036 (queue_middle_tasks): Likewise.
14037 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14039 * archive.cc: Include "mapfile.h".
14040 (Archive::add_symbols): Add mapfile parameter. Change all
14041 callers. Pass mapfile, symbol, and reason to include_member.
14042 (Archive::include_all_members): Add mapfile parameter. Change all
14044 (Archive::include_member): Add mapfile, sym, and why parameters.
14045 Change all callers. Report inclusion to map file.
14046 * archive.h: Include "fileread.h".
14047 (class Archive): Update declarations.
14048 (Archive::file): New const method.
14049 (class Add_archive_symbols): Add mapfile_ field. Update
14050 constructor. Change all callers.
14051 * readsyms.h (class Read_symbols): Likewise.
14052 (class Finish_group): Likewise.
14053 (class Read_script): Likewise.
14054 * common.cc: Include "mapfile.h".
14055 (Symbol_table::allocate_commons): Add mapfile parameter. Change
14057 (Symbol_table::do_allocate_commons): Likewise.
14058 (Symbol_table::do_allocate_commons_list): Likewise. Report common
14059 symbol allocation to mapfile.
14060 * common.h (class Allocate_commons_task): Add mapfile_ field.
14061 Update constructor. Change all callers.
14062 * symtab.h (class Symbol_table): Update declarations.
14063 * layout.cc: Include "mapfile.h".
14064 (Layout_task_runner::run): Print information to mapfile.
14065 (Layout::create_gold_note): Change Output_data_fixed_space to
14066 Output_data_zero_fill.
14067 (Layout::create_build_id): Likewise.
14068 (Layout::print_to_mapfile): New function.
14069 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
14070 constructor. Change caller.
14071 (class Layout): Declare print_to_mapfile.
14072 * output.cc (Output_section::Input_section::print_to_mapfile): New
14074 (Output_section::add_input_section): If producing a map, always
14075 add to input_sections_ list.
14076 (Output_section::do_print_to_mapfile): New function.
14077 (Output_segment::print_sections_to_mapfile): New function.
14078 (Output_segment::print_section_list_to_mapfile): New function.
14079 * output.h: Include "mapfile.h".
14080 (Output_data::print_to_mapfile): New function.
14081 (Output_data::do_print_to_mapfile): New virtual function.
14082 (Output_segment_headers::do_print_to_mapfile): New function.
14083 (Output_file_header::do_print_to_mapfile): New function.
14084 (Output_data_const::do_print_to_mapfile): New function.
14085 (class Output_data_const_buffer): Add map_name_ field. Update
14086 constructor. Change all callers. Add do_print_to_mapfile
14088 (class Output_data_fixed_space): Likewise.
14089 (class Output_data_space): Likewise.
14090 (class Output_data_zero_fill): New class.
14091 (Output_data_strtab::do_print_to_mapfile): New function.
14092 (Output_data_reloc_base::do_print_to_mapfile): New function.
14093 (Output_relocatable_relocs::do_print_to_mapfile): New function.
14094 (Output_data_group::do_print_to_mapfile): New function.
14095 (Output_data_got::do_print_to_mapfile): New function.
14096 (Output_data_dynamic::do_print_to_mapfile): New function.
14097 (Output_symtab_xindex::do_print_to_mapfile): New function.
14098 (class Output_section): Declare do_print_to_mapflie. Declare
14099 print_to_mapfile in Input_section.
14100 (class Output_segment): Declare new functions.
14101 * object.h (Sized_relobj::symbol_count): New function.
14102 * script-sections.cc
14103 (Output_section_element_dot_assignment::set_section_addresses):
14104 Change Output_data_fixed_space to Output_data_zero_fill.
14105 (Output_data_expression::do_print_to_mapfile): New function.
14106 * script.cc (read_input_script): Add mapfile parameter. Change
14108 * script.h (read_input_script): Update declaration.
14109 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14110 (Eh_frame::do_print_to_mapfile): New function.
14111 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14112 (Output_merge_string::do_print_to_mapfile): New function.
14113 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14115 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14117 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14119 * Makefile.am (CCFILES): Add mapfile.cc.
14120 (HFILES): Add mapfile.h.
14121 * Makefile.in: Rebuild.
14123 2008-05-19 Ian Lance Taylor <iant@google.com>
14125 * options.h (class General_options): Add -z relro.
14126 * layout.cc (Layout::Layout): Initialize relro_segment_.
14127 (Layout::add_output_section_data): Return the output section.
14128 (Layout::make_output_section): Rcognize relro sections and mark
14129 them appropriately.
14130 (Layout::attach_allocated_section_to_segment): Put relro sections
14131 in a PT_GNU_RELRO segment.
14132 (Layout::create_initial_dynamic_sections): Mark the .dynamic
14134 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14136 (Layout::linkonce_mapping): Map d.rel.ro.local to
14137 .data.rel.ro.local.
14138 (Layout::output_section_name): Us .data.rel.ro.local for any
14139 section which begins with that.
14140 * layout.h (class Layout): Update add_output_section_data
14141 declaration. Add relro_segment_ field.
14142 * output.cc (Output_section::Output_section): Initialize is_relro_
14143 and is_relro_local_ fields.
14144 (Output_segment::add_output_section): Group relro sections.
14145 (Output_segment::is_first_section_relro): New function.
14146 (Output_segment::maximum_alignment): If there is a relro section,
14147 align the segment to the common page size.
14148 (Output_segment::set_section_addresses): Track whether we are
14149 looking at relro sections. If the last section is a relro
14150 section, align to the common page size.
14151 (Output_segment::set_section_list_addresses): Add in_relro
14152 parameter. Change all callers. Align to the page size when
14153 moving from relro to non-relro section.
14154 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14156 * output.h (class Output_section): Add is_relro_ and
14157 is_relro_local_ fields.
14158 (Output_section::is_relro): New function.
14159 (Output_section::set_is_relro): New function.
14160 (Output_section::is_relro_local): New function.
14161 (Output_section::set_is_relro_local): New function.
14162 (class Output_segment): Update declarations.
14163 * i386.cc (Target_i386::got_section): Mark .got section as relro.
14164 * sparc.cc (Target_sparc::got_section): Likewise.
14165 * x86_64.cc (Target_x86_64::got_section): Likewise.
14166 * testsuite/relro_test_main.cc: New file.
14167 * testsuite/relro_test.cc: New file.
14168 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14169 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14170 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14171 (relro_test.so, relro_test_pic.o): New targets.
14172 * testsuite/Makefile.in: Rebuild.
14174 2008-05-16 Ian Lance Taylor <iant@google.com>
14176 * output.cc (Output_segment::add_output_section): Remove front
14178 * output.h (class Output_segment): Remove
14179 add_initial_output_section and overloaded add_output_section.
14180 Update declaration of remaining add_output_section.
14181 * layout.cc (Layout::create_interp): Call add_output_section
14182 rather than add_initial_output_section.
14183 (Layout::finish_dynamic_section): Likewise.
14185 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14186 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
14187 know the dynamic type.
14188 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14189 field. Initialize it in constructor.
14190 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14191 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14192 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14195 * output.cc (Output_reloc::get_address): Change return type to
14197 * output.h (class Output_reloc): Update get_address declaration.
14198 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14199 for section addresses.
14201 2008-05-09 Ian Lance Taylor <iant@google.com>
14204 * gold.cc (gold_nomem): Use return value of write.
14206 2008-05-08 Ian Lance Taylor <iant@google.com>
14208 * symtab.c (Symbol::init_base_output_data): Add version
14209 parameter. Change all callers.
14210 (Symbol::init_base_output_segment): Likewise.
14211 (Symbol::init_base_constant): Likewise.
14212 (Symbol::init_base_undefined): Likewise.
14213 (Sized_symbol::init_output_data): Likewise.
14214 (Sized_symbol::init_output_segment): Likewise.
14215 (Sized_symbol::init_constant): Likewise.
14216 (Sized_symbol::init_undefined): Likewise.
14217 (Symbol_table::do_define_in_output_data): If the new symbol has a
14218 version, mark it as the default.
14219 (Symbol_table::do_define_in_output_segment): Likewise.
14220 (Symbol_table::do_define_as_constant): Likewise.
14221 * symtab.h (class Symbol): Update declarations.
14222 (class Sized_symbol): Likewise.
14223 * resolve.cc (Symbol::override_version): New function.
14224 (Symbol::override_base): Call override_version.
14225 (Symbol::override_base_with_special): Likewise.
14226 * testsuite/ver_script_8.script: New file.
14227 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14228 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14229 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14230 (ver_test_8_1.so, ver_test_8_2.so): New targets.
14232 2008-05-06 Ian Lance Taylor <iant@google.com>
14235 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14237 (class General_options): Remove existing --undefined, and add
14238 --no-undefined instead. Add new --undefined as synonym for -u.
14239 * archive.cc (Archive::add_symbols): Check whether symbol was
14241 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14242 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14243 all uses. Add IS_UNDEFINED. Update declarations to split
14244 different versions of init_base. Declare init_base_undefined.
14245 (Symbol::is_defined): Handle IS_UNDEFINED.
14246 (Symbol::is_undefined): Likewise.
14247 (Symbol::is_weak_undefined): Call is_undefined.
14248 (Symbol::is_absolute): Handle IS_CONSTANT.
14249 (class Sized_symbol): Update declarations to split different
14250 versions of init. Declare init_undefined.
14251 (class Symbol_table): Declare new functions.
14252 * symtab.cc (Symbol::init_base_object): Rename from init_base.
14253 Change all callers.
14254 (Symbol::init_base_output_data): Likewise.
14255 (Symbol::init_base_output_segment): Likewise.
14256 (Symbol::init_base_constant): Likewise.
14257 (Symbol::init_base_undefined): New function.
14258 (Sized_symbol::init_object): Rename from init. Change all
14260 (Sized_symbol::init_output_data): Likewise.
14261 (Sized_symbol::init_output_segment): Likewise.
14262 (Sized_symbol::init_constant): Likewise.
14263 (Sized_symbol::init_undefined): New function.
14264 (Symbol_table::add_undefined_symbols_from_command_line): New
14266 (Symbol_table::do_add_undefined_symbols_from_command_line): New
14268 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14269 (Symbol::output_section): Likewise.
14270 (Symbol::set_output_section): Likewise.
14271 (Symbol_table::sized_finalize_symbol): Likewise.
14272 (Symbol_table::sized_write_globals): Likewise.
14273 * resolve.cc (Symbol_table::should_override): Likewise.
14274 (Symbol::override_base_with_special): Likewise.
14276 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14277 symbol, change it to have default visibility.
14278 * testsuite/protected_1.cc: New file.
14279 * testsuite/protected_2.cc: New file.
14280 * testsuite/protected_3.cc: New file.
14281 * testsuite/protected_main_1.cc: New file.
14282 * testsuite/protected_main_2.cc: New file.
14283 * testsuite/protected_main_3.cc: New file.
14284 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14285 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14286 (protected_1_LDFLAGS, protected_1_LDADD): Define.
14287 (protected_1.so): New target.
14288 (protected_1_pic.o, protected_2_pic.o): New targets.
14289 (protected_3_pic.o): New target.
14290 (check_PROGRAMS): Add protected_2.
14291 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14292 (protected_2_LDFLAGS, protected_2_LDADD): Define.
14293 * testsuite/Makefile.in: Rebuild.
14295 * options.h (DEFINE_var): Add set_user_set_##varname__.
14296 (DEFINE_bool_alias): New macro.
14297 (class General_options): Define -Bstatic using DEFINE_bool_alias
14298 rather than DEFINE_special. Add --undefined as an alias for -z
14300 * options.cc (General_options::parse_Bstatic): Remove.
14302 * options.h (class General_options): Add --fatal-warnings.
14303 * main.cc (main): Implement --fatal-warnings.
14304 * errors.h (Errors::warning_count): New function.
14306 * options.h (class General_options): Add -Bsymbolic-functions.
14307 * symtab.h (Symbol::is_preemptible): Check for
14308 -Bsymbolic-functions.
14310 2008-05-05 Ian Lance Taylor <iant@google.com>
14312 * options.h (DEFINE_bool): For DASH_Z, create the negative option
14313 as noVARNAME rather than no-VARNAME.
14314 (class General_options): Add option -z combreloc.
14315 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14317 (Output_reloc::sort_before) [SHT_REL]: New function.
14318 (Output_reloc::sort_before) [SHT_RELA]: New function.
14319 (class Output_data_reloc_base): Add sort_relocs_ field. Define
14320 Sort_relocs_comparison.
14321 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14322 parameter. Change all callers.
14323 (Output_data_reloc::Output_data_reloc) [both versions]: Add
14324 sort_relocs parameter. Change all callers.
14325 * output.cc (Output_reloc::get_address): New function, broken out
14327 (Output_reloc::write_rel): Call it.
14328 (Output_reloc::compare): New function.
14329 (Output_data_reloc_base::do_write): Optionally sort relocs.
14331 * configure.ac: If targ_extra_obj is set, link it in.
14332 * configure.tgt: Initialize all variables.
14333 (x86_64*): Set targ_extra_obj and targ_extra_size.
14334 * configure: Rebuild.
14336 * object.cc (Sized_relobj::include_section_group): Adjust section
14337 indexes read from group data. Build vector to pass to
14339 * layout.cc (Layout::layout_group): Add flags and shndxes
14340 parameters. Remove contents parameter. Change caller. Update
14341 explicit instantiations.
14342 * layout.h (class Layout): Update layout_group declaration.
14343 * output.cc (Output_data_group::Output_data_group): Add flags and
14344 input_shndxes parameters. Remove contents parameter. Change
14346 (Output_data_group::do_write): Change input_sections_ to
14348 * output.h (class Output_data_group): Update constructor
14349 declaration. Rename input_sections_ to input_shndxes_.
14350 * testsuite/many_sections_test.cc: Add template.
14352 2008-04-30 Cary Coutant <ccoutant@google.com>
14354 * target-reloc.h (relocate_section): Fix dead-pointer bug.
14356 * layout.cc (Layout::include_section): Refactored check for debug
14358 (Layout::add_comdat): Add new parameters. Change type
14359 of signature parameter. Add object and shndx to signatures table.
14360 (Layout::find_kept_object): New function.
14361 * layout.h: Include <cstring>.
14362 (Layout::is_debug_info_section): New function.
14363 (Layout::add_comdat): Add new parameters.
14364 (Layout::find_kept_object): New function.
14365 (Layout::Kept_section): New struct.
14366 (Layout::Signatures): Change type of map range.
14367 * object.cc (Relobj::output_section_address): New function.
14368 (Sized_relobj::include_section_group): Add new parameters. Change
14369 calls to Layout::add_comdat. Change to build table of kept comdat
14370 groups and table mapping discarded sections to kept sections.
14371 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
14372 (Sized_relobj::do_layout): Change calls to include_section_group and
14373 include_linkonce_section.
14374 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14375 value to zero when section is discarded.
14376 (Sized_relobj::map_to_kept_section): New function.
14377 * object.h (Relobj::output_section_address): New function.
14378 (Relobj::Comdat_group): New type.
14379 (Relobj::find_comdat_group): New function.
14380 (Relobj::Comdat_group_table): New type.
14381 (Relobj::Kept_comdat_section): New type.
14382 (Relobj::Kept_comdat_section_table): New type.
14383 (Relobj::add_comdat_group): New function.
14384 (Relobj::set_kept_comdat_section): New function.
14385 (Relobj::get_kept_comdat_section): New function.
14386 (Relobj::comdat_groups_): New field.
14387 (Relobj::kept_comdat_sections_): New field.
14388 (Symbol_value::input_value): Update comment.
14389 (Sized_relobj::map_to_kept_section) New function.
14390 (Sized_relobj::include_linkonce_section): Add new parameter.
14391 * target-reloc.h (Comdat_behavior): New type.
14392 (get_comdat_behavior): New function.
14393 (relocate_section): Add code to map a discarded section to the
14394 corresponding kept section when applying a relocation.
14396 2008-04-30 Craig Silverstein <csilvers@google.com>
14398 * dwarf_reader.cc (next_generation_count): New static var.
14399 (Addr2line_cache_entry): New struct.
14400 (addr2line_cache): New static var.
14401 (Dwarf_line_info::one_addr2line): Added caching.
14402 (Dwarf_line_info::clear_addr2line_cache): New function.
14403 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14404 cache-size parameter.
14405 (Dwarf_line_info::one_addr2line_cache): New function.
14406 * symtab.cc (Symbol_table::detect_odr_violations): Pass
14407 new cache-size argument to one_addr2line(), and clear cache.
14409 2008-04-28 Cary Coutant <ccoutant@google.com>
14411 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14412 R_386_PC8 relocations.
14414 2008-04-23 Ian Lance Taylor <iant@google.com>
14416 * object.cc (Sized_relobj::include_section_group): Check for
14417 invalid section group.
14419 * object.cc (make_elf_object): Correct test for 64-bit ELF file
14422 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14423 than read for file header.
14424 * archive.cc (Archive::include_member): Likewise.
14426 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
14428 * aclocal.m4: Regenerate.
14429 * configure: Regenerate.
14431 2008-04-19 Ian Lance Taylor <iant@google.com>
14433 * version.cc (version_string): Bump to 1.6.
14435 * testsuite/Makefile.am (many_sections_r_test): New target.
14436 (many_sections_r_test_SOURCES): Remove.
14437 (many_sections_r_test_DEPENDENCIES): Remove.
14438 (many_sections_r_test_LDFLAGS): Remove.
14439 (many_sections_r_test_LDADD): Remove.
14441 * object.cc (Sized_relobj::do_add_symbols): Always pass
14442 local_symbol_count_ to add_from_relobj.
14444 * testsuite/Makefile.am (many_sections_check.h): Only check one in
14445 every thousand variables.
14446 * testsuite/Makefile.in: Rebuild.
14448 * object.cc (Xindex::initialize_symtab_xindex): New function.
14449 (Xindex::read_symtab_xindex): New function.
14450 (Xindex::sym_xindex_to_shndx): New function.
14451 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14453 (Sized_relobj::do_initialize_xindex): New function.
14454 (Sized_relobj::do_read_symbols): Adjust section links.
14455 (Sized_relobj::symbol_section_and_value): Add is_ordinary
14456 parameter. Change all callers.
14457 (Sized_relobj::include_section_group): Adjust section links and
14458 symbol section indexes.
14459 (Sized_relobj::do_layout): Adjust section links.
14460 (Sized_relobj::do_count_local_symbols): Adjust section links and
14461 symbol section indexes.
14462 (Sized_relobj::do_finalize_local_symbols): Distinguish between
14463 ordinary and special symbols.
14464 (Sized_relobj::write_local_symbols): Add symtab_xindex and
14465 dynsym_xindex parameters. Change all callers. Adjust section
14466 links. Use SHN_XINDEX when needed.
14467 (Sized_relobj::get_symbol_location_info): Adjust section links.
14468 Don't get fooled by special symbols.
14469 * object.h (class Xindex): Define.
14470 (class Object): Add xindex_ parameter. Declare virtual functoin
14471 do_initialize_xindex.
14472 (Object::adjust_sym_shndx): New function.
14473 (Object::set_xindex): New protected function.
14474 (class Symbol_value): Add is_ordinary_shndx_ field.
14475 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14476 (Symbol_value::value): Assert ordinary section.
14477 (Symbol_value::initialize_input_to_output_map): Likewise.
14478 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14479 Change all callers.
14480 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
14482 (class Sized_relobj): Update declarations.
14483 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14484 parameter. Change all callers.
14485 (Sized_relobj::adjust_shndx): New function.
14486 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14488 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14489 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
14490 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
14491 (Sized_dynobj::read_dynsym_section): Adjust section links.
14492 (Sized_dynobj::read_dynamic): Likewise.
14493 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
14495 (Sized_dynobj::do_initialize_xindex): New function.
14496 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
14497 do_initialize_xindex.
14498 (Sized_dynobj::adjust_shndx): New function.
14499 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14500 dynsym_xindex_ fields.
14501 (Layout::finalize): Add a call to set_section_indexes before
14502 creating the symtab sections.
14503 (Layout::set_section_indexes): Don't do anything if the section
14504 already has a section index.
14505 (Layout::create_symtab_sections): Add shnum parameter. Change
14506 caller. Create .symtab_shndx section if needed.
14507 (Layout::create_shdrs): Add shstrtab_section parameter. Change
14509 (Layout::allocated_output_section_count): New function.
14510 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14512 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14513 fields. Update declarations.
14514 (Layout::symtab_xindex): New function.
14515 (Layout::dynsym_xindex): New function.
14516 (class Write_symbols_task): Add layout_ field.
14517 (Write_symbols_task::Write_symbols_task): Add layout parameter.
14519 * output.cc (Output_section_headers::Output_section_headers): Add
14520 shstrtab_section parameter. Change all callers.
14521 (Output_section_headers::do_sized_write): Store overflow values
14522 for section count and section string table section index in
14523 section header zero.
14524 (Output_file_header::do_sized_write): Check for overflow of
14525 section count and section string table section index.
14526 (Output_symtab_xindex::do_write): New function.
14527 (Output_symtab_xindex::endian_do_write): New function.
14528 * output.h (class Output_section_headers): Add shstrtab_section_.
14529 Update declarations.
14530 (class Output_symtab_xindex): Define.
14531 (Output_section::has_out_shndx): New function.
14532 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14534 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14535 Change all callers.
14536 (Sized_symbol::init): Likewise.
14537 (Symbol::output_section): Check for ordinary symbol.
14538 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
14539 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
14541 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14542 Change all callers. Simplify handling of symbols from sections
14543 not included in the link.
14544 (Symbol_table::add_from_dynobj): Handle ordinary symbol
14546 (Weak_alias_sorter::operator()): Assert that symbols are
14548 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14550 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14551 parameters. Change all callers.
14552 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
14553 symbol distinction. Use SHN_XINDEX when needed.
14554 (Symbol_table::write_section_symbol): Add symtab_xindex
14555 parameter. Change all callers.
14556 (Symbol_table::sized_write_section_symbol): Likewise. Use
14557 SHN_XINDEX when needed.
14558 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
14560 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
14561 (Symbol::is_defined): Check is_ordinary.
14562 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14563 (Symbol::is_absolute, Symbol::is_common): Likewise.
14564 (class Sized_symbol): Update declarations.
14565 (class Symbol_table): Update declarations.
14566 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14567 parameters. Change all callers.
14568 (Sized_symbol::override): Likewise.
14569 (Symbol_table::override): Likewise.
14570 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
14571 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
14572 is_ordinary, and orig_st_shndx parameters. Change all callers.
14573 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14574 to be in an ordinary section.
14575 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14576 object and is_ordinary parameters. Change all callers.
14577 (Sized_dwarf_line_info::read_relocs): Add object parameter.
14578 Change all callers. Don't add undefined or non-ordinary symbols
14580 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14581 Change all callers.
14582 * dwarf_reader.h (class Sized_dwarf_line_info): Update
14584 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14585 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14586 (Sized_relobj::relocate_sections): Likewise.
14587 * target-reloc.h (scan_relocs): Adjust section symbol index.
14588 (scan_relocatable_relocs): Likewise.
14589 * i386.cc (Scan::local): Check for ordinary symbols.
14590 * sparc.cc (Scan::local): Likewise.
14591 * x86_64.cc (Scan::local): Likewise.
14592 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14593 to symbol_section_and_value.
14594 * testsuite/many_sections_test.cc: New file.
14595 * testsuite/Makefile.am (BUILT_SOURCES): Define.
14596 (check_PROGRAMS): Add many_sections_test.
14597 (many_sections_test_SOURCES): Define.
14598 (many_sections_test_DEPENDENCIES): Define.
14599 (many_sections_test_LDFLAGS): Define.
14600 (BUILT_SOURCES): Add many_sections_define.h.
14601 (many_sections_define.h): New target.
14602 (BUILT_SOURCES): Add many_sections_check.h.
14603 (many_sections_check.h): New target.
14604 (check_PROGRAMS): Add many_sections_r_test.
14605 (many_sections_r_test_SOURCES): Define.
14606 (many_sections_r_test_DEPENDENCIES): Define.
14607 (many_sections_r_test_LDFLAGS): Define.
14608 (many_sections_r_test_LDADD): Define.
14609 (many_sections_r_test.o): New target.
14610 * testsuite/Makefile.in: Rebuild.
14612 2008-04-17 Cary Coutant <ccoutant@google.com>
14614 * errors.cc (Errors::info): New function.
14615 (gold_info): New function.
14616 * errors.h (Errors::info): New function.
14617 * gold.h (gold_info): New function.
14618 * object.cc (Input_objects::add_object): Print trace output.
14619 * options.cc (options::parse_set): New function.
14620 (General_options::parse_wrap): Deleted.
14621 (General_options::General_options): Deleted initializer.
14622 * options.h (options::String_set): New typedef.
14623 (options::parse_set): New function.
14624 (DEFINE_set): New macro.
14625 (General_options::wrap): Changed to use DEFINE_set. Changed
14626 callers of any_wrap_symbols and is_wrap_symbol.
14627 (General_options::trace, General_options::trace_symbol):
14629 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14630 (General_options::wrap_symbols_): Deleted.
14631 * symtab.cc (Symbol_table::add_from_object): Print trace output.
14633 2008-04-17 David S. Miller <davem@davemloft.net>
14635 * options.cc (General_options::parse_V): New function.
14636 * options.h: Add entries for -V and -Qy.
14638 2008-04-17 Ian Lance Taylor <iant@google.com>
14640 * common.cc (Symbol_table::allocate_commons): Remove options
14641 parameter. Change caller.
14642 (Symbol_table::do_allocate_commons): Remove options parameter.
14643 Change caller. Just call do_allocate_commons_list twice.
14644 (Symbol_table::do_allocate_commons_list): New function, broken out
14645 of do_allocate_commons.
14646 * common.h (class Allocate_commons_task): Remove options_ field.
14647 Update constructor.
14648 * symtab.cc (Symbol_table::Symbol_table): Initialize
14650 (Symbol_table::add_from_object): Put TLS common symbols on
14652 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14653 which are IN_OUTPUT_DATA.
14654 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
14655 allocate_commons and do_allocate_commons declarations. Declare
14656 do_allocate_commons_list.
14657 * gold.cc (queue_middle_tasks): Update creation of
14658 Allocate_commons_task to not pass options.
14659 * testsuite/Makefile.am (INCLUDES): Add -I.. .
14660 (TLS_TEST_C_FLAGS): New variable.
14661 (tls_test_c_pic.o): New target.
14662 (tls_test_shared.so): Link in tls_test_c_pic.o.
14663 (tls_test_c_pic_ie.o): New target.
14664 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14665 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14666 (tls_test_c.o): New target.
14667 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14668 (tls_pic_test_LDADD): Likewise.
14669 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14670 (tls_shared_gd_to_ie_test_LDADD): Likewise.
14671 (tls_test_c_gnu2.o): New target.
14672 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14674 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14675 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14676 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14677 * testsuite/tls_test.cc: Include "config.h".
14678 (t_last): Call t11_last.
14679 * testsuite/tls_test.h (t11, t11_last): Declare.
14680 * testsuite/tls_test_c.c: New file.
14681 * testsuite/tls_test_main.cc (thread_routine): Call t11.
14682 * configure.ac: Check for OpenMP support.
14683 * configure, config.in, Makefile.in: Rebuild.
14684 * testsuite/Makefile.in: Rebuild.
14686 2008-04-16 Cary Coutant <ccoutant@google.com>
14688 * i386.cc (Target_i386::define_tls_base_symbol): New function.
14689 (Target_i386::tls_base_symbol_defined_): New field.
14690 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14691 (Target_i386::Scan::global): Likewise.
14692 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14693 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14694 (Target_x86_64::tls_base_symbol_defined_): New field.
14695 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14696 (Target_x86_64::Scan::global): Likewise.
14698 2008-04-16 Cary Coutant <ccoutant@google.com>
14700 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14701 (Symbol::needs_plt_entry): Allow weak undefined symbols.
14702 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14703 building shared libraries.
14704 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14705 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14706 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14707 * testsuite/Makefile.in: Rebuild.
14708 * testsuite/weak_undef.h: New file.
14709 * testsuite/weak_undef_file1.cc: Add extra test cases.
14710 * testsuite/weak_undef_file2.cc: Likewise.
14711 * testsuite/weak_undef_test.cc: Likewise.
14713 2008-04-16 David S. Miller <davem@davemloft.net>
14715 * sparc.cc (Target_sparc::Scan): Change from struct to class.
14716 Add issued_non_pic_error_ field. Declare check_non_pic.
14717 (Target_sparc::Scan::check_non_pic): New function.
14718 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14719 (Target_sparc::Scan::global): Likewise.
14721 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14722 * configure: Rebuild.
14724 * options.h (DEFINE_enable): New macro.
14725 (new_dtags): New enable option.
14726 (initfirst, interpose, loadfltr, nodefaultlib,
14727 nodelete, nodlopen, nodump): New -z options.
14728 * layout.cc (Layout:finish_dynamic_section): If new
14729 dtags enabled, emit DT_RUNPATH. Also, emit a
14730 DT_FLAGS_1 containing any specified -z flags.
14732 2008-04-16 Ian Lance Taylor <iant@google.com>
14734 * copy-relocs.cc: New file.
14735 * copy-relocs.h: New file.
14736 * reloc.cc: Remove Copy_relocs code.
14737 * reloc.h: Likewise.
14738 * reloc-types.h (struct Reloc_types) [both versions]: Add
14739 get_reloc_addend_noerror.
14740 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14741 variants of add_global which take an addend which must be zero.
14742 * i386.cc: Include "copy-relocs.h".
14743 (class Target_i386): Change type of copy_relocs_ to variable,
14744 update initializer.
14745 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14746 Change all callers.
14747 (Target_i386::do_finalize_sections): Change handling of
14749 * sparc.cc: Include "copy-relocs.h".
14750 (class Target_sparc): Change type of copy_relocs_ to variable,
14751 update initializer.
14752 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14753 Change all callers.
14754 (Target_sparc::do_finalize_sections): Change handling of
14756 * x86_64.cc: Include "copy-relocs.h".
14757 (class Target_x86_64): Change type of copy_relocs_ to variable,
14758 update initializer.
14759 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14760 class. Change all callers.
14761 (Target_x86_64::do_finalize_sections): Change handling of
14763 * Makefile.am (CCFILES): Add copy-relocs.cc.
14764 (HFILES): Add copy-relocs.h.
14766 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14768 * testsuite/script_test_4.sh: Permit leading zeroes.
14770 2008-04-15 Ian Lance Taylor <iant@google.com>
14772 * script-sections.cc (Script_sections::create_segments): Use
14773 header_size_adjustment even when there is enough room for the
14775 * testsuite/script_test_4.sh: New file.
14776 * testsuite/script_test_4.t: New file.
14777 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14778 (check_DATA): Add script_test_4.stdout.
14779 (MOSTLYCLEANFILES): Likewise.
14780 (script_test_4): New target.
14781 (script_test_4.stdout): New target.
14782 * testsuite/Makefile.in: Rebuild.
14784 * sparc.cc: Add definitions for Output_data_plt_sparc class
14787 2008-04-14 David S. Miller <davem@davemloft.net>
14789 * sparc.cc: New file.
14790 * Makefile.am (TARGETSOURCES): Add sparc.cc
14791 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14792 * configure.tgt: Document targ_extra_size and
14793 targ_extra_big_endian. Add entries for sparc-* and
14795 * configure.ac: Handle targ_extra_size and
14796 targ_extra_big_endian.
14797 * Makefile.in: Rebuild.
14798 * configure: Likewise.
14799 * po/POTFILES.in: Likewise.
14800 * po/gold.pot: Likewise.
14802 2008-04-14 Ian Lance Taylor <iant@google.com>
14804 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14805 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14806 in the name/type/flags to section mapping. Don't call
14807 allocate_output_section.
14808 (Layout::choose_output_section): Change parameter from adjust_name
14809 to is_input_section. Don't permit input sections after sections
14810 are attached to segments. Don't call allocate_output_section.
14811 (Layout::layout_eh_frame): Call update_flags_for_input_section,
14812 not write_enable_output_section.
14813 (Layout::make_output_section): Don't push to
14814 unattached_section_list_ nor call attach_to_segment. Call
14815 attach_section_to_segment if sections are attached.
14816 (Layout::attach_sections_to_segments): New function.
14817 (Layout::attach_section_to_segment): New function.
14818 (Layout::attach_allocated_section_to_segment): Rename from
14819 attach_to_segment. Remove flags parameter.
14820 (Layout::allocate_output_section): Remove function.
14821 (Layout::write_enable_output_section): Remove function.
14822 * layout.h (class Layout): Update for above changes. Add new
14823 field sections_are_attached_.
14824 * output.h (Output_section::update_flags_for_input_section): New
14826 * output.cc (Output_section::add_input_section): Call
14827 update_flags_for_input_section.
14828 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14830 2008-04-11 Cary Coutant <ccoutant@google.com>
14832 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14833 thought unnecessary.
14834 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14836 2008-04-11 Ian Lance Taylor <iant@google.com>
14838 * output.h (class Output_section_data): Remove inline definition
14840 * output.cc (Output_section_data::set_addralign): New function.
14842 2008-04-11 Cary Coutant <ccoutant@google.com>
14844 Add support for TLS descriptors for i386 and x86_64.
14845 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14846 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14847 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14849 (Target_i386::got_mod_index_entry): Remove unnecessary code.
14850 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14851 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
14853 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14854 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14855 Fix problem with initial-exec relocations.
14856 (Target_i386::Relocate::relocate_tls): Likewise.
14857 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14859 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14860 support for section-plus-offset dynamic table entries.
14861 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14862 (Output_data_dynamic::Dynamic_entry): Add support for
14863 section-plus-offset dynamic table entries.
14864 (Output_data_dynamic::Classification): Likewise.
14865 (Output_data_dynamic::classification_): Renamed offset_.
14866 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14867 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14868 (Target_x86_64::make_plt_section): New function.
14869 (Target_x86_64::reserve_tlsdesc_entries): New function.
14870 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14871 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14872 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14873 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14874 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14875 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14876 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14877 add extra PLT entry for TLS descriptors.
14878 (Output_data_plt_x86_64::got_): New field.
14879 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14880 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14882 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14884 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14885 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14886 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14887 R_386_TLS_DESC_CALL relocations.
14888 (Target_x86_64::Scan::global): Likewise.
14889 (Target_x86_64::do_finalize_sections): Add dynamic table entries
14890 for TLS descriptors.
14891 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14892 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14893 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14894 GD-to-IE relaxation.
14895 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14896 and TLS_DESCRIPTORS.
14897 * Makefile.in: Rebuild.
14898 * configure: Rebuild.
14899 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14900 (tls_test_shared2.so): New target.
14901 (tls_shared_gd_to_ie_test_SOURCES): New variable.
14902 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14903 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14904 (tls_shared_gd_to_ie_test_LDADD): New variable.
14905 (tls_shared_gnu2_gd_to_ie_test): New target.
14906 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14908 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14909 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14910 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14911 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14912 (tls_shared_gnu2_test): New target.
14913 (tls_test_gnu2_shared.so): New target.
14914 (tls_shared_gnu2_test_SOURCES): New variable.
14915 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14916 (tls_shared_gnu2_test_LDFLAGS): New variable.
14917 (tls_shared_gnu2_test_LDADD): New variable.
14918 * testsuite/Makefile.in: Rebuild.
14919 * testsuite/Makefile.
14921 2008-04-11 Ian Lance Taylor <iant@google.com>
14923 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14925 * testsuite/Makefile.in: Rebuild.
14927 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14929 * testsuite/script_test_2.cc (main): Adjust test.
14931 2008-04-11 David S. Miller <davem@davemloft.net>
14932 Ian Lance Taylor <iant@google.com>
14934 * options.h (General_options): Add entries for '-Y' and
14936 * options.cc (General_options:finalize): If -Y was used, add those
14937 entries to the library path instead of the default "/lib" and
14940 2008-04-11 David S. Miller <davem@davemloft.net>
14942 * testsuite/justsyms.t: Start at 0x100.
14943 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14944 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14946 * testsuite/script_test_2.cc: Adjust string and section length
14949 2008-04-09 Ian Lance Taylor <iant@google.com>
14952 * script-sections.cc (Sections_element::allocate_to_segment): Add
14954 (Output_section_definition::allocate_to_segment): Likewise.
14955 (Orphan_output_section::allocate_to_segment): Likewise.
14956 (Script_sections::attach_sections_using_phdrs_clause): Don't
14957 propagate non-PT_LOAD segments to orphan sections.
14958 * testsuite/Makefile.am (script_test_3.stdout): Generate using
14959 readelf rather than objdump.
14960 * testsuite/script_test_3.sh: Adjust accordingly. Test that
14961 .interp section and PT_INTERP segment are the same size.
14962 * testsuite/Makefile.in: Rebuild.
14964 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14965 aliases for symbols defined in the same object.
14966 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14967 (weak_alias_test_SOURCES): New variable.
14968 (weak_alias_test_DEPENDENCIES): New variable.
14969 (weak_alias_test_LDFLAGS): New variable.
14970 (weak_alias_test_LDADD): New variable.
14971 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14972 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14973 (weak_alias_test_3.o): New target.
14974 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14975 * testsuite/weak_alias_test_main.cc: New file.
14976 * testsuite/weak_alias_test_1.cc: New file.
14977 * testsuite/weak_alias_test_2.cc: New file.
14978 * testsuite/weak_alias_test_3.cc: New file.
14980 2008-04-08 Ian Lance Taylor <iant@google.com>
14982 * options.h (class General_options): Add --noinhibit-exec option.
14983 * main.cc (main): Check --noinhibit-exec.
14985 * options.h (class General_options): Define --wrap as a special
14986 option. Add wrap_symbols_ field.
14987 (General_options::any_wrap_symbols): New function.
14988 (General_options::is_wrap_symbol): New function.
14989 * options.cc (General_options::parse_wrap): New function.
14990 (General_options::General_options): Initialize wrap_symbols_.
14991 * symtab.cc (Symbol_table::wrap_symbol): New function.
14992 (Symbol_table::add_from_object): Handle --wrap.
14993 * symtab.h (class Symbol_table): Declare wrap_symbol.
14994 * target.h (Target::wrap_char): New function.
14995 (Target::Target_info): Add wrap_char field.
14996 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14997 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14998 * testsuite/testfile.cc (Target_test::test_target_info):
15001 * errors.cc (Errors::undefined_symbol): Mention symbol version if
15004 * layout.h (class Layout): Add added_eh_frame_data_ field.
15005 * layout.cc (Layout::Layout): Initialize new field.
15006 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15007 output section until we find a section we merged successfully.
15008 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15009 that the size be non-zero.
15011 * merge.cc (Object_merge_map::get_output_offset): Remove inline
15014 2008-04-08 Craig Silverstein <csilvers@google.com>
15016 * configure.ac: Export new conditional variable HAVE_ZLIB.
15017 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15019 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15020 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15022 2008-04-07 Ian Lance Taylor <iant@google.com>
15024 * version.cc (version_string): Set to "1.5".
15026 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15027 Add issued_non_pic_error_ field. Declare check_non_pic.
15028 (Target_x86_64::Scan::check_non_pic): New function.
15029 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15030 (Target_x86_64::Scan::global): Likewise.
15032 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15033 addend parameter. Change caller. Handle merge sections.
15034 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15035 Address to Addend. Don't add in the result of
15036 local_section_offset, pass down the addend and use the returned
15038 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15039 Update declarations of local_section_offset and symbol_value.
15040 * testsuite/two_file_test_1.cc (t18): New function.
15041 * testsuite/two_file_test_2.cc (f18): New function.
15042 * testsuite/two_file_test_main.cc (main): Call t18.
15043 * testsuite/two_file_test.h (t18, f18): Declare.
15045 * configure.ac: Don't test for objdump, c++filt, or readelf.
15046 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15048 (TEST_READELF): New variable.
15049 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15050 (check_PROGRAMS): Add two_file_strip_test.
15051 (two_file_strip_test): New target.
15052 (check_PROGRAMS): Add two_file_same_shared_strip_test.
15053 (two_file_same_shared_strip_test_SOURCES): New variable.
15054 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15055 (two_file_same_shared_strip_test_LDFLAGS): New variable.
15056 (two_file_same_shared_strip_test_LDADD): New variable.
15057 (two_file_shared_strip.so): New target.
15058 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15059 (ver_test_5.syms, ver_test_7.syms): Likewise.
15060 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15061 (strip_test_3.stdout): Use TEST_OBJDUMP.
15062 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15064 2008-04-04 Cary Coutant <ccoutant@google.com>
15066 * symtab.h (Symbol::is_weak_undefined): New function.
15067 (Symbol::is_strong_undefined): New function.
15068 (Symbol::is_absolute): New function.
15069 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15070 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15072 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15073 (weak_undef_test): New target.
15074 * testsuite/Makefile.in: Rebuild.
15075 * testsuite/weak_undef_file1.cc: New file.
15076 * testsuite/weak_undef_file2.cc: New file.
15077 * testsuite/weak_undef_test.cc: New file.
15079 2008-04-03 Craig Silverstein <csilvers@google.com>
15081 * compressed_output.h (class Output_compressed_section): Use
15083 * compressed_output.cc (zlib_compress): Use unsigned buffers,
15085 (zlib_compressed_suffix): Removed.
15086 (Output_compressed_section::set_final_data_size): Use unsigned
15088 * testsuite/Makefile.am (flagstest_compress_debug_sections):
15089 Fix linker invocation.
15090 (flagstest_o_specialfile_and_compress_debug_sections):
15092 * testsuite/Makefile.in: Regenerated.
15094 2008-04-02 David S. Miller <davem@davemloft.net>
15096 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15097 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15099 2008-04-02 Craig Silverstein <csilvers@google.com>
15103 2008-04-02 Ian Lance Taylor <iant@google.com>
15105 * fileread.cc (File_read::find_view): Add byteshift and vshifted
15106 parameters. Update for new key type to views_. Change all
15108 (File_read::read): Adjust for byteshift in returned view.
15109 (File_read::add_view): New function, broken out of
15110 find_and_make_view.
15111 (File_read::make_view): New function, broken out of
15112 find_and_make_view.
15113 (File_read::find_or_make_view): Add offset and aligned
15114 parameters. Rewrite accordingly. Change all callers.
15115 (File_read::get_view): Add offset and aligned parameters. Adjust
15116 for byteshift in return value.
15117 (File_read::get_lasting_view): Likewise.
15118 * fileread.h (class File_read): Update declarations.
15119 (class File_read::View): Add byteshift_ field. Add byteshift to
15120 constructor. Add byteshift method.
15121 * archive.h (Archive::clear_uncached_views): New function.
15122 (Archive::get_view): Add aligned parameter. Change all callers.
15123 * object.h (Object::get_view): Add aligned parameter. Change all
15125 (Object::get_lasting_view): Likewise.
15127 * fileread.cc (File_read::release): Don't call clear_views if
15128 there are multiple objects.
15129 * fileread.h (File_read::clear_uncached_views): New function.
15130 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15133 2008-03-31 Cary Coutant <ccoutant@google.com>
15135 Add thin archive support.
15136 * archive.cc (Archive::armagt): New const.
15137 (Archive::setup): Remove task parameter and calls to unlock.
15138 (Archive::unlock_nested_archives): New function.
15139 (Archive::read_header): Add nested_off parameter. Change
15141 (Archive::interpret_header): Likewise.
15142 (Archive::include_all_members): Change to handle thin
15144 (Archive::include_member): Likewise.
15145 * archive.h (Archive::Archive): Add new parameters and
15147 (Archive::armagt): New const.
15148 (Archive::setup): Remove task parameter.
15149 (Archive::unlock_nested_archives): New function.
15150 (Archive::read_header): Add nested_off parameter.
15151 (Archive::interpret_header): Likewise.
15152 (Archive::Nested_archive_table): New typedef.
15153 (Archive::is_thin_archive_): New field.
15154 (Archive::nested_archives_): New field.
15155 (Archive::options_): New field.
15156 (Archive::dirpath_): New field.
15157 (Archive::task_): New field.
15158 * readsyms.cc (Read_symbols::do_read_symbols): Add check
15159 for thin archives. Pass additional parameters to
15160 Archive::Archive. Unlock the archive file after calling
15163 2008-03-29 Ian Lance Taylor <iant@google.com>
15165 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15166 version symbol to be local.
15167 * testsuite/ver_test_4.sh: New file.
15168 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15169 (check_DATA): Add ver_test_4.syms.
15170 (ver_test_4.syms): New target.
15171 * testsuite/Makefile.in: Rebuild.
15174 (Output_section::Input_section_sort_entry::has_priority): New
15176 (Output_section::Input_section_sort_entry::match_file_name): New
15178 (Output_section::Input_section_sort_entry::match_section_name):
15180 (Output_section::Input_section_sort_entry::match_section_name_prefix):
15182 (Output_section::Input_section_sort_entry::match_section_file):
15184 (Output_section::Input_section_sort_compare::operator()): Rewrite
15185 using new Input_section_sort_entry functions. Sort crtbegin and
15186 crtend first. Sort sections with no priority before sections with
15188 * testsuite/initpri1.c (d3): Check j != 4.
15189 (cd5): New constructor/destructor function.
15190 (main): Check j != 2.
15192 * symtab.cc (Symbol_table::add_from_object): If we don't use the
15193 new symbol when resolving, don't call set_is_default.
15194 * testsuite/ver_test_7.cc: New file.
15195 * testsuite/ver_test_7.sh: New file.
15196 * testsuite/Makefile.am (ver_test_7.so): New target.
15197 (ver_test_7.o): New target.
15198 (check_SCRIPTS): Add ver_test_7.sh.
15199 (check_DATA): Add ver_test_7.syms.
15200 (ver_test_7.syms): New target.
15202 2008-03-28 Ian Lance Taylor <iant@google.com>
15204 * layout.cc (Layout::layout): If we see an input section with a
15205 name that needs sorting, set the must_sort flag for the output
15207 (Layout::make_output_section): If the name of the output section
15208 indicates that it might require sorting, set the may_sort flag.
15209 * output.h (Output_section::may_sort_attached_input_sections): New
15211 (Output_section::set_may_sort_attached_input_sections): New
15213 (Output_section::must_sort_attached_input_sections): New
15215 (Output_section::set_must_sort_attached_input_sections): New
15217 (class Output_section): Declare Input_section_sort_entry. Define
15218 Input_section_sort_compare. Declare
15219 sort_attached_input_sections. Add new fields:
15220 may_sort_attached_input_sections_,
15221 must_sort_attached_input_sections_,
15222 attached_input_sections_are_sorted_.
15223 * output.cc (Output_section::Output_section): Initialize new
15225 (Output_section::add_input_section): Add an entry to
15226 input_sections_ if may_sort or must_sort are true.
15227 (Output_section::set_final_data_size): Call
15228 sort_attached_input_sections if necessary.
15229 (Output_section::Input_section_sort_entry): Define new class.
15230 (Output_section::Input_section_sort_compare::operator()): New
15232 (Output_section::sort_attached_input_sections): New function.
15233 * configure.ac: Check whether the compiler supports constructor
15234 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
15235 * testsuite/initpri1.c: New file.
15236 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15237 CONSTRUCTOR_PRIORITY.
15238 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15239 (initpri1_LDFLAGS): New variable.
15240 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15242 2008-03-27 Ian Lance Taylor <iant@google.com>
15244 * common.cc (Sort_commons::operator): Correct sorting algorithm.
15245 * testsuite/common_test_1.c: New file.
15246 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15247 (common_test_1_SOURCES): New variable.
15248 (common_test_1_DEPENDENCIES): New variable.
15249 (common_test_1_LDFLAGS): New variable.
15251 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15252 and commons_ correctly when NAME/VERSION does not override
15254 * testsuite/ver_test_6.c: New file.
15255 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15256 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15257 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15259 2008-03-26 Ian Lance Taylor <iant@google.com>
15261 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15262 of an undefined symbol from a version script.
15263 * testsuite/Makefile.am (ver_test_5.so): New target.
15264 (ver_test_5.o): New target.
15265 (check_SCRIPTS): Add ver_test_5.sh.
15266 (check_DATA): Add ver_test_5.syms.
15267 (ver_test_5.syms): New target.
15268 * testsuite/ver_test_5.cc: New file.
15269 * testsuite/ver_test_5.script: New file.
15270 * testsuite/ver_test_5.sh: New file.
15271 * Makefile.in, testsuite/Makefile.in: Rebuild.
15274 Fix problems building gold with gcc 4.3.0.
15275 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15276 (gold_error_at_location, gold_warning_at_location): Use it.
15277 * configure.ac: Check whether we can compile and use a template
15278 function with a printf attribute.
15279 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15280 when jumping over bytes.
15281 * object.cc: Instantiate Object::read_section_data.
15282 * debug.h: Include <cstring>
15283 * dwarf_reader.cc: Include <algorithm>
15284 * main.cc: Include <cstring>.
15285 * options.cc: Include <cstring>.
15286 * output.cc: Include <cstring>.
15287 * script.cc: Include <cstring>.
15288 * script.h: Include <string>.
15289 * symtab.cc: Include <cstring> and <algorithm>.
15290 * target-select.cc: Include <cstring>.
15291 * version.cc: Include <string>.
15292 * testsuite/testmain.cc: Include <cstdlib>.
15293 * configure, config.in: Rebuild.
15295 2008-03-25 Ian Lance Taylor <iant@google.com>
15297 * options.cc: Include "../bfd/bfdver.h".
15298 (options::help): Print bug reporting address.
15300 * version.cc (print_version): Adjust output for current value of
15301 BFD_VERSION_STRING.
15305 * options.cc (options::help): Print list of supported targets.
15306 * target-select.h: Include <vector>.
15307 (class Target_selector): Make machine_, size_, and is_big_endian_
15308 fields const. Add bfd_name_ and instantiated_target_ fields.
15309 (Target_selector::Target_selector): Add bfd_name parameter.
15310 (Target_selector::recognize): Make non-virtual, call
15312 (Target_selector::recognize_by_name): Make non-virtual, call
15313 do_recognize_by_name.
15314 (Target_selector::supported_names): New function.
15315 (Target_selector::bfd_name): New function.
15316 (Target_selector::do_instantiate_target): New pure virtual
15318 (Target_selector::do_recognize): New virtual function.
15319 (Target_selector::do_recognize_by_name): New virtual function.
15320 (Target_selector::instantiate_target): New private function.
15321 (supported_target_names): Declare.
15322 * target-select.cc (Target_selector::Target_selector): Update for
15323 new parameter and fields.
15324 (select_target_by_name): Check that the name matches before
15325 calling recognize_by_name.
15326 (supported_target_names): New function.
15327 * i386.cc (class Target_selector_i386): Update Target_selector
15328 constructor call. Remove recognize and recognize_by_name. Add
15329 do_instantiate_target.
15330 * x86_64.cc (class Target_selector_x86_64): Likewise.
15331 * testsuite/testfile.cc (class Target_selector_test): Update for
15332 changes to Target_selector.
15334 * README: Rewrite, with some notes on unsupported features.
15336 2008-03-24 Cary Coutant <ccoutant@google.com>
15338 * i386.cc (Target_i386::Got_type): New enum declaration.
15339 (Target_i386::Scan::local): Updated callers of Output_data_got
15341 (Target_i386::Scan::global): Likewise.
15342 (Target_i386::Relocate::relocate): Likewise.
15343 (Target_i386::Relocate::relocate_tls): Likewise.
15344 * object.h (Got_offset_list): New class.
15345 (Sized_relobj::local_has_got_offset): Added got_type parameter.
15346 (Sized_relobj::local_got_offset): Likewise.
15347 (Sized_relobj::set_local_got_offset): Likewise.
15348 (Sized_relobj::local_has_tls_got_offset): Removed.
15349 (Sized_relobj::local_tls_got_offset): Removed.
15350 (Sized_relobj::set_local_tls_got_offset): Removed.
15351 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15352 * output.cc (Output_data_got::add_global): Added got_type parameter.
15353 (Output_data_got::add_global_with_rel): Likewise.
15354 (Output_data_got::add_global_with_rela): Likewise.
15355 (Output_data_got::add_global_pair_with_rel): New function.
15356 (Output_data_got::add_global_pair_with_rela): New function.
15357 (Output_data_got::add_local): Added got_type parameter.
15358 (Output_data_got::add_local_with_rel): Likewise.
15359 (Output_data_got::add_local_with_rela): Likewise.
15360 (Output_data_got::add_local_pair_with_rel): New function.
15361 (Output_data_got::add_local_pair_with_rela): New function.
15362 (Output_data_got::add_global_tls): Removed.
15363 (Output_data_got::add_global_tls_with_rel): Removed.
15364 (Output_data_got::add_global_tls_with_rela): Removed.
15365 (Output_data_got::add_local_tls): Removed.
15366 (Output_data_got::add_local_tls_with_rel): Removed.
15367 (Output_data_got::add_local_tls_with_rela): Removed.
15368 * output.h (Output_data_got::add_global): Added got_type parameter.
15369 (Output_data_got::add_global_with_rel): Likewise.
15370 (Output_data_got::add_global_with_rela): Likewise.
15371 (Output_data_got::add_global_pair_with_rel): New function.
15372 (Output_data_got::add_global_pair_with_rela): New function.
15373 (Output_data_got::add_local): Added got_type parameter.
15374 (Output_data_got::add_local_with_rel): Likewise.
15375 (Output_data_got::add_local_with_rela): Likewise.
15376 (Output_data_got::add_local_pair_with_rel): New function.
15377 (Output_data_got::add_local_pair_with_rela): New function.
15378 (Output_data_got::add_global_tls): Removed.
15379 (Output_data_got::add_global_tls_with_rel): Removed.
15380 (Output_data_got::add_global_tls_with_rela): Removed.
15381 (Output_data_got::add_local_tls): Removed.
15382 (Output_data_got::add_local_tls_with_rel): Removed.
15383 (Output_data_got::add_local_tls_with_rela): Removed.
15384 * resolve.cc (Symbol::override_base_with_special): Removed
15385 reference to has_got_offset_ field.
15386 * symtab.cc (Symbol::init_fields): Replaced initialization
15387 of got_offset_ with got_offsets_. Removed initialization
15389 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15390 (Symbol::got_offset): Likewise.
15391 (Symbol::set_got_offset): Likewise.
15392 (Symbol::has_tls_got_offset): Removed.
15393 (Symbol::tls_got_offset): Removed.
15394 (Symbol::set_tls_got_offset): Removed.
15395 (Symbol::got_offset_): Removed.
15396 (Symbol::tls_mod_got_offset_): Removed.
15397 (Symbol::tls_pair_got_offset_): Removed.
15398 (Symbol::got_offsets_): New field.
15399 (Symbol::has_got_offset): Removed.
15400 (Symbol::has_tls_mod_got_offset): Removed.
15401 (Symbol::has_tls_pair_got_offset): Removed.
15402 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15403 (Target_x86_64::Scan::local): Updated callers of Output_data_got
15405 (Target_x86_64::Scan::global): Likewise.
15406 (Target_x86_64::Relocate::relocate): Likewise.
15407 (Target_x86_64::Relocate::relocate_tls): Likewise.
15409 2008-03-25 Ben Elliston <bje@au.ibm.com>
15411 * yyscript.y: Fix spelling error in comment.
15413 2008-03-24 Ian Lance Taylor <iant@google.com>
15415 * options.h (class General_options): Define build_id option.
15416 * layout.h (class Layout): Declare write_build_id, create_note,
15417 create_build_id. Add build_id_note_ member.
15418 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15419 "libiberty.h", "md5.h", "sha1.h".
15420 (Layout::Layout): Initialize eh_frame_data_,
15421 eh_frame_hdr_section_, and build_id_note_.
15422 (Layout::finalize): Call create_build_id.
15423 (Layout::create_note): New function, broken out of
15424 Layout::create_gold_note.
15425 (Layout::create_gold_note): Call create_note.
15426 (Layout::create_build_id): New function.
15427 (Layout::write_build_id): New function.
15428 (Close_task_runner::run): Call write_build_id.
15430 * x86_64.cc: Correct license to GPLv3.
15432 2008-03-23 Ian Lance Taylor <iant@google.com>
15434 * options.cc: Include "demangle.h".
15435 (parse_optional_string): New function.
15436 (parse_long_option): Handle takes_optional_argument.
15437 (parse_short_option): Update dash_z initializer. Handle
15438 takes_optional_argument.
15439 (General_options::General_options): Initialize do_demangle_.
15440 (General_options::finalize): Set do_demangle_. Handle demangling
15442 * options.h (parse_optional_string): Declare.
15443 (struct One_option): Add optional_arg field. Update constructor.
15444 Update call constructor calls. Add takes_optional_argument
15446 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
15447 (DEFINE_optional_string): Define.
15448 (General_options::demangle): Change from DEFINE_bool to
15449 DEFINE_optional_string.
15450 (General_options::no_demangle): New function.
15451 (General_options::do_demangle): New function.
15452 (General_options::set_do_demangle): New function.
15453 (General_options::execstack_status_): Move definition to end of
15455 (General_options::static_): Likewise.
15456 (General_options::do_demangle_): New field.
15457 * object.cc (big_endian>::get_symbol_location_info): Call
15458 Options::do_demangle, not Options::demangle.
15459 * symtab.cc (demangle): Likewise.
15461 2008-03-22 Ian Lance Taylor <iant@google.com>
15463 * gold.h: Include <cstddef> and <sys/types.h>
15464 * options.h: Include <cstring>.
15466 2008-03-21 Ian Lance Taylor <iant@google.com>
15468 * Added source code to GNU binutils.
15470 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15472 Copying and distribution of this file, with or without modification,
15473 are permitted in any medium without royalty provided the copyright
15474 notice and this notice are preserved.
15480 version-control: never