1 2013-11-15 Alan Modra <amodra@gmail.com>
3 * powerpc.cc (Target_powerpc::glink_section): Provide non-const
5 (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
6 Only call ppc64_local_entry_offset for 64-bit. Restrict
7 symval_for_branch lookup to ELFv1.
8 (Stub_table::add_plt_call_entry): Use unsigned int off.
9 (Output_data_glink::Address, invalid_address): New.
10 (Output_data_glink::add_eh_frame): Move out of line. Add
12 (Output_data_glink::add_global_entry, find_global_entry,
13 global_entry_address): New functions.
14 (Output_data_glink::global_entry_stubs_, end_branch_table_,
15 ge_size): New variables.
16 (Output_data_glink::set_final_data_size): Add global entry
18 (Output_data_glink::do_write): Write global entry stubs.
19 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
20 parameter. Return true for ELFv2. Adjust callers.
21 (Target_powerpc::Scan::local, global): Restrict opd lookup to
22 ELFv1. Similarly for ifunc and dynamic relocation processing
23 specific to ELFv1. Recognize that symbols are defined on
24 their plt entries for ELFv2.
25 (Target_powerpc::symval_for_branch): Assert if called for
27 (Target_powerpc::Relocate::relocate): Use global entry plt
28 stub for symbol value if such exists on ELFv2.
29 (Target_powerpc::Relocate::relocate): Don't call
30 symval_for_branch when ELFv2. Do adjust for local entry
32 (Target_powerpc::do_dynsym_value): Set symbols to global entry
34 (Target_powerpc::do_plt_address_for_global): Similarly.
36 2013-11-14 Cary Coutant <ccoutant@google.com>
38 Revert patch -- this did not fix the problem, and there is
41 2013-11-14 Cary Coutant <ccoutant@google.com>
44 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
45 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
46 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
47 updating fde_offsets_.
48 (Eh_frame_hdr::lock_): New data member.
50 2013-11-14 Cary Coutant <ccoutant@google.com>
52 * dwp.cc (Dwo_file_entry): New type.
53 (File_list): Use Dwo_file_entry.
54 (Dwo_file::verify): New function.
55 (Dwo_file::verify_dwo_list): New function.
56 (Dwo_file::sized_verify_dwo_list): New function.
57 (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
59 (Dwp_options): New enum type.
60 (dwp_options): Add --verify-only.
63 * dwp.h (gold_info): Add declaration.
65 2013-11-14 Cary Coutant <ccoutant@google.com>
68 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
69 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
70 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
71 updating fde_offsets_.
72 (Eh_frame_hdr::lock_): New data member.
74 2013-11-06 Cary Coutant <ccoutant@google.com>
77 * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
78 before reloc sections.
80 2013-11-04 Alan Modra <amodra@gmail.com>
82 * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
83 (Symbol::needs_dynamic_reloc): Test new flag.
84 * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
85 (Target_powerpc::Scan::get_reference_flags): Add target param.
86 Return FUNC_DESC_ABI for 64-bit ELFv1.
87 (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
89 (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
90 (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
92 2013-10-31 Cary Coutant <ccoutant@google.com>
94 Restore support for dwp v2 DWARF package file format.
96 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
97 tu_length parameter. Adjust all callers.
98 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
99 * dwp.cc: Include dwarf.h.
100 (Section_bounds): New struct type.
101 (Unit_set): New struct type.
102 (Dwo_file::Dwo_file): Initialize new data member.
103 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
104 Combine and rename to...
105 (Dwo_file::read_unit_index): ...this.
106 (Dwo_file::sized_read_compunit_index)
107 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
108 (Dwo_file::sized_read_unit_index): ...this.
109 (Dwo_file::copy_section): Remove section_name, is_str_offsets
110 parameters; add section_id parameter.
111 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
112 (Dwo_file::add_unit_set): ...this.
113 (Dwo_file::shndx_map_): Remove.
114 (Dwo_file::sect_offsets_): New data member.
115 (Dwp_output_file::Dwp_output_file): Initialize new data members.
116 (Dwp_output_file::add_section): Rename to...
117 (Dwp_output_file::add_contribution): ...this.
118 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
119 (Dwp_output_file::add_tu_set): Likewise.
120 (Dwp_output_file::Contribution): New type.
121 (Dwp_output_file::Section::contributions): New data member.
122 (Dwp_output_file::Cu_or_tu_set): Remove.
123 (Dwp_output_file::Section::Section): New ctor.
124 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
125 (Dwp_output_file::Dwp_index::Section_table): New type.
126 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
127 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
129 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
130 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
131 (Dwp_output_file::Dwp_index::section_table): New member function.
132 (Dwp_output_file::Dwp_index::section_table_end): New member function.
133 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
134 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
135 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
136 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
137 (Dwp_output_file::Dwp_index::section_table_): New data member.
138 (Dwp_output_file::Dwp_index::section_mask_): New data member.
139 (Dwp_output_file::add_output_section): New member function.
140 (Dwp_output_file::write_new_section): New member function.
141 (Dwp_output_file::write_contributions): New member function.
142 (Dwp_output_file::section_id_map_): New data member.
143 (class Dwo_id_info_reader): Remove.
144 (class Unit_reader): New class.
145 (get_dwarf_section_name): New function.
146 (Dwo_file::read_executable): Adjust initializations of class data.
147 (Dwo_file::read): Add support for v2 package file format.
148 (Dwo_file::read_unit_index): Likewise.
149 (Dwo_file::sized_read_unit_index): Likewise.
150 (Dwo_file::copy_section): Likewise.
151 (Dwo_file::add_unit_set): Likewise.
152 (Dwp_output_file::add_output_section): Likewise.
153 (Dwp_output_file::add_contribution): Likewise.
154 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
156 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
158 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
160 (Dwp_output_file::initialize): Remove unused function.
161 (Dwp_output_file::finalize): Add support for v2 package file format.
162 (Dwp_output_file::write_index): Likewise.
163 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
166 2013-10-31 Cary Coutant <ccoutant@google.com>
168 * configure.ac: Fix check for -fmerge-constants.
169 * configure.ac: Regenerate.
171 2013-10-30 Roland McGrath <mcgrathr@google.com>
173 * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
174 Correct 9-byte nop sequence to match what the assembler generates.
176 2013-10-30 Alan Modra <amodra@gmail.com>
178 * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
179 ppc64_local_entry_offset, ppc64_local_entry_offset,
180 do_read_symbols): New functions.
181 (Powerpc_relobj::e_flags_, st_other_): New vars.
182 (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
183 (Powerpc_dynobj::abiversion, set_abiversion): New functions.
184 (Powerpc_relobj::e_flags_): New var.
185 (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
186 and adjust for ELFv2.
187 (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
188 (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
189 (Powerpc_dynobj::do_find_special_sections): Likewise.
190 (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
191 (Target_powerpc::Branch_info::make_stub): Adjust stub destination
192 to ELFv2 local entry.
193 (Target_powerpc::do_relax): No thread safe barriers needed for
195 (Output_data_plt_powerpc::initial_plt_entry_size_,
196 plt_entry_size): Delete. Replace all uses with
197 first_plt_entry_offset() and plt_entry_size().
198 (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
199 reserved_size parm. Update callers.
200 (Output_data_plt_powerpc::entry_count): Update.
201 (Output_data_plt_powerpc::first_plt_entry_offset): Make private
202 and use Target_powerpc::first_plt_entry_offset().
203 (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
204 rename to plt_entry_size.
205 (Output_data_plt_powerpc::add_ifunc_entry,
206 add_local_ifunc_entry): Adjust reloc for ELFv2.
207 (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
208 (glink_eh_frame_fde_64v2): New.
209 (Stub_table::plt_call_size): Support ELFv2 sizing.
210 (Output_data_glink::add_eh_frame): Use the new FDE.
211 (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
212 (Stub_table::do_write): Write ELFv2 stubs and glink.
213 (Target_powerpc::Relocate::relocate): Replaces nop after call
214 with ld 2,24(1) and adjust local offset destination for ELFv2.
216 2013-10-30 Alan Modra <amodra@gmail.com>
218 * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
219 (Target_powerpc::Scan::global, local): Likewise.
220 (Target_powerpc::Relocate::relocate): Likewise. Check for overflow
221 on all ppc64 @h and @ha relocs.
223 2013-10-14 Alan Modra <amodra@gmail.com>
225 * output.h (Output_data_got::add_constant): Tidy.
226 (Output_data_got::add_constant_pair): New function.
227 * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
228 methods used so as to first call reserve_ent().
230 2013-10-11 Roland McGrath <mcgrathr@google.com>
232 * powerpc.cc (Output_data_got_powerpc): Remove unused methods
233 add_got_entry and add_got_entry_pair.
235 * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
236 (HAVE_PUBNAMES): Likewise.
237 * configure: Regenerate.
239 * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
240 * testsuite/Makefile.in: Regenerate.
242 * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
243 Remove const from declaration.
244 * target.cc (Sized_target::do_adjust_elf_header): Update definition.
245 * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
246 * output.h (Output_file_header): Remove const from member target_
247 and corresponding constructor argument.
248 * output.cc (Output_file_header::Output_file_header): Update prototype.
249 (Output_file_header::do_sized_write): Use this->target_ in place
250 of parameters()->target().
252 * testsuite/undef_symbol.cc (Foo::get_a): New method.
254 * configure.ac (MERGE_CONSTANTS_FLAG): New check.
255 * configure: Regenerate.
256 * Makefile.in: Regenerate.
257 * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
258 * testsuite/merge_string_literals_2.c: Likewise.
259 * testsuite/Makefile.am
260 (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
261 (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
262 literal -fmerge-constants.
263 * testsuite/Makefile.in: Regenerate.
265 * i386.cc (Target_i386): Remove unused member dynbss_.
266 * arm.cc (Target_arm): Likewise.
267 * powerpc.cc (Target_powerpc): Likewise.
268 * sparc.cc (Target_sparc): Likewise.
269 * tilegx.cc (Target_tilegx): Likewise.
270 * x86_64.cc (Target_x86_64): Likewise.
271 * dwarf_reader.h (Dwarf_info_reader): Remove unused members
272 type_signature_, type_offset_.
273 * plugin.h (Plugin_hook): Remove unused member layout_.
274 * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
276 (Read_member): Remove unused members input_objects_, symtab_,
278 (Check_library): Remove unused member symtab_.
279 * archive.h (Lib_group): Remove unused member lib_.
280 * archive.cc (Lib_group::Lib_group): Update initializer.
281 * incremental.h (Incremental_binary): Remove unused member target_.
282 (Incremental_script_entry): Removed unused member script_.
283 * layout.h (Write_symbols_task): Remove unused member input_objects_.
284 * icf.h (Icf): Remove unused member num_tracked_relocs.
286 * gold-threads.h (Once): Conditionalize member was_run_lock_ on
287 [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
289 * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
291 * archive.h: Use struct rather than class for forward declaration
292 of Read_symbols_data.
294 2013-10-07 Cary Coutant <ccoutant@google.com>
297 * testsuite/Makefile.am (icf_test): Fix dependencies.
298 (icf_safe_test): Likewise.
299 (icf_safe_so_test): Likewise.
300 (large_symbol_alignment): Add empty _LDADD rule.
301 * testsuite/Makefile.in: Regenerate.
303 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
306 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
307 relocation for R_X86_64_32 on x32.
309 2013-08-27 Roland McGrath <mcgrathr@google.com>
311 * output.cc (Output_segment::set_section_addresses): Take new
312 Target* argument. If target->isolate_execinstr() and the segment
313 is executable and starts at a target->abi_pagesize() boundary,
314 pad its end out to a target->abi_pagesize() boundary with code fill.
315 * output.h (Output_segment::set_section_addresses): Update decl.
316 * layout.h (Layout::check_output_data_for_reset_values): Take new
317 argument RELAX_OUTPUTS.
318 (Layout): New member relax_output_list_.
319 (Layout::add_relax_output): New method.
320 * layout.cc (Layout::Layout): Update constructor.
321 (Layout::reset_relax_output): New method.
322 (Layout::clean_up_after_relaxation): Call it.
323 (Layout::prepare_for_relaxation): Update caller.
324 (Layout::set_segment_offsets): Update callers of set_section_addresses.
325 Call reset_relax_output before re-processing segments for
326 isolate_execinstr case.
327 (Layout::write_data): Handle relax_output_list_.
328 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
329 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
331 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
334 * object.h: Fix typos.
336 2013-08-16 Roland McGrath <mcgrathr@google.com>
338 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
339 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
341 2013-08-07 Cary Coutant <ccoutant@google.com>
343 Revert support for v2 DWP files:
345 2013-03-01 Cary Coutant <ccoutant@google.com>
347 Add dwp support for v2 DWARF package file format.
348 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
349 tu_length parameter. Adjust all callers.
350 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
351 * dwp.cc: Include dwarf.h.
352 (Section_bounds): New struct type.
353 (Unit_set): New struct type.
354 (Dwo_file::Dwo_file): Initialize new data member.
355 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
356 Combine and rename to...
357 (Dwo_file::read_unit_index): ...this.
358 (Dwo_file::sized_read_compunit_index)
359 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
360 (Dwo_file::sized_read_unit_index): ...this.
361 (Dwo_file::copy_section): Remove section_name, is_str_offsets
362 parameters; add section_id parameter.
363 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
364 (Dwo_file::add_unit_set): ...this.
365 (Dwo_file::shndx_map_): Remove.
366 (Dwo_file::sect_offsets_): New data member.
367 (Dwp_output_file::Dwp_output_file): Initialize new data members.
368 (Dwp_output_file::add_section): Rename to...
369 (Dwp_output_file::add_contribution): ...this.
370 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
371 (Dwp_output_file::add_tu_set): Likewise.
372 (Dwp_output_file::Contribution): New type.
373 (Dwp_output_file::Section::contributions): New data member.
374 (Dwp_output_file::Cu_or_tu_set): Remove.
375 (Dwp_output_file::Section::Section): New ctor.
376 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
377 (Dwp_output_file::Dwp_index::Section_table): New type.
378 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
379 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
381 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
382 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
383 (Dwp_output_file::Dwp_index::section_table): New member function.
384 (Dwp_output_file::Dwp_index::section_table_end): New member function.
385 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
386 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
387 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
388 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
389 (Dwp_output_file::Dwp_index::section_table_): New data member.
390 (Dwp_output_file::Dwp_index::section_mask_): New data member.
391 (Dwp_output_file::add_output_section): New member function.
392 (Dwp_output_file::write_new_section): New member function.
393 (Dwp_output_file::write_contributions): New member function.
394 (Dwp_output_file::section_id_map_): New data member.
395 (class Dwo_id_info_reader): Remove.
396 (class Unit_reader): New class.
397 (get_dwarf_section_name): New function.
398 (Dwo_file::read_executable): Adjust initializations of class data.
399 (Dwo_file::read): Add support for v2 package file format.
400 (Dwo_file::read_unit_index): Likewise.
401 (Dwo_file::sized_read_unit_index): Likewise.
402 (Dwo_file::copy_section): Likewise.
403 (Dwo_file::add_unit_set): Likewise.
404 (Dwp_output_file::add_output_section): Likewise.
405 (Dwp_output_file::add_contribution): Likewise.
406 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
408 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
410 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
412 (Dwp_output_file::initialize): Remove unused function.
413 (Dwp_output_file::finalize): Add support for v2 package file format.
414 (Dwp_output_file::write_index): Likewise.
415 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
418 2013-07-31 Cary Coutant <ccoutant@google.com>
420 * object.cc (Sized_relobj::do_output_section_address): New function.
421 (Sized_relobj): Instantiate explicitly.
422 * object.h (Object::output_section_address): New function.
423 (Object::do_output_section_address): New function.
424 (Sized_relobj::do_output_section_address): New function.
425 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
427 2013-07-30 Cary Coutant <ccoutant@google.com>
428 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
430 * parameters.cc (Parameters::entry): Return target-specific entry
432 * target.h (Target::entry_symbol_name): New function.
433 (Target_info::entry_symbol_name): New data member.
435 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
436 * i386.cc (Target_i386::i386_info): Likewise.
437 (Target_i386_nacl::i386_nacl_info): Likewise.
438 * sparc.cc (Target_sparc::sparc_info): Likewise.
439 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
440 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
441 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
442 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
444 2013-07-22 Sterling Augustine <saugustine@google.com>
446 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
447 Convert parameter shndx to local variable. Add parameters symtab
448 and symtab_size. Scan over section names. Find relocation
449 section corresponding to current section. Create and initialize
450 reloc_mapper_ and reloc_type_.
451 (Dwarf_pubnames_table::read_header): Add assertion. Change
452 unit_length to off_t. Initialize member unit_length_. Fill in field
454 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
455 Initialize new fields unit_length_ and cu_offset_.
456 (Dwarf_pubnames_table::read_section): Update prototype.
457 (Dwarf_pubnames_table::cu_offset): New member function.
458 (Dwarf_pubnames_table::subsection_size): Likewise.
459 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
461 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
462 member functions public.
463 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
464 Update comment. Rework logic. Move repeated parts to...
465 (Gdb_index_info_reader::read_pubtable): ...here. New function.
466 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
467 pubtypes_table_, and stmt_list_offset.
468 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
469 Gdb_index::find_pubtype_offset,
470 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
471 (Gdb_index::pubnames_read): Update prototype and rework logic.
472 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
474 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
475 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
476 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
477 Gdb_index::map_pubtable_to_dies):
479 (Gdb_index::pubnames_read): Update declaration.
480 (Gdb_index::Pubname_offset_map): New type.
481 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
482 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
483 Gdb_index::stmt_list_offset): Declare.
484 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
485 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
486 Gdb_index::pubtypes_offset_): Remove.
488 2013-07-19 Roland McGrath <mcgrathr@google.com>
490 * options.h (General_options): Add -Trodata-segment option.
491 * parameters.cc (Parameters::check_rodata_segment): New function.
492 (Parameters::set_target_once): Call it.
493 * parameters.h (Parameters): Declare it (private member function).
494 * layout.cc (load_seg_unusable_for_headers): New function, broken
495 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
496 then validate rodata segment rather than text segment.
497 (relaxation_loop_body): Call that.
498 (is_text_segment): New function. Don't admit a non-executable
499 segment if TARGET->isolate_execinstr().
500 (set_segment_offsets): Call it. Honor -Trodata-segment option.
502 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
505 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
506 * nacl.h (Sniff_file::View::View): Request aligned view.
508 2013-07-11 Cary Coutant <ccoutant@google.com>
510 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
511 correct BRLT entry size.
513 2013-07-03 Alan Modra <amodra@gmail.com>
515 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
518 2013-07-01 Cary Coutant <ccoutant@google.com>
520 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
522 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
523 (Dwarf_ranges_table::lookup_reloc): New function.
524 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
526 (Dwarf_ranges_table::lookup_reloc): New function.
527 (Dwarf_ranges_table::reloc_type_): New data member.
529 2013-06-27 Jing Yu <jingyu@google.com>
532 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
534 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
535 (Target_powerpc::do_relax): Call the above.
537 2013-06-27 Cary Coutant <ccoutant@google.com>
539 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
540 on garbage collected .opd section.
542 2013-06-27 Alan Modra <amodra@gmail.com>
544 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
546 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
547 (Target_powerpc::do_function_location): Likewise for loc->shndx.
549 2013-06-14 Cary Coutant <ccoutant@google.com>
551 * resolve.cc (Symbol::override_base): Don't override st_type
552 from plugin placeholder symbols.
553 (Symbol_table::resolve): Likewise.
554 (Symbol_table::should_override): Don't complain about TLS mismatch
555 if the TO symbol is a plugin placeholder.
556 * testsuite/Makefile.am (plugin_test_tls): New test.
557 * testsuite/Makefile.in: Regenerate.
558 * testsuite/plugin_test_tls.sh: New test script.
559 * testsuite/two_file_test_2_tls.cc: New test source.
560 * testsuite/two_file_test_tls.cc: New test source.
562 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
564 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
565 the maximum segment alignment is larger than the page size.
566 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
567 correctly aligns the symbols with large alignemnt.
568 * testsuite/Makefile.in: Regenerate.
569 * testsuite/large_symbol_alignment.cc: New file.
571 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
572 Sriraman Tallam <tmsriram@google.com>
574 * options.h (sort_section): New option.
575 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
576 Rename from Input_section_sort_section_name_special_ordering_compare.
577 (Input_section_sort_section_name_compare): New struct.
578 * output.cc (Output_section::Input_section_sort_section_name_compare::
579 operator()): New function.
580 (Output_section::sort_attached_input_sections): Use new sort function
581 for .text if --sort-section=name is specified.
582 * layout.cc (Layout::make_output_section):
583 Add sorting by name when --sort-section=name is specified.
584 * testsuite/Makefile.am (text_section_grouping): Test option
586 * testsuite/Makefile.in: Regenerate.
587 * testsuite/section_sorting_name.cc: New file.
588 * testsuite/section_sorting_name.sh: New file.
590 2013-05-21 Cary Coutant <ccoutant@google.com>
592 * symtab.h (Symbol::is_cxx_vtable): New function.
593 * target-reloc.h (relocate_section): Check for vtable symbol.
594 * testsuite/Makefile.am (missing_key_func.sh): New test case.
595 * testsuite/Makefile.in: Regenerate.
596 * testsuite/missing_key_func.cc: New test source.
597 * testsuite/missing_key_func.sh: New test script.
599 2013-05-21 Cary Coutant <ccoutant@google.com>
601 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
602 type of enclosing symbol.
603 (Relocate_info::location): Check symbol type when describing symbol.
604 * object.h (Symbol_location_info): Remove unused line_number;
605 add enclosing_symbol_type.
606 * testsuite/debug_msg.sh: Adjust expected output.
608 2013-05-13 Cary Coutant <ccoutant@google.com>
610 * configure.ac: Export DEFAULT_TARGET.
611 * configure: Regenerate.
612 * Makefile.in: Regenerate.
613 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
614 * testsuite/Makefile.in: Regenerate.
615 * testsuite/debug_msg.sh: Delete duplicate tests.
616 Don't check undef_int error message match for powerpc where the
617 source file and line number aren't available.
619 2013-05-10 Roland McGrath <mcgrathr@google.com>
621 * options.h (General_options): Add --rosegment-gap option.
622 * options.cc (finalize): --rosegment-gap implies --rosegment.
623 * layout.cc (set_segment_offsets): Let user option override
624 target->rosegment_gap().
626 2013-05-10 Roland McGrath <mcgrathr@google.com>
628 * options.h (General_options): Remove leading space from help
629 messages for -nostdlib and --rosegment.
631 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
634 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
636 2013-05-03 Alan Modra <amodra@gmail.com>
638 * merge.cc (Output_merge_string::do_add_input_section): Correct
639 scan for number of strings. Rename vars to avoid shadowing.
640 Include missing terminator in input_size_.
642 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
644 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
645 Restore empty string handling.
647 2013-05-01 Cary Coutant <ccoutant@google.com>
649 * stringpool.cc (Stringpool_template::new_key_offset): Fix
650 uninitialized warning.
652 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
654 * output.cc (Output_section::add_merge_input_section): Allow
655 to merge sections if the alignment is more than character size.
656 * merge.h (Output_merge_string::Output_merge_string): Remove
658 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
659 only not-null strings. Check the alignment of strings.
661 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
662 alignment as the argument.
663 (Stringpool_template<Stringpool_char>::addralign_): New class member.
664 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
665 Align non-zero length strings according to the addralign_.
666 (Stringpool_template<Stringpool_char>::set_string_offsets):
667 Updating offsets according to the given alignment.
668 * testsuite/Makefile.am (text_section_grouping): Test if string
669 literals are getting merged.
670 * testsuite/Makefile.in: Regenerate.
671 * testsuite/merge_string_literals_1.c: New file.
672 * testsuite/merge_string_literals_2.c: Ditto.
673 * testsuite/merge_string_literals.sh: Ditto.
675 2013-04-26 Ian Lance Taylor <iant@google.com>
677 * target-reloc.h (relocate_section): If the reloc offset is out of
678 range, pass VIEW as NULL to relocate.relocate.
679 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
680 * i386.cc (Target_i386::Relocate::relocate): Likewise.
681 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
682 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
683 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
684 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
686 2013-04-26 Geoff Pike <gpike@chromium.org>
688 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
689 * layout.cc (Hash_task): New class.
690 (Layout::queue_build_id_tasks): New function.
691 (Layout::write_build_id): Handle single-thread portion of build ID
692 computation. (In some cases, all of it is single-threaded.) Replace
693 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
694 functionality in fewer lines of code.
695 * layout.h (Layout::queue_build_id_tasks): New function declaration.
696 * options.h (General_options): make "--build-id" default to tree
697 rather than sha1. Add two new options related to --build-id=tree:
698 --build-id-chunk-size-for-treehash and
699 --build-id-min-file-size-for-treehash.
700 * Makefile.am: add testing of --build-id=tree and related new options
701 (these tests will be invoked by "make check").
702 * Makefile.in: Regenerate.
704 2013-04-25 Alan Modra <amodra@gmail.com>
706 * configure.tgt: Add powerpcle and powerpc64le.
708 2013-04-22 Alan Modra <amodra@gmail.com>
711 * layout.cc (Layout::segment_precedes): Allow more than one
712 segment with the same type and flags.
714 2013-04-15 Cary Coutant <ccoutant@google.com>
716 * layout.cc (Layout::set_relocatable_section_offsets): Don't
717 allocate space in file for BSS sections.
719 2013-04-15 Cary Coutant <ccoutant@google.com>
721 * script-sections.cc (Orphan_output_section): Reset address
722 to zero after each orphaned section for relocatable links.
724 2013-04-15 Cary Coutant <ccoutant@google.com>
726 * symtab.cc (Symbol_table::sized_write_globals): Subtract
727 section starting address for relocatable link.
728 * testsuite/Makefile.am (script_test_11): New test.
729 * testsuite/Makefile.in: Regenerate.
730 * testsuite/script_test_11.c: New source file.
731 * testsuite/script_test_11.t: New linker script.
733 2013-04-13 Alan Modra <amodra@gmail.com>
735 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
736 owner when sections are not adjacent and exceed group size.
737 (Target_powerpc::group_sections): Handle corner case.
738 (Target_powerpc::Branch_info::make_stub): Handle case where
739 stub table doesn't exist due to branches in non-exec sections.
740 (Target_powerpc::Relocate::relocate): Likewise.
742 2013-04-11 Alan Modra <amodra@gmail.com>
745 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
746 .branch_lt to match bfd ld. Adjust comments throughout file.
748 2013-04-04 Ian Lance Taylor <iant@google.com>
751 * object.cc (do_layout_deferred_sections): Handle .eh_frame
752 sections before checking whether they are included in the link.
754 2013-03-29 Sriraman Tallam <tmsriram@google.com>
756 * archive.cc (Archive::get_elf_object_for_member): Create the elf
757 object before calling the plugin claim_file handler. Pass the elf
758 object of the archive to the plugin. Delete the elf object if the
759 plugin claims the file.
761 2013-03-21 Alan Modra <amodra@gmail.com>
763 * layout.cc (Layout::set_segment_offsets): Accept writable .text
766 2013-03-21 Alan Modra <amodra@gmail.com>
768 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
770 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
771 uninitialized" warning.
773 2013-03-20 Alan Modra <amodra@gmail.com>
775 * symtab.h (Symbol::clear_version): New function.
776 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
777 is_needed by weak references. Clear version for symbols defined
778 in as-needed objects that are not needed.
780 2013-03-15 Alan Modra <amodra@gmail.com>
782 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
783 static and public. Add report_err param. Return false for data refs.
784 (Target_powerpc::rela_dyn_section): New overloaded function.
785 (Target_powerpc::plt_, iplt_): Elucidate.
786 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
787 (Output_data_plt_powerpc::do_write): Don't write .iplt.
788 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
789 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
790 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
791 push_branch and make_plt_entry for ifunc syms when
792 reloc_needs_plt_for_ifunc.
793 (Target_powerpc::Relocate::relocate): Don't use plt entry value
794 for ifunc unless reloc_needs_plt_for_ifunc.
796 2013-03-15 Alan Modra <amodra@gmail.com>
798 * gc.h (gc_process_relocs): Don't look through function descriptors.
799 * icf.cc (get_section_contents): Do so here instead.
801 2013-03-13 Alan Modra <amodra@gmail.com>
803 * powerpc.cc (is_branch_reloc): Forward declare.
804 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
805 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
806 false for 64-bit, true for 32-bit non-branch relocs.
807 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
808 * testsuite/Makefile.am (icf_test): Use linker map file instead of
810 (icf_safe_test): Generate linker map file as well as nm output.
811 (icf_safe_so_test): Likewise.
812 * testsuite/Makefile.in: Regenerate.
813 * testsuite/icf_test.sh: Parse linker map file to determine
815 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
816 * testsuite/icf_safe_so_test.sh: Likewise.
817 (X86_32_or_ARM_specific_safe_fold): Merge into..
818 (arch_specific_safe_fold): ..this.
819 (X86_64_specific_safe_fold): Delete unused function.
821 2013-03-12 Alan Modra <amodra@gmail.com>
823 * gc.h (gc_process_relocs): Look through function descriptors
824 to determine shndx, symvalue and addend used by ICF. Tidy
825 variable duplication.
827 2013-03-11 Alan Modra <amodra@gmail.com>
829 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
830 * layout.cc (Layout_task_runner::run): ..to here.
831 * symtab.h (struct Symbol_location): Extract from..
832 (class Symbol_table): ..here.
833 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
834 * target.h (class Target): Add function_location and
835 do_function_location functions.
836 (class Sized_target): Add do_function_location.
837 * object.h (class Sized_relobj_file): Move find_shdr..
838 (class Object): ..to here.
839 * object.cc: Likewise. Update to suit. Instantiate.
840 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
841 * powerpc.cc (class Powerpc_dynobj): New.
842 (Target_powerpc::do_function_location): New function.
843 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
844 (Powerpc_dynobj::do_read_symbols): New function.
845 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
847 2013-03-08 Ian Lance Taylor <iant@google.com>
849 * options.cc (General_options::string_to_object_format): Accept
852 2013-03-08 Alan Modra <amodra@gmail.com>
854 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
856 (struct Post_fde): Move definition to here..
857 * ehframe.cc (struct Post_fde): ..from here.
858 (Cie::write): Don't alloc Post_fde.
859 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
861 2013-03-07 Alan Modra <amodra@gmail.com>
863 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
864 relocation referencing .LC0.
865 * testsuite/discard_locals_test.sh: Remove FIXMEs.
867 2013-03-07 Alan Modra <amodra@gmail.com>
869 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
870 always_inline. Add assembly for powerpc to avoid GOT.
872 2013-03-07 Alan Modra <amodra@gmail.com>
874 * testsuite/script_test_10.sh: Don't test .bss section
877 2013-03-06 Alan Modra <amodra@gmail.com>
879 * powerpc.cc (class Powerpc_relobj): Move some member functions.
880 (Target_powerpc::symval_for_branch): Add symtab param. Update
881 all callers. Handle folded sections.
882 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
884 (Global_symbol_visitor_opd::operator()): Likewise.
886 2013-03-04 Alan Modra <amodra@gmail.com>
888 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
889 * testsuite/Makefile.in: Regenerate.
891 2013-03-01 Cary Coutant <ccoutant@google.com>
893 Add dwp support for v2 DWARF package file format.
894 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
895 tu_length parameter. Adjust all callers.
896 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
897 * dwp.cc: Include dwarf.h.
898 (Section_bounds): New struct type.
899 (Unit_set): New struct type.
900 (Dwo_file::Dwo_file): Initialize new data member.
901 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
902 Combine and rename to...
903 (Dwo_file::read_unit_index): ...this.
904 (Dwo_file::sized_read_compunit_index)
905 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
906 (Dwo_file::sized_read_unit_index): ...this.
907 (Dwo_file::copy_section): Remove section_name, is_str_offsets
908 parameters; add section_id parameter.
909 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
910 (Dwo_file::add_unit_set): ...this.
911 (Dwo_file::shndx_map_): Remove.
912 (Dwo_file::sect_offsets_): New data member.
913 (Dwp_output_file::Dwp_output_file): Initialize new data members.
914 (Dwp_output_file::add_section): Rename to...
915 (Dwp_output_file::add_contribution): ...this.
916 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
917 (Dwp_output_file::add_tu_set): Likewise.
918 (Dwp_output_file::Contribution): New type.
919 (Dwp_output_file::Section::contributions): New data member.
920 (Dwp_output_file::Cu_or_tu_set): Remove.
921 (Dwp_output_file::Section::Section): New ctor.
922 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
923 (Dwp_output_file::Dwp_index::Section_table): New type.
924 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
925 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
927 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
928 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
929 (Dwp_output_file::Dwp_index::section_table): New member function.
930 (Dwp_output_file::Dwp_index::section_table_end): New member function.
931 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
932 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
933 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
934 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
935 (Dwp_output_file::Dwp_index::section_table_): New data member.
936 (Dwp_output_file::Dwp_index::section_mask_): New data member.
937 (Dwp_output_file::add_output_section): New member function.
938 (Dwp_output_file::write_new_section): New member function.
939 (Dwp_output_file::write_contributions): New member function.
940 (Dwp_output_file::section_id_map_): New data member.
941 (class Dwo_id_info_reader): Remove.
942 (class Unit_reader): New class.
943 (get_dwarf_section_name): New function.
944 (Dwo_file::read_executable): Adjust initializations of class data.
945 (Dwo_file::read): Add support for v2 package file format.
946 (Dwo_file::read_unit_index): Likewise.
947 (Dwo_file::sized_read_unit_index): Likewise.
948 (Dwo_file::copy_section): Likewise.
949 (Dwo_file::add_unit_set): Likewise.
950 (Dwp_output_file::add_output_section): Likewise.
951 (Dwp_output_file::add_contribution): Likewise.
952 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
954 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
956 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
958 (Dwp_output_file::initialize): Remove unused function.
959 (Dwp_output_file::finalize): Add support for v2 package file format.
960 (Dwp_output_file::write_index): Likewise.
961 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
964 2013-03-01 Cary Coutant <ccoutant@google.com>
966 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
967 function into class definition in header file.
968 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
969 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
971 (Dwarf_info_reader::check_buffer): Move here from .cc file.
973 2013-02-28 Alan Modra <amodra@gmail.com>
975 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
976 * target.cc (Target::do_plt_fde_location): New function.
977 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
978 accessor function, and constructor param.
979 (struct Post_fde, Post_fdes): Declare.
980 (Cie::write): Add post_fdes param.
981 * ehframe.cc (Fde::write): Use plt_fde_location.
982 (struct Post_fde): Define.
983 (Cie::write): Stash FDEs added post merge mapping.
984 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
985 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
986 (Eh_frame::do_sized_write): Arrange to write post map FDES after
988 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
989 (Target_powerpc::has_glink): New function.
990 (Target_powerpc::do_relax): Add eh_frame info for stubs.
991 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
992 glink_eh_frame_fde_32, default_fde): New data.
993 (Stub_table::eh_frame_added_): New var.
994 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
996 (Stub_table::add_eh_frame): New function.
997 (Output_data_glink::add_eh_frame): New function.
998 (Target_powerpc::make_glink_section): Call add_eh_frame.
1000 2013-02-15 Ian Lance Taylor <iant@google.com>
1002 * options.h (DEFINE_uint64_alias): Define.
1003 (class General_options): Add -Ttext-segment as an alias for
1006 2013-02-15 Alan Modra <amodra@gmail.com>
1008 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1009 (Stub_table::do_write): ..here, two places.
1010 (Stub_table::plt_call_size): Use it here too.
1012 2013-02-11 Ian Lance Taylor <iant@google.com>
1014 * descriptors.cc (Descriptors::close_all): New function.
1015 * descriptors.h (class Descriptors): Declare close_all.
1016 (close_all_descriptors): New inline function.
1017 * plugin.cc: Include "descriptors.h".
1018 (Plugin_manager::cleanup): Call close_all_descriptors.
1020 2013-02-06 Alan Modra <amodra@gmail.com>
1022 * README: Update coding style link.
1024 2013-01-28 Cary Coutant <ccoutant@google.com>
1026 * dwp.cc (File_list): New typedef.
1027 (Dwo_name_info_reader): New class.
1028 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1029 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1030 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1031 (Dwo_file::read_executable): New function.
1032 (Dwo_file::read): Move common setup code to ...
1033 (Dwo_file::make_object): ... here.
1034 (dwp_options): Add --exec/-e.
1038 2013-01-24 Sriraman Tallam <tmsriram@google.com>
1040 * layout.cc (Layout::layout): Check for option text_reorder.
1041 (Layout::make_output_section): Ditto.
1042 * options.h (text_reorder): New option.
1043 * output.cc (Input_section_sort_compare): Remove special ordering
1046 Input_section_sort_section_name_special_ordering_compare::
1047 operator()): New function.
1048 (Output_section::sort_attached_input_sections): Use new sort function
1050 * output.h (Input_section_sort_section_name_special_ordering_compare):
1052 * testsuite/Makefile.am (text_section_grouping): Test option
1054 * testsuite/Makefile.in: Regenerate.
1055 * testsuite/text_section_grouping.sh: Check order of functions without
1056 default text reordering.
1058 2013-01-18 Mike Frysinger <vapier@gentoo.org>
1060 * options.h (General_options): Change default to true for new_dtags.
1062 2013-01-18 Mike Frysinger <vapier@gentoo.org>
1064 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1065 when enable_new_dtags is false. Only add DT_RUNPATH when
1066 enable_new_dtags is true.
1068 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
1070 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1071 used in declaration and definition consistent.
1072 (Target_powerpc::symval_for_branch): Ditto.
1074 2013-01-16 Sriraman Tallam <tmsriram@google.com>
1076 * testsuite/plugin_final_layout.cc: Fix comment.
1078 2013-01-16 Sriraman Tallam <tmsriram@google.com>
1080 * layout.cc (Layout::layout): Do not do default sorting for
1081 text sections when section ordering is specified.
1082 (make_output_section): Ditto.
1083 * testsuite/plugin_final_layout.cc: Name the function sections
1084 to catch reordering issues.
1086 2013-01-15 Alan Modra <amodra@gmail.com>
1088 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1091 2013-01-15 Alan Modra <amodra@gmail.com>
1093 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1094 * testsuite/Makefile.in: Regenerate.
1096 2013-01-14 Alan Modra <amodra@gmail.com>
1098 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1099 * testsuite/Makefile.in: Regenerate.
1101 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
1104 Fix mingw gold build with plugins enabled
1105 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1106 * configure.ac: Export DLOPEN_LIBS and add headers check.
1107 * plugin.cc: Handle non-dlfcn case.
1108 * Makefile.in: Regenerate.
1109 * config.in: Regenerate.
1110 * configure: Regenerate.
1111 * testsuite/Makefile.in: Regenerate.
1113 2013-01-09 Sriraman Tallam <tmsriram@google.com>
1115 * output.h (sort_attached_input_sections): Change to be public.
1116 * script-sections.cc
1117 (Output_section_definition::set_section_addresses): Sort
1118 attached input sections according to section order before linker
1119 script assigns section addresses.
1120 (Orphan_output_section::set_section_addresses): Sort
1121 attached input sections according to section order before linker
1122 script assigns section addresses.
1123 * Makefile.am (final_layout.sh): Use a simple linker script to
1124 check if section ordering still works.
1125 * Makefile.in: Regenerate.
1127 2013-01-09 Ben Cheng <bccheng@google.com>
1129 * arm.cc (Target_arm::attributes_accept_div): New function.
1130 (Target_arm::attributes_forbid_div): New function.
1131 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1132 attribute using the same new functions as what bfd/elf32_arm.c
1135 2013-01-07 Cary Coutant <ccoutant@google.com>
1138 * output.cc (Output_section::add_input_section): For incremental
1139 updates, don't track input sections that are allocated from patch
1142 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
1143 Ian Lance Taylor <iant@google.com>
1146 * configure.ac (--enable-ld): Removed.
1147 (install_as_default): Set to yes only for --enable-gold=default
1149 * configure: Regenerated.
1151 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
1153 * options.h (General_options): Add -fuse-ld= for GCC linker
1154 option compatibility.
1156 2013-01-04 Cary Coutant <ccoutant@google.com>
1158 * configure.ac: Fix typo restoring CXXFLAGS.
1159 * configure: Regenerate.
1161 2013-01-04 Cary Coutant <ccoutant@google.com>
1163 * testsuite/Makefile.am (CXXLINK_S): New macro.
1164 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1165 * testsuite/Makefile.in: Regenerate.
1167 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
1169 * version.cc (print_version): Update copyright year to 2013.
1171 2012-12-20 Ian Lance Taylor <iant@google.com>
1173 * layout.cc (Layout::special_ordering_of_input_section): New
1175 (Layout::layout): If input section requires special ordering, must
1176 sort input sections.
1177 (Layout::make_output_section): May sort .text input sections.
1178 (Layout::is_section_name_prefix_grouped): Remove.
1179 * layout.h (class Layout): Declare
1180 special_ordering_of_input_section. Don't declare
1181 is_section_name_prefix_grouped.
1182 * output.cc (Output_section::add_input_section): Revert last
1184 (Output_section::Input_section_sort::match_file_name): Don't crash
1185 if called on output section data.
1186 (Output_section::Input_section_sort_compare): Sort based on
1188 (Output_section::Input_section_sort_section_order_index_compare):
1190 (Output_section::sort_attached_input_sections): Likewise.
1192 2012-12-18 Sriraman Tallam <tmsriram@google.com>
1194 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1195 * layout.h (Layout::is_section_name_prefix_grouped): New function.
1196 * output.cc (Output_section::add_input_section): Check if section
1197 name contains special prefix. Keep input sections to sort such
1199 (Output_section::Input_section_sort_section_order_index_compare
1200 ::operator()): Group sections according to prefixes.
1201 (Output_section::sort_attached_input_sections): Add condition to
1202 Input_section_entry constructor call.
1203 * testsuite/Makefile.am (text_section_grouping): New test.
1204 * testsuite/Makefile.in: Regenerate.
1205 * testsuite/text_section_grouping.cc: New file.
1206 * testsuite/text_section_grouping.sh: New file.
1208 2012-12-17 Nick Clifton <nickc@redhat.com>
1210 * Makefile.am: Add copyright notice.
1213 * configure.ac: Likewise.
1214 * ftruncate.c: Likewise.
1215 * Makefile.in: Regenerate.
1217 2012-12-14 Cary Coutant <ccoutant@google.com>
1219 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1220 --no-as-needed flag.
1221 (exception_separate_shared_12_test): Likewise.
1222 (incremental_copy_test): Likewise.
1223 * testsuite/Makefile.in: Regenerate.
1225 2012-12-14 Cary Coutant <ccoutant@google.com>
1227 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1228 (Dwp_output_file::Dwp_index::enter_set): Add assert.
1230 2012-12-12 Alan Modra <amodra@gmail.com>
1232 * powerpc.cc (class Track_tls): New.
1233 (class Relocate, class Scan): Inherit Track_tls.
1234 (Target_powerpc::Scan::local, global): Track tls optimization
1235 and avoid creating plt entry for __tls_get_addr if all uses
1237 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1239 2012-12-12 Alan Modra <amodra@gmail.com>
1241 * options.h (General_options): Add --toc-sort/--no-toc-sort.
1242 Replace no_toc_optimize with toc_optimize.
1243 * output.h (Output_section::input_sections): Provide non-const variant.
1244 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1245 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1247 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1248 (class Sort_toc_sections): New.
1249 (Target_powerpc::do_finalize_sections): Sort toc sections.
1250 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1252 2012-12-10 Roland McGrath <mcgrathr@google.com>
1254 * testsuite/binary_unittest.cc (read_all): New function.
1255 (Sized_binary_test): Use it instead of ::read.
1256 * fileread.cc (do_read): Don't assume pread always reads the whole
1257 amount in a single call.
1259 2012-12-10 Alan Modra <amodra@gmail.com>
1261 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1262 Set EM_PPC64 or EM_PPC here.
1263 (Target_selector_powerpc::do_recognize): Delete.
1265 2012-12-10 Alan Modra <amodra@gmail.com>
1267 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1269 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1271 2012-12-07 Roland McGrath <mcgrathr@google.com>
1273 * testsuite/binary_unittest.cc (Sized_binary_test):
1274 Use open_descriptor rather than ::open.
1276 2012-12-07 Alan Modra <amodra@gmail.com>
1278 * powerpc.cc (Stub_table::do_write): Delete redundant Address
1279 typedef and invalid_address constant.
1280 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1281 instantiate constants.
1283 2012-12-06 Roland McGrath <mcgrathr@google.com>
1285 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1286 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1287 * aclocal.m4: Regenerate.
1288 * configure: Regenerate.
1289 * Makefile.in: Regenerate.
1290 * testsuite/Makefile.in: Regenerate.
1292 2012-12-07 Alan Modra <amodra@gmail.com>
1294 * options.h (General_options): Add no_toc_optimize.
1295 * powerpc.cc (ok_lo_toc_insn): New function.
1296 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1298 2012-12-06 Alan Modra <amodra@gmail.com>
1300 * options.h (General_options): Add plt_align, plt_static_chain,
1301 plt_thread_safe. Update stub_group_size help text.
1302 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1303 for new plt_thread_safe_ var.
1304 (use_plt_offset): Correct comments.
1305 (Target_powerpc::do_relax): Look for thread creation symbols to
1306 determine default plt_thread_safe value. Clear plt call stubs
1307 as well as branch stubs each iteration.
1308 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1310 (l, hi, ha, write_insn): Move earlier.
1311 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1312 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1314 (Stub_table::update_size): Adjust.
1315 (Stub_table::prev_size, set_prev_size): Delete.
1316 (Stub_table::stub_align): Let --plt-align affect result.
1317 (Stub_table::plt_call_size): Calculate sizes for various stubs.
1318 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1319 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1320 (Stub_table::do_write): Support more stub variants.
1322 2012-12-04 Alan Modra <amodra@gmail.com>
1324 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1325 (Target_powerpc::do_define_standard_symbols): New function.
1327 2012-12-03 Alan Modra <amodra@gmail.com>
1329 * output.h: Formatting, whitespace.
1331 2012-12-03 Alan Modra <amodra@gmail.com>
1333 * layout.h (Layout::get_executable_sections): Declare.
1334 * layout.cc (Layout::get_executable_sections): New function.
1335 * arm.cc (Target_arm::group_sections): Use it.
1336 (Arm_output_section::group_sections): Delete now redundant test.
1337 * output.cc (Output_reloc::Output_reloc): Add is_relative.
1338 param to handle relative relocs.
1339 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1340 (Output_data_reloc::add_absolute): Adjust.
1341 (Output_data_reloc::add_relative): New function.
1342 (Output_data::reset_data_size): New function.
1343 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1344 (Output_section::set_addralign): New function.
1345 (Output_section::checkpoint_set_addralign): New function.
1346 (Output_section::clear_section_offsets_need_adjustment): New function.
1347 (Output_section::input_sections): Make public.
1348 * powerpc.cc (class Output_data_brlt_powerpc): New.
1349 (class Stub_table, class Stub_control): New.
1350 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1351 stub_table_, set_stub_table, stub_table): New vectors and accessor
1353 (Target_powerpc::do_may_relax, do_relax, push_branch,
1354 new_stub_table, stub_tables, brlt_section, group_sections,
1355 add_branch_lookup_table, find_branch_lookup_table,
1356 write_branch_lookup_table, make_brlt_section): New functions.
1357 (Target_powerpc::struct Sort_sections, class Branch_info): New.
1358 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1359 branch_info_): New vars.
1360 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1361 make call stubs here.
1362 (Output_data_glink): Remove all call stub handling from this class.
1363 (Target_powerpc::Scan::local, global): Save interesting branch
1364 relocs and relocs for ifunc. Adjust calls to plt entry functions.
1365 (Target_powerpc::do_finalize_sections): Only make reg save/restore
1366 functions on final link.
1367 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1368 Handle long branch destinations too.
1369 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1370 do_plt_address_for_local): Adjust lookup of plt call stubs.
1372 2012-11-30 Alan Modra <amodra@gmail.com>
1374 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1375 relocs against protected symbols when building 32-bit shared libs.
1377 2012-11-30 Alan Modra <amodra@gmail.com>
1379 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1380 param. Call got_section() to make .got. Update all callers
1381 and their callers and so on.
1383 2012-11-30 Alan Modra <amodra@gmail.com>
1385 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1386 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1387 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1388 value if it already exists.
1390 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
1393 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1395 2012-11-14 Roland McGrath <mcgrathr@google.com>
1397 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1398 than bfc instruction for data sandboxing.
1400 2012-11-08 Alan Modra <amodra@gmail.com>
1402 * po/POTFILES.in: Regenerate.
1404 2012-11-05 Alan Modra <amodra@gmail.com>
1406 * configure.ac: Apply 2012-09-10 change to config.in here.
1407 * configure: Regenerate.
1409 2012-11-05 Alan Modra <amodra@gmail.com>
1411 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1412 (struct Opd_ent): Use "Address" rather than "Offset".
1413 (Output_data_got_powerpc::got_base_offset): Return Valtype.
1414 (Target_powerpc::got_section): Make public.
1415 (Target_powerpc::scan_relocs): Move code setting symbols..
1416 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1417 Create _SDA_BASE_ only when referenced.
1419 2012-11-02 Roland McGrath <mcgrathr@google.com>
1421 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1424 2012-11-01 Roland McGrath <mcgrathr@google.com>
1426 * target.h (Sized_target::relocate_relocs): Use Elf_Off
1427 for offset_in_output_section parameter.
1428 (Sized_target::relocate_special_relocatable): Likewise.
1429 * arm.cc (Target_arm::relocate_relocs): Likewise.
1430 (Target_arm::relocate_special_relocatable): Likewise.
1431 * i386.cc (Target_i386::relocate_relocs): Likewise.
1432 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1433 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1434 * target-reloc.h (relocate_relocs): Likewise.
1435 * testsuite/testfile.cc (Target_test): Likewise.
1436 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1437 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1439 * system.h: Move inclusion of <clocale> to after <libintl.h> in
1440 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1442 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1443 parameter, which is unused in the [!F_SETFD] case.
1445 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1446 SYMNDX to off_t before comparing it to this->data_size().
1447 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1448 * incremental.cc (Output_section_incremental_inputs::do_write):
1449 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1451 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1453 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
1455 * gold.cc (Target_arm::do_adjust_elf_header): Add the
1456 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1459 2012-10-29 Cary Coutant <ccoutant@google.com>
1461 * dwp.cc (usage): Add file and exit status parameters;
1462 add --help and --version options.
1463 (print_version): New function.
1464 (main): Add --help and --version options.
1466 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1468 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1469 final_layout_sequence.txt.
1470 * testsuite/Makefile.in: Regenerated.
1472 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1474 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1475 COMPILE generated by automake.
1477 (CXXCOMPILE1): Likewise.
1478 (CXXLINK1): Likewise.
1479 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1481 (CXXCOMPILE): Likewise.
1482 (CXXLINK): Likewise.
1483 * testsuite/Makefile.in: Regenerated.
1485 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1487 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1488 on bad fwrite return.
1490 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1492 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1495 2012-10-23 Cary Coutant <ccoutant@google.com>
1497 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1498 * testsuite/Makefile.in: Regenerate.
1499 * testsuite/dwp_test.h: New source file.
1500 * testsuite/dwp_test_1.cc: New source file.
1501 * testsuite/dwp_test_1.s: New source file.
1502 * testsuite/dwp_test_1.sh: New source file.
1503 * testsuite/dwp_test_1b.cc: New source file.
1504 * testsuite/dwp_test_1b.s: New source file.
1505 * testsuite/dwp_test_2.cc: New source file.
1506 * testsuite/dwp_test_2.s: New source file.
1507 * testsuite/dwp_test_2.sh: New source file.
1508 * testsuite/dwp_test_main.cc: New source file.
1509 * testsuite/dwp_test_main.s: New source file.
1511 2012-10-23 Cary Coutant <ccoutant@google.com>
1513 * dwp.h: New header file.
1514 * dwp.cc: New source file.
1515 * gold.h: Move shared declarations to system.h.
1516 * system.h: New header file.
1517 * Makefile.am: Add dwp.
1518 * Makefile.in: Regenerate.
1520 2012-10-23 Cary Coutant <ccoutant@google.com>
1522 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1523 Dwarf_info_reader::read_from_pointer.
1524 (Dwarf_pubnames_table::read_header): Likewise.
1525 (Dwarf_pubnames_table::next_name): Likewise.
1526 (Dwarf_die::read_attributes): Likewise.
1527 (Dwarf_die::skip_attributes): Likewise.
1528 (Dwarf_info_reader::read_from_pointer): New function template.
1529 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1530 (Dwarf_pubnames_table): Likewise.
1531 (Dwarf_info_reader::read_from_pointer): New function template.
1532 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1533 Dwarf_pubnames_table ctor.
1535 2012-10-23 Cary Coutant <ccoutant@google.com>
1537 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1539 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1541 (Dwarf_info_reader::set_abbrev_shndx): New method.
1542 (Dwarf_info_reader::abbrev_shndx_): New data member.
1544 2012-10-23 Cary Coutant <ccoutant@google.com>
1546 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1547 from object, not parameters.
1548 (Dwarf_info_reader::parse): Likewise.
1549 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1550 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1551 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1554 2012-10-23 Cary Coutant <ccoutant@google.com>
1556 * fileread.cc (Input_file::Input_file): New constructor.
1557 * fileread.h (class Input_file): Add new constructor.
1559 2012-10-18 Alan Modra <amodra@gmail.com>
1562 * object.cc (Relobj::is_section_name_included): Also match
1563 .sdata personality section.
1565 2012-10-18 Alan Modra <amodra@gmail.com>
1567 * target-reloc.h (class Default_comdat_behavior): New, package up..
1568 (get_comdat_behaviour): ..this.
1569 (relocate_section): Add Relocate_comdat_behavior template arg,
1570 adjust code to suit.
1571 * arm.cc (Target_arm::relocate_section): Adjust to suit.
1572 (Target_arm::scan_reloc_section): Likewise.
1573 * i386.cc (Target_i386::relocate_section): Likewise.
1574 * sparc.cc (Target_sparc::relocate_section): Likewise.
1575 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1576 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1577 * powerpc.cc (class Relocate_comdat_behavior): New.
1578 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
1579 gold::relocate_section with new template arg.
1581 2012-10-18 Alan Modra <amodra@gmail.com>
1583 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1584 dynamic relocs for GOT_TPREL got entries, without symbol if
1586 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1587 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1588 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1590 2012-10-17 Alan Modra <amodra@gmail.com>
1593 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1595 2012-10-16 Sriraman Tallam <tmsriram@google.com>
1597 * layout.cc (Layout::include_section): Keep sections marked
1598 SHF_EXCLUDE when doing relocatable links.
1600 2012-10-16 Alan Modra <amodra@gmail.com>
1602 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1603 (Target_powerpc::do_finalize_sections): Call it.
1604 (Output_data_save_res): New class and supporting functions.
1605 (Target_powerpc::symval_for_branch): Only look up .opd entry for
1606 normal symbols defined in object files.
1608 2012-10-12 Alan Modra <amodra@gmail.com>
1610 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1611 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
1612 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1613 section if scan_opd_relocs not yet called.
1614 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1616 2012-10-12 Alan Modra <amodra@gmail.com>
1618 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1619 add_local_ifunc_entry): Revert last change.
1620 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1622 2012-10-05 Alan Modra <amodra@gmail.com>
1624 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1625 do_plt_address_for_global): New functions.
1626 (Output_data_got_powerpc::do_write): Don't segfault when linking
1628 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1629 add_local_ifunc_entry): Return true on adding entry..
1630 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1631 glink->add_entry call. Remove unused symtab param. Adjust calls.
1632 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1633 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
1634 set up symbols here.
1635 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1636 syms here. Do so even when no .iplt. Don't segfault when linking
1638 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
1639 new variants without reloc param.
1640 (Glink_sym_ent::Glink_sym_ent): Likewise.
1641 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1642 reloc when refs will resolve to plt call stub.
1643 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
1644 R_PPC_PLTREL24 to resolve locally.
1645 (Target_powerpc::Scan::global): Correct ifunc handling.
1646 (Target_powerpc::Relocate::relocate): Correct local sym glink
1647 lookup. Don't destroy "value" when we have a plt call stub,
1648 and when checking plt call validity.
1649 (Target_powerpc::do_dynsym_value): Simplify.
1651 2012-10-05 Alan Modra <amodra@gmail.com>
1653 * i386.cc (Output_data_plt_i386::address_for_global,
1654 address_for_local): Add plt offset to returned value. Adjust uses.
1655 * sparc.cc (Output_data_plt_sparc::address_for_global,
1656 address_for_local): Likewise.
1657 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1658 address_for_local): Likewise.
1659 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1660 address_for_local): Likewise.
1661 * target.h (Target::plt_address_for_global, plt_address_for_local):
1663 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1664 (Output_data_got::Got_entry::write): Nor here.
1665 * output.h: Comment fix.
1667 2012-10-02 Jiong Wang <jiwang@tilera.com>
1669 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1670 global_offset_table_ value for larget got.
1671 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1673 2012-09-29 Alan Modra <amodra@gmail.com>
1675 * powerpc.cc (Target_powerpc::iplt_): New output section.
1676 (Target_powerpc::iplt_section, make_iplt_section,
1677 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1678 (Target_powerpc::make_plt_entry): Handle ifunc syms.
1679 Target_powerpc::plt_entry_count): Count iplt entries too.
1680 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1681 reloc section in constructor. New params.
1682 (Target_powerpc::make_plt_section): Create reloc section here instead.
1683 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1685 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1686 (Output_data_glink::add_entry, find_entry): New functions to
1687 deal with local syms.
1688 (Glink_sym_ent): Add support for local syms.
1689 (Output_data_glink::do_write): Handle ifunc plt entries.
1690 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1691 (Target_powerpc::Scan::local, global): Handle ifunc syms.
1692 (Target_powerpc::Relocate::relocate): Likewise.
1693 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1695 2012-09-25 Alan Modra <amodra@gmail.com>
1697 * object.h (Sized_relobj_file::adjust_local_symbol,
1698 do_adjust_local_symbol): New functions.
1699 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1700 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1701 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1702 and irregular opd entry spacing.
1703 (Powerpc_relobj::do_read_relocs): Add opd size checks.
1704 (Global_symbol_visitor_opd): New functor.
1705 (Target_powerpc::do_finalize_sections): Omit global symbols defined
1706 on deleted opd entries.
1708 2012-09-15 Jiong Wang <jiwang@tilera.com>
1710 * tilegx.cc: New file.
1711 * Makefile.am (TARGETSOURCES): Add tilegx.cc
1712 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1713 * configure.tgt: Add entries for tilegx*.
1714 * configure.ac: Likewise.
1715 * Makefile.in: Rebuild.
1716 * configure: Likewise.
1717 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1720 2012-09-13 Alan Modra <amodra@gmail.com>
1722 * target-reloc.h (scan_relocs): Call scan.local for relocs
1723 against symbols in discarded sections. Pass is_discarded
1725 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1726 Add is_discarded param.
1727 * powerpc (Target_powerpc::Scan::local): Likewise. Use
1728 is_discarded to flag opd entry as discarded. Don't emit dyn
1729 relocs on such entries.
1730 (Target_powerpc::Scan::global): Similarly detect and handle
1732 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1733 opd_ent_. Update all uses.
1734 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1735 (Target_powerpc::relocate_section): Zero out discarded opd
1738 2012-09-12 Ian Lance Taylor <iant@google.com>
1741 * output.cc: Rename Output_data_got template parameter from size
1742 to got_size for all functions. Compile all variants of
1744 (Output_data_got::Got_entry::write): Correct use of size for
1745 symbol value. Use local_is_tls rather than casting to
1747 * object.h (class Object): Add local_is_tls and do_local_is_tls.
1748 (class Sized_relobj_file): Add do_local_is_tls.
1749 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1751 2012-09-11 Alan Modra <amodra@gmail.com>
1754 * layout.cc (Layout::set_segment_offsets): When using
1755 common-page-size alignment, ensure we are on a new max-page-size
1757 * output.cc (Output_segment::set_section_addresses): Use
1758 abi_pagesize, not common_pagesize for relro boundary.
1759 (Output_segment::set_offset): Likewise.
1761 2012-09-11 Alan Modra <amodra@gmail.com>
1763 * output.h (Output_data_got::add_global_tls, add_local_tls,
1764 add_local_tls_pair): New functions.
1765 (Output_data_got::add_local_pair_with_rel): Remove second
1766 reloc param. Expand comment.
1767 (Output_data_got::Got_entry): Rename use_plt_offset_ to
1768 use_plt_or_tls_offset_, similarly for constructor param.
1769 (Output_data_got::Got_entry::write): Add got_index param.
1770 * output.cc (Output_data_got::add_global_tls, add_local_tls,
1771 add_local_tls_pair): New functions.
1772 (Output_data_got::Got_entry::write): Handle tls symbols
1773 with use_plt_or_tls_offset_ set specially.
1774 (Output_data_got::add_local_pair_with_rel): Only one reloc.
1775 (Output_data_got::do_write): Replace iterator with index, pass
1776 index to entry write function.
1777 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1778 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1779 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1781 * i386.cc (Target_i386::Scan::local): Likewise.
1782 * sparc.cc (Target_sparc::Scan::local): Likewise.
1783 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1784 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1785 do_tls_offset_for_global): New functions.
1786 (Target_powerpc::Scan::local): Correct TLS relocations and got
1788 (Target_powerpc::Scan::global): Don't emit unnecessary
1789 dynamic relocations on TLS GOT entries.
1791 2012-09-10 Matthias Klose <doko@ubuntu.com>
1793 * config.in: Disable sanity check for kfreebsd.
1795 2012-09-10 Sterling Augustine <saugustine@google.com>
1797 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1798 (Gdb_index::pubtypes_read): New parameter.
1799 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1801 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1804 2012-09-09 Alan Modra <amodra@gmail.com>
1806 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1807 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1808 * gc.h (gc_process_relocs): Call target gc_add_reference.
1809 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1810 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1811 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1813 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1814 to cater for when we don't need code offset. Update use.
1815 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1816 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1817 set_opd_valid): New functions.
1818 (Target_powerpc::do_gc_add_reference): New function.
1819 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1821 (Target_powerpc::do_gc_mark_symbol): New function.
1823 2012-09-06 Cary Coutant <ccoutant@google.com>
1825 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1826 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1827 (Dwarf_die::skip_attributes): Likewise.
1828 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1829 * testsuite/gdb_index_test.cc (inline_func_1): New function.
1831 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1833 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
1835 * testsuite/script_test_3.t: Add .got.plt output section
1837 * testsuite/script_test_4.t: Likewise.
1839 2012-09-05 Alan Modra <amodra@gmail.com>
1841 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1842 update all uses and lose "enum" when using type.
1844 2012-09-05 Alan Modra <amodra@gmail.com>
1846 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1847 * configure: Regenerate.
1848 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1849 (plugin_final_layout.stdout): Likewise.
1850 (memory_test): Set page sizes to 0x1000.
1851 * testsuite/Makefile.in: Regenerate.
1852 * testsuite/discard_locals_test.sh: Add FIXME comment.
1853 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1854 * testsuite/pr14265.t: Add .got output section statement.
1855 * testsuite/script_test_2.t: Likewise.
1856 * testsuite/script_test_3.t: Likewise.
1857 * testsuite/script_test_4.t: Likewise.
1858 * testsuite/script_test_5.t: Likewise.
1859 * testsuite/script_test_6.t: Likewise.
1860 * testsuite/script_test_7.t: Likewise.
1861 * testsuite/script_test_9.t: Likewise.
1863 2012-09-05 Alan Modra <amodra@gmail.com>
1865 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1866 (Powerpc_relocate_functions::Status): New typedef.
1867 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1868 (Target_powerpc::Scan::local): Handle REL64.
1869 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1870 for REL32 and REL64.
1871 (Target_powerpc::symval_for_branch): New function, extracted from..
1872 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
1873 checks. Report overflow errors.
1875 2012-09-05 Alan Modra <amodra@gmail.com>
1877 * object.h (Sized_relobj_file::emit_relocs): Delete.
1878 (Sized_relobj_file::emit_relocs_reltype): Delete.
1879 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1880 relocate_relocs for --emit-relocs.
1881 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1882 * output.h: Update comment.
1883 (Output_segment::first_section): New function.
1884 (Output_segment::first_section_load_address): Use first_section.
1885 * output.cc (Output_segment::first_section): New function extracted..
1886 (Output_segment::first_section_load_address): ..from here. Delete.
1887 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1888 * target.h (Sized_target::relocate_for_relocatable): Likewise.
1889 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1890 adjust call to target.h function.
1891 * i386.cc (Target_i386): Likewise.
1892 * sparc.cc (Target_sparc): Likewise.
1893 * x86_64.cc (Target_x86_64): Likewise.
1894 * powerpc.cc (Target_powerpc): Likewise.
1895 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
1896 first tls section has section symbol for optimised local dynamic
1898 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1899 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1901 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1902 Rename to relocate_relocs. Update error message.
1904 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
1906 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1909 2012-08-31 Alan Modra <amodra@gmail.com>
1911 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1912 (Powerpc_relobj::toc_base_offset): New stub function.
1913 (Target_powerpc): Add tp_offset, dtp_offset. Rename
1914 got_mod_index_offset to tlsld_got_offset. Update all refs.
1915 (Target_powerpc::Relocate::enum skip_tls): New.
1916 (Target_powerpc::call_tls_get_addr_): New var.
1917 (Target_powerpc::is_branch_reloc): Move to file scope.
1918 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1919 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1921 (Target_powerpc::enum Got_type): Delete old values, add new ones.
1922 (powerpc_info): Correct common_pagesize for ppc64.
1923 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1924 (Powerpc_relocate_functions): Add overflow check enums and functions.
1925 Add non-shift version of rela, rela_ua. Delete all rel public
1926 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
1927 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1928 addr16_ha3, addr14 functions.
1929 (Output_data_got_powerpc::add_constant_pair): New function.
1930 (Output_data_got_powerpc::got_base_offset): Likewise.
1931 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1932 (instruction constants): Sort, add some more.
1933 (Output_data_glink::do_write): Add and use Address typedef. Use
1934 object->toc_base_offset() stub for 64-bit.
1935 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1936 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1937 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1938 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
1939 Always treat .opd relocs as against locally defined symbol.
1940 Correct condition for RELATIVE relocs.
1941 (Target_powerpc::do_finalize_sections): Test for NULL sections.
1942 (Target_powerpc::Relocate::relocate): Use plt call stub as value
1943 for 32-bit syms with a plt entry. Correct ppc64 toc base
1944 calculations. Handle TLS relocs, and more. Add overflow
1945 checking and adjust for Powerpc_relocate_functions changes.
1946 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1947 Reinstate --emit-relocs code with FIXME.
1949 2012-08-30 Alan Modra <amodra@gmail.com>
1951 * layout.cc (Layout::set_segment_offsets): Set p_align to
1952 abi_pagesize, not common_pagesize.
1953 (Layout::relaxation_loop_body): Similarly use abi_pagesize
1954 to determine whether file header can go in segment.
1956 2012-08-30 Alan Modra <amodra@gmail.com>
1958 * output.h (Output_reloc::Output_reloc <output section>): Add
1959 is_relative param. Adjust calls.
1960 (Output_reloc::add_output_section_relative): New functions.
1961 * output.cc (Output_reloc::Output_reloc <output section>): Handle
1963 (Output_reloc::symbol_value): Handle SECTION_CODE.
1965 2012-08-24 Sriraman Tallam <tmsriram@google.com>
1967 * gold.cc (queue_middle_tasks): Call layout again when unique
1968 segments for sections is desired.
1969 * layout.cc (Layout::Layout): Initialize new members.
1970 (Layout::get_output_section_flags): New function.
1971 (Layout::choose_output_section): Call get_output_section_flags.
1972 (Layout::layout): Make output section for mapping to a unique segment.
1973 (Layout::insert_section_segment_map): New function.
1974 (Layout::attach_allocated_section_to_segment): Make unique segment for
1975 output sections marked so.
1976 (Layout::segment_precedes): Check for unique segments when sorting.
1977 * layout.h (Layout::Unique_segment_info): New struct.
1978 (Layout::Section_segment_map): New typedef.
1979 (Layout::insert_section_segment_map): New function.
1980 (Layout::get_output_section_flags): New function.
1981 (Layout::is_unique_segment_for_sections_specified): New function.
1982 (Layout::set_unique_segment_for_sections_specified): New function.
1983 (Layout::unique_segment_for_sections_specified_): New member.
1984 (Layout::section_segment_map_): New member.
1985 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1986 Rename is_gc_pass_one to is_pass_one.
1987 Rename is_gc_pass_two to is_pass_two.
1988 Rename is_gc_or_icf to is_two_pass.
1989 Check for which pass based on whether symbols data is present.
1990 Make it two pass when unique segments for sections is desired.
1991 * output.cc (Output_section::Output_section): Initialize new
1993 * output.h (Output_section::is_unique_segment): New function.
1994 (Output_section::set_is_unique_segment): New function.
1995 (Output_section::is_unique_segment_): New member.
1996 (Output_section::extra_segment_flags): New function.
1997 (Output_section::set_extra_segment_flags): New function.
1998 (Output_section::extra_segment_flags_): New member.
1999 (Output_section::segment_alignment): New function.
2000 (Output_section::set_segment_alignment): New function.
2001 (Output_section::segment_alignment_): New member.
2002 (Output_segment::Output_segment): Initialize is_unique_segment_.
2003 (Output_segment::is_unique_segment): New function.
2004 (Output_segment::set_is_unique_segment): New function.
2005 (Output_segment::is_unique_segment_): New member.
2006 * plugin.cc (allow_unique_segment_for_sections): New function.
2007 (unique_segment_for_sections): New function.
2008 (Plugin::load): Add new functions to transfer vector.
2009 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2010 * Makefile.in: Regenerate.
2011 * testsuite/plugin_final_layout.sh: Check if unique segment
2012 functionality works.
2013 * testsuite/plugin_section_order.c (onload): Check if new interfaces
2015 (allow_unique_segment_for_sections): New global.
2016 (unique_segment_for_sections): New global.
2017 (claim_file_hook): Call allow_unique_segment_for_sections.
2018 (all_symbols_read_hook): Call unique_segment_for_sections.
2020 2012-08-22 Cary Coutant <ccoutant@google.com>
2022 * layout.cc (Layout::include_section): Don't assert on GROUP
2023 sections with --emit-relocs.
2025 2012-08-21 Cary Coutant <ccoutant@google.com>
2027 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2028 if --export-dynamic-symbol names an undef symbol.
2030 2012-08-18 Alan Modra <amodra@gmail.com>
2032 * powerpc.cc: Formatting and white space.
2033 (Powerpc_relobj): Rename got2_section_ to special_.
2034 Add opd_ent_shndx_ and opd_ent_off_ vectors.
2035 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2036 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2037 (Target_powerpc): Add Address typedef and invalid_address. Use
2039 (Target_powerpc::is_branch_reloc): New function.
2040 (Powerpc_relocate_functions): Add Address typedef, use throughout.
2041 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2042 for dst_mask, value and addend.
2043 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2044 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2045 (Output_data_glink::do_write): Correct toc base. Don't try to use
2046 uint16_t for 24-bit offset. Use get_output_section_offset and
2048 (Target_powerpc::Scan::local): Handle more relocs.
2049 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2050 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2051 Plug in toc restoring insn after plt calls. Translate branches
2052 to function descriptor symbols to corresponding entry point.
2053 (Target_powerpc::relocate_for_relocatable): Check return from
2054 get_output_section_offset.
2055 * symtab.h: Comment typo.
2057 2012-08-14 Ian Lance Taylor <iant@google.com>
2059 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2060 unsupported_relocal_local to call unsupported_reloc_global.
2062 2012-08-14 Nick Clifton <nickc@redhat.com>
2065 * script-sections.cc (Sections_element::output_section_name): Add
2066 keep return parameter.
2067 (Output_section_element::match_name): Add keep return parameter.
2068 Return the value of the keep_ member.
2069 * script-sections.h (class Output_section): Update
2070 output_section_name prototype.
2071 * layout.cc (Layout::keep_input_section): New public member
2073 (Layout::choose_output_section): Pass keep parameter to
2074 output_section_name.
2075 * layout.h (class Layout): Add keep_input_section.
2076 * object.cc (Sized_relobj_file::do_layout): Check for kept input
2078 * testsuite/Makefile.am: Add a test.
2079 * testsuite/Makefile.in: Regenerate.
2080 * testsuite/pr14265.c: Source file for the test.
2081 * testsuite/pr14265.t: Linker script for the test.
2082 * testsuite/pr14265.sh: Shell script for the test.
2084 2012-08-14 Alan Modra <amodra@gmail.com>
2086 * target.h (Target::output_section_name): New function.
2087 (Target::do_output_section_name): New function.
2088 * layout.cc (Layout::choose_output_section): Call the above.
2089 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2091 2012-08-14 Alan Modra <amodra@gmail.com>
2093 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2094 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2095 for replace_constant call.
2096 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2097 (Output_data_glink::do_print_to_mapfile): New function.
2098 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2099 (Target_powerpc::Relocate::relocate): Likewise.
2101 2012-08-14 Alan Modra <amodra@gmail.com>
2103 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2104 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2105 (Output_data_glink::add_entry,find_entry): Remove shndx param.
2106 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
2107 all references to shndx_. Handle special case for R_PPC_PLTREL24
2109 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2110 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2111 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2113 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2114 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2116 2012-08-12 Alan Modra <amodra@gmail.com>
2118 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
2119 (glink insn constants): Use uint32_t.
2120 (Output_data_glink::add_entry): Use insert, not [] operator.
2122 2012-08-11 Alan Modra <amodra@gmail.com>
2124 * object.h (Sized_relobj_file::find_shdr): New function.
2125 (Sized_relobj_file::find_special_sections): New function.
2126 * object.cc (Sized_relobj_file::find_shdr): New function.
2127 (Sized_relobj_file::find_eh_frame): Use find_shdr.
2128 (Sized_relobj_file::find_special_sections): New function, split out..
2129 (Sized_relobj_file::do_read_symbols): ..from here.
2130 * output.h (Output_data_got::replace_constant): New function.
2131 (Output_data_got::num_entries): New function.
2132 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2133 (Output_data_got::got_offset): Protected rather than private.
2134 (Output_data_got::replace_got_entry): New function.
2135 * output.cc (Output_data_got::replace_got_entry): New function.
2136 * powerpc.cc (class Powerpc_relobj): New.
2137 (class Powerpc_relocate_functions): Delete all psymval variants or
2138 convert to value,addend type. Delete pcrela, pcrela_unaligned.
2139 Implement _ha functions using corresponding _hi function.
2140 (Powerpc_relobj::find_special_sections): New function.
2141 (Target_powerpc::do_make_elf_object): New function.
2142 (class Output_data_got_powerpc): New.
2143 (class Output_data_glink): New.
2144 (class Powerpc_scan_relocatable_reloc): New.
2145 Many more changes througout file.
2147 2012-08-09 Nick Clifton <nickc@redhat.com>
2149 * po/vi.po: Updated Vietnamese translation.
2151 2012-08-07 Ian Lance Taylor <iant@google.com>
2153 * layout.cc (Layout::add_target_dynamic_tags): If
2154 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2157 2012-07-30 Nick Clifton <nickc@redhat.com>
2159 * po/gold.pot: Updated template.
2160 * po/es.po: Updated Spanish translation.
2162 2012-07-18 Cary Coutant <ccoutant@google.com>
2165 * configure.ac: Add check for -gpubnames support.
2166 * configure: Regenerate.
2167 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2168 support; force -gno-pubnames.
2169 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2171 (gdb_index_test_4): New test.
2172 * testsuite/Makefile.in: Regenerate.
2173 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2174 * testsuite/gdb_index_test_2.sh: Likewise.
2175 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2176 * testsuite/gdb_index_test_4.sh: New script.
2177 * testsuite/gdb_index_test_comm.sh: New script with common code;
2178 don't look for space after colon.
2180 2012-07-16 Sriraman Tallam <tmsriram@google.com>
2182 * gold.cc (queue_middle_tasks): Update function order only after
2183 deferred objects due to plugins are processed.
2185 2012-07-11 Ian Lance Taylor <iant@google.com>
2187 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2188 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2189 (Target_arm::scan_reloc_for_stub): Likewise.
2190 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2191 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2192 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2193 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2194 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2196 2012-07-10 Dodji Seketeli <dodji@redhat.com>
2197 Ian Lance Taylor <iant@google.com>
2200 * configure.ac: Test whether std::tr1::hash<off_t> works.
2201 * gold.h: Add a specialization for std::tr1::hash<off_t> if
2203 * output.h (class Output_fill): Add virtual destructor.
2204 * configure, config.in: Rebuild.
2206 2012-06-22 Roland McGrath <mcgrathr@google.com>
2208 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2210 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
2212 * plugin.cc (Plugin::load): Handle position independent executables.
2214 2012-06-06 Cary Coutant <ccoutant@google.com>
2216 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2218 (lines_only_debug_sections): Likewise.
2219 (gdb_fast_lookup_sections): New static array.
2220 (is_gdb_debug_section): Rename formal parameter.
2221 (is_lines_only_debug_section): Likewise.
2222 (is_gdb_fast_lookup_section): New function.
2223 (Layout::include_section): Check for ".zdebug_" prefix; pass
2224 section name suffix to is_gdb_debug_section, et al.; check for
2225 fast-lookup sections when building .gdb_index.
2226 * options.h (--strip-debug-gdb): Update GDB version number.
2228 2012-06-06 Cary Coutant <ccoutant@google.com>
2230 * configure.ac: Add check for fallocate.
2231 * configure: Regenerate.
2232 * config.in: Regenerate.
2234 * options.h (class General_options): Add --mmap-output-file and
2235 --posix-fallocate options.
2236 * output.cc: (posix_fallocate): Remove; replace with...
2237 (gold_fallocate): New function.
2238 (Output_file::map_no_anonymous): Call gold_fallocate.
2239 (Output_file::map): Check --mmap-output-file option.
2241 2012-06-05 Jing Yu <jingyu@google.com>
2243 * gold.h (textdomain): Add do {} to empty while(0).
2244 (bindtextdomain): Likewise.
2246 2012-06-04 Cary Coutant <ccoutant@google.com>
2248 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2251 2012-05-25 Sriraman Tallam <tmsriram@google.com>
2253 * symtab.cc (Symbol_table::define_special_symbol):
2254 Initialize *poldsym to prevent uninitialized variable errors.
2256 2012-05-23 Cary Coutant <ccoutant@google.com>
2258 * layout.cc (Layout::section_name_mapping): Add rules to handle
2259 exact match on .data.rel.ro.local or .data.rel.ro.
2260 (Layout::output_section_name): Check for exact matches.
2262 2012-05-23 Cary Coutant <ccoutant@google.com>
2264 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2267 2012-05-22 Cary Coutant <ccoutant@google.com>
2269 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2270 object before exporting symbol.
2272 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
2274 * testsuite/tls_test.cc: Include "config.h" first.
2275 * testsuite/tls_test_c.c: Likewise.
2277 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
2278 Nick Clifton <nickc@redhat.com>
2281 * configure.in: Add check that sysdep.h has been included before
2282 any system header files.
2283 * configure: Regenerate.
2284 * config.in: Regenerate.
2286 2012-05-14 Cary Coutant <ccoutant@google.com>
2288 * layout.cc (Layout::make_output_section): Mark .tdata section
2290 * testsuite/relro_test.cc: Add a TLS variable.
2292 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
2295 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2296 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2299 2012-05-08 Cary Coutant <ccoutant@google.com>
2301 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2302 (lines_only_debug_sections): Likewise.
2304 2012-05-02 Roland McGrath <mcgrathr@google.com>
2306 * nacl.cc: New file.
2308 * Makefile.am (CCFILES, HFILES): Add them.
2309 * Makefile.in: Regenerate.
2310 * i386.cc (Output_data_plt_i386_nacl): New class.
2311 (Output_data_plt_i386_nacl_exec): New class.
2312 (Output_data_plt_i386_nacl_dyn): New class.
2313 (Target_i386_nacl): New class.
2314 (Target_selector_i386_nacl): New class.
2315 (target_selector_i386): Use it instead of Target_selector_i386.
2316 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2317 (Target_x86_64_nacl): New class.
2318 (Target_selector_x86_64_nacl): New class.
2319 (target_selector_x86_64, target_selector_x32): Use it instead of
2320 Target_selector_x86_64.
2321 * arm.cc (Output_data_plt_arm_nacl): New class.
2322 (Target_arm_nacl): New class.
2323 (Target_selector_arm_nacl): New class.
2324 (target_selector_arm, target_selector_armbe): Use it instead of
2325 Target_selector_arm.
2327 * target-select.cc (select_target): Take new Input_file* and off_t
2328 arguments, pass them on to recognize method of selector.
2329 * object.cc (make_elf_sized_object): Update caller.
2330 * parameters.cc (parameters_force_valid_target): Likewise.
2331 * incremental.cc (make_sized_incremental_binary): Likewise.
2332 * target-select.h: Update decl.
2333 (Target_selector::recognize): Take new Input_file* argument,
2334 pass it on to do_recognize.
2335 (Target_selector::do_recognize): Take new Input_file* argument.
2336 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2337 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2338 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2339 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2341 * target.h (Target::Target_info): New members isolate_execinstr
2343 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2344 * arm.cc (Target_arm::arm_info): Update initializer.
2345 * i386.cc (Target_i386::i386_info): Likewise.
2346 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2347 * sparc.cc (Target_sparc::sparc_info): Likewise.
2348 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2349 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2350 * layout.cc (Layout::attach_allocated_section_to_segment):
2351 Take new const Target* argument. If target->isolate_execinstr(), act
2353 (Layout::find_first_load_seg): Take new const Target* argument;
2354 if target->isolate_execinstr(), reject PF_X segments.
2355 (Layout::relaxation_loop_body): Update caller.
2356 (Layout::set_segment_offsets): If target->isolate_execinstr(),
2357 reset file offset to zero when we hit LOAD_SEG, and then do a second
2358 loop over the segments before LOAD_SEG to reassign offsets after
2359 addresses have been determined. Handle target->rosegment_gap().
2360 (Layout::attach_section_to_segment): Take new const Target* argument;
2361 pass it to attach_allocated_section_to_segment.
2362 (Layout::make_output_section): Update caller.
2363 (Layout::attach_sections_to_segments): Take new const Target* argument;
2364 pass it to attach_section_to_segment.
2365 * gold.cc (queue_middle_tasks): Update caller.
2366 * layout.h (Layout): Update method decls with new arguments.
2368 * arm.cc (Target_arm::Target_arm): Take optional argument for the
2369 Target_info pointer to use.
2370 (Target_arm::do_make_data_plt): New virtual method.
2371 (Target_arm::make_data_plt): New method that calls it.
2372 (Target_arm::make_plt_entry): Use it.
2373 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2374 for the section alignment.
2375 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2377 (Output_data_plt_arm::first_plt_entry_offset): Call it.
2378 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2380 (Output_data_plt_arm::get_plt_entry_size): Call it.
2381 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2382 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2383 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2385 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2386 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2387 method instead of sizeof(plt_entry).
2388 (Output_data_plt_arm::add_entry): Likewise.
2389 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2390 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2392 (Target_arm::plt_entry_size): Likewise.
2393 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2395 (Output_data_plt_arm_standard): ... here, new class.
2396 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2397 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2398 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2400 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2401 Take additional argument for the PLT entry size.
2402 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2403 Use get_plt_entry_size method rather than plt_entry_size variable.
2404 (Output_data_plt_x86_64::reserve_slot): Likewise.
2405 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2406 (Output_data_plt_x86_64::add_entry): Likewise.
2407 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2408 (Output_data_plt_x86_64::address_for_global): Likewise.
2409 (Output_data_plt_x86_64::address_for_local): Likewise.
2410 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2411 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2412 Make method non-static.
2413 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2415 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2416 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2417 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2418 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2420 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2421 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2423 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2424 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2426 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2427 (Output_data_plt_x86_64::plt_entry_size)
2428 (Output_data_plt_x86_64::first_plt_entry)
2429 (Output_data_plt_x86_64::plt_entry)
2430 (Output_data_plt_x86_64::tlsdesc_plt_entry)
2431 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2432 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2433 (Output_data_plt_x86_64_standard): ... here, new class.
2434 (Target_x86_64::Target_x86_64): Take optional argument for the
2435 Target_info pointer to use.
2436 (Target_x86_64::do_make_data_plt): New virtual method.
2437 (Target_x86_64::make_data_plt): New method to call it.
2438 (Target_x86_64::init_got_plt_for_update): Use that.
2439 Call this->plt_->add_eh_frame method here.
2440 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2441 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2442 rather than static method.
2443 (Target_x86_64::plt_entry_size): Likewise.
2444 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2445 rather than plt_entry_size variable. Move guts of PLT filling to...
2446 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2447 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2448 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2450 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2451 additional argument for the section alignment.
2452 Don't do add_eh_frame_for_plt here.
2453 (Output_data_plt_i386::first_plt_entry_offset): Make the method
2454 non-static. Use get_plt_entry_size method rather than plt_entry_size
2456 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2458 (Output_data_plt_i386::get_plt_entry_size): Call it.
2459 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2460 (Output_data_plt_i386::add_eh_frame): New method to call it.
2461 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2463 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2464 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2466 (Output_data_plt_i386::fill_plt_entry): New method to call it.
2467 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2468 method instead of plt_entry_size.
2469 (Output_data_plt_i386::plt_entry_size)
2470 (Output_data_plt_i386::plt_eh_frame_fde_size)
2471 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2472 (Output_data_plt_i386_standard): ... here, new class.
2473 (Output_data_plt_i386_exec): New class.
2474 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2475 (Output_data_plt_i386_exec::first_plt_entry): ... here.
2476 (Output_data_plt_i386::exec_plt_entry): Move to ...
2477 (Output_data_plt_i386_exec::plt_entry): ... here.
2478 (Output_data_plt_i386_dyn): New class.
2479 (Output_data_plt_i386::first_plt_entry): Move to ...
2480 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2481 (Output_data_plt_i386::dyn_plt_entry): Move to ...
2482 (Output_data_plt_i386_dyn::plt_entry): ... here.
2483 (Target_i386::Target_i386): Take optional argument for the Target_info
2485 (Target_i386::do_make_data_plt): New virtual method.
2486 (Target_i386::make_data_plt): New method to call it.
2487 (Target_i386::make_plt_section): Use that.
2488 Call this->plt_->add_eh_frame method here.
2489 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2490 rather than plt_entry_size variable.
2491 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2492 (Output_data_plt_i386::address_for_local): Likewise.
2493 (Output_data_plt_i386::do_write): Likewise.
2494 Move guts of PLT filling to...
2495 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2496 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2497 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2498 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2500 2012-05-01 Cary Coutant <ccoutant@google.com>
2502 * dwarf_reader.cc (Dwarf_die::read_attributes)
2503 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2504 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2505 * reduced_debug_output.cc
2506 (Output_reduced_debug_info_section::get_die_end): Remove
2507 DW_FORM_GNU_ref_index. Add default case.
2509 2012-04-26 Mark Wielaard <mjw@redhat.com>
2511 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2512 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2513 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2514 DW_AT_high_pc as offset from DW_AT_low_pc.
2516 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2517 * testsuite/Makefile.in: Regenerate.
2518 * testsuite/gdb_index_test_3.c: New test source file.
2519 * testsuite/gdb_index_test_3.sh: New test source file.
2521 2012-04-25 Ian Lance Taylor <iant@google.com>
2523 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2525 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2526 as a class, not a struct.
2527 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2528 (Target_arm::apply_cortex_a8_workaround): Likewise.
2529 * gc.h: Declare Reloc_types as a struct, not a class.
2530 * object.h: Declare Symbols_data as a struct.
2531 * reloc.h: Declare Read_relocs_data as a struct.
2532 * target.h: Declare Relocate_info as a struct.
2534 2012-04-24 David S. Miller <davem@davemloft.net>
2536 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2537 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2540 2012-04-24 Cary Coutant <ccoutant@google.com>
2542 * incremental-dump.cc (find_input_containing_global): Replace
2543 magic number with symbolic constant.
2544 (dump_incremental_inputs): Update version number.
2545 * incremental.cc (Output_section_incremental_inputs): Update version
2546 number; import symbolic constants from Incremental_inputs_reader.
2547 (Incremental_inputs::create_data_sections): Align relocations
2548 section correctly for 64-bit targets.
2549 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2550 constants; add padding.
2551 (Output_section_incremental_inputs::write_header): Add assert for
2553 (Output_section_incremental_inputs::write_input_files): Add assert
2554 for input_entry_size.
2555 (Output_section_incremental_inputs::write_info_blocks): Add padding;
2556 add assert for object_info_size, input_section_entry_size,
2557 global_sym_entry_size.
2558 * incremental.h (Incremental_inputs_reader): Add symbolic constants
2559 for data structure sizes; use them.
2560 (Incremental_input_entry_reader): Import symbolic constants from
2561 Incremental_inputs_reader; use them.
2563 2012-04-23 David S. Miller <davem@davemloft.net>
2565 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2567 (Target_sparc::Target_sparc): Initialize new fields.
2568 (Target_sparc::do_make_elf_object): New function.
2569 (Target_sparc::do_adjust_elf_header): New function.
2571 2012-04-23 Cary Coutant <ccoutant@google.com>
2573 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2574 CU range table of gdb index.
2576 2012-04-20 David S. Miller <davem@davemloft.net>
2578 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2581 2012-04-16 David S. Miller <davem@davemloft.net>
2583 * sparc.cc (Target_sparc::got_address): New function.
2584 (Sparc_relocate_functions::gdop_hix22): New function.
2585 (Sparc_relocate_functions::gdop_lox10): New function.
2586 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2588 (Target_sparc::Scan::local): Likewise if the global symbol is not
2589 preemptible and is not IFUNC.
2590 (Target_sparc::Relocate::relocate): Perform GOTDATA code
2591 transformations for local and non-preemptible non-IFUNC global
2594 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2595 writing out 64-bit part of ranges.
2597 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2598 -fpic and -fpie respectively.
2599 * Makefile.in: Regenerate.
2601 * sparc.cc (class Target_sparc): Add rela_ifunc_.
2602 (Target_sparc::Target_sparc): Initialize new field.
2603 (Target_sparc::do_plt_section_for_global): New function.
2604 (Target_sparc::do_plt_section_for_local): New function.
2605 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2606 (Target_sparc::make_plt_section): New function, broken out of
2607 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
2608 (Target_sparc::make_plt_entry): Call make_plt_section.
2609 (Target_sparc::make_local_ifunc_plt_entry): New function.
2610 (Target_sparc::rela_ifunc_section): New function.
2611 (Target_sparc::plt_section): Remove const.
2612 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
2613 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2614 and ifunc_count_ fields.
2615 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2616 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2617 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2618 (Output_data_plt_sparc::rela_ifunc): New function.
2619 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2620 (Output_data_plt_sparc::has_ifunc_section): New function.
2621 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2622 (Output_data_plt_sparc::address_for_global): New function.
2623 (Output_data_plt_sparc::address_for_local): New function.
2624 (Output_data_plt_sparc::plt_index_to_offset): New function.
2625 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2627 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2629 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2630 R_SPARC_JMP_IREL to switch.
2631 (Target_sparc::Scan::check_non_pic): Likewise.
2632 (Target_sparc::Scan::local): Handle IFUNC symbols.
2633 (Target_sparc::Scan::local): Likewise.
2634 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2635 and plt_address_for_local.
2636 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2637 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2639 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2640 (class Output_data_reloc): Adjust calls to Output_reloc_type.
2641 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2642 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2644 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2645 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2647 * sparc.cc (Target_sparc::Scan::global): Likewise.
2648 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2650 2012-04-16 Cary Coutant <ccoutant@google.com>
2652 * archive.cc (Library_base::should_include_member): Check for
2653 --export-dynamic-symbol.
2654 * options.h (class General_options): Add --export-dynamic-symbol.
2655 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2656 --export-dynamic-symbol.
2657 (Symbol_table::gc_mark_undef_symbols): Likewise.
2658 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2660 2012-04-12 David S. Miller <davem@davemloft.net>
2662 * sparc.cc (Reloc::wdisp10): New relocation method.
2663 (Reloc::h34): Likewise.
2664 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2665 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2667 (Target_sparc::Scan::local): Likewise.
2668 (Target_sparc::Scan::global): Likewise.
2669 (Target_sparc::Relocate::relocate): Likewise.
2671 2012-04-09 Cary Coutant <ccoutant@google.com>
2673 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2676 2012-04-06 Ian Lance Taylor <iant@google.com>
2678 * timer.cc: #include <unistd.h>.
2680 2012-04-06 Roland McGrath <mcgrathr@google.com>
2682 * configure.in (AC_CHECK_HEADERS): Add locale.h.
2683 * config.in: Regenerate.
2684 * configure: Regenerate.
2686 2012-04-05 Nick Clifton <nickc@redhat.com>
2688 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2689 (AM_LC_MESSAGES): Add.
2690 * aclocal.m4: Regenerate.
2691 * config.in: Regenerate.
2692 * configure: Regenerate.
2694 2012-03-21 Cary Coutant <ccoutant@google.com>
2696 * Makefile.am: Add gdb-index.cc, gdb-index.h.
2697 * Makefile.in: Regenerate.
2698 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2699 (Sized_elf_reloc_mapper::symbol_section): New function.
2700 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2701 (make_elf_reloc_mapper): New function.
2702 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2703 (Dwarf_abbrev_table::do_read_abbrevs): New function.
2704 (Dwarf_abbrev_table::do_get_abbrev): New function.
2705 (Dwarf_ranges_table::read_ranges_table): New function.
2706 (Dwarf_ranges_table::read_range_list): New function.
2707 (Dwarf_pubnames_table::read_section): New function.
2708 (Dwarf_pubnames_table::read_header): New function.
2709 (Dwarf_pubnames_table::next_name): New function.
2710 (Dwarf_die::Dwarf_die): New function.
2711 (Dwarf_die::read_attributes): New function.
2712 (Dwarf_die::skip_attributes): New function.
2713 (Dwarf_die::set_name): New function.
2714 (Dwarf_die::set_linkage_name): New function.
2715 (Dwarf_die::attribute): New function.
2716 (Dwarf_die::string_attribute): New function.
2717 (Dwarf_die::int_attribute): New function.
2718 (Dwarf_die::uint_attribute): New function.
2719 (Dwarf_die::ref_attribute): New function.
2720 (Dwarf_die::child_offset): New function.
2721 (Dwarf_die::sibling_offset): New function.
2722 (Dwarf_info_reader::check_buffer): New function.
2723 (Dwarf_info_reader::parse): New function.
2724 (Dwarf_info_reader::do_parse): New function.
2725 (Dwarf_info_reader::do_read_string_table): New function.
2726 (Dwarf_info_reader::lookup_reloc): New function.
2727 (Dwarf_info_reader::get_string): New function.
2728 (Dwarf_info_reader::visit_compilation_unit): New function.
2729 (Dwarf_info_reader::visit_type_unit): New function.
2730 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2731 Sized_elf_reloc_mapper.
2732 (Sized_dwarf_line_info::symbol_section): Remove function.
2733 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2734 (Sized_dwarf_line_info::read_line_mappings): Remove object
2735 parameter, adjust callers.
2736 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2737 * dwarf_reader.h: Include <sys/types.h>.
2738 (class Track_relocs): Remove forward declaration.
2739 (class Elf_reloc_mapper): New class.
2740 (class Sized_elf_reloc_mapper): New class.
2741 (class Dwarf_abbrev_table): New class.
2742 (class Dwarf_range_list): New class.
2743 (class Dwarf_ranges_table): New class.
2744 (class Dwarf_pubnames_table): New class.
2745 (class Dwarf_die): New class.
2746 (class Dwarf_info_reader): New class.
2747 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2748 (Sized_dwarf_line_info::symbol_section): Remove member function.
2749 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2751 * gdb-index.cc: New source file.
2752 * gdb-index.h: New source file.
2753 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2754 and .debug_types sections, call Layout::add_to_gdb_index.
2755 (Sized_relobj_incr::do_section_name): Implement.
2756 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2757 return type; Implement.
2758 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2760 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2761 parameter list and return type.
2762 (Sized_incr_dynobj::do_section_contents): Likewise.
2763 * layout.cc: Include gdb-index.h.
2764 (Layout::Layout): Initialize gdb_index_data_.
2765 (Layout::init_fixed_output_section): Check for .gdb_index section.
2766 (Layout::add_to_gdb_index): New function. Instantiate.
2767 * layout.h: Add forward declaration for class Gdb_index.
2768 (Layout::add_to_gdb_index): New member function.
2769 (Layout::gdb_index_data_): New data member.
2770 * main.cc: Include gdb-index.h.
2771 (main): Print statistics for gdb index.
2772 * object.cc (Object::section_contents): Move code into
2773 do_section_contents.
2774 (need_decompressed_section): Check for sections needed when building
2776 (build_compressed_section_map): Likewise.
2777 (Sized_relobj_file::do_read_symbols): Need local symbols when building
2779 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2780 sections; call Layout::add_to_gdb_index.
2781 (Sized_relobj_file::do_decompressed_section_contents): Call
2782 do_section_contents directly.
2783 * object.h (Object::do_section_contents): Adjust parameter list and
2785 (Object::do_decompressed_section_contents): Call do_section_contents
2787 (Sized_relobj_file::do_section_contents): Adjust parameter list and
2789 * options.h (class General_options): Add --gdb-index option.
2790 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2791 list and return type.
2792 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2793 * reloc.h (Track_relocs::checkpoint): New function.
2794 (Track_relocs::reset): New function.
2796 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2798 * testsuite/Makefile.in: Regenerate.
2799 * testsuite/gdb_index_test.cc: New test source file.
2800 * testsuite/gdb_index_test_1.sh: New test source file.
2801 * testsuite/gdb_index_test_2.sh: New test source file.
2803 2012-03-19 Doug Kwan <dougkwan@google.com>
2805 * arm.cc (Target_arm::do_define_standard_symbols): New method.
2806 (Target_arm::do_finalize_sections): Remove code which defines
2807 __exidx_start and __exidx_end. Make symbol table parameter
2808 anonymous as it is not used.
2809 * gold.cc (queue_middle_tasks): Call target hook to define any
2810 target-specific symbols.
2811 * target.h (Target::define_standard_symbols): New method.
2812 (Target::do_define_standard_symbols): Same.
2813 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2814 * testsuite/Makefile.in: Regenerate.
2815 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2817 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2818 relocations are generated for __exidx_start and __exidx_end.
2820 2012-03-16 Doug Kwan <dougkwan@google.com>
2822 * testsuite/Makefile.am: Disable test initpri3b.
2823 * testsuite/Makefile.in: Regenerate.
2825 2012-03-15 Doug Kwan <dougkwan@google.com>
2827 * arm.cc (Target_arm::got_section): Make .got section read-only
2830 2012-03-15 Ian Lance Taylor <iant@google.com>
2833 * layout.cc (Layout::make_output_section): Correctly mark
2834 SHT_INIT_ARRAY, et. al., as relro.
2836 2012-03-14 Doug Kwan <dougkwan@google.com>
2838 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2839 dynamic relocations for protected symbols in shared objects.
2841 2012-03-13 Ian Lance Taylor <iant@google.com>
2843 * resolve.cc (Symbol_table::resolve): When merging common symbols,
2844 keep the larger alignment.
2846 2012-03-12 Cary Coutant <ccoutant@google.com>
2848 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2849 handling of DW_LNE_define_file.
2851 2012-03-12 Cary Coutant <ccoutant@google.com>
2853 * reduced_debug_output.cc
2854 (Output_reduced_debug_info_section::get_die_end): Add new FORM
2857 2012-02-29 Cary Coutant <ccoutant@google.com>
2859 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2861 2012-02-29 Cary Coutant <ccoutant@google.com>
2863 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2864 Call Object::decompressed_section_contents.
2865 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2867 (Sized_dwarf_line_info::buffer_start_): New data member.
2868 * merge.cc (Output_merge_data::do_add_input_section): Call
2869 Object::decompressed_section_contents.
2870 (Output_merge_string::do_add_input_section): Likewise.
2871 * object.cc (need_decompressed_section): New function.
2872 (build_compressed_section_map): Decompress sections needed later.
2873 (Sized_relobj_file::do_decompressed_section_contents): New function.
2874 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2875 * object.h (Object::decompressed_section_contents): New function.
2876 (Object::discard_decompressed_sections): New function.
2877 (Object::do_decompressed_section_contents): New function.
2878 (Object::do_discard_decompressed_sections): New function.
2879 (Compressed_section_info): New type.
2880 (Compressed_section_map): Include decompressed section contents.
2881 (Sized_relobj_file::do_decompressed_section_contents): New function.
2882 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2884 2012-02-16 Cary Coutant <ccoutant@google.com>
2886 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2887 * testsuite/Makefile.in: Regenerate.
2889 2012-02-14 Cary Coutant <ccoutant@google.com>
2891 * options.cc (General_options::finalize): Disallow -pie and -static.
2893 2012-02-03 Doug Kwan <dougkwan@google.com>
2895 * arm.cc (Arm_relocate_functions::abs8,
2896 Arm_relocate_functions::abs16): Use
2897 Bits::has_signed_unsigned_overflow32.
2898 (Arm_relocate_functions::thm_abs8): Correct range of
2900 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2903 2012-02-02 Doug Kwan <dougkwan@google.com>
2905 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2906 position independent outputs, not just shared objects.
2908 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
2910 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2911 * configure: Regenerated.
2913 2012-01-27 Ian Lance Taylor <iant@google.com>
2915 * reloc.h (Bits): New class with static functions, copied from
2916 namespace utils in arm.cc.
2917 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
2920 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2922 * incremental.cc (write_info_blocks): Correct relocation offset.
2924 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2926 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2927 (Relocate::tls_gd_to_le): Likewise.
2929 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2931 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2933 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2935 * configure.ac: Check if -mcmodel=medium works.
2936 * configure: Regenerated.
2938 2012-01-24 Cary Coutant <ccoutant@google.com>
2940 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2942 (read_unsigned_LEB_128_x): ... this new function.
2943 (read_signed_LEB_128): Replaced with inline definition and ...
2944 (read_signed_LEB_128_x): ... this new function.
2945 * int_encoding.h (read_unsigned_LEB_128_x): New function.
2946 (read_unsigned_LEB_128): Add inline definition.
2947 (read_signed_LEB_128_x): New function.
2948 (read_signed_LEB_128): Add inline definition.
2949 * testsuite/Makefile.am (leb128_unittest): New unit test.
2950 * testsuite/Makefile.in: Regenerate.
2951 * testsuite/leb128_unittest.cc: New unit test.
2953 2012-01-23 Ian Lance Taylor <iant@google.com>
2956 * i386.cc (Target_i386::do_code_fill): When using a jmp
2957 instruction, pad with nop instructions.
2958 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2960 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
2962 * x86_64.cc (gc_process_relocs): Add typename on types used in
2964 (scan_relocs): Likewise.
2965 (relocate_section): Likewise.
2966 (apply_relocation): Likewise.
2968 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
2970 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2971 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2974 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
2976 * x86_64.cc: Initial support for x32.
2978 2012-01-03 Cary Coutant <ccoutant@google.com>
2980 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2981 Use abstract base class for GOT.
2982 * gold/output.h (class Output_data_got_base): New abstract base class.
2983 (class Output_data_got): Derive from new base class, adjust ctors.
2984 (Output_data_got::reserve_slot): Make virtual; rename to
2985 do_reserve_slot; Adjust callers.
2986 * gold/target.h (Sized_target::init_got_plt_for_update): Return
2987 pointer to abstract base class.
2988 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2990 2011-12-18 Ian Lance Taylor <iant@google.com>
2992 * object.h (Relobj::local_symbol_value): New function.
2993 (Relobj::local_plt_offset): New function.
2994 (Relobj::local_has_got_offset): New function.
2995 (Relobj::local_got_offset): New function.
2996 (Relobj::set_local_got_offset): New function.
2997 (Relobj::do_local_symbol_value): New pure virtual function.
2998 (Relobj::do_local_plt_offset): Likewise.
2999 (Relobj::do_local_has_got_offset): Likewise.
3000 (Relobj::do_local_got_offset): Likewise.
3001 (Relobj::do_set_local_got_offset): Likewise.
3002 (Sized_relobj::do_local_has_got_offset): Rename from
3003 local_has_got_offset.
3004 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3005 (Sized_relobj::do_set_local_got_offset): Rename from
3006 set_local_got_offset.
3007 (Sized_relobj_file::do_local_plt_offset): Rename from
3009 (Sized_relobj_file::do_local_symbol_value): New function.
3010 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3012 * output.cc (Output_data_got::Got_entry::write): Change object to
3013 Relobj. Use local_symbol_value.
3014 (Output_data_got::add_global_with_rel): Change rel_dyn to
3015 Output_data_reloc_generic*. Use add_global_generic.
3016 (Output_data_got::add_global_with_rela): Remove. Change all
3017 callers to use add_global_with_rel.
3018 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3019 Output_data_reloc_generic*. Use add_global_generic.
3020 (Output_data_got::add_global_pair_with_rela): Remove. Change all
3021 callers to use add_global_pair_with_rel.
3022 (Output_data_got::add_local): Change object to Relobj*.
3023 (Output_data_got::add_local_plt): Likewise.
3024 (Output_data_got::add_local_with_rel): Change object to Relobj*,
3025 change rel_dyn to Output_data_reloc_generic*. Use
3027 (Output_data_got::add_local_with_rela): Remove. Change all
3028 callers to use all_local_with_rel.
3029 (Output_data_got::add_local_pair_with_rel): Change object to
3030 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
3031 add_output_section_generic.
3032 (Output_data_got::add_local_pair_with_rela): Remove. Change all
3033 callers to use add_local_pair_with_rel.
3034 (Output_data_got::reserve_local): Change object to Relobj*.
3035 * output.h: (class Output_data_reloc_generic): Add pure virtual
3036 declarations for add_global_generic, add_local_generic,
3037 add_output_section_generic.
3038 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3039 functions for Output_data_reloc_generic. Update declarations for
3040 changes listed in output.cc.
3041 (class Output_data_got): Change template parameter to got_size.
3042 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
3043 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3045 (Sized_relobj_incr::do_local_plt_offset): New function.
3046 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3049 2011-12-17 Cary Coutant <ccoutant@google.com>
3051 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3052 * resolve.cc (Symbol_table::resolve): Likewise.
3053 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3055 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3057 2011-12-16 Ian Lance Taylor <iant@google.com>
3059 * output.h (Output_data_reloc_generic::add): Only call
3060 add_dynamic_reloc if this is a dynamic reloc section.
3062 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
3065 * target-reloc.h (apply_relocation): Replace <64, false> with
3068 2011-11-25 Nick Clifton <nickc@redhat.com>
3070 * po/it.po: New Italian translation.
3072 2011-11-17 Sterling Augustine <saugustine@google.com>
3074 * script.cc (script_include_directive): Implement.
3075 (read_script_file): New local variables name and search_path. Update
3076 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3077 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3078 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3080 2011-11-11 Sterling Augustine <saugustine@google.com>
3082 * yyscript.y (section_cmd): Add support for INCLUDE directive.
3083 (file_or_sections_cmd): Likewise.
3085 2011-11-11 Doug Kwan <dougkwan@google.com>
3087 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3088 if --just-symbols is given.
3090 2011-11-10 Doug Kwan <dougkwan@google.com>
3093 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3094 when processing data relocs.
3095 * reloc.h (Relocate_functions::rel_unaligned): New method.
3096 (Relocate_functions::pcrel_unaligned): Ditto.
3097 (Relocate_functions::rel32_unaligned): Ditto.
3098 (Relocate_functions::pcrel32_unaligned): Ditto.
3100 2011-11-09 Doug Kwan <dougkwan@google.com>
3103 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3104 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3105 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3106 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3107 (Relocate_functions::rel_unaligned): New.
3108 (Relocate_functions::rel32_unaligned): New.
3109 * target-reloc.h (relocate_for_relocatable): Add code to handle
3110 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3111 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3112 arm_unaligned_reloc_r): New targets.
3113 * testsuite/Makefile.in: Regenerate.
3114 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3117 2011-11-02 Ian Lance Taylor <iant@google.com>
3119 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
3121 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3122 * options.cc (General_options::finalize): Use library search path
3123 from configure script if specified. If not native and no sysroot,
3124 only search TOOLLIBDIR.
3125 * options.h (Search_directory::Search_directory): Change name to
3127 (General_options::add_to_library_path_with_sysroot): Change arg to
3129 * configure, Makefile.in, config.in: Rebuild.
3131 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
3133 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3134 we are working around the ARM1176 Erratum.
3135 * options.h (General_options::fix_arm1176): Add option.
3136 * testsuite/Makefile.am: Add testcases, and keep current ones
3138 * testsuite/Makefile.in: Regenerate.
3139 * testsuite/arm_fix_1176.s: New file.
3140 * testsuite/arm_fix_1176.sh: Likewise.
3142 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
3144 * arm.cc (Target_arm::Target_arm): Remove initialisation of
3146 (Target_arm::may_use_blx): Remove method.
3147 (Target_arm::set_may_use_blx): Likewise.
3148 (Target_arm::may_use_v4t_interworking): New method.
3149 (Target_arm::may_use_v5t_interworking): Likewise.
3150 (Target_arm::may_use_blx_): Remove member variable.
3151 (Arm_relocate_functions::arm_branch_common): Check for v5T
3153 (Arm_relocate_functions::thumb_branch_common): Likewise.
3154 (Reloc_stub::stub_type_for_reloc): Likewise.
3155 (Target_arm::do_finalize_sections): Correct interworking checks.
3156 * testsuite/Makefile.am: Add new tests.
3157 * testsuite/Makefile.in: Regenerate.
3158 * testsuite/arm_farcall_arm_arm.s: New test.
3159 * testsuite/arm_farcall_arm_arm.sh: Likewise.
3160 * testsuite/arm_farcall_arm_thumb.s: Likewise.
3161 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3162 * testsuite/arm_farcall_thumb_arm.s: Likewise.
3163 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3164 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3165 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3167 2011-10-31 Cary Coutant <ccoutant@google.com>
3170 * expression.cc (Expression::eval_with_dot): Add
3171 is_section_dot_assignment parameter.
3172 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
3173 absolute and assigning to dot within a section.
3174 * script-sections.cc
3175 (Output_section_element_assignment::set_section_addresses): Pass
3176 dot_section to set_if_absolute.
3177 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3178 as is_section_dot_assignment flag to eval_with_dot.
3179 (Output_section_element_dot_assignment::set_section_addresses):
3181 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3182 parameter. Also set value if relative to dot_section; set the
3183 symbol's output_section.
3184 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3185 parameter. Adjust all callers.
3186 (Expression::eval_maybe_dot): Likewise.
3187 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3189 * testsuite/script_test_2.t: Test assignment of an absolute value
3190 to dot within an output section element.
3192 2011-10-31 Cary Coutant <ccoutant@google.com>
3194 * options.h (class General_options): Add --[no-]gnu-unique options.
3195 * symtab.cc (Symbol_table::sized_write_globals): Convert
3196 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3198 2011-10-31 Cary Coutant <ccoutant@google.com>
3201 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3202 unnecessary assertion.
3203 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3205 2011-10-31 Sriraman Tallam <tmsriram@google.com>
3207 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3209 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3211 Change to just keep the section associated with symbol.
3212 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3213 they are externally visible and --export-dynamic is turned on.
3214 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3216 2011-10-19 Ian Lance Taylor <iant@google.com>
3219 * script-sections.cc
3220 (Output_section_element_dot_assignment::needs_output_section): New
3223 2011-10-19 Ian Lance Taylor <iant@google.com>
3226 * layout.cc (Layout::segment_precedes): Don't assert failure if a
3227 --section-start option was seen.
3228 * options.h (General_options::any_section_start): New function.
3230 2011-10-18 David S. Miller <davem@davemloft.net>
3233 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3234 member to track relocation locations that have moved during TLS
3235 reloc optimizations.
3236 (Target_sparc::Relocate::Relocate): Initialize to NULL.
3237 (Target_sparc::Relocate::relocate): Adjust view down by 4
3238 bytes if it matches reloc_adjust_addr_.
3239 (Target_sparc::Relocate::relocate_tls): Always move the
3240 __tls_get_addr call delay slot instruction forward 4 bytes when
3241 performing relaxation.
3243 2011-10-18 Cary Coutant <ccoutant@google.com>
3245 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3246 (Output_file::map_no_anonymous): Check for non-zero
3247 return code from posix_fallocate.
3249 2011-10-17 Cary Coutant <ccoutant@google.com>
3252 * plugin.cc (is_visible_from_outside): Check for symbols
3253 referenced from dynamic objects.
3254 * resolve.cc (Symbol_table::resolve): Don't count references
3255 from dynamic objects as references from real ELF files.
3256 * testsuite/plugin_test_2.sh: Adjust expected result.
3258 2011-10-17 Cary Coutant <ccoutant@google.com>
3260 * gold.cc: Include timer.h.
3261 (queue_middle_tasks): Stamp time.
3262 (queue_final_tasks): Likewise.
3263 * main.cc (main): Store timer in parameters. Print timers
3265 * parameters.cc (Parameters::Parameters): Initialize timer_.
3266 (Parameters::set_timer): New function.
3267 (set_parameters_timer): New function.
3268 * parameters.h (Parameters::set_timer): New function.
3269 (Parameters::timer): New function.
3270 (Parameters::timer_): New data member.
3271 (set_parameters_timer): New function.
3272 * timer.cc (Timer::stamp): New function.
3273 (Timer::get_pass_time): New function.
3274 * timer.h (Timer::stamp): New function.
3275 (Timer::get_pass_time): New function.
3276 (Timer::pass_times_): New data member.
3278 2011-10-17 Cary Coutant <ccoutant@google.com>
3280 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3281 task for members of lib groups.
3283 2011-10-17 Cary Coutant <ccoutant@google.com>
3286 * fileread.cc (File_read::find_view): Add assert.
3287 (File_read::make_view): Move bounds check (replace with assert)...
3288 (File_read::find_or_make_view): ... to here.
3290 2011-10-12 Cary Coutant <ccoutant@google.com>
3292 * output.cc (Output_file::open_base_file): Handle case where
3293 ::read returns less than requested size.
3295 2011-10-10 Cary Coutant <ccoutant@google.com>
3297 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3298 Initialize defined_count_.
3299 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3300 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3301 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3302 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3303 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3304 * incremental.h (Sized_relobj_incr::defined_count_): New data
3306 (Sized_incr_dynobj::defined_count_): New data member.
3307 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3308 Return zeroes instead of internal error.
3310 2011-10-10 Cary Coutant <ccoutant@google.com>
3313 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3314 (Output_reloc::symbol_value): Return PLT offset if flag is set.
3315 * output.h (class Output_reloc): Add use_plt_offset flag.
3316 (Output_reloc::type_): Adjust size of bit field.
3317 (Output_reloc::use_plt_offset_): New bit field.
3318 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3319 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3320 flag. Adjust all callers.
3321 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3322 creating RELATIVE relocations.
3324 2011-10-10 Nick Clifton <nickc@redhat.com>
3326 * po/es.po: Updated Spanish translation.
3327 * po/fi.po: Updated Finnish translation.
3329 2011-10-03 Diego Novillo <dnovillo@google.com>
3331 * options.cc (parse_uint): Fix dereference of RETVAL.
3333 2011-09-29 Sriraman Tallam <tmsriram@google.com>
3335 * layout.h (section_order_map_): New member.
3336 (get_section_order_map): New member function.
3337 * output.cc (Output_section::add_input_section): Check for patterns
3338 only when --section-ordering-file is specified.
3339 * gold.cc (queue_middle_tasks): Delay updating order of sections till
3340 output_sections have been formed.
3341 * layout.cc (Layout_Layout): Initialize section_order_map_.
3342 * plugin.cc (update_section_order): Store order in order_map. Do not
3344 * testsuite/Makefile.am: Add test case for plugin_final_layout.
3345 * testsuite/Makefile.in: Regenerate.
3346 * testsuite/plugin_section_order.c: New file.
3347 * testsuite/plugin_final_layout.cc: New file.
3348 * testsuite/plugin_final_layout.sh: New file.
3350 2011-09-29 Cary Coutant <ccoutant@google.com>
3352 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3354 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3355 symbols during incremental update.
3356 (Symbol_table::add_from_dynobj): Likewise.
3358 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3359 Ian Lance Taylor <iant@google.com>
3361 * symtab.cc (Symbol_table::define_special_symbol): Always
3362 canonicalize version string.
3364 2011-09-26 Cary Coutant <ccoutant@google.com>
3366 * gold.cc (queue_initial_tasks): Move option checks ...
3367 * options.cc (General_options::finalize): ... to here. Disable
3368 some options; make others fatal.
3370 2011-09-26 Cary Coutant <ccoutant@google.com>
3373 * plugin.cc (get_symbols_v2): New function.
3374 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3375 (is_referenced_from_outside): New function.
3376 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3377 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3378 (get_symbols): Pass version parameter.
3379 (get_symbols_v2): New function.
3380 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3382 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3383 (onload): Add LDPT_GET_SYMBOLS_V2.
3384 (all_symbols_read_hook): Use get_symbols_v2; check for
3385 LDPR_PREVAILING_DEF_IRONLY_EXP.
3386 * testsuite/plugin_test_3.sh: Update expected results.
3388 2011-09-23 Simon Baldwin <simonb@google.com>
3390 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3391 configuration options.
3392 * configure: Regenerate.
3393 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3394 * Makefile.in: Regenerate.
3395 * testsuite/Makefile.in: Regenerate.
3397 2011-09-19 Sriraman Tallam <tmsriram@google.com>
3399 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3401 2011-09-19 Cary Coutant <ccoutant@google.com>
3403 * incremental.cc (can_incremental_update): Fix typo in comment.
3404 * incremental.h (can_incremental_update): Likewise.
3406 2011-09-18 Cary Coutant <ccoutant@google.com>
3408 * incremental.cc (can_incremental_update): New function.
3409 * incremental.h (can_incremental_update): New function.
3410 * layout.cc (Layout::init_fixed_output_section): Call it.
3411 (Layout::make_output_section): Don't allow patch space in .eh_frame.
3412 * object.cc (Sized_relobj_file::do_layout): Call
3413 can_incremental_update.
3415 2011-09-13 Cary Coutant <ccoutant@google.com>
3417 * configure.ac: Check for glibc support for gnu_indirect_function
3418 support with static linking, setting automake conditional
3420 * Makefile.in: Regenerate.
3421 * configure: Regenerate.
3423 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3424 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3426 * testsuite/Makefile.in: Regenerate.
3428 2011-09-13 Cary Coutant <ccoutant@google.com>
3430 * incremental.cc (Sized_relobj_incr::do_layout): Call
3431 report_comdat_group for kept comdat sections.
3432 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3433 * testsuite/Makefile.in: Regenerate.
3434 * testsuite/incr_comdat_test_1.cc: New source file.
3435 * testsuite/incr_comdat_test_2_v1.cc: New source file.
3436 * testsuite/incr_comdat_test_2_v2.cc: New source file.
3437 * testsuite/incr_comdat_test_2_v3.cc: New source file.
3439 2011-09-13 Ian Lance Taylor <iant@google.com>
3441 * object.cc (Sized_relobj_file::do_layout): Remove unused local
3442 variable external_symbols_offset.
3444 2011-09-12 Ian Lance Taylor <iant@google.com>
3446 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3447 triggered if object has no symbols.
3449 2011-09-09 David S. Miller <davem@davemloft.net>
3451 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3452 (Output_fill_debug_line::do_write): Likewise.
3454 2011-08-29 Cary Coutant <ccoutant@google.com>
3456 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3457 casts to match formatting specs.
3458 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3460 2011-08-26 Cary Coutant <ccoutant@google.com>
3462 * layout.cc (Free_list::allocate): Provide guarantee of minimum
3463 remaining hole size when allocating.
3464 (Layout::make_output_section): Set fill methods for debug sections.
3465 * layout.h (Free_list::Free_list_node): Move from private to
3467 (Free_list::set_min_hole_size): New function.
3468 (Free_list::begin, Free_list::end): New functions.
3469 (Free_list::min_hole_): New data member.
3470 * output.cc: Include dwarf.h.
3471 (Output_fill_debug_info::do_minimum_hole_size): New function.
3472 (Output_fill_debug_info::do_write): New function.
3473 (Output_fill_debug_line::do_minimum_hole_size): New function.
3474 (Output_fill_debug_line::do_write): New function.
3475 (Output_section::Output_section): Initialize new data member.
3476 (Output_section::set_final_data_size): Ensure patch space is larger
3477 than minimum hole size.
3478 (Output_section::do_write): Fill holes in debug sections.
3479 * output.h (Output_fill): New class.
3480 (Output_fill_debug_info): New class.
3481 (Output_fill_debug_line): New class.
3482 (Output_section::set_free_space_fill): New function.
3483 (Output_section::free_space_fill_): New data member.
3484 * testsuite/Makefile.am (incremental_test_3): Add
3485 --incremental-patch option.
3486 (incremental_test_4): Likewise.
3487 (incremental_test_5): Likewise.
3488 (incremental_test_6): Likewise.
3489 (incremental_copy_test): Likewise.
3490 (incremental_common_test_1): Likewise.
3491 * testsuite/Makefile.in: Regenerate.
3493 2011-08-26 Nick Clifton <nickc@redhat.com>
3495 * po/es.po: Updated Spanish translation.
3497 2011-08-01 Cary Coutant <ccoutant@google.com>
3499 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3500 * gold/testsuite/Makefile.in: Regenerate.
3501 * gold/testsuite/justsyms_exec.c: New source file.
3502 * gold/testsuite/justsyms_lib.c: New source file.
3504 2011-08-01 Cary Coutant <ccoutant@google.com>
3506 * layout.cc (Layout::set_segment_offsets): Don't realign text
3507 segment if -Ttext was specified.
3508 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3510 * object.h (Sized_relobj_file::e_type): New function.
3511 (Sized_relobj_file::e_type_): New data member.
3512 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3513 base address for ET_EXEC files.
3514 * target.cc (Target::do_make_elf_object_implementation): Allow
3515 ET_EXEC files with --just-symbols option.
3517 2011-07-28 Cary Coutant <ccoutant@google.com>
3519 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3520 Add thread_number parameter.
3521 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3522 * workqueue-threads.cc
3523 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3524 current thread if its thread number is greater than desired thread
3526 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3527 Add thread_number parameter.
3528 (Workqueue::should_cancel_thread): Likewise.
3529 (Workqueue::find_runnable_or_wait): Pass thread_number to
3530 should_cancel_thread.
3531 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3534 2011-07-22 Sriraman Tallam <tmsriram@google.com>
3536 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3537 only after checking if it cannot be forced local.
3538 * symtab.h (is_externally_visible): Check if the symbol is not forced
3541 2011-07-15 Ian Lance Taylor <iant@google.com>
3543 * options.h (class General_options): Add --print-output-format.
3544 Move -EL next to -EB, for better --help output.
3545 * target-select.cc: Include <cstdio>, "options.h", and
3547 (Target_selector::do_target_bfd_name): New function.
3548 (print_output_format): New function.
3549 * target-select.h (class Target_selector): Update declarations.
3550 (Target_selector::target_bfd_name): New function.
3551 (print_output_format): Declare.
3552 * main.cc: Include "target-select.h".
3553 (main): Handle --print-output-format.
3554 * gold.cc: Include "target-select.h".
3555 (queue_initial_tasks): Handle --print-output-format when there are
3557 * parameters.cc (parameters_force_valid_target): Give a better
3558 error message if -EB/-EL does not match target.
3559 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3562 2011-07-15 Ian Lance Taylor <iant@google.com>
3564 * i386.cc (class Output_data_plt_i386): Add layout_ field.
3565 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3566 (Output_data_plt_i386::do_write): Write address of .dynamic
3567 section to first entry in .got.plt section.
3568 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3569 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3571 (Output_data_plt_x86_64::do_write): Write address of .dynamic
3572 section to first entry in .got.plt section.
3573 * layout.h (Layout::dynamic_section): New function.
3575 2011-07-13 Sriraman Tallam <tmsriram@google.com>
3577 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3579 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3580 input_section_position_, and input_section_glob_.
3581 (read_layout_from_file): Call function section_ordering_specified.
3582 * layout.h (is_section_ordering_specified): New function.
3583 (section_ordering_specified): New function.
3584 (section_ordering_specified_): New boolean member.
3585 * main.cc(main): Call load_plugins after layout object is defined.
3586 * output.cc (Output_section::add_input_section): Use
3587 function section_ordering_specified to check if section ordering is
3589 * output.cc (Output_section::add_relaxed_input_section): Use
3590 function section_ordering_specified to check if section ordering is
3592 (Output_section::update_section_layout): New function.
3593 (Output_section::sort_attached_input_sections): Check if input section
3595 * output.h (Output_section::update_section_layout): New function.
3596 * plugin.cc (get_section_count): New function.
3597 (get_section_type): New function.
3598 (get_section_name): New function.
3599 (get_section_contents): New function.
3600 (update_section_order): New function.
3601 (allow_section_ordering): New function.
3602 (Plugin::load): Add the new interfaces to the transfer vector.
3603 (Plugin_manager::load_plugins): New parameter.
3604 (Plugin_manager::all_symbols_read): New parameter.
3605 (Plugin_manager::claim_file): New parameter. Save the elf object for
3607 (Plugin_manager::get_elf_object): New function.
3608 (Plugin_manager::get_view): Change to directly use the bool to check
3609 if get_view is called from claim_file_hook.
3610 * plugin.h (input_objects): New function
3611 (Plugin__manager::load_plugins): New parameter.
3612 (Plugin_manager::claim_file): New parameter.
3613 (Plugin_manager::get_elf_object): New function.
3614 (Plugin_manager::in_claim_file_handler): New function.
3615 (Plugin_manager::in_claim_file_handler_): New member.
3616 (layout): New function.
3617 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3618 handler with an extra parameter. Make the elf object before calling
3620 * testsuite/plugin_test.c (get_section_count): New function pointer.
3621 (get_section_type): New function pointer.
3622 (get_section_name): New function pointer.
3623 (get_section_contents): New function pointer.
3624 (update_section_order): New function pointer.
3625 (allow_section_ordering): New function pointer.
3626 (onload): Check if the new interfaces exist.
3628 2011-07-13 Ian Lance Taylor <iant@google.com>
3630 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3632 * x86_64.cc (Target_x86_64::got_section): Likewise.
3633 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3634 (relro_now_test_SOURCES): New variable.
3635 (relro_now_test_DEPENDENCIES): New variable.
3636 (relro_now_test_LDFLAGS): New variable.
3637 (relro_now_test_LDADD): New variable.
3638 (relro_now_test.so): New target.
3639 * testsuite/Makefile.in: Rebuild.
3641 2011-07-12 Ian Lance Taylor <iant@google.com>
3644 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3645 GLOB_DAT relocation rather than a RELATIVE relocation for a
3646 protected symbol when creating a shared library.
3647 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3648 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3649 * testsuite/protected_main_1.cc (main): Test that protected
3650 function has same address.
3652 2011-07-11 Ian Lance Taylor <iant@google.com>
3655 * options.h (class General_options): Add -Bgroup.
3656 * options.cc (General_options::finalize): If -Bgroup is set,
3657 default to --unresolved-symbols=report-all.
3658 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3659 * target-reloc.h (issue_undefined_symbol_error): Handle
3660 --unresolved-symbols=report-all.
3662 2011-07-08 Ian Lance Taylor <iant@google.com>
3665 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3666 if linker script discards key sections.
3667 (Layout::create_dynamic_symtab): Likewise.
3668 (Layout::assign_local_dynsym_offsets): Likewise.
3669 (Layout::sized_create_version_sections): Likewise.
3670 (Layout::create_interp): Likewise.
3671 (Layout::finish_dynamic_section): Likewise.
3672 (Layout::set_dynamic_symbol_size): Likewise.
3674 2011-07-08 Ian Lance Taylor <iant@google.com>
3677 * options.h (class General_options): Add --unresolved-symbols.
3678 * target-reloc.h (issue_undefined_symbol_error): Check
3679 --unresolved-symbols. Add comments.
3681 2011-07-08 Ian Lance Taylor <iant@google.com>
3683 * testsuite/odr_violation2.cc (Ordering::operator()): Make
3684 expression more complex.
3686 2011-07-08 Ian Lance Taylor <iant@google.com>
3689 * target-reloc.h (issue_undefined_symbol_error): New inline
3690 function, broken out of relocate_section.
3691 (relocate_section): Call issue_undefined_symbol_error.
3692 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3693 there is no TLS segment if we are about to issue an undefined
3695 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3697 2011-07-08 Ian Lance Taylor <iant@google.com>
3700 * resolve.cc (Symbol_table::should_override): Add fromtype
3701 parameter. Change all callers. Give error when linking together
3702 TLS and non-TLS symbol.
3703 (Symbol_table::should_override_with_special): Add fromtype
3704 parameter. Change all callers.
3705 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3706 there is no TLS segment if we have reported some errors.
3707 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3709 2011-07-08 Ian Lance Taylor <iant@google.com>
3712 * target.h (Target::plt_address_for_global): New function.
3713 (Target::plt_address_for_local): New function.
3714 (Target::plt_section_for_global): Remove.
3715 (Target::plt_section_for_local): Remove.
3716 (Target::do_plt_address_for_global): New virtual function.
3717 (Target::do_plt_address_for_local): New virtual function.
3718 (Target::do_plt_section_for_global): Remove.
3719 (Target::do_plt_section_for_local): Remove.
3720 (Target::register_global_plt_entry): Add Symbol_table and Layout
3722 * output.cc (Output_data_got::Got_entry::write): Use
3723 plt_address_for_global and plt_address_for_local.
3724 * layout.cc (Layout::add_target_dynamic_tags): Use size and
3725 address of output section.
3726 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3727 got_irelative_, and irelative_count_ fields. Update
3729 (Output_data_plt_i386::has_irelative_section): New function.
3730 (Output_data_plt_i386::entry_count): Add irelative_count_.
3731 (Output_data_plt_i386::set_final_data_size): Likewise.
3732 (class Target_i386): Add got_irelative_ and rel_irelative_
3733 fields. Update declarations.
3734 (Target_i386::Target_i386): Initialize new fields.
3735 (Target_i386::do_plt_address_for_global): New function replacing
3736 do_plt_section_for_global.
3737 (Target_i386::do_plt_address_for_local): New function replacing
3738 do_plt_section_for_local.
3739 (Target_i386::got_section): Create got_irelative_.
3740 (Target_i386::rel_irelative_section): New function.
3741 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3742 fields. Don't define __rel_iplt_{start,end}.
3743 (Output_data_plt_i386::add_entry): Add symtab and layout
3744 parameters. Change all callers. Use different PLT and GOT for
3746 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3747 layout parameters. Change all callers. Use different PLT and
3749 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3750 (Output_data_plt_i386::rel_irelative): New function.
3751 (Output_data_plt_i386::address_for_global): New function.
3752 (Output_data_plt_i386::address_for_local): New function.
3753 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
3754 IRELATIVE GOT when changing IFUNC GOT entries.
3755 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3757 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3758 if we didn't create an IRELATIVE GOT.
3759 (Target_i386::Relocate::relocate): Use plt_address_for_global and
3760 plt_address_for_local.
3761 (Target_i386::do_dynsym_value): Use plt_address_for_global.
3762 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3763 got_irelative_, and irelative_count_ fields. Update
3765 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3766 Initialize new fields. Remove symtab parameter. Change all
3768 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3770 (Output_data_plt_x86_64::has_irelative_section): New function.
3771 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3772 (class Target_x86_64): Add got_irelative_ and rel_irelative_
3773 fields. Update declarations.
3774 (Target_x86_64::Target_x86_64): Initialize new fields.
3775 (Target_x86_64::do_plt_address_for_global): New function replacing
3776 do_plt_section_for_global.
3777 (Target_x86_64::do_plt_address_for_local): New function replacing
3778 do_plt_section_for_local.
3779 (Target_x86_64::got_section): Create got_irelative_.
3780 (Target_x86_64::rela_irelative_section): New function.
3781 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
3782 all callers. Don't create __rel_iplt_{start,end}.
3783 (Output_data_plt_x86_64::add_entry): Add symtab and layout
3784 parameters. Change all callers. Use different PLT and GOT for
3786 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3787 layout parameters. Change all callers. Use different PLT and
3789 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3790 parameters. Change all callers. Use different PLT and GOT for
3792 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3793 (Output_data_plt_x86_64::rela_irelative): New function.
3794 (Output_data_plt_x86_64::address_for_global): New function.
3795 (Output_data_plt_x86_64::address_for_local): New function.
3796 (Output_data_plt_x86_64::set_final_data_size): Likewise.
3797 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3798 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3799 (Target_x86_64::register_global_plt_entry): Add symtab and layout
3801 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3803 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3804 symbols if we didn't create an IRELATIVE GOT.
3805 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3806 plt_address_for_local.
3807 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3808 * testsuite/ifuncvar1.c: New test file.
3809 * testsuite/ifuncvar2.c: New test file.
3810 * testsuite/ifuncvar3.c: New test file.
3811 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3812 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3813 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3814 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3815 * testsuite/Makefile.in: Rebuild.
3817 2011-07-07 Cary Coutant <ccoutant@google.com>
3819 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3820 (two_file_test_1_ndebug.o): Likewise.
3821 (two_file_test_1b_ndebug.o): Likewise.
3822 (two_file_test_2_ndebug.o): Likewise.
3823 (two_file_test_main_ndebug.o): Likewise.
3824 (incremental_test_2): Link with no-debug versions.
3826 2011-07-06 Cary Coutant <ccoutant@google.com>
3828 * gold/incremental.cc
3829 (Output_section_incremental_inputs::write_info_blocks): Check for
3830 hidden and internal symbols.
3832 2011-07-06 Cary Coutant <ccoutant@google.com>
3834 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3835 Check disposition for startup file.
3836 (Incremental_inputs::report_command_line): Ignore
3837 --incremental-startup-unchanged option.
3838 * options.cc (General_options::parse_incremental_startup_unchanged):
3840 (General_options::General_options): Initialize new data member.
3841 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3842 (General_options): Add --incremental-startup-unchanged option.
3843 (General_options::incremental_startup_disposition): New function.
3844 (General_options::incremental_startup_disposition_): New data member.
3846 2011-07-06 Cary Coutant <ccoutant@google.com>
3848 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3849 input file index to Script_info ctor.
3850 (Sized_incremental_binary::do_file_has_changed): Find the
3851 command-line argument for files named in scripts.
3852 * incremental.h (Script_info::Script_info): New ctor
3853 with input file index.
3854 (Script_info::input_file_index): New function.
3855 (Script_info::input_file_index_): New data member.
3856 (Incremental_binary::get_library): Add const.
3857 (Incremental_binary::get_script_info): Add const.
3858 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3859 * testsuite/Makefile.am (incremental_test_5): New test case.
3860 (incremental_test_6): New test case.
3861 * testsuite/Makefile.in: Regenerate.
3863 2011-07-06 Cary Coutant <ccoutant@google.com>
3865 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3866 debug output when command lines differ.
3868 2011-07-06 Cary Coutant <ccoutant@google.com>
3870 * incremental.cc (Incremental_inputs::report_command_line): Ignore
3871 --incremental-patch option.
3872 * layout.cc (Free_list::allocate): Extend allocation beyond original
3874 (Layout::make_output_section): Mark sections that should get
3876 * options.cc (parse_percent): New function.
3877 * options.h (parse_percent): New function.
3878 (DEFINE_percent): New macro.
3879 (General_options): Add --incremental-patch option.
3880 * output.cc (Output_section::Output_section): Initialize new data
3882 (Output_section::add_input_section): Print section name when out
3884 (Output_section::add_output_section_data): Likewise.
3885 (Output_section::set_final_data_size): Add patch space when
3886 doing --incremental-full.
3887 (Output_section::do_reset_address_and_file_offset): Remove patch
3889 (Output_segment::set_section_list_addresses): Print debug output
3890 only if --incremental-update.
3891 * output.h (Output_section::set_is_patch_space_allowed): New function.
3892 (Output_section::is_patch_space_allowed_): New data member.
3893 (Output_section::patch_space_): New data member.
3894 * parameters.cc (Parameters::incremental_full): New function.
3895 * parameters.h (Parameters::incremental_full): New function
3896 * testsuite/Makefile.am (incremental_test_2): Add test for
3897 --incremental-patch option.
3898 * testsuite/Makefile.in: Regenerate.
3899 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3900 (t18): Remove function body.
3902 2011-07-05 Doug Kwan <dougkwan@google.com>
3905 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3906 Arm_Address type for relocation result.
3907 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
3909 (Arm_relocate_functions::abs32): Use unaligned access.
3910 (Arm_relocate_functions::rel32): Ditto.
3911 (Arm_relocate_functions::prel31): Ditto.
3912 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3913 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3914 static data relocations.
3915 * testsuite/Makefile.in: Regnerate.
3916 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3918 2011-07-05 Ian Lance Taylor <iant@google.com>
3921 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3922 symbols if necessary.
3923 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3925 2011-07-05 Ian Lance Taylor <iant@google.com>
3928 * resolve.cc (Symbol::override_base_with_special): Simply override
3929 version with special symbol version, ignoring previous version.
3931 2011-07-05 Ian Lance Taylor <iant@google.com>
3933 * object.cc (Sized_relobj_file::include_section_group): Add
3934 information to comment about signature location.
3936 2011-07-02 Ian Lance Taylor <iant@google.com>
3939 * options.h (class General_options): Add -f and -F.
3940 * options.cc (General_options::finalize): Fatal error if -f/-F
3941 are used without -shared.
3942 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3944 2011-07-02 Ian Lance Taylor <iant@google.com>
3946 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3948 2011-07-01 Ian Lance Taylor <iant@google.com>
3952 * resolve.cc (Symbol::override_base_with_special): Don't override
3953 the version if the overriding symbol has a different name.
3954 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
3955 all callers. If we give an error about an undefined version,
3956 define the base version if necessary.
3957 * dynobj.h (class Versions): Update declaration.
3958 * testsuite/weak_alias_test_5.cc: New file.
3959 * testsuite/weak_alias_test.script: New file.
3960 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3961 and versioned_alias have the right value, and call t2.
3962 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3963 weak_alias_test_5.so.
3964 (weak_alias_test_LDADD): Likewise.
3965 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3966 * testsuite/Makefile.in: Rebuild.
3968 2011-07-01 Ian Lance Taylor <iant@google.com>
3971 * options.h (class General_options): Support -z notext.
3972 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3974 (two_file_shared_nonpic.so): Likewise.
3975 (two_file_shared_mixed.so): Likewise.
3976 (two_file_shared_mixed_1.so): Likewise.
3977 (weak_undef_lib_nonpic.so): Likewise.
3978 (alt/weak_undef_lib_nonpic.so): Likewise.
3979 (tls_test_shared_nonpic.so): Likewise.
3980 * testsuite/Makefile.in: Rebuild.
3982 2011-07-01 Ian Lance Taylor <iant@google.com>
3985 * configure.ac: Test whether static linking works, setting
3986 the automake conditional HAVE_STATIC.
3987 * testsuite/Makefile.am: Disable tests using -static if
3988 HAVE_STATIC is not true.
3989 * configure, testsuite/Makefile.in: Rebuild.
3991 2011-07-01 Ian Lance Taylor <iant@google.com>
3994 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3995 Assert if we see DW_EH_PE_indirect.
3996 * target.h (Target::ehframe_datarel_base): New function.
3997 (Target::do_ehframe_datarel_base): New target function.
3998 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3999 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4002 2011-07-01 Ian Lance Taylor <iant@google.com>
4005 * options.h (class General_options): Add
4006 --ld-generated-unwind-info.
4007 * ehframe.cc (Fde::write): Add address parameter. Change all
4008 callers. If associated with PLT, fill in address and size.
4009 (Cie::set_output_offset): Only add merge mapping if there is an
4011 (Cie::write): Add address parameter. Change all callers.
4012 (Eh_frame::add_ehframe_for_plt): New function.
4013 * ehframe.h (class Fde): Update declarations. Move shndx_ and
4014 input_offset_ fields into union u_, with new plt field.
4015 (Fde::Fde): Adjust for new union field.
4016 (Fde::Fde) [Output_data version]: New constructor.
4017 (Fde::add_mapping): Only add merge mapping if there is an object.
4018 (class Cie): Update declarations.
4019 (class Eh_frame): Declare add_ehframe_for_plt.
4020 * layout.cc (Layout::layout_eh_frame): Break out code into
4021 make_eh_frame_section, and call it.
4022 (Layout::make_eh_frame_section): New function.
4023 (Layout::add_eh_frame_for_plt): New function.
4024 * layout.h (class Layout): Update declarations.
4025 * merge.cc (Merge_map::add_mapping): Add assertion.
4026 * i386.cc: Include "dwarf.h".
4027 (class Output_data_plt_i386): Make first_plt_entry,
4028 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
4029 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4030 and plt_eh_frame_fde.
4031 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4032 boundary. Call add_eh_frame_for_plt if appropriate.
4033 * x86_64.cc: Include "dwarf.h".
4034 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
4035 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
4036 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4037 and plt_eh_frame_fde.
4038 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4041 2011-06-29 Ian Lance Taylor <iant@google.com>
4044 * object.cc (Sized_relobj_file::layout_section): Change shdr
4045 parameter to be const.
4046 (Sized_relobj_file::layout_eh_frame_section): New function, broken
4048 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4049 appropriate. Call layout_eh_frame_section.
4050 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4052 * object.h (class Sized_relobj_file): Update declarations.
4054 2011-06-29 Ian Lance Taylor <iant@google.com>
4057 * script.cc (Token::integer_value): Accept trailing M/m/K/k
4059 (Lex::gather_token): Accept trailing M/m/K/k for integers.
4061 2011-06-29 Ian Lance Taylor <iant@google.com>
4064 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4066 * layout.cc (Layout::layout_eh_frame): Likewise.
4068 2011-06-29 Ian Lance Taylor <iant@google.com>
4071 * layout.cc (Layout::symtab_section_shndx): New function.
4072 * layout.h (class Layout): Declare symtab_section_shndx.
4073 * output.cc (Output_section::write_header): Call it.
4075 2011-06-29 Ian Lance Taylor <iant@google.com>
4078 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4079 symbols which are not used in a relocation.
4081 2011-06-28 Ian Lance Taylor <iant@google.com>
4084 * layout.cc (Layout::segment_precedes): Don't crash if a linker
4085 script create indistinguishable segments.
4086 (Layout::set_segment_offsets): Use stable_sort when sorting
4087 segments. Pass this to Compare_segments constructor.
4088 * layout.h (class Layout): Make segment_precedes non-static.
4089 (class Compare_segments): Change from struct to class. Add
4090 layout_ field. Add constructor.
4091 * script-sections.cc
4092 (Script_sections::attach_sections_using_phdrs_clause): Rename
4093 local orphan to is_orphan. Don't report failure to put empty
4094 section in segment. On attachment failure, report name of
4095 section, and attach to first PT_LOAD segment.
4097 2011-06-28 Ian Lance Taylor <iant@google.com>
4100 * target-select.cc (Target_selector::Target_selector): Add
4101 emulation parameter. Change all callers.
4102 (select_target_by_bfd_name): Rename from select_target_by_name.
4104 (select_target_by_emulation): New function.
4105 (supported_emulation_names): New function.
4106 * target-select.h (class Target_selector): Add emulation_ field.
4107 Update declarations.
4108 (Target_selector::recognize_by_bfd_name): Rename from
4109 recognize_by_name. Change all callers.
4110 (Target_selector::supported_bfd_names): Rename from
4111 supported_names. Change all callers.
4112 (Target_selector::recognize_by_emulation): New function.
4113 (Target_selector::supported_emulations): New function.
4114 (Target_selector::emulation): New function.
4115 (Target_selector::do_recognize_by_bfd_name): Rename from
4116 do_recognize_by_name. Change all callers.
4117 (Target_selector::do_supported_bfd_names): Rename from
4118 do_supported_names. Change all callers.
4119 (Target_selector::do_recognize_by_emulation): New function.
4120 (Target_selector::do_supported_emulations): New function.
4121 (select_target_by_bfd_name): Change name in declaration.
4122 (select_target_by_emulation): Declare.
4123 (supported_emulation_names): Declare.
4124 * parameters.cc (parameters_force_valid_target): Try to find
4125 target based on emulation from -m option.
4126 * options.h (class General_options): Change doc string for -m.
4127 * options.cc (help): Print emulations.
4128 (General_options::parse_V): Likewise.
4129 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4130 Add emulation parameter. Change all callers.
4132 2011-06-28 Ian Lance Taylor <iant@google.com>
4134 * target.h (class Target): Add osabi_ field.
4135 (Target::osabi): New function.
4136 (Target::set_osabi): New function.
4137 (Target::Target): Initialize osabi_.
4138 (Target::do_adjust_elf_header): Make pure virtual.
4139 (Sized_target::do_adjust_elf_header): Declare.
4140 * target.cc (Sized_target::do_adjust_elf_header): New function.
4141 (class Sized_target): Instantiate all versions.
4142 * freebsd.h (class Target_freebsd): Remove.
4143 (Target_selector_freebsd::do_recognize): Call set_osabi on
4145 (Target_selector_freebsd::do_recognize_by_name): Likewise.
4146 (Target_selector_freebsd::set_osabi): Remove.
4147 * i386.cc (class Target_i386): Inherit from Sized_target rather
4148 than Target_freebsd.
4149 * x86_64.cc (class Target_x86_64): Likewise.
4151 2011-06-28 Ian Lance Taylor <iant@google.com>
4153 * target.h (Target::can_check_for_function_pointers): Rewrite.
4155 (Target::can_icf_inline_merge_sections): Likewise.
4156 (Target::section_may_have_icf_unsafe_poineters): Likewise.
4157 (Target::Target_info): Add can_icf_inline_merge_sections field.
4158 (Target::do_can_check_for_function_pointers): New virtual
4160 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4161 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4162 from can_check_for_function_pointers, move in file.
4163 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4164 section_may_have_icf_unsafe_poineters, move in file.
4165 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4166 * i386.cc (Target_i386::do_can_check_for_function_pointers):
4167 Rename from can_check_for_function_pointers, move in file.
4168 (Target_i386::can_icf_inline_merge_sections): Remove.
4169 (Target_i386::i386_info): Initialize
4170 can_icf_inline_merge_sections.
4171 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4172 Initialize can_icf_inline_merge_sections.
4173 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4174 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4175 Rename from can_check_for_function_pointers, move in file.
4176 (Target_x86_64::can_icf_inline_merge_sections): Remove.
4177 (Target_x86_64::x86_64_info): Initialize
4178 can_icf_inline_merge_sections.
4179 * testsuite/testfile.cc (Target_test::test_target_info):
4181 * icf.cc (get_section_contents): Correct formatting.
4183 2011-06-27 Ian Lance Taylor <iant@google.com>
4185 * symtab.cc (Symbol::versioned_name): New function.
4186 (Symbol_table::add_to_final_symtab): Use versioned_name when
4188 (Symbol_table::sized_write_symbol): Likewise.
4189 * symtab.h (class Symbol): Declare versioned_name.
4190 * stringpool.h (class Stringpool_template): Add variant of add
4191 which takes a std::basic_string.
4192 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4193 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4194 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4195 (ver_test_12.o): New target.
4196 * testsuite/Makefile.in: Rebuild.
4198 2011-06-27 Doug Kwan <dougkwan@google.com>
4200 * arm.cc (Arm_relocate_functions::thm_jump8,
4201 Arm_relocate_functions::thm_jump11): Use a wider signed
4202 type to compute offset.
4203 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4205 * testsuite/Makefile.in: Regenerate.
4206 * testsuite/arm_branch_in_range.sh: Check test results of
4207 arm_thm_jump11 and arm_thm_jump8.
4208 * testsuite/arm_thm_jump11.s: New test source file.
4209 * testsuite/arm_thm_jump11.t: New linker script.
4210 * testsuite/arm_thm_jump8.s: New test source file.
4211 * testsuite/arm_thm_jump8.t: New linker script.
4213 2011-06-24 Ian Lance Taylor <iant@google.com>
4215 * layout.cc: Include "object.h".
4216 (ctors_sections_in_init_array): New static variable.
4217 (Layout::is_ctors_in_init_array): New function.
4218 (Layout::layout): Add entry to ctors_sections_in_init_array if
4220 * layout.h (class Layout): Declare is_ctors_in_init_array.
4221 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4222 is_ctors_reverse_view is set.
4223 (Sized_relobj_file::write_sections): Add layout parameter. Change
4224 all callers. Set is_ctors_reverse_view field of View_size.
4225 (Sized_relobj_file::reverse_words): New function.
4226 * object.h (Sized_relobj_file::View_size): Add
4227 is_ctors_reverse_view field.
4228 (class Sized_relobj_file): Update declarations.
4229 * testsuite/initpri3.c: New test.
4230 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4232 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4233 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4234 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4235 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4236 * testsuite/Makefile.in: Rebuild.
4238 2011-06-24 Cary Coutant <ccoutant@google.com>
4240 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4241 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4242 (debug_msg_cdebug.err): New targets.
4243 * testsuite/Makefile.in: Regenerate.
4244 * testsuite/debug_msg.sh: Check output of link with compressed debug.
4245 Fix checks for link with shared library.
4247 2011-06-24 Doug Kwan <dougkwan@google.com>
4249 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4250 skip empty text sections.
4251 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4253 2011-06-22 Ian Lance Taylor <iant@google.com>
4256 * options.h (class General_options): Add --ctors-in-init-array.
4257 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4258 friends as SHT_PROGBITS for merging sections.
4259 (Layout::layout): Remove special handling of .init_array and
4260 friends. Don't sort if doing relocatable link. Sort for .ctors
4261 and .dtors if ctors_in_init_array.
4262 (Layout::make_output_section): Force correct section types for
4263 .init_array and friends. Don't sort if doing relocatable link,
4264 Don't sort .ctors and .dtors if ctors_in_init_array.
4265 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4266 (Layout::output_section_name): Add relobj parameter. Change all
4267 callers. Handle .ctors. and .dtors. in code rather than table.
4268 Handle .ctors and .dtors if ctors_in_init_array.
4269 (Layout::match_file_name): New function, moved from output.cc.
4270 * layout.h (class Layout): Update declarations.
4271 * output.cc: Include "layout.h".
4272 (Input_section_sort_entry::get_priority): New function.
4273 (Input_section_sort_entry::match_file_name): Just call
4274 Layout::match_file_name.
4275 (Output_section::Input_section_sort_init_fini_compare::operator()):
4276 Handle .ctors and .dtors. Sort by explicit priority rather than
4278 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4279 * testsuite/initpri2.c: New test.
4280 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4281 (check_PROGRAMS): Add initpri2.
4282 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4283 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4284 * configure, testsuite/Makefile.in: Rebuild.
4286 2011-06-19 Ian Lance Taylor <iant@google.com>
4289 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4290 .interp section to a PT_INTERP segment even if we have seen a
4291 --dynamic-linker option. Don't do it if we have seen a PHDRS
4292 clause in a linker script.
4293 (Layout::finalize): Don't create a .interp section if we've
4294 already create a PT_INTERP segment.
4295 (Layout::create_interp): Always call choose_output_section (revert
4296 patch of 2011-06-17). Don't create PT_INTERP segment.
4297 * script-sections.cc
4298 (Script_sections::create_note_and_tls_segments): Add a .interp
4299 section to a PT_INTERP segment even if we have seen a
4300 --dynamic-linker option.
4302 2011-06-18 Ian Lance Taylor <iant@google.com>
4304 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4305 merely because a non-PT_LOAD segment has a dynamic reloc.
4307 2011-06-18 Ian Lance Taylor <iant@google.com>
4309 * layout.cc (Layout::finish_dynamic_section): Don't create
4310 DT_FLAGS entry if not needed.
4312 2011-06-18 Ian Lance Taylor <iant@google.com>
4315 * layout.cc (Layout::layout_eh_frame): Correct handling of
4316 writable .eh_frame section.
4318 2011-06-17 Ian Lance Taylor <iant@google.com>
4321 * resolve.cc (Symbol_table::resolve): Don't give an error if a
4322 symbol is redefined with the exact same object and value.
4324 2011-06-17 Ian Lance Taylor <iant@google.com>
4327 * layout.h (class Layout): Add interp_segment_ field.
4328 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4329 (Layout::attach_allocated_section_to_segment): If making shared
4330 library, put .interp section in PT_INTERP segment.
4331 (Layout::finalize): Also call create_interp if -dynamic-linker
4333 (Layout::create_interp): Assert that there is no PT_INTERP
4334 segment. If not using a SECTIONS clause, use make_output_section.
4335 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4336 * script-sections.cc
4337 (Script_sections::create_note_and_tls_segments): If making shared
4338 library, put .interp section in PT_INTERP segment.
4340 2011-06-17 Ian Lance Taylor <iant@google.com>
4342 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4343 when making a shared library.
4345 2011-06-17 Ian Lance Taylor <iant@google.com>
4347 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4348 parameter. Change all callers. Don't issue warning about PC32
4349 against locally defined symbol.
4351 2011-06-16 Ian Lance Taylor <iant@google.com>
4353 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4354 occurs in same object.
4356 2011-06-14 Alan Modra <amodra@gmail.com>
4358 * po/POTFILES.in: Regenerate.
4360 2011-06-09 Ian Lance Taylor <iant@google.com>
4362 * script-sections.cc
4363 (Orphan_output_section::set_section_addresses): For a relocatable
4364 link set address to 0.
4366 2011-06-09 Cary Coutant <ccoutant@google.com>
4369 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4370 used with --compress-debug-sections.
4371 * gold/object.cc (Sized_relobj_file::do_layout): Report
4372 uncompressed size of compressed input sections.
4374 2011-06-08 Cary Coutant <ccoutant@google.com>
4377 * testsuite/two_file_test_2_v1.cc: Change initialization of
4378 v2 to keep it in .data.
4380 2011-06-07 Cary Coutant <ccoutant@google.com>
4382 * common.cc (Symbol_table::do_allocate_commons_list): Call
4384 * errors.cc (Errors::fatal): Adjust call to gold_exit.
4385 (Errors::fallback): New function.
4386 (gold_fallback): New function.
4387 * errors.h (Errors::fallback): New function.
4388 * gold.cc (gold_exit): Change status parameter to enum; adjust
4390 (queue_initial_tasks): Call gold_fallback.
4391 * gold.h: Include cstdlib.
4392 (Exit_status): New enum type.
4393 (gold_exit): Change status parameter to enum.
4394 (gold_fallback): New function.
4395 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4396 (Layout::create_symtab_sections): Likewise.
4397 (Layout::create_shdrs): Likewise.
4398 * main.cc (main): Adjust call to gold_exit.
4399 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4400 (Output_data_got::add_got_entry_pair): Likewise.
4401 (Output_section::add_input_section): Likewise.
4402 (Output_section::add_output_section_data): Likewise.
4403 (Output_segment::set_section_list_addresses): Likewise.
4404 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4406 2011-06-07 Cary Coutant <ccoutant@google.com>
4408 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4409 for incremental links.
4410 * output.cc (Output_segment::set_section_list_addresses): Remove
4411 FIXME and test for TLS or BSS.
4413 2011-06-07 Cary Coutant <ccoutant@google.com>
4415 * testsuite/Makefile.am: Add incremental_copy_test,
4416 incremental_common_test_1.
4417 * testsuite/Makefile.in: Regenerate.
4418 * testsuite/common_test_1_v1.c: New source file.
4419 * testsuite/common_test_1_v2.c: New source file.
4420 * testsuite/copy_test_v1.cc: New source file.
4422 2011-06-07 Cary Coutant <ccoutant@google.com>
4424 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4425 update, allocate common from bss section's free list.
4426 * incremental-dump.cc (dump_incremental_inputs): Print flag for
4427 linker-defined symbols.
4428 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4429 Skip GOT and PLT entries that are no longer referenced.
4430 (Output_section_incremental_inputs::write_info_blocks): Mark
4431 linker-defined symbols.
4432 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4433 * output.cc (Output_section::allocate): New function.
4434 * output.h (Output_section::allocate): New function.
4435 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4436 linker-defined symbols.
4437 (Symbol::override_base_with_special): Copy is_predefined_ flag.
4438 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4439 (Symbol::init_base_output_data): Likewise.
4440 (Symbol::init_base_output_segment): Likewise.
4441 (Symbol::init_base_constant): Likewise.
4442 (Sized_symbol::init_output_data): Likewise.
4443 (Sized_symbol::init_output_segment): Likewise.
4444 (Sized_symbol::init_constant): Likewise.
4445 (Symbol_table::do_define_in_output_data): Likewise.
4446 (Symbol_table::do_define_in_output_segment): Likewise.
4447 (Symbol_table::do_define_as_constant): Likewise.
4448 * symtab.h (Symbol::is_predefined): New function.
4449 (Symbol::init_base_output_data): Add is_predefined parameter.
4450 (Symbol::init_base_output_segment): Likewise.
4451 (Symbol::init_base_constant): Likewise.
4452 (Symbol::is_predefined_): New data member.
4453 (Sized_symbol::init_output_data): Add is_predefined parameter.
4454 (Sized_symbol::init_output_segment): Likewise.
4455 (Sized_symbol::init_constant): Likewise.
4456 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4458 2011-06-07 Cary Coutant <ccoutant@google.com>
4460 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4461 instead of emit_copy_reloc.
4462 (Copy_relocs::emit_copy_reloc): Refactor.
4463 (Copy_relocs::make_copy_reloc): New function.
4464 (Copy_relocs::add_copy_reloc): Remove.
4465 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4467 (Copy_relocs::make_copy_reloc): New function.
4468 (Copy_relocs::add_copy_reloc): Remove.
4469 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4470 unchanged input files.
4471 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4472 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4473 Reserve BSS space for COPY relocations.
4474 (Sized_incremental_binary::do_emit_copy_relocs): New function.
4475 (Output_section_incremental_inputs::write_info_blocks): Record
4476 whether a symbol is copied from a shared object.
4477 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4478 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4479 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4480 (Incremental_input_entry_reader::get_output_symbol_index): Add
4482 (Incremental_binary::emit_copy_relocs): New function.
4483 (Incremental_binary::do_emit_copy_relocs): New function.
4484 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4486 (Sized_incremental_binary::add_copy_reloc): New function.
4487 (Sized_incremental_binary::do_emit_copy_relocs): New function.
4488 (Sized_incremental_binary::Copy_reloc): New struct.
4489 (Sized_incremental_binary::Copy_relocs): New typedef.
4490 (Sized_incremental_binary::copy_relocs_): New data member.
4491 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4492 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4493 * target.h (Sized_target::emit_copy_reloc): New function.
4494 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4496 2011-06-02 Cary Coutant <ccoutant@google.com>
4499 * gold/archive.cc (Archive::Archive): Initialize new data member.
4500 (Archive::include_all_members): Return if archive has already been
4502 * gold/archive.h (Archive::include_all_members_): New data member.
4504 2011-06-02 Nick Clifton <nickc@redhat.com>
4506 * dynobj.h: Fix spelling mistake in comment.
4507 * output.cc: Likewise.
4509 2011-05-31 Doug Kwan <dougkwan@google.com>
4513 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4514 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4515 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
4516 redundant arm_exidx_test.so.
4517 * testsuite/Makefile.in: Regenerate.
4518 (check_SCRIPTS): Add pr12826.sh
4519 (check_DATA): Add pr12826.stdout
4520 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4521 * testsuite/pr12826.sh: New file.
4522 * testsuite/pr12826_1.s: Ditto.
4523 * testsuite/pr12826_1.s: Ditto.
4525 2011-05-30 Ian Lance Taylor <iant@google.com>
4527 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4530 2011-05-29 Ian Lance Taylor <iant@google.com>
4533 * testsuite/Makefile.am: Use different file name for two_file_test
4534 temporary file for each incremental test.
4535 * testsuite/Makefile.in: Rebuild.
4537 2011-05-29 Ian Lance Taylor <iant@google.com>
4539 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4540 binary input file is empty.
4542 2011-05-27 Ian Lance Taylor <iant@google.com>
4544 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4545 (ver_test_9.so): Likewise.
4546 * testsuite/Makefile.in: Rebuild.
4548 2011-05-26 Cary Coutant <ccoutant@google.com>
4550 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4551 * incremental.cc (Incremental_inputs::report_input_section): Fix
4552 comment, indentation.
4553 (Incremental_inputs::report_comdat_group): New function.
4554 (Output_section_incremental_inputs::set_final_data_size): Adjust size
4555 of data for incremental input file entry.
4556 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4557 group count, COMDAT group signatures.
4558 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4559 an unchanged input file.
4560 * incremental.h (Incremental_object_entry::Incremental_object_entry):
4561 Initialize new data member.
4562 (Incremental_object_entry::add_comdat_group): New function.
4563 (Incremental_object_entry::get_comdat_group_count): New function.
4564 (Incremental_object_entry::get_comdat_signature_key): New function.
4565 (Incremental_object_entry::groups_): New data member.
4566 (Incremental_inputs::report_comdat_group): New function.
4567 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4568 data for incremental input file entry.
4569 (Incremental_input_entry_reader::get_comdat_group_count): New function.
4570 (Incremental_input_entry_reader::get_input_section): Adjust size of
4571 data for incremental input file entry.
4572 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4573 (Incremental_input_entry_reader::get_comdat_group_signature): New
4575 * object.cc (Sized_relobj::include_section_group): Report kept
4576 COMDAT groups for incremental links.
4578 2011-05-24 David Meyer <pdox@google.com>
4580 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4581 with name parameter. Add found_name parameter.
4582 * fileread.cc (Input_file::find_file): Adjust code accordingly.
4583 * dirsearch.h (class Dirsearch): Update declaration.
4585 2011-05-24 Ian Lance Taylor <iant@google.com>
4587 * archive.cc (Library_base::should_include_member): Pull in object
4588 from archive if it defines the entry symbol.
4589 * parameters.cc (Parameters::entry): New function.
4590 * parameters.h (class Parameters): Declare entry.
4591 * output.h (class Output_file_header): Remove entry_ field.
4592 * output.cc (Output_file_header::Output_file_header): Remove entry
4593 parameter. Change all callers.
4594 (Output_file_header::entry): Use parameters->entry.
4595 * gold.cc (queue_middle_tasks): Likewise.
4596 * plugin.cc (Plugin_hook::run): Likewise.
4598 2011-05-24 Cary Coutant <ccoutant@google.com>
4600 * gold.cc (queue_initial_tasks): Pass incremental base filename
4601 to Output_file::open_base_file; don't print error message.
4602 * incremental-dump.cc (main): Adjust call to
4603 Output_file::open_for_modification.
4604 * incremental-dump.cc (main): Likewise.
4605 * incremental.cc (Incremental_inputs::report_command_line):
4606 Ignore --incremental-base option when comparing command lines.
4607 Ignore parameter when given as separate argument.
4608 * options.h (class General_options): Add --incremental-base.
4609 * output.cc (Output_file::Output_file):
4610 (Output_file::open_base_file): Add base_name and writable parameters;
4611 read base file into new file; print error message here.
4612 (Output_file::map_no_anonymous): Add writable parameter; adjust all
4614 * output.h (Output_file::open_for_modification): Rename to...
4615 (Output_file::open_base_file): ...this; add base_name and
4616 writable parameters; adjust all callers.
4617 (Output_file::map_no_anonymous): Add writable parameter; adjust all
4619 * testsuite/Makefile.am (incremental_test_4): Test
4621 * testsuite/Makefile.in: Regenerate.
4623 2011-05-24 Cary Coutant <ccoutant@google.com>
4625 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4627 * testsuite/Makefile.in: Regenerate.
4628 * testsuite/two_file_test_1_v1.cc: New test source file.
4629 * testsuite/two_file_test_1b_v1.cc: New test source file.
4630 * testsuite/two_file_test_2_v1.cc: New test source file.
4632 2011-05-24 Cary Coutant <ccoutant@google.com>
4634 * dynobj.h (Dynobj::do_dynobj): New function.
4635 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4636 flag and soname for shared objects.
4637 * incremental.cc (Incremental_inputs::report_object): Make
4638 either Incremental_object_entry or Incremental_dynobj_entry; add
4639 soname to string table.
4640 (Incremental_inputs::report_input_section): Add assertion.
4641 (Output_section_incremental_inputs::set_final_data_size): Adjust
4642 type of input file entry for shared libraries; adjust size of
4643 shared library info entry.
4644 (Output_section_incremental_inputs::write_input_files): Write
4645 as_needed flag for shared libraries.
4646 (Output_section_incremental_inputs::write_info_blocks): Adjust type
4647 of input file entry for shared libraries; write soname.
4648 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4649 soname from incremental info.
4650 * incremental.h (enum Incremental_input_flags): Add
4651 INCREMENTAL_INPUT_AS_NEEDED.
4652 (Incremental_input_entry::Incremental_input_entry): Initialize new
4654 (Incremental_input_entry::set_as_needed): New function.
4655 (Incremental_input_entry::as_needed): New function.
4656 (Incremental_input_entry::do_dynobj_entry): New function.
4657 (Incremental_input_entry::as_needed_): New data member.
4658 (Incremental_object_entry::Incremental_object_entry): Don't check
4660 (Incremental_object_entry::do_type): Likewise.
4661 (class Incremental_dynobj_entry): New class.
4662 (Incremental_input_entry_reader::as_needed): New function.
4663 (Incremental_input_entry_reader::get_soname): New function.
4664 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4665 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4666 size of shared library info entry.
4667 * layout.cc (Layout::finish_dynamic_section): Don't test for
4668 incremental link when adding DT_NEEDED entries.
4669 * object.h (Object::Object): Initialize new data member.
4670 (Object::dynobj): New function.
4671 (Object::set_as_needed): New function.
4672 (Object::as_needed): New function.
4673 (Object::do_dynobj): New function.
4674 (Object::as_needed_): New data member.
4676 2011-05-24 Cary Coutant <ccoutant@google.com>
4678 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4679 info; adjust display of GOT entries.
4680 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4681 vector of input objects; remove file_status_.
4682 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4683 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4684 got_plt reader; call target hooks to reserve GOT entries.
4685 (Output_section_incremental_inputs::set_final_data_size): Adjust size
4686 of input file info header and GOT info entry.
4687 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4689 (Got_plt_view_info::got_descriptor): Remove.
4690 (Got_plt_view_info::sym_index): New data member.
4691 (Got_plt_view_info::input_index): New data member.
4692 (Local_got_offset_visitor::visit): Write input file index.
4693 (Global_got_offset_visitor::visit): Write 0 for input file index.
4694 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4695 with sym_index and input_index.
4696 (Output_section_incremental_inputs::write_got_plt): Adjust size of
4697 incremental info GOT entry; replace got_descriptor with input_index.
4698 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4699 map from input file index to object.
4700 (Sized_relobj_incr::do_layout): Replace direct data member reference
4701 with accessor function.
4702 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4703 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4704 Adjust size of input file info header.
4705 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4706 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4707 (Incremental_input_entry_reader::get_input_section): Adjust size of
4708 input file info header.
4709 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4710 of incremental info GOT entry.
4711 (Incremental_got_plt_reader::get_got_desc): Remove.
4712 (Incremental_got_plt_reader::get_got_symndx): New function.
4713 (Incremental_got_plt_reader::get_got_input_index): New function.
4714 (Sized_incremental_binary::Sized_incremental_binary): Remove
4715 file_status_; add input_objects_.
4716 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4717 (Sized_incremental_binary::set_file_is_unchanged): Remove.
4718 (Sized_incremental_binary::file_is_unchanged): Remove.
4719 (Sized_incremental_binary::set_input_object): New function.
4720 (Sized_incremental_binary::input_object): New function.
4721 (Sized_incremental_binary::file_status_): Remove.
4722 (Sized_incremental_binary::input_objects_): New data member.
4723 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4725 (Sized_relobj_incr::invalid_address): Move to base class.
4726 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4728 (Sized_relobj_incr::do_output_section_offset): Likewise.
4729 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4730 (Sized_relobj_incr::section_offsets_): Likewise.
4731 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4733 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4734 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4735 with accessor function.
4736 (Sized_relobj_file::do_layout): Likewise.
4737 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4738 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4739 (Sized_relobj_file::compute_final_local_value): Replace refs to
4740 section_offsets_ with accessor function.
4741 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4742 * object.h (Relobj::Relobj): Initialize new data members.
4743 (Relobj::add_dyn_reloc): New function.
4744 (Relobj::first_dyn_reloc): New function.
4745 (Relobj::dyn_reloc_count): New function.
4746 (Relobj::first_dyn_reloc_): New data member.
4747 (Relobj::dyn_reloc_count_): New data member.
4748 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4750 (Sized_relobj::Address): New typedef.
4751 (Sized_relobj::invalid_address): Move here from child class.
4752 (Sized_relobj::Sized_relobj): Initialize new data members.
4753 (Sized_relobj::sized_relobj): New function.
4754 (Sized_relobj::is_output_section_offset_invalid): Move here from
4756 (Sized_relobj::get_output_section_offset): Likewise.
4757 (Sized_relobj::local_has_got_offset): Likewise.
4758 (Sized_relobj::local_got_offset): Likewise.
4759 (Sized_relobj::set_local_got_offset): Likewise.
4760 (Sized_relobj::do_for_all_local_got_entries): Likewise.
4761 (Sized_relobj::clear_got_offsets): New function.
4762 (Sized_relobj::section_offsets): Move here from child class.
4763 (Sized_relobj::do_output_section_offset): Likewise.
4764 (Sized_relobj::do_set_section_offset): Likewise.
4765 (Sized_relobj::Local_got_offsets): Likewise.
4766 (Sized_relobj::local_got_offsets_): Likewise.
4767 (Sized_relobj::section_offsets_): Likewise.
4768 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4770 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4772 (Sized_relobj_file::sized_relobj): New function
4773 (Sized_relobj_file::local_has_got_offset): Move to base class.
4774 (Sized_relobj_file::local_got_offset): Likewise.
4775 (Sized_relobj_file::set_local_got_offset): Likewise.
4776 (Sized_relobj_file::get_output_section_offset): Likewise.
4777 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4778 (Sized_relobj_file::do_output_section_offset): Likewise.
4779 (Sized_relobj_file::do_set_section_offset): Likewise.
4780 (Sized_relobj_file::Local_got_offsets): Likewise.
4781 (Sized_relobj_file::local_got_offsets_): Likewise.
4782 (Sized_relobj_file::section_offsets_): Likewise.
4783 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4785 (set_needs_dynsym_index): Convert relobj to derived class pointer.
4786 (Output_reloc::get_symbol_index): Likewise.
4787 (Output_reloc::local_section_offset): Likewise.
4788 (Output_reloc::get_address): Likewise.
4789 (Output_reloc::symbol_value): Likewise.
4790 (Output_data_got::reserve_slot): Move to class definition.
4791 (Output_data_got::reserve_local): New function.
4792 (Output_data_got::reserve_slot_for_global): Remove.
4793 (Output_data_got::reserve_global): New function.
4794 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4795 (all constructors, two instantiations).
4796 (Output_reloc::get_relobj): New function (two instantiations).
4797 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4798 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4799 (Output_data_reloc::add_global): Adjust type of relobj.
4800 (Output_data_reloc::add_global_relative): Likewise.
4801 (Output_data_reloc::add_symbolless_global_addend): Likewise.
4802 (Output_data_reloc::add_local): Likewise.
4803 (Output_data_reloc::add_local_relative): Likewise.
4804 (Output_data_reloc::add_symbolless_local_addend): Likewise.
4805 (Output_data_reloc::add_local_section): Likewise.
4806 (Output_data_reloc::add_output_section): Likewise.
4807 (Output_data_reloc::add_absolute): Likewise.
4808 (Output_data_reloc::add_target_specific): Likewise.
4809 (Output_data_got::reserve_slot): Move definition here.
4810 (Output_data_got::reserve_local): New function.
4811 (Output_data_got::reserve_global): New function.
4812 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4813 section_offsets_ with accessor function.
4814 (Sized_relobj_file::write_sections): Likewise.
4815 (Sized_relobj_file::do_relocate_sections): Likewise.
4816 * target.h (Sized_target::reserve_local_got_entry): New function.
4817 (Sized_target::reserve_global_got_entry): New function.
4818 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4819 (Target_x86_64::reserve_global_got_entry): New function.
4820 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4822 2011-05-23 Cary Coutant <ccoutant@google.com>
4824 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4825 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4826 bit when checking got_type.
4827 * incremental.cc (Sized_incremental_binary::setup_readers):
4828 Store symbol table and string table locations; initialize bit vector
4829 of file status flags.
4830 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4832 (Sized_incremental_binary::do_process_got_plt): New function.
4833 (Sized_incremental_binary::get_symtab_view): Use stored locations.
4834 (Output_section_incremental_inputs::set_final_data_size): Record
4835 file index for each input file.
4836 (Output_section_incremental_inputs::write_got_plt): Store file index
4837 instead of input entry offset for each GOT entry.
4839 (Incremental_input_entry::Incremental_input_entry): Initialize new
4841 (Incremental_input_entry::set_offset): Store file index.
4842 (Incremental_input_entry::get_file_index): New function.
4843 (Incremental_input_entry::file_index_): New data member.
4844 (Incremental_binary::process_got_plt): New function.
4845 (Incremental_binary::do_process_got_plt): New function.
4846 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4848 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4849 (Sized_incremental_binary::set_file_is_unchanged): New function.
4850 (Sized_incremental_binary::file_is_unchanged): New function.
4851 (Sized_incremental_binary::do_process_got_plt): New function.
4852 (Sized_incremental_binary::file_status_): New data member.
4853 (Sized_incremental_binary::main_symtab_loc_): New data member.
4854 (Sized_incremental_binary::main_strtab_loc_): New data member.
4855 * output.cc (Output_data_got::Got_entry::write): Add case
4857 (Output_data_got::add_global): Call add_got_entry.
4858 (Output_data_got::add_global_plt): Likewise.
4859 (Output_data_got::add_global_with_rel): Likewise.
4860 (Output_data_got::add_global_with_rela): Likewise.
4861 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4862 (Output_data_got::add_global_pair_with_rela): Likewise.
4863 (Output_data_got::add_local): Call add_got_entry.
4864 (Output_data_got::add_local_plt): Likewise.
4865 (Output_data_got::add_local_with_rel): Likewise.
4866 (Output_data_got::add_local_with_rela): Likewise.
4867 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4868 (Output_data_got::add_local_pair_with_rela): Likewise.
4869 (Output_data_got::reserve_slot): New function.
4870 (Output_data_got::reserve_slot_for_global): New function.
4871 (Output_data_got::add_got_entry): New function.
4872 (Output_data_got::add_got_entry_pair): New function.
4873 (Output_section::add_output_section_data): Edit FIXME.
4875 (Output_section_data_build::Output_section_data_build): New
4876 constructor with size parameter.
4877 (Output_data_space::Output_data_space): Likewise.
4878 (Output_data_got::Output_data_got): Initialize new data member; new
4879 constructor with size parameter.
4880 (Output_data_got::add_constant): Call add_got_entry.
4881 (Output_data_got::reserve_slot): New function.
4882 (Output_data_got::reserve_slot_for_global): New function.
4883 (class Output_data_got::Got_entry): Add RESERVED_CODE.
4884 (Output_data_got::add_got_entry): New function.
4885 (Output_data_got::add_got_entry_pair): New function.
4886 (Output_data_got::free_list_): New data member.
4887 * target.h (Sized_target::init_got_plt_for_update): New function.
4888 (Sized_target::register_global_plt_entry): New function.
4889 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4890 Initialize new data member; call init; add constructor with PLT count.
4891 (Output_data_plt_x86_64::init): New function.
4892 (Output_data_plt_x86_64::add_relocation): New function.
4893 (Output_data_plt_x86_64::reserve_slot): New function.
4894 (Output_data_plt_x86_64::free_list_): New data member.
4895 (Target_x86_64::init_got_plt_for_update): New function.
4896 (Target_x86_64::register_global_plt_entry): New function.
4897 (Output_data_plt_x86_64::add_entry): Allocate from free list for
4898 incremental updates.
4899 (Output_data_plt_x86_64::add_relocation): New function.
4900 * testsuite/object_unittest.cc (Object_test): Set default options.
4902 2011-05-16 Ian Lance Taylor <iant@google.com>
4904 * options.h (class General_options): Make -i a synonym for -r.
4906 2011-05-16 Ian Lance Taylor <iant@google.com>
4908 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4910 2011-05-10 Cary Coutant <ccoutant@google.com>
4912 * object.cc (Sized_relobj::do_count_local_symbols): Check for
4915 2011-05-06 Ian Lance Taylor <iant@google.com>
4917 * layout.cc (Layout::layout): If the output section flags change,
4918 update the ordering.
4920 2011-04-25 Cary Coutant <ccoutant@google.com>
4922 * incremental-dump.cc (dump_incremental_inputs): Print local
4923 symbol info for each input file.
4925 (Output_section_incremental_inputs::set_final_data_size): Add local
4926 symbol info to input file entries in incremental info.
4927 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4928 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4929 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4930 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4932 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4933 (Sized_incr_relobj::do_relocate): Write the local symbols.
4934 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4935 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4936 Adjust size of input file header.
4937 (Incremental_inputs_reader::get_local_symbol_offset): New function.
4938 (Incremental_inputs_reader::get_local_symbol_count): New function.
4939 (Incremental_inputs_reader::get_input_section): Adjust size of input
4941 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4942 (Sized_incr_relobj::This): New typedef.
4943 (Sized_incr_relobj::sym_size): New const data member.
4944 (Sized_incr_relobj::Local_symbol): New struct.
4945 (Sized_incr_relobj::do_output_local_symbol_count): New function.
4946 (Sized_incr_relobj::do_local_symbol_offset): New function.
4947 (Sized_incr_relobj::local_symbol_count_): New data member.
4948 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4949 (Sized_incr_relobj::local_symbol_index_): New data member.
4950 (Sized_incr_relobj::local_symbol_offset_): New data member.
4951 (Sized_incr_relobj::local_dynsym_offset_): New data member.
4952 (Sized_incr_relobj::local_symbols_): New data member.
4953 * object.h (Relobj::output_local_symbol_count): New function.
4954 (Relobj::local_symbol_offset): New function.
4955 (Relobj::do_output_local_symbol_count): New function.
4956 (Relobj::do_local_symbol_offset): New function.
4957 (Sized_relobj::do_output_local_symbol_count): New function.
4958 (Sized_relobj::do_local_symbol_offset): New function.
4960 2011-04-22 Vladimir Simonov <sv@sw.ru>
4962 * descriptors.cc (set_close_on_exec): New function.
4963 (Descriptors::open): Use set_close_on_exec.
4964 * output.cc (S_ISLNK): Define if not defined.
4966 2011-04-22 Cary Coutant <ccoutant@google.com>
4968 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4970 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4971 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4972 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4974 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4975 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4976 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4978 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4980 (Incremental_binary::apply_incremental_relocs): New function.
4981 (Incremental_binary::do_apply_incremental_relocs): New function.
4982 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4984 (Sized_incremental_binary::add_global_symbol): New function.
4985 (Sized_incremental_binary::global_symbol): New function.
4986 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4987 (Sized_incremental_binary::symbol_map_): New data member.
4988 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4989 * target.h (Sized_target::apply_relocation): New function.
4990 * target-reloc.h (apply_relocation): New function.
4991 * x86_64.cc (Target_x86_64::apply_relocation): New function.
4993 2011-04-22 Doug Kwan <dougkwan@google.com>
4995 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4996 flag of a SHT_ARM_EXIDX section.
4997 * testsuite/Makefile.am (arm_exidx_test): New test rules.
4998 * testsuite/Makefile.in: Regenerate.
4999 * testsuite/arm_exidx_test.s: New file.
5000 * testsuite/arm_exidx_test.sh: Same.
5002 2011-04-20 Cary Coutant <ccoutant@google.com>
5005 * archive.h (Incremental_archive_entry::Archive_member):
5006 Initialize arg_serial_ (second constructor).
5008 2011-04-17 Ian Lance Taylor <iant@google.com>
5010 * object.cc (Relocate_info::location): Simplify location string.
5011 * errors.cc (Errors::error_at_location): Don't print program
5013 (Errors::warning_at_location): Likewise.
5014 (Errors::undefined_symbol): Likewise.
5015 * testsuite/debug_msg.sh: Update accordingly.
5017 2011-04-14 Cary Coutant <ccoutant@google.com>
5019 * gold/layout.cc (Layout::symtab_section_offset): New function.
5020 * gold/layout.h (Layout::symtab_section_offset): New function.
5021 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5023 2011-04-12 Ian Lance Taylor <iant@google.com>
5025 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
5026 with MREMAP_MAYMOVE.
5027 * output.h (class Output_file): Add map_is_allocated_ field.
5028 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
5029 not available, provide stubs. If mremap is not available, #define
5031 (MREMAP_MAYMOVE): Define if not defined.
5032 (Output_file::Output_file): Initialize map_is_allocated_.
5033 (Output_file::resize): Check map_is_allocated_.
5034 (Output_file::map_anonymous): If mmap fails, use malloc.
5035 (Output_file::unmap): Don't do anything for an anonymous map.
5036 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
5037 is not available, provide stubs.
5038 (File_read::View::~View): Use free rather than delete[].
5039 (File_read::make_view): Use malloc rather than new[]. If mmap
5041 (File_read::find_or_make_view): Use malloc rather than new[].
5042 * gold.h: Remove HAVE_REMAP code.
5043 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
5044 exists. Rename mremap to gold_mremap. If mmap is not available
5046 * configure, config.in: Rebuild.
5048 2011-04-11 Ian Lance Taylor <iant@google.com>
5050 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5051 initialize local variable v.
5053 2011-04-11 Cary Coutant <ccoutant@google.com>
5055 * archive.cc (Archive::include_member): Adjust call to
5057 (Add_archive_symbols::run): Track argument serial numbers.
5058 (Lib_group::include_member): Likewise.
5059 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5060 * archive.h (Incremental_archive_entry::Archive_member):
5061 Initialize arg_serial_.
5062 (Archive_member::arg_serial_): New data member.
5063 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5064 (Sized_dynobj::do_add_symbols): Track symbols when doing an
5066 (Sized_dynobj::do_for_all_local_got_entries): New function.
5067 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5069 * fileread.cc (get_mtime): New function.
5070 * fileread.h (get_mtime): New function.
5071 * gold.cc (queue_initial_tasks): Check for incremental update.
5072 (process_incremental_input): New function.
5073 (queue_middle_tasks): Don't force valid target for incremental
5075 * incremental-dump.cc (find_input_containing_global): Adjust
5076 size of symbol info entry.
5077 (dump_incremental_inputs): Dump argument serial number and
5078 in_system_directory flag; bias shndx by 1; print symbol names
5079 when dumping per-file symbol lists; use new symbol info readers.
5081 (Output_section_incremental_inputs:update_data_size): New function.
5082 (Sized_incremental_binary::setup_readers): Setup input readers
5083 for each input file; build maps for files added from libraries
5085 (Sized_incremental_binary::check_input_args): New function.
5086 (Sized_incremental_binary::do_check_inputs): Build map of argument
5087 serial numbers to input arguments.
5088 (Sized_incremental_binary::do_file_has_changed): Rename
5089 do_file_is_unchanged to this; compare file modification times.
5090 (Sized_incremental_binary::do_init_layout): New function.
5091 (Sized_incremental_binary::do_reserve_layout): New function.
5092 (Sized_incremental_binary::do_get_input_reader): Remove.
5093 (Sized_incremental_binary::get_symtab_view): New function.
5094 (Incremental_checker::can_incrementally_link_output_file): Remove.
5095 (Incremental_inputs::report_command_line): Exclude --debug options.
5096 (Incremental_inputs::report_archive_begin): Add parameter; track
5097 argument serial numbers; don't put input file entry for archive
5098 before archive members.
5099 (Incremental_inputs::report_archive_end): Put input file entry
5100 for archive after archive members.
5101 (Incremental_inputs::report_object): Add parameter; track argument
5102 serial numbers and in_system_directory flag.
5103 (Incremental_inputs::report_script): Add parameter; track argument
5105 (Output_section_incremental_inputs::set_final_data_size): Adjust
5106 size of symbol info entry; check for forwarding symbols.
5107 (Output_section_incremental_inputs::write_input_files): Write
5108 in_system_directory flag and argument serial number.
5109 (Output_section_incremental_inputs::write_info_blocks): Map section
5110 indices between incremental info and original input file; store
5111 input section index for each symbol.
5112 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5113 change operator() to visit().
5114 (class Global_got_offset_visitor): Likewise.
5115 (class Global_symbol_visitor_got_plt):
5116 (Output_section_incremental_inputs::write_got_plt): Use new visitor
5118 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5119 (Sized_incr_relobj::do_read_symbols): New function.
5120 (Sized_incr_relobj::do_layout): New function.
5121 (Sized_incr_relobj::do_layout_deferred_sections): New function.
5122 (Sized_incr_relobj::do_add_symbols): New function.
5123 (Sized_incr_relobj::do_should_include_member): New function.
5124 (Sized_incr_relobj::do_for_all_global_symbols): New function.
5125 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5126 (Sized_incr_relobj::do_section_size): New function.
5127 (Sized_incr_relobj::do_section_name): New function.
5128 (Sized_incr_relobj::do_section_contents): New function.
5129 (Sized_incr_relobj::do_section_flags): New function.
5130 (Sized_incr_relobj::do_section_entsize): New function.
5131 (Sized_incr_relobj::do_section_address): New function.
5132 (Sized_incr_relobj::do_section_type): New function.
5133 (Sized_incr_relobj::do_section_link): New function.
5134 (Sized_incr_relobj::do_section_info): New function.
5135 (Sized_incr_relobj::do_section_addralign): New function.
5136 (Sized_incr_relobj::do_initialize_xindex): New function.
5137 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5138 (Sized_incr_relobj::do_read_relocs): New function.
5139 (Sized_incr_relobj::do_gc_process_relocs): New function.
5140 (Sized_incr_relobj::do_scan_relocs): New function.
5141 (Sized_incr_relobj::do_count_local_symbols): New function.
5142 (Sized_incr_relobj::do_finalize_local_symbols): New function.
5143 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5144 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5145 (Sized_incr_relobj::do_relocate): New function.
5146 (Sized_incr_relobj::do_set_section_offset): New function.
5147 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5148 (Sized_incr_dynobj::do_read_symbols): New function.
5149 (Sized_incr_dynobj::do_layout): New function.
5150 (Sized_incr_dynobj::do_add_symbols): New function.
5151 (Sized_incr_dynobj::do_should_include_member): New function.
5152 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5153 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5154 (Sized_incr_dynobj::do_section_size): New function.
5155 (Sized_incr_dynobj::do_section_name): New function.
5156 (Sized_incr_dynobj::do_section_contents): New function.
5157 (Sized_incr_dynobj::do_section_flags): New function.
5158 (Sized_incr_dynobj::do_section_entsize): New function.
5159 (Sized_incr_dynobj::do_section_address): New function.
5160 (Sized_incr_dynobj::do_section_type): New function.
5161 (Sized_incr_dynobj::do_section_link): New function.
5162 (Sized_incr_dynobj::do_section_info): New function.
5163 (Sized_incr_dynobj::do_section_addralign): New function.
5164 (Sized_incr_dynobj::do_initialize_xindex): New function.
5165 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5166 (make_sized_incremental_object): New function.
5167 (Incremental_library::copy_unused_symbols): New function.
5168 (Incremental_library::do_for_all_unused_symbols): New function.
5169 * incremental.h (enum Incremental_input_flags): New type.
5170 (class Incremental_checker): Remove.
5171 (Incremental_input_entry::Incremental_input_entry): Add argument
5173 (Incremental_input_entry::arg_serial): New function.
5174 (Incremental_input_entry::set_is_in_system_directory): New function.
5175 (Incremental_input_entry::is_in_system_directory): New function.
5176 (Incremental_input_entry::arg_serial_): New data member.
5177 (Incremental_input_entry::is_in_system_directory_): New data member.
5178 (class Script_info): Move here from script.h.
5179 (Script_info::Script_info): Add filename parameter.
5180 (Script_info::filename): New function.
5181 (Script_info::filename_): New data member.
5182 (Incremental_script_entry::Incremental_script_entry): Add argument
5184 (Incremental_object_entry::Incremental_object_entry): Likewise.
5185 (Incremental_object_entry::add_input_section): Build list of input
5186 sections with map to original shndx.
5187 (Incremental_object_entry::get_input_section_index): New function.
5188 (Incremental_object_entry::shndx_): New data member.
5189 (Incremental_object_entry::name_key_): Rename; adjust all refs.
5190 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5191 (Incremental_archive_entry::Incremental_archive_entry): Add argument
5193 (Incremental_inputs::report_archive_begin): Likewise.
5194 (Incremental_inputs::report_object): Likewise.
5195 (Incremental_inputs::report_script): Likewise.
5196 (class Incremental_global_symbol_reader): New class.
5197 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5198 and store flags and input file type.
5199 (Incremental_input_entry_reader::arg_serial): New function.
5200 (Incremental_input_entry_reader::type): Extract type from flags.
5201 (Incremental_input_entry_reader::is_in_system_directory): New function.
5202 (Incremental_input_entry_reader::get_input_section_count): Call
5203 accessor function for type.
5204 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5205 function for type; adjust size of global symbol entry.
5206 (Incremental_input_entry_reader::get_global_symbol_count): Call
5207 accessor function for type.
5208 (Incremental_input_entry_reader::get_object_count): Likewise.
5209 (Incremental_input_entry_reader::get_object_offset): Likewise.
5210 (Incremental_input_entry_reader::get_member_count): Likewise.
5211 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5212 (Incremental_input_entry_reader::get_member_offset): Likewise.
5213 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5214 (Incremental_input_entry_reader::Global_symbol_info): Remove.
5215 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5216 (Incremental_input_entry_reader::get_global_symbol_reader): New
5218 (Incremental_input_entry_reader::get_output_symbol_index): New
5220 (Incremental_input_entry_reader::type_): Remove.
5221 (Incremental_input_entry_reader::flags_): New data member.
5222 (Incremental_inputs_reader::input_file_offset): New function.
5223 (Incremental_inputs_reader::input_file_index): New function.
5224 (Incremental_inputs_reader::input_file): Call input_file_offset.
5225 (Incremental_inputs_reader::input_file_at_offset): New function.
5226 (Incremental_relocs_reader::get_r_type): Reformat.
5227 (Incremental_relocs_reader::get_r_shndx): Reformat.
5228 (Incremental_relocs_reader::get_r_offset): Reformat.
5229 (Incremental_relocs_reader::data): New function.
5230 (Incremental_binary::Incremental_binary): Initialize new data members.
5231 (Incremental_binary::check_inputs): Add cmdline parameter.
5232 (Incremental_binary::file_is_unchanged): Remove.
5233 (Input_reader::arg_serial): New function.
5234 (Input_reader::get_unused_symbol_count): New function.
5235 (Input_reader::get_unused_symbol): New function.
5236 (Input_reader::do_arg_serial): New function.
5237 (Input_reader::do_get_unused_symbol_count): New function.
5238 (Input_reader::do_get_unused_symbol): New function.
5239 (Incremental_binary::input_file_count): New function.
5240 (Incremental_binary::get_input_reader): Change signature to use
5241 index instead of filename.
5242 (Incremental_binary::file_has_changed): New function.
5243 (Incremental_binary::get_input_argument): New function.
5244 (Incremental_binary::get_library): New function.
5245 (Incremental_binary::get_script_info): New function.
5246 (Incremental_binary::init_layout): New function.
5247 (Incremental_binary::reserve_layout): New function.
5248 (Incremental_binary::output_file): New function.
5249 (Incremental_binary::do_check_inputs): New function.
5250 (Incremental_binary::do_file_is_unchanged): Remove.
5251 (Incremental_binary::do_file_has_changed): New function.
5252 (Incremental_binary::do_init_layout): New function.
5253 (Incremental_binary::do_reserve_layout): New function.
5254 (Incremental_binary::do_input_file_count): New function.
5255 (Incremental_binary::do_get_input_reader): Change signature.
5256 (Incremental_binary::input_args_map_): New data member.
5257 (Incremental_binary::library_map_): New data member.
5258 (Incremental_binary::script_map_): New data member.
5259 (Sized_incremental_binary::Sized_incremental_binary): Initialize
5261 (Sized_incremental_binary::output_section): New function.
5262 (Sized_incremental_binary::inputs_reader): Add const.
5263 (Sized_incremental_binary::symtab_reader): Add const.
5264 (Sized_incremental_binary::relocs_reader): Add const.
5265 (Sized_incremental_binary::got_plt_reader): Add const.
5266 (Sized_incremental_binary::get_symtab_view): New function.
5267 (Sized_incremental_binary::Inputs_reader): New typedef.
5268 (Sized_incremental_binary::Input_entry_reader): New typedef.
5269 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5270 (Sized_incremental_binary::do_file_is_unchanged): Remove.
5271 (Sized_incremental_binary::do_file_has_changed): New function.
5272 (Sized_incremental_binary::do_init_layout): New function.
5273 (Sized_incremental_binary::do_reserve_layout): New function.
5274 (Sized_input_reader::Inputs_reader): Remove.
5275 (Sized_input_reader::Input_entry_reader): Remove.
5276 (Sized_input_reader::do_arg_serial): New function.
5277 (Sized_input_reader::do_get_unused_symbol_count): New function.
5278 (Sized_input_reader::do_get_unused_symbol): New function.
5279 (Sized_incremental_binary::do_input_file_count): New function.
5280 (Sized_incremental_binary::do_get_input_reader): Change signature;
5281 use index instead of filename.
5282 (Sized_incremental_binary::section_map_): New data member.
5283 (Sized_incremental_binary::input_entry_readers_): New data member.
5284 (class Sized_incr_relobj): New class.
5285 (class Sized_incr_dynobj): New class.
5286 (make_sized_incremental_object): New function.
5287 (class Incremental_library): New class.
5288 * layout.cc (Free_list::num_lists): New static data member.
5289 (Free_list::num_nodes): New static data member.
5290 (Free_list::num_removes): New static data member.
5291 (Free_list::num_remove_visits): New static data member.
5292 (Free_list::num_allocates): New static data member.
5293 (Free_list::num_allocate_visits): New static data member.
5294 (Free_list::init): New function.
5295 (Free_list::remove): New function.
5296 (Free_list::allocate): New function.
5297 (Free_list::dump): New function.
5298 (Free_list::print_stats): New function.
5299 (Layout_task_runner::run): Resize output file for incremental updates.
5300 (Layout::Layout): Initialize new data members.
5301 (Layout::set_incremental_base): New function.
5302 (Layout::init_fixed_output_section): New function.
5303 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5304 incremental updates.
5305 (Layout::create_gold_note): Do not create gold note section for
5306 incremental updates.
5307 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5308 for incremental updates.
5309 (Layout::set_section_offsets): For incremental updates, allocate space
5311 (Layout::create_symtab_sections): Layout with offsets relative to
5312 start of section; for incremental updates, allocate space from free
5314 (Layout::create_shdrs): For incremental updates, allocate space from
5316 (Layout::finish_dynamic_section): For incremental updates, do not
5317 check --as-needed (fixed in subsequent patch).
5318 * layout.h (class Free_list): New class.
5319 (Layout::set_incremental_base): New function.
5320 (Layout::incremental_base): New function.
5321 (Layout::init_fixed_output_section): New function.
5322 (Layout::allocate): New function.
5323 (Layout::incremental_base_): New data member.
5324 (Layout::free_list_): New data member.
5325 * main.cc (main): Print Free_list statistics.
5326 * object.cc (Relobj::finalize_incremental_relocs): Add
5327 clear_counts parameter; clear counts only when clear_counts is set.
5328 (Sized_relobj::Sized_relobj): Initialize new base class.
5329 (Sized_relobj::do_layout): Don't report special sections.
5330 (Sized_relobj::do_for_all_local_got_entries): New function.
5331 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5332 symtab_off to all symbol table offsets.
5333 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5334 * object.h (class Got_offset_list): Move to top of file.
5335 (Object::Object): Allow case where input_file == NULL.
5336 (Object::~Object): Likewise.
5337 (Object::input_file): Assert that input_file != NULL.
5338 (Object::lock): Allow case where input_file == NULL.
5339 (Object::unlock): Likewise.
5340 (Object::is_locked): Likewise.
5341 (Object::token): Likewise.
5342 (Object::release): Likewise.
5343 (Object::is_incremental): New function.
5344 (Object::get_mtime): New function.
5345 (Object::for_all_local_got_entries): New function.
5346 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5347 (Object::set_is_in_system_directory): New function.
5348 (Object::is_in_system_directory): New function.
5349 (Object::do_is_incremental): New function.
5350 (Object::do_get_mtime): New function.
5351 (Object::do_for_all_local_got_entries): New function.
5352 (Object::is_in_system_directory_): New data member.
5353 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5354 (class Sized_relobj_base): New class.
5355 (class Sized_relobj): Derive from Sized_relobj_base.
5356 (class Sized_relobj::Symbols): Redeclare from base class.
5357 (class Sized_relobj::local_got_offset_list): Remove.
5358 (class Sized_relobj::Output_sections): Redeclare from base class.
5359 (class Sized_relobj::do_for_all_local_got_entries): New function.
5360 (class Sized_relobj::write_local_symbols): Add offset parameter.
5361 (class Sized_relobj::local_symbol_offset_): Update comment.
5362 (class Sized_relobj::local_dynsym_offset_): Update comment.
5363 * options.cc (Input_arguments::add_file): Remove const.
5364 * options.h (Input_file_argument::Input_file_argument):
5365 Initialize arg_serial_ (all constructors).
5366 (Input_file_argument::set_arg_serial): New function.
5367 (Input_file_argument::arg_serial): New function.
5368 (Input_file_argument::arg_serial_): New data member.
5369 (Input_arguments::Input_arguments): Initialize file_count_.
5370 (Input_arguments::add_file): Remove const.
5371 (Input_arguments::number_of_input_files): New function.
5372 (Input_arguments::file_count_): New data member.
5373 (Command_line::number_of_input_files): Call
5374 Input_arguments::number_of_input_files.
5375 * output.cc (Output_segment_headers::Output_segment_headers):
5377 (Output_section::Input_section::current_data_size): New function.
5378 (Output_section::Output_section): Initialize new data members.
5379 (Output_section::add_input_section): Don't do merge sections for
5380 an incremental link; allocate space from free list for an
5382 (Output_section::add_output_section_data): Allocate space from
5383 free list for an incremental update.
5384 (Output_section::update_data_size): New function.
5385 (Output_section::set_fixed_layout): New function.
5386 (Output_section::reserve): New function.
5387 (Output_segment::set_section_addresses): Remove const.
5388 (Output_segment::set_section_list_addresses): Remove const; allocate
5389 space from free list for an incremental update.
5390 (Output_segment::set_offset): Adjust size of RELRO segment for an
5392 * output.h (Output_data::current_data_size): Move here from
5394 (Output_data::pre_finalize_data_size): New function.
5395 (Output_data::update_data_size): New function.
5396 (Output_section_headers::update_data_size): new function.
5397 (Output_section_data_build::current_data_size): Move to Output_data.
5398 (Output_data_strtab::update_data_size): New function.
5399 (Output_section::current_data_size): Move to Output_data.
5400 (Output_section::set_fixed_layout): New function.
5401 (Output_section::has_fixed_layout): New function.
5402 (Output_section::reserve): New function.
5403 (Output_section::update_data_size): New function.
5404 (Output_section::has_fixed_layout_): New data member.
5405 (Output_section::free_list_): New data member.
5406 (Output_segment::set_section_addresses): Remove const.
5407 (Output_segment::set_section_list_addresses): Remove const.
5408 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5410 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5412 * readsyms.cc (Read_symbols::do_read_symbols): Add library
5413 parameter when calling Add_symbols constructor; store argument
5414 serial number for members of a lib group.
5415 (Add_symbols::locks): Allow case where token == NULL.
5416 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5417 (Read_member::~Read_member): New function.
5418 (Read_member::is_runnable): New function.
5419 (Read_member::locks): New function.
5420 (Read_member::run): New function.
5421 (Check_script::~Check_script): New function.
5422 (Check_script::is_runnable): New function.
5423 (Check_script::locks): New function.
5424 (Check_script::run): New function.
5425 (Check_library::~Check_library): New function.
5426 (Check_library::is_runnable): New function.
5427 (Check_library::locks): New function.
5428 (Check_library::run): New function.
5429 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5430 (Add_symbols::library_): New data member.
5431 (class Read_member): New class.
5432 (class Check_script): New class.
5433 (class Check_library): New class.
5434 * reloc.cc (Read_relocs::is_runnable): Allow case where
5436 (Read_relocs::locks): Likewise.
5437 (Scan_relocs::locks): Likewise.
5438 (Relocate_task::locks): Likewise.
5439 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5441 (Sized_relobj::incremental_relocs_scan): Fix comment.
5442 (Sized_relobj::do_relocate): Pass output file offset to
5443 write_local_symbols.
5444 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5445 from class declaration.
5446 * script.cc (read_input_script): Allocate Script_info; pass
5447 argument serial number to report_script.
5448 * script.h (class Script_info): Move to incremental.h.
5449 * symtab.cc (Symbol_table::add_from_incrobj): New function.
5450 * symtab.h (Symbol_table::add_from_incrobj): New function.
5451 (Symbol_table::set_file_offset): New function.
5453 2011-04-05 Cary Coutant <ccoutant@google.com>
5455 * incremental-dump.cc (dump_incremental_inputs): Change signature
5456 to take a Sized_incremental_binary; change caller. Use readers
5457 in Sized_incremental_binary.
5459 (Sized_incremental_binary::find_incremental_inputs_sections):
5460 Rename do_find_incremental_inputs_sections to this.
5461 (Sized_incremental_binary::setup_readers): New function.
5462 (Sized_incremental_binary::do_check_inputs): Check
5463 has_incremental_info_ flag; move setup code to setup_readers;
5465 (Sized_incremental_binary::do_file_is_unchanged): New function.
5466 (Sized_incremental_binary::do_get_input_reader): New function.
5467 * incremental.h (class Incremental_binary): Move to end of file.
5468 (Incremental_binary::file_is_unchanged): New function.
5469 (Incremental_binary::do_file_is_unchanged): New function.
5470 (Incremental_binary::Input_reader): New class.
5471 (Incremental_binary::get_input_reader): New function.
5472 (class Sized_incremental_binary): Move to end of file.
5473 (Sized_incremental_binary::Sized_incremental_binary): Setup the
5474 input section reader classes.
5475 (Sized_incremental_binary::has_incremental_info): New function.
5476 (Sized_incremental_binary::inputs_reader): New function.
5477 (Sized_incremental_binary::symtab_reader): New function.
5478 (Sized_incremental_binary::relocs_reader): New function.
5479 (Sized_incremental_binary::got_plt_reader): New function.
5480 (Sized_incremental_binary::do_file_is_unchanged): New function.
5481 (Sized_incremental_binary::Sized_input_reader): New class.
5482 (Sized_incremental_binary::get_input_reader): New function.
5483 (Sized_incremental_binary::find_incremental_inputs_sections):
5484 Rename do_find_incremental_inputs_sections to this.
5485 (Sized_incremental_binary::setup_readers): New function.
5486 (Sized_incremental_binary::has_incremental_info_): New data member.
5487 (Sized_incremental_binary::inputs_reader_): New data member.
5488 (Sized_incremental_binary::symtab_reader_): New data member.
5489 (Sized_incremental_binary::relocs_reader_): New data member.
5490 (Sized_incremental_binary::got_plt_reader_): New data member.
5491 (Sized_incremental_binary::current_input_file_): New data member.
5493 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
5496 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5499 2011-03-30 Cary Coutant <ccoutant@google.com>
5501 * archive.cc (Archive::include_member): Adjust call to report_object.
5502 (Add_archive_symbols::run): Add script_info to call to
5503 report_archive_begin.
5504 (Lib_group::include_member): Adjust call to report_object.
5505 (Add_lib_group_symbols::run): Adjust call to report_object.
5506 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5507 blocks. Add object count for script input files.
5508 * incremental.cc (Incremental_inputs::report_archive_begin): Add
5509 script_info parameter; change all callers.
5510 (Incremental_inputs::report_object): Add script_info parameter;
5512 (Incremental_inputs::report_script): Store backpointer to
5513 incremental info entry.
5514 (Output_section_incremental_inputs::set_final_data_size): Record
5515 additional information for scripts.
5516 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5517 * incremental.h (Incremental_script_entry::add_object): New function.
5518 (Incremental_script_entry::get_object_count): New function.
5519 (Incremental_script_entry::get_object): New function.
5520 (Incremental_script_entry::objects_): New data member; adjust
5522 (Incremental_inputs::report_archive_begin): Add script_info parameter.
5523 (Incremental_inputs::report_object): Add script_info parameter.
5524 (Incremental_inputs_reader::get_object_count): New function.
5525 (Incremental_inputs_reader::get_object_offset): New function.
5526 * options.cc (Input_arguments::add_file): Return reference to
5528 * options.h (Input_argument::set_script_info): New function.
5529 (Input_argument::script_info): New function.
5530 (Input_argument::script_info_): New data member; adjust all
5532 (Input_file_group::add_file): Return reference to new input argument.
5533 (Input_file_lib::add_file): Likewise.
5534 (Input_arguments::add_file): Likewise.
5535 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5536 * script.cc (Parser_closure::Parser_closure): Add script_info
5537 parameter; adjust all callers.
5538 (Parser_closure::script_info): New function.
5539 (Parser_closure::script_info_): New data member.
5540 (read_input_script): Report scripts earlier to incremental info.
5541 (script_add_file): Set script_info in Input_argument.
5542 (script_add_library): Likewise.
5543 * script.h (Script_options::Script_info): Rewrite class.
5545 2011-03-29 Cary Coutant <ccoutant@google.com>
5547 * archive.cc (Library_base::should_include_member): Move
5548 method here from class Archive.
5549 (Archive::Archive): Initialize base class.
5550 (Archive::should_include_member): Move to base class.
5551 (Archive::do_for_all_unused_symbols): New function.
5552 (Add_archive_symbols::run): Remove redundant access to
5554 (Lib_group::Lib_group): Initialize base class.
5555 (Lib_group::do_filename): New function.
5556 (Lib_group::include_member): Pass pointer to Lib_group to
5558 (Lib_group::do_for_all_unused_symbols): New function.
5559 (Add_lib_group_symbols::run): Report archive information for
5561 * archive.h (class Library_base): New base class.
5562 (class Archive): Derive from Library_base.
5563 (Archive::filename): Move to base class.
5564 (Archive::set_incremental_info): Likewise.
5565 (Archive::incremental_info): Likewise.
5566 (Archive::Should_include): Likewise.
5567 (Archive::should_include_member): Likewise.
5568 (Archive::Armap_entry): Remove.
5569 (Archive::Unused_symbol_iterator): Remove.
5570 (Archive::unused_symbols_begin): Remove.
5571 (Archive::unused_symbols_end): Remove.
5572 (Archive::do_filename): New function.
5573 (Archive::do_get_mtime): New function.
5574 (Archive::do_for_all_unused_symbols): New function.
5575 (Archive::task_): Move to base class.
5576 (Archive::incremental_info_): Likewise.
5577 (class Lib_group): Derive from Library_base.
5578 (Lib_group::do_filename): New function.
5579 (Lib_group::do_get_mtime): New function.
5580 (Lib_group::do_for_all_unused_symbols): New function.
5581 (Lib_group::task_): Move to base class.
5582 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5584 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5586 * incremental.cc (Incremental_inputs::report_archive_begin):
5587 Use Library_base; call library's get_mtime; add incremental inputs
5588 entry before members.
5589 (class Unused_symbol_visitor): New class.
5590 (Incremental_inputs::report_archive_end): Use Library_base; use
5591 visitor class to record unused symbols; don't add incremental inputs
5592 entry after members.
5593 (Incremental_inputs::report_object): Use Library_base.
5595 (Incremental_archive_entry::Incremental_archive_entry): Remove
5596 unused Archive parameter.
5597 (Incremental_inputs::report_archive_begin): Use Library_base.
5598 (Incremental_inputs::report_archive_end): Likewise.
5599 (Incremental_inputs::report_object): Likewise.
5600 * object.cc (Sized_relobj::do_for_all_global_symbols): New
5602 * object.h (Object::for_all_global_symbols): New function.
5603 (Object::do_for_all_global_symbols): New function.
5604 (Sized_relobj::do_for_all_global_symbols): New function.
5605 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
5607 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
5610 2011-03-27 Ian Lance Taylor <iant@google.com>
5612 * archive.cc (Archive::interpret_header): Return -1 if something
5613 goes wrong. Change callers accordingly.
5615 2011-03-25 Cary Coutant <ccoutant@google.com>
5617 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5618 * testsuite/Makefile.in: Regenerate.
5620 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
5622 * plugin.cc (get_view): New.
5623 (Plugin::load): Pass get_view to the plugin.
5624 (Plugin_manager::get_view): New.
5626 2011-03-21 Ian Lance Taylor <iant@google.com>
5628 * testsuite/final_layout.sh: Rewrite to not use dc.
5629 * testsuite/relro_test.sh: Fail if dc is not present.
5631 2011-03-21 Sriraman Tallam <tmsriram@google.com>
5633 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5635 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5636 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5638 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5639 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5641 2011-03-14 Ian Lance Taylor <iant@google.com>
5643 * script-sections.cc (Sort_output_sections::script_compare):
5644 Rename from is_before, change return type.
5645 (Sort_output_sections::operator()): Adjust accordingly.
5647 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
5650 * testsuite/odr_violation2.cc: Add comment to make all error line
5651 numbers double digits.
5652 * testsuite/debug_msg.sh: Adjust expected errors.
5654 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
5656 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5657 but mark earlier ones as non-canonical
5658 (offset_to_iterator): Update search target and example
5659 (do_addr2line): Return extra lines in a vector*
5660 (format_file_lineno): Extract from do_addr2line
5661 (one_addr2line): Add vector* out-param
5662 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5663 when a lineno entry appeared last for its instruction
5664 (Dwarf_line_info): Add vector* out-param
5665 * object.cc (Relocate_info): Pass NULL for the vector* out-param
5666 * symtab.cc (Odr_violation_compare): Include the lineno in the
5668 (linenos_from_loc): New. Combine the canonical line for an
5669 address with its other lines.
5670 (True_if_intersect): New. Helper functor to make
5671 std::set_intersection a query.
5672 (detect_odr_violations): Compare sets of lines instead of just
5673 one line for each function. This became less deterministic, but
5674 has fewer false positives.
5675 * symtab.h: Declarations.
5676 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5677 mix an optimized and non-optimized object in the same binary
5678 (odr_violation2.so): Same.
5679 * testsuite/Makefile.in: Regenerate from Makefile.am.
5680 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5681 * testsuite/debug_msg.sh: Update line numbers and add
5683 * testsuite/odr_violation1.cc: Use OdrDerived, in a
5684 non-optimized context.
5685 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5686 isn't inlined, and use OdrDerived in an optimized context.
5687 * testsuite/odr_header1.h: Defines OdrDerived, where
5688 optimization will change the
5689 first-instruction-in-the-destructor's file and line number.
5690 * testsuite/odr_header2.h: Defines OdrBase.
5692 2011-03-09 Ian Lance Taylor <iant@google.com>
5694 * fileread.cc (File_read::clear_views): Don't delete the whole
5697 2011-03-08 Ian Lance Taylor <iant@google.com>
5700 * fileread.cc: #include <climits>.
5701 (GOLD_IOV_MAX): Define.
5702 (File_read::read_multiple): Limit number of entries by iov_max.
5703 * fileread.h (class File_read): Always set max_readv_entries to
5706 2011-03-07 Ian Lance Taylor <iant@google.com>
5709 * options.h (class General_options): Add -dy and -dn.
5711 2011-03-02 Cary Coutant <ccoutant@google.com>
5713 * testsuite/script_test_9.t: Add TLS segment.
5715 2011-03-02 Simon Baldwin <simonb@google.com>
5717 * configure.ac: Add check for gnu_indirect_function support in
5718 the toolchain building binutils.
5719 * configure: Rebuild.
5721 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
5723 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5724 plugin only symbols.
5725 (Symbol_table::sized_finalize_symbol) Mark symbol only present
5726 in plugin files as not needed in the symbol table.
5728 2011-02-11 Sriraman Tallam <tmsriram@google.com>
5730 * output.cc (Output_section::add_input_section): Delay fill
5731 generation for section ordering.
5733 2011-02-09 Ian Lance Taylor <iant@google.com>
5736 * object.h (class Sized_relobj): Remove clear_local_symbols.
5737 * reloc.cc (Sized_relobj::do_relocate): Don't call
5738 clear_local_symbols.
5740 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
5742 * plugin.cc (is_visible_from_outside): Return true for symbols
5745 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
5747 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5750 2011-02-02 Sriraman Tallam <tmsriram@google.com>
5752 * icf.h (is_section_foldable_candidate): Change type of parameter
5754 * icf.cc (Icf::find_identical_sections): Change type of local variable
5755 section_name to be std::string.
5756 (is_function_ctor_or_dtor): Change type of parameter to std::string.
5758 2011-01-25 Ian Lance Taylor <iant@google.com>
5760 * script.cc (script_add_extern): Rewrite to use
5761 add_symbol_reference.
5763 2011-01-25 Doug Kwan <dougkwan@google.com>
5765 * icf.cc (get_section_contents): Always lock section's object.
5767 2011-01-24 Ian Lance Taylor <iant@google.com>
5769 * options.h (class General_options): Accept
5770 --no-detect-odr-violations.
5772 2011-01-24 Ian Lance Taylor <iant@google.com>
5774 * version.cc (version_string): Bump to 1.11.
5776 2011-01-24 Ian Lance Taylor <iant@google.com>
5778 * plugin.cc (class Plugin_rescan): Define new class.
5779 (Plugin_manager::claim_file): Set any_claimed_.
5780 (Plugin_manager::save_archive): New function.
5781 (Plugin_manager::save_input_group): New function.
5782 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5784 (Plugin_manager::new_undefined_symbol): New function.
5785 (Plugin_manager::rescan): New function.
5786 (Plugin_manager::rescannable_defines): New function.
5787 (Plugin_manager::add_input_file): Set any_added_.
5788 * plugin.h (class Plugin_manager): define new fields rescannable_,
5789 undefined_symbols_, any_claimed_, and any_added_. Declare
5790 Plugin_rescan as friend. Declare new functions.
5791 (Plugin_manager::Rescannable): Define type.
5792 (Plugin_manager::Rescannable_list): Define type.
5793 (Plugin_manager::Undefined_symbol_list): Define type.
5794 (Plugin_manager::Plugin_manager): Initialize new fields.
5795 * archive.cc (Archive::defines_symbol): New function.
5796 (Add_archive_symbols::run): Pass archive to plugins if any.
5797 * archive.h (class Archive): Declare defines_symbol.
5798 * readsyms.cc (Input_group::~Input_group): New function.
5799 (Finish_group::run): Pass input_group to plugins if any.
5800 * readsyms.h (class Input_group): Declare destructor.
5801 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5804 2011-01-10 Ian Lance Taylor <iant@google.com>
5806 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5808 (Layout::set_segment_offsets): Reset increase_relro before calling
5809 set_section_addresses a second time.
5811 2011-01-04 Cary Coutant <ccoutant@google.com>
5813 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5814 sections before NOBITS sections.
5816 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
5818 * version.cc (print_version): Update copyright to 2011.
5820 2010-12-23 Cary Coutant <ccoutant@google.com>
5822 * output.h (Output_data_reloc::add_output_section): Pass OD instead
5823 of OS to this->add. Add OD parameter to second form of the function.
5825 2010-12-20 Ian Lance Taylor <iant@google.com>
5827 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5828 second of two consecutive entries with same offset.
5830 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5832 * testsuite/Makefile.am (ifuncmain2static_LDADD)
5833 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5834 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5835 to avoid unneeded links against $(LDADD).
5836 * testsuite/Makefile.in: Regenerate.
5838 2010-12-15 Ian Lance Taylor <iant@google.com>
5841 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5842 for R_X86_64_32 and R_X86_64_PC32.
5843 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5844 ver_matching_def_pic.o.
5845 (ver_matching_def_pic.o): New target.
5847 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5849 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5850 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5851 Move definition before File_read::View member definitions.
5852 (File_read::View::~View): Initialize and hold lock before
5853 updating current_mapped_bytes.
5855 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5857 * dwarf_reader.cc: Remove outdated comment.
5858 * gold-threads.cc: Fix typo in error message.
5859 * archive.cc: Fix typos in comments.
5860 * archive.h: Likewise.
5861 * arm-reloc-property.cc: Likewise.
5862 * arm-reloc-property.h: Likewise.
5863 * arm-reloc.def: Likewise.
5865 * attributes.h: Likewise.
5866 * cref.cc: Likewise.
5867 * ehframe.cc: Likewise.
5868 * fileread.h: Likewise.
5870 * i386.cc: Likewise.
5872 * incremental.h: Likewise.
5873 * int_encoding.cc: Likewise.
5874 * layout.h: Likewise.
5875 * main.cc: Likewise.
5876 * merge.h: Likewise.
5877 * object.cc: Likewise.
5878 * object.h: Likewise.
5879 * options.cc: Likewise.
5880 * readsyms.cc: Likewise.
5881 * reduced_debug_output.cc: Likewise.
5882 * reloc.cc: Likewise.
5883 * script-sections.cc: Likewise.
5884 * sparc.cc: Likewise.
5885 * symtab.h: Likewise.
5886 * target-reloc.h: Likewise.
5887 * target.cc: Likewise.
5888 * target.h: Likewise.
5889 * timer.cc: Likewise.
5890 * timer.h: Likewise.
5891 * x86_64.cc: Likewise.
5893 2010-12-09 Cary Coutant <ccoutant@google.com>
5895 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5897 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5898 parameter; change all callers.
5899 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5900 * options.h (warn_execstack): New option.
5902 2010-12-07 Doug Kwan <dougkwan@google.com>
5904 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5905 like function call relocations.
5907 2010-12-07 Ian Lance Taylor <iant@google.com>
5909 * archive.cc (Archive::get_elf_object_for_member): Permit
5910 punconfigured to be NULL.
5911 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5912 (Archive::include_member): Pass NULL to get_elf_object_for_member
5913 if we searched for the archive and this is the first included
5916 2010-12-01 Ian Lance Taylor <iant@google.com>
5918 * dwarf_reader.h (class Sized_dwarf_line_info): Add
5919 track_relocs_type_ field.
5920 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5921 Set track_relocs_type_.
5922 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5923 contents when using RELA relocs.
5924 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5926 * reloc.cc (Track_relocs::next_addend): New function.
5927 * reloc.h (class Track_relocs): Declare next_addend.
5929 2010-12-01 Ian Lance Taylor <iant@google.com>
5931 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5934 2010-12-01 Ian Lance Taylor <iant@google.com>
5936 * README: Update compilers known to work and fail.
5938 2010-11-23 Matthias Klose <doko@ubuntu.com>
5940 * configure.in: For --enable-gold, handle value `default' instead of
5941 `both*'. Always install ld as ld.bfd, install as ld if gold is
5943 * configure: Regenerate.
5945 2010-11-18 Doug Kwan <dougkwan@google.com>
5947 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5948 and right_alignment to be zero. Store result alignment only if it is
5949 greater than existing alignment.
5951 2010-11-16 Cary Coutant <ccoutant@google.com>
5954 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5955 Check for ".zdebug_line".
5957 2010-11-16 Doug Kwan <dougkwan@google.com>
5958 Cary Coutant <ccoutant@google.com>
5960 * output.h (Output_segment::set_section_addresses): Pass increase_relro
5961 by reference; adjust all callers.
5962 * output.cc (Output_segment::set_section_addresses): Adjust references
5963 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5965 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5966 end at page boundary.
5968 2010-11-16 Cary Coutant <ccoutant@google.com>
5971 * layout.cc (Layout::choose_output_section): Transform names of
5972 compressed sections even when using a script with a SECTIONS clause.
5973 (Layout::output_section_name): Remove code to transform
5974 compressed debug section names.
5975 * output.cc (Output_section::add_input_section): Use uncompressed
5976 section size when tracking input sections.
5978 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
5980 * symtab.h (Symbol::NON_PIC_REF): Remove.
5981 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5982 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
5983 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5984 (Symbol::use_plt_offset): Take a flags argument and pass it
5985 directly to needs_dynamic_reloc. Restrict check for undefined
5986 weak symbols to function calls.
5987 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5988 (Target_arm::Scan::global): Use it.
5989 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5990 (Target_arm::Relocate::relocate): Likewise.
5991 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5992 parameter with an r_type parameter. Use get_reference_flags
5994 (Target_arm::Relocate::relocate): Update accordingly.
5995 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5996 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5997 (Target_i386::Scan::global): Likewise.
5998 (Target_i386::Relocate::relocate): Likewise.
5999 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6000 parameter with an r_type parameter. Use get_reference_flags
6002 (Target_i386::Relocate::relocate): Update accordingly.
6003 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6004 (Target_powerpc::Scan::global): Use it.
6005 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6006 (Target_powerpc::Relocate::relocate): Likewise.
6007 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6008 (Target_sparc::Scan::global): Use it.
6009 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6010 (Target_sparc::Relocate::relocate): Likewise.
6011 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6012 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6013 (Target_x86_64::Scan::global): Likewise.
6014 (Target_x86_64::Relocate::relocate): Likewise.
6016 2010-11-08 Doug Kwan <dougkwan@google.com>
6017 Cary Coutant <ccoutant@google.com>
6019 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6020 (Arm_exidx_merge_section::section_contents_): New data member.
6021 (Arm_input_section::Arm_input_section): Initialize original_contents_.
6022 (Arm_input_section::~Arm_input_section): De-allocate memory.
6023 (Arm_input_section::original_contents_): New data member.
6024 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6025 in parameters instead of calling Object::section_contents without
6027 (Arm_output_section::group_section): New parameter TASK. Pass it
6028 to callees that need locking objects.
6029 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
6030 to lock EXIDX input sections. Fix a formatting issue. Call
6031 Arm_exidx_merged_section::build_contents to create merged section
6033 (Arm_output_section::create_stub_group): New parameter TASK. Use it
6034 to lock object of stub table owner.
6035 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6036 TEXT_SIZE to initialize data member TEXT_SIZE_.
6037 (Arm_exidx_input_section::addralign): Fix typo in comment.
6038 (Arm_exidx_input_section::text_size): New method.
6039 (Target_arm::do_relax): New parameter TASK. Pass it to callees
6040 that require locking objects. Lock objects before scanning for stubs
6041 and updating local symbols.
6042 (Arm_input_section<big_endian>::init): Copy contents of original
6044 (Arm_input_section<big_endian>::do_write): Use saved contents of
6045 original input section instead of calling Object::section_contents
6047 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6048 size without calling Object::section_size().
6049 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6050 for size. Allocate a buffer for merged EXIDX entries.
6051 (Arm_exidx_merged_section::build_contents): New method.
6052 (Arm_exidx_merged_section::do_write): Move merge section contents
6053 building code to Arm_exidx_merged_section::build_contetns. Write
6054 out contetns in buffer instead of building it on the fly.
6055 (Arm_relobj::make_exidx_input_section): Also pass text section size
6056 to Arm_exidx_input_section constructor.
6057 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
6058 (Arm_dynobj::do_read_symbols): Fix memory leak.
6059 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6060 * target.h: (class Task): Add forward declaration.
6061 (Target::relax): Add new parameter TASK and pass it to
6063 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
6065 2010-11-05 Cary Coutant <ccoutant@google.com>
6068 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6069 object when reading from the file.
6070 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6072 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6073 when reading section contents.
6074 (get_section_contents): Likewise.
6075 (icf::find_identical_sections): Likewise.
6076 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6077 object when reading from the file.
6078 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6079 the object when doing deferred section layout.
6081 2010-11-03 Nick Clifton <nickc@redhat.com>
6084 * script.h (class Symbol_assignment: name): New member. Returns
6085 the name of the symbol.
6086 * scrfipt.cc (Script_options::is_pending_assignment): New member.
6087 Returns true if the given symbol name is on the list of
6088 assignments wating to be processed.
6089 * archive.cc (should_incldue_member): If the symbol is undefined,
6090 check to see if it is on the list of symbols pending assignment.
6092 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
6094 * script-sections.cc (Script_sections::find_memory_region): Check
6095 for a NULL output section pointer.
6097 2010-10-29 Doug Kwan <dougkwan@google.com>
6099 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6100 Output_section::add_relaxed_input_section.
6101 * output.cc (Output_section::add_relaxed_input_section): Add new
6102 arguments LAYOUT and NAME. Set section order index.
6103 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6104 Copy section order index.
6105 * output.h (Output_section::add_relaxed_input_section): Add new
6106 arguments LAYOUT and NAME.
6108 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6110 * testsuite/Makefile.am: Move gcctestdir/ld rule to
6111 NATIVE_OR_CROSS_LINKER.
6112 * testsuite/Makefile.in: Regenerate.
6114 2010-10-20 Doug Kwan <dougkwan@google.com>
6116 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6117 without SHF_LINK_ORDER flags.
6118 * layout.cc (Layout::choose_output_section): Do not filter
6119 SHF_LINK_ORDER flag in a relocatable link.
6121 2010-10-17 Cary Coutant <ccoutant@google.com>
6123 * output.h (Output_segment::set_section_addresses): Change function
6124 signature. Update all callers.
6125 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6127 (Output_segment::set_section_addresses): Align after last TLS
6128 section. Add padding before last relro section instead of after.
6130 2010-10-17 Doug Kwan <dougkwan@google.com>
6132 * gold/arm.cc (Target_arm::got_section): Use correct order and set
6133 GOT output section to be writable.
6135 2010-10-14 Cary Coutant <ccoutant@google.com>
6137 * debug.h (DEBUG_INCREMENTAL): New flag.
6138 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6139 * gold.cc (queue_initial_tasks): Check parameters for incremental link
6141 * incremental.cc (report_command_line): Ignore all forms of
6143 * layout.cc (Layout::Layout): Check parameters for incremental link
6145 * options.cc (General_options::parse_incremental): New function.
6146 (General_options::parse_no_incremental): New function.
6147 (General_options::parse_incremental_full): New function.
6148 (General_options::parse_incremental_update): New function.
6149 (General_options::incremental_mode_): New data member.
6150 (General_options::finalize): Check incremental_mode_.
6151 * options.h (General_options): Update help text for --incremental.
6152 Add --no-incremental, --incremental-full, --incremental-update.
6153 (General_options::Incremental_mode): New enum type.
6154 (General_options::incremental_mode): New function.
6155 (General_options::incremental_mode_): New data member.
6156 * parameters.cc (Parameters::incremental_mode_): New data member.
6157 (Parameters::set_options): Set incremental_mode_.
6158 (Parameters::set_incremental_full): New function.
6159 (Parameters::incremental): New function.
6160 (Parameters::incremental_update): New function.
6161 (set_parameters_incremental_full): New function.
6162 * parameters.h (Parameters::set_incremental_full): New function.
6163 (Parameters::incremental): New function.
6164 (Parameters::incremental_update): New function.
6165 (Parameters::incremental_mode_): New data member.
6166 (set_parameters_incremental_full): New function.
6167 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6168 incremental link mode.
6169 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6170 (Sized_relobj::do_relocate_sections): Likewise.
6171 * testsuite/Makefile.am (incremental_test): Use --incremental-full
6173 * testsuite/Makefile.in: Regenerate.
6174 * testsuite/incremental_test.sh: Filter all forms of --incremental.
6176 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6178 * script-sections.h (class Script_sections): Make
6179 Sections_elements typedef public.
6180 * script-sections.cc (class Sort_output_sections): Add elements_
6181 field. Add constructor which sets it; change all callers.
6182 (Sort_output_sections::is_before): New function.
6183 (Sort_output_sections::operator()): Call is_before.
6184 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6186 * testsuite/script_test_10.sh: New test. Test script section
6188 * testsuite/script_test_10.t: Likewise.
6189 * testsuite/script_test_10.s: Likewise.
6190 * testsuite/Makefile.am: Wrap the cross linker tests and the
6191 common tests into NATIVE_OR_CROSS_LINKER.
6192 (check_SCRIPTS): Add script_test_10.sh.
6193 (check_DATA): Add script_test_10.stdout.
6194 (script_test_10.o, script_test_10): New targets.
6195 (script_test_10.stdout): New target.
6196 * configure, testsuite/Makefile.in: Regenerate.
6198 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6200 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6201 error for the deprecated relocations.
6202 (Target_arm::Scan::global): Likewise.
6203 (Target_arm::Relocate::relocate): Likewise.
6205 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
6207 * fileread.cc (Input_file::find_file): Initialize *found_name
6208 and *namep when using the fallback search for case 4.
6210 2010-10-11 Cary Coutant <ccoutant@google.com>
6212 * options.h (class General_options): Redefine -z lazy as an alias for
6213 the negation of -z now.
6215 2010-10-11 Ian Lance Taylor <iant@google.com>
6217 * resolve.cc (symbol_to_bits): Report the value of the unsupported
6220 2010-10-06 Nick Clifton <nickc@redhat.com>
6222 * script-sections.cc(class Memory_region): Remove
6223 current_lma_offset_ field. Rename current_vma_offset_ to
6224 current_offset_. Add last_section_ field.
6225 (Memory_region::get_current_vma_address): Rename to
6226 get_current_address.
6227 (Memory_region::get_current_lma_address): Delete.
6228 (Memory_region::increment_vma_offset): Rename to
6230 (Memory_region::increment_lma_offset): Delete.
6231 (Memory_region::attributes_compatible): New method. Returns
6232 true if the provided section is compatible with the region.
6233 (Memory_region::get_last_section): New method. Returns the last
6234 section to use the region.
6235 (Memory_region::set_last_section): New method. Stores the last
6236 section to use the region.
6237 (Script_sections::block_in_region): New method. Returns true if
6238 a block of memory is contained within a region.
6239 (Script_sections::find_memory_region): New method. Locates a
6240 memory region to be used to set a VMA or LMA address.
6241 (Output_section_definition::set_section_addresses): Add code to
6242 check for addresses set by memory regions.
6243 (Output_segment::set_section_addresses): Remove memory region
6245 (Script_sections::create_segment): Add a warning if a header
6246 segment is created outside of any region.
6247 * script-sections.h (class Script_sections): Add prototypes for
6248 find_memory_region and block_in_region methods.
6249 * testsuite/memory_test.s: Use .long instead of .word.
6250 * testsuite/memory_test.t: Add some more output sections.
6251 * testsuite/memory_test.sh: Update expected output.
6253 2010-10-02 Doug Kwan <dougkwan@google.com>
6255 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6256 defintion to symtab.h
6257 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6258 declaration to defintion.
6260 2010-10-01 Nick Clifton <nickc@redhat.com>
6262 * expression.cc (eval): Replace dummy argument with NULL.
6263 (eval_maybe_dot): Check for a NULL result section pointer.
6264 (Symbol_expression::value): Likewise.
6265 (Dot_expression::value): Likewise.
6266 (BINARY_EXPRESSION): Likewise.
6267 (Max_expression::value): Likewise.
6268 (Min_expression::value): Likewise.
6269 (Absolute_expression::value): Likewise.
6270 (Addr_expression::value_from_output_section): Likewise.
6271 (Loaddddr_expression::value_from_output_section): Likewise.
6272 (Segment_start_expression::value): Likewise.
6273 * script-sections.cc
6274 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6276 (Sections_elememt_dot_assignment::set_section_addresses):
6278 (Output_data_expression::do_write_to_buffer): Likewise.
6279 (Output_section_definition::finalize_symbols): Likewise.
6280 (Output_section_definition::set_section_addresses): Likewise.
6282 2010-09-30 Doug Kwan <dougkwan@google.com>
6284 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6286 2010-09-28 Sriraman Tallam <tmsriram@google.com>
6288 * target.h (Target::can_icf_inline_merge_sections): New virtual
6290 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6292 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6294 * icf.cc (get_section_contents): Inline merge sections only when
6297 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6299 * configure: Regenerate.
6301 2010-09-17 Ian Lance Taylor <iant@google.com>
6303 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6304 * testsuite/Makefile.am (memory_test.o): New target.
6305 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6307 * testsuite/Makefile.in: Rebuild.
6309 2010-09-17 Doug Kwan <dougkwan@google.com>
6311 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6312 defintion if relocation uses GOT entries of the symbol.
6313 * testsuite/icf_safe_test.sh: Fix test.
6314 * testsuite/icf_safe_so_test.sh: Fix test.
6316 2010-09-16 Cary Coutant <ccoutant@google.com>
6318 * script_sections.cc (class Memory_region): Remove "NULL" from
6319 vector initializations.
6321 2010-09-15 Cary Coutant <ccoutant@google.com>
6323 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6324 Resolve forwarding symbols.
6326 2010-09-15 Doug Kwan <dougkwan@google.com>
6328 * gold/testsuite/script_test_3.t: Add ARM special sections.
6329 * gold/testsuite/script_test_4.t: Same.
6330 * gold/testsuite/script_test_5.t: Same.
6331 * gold/testsuite/script_test_6.t: Same.
6332 * gold/testsuite/script_test_7.t: Same.
6333 * gold/testsuite/script_test_7.t: Same.
6334 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6336 2010-09-14 Cary Coutant <ccoutant@google.com>
6338 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6339 (Target_x86_64::Relocate::relocate_tls): Replace check for
6340 saw_tls_block_reloc_ with test for executable section.
6342 2010-09-12 Cary Coutant <ccoutant@google.com>
6344 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6345 position-independent executables to shared libraries need dynamic
6347 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6348 position-independent executables.
6349 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6350 * testsuite/Makefile.in: Regenerate.
6352 2010-09-10 Nick Clifton <nickc@redhat.com>
6355 * testsuite/memory_test.t: Discard any sections that are not
6358 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
6361 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6362 "This::" to work around a bug in gcc 4.2.
6364 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6366 2010-09-09 Rafael Espindola <espindola@google.com>
6368 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6369 sections with different PF_X flags in the same segment.
6370 (Layout::find_first_load_seg): Search all segments to find the first
6372 * options.h (rosegment): New.
6374 2010-09-08 Rafael Espindola <espindola@google.com>
6376 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6378 2010-09-08 Doug Kwan <dougkwan@google.com>
6380 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6381 (Arm_relobj::do_relocate_sections): Add new parameter for output
6382 file to match the parent.
6383 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6384 of local symbols instead of input values. Update code to track
6385 changes in gold::relocate_section.
6386 * object.cc (Sized_relobj::compute_final_local_value): New methods.
6387 (Sized_relobj::compute_final_local_value_internal): New methods.
6388 (Sized_relobj::do_finalize_local_symbols): Move code from loop
6389 body into private version of Sized_relobj::compute_final_local_value.
6390 Call the inline method.
6391 * object.h (Symbol_value::Symbol_value): Define destructor. Free
6392 merged symbol value if there is one.
6393 (Symbol_value::has_output_value): New method defintiion.
6394 (Sized_relobj::Compute_final_local_value_status): New enum type.
6395 (Sized_relobj::compute_final_local_value): New methods.
6396 (Sized_relobj::compute_final_local_value_internal): New methods.
6397 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6398 and arm_cortex_a8.sh.
6399 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6400 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6402 * Makefile.in: Regenerate.
6403 * testsuite/arm_bl_out_of_range.s: Update test.
6404 * testsuite/thumb_bl_out_of_range.s: Ditto.
6405 * testsuite/thumb_blx_out_of_range.s: Ditto.
6406 * testsuite/arm_branch_out_of_range.sh: New file.
6407 * testsuite/arm_cortex_a8.sh: Ditto.
6408 * testsuite/arm_cortex_a8_b.s: Ditto.
6409 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6410 * testsuite/arm_cortex_a8_b_local.s: Ditto.
6411 * testsuite/arm_cortex_a8_bl.s: Ditto.
6412 * testsuite/arm_cortex_a8_blx.s: Ditto.
6413 * testsuite/arm_cortex_a8_local.s: Ditto.
6414 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6415 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6417 2010-09-08 Rafael Espindola <espindola@google.com>
6419 * Makefile.am (memory_test.stdout): Run readelf with -W.
6420 * Makefile.in: Regenerate.
6421 * testsuite/memory_test.sh: Make the regexps accept both 32 and
6424 2010-09-08 Rafael Espindola <espindola@google.com>
6426 * script-sections.cc (Script_sections::add_memory_region): Convert
6427 field precision to int.
6428 * script.cc (script_set_section_region, script_set_section_region):
6429 Convert field precision to int.
6431 2010-09-08 Rafael Espindola <espindola@google.com>
6433 * arm.cc (do_finalize_sections): Create the __exidx_start and
6434 __exdix_end symbols even when the section is missing.
6436 2010-09-08 Nick Clifton <nickc@redhat.com>
6438 * README: Remove claim that MEMORY is not supported.
6439 * expression.cc (script_exp_function_origin)
6440 (script_exp_function_length): Move from here to ...
6441 * script.cc: ... here.
6442 (script_set_section_region, script_add_memory)
6443 (script_parse_memory_attr, script_include_directive): New
6445 * script-sections.cc
6446 (class Memory_region): New class.
6447 (class Output_section_definition): Add set_memory_region,
6448 set_section_vma, set_section_lma and get_section_name methods.
6449 (class Script_Sections): Add add_memory_region,
6450 find_memory_region, find_memory_region_origin,
6451 find_memory_region_length and set_memory_region methods.
6452 Have set_section_addresses method walk the list of set memory
6454 Extend the print methos to display memory regions.
6455 * script-sections.h: Add prototypes for new methods.
6456 Add enum for MEMORY region attributes.
6457 * yyscript.y: Add support for parsing MEMORY regions.
6458 * script-c.h: Add prototypes for new functions.
6459 * testsuite/Makefile.am: Add test of MEMORY region functionality.
6460 * testsuite/Makefile.in: Regenerate.
6461 * testsuite/memory_test.sh: New script.
6462 * testsuite/memory_test.s: New assembler source file.
6463 * testsuite/memory_test.t: New linker script.
6465 2010-08-27 Doug Kwan <dougkwan@google.com>
6467 * gold/resolve.cc (Symbol_table::should_override): Let a weak
6468 reference override an existing dynamic weak reference.
6469 * testsuite/Makefile.am: Add new test dyn_weak_ref.
6470 * testsuite/Makefile.in: Regenerate.
6471 * testsuite/dyn_weak_ref.sh: New file.
6472 * testsuite/dyn_weak_ref_1.c: Ditto.
6473 * testsuite/dyn_weak_ref_2.c: Ditto.
6475 2010-08-27 Ian Lance Taylor <iant@google.com>
6477 * incremental.h (class Incremental_input_entry): Add virtual
6480 2010-08-27 Ian Lance Taylor <iant@google.com>
6482 * testsuite/start_lib_test_3.c: Mark t3 as used.
6484 2010-08-27 Nick Clifton <nickc@redhat.com>
6486 * options.cc (version_script): Fix small typo in previous
6489 2010-08-25 Nick Clifton <nickc@redhat.com>
6491 * archive.cc: Formatting fixes: Remove whitespace between
6492 typename and following asterisk. Remove whitespace between
6493 function name and opening parenthesis.
6494 * archive.h: Likewise.
6496 * attributes.cc: Likewise.
6497 * attributes.h: Likewise.
6498 * common.cc: Likewise.
6499 * copy-relocs.cc: Likewise.
6500 * dirsearch.h: Likewise.
6501 * dynobj.cc: Likewise.
6502 * ehframe.cc: Likewise.
6503 * ehframe.h: Likewise.
6504 * expression.cc: Likewise.
6505 * fileread.cc: Likewise.
6506 * fileread.h: Likewise.
6508 * gold-threads.cc: Likewise.
6509 * gold.cc: Likewise.
6510 * i386.cc: Likewise.
6512 * incremental-dump.cc: Likewise.
6513 * incremental.cc: Likewise.
6514 * layout.cc: Likewise.
6515 * layout.h: Likewise.
6516 * main.cc: Likewise.
6517 * merge.cc: Likewise.
6518 * merge.h: Likewise.
6519 * object.cc: Likewise.
6520 * object.h: Likewise.
6521 * options.cc: Likewise.
6522 * options.h: Likewise.
6523 * output.cc: Likewise.
6524 * output.h: Likewise.
6525 * plugin.cc: Likewise.
6526 * plugin.h: Likewise.
6527 * powerpc.cc: Likewise.
6528 * reloc.cc: Likewise.
6529 * script-c.h: Likewise.
6530 * script-sections.cc: Likewise.
6531 * script.cc: Likewise.
6532 * stringpool.cc: Likewise.
6533 * symtab.cc: Likewise.
6534 * symtab.h: Likewise.
6535 * target.cc: Likewise.
6536 * timer.cc: Likewise.
6537 * timer.h: Likewise.
6538 * version.cc: Likewise.
6539 * x86_64.cc: Likewise.
6541 2010-08-24 Nick Clifton <nickc@redhat.com>
6544 * layout.cc (segment_precedes): Sort segments by their physical
6545 addresses, if they have been set.
6547 2010-08-23 Cary Coutant <ccoutant@google.com>
6549 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6551 (Lib_group::include_member): Unlock object after deleting its
6553 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6556 2010-08-19 Neil Vachharajani <nvachhar@google.com>
6557 Cary Coutant <ccoutant@google.com>
6559 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6560 constructor, and set_blocker.
6561 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6563 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6564 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6565 * testsuite/Makefile.am (start_lib_test): New test case.
6566 * testsuite/Makefile.in: Regenerate.
6567 * testsuite/start_lib_test_main.c: New file.
6568 * testsuite/start_lib_test_1.c: New file.
6569 * testsuite/start_lib_test_2.c: New file.
6570 * testsuite/start_lib_test_3.c: New file.
6572 2010-08-19 Ian Lance Taylor <iant@google.com>
6574 * Makefile.in: Rebuild with automake 1.11.1.
6575 * aclocal.m4: Likewise.
6576 * testsuite/Makefile.in: Likewise.
6578 2010-08-19 Ian Lance Taylor <iant@google.com>
6581 * i386.cc (class Output_data_plt_i386): Update declarations.
6582 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
6583 local_ifuncs_ fields.
6584 (Target_i386::do_plt_section_for_global): New function.
6585 (Target_i386::do_plt_section_for_local): New function.
6586 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6587 parameter; change all callers. Initialize global_ifuncs_ and
6588 local_ifuncs_. If doing a static link define __rel_iplt_start and
6590 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6591 (Output_data_plt_i386::add_local_ifunc_entry): New function.
6592 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6594 (Target_i386::make_plt_section): New function, broken out of
6595 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
6596 (Target_i386::make_plt_entry): Call make_plt_section.
6597 (Target_i386::make_local_ifunc_plt_entry): New function.
6598 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6599 (Target_i386::Scan::local): Handle IFUNC symbols. Add
6600 R_386_IRELATIVE to switch.
6601 (Target_i386::Scan::global): Likewise.
6602 (Target_i386::Relocate::relocate): Likewise.
6603 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6605 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6606 (Target_x86_64::do_plt_section_for_global): New function.
6607 (Target_x86_64::do_plt_section_for_local): New function.
6608 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6609 parameter; change all callers. If doing a static link define
6610 __rela_iplt_start and __rela_iplt_end.
6611 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6612 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6613 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6615 (Target_x86_64::make_local_ifunc_plt_entry): New function.
6616 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6618 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6619 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
6620 R_X86_64_IRELATIVE to switch.
6621 (Target_x86_64::Scan::global): Likewise.
6622 (Target_x86_64::Relocate::relocate): Likewise.
6623 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6625 * target.h (class Target): Add plt_section_for_global and
6626 plt_section_for_local functions. Add do_plt_section_for_global
6627 and do_plt_section_for_local virtual functions.
6628 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
6629 clarifying comments.
6630 (Symbol::use_plt_offset): Handle IFUNC symbol.
6631 * object.cc (Sized_relobj::Sized_relobj): Initialize
6633 (Sized_relobj::local_has_plt_offset): New function.
6634 (Sized_relobj::local_plt_offset): New function.
6635 (Sized_relobj::set_local_plt_offset): New function.
6636 (Sized_relobj::do_count): Handle IFUNC symbol.
6637 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
6638 a bit away from input_shndx_ field. Add set_is_func_symbol and
6639 is_ifunc_symbol functions.
6640 (class Sized_relobj): Update declarations. Remove Tls_got_entry
6641 and Local_tls_got_offsets. Define Local_plt_offsets. Add
6642 local_plt_offsets_ field.
6643 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6644 * output.h (class Output_section_data): Add non-const
6645 output_section function.
6646 (class Output_data_got): Update declarations.
6647 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6648 Add use_plt_offset parameter to global and local constructors.
6649 Change all callers. Change local_sym_index_ field to 31 bits.
6650 Change GSYM_CODE and CONSTANT_CODE accordingly.
6651 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6652 doing a static link don't set sh_link field.
6653 (Output_data_got::Got_entry::write): Use PLT offset if
6655 (Output_data_got::add_global_plt): New function.
6656 (Output_data_got::add_local_plt): New function.
6657 * target-reloc.h (relocate_section): Handle IFUNC symbol.
6658 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6659 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6660 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6661 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6663 * testsuite/ifunc-sel.h: New file.
6664 * testsuite/ifuncmain1.c: New file.
6665 * testsuite/ifuncmain1vis.c: New file.
6666 * testsuite/ifuncmod1.c: New file.
6667 * testsuite/ifuncdep2.c: New file.
6668 * testsuite/ifuncmain2.c: New file.
6669 * testsuite/ifuncmain3.c: New file.
6670 * testsuite/ifuncmod3.c: New file.
6671 * testsuite/ifuncmain4.c: New file.
6672 * testsuite/ifuncmain5.c: New file.
6673 * testsuite/ifuncmod5.c: New file.
6674 * testsuite/ifuncmain6pie.c: New file.
6675 * testsuite/ifuncmod6.c: New file.
6676 * testsuite/ifuncmain7.c: New file.
6677 * configure, testsuite/Makefile.in: Rebuild.
6679 2010-08-18 Ian Lance Taylor <iant@google.com>
6682 (Output_section_incremental_inputs::write_input_files): Add cast
6683 to avoid signed/unsigned comparison warning.
6684 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6686 2010-08-12 Cary Coutant <ccoutant@google.com>
6688 * common.cc (Sort_commons::operator()): Remove unnecessary code.
6690 2010-08-13 Ian Lance Taylor <iant@google.com>
6692 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6694 2010-08-12 Cary Coutant <ccoutant@google.com>
6695 Doug Kwan <dougkwan@google.com>
6697 * resolve.cc (Symbol_table::should_override): When a weak dynamic
6698 defintion overrides non-weak undef, remember that the original undef
6700 * symtab.cc (Symbol_table::sized_write_global): For undef without
6701 an original weak binding, set binding to global in output.
6702 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6703 * testsuite/Makefile.in: Regenerate.
6704 * testsuite/strong_ref_weak_def.sh: New file.
6705 * testsuite/strong_ref_weak_def_1.c: Ditto.
6706 * testsuite/strong_ref_weak_def_2.c: Ditto.
6708 2010-08-12 Cary Coutant <ccoutant@google.com>
6710 * testsuite/incremental_test.sh: Rewrite.
6711 * testsuite/incremental_test_1.c: Rewrite.
6712 * testsuite/incremental_test_2.c: Rewrite.
6714 2010-08-12 Cary Coutant <ccoutant@google.com>
6716 * arm.cc (Target_arm::got_size): Add const.
6717 (Target_arm::got_entry_count): New function.
6718 (Target_arm::plt_entry_count): New function.
6719 (Target_arm::first_plt_entry_offset): New function.
6720 (Target_arm::plt_entry_size): New function.
6721 (Output_data_plt_arm::entry_count): New function.
6722 (Output_data_plt_arm::first_plt_entry_offset): New function.
6723 (Output_data_plt_arm::get_plt_entry_size): New function.
6724 * i386.cc (Target_i386::got_size): Add const.
6725 (Target_i386::got_entry_count): New function.
6726 (Target_i386::plt_entry_count): New function.
6727 (Target_i386::first_plt_entry_offset): New function.
6728 (Target_i386::plt_entry_size): New function.
6729 (Output_data_plt_i386::entry_count): New function.
6730 (Output_data_plt_i386::first_plt_entry_offset): New function.
6731 (Output_data_plt_i386::get_plt_entry_size): New function.
6732 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6733 find_incremental_inputs_sections. Dump incremental_got_plt section.
6734 * incremental.cc: Include target.h.
6735 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6736 parameter. Adjust all callers. Find incremental_got_plt section.
6737 (Incremental_inputs::create_data_sections): Create incremental_got_plt
6739 (Output_section_incremental_inputs::set_final_data_size): Calculate
6740 size of incremental_got_plt section.
6741 (Output_section_incremental_inputs::do_write): Write the
6742 incremental_got_plt section.
6743 (Got_plt_view_info): New struct.
6744 (Local_got_offset_visitor): New class.
6745 (Global_got_offset_visitor): New class.
6746 (Global_symbol_visitor_got_plt): New class.
6747 (Output_section_incremental_inputs::write_got_plt): New function.
6748 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6749 Add parameter. Adjust all callers.
6750 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6751 (Incremental_inputs::got_plt_section): New function.
6752 (Incremental_inputs::got_plt_section_): New data member.
6753 (Incremental_got_plt_reader): New class.
6754 * layout.cc (Layout::create_incremental_info_sections): Add the
6755 incremental_got_plt section.
6756 * object.h (Got_offset_list::get_list): New function.
6757 (Got offset_list::for_all_got_offsets): New function.
6758 (Sized_relobj::local_got_offset_list): New function.
6759 * powerpc.cc (Target_powerpc::got_size): Add const.
6760 (Target_powerpc::got_entry_count): New function.
6761 (Target_powerpc::plt_entry_count): New function.
6762 (Target_powerpc::first_plt_entry_offset): New function.
6763 (Target_powerpc::plt_entry_size): New function.
6764 (Output_data_plt_powerpc::entry_count): New function.
6765 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6766 (Output_data_plt_powerpc::get_plt_entry_size): New function.
6767 * sparc.cc (Target_sparc::got_size): Add const.
6768 (Target_sparc::got_entry_count): New function.
6769 (Target_sparc::plt_entry_count): New function.
6770 (Target_sparc::first_plt_entry_offset): New function.
6771 (Target_sparc::plt_entry_size): New function.
6772 (Output_data_plt_sparc::entry_count): New function.
6773 (Output_data_plt_sparc::first_plt_entry_offset): New function.
6774 (Output_data_plt_sparc::get_plt_entry_size): New function.
6775 * symtab.h (Symbol::got_offset_list): New function.
6776 (Symbol_table::for_all_symbols): New function.
6777 * target.h (Sized_target::got_entry_count): New function.
6778 (Sized_target::plt_entry_count): New function.
6779 (Sized_target::plt_entry_size): New function.
6780 * x86_64.cc (Target_x86_64::got_size): Add const.
6781 (Target_x86_64::got_entry_count): New function.
6782 (Target_x86_64::plt_entry_count): New function.
6783 (Target_x86_64::first_plt_entry_offset): New function.
6784 (Target_x86_64::plt_entry_size): New function.
6785 (Output_data_plt_x86_64::entry_count): New function.
6786 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6787 (Output_data_plt_x86_64::get_plt_entry_size): New function.
6789 2010-08-12 Cary Coutant <ccoutant@google.com>
6791 * archive.cc: Include incremental.h.
6792 (Archive::Archive): Initialize incremental_info_.
6793 (Archive::include_member): Record archive members in incremental info.
6794 (Add_archive_symbols::run): Record begin and end of an archive in
6796 (Lib_group::include_member): Record objects in incremental info.
6797 * archive.h (Incremental_archive_entry): Forward declaration.
6798 (Archive::set_incremental_info): New member function.
6799 (Archive::incremental_info): New member function.
6800 (Archive::Unused_symbol_iterator): New class.
6801 (Archive::unused_symbols_begin): New member function.
6802 (Archive::unused_symbols_end): New member function.
6803 (Archive::incremental_info_): New data member.
6804 * incremental-dump.cc (find_input_containing_global): New function.
6805 (dump_incremental_inputs): Dump new incremental info sections.
6806 * incremental.cc: Include symtab.h.
6807 (Output_section_incremental_inputs): New class.
6808 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6809 new incremental info sections.
6810 (Sized_incremental_binary::do_check_inputs): Likewise.
6811 (Incremental_inputs::report_archive): Remove.
6812 (Incremental_inputs::report_archive_begin): New function.
6813 (Incremental_inputs::report_archive_end): New function.
6814 (Incremental_inputs::report_object): New function.
6815 (Incremental_inputs::finalize_inputs): Remove.
6816 (Incremental_inputs::report_input_section): New function.
6817 (Incremental_inputs::report_script): Rewrite.
6818 (Incremental_inputs::finalize): Do nothing but finalize string table.
6819 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6820 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6821 (Incremental_inputs::create_data_sections): New function.
6822 (Incremental_inputs::relocs_entsize): New function.
6823 (Output_section_incremental_inputs::set_final_data_size): New function.
6824 (Output_section_incremental_inputs::do_write): New function.
6825 (Output_section_incremental_inputs::write_header): New function.
6826 (Output_section_incremental_inputs::write_input_files): New function.
6827 (Output_section_incremental_inputs::write_info_blocks): New function.
6828 (Output_section_incremental_inputs::write_symtab): New function.
6829 * incremental.h (Incremental_script_entry): Forward declaration.
6830 (Incremental_object_entry): Forward declaration.
6831 (Incremental_archive_entry): Forward declaration.
6832 (Incremental_inputs): Forward declaration.
6833 (Incremental_inputs_header_data): Remove.
6834 (Incremental_inputs_header): Remove.
6835 (Incremental_inputs_header_write): Remove.
6836 (Incremental_inputs_entry_data): Remove.
6837 (Incremental_inputs_entry): Remove.
6838 (Incremental_inputs_entry_write): Remove.
6839 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6840 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6841 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6842 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6844 (Incremental_input_entry): New class.
6845 (Incremental_script_entry): New class.
6846 (Incremental_object_entry): New class.
6847 (Incremental_archive_entry): New class.
6848 (Incremental_inputs::Incremental_inputs): Initialize new data members.
6849 (Incremental_inputs::report_inputs): Remove.
6850 (Incremental_inputs::report_archive): Remove.
6851 (Incremental_inputs::report_archive_begin): New function.
6852 (Incremental_inputs::report_archive_end): New function.
6853 (Incremental_inputs::report_object): Change prototype.
6854 (Incremental_inputs::report_input_section): New function.
6855 (Incremental_inputs::report_script): Change prototype.
6856 (Incremental_inputs::get_reloc_count): New function.
6857 (Incremental_inputs::set_reloc_count): New function.
6858 (Incremental_inputs::create_data_sections): New function.
6859 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6860 (Incremental_inputs::inputs_section): New function.
6861 (Incremental_inputs::symtab_section): New function.
6862 (Incremental_inputs::relocs_section): New function.
6863 (Incremental_inputs::get_stringpool): Add const.
6864 (Incremental_inputs::command_line): Add const.
6865 (Incremental_inputs::inputs): Remove.
6866 (Incremental_inputs::command_line_key): New function.
6867 (Incremental_inputs::input_file_count): New function.
6868 (Incremental_inputs::input_files): New function.
6869 (Incremental_inputs::relocs_entsize): New function.
6870 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6871 (Incremental_inputs::finalize_inputs): Remove.
6872 (Incremental_inputs::Input_info): Remove.
6873 (Incremental_inputs::lock_): Remove.
6874 (Incremental_inputs::inputs_): Change type.
6875 (Incremental_inputs::inputs_map_): Remove.
6876 (Incremental_inputs::current_object_entry_): New data member.
6877 (Incremental_inputs::inputs_section_): New data member.
6878 (Incremental_inputs::symtab_section_): New data member.
6879 (Incremental_inputs::relocs_section_): New data member.
6880 (Incremental_inputs::reloc_count_): New data member.
6881 (Incremental_inputs_reader): New class.
6882 (Incremental_symtab_reader): New class.
6883 (Incremental_relocs_reader): New class.
6884 * layout.cc (Layout::finalize): Move finalization of incremental info
6885 and creation of incremental info sections to follow finalization of
6886 symbol table. Set offsets for postprocessing sections.
6887 (Layout::create_incremental_info_sections): Call
6888 Incremental_inputs::create_data_sections. Add incremental symtab
6889 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
6890 sections to layout after input sections.
6891 * layout.h (struct Timespec): Forward declaration.
6892 (Layout::incremental_inputs): Add const.
6893 (Layout::create_incremental_info_sections): Add parameter.
6894 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6895 * object.cc: Include incremental.h.
6896 (Relobj::finalize_incremental_relocs): New function.
6897 (Sized_relobj::do_layout): Record input sections in incremental info.
6898 * object.h (Object::output_section): New function.
6899 (Object::output_section_offset): Moved from Relobj.
6900 (Object::get_incremental_reloc_base): New function.
6901 (Object::get_incremental_reloc_count): New function.
6902 (Object::do_output_section): New function.
6903 (Object::do_output_section_offset): Moved from Relobj.
6904 (Object::do_get_incremental_reloc_base): New function.
6905 (Object::do_get_incremental_reloc_count): New function.
6906 (Object::Object): Initialize new data members.
6907 (Relobj::output_section): Renamed do_output_section and moved to
6909 (Relobj::output_section_offset): Moved to Object.
6910 (Relobj::do_get_incremental_reloc_base): New function.
6911 (Relobj::do_get_incremental_reloc_count): New function.
6912 (Relobj::allocate_incremental_reloc_counts): New function.
6913 (Relobj::count_incremental_reloc): New function.
6914 (Relobj::finalize_incremental_relocs): New function.
6915 (Relobj::next_incremental_reloc_index): New function.
6916 (Relobj::reloc_counts_): New data member.
6917 (Relobj::reloc_bases_): New data member.
6918 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
6919 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
6920 (Sized_relobj::incremental_relocs_scan): New function.
6921 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6922 (Sized_relobj::incremental_relocs_write): New function.
6923 (Sized_relobj::incremental_relocs_write_reltype): New function.
6924 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6926 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6927 archives and object files elsewhere.
6928 (Add_symbols::run): Report object files here.
6929 (Finish_group::run): Report end of archive at end of group.
6930 * reloc.cc: Include layout.h, incremental.h.
6931 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6932 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6933 (Sized_relobj::incremental_relocs_scan): New function.
6934 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6935 (Sized_relobj::do_relocate_sections): Write incremental relocations.
6936 (Sized_relobj::incremental_relocs_write): New function.
6937 (Sized_relobj::incremental_relocs_write_reltype): New function.
6938 * script.cc (read_input_script): Rewrite test for incremental link.
6939 Change call to Incremental_inputs::report_script.
6940 * symtab.h (Symbol_table::first_global_index): New function.
6941 (Symbol_table::output_count): New function.
6943 2010-08-12 Doug Kwan <dougkwan@google.com>
6945 * arm.cc (Target_arm::merge_object_attributes): Check command line
6946 options --no-wchar-size-warning and --no-enum-size-warning.
6947 * options.h (General_options): Add ld-compatible options
6948 --no-enum-size-warning and --no-wchar-size-warning.
6950 2010-08-04 Ian Lance Taylor <iant@google.com>
6952 * x86_64.cc (Target_x86_64::Scan::local): Use
6953 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6954 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6955 (Target_x86_64::Scan::global): Likewise.
6956 (Target_x86_64::Relocate::relocate): Likewise.
6957 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6960 2010-08-03 Cary Coutant <ccoutant@google.com>
6962 * merge.cc (Output_merge_string::do_add_input_section): Count strings
6963 to reserve space in merged_strings vector. Keep total input size
6965 (Output_merge_string::do_print_merge_stats): Print total input size.
6966 * merge.h (Output_merge_string): Add input_size_ field.
6967 * stringpool.cc (Stringpool_template::string_length): Move
6968 implementations out of Stringpool_template class and place in
6970 * stringpool.h (string_length): Move out of Stringpool_template.
6972 2010-08-03 Ian Lance Taylor <iant@google.com>
6975 * layout.cc (relaxation_loop_body): If address of load segment is
6976 set, adjust address to include headers if possible.
6978 2010-08-03 Ian Lance Taylor <iant@google.com>
6980 * version.cc (version_string): Bump to 1.10.
6982 2010-08-03 Ian Lance Taylor <iant@google.com>
6985 * layout.h (enum Output_section_order): Define.
6986 (class Layout): Update declarations.
6987 * layout.cc (Layout::get_output_section): Add order parameter.
6988 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6989 is_first_non_relro parameters. Change all callers.
6990 (Layout::choose_output_section): Likewise.
6991 (Layout::add_output_section_data): Likewise.
6992 (Layout::make_output_section): Likewise. Set order.
6993 (Layout::default_section_order): New function.
6994 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6995 * output.cc (Output_section::Output_section): Initialize order_.
6996 Don't initialize deleted fields.
6997 (Output_segment::Output_segment): Don't initialize deleted
6999 (Output_segment::add_output_section_to_load): New function
7000 replacing add_output_section. Change all callers to call this or
7001 add_output_section_to_nonload.
7002 (Output_segment::add_output_section_to_nonload): New function.
7003 (Output_segment::remove_output_section): Rewrite.
7004 (Output_segment::add_initial_output_data): Likewise.
7005 (Output_segment::has_any_data_sections): Likewise.
7006 (Output_segment::is_first_section_relro): Likewise.
7007 (Output_segment::maximum_alignment): Likewise.
7008 (Output_segment::has_dynamic_reloc): New function replacing
7009 dynamic_reloc_count. Change all callers.
7010 (Output_segment::has_dynamic_reloc_list): New function replacing
7011 dynamic_reloc_count_list. Change all callers.
7012 (Output_segment::set_section_addresses): Rewrite.
7013 (Output_segment::set_offset): Rewrite.
7014 (Output_segment::find_first_and_last_list): Remove.
7015 (Output_segment::set_tls_offsets): Rewrite.
7016 (Output_segment::first_section_load_address): Likewise.
7017 (Output_segment::output_section_count): Likewise.
7018 (Output_segment::section_with_lowest_load_address): Likewise.
7019 (Output_segment::write_section_headers): Likewise.
7020 (Output_segment::print_sections_to_map): Likewise.
7021 * output.h (class Output_data): Remove dynamic_reloc_count_
7022 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
7023 (Output_data::add_dynamic_reloc): Rewrite.
7024 (Output_data::has_dynamic_reloc): New function.
7025 (Output_data::dynamic_reloc_count): Remove.
7026 (class Output_section): Add order_ field. Remvoe is_relro_local_,
7027 is_last_relro_, is_first_non_relro_, is_interp_,
7028 is_dynamic_linker_section_ fields. Add order and set_order
7029 functions. Remove is_relro_local, set_is_relro_local,
7030 is_last_relro, set_is_last_relro, is_first_non_relro,
7031 set_is_first_non_relro functions, is_interp, set_is_interp,
7032 is_dynamic_linker_section, and set_is_dynamic_linker_section
7034 (class Output_segment): Change Output_data_list from std::list to
7035 std:;vector. Add output_lists_ field. Remove output_data_ and
7036 output_bss_ fields. Update declarations.
7038 2010-08-02 Ian Lance Taylor <iant@google.com>
7040 * arm.cc (Target_arm::gc_process_relocs): Use typename.
7041 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7042 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7044 2010-08-02 Ian Lance Taylor <iant@google.com>
7047 * script.cc (Script_options::Script_options): Initialize
7048 symbol_definitions_ and symbol_references_.
7049 (Script_options::add_symbol_assignment): Update
7050 symbol_definitions_ and symbol_references_.
7051 (Script_options::add_symbol_reference): New function.
7052 (script_symbol): New function.
7053 * script.h (class Script_options): Add symbol_definitions_ and
7054 symbol_references_ fields.
7055 (Script_options::referenced_const_iterator): New type.
7056 (Script_options::referenced_begin): New function.
7057 (Script_options::referenced_end): New function.
7058 (Script_options::is_referenced): New function.
7059 (Script_options::any_unreferenced): New function.
7060 * script-c.h (script_symbol): Declare.
7061 * yyscript.y (exp): Call script_symbol.
7062 * symtab.cc: Include "script.h".
7063 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7064 Change all callers. Check symbols referenced by scripts.
7065 (Symbol_table::add_undefined_symbols_from_command_line): Add
7066 layout parameter. Change all callers.
7067 (Symbol_table::do_add_undefined_symbols_from_command_line):
7068 Likewise. Break out loop body. Check symbols referenced by
7070 (Symbol_table::add_undefined_symbol_from_command_line): New
7071 function broken out of
7072 do_add_undefined_symbols_from_command_line.
7073 * symtab.h (class Symbol_table): Update declarations.
7074 * archive.cc: Include "layout.h".
7075 (Archive::should_include_member): Add layout parameter. Change
7076 all callers. Check for symbol mentioned in expression.
7077 * archive.h (class Archive): Update declaration.
7078 * object.cc (Sized_relobj::do_should_include_member): Add layout
7080 * object.h (Object::should_include_member): Add layout parameter.
7082 (Object::do_should_include_member): Add layout parameter.
7083 (class Sized_relobj): Update declaration.
7084 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7086 * dynobj.h (class Sized_dynobj): Update declaration.
7087 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7089 * plugin.h (class Sized_pluginobj): Update declaration.
7091 2010-08-02 Ian Lance Taylor <iant@google.com>
7094 * output.cc (Output_segment::set_offset): Search for the first and
7095 last sections rather than assuming that the list is in order.
7096 (Output_segment::find_first_and_last_list): New function.
7097 * output.h (class Output_segment): Update declarations.
7098 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7099 (relro_strip_test_SOURCES): New variable.
7100 (relro_strip_test_DEPENDENCIES): New variable.
7101 (relro_strip_test_LDFLAGS): New variable.
7102 (relro_strip_test_LDADD): New variable.
7103 (relro_strip_test.so): New target.
7105 2010-08-02 Ian Lance Taylor <iant@google.com>
7107 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7108 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7109 (Target_i386::got_tlsdesc_section): New function.
7110 (Target_i386::got_section): Create space for GOT entries for
7111 TLSDESC relocations.
7112 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7114 (Target_i386::Scan::global): Likewise.
7115 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7117 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7118 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7119 (Target_x86_64::got_tlsdesc_section): New function.
7120 (Target_x86_64::got_section): Create space for GOT entries for
7121 TLSDESC relocations.
7122 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7124 (Target_x86_64::Scan::global): Likewise.
7125 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7128 2010-08-02 Ian Lance Taylor <iant@google.com>
7130 * testsuite/final_layout.sh: Use dc to convert from hex to
7133 2010-07-29 Sriraman Tallam <tmsriram@google.com>
7135 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7136 paramter to the call to gold::gc_process_relocs.
7137 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7138 paramter to the call to gold::gc_process_relocs.
7139 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7140 parameter to the call to gold::gc_process_relocs.
7141 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7142 template parameter to the call to gold::gc_process_relocs.
7143 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7144 paramter to the call to gold::gc_process_relocs.
7145 * gc.h (get_embedded_addend_size): New function.
7146 (gc_process_relocs): Save the size of the reloc for use by ICF.
7147 * icf.cc (get_section_contents): Get the addend from the text section
7148 for SHT_REL relocation sections.
7149 * icf.h (Icf::Reloc_addend_size_info): New typedef.
7150 (Icf::Reloc_info): Add new member reloc_addend_size_info.
7151 * int_encoding.h (read_from_pointer): New overloaded function.
7152 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7153 * testsuite/icf_sht_rel_addend_test.sh: New file.
7154 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7155 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7157 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7159 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7160 * Makefile.in: Regenerate.
7161 * testsuite/Makefile.in: Regenerate.
7163 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
7165 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7166 * gold/testsuite/debug_msg.cc: Likewise.
7167 * gold/testsuite/odr_violation1.cc
7168 * gold/testsuite/odr_violation2.cc
7170 2010-07-21 Cary Coutant <ccoutant@google.com>
7172 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7173 string, and length fields.
7174 (Output_merge_string::Merged_strings_list): New type.
7175 (Output_merge_string::Merged_strings_lists): New typedef.
7176 (Output_merge_string): Replace merged_strings_ with
7177 merged_strings_lists_.
7178 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7179 Merged_strings_list per input object and section. Don't store pointer
7180 to the string. Don't store length with each merged string entry.
7181 (Output_merge_string::finalize_merged_data): Loop over list of merged
7182 strings lists. Recompute length of each merged string.
7184 2010-07-15 Cary Coutant <ccoutant@google.com>
7186 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7189 2010-07-14 Ian Lance Taylor <iant@google.com>
7191 * descriptors.cc (Descriptors::open): Report correct name in error
7194 2010-07-13 Doug Kwan <dougkwan@google.com>
7196 * arm.cc (Arm_input_section::Arm_input_section): For a
7197 SHT_ARM_EXIDX section, always keeps the input sections.
7198 (Arm_input_section::set_exidx_section_link): New method.
7199 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7200 has_errors_ to false.
7201 (Arm_exidx_input_section::has_errors,
7202 Arm_exidx_input_section::set_has_errors): New methods.
7203 (Arm_exidx_input_section::has_errors_): New data member.
7204 (Arm_relobj::get_exidx_shndx_list): New method.
7205 (Arm_output_section::append_text_sections_to_list): Do not skip
7206 section without SHF_EXECINSTR.
7207 (Arm_output_section::fix_exidx_coverage): Skip input sections with
7209 (Arm_relobj::make_exidx_input_section): Add new parameter for text
7210 section header. Make error messages more verbose. Check for
7211 a non-executable section linked to an EXIDX section.
7212 (Arm_relobj::do_read_symbols): Remove error checking, which has been
7213 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
7214 check that there is no deferred EXIDX section if we exit early.
7215 Instead of not making an EXIDX section in case of an error, make one
7216 and set the has_errors flag of it.
7217 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7218 in a relocatable link.
7219 (Target_arm::do_relax): Look for the EXIDX output section instead of
7220 assuming that it is called .ARM.exidx.
7221 (Target_arm::fix_exidx_coverage): Add a new parameter for input
7222 section list. Do not check for SHF_EXECINSTR section flags but
7223 skip any input section with errors.
7224 * output.cc (Output_section::Output_section): Initialize
7225 always_keeps_input_sections_ to false.
7226 (Output_section::add_input_section): Check for
7227 always_keeps_input_sections_.
7228 * output.h (Output_section::always_keeps_input_sections,
7229 Output_section::set_always_keeps_input_sections): New methods.
7230 (Output_section::always_keeps_input_sections): New data member.
7232 2010-07-13 Rafael Espindola <espindola@google.com>
7234 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7235 * fileread.h (Input_file): Add try_extra_search_path and find_file.
7237 2010-07-13 Philip Herron <herron.philip@googlemail.com>
7238 Ian Lance Taylor <iant@google.com>
7240 * output.h (Output_section_lookup_maps::add_merge_section):
7241 Correct check of whether value was inserted.
7242 (Output_section_lookup_maps::add_merge_input_section): Likewise.
7243 (Output_section_lookup_maps::add_relaxed_input_section):
7245 * arm.cc (Target_arm::got_section): Remove used local os.
7246 * i386.cc (Target_i386::got_section): Likewise.
7247 * x86_64.cc (Target_x86_64::got_section): Likewise.
7248 * sparc.cc (Target_sparc::got_section): Likewise.
7249 (Target_sparc::relocate): Remove unused local have_got_offset.
7250 * powerpc.cc (Target_powerpc::relocate): Likewise.
7252 2010-07-13 Ian Lance Taylor <iant@google.com>
7254 * compressed_output.cc (zlib_decompress): Fix signature in
7257 * archive.cc (Archive::include_member): Unlock an external member
7258 of a thin archive. Don't bother to delete an object we know is
7261 2010-07-12 Cary Coutant <ccoutant@google.com>
7263 * compressed_output.cc (zlib_decompress): New function.
7264 (get_uncompressed_size): New function.
7265 (decompress_input_section): New function.
7266 * compressed_output.h (get_uncompressed_size): New function.
7267 (decompress_input_section): New function.
7268 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7269 Handle compressed debug sections.
7270 * layout.cc (is_compressed_debug_section): New function.
7271 (Layout::output_section_name): Map compressed section names to
7273 * layout.h (is_compressed_debug_section): New function.
7274 (is_debug_info_section): Recognize compressed debug sections.
7275 * merge.cc: Include compressed_output.h.
7276 (Output_merge_data::do_add_input_section): Handle compressed
7278 (Output_merge_string::do_add_input_section): Handle compressed
7280 * object.cc: Include compressed_output.h.
7281 (Sized_relobj::Sized_relobj): Initialize new data members.
7282 (build_compressed_section_map): New function.
7283 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7284 * object.h (Object::section_is_compressed): New method.
7285 (Object::do_section_is_compressed): New method.
7286 (Sized_relobj::Compressed_section_map): New type.
7287 (Sized_relobj::do_section_is_compressed): New method.
7288 (Sized_relobj::compressed_sections_): New data member.
7289 * output.cc (Output_section::add_input_section): Handle compressed
7291 * reloc.cc: Include compressed_output.h.
7292 (Sized_relobj::write_sections): Handle compressed debug sections.
7294 2010-07-08 Cary Coutant <ccoutant@google.com>
7296 * resolve.cc (Symbol_table::resolve): Remember whether undef was
7297 weak when resolving to a dynamic def.
7298 (Symbol_table::should_override): Add adjust_dyndef flag; set it
7299 for weak undef/dynamic def cases. Adjust callers.
7300 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7301 undef_binding_weak_.
7302 (Symbol_table::sized_write_globals): Adjust symbol binding.
7303 (Symbol_table::sized_write_symbol): Add binding parameter.
7304 * symtab.h (Symbol::set_undef_binding): New method.
7305 (Symbol::is_undef_binding_weak): New method.
7306 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7307 (Symbol_table::should_override): Add new parameter.
7308 (Symbol_table::sized_write_symbol): Add new parameter.
7310 * testsuite/weak_undef_file1.cc: Add new test case.
7311 * testsuite/weak_undef_file2.cc: Fix header comment.
7312 * testsuite/weak_undef_test.cc: Add new test case.
7314 2010-06-29 Doug Kwan <dougkwan@google.com>
7316 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7317 Initialize USE_SYMBOL_.
7318 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7320 (Arm_reloc_property::uses_symbol_): New data member declaration.
7321 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7322 uses symbol value and symbol is undefined but not weakly undefined.
7324 2010-06-28 Rafael Espindola <espindola@google.com>
7326 * plugin.cc (Plugin::load): Use dlerror.
7328 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
7330 * symtab.cc (detect_odr_violations): When reporting an ODR
7331 violation, report an object where the symbol is defined.
7333 2010-06-25 Doug Kwan <dougkwan@google.com>
7335 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7336 (Target_arm::section_may_have_icf_unsafe_pointers): New method
7338 (Target_arm::Scan::local_reloc_may_be_function_pointer,
7339 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7340 target hook to detect function points.
7341 (Target_arm::Scan::possible_function_pointer_reloc): New method.
7342 * icf.h (Icf::check_section_for_function_pointers): Change type of
7343 parameter SECTION_NAME to const reference to std::string. Use
7344 target hook to determine if section may have unsafe pointers.
7345 * target.h (Target::section_may_have_icf_unsafe_pointers): New
7348 2010-06-21 Rafael Espindola <espindola@google.com>
7350 * fileread.cc (Input_file::find_fie): New
7351 (Input_file::open): Use Input_file::find_fie.
7352 * fileread.h (Input_file::find_fie): New
7353 * plugin.cc (set_extra_library_path): New.
7354 (Plugin::load): Add set_extra_library_path to the transfer vector.
7355 (Plugin_manager::set_extra_library_path): New.
7356 (Plugin_manager::add_input_file): Use the extra search path if set.
7357 (set_extra_library_path(): New.
7358 * plugin.h (Plugin_manager): Add set_extra_library_path and
7361 2010-06-19 Cary Coutant <ccoutant@google.com>
7363 * layout.cc (gdb_sections): Add .debug_types.
7364 (lines_only_debug_sections): Likewise.
7366 2010-06-18 Rafael Espindola <espindola@google.com>
7368 * plugin.cc (add_input_file,add_input_library)
7369 (Plugin_manager::add_input_file): Make filename arguments const.
7370 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7373 2010-06-16 Doug Kwan <dougkwan@google.com>
7375 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7376 .ARM.attributes section if we have not merged any input
7377 attributes sections.
7379 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7381 * arm.cc: Allow combining objects with no EABI version
7384 2010-06-15 Rafael Espindola <espindola@google.com>
7386 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7388 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7390 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7391 (struct iovec): Correct !HAVE_READV definition.
7393 2010-06-10 Cary Coutant <ccoutant@google.com>
7395 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7396 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7398 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7401 * symtab.h (Symbol::is_placeholder): New member function.
7402 * target-reloc.h (relocate_section): Check for placeholder symbols.
7404 * testsuite/Makefile.am (plugin_test_8): New test.
7405 (plugin_test_9): New test.
7406 * testsuite/Makefile.in: Regenerate.
7408 2010-06-09 Nick Clifton <nickc@redhat.com>
7410 * yyscript.y (input_list_element): Allow strings prefixed with
7411 the '-' character. Treat these as libraries.
7412 * script.cc (script_add_library): New function. Adds a library
7413 specified by "-l<name>" found in an input script.
7414 * script-c.h: Add prototype for script_add_library.
7416 2010-06-07 Doug Kwan <dougkwan@google.com>
7418 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7419 Restrict stub-group size to be within long conditional branch
7420 range when working around cortex-A8 erratum.
7422 2010-06-07 Damien Diederen <dd@crosstwine.com>
7424 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7427 2010-06-03 Sriraman Tallam <tmsriram@google.com>
7431 (Output_section::Input_section_sort_entry::compare_section_ordering):
7432 Change to return non-zero correctly.
7433 (Output_section::Input_section_sort_section_order_index_compare
7434 ::operator()): Change to fix ambiguity in comparisons.
7436 2010-06-01 Sriraman Tallam <tmsriram@google.com>
7438 * gold.h (is_wildcard_string): New function.
7439 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7440 (Layout::layout_eh_frame): Ditto.
7441 (Layout::find_section_order_index): New method.
7442 (Layout::read_layout_from_file): New method.
7443 * layout.h (Layout::find_section_order_index): New method.
7444 (Layout::read_layout_from_file): New method.
7445 (Layout::input_section_position_): New private member.
7446 (Layout::input_section_glob_): New private member.
7447 * main.cc (main): Call read_layout_from_file here.
7448 * options.h (--section-ordering-file): New option.
7449 * output.cc (Output_section::input_section_order_specified_): New
7451 (Output_section::Output_section): Initialize new member.
7452 (Output_section::add_input_section): Add new parameter.
7453 Keep input sections when --section-ordering-file is used.
7454 (Output_section::set_final_data_size): Sort input sections when
7455 section ordering file is specified.
7456 (Output_section::Input_section_sort_entry): Add new parameter.
7458 (Output_section::Input_section_sort_entry::compare_section_ordering):
7460 (Output_section::Input_section_sort_compare::operator()): Change to
7461 consider section_order_index.
7462 (Output_section::Input_section_sort_init_fini_compare::operator()):
7463 Change to consider section_order_index.
7464 (Output_section::Input_section_sort_section_order_index_compare
7465 ::operator()): New method.
7466 (Output_section::sort_attached_input_sections): Change to sort
7467 according to section order when specified.
7468 (Output_section::add_input_section<32, true>): Add new parameter.
7469 (Output_section::add_input_section<64, true>): Add new parameter.
7470 (Output_section::add_input_section<32, false>): Add new parameter.
7471 (Output_section::add_input_section<64, false>): Add new parameter.
7472 * output.h (Output_section::add_input_section): Add new parameter.
7473 (Output_section::input_section_order_specified): New
7475 (Output_section::set_input_section_order_specified): New method.
7476 (Input_section::Input_section): Initialize section_order_index_.
7477 (Input_section::section_order_index): New method.
7478 (Input_section::set_section_order_index): New method.
7479 (Input_section::section_order_index_): New member.
7480 (Input_section::Input_section_sort_section_order_index_compare): New
7482 (Output_section::input_section_order_specified_): New member.
7483 * script-sections.cc (is_wildcard_string): Delete and move modified
7485 (Output_section_element_input::Output_section_element_input): Modify
7486 call to is_wildcard_string.
7487 (Output_section_element_input::Input_section_pattern
7488 ::Input_section_pattern): Ditto.
7489 (Output_section_element_input::Output_section_element_input): Ditto.
7490 * testsuite/Makefile.am (final_layout): New test case.
7491 * testsuite/Makefile.in: Regenerate.
7492 * testsuite/final_layout.cc: New file.
7493 * testsuite/final_layout.sh: New file.
7495 2010-06-01 Rafael Espindola <espindola@google.com>
7497 * plugin.cc (Plugin::load): Pass the output name to the plugin.
7499 2010-06-01 Rafael Espindola <espindola@google.com>
7501 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7502 visibility of symbols.
7504 2010-05-27 Doug Kwan <dougkwan@google.com>
7506 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7507 from start of output section instead of address for a local symbol
7508 in a merged or relaxed section when doing a relocatable link.
7510 2010-05-26 Rafael Espindola <espindola@google.com>
7513 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7514 adding sections the garbage collector removed.
7515 * gold/testsuite/Makefile.am: Add test.
7516 * gold/testsuite/Makefile.in: Regenerate.
7517 * gold/testsuite/plugin_test_7.sh: New.
7518 * gold/testsuite/plugin_test_7_1.c: New.
7519 * gold/testsuite/plugin_test_7_2.c: New.
7521 2010-05-26 Rafael Espindola <espindola@google.com>
7523 * script-sections.cc (Output_section_definition::set_section_addresses):
7524 Check for --section-start.
7526 2010-05-26 Doug Kwan <dougkwan@google.com>
7528 * arm.cc (Arm_scan_relocatable_relocs): New class.
7529 (Target_arm::relocate_special_relocatable): New method.
7530 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7531 (Arm_relocate_functions::thumb_branch_common): Same.
7532 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7533 instead of Default_scan_relocatable_relocs.
7534 * target-reloc.h (relocate_for_relocatable): Let target handle
7535 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7536 * target.h (Sized_target::relocate_special_relocatable): New method.
7538 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7540 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7542 2010-05-23 Doug Kwan <dougkwan@google.com>
7544 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7546 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7547 with a direct branch, not a conditional branch, to a stub.
7548 * merge.cc (Output_merge_base::record_input_section): New method
7550 (Output_merge_data::do_add_input_section): Record input section if
7551 keeps-input-sections flag is set.
7552 (Output_merge_string::do_add_input_section): Ditto.
7553 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7554 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7556 (Output_merge_base::keeps_input_sections,
7557 Output_merge_base::set_keeps_input_sections,
7558 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7560 (Output_merge_base::Input_sections): New type declaration.
7561 (Output_merge_base::input_sections_begin,
7562 Output_merge_base::input_sections_end,
7563 Output_merge_base::do_set_keeps_input_sections): New method definitions.
7564 (Output_merge_base::bool keeps_input_sections_,
7565 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7566 Output_merge_base::input_sections_): New data members.
7567 (Output_merge_data::do_set_keeps_input_sections): New method
7569 (Output_merge_string::do_set_keeps_input_sections): Ditto.
7570 * output.cc (Output_section::Input_section::relobj): Move method
7571 defintion from class declaration to here and handle merge sections.
7572 (Output_section::Input_section::shndx): Ditto.
7573 (Output_section::Output_section): Remove initializations of removed
7574 data members and initialize new data member LOOKUP_MAPS_.
7575 (Output_section::add_input_section): Set keeps-input-sections flag
7576 for a newly created merge output section as appropriate. Adjust code
7577 to use Output_section_lookup_maps class.
7578 (Output_section::add_relaxed_input_section): Adjst code for lookup
7579 maps code refactoring.
7580 (Output_section::add_merge_input_section): Add a new parameter
7581 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
7582 class. If adding input section to a newly created merge output
7583 section fails, remove the new merge section.
7584 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7585 Adjust code for use of the Output_section_lookup_maps class.
7586 (Output_section::find_merge_section): Ditto.
7587 (Output_section::build_lookup_maps): New method defintion.
7588 (Output_section::find_relaxed_input_section): Adjust code to use
7589 Output_section_lookup_maps class.
7590 (Output_section::get_input_sections): Export merge sections. Adjust
7591 code to use Output_section_lookup_maps class.
7592 (Output_section:::add_script_input_section): Adjust code to use
7593 Output_section_lookup_maps class. Update lookup maps for merge
7595 (Output_section::discard_states): Use Output_section_lookup_maps.
7596 (Output_section::restore_states): Same.
7597 * output.h (Merge_section_properties): Move class defintion out of
7599 (Output_section_lookup_maps): New class.
7600 (Output_section::Input_section::is_merge_section): New method
7602 (Output_section::Input_section::relobj): Move defintion out of class
7603 defintion. Declare method only.
7604 (Output_section::Input_section::shndx): Ditto.
7605 (Output_section::Input_section::output_merge_base): New method defintion.
7606 (Output_section::Input_section::u2_.pomb): New union field.
7607 (Output_section::Merge_section_by_properties_map,
7608 Output_section::Output_section_data_by_input_section_map,
7609 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7611 (Output_section::add_merge_input_section): Add new parameter
7612 KEEPS_INPUT_SECTIONS.
7613 (Output_section::build_lookup_maps): New method declaration.
7614 (Output_section::merge_section_map_,
7615 Output_section::merge_section_by_properties_map_,
7616 Output_section::relaxed_input_section_map_,
7617 Output_section::is_relaxed_input_section_map_valid_): Remove data
7619 (Output_section::lookup_maps_): New data member.
7621 2010-05-21 Doug Kwan <dougkwan@google.com>
7624 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7625 avoid a compilation error.
7627 2010-05-19 Rafael Espindola <espindola@google.com>
7629 * script-sections.cc (Output_section_definition::allocate_to_segment):
7630 Update the phdrs_list even when the output section is NULL.
7631 * testsuite/Makefile.am: Add test.
7632 * testsuite/Makefile.in: Regenerate.
7633 * testsuite/script_test_9.cc: New.
7634 * testsuite/script_test_9.sh: New.
7635 * testsuite/script_test_9.t: New.
7637 2010-05-19 Doug Kwan <dougkwan@google.com>
7639 * arm.cc (Arm_input_section::original_size): New method.
7640 (Arm_input_section::do_addralign): Add a cast.
7641 (Arm_input_section::do_output_offset): Remove static cast.
7642 (Arm_input_section::original_addralign,
7643 Arm_input_section::original_size_): Change type to uint32_t.
7644 (Arm_input_section::init): Add safe casts for section alignment
7646 (Arm_input_section::set_final_data_size): Do not set address and
7647 offset of stub table.
7648 (Arm_output_section::fix_exidx_coverage): Change use of of
7649 Output_section::Simple_input_section to that of
7650 Output_section::Input_section.
7651 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7652 except for the first pass.
7653 * output.cc (Output_section::get_input_sections): Change type of
7654 input_sections to std::list<Input_section>.
7655 (Output_section::add_script_input_section): Rename from
7656 Output_section::add_simple_input_section. Change type of SIS
7657 parameter from Simple_input_section to Input_section.
7658 * output.h (Output_section::Simple_input_section): Remove class.
7659 (Output_section::Input_section): Change class visibility to public.
7660 (Output_section::Input_section::addralign): Use stored alignments
7661 for special input sections if set.
7662 (Output_section::Input_section::set_addralign): New method.
7663 (Output_section::get_input_sections): Change parameter type from
7664 list of Simple_input_section to list of Input_section.
7665 (Output_section::add_script_input_section): Rename from
7666 Output_section::add_simple_input_section. Change first parameter's
7667 type from Simple_input_section to Input_section and remove the
7668 second and third parameters.
7669 * script-sections.cc (Input_section::Input_section_list): Change
7670 type to list of Output_section::Input_section/
7671 (Input_section_info::Input_section_info): Change parameter type of
7672 INPUT_SECTION to Output_section::Input_section.
7673 (Input_section_info::input_section): Change return type.
7674 (Input_section_info::input_section_): Change type to
7675 Output_section::Input_section.
7676 (Output_section_element_input::set_section_addresses): Adjust code
7677 to use Output_section::Input_section instead of
7678 Output_section::Simple_input_section. Adjust code for renaming
7679 of Output_section::add_simple_input_section.
7680 (Orphan_output_section::set_section_addresses): Ditto.
7682 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7684 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7685 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7687 2010-05-18 Rafael Espindola <espindola@google.com>
7689 * options.cc (General_options::finalize): Handle -nostdlib.
7690 * options.h (nostdlib): New option.
7691 * script.cc (script_add_search_dir): Handle -nostdlib.
7693 2010-05-12 Doug Kwan <dougkwan@google.com>
7695 * arm.cc (Target_arm::do_finalize_sections): Create an empty
7696 attributes section only if there no attributes section after merging.
7697 (Target_arm::merge_object_attributes): Move value of
7698 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7699 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7700 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7701 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7702 and arm_attr_merge_7.stdout.
7703 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7704 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7705 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7706 arm_attr_merge_7b.o): New rules.
7707 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7709 * testsuite/Makefile.in: Regenerate.
7710 * testsuite/arm_attr_merge.sh: New file.
7711 * testsuite/arm_attr_merge_[67][ab].s: Same.
7713 2010-05-05 Nick Clifton <nickc@redhat.com>
7715 * po/es.po: Updated Spanish translation.
7717 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
7719 * Makefile.am (install-exec-local): Properly install gold as
7720 default cross linker.
7721 * Makefile.in: Regenerated.
7723 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
7724 Nick Clifton <nickc@redhat.com>
7726 * configure.ac (install_as_default): Define and set to false
7727 unless --enable-gold or --enable-gold=both/gold has been
7729 * configure: Regenerate.
7731 * Makefile.am (install-exec-local): Install the executable as
7732 'ld.gold'. If install_as_default is true then also install it as
7734 * Makefile.in: Regenerated.
7736 2010-04-24 Ian Lance Taylor <iant@google.com>
7738 * layout.cc (Layout::layout_reloc): In relocatable link don't
7739 combine reloc sections for grouped sections.
7741 2010-04-23 Sriraman Tallam <tmsriram@google.com>
7743 * gc.h (gc_process_relocs): Pass information on relocs pointing to
7744 sections that are not ordinary to icf.
7745 * icf.cc (get_section_contents): Handle relocation pointing to section
7746 with no object or shndx information.
7747 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7748 * testsuite/Makefile.in: Regenerate.
7749 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7750 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7752 2010-04-22 Ian Lance Taylor <iant@google.com>
7754 * expression.cc (Expression::Expression_eval_info): Add
7755 result_alignment_pointer field.
7756 (Expression::eval_with_dot): Add result_alignment_pointer
7757 parameter. Change all callers.
7758 (Expression::eval_maybe_dot): Likewise.
7759 (class Binary_expression): Add alignment_pointer parameter to
7760 left_value and right_value. Change all callers.
7761 (BINARY_EXPRESSION): Set result alignment.
7762 (class Trinary_expression): Add alignment_pointer parameter to
7763 arg2_value and arg3_value. Change all callers.
7764 (Trinary_cond::value): Set result alignment.
7765 (Max_expression::value, Min_expression::value): Likewise.
7766 (Align_expression::value): Likewise.
7767 * script-sections.cc (class Sections_element): Add dot_alignment
7768 parameter to set_section_addresses virtual function. Update
7770 (class Output_section_element): Likewise.
7771 (Script_sections::create_segments): Add dot_alignment parameter.
7773 (Script_sections::create_segments_from_phdrs_clause): Likewise.
7774 (Script_sections::set_phdrs_clause_addresses): Likewise.
7775 * script-sections.h: Update declarations.
7776 * script.h: Update declarations.
7777 * output.h (Output_segment::set_minimum_p_align): Don't decrease
7779 * testsuite/script_test_3.t: Set large alignment.
7780 * testsuite/script_test_3.sh: Make sure that at least one LOAD
7781 segment has expected alignment.
7783 2010-04-22 Nick Clifton <nickc@redhat.com>
7785 * po/gold.pot: Updated by the Translation project.
7786 * po/vi.po: Updated Vietnamese translation.
7788 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
7790 * testsuite/Makefile.am (check_PROGRAMS): Add
7791 icf_virtual_function_folding_test.
7792 * testsuite/Makefile.in: Regenerated.
7794 2010-04-15 Andrew Haley <aph@redhat.com>
7796 * options.h (merge_exidx_entries): New option.
7797 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7798 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7799 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7800 (Target_arm::merge_exidx_entries): New function.
7801 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7802 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7803 to Arm_exidx_fixup constructor.
7804 Add new arg, merge_exidx_entries.
7805 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7806 Arm_output_section::fix_exidx_coverage.
7808 2010-04-18 Sriraman Tallam <tmsriram@google.com>
7810 * icf.cc (get_section_contents): Check for preemptible functions.
7811 Ignore addend when appropriate.
7812 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
7814 (add_from_relobj): Check for section folded.
7815 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7816 * symtab.h (should_add_dynsym_entry): Add new parameter.
7817 * target-reloc.h (scan_relocs): Check for section folded.
7818 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7819 Check reloc types for function pointers in shared objects.
7820 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7822 (icf_preemptible_functions_test): New test case.
7823 (icf_string_merge_test): New test case.
7824 * testsuite.Makefile.in: Regenerate.
7825 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7826 bar_glob. Refactor code.
7827 * testsuite/icf_preemptible_functions_test.cc: New file.
7828 * testsuite/icf_preemptible_functions_test.sh: New file.
7829 * testsuite/icf_string_merge_test.cc: New file.
7830 * testsuite/icf_string_merge_test.sh: New file.
7831 * testsuite/icf_virtual_function_folding_test.cc: New file.
7832 * testsuite/icf_virtual_function_folding_test.sh: New file.
7834 2010-04-14 Doug Kwan <dougkwan@google.com>
7836 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7837 for local symbol recounting if we remove a section due to ICF.
7838 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7839 there are no regular objects in input.
7841 2010-04-13 Doug Kwan <dougkwan@google.com>
7843 * arm.cc (Arm_input_section::set_final_data_size): Compute
7844 accurate final data size instead of using current data size.
7846 2010-04-09 Doug Kwan <dougkwan@google.com>
7848 * layout.cc (Layout::choose_output_section): Handle script section
7850 (Layout::make_output_section_for_script): Add section type parameter.
7851 Handle script section types.
7852 * layout.h (Layout::make_output_section_for_script): Add section
7854 * output.cc (Output_section::Output_section): Initialize data member
7856 (Output_section::do_reset_address_and_file_offset): Do not set address
7857 to 0 if section is a NOLOAD section.
7858 * output.h (Output_section::is_noload): New method.
7859 (Output_section::set_is_noload): Ditto.
7860 (Output_section::is_noload_): New data member.
7861 * script-c.h (Script_section_type): New enum type.
7862 (struct Parser_output_section_header): Add new file section_type.
7863 * script-sections.cc (Sections_element::output_section_name): Add
7864 parameter for returning script section type.
7865 (Output_section_definition::output_section_name): Ditto.
7866 (Output_section_definition::section_type)P; New method.
7867 (Output_section_definiton::script_section_type_name): Ditto.
7868 (Output_section_definition::script_section_type_): New data member.
7869 (Output_section_definition::Output_section_definition): Initialize
7870 data member Output_section_definition::script_section_type_.
7871 (Output_section_definition::create_sections): Pass script section type
7872 to Layout::make_output_section_for_script.
7873 (Output_section_definition::output_section_name): Return script
7874 section type to caller.
7875 (Output_section_definition::set_section_address): Do not advance
7876 dot value and load address if section type is NOLOAD. Set address
7877 of NOLOAD sections regardless of section flags.
7878 (Output_section_definition::print): Print section type if it is
7879 not SCRIPT_SECTION_TYPE_NONE.
7880 (Output_section_definition::section_type): New method.
7881 (Output_section_definition::script_section_type_name): Ditto.
7882 (Script_sections::output_section_name): Add new parameter
7883 PSECTION_TYPE for returning script section type. Pass it to
7884 section elements. Handle discard sections.
7885 (Sort_output_sections::operator()): Handle NOLOAD sections.
7886 * script-sections.h (Script_sections::Section_type): New enum type.
7887 (Script_sections::output_section_name): Add a new parameter for
7888 returning script section type.
7889 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7891 * yyscript.y (union): Add new field SECTION_TYPE.
7892 (COPY, DSECT, INFO, NOLOAD): New tokens.
7893 (opt_address_and_section_type): Change type to output_section_header.
7894 (section_type): New non-terminal
7895 (section_header): Handle section type.
7896 (opt_address_and_section_type): Return section type value.
7898 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
7900 * testsuite/plugin_common_test_1.c (foo): Add prototype.
7901 * testsuite/plugin_common_test_2.c (foo): Likewise.
7903 2010-04-08 Doug Kwan <dougkwan@google.com>
7905 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7907 * output.cc (Output_section::add_merge_input_section): Simplify
7908 code and return status of Output_merge_base::add_input_section.
7909 Update merge section map only if Output_merge_base::add_input_section
7912 2010-04-07 Doug Kwan <dougkwan@google.com>
7914 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7915 if section is marked as containing instructions but has no mapping
7917 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7918 correct section index.
7919 (Arm_relobj::find_linked_text_section): Ditto.
7921 2010-04-07 Cary Coutant <ccoutant@google.com>
7923 * archive.cc (include_member): Destroy Read_symbols_data object before
7925 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7926 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7927 (Read_symbols_data::~Read_symbols_data) New destructor.
7928 (Section_relocs::Section_relocs) New constructor.
7929 (Section_relocs::~Section_relocs) New destructor.
7930 (Read_relocs_data::Read_relocs_data) New constructor.
7931 (Read_relocs_data::~Read_relocs_data) New destructor.
7932 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7933 pointers to NULL after deleting.
7935 2010-04-07 Doug Kwan <dougkwan@google.com>
7937 * arm.cc: Replace "endianity" with "endianness" in comments.
7938 (Arm_exidx_cantunwind): Ditto.
7939 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7940 (Arm_relobj::merge_flags_and_attributes): New method.
7941 (Arm_relobj::merge_flags_and_attributes_): New data member.
7942 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7943 (Arm_relobj::scan_sections_for_stubs): Ditto.
7944 (Arm_relobj::do_read_symbols): Check to see if we really want to
7945 merge processor-specific flags and attributes. Exit early if
7946 an object is empty except for section names and the undefined symbol.
7947 (Target_arm::do_finalize_sections): Move check for ELF format to
7948 Arm_relobj::do_read_symbols. Merge processor specific flags and
7949 attributes from a regular object only when we have determined that
7950 it is aapropriate. Do not create an .ARM.attributes section in
7951 output if there is no regular input object.
7952 (Target_arm::merge_processor_specific_flags): Check
7953 --warn-mismatch before printing any error.
7954 (Target_arm::merge_object_attributes): Ditto.
7955 * gold.cc (queue_middle_tasks): Handle the case in which there is
7956 no regular object in input.
7957 * options.cc (General_options::parse_EB): New method.
7958 (General_options::parse_EL): Same.
7959 (General_options::General_options): Initialize endianness_.
7960 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7962 (General_options::Endianness): New enum.
7963 (General_options::endianness): New method.
7964 (General_options::endianness_): New data member.
7965 * parameters.cc (Parameters::set_options): Check target endianness.
7966 (Parameters::set_target_once): Ditto.
7967 (Parameters::check_target_endianness): New method.
7968 (parameters_force_valid_target): If either -EL or -EB is specified,
7969 use it to define endianness of default target.
7970 * parameters.h (Parameters::check_target_endianness): New method
7972 * target.h (class Target): Change "endianity" to "endianness"
7975 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7977 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7978 * configure: Regenerate.
7979 * Makefile.in: Regenerate.
7980 * testsuite/Makefile.in: Regenerate.
7982 2010-04-06 Cary Coutant <ccoutant@google.com>
7985 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7986 prevailing definitions of common symbols.
7987 * testsuite/plugin_test_6.sh: New test case.
7988 * testsuite/plugin_common_test_1.c: New test case.
7989 * testsuite/plugin_common_test_2.c: New test case.
7990 * testsuite/Makefile.am (plugin_test_6): New test case.
7991 * testsuite/Makefile.in: Regenerate.
7993 2010-04-06 Nick Clifton <nickc@redhat.com>
7995 * po/vi.po: New Vietnamese translation.
7997 2010-03-30 Doug Kwan <dougkwan@google.com>
7999 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8001 2010-03-25 Doug Kwan <dougkwan@google.com>
8003 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8004 to avoid a conversion warning on a 32-bit host.
8006 2010-03-24 Ian Lance Taylor <iant@google.com>
8008 * testsuite/script_test_3.t: Add a TLS segment.
8009 * testsuite/Makefile.am (check_PROGRAMS): Add
8010 tls_phdrs_script_test.
8011 (tls_phdrs_script_test_SOURCES): Define.
8012 (tls_phdrs_script_test_DEPENDENCIES): Define.
8013 (tls_phdrs_script_test_LDFLAGS): Define.
8014 (tls_phdrs_script_test_LDADD): Define.
8015 * testsuite/Makefile.in: Rebuild.
8017 2010-03-23 Cary Coutant <ccoutant@google.com>
8019 * fileread.cc (find_or_make_view): Fix comment.
8021 2010-03-23 Ian Lance Taylor <iant@google.com>
8023 * script-sections.cc (class Orphan_section_placement): Define
8024 PLACE_TLS and PLACE_TLS_BSS.
8025 (Orphan_section_placement::Orphan_section_placement): Initialize
8027 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8028 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8029 (tls_script_test_SOURCES): Define.
8030 (tls_script_test_DEPENDENCIES): Define.
8031 (tls_script_test_LDFLAGS): Define.
8032 (tls_script_test_LDADD): Define.
8033 * testsuite/Makefile.in: Rebuild.
8035 2010-03-22 Doug Kwan <dougkwan@google.com>
8037 * arm.cc (Arm_relocate_functions::abs8,
8038 Arm_relocate_functions::abs16): Use correct check for overflow
8039 specified in the ARM ELF specs.
8040 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
8041 target of a BLX instruction specially.
8042 (Reloc_stub::stub_type_for_reloc): Ditto.
8043 (Relocate::relocate): Use symbolic names instead of numeric relocation
8044 codes to report error.
8045 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8047 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8048 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8049 thumb2_blx_out_of_range.stdout
8050 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8051 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8052 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8053 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8054 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8055 thumb2_blx_in_range, thumb2_blx_in_range.o,
8056 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8057 thumb2_blx_out_of_range.o): New rules.
8058 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8059 thumb2_blx_in_range and thumb2_blx_out_of_range.
8060 * testsuite/Makefile.in: Regenerate.
8061 * arm_branch_in_range.sh: Add tests for THUMB BLX.
8062 * testsuite/thumb_blx_in_range.s: New file.
8063 * testsuite/thumb_blx_out_of_range.s: New file.
8065 2010-03-22 Rafael Espindola <espindola@google.com>
8067 * archive.cc (Should_include): Move to archive.h.
8068 (should_include_member): Make it a member of Archive.
8070 (Add_lib_group_symbols): New.
8071 * archive.h: Include options.h.
8072 (Archive_member): Moved from Archive.
8073 (Should_include): Moved from archive.cc.
8075 (Add_lib_group_symbols): New.
8076 * dynobj.cc (do_should_include_member): New.
8077 * dynobj.h (do_should_include_member): New.
8078 * gold.cc (queue_initial_tasks): Update call to queue.
8079 * main.cc (main): Print lib group stats.
8080 * object.cc (do_should_include_member): New.
8081 * object.h: Include archive.h.
8082 (Object::should_include_member): New.
8083 (Object::do_should_include_member): New.
8084 (Sized_relobj::do_should_include_member): New.
8085 * options.cc (General_options::parse_start_lib): New.
8086 (General_options::parse_end_lib): New.
8087 (Input_arguments::add_file): Handle lib groups.
8088 (Input_arguments::start_group): Check we are not in a lib.
8089 (Input_arguments::start_lib): New.
8090 (Input_arguments::end_lib): New.
8091 * options.h (General_options): Add start_lib and end_lib.
8092 (Input_argument::lib_): New.
8093 (Input_argument::lib): New.
8094 (Input_argument::is_lib): New.
8095 (Input_file_lib): New.
8096 (Input_arguments::in_lib_): New.
8097 (Input_arguments::in_lib): New.
8098 (Input_arguments::start_lib): New.
8099 (Input_arguments::end_lib_): New.
8100 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8101 in unused members as preempted.
8102 (Sized_pluginobj::do_should_include_member): New.
8103 * plugin.h (Sized_pluginobj::do_should_include_member): New.
8104 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8106 (Read_symbols::do_whole_lib_group): New.
8107 (Read_symbols::do_lib_group): New.
8108 (Read_symbols::do_read_symbols): Handle lib groups.
8109 (Read_symbols::get_name): Handle lib groups.
8110 * readsyms.h (Read_symbols): Add an archive member pointer.
8111 (Read_symbols::do_whole_lib_group): New.
8112 (Read_symbols::do_lib_group): New.
8113 (Read_symbols::member_): New.
8114 * script.cc (read_input_script): Update call to queue_soon.
8116 2010-03-19 Doug Kwan <dougkwan@google.com>
8118 * arm.cc (Stub_table::Stub_table): Initialize new data members
8119 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8120 (Stub_table::add_reloc_stub): Assign stub offset and update
8121 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8122 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8124 (Stub_table::update_data_size_and_addralign): Use
8125 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8126 instead of going over all reloc stubs.
8127 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8128 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8129 Stringpool_template::offset_ to size of Stringpool_char.
8130 (Stringpool_template::new_key_offset): Remove code to initialize
8131 Stringpool_template::offset_.
8132 * stringpool.h (Stringpool_template::set_no_zero_null): Set
8133 Stringpool_template::offset_ to zero.
8135 2010-03-15 Doug Kwan <dougkwan@google.com>
8137 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8139 (Stringpool_template::new_key_offset): New method.
8140 (Stringpool_template::add_string): Assign offsets when adding new
8142 (Stringpool_template::set_string_offsets): Do not set string offsets
8143 when not optimizing.
8144 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8146 (Chunked_vector::clear): Clear size_.
8147 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8148 (Chunked_vector::size): Return size_.
8149 (Chunked_vector::push_back): Use size_ to find insert position.
8150 (Chunked_vector::size_): New data member.
8151 (Stringpool_template::set_no_zero_null): Assert string set is empty.
8152 (Stringpool_template::new_key_offset): New method declaration.
8153 (Stringpool_template::offset_): New data member.
8155 2010-03-15 Rafael Espindola <espindola@google.com>
8157 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8158 Add_symbols' constructor.
8159 * readsyms.h (Add_symbols): Remove the input_group member.
8161 2010-03-10 Ian Lance Taylor <iant@google.com>
8163 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8164 target to ask whether a reference to a symbol requires a stack
8166 * target.h (Target::is_call_to_non_split): New function.
8167 (Target::do_is_call_to_non_split): Declare virtual function.
8168 * target.cc: Include "symtab.h".
8169 (Target::do_is_call_to_non_split): New function.
8170 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8172 2010-03-10 Cary Coutant <ccoutant@google.com>
8174 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8175 (File_read::open[1]): Remove initial mapping of whole_file_view_.
8176 (File_read::open[2]): Add whole_file_view_ to list of views.
8177 (File_read::make_view): Remove test of whole_file_view_.
8178 (File_read::find_or_make_view): Create whole_file_view_ if
8180 (File_read::clear_views): Replace bool parameter with enum;
8181 adjust all callers. Don't delete views with permanent data;
8182 do delete cached views and views from archives if
8183 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
8184 if clearing the corresponding view.
8185 * fileread.h (File_read::Clear_views_mode): New enum.
8186 (File_read::View::is_permanent_view): New method.
8187 (File_read::clear_views): Replace bool parameter
8188 with enum; adjust all callers.
8189 * options.h (General_options): Change keep_files_mapped option;
8190 add map_whole_files.
8191 * readsyms.cc (Add_symbols::run): Delete sd_ object before
8193 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8196 2010-03-10 David S. Miller <davem@davemloft.net>
8198 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8200 2010-03-09 Sriraman Tallam <tmsriram@google.com>
8202 * icf.cc (get_section_contents): Add '@' marker after processing the
8205 2010-03-08 Doug Kwan <dougkwan@google.com>
8207 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8208 due to a conversion warning.
8209 (Arm_relobj::update_output_local_symbol_count): Check for local
8210 symbol with unset output index.
8212 2010-03-05 Ian Lance Taylor <iant@google.com>
8214 * options.h (class General_options): Add --spare-dynamic-tags.
8215 * output.cc (Output_data_dynamic::set_final_data_size): Implement
8216 --spare-dynamic-tags.
8218 2010-03-05 Ian Lance Taylor <iant@google.com>
8220 * incremental.cc: Include "libiberty.h".
8222 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
8224 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8225 function, is_info_ member.
8226 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8227 (Versions::Versions): Update caller.
8228 (Versions::define_base_version): Likewise.
8229 (Versions::add_def): Likewise.
8231 2010-03-03 Sriraman Tallam <tmsriram@google.com>
8233 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8234 (Scan::possible_function_pointer_reloc): New function.
8235 (Scan::local_reloc_may_be_function_pointer): Change to call
8236 possible_function_pointer_reloc.
8237 (Scan::global_reloc_may_be_function_pointer): Ditto.
8238 * icf.h (Icf::check_section_for_function_pointers): Change to reject
8239 relocations in ".data.rel.ro._ZTV" section.
8240 * testsuite/icf_safe_so_test.sh: Change to pass i386.
8241 * testsuite/icf_safe_so_test.cc: Ditto.
8242 * testsuite/icf_safe_test.cc: Ditto.
8243 * testsuite/icf_safe_test.sh: Ditto.
8245 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8246 Ian Lance Taylor <iant@google.com>
8248 * target-reloc.h (relocate_section): Check the symbol table index
8249 for -1U before setting the local symbol index.
8250 (scan_relocatable_relocs): If copying the relocation, record that
8251 the local symbol is required.
8252 * object.h (Symbol_value::is_output_symtab_index_set): New
8254 (Symbol_value::may_be_discarded_from_output_symtab): New
8256 (Symbol_value::has_output_symtab_entry): New function.
8257 (Symbol_value::needs_output_symtab_entry): Remove.
8258 (Symbol_value::output_symtab_index): Make sure the symbol index is
8260 (Symbol_value::set_output_symtab_index): Make sure the symbol
8261 index is not set. Make sure the new index is valid.
8262 (Symbol_value::set_must_have_output_symtab_entry): New function.
8263 (Symbol_value::has_output_dynsym_entry): New function.
8264 (Symbol_value::set_output_dynsym_index): Make sure the new index
8266 (Sized_relobj::set_must_have_output_symtab_entry): New function.
8267 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8268 local symbol if permitted.
8269 (Sized_relobj::do_finalize_local_symbols): Call
8270 is_output_symtab_index_set rather than needs_output_symtab_entry.
8271 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8272 rather than needs_output_symtab_entry. Call
8273 has_output_dynsym_entry rather than needs_output_dynsym_entry.
8274 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8275 is_output_symtab_index_set rather than needs_output_symtab_entry.
8276 * testsuite/discard_locals_relocatable_test.c: New file.
8277 * testsuite/discard_locals_test.sh: Test -r.
8278 * testsuite/Makefile.am (check_DATA): Add
8279 discard_locals_relocatable_test1.syms,
8280 discard_local_relocatable_test2.syms.
8281 (MOSTLYCLEANFILES): Likewise. Also add
8282 discard_locals_relocatable_test1.lout and
8283 discard_locals_relocatable_test2.out.
8284 (discard_locals_relocatable_test1.syms): New target.
8285 (discard_locals_relocatable_test.o): New target.
8286 (discard_locals_relocatable_test1.out): New target.
8287 (discard_locals_relocatable_test2.syms): New target.
8288 (discard_locals_relocatable_test2.out): New target.
8289 (various): Add missing ../ld-new dependencies.
8290 * testsuite/Makefile.in: Rebuild.
8292 2010-03-03 Nick Clifton <nickc@redhat.com>
8294 * po/fi.po: New Finnish translation.
8296 2010-03-01 Doug Kwan <dougkwan@google.com>
8298 * layout.cc (Layout::Layout): Force section types of .init_array*,
8299 .preinit_array* and .fini_array* sections.
8300 * output.cc (Output_section::Input_section_sort_entry::has_priority):
8301 Fix check of return value of std::string::find.().
8302 (Output_section::Input_section_sort_compare::operator()): Remove
8303 comment about .init_array.
8304 (Output_section::Input_section_sort_init_fini_compare::operator()):
8306 (Output_section::sort_attached_input_sections): Handle .init_array
8307 and .fini_array specially.
8308 * output.h (Output_section::Inut_section_sort_compare): Update
8310 (Output_section::Input_section_sort_init_fini_compare): New struct.
8312 2010-02-26 Doug Kwan <dougkwan@google.com>
8314 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8315 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8316 * testsuite/debug_msg.sh: Avoid matching source line number for
8317 use of global variable undef_int.
8319 2010-02-26 Doug Kwan <dougkwan@google.com>
8321 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8322 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8323 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8324 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8325 * options.cc (General_options::General_options): Initialize member
8327 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8328 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8329 and rm_no_fix_v4bx.stdout
8330 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8331 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8332 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8333 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8334 and arm_no_fix_v4bx.
8335 * Makefile.in: Regenerate.
8336 * testsuite/arm_fix_v4bx.s: New file.
8337 * testsuite/arm_fix_v4bx.sh: Ditto.
8339 2010-02-24 Doug Kwan <dougkwan@google.com>
8341 * arm.cc (Target_arm::got_section): Make the .got section the first
8342 non RELRO section in the data segment.
8343 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8344 suffixes of section names.
8346 2010-02-24 Doug Kwan <dougkwan@google.com>
8348 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8349 flags and attributes merging if an input file is a binary file.
8350 * fileread.cc (Input_file::open): Record format of original file.
8351 * fileread.h (Input_file::Format): New enum type.
8352 (Input_file::Input_file): Initialize data member format_.
8353 (Input_file::format): New method definition.
8354 (Input_file::format_):: New data member.
8356 2010-02-24 Doug Kwan <dougkwan@google.com>
8358 * arm.cc (Arm_output_data_got): New class.
8359 (ARM_TCB_SIZE): New constant
8360 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8361 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8362 If user uses a script with a SECTIONS clause, issue only a warning
8363 for a misplaced EXIDX input section. Otherwise, issue an error.
8364 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8366 (Target_arm::got_mode_index_entry): Handle static linking.
8367 (Target_arm::Scan::local): Ditto.
8368 (Target_arm::Scan::global): Ditto.
8369 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
8370 all incorrectly implemented relocations.
8371 (Target_arm::fix_exidx_coverage): Pass layout to
8372 Arm_output_section::fix_exidx_coverage.
8373 * layout.cc (Layout::section_name_mapping): Remove trailing dots
8374 from ".ARM.exidx." and ".ARM.extab.".
8376 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8378 * arm.cc (Target_arm::do_finalize_sections): Create attribute
8379 section if it does not already exist.
8380 * attributes.cc (Attributes_section_data::Attributes_section_data):
8381 Don't crash if size is zero.
8383 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8384 Ian Lance Taylor <iant@google.com>
8386 * gold.cc (queue_middle_tasks): If no input files were opened,
8388 * workqueue.h (Task_function::Task_function): Assert that there is
8391 2010-02-22 Doug Kwan <dougkwan@google.com>
8393 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8394 * icf.cc (get_section_contents): Cast snprintf arguments to long long
8395 types to avoid warnings due to different uint64_t implementations
8398 2010-02-21 Doug Kwan <dougkwan@google.com>
8400 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8401 handling of the maximum backward branch offset.
8402 (Arm_relocate_functions::thumb_branch_common): Ditto.
8403 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8404 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8405 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8406 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8407 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8408 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8409 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8410 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8411 thumb_bl_out_of_range thumb_bl_out_of_range.o,
8412 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8413 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8414 thumb2_bl_out_of_range.o): New rules.
8415 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8416 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8417 thumb2_bl_out_of_range
8418 * testsuite/Makefile.in: Regenerate.
8419 * testsuite/arm_bl_in_range.s: New file.
8420 * testsuite/arm_bl_out_of_range.s: Ditto.
8421 * testsuite/arm_branch_in_range.sh: Ditto.
8422 * testsuite/arm_branch_range.t: Ditto.
8423 * testsuite/thumb2_branch_range.t: Ditto.
8424 * testsuite/thumb_bl_in_range.s: Ditto.
8425 * testsuite/thumb_bl_out_of_range.s: Ditto.
8426 * testsuite/thumb_branch_range.t: Ditto.
8428 2010-02-20 Sriraman Tallam <tmsriram@google.com>
8430 * gc.h (gc_process_relocs): Change vectors to point to the new list.
8431 Add reloc offset information.
8432 * icf.cc (get_section_contents): Change iterators to point to the new
8433 vectors. Add reloc offset information to the contents.
8434 * icf.h (Icf::Sections_reachable_info): New typedef.
8435 (Icf::Sections_reachable_list): New typedef.
8436 (Icf::Offset_info): New typedef.
8437 (Icf::Reloc_info): New struct typedef.
8438 (Icf::Reloc_info_list): New typedef.
8439 (Icf::symbol_reloc_list): Delete method.
8440 (Icf::addend_reloc_list): Delete method.
8441 (Icf::section_reloc_list): Delete method.
8442 (Icf::reloc_info_list): New method.
8443 (Icf::reloc_info_list_): New member.
8445 2010-02-19 Doug Kwan <dougkwan@google.com>
8447 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8448 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8449 * arm.cc (Arm_relocation_functions): New forward declaration.
8450 (Target_arm::Target_arm): Initialize new data members
8451 got_mod_index_offset_ and tls_base_symbol_defined_.
8452 (Target_arm::Relocate::relocate_tls): New method.
8453 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8454 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8456 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8457 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8458 (Target_arm::got_mod_index_offset_,
8459 Target_arm::tls_base_symbol_defined_): New data members.
8460 (Target_arm::Scan::local, Target::Scan::global,
8461 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8464 2010-02-18 Doug Kwan <dougkwan@google.com>
8466 * arm.cc (Arm_relobj::find_linked_text_section): New method.
8467 (Arm_relobj::make_exidx_input_section): Pass section index of linked
8468 text section as a parameter becuase some broken tools may not set
8469 the link in section header.
8470 (Target_arm::has_got_section): New method.
8471 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8472 without any mapping symbol as data only. Remove warning.
8473 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8474 link in its section header, try to discover the link by inspecting the
8475 REL31 relocation at the beginning of the section.
8476 (Target_arm::Scan::check_non_pic): Report name of offending relocation
8478 (Target_arm::Scan::global): Treat any reference to the symbol
8479 _GLOBAL_OFFSET_TABLE_ as a GOT access.
8481 2010-02-12 Sriraman Tallam <tmsriram@google.com>
8483 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8484 (Scan::global_reloc_may_be_function_pointer): New function.
8485 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8486 (Scan::global_reloc_may_be_function_pointer): New function.
8487 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8488 (Scan::global_reloc_may_be_function_pointer): New function.
8489 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8490 (Scan::global_reloc_may_be_function_pointer): New function.
8491 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8492 (Scan::global_reloc_may_be_function_pointer): New function.
8493 (Scan::possible_function_pointer_reloc): New function.
8494 (Target_x86_64::can_check_for_function_pointers): New function.
8495 * gc.h (gc_process_relocs): Scan relocation types to determine if
8496 function pointers were taken for targets that support it.
8497 * icf.cc (Icf::find_identical_sections): Include functions for
8498 folding in safe ICF whose pointer is not taken.
8499 * icf.h (Secn_fptr_taken_set): New typedef.
8500 (fptr_section_id_): New member.
8501 (section_has_function_pointers): New function.
8502 (set_section_has_function_pointers): New function.
8503 (check_section_for_function_pointers): New function.
8504 * options.h: Fix comment for safe ICF option.
8505 * target.h (can_check_for_function_pointers): New function.
8506 * testsuite/Makefile.am: Add icf_safe_so_test test case.
8507 Modify icf_safe_test for X86-64.
8508 * testsuite/Makefile.in: Regenerate.
8509 * testsuite/icf_safe_so_test.cc: New file.
8510 * testsuite/icf_safe_so_test.sh: New file.
8511 * testsuite/icf_safe_test.cc (kept_func_3): New function.
8512 (main): Change to take pointer to function kept_func_3.
8513 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8514 folding is done correctly for X86-64.
8516 2010-02-12 David S. Miller <davem@davemloft.net>
8518 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8519 is_symbolless parameter.
8520 (Output_reloc<SHT_REL>::is_symbolless): New.
8521 (Output_reloc<SHT_REL>::is_symbolless_): New.
8522 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8523 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8524 (Output_reloc<SHT_RELA>::is_symbolless): New.
8525 (Output_data_reloc::add_global): Handle is_symbolless.
8526 (Output_data_reloc::add_global_relative): Likewise.
8527 (Output_data_reloc::add_local): Likewise.
8528 (Output_data_reloc::add_local_relative): Likewise.
8529 (Output_data_reloc::add_symbolless_global_addend): New.
8530 (Output_data_reloc::add_symbolless_local_addend): New.
8531 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8533 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8534 instead of ->is_relative_
8535 (Output_reloc::write): Likewise.
8536 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8537 (Output_reloc::write_rel): Simplify.
8539 * sparc.cc (Target_sparc::Scan::local): Use
8540 ->add_symbolless_local_addend as needed.
8541 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8542 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
8543 based upon relocation offset.
8545 2010-02-11 Doug Kwan <dougkwan@google.com>
8547 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8548 (Target_arm::Scan::global): Ditto. Also remove a comment before the
8549 beginning of function.
8550 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8551 and MOVT_ABS relocations. Those are non issued in scanning. Fix
8552 parameter is_32bit in calls to should_apply_static_reloc.
8553 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8554 (check_DATA): Add arm_abs_global.stdout.
8555 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8556 arm_abs_global.stdout): New rules.
8557 (MOSTLLYCLEANFILES): Add arm_abs_global
8558 * Makefile.in: Regenerate.
8559 * testsuite/arm_abs_global.s: New file.
8560 * testsuite/arm_abs_global.sh: Ditto.
8561 * testsuite/arm_abs_lib.s: Ditto.
8563 2010-02-11 Ian Lance Taylor <iant@google.com>
8565 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8567 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
8568 Allocate_commons_task first.
8569 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8570 task, rather than symtab_lock_.
8571 (Gc_process_relocs::~Gc_process_relocs): New function.
8572 (Gc_process_relocs::is_runnable): Check this_blocker_.
8573 (Gc_process_relocs::locks): Use next_blocker_ rather than
8575 (Scan_relocs::~Scan_relocs): New function.
8576 (Scan_relocs::is_runnable): Check this_blocker_ rather than
8578 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
8580 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8581 fields. Add this_blocker_ and next_blocker_ fields. Adjust
8582 constructor accordingly.
8583 (class Gc_process_relocs): Likewise.
8584 (class Scan_relocs): Likewise.
8585 * common.h (class Allocate_commons_task): Remove symtab_lock_
8586 field, and corresponding constructor parameter.
8587 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8589 (Allocate_commons_task::locks): Likewise.
8591 2010-02-11 Ian Lance Taylor <iant@google.com>
8593 * gold-threads.h (class Once): Define.
8594 (class Initialize_lock): Rewrite as child of Once.
8595 * gold-threads.cc (class Once_initialize): Define.
8596 (once_pointer_control): New static variable.
8597 (once_pointer, once_arg): New static variables.
8598 (c_run_once): New static function.
8599 (Once::Once, Once::run_once, Once::internal_run): New functions.
8600 (class Initialize_lock_once): Remove.
8601 (initialize_lock_control): Remove.
8602 (initialize_lock_pointer): Remove.
8603 (initialize_lock_once): Remove.
8604 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8605 (Initialize_lock::initialize): Rewrite.
8606 (Initialize_lock::do_run_once): New function.
8607 * archive.cc (Archive::interpret_header): Only clear name if it is
8609 * fileread.cc: Include "gold-threads.h"
8610 (file_counts_lock): New static variable.
8611 (file_counts_initialize_lock): Likewise.
8612 (File_read::release): Only increment counts when using --stats.
8613 Use a lock around the increment.
8614 * parameters.cc (class Set_parameters_target_once): Define.
8615 (set_parameters_target_once): New static variable.
8616 (Parameters::Parameters): Move here from parameters.h.
8617 (Parameters::set_target): Rewrite.
8618 (Parameters::set_target_once): New function.
8619 (Parameters::clear_target): Move here and rewrite.
8620 * parameters.h (class Parameters): Update declarations. Add
8621 set_parameters_target_once_ field.
8622 (Parameters::Parameters): Move to parameters.cc.
8623 (Parameters::clear_target): Likewise.
8624 * readsyms.cc (Read_symbols::do_group): Create a Start_group
8626 (Start_group::~Start_group): New function.
8627 (Start_group::is_runnable): New function.
8628 (Start_group::locks, Start_group::run): New functions.
8629 (Finish_group::run): Change saw_undefined to size_t.
8630 * readsyms.h (class Start_group): Define.
8631 (class Finish_group): Change saw_undefined_ field to size_t.
8632 (Finish_group::Finish_group): Remove saw_undefined and
8633 this_blocker parameters. Change all callers.
8634 (Finish_group::set_saw_undefined): New function.
8635 (Finish_group::set_blocker): New function.
8636 * symtab.h (class Symbol_table): Change saw_undefined to return
8637 size_t. Change saw_undefined_ field to size_t.
8638 * target-select.cc (Set_target_once::do_run_once): New function.
8639 (Target_selector::Target_selector): Initialize set_target_once_
8640 field. Don't initialize lock_ and initialize_lock_ fields.
8641 (Target_selector::instantiate_target): Rewrite.
8642 (Target_selector::set_target): New function.
8643 * target-select.h (class Set_target_once): Define.
8644 (class Target_selector): Update declarations. Make
8645 Set_target_once a friend. Remove lock_ and initialize_lock_
8646 fields. Add set_target_once_ field.
8648 2010-02-10 Ian Lance Taylor <iant@google.com>
8650 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8652 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
8653 (queue_middle_tasks): Add all blockers before queueing any tasks.
8654 (queue_final_tasks): Likewise.
8655 * token.h (Task_token::add_blockers): New function.
8656 * object.h (Input_objects::number_of_relobjs): New function.
8658 2010-02-10 Ian Lance Taylor <iant@google.com>
8660 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8661 shared, not if not position independent.
8662 * x86_64.cc (Relocate::relocate_tls): Likewise.
8663 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8664 (tls_pie_pic_test): New target.
8665 * testsuite/Makefile.in: Rebuild.
8667 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8668 (tls_test_main_pie.o, tls_test_pie.o): New targets.
8669 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8670 * testsuite/Makefile.in: Rebuild.
8672 2010-02-09 David S. Miller <davem@davemloft.net>
8674 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8675 R_SPARC_RELATIVE using ->add_local_relative().
8676 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8678 * output.h (Output_data_dynamic::add_section_size): New method
8679 that takes two Output_data objects.
8680 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8681 entry param. Handle it in initializers.
8682 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8683 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8684 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8686 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8687 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8688 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8689 for dynrel_includes_plt.
8690 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8691 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8692 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8694 (Target_sparc::do_finalize_sections): Update to pass true for
8695 dynrel_includes_plt.
8696 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8697 output before .rela.plt
8698 (Target_powerpc::do_finalize_sections): Update to pass true for
8699 dynrel_includes_plt when 32-bit.
8701 2010-02-08 Doug Kwan <dougkwan@google.com>
8703 * arm.cc (Arm_relobj::simple_input_section_output_address): New
8705 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8706 Arm_relobj::scan_section_for_cortex_a8_stubs,
8707 Arm_relobj::do_relocation_section): Instead of calling
8708 Output_section::output_address, use faster
8709 Arm_relobj::simple_input_section_output_address.
8711 2010-02-08 David S. Miller <davem@davemloft.net>
8713 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8714 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8715 relocation helper function.
8717 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8718 just like R_SPARC_GOT{10,13,22}.
8719 (Target_sparc::Scan::local): Likewise.
8720 (Target_sparc::Relocate:relocate): Likewise.
8722 2010-02-06 Ian Lance Taylor <iant@google.com>
8724 * configure.ac: Rewrite targetobjs duplicate removal code to use
8725 only shell constructs.
8726 * configure: Rebuild.
8728 2010-02-05 Doug Kwan <dougkwan@google.com>
8731 * arm.cc (Arm_relobj::section_is_scannable): New method.
8732 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8733 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8735 2010-02-04 Doug Kwan <dougkwan@google.com>
8738 * arm-reloc-property.cc (cstdio): Include.
8739 * configure.ac (targetobjs): Remove duplicates.
8740 * configure: Regenerate.
8741 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8742 big and little endian version for a given address size.
8744 2010-02-03 Doug Kwan <dougkwan@google.com>
8746 * arm-reloc-property.cc
8747 (Arm_reloc_property_table::reloc_name_in_error_message): New method
8749 * arm-reloc-property.h
8750 (Arm_reloc_property_table::get_implemented_static_reloc_property):
8751 New method definition.
8752 (Arm_reloc_property_table::reloc_name_in_error_message): New method
8754 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8756 (GOT_PREL): Change implemented to Y.
8757 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8758 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8759 (Arm_relocate_functions::movw_abs_nc): Remove method.
8760 (Arm_relocate_functions::movt_abs): Ditto.
8761 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8762 (Arm_relocate_functions::thm_movt_abs): Ditto.
8763 (Arm_relocate_functions::movw_rel_nc): Ditto.
8764 (Arm_relocate_functions::movw_rel): Ditto.
8765 (Arm_relocate_functions::movt_rel): Ditto.
8766 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8767 (Arm_relocate_functions:thm_movw_rel): Ditto.
8768 (Arm_relocate_functions:thm_movt_rel): Ditto.
8769 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8770 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8771 New method definitions.
8772 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8773 (Arm_relocation_functions::arm_grp_ldr): Ditto.
8774 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8775 (Arm_relocation_functions::arm_grp_ldc): Ditto.
8776 (Target_arm::Relocate::relocate): Check for non-static or
8777 unimplemented relocation code and exit early. Change calls to
8778 Target_arm::reloc_uses_thumb_bit and
8779 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8780 instead. Refactor code to handle similar relocations to increase
8781 code sharing. Remove check for unsupported relocation code in switch
8783 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8784 relocation property table to find out size. Change error message to
8785 print out the name of a relocation code instead of the numeric value.
8786 (Target_arm::scan_reloc_for_stub): Use relocation property table
8787 instead of calling Target_arm::reloc_uses_thumb_bit().
8789 2010-02-02 Doug Kwan <dougkwan@google.com>
8791 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8792 types of relaxed input section.
8794 2010-02-02 Doug Kwan <dougkwan@google.com>
8796 * Makefile.am (HFILES): Add arm-reloc-property.h.
8798 (TARGETSOURCES): Add arm-reloc-property.cc
8799 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8800 (libgold_a_SOURCES): $(DEFFILES)
8801 * Makefile.in: Regenerate.
8802 * arm-reloc-property.cc: New file.
8803 * arm-reloc-property.h: New file.
8804 * arm-reloc.def: New file.
8805 * arm.cc: Update comments.
8806 (arm-reloc-property.h): New included header.
8807 (arm_reloc_property_table): New global variable.
8808 (Target_arm::do_select_as_default_target): New method definition.
8809 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8810 arm-reloc-property to targ_extra_obj.
8811 * parameters.cc (set_parameters_target): Call
8812 Target::select_as_default_target().
8813 * target.h (Target::select_as_default_target): New method definition.
8814 (Target::do_select_as_default_target): Same.
8816 2010-02-01 Doug Kwan <dougkwan@google.com>
8818 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8819 first_output_text_section_.
8820 (Arm_exidx_fixup::first_output_text_section): New method definition.
8821 (Arm_exidx_fixup::first_output_text_section_): New data member.
8822 (Arm_exidx_fixup::process_exidx_section): Record the first text
8823 output section seen.
8824 (Arm_output_section::fix_exidx_coverage): Set correct linked section
8825 and entsize in output section header.
8827 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8829 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8830 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8831 (Arm_relocate_functions::thm_alu11): New Method.
8832 (Arm_relocate_functions::thm_pc8): New Method.
8833 (Arm_relocate_functions::thm_pc12): New Method.
8834 (Target_arm::Scan::local): Handle the relocations.
8835 (Target_arm::Scan::global): Likewise.
8836 (Target_arm::Relocate::relocate): Likewise.
8837 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8839 2010-01-29 Doug Kwan <dougkwan@google.com>
8841 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8842 of relocation types as ld.
8844 2010-01-29 Doug Kwan <dougkwan@google.com>
8846 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8848 (Arm_relocate_functions::thumb_branch_common): Ditto.
8849 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8850 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8851 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8852 Arm_relocate_functions::jump24): Remove.
8853 (Target_arm::Relocate::relocate): Adjust code to call
8854 Arm_relocation_functions::arm_branch_common and
8855 Arm_relocation_functions::thumb_branch_common instead of their removed
8856 wrappers. Merge switch-cases together to reduce source code size.
8858 2010-01-29 Doug Kwan <dougkwan@google.com>
8860 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8861 output_local_symbol_count_needs_update_.
8862 (Arm_relobj::output_local_symbol_count_needs_update,
8863 Arm_relobj::set_output_local_symbol_count_needs_update,
8864 Arm_relobj::update_output_local_symbol_count): New methods.
8865 (Arm_relobj::output_local_symbol_count_needs_update_): New data
8867 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8868 of pointed function as in a R_ARM_PREL31 relocation.
8869 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8870 for output local symbol count updating.
8871 (Target_arm::do_relax): Update output local symbol counts in objects
8873 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8875 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8877 * arm.cc: Added support for the ARM relocations:
8878 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8879 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8880 (Arm_relocate_functions::movw_rel_nc): Renamed (was
8882 (Arm_relocate_functions::movw_rel): New method.
8883 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8884 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8886 (Arm_relocate_functions::thm_movw_rel): New method.
8887 (Arm_relocate_functions::thm_movt_rel): Renamed (was
8889 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8891 (Target_arm::Scan::global): Likewise.
8892 (Target_arm::Relocate::relocate): Likewise.
8893 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8896 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8898 * arm.cc: Added support for ARM group relocations.
8899 (Target_arm::reloc_needs_sym_origin): New method.
8900 (Arm_relocate_functions::calc_grp_kn): New method.
8901 (Arm_relocate_functions::calc_grp_residual): New method.
8902 (Arm_relocate_functions::calc_grp_gn): New method.
8903 (Arm_relocate_functions::arm_grp_alu): New Method.
8904 (Arm_relocate_functions::arm_grp_ldr): New Method.
8905 (Arm_relocate_functions::arm_grp_ldrs): New Method.
8906 (Arm_relocate_functions::arm_grp_ldc): New Method.
8907 (Target_arm::Scan::local): Handle the ARM group relocations.
8908 (Target_arm::Scan::global): Likewise.
8909 (Target_arm::Relocate::relocate): Likewise.
8910 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8913 2010-01-26 Doug Kwan <dougkwan@google.com>
8915 * arm.cc (set): Include.
8916 (class Arm_exidx_fixup): Change type of last_input_section_ to const
8918 (Arm_output_section::Text_section_list): New type.
8919 (Arm_output_section::append_text_sections_to_list): New method.
8920 (Arm_output_section::fix_exidx_coverage): Ditto.
8921 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8922 (Arm_relobj::convert_input_section_to_relaxed_section): Use
8923 Relobj::set_section_offset() instead of
8924 Sized_relobj::invalidate_section_offset().
8925 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8926 parameter for section headers. Ignore relocation sections for
8927 unallocated sections and EXIDX sections.
8928 (Target_arm::fix_exidx_coverage): New method.
8929 (Target_arm::output_section_address_less_than): New type.
8930 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8931 linked text section instead of the EXIDX section.
8932 (Arm_output_section::create_stub_group): Add an assertion to check
8933 that this is not an EXIDX output section.
8934 (Arm_output_section::append_text_sections_to_list): New method.
8935 (Arm_output_section::fix_exidx_coverage): Ditto.
8936 (Arm_relobj::scan_sections_for_stubs): Adjust call to
8937 Arm_relobj::section_needs_reloc_stub_scanning.
8938 (Target_arm::do_relax): Fix EXIDX output section coverage in the
8940 (Target_arm::fix_exidx_coverage): New method.
8941 * object.h (Relobj::set_output_section): New method.
8942 (Sized_relobj::invalidate_section_offset): Remove method.
8943 (Sized_relobj::do_invalidate_section_offset): Remove method.
8944 (Sized_relobj::do_set_section_offset): Handle offset value -1.
8946 2010-01-25 Doug Kwan <dougkwan@google.com>
8948 * arm.cc (Arm_exidx_merged_section::do_output_offset):
8949 Fix warning due to signed and unsigned comparison on a 32-bit host.
8951 2010-01-22 Doug Kwan <dougkwan@google.com>
8953 * arm.cc (Target_arm::do_relax): Record an output section for section
8954 offset adjustment it contains any stub table that has changed.
8955 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8956 offsets in an output section if necessary.
8957 * output.cc (Output_section::Output_section): Initialize
8958 section_offsets_need_adjustments_.
8959 (Output_section::add_input_section_for_script): Renamed to
8960 Output_section::add_simple_input_section.
8961 (Output_section::save_states): Add a comment.
8962 (Output_section::discard_states): New method defintion.
8963 (Output_section::adjust_section_offsets): Same.
8964 * output.h (Output_section::add_input_section_for_script): Renamed to
8965 Output_section::add_simple_input_section.
8966 (Output_section::discard_states): New method declaration.
8967 (Output_section::adjust_section_offsets): Same.
8968 (Output_section::section_offsets_need_adjustment,
8969 Output_section::set_section_offsets_need_adjustment): New method
8971 (Output_section::section_offsets_need_adjustment_): New data member.
8972 * script-sections.cc
8973 (Output_section_element_input::set_section_address): Adjust code for
8974 renaming of Output_section::add_input_section_for_script.
8975 (Orphan_output_section::set_section_address): Same.
8977 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8979 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8980 Fix_v4bx enum values .
8981 * gold/options.h (General_options): New option definitions.
8982 (General_options::fix_v4bx): New method.
8983 (General_options::Fix_v4bx): New enum.
8984 * gold/options.cc (General_options::parse_fix_v4bx): New method.
8985 (General_options::parse_fix_v4bx_interworking): New method.
8987 2010-01-22 Doug Kwan <dougkwan@google.com>
8989 * arm.cc (Arm_exidx_fixup): New class.
8991 2010-01-21 Doug Kwan <dougkwan@google.com>
8993 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8995 (Arm_exidx_section_offset_map): New type.
8997 2010-01-21 Doug Kwan <dougkwan@google.com>
8999 * arm.cc (Arm_exidx_input_section): New class.
9000 (Arm_relobj::exidx_input_section_by_link,
9001 Arm_relobj::exidx_input_section_by_shndx,
9002 Arm_relobj::make_exidx_input_section): New methods.
9003 (read_arm_attributes_section): Remove.
9004 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9005 information about them.
9006 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9009 2010-01-20 Doug Kwan <dougkwan@google.com>
9011 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9012 Input_section_specifier to Section_id.
9013 (Target_arm::new_arm_input_section: Adjust code for change of key
9015 (Target_arm::find_arm_input_section): Ditto.
9016 * gc.h (object.h): Include for Section_id nand Section_id_hash.
9017 (Section_id): Remove.
9018 (Garbage_collection::Section_id_hash): Remove.
9019 * icf.h (object.h): Include for Section_id nand Section_id_hash.
9020 (Section_id): Remove.
9021 (Icf::Section_id_hash): Remove.
9022 * object.h (Section_id, Const_section_id, Section_id_hash,
9023 Const_section_id_hash): New type definitions.
9024 * output.cc (Output_section::add_relaxed_input_section): Change to
9025 use Const_section_id instead of Input_section_specifier as key type.
9026 (Output_section::add_merge_input_section): Ditto.
9027 (Output_section::build_relaxation_map): Change to use Section_id
9028 instead of Input_section_specifier as key type.
9029 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9031 (Output_section::convert_input_sections_to_relaxed_sections): Change
9032 to use Const_section_id instead of Input_section_specifier as key type.
9033 (Output_section::find_merge_section): Ditto.
9034 (Output_section::find_relaxed_input_section): Ditto.
9035 * output.h (Input_section_specifier): Remove class.
9036 (Output_section::Output_section_data_by_input_section_map): Change
9037 key type to Const_section_id.
9038 (Output_section::Output_relaxed_input_section_by_input_section_map):
9040 (Output_section::Relaxation_map): Change key type to Section_id.
9042 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9044 * gold/arm.cc: Added support for R_ARM_V4BX relocation
9045 (class Arm_v4bx_stub): New class.
9046 (DEF_STUBS): Updated definition to support v4_veneer_bx.
9047 (Stub_factory::make_arm_v4bx_stub): New method.
9048 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9049 (Stub_table::empty): Handle v4bx stubs.
9050 (Stub_table::add_arm_v4bx_stub): New method.
9051 (Stub_table::find_arm_v4bx_stub): New method.
9052 (Arm_relocate_functions::v4bx): New method.
9053 (Target_arm::fix_v4bx): New method.
9054 (Target_arm::Target_arm): Handle R_ARM_V4BX.
9055 (Stub_table::relocate_stubs): Likewise.
9056 (Stub_table::do_write): Likewise.
9057 (Stub_table::update_data_size_and_addralign): Likewise.
9058 (Stub_table::finalize_stubs): Likewise.
9059 (Target_arm::Scan::local): Likewise.
9060 (Target_arm::Scan::global): Likewise.
9061 (Target_arm::do_finalize_sections): Likewise.
9062 (Target_arm::Relocate::relocate): Likewise.
9063 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9065 (Target_arm::scan_reloc_for_stub): Likewise.
9066 (Target_arm::scan_reloc_section_for_stubs): Likewise.
9068 2010-01-19 Ian Lance Taylor <iant@google.com>
9070 * output.cc (Output_section_headers::do_sized_write): Write large
9071 segment count to sh_info field.
9072 (Output_file_header::do_sized_write): For large segment count,
9073 write PN_XNUM to e_phnum field.
9075 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9077 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9078 (Arm_relocate_functions::thm_jump8): New function.
9079 (Arm_relocate_functions::thm_jump11): New function.
9080 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9082 (Target_arm::Scan::global): Likewise.
9083 (Target_arm::Relocate::relocate): Likewise.
9084 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9087 2010-01-14 Doug Kwan <dougkwan@google.com>
9089 * arm.cc (map, utility): Include headers.
9090 (Target_arm::apply_cortex_a8_workaround): New method.
9091 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9092 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9093 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9094 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9095 the --[no-]fix-cortex-a8 command line options.
9096 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9097 (Target_arm::relocate_stub): Use addend in instruction template.
9098 * options.h (DEFINE_bool): Set the user-set flag.
9099 (General_options): Add --[no-]-fix-cortex options.
9100 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9101 : Update fast look-up map after conversion.
9103 2010-01-14 Sriraman Tallam <tmsriram@google.com>
9105 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9106 in the first pass of do_layout.
9108 2010-01-13 Doug Kwan <dougkwan@google.com>
9110 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9111 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9112 apparent compiler problem of not folding static constant integral
9113 data members of elfcpp::Elf_sizes<32>.
9115 2010-01-13 Doug Kwan <dougkwan@google.com>
9117 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9118 Arm_relobj::section_needs_cortex_a8_stub_scanning,
9119 Arm_relobj::scan_section_for_cortex_a8_erratum,
9120 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9121 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9122 sections to scan for relocation stubs into a new method
9123 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
9124 relocation and Cortex-A8 stub scanning.
9125 (Target_arm::do_relax): Force stubs to be after stubbed sections
9126 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
9127 the beginning of a new relaxation pass. Update a comment.
9128 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9130 2010-01-12 Ian Lance Taylor <iant@google.com>
9132 * target-reloc.h (visibility_error): New inline function.
9133 (relocate_section): Call visibility_error.
9134 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9135 (MOSTLYCLEANFILES): Likewise.
9136 (protected_4_pic.o, protected_3.err): New targets.
9137 * testsuite/protected_4.cc: New file.
9139 2010-01-12 Doug Kwan <dougkwan@google.com>
9141 * arm.cc (Cortex_a8_reloc): New class.
9142 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9143 and cortex_a8_relocs_info_.
9144 (Target_arm::fix_cortex_a8): New method definition.
9145 (Target_arm::Cortex_a8_relocs_info): New type.
9146 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9147 New data member declarations.
9148 (Target_arm::scan_reloc_for_stub): Record information about
9149 relocations for THUMB branches that might be exempted from the
9150 Cortex-A8 workaround.
9151 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9152 at the beginning of a relaxation pass.
9154 2010-01-12 Doug Kwan <dougkwan@google.com>
9156 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9157 (Arm_relobj::Mapping_symbol_position,
9158 Arm_reloj::Mapping_symbol_position_less,
9159 Arm_relobj::Mapping_symbols_info): New types.
9160 (Target_arm::is_mapping_symbol_name): New method definition.
9161 (Arm_relobj::do_count_local_symbols): Save information about mapping
9164 2010-01-11 Doug Kwan <dougkwan@google.com>
9166 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9167 Arm_relocate_functions::thumb32_branch_upper,
9168 Arm_relocate_functions::thumb32_branch_lower,
9169 Arm_relocate_functions::thumb32_cond_branch_offset,
9170 Arm_relocate_functions::thumb32_cond_branch_upper,
9171 Arm_relocate_functions::thumb32_cond_branch_lower,
9172 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9173 branch offset encoding.
9174 (Arm_relocate_functions::thumb_branch_common): Use new branch
9175 offset encoding methods to avoid code duplication.
9176 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9177 (Stub_addend_reader::operator()): Use new branch encoding method
9178 to avoid code duplication.
9180 2010-01-11 Doug Kwan <dougkwan@google.com>
9182 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9183 (Target_arm::do_finalize_sections): Define special EXIDX section
9184 symbols only if referenced.
9185 * gc.h (Garbage_collection::add_reference): New method.
9186 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9189 2010-01-11 Ian Lance Taylor <iant@google.com>
9191 * script.cc (Version_script_info::build_expression_list_lookup):
9192 Change complaing about duplicate wildcard match from error to
9195 * script.cc (class Lazy_demangler): Recreate--revert part of patch
9197 (Version_script_info::Version_script_info): Initialize globs_,
9198 default_version_, default_is_global_, and exact_. Don't
9199 initialize globals_ or locals_.
9200 (Version_script_info::build_lookup_tables): Build local symbols
9202 (Version_script_info::unquote): New function.
9203 (Version_script_info::add_exact_match): New function.
9204 (Version_script_info::build_expression_list_lookup): Remove lookup
9205 parameter. Add is_global parameter. Change all callers. Handle
9206 wildcard pattern specially. Unquote pattern. Call
9208 (Version_script_info::get_name_to_match): New function.
9209 (Version_script_info::get_symbol_version): New function.
9210 (Version_script_info::get_symbol_version_helper): Remove.
9211 (Version_script_info::check_unmatched_names): Call unquote.
9212 * script.h (class Version_script_info): Change get_symbol_version
9213 to be non-inline and add is_global parameter; change all callers.
9214 Rewrite symbol_is_local. Update declarations. Define struct
9215 Version_tree_match, Exact, Globs. Don't define struct Lookup.
9216 Remove globals_ and locals_ members. Add exact_, globs_,
9217 default_version_, is_global_.
9218 (Version_script_info::Glob): Remove pattern, add expression and
9219 is_global. Update constructor. Change all callers.
9220 * dynobj.cc (Versions::finalize): Mark the version symbol as the
9222 (Versions::symbol_section_contents): If a symbol is undefined, or
9223 defined in a dynamic object, set the version index to
9225 * symtab.cc (Symbol_table::add_from_relobj): Don't call
9227 (Symbol_table::add_from_pluginobj): Likewise.
9228 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9230 2010-01-11 Doug Kwan <dougkwan@google.com>
9232 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9233 (incremental_dump_LDADD): Add linking option for libintl.
9234 * Makefile.in: Regenerate.
9236 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
9239 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9241 * testsuite/Makefile.in: Regenerated.
9243 2010-01-10 Doug Kwan <dougkwan@google.com>
9245 * options.h (DEFINE_var): Use parentheses around argument varname__
9246 in macro body to avoid any unintended subsequent substitutions.
9248 2010-01-10 Ian Lance Taylor <iant@google.com>
9250 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9251 candidates before doing symbol resolution.
9253 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9254 ODR candidates if only one is weak.
9256 2010-01-08 Ian Lance Taylor <iant@google.com>
9258 * script.cc (Version_script_info::build_expression_list_lookup):
9259 Don't warn about ambiguous version, just record the ambiguity.
9260 (Version_script_info::get_symbol_version_helper): Give error if
9261 version is ambiguous.
9263 2010-01-08 Doug Kwan <dougkwan@google.com>
9265 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9266 prev_data_size_ and prev_addralign_. Remove initializer for
9267 deleted data member has_been_changed_.
9268 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9269 to determine if the table is empty.
9270 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9272 (Stub_table::add_reloc_stub): Define method in class definition
9273 instead of just declaring it there.
9274 (Stub_table::add_cortex_a8_stub): New method definition.
9275 (Stub_table::update_data_size_and_addralign): Ditto.
9276 (Stub_table::finalize_stubs): Ditto.
9277 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9278 (Stub_table::do_addralign_): Return address alignment in the
9279 (Stub_table::do_reset_address_and_file_offset): Define method in
9280 class definition instead of declaring it there. Set current data
9281 size to be the data size of the previous pass.
9282 (Stub_table::set_final_data_size): Use current data size as the
9284 (Stub_table::relocate_stub): Change parameter type of stub from
9285 Reloc_stub pointer to Stub pointer.
9286 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9287 (Stub_table::Cortex_a8_stub_list): New typedef.
9288 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9289 Stub_table::prev_addralign_): New data member.
9290 (Arm_relobj::Arm_relobj): Initialize data member
9291 section_has_cortex_a8_workaround_.
9292 (Arm_relobj::section_has_cortex_a8_workaround,
9293 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9295 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9297 (Target_arm::relocate_stub): Change parameter type of stub from
9298 Reloc_stub pointer to Stub pointer.
9299 (Insn_template::size, Insn_template::alignment): Handle
9300 THUMB16_SPECIAL_TYPE.
9301 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9302 Stub_table::update_data_size_and_addralign,
9303 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9305 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9306 (Stub_table::do_write): Ditto.
9307 (Target_arm::do_relax): Adjust code for changes in Stub_table.
9309 2010-01-08 Ian Lance Taylor <iant@google.com>
9312 * symtab.h (class Symbol): Remove fields is_target_special_ and
9313 has_plt_offset_. Add field is_defined_in_discarded_section_.
9314 (Symbol::is_defined_in_discarded_section): New function.
9315 (Symbol::set_is_defined_in_discarded_section): New function.
9316 (Symbol::has_plt_offset): Rewrite.
9317 (Symbol::set_plt_offset): Verify that new offset is not -1U.
9318 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9319 Don't initialize is_target_special_ or has_plt_offset_.
9320 Initialize is_defined_in_discarded_section_.
9321 (Symbol_table::add_from_relobj): If appropriate, set
9322 is_defined_in_discarded_section.
9323 * resolve.cc (Symbol::override_base_with_special): Don't test
9324 is_target_special_. Change has_plt_offset_ to has_plt_offset().
9325 * target-reloc.h (relocate_section): Do special handling for
9326 symbols defined in discarded sections for global symbols as well
9329 2010-01-08 Ian Lance Taylor <iant@google.com>
9331 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9332 the SHT_SYMTAB case.
9334 2010-01-08 Ian Lance Taylor <iant@google.com>
9336 * object.cc (Sized_relobj::do_layout): Don't get confused if
9337 layout_eh_frame returns NULL.
9339 2010-01-08 Ian Lance Taylor <iant@google.com>
9342 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9343 dynamic symbol table, use the normal symbol table.
9344 (Sized_dynobj::do_read_symbols): Remove assertion about type of
9347 2010-01-08 Ian Lance Taylor <iant@google.com>
9350 * layout.cc (Layout::include_section): Remove .gnu_debuglink
9353 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
9355 * version.cc (print_version): Change to "Copyright 2010".
9357 2010-01-08 Ian Lance Taylor <iant@google.com>
9361 * i386.cc (class Target_i386): Change return type of plt_section
9363 (class Output_data_plt_i386): Add tls_desc_rel_ field.
9364 (Output_data_plt_i386::Output_data_plt_i386): Initialize
9365 tls_desc_rel_ field.
9366 (Output_data_plt_i386::rel_tls_desc): New function.
9367 (Target_i386::rel_tls_desc_section): New function.
9368 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9369 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9370 R_386_TLS_DESC reloc in rel_tls_desc_section.
9371 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9372 Define struct Tlsdesc_info.
9373 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9374 (Target_x86_64::do_reloc_symbol_index): New function.
9375 (Target_x86_64::add_tlsdesc_info): New function.
9376 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9377 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9379 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
9381 (Output_data_plt_x86_64::rela_tlsdesc): New function.
9382 (Target_x86_64::rela_tlsdesc_section): New function.
9383 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9385 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9386 (Target_x86_64::do_reloc_addend): New function.
9387 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9388 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9389 declarations. Define TARGET_CODE. Add arg field to u1_ union.
9390 (Output_reloc::type): New function.
9391 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9392 (Output_reloc::is_target_specific): New function.
9393 (Output_reloc::target_arg): New function.
9394 (class Output_reloc) [SHT_RELA]: Add four new constructors for
9395 absolute relocs and target specific relocs.
9396 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9397 add_target_specific.
9398 (class Output_data_reloc) [SHT_RELA]: Likewise.
9399 * output.cc (Output_reloc::Output_reloc): Add four new versions
9400 for absolute relocs and target specific relocs.
9401 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9402 (Output_reloc::get_symbol_index): Likewise.
9403 (Output_reloc::local_section_offset): Check that local_sym_index_
9404 is not TARGET_CODE or 0.
9405 (Output_reloc::symbol_value): Likewise.
9406 (Output_reloc::write) [SHT_RELA]: Call target for target specific
9408 * target.h (class Target): Add reloc_symbol_index and reloc_addend
9409 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
9411 * layout.cc (add_target_dynamic_tags): Use output section for
9412 DT_PLTRELSZ and DT_JMPREL.
9414 2010-01-07 Ian Lance Taylor <iant@google.com>
9417 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9419 (class Output_data_reloc_generic): Define.
9420 (class Output_data_reloc_base): Change base class to
9421 Output_data_reloc_generic. Change add() method to call
9422 bump_relative_reloc_count for a relative reloc. Remove
9424 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9426 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9427 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
9429 * layout.h (class Layout): Update declaration.
9431 2010-01-07 Ian Lance Taylor <iant@google.com>
9433 * output.h (class Output_data): Add const version of
9434 output_section and do_output_section.
9435 (class Output_section_data): Add const version of
9437 (class Output_section): Likewise.
9438 * layout.cc (Layout::add_target_dynamic_tags): New function.
9439 * layout.h (class Layout): Update declarations.
9440 * arm.cc (Target_arm::do_finalize_sections): Use
9441 add_target_dynamic_tags.
9442 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9443 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9444 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9445 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9447 2010-01-07 Ian Lance Taylor <iant@google.com>
9450 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9453 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
9454 Ian Lance Taylor <iant@google.com>
9457 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9458 Xindex::read_symtab_xindex.
9460 2010-01-07 Doug Kwan <dougkwan@google.com>
9462 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9463 (Insn_template::thumb16_bcond_insn): New method declaration.
9464 (Insn_template): Fix spelling.
9465 (Stub::thumb16_special): New method declaration.
9466 (Stub::do_write): Define virtual method which was previously pure
9468 (Stub::do_thumb16_special): New method declaration.
9469 (Stub::do_fixed_endian_write): New template member.
9470 (Reloc_stub::do_write): Remove.
9471 (Reloc_stub::do_fixed_endian_write): Remove.
9472 (Cortex_a8_stub): New class definition.
9473 (Stub_factory::make_cortex_a8_stub): New method definition.
9474 (Stub_factory::Stub_factory): Add missing static storage class
9475 qualifier for elf32_arm_stub_a8_veneer_blx.
9477 2010-01-07 Ian Lance Taylor <iant@google.com>
9480 * options.h (class General_options): Add --warn-unresolved-symbols
9481 and --error-unresolved-symbols.
9482 * errors.cc (Errors::undefined_symbol): Implement
9483 --warn-unresolved-symbols.
9485 * options.h (class General_options): Add -z text and -z textoff.
9486 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9488 2010-01-06 Sriraman Tallam <tmsriram@google.com>
9490 * gc.h (Garbage_collection::Cident_section_map): New typedef.
9491 (Garbage_collection::cident_sections): New function.
9492 (Garbage_collection::add_cident_section): New function.
9493 (Garbage_collection::cident_sections_): New member.
9494 (gc_process_relocs): Add references to sections whose names are C
9496 * gold.h (cident_section_start_prefix): New constant.
9497 (cident_section_stop_prefix): New constant.
9498 (is_cident): New function.
9499 * layout.cc (Layout::define_section_symbols): Replace string constants
9500 with the newly defined constants.
9501 * object.cc (Sized_relobj::do_layout): Track sections whose names are
9503 * testsuite/Makefile.am: Add gc_orphan_section_test.
9504 * testsuite/Makefile.in: Regenerate.
9505 * testsuite/gc_orphan_section_test.cc: New file.
9506 * testsuite/gc_orphan_section_test.sh: New file.
9508 2010-01-06 Ian Lance Taylor <iant@google.com>
9511 * options.h (class General_options): Add --warn-shared-textrel.
9512 * layout.cc (Layout::finish_dynamic_section): Implement
9513 --warn-shared-textrel.
9516 * options.h (class General_options): Add --warn-multiple-gp.
9518 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9520 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9521 $(THREADSLIB) and $(LIBDL).
9522 * Makefile.in: Rebuild.
9524 2010-01-06 Ian Lance Taylor <iant@google.com>
9527 * options.cc (General_options::parse_section_start): New function.
9528 (General_options::section_start): New function.
9529 (General_options::General_options): Initialize all members.
9530 * options.h: Include <map>
9531 (class General_options): Add --section-start. Add section_starts_
9533 * layout.cc (Layout::attach_allocated_section_to_segment): If
9534 --section-start was used, set the address of the segment. Remove
9535 local sort_sections.
9536 (Layout::relaxation_loop_body): If the address of the load segment
9537 has been set by --section-start, don't use it.
9538 * output.h (Output_segment::update_flags_for_output_section): New
9540 * output.cc (Output_segment::add_output_section): Call
9541 update_flags_for_output_section.
9543 2010-01-05 Ian Lance Taylor <iant@google.com>
9546 * options.h (class General_options): Add --undefined-version.
9547 * script.cc (struct Version_expression): Add was_matched_by_symbol
9549 (Version_script_info::matched_symbol): New function.
9550 (Version_script_info::get_symbol_version_helper): Call
9552 (Version_script_info::check_unmatched_names): New function.
9553 * script.h (class Version_script_info): Update declarations.
9554 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9556 * options.h (class General_options): Use DEFINE_bool_alias for
9557 allow_multiple_definition.
9558 * resolve.cc (Symbol_table::should_override): Don't test
9559 allow_multiple_definition.
9562 * options.h (class General_options): Add --cref.
9563 * main.cc (main): Print cref table if --cref. Don't close mapfile
9564 until after printing cref table.
9565 * cref.cc: Include "symtab.h".
9566 (class Cref_inputs): Define Cref_table_compare and Cref_table.
9567 (Cref_table_compare::operator()): New function.
9568 (Cref_inputs::gather_cref): New function.
9569 (filecol): New static const.
9570 (Cref_inputs::print_cref): New function.
9571 (Cref::print_cref): New function.
9572 * cref.h: Include <cstdio>.
9573 (class Cref): Update declarations.
9574 * mapfile.h (Mapfile::file): New function.
9575 * object.h (class Object): Define Symbols. Declare virtual
9576 do_get_global_symbols.
9577 (Object::get_global_symbols): New function.
9578 * object.cc (Input_objects::add_object): Pass object to cref_ if
9580 (Input_objects::archive_start): Likewise.
9581 (Input_objects::archive_stop): Likewise.
9582 (Input_objects::print_cref): New function.
9583 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9584 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9586 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9588 * plugin.h (class Sized_pluginobj): Update declarations.
9590 2010-01-05 Ian Lance Taylor <iant@google.com>
9592 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9593 to is_default_version. Rename insdef to insdefault.
9594 (Symbol_table::add_from_relobj): Rename def to is_default_version
9595 and local to is_forced_local.
9596 (Symbol_table::add_from_pluginobj): Likewise.
9597 (Symbol_table::add_from_dynobj): Likewise.
9598 (Symbol_table::define_special_symbol): Rename insdef to
9601 2010-01-04 Ian Lance Taylor <iant@google.com>
9604 * options.h (class General_options): Add
9605 --allow-multiple-definition and -z muldefs.
9606 * resolve.cc (Symbol_table::should_override): Don't warn about a
9607 multiple symbol definition if --allow-multiple-definition or -z
9611 * options.h (class General_options): Add --add-needed and
9612 --copy-dt-needed-entries. Tweak --as-needed help entry.
9613 * object.cc (Input_objects::check_dynamic_dependencies): Give an
9614 error if --copy-dt-needed-entries aka --add-needed is used and
9615 would cause a change in behaviour.
9618 * options.h (class General_options): Add -G as a short version of
9619 --shared. Add no-op options -assert, -g, and -i.
9621 2010-01-04 Sriraman Tallam <tmsriram@google.com>
9623 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9624 check for .text or .gnu.linkonce.t sections.
9625 * icf.cc (Icf::find_identical_sections): Ditto.
9626 Change the detection for mangled function name within the section
9628 * icf.h (is_section_foldable_candidate): New function.
9630 2009-12-30 Ian Lance Taylor <iant@google.com>
9633 * options.h (class General_options): Permit two dashes with
9634 --retain-symbols-file.
9636 2009-12-30 Ian Lance Taylor <iant@google.com>
9639 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9640 don't put the file header and segment headers in the text
9644 * common.cc (Sort_commons::operator()): Stabilize sort when both
9646 (Symbol_table::do_allocate_commons_list): When allocating common
9647 symbols, skip a symbol which is no longer common.
9648 * symtab.h (Symbol::is_common): Test whether the symbol comes from
9649 an object before checking its type.
9650 * testsuite/common_test_2.c: New file.
9651 * testsuite/common_test_3.c: New file.
9652 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9653 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9654 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9655 (common_test_2_pic.o, common_test_2.so): New targets.
9656 (common_test_3_pic.o, common_test_3.so): New targets.
9657 * testsuite/Makefile.in: Rebuild.
9660 * script.cc (read_input_script): If we see a new SECTIONS clause,
9661 and we have added an input section, give an error.
9662 * layout.h (class Layout): Add have_added_input_section function.
9663 Add have_added_input_section_ field.
9664 * layout.cc (Layout::Layout): Initialize
9665 have_added_input_section_.
9666 (Layout::layout): Set have_added_input_section_.
9667 (Layout::layout_eh_frame): Likewise.
9669 2009-12-30 Ian Lance Taylor <iant@google.com>
9672 * options.h (class General_options): Add --sort-common option.
9673 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9674 * common.cc (Sort_common): Add sort_order parameter to
9675 constructor. Add sort_order_ field.
9676 (Sort_commons::operator): Check sort_order_.
9677 (Symbol_table::allocate_commons): Determine the sort order.
9678 (Symbol_table::do_allocate_commons): Add sort_order parameter.
9680 (Symbol_table::do_allocate_commons_list): Likewise.
9682 2009-12-30 Ian Lance Taylor <iant@google.com>
9685 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9686 symbols from this object, don't change the visibility of an
9688 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9690 2009-12-30 Ian Lance Taylor <iant@google.com>
9693 * script.h (class Version_script_info): Define Language enum.
9694 Update declarations. Define Glob, Exact, and Lookup types. Add
9695 new fields globals_, locals_, and is_finalized_.
9696 * script.cc: Various formatting fixes.
9697 (class Parser_closure): Change language_stack_ from a vector of
9698 std::string to one of Version_script_info::Language. Adjust all
9700 (class Lazy_demangler): Remove.
9701 (struct Version_expression): Change language from std::string to
9702 Version_script_info::Language.
9703 (Version_script_info::Version_script_info): New function.
9704 (Version_script_info::~Version_script_info): Don't call clear.
9705 (Version_script_info::finalize): New function.
9706 (Version_script_info::build_lookup_tables): New function.
9707 (Version_script_info::build_expression_list_lookup): New
9709 (Version_script_info::get_symbol_version_helper): Rewrite to use
9711 (Version_script_info::print_expression_list): Adjust to use
9712 Version_script_info::Language.
9713 (script_push_lex_into_version_mode): Check that the version script
9714 has not been finalized.
9715 (version_script_push_lang): Change language string to
9716 Version_script_info::Language.
9717 * options.cc (Command_line::version_script): New function.
9718 * options.h (class General_options): Add finalize_dynamic_list
9719 function. Change version_script from declaration to definition.
9720 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9721 * testsuite/version_script.map: Remove duplicate def of foo.
9722 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9724 * testsuite/Makefile.in: Rebuild.
9726 2009-12-30 Ian Lance Taylor <iant@google.com>
9729 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9730 if the input symbol index is 0, make the output symbol index 0.
9732 2009-12-30 Ian Lance Taylor <iant@google.com>
9735 * options.h (class General_options): Add -x/--discard-all.
9736 * object.cc (Sized_relobj::do_count_local_symbols): Handle
9737 --discard-all. If the local symbol needs a dynamic entry, check
9738 that before handling --discard-locals.
9740 2009-12-30 Ian Lance Taylor <iant@google.com>
9743 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9745 (Output_segment::add_output_section): Don't change the flags if
9749 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9750 GNU hash table if they need a dynamic value. Otherwise, don't add
9751 them if they are defined in a dynamic object or are forced local.
9753 2009-12-29 Ian Lance Taylor <iant@google.com>
9756 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9757 .gnu.hash table for a 32-bit target.
9760 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9761 regular and a dynamic object only needs a dynamic symbol table
9762 entry if it is externally visible.
9765 * i386.cc (class Target_i386): Initialize global_offset_table_ in
9766 constructor. Add global_offset_table_ field.
9767 (Target_i386::got_section): Set global_offset_table_.
9768 (Target_i386::do_finalize_sections): Set global_offset_table_
9770 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9771 in constructor. Add global_offset_table_ field.
9772 (Target_x86_64::got_section): Set global_offset_table_.
9773 (Target_x86_64::do_finalize_sections): Set global_offset_table_
9776 * layout.cc (Layout::Layout): Initialize increase_relro_.
9777 (Layout::get_output_section): Add is_relro, is_last_relro, and
9778 is_first_non_relro parameters. Change all callers.
9779 (Layout::choose_output_section): Likewise.
9780 (Layout::add_output_section_data): Likewise.
9781 (Layout::make_output_section): Likewise.
9782 (Layout::set_segment_offsets): Clear increase_relro when using a
9784 * layout.h (class Layout): Add increase_relro method. Add
9785 increase_relro_ field. Update declarations.
9786 * output.cc (Output_section::Output_section): Initialize
9787 is_last_relro_ and is_first_non_relro_.
9788 (Output_segment::add_output_section): Group relro sections is
9789 do_sort is true. Handle is_last_relro and is_first_non_relro.
9790 (Output_segment::maximum_alignment): Remove relro handling.
9791 (Output_segment::set_section_addresses): Add increase_relro
9792 parameter. Change all callers. Add initial alignment to align
9793 relro sections on separate page. Remove old relro handling.
9794 (Output_segment::set_section_list_addresses): Remove in_relro
9795 parameter. Change all callers.
9796 (Output_segment::set_offset): Add increase parameter. Change all
9797 callers. Remove old relro handling.
9798 * output.h (class Output_section): Add new methods: is_last_relro,
9799 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9800 Add is_last_relro_ and is_first_non_relro_ fields.
9801 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9802 Create separate .got.plt section. Call increase_relro.
9803 * x86_64.cc (Target_x86_64::got_section): Likewise.
9804 * testsuite/relro_script_test.t: Add .got.plt.
9807 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9808 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9809 (Layout::finalize): Call set_dynamic_symbol_size.
9810 (Layout::set_dynamic_symbol_size): New function.
9811 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
9812 set_dynamic_symbol_size.
9815 * output.h (class Output_section): Add is_entsize_zero_ field.
9816 * output.cc (Output_section::Output_section): Initialize
9818 (Output_section::set_entsize): If two different entsizes are
9819 requested, force it to zero.
9820 (Output_section::add_input_section): Set flags for .debug_str
9821 before updating section flags. Set entsize.
9822 (Output_section::update_flags_for_input_section): Set SHF_MERGE
9823 and SHF_STRING if all input sections have those flags.
9825 2009-12-29 Rafael Espindola <espindola@google.com>
9827 * main.cc (main): Fix the sys time reporting.
9828 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9831 2009-12-29 Sriraman Tallam <tmsriram@google.com>
9833 * options.cc (General_options::parse_version): Allow -v to exit
9834 without an error if there is nothing to link.
9836 2009-12-29 Ian Lance Taylor <iant@google.com>
9838 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9839 using a version of gcc before 4.1.
9840 * configure: Rebuild.
9842 2009-12-28 Chris Demetriou <cgd@google.com>
9844 * attributes.cc (Output_attributes_section_data::do_write): Use
9845 std::vector::front rather than std::vector::data.
9847 2009-12-28 Ian Lance Taylor <iant@google.com>
9849 * symtab.h (class Symbol_table): Add enum Defined.
9850 * resolve.cc (Symbol_table::should_override): Add defined
9851 parameter. Change all callers. Test whether object is NULL
9852 before calling a method on it.
9853 (Symbol_table::report_resolve_problem): Add defined parameter.
9855 (Symbol_table::should_override_with_special): Likewise.
9856 * symtab.cc (Symbol_table::define_in_output_data): Add defined
9857 parameter. Change all callers.
9858 (Symbol_table::do_define_in_output_data): Likewise.
9859 (Symbol_table::define_in_output_segment): Likewise.
9860 (Symbol_table::do_define_in_output_segment): Likewise.
9861 (Symbol_table::define_as_constant): Likewise.
9862 (Symbol_table::do_define_as_constant): Likewise.
9863 * script.h (class Symbol_assignment): Add is_defsym parameter to
9864 constructor; change all callers.
9865 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9866 parameter. Change all callers. Add is_defsym_ field.
9867 (class Parser_closure): Add parsing_defsym parameter to
9868 constructor; change all callers. Add parsing_defsym accessor
9869 function. Add parsing_defsym_ field.
9871 2009-12-28 Ian Lance Taylor <iant@google.com>
9873 * gold.cc (queue_middle_tasks): Fix formatting.
9874 * object.cc (Relobj::is_section_name_included): Likewise.
9876 2009-12-23 Ian Lance Taylor <iant@google.com>
9878 * i386.cc (Target_i386::do_calls_non_split): Recognize
9879 -fsplit-stack prologue for a function with a static chain.
9880 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9881 -fsplit-stack prologue when using %r11.
9883 2009-12-21 Sriraman Tallam <tmsriram@google.com>
9885 * options.cc (General_options::parse_version): Make -v continue and do
9886 the link like GNU ld does.
9888 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
9890 * Makefile.am (CCFILES): Add timer.cc.
9891 (HFILES): Add timer.h.
9892 * configure.ac: Check for sysconf and times.
9893 * main.cc: include timer.h.
9894 (main): Use Timer instead of get_run_time.
9897 * workqueue.cc: include timer.h.
9898 (Workqueue::find_and_run_task):
9899 Report user, sys and wall time.
9900 * Makefile.in: Regenerate.
9901 * config.in: Regenerate.
9902 * configure: Regenerate.
9904 2009-12-16 Doug Kwan <dougkwan@google.com>
9906 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9908 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9909 relaxed input sections.
9910 * output.cc (Output_section::find_relaxed_input_section): Change
9911 return type to Output_relaxed_input_section pointer. Adjust code
9912 for new type of relaxed_input_section_map_.
9913 * output.h (Output_section::find_relaxed_input_section): Change
9914 return type to Output_relaxed_input_section pointer.
9915 (Output_section::Output_relaxed_input_section_by_input_section_map):
9917 (Output_section::relaxed_input_section_map_): Change type to
9918 Output_section::Output_relaxed_input_section_by_input_section_map.
9919 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9922 2009-12-15 Ian Lance Taylor <iant@google.com>
9924 * layout.cc (Layout::create_shstrtab): Only write out after input
9925 sections if we are compressing debug sections.
9927 2009-12-15 Ian Lance Taylor <iant@google.com>
9929 * archive.cc (Archive::add_symbols): Only look up a symbol without
9930 a version if there is, in fact, a version.
9932 2009-12-14 Ian Lance Taylor <iant@google.com>
9934 Revert -Wshadow changes, all changes from:
9935 2009-12-11 Doug Kwan <dougkwan@google.com>
9936 2009-12-11 Nick Clifton <nickc@redhat.com>
9937 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9939 2009-12-11 Doug Kwan <dougkwan@google.com>
9941 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9943 * attributes.cc (Object_attribute::size): Ditto.
9944 (Attributes_section_data::size): Ditto.
9945 (Attributes_section_data::Attributes_section_data): Ditto.
9946 (Output_attributes_section_data::do_write): Ditto.
9947 * attributes.h (Object_attribute::set_type): Ditto.
9948 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9950 2009-12-11 Nick Clifton <nickc@redhat.com>
9952 * archive.cc: Fix shadowed variable warnings.
9954 * compressed_output.cc: Likewise.
9955 * compressed_output.h: Likewise.
9956 * configure: Likewise.
9957 * dwarf_reader.cc: Likewise.
9958 * dynobj.cc: Likewise.
9959 * dynobj.h: Likewise.
9960 * ehframe.cc: Likewise.
9961 * ehframe.h: Likewise.
9962 * errors.cc: Likewise.
9963 * expression.cc: Likewise.
9964 * fileread.cc: Likewise.
9965 * fileread.h: Likewise.
9966 * freebsd.h: Likewise.
9967 * i386.cc: Likewise.
9969 * incremental.h: Likewise.
9970 * layout.cc: Likewise.
9971 * layout.h: Likewise.
9972 * mapfile.cc: Likewise.
9973 * merge.cc: Likewise.
9974 * merge.h: Likewise.
9975 * object.cc: Likewise.
9976 * object.h: Likewise.
9977 * options.h: Likewise.
9978 * output.cc: Likewise.
9979 * output.h: Likewise.
9980 * parameters.cc: Likewise.
9981 * plugin.cc: Likewise.
9982 * powerpc.cc: Likewise.
9983 * reduced_debug_output.cc: Likewise.
9984 * reduced_debug_output.h: Likewise.
9985 * reloc.cc: Likewise.
9986 * reloc.h: Likewise.
9987 * resolve.cc: Likewise.
9988 * script-sections.cc: Likewise.
9989 * script.cc: Likewise.
9990 * script.h: Likewise.
9991 * sparc.cc: Likewise.
9992 * symtab.cc: Likewise.
9993 * symtab.h: Likewise.
9994 * target-select.cc: Likewise.
9995 * target-select.h: Likewise.
9996 * token.h: Likewise.
9997 * workqueue.cc: Likewise.
9998 * workqueue.h: Likewise.
9999 * x86_64.cc: Likewise.
10001 2009-12-10 Doug Kwan <dougkwan@google.com>
10003 * arm.cc (attributes.h): New include.
10004 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10005 (Arm_relobj::~Arm_relobj): Delete object pointed by
10006 attributes_section_data_.
10007 (Arm_relobj::attributes_section_data): New method definition.
10008 (Arm_relobj::attributes_section_data_): New data member declaration.
10009 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10010 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10011 attributes_section_data_.
10012 (Arm_dynobj::attributes_section_data): New method definition.
10013 (Arm_dynobj::attributes_section_data_): New data member declaration.
10014 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
10015 initialization value of may_use_blx_ to false.
10016 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10017 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10018 object attributes to compute results instead of hard-coding.
10019 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10020 Target_arm::get_secondary_compatible_arch,
10021 Target_arm::set_secondary_compatible_arch
10022 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10023 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10024 New method declarations.
10025 (Target_arm::get_aeabi_object_attribute): New method definition.
10026 (Target_arm::attributes_section_data_): New data member declaration.
10027 (read_arm_attributes_section): New template definition.
10028 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10029 (Arm_dynobj::do_read_symbols): Ditto.
10030 (Target_arm::do_finalize_sections): Merge attributes sections from
10031 input. Check for BLX use after attributes section merging.
10032 Fix __exidx_start and __exidx_end visibility. Create an
10033 .ARM.attributes section if necessary.
10034 (Target_arm::get_secondary_compatible_arch,
10035 Target_arm::set_secondary_compatible_arch,
10036 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10037 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10038 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10039 New method definitions.
10041 2009-12-09 Ian Lance Taylor <iant@google.com>
10043 * plugin.cc (Plugin::load): Don't cast from void* to a function
10046 2009-12-09 Ian Lance Taylor <iant@google.com>
10048 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10049 information fields.
10051 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
10053 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10054 Replace two_file_shared_1.so with two_file_shared_2.so.
10055 * testsuite/Makefile.in: Regenerated.
10057 2009-12-08 Doug Kwan <dougkwan@google.com>
10059 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10060 (HFILES): Add attributes.h and int_encoding.h.
10061 * Makefile.in: Regenerate.
10062 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10063 function definitions to int_encoding.cc
10064 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10065 prototypes to int_encoding.h
10066 * reduced_debug_output.cc (int_encoding.h): New include.
10067 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10068 function definitions to int_encoding.cc
10069 (insert_into_vector, read_from_pointer): Move template definitions to
10071 * attributes.cc: New file.
10072 * attributes.h: New file.
10073 * int_encoding.cc: New file.
10074 * int_encoding.h: New file.
10076 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
10079 * incremental-dump.cc (dump_incremental_inputs): New.
10080 (main): Use dump_incremental_inputs.
10082 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
10085 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10086 checking elfcpp::STT_FUNC.
10087 (Target_i386::Relocate::relocate): Likewise.
10088 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10090 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10091 symbols from shared libraries into normal FUNC symbols.
10093 * symtab.h (Symbol): Add is_func and use it.
10095 2009-12-05 Doug Kwan <dougkwan@google.com>
10097 * arm.cc (Target_arm::arm_info): Initialize new fields
10098 attributes_section and attributes_vendor.
10099 * i386.cc (Target_i386::i386_info): Same.
10100 * object.cc (Sized_relobj::do_layout): Skip attribute section.
10101 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10102 fields attributes_section and attributes_vendor.
10103 * sparc.cc (Target_sparc::sparc_info): Same.
10104 * target.h (Target::attributes_section, Target::attributes_vendor,
10105 Target::is_attributes_section, Target::attribute_arg_type,
10106 Target::attributes_order): New method definitions.
10107 (Target::Target_info::attributes_section,
10108 Target::Target_info::attributes_vendor): New fields.
10109 (Target::do_attribute_arg_type, Target::do_attributes_order): New
10110 virtual method definitions.
10111 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10112 attributes_section and attributes_vendor.
10113 * testsuite/testfile.cc (Target_test::test_target_info): Same.
10115 2009-12-05 Doug Kwan <dougkwan@google.com>
10117 * arm.cc: Update comments about interworking and stub generation.
10118 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10119 considered as non-PIC.
10120 (Arm_relocate_functions::base_abs): Fix formatting.
10121 (Arm_relocate_functions::got_prel): Fix comment. Change interface
10122 of function to use GOT entry address instead of offset.
10123 (Target_arm::Scan::global): Issue an error if a symbol would need a
10124 PLT does not get one because it is untyped. Remove code to create
10125 dynamic symbols for relative branches.
10126 (Target_arm::Relocate::relocate: Use 0 instead of false since function
10127 takes unsigned integer instead of boolean.
10129 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
10131 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10132 (two_file_test_LDADD): Likewise.
10133 (common_test_1_LDADD): Likewise.
10134 (exception_test_LDADD) Likewise.
10135 (weak_test_LDADD): Likewise.
10136 (many_sections_test_LDADD): Likewise.
10137 (initpri1_LDADD): Likewise.
10138 (script_test_1_LDADD): Likewise.
10139 (script_test_2_LDADD): Likewise.
10140 (justsyms_LDADD): Likewise.
10141 (binary_test_LDADD): Likewise.
10142 (large_LDADD): Likewise.
10143 * testsuite/Makefile.in: Regenerated.
10145 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
10147 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10148 (Symbol_table::override_with_special): Likewise.
10149 (Symbol_table::add_from_object): Likewise.
10151 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
10153 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10154 Don't set the data_offset twice.
10156 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
10158 * testsuite/Makefile.in: Regenerate.
10160 2009-12-03 Doug Kwan <dougkwan@google.com>
10162 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10163 (Target_arm::do_finalize_sections): Add parameter for symbol table
10164 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
10165 * i386.cc (Target_i386::do_finalize_sections): Add an additional
10166 parameter for symbol table pointer.
10167 * layout.cc (Layout::finalize): Call Target::finalize_sections with
10168 an additional parameter for a pointer to symbol table.
10169 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10170 parameter for a symbol table pointer.
10171 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10172 * target.h (Target::finalize_sections, Target::do_finalize_sections):
10174 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10175 parameter for a symbol table pointer.
10177 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
10179 * incremental.cc (Incremental_inputs_header)
10180 (Incremental_inputs_header_write, Incremental_inputs_entry)
10181 (Incremental_inputs_entry_write): Move ...
10182 * incremental.h (Incremental_inputs_header)
10183 (Incremental_inputs_header_write, Incremental_inputs_entry)
10184 (Incremental_inputs_entry_write): here.
10186 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10188 * incremental.cc (make_sized_incremental_binary): Set the target.
10189 Error if it is incompatible.
10190 * output.h (Output_file): Add filename method.
10192 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10194 * incremental.cc (Incremental_inputs_entry): Remove unused argument
10195 from the get_* methods.
10197 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10199 * incremental-dump.cc (main): Check that the offeset of a script is 0.
10200 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10201 Write 0 for the data_offset of scripts.
10203 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10205 * testsuite/Makefile.am: Add the incremental_test.sh test.
10206 * testsuite/incremental_test.sh: New.
10207 * testsuite/incremental_test_1.c: New.
10208 * testsuite/incremental_test_2.c: New.
10210 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
10212 * incremental-dump.cc (main): Fix typos.
10214 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
10217 * incremental-dump.cc (main): Use llu to print 64 bit values.
10219 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
10220 H.J. Lu <hongjiu.lu@intel.com>
10222 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10224 (incremental_dump_LDADD): Likewise.
10225 * Makefile.in: Regenerated.
10227 2009-11-25 Doug Kwan <dougkwan@google.com>
10231 2009-11-25 Doug Kwan <dougkwan@google.com>
10233 * arm.cc (Target_arm::Target_arm): Move method definition
10234 outside of class definition. Add code to handle
10235 --target1-rel, --target1-abs and --target2= options.
10236 (Target_arm::get_reloc_reloc_type): Change method to be
10237 non-static and const.
10238 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10239 New data member declaration.
10240 (Target_arm::Scan::local, Target_arm::Scan::global,
10241 Target_arm::Relocate::relocate,
10242 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10243 Adjust call to Target_arm::get_real_reloc_type.
10244 (Target_arm::get_real_reloc_type): Use command line options
10245 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10246 * options.h (--target1-rel, --target1-abs, --target2): New
10249 2009-11-25 Doug Kwan <dougkwan@google.com>
10251 * arm.cc (Target_arm::Target_arm): Move method definition outside of
10252 class definition. Add code to handle --target1-rel, --target1-abs
10253 and --target2= options.
10254 (Target_arm::get_reloc_reloc_type): Change method to be non-static
10256 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10257 member declaration.
10258 (Target_arm::Scan::local, Target_arm::Scan::global,
10259 Target_arm::Relocate::relocate,
10260 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10261 call to Target_arm::get_real_reloc_type.
10262 (Target_arm::get_real_reloc_type): Use command line options to
10263 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10264 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10267 2009-11-25 Doug Kwan <dougkwan@google.com>
10269 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10270 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10271 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10273 (Arm_relocate_functions::thm_call): Replace body with a call to
10274 Arm_relocate_functions::thumb_branch_common.
10275 (Arm_relocate_functions::thm_jump24,
10276 Arm_relocate_functions::thm_xpc22): New method definitions.
10277 (Arm_relocate_functions::thumb_branch_common): New method definition.
10278 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10280 (Target_arm::Relocate::relocate): Adjust call to thm_call.
10281 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10283 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10285 * Makefile.am: Build incremental-dump
10286 * Makefile.in: Regenerate.
10287 * incremental-dump.cc: New.
10288 * incremental.cc (Incremental_inputs_header_data,
10289 Incremental_inputs_entry_data): Move to incremental.h
10290 * incremental.h: (Incremental_inputs_header_data,
10291 Incremental_inputs_entry_data): Move from incremental.cc
10293 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10295 * incremental.cc (Incremental_inputs_header,
10296 Incremental_inputs_header_write, Incremental_inputs_entry,
10297 Incremental_inputs_entry_write): Add a typedef with the data type.
10299 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10301 * incremental.cc (Incremental_inputs_header,
10302 Incremental_inputs_header_write, Incremental_inputs_entry,
10303 Incremental_inputs_entry_write): Update comment about which
10304 type has the filed descriptions.
10306 2009-11-15 Doug Kwan <dougkwan@google.com>
10308 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10309 (Arm_relocate_functions::arm_branch_common): Change method defintion
10310 in class definition to a method declaration and update list of formal
10312 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10313 Arm_relocation_functions::jump24): Adjust call to
10314 Arm_relocate_functions::arm_branch_common. Update list of formal
10316 (Arm_relocate_functions::xpc25): New method definition.
10317 (Arm_relocate_functions::arm_branch_common): Move method defintion
10318 out from class definition. Use stubs for mode-switching and extending
10320 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10321 specially. Change code to enable use of stubs in ARM branches.
10323 2009-11-10 Doug Kwan <dougkwan@google.com>
10325 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10326 in method declaration.
10327 (Target_arm::relocate_stub): New method declaration.
10328 (Target_arm::default_target): Change to return a pointer instead of
10330 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10331 Target_arm::default_target.
10332 (Arm_Relobj::do_relocate_sections): Remove options paramater in
10334 (Target_arm::relocate_section): Adjust view.
10335 (Target_arm::relocate_stub): New method definition.
10337 2009-11-10 Doug Kwan <dougkwan@google.com>
10339 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10341 * incremental.cc (open_incremental_binary): Initialized local
10342 variables to avoid warnings.
10343 * object.cc (make_elf_object): Ditto.
10344 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10347 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
10350 * testsuite/plugin_test.c: Include "config.h".
10352 2009-11-09 Doug Kwan <dougkwan@google.com>
10354 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10355 (arm_symbol_value): Remove.
10356 (Arm_relocate_functions::arm_branch_common,
10357 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10358 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10359 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10360 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10361 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10362 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10363 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10364 Arm_relocate_functions::thm_mobw_abs_nc,
10365 Arm_relocate_functions::thm_mov_abs,
10366 Arm_relocate_functions::movw_prel_nc,
10367 Arm_relocate_functions::thm_movt_abs,
10368 Arm_relocate_functions::movt_prel,
10369 Arm_relocate_functions::thm_movw_prel_nc,
10370 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10371 (Target_arm::Relocate::relocate): Only decompose address into two
10372 parts if relocation type uses the thumb-bit and pass the actual
10373 bit instead of a flag indicating that the thumb-bit is used. Adjust
10374 calls to methods in Arm_relocate_functions for this change.
10376 2009-11-08 Ian Lance Taylor <iant@google.com>
10379 * reloc.cc: Instantiate
10380 Sized_relobj::initialize_input_to_output_maps and
10381 Sized_relobj:free_input_to_output_maps.
10383 2009-11-06 Ian Lance Taylor <iant@google.com>
10386 * defstd.cc (in_segment): Set only_if_ref true for "end".
10388 2009-11-06 Doug Kwan <dougkwan@google.com>
10390 * arm.cc (class Reloc_stub): Correct a comment.
10391 (Target_arm::Target_arm): Initialize arm_input_section_map_.
10392 (Target_arm::scan_section_for_stubs): New method declaration.
10393 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10394 Change methods from private to protected.
10395 (Target_arm::do_may_relax): New method definition.
10396 (Target_arm::do_relax, Target_arm::group_sections,
10397 Target_arm::scan_reloc_for_stub,
10398 Target_arm::scan_reloc_section_for_stubs): New method declarations.
10399 (Target_arm::arm_input_section_map_): New data member declaration.
10400 (Target_arm::scan_reloc_for_stub,
10401 Target_arm::scan_reloc_section_for_stubs,
10402 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10403 Target_arm::do_relax): New method definitions.
10405 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
10407 * configure.ac: Check for (struct stat)::st_mtim
10408 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10409 * config.in: Regenerate.
10410 * configure: Regenerate.
10412 2009-11-05 Ian Lance Taylor <iant@google.com>
10415 * output.cc (Output_segment::add_output_section): Add missing
10418 2009-11-04 Ian Lance Taylor <iant@google.com>
10421 * object.h (class Object): Add is_needed and set_is_needed
10422 methods. Add is_needed_ field. Make bool fields into bitfields.
10423 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10424 defined in a dynamic object and referenced by a regular object,
10425 set is_needed for the dynamic object.
10426 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10427 if the file is marked with as_needed and it is not needed.
10429 2009-11-04 Ian Lance Taylor <iant@google.com>
10432 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10433 tags if data is discarded by linker script.
10434 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10435 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10436 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10437 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10439 2009-11-04 Ian Lance Taylor <iant@google.com>
10441 * layout.cc (Layout::get_output_section): Add is_interp and
10442 is_dynamic_linker_section parameters. Change all callers.
10443 (Layout::choose_output_section): Likewise.
10444 (Layout::make_output_section): Likewise.
10445 (Layout::add_output_section_data): Add is_dynamic_linker_section
10446 parameter. Change all callers.
10447 * layout.h (class Layout): Update declarations.
10448 * output.h (class Output_section): Add is_interp, set_is_interp,
10449 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10450 Add is_interp_, is_dynamic_linker_section_ fields. Change
10451 generate_code_fills_at_write_ to a bitfield.
10452 * output.cc (Output_section::Output_sections): Initialize new
10454 (Output_segment::add_output_section): Add do_sort parameter.
10455 Change all callers.
10457 2009-11-03 Ian Lance Taylor <iant@google.com>
10460 * options.h (class General_options): Add --warn-common.
10461 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10462 merging two common symbols.
10463 (Symbol_table::should_override): Handle --warn-common when merging
10464 a common symbol with a defined symbol. Use report_resolve_problem
10465 for multiple definitions.
10466 (Symbol_table::report_resolve_problem): New function.
10467 * symtab.h (class Symbol_table): Declare report_resolve_problem.
10469 2009-11-03 Doug Kwan <dougkwan@google.com>
10471 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10473 (Target_arm::stub_factory): New method definition.
10474 (Target_arm::new_arm_input_section,
10475 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10476 Target_arm::reloc_uses_thumb_bit): New method declarations.
10477 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10478 New type definitions.
10479 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10480 member declarations.
10481 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10482 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10483 New method definitions.
10485 2009-11-03 Ian Lance Taylor <iant@google.com>
10487 * options.h (class General_options): Add --warn_constructors.
10489 2009-11-03 Ian Lance Taylor <iant@google.com>
10492 * defstd.cc (in_section): Add entries for __rel_iplt_start,
10493 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10495 2009-11-03 Ian Lance Taylor <iant@google.com>
10498 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10499 --msgid-bugs-address.
10500 (install-pdf): New target.
10501 (install-data_yes): Look up one directory to find mkinstalldirs.
10503 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
10505 * po/Make-in (.po.gmo): Don't generate .gmo files in source
10508 2009-10-30 Doug Kwan <dougkwan@google.com>
10510 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10512 2009-10-30 Doug Kwan <dougkwan@google.com>
10514 * arm.cc (Stub_addend_reader): New struct template definition
10515 and partial specializations.
10516 (Stub_addend_reader::operator()): New method definition for a
10517 partially specialized template.
10519 2009-10-30 Doug Kwan <dougkwan@google.com>
10521 * arm.cc (Arm_relobj::processor_specific_flags): New method
10523 (Arm_relobj::do_read_symbols): New method declaration.
10524 (Arm_relobj::processor_specific_flags_): New data member declaration.
10525 (Arm_dynobj): New class definition.
10526 (Target_arm::do_finalize_sections): Add input_objects parameter.
10527 (Target_arm::do_adjust_elf_header): New method declaration.
10528 (Target_arm::are_eabi_versions_compatible,
10529 (Target_arm::merge_processor_specific_flags): New method declaration.
10530 (Target_arm::do_make_elf_object): New overloaded method definitions
10532 (Arm_relobj::do_read_symbols): New method definition.
10533 (Arm_dynobj::do_read_symbols): Ditto.
10534 (Target_arm::do_finalize_sections): Add input_objects parameters.
10535 Merge processor-specific flags from all input objects.
10536 (Target_arm::are_eabi_versions_compatible,
10537 Target_arm::merge_processor_specific_flags,
10538 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10539 New method definitions.
10540 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10541 Input_objects pointer type parameter.
10542 * layout.cc (Layout::finalize): Pass input objects to target's.
10543 finalize_sections function.
10544 * output.cc (Output_file_header::do_sized_write): Set ELF file
10545 header's processor-specific flags.
10546 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10547 Input_objects pointer type parameter.
10548 * sparc.cc (Target_sparc::do_finalize_sections): Same.
10549 * target.h (Input_objects): New forward class declaration.
10550 (Target::processor_specific_flags,
10551 Target::are_processor_specific_flags_sect): New method definitions.
10552 (Target::finalize_sections): Add input_objects parameter.
10553 (Target::Target): Initialize processor_specific_flags_ and
10554 are_processor_specific_flags_set_.
10555 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10557 (Target::set_processor_specific_flags): New method definition.
10558 (Target::processor_specific_flags_,
10559 Target::are_processor_specific_flags_set_): New data member
10561 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10562 Input_objects pointer type parameter.
10564 2009-10-30 Doug Kwan <dougkwan@google.com>
10566 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10568 2009-10-28 Ian Lance Taylor <iant@google.com>
10570 * object.h (class Relobj): Drop options parameter from
10571 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10572 do_scan_relocs, do_relocate. Change all callers.
10573 (class Sized_relobj): Drop options parameters from
10574 do_gc_process_relocs, do_scan_relocs, do_relocate,
10575 do_relocate_sections, relocate_sections, emit_relocs_scan,
10576 emit_relocs_scan_reltype. Change all callers.
10577 (struct Relocate_info): Remove options field and all references to
10579 * reloc.h (class Read_relocs): Remove options constructor
10580 parameter and options_ field. Change all callers.
10581 (class Gc_process_relocs, class Scan_relocs): Likewise.
10582 (class Relocate_task): Likewise.
10583 * target-reloc.h (scan_relocs): Remove options parameter. Change
10585 (scan_relocatable_relocs): Likewise.
10586 * target.h (class Sized_target): Remove options parameter from
10587 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
10589 * gc.h (gc_process_relocs): Remove options parameter. Change all
10591 * arm.cc: Update functions to remove options parameters.
10592 * i386.cc: Likewise.
10593 * powerpc.cc: Likewise.
10594 * sparc.cc: Likewise.
10595 * x86_64.cc: Likewise.
10596 * testsuite/testfile.cc: Likewise.
10598 2009-10-28 Doug Kwan <dougkwan@google.com>
10600 * arm.cc (Arm_relobj): New class definition.
10601 (Arm_relobj::scan_sections_for_stubs,
10602 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10603 New method definitions.
10605 2009-10-28 Cary Coutant <ccoutant@google.com>
10607 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10608 (Plugin::cleanup_done_): New member.
10609 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10610 (Plugin_manager::cleanup_done_): Remove.
10611 (Plugin_manager::add_input_file): Edit error message.
10612 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10613 (Plugin_manager::cleanup): Remove use of cleanup_done_.
10615 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
10617 * fileread.cc: (File_read::View::~View): Use the new
10618 data_ownership_ filed.
10619 (File_read::~File_read): Dispose the new whole_file_view_.
10620 (File_read::open): Mmap the whole file if needed.
10621 (File_read::open): Use whole_file_view_ instead of contents_.
10622 (File_read::find_view): Use whole_file_view_ if applicable.
10623 (File_read::do_read): Use whole_file_view_ instead of contents_.
10624 (File_read::make_view): Use whole_file_view_ instead of contents_,
10625 update File_read::View::View call.
10626 (File_read::find_or_make_view): Update File_read::View::View
10628 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10630 (File_read::View::Data_ownership): New enum.
10631 (File_read::View::View): Replace bool mapped_ with Data_ownership
10633 (File_read::View::mapped_): Remove (replaced by data_ownership_).
10634 (File_read::View::data_ownership_): New field.
10635 (File_read::contents_): Remove (replaced by whole_file_view_).
10636 (File_read::whole_file_view_): New field.
10637 * options.h (class General_options): Add --keep-files-mapped.
10639 2009-10-27 Cary Coutant <ccoutant@google.com>
10641 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10642 * testsuite/Makefile.am (plugin_test_5): New test case.
10643 * testsuite/Makefile.in: Regenerate.
10645 2009-10-25 Doug Kwan <dougkwan@google.com>
10647 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10648 from private to protected to allow access by child class.
10649 (Sized_relobj::do_relocate_sections): New method declaration.
10650 (Sized_relobj::relocate_sections): Virtualize.
10651 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10652 Sized_relobj::relocate_sections. Instantiate template explicitly
10653 for different target sizes and endianity.
10655 2009-10-24 Doug Kwan <dougkwan@google.com>
10657 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10658 (Arm_input_section::as_arm_input_section): New method.
10659 (Arm_output_section): New class definition.
10660 (Arm_output_section::create_stub_group,
10661 Arm_output_section::group_sections): New method definitions.
10663 2009-10-22 Doug Kwan <dougkwan@google.com>
10665 * arm.cc (Arm_input_section): New class definition.
10666 (Arm_input_section::init, Arm_input_section:do_write,
10667 Arm_input_section::set_final_data_size,
10668 Arm_input_section::do_reset_address_and_file_offset): New method
10671 2009-10-21 Doug Kwan <dougkwan@google.com>
10673 * arm.cc (Stub_table, Arm_input_section): New forward class
10675 (Stub_table): New class defintion.
10676 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10677 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10678 New method definition.
10680 2009-10-21 Doug Kwan <dougkwan@google.com>
10682 * arm.cc: Update copyright comments.
10683 (Target_arm): New forward class template declaration.
10684 (Arm_address): New type.
10685 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10686 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10687 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10689 (Insn_template): Same.
10690 (DEF_STUBS): New macro.
10691 (Stub_type): New enum type.
10692 (Stub_template): New class definition.
10694 (Reloc_stub): Same.
10695 (Stub_factory): Same.
10696 (Target_arm::Target_arm): Initialize may_use_blx_ and
10697 should_force_pic_veneer_.
10698 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10699 Target_arm::should_force_pic_veneer,
10700 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10701 Target_arm::using_thumb_only, Target_arm:;default_target): New
10703 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10704 New data member declarations.
10705 (Insn_template::size, Insn_template::alignment): New method defintions.
10706 (Stub_template::Stub_template): New method definition.
10707 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10708 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10709 (Stub_factory::Stub_factory): New method definition.
10710 * gold.h (string_hash): New template.
10711 * output.h (Input_section_specifier::hash_value): Use
10713 (Input_section_specifier::string_hash): Remove.
10714 * stringpool.cc (Stringpool_template::string_hash): Use
10717 2009-10-20 Doug Kwan <dougkwan@google.com>
10719 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10720 symbols of relaxed input sections.
10721 * output.h (Output_section::find_relaxed_input_section): Make
10724 2009-10-16 Doug Kwan <dougkwan@google.com>
10726 * dynobj.cc (Versions::Versions): Initialize version_script_.
10727 Only insert base version symbol definition for a shared object
10728 if version script defines any version versions.
10729 (Versions::define_base_version): New method definition.
10730 (Versions::add_def): Check that base version is not needed.
10731 (Versions::add_need): Define base version lazily.
10732 * dynobj.h (Versions::define_base_version): New method declaration.
10733 (Versions::needs_base_version_): New data member declaration.
10734 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10735 (check_DATA): Add no_version_test.stdout.
10736 (libno_version_test.so, no_version_test.o no_version_test.stdout):
10738 * testsuite/Makefile.in: Regenerate.
10739 * testsuite/no_version_test.c: New file.
10740 * testsuite/no_version_test.sh: Ditto.
10742 2009-10-16 Doug Kwan <dougkwan@google.com>
10744 * expression.cc (class Segment_start_expression): New class definition.
10745 (Segment_start_expression::value): New method definition.
10746 (script_exp_function_segment_start): Return a new
10747 Segment_start_expression.
10748 * gold/script-c.h (script_saw_segment_start_expression): New function
10750 * script-sections.cc (Script_sections::Script_sections): Initialize
10751 SAW_SEGMENT_START_EXPRESSION_ to false.
10752 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10753 and -Tbbs options to specify section addresses if given in
10754 command line and no SEGMENT_START expression is seen in a script.
10755 * script-sections.h (Script_sections::saw_segment_start_expression,
10756 Script_sections::set_saw_segment_start_expression): New method
10758 (Script_sections::saw_segment_start_expression_): New data member
10760 * script.cc (script_saw_segment_start_expression): New function.
10761 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10762 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10763 script_test_7.sh and script_test_8.sh.
10764 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10765 script_test_8.stdout.
10766 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10767 (script_test_6, script_test_6.stdout, script_test_7,
10768 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10769 * Makefile.in: Regenerate.
10770 * testsuite/script_test_6.sh: New file.
10771 * testsuite/script_test_6.t: Same.
10772 * testsuite/script_test_7.sh: Same.
10773 * testsuite/script_test_7.t: Same.
10774 * testsuite/script_test_8.sh: Same.
10776 2009-10-16 Doug Kwan <dougkwan@google.com>
10778 * output.cc (Output_segment::set_section_list_address): Cast
10779 expressions to unsigned long long type to avoid format warnings.
10781 2009-10-15 Ian Lance Taylor <iant@google.com>
10783 * script.cc (Script_options::add_symbol_assignment): Always add a
10784 dot assignment to script_sections_.
10785 * script-sections.cc (Script_sections::add_dot_assignment):
10786 Initialize if necessary.
10788 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10789 program headers with no load segment if there is a linker script.
10791 * layout.cc (Layout::set_segment_offsets): Align the file offset
10792 to the segment aligment for -N or -n with no load segment.
10793 * output.cc (Output_segment::add_output_section): Don't crash if
10794 the first section is a TLS section.
10795 (Output_segment::set_section_list_addresses): Print an error
10796 message if the address moves backward in a linker script.
10797 * script-sections.cc
10798 (Output_section_element_input::set_section_addresses): Don't
10799 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10800 (Orphan_output_section::set_section_addresses): Likewise.
10802 2009-10-15 Doug Kwan <dougkwan@google.com>
10804 * layout.cc (Layout::finish_dynamic_section): Generate tags
10805 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10806 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10807 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10809 2009-10-14 Ian Lance Taylor <iant@google.com>
10811 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10813 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10814 data_shdr fields of relinfo.
10815 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10816 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
10817 R_386_TLS_LDO_32, adjust based on section flags.
10818 (Target_i386::Relocate::fix_up_ldo): Remove.
10820 2009-10-13 Ian Lance Taylor <iant@google.com>
10822 Add support for -pie.
10823 * options.h (class General_options): Add -pie and
10825 (General_options::output_is_position_independent): Test -pie.
10826 (General_options::output_is_executable): Return true if not shared
10827 and not relocatable.
10828 (General_options::output_is_pie): Remove.
10829 * options.cc (General_options::finalize): Reject incompatible uses
10831 * gold.cc (queue_middle_tasks): A -pie link is not static.
10832 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10833 * symtab.cc (Symbol::final_value_is_known): Return false if
10834 output_is_position_independent.
10835 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10836 output_is_position_independent.
10837 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10838 output_is_position_independent.
10839 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10840 output_is_position_independent.
10841 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10843 (basic_pie_test.o, basic_pie_test): New targets.
10844 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10845 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10846 (two_file_pie_test): New target.
10847 * testsuite/Makefile.in: Rebuild.
10848 * README: Remove note saying that -pie is not supported.
10850 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
10852 * options.h (class General_options): Add -init and -fini.
10853 * layout.cc (Layout::finish_dynamic_section): Emit
10854 given init and fini functions.
10856 2009-10-13 Sriraman Tallam <tmsriram@google.com>
10858 * gc.h (gc_process_relocs): Check if icf is enabled using new
10860 * gold.cc (queue_initial_tasks): Likewise.
10861 (queue_middle_tasks): Likewise.
10862 * object.cc (do_layout): Likewise.
10863 * symtab.cc (is_section_folded): Likewise.
10864 * main.cc (main): Likewise.
10865 * reloc.cc (Read_relocs::run): Likewise.
10866 (Sized_relobj::do_scan_relocs): Likewise.
10867 * icf.cc (is_function_ctor_or_dtor): New function.
10868 (Icf::find_identical_sections): Check if function is ctor or dtor when
10869 safe icf is chosen.
10870 * options.h (General_options::icf): Change option to be an enum.
10871 (Icf_status): New enum.
10872 (icf_enabled): New method.
10873 (icf_safe_folding): New method.
10874 (set_icf_status): New method.
10875 (icf_status_): New variable.
10876 * (options.cc) (General_options::finalize): Set icf_status_.
10877 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10878 icf_test and icf_keep_unique_test to use the --icf enum flag.
10879 * testsuite/icf_safe_test.sh: New file.
10880 * testsuite/icf_safe_test.cc: New file.
10882 2009-10-12 Sriraman Tallam <tmsriram@google.com>
10884 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10885 includes to gc.h and icf.h.
10886 * arm.cc: Include gc.h.
10887 * gold.cc: Likewise.
10888 * i386.cc: Likewise.
10889 * powerpc.cc: Likewise.
10890 * sparc.cc: Likewise.
10891 * x86_64.cc: Likewise.
10892 * gc.h: Include icf.h.
10894 2009-10-11 Ian Lance Taylor <iant@google.com>
10896 * plugin.cc: Include "gold.h" before other header files.
10898 2009-10-10 Chris Demetriou <cgd@google.com>
10900 * options.h (Input_file_argument::Input_file_type): New enum.
10901 (Input_file_argument::is_lib_): Replace with...
10902 (Input_file_argument::type_): New member.
10903 (Input_file_argument::Input_file_argument): Take Input_file_type
10904 'type' rather than boolean 'is_lib' as second argument.
10905 (Input_file_argument::is_lib): Use type_.
10906 (Input_file_argument::is_searched_file): New function.
10907 (Input_file_argument::may_need_search): Handle is_searched_file.
10908 * options.cc (General_options::parse_library): Support -l:filename.
10909 (General_options::parse_just_symbols): Update for Input_file_argument
10911 (Command_line::process): Likewise.
10912 * archive.cc (Archive::get_file_and_offset): Likewise.
10913 * plugin.cc (Plugin_manager::release_input_file): Likewise.
10914 * script.cc (read_script_file, script_add_file): Likewise.
10915 * fileread.cc (Input_file::Input_file): Likewise.
10916 (Input_file::will_search_for): Handle is_searched_file.
10917 (Input_file::open): Likewise.
10918 * readsyms.cc (Read_symbols::get_name): Likewise.
10919 * testsuite/Makefile.am (searched_file_test): New test.
10920 * testsuite/Makefile.in: Regenerate.
10921 * testsuite/searched_file_test.cc: New file.
10922 * testsuite/searched_file_test_lib.cc: New file.
10924 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10925 Ian Lance Taylor <iant@google.com>
10927 * descriptor.cc: Include <cstdio> and "binary-io.h".
10928 (Descriptors::open): Open the files in binary mode always.
10929 * script.cc (Lex::get_token): Treat \r as whitespace.
10931 2009-10-09 Ian Lance Taylor <iant@google.com>
10933 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10935 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10936 Ian Lance Taylor <iant@google.com>
10938 * configure.ac: Check for readv function also.
10939 * fileread.cc (readv): Define if not HAVE_READV.
10940 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10942 * config.in: Regenerate.
10943 * configure: Regenerate.
10945 2009-10-09 Doug Kwan <dougkwan@google.com>
10947 * layout.cc (Layout::make_output_section): Call target hook to make
10948 ordinary output section.
10949 (Layout::finalize): Adjust parameter list of call the
10950 Target::may_relax().
10951 * layout.h (class Layout::section_list): New method.
10952 * merge.h (Output_merge_base::entsize): Change visibility to public.
10953 (Output_merge_base::is_string, Output_merge_base::do_is_string):
10955 (Output_merge_string::do_is_string): New method.
10956 * object.cc (Sized_relobj::do_setup): renamed from
10957 Sized_relobj::set_up.
10958 * object.h (Sized_relobj::adjust_shndx,
10959 Sized_relobj::initializ_input_to_output_maps,
10960 Sized_relobj::free_input_to_output_maps): Change visibilities to
10962 (Sized_relobj::setup): Virtualize.
10963 (Sized_relobj::do_setup): New method declaration.
10964 (Sized_relobj::invalidate_section_offset,
10965 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10966 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10967 * options.cc (parse_int): New function.
10968 * options.h (parse_int): New declaration.
10969 (DEFINE_int): New macro.
10970 (stub_group_size): New option.
10971 * output.cc (Output_section::Output_section): Initialize memebers
10972 merge_section_map_, merge_section_by_properties_map_,
10973 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10974 (Output_section::add_input_section): Handled deferred code-fill
10975 generation and remove an old comment.
10976 (Output_section::add_relaxed_input_section): New method definition.
10977 (Output_section::add_merge_input_section): Use merge section by
10978 properties map to speed to search. Update merge section maps
10980 (Output_section::build_relaxation_map): New method definition.
10981 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10983 (Output_section::relax_input_section): Renamed to
10984 Output_section::convert_input_sections_to_relaxed_sections and change
10985 interface to take a vector of pointers to relaxed sections.
10986 (Output_section::find_merge_section,
10987 Output_section::find_relaxed_input_section): New method definitions.
10988 (Output_section::is_input_address_mapped,
10989 Output_section::output_offset, Output_section::output_address):
10990 Use output section data maps to speed up searching.
10991 (Output_section::find_starting_output_address): Add comments.
10992 (Output_section::do_write,
10993 Output_section::write_to_postprocessing_buffer): Do code-fill
10994 generation as appropriate.
10995 (Output_section::get_input_sections): Invalidate relaxed input section
10997 (Output_section::restore_states): Adjust type of checkpoint .
10998 Invalidate relaxed input section map.
10999 * output.h (Output_merge_base): New class declaration.
11000 (Input_section_specifier): New class defintion.
11001 (class Output_relaxed_input_section) Change base class to
11002 Output_section_data_build.
11003 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11004 base class initializer.
11005 (Output_section::add_relaxed_input_section): New method declaration.
11006 (Output_section::Input_section): Change visibility to protected.
11007 (Output_section::Input_section::relobj,
11008 Output_section::Input_section::shndx): Handle relaxed input sections.
11009 Output_section::input_sections) Change visibility to protected. Also
11010 define overload to return a non-const pointer.
11011 (Output_section::Merge_section_properties): New class defintion.
11012 (Output_section::Merge_section_by_properties_map,
11013 Output_section::Output_section_data_by_input_section_map,
11014 Output_section::Relaxation_map): New types.
11015 (Output_section::relax_input_section): Rename method to
11016 Output_section::convert_input_sections_to_relaxed_sections and change
11017 interface to take a vector of relaxed section pointers.
11018 (Output_section::find_merge_section,
11019 Output_section::find_relaxed_input_section,
11020 Output_section::build_relaxation_map,
11021 Output_section::convert_input_sections_in_list_to_relaxed_sections):
11022 New method declarations.
11023 (Output_section::merge_section_map_
11024 Output_section::merge_section_by_properties_map_,
11025 Output_section::relaxed_input_section_map_,
11026 Output_section::is_relaxed_input_section_map_valid_,
11027 Output_section::generate_code_fills_at_write_): New data members.
11028 * script-sections.cc
11029 (Output_section_element_input::set_section_addresses): Call
11030 current_data_size and addralign methods of relaxed input sections.
11031 (Orphan_output_section::set_section_addresses): Call current_data_size
11032 and addralign methods of relaxed input sections.
11033 * symtab.cc (Symbol_table::compute_final_value): Extract template
11034 from the body of Symbol_table::sized_finalize_symbol.
11035 (Symbol_table::sized_finalized_symbol): Call
11036 Symbol_table::compute_final_value.
11037 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11038 (Symbol_table::compute_final_value): New templated method declaration.
11039 * target.cc (Target::do_make_output_section): New method defintion.
11040 * target.h (Target::make_output_section): New method declaration.
11041 (Target::relax): Add more parameters for input objects, symbol table
11042 and layout. Adjust call to do_relax.
11043 (Target::do_make_output_section): New method declaration.
11044 (Target::do_relax): Add parameters for input objects, symbol table
11047 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11049 * pread.c: Include stdio.h.
11051 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11053 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11056 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11058 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11059 Change read_shndx type to unsigned int.
11060 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11062 (Sized_dwarf_line_info::read_line_mappings): Likewise.
11063 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11064 Change read_shndx type to unsigned int.
11065 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11067 (Sized_dwarf_line_info::read_line_mappings): Likewise.
11068 * layout.cc (Layout::create_symtab_sections): Cast the result of
11069 local_symcount * symsize to off_t in the gold_assert.
11071 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11073 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11074 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11076 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11077 (Arm_relocate_functions::thm_abs5): New function.
11078 (Arm_relocate_functions::abs12): New function.
11079 (Arm_relocate_functions::abs16): New function.
11080 (Arm_relocate_functions::base_abs): New function.
11081 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11082 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
11083 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11085 (Scan::global): Likewise.
11086 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11087 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11088 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11089 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11092 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11094 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11095 (Arm_relocate_functions::movt_prel): New function.
11096 (Arm_relocate_functions::thm_movw_prel_nc): New function.
11097 (Arm_relocate_functions::thm_movt_prel): New function.
11098 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11099 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11100 (Scan::global, Relocate::relocate): Likewise.
11101 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11103 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
11105 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11106 Incremental_checker.
11107 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11109 (class Incremental_inputs_header): New class.
11110 (Incremental_inputs_header_writer): Edit comment.
11111 (Incremental_inputs_entry): New class.
11112 (Incremental_inputs_entry_writer): Edit comment.
11113 (Sized_incremental_binary::do_find_incremental_inputs_section):
11114 Add *strtab_shndx parameter, fill it.
11115 (Sized_incremental_binary::do_check_inputs): New method.
11116 (Incremental_checker::can_incrementally_link_output_file): Use
11117 Sized_incremental_binary::check_inputs.
11118 (Incremental_inputs::report_command_line): Save command line in
11121 (Incremental_binary::find_incremental_inputs_section): New
11123 (Incremental_binary::do_find_incremental_inputs_section): Add
11124 strtab_shndx parameter.
11125 (Incremental_binary::do_check_inputs): New pure virtual method.
11126 (Sized_incremental_binary::do_check_inputs): Declare.
11127 (Incremental_checker::Incremental_checker): Add incremental_inputs
11128 parameter, use it to initialize incremental_inputs_.
11129 (Incremental_checker::incremental_inputs_): New field.
11130 (Incremental_checker::command_line): New method.
11131 (Incremental_checker::inputs): New method.
11132 (Incremental_checker::command_line_): New field.
11134 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
11136 * incremental.cc: Include <cstdarg> and "target-select.h".
11137 (vexplain_no_incremental): New function.
11138 (explain_no_incremental): New function.
11139 (Incremental_binary::error): New method.
11140 (Sized_incremental_binary::do_find_incremental_inputs_section): New
11142 (make_sized_incremental_binary): New function.
11143 (open_incremental_binary): New function.
11144 (can_incrementally_link_file): Add checks if output is ELF and has
11146 * incremental.h: Include "elfcpp_file.h" and "output.h".
11147 (Incremental_binary): New class.
11148 (Sized_incremental_binary): New class.
11149 (open_incremental_binary): Declare.
11150 * object.cc (is_elf_object): Use
11151 elfcpp::Elf_recognizer::is_elf_file.
11152 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11153 * output.h (Output_file::filesize): New method.
11155 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11157 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11159 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11160 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11162 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11164 (Arm_relocate_functions::movw_abs_nc): New function.
11165 (Arm_relocate_functions::movt_abs): New function.
11166 (Arm_relocate_functions::thm_movw_abs_nc): New function.
11167 (Arm_relocate_functions::thm_movt_abs): New function.
11168 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11169 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11170 (Scan::global): Likewise.
11171 (Relocate::relocate): Likewise.
11172 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11174 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11176 * arm.cc (Arm_relocate_functions::got_prel) New function.
11177 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11178 (Relocate::relocate): Likewise.
11179 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11181 2009-10-06 Ian Lance Taylor <iant@google.com>
11183 * options.h (class General_options): Define
11184 split_stack_adjust_size parameter.
11185 * object.h (class Object): Add uses_split_stack_ and
11186 has_no_split_stack_ fields. Add uses_split_stack and
11187 has_no_split_stack accessor functions. Declare
11188 handle_split_stack_section.
11189 (class Reloc_symbol_changes): Define.
11190 (class Sized_relobj): Define Function_offsets. Declare
11191 split_stack_adjust, split_stack_adjust_reltype, and
11193 * object.cc (Object::handle_split_stack_section): New function.
11194 (Sized_relobj::do_layout): Call handle_split_stack_section.
11195 * dynobj.cc (Sized_dynobj::do_layout): Call
11196 handle_split_stack_section.
11197 * reloc.cc (Sized_relobj::relocate_sections): Call
11198 split_stack_adjust for executable sections in split_stack
11199 objects. Pass reloc_map to relocate_section.
11200 (Sized_relobj::split_stack_adjust): New function.
11201 (Sized_relobj::split_stack_adjust_reltype): New function.
11202 (Sized_relobj::find_functions): New function.
11203 * target-reloc.h: Include "object.h".
11204 (relocate_section): Add reloc_symbol_changes parameter. Change
11206 * target.h (class Target): Add calls_non_split method. Declare
11207 do_calls_non_split virtual method. Declare match_view and
11209 * target.cc: Include "elfcpp.h".
11210 (Target::do_calls_non_split): New function.
11211 (Target::match_view): New function.
11212 (Target::set_view_to_nop): New function.
11213 * gold.cc (queue_middle_tasks): Give an error if mixing
11214 split-stack and non-split-stack objects with -r.
11215 * i386.cc (Target_i386::relocate_section): Add
11216 reloc_symbol_changes parameter.
11217 (Target_i386::do_calls_non_split): New function.
11218 * x86_64.cc (Target_x86_64::relocate_section): Add
11219 reloc_symbol_changes parameter.
11220 (Target_x86_64::do_calls_non_split): New function.
11221 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11223 * powerpc.cc (Target_powerpc::relocate_section): Add
11224 reloc_symbol_changes parameter.
11225 * sparc.cc (Target_sparc::relocate_section): Add
11226 reloc_symbol_changes parameter.
11227 * configure.ac: Call AM_CONDITIONAL for the default target.
11228 * configure: Rebuild.
11229 * testsuite/Makefile.am (TEST_AS): New variable.
11230 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11231 (check_DATA): Add split_i386 and split_x86_64 files.
11232 (SPLIT_DEFSYMS): Define.
11233 (split_i386_[1234n].o): New targets.
11234 (split_i386_[124]): New targets.
11235 (split_i386_[1234r].stdout): New targets.
11236 (split_x86_64_[1234n].o): New targets.
11237 (split_x86_64_[124]): New targets.
11238 (split_x86_64_[1234r].stdout): New targets.
11239 (MOSTLYCLEANFILES): Add new executables.
11240 * testsuite/split_i386.sh: New file.
11241 * testsuite/split_x86_64.sh: New file.
11242 * testsuite/split_i386_1.s: New file.
11243 * testsuite/split_i386_2.s: New file.
11244 * testsuite/split_i386_3.s: New file.
11245 * testsuite/split_i386_4.s: New file.
11246 * testsuite/split_i386_n.s: New file.
11247 * testsuite/split_x86_64_1.s: New file.
11248 * testsuite/split_x86_64_2.s: New file.
11249 * testsuite/split_x86_64_3.s: New file.
11250 * testsuite/split_x86_64_4.s: New file.
11251 * testsuite/split_x86_64_n.s: New file.
11252 * testsuite/testfile.cc (Target_test): Update relocation_section
11254 * testsuite/Makefile.in: Rebuild.
11256 2009-10-06 Ian Lance Taylor <iant@google.com>
11258 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11259 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11260 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
11261 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11262 the address on ldo_addrs_.
11263 (Target_i386::Relocate::fix_up_ldo): New function.
11265 2009-10-06 Rafael Espindola <espindola@google.com>
11267 * plugin.cc (add_input_library): New.
11268 (Plugin::load): Add add_input_library to tv.
11269 (Plugin_manager::add_input_file): Add the is_lib argument.
11270 (add_input_file): Update call to Plugin_manager::add_input_file.
11271 (add_input_library): New.
11272 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11274 2009-09-30 Doug Kwan <dougkwan@google.com>
11276 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11277 symbol and call Symbol::may_need_copy_reloc to determine if
11278 a copy reloc is needed.
11279 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11280 nocopyreloc is given in command line.
11281 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11282 given in command line.
11283 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11284 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11285 of the removed Target_i386::may_need_copy_reloc.
11286 * options.h (copyreloc): New option with default value false.
11287 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11288 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11289 instead of the removed Target_powerpc::may_need_copy_reloc.
11290 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11291 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11292 instead of the removed Target_sparc::may_need_copy_reloc.
11293 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11294 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11295 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11296 instead of the removed Target_x86_64::may_need_copy_reloc.
11298 2009-09-30 Ian Lance Taylor <iant@google.com>
11300 * object.h (class Object): Remove target_ field, and target,
11301 sized_target, and set_target methods.
11302 (Object::sized_target): Remove.
11303 (class Sized_relobj): Update declarations. Remove sized_target.
11304 * object.cc (Sized_relobj::setup): Remove target parameter.
11305 Change all callers.
11306 (Input_objects::add_object): Don't do anything with the target.
11307 (make_elf_sized_object): Add punconfigured parameter. Change all
11308 callers. Set or test parameter target.
11309 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11310 Change all callers.
11311 * parameters.cc (Parameters::set_target): Change parameter type to
11313 (Parameters::default_target): Remove.
11314 (set_parameters_target): Change parameter type to be non-const.
11315 (parameters_force_valid_target): New function.
11316 (parameters_clear_target): New function.
11317 * parameters.h (class Parameters): Update declarations. Remove
11318 default_target method. Add sized_target and clear_target
11319 methods. Change target_ to be non-const.
11320 (set_parameters_target): Update declaration.
11321 (parameters_force_valid_target): Declare.
11322 (parameters_clear_target): Declare.
11323 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11324 as NULL if we aren't searching.
11325 (Add_symbols::run): Don't check for compatible target.
11326 * fileread.cc (Input_file::open_binary): Call
11327 parameters_force_valid_target.
11328 * gold.cc (queue_middle_tasks): Likewise.
11329 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
11330 set_target on object.
11331 * dynobj.h (class Sized_dynobj): Update declarations.
11332 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11333 make_elf_object returns NULL.
11334 (Archive::include_member): Don't check whether object target is
11336 * output.cc (Output_section::add_input_section): Get target from
11338 (Output_section::relax_input_section): Likewise.
11339 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11341 (Sized_relobj::do_scan_relocs): Likewise.
11342 (Sized_relobj::relocate_sections): Likewise.
11343 * resolve.cc (Symbol_table::resolve): Likewise.
11344 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
11345 parameter. Change all callers.
11346 (Symbol_table::add_from_object): Get target from parameters.
11347 (Symbol_table::add_from_relobj): Don't check object target.
11348 (Symbol_table::add_from_dynobj): Likewise.
11349 (Symbol_table::define_special_symbol): Get target from
11351 * symtab.h (class Symbol_table): Update declaration.
11352 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11353 parameter. Change all callers. Clear parameter target.
11354 (Binary_test): Test target here.
11355 * testsuite/object_unittest.cc (gold_testsuite): Remove
11356 target_test_pointer parameter. Change all callers.
11357 (Object_test): Test target here.
11359 2009-09-26 Ian Lance Taylor <iant@google.com>
11361 * testsuite/initpri1.c: Don't try to use constructor priorities if
11362 compiling with gcc before 4.3.
11364 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
11366 * testsuite/retain_symbols_file_test.sh (check_present): Change
11367 output file name to retain_symbols_file_test.stdout.
11368 (check_absent): Likewise.
11370 2009-09-18 Craig Silverstein <csilvers@google.com>
11372 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11373 * options.cc: Include <cerrno> and <fstream>.
11374 (General_options::finalize): Parse -retain-symbols-file tag.
11375 * options.h: New flag.
11376 (General_options): New method should_retain_symbol, new
11377 variable symbols_to_retain.
11378 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11379 should_retain_symbol map.
11380 * testsuite/Makefile.am (retain_symbols_file_test): New test.
11381 * testsuite/Makefile.in: Regenerate.
11382 * testsuite/retain_symbols_file_test.sh: New file.
11384 2009-09-18 Nick Clifton <nickc@redhat.com>
11386 * po/es.po: Updated Spanish translation.
11388 2009-09-17 Doug Kwan <dougkwan@google.com>
11390 * debug.h (DEBUG_RELAXATION): New constant.
11391 (DEBUG_ALL): Add DEBUG_RELAXATION.
11392 (debug_string_to_enum): Add relaxation debug option.
11394 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11395 Layout::Relaxation_debug_check::read_sections,
11396 Layout::Relaxation_debug_check::read_sections): New method definitions.
11397 (Layout::Layout): Initialize data members
11398 record_output_section_data_from_scrips_,
11399 script_output_section_data_list_ and relaxation_debug_check_.
11400 (Layout::save_segments, Layout::restore_segments,
11401 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11402 Layout::relaxation_loop_body): New method definitions.
11403 (Layout::finalize): Support relaxation. Move section layout code to
11404 Layout::relaxation_loop_body.
11405 (Layout::set_asection_address_from_script): Move code for orphan
11406 section placement out.
11407 (Layout::place_orphan_sections_in_script): New method definition.
11408 * layout.h (Output_segment_headers, Output_file_header):
11409 New forward class declarations.
11410 (Layout::~Layout): Define.
11411 (Layout::new_output_section_data_from_script): New method definition.
11412 (Layout::place_orphan_sections_in_script): New method declaration.
11413 (Layout::Segment_states): New type declaration.
11414 (Layout::save_segments, Layout::restore_segments,
11415 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11416 Layout::relaxation_loop_body): New method declarations.
11417 (Layout::Output_section_data_list): New type declaration.
11418 (Layout::Relaxation_debug_check): New class definition.
11419 (Layout::record_output_section_data_from_script_,
11420 Layout::script_output_section_data_list_, Layout::segment_states_,
11421 Layout::relaxation_debug_check_): New data members.
11422 * output.cc: (Output_section_headers::do_size): New method definition.
11423 (Output_section_headers::Output_section_headers): Move size
11424 computation to Output_section_headers::do_size.
11425 (Output_segment_headers::do_size): New method definition.
11426 (Output_file_header::Output_file_header): Move size computation to
11427 Output_file_header::do_size and call it.
11428 (Output_file_header::do_size): New method definition.
11429 (Output_data_group::Output_data_group): Adjust call to
11430 Output_section_data.
11431 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11432 (Output_symtab_xindex::do_write): Add array bound check.
11433 (Output_section::Input_section::print_to_mapfile): Handle
11434 RELAXED_INPUT_SECTION_CODE.
11435 (Output_section::Output_section): Initialize data member checkpoint_.
11436 (Output_section::~Output_section): Delete checkpoint object pointed
11438 (Output_section::add_input_section): Always add an Input_section if
11440 (Output_section::add_merge_input_section): Add assert.
11441 (Output_section::relax_input_section): New method definition.
11442 (Output_section::set_final_data_size): Set load address to zero for
11443 an unallocated section.
11444 (Output_section::do_address_and_file_offset_have_reset_values):
11445 New method definition.
11446 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11447 Handle relaxed input section.
11448 (Output_section::sort_attached_input_sections): Checkpoint input
11449 section list lazily.
11450 (Output_section::get_input_sections): Change type of input_sections to
11451 list of Simple_input_section pointers. Checkpoint input section list
11452 lazily. Also handle relaxed input sections.
11453 (Output_section::add_input_section_for_script): Take a reference to
11454 a Simple_input_section object instead of Relobj pointer and section
11455 index as parameter. Handle relaxed input sections.
11456 (Output_section::save_states, Output_section::restore_states): New
11457 method definitions.
11458 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11459 (Output_data::is_data_size_fixed): New method definition.
11460 (Output_data::reset_addresss_and_file_offset): Do not reset data size
11462 (Output_data::address_and_file_offset_have_reset_values): New method
11464 (Output_data::do_address_and_file_offset_have_reset_values): New method
11466 (Output_data::set_data_size): Check that data size is not fixed.
11467 (Output_data::fix_data_size): New method definition.
11468 (Output_data::is_data_size_fixed_): New data member.
11469 (Output_section_headers::set_final_data_size): New method definition.
11470 (Output_section_headers::do_size): New method declaration.
11471 (Output_segment_headers::set_final_data_size): New method definition.
11472 (Output_segment_headers::do_size): New method declaration.
11473 (Output_file_header::set_final_data_size)::New method definition.
11474 (Output_file_header::do_size)::New method declaration.
11475 (Output_section_data::Output_section_data): Add new parameter
11476 is_data_size_fixed and use it to fix data size.
11477 (Output_data_const::Output_data_const): Adjust call to base class
11478 constructor and fix data size.
11479 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11480 base class constructor and fix data size.
11481 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11482 base class constructor and fix data size.
11483 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11484 class constructor and fix data size.
11485 (Output_data_group::set_final_data_size): New method definition.
11486 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11487 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11488 class constructor and fix data size.
11489 (Output_relaxed_input_section): New class definition.
11490 (Output_section::Simple_input_section): New class definition.
11491 (Output_section::get_input_sections): Adjust parameter list.
11492 (Output_section::add_input_section_for_script): Same.
11493 (Output_section::save_states, Output_section::restore_states,
11494 Output_section::do_address_and_file_offset_have_reset_values,
11495 (Output_section::Input_section::Input_section): Handle
11496 RELAXED_INPUT_SECTION_CODE. Add new overload for
11497 Output_relaxed_input_section.
11498 (Output_section::Input_section::is_input_section,
11499 Output_section::Input_section::set_output_section): Handle relaxed
11501 (Output_section::Input_section::is_relaxed_input_section,
11502 Output_section::Input_section::output_section_data,
11503 Output_section::Input_section::relaxed_input_section): New method
11505 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11507 (Output_section::Input_section::u1_): Update comments.
11508 (Output_section::Input_section::u2_): Add new union member poris.
11509 (Output_section::Checkpoint_output_section): New classs definition.
11510 (Output_section::relax_input_section): New method declaration.
11511 (Output_section::checkpoint_): New data member.
11512 (Output_segment): Update comments.
11513 (Output_segment::Output_segment): Un-privatize copy constructor.
11514 (Output_segment::operator=): Un-privatize.
11515 * script-sections.cc (Output_section_element::Input_section_list):
11516 Change element type to Output_section::Simple_input_section.
11517 (Output_section_element_dot_assignment::set_section_addresses):
11518 Register output section data for relaxation clean up.
11519 (Output_data_exression::Output_data_expression): Adjust call to base
11520 constructor to fix data size.
11521 (Output_section_element_data::set_section_addresses): Register
11522 Output_data_expression object for relaxation clean up.
11523 (struct Input_section_info): Replace Relobj pointer and section index
11524 pair with Output_section::Simple_input_section and Convert struct to a
11526 (Input_section_sorter::operator()): Adjust access to
11527 Input_section_info data member to use accessors.
11528 (Output_section_element_input::set_section_addresses): Use layout
11529 parameter. Adjust code to use Output_section::Simple_input_section
11530 and Input_secction_info classes. Register filler for relaxation
11532 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11533 and section index pair with Output_section::Simple_input_section
11534 class. Adjust code accordingly.
11535 (Phdrs_element::release_segment): New method definition.
11536 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11538 (Script_sections::release_segments): New method definition.
11539 * gold/script-sections.h (Script_sections::release_segments): New
11540 method declaration.
11541 * gold/target.h (Target::may_relax, Target::relax,
11542 Target::do_may_relax, Target::do_relax): New method definitions.
11544 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11546 * arm.cc (has_signed_unsigned_overflow): New function.
11547 (Arm_relocate_functions::abs8): New function.
11548 (Target_arm::Scan::local): Handle R_ARM_ABS8.
11549 (Target_arm::Scan::global): Likewise.
11550 (Target_arm::relocate::relocate): Likewise.
11551 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11554 2009-09-16 Cary Coutant <ccoutant@google.com>
11556 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11557 * testsuite/Makefile.in: Regenerate.
11559 2009-09-11 Nick Clifton <nickc@redhat.com>
11561 * po/gold.pot: Updated by the Translation project.
11563 2009-09-08 Cary Coutant <ccoutant@google.com>
11565 * output.cc (Output_file::open): Add execute permission to empty file.
11566 * testsuite/Makefile.am (permission_test): New test.
11567 * testsuite/Makefile.in: Regenerate.
11569 2009-09-02 Ian Lance Taylor <iant@google.com>
11571 * output.cc (Output_file::resize): Call map_no_anonymous rather
11574 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
11576 * gold.cc: Include "incremental.h".
11577 (queue_initial_tasks): Call Incremental_checker methods.
11578 * incremental.cc: Include "output.h".
11579 (Incremental_checker::can_incrementally_link_output_file): New
11581 * incremental.h (Incremental_checker): New class.
11583 * output.cc (Output_file::open_for_modification): New method.
11584 (Output_file::map_anonymous): Changed return type to bool. Record
11585 map in base_ field.
11586 (Output_file::map_no_anonymous): New method, broken out of map.
11587 (Output_file::map): Use map_no_anonymous and map_anonymous.
11588 * output.h (class Output_file): Update declarations.
11590 2009-08-24 Cary Coutant <ccoutant@google.com>
11592 * options.h (Command_line::Pre_options): New class.
11593 (Command_line::pre_options): New member.
11594 * options.cc (gold::options::ready_to_register): New variable.
11595 (One_option::register_option): Do nothing if not registering options.
11596 Assert if same short option registered twice.
11597 (General_options::General_options): Turn off option registration when
11599 (Command_line::Pre_options::Pre_options): New constructor.
11601 2009-08-24 Cary Coutant <ccoutant@google.com>
11603 * options.h (General_options::no_keep_memory): Remove incorrect
11606 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
11608 * Makefile.am (am__skiplex, am__skipyacc): New.
11609 * Makefile.in: Regenerate.
11611 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
11613 * Makefile.am (AM_CPPFLAGS): Renamed from ...
11614 (INCLUDES): ... this.
11615 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11616 (AM_CPPFLAGS): Renamed from ...
11617 (INCLUDE): ... this.
11618 * Makefile.in, testsuite/Makefile.in: Regenerate.
11620 * Makefile.in: Regenerate.
11621 * aclocal.m4: Likewise.
11622 * config.in: Likewise.
11623 * configure: Likewise.
11624 * testsuite/Makefile.in: Likewise.
11626 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11627 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11628 * Makefile.in: Regenerate.
11629 * testsuite/Makefile.in: Regenerate.
11631 2009-08-19 Cary Coutant <ccoutant@google.com>
11633 * resolve.cc (Symbol_table::resolve): Don't complain about defined
11634 symbols in shared libraries overridden by hidden or internal symbols
11635 in the main program.
11637 2009-08-19 Chris Demetriou <cgd@google.com>
11639 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11640 checking source file names in error messages.
11642 2009-08-18 Doug Kwan <dougkwan@google.com>
11644 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11645 an elcpp::Ehdr as parameter. Adjust call to set_target.
11646 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11647 an elfcpp::Ehdr as parameter.
11648 * object.cc (Object::set_target): Remove the version that looks up
11649 a target and sets it.
11650 (Sized_relobj::setup): Take a Target object instead of
11651 an elfcpp::Ehdr as parameter. Adjust call to set_target.
11652 (make_elf_sized_object): Find target and ask target to
11653 make an ELF object.
11654 * object.h: (Object::set_target): Remove the version that looks up
11655 a target and sets it.
11656 (Sized_relobj::setup): Take a Target object instead of
11657 an elfcpp:Ehdr as parameter.
11658 * target.cc: Include dynobj.h.
11659 (Target::do_make_elf_object_implementation): New.
11660 (Target::do_make_elf_object): New.
11661 * target.h (Target::make_elf_object): New template declaration.
11662 (Target::do_make_elf_object): New method declarations.
11663 (Target::do_make_elf_object_implementation): New template declaration.
11665 2009-08-14 Ian Lance Taylor <iant@google.com>
11667 * gold.h (FUNCTION_NAME): Define.
11668 (gold_unreachable): Use FUNCTION_NAME.
11670 2009-08-12 Sriraman Tallam <tmsriram@google.com>
11672 * icf.cc (Icf::find_identical_sections): Issue a warning when a
11673 symbol in the --keep-unique list is not found.
11675 2009-08-12 Sriraman Tallam <tmsriram@google.com>
11677 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11678 been maked as --keep-unique.
11679 (Icf::unfold_section): New function.
11680 * icf.h (Icf::unfold_section): New function.
11681 * options.h (General_options::keep_unique): New option.
11682 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11683 * testsuite/Makefile.in: Regenerate.
11684 * testsuite/icf_keep_unique_test.sh: New file.
11685 * testsuite/icf_keep_unique_test.cc: New file.
11687 2009-08-12 Cary Coutant <ccoutant@google.com>
11690 * resolve.cc (Symbol_table::resolve): Check for references from
11691 dynamic objects to hidden and internal symbols.
11692 * testsuite/Makefile.am (hidden_test.sh): New test.
11693 * testsuite/Makefile.in: Regenerate.
11694 * testsuite/hidden_test.sh: New script.
11695 * testsuite/hidden_test_1.c: New test source.
11696 * testsuite/hidden_test_main.c: New test source.
11698 2009-08-11 Doug Kwan <dougkwan@google.com>
11700 * arm.cc: Update comments.
11701 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11702 segment to locate the .ARM.exidx section if present.
11704 2009-08-09 Doug Kwan <dougkwan@google.com>
11706 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11709 2009-08-07 Sriraman Tallam <tmsriram@google.com>
11710 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11713 2009-08-06 Sriraman Tallam <tmsriram@google.com>
11715 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11716 valid tls_segment only for non-debug-section relocations.
11717 * testsuite/Makefile.am: Add gc_tls_test.
11718 * testsuite/Makefile.in: Regenerate.
11719 * testsuite/gc_tls_test.cc: New file.
11720 * testsuite/gc_tls_test.sh: New file.
11722 2009-08-05 Sriraman Tallam <tmsriram@google.com>
11724 * icf.cc: New file.
11726 * Makefile.am (CCFILES): Add icf.cc.
11727 (HFILES): Add icf.h
11728 * Makefile.in: Regenerate.
11729 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11730 * gc.h (gc_process_relocs): Populate lists used by icf to contain
11731 section, symbol and addend information for the relocs.
11732 * gold.cc (queue_middle_tasks): Call identical code folding.
11733 * gold.h: Add defines for multimap.
11734 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11735 to the call of finalize_local_symbols.
11736 * main.cc (main): Create object of class Icf.
11737 * object.cc (Sized_relobj::do_layout): Allow this function to be
11738 called twice during icf.
11739 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11740 to sections marked as identical by icf.
11741 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11743 (Sized_relobj::do_section_entsize): New function.
11744 * object.h (Object::section_entsize): New function.
11745 (Object::do_section_entsize): New pure virtual function.
11746 (Relobj::finalize_local_symbols): Add new parameter.
11747 (Relobj::do_section_entsize): New function.
11748 * options.h (General_options::icf): New option.
11749 (General_options::icf_iterations): New option.
11750 (General_options::print_icf_sections): New option.
11751 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11752 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11753 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11755 * symtab.cc (Symbol_table::is_section_folded): New function.
11756 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
11757 to sections marked as identical by icf.
11758 * symtab.h (Symbol_table::set_icf): New function.
11759 (Symbol_table::icf): New function.
11760 (Symbol_table::is_section_folded): New function.
11761 (Symbol_table::icf_): New data member.
11762 * target-reloc.h (relocate_section): Ignore sections folded by icf.
11763 * testsuite/Makefile.am: Add commands to build icf_test.
11764 * testsuite/Makefile.in: Regenerate.
11765 * testsuite/icf_test.sh: New file.
11766 * testsuite/icf_test.cc: New file.
11768 2009-07-24 Chris Demetriou <cgd@google.com>
11770 * layout.cc (is_compressible_debug_section): Fix incorrect
11771 comment about compressed section names.
11773 2009-07-20 Ian Lance Taylor <ian@airs.com>
11776 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11778 2009-07-16 Ian Lance Taylor <iant@google.com>
11781 * layout.h: #include <map>.
11782 (class Kept_section): Change from struct to class. Add accessors
11783 and setters. Add section size to Comdat_group mapping. Change
11784 Comdat_group to std::map. Add is_comdat_ field. Add
11785 linkonce_size field in union.
11786 (class Layout): Update declaration of find_or_add_kept_section.
11787 Don't declare find_kept_object.
11788 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11789 parameter. Add object, shndx, is_comdat, and is_group_name
11790 parameters. Change all callers. Adjust for new Kept_section.
11791 (Layout::find_kept_object): Remove.
11792 * object.cc (Sized_relobj::include_section_group): Update use of
11793 Kept_section. Rename secnum to shndx. Only record
11794 Kept_comdat_section if sections are the same size.
11795 (Sized_relobj::include_linkonce_section): Update use of
11796 Kept_section. Only record Kept_comdat_section if sections are the
11797 same size. Set size of linkonce section.
11798 (Sized_relobj::map_to_kept_section): Update call to
11799 get_kept_comdat_section.
11800 * object.h (class Sized_relobj): Rename fields in
11801 Kept_comdat_section to drop trailing underscores; change object
11802 field to Relobj*. Change Kept_comdat_section_table to store
11803 struct rather than pointer.
11804 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11805 Add kept_object and kept_shndx parameters. Change all callers.
11806 (Sized_relobj::get_kept_comdat_section): Change return type to
11807 bool. Add kept_object and kept_shndx parameters. Change all
11809 * plugin.cc (Pluginobj::include_comdat_group): Update call to
11810 Layout::find_or_add_kept_section.
11812 2009-07-09 Ian Lance Taylor <iant@google.com>
11814 * merge.cc (Object_merge_map::initialize_input_to_output_map):
11815 Reserve space in the hash table.
11817 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
11819 * fileread.cc (File_read::get_mtime): New method.
11820 * fileread.h (Timespec): New structure.
11821 (File_read::get_mtime): New method.
11822 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11823 Renamed from timestamp_nsec.
11824 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11826 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11828 (Incremental_inputs::report_archive): Save mtime; style fix.
11829 (Incremental_inputs::report_obejct): Save mtime; style fix.
11830 (Incremental_inputs::report_script): Save mtime; style fix.
11831 (Incremental_inputs::finalize_inputs): Style fix.
11832 (Incremental_inputs::finalize): Style fix.
11833 (Incremental_inputs::create_input_section_data): Store inputs
11835 * incremental.h (Incremental_inputs::report_script): Add mtime
11837 (Incremental_inputs::Input_info::Input_info): Intialize only one
11839 (Incremental_inputs::Input_info::archive): Move to nameless
11841 (Incremental_inputs::Input_info::obejct): Move to nameless union.
11842 (Incremental_inputs::Input_info::script): Move to nameless union.
11843 (Incremental_inputs::mtime): New field.
11844 * script.cc (read_input_script): Pass file mtime to
11846 * script.h (Script_info::inputs): Style fix.
11848 2009-07-01 Ian Lance Taylor <ian@airs.com>
11850 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11853 2009-06-24 Ian Lance Taylor <iant@google.com>
11856 * layout.cc (Layout::choose_output_section): If we find an
11857 existing section, update the flags.
11858 (Layout::create_notes): New function, broken out of
11860 (Layout::finalize): Don't create note sections.
11861 (Layout::create_note): Don't crash if linker script discards
11863 (Layout::create_gold_note): Likewise.
11864 (Layout::create_build_id): Likewise. Don't set
11865 after_input_sections on the section.
11866 (Layout::create_executable_stack_info): Remove target parameter.
11868 * layout.h (class Layout): Declare create_notes. Update
11869 declaration of create_executable_stack_info.
11870 * gold.cc (queue_middle_tasks): Call create_notes.
11871 * output.cc (Output_section::update_flags_for_input_section): Move
11872 here from output.h. If SHF_ALLOC flag is newly set, mark address
11874 * output.h (Output_data::mark_address_invalid): New function.
11875 (class Output_section): Only declare, not define,
11876 update_flags_for_input_section. Remove set_flags.
11878 2009-06-24 Ian Lance Taylor <iant@google.com>
11880 * script-sections.cc (Output_section_definition::
11881 set_section_addresses): Rename shadowing local load_address to
11884 2009-06-24 Ian Lance Taylor <iant@google.com>
11887 * reloc.cc (relocate_sections): Skip empty relocation sections.
11889 2009-06-23 Ian Lance Taylor <iant@google.com>
11892 * layout.cc (Layout::create_note): Use choose_output_section
11893 rather than make_output_section.
11895 2009-06-23 Ian Lance Taylor <iant@google.com>
11898 * options.cc (General_options::parse_V): Set printed_version_.
11899 (General_options::General_options): Initialize printed_version_.
11900 * options.h (class General_options): Add printed_version_ field.
11901 * gold.cc (queue_initial_tasks): If there are no input files,
11902 don't give a fatal error if we printed the version information.
11903 (queue_middle_tasks): If using -r with a shared object, give a
11904 fatal error rather than an ordinary error.
11906 2009-06-23 Ian Lance Taylor <iant@google.com>
11909 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11910 (Layout::make_output_section): Set have_stabstr_section_ if we see
11911 a .stab*str section.
11912 (Layout::finalize): Call link_stabs_sections.
11913 (Layout::link_stabs_sections): New file.
11914 * layout.h (class Layout): Add have_stabstr_section_ field.
11915 Declare link_stabs_sections.
11917 2009-06-23 Doug Kwan <dougkwan@google.com>
11919 * Makefile.am (libgold_a_LIBADD): New.
11920 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11921 * Makefile.in: Regenerate.
11922 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11923 * configure: Regenerate.
11924 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11925 * fileread.cc: Include sys/state.h
11926 * gold.h: Declare memmem and strndup if found missing.
11927 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11929 2009-06-23 Ian Lance Taylor <iant@google.com>
11931 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11932 * configure: Rebuild.
11934 2009-06-23 Ian Lance Taylor <iant@google.com>
11937 * object.cc (Object::section_contents): Don't try to get a view if
11938 the section has length zero.
11939 (Object::handle_gnu_warning_section): If the section is empty, use
11940 the name of the section as the warning.
11942 2009-06-23 Ian Lance Taylor <iant@google.com>
11945 * stringpool.h (class Stringpool_template): Add optimize_ field.
11946 (Stringpool_template::set_optimize): New function.
11947 * stringpool.cc (Stringpool_template::Stringpool_template):
11948 Initialize optimize_ field.
11949 (Stringpool_template::set_string_offsets): Test local optimize
11950 fild rather than parameter.
11951 * layout.cc (Layout::Layout): Call set_optimize on the section
11954 2009-06-22 Ian Lance Taylor <iant@google.com>
11957 * yyscript.y: Parse TARGET.
11958 * script.cc (script_set_target): New function.
11959 * script-c.h (script_set_target): Declare.
11960 * options.cc (General_options::string_to_object_format): Rename
11961 from string_to_object_format in anonymous namespace. Change
11963 * options.h (class General_options): Declare
11964 string_to_object_format.
11966 2009-06-22 Ian Lance Taylor <iant@google.com>
11968 * script-sections.cc (Script_sections::create_segments): Don't put
11969 program headers in a PT_LOAD segment if -n or -N.
11971 2009-06-22 Ian Lance Taylor <iant@google.com>
11974 * options.h (class General_options): Add -z lazy and -z now. Sort
11975 -z options into alphabetical order.
11976 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11978 2009-06-21 Ian Lance Taylor <iant@google.com>
11980 * layout.cc (Layout::make_output_section): Call
11981 Target::new_output_section.
11982 (Layout::attach_allocated_section_to_segment): Put large section
11983 sections in a separate load segment with the large segment flag
11985 (Layout::segment_precedes): Sort large data segments after other
11987 (align_file_offset): New static function.
11988 (Layout::set_segment_offsets): Use align_file_offset.
11989 * output.h (class Output_section): Add is_small_section_ and
11990 is_large_section_ fields.
11991 (Output_section::is_small_section): New function.
11992 (Output_section::set_is_small_section): New function.
11993 (Output_section::is_large_section): New function.
11994 (Output_section::set_is_large_section): New function.
11995 (Output_section::is_large_data_section): New function.
11996 (class Output_segment): Add is_large_data_segment_ field.
11997 (Output_segment::is_large_data_segment): New function.
11998 (Output_segment::set_is_large_data_segment): New function.
11999 * output.cc (Output_section::Output_section): Initialize new
12001 (Output_segment::Output_segment): Likewise.
12002 (Output_segment::add_output_section): Add assertion that large
12003 data sections always go in large data segments. Force small data
12004 sections to the end of the list of data sections. Force small BSS
12005 sections to the start of the list of BSS sections. For large BSS
12006 sections to the end of the list of BSS sections.
12007 * symtab.h (class Symbol): Declare is_common_shndx.
12008 (Symbol::is_defined): Check Symbol::is_common_shndx.
12009 (Symbol::is_common): Likewise.
12010 (class Symbol_table): Define enum Commons_section_type. Update
12011 declarations. Add small_commons_ and large_commons_ fields.
12012 * symtab.cc (Symbol::is_common_shndx): New function.
12013 (Symbol_table::Symbol_table): Initialize new fields.
12014 (Symbol_table::add_from_object): Put small and large common
12015 symbols in the right list.
12016 (Symbol_table::sized_finalized_symbol): Check
12017 Symbol::is_common_shndx.
12018 (Symbol_table::sized_write_globals): Likewise.
12019 * common.cc (Symbol_table::do_allocate_commons): Allocate new
12020 common symbol lists. Don't call do_allocate_commons_list if the
12022 (Symbol_table::do_allocate_commons_list): Remove is_tls
12023 parameter. Add comons_section_type parameter. Change all
12024 callers. Handle small and large common symbols.
12025 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12026 Symbol::is_common_shndx.
12027 * resolve.cc (symbol_to_bits): Likewise.
12028 * target.h (Target::small_common_shndx): New function.
12029 (Target::small_common_section_flags): New function.
12030 (Target::large_common_shndx): New function.
12031 (Target::large_common_section_flags): New function.
12032 (Target::new_output_section): New function.
12033 (Target::Target_info): Add small_common_shndx, large_common_shndx,
12034 small_common_section_flags, and large_common_section_flags
12036 (Target::do_new_output_section): New virtual function.
12037 * arm.cc (Target_arm::arm_info): Initialize new fields.
12038 * i386.cc (Target_i386::i386_info): Likewise.
12039 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12041 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12042 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12043 (Target_x86_64::do_new_output_section): New function.
12044 * configure.ac: Define conditional MCMODEL_MEDIUM.
12045 * testsuite/Makefile.am (check_PROGRAMS): Add large.
12046 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12047 (large_LDFLAGS): Define.
12048 * testsuite/large.c: New file.
12049 * testsuite/testfile.cc (Target_test::test_target_info):
12050 Initialize new fields.
12051 * configure, testsuite/Makefile.in: Rebuild.
12053 2009-06-05 Doug Kwan <dougkwan@google.com>
12055 * Makefile.am (CCFILES): Add target.cc.
12056 * Makefile.in: Regenerate.
12057 * i386.cc (class Target_i386): Define new virtual method to
12058 override do_is_local_label_name in parent.
12059 * object.cc (Sized_relobj::do_count_local_symbols): Discard
12060 local symbols if --discard-locals or -X is given.
12061 * options.h (class General_options): Declare new options
12062 '--discard-locals' and '-X' for discarding locals.
12063 * target.h (class Target): Define new methods is_local_label_name.
12064 Declare new virtual method do_is_local_label_name.
12065 * target.cc: New file.
12066 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12067 (check_SCRIPTS): Add discard_locals_test.sh.
12068 (check_DATA): Add discard_local_tests.syms.
12069 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12070 (discard_local_tests.syms, discard_locals_test.o): New make rules.
12071 * testsuite/Makefile.in: Regenerate.
12072 * testsuite/discard_locals_test.c: New file.
12073 * testsuite/discard_locals_test.sh: Same.
12075 2009-06-05 Doug Kwan <dougkwan@google.com>
12077 * object.cc (Sized_relobj::Sized_relobj): Initialize
12078 discarded_eh_frame_shndx_ to -1U.
12079 (Sized_relobj::do_layout): Record index of a discard .eh_frame
12081 (Sized_relobj::do_count_local_symbols): Skip local symbols in
12082 a discarded .eh_frame section.
12083 (Sized_relobj::do_finalize_local_symbols): Ditto.
12084 * object.h (class Sized_relobj): Declare new member
12085 discarded_eh_frame_shndx_.
12086 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12087 (local_labels_test.o, local_labels_test): New rules.
12088 * testsuite/Makefile.in: Regenerate.
12090 2009-06-04 Doug Kwan <dougkwan@google.com>
12092 * layout.cc (Layout::section_name_mapping): Add mapping for
12093 special ARM sections.
12095 2009-06-03 Doug Kwan <dougkwan@google.com>
12097 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12098 (utils::has_overflow): Same.
12100 2009-06-03 Ian Lance Taylor <iant@google.com>
12102 * layout.cc (Layout::section_name_mapping): New array, replacing
12103 Layout::linkonce_mapping.
12104 (Layout::section_name_mapping_count): New variable, replacing
12105 Layout::linkonce_mapping_count.
12106 (Layout::linkonce_output_name): Remove.
12107 (Layout::output_section_name): Rewrite.
12108 * layout.h (class Layout): Rename Linkonce_mapping to
12109 Section_name_mapping, linkonce_mapping to section_name_mapping,
12110 linkonce_mapping_count to section_name_mapping_count. Don't
12111 declare linkonce_output_name.
12113 2009-06-03 Doug Kwan <dougkwan@google.com>
12115 * gold/arm.cc (namespace utils): New.
12116 (Target_arm::reloc_is_non_pic): Define new method.
12117 (class Arm_relocate_functions): New.
12118 (Target_arm::Relocate::relocate): Handle relocation types used by
12121 2009-06-03 Ian Lance Taylor <iant@google.com>
12123 * arm.cc (Target_arm::scan::global): Use || instead of |.
12125 2009-06-02 Doug Kwan <dougkwan@google.com>
12127 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
12128 issued_non_pic_error_.
12129 (class Target_arm::Scan): Declare new method check_non_pic.
12130 Define new method symbol_needs_plt_entry.
12131 Declare new data member issued_non_pic_error_.
12132 (class Target_arm::Relocate): Declare new method
12133 should_apply_static_reloc.
12134 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12135 (Target_arm::Scan::check_non_pic): Define new method.
12136 (Target_arm::Scan::local): Handle a small subset of reloc types used
12138 (Target_arm::Scan::local): Same.
12139 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12141 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
12143 * incremental.cc (Incremental_inputs::report_command_line): Filter
12144 out --incremental-* options.
12146 2009-05-29 Doug Kwan <dougkwan@google.com>
12148 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12150 (class Target_arm): Update comment.
12151 (Target_arm::Target_arm): Initialize new data members GOT_,
12152 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12153 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12154 and Target_arm::rel_dyn_section.
12155 Declare new_enum Target_arm::Got_type.
12156 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12158 Update commments for member do_dynsym_value.
12159 (Target_arm::got_size, Target_arm::plt_section,
12160 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12161 new methods inside class defintion.
12162 (Target_arm::got_section): Define new method.
12163 (Target_arm::rel_dyn_section): Same.
12164 (Output_data_plt_arm): New template class.
12165 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12166 (Output_data_plt_arm:do_adjust_output_section): Define new method.
12167 (Output_data_plt_arm::add_entry): Same.
12168 (Output_data_plt_arm::first_plt_entry): Define new
12169 static data member for PLT instruction template.
12170 (Output_data_plt_arm::plt_entry): Same.
12171 (Output_data_plt_arm::do_write): Define new method.
12172 (Target_arm::make_plt_entry): Same.
12173 (Target_arm::do_finalize_sections): Same.
12174 (Target_arm::do_dynsym_value): Same.
12176 2009-05-28 Doug Kwan <dougkwan@google.com>
12178 * Makefile.am (TARGETSOURCES): Add arm.cc.
12179 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12180 * Makefile.in: Regenerate.
12181 * arm.cc: New file.
12182 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12184 2009-05-26 Doug Kwan <dougkwan@google.com>
12186 * options.cc (General_options::parse_exclude_libs). Fix a comment.
12187 (General_options::check_excluded_libs): Strip off directories in
12188 archive name before matching like GNU ld does.
12189 * testsuite/Makefile.am (MOSTLYCLEANFILES,
12190 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12191 (exclude_libs_test_LDFLAGS): Add linker option
12192 -Wl,--exclude-libs,libexclude_libs_test_3
12193 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12194 an explicit archive without using -l.
12195 (alt/libexclude_libs_test_3.a): New make rule.
12196 * testsuite/Makefile.in: Regenerate.
12197 * testsuite/exclude_libs_test.c : Declare lib3_default().
12199 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12200 * exclude_libs_test_3.c: New file.
12202 2009-05-26 Nick Clifton <nickc@redhat.com>
12204 * po/id.po: New Indonesian translation.
12205 * po/gold.pot: Updated template file.
12207 2009-05-22 Sriraman Tallam <tmsriram@google.com>
12209 * testsuite/Makefile.am: Add -ffunction-sections to compile
12210 gc_comdat_test files. Add -Wl,--gc-sections to build
12212 * testsuite/Makefile.in: Regenerate.
12213 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12215 2009-05-21 Sriraman Tallam <tmsriram@google.com>
12217 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12218 kept comdat section was garbage collected.
12219 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12220 * testsuite/Makefile.in: Regenerate.
12221 * testsuite/gc_comdat_test.sh: New file.
12222 * testsuite/gc_comdat_test_1.cc: New file.
12223 * testsuite/gc_comdat_test_2.cc: New file.
12225 2009-05-19 Doug Kwan <dougkwan@google.com>
12227 * archive.cc (Archive::Archive): Move constructor from archive.h
12228 to here. Initialize no_export_.
12229 (Archive::get_elf_object_for_member): Set no_export flag of object.
12230 * archive.h (Archive::Archive): Move constructor body to
12232 (Archive::no_export): New method.
12233 (Archive::no_export_): New field.
12234 * object.h (Object::Object): Initialize no_export_ to false.
12235 (Object::no_export, Object::set_no_export): New methods.
12236 (Object::no_export_): New field.
12237 * options.cc (General_options::parse_exclude_libs): New method.
12238 (General_options::check_excluded_libs) Same.
12239 * options.h (exclude_libs): New option.
12240 (General_options::check_excluded_libs): New method declaration.
12241 (General_options::excluded_libs_): New field.
12242 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12243 default or protected visibility if an object has no-export flag set.
12244 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12245 (check_SCRIPTS): Add exclude_libs_test.sh.
12246 (check_DATA): Add exclude_libs_test.syms.
12247 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12248 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12249 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12250 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12251 (exclude_libs_test.syms, libexclude_libs_test_1.a,
12252 libexclude_libs_test_2.a): New rules.
12253 * testsuite/Makefile.in: Regenerate.
12254 * testsuite/exclude_libs_test.c: New file.
12255 * testsuite/exclude_libs_test.sh: Ditto.
12256 * testsuite/exclude_libs_test_1.c: Ditto.
12257 * testsuite/exclude_libs_test_2.c: Ditto.
12259 2009-05-15 Ian Lance Taylor <iant@google.com>
12261 * configure.ac: Check for declarations for cases where libiberty.h
12262 checks HAVE_DECL_xxx.
12263 * configure, config.in: Rebuild.
12265 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
12267 * gold.h (Incremental_argument_list): Remove (invalid) forward
12269 * incremental.cc (Incremental_inputs::report_achive): New method.
12270 (Incremental_inputs::report_object): New method.
12271 (Incremental_inputs::report_script): New method.
12272 (Incremental_inputs::finalize_inputs): New method.
12273 (Incremental_inputs::finalize): Call finalize_inputs().
12274 (Incremental_inputs::sized_create_incremental_inputs_section_data):
12275 Create inputs entries.
12276 * incremental.h (Incremental_input_type): New enum.
12277 (Incremental_inputs::Incremental_input): Initialize new fields.
12278 (Incremental_inputs::report_inputs): New method.
12279 (Incremental_inputs::report_achive): New method.
12280 (Incremental_inputs::report_object): New method.
12281 (Incremental_inputs::report_script): New method.
12282 (Incremental_inputs::finalize_inputs): New method.
12283 (Incremental_inputs::Input_info): New struct.
12284 (Incremental_inputs::Input_info_map): New typedef.
12285 (Incremental_inputs::lock_): New field.
12286 (Incremental_inputs::Inputs_): New field.
12287 (Incremental_inputs::Inputs_map): New field.
12288 * main.cc (main): Call Incremental_input::report_inputs.
12289 * options.h (Input_argument_list): Typedef moved from
12291 (Input_file_group::Files): Remove, use ::Input_argument_list.
12292 (Input_file_group::Input_argument_list): Remove, use
12293 ::Input_argument_list.
12294 * plugin.cc (Plugin_manager::add_input_file): Add error in
12296 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12298 * script.cc (read_input_script): Call
12299 Incremental_input::report_script.
12300 * script.h (Script_info): New class.
12302 2009-04-27 Ian Lance Taylor <iant@google.com>
12304 * x86_64.cc (do_adjust_output_section): Set entsize to
12307 2009-04-23 Elliott Hughes <enh@google.com>
12309 * output.cc (Output_file::close): After short writes, continue
12310 writing from the correct offset in the buffer being written.
12312 2009-04-23 Chris Demetriou <cgd@google.com>
12314 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12315 * configure: Regenerate.
12316 * config.in: Regenerate.
12317 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12318 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12320 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
12322 * incremental.cc (Incremental_inputs_header_data): Renamed from
12323 Incremental_input_header_data.
12324 (Incremental_inputs_header_data::data_size): New field.
12325 (Incremental_inputs_header_data::put_input_file_count): Renamed
12326 from input_file_count.
12327 (Incremental_inputs_header_data::put_command_line_offset): Renamed
12328 from command_line_offset.
12329 (Incremental_inputs_header_data::put_reserved): Renamed from
12331 (Incremental_inputs_entry_data): Renamed from
12332 Incremental_input_entry_data.
12333 (Incremental_inputs_entry_data::data_size): New field.
12334 (Incremental_inputs::report_command_line): New method.
12335 (Incremental_inputs::finalize): New method.
12336 (Incremental_inputs::create_incremental_inputs_data): New method.
12337 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12338 * incremental.h: New file.
12339 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12340 (Layout::finalize): Create incremental inputs section in
12341 incremental builds.
12342 (Layout::create_incremental_info_sections): New method.
12343 * layout.h (Layout::incremental_inputs): New method.
12344 (Layout::create_incremental_info_sections): New method.
12345 (Layout::incremental_inputs_): New field.
12346 * main.cc (main): Notify Incremental_input of the command line.
12348 2009-04-01 Ian Lance Taylor <iant@google.com>
12349 Mikolaj Zalewski <mikolajz@google.com>
12351 * gold.h (reserve_unordered_map): Define, three versions, one for
12352 each version of Unordered_map.
12353 * layout.cc (Layout::Layout): Remove options parameter. Add
12354 number_of_input_files parameter. Don't initialize options_.
12355 Initialize number_of_input_files_ and resized_signatures_. Move
12356 sections_are_attached_.
12357 (Layout::layout_group): Reserve space for group_signatures_.
12358 (Layout::find_or_add_kept_section): Change name parameter to be a
12359 reference. Resize signatures_ map when it gets large enough.
12360 (Layout::layout_eh_frame): Use parameters->options() instead of
12362 (Layout::make_output_section): Likewise.
12363 (Layout::attach_allocated_section_to_segment): Likewise.
12364 (Layout::finalize, Layout::create_executable_stack): Likewise.
12365 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12366 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12367 * layout.h (class Layout): Update declarations. Remove options_
12368 field. Add number_of_input_files_ and resized_signatures_
12369 fields. Move sections_are_attached_ field.
12370 * main.cc (main): Pass number of input files to Layout
12371 constructor. Don't pass options.
12373 2009-03-30 Ian Lance Taylor <iant@google.com>
12375 * ffsll.c (ffsll): Correct implementation.
12377 2009-03-27 Ian Lance Taylor <iant@google.com>
12379 * ffsll.c: New file.
12380 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12381 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12382 * ftruncate.c (ftruncate): Declare before definition.
12383 * mremap.c (mremap): Likewise.
12384 * pread.c (pread): Likewise.
12385 * configure, Makefile.in, config.in: Rebuild.
12387 * mremap.c: New file.
12388 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12389 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12390 (mremap): Declare if HAVE_MREMAP is not defined.
12391 * configure, Makefile.in, config.in: Rebuild.
12393 2009-03-27 Cary Coutant <ccoutant@google.com>
12395 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12396 position independent.
12397 * sparc.cc (Target_sparc::check_non_pic): Likewise.
12398 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12400 2009-03-24 Cary Coutant <ccoutant@google.com>
12402 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12404 (needs_dynamic_reloc): Likewise.
12406 2009-03-24 Ian Lance Taylor <iant@google.com>
12408 * yyscript.y (file_cmd): Recognize EXTERN.
12409 (extern_name_list, extern_name_list_body): New nonterminals.
12410 * script.cc (script_add_extern): Define.
12411 * script-c.h (script_add_extern): Declare.
12413 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
12415 * object.cc (is_elf_object): Define.
12416 * object.h (is_elf_object): Declare.
12417 * archive.cc (Archive::get_elf_object_for_member): Call
12419 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12421 2009-03-24 Elliott Hughes <enh@google.com>
12423 * output.cc (Output_file::map_anonymous): Define.
12424 (Output_file::map): Use map_anonymous. If the regular mmap fails,
12425 try an anonymous one. Report the size if the mmap fails.
12426 * output.h (class Output_file): Declare map_anonymous.
12428 2009-03-24 Ian Lance Taylor <iant@google.com>
12430 * target-select.cc (instantiate_target): Don't acquire the lock if
12431 the instantiated_target_ field has already been set.
12433 2009-03-23 Ian Lance Taylor <iant@google.com>
12435 * gold-threads.h (class Initialize_lock): Define.
12436 * gold-threads.cc (class Initialize_lock_once): Define.
12437 (initialize_lock_control): New static variable.
12438 (initialize_lock_pointer): New static variable.
12439 (initialize_lock_once): New static function.
12440 (Initialize_lock::Initialize_lock): Define.
12441 (Initialize_lock::initialize): Define.
12442 * target-select.h: Include "gold-threads.h".
12443 (class Target_selector): Add lock_ and initialize_lock_ fields.
12444 Don't define instantiate_target, just declare it.
12445 * target-select.cc (Target_selector::Target_selector): Initialize
12447 (Target_selector::instantiate_target): Define.
12448 * descriptors.h: Include "gold-threads.h".
12449 (class Descriptors): Add initialize_lock_ field.
12450 * descriptors.cc (Descriptors::Descriptors): Initialize new
12452 (Descriptors::open): Use initialize_lock_ field
12453 * errors.h (class Errors): Add initialize_lock_ field.
12454 * errors.cc (Errors::Errors): Initialize new field.
12455 (Errors::initialize_lock): Use initialize_lock_ field.
12456 * powerpc.cc (class Target_selector_powerpc): Remove
12457 instantiated_target_ field. In do_recognize call
12458 instantiate_target rather than do_instantiate_target. In
12459 do_instantiate_target just allocate a new target.
12460 * sparc.cc (class Target_selector_sparc): Likewise.
12462 * freebsd.h: New file.
12463 * i386.cc: Include "freebsd.h".
12464 (Target_i386): Derive from Target_freebsd rather than
12466 (Target_selector_i386): Derive from Target_selector_freebsd rather
12467 than Target_selector.
12468 * x86_64.cc: Include "freebsd.h".
12469 (Target_x86_64): Derive from Target_freebsd rather than
12471 (Target_selector_x86_64): Derive from Target_selector_freebsd
12472 rather than Target_selector.
12473 * target.h (class Target): Add adjust_elf_header and
12474 do_adjust_elf_header.
12475 * output.cc (Output_file_header:: do_sized_write): Call target
12476 adjust_elf_header routine.
12477 * configure.tgt: Set targ_osabi.
12478 * configure.ac: Define GOLD_DEFAULT_OSABI.
12479 * parameters.cc (Parameters::default_target): Pass
12480 GOLD_DEFAULT_OSABI to select_target.
12481 * target-select.h (class Target_selector): Make instantiate_target
12482 protected rather than private.
12483 * Makefile.am (HFILES): Add freebsd.h.
12484 * configure, Makefile.in, config.in: Rebuild.
12486 * merge.cc (do_add_input_section): Correct pend value. Change
12487 message about last entry not being null terminated from error to
12490 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
12492 * incremental.cc: New file.
12493 * Makefile.am (CCFILES): Add incremental.cc.
12494 * Makefile.in: Rebuild.
12496 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
12498 * layout.cc (Layout::output_section_name): Preserve names
12499 of '.note.' sections.
12501 2009-03-19 Ian Lance Taylor <iant@google.com>
12503 * descriptors.cc (Descriptors::open): Check that the options are
12504 valid before using them.
12506 2009-03-18 Ian Lance Taylor <iant@google.com>
12508 * script-sections.h: Include <list>.
12509 (class Script_sections): Change Sections_elements from std::vector
12510 to std::list. Typedef public Elements_iterator. Add
12511 orphan_section_placement_, data_segment_align_start_, and
12512 saw_data_segment_align_ fields. Remove data_segment_align_index_
12514 * script-sections.cc (class Orphan_section_placement): New class.
12515 (class Sections_element): Add virtual functions is_relro and
12516 orphan_section_init. Remove virtual function place_orphan_here.
12517 (class Output_section_definition): Add is_relro and
12518 orphan_section_init. Remove place_orphan_here.
12519 (class Orphan_output_section): Likewise.
12520 (Script_sections::Script_sections): Update for field changes.
12521 (Script_sections::data_segment_align): Set saw_data_segment_align_
12522 and data_segment_align_start_, not data_segment_align_index.
12523 (Script_sections::data_segment_relro_end): Check
12524 saw_data_segment_align_. Use data_segment_align_start_ rather
12525 than data_segment_align_index_.
12526 (Script_sections::place_orphan): Rewrite to use
12527 Orphan_section_placement.
12529 2009-03-17 Ian Lance Taylor <iant@google.com>
12531 * archive.cc (Archive::add_symbols): Check for a version attached
12532 to the symbol name in the archive map.
12533 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12534 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12535 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12536 (ver_test_11.a): New target.
12537 * testsuite/Makefile.in: Rebuild.
12539 * configure.ac: Check for chsize and posix_fallocate. Replace
12541 * ftruncate.c: New file, from gnulib.
12542 * output.cc (posix_fallocate): Define dummy version if not
12543 HAVE_POSIX_FALLOCATE.
12544 (Output_file::map): Call posix_fallocate rather than lseek and
12546 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12547 * configure, Makefile.in, config.in: Rebuild.
12549 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
12551 * layout.h (Layout::create_note): Add section_name parameter.
12552 * layout.cc (Layout::create_note): Likewise.
12553 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12555 2009-03-17 Ian Lance Taylor <iant@google.com>
12557 * descriptors.cc: Include "options.h".
12558 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12559 (Descriptors::open): Always use O_CLOEXEC when opening a new
12560 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
12561 then set FD_CLOEXEC.
12563 * sparc.cc (class Target_sparc): Add has_got_section.
12564 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12565 make sure we have a GOT section.
12567 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12568 (Target_sparc::Scan::local): Likewise.
12569 (Target_sparc::Scan::global): Likewise.
12570 (Target_sparc::Relocate::relocate): Likewise.
12571 (Target_sparc::Relocate::relocate_tls): Likewise.
12573 * symtab.cc (Symbol_table::define_default_version): New function,
12574 broken out of add_from_object.
12575 (Symbol_table::add_from_object): Call define_default_version.
12576 (Symbol_table::define_special_symbol): Add resolve_oldsym
12577 parameter. Change all callers. If the version for a symbol comes
12578 from a version script, resolve it with the symbol with the same
12579 name with no version. Also add the symbol without a version if
12581 (do_define_in_output_data): If resolving with oldsym, don't delete
12583 (do_define_in_output_segment): Likewise.
12584 (do_define_as_constant): Likewise.
12585 * symtab.h (class Symbol_table): Update declarations.
12587 2009-03-13 Ian Lance Taylor <iant@google.com>
12589 * readsyms.cc (Read_symbols::incompatible_warning): New function.
12590 (Read_symbols::requeue): New function.
12591 (Read_symbols::do_read_symbols): If make_elf_object fails because
12592 the target type is not configured, and the file was searched for,
12593 issue a warning and retry with the next directory.
12594 (Add_symbols::run): If the file has an incompatible format, and
12595 it was searched for, requeue the Read_symbols task. On error,
12596 release the object.
12597 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
12598 dirindex parameter to constructor. Change all callers. Declare
12599 incompatible_warning and requeue.
12600 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12601 input_argument_ and input_group_ fields. Add them to
12602 constructor. Change all callers.
12603 (class Read_script): Add dirindex_ field. Add it to constructor.
12604 Change all callers.
12605 * archive.cc (Archive::setup): Remove input_objects parameter.
12606 Change all callers.
12607 (Archive::get_file_and_offset): Likewise.
12608 (Archive::read_all_symbols): Likewise.
12609 (Archive::read_symbols): Likewise.
12610 (Archive::get_elf_object_for_member): Remove input_objects
12611 parameter. Add punconfigured parameter. Change all callers.
12612 (Archive::add_symbols): Change return type to bool. Check return
12613 value of include_member.
12614 (Archive::include_all_members): Likewise.
12615 (Archive::include_member): Change return type to bool. Return
12616 false if first included object has incompatible target. Set
12617 included_member_ field.
12618 (Add_archive_symbols::run): If add_symbols returns false, requeue
12620 * archive.h (class Archive): Add included_member_ field.
12621 Initialize it in constructor. Add input_file and searched_for
12622 methods. Update declarations.
12623 (class Add_archive_symbols): Add dirpath_, dirindex_, and
12624 input_argument_ fields. Add them to constructor. Change all
12626 * script.cc: Include "target-select.h".
12627 (class Parser_closure): Add skip_on_incompatible_target_ and
12628 found_incompatible_target_ fields. Add
12629 skip_on_incompatible_target parameter to constructor. Change all
12630 callers. Add methods skip_on_incompatible_target,
12631 clear_skip_on_incompatible_target, found_incompatible_target, and
12632 set_found_incompatible_target.
12633 (read_input_script): Add dirindex parameter. Change all callers.
12634 If parser finds an incompatible target, requeue Read_symbols
12636 (script_set_symbol): Clear skip_on_incompatible_target in
12638 (script_add_assertion, script_parse_option): Likewise.
12639 (script_start_sections, script_add_phdr): Likewise.
12640 (script_check_output_format): New function.
12641 * script.h (read_input_script): Update declaration.
12642 * script-c.h (script_check_output_format): Declare.
12643 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12644 (ignore_cmd): Remove OUTPUT_FORMAT.
12645 * fileread.cc (Input_file::Input_file): Add explicit this.
12646 (Input_file::will_search_for): New function.
12647 (Input_file::open): Add pindex parameter. Change all callers.
12648 * fileread.h (class Input_file): Add input_file_argument method.
12649 Declare will_search_for. Update declarations.
12650 * object.cc (make_elf_object): Add punconfigured parameter.
12651 Change all callers.
12652 * object.h (class Object): Make input_file public. Add
12653 searched_for method.
12654 (make_elf_object): Update declaration.
12655 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
12657 * dirsearch.h (class Dirsearch): Update declaration.
12658 * options.h (class General_options): Add --warn-search-mismatch.
12659 * parameters.cc (Parameters::is_compatible_target): New function.
12660 * parameters.h (class Parameters): Declare is_compatible_target.
12661 * workqueue.cc (Workqueue::add_blocker): New function.
12662 * workqueue.h (class Workqueue): Declare add_blocker.
12664 * fileread.cc (Input_file::open): Remove options parameter.
12665 Change all callers.
12666 (Input_file::open_binary): Likewise.
12667 * script.cc (read_input_script): Likewise.
12668 * readsyms.h (class Read_symbols): Remove options_ field. Remove
12669 options parameter from constructor. Change all callers.
12670 (class Read_script): Likewise.
12671 * fileread.h (class Input_file): Update declarations.
12672 * script.h (read_input_script): Update declaration.
12674 2009-03-10 Nick Clifton <nickc@redhat.com>
12676 * po/es.po: New Spanish translation.
12678 2009-03-06 Cary Coutant <ccoutant@google.com>
12680 * options.cc (parse_short_option): Keep dash_z from registering itself.
12682 2009-03-03 Ian Lance Taylor <iant@google.com>
12685 * target-reloc.h (relocate_section): Pass output_section to
12687 * i386.cc (Target_i386::should_apply_static_reloc): Add
12688 output_section parameter. Change all callers.
12689 (Target_i386::Relocate::relocate): Add output_section parameter.
12690 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12691 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12692 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12693 * testsuite/two_file_shared.sh: New script.
12694 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12695 (check_DATA): Add two_file_shared.dbg.
12696 (two_file_shared.dbg): New target.
12697 * testsuite/Makefile.in: Rebuild.
12699 2009-03-01 Ian Lance Taylor <iant@google.com>
12701 * configure.ac: Check for byteswap.h.
12702 * configure: Rebuild.
12703 * config.in: Rebuild.
12705 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
12707 * layout.cc (Layout::find_or_add_kept_section): New function.
12708 (Layout::add_comdat): Removed.
12709 * layout.h (struct Kept_section): Move out of class Layout.
12710 Remove trailing underscores from field names. Add group_sections
12711 field. Rename group_ field to is_group. Change all uses.
12712 (class Layout): Declare find_or_add_kept_section, not add_comdat.
12713 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12714 comdat_groups_ field.
12715 (Sized_relobj::include_section_group): Use
12716 find_or_add_kept_section and Kept_section::group_sections.
12717 (Sized_relobj::include_linkonce_section): Likewise.
12718 * object.cc (class Sized_relobj): Don't define Comdat_group or
12719 Comdat_group_table. Remove find_comdat_group and
12720 add_comdat_group. Remove comdat_groups_ field.
12721 * plugin.cc (include_comdat_group): Use
12722 Layout::find_or_add_kept_section.
12724 2009-02-28 Ian Lance Taylor <iant@google.com>
12726 * README: --gc-sections and map files are now supported. Document
12727 some build requirements.
12730 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12731 relocatable link set the value of the section symbol to zero.
12732 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12733 relocatable link don't include the section address in the local
12736 2009-02-27 Ian Lance Taylor <iant@google.com>
12739 * options.h (class Search_directory): Add is_system_directory.
12740 (class General_options): Declare is_in_system_directory.
12741 * options.cc (get_relative_sysroot): Make static.
12742 (get_default_sysroot): Make static.
12743 (General_optoins::is_in_system_directory): New function.
12744 * fileread.cc (Input_file::is_in_system_directory): New function.
12745 * fileread.h (class Input_file): Declare is_in_system_directory.
12746 * object.h (class Object): Add is_in_system_directory.
12747 (class Input_objects): Remove system_library_directory_ field.
12748 * object.cc (Input_objects::add_object): Don't set
12749 system_library_directory_.
12750 (input_objects::found_in_system_library_directory): Remove.
12751 * symtab.cc (Symbol_table::write_globals): Remove input_objects
12752 parameter. Change all callers.
12753 (Symbol_table::sized_write_globals): Likewise.
12754 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12755 Call Object::is_in_system_directory.
12756 * symtab.h (class Symbol_table): Update declarations.
12759 * descriptors.h (Open_descriptor): Add is_on_stack field.
12760 * descriptors.cc (Descriptors::open): If the descriptor is on the
12761 top of the stack, remove it. Initialize is_on_stack field.
12762 (Descriptors::release): Only add pod to stack if it is not on the
12764 (Descriptors::close_some_descriptor): Clear stack_next and
12765 is_on_stack fields.
12768 * output.cc (Output_section::find_starting_output_address): Rename
12769 from starting_output_address; add PADDR parameter; change return
12771 * output.h (class Output_section): Declare
12772 find_starting_output_address instead of starting_output_address.
12773 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12774 section symbol for which we can't find a merge section.
12777 * symtab.cc (Symbol_table::add_from_object): If the visibility is
12778 hidden or internal, force the symbol to be local.
12779 * resolve.cc (Symbol::override_visibility): Define.
12780 (Symbol::override_base): Use override_visibility.
12781 (Symbol_table::resolve): Likewise.
12782 (Symbol::override_base_with_special): Likewise.
12783 (Symbol_table::override_with_special): If the visibility is hidden
12784 or internal, force the symbol to be local.
12785 * symtab.h (class Symbol): Add set_visibility and
12786 override_visibility.
12787 * testsuite/ver_test_1.sh: New file.
12788 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12789 (check_DATA): Add ver_test_1.syms.
12790 (ver_test_1.syms): New target.
12791 * testsuite/Makefile.in: Rebuild.
12793 2009-02-25 Cary Coutant <ccoutant@google.com>
12795 * layout.cc (Layout::choose_output_section): Don't rename sections
12796 when using a linker script that has a SECTIONS clause.
12797 * Makefile.in: Regenerate.
12799 * testsuite/Makefile.am (script_test_5.sh): New test case.
12800 * testsuite/Makefile.in: Regenerate.
12801 * testsuite/script_test_5.cc: New file.
12802 * testsuite/script_test_5.sh: New file.
12803 * testsuite/script_test_5.t: New file.
12805 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
12807 * archive.cc (Archive::include_member): Update calls to add_symbols.
12808 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12809 the Layout argument.
12810 * dynobj.h (do_add_symbols): Add the Layout argument.
12811 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12813 * object.h (Object::add_symbols): Add the Layout argument.
12814 (Object::do_add_symbols): Add the Layout argument.
12815 (Sized_relobj::do_add_symbols): Add the Layout argument.
12816 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12817 Unify the two versions.
12818 (Add_plugin_symbols): Remove.
12819 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12820 (Sized_pluginobj::do_add_symbols): Unify the two versions.
12821 (Add_plugin_symbols): Remove.
12822 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12823 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12824 (Add_symbols::run): Make it work with Pulginobj.
12826 2009-02-06 Ian Lance Taylor <iant@google.com>
12828 * object.cc (Sized_relobj::do_layout): Make info message start
12829 with lower case letter.
12831 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
12833 * binary.cc: Fix file comment.
12835 * options.h (enum Incremental_disposition): Define.
12836 (class General_options): Add new options: --incremental,
12837 --incremental_changed, --incremental_unchanged,
12838 --incremental_unknown. Add incremental_disposition_ and
12839 implicit_incremental_ fields.
12840 (General_options::incremental_disposition): New function.
12841 (class Position_dependent_options): Add incremental_disposition
12843 (Position_dependent_options::copy_from_options): Set incremental
12845 * options.cc (General_options::parse_incremental_changed): New
12847 (General_options::parse_incremental_unchanged): New function.
12848 (General_options::parse_incremental_unknown): New function.
12849 (General_options::General_options): Initialize new fields
12850 incremental_disposition_ and implicit_incremental_.
12851 (General_options::finalize): Check for uasge of --incremental-*
12852 without --incremental.
12854 2009-02-06 Chris Demetriou <cgd@google.com>
12856 * gold.h (gold_undefined_symbol): Change to take only a Symbol
12857 pointer and to report location as the file name associated with
12859 (gold_undefined_symbol_at_location): New function to replace the
12860 old gold_undefined_symbol functionality.
12861 * target-reloc.h (relocate_section): Update to use
12862 gold_undefined_symbol_at_location.
12863 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12864 Call gold_undefined_symbol function rather than gold_error.
12865 * errors.h (Errors::undefined_symbol): Take location as a
12866 string, rather than calculating it from a relocation.
12867 * errors.cc (Errors::fatal): Print "fatal error:" before the
12869 (Errors::error, Errors::error_at_location): Print "error: "
12870 before the formatted message.
12871 (Errors::undefined_symbol): Take location as a string, rather
12872 than calculating it from a relocation.
12873 (gold_undefined_symbol_at_location): New function akin to
12874 old gold_undefined_symbol, calculates location from relocation.
12875 (gold_undefined_symbol): Change to take only a Symbol pointer
12876 and to report location as the file name associated with the symbol.
12877 * testsuite/debug_msg.sh: Update for changed error messages.
12878 * testsuite/undef_symbol.sh: Likewise.
12880 2009-02-04 Duncan Sands <baldrick@free.fr>
12883 * reduced_debug_output.h
12884 (Output_reduced_debug_abbrev_section::failed): Use format for
12886 (Output_reduced_debug_info_section::faild): Likewise.
12888 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
12890 * script.cc (Lazy_demangler): New class.
12891 (Version_script_info::get_symbol_version_helper): Demangle a
12894 2009-01-29 Cary Coutant <ccoutant@google.com>
12896 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12898 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12900 2009-01-28 Ian Lance Taylor <iant@google.com>
12902 * version.cc (version_string): Bump to 1.9.
12904 * gold.h: Include <cstring> and <stdint.h>.
12905 * version.cc: Include <cstdio>.
12906 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12908 * reduced_debug_output.cc (insert_into_vector): Rename from
12909 Insert_into_vector; change all callers. Use Swap_unaligned to
12910 avoid aliasing issue; remove union since it is unnecessary.
12912 2009-01-27 Sriraman Tallam <tmsriram@google.com>
12914 * Makefile.am (CCFILES): Add gc.cc.
12915 (HFILES): Add gc.h.
12916 * Makefile.in: Regenerate.
12917 * gold.cc (Gc_runner): New class.
12918 (queue_initial_tasks): Call garbage collection related tasks
12919 when corresponding options are invoked.
12920 (queue_middle_gc_tasks): New function.
12921 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12922 processed early before laying out sections during garbage collection.
12923 * gold.h (queue_middle_gc_tasks): New function.
12924 (is_prefix_of): Move from "layout.cc".
12925 * i386.cc (Target_i386::gc_process_relocs): New function.
12926 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12927 * main.cc (main): Create object of class "Garbage_collection".
12928 * object.cc (Relobj::copy_symbols_data): New function.
12929 (Relobj::is_section_name_included): New function.
12930 (Sized_relobj::do_layout): Allow this function to be called twice
12931 during garbage collection and defer layout of section during the
12933 * object.h (Relobj::get_symbols_data): New function.
12934 (Relobj::is_section_name_included): New function.
12935 (Relobj::copy_symbols_data): New function.
12936 (Relobj::set_symbols_data): New function.
12937 (Relobj::get_relocs_data): New function.
12938 (Relobj::set_relocs_data): New function.
12939 (Relobj::is_output_section_offset_invalid): New pure virtual function.
12940 (Relobj::gc_process_relocs): New function.
12941 (Relobj::do_gc_process_relocs): New pure virtual function.
12942 (Relobj::sd_): New data member.
12943 (Sized_relobj::is_output_section_offset_invalid): New function.
12944 (Sized_relobj::do_gc_process_relocs): New function.
12945 * options.h (General_options::gc_sections): Modify to not be a no-op.
12946 (General_options::print_gc_sections): New option.
12947 * plugin.cc (Plugin_finish::run): Remove function call to
12948 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
12949 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12950 * reloc.cc (Read_relocs::run): Add task to process relocs and
12951 determine unreferenced sections when doing garbage collection.
12952 (Gc_process_relocs): New class.
12953 (Sized_relobj::do_gc_process_relocs): New function.
12954 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12955 sections that are garbage collected.
12956 * reloc.h (Gc_process_relocs): New class.
12957 * sparc.cc (Target_sparc::gc_process_relocs): New function.
12958 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12959 symbols whose corresponding sections are garbage collected.
12960 (Symbol_table::Symbol_table): Add new parameter for the garbage
12962 (Symbol_table::gc_mark_undef_symbols): New function.
12963 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12964 (Symbol_table::gc_mark_dyn_syms): New function.
12965 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12967 (Symbol_table::add_from_object): Likewise.
12968 (Symbol_table::add_from_relobj): When building shared objects, do not
12969 treat externally visible symbols as garbage.
12970 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12971 table information for static and relocatable links.
12972 * symtab.h (Symbol_table::set_gc): New function.
12973 (Symbol_table::gc): New function.
12974 (Symbol_table::gc_mark_undef_symbols): New function.
12975 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12976 (Symbol_table::gc_mark_dyn_syms): New function.
12977 (Symbol_table::gc_): New data member.
12978 * target.h (Sized_target::gc_process_relocs): New pure virtual
12980 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12981 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12983 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
12985 * options.h (General_options::gc_sections): Define as a no-op for now.
12986 (General_options::no_keep_memory): Ditto.
12987 (General_options::Bshareable): Define.
12988 * options.cc (General_options::finalize): Honor -Bshareable.
12990 2009-01-20 Andreas Schwab <schwab@suse.de>
12992 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12993 read the value in the contents, since we don't use it. Use the
12994 template endianness when writing.
12995 (Relocate::relocate): Use it for R_PPC_REL16_HA.
12997 2009-01-19 Andreas Schwab <schwab@suse.de>
12999 * configure.tgt (powerpc64-*): Fix targ_obj.
13001 2009-01-15 Ian Lance Taylor <iant@google.com>
13003 * object.cc (Sized_relobj::write_local_symbols): Don't write out
13004 local symbols when stripping all symbols.
13006 2009-01-14 Cary Coutant <ccoutant@google.com>
13008 * output.cc (Output_reloc): Add explicit instantiations.
13010 2009-01-14 Cary Coutant <ccoutant@google.com>
13012 * archive.cc (Archive::get_elf_object_for_member): Remove call
13013 to File_read::claim_for_plugin.
13014 * descriptors.cc (Descriptors::open): Remove reference to
13016 (Descriptors::claim_for_plugin): Remove.
13017 * descriptors.h (Descriptors::claim_for_plugin): Remove.
13018 (Descriptors::is_claimed): Remove.
13019 (claim_descriptor_for_plugin): Remove.
13020 * fileread.cc (File_read::claim_for_plugin): Remove.
13021 * fileread.h (File_read::claim_for_plugin): Remove.
13022 (File_read::descriptor): Reopen descriptor if necessary.
13023 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
13024 (Plugin_manager::all_symbols_read): Add task parameter. Change
13026 (Plugin_manager::get_input_file): New function.
13027 (Plugin_manager::release_input_file): New function.
13028 (Pluginobj::Pluginobj): Add filesize parameter and initialize
13029 corresponding data member.
13030 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13031 and pass to base constructor. Change all callers.
13032 (get_input_file, release_input_file): New functions.
13033 (make_sized_plugin_object): Add filesize parameter. Change all callers.
13034 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13035 (Plugin_manager::all_symbols_read): Add task parameter.
13036 (Plugin_manager::get_input_file): New function.
13037 (Plugin_manager::release_input_file): New function.
13038 (Plugin_manager::task_): New data member.
13039 (Pluginobj::Pluginobj): Add filesize parameter.
13040 (Pluginobj::filename): New function.
13041 (Pluginobj::descriptor): New function.
13042 (Pluginobj::filesize): New function.
13043 (Pluginobj::filesize_): New data member.
13044 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13045 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13046 File_read::claim_for_plugin; use Object::unlock to unlock the file.
13048 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13049 with archive libraries.
13050 * testsuite/Makefile.in: Regenerate.
13051 * testsuite/plugin_test.c (struct sym_info): New type.
13052 (get_input_file, release_input_file): New static variables.
13053 (onload): Capture new transfer vector entries.
13054 (claim_file_hook): Stop reading at end of file according to filesize.
13055 Factor out parsing of readelf output into separate function.
13056 (all_symbols_read_hook): Exercise get_input_file and release_input_file
13057 APIs and get the source file name from the symbol table. Convert
13058 source file name to corresponding object file name. Print info
13059 message when adding new input files.
13060 (parse_readelf_line): New function.
13061 * testsuite/plugin_test_1.sh: Add checks for new info messages.
13062 * testsuite/plugin_test_2.sh: Likewise.
13063 * testsuite/plugin_test_3.sh: Likewise.
13064 * testsuite/plugin_test_4.sh: New test case.
13066 2009-01-07 Ian Lance Taylor <iant@google.com>
13068 * version.cc (version_string): Bump to 1.8.
13070 2008-12-23 Cary Coutant <ccoutant@google.com>
13072 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13073 * plugin.cc (Plugin_manager::finish): Rename as
13074 layout_deferred_objects. Move cleanup to separate function.
13075 (Plugin_manager::cleanup): New function.
13076 (Plugin_finish::run): Call layout_deferred_objects and cleanup
13078 * plugin.h (Plugin_manager::finish): Rename as
13079 layout_deferred_objects.
13080 (Plugin_manager::cleanup): New function.
13081 (Plugin_manager::cleanup_done): New field.
13083 2008-12-23 Cary Coutant <ccoutant@google.com>
13085 * plugin.cc (is_visible_from_outside): New function.
13086 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13087 so we don't return "IR only" status for exported symbols or -r links.
13089 * testsuite/Makefile.am (plugin_test_3): New test case.
13090 * testsuite/Makefile.in: Regenerate.
13091 * testsuite/plugin_test_3.sh: New file.
13093 2008-12-22 Cary Coutant <ccoutant@google.com>
13095 * object.cc (Sized_relobj::layout_section): New function.
13096 (Sized_relobj::do_layout): Defer layout of input sections until after
13097 plugin has provided replacement files.
13098 (Sized_relobj::do_layout_deferred_sections): New function.
13099 * object.h (Relobj::set_section_offset): Remove virtual keyword.
13100 (Relobj::layout_deferred_sections): New function.
13101 (Relobj::do_layout_deferred_sections): New function.
13102 (Sized_relobj::do_layout_deferred_sections): New function.
13103 (Sized_relobj::layout_section): New function.
13104 (Sized_relobj::Deferred_layout): New structure.
13105 (Sized_relobj::deferred_layout_): New field.
13106 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13107 Change all callers. Layout deferred sections.
13108 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
13110 (Plugin_hook::run): Move code from do_plugin_hook inline.
13111 (Plugin_hook::do_plugin_hook): Remove.
13112 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13113 (Plugin_manager::finish): Renamed, was cleanup.
13114 (Plugin_manager::should_defer_layout): New function.
13115 (Plugin_manager::add_deferred_layout_object): New function.
13116 (Plugin_manager::Deferred_layout_list): New type.
13117 (Plugin_manager::deferred_layout_objects_): New field.
13118 (Plugin_hook::do_plugin_hook): Remove.
13120 2008-12-17 Ian Lance Taylor <iant@google.com>
13122 * options.h (class General_options): Add --no case for
13125 2008-12-16 Cary Coutant <ccoutant@google.com>
13127 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13129 (Plugin_manager::claim_file): Create plugin object even if
13130 plugin did not call the add_symbols callback.
13131 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13132 asking for more symbols than were added.
13133 * testsuite/Makefile.am (plugin_test_1): Add test case with
13135 (empty.syms): New target.
13136 * testsuite/Makefile.in: Regenerate.
13137 * testsuite/plugin_test.c (claim_file_hook): Add new debug
13138 message. Don't call add_symbols if no globals.
13139 (all_symbols_read_hook): Don't provide replacement for empty
13142 2008-12-12 Ian Lance Taylor <iant@google.com>
13144 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13145 r_type == 0 for a local symbol with r_sym == 0.
13146 (scan_relocatable_relocs): Pass r_sym to
13147 local_non_section_strategy.
13148 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13151 * configure.ac: Update test for TLS descriptors: they are
13152 supported as of glibc 2.9.
13153 * configure: Rebuild.
13155 2008-12-11 Ian Lance Taylor <iant@google.com>
13158 * target-reloc.h (Default_scan_relocatable_relocs): For each
13159 function, map r_type == 0 to RELOC_DISCARD.
13161 2008-12-10 Cary Coutant <ccoutant@google.com>
13163 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13164 object to override a kept COMDAT group from a plugin object.
13166 2008-12-09 Ian Lance Taylor <iant@google.com>
13169 * yyscript.y (file_cmd): Handle INPUT.
13171 * testsuite/initpri1.c: Change all declarations to be full
13172 prototypes by adding void, to avoid compiler warnings.
13174 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
13176 * options.cc (General_options::parse_plugin_opt): New.
13177 (General_options::add_plugin): The argument now is just the filename.
13178 (General_options::add_plugin_option): New.
13179 * options.h (plugin_opt): New.
13180 (add_plugin): Change argument name.
13181 (add_plugin_option): New.
13182 * plugin.cc (Plugin::load): Don't parse the plugin option.
13183 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13184 (Plugin::add_option): New.
13185 (Plugin::args_): Change type.
13186 (Plugin::filename_): New.
13187 (Plugin_manager::add_plugin_option): New.
13188 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13189 * testsuite/Makefile.in: Regenerate.
13191 2008-12-05 Cary Coutant <ccoutant@google.com>
13193 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13194 Handle --strip-lto-sections option.
13195 * options.h (strip_lto_sections): New option.
13197 2008-12-01 Cary Coutant <ccoutant@google.com>
13199 * plugin.cc (ld_plugin_message): Change format parameter to const.
13200 Fix mismatch between new[] and delete.
13202 2008-11-14 Cary Coutant <ccoutant@google.com>
13204 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13207 2008-11-05 Craig Silverstein <csilvers@google.com>
13209 * options.cc (General_options::parse_dynamic_list): New function.
13210 * options.h (General_options): New flags dynamic_list,
13211 dynamic_list_data, dynamic_list_cpp_new, and
13212 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
13213 (General_options::in_dynamic_list): New function.
13214 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13215 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13216 (Lex::can_continue_name): Likewise.
13218 (read_script_file): New parameter script_options.
13219 (read_dynamic_list): New function.
13220 (Script_options::define_dynamic_list): New function.
13221 (dynamic_list_keyword_parsecodes): New variable.
13222 (dynamic_list_keywords): New variable.
13223 * script.h (Script_options::define_dynamic_list): New function
13225 (read_dynamic_list): New function prototype.
13226 * symtab.cc (strprefix): New macro.
13227 (Symbol::should_add_dynsym_entry): Support dynamic_list,
13228 dynamic_list_data, dynamic_list_cpp_new, and
13229 dynamic_list_cpp_typeinfo.
13230 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13231 (dynamic_list_expr): New rule.
13232 (dynamic_list_nodes): Likewise.
13233 (dynamic_list_node): Likewise.
13234 * testsuite/Makefile.am (dynamic_list): New test.
13235 * testsuite/Makefile.in: Regenerated.
13236 * testsuite/dynamic_list.t: New file.
13237 * testsuite/dynamic_list.sh: New file.
13239 2008-11-05 Craig Silverstein <csilvers@google.com>
13241 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13242 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13243 (t11_last): Likewise.
13244 * testsuite/ver_test_6.c (main): Likewise.
13246 2008-10-07 Cary Coutant <ccoutant@google.com>
13248 * options.c (General_options::finalize): Add check for -static and
13250 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13253 2008-10-02 Cary Coutant <ccoutant@google.com>
13255 * plugin.cc (make_sized_plugin_object): Fix conditional
13256 compilation to work when not all targets are enabled.
13258 2008-09-29 Cary Coutant <ccoutant@google.com>
13260 * archive.cc (Archive::get_file_and_offset): Use filename instead
13261 of name to get library path.
13262 (Archive::include_member): Unlock external member of a thin archive.
13264 * testsuite/Makefile.am (TEST_AR): New variable.
13265 (thin_archive_test_1): New test.
13266 (thin_archive_test_2): New test.
13267 * testsuite/Makefile.in: Regenerate.
13268 * testsuite/thin_archive_main.cc: New file.
13269 * testsuite/thin_archive_test_1.cc: New file.
13270 * testsuite/thin_archive_test_2.cc: New file.
13271 * testsuite/thin_archive_test_3.cc: New file.
13272 * testsuite/thin_archive_test_4.cc: New file.
13274 2008-09-29 Cary Coutant <ccoutant@google.com>
13276 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13277 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13279 (Sized_relobj::do_finalize_local_symbols): Likewise.
13280 (Sized_relobj::map_to_kept_section): Likewise.
13281 * object.h (Sized_relobj::invalid_address): New constant.
13282 (Sized_relobj::do_output_section_offset): Check for invalid_address
13284 * output.cc (Output_reloc::local_section_offset): Use constant
13285 invalid_address instead of -1U.
13286 (Output_reloc::get_address): Likewise.
13287 (Output_section::output_address): Change -1U to -1ULL.
13288 * output.h (Output_reloc::invalid_address): New constant.
13289 * reloc.cc (Sized_relobj::write_sections): Use constant
13290 invalid_address instead of -1U.
13291 (Sized_relobj::relocate_sections): Likewise.
13292 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13293 values for merge sections.
13294 * target-reloc.h (relocate_for_relocatable): Use constant
13295 invalid_address instead of -1U.
13297 2008-09-19 Cary Coutant <ccoutant@google.com>
13299 Add plugin functionality for link-time optimization (LTO).
13300 * configure.ac (plugins): Add --enable-plugins option.
13301 * configure: Regenerate.
13302 * config.in: Regenerate.
13303 * Makefile.am (LIBDL): New variable.
13304 (CCFILES): Add plugin.cc.
13305 (HFILES): Add plugin.h.
13306 (ldadd_var): Add LIBDL.
13307 * Makefile.in: Regenerate.
13309 * archive.cc: Include "plugin.h".
13310 (Archive::setup): Don't preread archive symbols when using a plugin.
13311 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
13312 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13314 (Archive::include_member): Add symbols from plugin objects.
13315 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13316 * descriptors.cc (Descriptors::open): Check for file descriptors
13317 abandoned by plugins.
13318 (Descriptors::claim_for_plugin): New function.
13319 * descriptors.h (Descriptors::claim_for_plugin): New function.
13320 (Open_descriptor::is_claimed): New field.
13321 (claim_descriptor_for_plugin): New function.
13322 * fileread.cc (File_read::claim_for_plugin): New function.
13323 * fileread.h (File_read::claim_for_plugin): New function.
13324 (File_read::descriptor): New function.
13325 * gold.cc: Include "plugin.h".
13326 (queue_initial_tasks): Add task to call plugin hooks for generating
13328 * main.cc: Include "plugin.h".
13329 (main): Load plugin libraries.
13330 * object.h (Pluginobj): Declare.
13331 (Object::pluginobj): New function.
13332 (Object::do_pluginobj): New function.
13333 (Object::set_target): New function.
13334 * options.cc: Include "plugin.h".
13335 (General_options::parse_plugin): New function.
13336 (General_options::General_options): Initialize plugins_ field.
13337 (General_options::add_plugin): New function.
13338 * options.h (Plugin_manager): Declare.
13339 (General_options): Add --plugin option.
13340 (General_options::has_plugins): New function.
13341 (General_options::plugins): New function.
13342 (General_options::add_plugin): New function.
13343 (General_options::plugins_): New field.
13344 * plugin.cc: New file.
13345 * plugin.h: New file.
13346 * readsyms.cc: Include "plugin.h".
13347 (Read_symbols::do_read_symbols): Check for archive before checking
13348 for ELF file. Call plugin hooks to claim files.
13349 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13350 from a real object file; force override when processing replacement
13352 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13353 (Symbol::init_base_object): Likewise.
13354 (Symbol::init_base_output_data): Likewise.
13355 (Symbol::init_base_output_segment): Likewise.
13356 (Symbol::init_base_constant): Likewise.
13357 (Symbol::init_base_undefined): Likewise.
13358 (Symbol::output_section): Assert that object is not a plugin.
13359 (Symbol_table::add_from_pluginobj): New function.
13360 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13362 (Symbol_table::sized_write_globals): Likewise.
13363 (Symbol_table::add_from_pluginobj): Instantiate template.
13364 * symtab.h (Sized_pluginobj): Declare.
13365 (Symbol::in_real_elf): New function.
13366 (Symbol::set_in_real_elf): New function.
13367 (Symbol::in_real_elf_): New field.
13368 (Symbol_table::add_from_pluginobj): New function.
13370 * testsuite/Makefile.am (AM_CFLAGS): New variable.
13371 (LIBDL): New variable.
13372 (LDADD): Add LIBDL.
13373 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13374 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13375 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13376 (MOSTLYCLEANFILES): Likewise.
13377 * testsuite/Makefile.in: Regenerate.
13378 * testsuite/plugin_test.c: New file.
13379 * testsuite/plugin_test_1.sh: New file.
13380 * testsuite/plugin_test_2.sh: New file.
13382 2008-09-16 Ian Lance Taylor <iant@google.com>
13384 * target-reloc.h (relocate_section): Check whether a symbol is
13385 defined by the ABI before reporting an undefined symbol error.
13386 * target.h (Target::is_defined_by_abi): Make parameter const.
13387 (Target::do_is_defined_by_abi): Likewise.
13388 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13389 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13390 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13391 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13392 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13393 * testsuite/Makefile.in: Rebuild.
13395 * fileread.cc (make_view): Add casts to avoid warning.
13397 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13399 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13400 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13402 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13404 * options.h (General_options::output_is_executable): New.
13405 (General_options::output_is_pie): New.
13406 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13407 for shared libraries.
13408 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13410 2008-09-11 Chris Demetriou <cgd@google.com>
13412 * options.h (origin): New -z option.
13413 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13414 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13417 2008-09-05 Cary Coutant <ccoutant@google.com>
13419 * fileread.cc (File_read::make_view): Add check for attempt to map
13420 beyond end of file.
13422 2008-09-05 Cary Coutant <ccoutant@google.com>
13424 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13425 explicit instantiations.
13427 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
13430 * options.cc (General_options::finalize): Allow undefined symbols
13431 in shlibs if linking -shared.
13434 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13435 symbols as not needing a dynsym entry.
13437 2008-08-20 Craig Silverstein <csilvers@google.com>
13439 * fileread.cc (File_read::open): Do not lock the file unless it
13440 was successfully opened.
13442 2008-08-14 Cary Coutant <ccoutant@google.com>
13444 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13445 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13446 * testsuite/tls_test.cc (struct int128): 128-bit struct
13447 for testing TLS relocs with non-zero addend.
13448 (v12): New TLS variable.
13450 (t_last): Add check for v12.
13451 * testsuite/tls_test.h (t12): New function.
13452 * testsuite/tls_test_main.cc (thread_routine): Call new test.
13454 2008-08-13 Ian Lance Taylor <iant@google.com>
13456 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13457 set tls_segment_ or relro_segment_.
13458 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13460 * output.h (Output_section::clear_is_relro): New function.
13461 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13462 sections specially even when output_data_ is empty.
13463 (Output_segment::maximum_alignment): When first section is relro,
13464 only force alignment for PT_LOAD segments.
13465 * script.cc (script_data_segment_align): New function.
13466 (script_data_segment_relro_end): New function.
13467 * script-c.h (script_data_segment_align): Declare.
13468 (script_data_segment_relro_end): Declare.
13469 * script-sections.h (class Script_sections): Declare
13470 data_segment_align and data_segment_relro_end. Add fields
13471 segment_align_index_ and saw_relro_end_.
13472 * script-sections.cc (class Sections_element): Add set_is_relro
13473 virtual function. Add new bool* parameter to place_orphan_here.
13474 Add get_output_section virtual function.
13475 (class Output_section_definition): Add set_is_relro. Add new
13476 bool* parameter to place_orphan_here. Add get_output_section.
13477 Add is_relro_ field.
13478 (Output_section_definition::Output_section_definition): Initialize
13479 evaluated_address_, evaluated_load_address, evaluated_addralign_,
13480 and is_relro_ fields.
13481 (Output_section_definition::place_orphan_here): Add is_relro
13483 (Output_section_definition::set_section_addresses): Set relro for
13485 (Output_section_definition::alternate_constraint): Likewise.
13486 (class Orphan_output_section): Add new bool* parameter to
13487 place_orphan_here. Add get_output_section.
13488 (Orphan_output_section::place_orphan_here): Add is_relro
13490 (Script_sections::Script_sections): Initialize
13491 data_segment_align_index_ and saw_relro_end_.
13492 (Script_sections::data_segment_align): New function.
13493 (Script_sections::data_segment_relro_end): New function.
13494 (Script_sections::place_orphan): Set or clear is_relro.
13495 (Script_sections::set_section_addresses): Force alignment of first
13497 * yyscript.y (exp): Call script_data_segment_align and
13498 script_data_segment_relro_end.
13499 * testsuite/relro_script_test.t: New file.
13500 * testsuite/relro_test.cc (using_script): Declare.
13501 (t1, t2): Test using_script.
13502 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13503 (relro_script_test_SOURCES): Define.
13504 (relro_script_test_DEPENDENCIES): Define.
13505 (relro_script_test_LDFLAGS): Define.
13506 (relro_script_test_LDADD): Define.
13507 (relro_script_test.so): New target.
13508 * testsuite/Makefile.in: Rebuild.
13510 2008-08-06 Cary Coutant <ccoutant@google.com>
13512 * archive.cc (Archive::total_archives, Archive::total_members)
13513 (Archive::total_members_loaded): New variables.
13514 (Archive::setup): Add parameter. Add option to preread
13516 (Archive::read_armap): Add counter.
13517 (Archive::get_file_and_offset): New function.
13518 (Archive::get_elf_object_for_member): New function.
13519 (Archive::read_all_symbols): New function.
13520 (Archive::read_symbols): New function.
13521 (Archive::add_symbols): Add counters.
13522 (Archive::include_all_members): Use armap to find members if it's
13524 (Archive::include_member): Skip reading symbols if already read.
13525 Factored code into Archive::get_file_and_offset and
13526 Archive::get_elf_object_for_member. Changed call to
13527 Mapfile::report_include_archive_member.
13528 (Archive::print_stats): New function.
13529 * archive.h: Declare Object and Read_symbols_data classes.
13530 (Archive::Archive): Add initializers for new members.
13531 (Archive::setup): Add parameter.
13532 (Archive::print_stats): New function.
13533 (Archive::total_archives, Archive::total_members)
13534 (Archive::total_members_loaded): New variables.
13535 (Archive::get_file_and_offset): New function.
13536 (Archive::get_elf_object_for_member): New function.
13537 (Archive::read_all_symbols): New function.
13538 (Archive::read_symbols): New function.
13539 (Archive::Archive_member): New class.
13540 (Archive::members_): New member.
13541 (Archive::num_members_): New member.
13542 * main.cc: Include archive.h.
13543 (main): Call Archive::print_stats.
13544 * mapfile.cc (Mapfile::report_include_archive_member): Delete
13545 archive parameter; member_name is now the fully-decorated name.
13546 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13547 * options.h: (General_options): Add --preread-archive-symbols option.
13548 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13551 2008-08-04 Ian Lance Taylor <iant@google.com>
13553 * symtab.h (Symbol::use_plt_offset): New function.
13554 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13555 * powerpc.cc (Relocate::relocate): Likewise.
13556 * sparc.cc (Relocate::relocate): Likewise.
13557 * x86_64.cc (Relocate::relocate): Likewise.
13558 * testsuite/weak_plt.sh: New test.
13559 * testsuite/weak_plt_main.cc: New test.
13560 * testsuite/weak_plt_shared.cc: New test.
13561 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13562 (check_PROGRAMS): Add weak_plt.
13563 (check_DATA): Add weak_plt_shared.so.
13564 (weak_plt_main_pic.o, weak_plt): New targets.
13565 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13566 * testsuite/Makefile.in: Rebuild.
13568 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13570 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13571 * testsuite/Makefile.in: Rebuild.
13573 2008-08-04 Alan Modra <amodra@bigpond.net.au>
13575 * Makefile.am (POTFILES.in): Set LC_ALL=C.
13576 * Makefile.in: Regenerate.
13577 * po/POTFILES.in: Regenerate.
13579 2008-07-29 Ian Lance Taylor <iant@google.com>
13581 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13582 symbols before other symbols.
13583 * testsuite/script_test_2.cc (test_addr): Declare.
13584 (test_addr_alias): Declare.
13585 (main): Check that test_addr and test_addr_alias have the right
13587 * testsuite/script_test_2.t: Define test_addr_alias and
13590 2008-07-24 Ian Lance Taylor <iant@google.com>
13593 * descriptors.cc: New file.
13594 * descriptors.h: New file.
13595 * gold-threads.h (class Hold_optional_lock): New class.
13596 * fileread.cc: Include "descriptors.h".
13597 (File_read::~File_read): Release descriptor rather than closing
13599 (File_read::open) [file]: Call open_descriptor rather than open.
13600 Set is_descriptor_opened_.
13601 (File_read::open) [memory]: Assert that descriptor is not open.
13602 (File_read::reopen_descriptor): New function.
13603 (File_read::release): Release descriptor.
13604 (File_read::do_read): Make non-const. Reopen descriptor.
13605 (File_read::read): Make non-const.
13606 (File_read::make_view): Reopen descriptor.
13607 (File_read::do_readv): Likewise.
13608 * fileread.h (class File_read): Add is_descriptor_opened_ field.
13609 Update declarations.
13610 * layout.cc: Include "descriptors.h".
13611 (Layout::create_build_id): Use open_descriptor rather than open.
13612 * output.cc: Include "descriptors.h".
13613 (Output_file::open): Use open_descriptor rather than open.
13614 * archive.cc (Archive::const_iterator): Change Archive to be
13616 (Archive::begin, Archive::end): Make non-const.
13617 (Archive::count_members): Likewise.
13618 * archive.h (class Archive): Update declarations.
13619 * object.h (Object::read): Make non-const.
13620 * Makefile.am (CCFILES): Add descriptors.cc.
13621 (HFILES): Add descriptors.h.
13622 * Makefile.in: Rebuild.
13625 * gold.h: Always include <clocale>. Add Solaris workarounds
13626 following code in binutils/sysdep.h.
13629 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13630 this->eh_frame_hdr_ is NULL before using it.
13632 * dynobj.cc (Versions::Versions): Update comment.
13634 * dynobj.cc (Versions::Versions): If there is an soname, use it as
13635 the base version name.
13637 * stringpool.cc (Stringpool_template::add_with_length): Set key to
13638 array size plus one.
13639 (Stringpool_template::set_string_offsets): Subtract one from key
13640 before using it as an array index.
13641 (Stringpool_template::get_offset_with_length): Likewise.
13642 (Stringpool_template::write_to_buffer): Likewise.
13643 * stringpool.h (Stringpool_template::get_offset_from_key):
13646 2008-07-23 Ian Lance Taylor <iant@google.com>
13649 * object.h (Merged_symbol_value::value): Do our best to handle a
13653 * script.cc (Version_script_info::get_versions): Don't add empty
13654 version tag to return value.
13655 (Version_script_info::get_symbol_version_helper): Change return
13656 type to bool. Add pversion parameter. Change all callers.
13657 (script_register_vers_node): Don't require a non-NULL tag.
13658 * script.h (class Version_script_info): Update declarations.
13659 (Version_script_info::get_symbol_version): Change return type to
13660 bool. Add version parameter. Change all callers.
13661 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13662 handling. Handle an empty version from a version script.
13663 (Symbol_table::define_special_symbol): Likewise.
13664 * testsuite/ver_test_10.script: New file.
13665 * testsuite/ver_test_10.sh: New file.
13666 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13667 (check_DATA): Add ver_test_10.syms.
13668 (ver_test_10.syms, ver_test_10.so): New target.
13669 * testsuite/Makefile.in: Rebuild.
13671 2008-07-23 Simon Baldwin <simonb@google.com>
13673 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13674 to zero for undefined symbols from dynamic libraries.
13676 2008-07-23 Ian Lance Taylor <iant@google.com>
13678 * symtab.cc (Symbol_table::resolve): Remove version parameter.
13679 Change all callers.
13680 * symtab.h (class Symbol_table): Update declaration.
13681 * testsuite/ver_test_9.cc: New file.
13682 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13683 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13684 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13685 (ver_test_9.so, ver_test_9.o): New targets.
13686 * testsuite/Makefile.in: Rebuild.
13688 2008-07-22 Ian Lance Taylor <iant@google.com>
13690 * options.h (class General_options): Define --check-sections.
13691 * layout.cc (Layout::set_segment_offsets): Handle
13694 * options.h (class General_options): Define -n/--nmagic and
13696 * options.cc (General_options::finalize): For -n/--nmagic or
13697 -N/--omagic, set -static.
13698 * layout.cc (Layout::attach_allocated_section_to_segment): If
13699 -N/--omagic, don't put read-only and read-write sections in
13700 different segments.
13701 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13702 finding a read-only segment.
13703 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13704 don't set the minimum segment alignment to the common page size,
13705 and don't set the file offset to the address modulo the page size.
13706 * script-sections.cc (Script_sections::create_segments): If
13707 -n/--omagic, don't put read-only and read-write sections in
13708 different segments.
13710 * cref.cc: New file.
13711 * cref.h: New file.
13712 * options.h (class General_options): Add --print-symbol-counts.
13713 * main.cc (main): Issue defined symbol report if requested.
13714 * archive.cc (Archive::interpret_header): Make into a const member
13716 (Archive::add_symbols): Call Input_objects::archive_start and
13718 (Archive::const_iterator): Define new class.
13719 (Archive::begin, Archive::end): New functions.
13720 (Archive::include_all_members): Rewrite to use iterator.
13721 (Archive::count_members): New function.
13722 * archive.h (class Archive): Update declarations.
13723 (Archive::filename): New function.
13724 * object.cc: Include "cref.h".
13725 (Sized_relobj::Sized_relobj): Initialize defined_count_.
13726 (Sized_relobj::do_get_global_symbol_counts): New function.
13727 (Input_objects::add_object): Add object to cross-referencer.
13728 (Input_objects::archive_start): New function.
13729 (Input_objects::archive_stop): New function.
13730 (Input_objects::print_symbol_counts): New function.
13731 * object.h: Declare Cref and Archive.
13732 (Object::get_global_symbol_counts): New function.
13733 (Object::do_get_global_symbol_counts): New pure virtual function.
13734 (class Sized_relobj): Add defined_count_ field. Update
13736 (class Input_objects): Add cref_ field. Update constructor.
13737 Update declarations.
13738 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13740 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13742 (Sized_dynobj::do_get_global_symbol_counts): New function.
13743 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13744 defined_count_. Update declarations. Define Symbols typedef.
13745 * symtab.cc (Symbol_table::add_from_relobj): Add defined
13746 parameter. Change all callers.
13747 (Symbol_table::add_from_dynobj): Add sympointers and defined
13748 parameters. Change all callers.
13749 * symtab.h (class Symbol_table): Update declarations.
13750 * Makefile.am (CCFILES): Add cref.cc.
13751 (HFILES): Add cref.h.
13752 * Makefile.in: Rebuild.
13754 2008-07-22 Simon Baldwin <simonb@google.com>
13756 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13757 to zero when writing undefined symbols.
13759 2008-07-22 Ian Lance Taylor <iant@google.com>
13761 * output.cc (Output_section::add_input_section): Don't try to
13762 merge empty merge sections.
13764 2008-07-21 Craig Silverstein <csilvers@google.com>
13766 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13767 Include symbol version in error message.
13769 2008-07-20 Chris Demetriou <cgd@google.com>
13771 * configure.ac (gold_cv_c_random_seed): New configured variable.
13772 (RANDOM_SEED_CFLAGS): New substituted variable.
13773 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13774 * configure: Rebuild.
13775 * Makefile.in: Likewise.
13776 * testsuite/Makefile.in: Likewise.
13778 2008-07-18 Ian Lance Taylor <iant@google.com>
13780 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13781 where we see NAME/NULL and NAME/VERSION as separate symbols.
13782 * testsuite/ver_test_main.cc (main): Call t4.
13783 (t4, t4_2a): Define.
13784 * testsuite/ver_test_2.cc (t4_2): Define.
13785 * testsuite/ver_test_2.script: Put t4_2a in VER2.
13786 * testsuite/ver_test_4.cc (t4_2a): Define.
13787 * testsuite/ver_test_4.script: Put t4_2a in VER2.
13788 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13790 2008-07-17 Ian Lance Taylor <iant@google.com>
13792 * dynobj.cc (Versions::add_def): If we give an error about a
13793 missing version, go ahead and create the version anyhow.
13795 2008-07-10 Ian Lance Taylor <iant@google.com>
13797 Handle output sections with more than 0x7fffffff bytes.
13798 * object.h (class Relobj): Change map_to_output_ to
13799 output_sections_, and just keep a section pointer. Change all
13800 uses. Move comdat group support to Sized_relobj.
13801 (Relobj::is_section_specially_mapped): Remove.
13802 (Relobj::output_section): Remove poff parameter. Change all
13804 (Relobj::output_section_offset): New function.
13805 (Relobj::set_section_offset): Rewrite.
13806 (Relobj::map_to_output): Remove.
13807 (Relobj::output_sections): New function.
13808 (Relobj::do_output_section_offset): New pure virtual function.
13809 (Relobj::do_set_section_offset): Likewise.
13810 (class Sized_relobj): Add section_offsets_ field. Add comdat
13811 group support from Relobj. Update declarations.
13812 (Sized_relobj::get_output_section_offset): New function.
13813 (Sized_relobj::do_output_section_offset): New function.
13814 (Sized_relobj::do_set_section_offset): New function.
13815 * object.cc (Relobj::output_section_address): Remove.
13816 (Sized_relobj::Sized_relobj): Initialize new fields.
13817 (Sized_relobj::include_section_group): Cast find_kept_object to
13819 (Sized_relobj::include_linkonce_section): Likewise.
13820 (Sized_relobj::do_layout): Use separate arrays for output section
13822 (Sized_relobj::do_count_local_symbols): Change map_to_output to
13824 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13825 output_sections and section_offsets.
13826 (Sized_relobj::write_local_symbols): Likewise.
13827 (map_to_kept_section): Compute output address directly.
13828 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13829 output_sections and section_offsets.
13830 (Sized_relobj::write_sections): Likewise.
13831 (Sized_relobj::relocate_sections): Likewise.
13832 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13833 * output.h (class Output_reloc): Update declarations. Change
13834 u2_.relobj to Sized_relobj*.
13835 (class Output_data_reloc): Change add functions to use
13837 * output.cc (Output_reloc::Output_reloc): Change relobj to
13839 (Output_reloc::local_section_offset): Change return type to
13840 Elf_Addr. Use get_output_section_offset.
13841 (Output_reloc::get_address): Likewise.
13842 (Output_section::is_input_address_mapped): Don't call
13843 is_section_specially_mapped.
13844 (Output_section::output_offset): Likewise.
13845 (Output_section::output_address): Likewise.
13846 (Output_section::starting_output_address): Likewise.
13847 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13848 parameter to Sized_relobj*.
13849 (Copy_relocs::need_copy_reloc): Likewise.
13850 (Copy_relocs::save): Likewise.
13851 * copy-relocs.h (class Copy_relocs): Update declarations.
13852 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13853 Sized_relobj*. Change relobj_ field to Sized_relobj*.
13854 * target-reloc.h (relocate_for_relocatable): Change
13855 offset_in_output_section type to Elf_Addr. Change code that uses
13857 * layout.cc (Layout::layout): Always set *off.
13858 * mapfile.cc (Mapfile::print_input_section): Use
13859 output_section_offset.
13860 * i386.cc (Target_i386::copy_reloc): Change object parameter to
13862 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13863 * sparc.cc (Target_sparc::copy_reloc): Likewise.
13864 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13866 2008-07-03 Ian Lance Taylor <iant@google.com>
13868 * layout.cc (Layout::include_section): Do not discard unrecognized
13869 SHT_STRTAB sections.
13871 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
13873 * script.cc (Lex::can_continue_name): Make '?' allowable in
13874 version-script names.
13875 * testsuite/version_script.map: Change glob pattern to use '?'
13877 2008-06-30 Manish Singh <yosh@gimp.org>
13880 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13883 2008-06-30 Ian Lance Taylor <iant@google.com>
13887 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13888 versions]: Don't try to read the value in the contents, since we
13889 don't use it. Use the template endianness when writing.
13891 2008-06-25 Cary Coutant <ccoutant@google.com>
13893 * fileread.cc (File_read::make_view): Assert on zero-length view.
13894 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13895 symbol table when there are no symbols to read.
13897 2008-06-23 Craig Silverstein <csilvers@google.com>
13899 * version.cc (version_string): Bump to 1.7
13901 2008-06-18 Craig Silverstein <csilvers@google.com>
13903 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13904 constant 0xFFFF to type Valtype.
13905 (Powerpc_relocate_functions::rel16_ha): Likewise.
13907 2008-06-17 Ian Lance Taylor <iant@google.com>
13909 * output.h (Output_section::Input_section): Initialize p2align_ to
13910 zero for Output_section_data constructors.
13911 (Output_section::Input_section::addralign): If not an input
13912 section, return the alignment of the Output_section_data.
13913 * testsuite/copy_test.cc: New file.
13914 * testsuite/copy_test_1.cc: New file.
13915 * testsuite/copy_test_2.cc: New file.
13916 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13917 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13918 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13919 (copy_test_1_pic.o, copy_test_1.so): New targets.
13920 (copy_test_2_pic.o, copy_test_2.so): New targets.
13921 * testsuite/Makefile.in: Rebuild.
13923 * script-sections.cc (Script_sections::place_orphan): Initialize
13924 local variable exact.
13926 2008-06-13 David Edelsohn <edelsohn@gnu.org>
13928 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13930 2008-06-12 David Edelsohn <edelsohn@gnu.org>
13931 David S. Miller <davem@davemloft.net>
13933 * powerpc.cc: New file.
13934 * Makefile.am (TARGETSOURCES): Add powerpc.cc
13935 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13936 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13937 * Makefile.in: Rebuild.
13939 2008-06-09 Ian Lance Taylor <iant@google.com>
13941 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13943 (throwing, orig_terminate): New static variables.
13944 (terminate_handler): New static function.
13945 (t2): Set terminate handler.
13947 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
13950 * binary.cc (Binary_to_elf::sized_convert): Fix .data
13953 2008-05-30 Cary Coutant <ccoutant@google.com>
13955 * archive.cc (Archive::include_all_members) Correct to step
13956 over symbol table and extended name table in thin archives.
13958 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
13961 * target-reloc.h (relocate_for_relocatable): Fix new_offset
13964 2008-05-28 Caleb Howe <cshowe@google.com>
13966 * reduced_debug_output.cc: New file.
13967 * reduced_debug_output.h: New file.
13968 * options.h (class General_options): Add --strip-debug-non-line.
13969 * options.cc (General_options::finalize): Add strip_debug_non_line
13970 to the strip heirarchy.
13971 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13973 * layout.cc: Include "reduced_debug_output.h".
13974 (Layout::Layout): Initialize new fields.
13975 (line_only_debug_sections): New static array.
13976 (is_lines_only_debug_sections): New static inline function.
13977 (Layout::include_section): Handle --strip-debug-non-line.
13978 (Layout::make_output_section): If --strip-debug-non-line, build
13979 new output sections for .debug_abbrev and .debug_info.
13980 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13981 gold. Warn about possible overflow.
13982 (read_signed_LEB_128): Likewise.
13983 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13984 (read_signed_LEB_128): Declare.
13985 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13986 (HFILES): Add reduced_debug_output.h.
13987 * Makefile.in: Rebuild.
13989 2008-05-21 Ian Lance Taylor <iant@google.com>
13991 * mapfile.cc: New file.
13992 * mapfile.h: New file.
13993 * options.h (class General_options): Add -M/--print-map and -Map.
13994 * options.cc (General_options::finalize): Make -M equivalent to
13996 * main.cc: Include <cstdio> and "mapfile.h".
13997 (main): Open mapfile if requested.
13998 * gold.cc (class Middle_runner): Add mapfile_ field. Update
13999 constructor. Change caller.
14000 (queue_initial_tasks): Add mapfile parameter. Change caller.
14001 (queue_middle_tasks): Likewise.
14002 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14004 * archive.cc: Include "mapfile.h".
14005 (Archive::add_symbols): Add mapfile parameter. Change all
14006 callers. Pass mapfile, symbol, and reason to include_member.
14007 (Archive::include_all_members): Add mapfile parameter. Change all
14009 (Archive::include_member): Add mapfile, sym, and why parameters.
14010 Change all callers. Report inclusion to map file.
14011 * archive.h: Include "fileread.h".
14012 (class Archive): Update declarations.
14013 (Archive::file): New const method.
14014 (class Add_archive_symbols): Add mapfile_ field. Update
14015 constructor. Change all callers.
14016 * readsyms.h (class Read_symbols): Likewise.
14017 (class Finish_group): Likewise.
14018 (class Read_script): Likewise.
14019 * common.cc: Include "mapfile.h".
14020 (Symbol_table::allocate_commons): Add mapfile parameter. Change
14022 (Symbol_table::do_allocate_commons): Likewise.
14023 (Symbol_table::do_allocate_commons_list): Likewise. Report common
14024 symbol allocation to mapfile.
14025 * common.h (class Allocate_commons_task): Add mapfile_ field.
14026 Update constructor. Change all callers.
14027 * symtab.h (class Symbol_table): Update declarations.
14028 * layout.cc: Include "mapfile.h".
14029 (Layout_task_runner::run): Print information to mapfile.
14030 (Layout::create_gold_note): Change Output_data_fixed_space to
14031 Output_data_zero_fill.
14032 (Layout::create_build_id): Likewise.
14033 (Layout::print_to_mapfile): New function.
14034 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
14035 constructor. Change caller.
14036 (class Layout): Declare print_to_mapfile.
14037 * output.cc (Output_section::Input_section::print_to_mapfile): New
14039 (Output_section::add_input_section): If producing a map, always
14040 add to input_sections_ list.
14041 (Output_section::do_print_to_mapfile): New function.
14042 (Output_segment::print_sections_to_mapfile): New function.
14043 (Output_segment::print_section_list_to_mapfile): New function.
14044 * output.h: Include "mapfile.h".
14045 (Output_data::print_to_mapfile): New function.
14046 (Output_data::do_print_to_mapfile): New virtual function.
14047 (Output_segment_headers::do_print_to_mapfile): New function.
14048 (Output_file_header::do_print_to_mapfile): New function.
14049 (Output_data_const::do_print_to_mapfile): New function.
14050 (class Output_data_const_buffer): Add map_name_ field. Update
14051 constructor. Change all callers. Add do_print_to_mapfile
14053 (class Output_data_fixed_space): Likewise.
14054 (class Output_data_space): Likewise.
14055 (class Output_data_zero_fill): New class.
14056 (Output_data_strtab::do_print_to_mapfile): New function.
14057 (Output_data_reloc_base::do_print_to_mapfile): New function.
14058 (Output_relocatable_relocs::do_print_to_mapfile): New function.
14059 (Output_data_group::do_print_to_mapfile): New function.
14060 (Output_data_got::do_print_to_mapfile): New function.
14061 (Output_data_dynamic::do_print_to_mapfile): New function.
14062 (Output_symtab_xindex::do_print_to_mapfile): New function.
14063 (class Output_section): Declare do_print_to_mapflie. Declare
14064 print_to_mapfile in Input_section.
14065 (class Output_segment): Declare new functions.
14066 * object.h (Sized_relobj::symbol_count): New function.
14067 * script-sections.cc
14068 (Output_section_element_dot_assignment::set_section_addresses):
14069 Change Output_data_fixed_space to Output_data_zero_fill.
14070 (Output_data_expression::do_print_to_mapfile): New function.
14071 * script.cc (read_input_script): Add mapfile parameter. Change
14073 * script.h (read_input_script): Update declaration.
14074 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14075 (Eh_frame::do_print_to_mapfile): New function.
14076 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14077 (Output_merge_string::do_print_to_mapfile): New function.
14078 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14080 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14082 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14084 * Makefile.am (CCFILES): Add mapfile.cc.
14085 (HFILES): Add mapfile.h.
14086 * Makefile.in: Rebuild.
14088 2008-05-19 Ian Lance Taylor <iant@google.com>
14090 * options.h (class General_options): Add -z relro.
14091 * layout.cc (Layout::Layout): Initialize relro_segment_.
14092 (Layout::add_output_section_data): Return the output section.
14093 (Layout::make_output_section): Rcognize relro sections and mark
14094 them appropriately.
14095 (Layout::attach_allocated_section_to_segment): Put relro sections
14096 in a PT_GNU_RELRO segment.
14097 (Layout::create_initial_dynamic_sections): Mark the .dynamic
14099 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14101 (Layout::linkonce_mapping): Map d.rel.ro.local to
14102 .data.rel.ro.local.
14103 (Layout::output_section_name): Us .data.rel.ro.local for any
14104 section which begins with that.
14105 * layout.h (class Layout): Update add_output_section_data
14106 declaration. Add relro_segment_ field.
14107 * output.cc (Output_section::Output_section): Initialize is_relro_
14108 and is_relro_local_ fields.
14109 (Output_segment::add_output_section): Group relro sections.
14110 (Output_segment::is_first_section_relro): New function.
14111 (Output_segment::maximum_alignment): If there is a relro section,
14112 align the segment to the common page size.
14113 (Output_segment::set_section_addresses): Track whether we are
14114 looking at relro sections. If the last section is a relro
14115 section, align to the common page size.
14116 (Output_segment::set_section_list_addresses): Add in_relro
14117 parameter. Change all callers. Align to the page size when
14118 moving from relro to non-relro section.
14119 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14121 * output.h (class Output_section): Add is_relro_ and
14122 is_relro_local_ fields.
14123 (Output_section::is_relro): New function.
14124 (Output_section::set_is_relro): New function.
14125 (Output_section::is_relro_local): New function.
14126 (Output_section::set_is_relro_local): New function.
14127 (class Output_segment): Update declarations.
14128 * i386.cc (Target_i386::got_section): Mark .got section as relro.
14129 * sparc.cc (Target_sparc::got_section): Likewise.
14130 * x86_64.cc (Target_x86_64::got_section): Likewise.
14131 * testsuite/relro_test_main.cc: New file.
14132 * testsuite/relro_test.cc: New file.
14133 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14134 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14135 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14136 (relro_test.so, relro_test_pic.o): New targets.
14137 * testsuite/Makefile.in: Rebuild.
14139 2008-05-16 Ian Lance Taylor <iant@google.com>
14141 * output.cc (Output_segment::add_output_section): Remove front
14143 * output.h (class Output_segment): Remove
14144 add_initial_output_section and overloaded add_output_section.
14145 Update declaration of remaining add_output_section.
14146 * layout.cc (Layout::create_interp): Call add_output_section
14147 rather than add_initial_output_section.
14148 (Layout::finish_dynamic_section): Likewise.
14150 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14151 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
14152 know the dynamic type.
14153 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14154 field. Initialize it in constructor.
14155 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14156 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14157 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14160 * output.cc (Output_reloc::get_address): Change return type to
14162 * output.h (class Output_reloc): Update get_address declaration.
14163 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14164 for section addresses.
14166 2008-05-09 Ian Lance Taylor <iant@google.com>
14169 * gold.cc (gold_nomem): Use return value of write.
14171 2008-05-08 Ian Lance Taylor <iant@google.com>
14173 * symtab.c (Symbol::init_base_output_data): Add version
14174 parameter. Change all callers.
14175 (Symbol::init_base_output_segment): Likewise.
14176 (Symbol::init_base_constant): Likewise.
14177 (Symbol::init_base_undefined): Likewise.
14178 (Sized_symbol::init_output_data): Likewise.
14179 (Sized_symbol::init_output_segment): Likewise.
14180 (Sized_symbol::init_constant): Likewise.
14181 (Sized_symbol::init_undefined): Likewise.
14182 (Symbol_table::do_define_in_output_data): If the new symbol has a
14183 version, mark it as the default.
14184 (Symbol_table::do_define_in_output_segment): Likewise.
14185 (Symbol_table::do_define_as_constant): Likewise.
14186 * symtab.h (class Symbol): Update declarations.
14187 (class Sized_symbol): Likewise.
14188 * resolve.cc (Symbol::override_version): New function.
14189 (Symbol::override_base): Call override_version.
14190 (Symbol::override_base_with_special): Likewise.
14191 * testsuite/ver_script_8.script: New file.
14192 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14193 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14194 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14195 (ver_test_8_1.so, ver_test_8_2.so): New targets.
14197 2008-05-06 Ian Lance Taylor <iant@google.com>
14200 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14202 (class General_options): Remove existing --undefined, and add
14203 --no-undefined instead. Add new --undefined as synonym for -u.
14204 * archive.cc (Archive::add_symbols): Check whether symbol was
14206 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14207 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14208 all uses. Add IS_UNDEFINED. Update declarations to split
14209 different versions of init_base. Declare init_base_undefined.
14210 (Symbol::is_defined): Handle IS_UNDEFINED.
14211 (Symbol::is_undefined): Likewise.
14212 (Symbol::is_weak_undefined): Call is_undefined.
14213 (Symbol::is_absolute): Handle IS_CONSTANT.
14214 (class Sized_symbol): Update declarations to split different
14215 versions of init. Declare init_undefined.
14216 (class Symbol_table): Declare new functions.
14217 * symtab.cc (Symbol::init_base_object): Rename from init_base.
14218 Change all callers.
14219 (Symbol::init_base_output_data): Likewise.
14220 (Symbol::init_base_output_segment): Likewise.
14221 (Symbol::init_base_constant): Likewise.
14222 (Symbol::init_base_undefined): New function.
14223 (Sized_symbol::init_object): Rename from init. Change all
14225 (Sized_symbol::init_output_data): Likewise.
14226 (Sized_symbol::init_output_segment): Likewise.
14227 (Sized_symbol::init_constant): Likewise.
14228 (Sized_symbol::init_undefined): New function.
14229 (Symbol_table::add_undefined_symbols_from_command_line): New
14231 (Symbol_table::do_add_undefined_symbols_from_command_line): New
14233 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14234 (Symbol::output_section): Likewise.
14235 (Symbol::set_output_section): Likewise.
14236 (Symbol_table::sized_finalize_symbol): Likewise.
14237 (Symbol_table::sized_write_globals): Likewise.
14238 * resolve.cc (Symbol_table::should_override): Likewise.
14239 (Symbol::override_base_with_special): Likewise.
14241 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14242 symbol, change it to have default visibility.
14243 * testsuite/protected_1.cc: New file.
14244 * testsuite/protected_2.cc: New file.
14245 * testsuite/protected_3.cc: New file.
14246 * testsuite/protected_main_1.cc: New file.
14247 * testsuite/protected_main_2.cc: New file.
14248 * testsuite/protected_main_3.cc: New file.
14249 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14250 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14251 (protected_1_LDFLAGS, protected_1_LDADD): Define.
14252 (protected_1.so): New target.
14253 (protected_1_pic.o, protected_2_pic.o): New targets.
14254 (protected_3_pic.o): New target.
14255 (check_PROGRAMS): Add protected_2.
14256 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14257 (protected_2_LDFLAGS, protected_2_LDADD): Define.
14258 * testsuite/Makefile.in: Rebuild.
14260 * options.h (DEFINE_var): Add set_user_set_##varname__.
14261 (DEFINE_bool_alias): New macro.
14262 (class General_options): Define -Bstatic using DEFINE_bool_alias
14263 rather than DEFINE_special. Add --undefined as an alias for -z
14265 * options.cc (General_options::parse_Bstatic): Remove.
14267 * options.h (class General_options): Add --fatal-warnings.
14268 * main.cc (main): Implement --fatal-warnings.
14269 * errors.h (Errors::warning_count): New function.
14271 * options.h (class General_options): Add -Bsymbolic-functions.
14272 * symtab.h (Symbol::is_preemptible): Check for
14273 -Bsymbolic-functions.
14275 2008-05-05 Ian Lance Taylor <iant@google.com>
14277 * options.h (DEFINE_bool): For DASH_Z, create the negative option
14278 as noVARNAME rather than no-VARNAME.
14279 (class General_options): Add option -z combreloc.
14280 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14282 (Output_reloc::sort_before) [SHT_REL]: New function.
14283 (Output_reloc::sort_before) [SHT_RELA]: New function.
14284 (class Output_data_reloc_base): Add sort_relocs_ field. Define
14285 Sort_relocs_comparison.
14286 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14287 parameter. Change all callers.
14288 (Output_data_reloc::Output_data_reloc) [both versions]: Add
14289 sort_relocs parameter. Change all callers.
14290 * output.cc (Output_reloc::get_address): New function, broken out
14292 (Output_reloc::write_rel): Call it.
14293 (Output_reloc::compare): New function.
14294 (Output_data_reloc_base::do_write): Optionally sort relocs.
14296 * configure.ac: If targ_extra_obj is set, link it in.
14297 * configure.tgt: Initialize all variables.
14298 (x86_64*): Set targ_extra_obj and targ_extra_size.
14299 * configure: Rebuild.
14301 * object.cc (Sized_relobj::include_section_group): Adjust section
14302 indexes read from group data. Build vector to pass to
14304 * layout.cc (Layout::layout_group): Add flags and shndxes
14305 parameters. Remove contents parameter. Change caller. Update
14306 explicit instantiations.
14307 * layout.h (class Layout): Update layout_group declaration.
14308 * output.cc (Output_data_group::Output_data_group): Add flags and
14309 input_shndxes parameters. Remove contents parameter. Change
14311 (Output_data_group::do_write): Change input_sections_ to
14313 * output.h (class Output_data_group): Update constructor
14314 declaration. Rename input_sections_ to input_shndxes_.
14315 * testsuite/many_sections_test.cc: Add template.
14317 2008-04-30 Cary Coutant <ccoutant@google.com>
14319 * target-reloc.h (relocate_section): Fix dead-pointer bug.
14321 * layout.cc (Layout::include_section): Refactored check for debug
14323 (Layout::add_comdat): Add new parameters. Change type
14324 of signature parameter. Add object and shndx to signatures table.
14325 (Layout::find_kept_object): New function.
14326 * layout.h: Include <cstring>.
14327 (Layout::is_debug_info_section): New function.
14328 (Layout::add_comdat): Add new parameters.
14329 (Layout::find_kept_object): New function.
14330 (Layout::Kept_section): New struct.
14331 (Layout::Signatures): Change type of map range.
14332 * object.cc (Relobj::output_section_address): New function.
14333 (Sized_relobj::include_section_group): Add new parameters. Change
14334 calls to Layout::add_comdat. Change to build table of kept comdat
14335 groups and table mapping discarded sections to kept sections.
14336 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
14337 (Sized_relobj::do_layout): Change calls to include_section_group and
14338 include_linkonce_section.
14339 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14340 value to zero when section is discarded.
14341 (Sized_relobj::map_to_kept_section): New function.
14342 * object.h (Relobj::output_section_address): New function.
14343 (Relobj::Comdat_group): New type.
14344 (Relobj::find_comdat_group): New function.
14345 (Relobj::Comdat_group_table): New type.
14346 (Relobj::Kept_comdat_section): New type.
14347 (Relobj::Kept_comdat_section_table): New type.
14348 (Relobj::add_comdat_group): New function.
14349 (Relobj::set_kept_comdat_section): New function.
14350 (Relobj::get_kept_comdat_section): New function.
14351 (Relobj::comdat_groups_): New field.
14352 (Relobj::kept_comdat_sections_): New field.
14353 (Symbol_value::input_value): Update comment.
14354 (Sized_relobj::map_to_kept_section) New function.
14355 (Sized_relobj::include_linkonce_section): Add new parameter.
14356 * target-reloc.h (Comdat_behavior): New type.
14357 (get_comdat_behavior): New function.
14358 (relocate_section): Add code to map a discarded section to the
14359 corresponding kept section when applying a relocation.
14361 2008-04-30 Craig Silverstein <csilvers@google.com>
14363 * dwarf_reader.cc (next_generation_count): New static var.
14364 (Addr2line_cache_entry): New struct.
14365 (addr2line_cache): New static var.
14366 (Dwarf_line_info::one_addr2line): Added caching.
14367 (Dwarf_line_info::clear_addr2line_cache): New function.
14368 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14369 cache-size parameter.
14370 (Dwarf_line_info::one_addr2line_cache): New function.
14371 * symtab.cc (Symbol_table::detect_odr_violations): Pass
14372 new cache-size argument to one_addr2line(), and clear cache.
14374 2008-04-28 Cary Coutant <ccoutant@google.com>
14376 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14377 R_386_PC8 relocations.
14379 2008-04-23 Ian Lance Taylor <iant@google.com>
14381 * object.cc (Sized_relobj::include_section_group): Check for
14382 invalid section group.
14384 * object.cc (make_elf_object): Correct test for 64-bit ELF file
14387 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14388 than read for file header.
14389 * archive.cc (Archive::include_member): Likewise.
14391 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
14393 * aclocal.m4: Regenerate.
14394 * configure: Regenerate.
14396 2008-04-19 Ian Lance Taylor <iant@google.com>
14398 * version.cc (version_string): Bump to 1.6.
14400 * testsuite/Makefile.am (many_sections_r_test): New target.
14401 (many_sections_r_test_SOURCES): Remove.
14402 (many_sections_r_test_DEPENDENCIES): Remove.
14403 (many_sections_r_test_LDFLAGS): Remove.
14404 (many_sections_r_test_LDADD): Remove.
14406 * object.cc (Sized_relobj::do_add_symbols): Always pass
14407 local_symbol_count_ to add_from_relobj.
14409 * testsuite/Makefile.am (many_sections_check.h): Only check one in
14410 every thousand variables.
14411 * testsuite/Makefile.in: Rebuild.
14413 * object.cc (Xindex::initialize_symtab_xindex): New function.
14414 (Xindex::read_symtab_xindex): New function.
14415 (Xindex::sym_xindex_to_shndx): New function.
14416 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14418 (Sized_relobj::do_initialize_xindex): New function.
14419 (Sized_relobj::do_read_symbols): Adjust section links.
14420 (Sized_relobj::symbol_section_and_value): Add is_ordinary
14421 parameter. Change all callers.
14422 (Sized_relobj::include_section_group): Adjust section links and
14423 symbol section indexes.
14424 (Sized_relobj::do_layout): Adjust section links.
14425 (Sized_relobj::do_count_local_symbols): Adjust section links and
14426 symbol section indexes.
14427 (Sized_relobj::do_finalize_local_symbols): Distinguish between
14428 ordinary and special symbols.
14429 (Sized_relobj::write_local_symbols): Add symtab_xindex and
14430 dynsym_xindex parameters. Change all callers. Adjust section
14431 links. Use SHN_XINDEX when needed.
14432 (Sized_relobj::get_symbol_location_info): Adjust section links.
14433 Don't get fooled by special symbols.
14434 * object.h (class Xindex): Define.
14435 (class Object): Add xindex_ parameter. Declare virtual functoin
14436 do_initialize_xindex.
14437 (Object::adjust_sym_shndx): New function.
14438 (Object::set_xindex): New protected function.
14439 (class Symbol_value): Add is_ordinary_shndx_ field.
14440 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14441 (Symbol_value::value): Assert ordinary section.
14442 (Symbol_value::initialize_input_to_output_map): Likewise.
14443 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14444 Change all callers.
14445 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
14447 (class Sized_relobj): Update declarations.
14448 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14449 parameter. Change all callers.
14450 (Sized_relobj::adjust_shndx): New function.
14451 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14453 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14454 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
14455 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
14456 (Sized_dynobj::read_dynsym_section): Adjust section links.
14457 (Sized_dynobj::read_dynamic): Likewise.
14458 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
14460 (Sized_dynobj::do_initialize_xindex): New function.
14461 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
14462 do_initialize_xindex.
14463 (Sized_dynobj::adjust_shndx): New function.
14464 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14465 dynsym_xindex_ fields.
14466 (Layout::finalize): Add a call to set_section_indexes before
14467 creating the symtab sections.
14468 (Layout::set_section_indexes): Don't do anything if the section
14469 already has a section index.
14470 (Layout::create_symtab_sections): Add shnum parameter. Change
14471 caller. Create .symtab_shndx section if needed.
14472 (Layout::create_shdrs): Add shstrtab_section parameter. Change
14474 (Layout::allocated_output_section_count): New function.
14475 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14477 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14478 fields. Update declarations.
14479 (Layout::symtab_xindex): New function.
14480 (Layout::dynsym_xindex): New function.
14481 (class Write_symbols_task): Add layout_ field.
14482 (Write_symbols_task::Write_symbols_task): Add layout parameter.
14484 * output.cc (Output_section_headers::Output_section_headers): Add
14485 shstrtab_section parameter. Change all callers.
14486 (Output_section_headers::do_sized_write): Store overflow values
14487 for section count and section string table section index in
14488 section header zero.
14489 (Output_file_header::do_sized_write): Check for overflow of
14490 section count and section string table section index.
14491 (Output_symtab_xindex::do_write): New function.
14492 (Output_symtab_xindex::endian_do_write): New function.
14493 * output.h (class Output_section_headers): Add shstrtab_section_.
14494 Update declarations.
14495 (class Output_symtab_xindex): Define.
14496 (Output_section::has_out_shndx): New function.
14497 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14499 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14500 Change all callers.
14501 (Sized_symbol::init): Likewise.
14502 (Symbol::output_section): Check for ordinary symbol.
14503 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
14504 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
14506 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14507 Change all callers. Simplify handling of symbols from sections
14508 not included in the link.
14509 (Symbol_table::add_from_dynobj): Handle ordinary symbol
14511 (Weak_alias_sorter::operator()): Assert that symbols are
14513 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14515 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14516 parameters. Change all callers.
14517 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
14518 symbol distinction. Use SHN_XINDEX when needed.
14519 (Symbol_table::write_section_symbol): Add symtab_xindex
14520 parameter. Change all callers.
14521 (Symbol_table::sized_write_section_symbol): Likewise. Use
14522 SHN_XINDEX when needed.
14523 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
14525 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
14526 (Symbol::is_defined): Check is_ordinary.
14527 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14528 (Symbol::is_absolute, Symbol::is_common): Likewise.
14529 (class Sized_symbol): Update declarations.
14530 (class Symbol_table): Update declarations.
14531 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14532 parameters. Change all callers.
14533 (Sized_symbol::override): Likewise.
14534 (Symbol_table::override): Likewise.
14535 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
14536 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
14537 is_ordinary, and orig_st_shndx parameters. Change all callers.
14538 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14539 to be in an ordinary section.
14540 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14541 object and is_ordinary parameters. Change all callers.
14542 (Sized_dwarf_line_info::read_relocs): Add object parameter.
14543 Change all callers. Don't add undefined or non-ordinary symbols
14545 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14546 Change all callers.
14547 * dwarf_reader.h (class Sized_dwarf_line_info): Update
14549 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14550 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14551 (Sized_relobj::relocate_sections): Likewise.
14552 * target-reloc.h (scan_relocs): Adjust section symbol index.
14553 (scan_relocatable_relocs): Likewise.
14554 * i386.cc (Scan::local): Check for ordinary symbols.
14555 * sparc.cc (Scan::local): Likewise.
14556 * x86_64.cc (Scan::local): Likewise.
14557 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14558 to symbol_section_and_value.
14559 * testsuite/many_sections_test.cc: New file.
14560 * testsuite/Makefile.am (BUILT_SOURCES): Define.
14561 (check_PROGRAMS): Add many_sections_test.
14562 (many_sections_test_SOURCES): Define.
14563 (many_sections_test_DEPENDENCIES): Define.
14564 (many_sections_test_LDFLAGS): Define.
14565 (BUILT_SOURCES): Add many_sections_define.h.
14566 (many_sections_define.h): New target.
14567 (BUILT_SOURCES): Add many_sections_check.h.
14568 (many_sections_check.h): New target.
14569 (check_PROGRAMS): Add many_sections_r_test.
14570 (many_sections_r_test_SOURCES): Define.
14571 (many_sections_r_test_DEPENDENCIES): Define.
14572 (many_sections_r_test_LDFLAGS): Define.
14573 (many_sections_r_test_LDADD): Define.
14574 (many_sections_r_test.o): New target.
14575 * testsuite/Makefile.in: Rebuild.
14577 2008-04-17 Cary Coutant <ccoutant@google.com>
14579 * errors.cc (Errors::info): New function.
14580 (gold_info): New function.
14581 * errors.h (Errors::info): New function.
14582 * gold.h (gold_info): New function.
14583 * object.cc (Input_objects::add_object): Print trace output.
14584 * options.cc (options::parse_set): New function.
14585 (General_options::parse_wrap): Deleted.
14586 (General_options::General_options): Deleted initializer.
14587 * options.h (options::String_set): New typedef.
14588 (options::parse_set): New function.
14589 (DEFINE_set): New macro.
14590 (General_options::wrap): Changed to use DEFINE_set. Changed
14591 callers of any_wrap_symbols and is_wrap_symbol.
14592 (General_options::trace, General_options::trace_symbol):
14594 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14595 (General_options::wrap_symbols_): Deleted.
14596 * symtab.cc (Symbol_table::add_from_object): Print trace output.
14598 2008-04-17 David S. Miller <davem@davemloft.net>
14600 * options.cc (General_options::parse_V): New function.
14601 * options.h: Add entries for -V and -Qy.
14603 2008-04-17 Ian Lance Taylor <iant@google.com>
14605 * common.cc (Symbol_table::allocate_commons): Remove options
14606 parameter. Change caller.
14607 (Symbol_table::do_allocate_commons): Remove options parameter.
14608 Change caller. Just call do_allocate_commons_list twice.
14609 (Symbol_table::do_allocate_commons_list): New function, broken out
14610 of do_allocate_commons.
14611 * common.h (class Allocate_commons_task): Remove options_ field.
14612 Update constructor.
14613 * symtab.cc (Symbol_table::Symbol_table): Initialize
14615 (Symbol_table::add_from_object): Put TLS common symbols on
14617 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14618 which are IN_OUTPUT_DATA.
14619 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
14620 allocate_commons and do_allocate_commons declarations. Declare
14621 do_allocate_commons_list.
14622 * gold.cc (queue_middle_tasks): Update creation of
14623 Allocate_commons_task to not pass options.
14624 * testsuite/Makefile.am (INCLUDES): Add -I.. .
14625 (TLS_TEST_C_FLAGS): New variable.
14626 (tls_test_c_pic.o): New target.
14627 (tls_test_shared.so): Link in tls_test_c_pic.o.
14628 (tls_test_c_pic_ie.o): New target.
14629 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14630 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14631 (tls_test_c.o): New target.
14632 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14633 (tls_pic_test_LDADD): Likewise.
14634 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14635 (tls_shared_gd_to_ie_test_LDADD): Likewise.
14636 (tls_test_c_gnu2.o): New target.
14637 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14639 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14640 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14641 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14642 * testsuite/tls_test.cc: Include "config.h".
14643 (t_last): Call t11_last.
14644 * testsuite/tls_test.h (t11, t11_last): Declare.
14645 * testsuite/tls_test_c.c: New file.
14646 * testsuite/tls_test_main.cc (thread_routine): Call t11.
14647 * configure.ac: Check for OpenMP support.
14648 * configure, config.in, Makefile.in: Rebuild.
14649 * testsuite/Makefile.in: Rebuild.
14651 2008-04-16 Cary Coutant <ccoutant@google.com>
14653 * i386.cc (Target_i386::define_tls_base_symbol): New function.
14654 (Target_i386::tls_base_symbol_defined_): New field.
14655 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14656 (Target_i386::Scan::global): Likewise.
14657 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14658 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14659 (Target_x86_64::tls_base_symbol_defined_): New field.
14660 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14661 (Target_x86_64::Scan::global): Likewise.
14663 2008-04-16 Cary Coutant <ccoutant@google.com>
14665 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14666 (Symbol::needs_plt_entry): Allow weak undefined symbols.
14667 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14668 building shared libraries.
14669 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14670 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14671 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14672 * testsuite/Makefile.in: Rebuild.
14673 * testsuite/weak_undef.h: New file.
14674 * testsuite/weak_undef_file1.cc: Add extra test cases.
14675 * testsuite/weak_undef_file2.cc: Likewise.
14676 * testsuite/weak_undef_test.cc: Likewise.
14678 2008-04-16 David S. Miller <davem@davemloft.net>
14680 * sparc.cc (Target_sparc::Scan): Change from struct to class.
14681 Add issued_non_pic_error_ field. Declare check_non_pic.
14682 (Target_sparc::Scan::check_non_pic): New function.
14683 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14684 (Target_sparc::Scan::global): Likewise.
14686 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14687 * configure: Rebuild.
14689 * options.h (DEFINE_enable): New macro.
14690 (new_dtags): New enable option.
14691 (initfirst, interpose, loadfltr, nodefaultlib,
14692 nodelete, nodlopen, nodump): New -z options.
14693 * layout.cc (Layout:finish_dynamic_section): If new
14694 dtags enabled, emit DT_RUNPATH. Also, emit a
14695 DT_FLAGS_1 containing any specified -z flags.
14697 2008-04-16 Ian Lance Taylor <iant@google.com>
14699 * copy-relocs.cc: New file.
14700 * copy-relocs.h: New file.
14701 * reloc.cc: Remove Copy_relocs code.
14702 * reloc.h: Likewise.
14703 * reloc-types.h (struct Reloc_types) [both versions]: Add
14704 get_reloc_addend_noerror.
14705 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14706 variants of add_global which take an addend which must be zero.
14707 * i386.cc: Include "copy-relocs.h".
14708 (class Target_i386): Change type of copy_relocs_ to variable,
14709 update initializer.
14710 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14711 Change all callers.
14712 (Target_i386::do_finalize_sections): Change handling of
14714 * sparc.cc: Include "copy-relocs.h".
14715 (class Target_sparc): Change type of copy_relocs_ to variable,
14716 update initializer.
14717 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14718 Change all callers.
14719 (Target_sparc::do_finalize_sections): Change handling of
14721 * x86_64.cc: Include "copy-relocs.h".
14722 (class Target_x86_64): Change type of copy_relocs_ to variable,
14723 update initializer.
14724 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14725 class. Change all callers.
14726 (Target_x86_64::do_finalize_sections): Change handling of
14728 * Makefile.am (CCFILES): Add copy-relocs.cc.
14729 (HFILES): Add copy-relocs.h.
14731 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14733 * testsuite/script_test_4.sh: Permit leading zeroes.
14735 2008-04-15 Ian Lance Taylor <iant@google.com>
14737 * script-sections.cc (Script_sections::create_segments): Use
14738 header_size_adjustment even when there is enough room for the
14740 * testsuite/script_test_4.sh: New file.
14741 * testsuite/script_test_4.t: New file.
14742 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14743 (check_DATA): Add script_test_4.stdout.
14744 (MOSTLYCLEANFILES): Likewise.
14745 (script_test_4): New target.
14746 (script_test_4.stdout): New target.
14747 * testsuite/Makefile.in: Rebuild.
14749 * sparc.cc: Add definitions for Output_data_plt_sparc class
14752 2008-04-14 David S. Miller <davem@davemloft.net>
14754 * sparc.cc: New file.
14755 * Makefile.am (TARGETSOURCES): Add sparc.cc
14756 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14757 * configure.tgt: Document targ_extra_size and
14758 targ_extra_big_endian. Add entries for sparc-* and
14760 * configure.ac: Handle targ_extra_size and
14761 targ_extra_big_endian.
14762 * Makefile.in: Rebuild.
14763 * configure: Likewise.
14764 * po/POTFILES.in: Likewise.
14765 * po/gold.pot: Likewise.
14767 2008-04-14 Ian Lance Taylor <iant@google.com>
14769 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14770 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14771 in the name/type/flags to section mapping. Don't call
14772 allocate_output_section.
14773 (Layout::choose_output_section): Change parameter from adjust_name
14774 to is_input_section. Don't permit input sections after sections
14775 are attached to segments. Don't call allocate_output_section.
14776 (Layout::layout_eh_frame): Call update_flags_for_input_section,
14777 not write_enable_output_section.
14778 (Layout::make_output_section): Don't push to
14779 unattached_section_list_ nor call attach_to_segment. Call
14780 attach_section_to_segment if sections are attached.
14781 (Layout::attach_sections_to_segments): New function.
14782 (Layout::attach_section_to_segment): New function.
14783 (Layout::attach_allocated_section_to_segment): Rename from
14784 attach_to_segment. Remove flags parameter.
14785 (Layout::allocate_output_section): Remove function.
14786 (Layout::write_enable_output_section): Remove function.
14787 * layout.h (class Layout): Update for above changes. Add new
14788 field sections_are_attached_.
14789 * output.h (Output_section::update_flags_for_input_section): New
14791 * output.cc (Output_section::add_input_section): Call
14792 update_flags_for_input_section.
14793 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14795 2008-04-11 Cary Coutant <ccoutant@google.com>
14797 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14798 thought unnecessary.
14799 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14801 2008-04-11 Ian Lance Taylor <iant@google.com>
14803 * output.h (class Output_section_data): Remove inline definition
14805 * output.cc (Output_section_data::set_addralign): New function.
14807 2008-04-11 Cary Coutant <ccoutant@google.com>
14809 Add support for TLS descriptors for i386 and x86_64.
14810 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14811 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14812 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14814 (Target_i386::got_mod_index_entry): Remove unnecessary code.
14815 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14816 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
14818 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14819 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14820 Fix problem with initial-exec relocations.
14821 (Target_i386::Relocate::relocate_tls): Likewise.
14822 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14824 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14825 support for section-plus-offset dynamic table entries.
14826 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14827 (Output_data_dynamic::Dynamic_entry): Add support for
14828 section-plus-offset dynamic table entries.
14829 (Output_data_dynamic::Classification): Likewise.
14830 (Output_data_dynamic::classification_): Renamed offset_.
14831 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14832 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14833 (Target_x86_64::make_plt_section): New function.
14834 (Target_x86_64::reserve_tlsdesc_entries): New function.
14835 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14836 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14837 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14838 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14839 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14840 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14841 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14842 add extra PLT entry for TLS descriptors.
14843 (Output_data_plt_x86_64::got_): New field.
14844 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14845 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14847 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14849 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14850 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14851 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14852 R_386_TLS_DESC_CALL relocations.
14853 (Target_x86_64::Scan::global): Likewise.
14854 (Target_x86_64::do_finalize_sections): Add dynamic table entries
14855 for TLS descriptors.
14856 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14857 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14858 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14859 GD-to-IE relaxation.
14860 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14861 and TLS_DESCRIPTORS.
14862 * Makefile.in: Rebuild.
14863 * configure: Rebuild.
14864 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14865 (tls_test_shared2.so): New target.
14866 (tls_shared_gd_to_ie_test_SOURCES): New variable.
14867 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14868 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14869 (tls_shared_gd_to_ie_test_LDADD): New variable.
14870 (tls_shared_gnu2_gd_to_ie_test): New target.
14871 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14873 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14874 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14875 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14876 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14877 (tls_shared_gnu2_test): New target.
14878 (tls_test_gnu2_shared.so): New target.
14879 (tls_shared_gnu2_test_SOURCES): New variable.
14880 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14881 (tls_shared_gnu2_test_LDFLAGS): New variable.
14882 (tls_shared_gnu2_test_LDADD): New variable.
14883 * testsuite/Makefile.in: Rebuild.
14884 * testsuite/Makefile.
14886 2008-04-11 Ian Lance Taylor <iant@google.com>
14888 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14890 * testsuite/Makefile.in: Rebuild.
14892 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14894 * testsuite/script_test_2.cc (main): Adjust test.
14896 2008-04-11 David S. Miller <davem@davemloft.net>
14897 Ian Lance Taylor <iant@google.com>
14899 * options.h (General_options): Add entries for '-Y' and
14901 * options.cc (General_options:finalize): If -Y was used, add those
14902 entries to the library path instead of the default "/lib" and
14905 2008-04-11 David S. Miller <davem@davemloft.net>
14907 * testsuite/justsyms.t: Start at 0x100.
14908 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14909 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14911 * testsuite/script_test_2.cc: Adjust string and section length
14914 2008-04-09 Ian Lance Taylor <iant@google.com>
14917 * script-sections.cc (Sections_element::allocate_to_segment): Add
14919 (Output_section_definition::allocate_to_segment): Likewise.
14920 (Orphan_output_section::allocate_to_segment): Likewise.
14921 (Script_sections::attach_sections_using_phdrs_clause): Don't
14922 propagate non-PT_LOAD segments to orphan sections.
14923 * testsuite/Makefile.am (script_test_3.stdout): Generate using
14924 readelf rather than objdump.
14925 * testsuite/script_test_3.sh: Adjust accordingly. Test that
14926 .interp section and PT_INTERP segment are the same size.
14927 * testsuite/Makefile.in: Rebuild.
14929 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14930 aliases for symbols defined in the same object.
14931 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14932 (weak_alias_test_SOURCES): New variable.
14933 (weak_alias_test_DEPENDENCIES): New variable.
14934 (weak_alias_test_LDFLAGS): New variable.
14935 (weak_alias_test_LDADD): New variable.
14936 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14937 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14938 (weak_alias_test_3.o): New target.
14939 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14940 * testsuite/weak_alias_test_main.cc: New file.
14941 * testsuite/weak_alias_test_1.cc: New file.
14942 * testsuite/weak_alias_test_2.cc: New file.
14943 * testsuite/weak_alias_test_3.cc: New file.
14945 2008-04-08 Ian Lance Taylor <iant@google.com>
14947 * options.h (class General_options): Add --noinhibit-exec option.
14948 * main.cc (main): Check --noinhibit-exec.
14950 * options.h (class General_options): Define --wrap as a special
14951 option. Add wrap_symbols_ field.
14952 (General_options::any_wrap_symbols): New function.
14953 (General_options::is_wrap_symbol): New function.
14954 * options.cc (General_options::parse_wrap): New function.
14955 (General_options::General_options): Initialize wrap_symbols_.
14956 * symtab.cc (Symbol_table::wrap_symbol): New function.
14957 (Symbol_table::add_from_object): Handle --wrap.
14958 * symtab.h (class Symbol_table): Declare wrap_symbol.
14959 * target.h (Target::wrap_char): New function.
14960 (Target::Target_info): Add wrap_char field.
14961 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14962 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14963 * testsuite/testfile.cc (Target_test::test_target_info):
14966 * errors.cc (Errors::undefined_symbol): Mention symbol version if
14969 * layout.h (class Layout): Add added_eh_frame_data_ field.
14970 * layout.cc (Layout::Layout): Initialize new field.
14971 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14972 output section until we find a section we merged successfully.
14973 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14974 that the size be non-zero.
14976 * merge.cc (Object_merge_map::get_output_offset): Remove inline
14979 2008-04-08 Craig Silverstein <csilvers@google.com>
14981 * configure.ac: Export new conditional variable HAVE_ZLIB.
14982 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14984 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14985 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14987 2008-04-07 Ian Lance Taylor <iant@google.com>
14989 * version.cc (version_string): Set to "1.5".
14991 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14992 Add issued_non_pic_error_ field. Declare check_non_pic.
14993 (Target_x86_64::Scan::check_non_pic): New function.
14994 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14995 (Target_x86_64::Scan::global): Likewise.
14997 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14998 addend parameter. Change caller. Handle merge sections.
14999 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15000 Address to Addend. Don't add in the result of
15001 local_section_offset, pass down the addend and use the returned
15003 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15004 Update declarations of local_section_offset and symbol_value.
15005 * testsuite/two_file_test_1.cc (t18): New function.
15006 * testsuite/two_file_test_2.cc (f18): New function.
15007 * testsuite/two_file_test_main.cc (main): Call t18.
15008 * testsuite/two_file_test.h (t18, f18): Declare.
15010 * configure.ac: Don't test for objdump, c++filt, or readelf.
15011 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15013 (TEST_READELF): New variable.
15014 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15015 (check_PROGRAMS): Add two_file_strip_test.
15016 (two_file_strip_test): New target.
15017 (check_PROGRAMS): Add two_file_same_shared_strip_test.
15018 (two_file_same_shared_strip_test_SOURCES): New variable.
15019 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15020 (two_file_same_shared_strip_test_LDFLAGS): New variable.
15021 (two_file_same_shared_strip_test_LDADD): New variable.
15022 (two_file_shared_strip.so): New target.
15023 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15024 (ver_test_5.syms, ver_test_7.syms): Likewise.
15025 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15026 (strip_test_3.stdout): Use TEST_OBJDUMP.
15027 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15029 2008-04-04 Cary Coutant <ccoutant@google.com>
15031 * symtab.h (Symbol::is_weak_undefined): New function.
15032 (Symbol::is_strong_undefined): New function.
15033 (Symbol::is_absolute): New function.
15034 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15035 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15037 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15038 (weak_undef_test): New target.
15039 * testsuite/Makefile.in: Rebuild.
15040 * testsuite/weak_undef_file1.cc: New file.
15041 * testsuite/weak_undef_file2.cc: New file.
15042 * testsuite/weak_undef_test.cc: New file.
15044 2008-04-03 Craig Silverstein <csilvers@google.com>
15046 * compressed_output.h (class Output_compressed_section): Use
15048 * compressed_output.cc (zlib_compress): Use unsigned buffers,
15050 (zlib_compressed_suffix): Removed.
15051 (Output_compressed_section::set_final_data_size): Use unsigned
15053 * testsuite/Makefile.am (flagstest_compress_debug_sections):
15054 Fix linker invocation.
15055 (flagstest_o_specialfile_and_compress_debug_sections):
15057 * testsuite/Makefile.in: Regenerated.
15059 2008-04-02 David S. Miller <davem@davemloft.net>
15061 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15062 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15064 2008-04-02 Craig Silverstein <csilvers@google.com>
15068 2008-04-02 Ian Lance Taylor <iant@google.com>
15070 * fileread.cc (File_read::find_view): Add byteshift and vshifted
15071 parameters. Update for new key type to views_. Change all
15073 (File_read::read): Adjust for byteshift in returned view.
15074 (File_read::add_view): New function, broken out of
15075 find_and_make_view.
15076 (File_read::make_view): New function, broken out of
15077 find_and_make_view.
15078 (File_read::find_or_make_view): Add offset and aligned
15079 parameters. Rewrite accordingly. Change all callers.
15080 (File_read::get_view): Add offset and aligned parameters. Adjust
15081 for byteshift in return value.
15082 (File_read::get_lasting_view): Likewise.
15083 * fileread.h (class File_read): Update declarations.
15084 (class File_read::View): Add byteshift_ field. Add byteshift to
15085 constructor. Add byteshift method.
15086 * archive.h (Archive::clear_uncached_views): New function.
15087 (Archive::get_view): Add aligned parameter. Change all callers.
15088 * object.h (Object::get_view): Add aligned parameter. Change all
15090 (Object::get_lasting_view): Likewise.
15092 * fileread.cc (File_read::release): Don't call clear_views if
15093 there are multiple objects.
15094 * fileread.h (File_read::clear_uncached_views): New function.
15095 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15098 2008-03-31 Cary Coutant <ccoutant@google.com>
15100 Add thin archive support.
15101 * archive.cc (Archive::armagt): New const.
15102 (Archive::setup): Remove task parameter and calls to unlock.
15103 (Archive::unlock_nested_archives): New function.
15104 (Archive::read_header): Add nested_off parameter. Change
15106 (Archive::interpret_header): Likewise.
15107 (Archive::include_all_members): Change to handle thin
15109 (Archive::include_member): Likewise.
15110 * archive.h (Archive::Archive): Add new parameters and
15112 (Archive::armagt): New const.
15113 (Archive::setup): Remove task parameter.
15114 (Archive::unlock_nested_archives): New function.
15115 (Archive::read_header): Add nested_off parameter.
15116 (Archive::interpret_header): Likewise.
15117 (Archive::Nested_archive_table): New typedef.
15118 (Archive::is_thin_archive_): New field.
15119 (Archive::nested_archives_): New field.
15120 (Archive::options_): New field.
15121 (Archive::dirpath_): New field.
15122 (Archive::task_): New field.
15123 * readsyms.cc (Read_symbols::do_read_symbols): Add check
15124 for thin archives. Pass additional parameters to
15125 Archive::Archive. Unlock the archive file after calling
15128 2008-03-29 Ian Lance Taylor <iant@google.com>
15130 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15131 version symbol to be local.
15132 * testsuite/ver_test_4.sh: New file.
15133 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15134 (check_DATA): Add ver_test_4.syms.
15135 (ver_test_4.syms): New target.
15136 * testsuite/Makefile.in: Rebuild.
15139 (Output_section::Input_section_sort_entry::has_priority): New
15141 (Output_section::Input_section_sort_entry::match_file_name): New
15143 (Output_section::Input_section_sort_entry::match_section_name):
15145 (Output_section::Input_section_sort_entry::match_section_name_prefix):
15147 (Output_section::Input_section_sort_entry::match_section_file):
15149 (Output_section::Input_section_sort_compare::operator()): Rewrite
15150 using new Input_section_sort_entry functions. Sort crtbegin and
15151 crtend first. Sort sections with no priority before sections with
15153 * testsuite/initpri1.c (d3): Check j != 4.
15154 (cd5): New constructor/destructor function.
15155 (main): Check j != 2.
15157 * symtab.cc (Symbol_table::add_from_object): If we don't use the
15158 new symbol when resolving, don't call set_is_default.
15159 * testsuite/ver_test_7.cc: New file.
15160 * testsuite/ver_test_7.sh: New file.
15161 * testsuite/Makefile.am (ver_test_7.so): New target.
15162 (ver_test_7.o): New target.
15163 (check_SCRIPTS): Add ver_test_7.sh.
15164 (check_DATA): Add ver_test_7.syms.
15165 (ver_test_7.syms): New target.
15167 2008-03-28 Ian Lance Taylor <iant@google.com>
15169 * layout.cc (Layout::layout): If we see an input section with a
15170 name that needs sorting, set the must_sort flag for the output
15172 (Layout::make_output_section): If the name of the output section
15173 indicates that it might require sorting, set the may_sort flag.
15174 * output.h (Output_section::may_sort_attached_input_sections): New
15176 (Output_section::set_may_sort_attached_input_sections): New
15178 (Output_section::must_sort_attached_input_sections): New
15180 (Output_section::set_must_sort_attached_input_sections): New
15182 (class Output_section): Declare Input_section_sort_entry. Define
15183 Input_section_sort_compare. Declare
15184 sort_attached_input_sections. Add new fields:
15185 may_sort_attached_input_sections_,
15186 must_sort_attached_input_sections_,
15187 attached_input_sections_are_sorted_.
15188 * output.cc (Output_section::Output_section): Initialize new
15190 (Output_section::add_input_section): Add an entry to
15191 input_sections_ if may_sort or must_sort are true.
15192 (Output_section::set_final_data_size): Call
15193 sort_attached_input_sections if necessary.
15194 (Output_section::Input_section_sort_entry): Define new class.
15195 (Output_section::Input_section_sort_compare::operator()): New
15197 (Output_section::sort_attached_input_sections): New function.
15198 * configure.ac: Check whether the compiler supports constructor
15199 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
15200 * testsuite/initpri1.c: New file.
15201 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15202 CONSTRUCTOR_PRIORITY.
15203 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15204 (initpri1_LDFLAGS): New variable.
15205 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15207 2008-03-27 Ian Lance Taylor <iant@google.com>
15209 * common.cc (Sort_commons::operator): Correct sorting algorithm.
15210 * testsuite/common_test_1.c: New file.
15211 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15212 (common_test_1_SOURCES): New variable.
15213 (common_test_1_DEPENDENCIES): New variable.
15214 (common_test_1_LDFLAGS): New variable.
15216 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15217 and commons_ correctly when NAME/VERSION does not override
15219 * testsuite/ver_test_6.c: New file.
15220 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15221 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15222 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15224 2008-03-26 Ian Lance Taylor <iant@google.com>
15226 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15227 of an undefined symbol from a version script.
15228 * testsuite/Makefile.am (ver_test_5.so): New target.
15229 (ver_test_5.o): New target.
15230 (check_SCRIPTS): Add ver_test_5.sh.
15231 (check_DATA): Add ver_test_5.syms.
15232 (ver_test_5.syms): New target.
15233 * testsuite/ver_test_5.cc: New file.
15234 * testsuite/ver_test_5.script: New file.
15235 * testsuite/ver_test_5.sh: New file.
15236 * Makefile.in, testsuite/Makefile.in: Rebuild.
15239 Fix problems building gold with gcc 4.3.0.
15240 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15241 (gold_error_at_location, gold_warning_at_location): Use it.
15242 * configure.ac: Check whether we can compile and use a template
15243 function with a printf attribute.
15244 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15245 when jumping over bytes.
15246 * object.cc: Instantiate Object::read_section_data.
15247 * debug.h: Include <cstring>
15248 * dwarf_reader.cc: Include <algorithm>
15249 * main.cc: Include <cstring>.
15250 * options.cc: Include <cstring>.
15251 * output.cc: Include <cstring>.
15252 * script.cc: Include <cstring>.
15253 * script.h: Include <string>.
15254 * symtab.cc: Include <cstring> and <algorithm>.
15255 * target-select.cc: Include <cstring>.
15256 * version.cc: Include <string>.
15257 * testsuite/testmain.cc: Include <cstdlib>.
15258 * configure, config.in: Rebuild.
15260 2008-03-25 Ian Lance Taylor <iant@google.com>
15262 * options.cc: Include "../bfd/bfdver.h".
15263 (options::help): Print bug reporting address.
15265 * version.cc (print_version): Adjust output for current value of
15266 BFD_VERSION_STRING.
15270 * options.cc (options::help): Print list of supported targets.
15271 * target-select.h: Include <vector>.
15272 (class Target_selector): Make machine_, size_, and is_big_endian_
15273 fields const. Add bfd_name_ and instantiated_target_ fields.
15274 (Target_selector::Target_selector): Add bfd_name parameter.
15275 (Target_selector::recognize): Make non-virtual, call
15277 (Target_selector::recognize_by_name): Make non-virtual, call
15278 do_recognize_by_name.
15279 (Target_selector::supported_names): New function.
15280 (Target_selector::bfd_name): New function.
15281 (Target_selector::do_instantiate_target): New pure virtual
15283 (Target_selector::do_recognize): New virtual function.
15284 (Target_selector::do_recognize_by_name): New virtual function.
15285 (Target_selector::instantiate_target): New private function.
15286 (supported_target_names): Declare.
15287 * target-select.cc (Target_selector::Target_selector): Update for
15288 new parameter and fields.
15289 (select_target_by_name): Check that the name matches before
15290 calling recognize_by_name.
15291 (supported_target_names): New function.
15292 * i386.cc (class Target_selector_i386): Update Target_selector
15293 constructor call. Remove recognize and recognize_by_name. Add
15294 do_instantiate_target.
15295 * x86_64.cc (class Target_selector_x86_64): Likewise.
15296 * testsuite/testfile.cc (class Target_selector_test): Update for
15297 changes to Target_selector.
15299 * README: Rewrite, with some notes on unsupported features.
15301 2008-03-24 Cary Coutant <ccoutant@google.com>
15303 * i386.cc (Target_i386::Got_type): New enum declaration.
15304 (Target_i386::Scan::local): Updated callers of Output_data_got
15306 (Target_i386::Scan::global): Likewise.
15307 (Target_i386::Relocate::relocate): Likewise.
15308 (Target_i386::Relocate::relocate_tls): Likewise.
15309 * object.h (Got_offset_list): New class.
15310 (Sized_relobj::local_has_got_offset): Added got_type parameter.
15311 (Sized_relobj::local_got_offset): Likewise.
15312 (Sized_relobj::set_local_got_offset): Likewise.
15313 (Sized_relobj::local_has_tls_got_offset): Removed.
15314 (Sized_relobj::local_tls_got_offset): Removed.
15315 (Sized_relobj::set_local_tls_got_offset): Removed.
15316 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15317 * output.cc (Output_data_got::add_global): Added got_type parameter.
15318 (Output_data_got::add_global_with_rel): Likewise.
15319 (Output_data_got::add_global_with_rela): Likewise.
15320 (Output_data_got::add_global_pair_with_rel): New function.
15321 (Output_data_got::add_global_pair_with_rela): New function.
15322 (Output_data_got::add_local): Added got_type parameter.
15323 (Output_data_got::add_local_with_rel): Likewise.
15324 (Output_data_got::add_local_with_rela): Likewise.
15325 (Output_data_got::add_local_pair_with_rel): New function.
15326 (Output_data_got::add_local_pair_with_rela): New function.
15327 (Output_data_got::add_global_tls): Removed.
15328 (Output_data_got::add_global_tls_with_rel): Removed.
15329 (Output_data_got::add_global_tls_with_rela): Removed.
15330 (Output_data_got::add_local_tls): Removed.
15331 (Output_data_got::add_local_tls_with_rel): Removed.
15332 (Output_data_got::add_local_tls_with_rela): Removed.
15333 * output.h (Output_data_got::add_global): Added got_type parameter.
15334 (Output_data_got::add_global_with_rel): Likewise.
15335 (Output_data_got::add_global_with_rela): Likewise.
15336 (Output_data_got::add_global_pair_with_rel): New function.
15337 (Output_data_got::add_global_pair_with_rela): New function.
15338 (Output_data_got::add_local): Added got_type parameter.
15339 (Output_data_got::add_local_with_rel): Likewise.
15340 (Output_data_got::add_local_with_rela): Likewise.
15341 (Output_data_got::add_local_pair_with_rel): New function.
15342 (Output_data_got::add_local_pair_with_rela): New function.
15343 (Output_data_got::add_global_tls): Removed.
15344 (Output_data_got::add_global_tls_with_rel): Removed.
15345 (Output_data_got::add_global_tls_with_rela): Removed.
15346 (Output_data_got::add_local_tls): Removed.
15347 (Output_data_got::add_local_tls_with_rel): Removed.
15348 (Output_data_got::add_local_tls_with_rela): Removed.
15349 * resolve.cc (Symbol::override_base_with_special): Removed
15350 reference to has_got_offset_ field.
15351 * symtab.cc (Symbol::init_fields): Replaced initialization
15352 of got_offset_ with got_offsets_. Removed initialization
15354 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15355 (Symbol::got_offset): Likewise.
15356 (Symbol::set_got_offset): Likewise.
15357 (Symbol::has_tls_got_offset): Removed.
15358 (Symbol::tls_got_offset): Removed.
15359 (Symbol::set_tls_got_offset): Removed.
15360 (Symbol::got_offset_): Removed.
15361 (Symbol::tls_mod_got_offset_): Removed.
15362 (Symbol::tls_pair_got_offset_): Removed.
15363 (Symbol::got_offsets_): New field.
15364 (Symbol::has_got_offset): Removed.
15365 (Symbol::has_tls_mod_got_offset): Removed.
15366 (Symbol::has_tls_pair_got_offset): Removed.
15367 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15368 (Target_x86_64::Scan::local): Updated callers of Output_data_got
15370 (Target_x86_64::Scan::global): Likewise.
15371 (Target_x86_64::Relocate::relocate): Likewise.
15372 (Target_x86_64::Relocate::relocate_tls): Likewise.
15374 2008-03-25 Ben Elliston <bje@au.ibm.com>
15376 * yyscript.y: Fix spelling error in comment.
15378 2008-03-24 Ian Lance Taylor <iant@google.com>
15380 * options.h (class General_options): Define build_id option.
15381 * layout.h (class Layout): Declare write_build_id, create_note,
15382 create_build_id. Add build_id_note_ member.
15383 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15384 "libiberty.h", "md5.h", "sha1.h".
15385 (Layout::Layout): Initialize eh_frame_data_,
15386 eh_frame_hdr_section_, and build_id_note_.
15387 (Layout::finalize): Call create_build_id.
15388 (Layout::create_note): New function, broken out of
15389 Layout::create_gold_note.
15390 (Layout::create_gold_note): Call create_note.
15391 (Layout::create_build_id): New function.
15392 (Layout::write_build_id): New function.
15393 (Close_task_runner::run): Call write_build_id.
15395 * x86_64.cc: Correct license to GPLv3.
15397 2008-03-23 Ian Lance Taylor <iant@google.com>
15399 * options.cc: Include "demangle.h".
15400 (parse_optional_string): New function.
15401 (parse_long_option): Handle takes_optional_argument.
15402 (parse_short_option): Update dash_z initializer. Handle
15403 takes_optional_argument.
15404 (General_options::General_options): Initialize do_demangle_.
15405 (General_options::finalize): Set do_demangle_. Handle demangling
15407 * options.h (parse_optional_string): Declare.
15408 (struct One_option): Add optional_arg field. Update constructor.
15409 Update call constructor calls. Add takes_optional_argument
15411 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
15412 (DEFINE_optional_string): Define.
15413 (General_options::demangle): Change from DEFINE_bool to
15414 DEFINE_optional_string.
15415 (General_options::no_demangle): New function.
15416 (General_options::do_demangle): New function.
15417 (General_options::set_do_demangle): New function.
15418 (General_options::execstack_status_): Move definition to end of
15420 (General_options::static_): Likewise.
15421 (General_options::do_demangle_): New field.
15422 * object.cc (big_endian>::get_symbol_location_info): Call
15423 Options::do_demangle, not Options::demangle.
15424 * symtab.cc (demangle): Likewise.
15426 2008-03-22 Ian Lance Taylor <iant@google.com>
15428 * gold.h: Include <cstddef> and <sys/types.h>
15429 * options.h: Include <cstring>.
15431 2008-03-21 Ian Lance Taylor <iant@google.com>
15433 * Added source code to GNU binutils.
15435 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15437 Copying and distribution of this file, with or without modification,
15438 are permitted in any medium without royalty provided the copyright
15439 notice and this notice are preserved.
15445 version-control: never