1 2013-11-06 Cary Coutant <ccoutant@google.com>
4 * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
7 2013-10-31 Cary Coutant <ccoutant@google.com>
9 Restore support for dwp v2 DWARF package file format.
11 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
12 tu_length parameter. Adjust all callers.
13 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
14 * dwp.cc: Include dwarf.h.
15 (Section_bounds): New struct type.
16 (Unit_set): New struct type.
17 (Dwo_file::Dwo_file): Initialize new data member.
18 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
19 Combine and rename to...
20 (Dwo_file::read_unit_index): ...this.
21 (Dwo_file::sized_read_compunit_index)
22 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
23 (Dwo_file::sized_read_unit_index): ...this.
24 (Dwo_file::copy_section): Remove section_name, is_str_offsets
25 parameters; add section_id parameter.
26 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
27 (Dwo_file::add_unit_set): ...this.
28 (Dwo_file::shndx_map_): Remove.
29 (Dwo_file::sect_offsets_): New data member.
30 (Dwp_output_file::Dwp_output_file): Initialize new data members.
31 (Dwp_output_file::add_section): Rename to...
32 (Dwp_output_file::add_contribution): ...this.
33 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
34 (Dwp_output_file::add_tu_set): Likewise.
35 (Dwp_output_file::Contribution): New type.
36 (Dwp_output_file::Section::contributions): New data member.
37 (Dwp_output_file::Cu_or_tu_set): Remove.
38 (Dwp_output_file::Section::Section): New ctor.
39 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
40 (Dwp_output_file::Dwp_index::Section_table): New type.
41 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
42 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
44 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
45 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
46 (Dwp_output_file::Dwp_index::section_table): New member function.
47 (Dwp_output_file::Dwp_index::section_table_end): New member function.
48 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
49 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
50 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
51 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
52 (Dwp_output_file::Dwp_index::section_table_): New data member.
53 (Dwp_output_file::Dwp_index::section_mask_): New data member.
54 (Dwp_output_file::add_output_section): New member function.
55 (Dwp_output_file::write_new_section): New member function.
56 (Dwp_output_file::write_contributions): New member function.
57 (Dwp_output_file::section_id_map_): New data member.
58 (class Dwo_id_info_reader): Remove.
59 (class Unit_reader): New class.
60 (get_dwarf_section_name): New function.
61 (Dwo_file::read_executable): Adjust initializations of class data.
62 (Dwo_file::read): Add support for v2 package file format.
63 (Dwo_file::read_unit_index): Likewise.
64 (Dwo_file::sized_read_unit_index): Likewise.
65 (Dwo_file::copy_section): Likewise.
66 (Dwo_file::add_unit_set): Likewise.
67 (Dwp_output_file::add_output_section): Likewise.
68 (Dwp_output_file::add_contribution): Likewise.
69 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
71 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
73 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
75 (Dwp_output_file::initialize): Remove unused function.
76 (Dwp_output_file::finalize): Add support for v2 package file format.
77 (Dwp_output_file::write_index): Likewise.
78 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
81 2013-10-31 Cary Coutant <ccoutant@google.com>
83 * configure.ac: Fix check for -fmerge-constants.
84 * configure.ac: Regenerate.
86 2013-10-30 Roland McGrath <mcgrathr@google.com>
88 * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
89 Correct 9-byte nop sequence to match what the assembler generates.
91 2013-10-30 Alan Modra <amodra@gmail.com>
93 * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
94 ppc64_local_entry_offset, ppc64_local_entry_offset,
95 do_read_symbols): New functions.
96 (Powerpc_relobj::e_flags_, st_other_): New vars.
97 (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
98 (Powerpc_dynobj::abiversion, set_abiversion): New functions.
99 (Powerpc_relobj::e_flags_): New var.
100 (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
101 and adjust for ELFv2.
102 (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
103 (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
104 (Powerpc_dynobj::do_find_special_sections): Likewise.
105 (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
106 (Target_powerpc::Branch_info::make_stub): Adjust stub destination
107 to ELFv2 local entry.
108 (Target_powerpc::do_relax): No thread safe barriers needed for
110 (Output_data_plt_powerpc::initial_plt_entry_size_,
111 plt_entry_size): Delete. Replace all uses with
112 first_plt_entry_offset() and plt_entry_size().
113 (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
114 reserved_size parm. Update callers.
115 (Output_data_plt_powerpc::entry_count): Update.
116 (Output_data_plt_powerpc::first_plt_entry_offset): Make private
117 and use Target_powerpc::first_plt_entry_offset().
118 (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
119 rename to plt_entry_size.
120 (Output_data_plt_powerpc::add_ifunc_entry,
121 add_local_ifunc_entry): Adjust reloc for ELFv2.
122 (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
123 (glink_eh_frame_fde_64v2): New.
124 (Stub_table::plt_call_size): Support ELFv2 sizing.
125 (Output_data_glink::add_eh_frame): Use the new FDE.
126 (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
127 (Stub_table::do_write): Write ELFv2 stubs and glink.
128 (Target_powerpc::Relocate::relocate): Replaces nop after call
129 with ld 2,24(1) and adjust local offset destination for ELFv2.
131 2013-10-30 Alan Modra <amodra@gmail.com>
133 * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
134 (Target_powerpc::Scan::global, local): Likewise.
135 (Target_powerpc::Relocate::relocate): Likewise. Check for overflow
136 on all ppc64 @h and @ha relocs.
138 2013-10-14 Alan Modra <amodra@gmail.com>
140 * output.h (Output_data_got::add_constant): Tidy.
141 (Output_data_got::add_constant_pair): New function.
142 * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
143 methods used so as to first call reserve_ent().
145 2013-10-11 Roland McGrath <mcgrathr@google.com>
147 * powerpc.cc (Output_data_got_powerpc): Remove unused methods
148 add_got_entry and add_got_entry_pair.
150 * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
151 (HAVE_PUBNAMES): Likewise.
152 * configure: Regenerate.
154 * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
155 * testsuite/Makefile.in: Regenerate.
157 * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
158 Remove const from declaration.
159 * target.cc (Sized_target::do_adjust_elf_header): Update definition.
160 * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
161 * output.h (Output_file_header): Remove const from member target_
162 and corresponding constructor argument.
163 * output.cc (Output_file_header::Output_file_header): Update prototype.
164 (Output_file_header::do_sized_write): Use this->target_ in place
165 of parameters()->target().
167 * testsuite/undef_symbol.cc (Foo::get_a): New method.
169 * configure.ac (MERGE_CONSTANTS_FLAG): New check.
170 * configure: Regenerate.
171 * Makefile.in: Regenerate.
172 * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
173 * testsuite/merge_string_literals_2.c: Likewise.
174 * testsuite/Makefile.am
175 (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
176 (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
177 literal -fmerge-constants.
178 * testsuite/Makefile.in: Regenerate.
180 * i386.cc (Target_i386): Remove unused member dynbss_.
181 * arm.cc (Target_arm): Likewise.
182 * powerpc.cc (Target_powerpc): Likewise.
183 * sparc.cc (Target_sparc): Likewise.
184 * tilegx.cc (Target_tilegx): Likewise.
185 * x86_64.cc (Target_x86_64): Likewise.
186 * dwarf_reader.h (Dwarf_info_reader): Remove unused members
187 type_signature_, type_offset_.
188 * plugin.h (Plugin_hook): Remove unused member layout_.
189 * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
191 (Read_member): Remove unused members input_objects_, symtab_,
193 (Check_library): Remove unused member symtab_.
194 * archive.h (Lib_group): Remove unused member lib_.
195 * archive.cc (Lib_group::Lib_group): Update initializer.
196 * incremental.h (Incremental_binary): Remove unused member target_.
197 (Incremental_script_entry): Removed unused member script_.
198 * layout.h (Write_symbols_task): Remove unused member input_objects_.
199 * icf.h (Icf): Remove unused member num_tracked_relocs.
201 * gold-threads.h (Once): Conditionalize member was_run_lock_ on
202 [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
204 * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
206 * archive.h: Use struct rather than class for forward declaration
207 of Read_symbols_data.
209 2013-10-07 Cary Coutant <ccoutant@google.com>
212 * testsuite/Makefile.am (icf_test): Fix dependencies.
213 (icf_safe_test): Likewise.
214 (icf_safe_so_test): Likewise.
215 (large_symbol_alignment): Add empty _LDADD rule.
216 * testsuite/Makefile.in: Regenerate.
218 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
221 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
222 relocation for R_X86_64_32 on x32.
224 2013-08-27 Roland McGrath <mcgrathr@google.com>
226 * output.cc (Output_segment::set_section_addresses): Take new
227 Target* argument. If target->isolate_execinstr() and the segment
228 is executable and starts at a target->abi_pagesize() boundary,
229 pad its end out to a target->abi_pagesize() boundary with code fill.
230 * output.h (Output_segment::set_section_addresses): Update decl.
231 * layout.h (Layout::check_output_data_for_reset_values): Take new
232 argument RELAX_OUTPUTS.
233 (Layout): New member relax_output_list_.
234 (Layout::add_relax_output): New method.
235 * layout.cc (Layout::Layout): Update constructor.
236 (Layout::reset_relax_output): New method.
237 (Layout::clean_up_after_relaxation): Call it.
238 (Layout::prepare_for_relaxation): Update caller.
239 (Layout::set_segment_offsets): Update callers of set_section_addresses.
240 Call reset_relax_output before re-processing segments for
241 isolate_execinstr case.
242 (Layout::write_data): Handle relax_output_list_.
243 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
244 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
246 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
249 * object.h: Fix typos.
251 2013-08-16 Roland McGrath <mcgrathr@google.com>
253 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
254 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
256 2013-08-07 Cary Coutant <ccoutant@google.com>
258 Revert support for v2 DWP files:
260 2013-03-01 Cary Coutant <ccoutant@google.com>
262 Add dwp support for v2 DWARF package file format.
263 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
264 tu_length parameter. Adjust all callers.
265 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
266 * dwp.cc: Include dwarf.h.
267 (Section_bounds): New struct type.
268 (Unit_set): New struct type.
269 (Dwo_file::Dwo_file): Initialize new data member.
270 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
271 Combine and rename to...
272 (Dwo_file::read_unit_index): ...this.
273 (Dwo_file::sized_read_compunit_index)
274 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
275 (Dwo_file::sized_read_unit_index): ...this.
276 (Dwo_file::copy_section): Remove section_name, is_str_offsets
277 parameters; add section_id parameter.
278 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
279 (Dwo_file::add_unit_set): ...this.
280 (Dwo_file::shndx_map_): Remove.
281 (Dwo_file::sect_offsets_): New data member.
282 (Dwp_output_file::Dwp_output_file): Initialize new data members.
283 (Dwp_output_file::add_section): Rename to...
284 (Dwp_output_file::add_contribution): ...this.
285 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
286 (Dwp_output_file::add_tu_set): Likewise.
287 (Dwp_output_file::Contribution): New type.
288 (Dwp_output_file::Section::contributions): New data member.
289 (Dwp_output_file::Cu_or_tu_set): Remove.
290 (Dwp_output_file::Section::Section): New ctor.
291 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
292 (Dwp_output_file::Dwp_index::Section_table): New type.
293 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
294 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
296 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
297 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
298 (Dwp_output_file::Dwp_index::section_table): New member function.
299 (Dwp_output_file::Dwp_index::section_table_end): New member function.
300 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
301 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
302 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
303 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
304 (Dwp_output_file::Dwp_index::section_table_): New data member.
305 (Dwp_output_file::Dwp_index::section_mask_): New data member.
306 (Dwp_output_file::add_output_section): New member function.
307 (Dwp_output_file::write_new_section): New member function.
308 (Dwp_output_file::write_contributions): New member function.
309 (Dwp_output_file::section_id_map_): New data member.
310 (class Dwo_id_info_reader): Remove.
311 (class Unit_reader): New class.
312 (get_dwarf_section_name): New function.
313 (Dwo_file::read_executable): Adjust initializations of class data.
314 (Dwo_file::read): Add support for v2 package file format.
315 (Dwo_file::read_unit_index): Likewise.
316 (Dwo_file::sized_read_unit_index): Likewise.
317 (Dwo_file::copy_section): Likewise.
318 (Dwo_file::add_unit_set): Likewise.
319 (Dwp_output_file::add_output_section): Likewise.
320 (Dwp_output_file::add_contribution): Likewise.
321 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
323 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
325 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
327 (Dwp_output_file::initialize): Remove unused function.
328 (Dwp_output_file::finalize): Add support for v2 package file format.
329 (Dwp_output_file::write_index): Likewise.
330 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
333 2013-07-31 Cary Coutant <ccoutant@google.com>
335 * object.cc (Sized_relobj::do_output_section_address): New function.
336 (Sized_relobj): Instantiate explicitly.
337 * object.h (Object::output_section_address): New function.
338 (Object::do_output_section_address): New function.
339 (Sized_relobj::do_output_section_address): New function.
340 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
342 2013-07-30 Cary Coutant <ccoutant@google.com>
343 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
345 * parameters.cc (Parameters::entry): Return target-specific entry
347 * target.h (Target::entry_symbol_name): New function.
348 (Target_info::entry_symbol_name): New data member.
350 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
351 * i386.cc (Target_i386::i386_info): Likewise.
352 (Target_i386_nacl::i386_nacl_info): Likewise.
353 * sparc.cc (Target_sparc::sparc_info): Likewise.
354 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
355 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
356 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
357 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
359 2013-07-22 Sterling Augustine <saugustine@google.com>
361 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
362 Convert parameter shndx to local variable. Add parameters symtab
363 and symtab_size. Scan over section names. Find relocation
364 section corresponding to current section. Create and initialize
365 reloc_mapper_ and reloc_type_.
366 (Dwarf_pubnames_table::read_header): Add assertion. Change
367 unit_length to off_t. Initialize member unit_length_. Fill in field
369 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
370 Initialize new fields unit_length_ and cu_offset_.
371 (Dwarf_pubnames_table::read_section): Update prototype.
372 (Dwarf_pubnames_table::cu_offset): New member function.
373 (Dwarf_pubnames_table::subsection_size): Likewise.
374 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
376 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
377 member functions public.
378 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
379 Update comment. Rework logic. Move repeated parts to...
380 (Gdb_index_info_reader::read_pubtable): ...here. New function.
381 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
382 pubtypes_table_, and stmt_list_offset.
383 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
384 Gdb_index::find_pubtype_offset,
385 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
386 (Gdb_index::pubnames_read): Update prototype and rework logic.
387 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
389 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
390 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
391 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
392 Gdb_index::map_pubtable_to_dies):
394 (Gdb_index::pubnames_read): Update declaration.
395 (Gdb_index::Pubname_offset_map): New type.
396 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
397 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
398 Gdb_index::stmt_list_offset): Declare.
399 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
400 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
401 Gdb_index::pubtypes_offset_): Remove.
403 2013-07-19 Roland McGrath <mcgrathr@google.com>
405 * options.h (General_options): Add -Trodata-segment option.
406 * parameters.cc (Parameters::check_rodata_segment): New function.
407 (Parameters::set_target_once): Call it.
408 * parameters.h (Parameters): Declare it (private member function).
409 * layout.cc (load_seg_unusable_for_headers): New function, broken
410 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
411 then validate rodata segment rather than text segment.
412 (relaxation_loop_body): Call that.
413 (is_text_segment): New function. Don't admit a non-executable
414 segment if TARGET->isolate_execinstr().
415 (set_segment_offsets): Call it. Honor -Trodata-segment option.
417 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
420 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
421 * nacl.h (Sniff_file::View::View): Request aligned view.
423 2013-07-11 Cary Coutant <ccoutant@google.com>
425 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
426 correct BRLT entry size.
428 2013-07-03 Alan Modra <amodra@gmail.com>
430 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
433 2013-07-01 Cary Coutant <ccoutant@google.com>
435 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
437 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
438 (Dwarf_ranges_table::lookup_reloc): New function.
439 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
441 (Dwarf_ranges_table::lookup_reloc): New function.
442 (Dwarf_ranges_table::reloc_type_): New data member.
444 2013-06-27 Jing Yu <jingyu@google.com>
447 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
449 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
450 (Target_powerpc::do_relax): Call the above.
452 2013-06-27 Cary Coutant <ccoutant@google.com>
454 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
455 on garbage collected .opd section.
457 2013-06-27 Alan Modra <amodra@gmail.com>
459 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
461 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
462 (Target_powerpc::do_function_location): Likewise for loc->shndx.
464 2013-06-14 Cary Coutant <ccoutant@google.com>
466 * resolve.cc (Symbol::override_base): Don't override st_type
467 from plugin placeholder symbols.
468 (Symbol_table::resolve): Likewise.
469 (Symbol_table::should_override): Don't complain about TLS mismatch
470 if the TO symbol is a plugin placeholder.
471 * testsuite/Makefile.am (plugin_test_tls): New test.
472 * testsuite/Makefile.in: Regenerate.
473 * testsuite/plugin_test_tls.sh: New test script.
474 * testsuite/two_file_test_2_tls.cc: New test source.
475 * testsuite/two_file_test_tls.cc: New test source.
477 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
479 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
480 the maximum segment alignment is larger than the page size.
481 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
482 correctly aligns the symbols with large alignemnt.
483 * testsuite/Makefile.in: Regenerate.
484 * testsuite/large_symbol_alignment.cc: New file.
486 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
487 Sriraman Tallam <tmsriram@google.com>
489 * options.h (sort_section): New option.
490 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
491 Rename from Input_section_sort_section_name_special_ordering_compare.
492 (Input_section_sort_section_name_compare): New struct.
493 * output.cc (Output_section::Input_section_sort_section_name_compare::
494 operator()): New function.
495 (Output_section::sort_attached_input_sections): Use new sort function
496 for .text if --sort-section=name is specified.
497 * layout.cc (Layout::make_output_section):
498 Add sorting by name when --sort-section=name is specified.
499 * testsuite/Makefile.am (text_section_grouping): Test option
501 * testsuite/Makefile.in: Regenerate.
502 * testsuite/section_sorting_name.cc: New file.
503 * testsuite/section_sorting_name.sh: New file.
505 2013-05-21 Cary Coutant <ccoutant@google.com>
507 * symtab.h (Symbol::is_cxx_vtable): New function.
508 * target-reloc.h (relocate_section): Check for vtable symbol.
509 * testsuite/Makefile.am (missing_key_func.sh): New test case.
510 * testsuite/Makefile.in: Regenerate.
511 * testsuite/missing_key_func.cc: New test source.
512 * testsuite/missing_key_func.sh: New test script.
514 2013-05-21 Cary Coutant <ccoutant@google.com>
516 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
517 type of enclosing symbol.
518 (Relocate_info::location): Check symbol type when describing symbol.
519 * object.h (Symbol_location_info): Remove unused line_number;
520 add enclosing_symbol_type.
521 * testsuite/debug_msg.sh: Adjust expected output.
523 2013-05-13 Cary Coutant <ccoutant@google.com>
525 * configure.ac: Export DEFAULT_TARGET.
526 * configure: Regenerate.
527 * Makefile.in: Regenerate.
528 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
529 * testsuite/Makefile.in: Regenerate.
530 * testsuite/debug_msg.sh: Delete duplicate tests.
531 Don't check undef_int error message match for powerpc where the
532 source file and line number aren't available.
534 2013-05-10 Roland McGrath <mcgrathr@google.com>
536 * options.h (General_options): Add --rosegment-gap option.
537 * options.cc (finalize): --rosegment-gap implies --rosegment.
538 * layout.cc (set_segment_offsets): Let user option override
539 target->rosegment_gap().
541 2013-05-10 Roland McGrath <mcgrathr@google.com>
543 * options.h (General_options): Remove leading space from help
544 messages for -nostdlib and --rosegment.
546 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
549 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
551 2013-05-03 Alan Modra <amodra@gmail.com>
553 * merge.cc (Output_merge_string::do_add_input_section): Correct
554 scan for number of strings. Rename vars to avoid shadowing.
555 Include missing terminator in input_size_.
557 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
559 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
560 Restore empty string handling.
562 2013-05-01 Cary Coutant <ccoutant@google.com>
564 * stringpool.cc (Stringpool_template::new_key_offset): Fix
565 uninitialized warning.
567 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
569 * output.cc (Output_section::add_merge_input_section): Allow
570 to merge sections if the alignment is more than character size.
571 * merge.h (Output_merge_string::Output_merge_string): Remove
573 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
574 only not-null strings. Check the alignment of strings.
576 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
577 alignment as the argument.
578 (Stringpool_template<Stringpool_char>::addralign_): New class member.
579 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
580 Align non-zero length strings according to the addralign_.
581 (Stringpool_template<Stringpool_char>::set_string_offsets):
582 Updating offsets according to the given alignment.
583 * testsuite/Makefile.am (text_section_grouping): Test if string
584 literals are getting merged.
585 * testsuite/Makefile.in: Regenerate.
586 * testsuite/merge_string_literals_1.c: New file.
587 * testsuite/merge_string_literals_2.c: Ditto.
588 * testsuite/merge_string_literals.sh: Ditto.
590 2013-04-26 Ian Lance Taylor <iant@google.com>
592 * target-reloc.h (relocate_section): If the reloc offset is out of
593 range, pass VIEW as NULL to relocate.relocate.
594 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
595 * i386.cc (Target_i386::Relocate::relocate): Likewise.
596 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
597 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
598 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
599 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
601 2013-04-26 Geoff Pike <gpike@chromium.org>
603 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
604 * layout.cc (Hash_task): New class.
605 (Layout::queue_build_id_tasks): New function.
606 (Layout::write_build_id): Handle single-thread portion of build ID
607 computation. (In some cases, all of it is single-threaded.) Replace
608 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
609 functionality in fewer lines of code.
610 * layout.h (Layout::queue_build_id_tasks): New function declaration.
611 * options.h (General_options): make "--build-id" default to tree
612 rather than sha1. Add two new options related to --build-id=tree:
613 --build-id-chunk-size-for-treehash and
614 --build-id-min-file-size-for-treehash.
615 * Makefile.am: add testing of --build-id=tree and related new options
616 (these tests will be invoked by "make check").
617 * Makefile.in: Regenerate.
619 2013-04-25 Alan Modra <amodra@gmail.com>
621 * configure.tgt: Add powerpcle and powerpc64le.
623 2013-04-22 Alan Modra <amodra@gmail.com>
626 * layout.cc (Layout::segment_precedes): Allow more than one
627 segment with the same type and flags.
629 2013-04-15 Cary Coutant <ccoutant@google.com>
631 * layout.cc (Layout::set_relocatable_section_offsets): Don't
632 allocate space in file for BSS sections.
634 2013-04-15 Cary Coutant <ccoutant@google.com>
636 * script-sections.cc (Orphan_output_section): Reset address
637 to zero after each orphaned section for relocatable links.
639 2013-04-15 Cary Coutant <ccoutant@google.com>
641 * symtab.cc (Symbol_table::sized_write_globals): Subtract
642 section starting address for relocatable link.
643 * testsuite/Makefile.am (script_test_11): New test.
644 * testsuite/Makefile.in: Regenerate.
645 * testsuite/script_test_11.c: New source file.
646 * testsuite/script_test_11.t: New linker script.
648 2013-04-13 Alan Modra <amodra@gmail.com>
650 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
651 owner when sections are not adjacent and exceed group size.
652 (Target_powerpc::group_sections): Handle corner case.
653 (Target_powerpc::Branch_info::make_stub): Handle case where
654 stub table doesn't exist due to branches in non-exec sections.
655 (Target_powerpc::Relocate::relocate): Likewise.
657 2013-04-11 Alan Modra <amodra@gmail.com>
660 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
661 .branch_lt to match bfd ld. Adjust comments throughout file.
663 2013-04-04 Ian Lance Taylor <iant@google.com>
666 * object.cc (do_layout_deferred_sections): Handle .eh_frame
667 sections before checking whether they are included in the link.
669 2013-03-29 Sriraman Tallam <tmsriram@google.com>
671 * archive.cc (Archive::get_elf_object_for_member): Create the elf
672 object before calling the plugin claim_file handler. Pass the elf
673 object of the archive to the plugin. Delete the elf object if the
674 plugin claims the file.
676 2013-03-21 Alan Modra <amodra@gmail.com>
678 * layout.cc (Layout::set_segment_offsets): Accept writable .text
681 2013-03-21 Alan Modra <amodra@gmail.com>
683 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
685 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
686 uninitialized" warning.
688 2013-03-20 Alan Modra <amodra@gmail.com>
690 * symtab.h (Symbol::clear_version): New function.
691 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
692 is_needed by weak references. Clear version for symbols defined
693 in as-needed objects that are not needed.
695 2013-03-15 Alan Modra <amodra@gmail.com>
697 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
698 static and public. Add report_err param. Return false for data refs.
699 (Target_powerpc::rela_dyn_section): New overloaded function.
700 (Target_powerpc::plt_, iplt_): Elucidate.
701 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
702 (Output_data_plt_powerpc::do_write): Don't write .iplt.
703 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
704 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
705 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
706 push_branch and make_plt_entry for ifunc syms when
707 reloc_needs_plt_for_ifunc.
708 (Target_powerpc::Relocate::relocate): Don't use plt entry value
709 for ifunc unless reloc_needs_plt_for_ifunc.
711 2013-03-15 Alan Modra <amodra@gmail.com>
713 * gc.h (gc_process_relocs): Don't look through function descriptors.
714 * icf.cc (get_section_contents): Do so here instead.
716 2013-03-13 Alan Modra <amodra@gmail.com>
718 * powerpc.cc (is_branch_reloc): Forward declare.
719 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
720 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
721 false for 64-bit, true for 32-bit non-branch relocs.
722 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
723 * testsuite/Makefile.am (icf_test): Use linker map file instead of
725 (icf_safe_test): Generate linker map file as well as nm output.
726 (icf_safe_so_test): Likewise.
727 * testsuite/Makefile.in: Regenerate.
728 * testsuite/icf_test.sh: Parse linker map file to determine
730 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
731 * testsuite/icf_safe_so_test.sh: Likewise.
732 (X86_32_or_ARM_specific_safe_fold): Merge into..
733 (arch_specific_safe_fold): ..this.
734 (X86_64_specific_safe_fold): Delete unused function.
736 2013-03-12 Alan Modra <amodra@gmail.com>
738 * gc.h (gc_process_relocs): Look through function descriptors
739 to determine shndx, symvalue and addend used by ICF. Tidy
740 variable duplication.
742 2013-03-11 Alan Modra <amodra@gmail.com>
744 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
745 * layout.cc (Layout_task_runner::run): ..to here.
746 * symtab.h (struct Symbol_location): Extract from..
747 (class Symbol_table): ..here.
748 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
749 * target.h (class Target): Add function_location and
750 do_function_location functions.
751 (class Sized_target): Add do_function_location.
752 * object.h (class Sized_relobj_file): Move find_shdr..
753 (class Object): ..to here.
754 * object.cc: Likewise. Update to suit. Instantiate.
755 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
756 * powerpc.cc (class Powerpc_dynobj): New.
757 (Target_powerpc::do_function_location): New function.
758 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
759 (Powerpc_dynobj::do_read_symbols): New function.
760 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
762 2013-03-08 Ian Lance Taylor <iant@google.com>
764 * options.cc (General_options::string_to_object_format): Accept
767 2013-03-08 Alan Modra <amodra@gmail.com>
769 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
771 (struct Post_fde): Move definition to here..
772 * ehframe.cc (struct Post_fde): ..from here.
773 (Cie::write): Don't alloc Post_fde.
774 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
776 2013-03-07 Alan Modra <amodra@gmail.com>
778 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
779 relocation referencing .LC0.
780 * testsuite/discard_locals_test.sh: Remove FIXMEs.
782 2013-03-07 Alan Modra <amodra@gmail.com>
784 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
785 always_inline. Add assembly for powerpc to avoid GOT.
787 2013-03-07 Alan Modra <amodra@gmail.com>
789 * testsuite/script_test_10.sh: Don't test .bss section
792 2013-03-06 Alan Modra <amodra@gmail.com>
794 * powerpc.cc (class Powerpc_relobj): Move some member functions.
795 (Target_powerpc::symval_for_branch): Add symtab param. Update
796 all callers. Handle folded sections.
797 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
799 (Global_symbol_visitor_opd::operator()): Likewise.
801 2013-03-04 Alan Modra <amodra@gmail.com>
803 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
804 * testsuite/Makefile.in: Regenerate.
806 2013-03-01 Cary Coutant <ccoutant@google.com>
808 Add dwp support for v2 DWARF package file format.
809 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
810 tu_length parameter. Adjust all callers.
811 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
812 * dwp.cc: Include dwarf.h.
813 (Section_bounds): New struct type.
814 (Unit_set): New struct type.
815 (Dwo_file::Dwo_file): Initialize new data member.
816 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
817 Combine and rename to...
818 (Dwo_file::read_unit_index): ...this.
819 (Dwo_file::sized_read_compunit_index)
820 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
821 (Dwo_file::sized_read_unit_index): ...this.
822 (Dwo_file::copy_section): Remove section_name, is_str_offsets
823 parameters; add section_id parameter.
824 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
825 (Dwo_file::add_unit_set): ...this.
826 (Dwo_file::shndx_map_): Remove.
827 (Dwo_file::sect_offsets_): New data member.
828 (Dwp_output_file::Dwp_output_file): Initialize new data members.
829 (Dwp_output_file::add_section): Rename to...
830 (Dwp_output_file::add_contribution): ...this.
831 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
832 (Dwp_output_file::add_tu_set): Likewise.
833 (Dwp_output_file::Contribution): New type.
834 (Dwp_output_file::Section::contributions): New data member.
835 (Dwp_output_file::Cu_or_tu_set): Remove.
836 (Dwp_output_file::Section::Section): New ctor.
837 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
838 (Dwp_output_file::Dwp_index::Section_table): New type.
839 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
840 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
842 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
843 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
844 (Dwp_output_file::Dwp_index::section_table): New member function.
845 (Dwp_output_file::Dwp_index::section_table_end): New member function.
846 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
847 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
848 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
849 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
850 (Dwp_output_file::Dwp_index::section_table_): New data member.
851 (Dwp_output_file::Dwp_index::section_mask_): New data member.
852 (Dwp_output_file::add_output_section): New member function.
853 (Dwp_output_file::write_new_section): New member function.
854 (Dwp_output_file::write_contributions): New member function.
855 (Dwp_output_file::section_id_map_): New data member.
856 (class Dwo_id_info_reader): Remove.
857 (class Unit_reader): New class.
858 (get_dwarf_section_name): New function.
859 (Dwo_file::read_executable): Adjust initializations of class data.
860 (Dwo_file::read): Add support for v2 package file format.
861 (Dwo_file::read_unit_index): Likewise.
862 (Dwo_file::sized_read_unit_index): Likewise.
863 (Dwo_file::copy_section): Likewise.
864 (Dwo_file::add_unit_set): Likewise.
865 (Dwp_output_file::add_output_section): Likewise.
866 (Dwp_output_file::add_contribution): Likewise.
867 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
869 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
871 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
873 (Dwp_output_file::initialize): Remove unused function.
874 (Dwp_output_file::finalize): Add support for v2 package file format.
875 (Dwp_output_file::write_index): Likewise.
876 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
879 2013-03-01 Cary Coutant <ccoutant@google.com>
881 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
882 function into class definition in header file.
883 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
884 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
886 (Dwarf_info_reader::check_buffer): Move here from .cc file.
888 2013-02-28 Alan Modra <amodra@gmail.com>
890 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
891 * target.cc (Target::do_plt_fde_location): New function.
892 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
893 accessor function, and constructor param.
894 (struct Post_fde, Post_fdes): Declare.
895 (Cie::write): Add post_fdes param.
896 * ehframe.cc (Fde::write): Use plt_fde_location.
897 (struct Post_fde): Define.
898 (Cie::write): Stash FDEs added post merge mapping.
899 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
900 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
901 (Eh_frame::do_sized_write): Arrange to write post map FDES after
903 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
904 (Target_powerpc::has_glink): New function.
905 (Target_powerpc::do_relax): Add eh_frame info for stubs.
906 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
907 glink_eh_frame_fde_32, default_fde): New data.
908 (Stub_table::eh_frame_added_): New var.
909 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
911 (Stub_table::add_eh_frame): New function.
912 (Output_data_glink::add_eh_frame): New function.
913 (Target_powerpc::make_glink_section): Call add_eh_frame.
915 2013-02-15 Ian Lance Taylor <iant@google.com>
917 * options.h (DEFINE_uint64_alias): Define.
918 (class General_options): Add -Ttext-segment as an alias for
921 2013-02-15 Alan Modra <amodra@gmail.com>
923 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
924 (Stub_table::do_write): ..here, two places.
925 (Stub_table::plt_call_size): Use it here too.
927 2013-02-11 Ian Lance Taylor <iant@google.com>
929 * descriptors.cc (Descriptors::close_all): New function.
930 * descriptors.h (class Descriptors): Declare close_all.
931 (close_all_descriptors): New inline function.
932 * plugin.cc: Include "descriptors.h".
933 (Plugin_manager::cleanup): Call close_all_descriptors.
935 2013-02-06 Alan Modra <amodra@gmail.com>
937 * README: Update coding style link.
939 2013-01-28 Cary Coutant <ccoutant@google.com>
941 * dwp.cc (File_list): New typedef.
942 (Dwo_name_info_reader): New class.
943 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
944 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
945 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
946 (Dwo_file::read_executable): New function.
947 (Dwo_file::read): Move common setup code to ...
948 (Dwo_file::make_object): ... here.
949 (dwp_options): Add --exec/-e.
953 2013-01-24 Sriraman Tallam <tmsriram@google.com>
955 * layout.cc (Layout::layout): Check for option text_reorder.
956 (Layout::make_output_section): Ditto.
957 * options.h (text_reorder): New option.
958 * output.cc (Input_section_sort_compare): Remove special ordering
961 Input_section_sort_section_name_special_ordering_compare::
962 operator()): New function.
963 (Output_section::sort_attached_input_sections): Use new sort function
965 * output.h (Input_section_sort_section_name_special_ordering_compare):
967 * testsuite/Makefile.am (text_section_grouping): Test option
969 * testsuite/Makefile.in: Regenerate.
970 * testsuite/text_section_grouping.sh: Check order of functions without
971 default text reordering.
973 2013-01-18 Mike Frysinger <vapier@gentoo.org>
975 * options.h (General_options): Change default to true for new_dtags.
977 2013-01-18 Mike Frysinger <vapier@gentoo.org>
979 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
980 when enable_new_dtags is false. Only add DT_RUNPATH when
981 enable_new_dtags is true.
983 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
985 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
986 used in declaration and definition consistent.
987 (Target_powerpc::symval_for_branch): Ditto.
989 2013-01-16 Sriraman Tallam <tmsriram@google.com>
991 * testsuite/plugin_final_layout.cc: Fix comment.
993 2013-01-16 Sriraman Tallam <tmsriram@google.com>
995 * layout.cc (Layout::layout): Do not do default sorting for
996 text sections when section ordering is specified.
997 (make_output_section): Ditto.
998 * testsuite/plugin_final_layout.cc: Name the function sections
999 to catch reordering issues.
1001 2013-01-15 Alan Modra <amodra@gmail.com>
1003 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1006 2013-01-15 Alan Modra <amodra@gmail.com>
1008 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1009 * testsuite/Makefile.in: Regenerate.
1011 2013-01-14 Alan Modra <amodra@gmail.com>
1013 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1014 * testsuite/Makefile.in: Regenerate.
1016 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
1019 Fix mingw gold build with plugins enabled
1020 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1021 * configure.ac: Export DLOPEN_LIBS and add headers check.
1022 * plugin.cc: Handle non-dlfcn case.
1023 * Makefile.in: Regenerate.
1024 * config.in: Regenerate.
1025 * configure: Regenerate.
1026 * testsuite/Makefile.in: Regenerate.
1028 2013-01-09 Sriraman Tallam <tmsriram@google.com>
1030 * output.h (sort_attached_input_sections): Change to be public.
1031 * script-sections.cc
1032 (Output_section_definition::set_section_addresses): Sort
1033 attached input sections according to section order before linker
1034 script assigns section addresses.
1035 (Orphan_output_section::set_section_addresses): Sort
1036 attached input sections according to section order before linker
1037 script assigns section addresses.
1038 * Makefile.am (final_layout.sh): Use a simple linker script to
1039 check if section ordering still works.
1040 * Makefile.in: Regenerate.
1042 2013-01-09 Ben Cheng <bccheng@google.com>
1044 * arm.cc (Target_arm::attributes_accept_div): New function.
1045 (Target_arm::attributes_forbid_div): New function.
1046 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1047 attribute using the same new functions as what bfd/elf32_arm.c
1050 2013-01-07 Cary Coutant <ccoutant@google.com>
1053 * output.cc (Output_section::add_input_section): For incremental
1054 updates, don't track input sections that are allocated from patch
1057 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
1058 Ian Lance Taylor <iant@google.com>
1061 * configure.ac (--enable-ld): Removed.
1062 (install_as_default): Set to yes only for --enable-gold=default
1064 * configure: Regenerated.
1066 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
1068 * options.h (General_options): Add -fuse-ld= for GCC linker
1069 option compatibility.
1071 2013-01-04 Cary Coutant <ccoutant@google.com>
1073 * configure.ac: Fix typo restoring CXXFLAGS.
1074 * configure: Regenerate.
1076 2013-01-04 Cary Coutant <ccoutant@google.com>
1078 * testsuite/Makefile.am (CXXLINK_S): New macro.
1079 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1080 * testsuite/Makefile.in: Regenerate.
1082 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
1084 * version.cc (print_version): Update copyright year to 2013.
1086 2012-12-20 Ian Lance Taylor <iant@google.com>
1088 * layout.cc (Layout::special_ordering_of_input_section): New
1090 (Layout::layout): If input section requires special ordering, must
1091 sort input sections.
1092 (Layout::make_output_section): May sort .text input sections.
1093 (Layout::is_section_name_prefix_grouped): Remove.
1094 * layout.h (class Layout): Declare
1095 special_ordering_of_input_section. Don't declare
1096 is_section_name_prefix_grouped.
1097 * output.cc (Output_section::add_input_section): Revert last
1099 (Output_section::Input_section_sort::match_file_name): Don't crash
1100 if called on output section data.
1101 (Output_section::Input_section_sort_compare): Sort based on
1103 (Output_section::Input_section_sort_section_order_index_compare):
1105 (Output_section::sort_attached_input_sections): Likewise.
1107 2012-12-18 Sriraman Tallam <tmsriram@google.com>
1109 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1110 * layout.h (Layout::is_section_name_prefix_grouped): New function.
1111 * output.cc (Output_section::add_input_section): Check if section
1112 name contains special prefix. Keep input sections to sort such
1114 (Output_section::Input_section_sort_section_order_index_compare
1115 ::operator()): Group sections according to prefixes.
1116 (Output_section::sort_attached_input_sections): Add condition to
1117 Input_section_entry constructor call.
1118 * testsuite/Makefile.am (text_section_grouping): New test.
1119 * testsuite/Makefile.in: Regenerate.
1120 * testsuite/text_section_grouping.cc: New file.
1121 * testsuite/text_section_grouping.sh: New file.
1123 2012-12-17 Nick Clifton <nickc@redhat.com>
1125 * Makefile.am: Add copyright notice.
1128 * configure.ac: Likewise.
1129 * ftruncate.c: Likewise.
1130 * Makefile.in: Regenerate.
1132 2012-12-14 Cary Coutant <ccoutant@google.com>
1134 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1135 --no-as-needed flag.
1136 (exception_separate_shared_12_test): Likewise.
1137 (incremental_copy_test): Likewise.
1138 * testsuite/Makefile.in: Regenerate.
1140 2012-12-14 Cary Coutant <ccoutant@google.com>
1142 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1143 (Dwp_output_file::Dwp_index::enter_set): Add assert.
1145 2012-12-12 Alan Modra <amodra@gmail.com>
1147 * powerpc.cc (class Track_tls): New.
1148 (class Relocate, class Scan): Inherit Track_tls.
1149 (Target_powerpc::Scan::local, global): Track tls optimization
1150 and avoid creating plt entry for __tls_get_addr if all uses
1152 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1154 2012-12-12 Alan Modra <amodra@gmail.com>
1156 * options.h (General_options): Add --toc-sort/--no-toc-sort.
1157 Replace no_toc_optimize with toc_optimize.
1158 * output.h (Output_section::input_sections): Provide non-const variant.
1159 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1160 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1162 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1163 (class Sort_toc_sections): New.
1164 (Target_powerpc::do_finalize_sections): Sort toc sections.
1165 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1167 2012-12-10 Roland McGrath <mcgrathr@google.com>
1169 * testsuite/binary_unittest.cc (read_all): New function.
1170 (Sized_binary_test): Use it instead of ::read.
1171 * fileread.cc (do_read): Don't assume pread always reads the whole
1172 amount in a single call.
1174 2012-12-10 Alan Modra <amodra@gmail.com>
1176 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1177 Set EM_PPC64 or EM_PPC here.
1178 (Target_selector_powerpc::do_recognize): Delete.
1180 2012-12-10 Alan Modra <amodra@gmail.com>
1182 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1184 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1186 2012-12-07 Roland McGrath <mcgrathr@google.com>
1188 * testsuite/binary_unittest.cc (Sized_binary_test):
1189 Use open_descriptor rather than ::open.
1191 2012-12-07 Alan Modra <amodra@gmail.com>
1193 * powerpc.cc (Stub_table::do_write): Delete redundant Address
1194 typedef and invalid_address constant.
1195 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1196 instantiate constants.
1198 2012-12-06 Roland McGrath <mcgrathr@google.com>
1200 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1201 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1202 * aclocal.m4: Regenerate.
1203 * configure: Regenerate.
1204 * Makefile.in: Regenerate.
1205 * testsuite/Makefile.in: Regenerate.
1207 2012-12-07 Alan Modra <amodra@gmail.com>
1209 * options.h (General_options): Add no_toc_optimize.
1210 * powerpc.cc (ok_lo_toc_insn): New function.
1211 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1213 2012-12-06 Alan Modra <amodra@gmail.com>
1215 * options.h (General_options): Add plt_align, plt_static_chain,
1216 plt_thread_safe. Update stub_group_size help text.
1217 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1218 for new plt_thread_safe_ var.
1219 (use_plt_offset): Correct comments.
1220 (Target_powerpc::do_relax): Look for thread creation symbols to
1221 determine default plt_thread_safe value. Clear plt call stubs
1222 as well as branch stubs each iteration.
1223 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1225 (l, hi, ha, write_insn): Move earlier.
1226 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1227 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1229 (Stub_table::update_size): Adjust.
1230 (Stub_table::prev_size, set_prev_size): Delete.
1231 (Stub_table::stub_align): Let --plt-align affect result.
1232 (Stub_table::plt_call_size): Calculate sizes for various stubs.
1233 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1234 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1235 (Stub_table::do_write): Support more stub variants.
1237 2012-12-04 Alan Modra <amodra@gmail.com>
1239 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1240 (Target_powerpc::do_define_standard_symbols): New function.
1242 2012-12-03 Alan Modra <amodra@gmail.com>
1244 * output.h: Formatting, whitespace.
1246 2012-12-03 Alan Modra <amodra@gmail.com>
1248 * layout.h (Layout::get_executable_sections): Declare.
1249 * layout.cc (Layout::get_executable_sections): New function.
1250 * arm.cc (Target_arm::group_sections): Use it.
1251 (Arm_output_section::group_sections): Delete now redundant test.
1252 * output.cc (Output_reloc::Output_reloc): Add is_relative.
1253 param to handle relative relocs.
1254 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1255 (Output_data_reloc::add_absolute): Adjust.
1256 (Output_data_reloc::add_relative): New function.
1257 (Output_data::reset_data_size): New function.
1258 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1259 (Output_section::set_addralign): New function.
1260 (Output_section::checkpoint_set_addralign): New function.
1261 (Output_section::clear_section_offsets_need_adjustment): New function.
1262 (Output_section::input_sections): Make public.
1263 * powerpc.cc (class Output_data_brlt_powerpc): New.
1264 (class Stub_table, class Stub_control): New.
1265 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1266 stub_table_, set_stub_table, stub_table): New vectors and accessor
1268 (Target_powerpc::do_may_relax, do_relax, push_branch,
1269 new_stub_table, stub_tables, brlt_section, group_sections,
1270 add_branch_lookup_table, find_branch_lookup_table,
1271 write_branch_lookup_table, make_brlt_section): New functions.
1272 (Target_powerpc::struct Sort_sections, class Branch_info): New.
1273 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1274 branch_info_): New vars.
1275 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1276 make call stubs here.
1277 (Output_data_glink): Remove all call stub handling from this class.
1278 (Target_powerpc::Scan::local, global): Save interesting branch
1279 relocs and relocs for ifunc. Adjust calls to plt entry functions.
1280 (Target_powerpc::do_finalize_sections): Only make reg save/restore
1281 functions on final link.
1282 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1283 Handle long branch destinations too.
1284 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1285 do_plt_address_for_local): Adjust lookup of plt call stubs.
1287 2012-11-30 Alan Modra <amodra@gmail.com>
1289 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1290 relocs against protected symbols when building 32-bit shared libs.
1292 2012-11-30 Alan Modra <amodra@gmail.com>
1294 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1295 param. Call got_section() to make .got. Update all callers
1296 and their callers and so on.
1298 2012-11-30 Alan Modra <amodra@gmail.com>
1300 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1301 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1302 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1303 value if it already exists.
1305 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
1308 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1310 2012-11-14 Roland McGrath <mcgrathr@google.com>
1312 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1313 than bfc instruction for data sandboxing.
1315 2012-11-08 Alan Modra <amodra@gmail.com>
1317 * po/POTFILES.in: Regenerate.
1319 2012-11-05 Alan Modra <amodra@gmail.com>
1321 * configure.ac: Apply 2012-09-10 change to config.in here.
1322 * configure: Regenerate.
1324 2012-11-05 Alan Modra <amodra@gmail.com>
1326 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1327 (struct Opd_ent): Use "Address" rather than "Offset".
1328 (Output_data_got_powerpc::got_base_offset): Return Valtype.
1329 (Target_powerpc::got_section): Make public.
1330 (Target_powerpc::scan_relocs): Move code setting symbols..
1331 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1332 Create _SDA_BASE_ only when referenced.
1334 2012-11-02 Roland McGrath <mcgrathr@google.com>
1336 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1339 2012-11-01 Roland McGrath <mcgrathr@google.com>
1341 * target.h (Sized_target::relocate_relocs): Use Elf_Off
1342 for offset_in_output_section parameter.
1343 (Sized_target::relocate_special_relocatable): Likewise.
1344 * arm.cc (Target_arm::relocate_relocs): Likewise.
1345 (Target_arm::relocate_special_relocatable): Likewise.
1346 * i386.cc (Target_i386::relocate_relocs): Likewise.
1347 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1348 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1349 * target-reloc.h (relocate_relocs): Likewise.
1350 * testsuite/testfile.cc (Target_test): Likewise.
1351 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1352 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1354 * system.h: Move inclusion of <clocale> to after <libintl.h> in
1355 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1357 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1358 parameter, which is unused in the [!F_SETFD] case.
1360 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1361 SYMNDX to off_t before comparing it to this->data_size().
1362 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1363 * incremental.cc (Output_section_incremental_inputs::do_write):
1364 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1366 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1368 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
1370 * gold.cc (Target_arm::do_adjust_elf_header): Add the
1371 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1374 2012-10-29 Cary Coutant <ccoutant@google.com>
1376 * dwp.cc (usage): Add file and exit status parameters;
1377 add --help and --version options.
1378 (print_version): New function.
1379 (main): Add --help and --version options.
1381 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1383 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1384 final_layout_sequence.txt.
1385 * testsuite/Makefile.in: Regenerated.
1387 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1389 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1390 COMPILE generated by automake.
1392 (CXXCOMPILE1): Likewise.
1393 (CXXLINK1): Likewise.
1394 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1396 (CXXCOMPILE): Likewise.
1397 (CXXLINK): Likewise.
1398 * testsuite/Makefile.in: Regenerated.
1400 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1402 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1403 on bad fwrite return.
1405 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1407 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1410 2012-10-23 Cary Coutant <ccoutant@google.com>
1412 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1413 * testsuite/Makefile.in: Regenerate.
1414 * testsuite/dwp_test.h: New source file.
1415 * testsuite/dwp_test_1.cc: New source file.
1416 * testsuite/dwp_test_1.s: New source file.
1417 * testsuite/dwp_test_1.sh: New source file.
1418 * testsuite/dwp_test_1b.cc: New source file.
1419 * testsuite/dwp_test_1b.s: New source file.
1420 * testsuite/dwp_test_2.cc: New source file.
1421 * testsuite/dwp_test_2.s: New source file.
1422 * testsuite/dwp_test_2.sh: New source file.
1423 * testsuite/dwp_test_main.cc: New source file.
1424 * testsuite/dwp_test_main.s: New source file.
1426 2012-10-23 Cary Coutant <ccoutant@google.com>
1428 * dwp.h: New header file.
1429 * dwp.cc: New source file.
1430 * gold.h: Move shared declarations to system.h.
1431 * system.h: New header file.
1432 * Makefile.am: Add dwp.
1433 * Makefile.in: Regenerate.
1435 2012-10-23 Cary Coutant <ccoutant@google.com>
1437 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1438 Dwarf_info_reader::read_from_pointer.
1439 (Dwarf_pubnames_table::read_header): Likewise.
1440 (Dwarf_pubnames_table::next_name): Likewise.
1441 (Dwarf_die::read_attributes): Likewise.
1442 (Dwarf_die::skip_attributes): Likewise.
1443 (Dwarf_info_reader::read_from_pointer): New function template.
1444 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1445 (Dwarf_pubnames_table): Likewise.
1446 (Dwarf_info_reader::read_from_pointer): New function template.
1447 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1448 Dwarf_pubnames_table ctor.
1450 2012-10-23 Cary Coutant <ccoutant@google.com>
1452 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1454 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1456 (Dwarf_info_reader::set_abbrev_shndx): New method.
1457 (Dwarf_info_reader::abbrev_shndx_): New data member.
1459 2012-10-23 Cary Coutant <ccoutant@google.com>
1461 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1462 from object, not parameters.
1463 (Dwarf_info_reader::parse): Likewise.
1464 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1465 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1466 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1469 2012-10-23 Cary Coutant <ccoutant@google.com>
1471 * fileread.cc (Input_file::Input_file): New constructor.
1472 * fileread.h (class Input_file): Add new constructor.
1474 2012-10-18 Alan Modra <amodra@gmail.com>
1477 * object.cc (Relobj::is_section_name_included): Also match
1478 .sdata personality section.
1480 2012-10-18 Alan Modra <amodra@gmail.com>
1482 * target-reloc.h (class Default_comdat_behavior): New, package up..
1483 (get_comdat_behaviour): ..this.
1484 (relocate_section): Add Relocate_comdat_behavior template arg,
1485 adjust code to suit.
1486 * arm.cc (Target_arm::relocate_section): Adjust to suit.
1487 (Target_arm::scan_reloc_section): Likewise.
1488 * i386.cc (Target_i386::relocate_section): Likewise.
1489 * sparc.cc (Target_sparc::relocate_section): Likewise.
1490 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1491 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1492 * powerpc.cc (class Relocate_comdat_behavior): New.
1493 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
1494 gold::relocate_section with new template arg.
1496 2012-10-18 Alan Modra <amodra@gmail.com>
1498 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1499 dynamic relocs for GOT_TPREL got entries, without symbol if
1501 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1502 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1503 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1505 2012-10-17 Alan Modra <amodra@gmail.com>
1508 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1510 2012-10-16 Sriraman Tallam <tmsriram@google.com>
1512 * layout.cc (Layout::include_section): Keep sections marked
1513 SHF_EXCLUDE when doing relocatable links.
1515 2012-10-16 Alan Modra <amodra@gmail.com>
1517 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1518 (Target_powerpc::do_finalize_sections): Call it.
1519 (Output_data_save_res): New class and supporting functions.
1520 (Target_powerpc::symval_for_branch): Only look up .opd entry for
1521 normal symbols defined in object files.
1523 2012-10-12 Alan Modra <amodra@gmail.com>
1525 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1526 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
1527 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1528 section if scan_opd_relocs not yet called.
1529 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1531 2012-10-12 Alan Modra <amodra@gmail.com>
1533 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1534 add_local_ifunc_entry): Revert last change.
1535 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1537 2012-10-05 Alan Modra <amodra@gmail.com>
1539 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1540 do_plt_address_for_global): New functions.
1541 (Output_data_got_powerpc::do_write): Don't segfault when linking
1543 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1544 add_local_ifunc_entry): Return true on adding entry..
1545 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1546 glink->add_entry call. Remove unused symtab param. Adjust calls.
1547 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1548 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
1549 set up symbols here.
1550 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1551 syms here. Do so even when no .iplt. Don't segfault when linking
1553 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
1554 new variants without reloc param.
1555 (Glink_sym_ent::Glink_sym_ent): Likewise.
1556 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1557 reloc when refs will resolve to plt call stub.
1558 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
1559 R_PPC_PLTREL24 to resolve locally.
1560 (Target_powerpc::Scan::global): Correct ifunc handling.
1561 (Target_powerpc::Relocate::relocate): Correct local sym glink
1562 lookup. Don't destroy "value" when we have a plt call stub,
1563 and when checking plt call validity.
1564 (Target_powerpc::do_dynsym_value): Simplify.
1566 2012-10-05 Alan Modra <amodra@gmail.com>
1568 * i386.cc (Output_data_plt_i386::address_for_global,
1569 address_for_local): Add plt offset to returned value. Adjust uses.
1570 * sparc.cc (Output_data_plt_sparc::address_for_global,
1571 address_for_local): Likewise.
1572 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1573 address_for_local): Likewise.
1574 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1575 address_for_local): Likewise.
1576 * target.h (Target::plt_address_for_global, plt_address_for_local):
1578 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1579 (Output_data_got::Got_entry::write): Nor here.
1580 * output.h: Comment fix.
1582 2012-10-02 Jiong Wang <jiwang@tilera.com>
1584 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1585 global_offset_table_ value for larget got.
1586 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1588 2012-09-29 Alan Modra <amodra@gmail.com>
1590 * powerpc.cc (Target_powerpc::iplt_): New output section.
1591 (Target_powerpc::iplt_section, make_iplt_section,
1592 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1593 (Target_powerpc::make_plt_entry): Handle ifunc syms.
1594 Target_powerpc::plt_entry_count): Count iplt entries too.
1595 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1596 reloc section in constructor. New params.
1597 (Target_powerpc::make_plt_section): Create reloc section here instead.
1598 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1600 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1601 (Output_data_glink::add_entry, find_entry): New functions to
1602 deal with local syms.
1603 (Glink_sym_ent): Add support for local syms.
1604 (Output_data_glink::do_write): Handle ifunc plt entries.
1605 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1606 (Target_powerpc::Scan::local, global): Handle ifunc syms.
1607 (Target_powerpc::Relocate::relocate): Likewise.
1608 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1610 2012-09-25 Alan Modra <amodra@gmail.com>
1612 * object.h (Sized_relobj_file::adjust_local_symbol,
1613 do_adjust_local_symbol): New functions.
1614 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1615 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1616 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1617 and irregular opd entry spacing.
1618 (Powerpc_relobj::do_read_relocs): Add opd size checks.
1619 (Global_symbol_visitor_opd): New functor.
1620 (Target_powerpc::do_finalize_sections): Omit global symbols defined
1621 on deleted opd entries.
1623 2012-09-15 Jiong Wang <jiwang@tilera.com>
1625 * tilegx.cc: New file.
1626 * Makefile.am (TARGETSOURCES): Add tilegx.cc
1627 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1628 * configure.tgt: Add entries for tilegx*.
1629 * configure.ac: Likewise.
1630 * Makefile.in: Rebuild.
1631 * configure: Likewise.
1632 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1635 2012-09-13 Alan Modra <amodra@gmail.com>
1637 * target-reloc.h (scan_relocs): Call scan.local for relocs
1638 against symbols in discarded sections. Pass is_discarded
1640 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1641 Add is_discarded param.
1642 * powerpc (Target_powerpc::Scan::local): Likewise. Use
1643 is_discarded to flag opd entry as discarded. Don't emit dyn
1644 relocs on such entries.
1645 (Target_powerpc::Scan::global): Similarly detect and handle
1647 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1648 opd_ent_. Update all uses.
1649 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1650 (Target_powerpc::relocate_section): Zero out discarded opd
1653 2012-09-12 Ian Lance Taylor <iant@google.com>
1656 * output.cc: Rename Output_data_got template parameter from size
1657 to got_size for all functions. Compile all variants of
1659 (Output_data_got::Got_entry::write): Correct use of size for
1660 symbol value. Use local_is_tls rather than casting to
1662 * object.h (class Object): Add local_is_tls and do_local_is_tls.
1663 (class Sized_relobj_file): Add do_local_is_tls.
1664 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1666 2012-09-11 Alan Modra <amodra@gmail.com>
1669 * layout.cc (Layout::set_segment_offsets): When using
1670 common-page-size alignment, ensure we are on a new max-page-size
1672 * output.cc (Output_segment::set_section_addresses): Use
1673 abi_pagesize, not common_pagesize for relro boundary.
1674 (Output_segment::set_offset): Likewise.
1676 2012-09-11 Alan Modra <amodra@gmail.com>
1678 * output.h (Output_data_got::add_global_tls, add_local_tls,
1679 add_local_tls_pair): New functions.
1680 (Output_data_got::add_local_pair_with_rel): Remove second
1681 reloc param. Expand comment.
1682 (Output_data_got::Got_entry): Rename use_plt_offset_ to
1683 use_plt_or_tls_offset_, similarly for constructor param.
1684 (Output_data_got::Got_entry::write): Add got_index param.
1685 * output.cc (Output_data_got::add_global_tls, add_local_tls,
1686 add_local_tls_pair): New functions.
1687 (Output_data_got::Got_entry::write): Handle tls symbols
1688 with use_plt_or_tls_offset_ set specially.
1689 (Output_data_got::add_local_pair_with_rel): Only one reloc.
1690 (Output_data_got::do_write): Replace iterator with index, pass
1691 index to entry write function.
1692 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1693 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1694 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1696 * i386.cc (Target_i386::Scan::local): Likewise.
1697 * sparc.cc (Target_sparc::Scan::local): Likewise.
1698 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1699 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1700 do_tls_offset_for_global): New functions.
1701 (Target_powerpc::Scan::local): Correct TLS relocations and got
1703 (Target_powerpc::Scan::global): Don't emit unnecessary
1704 dynamic relocations on TLS GOT entries.
1706 2012-09-10 Matthias Klose <doko@ubuntu.com>
1708 * config.in: Disable sanity check for kfreebsd.
1710 2012-09-10 Sterling Augustine <saugustine@google.com>
1712 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1713 (Gdb_index::pubtypes_read): New parameter.
1714 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1716 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1719 2012-09-09 Alan Modra <amodra@gmail.com>
1721 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1722 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1723 * gc.h (gc_process_relocs): Call target gc_add_reference.
1724 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1725 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1726 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1728 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1729 to cater for when we don't need code offset. Update use.
1730 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1731 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1732 set_opd_valid): New functions.
1733 (Target_powerpc::do_gc_add_reference): New function.
1734 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1736 (Target_powerpc::do_gc_mark_symbol): New function.
1738 2012-09-06 Cary Coutant <ccoutant@google.com>
1740 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1741 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1742 (Dwarf_die::skip_attributes): Likewise.
1743 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1744 * testsuite/gdb_index_test.cc (inline_func_1): New function.
1746 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1748 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
1750 * testsuite/script_test_3.t: Add .got.plt output section
1752 * testsuite/script_test_4.t: Likewise.
1754 2012-09-05 Alan Modra <amodra@gmail.com>
1756 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1757 update all uses and lose "enum" when using type.
1759 2012-09-05 Alan Modra <amodra@gmail.com>
1761 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1762 * configure: Regenerate.
1763 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1764 (plugin_final_layout.stdout): Likewise.
1765 (memory_test): Set page sizes to 0x1000.
1766 * testsuite/Makefile.in: Regenerate.
1767 * testsuite/discard_locals_test.sh: Add FIXME comment.
1768 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1769 * testsuite/pr14265.t: Add .got output section statement.
1770 * testsuite/script_test_2.t: Likewise.
1771 * testsuite/script_test_3.t: Likewise.
1772 * testsuite/script_test_4.t: Likewise.
1773 * testsuite/script_test_5.t: Likewise.
1774 * testsuite/script_test_6.t: Likewise.
1775 * testsuite/script_test_7.t: Likewise.
1776 * testsuite/script_test_9.t: Likewise.
1778 2012-09-05 Alan Modra <amodra@gmail.com>
1780 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1781 (Powerpc_relocate_functions::Status): New typedef.
1782 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1783 (Target_powerpc::Scan::local): Handle REL64.
1784 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1785 for REL32 and REL64.
1786 (Target_powerpc::symval_for_branch): New function, extracted from..
1787 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
1788 checks. Report overflow errors.
1790 2012-09-05 Alan Modra <amodra@gmail.com>
1792 * object.h (Sized_relobj_file::emit_relocs): Delete.
1793 (Sized_relobj_file::emit_relocs_reltype): Delete.
1794 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1795 relocate_relocs for --emit-relocs.
1796 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1797 * output.h: Update comment.
1798 (Output_segment::first_section): New function.
1799 (Output_segment::first_section_load_address): Use first_section.
1800 * output.cc (Output_segment::first_section): New function extracted..
1801 (Output_segment::first_section_load_address): ..from here. Delete.
1802 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1803 * target.h (Sized_target::relocate_for_relocatable): Likewise.
1804 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1805 adjust call to target.h function.
1806 * i386.cc (Target_i386): Likewise.
1807 * sparc.cc (Target_sparc): Likewise.
1808 * x86_64.cc (Target_x86_64): Likewise.
1809 * powerpc.cc (Target_powerpc): Likewise.
1810 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
1811 first tls section has section symbol for optimised local dynamic
1813 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1814 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1816 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1817 Rename to relocate_relocs. Update error message.
1819 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
1821 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1824 2012-08-31 Alan Modra <amodra@gmail.com>
1826 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1827 (Powerpc_relobj::toc_base_offset): New stub function.
1828 (Target_powerpc): Add tp_offset, dtp_offset. Rename
1829 got_mod_index_offset to tlsld_got_offset. Update all refs.
1830 (Target_powerpc::Relocate::enum skip_tls): New.
1831 (Target_powerpc::call_tls_get_addr_): New var.
1832 (Target_powerpc::is_branch_reloc): Move to file scope.
1833 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1834 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1836 (Target_powerpc::enum Got_type): Delete old values, add new ones.
1837 (powerpc_info): Correct common_pagesize for ppc64.
1838 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1839 (Powerpc_relocate_functions): Add overflow check enums and functions.
1840 Add non-shift version of rela, rela_ua. Delete all rel public
1841 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
1842 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1843 addr16_ha3, addr14 functions.
1844 (Output_data_got_powerpc::add_constant_pair): New function.
1845 (Output_data_got_powerpc::got_base_offset): Likewise.
1846 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1847 (instruction constants): Sort, add some more.
1848 (Output_data_glink::do_write): Add and use Address typedef. Use
1849 object->toc_base_offset() stub for 64-bit.
1850 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1851 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1852 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1853 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
1854 Always treat .opd relocs as against locally defined symbol.
1855 Correct condition for RELATIVE relocs.
1856 (Target_powerpc::do_finalize_sections): Test for NULL sections.
1857 (Target_powerpc::Relocate::relocate): Use plt call stub as value
1858 for 32-bit syms with a plt entry. Correct ppc64 toc base
1859 calculations. Handle TLS relocs, and more. Add overflow
1860 checking and adjust for Powerpc_relocate_functions changes.
1861 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1862 Reinstate --emit-relocs code with FIXME.
1864 2012-08-30 Alan Modra <amodra@gmail.com>
1866 * layout.cc (Layout::set_segment_offsets): Set p_align to
1867 abi_pagesize, not common_pagesize.
1868 (Layout::relaxation_loop_body): Similarly use abi_pagesize
1869 to determine whether file header can go in segment.
1871 2012-08-30 Alan Modra <amodra@gmail.com>
1873 * output.h (Output_reloc::Output_reloc <output section>): Add
1874 is_relative param. Adjust calls.
1875 (Output_reloc::add_output_section_relative): New functions.
1876 * output.cc (Output_reloc::Output_reloc <output section>): Handle
1878 (Output_reloc::symbol_value): Handle SECTION_CODE.
1880 2012-08-24 Sriraman Tallam <tmsriram@google.com>
1882 * gold.cc (queue_middle_tasks): Call layout again when unique
1883 segments for sections is desired.
1884 * layout.cc (Layout::Layout): Initialize new members.
1885 (Layout::get_output_section_flags): New function.
1886 (Layout::choose_output_section): Call get_output_section_flags.
1887 (Layout::layout): Make output section for mapping to a unique segment.
1888 (Layout::insert_section_segment_map): New function.
1889 (Layout::attach_allocated_section_to_segment): Make unique segment for
1890 output sections marked so.
1891 (Layout::segment_precedes): Check for unique segments when sorting.
1892 * layout.h (Layout::Unique_segment_info): New struct.
1893 (Layout::Section_segment_map): New typedef.
1894 (Layout::insert_section_segment_map): New function.
1895 (Layout::get_output_section_flags): New function.
1896 (Layout::is_unique_segment_for_sections_specified): New function.
1897 (Layout::set_unique_segment_for_sections_specified): New function.
1898 (Layout::unique_segment_for_sections_specified_): New member.
1899 (Layout::section_segment_map_): New member.
1900 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1901 Rename is_gc_pass_one to is_pass_one.
1902 Rename is_gc_pass_two to is_pass_two.
1903 Rename is_gc_or_icf to is_two_pass.
1904 Check for which pass based on whether symbols data is present.
1905 Make it two pass when unique segments for sections is desired.
1906 * output.cc (Output_section::Output_section): Initialize new
1908 * output.h (Output_section::is_unique_segment): New function.
1909 (Output_section::set_is_unique_segment): New function.
1910 (Output_section::is_unique_segment_): New member.
1911 (Output_section::extra_segment_flags): New function.
1912 (Output_section::set_extra_segment_flags): New function.
1913 (Output_section::extra_segment_flags_): New member.
1914 (Output_section::segment_alignment): New function.
1915 (Output_section::set_segment_alignment): New function.
1916 (Output_section::segment_alignment_): New member.
1917 (Output_segment::Output_segment): Initialize is_unique_segment_.
1918 (Output_segment::is_unique_segment): New function.
1919 (Output_segment::set_is_unique_segment): New function.
1920 (Output_segment::is_unique_segment_): New member.
1921 * plugin.cc (allow_unique_segment_for_sections): New function.
1922 (unique_segment_for_sections): New function.
1923 (Plugin::load): Add new functions to transfer vector.
1924 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1925 * Makefile.in: Regenerate.
1926 * testsuite/plugin_final_layout.sh: Check if unique segment
1927 functionality works.
1928 * testsuite/plugin_section_order.c (onload): Check if new interfaces
1930 (allow_unique_segment_for_sections): New global.
1931 (unique_segment_for_sections): New global.
1932 (claim_file_hook): Call allow_unique_segment_for_sections.
1933 (all_symbols_read_hook): Call unique_segment_for_sections.
1935 2012-08-22 Cary Coutant <ccoutant@google.com>
1937 * layout.cc (Layout::include_section): Don't assert on GROUP
1938 sections with --emit-relocs.
1940 2012-08-21 Cary Coutant <ccoutant@google.com>
1942 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1943 if --export-dynamic-symbol names an undef symbol.
1945 2012-08-18 Alan Modra <amodra@gmail.com>
1947 * powerpc.cc: Formatting and white space.
1948 (Powerpc_relobj): Rename got2_section_ to special_.
1949 Add opd_ent_shndx_ and opd_ent_off_ vectors.
1950 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1951 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1952 (Target_powerpc): Add Address typedef and invalid_address. Use
1954 (Target_powerpc::is_branch_reloc): New function.
1955 (Powerpc_relocate_functions): Add Address typedef, use throughout.
1956 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1957 for dst_mask, value and addend.
1958 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1959 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1960 (Output_data_glink::do_write): Correct toc base. Don't try to use
1961 uint16_t for 24-bit offset. Use get_output_section_offset and
1963 (Target_powerpc::Scan::local): Handle more relocs.
1964 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1965 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1966 Plug in toc restoring insn after plt calls. Translate branches
1967 to function descriptor symbols to corresponding entry point.
1968 (Target_powerpc::relocate_for_relocatable): Check return from
1969 get_output_section_offset.
1970 * symtab.h: Comment typo.
1972 2012-08-14 Ian Lance Taylor <iant@google.com>
1974 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1975 unsupported_relocal_local to call unsupported_reloc_global.
1977 2012-08-14 Nick Clifton <nickc@redhat.com>
1980 * script-sections.cc (Sections_element::output_section_name): Add
1981 keep return parameter.
1982 (Output_section_element::match_name): Add keep return parameter.
1983 Return the value of the keep_ member.
1984 * script-sections.h (class Output_section): Update
1985 output_section_name prototype.
1986 * layout.cc (Layout::keep_input_section): New public member
1988 (Layout::choose_output_section): Pass keep parameter to
1989 output_section_name.
1990 * layout.h (class Layout): Add keep_input_section.
1991 * object.cc (Sized_relobj_file::do_layout): Check for kept input
1993 * testsuite/Makefile.am: Add a test.
1994 * testsuite/Makefile.in: Regenerate.
1995 * testsuite/pr14265.c: Source file for the test.
1996 * testsuite/pr14265.t: Linker script for the test.
1997 * testsuite/pr14265.sh: Shell script for the test.
1999 2012-08-14 Alan Modra <amodra@gmail.com>
2001 * target.h (Target::output_section_name): New function.
2002 (Target::do_output_section_name): New function.
2003 * layout.cc (Layout::choose_output_section): Call the above.
2004 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2006 2012-08-14 Alan Modra <amodra@gmail.com>
2008 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2009 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2010 for replace_constant call.
2011 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2012 (Output_data_glink::do_print_to_mapfile): New function.
2013 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2014 (Target_powerpc::Relocate::relocate): Likewise.
2016 2012-08-14 Alan Modra <amodra@gmail.com>
2018 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2019 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2020 (Output_data_glink::add_entry,find_entry): Remove shndx param.
2021 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
2022 all references to shndx_. Handle special case for R_PPC_PLTREL24
2024 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2025 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2026 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2028 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2029 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2031 2012-08-12 Alan Modra <amodra@gmail.com>
2033 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
2034 (glink insn constants): Use uint32_t.
2035 (Output_data_glink::add_entry): Use insert, not [] operator.
2037 2012-08-11 Alan Modra <amodra@gmail.com>
2039 * object.h (Sized_relobj_file::find_shdr): New function.
2040 (Sized_relobj_file::find_special_sections): New function.
2041 * object.cc (Sized_relobj_file::find_shdr): New function.
2042 (Sized_relobj_file::find_eh_frame): Use find_shdr.
2043 (Sized_relobj_file::find_special_sections): New function, split out..
2044 (Sized_relobj_file::do_read_symbols): ..from here.
2045 * output.h (Output_data_got::replace_constant): New function.
2046 (Output_data_got::num_entries): New function.
2047 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2048 (Output_data_got::got_offset): Protected rather than private.
2049 (Output_data_got::replace_got_entry): New function.
2050 * output.cc (Output_data_got::replace_got_entry): New function.
2051 * powerpc.cc (class Powerpc_relobj): New.
2052 (class Powerpc_relocate_functions): Delete all psymval variants or
2053 convert to value,addend type. Delete pcrela, pcrela_unaligned.
2054 Implement _ha functions using corresponding _hi function.
2055 (Powerpc_relobj::find_special_sections): New function.
2056 (Target_powerpc::do_make_elf_object): New function.
2057 (class Output_data_got_powerpc): New.
2058 (class Output_data_glink): New.
2059 (class Powerpc_scan_relocatable_reloc): New.
2060 Many more changes througout file.
2062 2012-08-09 Nick Clifton <nickc@redhat.com>
2064 * po/vi.po: Updated Vietnamese translation.
2066 2012-08-07 Ian Lance Taylor <iant@google.com>
2068 * layout.cc (Layout::add_target_dynamic_tags): If
2069 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2072 2012-07-30 Nick Clifton <nickc@redhat.com>
2074 * po/gold.pot: Updated template.
2075 * po/es.po: Updated Spanish translation.
2077 2012-07-18 Cary Coutant <ccoutant@google.com>
2080 * configure.ac: Add check for -gpubnames support.
2081 * configure: Regenerate.
2082 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2083 support; force -gno-pubnames.
2084 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2086 (gdb_index_test_4): New test.
2087 * testsuite/Makefile.in: Regenerate.
2088 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2089 * testsuite/gdb_index_test_2.sh: Likewise.
2090 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2091 * testsuite/gdb_index_test_4.sh: New script.
2092 * testsuite/gdb_index_test_comm.sh: New script with common code;
2093 don't look for space after colon.
2095 2012-07-16 Sriraman Tallam <tmsriram@google.com>
2097 * gold.cc (queue_middle_tasks): Update function order only after
2098 deferred objects due to plugins are processed.
2100 2012-07-11 Ian Lance Taylor <iant@google.com>
2102 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2103 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2104 (Target_arm::scan_reloc_for_stub): Likewise.
2105 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2106 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2107 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2108 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2109 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2111 2012-07-10 Dodji Seketeli <dodji@redhat.com>
2112 Ian Lance Taylor <iant@google.com>
2115 * configure.ac: Test whether std::tr1::hash<off_t> works.
2116 * gold.h: Add a specialization for std::tr1::hash<off_t> if
2118 * output.h (class Output_fill): Add virtual destructor.
2119 * configure, config.in: Rebuild.
2121 2012-06-22 Roland McGrath <mcgrathr@google.com>
2123 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2125 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
2127 * plugin.cc (Plugin::load): Handle position independent executables.
2129 2012-06-06 Cary Coutant <ccoutant@google.com>
2131 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2133 (lines_only_debug_sections): Likewise.
2134 (gdb_fast_lookup_sections): New static array.
2135 (is_gdb_debug_section): Rename formal parameter.
2136 (is_lines_only_debug_section): Likewise.
2137 (is_gdb_fast_lookup_section): New function.
2138 (Layout::include_section): Check for ".zdebug_" prefix; pass
2139 section name suffix to is_gdb_debug_section, et al.; check for
2140 fast-lookup sections when building .gdb_index.
2141 * options.h (--strip-debug-gdb): Update GDB version number.
2143 2012-06-06 Cary Coutant <ccoutant@google.com>
2145 * configure.ac: Add check for fallocate.
2146 * configure: Regenerate.
2147 * config.in: Regenerate.
2149 * options.h (class General_options): Add --mmap-output-file and
2150 --posix-fallocate options.
2151 * output.cc: (posix_fallocate): Remove; replace with...
2152 (gold_fallocate): New function.
2153 (Output_file::map_no_anonymous): Call gold_fallocate.
2154 (Output_file::map): Check --mmap-output-file option.
2156 2012-06-05 Jing Yu <jingyu@google.com>
2158 * gold.h (textdomain): Add do {} to empty while(0).
2159 (bindtextdomain): Likewise.
2161 2012-06-04 Cary Coutant <ccoutant@google.com>
2163 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2166 2012-05-25 Sriraman Tallam <tmsriram@google.com>
2168 * symtab.cc (Symbol_table::define_special_symbol):
2169 Initialize *poldsym to prevent uninitialized variable errors.
2171 2012-05-23 Cary Coutant <ccoutant@google.com>
2173 * layout.cc (Layout::section_name_mapping): Add rules to handle
2174 exact match on .data.rel.ro.local or .data.rel.ro.
2175 (Layout::output_section_name): Check for exact matches.
2177 2012-05-23 Cary Coutant <ccoutant@google.com>
2179 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2182 2012-05-22 Cary Coutant <ccoutant@google.com>
2184 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2185 object before exporting symbol.
2187 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
2189 * testsuite/tls_test.cc: Include "config.h" first.
2190 * testsuite/tls_test_c.c: Likewise.
2192 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
2193 Nick Clifton <nickc@redhat.com>
2196 * configure.in: Add check that sysdep.h has been included before
2197 any system header files.
2198 * configure: Regenerate.
2199 * config.in: Regenerate.
2201 2012-05-14 Cary Coutant <ccoutant@google.com>
2203 * layout.cc (Layout::make_output_section): Mark .tdata section
2205 * testsuite/relro_test.cc: Add a TLS variable.
2207 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
2210 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2211 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2214 2012-05-08 Cary Coutant <ccoutant@google.com>
2216 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2217 (lines_only_debug_sections): Likewise.
2219 2012-05-02 Roland McGrath <mcgrathr@google.com>
2221 * nacl.cc: New file.
2223 * Makefile.am (CCFILES, HFILES): Add them.
2224 * Makefile.in: Regenerate.
2225 * i386.cc (Output_data_plt_i386_nacl): New class.
2226 (Output_data_plt_i386_nacl_exec): New class.
2227 (Output_data_plt_i386_nacl_dyn): New class.
2228 (Target_i386_nacl): New class.
2229 (Target_selector_i386_nacl): New class.
2230 (target_selector_i386): Use it instead of Target_selector_i386.
2231 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2232 (Target_x86_64_nacl): New class.
2233 (Target_selector_x86_64_nacl): New class.
2234 (target_selector_x86_64, target_selector_x32): Use it instead of
2235 Target_selector_x86_64.
2236 * arm.cc (Output_data_plt_arm_nacl): New class.
2237 (Target_arm_nacl): New class.
2238 (Target_selector_arm_nacl): New class.
2239 (target_selector_arm, target_selector_armbe): Use it instead of
2240 Target_selector_arm.
2242 * target-select.cc (select_target): Take new Input_file* and off_t
2243 arguments, pass them on to recognize method of selector.
2244 * object.cc (make_elf_sized_object): Update caller.
2245 * parameters.cc (parameters_force_valid_target): Likewise.
2246 * incremental.cc (make_sized_incremental_binary): Likewise.
2247 * target-select.h: Update decl.
2248 (Target_selector::recognize): Take new Input_file* argument,
2249 pass it on to do_recognize.
2250 (Target_selector::do_recognize): Take new Input_file* argument.
2251 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2252 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2253 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2254 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2256 * target.h (Target::Target_info): New members isolate_execinstr
2258 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2259 * arm.cc (Target_arm::arm_info): Update initializer.
2260 * i386.cc (Target_i386::i386_info): Likewise.
2261 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2262 * sparc.cc (Target_sparc::sparc_info): Likewise.
2263 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2264 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2265 * layout.cc (Layout::attach_allocated_section_to_segment):
2266 Take new const Target* argument. If target->isolate_execinstr(), act
2268 (Layout::find_first_load_seg): Take new const Target* argument;
2269 if target->isolate_execinstr(), reject PF_X segments.
2270 (Layout::relaxation_loop_body): Update caller.
2271 (Layout::set_segment_offsets): If target->isolate_execinstr(),
2272 reset file offset to zero when we hit LOAD_SEG, and then do a second
2273 loop over the segments before LOAD_SEG to reassign offsets after
2274 addresses have been determined. Handle target->rosegment_gap().
2275 (Layout::attach_section_to_segment): Take new const Target* argument;
2276 pass it to attach_allocated_section_to_segment.
2277 (Layout::make_output_section): Update caller.
2278 (Layout::attach_sections_to_segments): Take new const Target* argument;
2279 pass it to attach_section_to_segment.
2280 * gold.cc (queue_middle_tasks): Update caller.
2281 * layout.h (Layout): Update method decls with new arguments.
2283 * arm.cc (Target_arm::Target_arm): Take optional argument for the
2284 Target_info pointer to use.
2285 (Target_arm::do_make_data_plt): New virtual method.
2286 (Target_arm::make_data_plt): New method that calls it.
2287 (Target_arm::make_plt_entry): Use it.
2288 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2289 for the section alignment.
2290 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2292 (Output_data_plt_arm::first_plt_entry_offset): Call it.
2293 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2295 (Output_data_plt_arm::get_plt_entry_size): Call it.
2296 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2297 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2298 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2300 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2301 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2302 method instead of sizeof(plt_entry).
2303 (Output_data_plt_arm::add_entry): Likewise.
2304 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2305 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2307 (Target_arm::plt_entry_size): Likewise.
2308 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2310 (Output_data_plt_arm_standard): ... here, new class.
2311 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2312 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2313 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2315 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2316 Take additional argument for the PLT entry size.
2317 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2318 Use get_plt_entry_size method rather than plt_entry_size variable.
2319 (Output_data_plt_x86_64::reserve_slot): Likewise.
2320 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2321 (Output_data_plt_x86_64::add_entry): Likewise.
2322 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2323 (Output_data_plt_x86_64::address_for_global): Likewise.
2324 (Output_data_plt_x86_64::address_for_local): Likewise.
2325 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2326 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2327 Make method non-static.
2328 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2330 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2331 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2332 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2333 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2335 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2336 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2338 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2339 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2341 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2342 (Output_data_plt_x86_64::plt_entry_size)
2343 (Output_data_plt_x86_64::first_plt_entry)
2344 (Output_data_plt_x86_64::plt_entry)
2345 (Output_data_plt_x86_64::tlsdesc_plt_entry)
2346 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2347 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2348 (Output_data_plt_x86_64_standard): ... here, new class.
2349 (Target_x86_64::Target_x86_64): Take optional argument for the
2350 Target_info pointer to use.
2351 (Target_x86_64::do_make_data_plt): New virtual method.
2352 (Target_x86_64::make_data_plt): New method to call it.
2353 (Target_x86_64::init_got_plt_for_update): Use that.
2354 Call this->plt_->add_eh_frame method here.
2355 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2356 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2357 rather than static method.
2358 (Target_x86_64::plt_entry_size): Likewise.
2359 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2360 rather than plt_entry_size variable. Move guts of PLT filling to...
2361 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2362 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2363 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2365 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2366 additional argument for the section alignment.
2367 Don't do add_eh_frame_for_plt here.
2368 (Output_data_plt_i386::first_plt_entry_offset): Make the method
2369 non-static. Use get_plt_entry_size method rather than plt_entry_size
2371 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2373 (Output_data_plt_i386::get_plt_entry_size): Call it.
2374 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2375 (Output_data_plt_i386::add_eh_frame): New method to call it.
2376 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2378 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2379 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2381 (Output_data_plt_i386::fill_plt_entry): New method to call it.
2382 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2383 method instead of plt_entry_size.
2384 (Output_data_plt_i386::plt_entry_size)
2385 (Output_data_plt_i386::plt_eh_frame_fde_size)
2386 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2387 (Output_data_plt_i386_standard): ... here, new class.
2388 (Output_data_plt_i386_exec): New class.
2389 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2390 (Output_data_plt_i386_exec::first_plt_entry): ... here.
2391 (Output_data_plt_i386::exec_plt_entry): Move to ...
2392 (Output_data_plt_i386_exec::plt_entry): ... here.
2393 (Output_data_plt_i386_dyn): New class.
2394 (Output_data_plt_i386::first_plt_entry): Move to ...
2395 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2396 (Output_data_plt_i386::dyn_plt_entry): Move to ...
2397 (Output_data_plt_i386_dyn::plt_entry): ... here.
2398 (Target_i386::Target_i386): Take optional argument for the Target_info
2400 (Target_i386::do_make_data_plt): New virtual method.
2401 (Target_i386::make_data_plt): New method to call it.
2402 (Target_i386::make_plt_section): Use that.
2403 Call this->plt_->add_eh_frame method here.
2404 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2405 rather than plt_entry_size variable.
2406 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2407 (Output_data_plt_i386::address_for_local): Likewise.
2408 (Output_data_plt_i386::do_write): Likewise.
2409 Move guts of PLT filling to...
2410 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2411 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2412 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2413 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2415 2012-05-01 Cary Coutant <ccoutant@google.com>
2417 * dwarf_reader.cc (Dwarf_die::read_attributes)
2418 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2419 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2420 * reduced_debug_output.cc
2421 (Output_reduced_debug_info_section::get_die_end): Remove
2422 DW_FORM_GNU_ref_index. Add default case.
2424 2012-04-26 Mark Wielaard <mjw@redhat.com>
2426 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2427 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2428 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2429 DW_AT_high_pc as offset from DW_AT_low_pc.
2431 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2432 * testsuite/Makefile.in: Regenerate.
2433 * testsuite/gdb_index_test_3.c: New test source file.
2434 * testsuite/gdb_index_test_3.sh: New test source file.
2436 2012-04-25 Ian Lance Taylor <iant@google.com>
2438 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2440 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2441 as a class, not a struct.
2442 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2443 (Target_arm::apply_cortex_a8_workaround): Likewise.
2444 * gc.h: Declare Reloc_types as a struct, not a class.
2445 * object.h: Declare Symbols_data as a struct.
2446 * reloc.h: Declare Read_relocs_data as a struct.
2447 * target.h: Declare Relocate_info as a struct.
2449 2012-04-24 David S. Miller <davem@davemloft.net>
2451 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2452 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2455 2012-04-24 Cary Coutant <ccoutant@google.com>
2457 * incremental-dump.cc (find_input_containing_global): Replace
2458 magic number with symbolic constant.
2459 (dump_incremental_inputs): Update version number.
2460 * incremental.cc (Output_section_incremental_inputs): Update version
2461 number; import symbolic constants from Incremental_inputs_reader.
2462 (Incremental_inputs::create_data_sections): Align relocations
2463 section correctly for 64-bit targets.
2464 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2465 constants; add padding.
2466 (Output_section_incremental_inputs::write_header): Add assert for
2468 (Output_section_incremental_inputs::write_input_files): Add assert
2469 for input_entry_size.
2470 (Output_section_incremental_inputs::write_info_blocks): Add padding;
2471 add assert for object_info_size, input_section_entry_size,
2472 global_sym_entry_size.
2473 * incremental.h (Incremental_inputs_reader): Add symbolic constants
2474 for data structure sizes; use them.
2475 (Incremental_input_entry_reader): Import symbolic constants from
2476 Incremental_inputs_reader; use them.
2478 2012-04-23 David S. Miller <davem@davemloft.net>
2480 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2482 (Target_sparc::Target_sparc): Initialize new fields.
2483 (Target_sparc::do_make_elf_object): New function.
2484 (Target_sparc::do_adjust_elf_header): New function.
2486 2012-04-23 Cary Coutant <ccoutant@google.com>
2488 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2489 CU range table of gdb index.
2491 2012-04-20 David S. Miller <davem@davemloft.net>
2493 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2496 2012-04-16 David S. Miller <davem@davemloft.net>
2498 * sparc.cc (Target_sparc::got_address): New function.
2499 (Sparc_relocate_functions::gdop_hix22): New function.
2500 (Sparc_relocate_functions::gdop_lox10): New function.
2501 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2503 (Target_sparc::Scan::local): Likewise if the global symbol is not
2504 preemptible and is not IFUNC.
2505 (Target_sparc::Relocate::relocate): Perform GOTDATA code
2506 transformations for local and non-preemptible non-IFUNC global
2509 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2510 writing out 64-bit part of ranges.
2512 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2513 -fpic and -fpie respectively.
2514 * Makefile.in: Regenerate.
2516 * sparc.cc (class Target_sparc): Add rela_ifunc_.
2517 (Target_sparc::Target_sparc): Initialize new field.
2518 (Target_sparc::do_plt_section_for_global): New function.
2519 (Target_sparc::do_plt_section_for_local): New function.
2520 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2521 (Target_sparc::make_plt_section): New function, broken out of
2522 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
2523 (Target_sparc::make_plt_entry): Call make_plt_section.
2524 (Target_sparc::make_local_ifunc_plt_entry): New function.
2525 (Target_sparc::rela_ifunc_section): New function.
2526 (Target_sparc::plt_section): Remove const.
2527 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
2528 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2529 and ifunc_count_ fields.
2530 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2531 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2532 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2533 (Output_data_plt_sparc::rela_ifunc): New function.
2534 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2535 (Output_data_plt_sparc::has_ifunc_section): New function.
2536 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2537 (Output_data_plt_sparc::address_for_global): New function.
2538 (Output_data_plt_sparc::address_for_local): New function.
2539 (Output_data_plt_sparc::plt_index_to_offset): New function.
2540 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2542 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2544 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2545 R_SPARC_JMP_IREL to switch.
2546 (Target_sparc::Scan::check_non_pic): Likewise.
2547 (Target_sparc::Scan::local): Handle IFUNC symbols.
2548 (Target_sparc::Scan::local): Likewise.
2549 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2550 and plt_address_for_local.
2551 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2552 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2554 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2555 (class Output_data_reloc): Adjust calls to Output_reloc_type.
2556 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2557 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2559 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2560 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2562 * sparc.cc (Target_sparc::Scan::global): Likewise.
2563 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2565 2012-04-16 Cary Coutant <ccoutant@google.com>
2567 * archive.cc (Library_base::should_include_member): Check for
2568 --export-dynamic-symbol.
2569 * options.h (class General_options): Add --export-dynamic-symbol.
2570 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2571 --export-dynamic-symbol.
2572 (Symbol_table::gc_mark_undef_symbols): Likewise.
2573 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2575 2012-04-12 David S. Miller <davem@davemloft.net>
2577 * sparc.cc (Reloc::wdisp10): New relocation method.
2578 (Reloc::h34): Likewise.
2579 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2580 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2582 (Target_sparc::Scan::local): Likewise.
2583 (Target_sparc::Scan::global): Likewise.
2584 (Target_sparc::Relocate::relocate): Likewise.
2586 2012-04-09 Cary Coutant <ccoutant@google.com>
2588 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2591 2012-04-06 Ian Lance Taylor <iant@google.com>
2593 * timer.cc: #include <unistd.h>.
2595 2012-04-06 Roland McGrath <mcgrathr@google.com>
2597 * configure.in (AC_CHECK_HEADERS): Add locale.h.
2598 * config.in: Regenerate.
2599 * configure: Regenerate.
2601 2012-04-05 Nick Clifton <nickc@redhat.com>
2603 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2604 (AM_LC_MESSAGES): Add.
2605 * aclocal.m4: Regenerate.
2606 * config.in: Regenerate.
2607 * configure: Regenerate.
2609 2012-03-21 Cary Coutant <ccoutant@google.com>
2611 * Makefile.am: Add gdb-index.cc, gdb-index.h.
2612 * Makefile.in: Regenerate.
2613 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2614 (Sized_elf_reloc_mapper::symbol_section): New function.
2615 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2616 (make_elf_reloc_mapper): New function.
2617 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2618 (Dwarf_abbrev_table::do_read_abbrevs): New function.
2619 (Dwarf_abbrev_table::do_get_abbrev): New function.
2620 (Dwarf_ranges_table::read_ranges_table): New function.
2621 (Dwarf_ranges_table::read_range_list): New function.
2622 (Dwarf_pubnames_table::read_section): New function.
2623 (Dwarf_pubnames_table::read_header): New function.
2624 (Dwarf_pubnames_table::next_name): New function.
2625 (Dwarf_die::Dwarf_die): New function.
2626 (Dwarf_die::read_attributes): New function.
2627 (Dwarf_die::skip_attributes): New function.
2628 (Dwarf_die::set_name): New function.
2629 (Dwarf_die::set_linkage_name): New function.
2630 (Dwarf_die::attribute): New function.
2631 (Dwarf_die::string_attribute): New function.
2632 (Dwarf_die::int_attribute): New function.
2633 (Dwarf_die::uint_attribute): New function.
2634 (Dwarf_die::ref_attribute): New function.
2635 (Dwarf_die::child_offset): New function.
2636 (Dwarf_die::sibling_offset): New function.
2637 (Dwarf_info_reader::check_buffer): New function.
2638 (Dwarf_info_reader::parse): New function.
2639 (Dwarf_info_reader::do_parse): New function.
2640 (Dwarf_info_reader::do_read_string_table): New function.
2641 (Dwarf_info_reader::lookup_reloc): New function.
2642 (Dwarf_info_reader::get_string): New function.
2643 (Dwarf_info_reader::visit_compilation_unit): New function.
2644 (Dwarf_info_reader::visit_type_unit): New function.
2645 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2646 Sized_elf_reloc_mapper.
2647 (Sized_dwarf_line_info::symbol_section): Remove function.
2648 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2649 (Sized_dwarf_line_info::read_line_mappings): Remove object
2650 parameter, adjust callers.
2651 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2652 * dwarf_reader.h: Include <sys/types.h>.
2653 (class Track_relocs): Remove forward declaration.
2654 (class Elf_reloc_mapper): New class.
2655 (class Sized_elf_reloc_mapper): New class.
2656 (class Dwarf_abbrev_table): New class.
2657 (class Dwarf_range_list): New class.
2658 (class Dwarf_ranges_table): New class.
2659 (class Dwarf_pubnames_table): New class.
2660 (class Dwarf_die): New class.
2661 (class Dwarf_info_reader): New class.
2662 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2663 (Sized_dwarf_line_info::symbol_section): Remove member function.
2664 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2666 * gdb-index.cc: New source file.
2667 * gdb-index.h: New source file.
2668 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2669 and .debug_types sections, call Layout::add_to_gdb_index.
2670 (Sized_relobj_incr::do_section_name): Implement.
2671 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2672 return type; Implement.
2673 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2675 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2676 parameter list and return type.
2677 (Sized_incr_dynobj::do_section_contents): Likewise.
2678 * layout.cc: Include gdb-index.h.
2679 (Layout::Layout): Initialize gdb_index_data_.
2680 (Layout::init_fixed_output_section): Check for .gdb_index section.
2681 (Layout::add_to_gdb_index): New function. Instantiate.
2682 * layout.h: Add forward declaration for class Gdb_index.
2683 (Layout::add_to_gdb_index): New member function.
2684 (Layout::gdb_index_data_): New data member.
2685 * main.cc: Include gdb-index.h.
2686 (main): Print statistics for gdb index.
2687 * object.cc (Object::section_contents): Move code into
2688 do_section_contents.
2689 (need_decompressed_section): Check for sections needed when building
2691 (build_compressed_section_map): Likewise.
2692 (Sized_relobj_file::do_read_symbols): Need local symbols when building
2694 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2695 sections; call Layout::add_to_gdb_index.
2696 (Sized_relobj_file::do_decompressed_section_contents): Call
2697 do_section_contents directly.
2698 * object.h (Object::do_section_contents): Adjust parameter list and
2700 (Object::do_decompressed_section_contents): Call do_section_contents
2702 (Sized_relobj_file::do_section_contents): Adjust parameter list and
2704 * options.h (class General_options): Add --gdb-index option.
2705 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2706 list and return type.
2707 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2708 * reloc.h (Track_relocs::checkpoint): New function.
2709 (Track_relocs::reset): New function.
2711 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2713 * testsuite/Makefile.in: Regenerate.
2714 * testsuite/gdb_index_test.cc: New test source file.
2715 * testsuite/gdb_index_test_1.sh: New test source file.
2716 * testsuite/gdb_index_test_2.sh: New test source file.
2718 2012-03-19 Doug Kwan <dougkwan@google.com>
2720 * arm.cc (Target_arm::do_define_standard_symbols): New method.
2721 (Target_arm::do_finalize_sections): Remove code which defines
2722 __exidx_start and __exidx_end. Make symbol table parameter
2723 anonymous as it is not used.
2724 * gold.cc (queue_middle_tasks): Call target hook to define any
2725 target-specific symbols.
2726 * target.h (Target::define_standard_symbols): New method.
2727 (Target::do_define_standard_symbols): Same.
2728 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2729 * testsuite/Makefile.in: Regenerate.
2730 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2732 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2733 relocations are generated for __exidx_start and __exidx_end.
2735 2012-03-16 Doug Kwan <dougkwan@google.com>
2737 * testsuite/Makefile.am: Disable test initpri3b.
2738 * testsuite/Makefile.in: Regenerate.
2740 2012-03-15 Doug Kwan <dougkwan@google.com>
2742 * arm.cc (Target_arm::got_section): Make .got section read-only
2745 2012-03-15 Ian Lance Taylor <iant@google.com>
2748 * layout.cc (Layout::make_output_section): Correctly mark
2749 SHT_INIT_ARRAY, et. al., as relro.
2751 2012-03-14 Doug Kwan <dougkwan@google.com>
2753 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2754 dynamic relocations for protected symbols in shared objects.
2756 2012-03-13 Ian Lance Taylor <iant@google.com>
2758 * resolve.cc (Symbol_table::resolve): When merging common symbols,
2759 keep the larger alignment.
2761 2012-03-12 Cary Coutant <ccoutant@google.com>
2763 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2764 handling of DW_LNE_define_file.
2766 2012-03-12 Cary Coutant <ccoutant@google.com>
2768 * reduced_debug_output.cc
2769 (Output_reduced_debug_info_section::get_die_end): Add new FORM
2772 2012-02-29 Cary Coutant <ccoutant@google.com>
2774 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2776 2012-02-29 Cary Coutant <ccoutant@google.com>
2778 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2779 Call Object::decompressed_section_contents.
2780 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2782 (Sized_dwarf_line_info::buffer_start_): New data member.
2783 * merge.cc (Output_merge_data::do_add_input_section): Call
2784 Object::decompressed_section_contents.
2785 (Output_merge_string::do_add_input_section): Likewise.
2786 * object.cc (need_decompressed_section): New function.
2787 (build_compressed_section_map): Decompress sections needed later.
2788 (Sized_relobj_file::do_decompressed_section_contents): New function.
2789 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2790 * object.h (Object::decompressed_section_contents): New function.
2791 (Object::discard_decompressed_sections): New function.
2792 (Object::do_decompressed_section_contents): New function.
2793 (Object::do_discard_decompressed_sections): New function.
2794 (Compressed_section_info): New type.
2795 (Compressed_section_map): Include decompressed section contents.
2796 (Sized_relobj_file::do_decompressed_section_contents): New function.
2797 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2799 2012-02-16 Cary Coutant <ccoutant@google.com>
2801 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2802 * testsuite/Makefile.in: Regenerate.
2804 2012-02-14 Cary Coutant <ccoutant@google.com>
2806 * options.cc (General_options::finalize): Disallow -pie and -static.
2808 2012-02-03 Doug Kwan <dougkwan@google.com>
2810 * arm.cc (Arm_relocate_functions::abs8,
2811 Arm_relocate_functions::abs16): Use
2812 Bits::has_signed_unsigned_overflow32.
2813 (Arm_relocate_functions::thm_abs8): Correct range of
2815 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2818 2012-02-02 Doug Kwan <dougkwan@google.com>
2820 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2821 position independent outputs, not just shared objects.
2823 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
2825 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2826 * configure: Regenerated.
2828 2012-01-27 Ian Lance Taylor <iant@google.com>
2830 * reloc.h (Bits): New class with static functions, copied from
2831 namespace utils in arm.cc.
2832 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
2835 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2837 * incremental.cc (write_info_blocks): Correct relocation offset.
2839 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2841 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2842 (Relocate::tls_gd_to_le): Likewise.
2844 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2846 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2848 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2850 * configure.ac: Check if -mcmodel=medium works.
2851 * configure: Regenerated.
2853 2012-01-24 Cary Coutant <ccoutant@google.com>
2855 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2857 (read_unsigned_LEB_128_x): ... this new function.
2858 (read_signed_LEB_128): Replaced with inline definition and ...
2859 (read_signed_LEB_128_x): ... this new function.
2860 * int_encoding.h (read_unsigned_LEB_128_x): New function.
2861 (read_unsigned_LEB_128): Add inline definition.
2862 (read_signed_LEB_128_x): New function.
2863 (read_signed_LEB_128): Add inline definition.
2864 * testsuite/Makefile.am (leb128_unittest): New unit test.
2865 * testsuite/Makefile.in: Regenerate.
2866 * testsuite/leb128_unittest.cc: New unit test.
2868 2012-01-23 Ian Lance Taylor <iant@google.com>
2871 * i386.cc (Target_i386::do_code_fill): When using a jmp
2872 instruction, pad with nop instructions.
2873 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2875 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
2877 * x86_64.cc (gc_process_relocs): Add typename on types used in
2879 (scan_relocs): Likewise.
2880 (relocate_section): Likewise.
2881 (apply_relocation): Likewise.
2883 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
2885 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2886 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2889 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
2891 * x86_64.cc: Initial support for x32.
2893 2012-01-03 Cary Coutant <ccoutant@google.com>
2895 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2896 Use abstract base class for GOT.
2897 * gold/output.h (class Output_data_got_base): New abstract base class.
2898 (class Output_data_got): Derive from new base class, adjust ctors.
2899 (Output_data_got::reserve_slot): Make virtual; rename to
2900 do_reserve_slot; Adjust callers.
2901 * gold/target.h (Sized_target::init_got_plt_for_update): Return
2902 pointer to abstract base class.
2903 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2905 2011-12-18 Ian Lance Taylor <iant@google.com>
2907 * object.h (Relobj::local_symbol_value): New function.
2908 (Relobj::local_plt_offset): New function.
2909 (Relobj::local_has_got_offset): New function.
2910 (Relobj::local_got_offset): New function.
2911 (Relobj::set_local_got_offset): New function.
2912 (Relobj::do_local_symbol_value): New pure virtual function.
2913 (Relobj::do_local_plt_offset): Likewise.
2914 (Relobj::do_local_has_got_offset): Likewise.
2915 (Relobj::do_local_got_offset): Likewise.
2916 (Relobj::do_set_local_got_offset): Likewise.
2917 (Sized_relobj::do_local_has_got_offset): Rename from
2918 local_has_got_offset.
2919 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2920 (Sized_relobj::do_set_local_got_offset): Rename from
2921 set_local_got_offset.
2922 (Sized_relobj_file::do_local_plt_offset): Rename from
2924 (Sized_relobj_file::do_local_symbol_value): New function.
2925 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2927 * output.cc (Output_data_got::Got_entry::write): Change object to
2928 Relobj. Use local_symbol_value.
2929 (Output_data_got::add_global_with_rel): Change rel_dyn to
2930 Output_data_reloc_generic*. Use add_global_generic.
2931 (Output_data_got::add_global_with_rela): Remove. Change all
2932 callers to use add_global_with_rel.
2933 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2934 Output_data_reloc_generic*. Use add_global_generic.
2935 (Output_data_got::add_global_pair_with_rela): Remove. Change all
2936 callers to use add_global_pair_with_rel.
2937 (Output_data_got::add_local): Change object to Relobj*.
2938 (Output_data_got::add_local_plt): Likewise.
2939 (Output_data_got::add_local_with_rel): Change object to Relobj*,
2940 change rel_dyn to Output_data_reloc_generic*. Use
2942 (Output_data_got::add_local_with_rela): Remove. Change all
2943 callers to use all_local_with_rel.
2944 (Output_data_got::add_local_pair_with_rel): Change object to
2945 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
2946 add_output_section_generic.
2947 (Output_data_got::add_local_pair_with_rela): Remove. Change all
2948 callers to use add_local_pair_with_rel.
2949 (Output_data_got::reserve_local): Change object to Relobj*.
2950 * output.h: (class Output_data_reloc_generic): Add pure virtual
2951 declarations for add_global_generic, add_local_generic,
2952 add_output_section_generic.
2953 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2954 functions for Output_data_reloc_generic. Update declarations for
2955 changes listed in output.cc.
2956 (class Output_data_got): Change template parameter to got_size.
2957 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
2958 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2960 (Sized_relobj_incr::do_local_plt_offset): New function.
2961 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2964 2011-12-17 Cary Coutant <ccoutant@google.com>
2966 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2967 * resolve.cc (Symbol_table::resolve): Likewise.
2968 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2970 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2972 2011-12-16 Ian Lance Taylor <iant@google.com>
2974 * output.h (Output_data_reloc_generic::add): Only call
2975 add_dynamic_reloc if this is a dynamic reloc section.
2977 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
2980 * target-reloc.h (apply_relocation): Replace <64, false> with
2983 2011-11-25 Nick Clifton <nickc@redhat.com>
2985 * po/it.po: New Italian translation.
2987 2011-11-17 Sterling Augustine <saugustine@google.com>
2989 * script.cc (script_include_directive): Implement.
2990 (read_script_file): New local variables name and search_path. Update
2991 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2992 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2993 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2995 2011-11-11 Sterling Augustine <saugustine@google.com>
2997 * yyscript.y (section_cmd): Add support for INCLUDE directive.
2998 (file_or_sections_cmd): Likewise.
3000 2011-11-11 Doug Kwan <dougkwan@google.com>
3002 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3003 if --just-symbols is given.
3005 2011-11-10 Doug Kwan <dougkwan@google.com>
3008 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3009 when processing data relocs.
3010 * reloc.h (Relocate_functions::rel_unaligned): New method.
3011 (Relocate_functions::pcrel_unaligned): Ditto.
3012 (Relocate_functions::rel32_unaligned): Ditto.
3013 (Relocate_functions::pcrel32_unaligned): Ditto.
3015 2011-11-09 Doug Kwan <dougkwan@google.com>
3018 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3019 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3020 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3021 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3022 (Relocate_functions::rel_unaligned): New.
3023 (Relocate_functions::rel32_unaligned): New.
3024 * target-reloc.h (relocate_for_relocatable): Add code to handle
3025 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3026 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3027 arm_unaligned_reloc_r): New targets.
3028 * testsuite/Makefile.in: Regenerate.
3029 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3032 2011-11-02 Ian Lance Taylor <iant@google.com>
3034 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
3036 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3037 * options.cc (General_options::finalize): Use library search path
3038 from configure script if specified. If not native and no sysroot,
3039 only search TOOLLIBDIR.
3040 * options.h (Search_directory::Search_directory): Change name to
3042 (General_options::add_to_library_path_with_sysroot): Change arg to
3044 * configure, Makefile.in, config.in: Rebuild.
3046 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
3048 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3049 we are working around the ARM1176 Erratum.
3050 * options.h (General_options::fix_arm1176): Add option.
3051 * testsuite/Makefile.am: Add testcases, and keep current ones
3053 * testsuite/Makefile.in: Regenerate.
3054 * testsuite/arm_fix_1176.s: New file.
3055 * testsuite/arm_fix_1176.sh: Likewise.
3057 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
3059 * arm.cc (Target_arm::Target_arm): Remove initialisation of
3061 (Target_arm::may_use_blx): Remove method.
3062 (Target_arm::set_may_use_blx): Likewise.
3063 (Target_arm::may_use_v4t_interworking): New method.
3064 (Target_arm::may_use_v5t_interworking): Likewise.
3065 (Target_arm::may_use_blx_): Remove member variable.
3066 (Arm_relocate_functions::arm_branch_common): Check for v5T
3068 (Arm_relocate_functions::thumb_branch_common): Likewise.
3069 (Reloc_stub::stub_type_for_reloc): Likewise.
3070 (Target_arm::do_finalize_sections): Correct interworking checks.
3071 * testsuite/Makefile.am: Add new tests.
3072 * testsuite/Makefile.in: Regenerate.
3073 * testsuite/arm_farcall_arm_arm.s: New test.
3074 * testsuite/arm_farcall_arm_arm.sh: Likewise.
3075 * testsuite/arm_farcall_arm_thumb.s: Likewise.
3076 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3077 * testsuite/arm_farcall_thumb_arm.s: Likewise.
3078 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3079 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3080 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3082 2011-10-31 Cary Coutant <ccoutant@google.com>
3085 * expression.cc (Expression::eval_with_dot): Add
3086 is_section_dot_assignment parameter.
3087 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
3088 absolute and assigning to dot within a section.
3089 * script-sections.cc
3090 (Output_section_element_assignment::set_section_addresses): Pass
3091 dot_section to set_if_absolute.
3092 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3093 as is_section_dot_assignment flag to eval_with_dot.
3094 (Output_section_element_dot_assignment::set_section_addresses):
3096 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3097 parameter. Also set value if relative to dot_section; set the
3098 symbol's output_section.
3099 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3100 parameter. Adjust all callers.
3101 (Expression::eval_maybe_dot): Likewise.
3102 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3104 * testsuite/script_test_2.t: Test assignment of an absolute value
3105 to dot within an output section element.
3107 2011-10-31 Cary Coutant <ccoutant@google.com>
3109 * options.h (class General_options): Add --[no-]gnu-unique options.
3110 * symtab.cc (Symbol_table::sized_write_globals): Convert
3111 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3113 2011-10-31 Cary Coutant <ccoutant@google.com>
3116 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3117 unnecessary assertion.
3118 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3120 2011-10-31 Sriraman Tallam <tmsriram@google.com>
3122 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3124 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3126 Change to just keep the section associated with symbol.
3127 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3128 they are externally visible and --export-dynamic is turned on.
3129 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3131 2011-10-19 Ian Lance Taylor <iant@google.com>
3134 * script-sections.cc
3135 (Output_section_element_dot_assignment::needs_output_section): New
3138 2011-10-19 Ian Lance Taylor <iant@google.com>
3141 * layout.cc (Layout::segment_precedes): Don't assert failure if a
3142 --section-start option was seen.
3143 * options.h (General_options::any_section_start): New function.
3145 2011-10-18 David S. Miller <davem@davemloft.net>
3148 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3149 member to track relocation locations that have moved during TLS
3150 reloc optimizations.
3151 (Target_sparc::Relocate::Relocate): Initialize to NULL.
3152 (Target_sparc::Relocate::relocate): Adjust view down by 4
3153 bytes if it matches reloc_adjust_addr_.
3154 (Target_sparc::Relocate::relocate_tls): Always move the
3155 __tls_get_addr call delay slot instruction forward 4 bytes when
3156 performing relaxation.
3158 2011-10-18 Cary Coutant <ccoutant@google.com>
3160 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3161 (Output_file::map_no_anonymous): Check for non-zero
3162 return code from posix_fallocate.
3164 2011-10-17 Cary Coutant <ccoutant@google.com>
3167 * plugin.cc (is_visible_from_outside): Check for symbols
3168 referenced from dynamic objects.
3169 * resolve.cc (Symbol_table::resolve): Don't count references
3170 from dynamic objects as references from real ELF files.
3171 * testsuite/plugin_test_2.sh: Adjust expected result.
3173 2011-10-17 Cary Coutant <ccoutant@google.com>
3175 * gold.cc: Include timer.h.
3176 (queue_middle_tasks): Stamp time.
3177 (queue_final_tasks): Likewise.
3178 * main.cc (main): Store timer in parameters. Print timers
3180 * parameters.cc (Parameters::Parameters): Initialize timer_.
3181 (Parameters::set_timer): New function.
3182 (set_parameters_timer): New function.
3183 * parameters.h (Parameters::set_timer): New function.
3184 (Parameters::timer): New function.
3185 (Parameters::timer_): New data member.
3186 (set_parameters_timer): New function.
3187 * timer.cc (Timer::stamp): New function.
3188 (Timer::get_pass_time): New function.
3189 * timer.h (Timer::stamp): New function.
3190 (Timer::get_pass_time): New function.
3191 (Timer::pass_times_): New data member.
3193 2011-10-17 Cary Coutant <ccoutant@google.com>
3195 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3196 task for members of lib groups.
3198 2011-10-17 Cary Coutant <ccoutant@google.com>
3201 * fileread.cc (File_read::find_view): Add assert.
3202 (File_read::make_view): Move bounds check (replace with assert)...
3203 (File_read::find_or_make_view): ... to here.
3205 2011-10-12 Cary Coutant <ccoutant@google.com>
3207 * output.cc (Output_file::open_base_file): Handle case where
3208 ::read returns less than requested size.
3210 2011-10-10 Cary Coutant <ccoutant@google.com>
3212 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3213 Initialize defined_count_.
3214 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3215 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3216 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3217 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3218 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3219 * incremental.h (Sized_relobj_incr::defined_count_): New data
3221 (Sized_incr_dynobj::defined_count_): New data member.
3222 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3223 Return zeroes instead of internal error.
3225 2011-10-10 Cary Coutant <ccoutant@google.com>
3228 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3229 (Output_reloc::symbol_value): Return PLT offset if flag is set.
3230 * output.h (class Output_reloc): Add use_plt_offset flag.
3231 (Output_reloc::type_): Adjust size of bit field.
3232 (Output_reloc::use_plt_offset_): New bit field.
3233 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3234 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3235 flag. Adjust all callers.
3236 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3237 creating RELATIVE relocations.
3239 2011-10-10 Nick Clifton <nickc@redhat.com>
3241 * po/es.po: Updated Spanish translation.
3242 * po/fi.po: Updated Finnish translation.
3244 2011-10-03 Diego Novillo <dnovillo@google.com>
3246 * options.cc (parse_uint): Fix dereference of RETVAL.
3248 2011-09-29 Sriraman Tallam <tmsriram@google.com>
3250 * layout.h (section_order_map_): New member.
3251 (get_section_order_map): New member function.
3252 * output.cc (Output_section::add_input_section): Check for patterns
3253 only when --section-ordering-file is specified.
3254 * gold.cc (queue_middle_tasks): Delay updating order of sections till
3255 output_sections have been formed.
3256 * layout.cc (Layout_Layout): Initialize section_order_map_.
3257 * plugin.cc (update_section_order): Store order in order_map. Do not
3259 * testsuite/Makefile.am: Add test case for plugin_final_layout.
3260 * testsuite/Makefile.in: Regenerate.
3261 * testsuite/plugin_section_order.c: New file.
3262 * testsuite/plugin_final_layout.cc: New file.
3263 * testsuite/plugin_final_layout.sh: New file.
3265 2011-09-29 Cary Coutant <ccoutant@google.com>
3267 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3269 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3270 symbols during incremental update.
3271 (Symbol_table::add_from_dynobj): Likewise.
3273 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3274 Ian Lance Taylor <iant@google.com>
3276 * symtab.cc (Symbol_table::define_special_symbol): Always
3277 canonicalize version string.
3279 2011-09-26 Cary Coutant <ccoutant@google.com>
3281 * gold.cc (queue_initial_tasks): Move option checks ...
3282 * options.cc (General_options::finalize): ... to here. Disable
3283 some options; make others fatal.
3285 2011-09-26 Cary Coutant <ccoutant@google.com>
3288 * plugin.cc (get_symbols_v2): New function.
3289 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3290 (is_referenced_from_outside): New function.
3291 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3292 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3293 (get_symbols): Pass version parameter.
3294 (get_symbols_v2): New function.
3295 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3297 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3298 (onload): Add LDPT_GET_SYMBOLS_V2.
3299 (all_symbols_read_hook): Use get_symbols_v2; check for
3300 LDPR_PREVAILING_DEF_IRONLY_EXP.
3301 * testsuite/plugin_test_3.sh: Update expected results.
3303 2011-09-23 Simon Baldwin <simonb@google.com>
3305 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3306 configuration options.
3307 * configure: Regenerate.
3308 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3309 * Makefile.in: Regenerate.
3310 * testsuite/Makefile.in: Regenerate.
3312 2011-09-19 Sriraman Tallam <tmsriram@google.com>
3314 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3316 2011-09-19 Cary Coutant <ccoutant@google.com>
3318 * incremental.cc (can_incremental_update): Fix typo in comment.
3319 * incremental.h (can_incremental_update): Likewise.
3321 2011-09-18 Cary Coutant <ccoutant@google.com>
3323 * incremental.cc (can_incremental_update): New function.
3324 * incremental.h (can_incremental_update): New function.
3325 * layout.cc (Layout::init_fixed_output_section): Call it.
3326 (Layout::make_output_section): Don't allow patch space in .eh_frame.
3327 * object.cc (Sized_relobj_file::do_layout): Call
3328 can_incremental_update.
3330 2011-09-13 Cary Coutant <ccoutant@google.com>
3332 * configure.ac: Check for glibc support for gnu_indirect_function
3333 support with static linking, setting automake conditional
3335 * Makefile.in: Regenerate.
3336 * configure: Regenerate.
3338 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3339 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3341 * testsuite/Makefile.in: Regenerate.
3343 2011-09-13 Cary Coutant <ccoutant@google.com>
3345 * incremental.cc (Sized_relobj_incr::do_layout): Call
3346 report_comdat_group for kept comdat sections.
3347 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3348 * testsuite/Makefile.in: Regenerate.
3349 * testsuite/incr_comdat_test_1.cc: New source file.
3350 * testsuite/incr_comdat_test_2_v1.cc: New source file.
3351 * testsuite/incr_comdat_test_2_v2.cc: New source file.
3352 * testsuite/incr_comdat_test_2_v3.cc: New source file.
3354 2011-09-13 Ian Lance Taylor <iant@google.com>
3356 * object.cc (Sized_relobj_file::do_layout): Remove unused local
3357 variable external_symbols_offset.
3359 2011-09-12 Ian Lance Taylor <iant@google.com>
3361 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3362 triggered if object has no symbols.
3364 2011-09-09 David S. Miller <davem@davemloft.net>
3366 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3367 (Output_fill_debug_line::do_write): Likewise.
3369 2011-08-29 Cary Coutant <ccoutant@google.com>
3371 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3372 casts to match formatting specs.
3373 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3375 2011-08-26 Cary Coutant <ccoutant@google.com>
3377 * layout.cc (Free_list::allocate): Provide guarantee of minimum
3378 remaining hole size when allocating.
3379 (Layout::make_output_section): Set fill methods for debug sections.
3380 * layout.h (Free_list::Free_list_node): Move from private to
3382 (Free_list::set_min_hole_size): New function.
3383 (Free_list::begin, Free_list::end): New functions.
3384 (Free_list::min_hole_): New data member.
3385 * output.cc: Include dwarf.h.
3386 (Output_fill_debug_info::do_minimum_hole_size): New function.
3387 (Output_fill_debug_info::do_write): New function.
3388 (Output_fill_debug_line::do_minimum_hole_size): New function.
3389 (Output_fill_debug_line::do_write): New function.
3390 (Output_section::Output_section): Initialize new data member.
3391 (Output_section::set_final_data_size): Ensure patch space is larger
3392 than minimum hole size.
3393 (Output_section::do_write): Fill holes in debug sections.
3394 * output.h (Output_fill): New class.
3395 (Output_fill_debug_info): New class.
3396 (Output_fill_debug_line): New class.
3397 (Output_section::set_free_space_fill): New function.
3398 (Output_section::free_space_fill_): New data member.
3399 * testsuite/Makefile.am (incremental_test_3): Add
3400 --incremental-patch option.
3401 (incremental_test_4): Likewise.
3402 (incremental_test_5): Likewise.
3403 (incremental_test_6): Likewise.
3404 (incremental_copy_test): Likewise.
3405 (incremental_common_test_1): Likewise.
3406 * testsuite/Makefile.in: Regenerate.
3408 2011-08-26 Nick Clifton <nickc@redhat.com>
3410 * po/es.po: Updated Spanish translation.
3412 2011-08-01 Cary Coutant <ccoutant@google.com>
3414 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3415 * gold/testsuite/Makefile.in: Regenerate.
3416 * gold/testsuite/justsyms_exec.c: New source file.
3417 * gold/testsuite/justsyms_lib.c: New source file.
3419 2011-08-01 Cary Coutant <ccoutant@google.com>
3421 * layout.cc (Layout::set_segment_offsets): Don't realign text
3422 segment if -Ttext was specified.
3423 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3425 * object.h (Sized_relobj_file::e_type): New function.
3426 (Sized_relobj_file::e_type_): New data member.
3427 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3428 base address for ET_EXEC files.
3429 * target.cc (Target::do_make_elf_object_implementation): Allow
3430 ET_EXEC files with --just-symbols option.
3432 2011-07-28 Cary Coutant <ccoutant@google.com>
3434 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3435 Add thread_number parameter.
3436 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3437 * workqueue-threads.cc
3438 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3439 current thread if its thread number is greater than desired thread
3441 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3442 Add thread_number parameter.
3443 (Workqueue::should_cancel_thread): Likewise.
3444 (Workqueue::find_runnable_or_wait): Pass thread_number to
3445 should_cancel_thread.
3446 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3449 2011-07-22 Sriraman Tallam <tmsriram@google.com>
3451 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3452 only after checking if it cannot be forced local.
3453 * symtab.h (is_externally_visible): Check if the symbol is not forced
3456 2011-07-15 Ian Lance Taylor <iant@google.com>
3458 * options.h (class General_options): Add --print-output-format.
3459 Move -EL next to -EB, for better --help output.
3460 * target-select.cc: Include <cstdio>, "options.h", and
3462 (Target_selector::do_target_bfd_name): New function.
3463 (print_output_format): New function.
3464 * target-select.h (class Target_selector): Update declarations.
3465 (Target_selector::target_bfd_name): New function.
3466 (print_output_format): Declare.
3467 * main.cc: Include "target-select.h".
3468 (main): Handle --print-output-format.
3469 * gold.cc: Include "target-select.h".
3470 (queue_initial_tasks): Handle --print-output-format when there are
3472 * parameters.cc (parameters_force_valid_target): Give a better
3473 error message if -EB/-EL does not match target.
3474 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3477 2011-07-15 Ian Lance Taylor <iant@google.com>
3479 * i386.cc (class Output_data_plt_i386): Add layout_ field.
3480 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3481 (Output_data_plt_i386::do_write): Write address of .dynamic
3482 section to first entry in .got.plt section.
3483 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3484 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3486 (Output_data_plt_x86_64::do_write): Write address of .dynamic
3487 section to first entry in .got.plt section.
3488 * layout.h (Layout::dynamic_section): New function.
3490 2011-07-13 Sriraman Tallam <tmsriram@google.com>
3492 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3494 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3495 input_section_position_, and input_section_glob_.
3496 (read_layout_from_file): Call function section_ordering_specified.
3497 * layout.h (is_section_ordering_specified): New function.
3498 (section_ordering_specified): New function.
3499 (section_ordering_specified_): New boolean member.
3500 * main.cc(main): Call load_plugins after layout object is defined.
3501 * output.cc (Output_section::add_input_section): Use
3502 function section_ordering_specified to check if section ordering is
3504 * output.cc (Output_section::add_relaxed_input_section): Use
3505 function section_ordering_specified to check if section ordering is
3507 (Output_section::update_section_layout): New function.
3508 (Output_section::sort_attached_input_sections): Check if input section
3510 * output.h (Output_section::update_section_layout): New function.
3511 * plugin.cc (get_section_count): New function.
3512 (get_section_type): New function.
3513 (get_section_name): New function.
3514 (get_section_contents): New function.
3515 (update_section_order): New function.
3516 (allow_section_ordering): New function.
3517 (Plugin::load): Add the new interfaces to the transfer vector.
3518 (Plugin_manager::load_plugins): New parameter.
3519 (Plugin_manager::all_symbols_read): New parameter.
3520 (Plugin_manager::claim_file): New parameter. Save the elf object for
3522 (Plugin_manager::get_elf_object): New function.
3523 (Plugin_manager::get_view): Change to directly use the bool to check
3524 if get_view is called from claim_file_hook.
3525 * plugin.h (input_objects): New function
3526 (Plugin__manager::load_plugins): New parameter.
3527 (Plugin_manager::claim_file): New parameter.
3528 (Plugin_manager::get_elf_object): New function.
3529 (Plugin_manager::in_claim_file_handler): New function.
3530 (Plugin_manager::in_claim_file_handler_): New member.
3531 (layout): New function.
3532 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3533 handler with an extra parameter. Make the elf object before calling
3535 * testsuite/plugin_test.c (get_section_count): New function pointer.
3536 (get_section_type): New function pointer.
3537 (get_section_name): New function pointer.
3538 (get_section_contents): New function pointer.
3539 (update_section_order): New function pointer.
3540 (allow_section_ordering): New function pointer.
3541 (onload): Check if the new interfaces exist.
3543 2011-07-13 Ian Lance Taylor <iant@google.com>
3545 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3547 * x86_64.cc (Target_x86_64::got_section): Likewise.
3548 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3549 (relro_now_test_SOURCES): New variable.
3550 (relro_now_test_DEPENDENCIES): New variable.
3551 (relro_now_test_LDFLAGS): New variable.
3552 (relro_now_test_LDADD): New variable.
3553 (relro_now_test.so): New target.
3554 * testsuite/Makefile.in: Rebuild.
3556 2011-07-12 Ian Lance Taylor <iant@google.com>
3559 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3560 GLOB_DAT relocation rather than a RELATIVE relocation for a
3561 protected symbol when creating a shared library.
3562 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3563 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3564 * testsuite/protected_main_1.cc (main): Test that protected
3565 function has same address.
3567 2011-07-11 Ian Lance Taylor <iant@google.com>
3570 * options.h (class General_options): Add -Bgroup.
3571 * options.cc (General_options::finalize): If -Bgroup is set,
3572 default to --unresolved-symbols=report-all.
3573 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3574 * target-reloc.h (issue_undefined_symbol_error): Handle
3575 --unresolved-symbols=report-all.
3577 2011-07-08 Ian Lance Taylor <iant@google.com>
3580 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3581 if linker script discards key sections.
3582 (Layout::create_dynamic_symtab): Likewise.
3583 (Layout::assign_local_dynsym_offsets): Likewise.
3584 (Layout::sized_create_version_sections): Likewise.
3585 (Layout::create_interp): Likewise.
3586 (Layout::finish_dynamic_section): Likewise.
3587 (Layout::set_dynamic_symbol_size): Likewise.
3589 2011-07-08 Ian Lance Taylor <iant@google.com>
3592 * options.h (class General_options): Add --unresolved-symbols.
3593 * target-reloc.h (issue_undefined_symbol_error): Check
3594 --unresolved-symbols. Add comments.
3596 2011-07-08 Ian Lance Taylor <iant@google.com>
3598 * testsuite/odr_violation2.cc (Ordering::operator()): Make
3599 expression more complex.
3601 2011-07-08 Ian Lance Taylor <iant@google.com>
3604 * target-reloc.h (issue_undefined_symbol_error): New inline
3605 function, broken out of relocate_section.
3606 (relocate_section): Call issue_undefined_symbol_error.
3607 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3608 there is no TLS segment if we are about to issue an undefined
3610 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3612 2011-07-08 Ian Lance Taylor <iant@google.com>
3615 * resolve.cc (Symbol_table::should_override): Add fromtype
3616 parameter. Change all callers. Give error when linking together
3617 TLS and non-TLS symbol.
3618 (Symbol_table::should_override_with_special): Add fromtype
3619 parameter. Change all callers.
3620 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3621 there is no TLS segment if we have reported some errors.
3622 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3624 2011-07-08 Ian Lance Taylor <iant@google.com>
3627 * target.h (Target::plt_address_for_global): New function.
3628 (Target::plt_address_for_local): New function.
3629 (Target::plt_section_for_global): Remove.
3630 (Target::plt_section_for_local): Remove.
3631 (Target::do_plt_address_for_global): New virtual function.
3632 (Target::do_plt_address_for_local): New virtual function.
3633 (Target::do_plt_section_for_global): Remove.
3634 (Target::do_plt_section_for_local): Remove.
3635 (Target::register_global_plt_entry): Add Symbol_table and Layout
3637 * output.cc (Output_data_got::Got_entry::write): Use
3638 plt_address_for_global and plt_address_for_local.
3639 * layout.cc (Layout::add_target_dynamic_tags): Use size and
3640 address of output section.
3641 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3642 got_irelative_, and irelative_count_ fields. Update
3644 (Output_data_plt_i386::has_irelative_section): New function.
3645 (Output_data_plt_i386::entry_count): Add irelative_count_.
3646 (Output_data_plt_i386::set_final_data_size): Likewise.
3647 (class Target_i386): Add got_irelative_ and rel_irelative_
3648 fields. Update declarations.
3649 (Target_i386::Target_i386): Initialize new fields.
3650 (Target_i386::do_plt_address_for_global): New function replacing
3651 do_plt_section_for_global.
3652 (Target_i386::do_plt_address_for_local): New function replacing
3653 do_plt_section_for_local.
3654 (Target_i386::got_section): Create got_irelative_.
3655 (Target_i386::rel_irelative_section): New function.
3656 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3657 fields. Don't define __rel_iplt_{start,end}.
3658 (Output_data_plt_i386::add_entry): Add symtab and layout
3659 parameters. Change all callers. Use different PLT and GOT for
3661 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3662 layout parameters. Change all callers. Use different PLT and
3664 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3665 (Output_data_plt_i386::rel_irelative): New function.
3666 (Output_data_plt_i386::address_for_global): New function.
3667 (Output_data_plt_i386::address_for_local): New function.
3668 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
3669 IRELATIVE GOT when changing IFUNC GOT entries.
3670 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3672 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3673 if we didn't create an IRELATIVE GOT.
3674 (Target_i386::Relocate::relocate): Use plt_address_for_global and
3675 plt_address_for_local.
3676 (Target_i386::do_dynsym_value): Use plt_address_for_global.
3677 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3678 got_irelative_, and irelative_count_ fields. Update
3680 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3681 Initialize new fields. Remove symtab parameter. Change all
3683 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3685 (Output_data_plt_x86_64::has_irelative_section): New function.
3686 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3687 (class Target_x86_64): Add got_irelative_ and rel_irelative_
3688 fields. Update declarations.
3689 (Target_x86_64::Target_x86_64): Initialize new fields.
3690 (Target_x86_64::do_plt_address_for_global): New function replacing
3691 do_plt_section_for_global.
3692 (Target_x86_64::do_plt_address_for_local): New function replacing
3693 do_plt_section_for_local.
3694 (Target_x86_64::got_section): Create got_irelative_.
3695 (Target_x86_64::rela_irelative_section): New function.
3696 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
3697 all callers. Don't create __rel_iplt_{start,end}.
3698 (Output_data_plt_x86_64::add_entry): Add symtab and layout
3699 parameters. Change all callers. Use different PLT and GOT for
3701 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3702 layout parameters. Change all callers. Use different PLT and
3704 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3705 parameters. Change all callers. Use different PLT and GOT for
3707 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3708 (Output_data_plt_x86_64::rela_irelative): New function.
3709 (Output_data_plt_x86_64::address_for_global): New function.
3710 (Output_data_plt_x86_64::address_for_local): New function.
3711 (Output_data_plt_x86_64::set_final_data_size): Likewise.
3712 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3713 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3714 (Target_x86_64::register_global_plt_entry): Add symtab and layout
3716 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3718 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3719 symbols if we didn't create an IRELATIVE GOT.
3720 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3721 plt_address_for_local.
3722 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3723 * testsuite/ifuncvar1.c: New test file.
3724 * testsuite/ifuncvar2.c: New test file.
3725 * testsuite/ifuncvar3.c: New test file.
3726 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3727 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3728 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3729 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3730 * testsuite/Makefile.in: Rebuild.
3732 2011-07-07 Cary Coutant <ccoutant@google.com>
3734 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3735 (two_file_test_1_ndebug.o): Likewise.
3736 (two_file_test_1b_ndebug.o): Likewise.
3737 (two_file_test_2_ndebug.o): Likewise.
3738 (two_file_test_main_ndebug.o): Likewise.
3739 (incremental_test_2): Link with no-debug versions.
3741 2011-07-06 Cary Coutant <ccoutant@google.com>
3743 * gold/incremental.cc
3744 (Output_section_incremental_inputs::write_info_blocks): Check for
3745 hidden and internal symbols.
3747 2011-07-06 Cary Coutant <ccoutant@google.com>
3749 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3750 Check disposition for startup file.
3751 (Incremental_inputs::report_command_line): Ignore
3752 --incremental-startup-unchanged option.
3753 * options.cc (General_options::parse_incremental_startup_unchanged):
3755 (General_options::General_options): Initialize new data member.
3756 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3757 (General_options): Add --incremental-startup-unchanged option.
3758 (General_options::incremental_startup_disposition): New function.
3759 (General_options::incremental_startup_disposition_): New data member.
3761 2011-07-06 Cary Coutant <ccoutant@google.com>
3763 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3764 input file index to Script_info ctor.
3765 (Sized_incremental_binary::do_file_has_changed): Find the
3766 command-line argument for files named in scripts.
3767 * incremental.h (Script_info::Script_info): New ctor
3768 with input file index.
3769 (Script_info::input_file_index): New function.
3770 (Script_info::input_file_index_): New data member.
3771 (Incremental_binary::get_library): Add const.
3772 (Incremental_binary::get_script_info): Add const.
3773 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3774 * testsuite/Makefile.am (incremental_test_5): New test case.
3775 (incremental_test_6): New test case.
3776 * testsuite/Makefile.in: Regenerate.
3778 2011-07-06 Cary Coutant <ccoutant@google.com>
3780 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3781 debug output when command lines differ.
3783 2011-07-06 Cary Coutant <ccoutant@google.com>
3785 * incremental.cc (Incremental_inputs::report_command_line): Ignore
3786 --incremental-patch option.
3787 * layout.cc (Free_list::allocate): Extend allocation beyond original
3789 (Layout::make_output_section): Mark sections that should get
3791 * options.cc (parse_percent): New function.
3792 * options.h (parse_percent): New function.
3793 (DEFINE_percent): New macro.
3794 (General_options): Add --incremental-patch option.
3795 * output.cc (Output_section::Output_section): Initialize new data
3797 (Output_section::add_input_section): Print section name when out
3799 (Output_section::add_output_section_data): Likewise.
3800 (Output_section::set_final_data_size): Add patch space when
3801 doing --incremental-full.
3802 (Output_section::do_reset_address_and_file_offset): Remove patch
3804 (Output_segment::set_section_list_addresses): Print debug output
3805 only if --incremental-update.
3806 * output.h (Output_section::set_is_patch_space_allowed): New function.
3807 (Output_section::is_patch_space_allowed_): New data member.
3808 (Output_section::patch_space_): New data member.
3809 * parameters.cc (Parameters::incremental_full): New function.
3810 * parameters.h (Parameters::incremental_full): New function
3811 * testsuite/Makefile.am (incremental_test_2): Add test for
3812 --incremental-patch option.
3813 * testsuite/Makefile.in: Regenerate.
3814 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3815 (t18): Remove function body.
3817 2011-07-05 Doug Kwan <dougkwan@google.com>
3820 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3821 Arm_Address type for relocation result.
3822 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
3824 (Arm_relocate_functions::abs32): Use unaligned access.
3825 (Arm_relocate_functions::rel32): Ditto.
3826 (Arm_relocate_functions::prel31): Ditto.
3827 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3828 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3829 static data relocations.
3830 * testsuite/Makefile.in: Regnerate.
3831 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3833 2011-07-05 Ian Lance Taylor <iant@google.com>
3836 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3837 symbols if necessary.
3838 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3840 2011-07-05 Ian Lance Taylor <iant@google.com>
3843 * resolve.cc (Symbol::override_base_with_special): Simply override
3844 version with special symbol version, ignoring previous version.
3846 2011-07-05 Ian Lance Taylor <iant@google.com>
3848 * object.cc (Sized_relobj_file::include_section_group): Add
3849 information to comment about signature location.
3851 2011-07-02 Ian Lance Taylor <iant@google.com>
3854 * options.h (class General_options): Add -f and -F.
3855 * options.cc (General_options::finalize): Fatal error if -f/-F
3856 are used without -shared.
3857 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3859 2011-07-02 Ian Lance Taylor <iant@google.com>
3861 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3863 2011-07-01 Ian Lance Taylor <iant@google.com>
3867 * resolve.cc (Symbol::override_base_with_special): Don't override
3868 the version if the overriding symbol has a different name.
3869 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
3870 all callers. If we give an error about an undefined version,
3871 define the base version if necessary.
3872 * dynobj.h (class Versions): Update declaration.
3873 * testsuite/weak_alias_test_5.cc: New file.
3874 * testsuite/weak_alias_test.script: New file.
3875 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3876 and versioned_alias have the right value, and call t2.
3877 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3878 weak_alias_test_5.so.
3879 (weak_alias_test_LDADD): Likewise.
3880 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3881 * testsuite/Makefile.in: Rebuild.
3883 2011-07-01 Ian Lance Taylor <iant@google.com>
3886 * options.h (class General_options): Support -z notext.
3887 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3889 (two_file_shared_nonpic.so): Likewise.
3890 (two_file_shared_mixed.so): Likewise.
3891 (two_file_shared_mixed_1.so): Likewise.
3892 (weak_undef_lib_nonpic.so): Likewise.
3893 (alt/weak_undef_lib_nonpic.so): Likewise.
3894 (tls_test_shared_nonpic.so): Likewise.
3895 * testsuite/Makefile.in: Rebuild.
3897 2011-07-01 Ian Lance Taylor <iant@google.com>
3900 * configure.ac: Test whether static linking works, setting
3901 the automake conditional HAVE_STATIC.
3902 * testsuite/Makefile.am: Disable tests using -static if
3903 HAVE_STATIC is not true.
3904 * configure, testsuite/Makefile.in: Rebuild.
3906 2011-07-01 Ian Lance Taylor <iant@google.com>
3909 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3910 Assert if we see DW_EH_PE_indirect.
3911 * target.h (Target::ehframe_datarel_base): New function.
3912 (Target::do_ehframe_datarel_base): New target function.
3913 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3914 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3917 2011-07-01 Ian Lance Taylor <iant@google.com>
3920 * options.h (class General_options): Add
3921 --ld-generated-unwind-info.
3922 * ehframe.cc (Fde::write): Add address parameter. Change all
3923 callers. If associated with PLT, fill in address and size.
3924 (Cie::set_output_offset): Only add merge mapping if there is an
3926 (Cie::write): Add address parameter. Change all callers.
3927 (Eh_frame::add_ehframe_for_plt): New function.
3928 * ehframe.h (class Fde): Update declarations. Move shndx_ and
3929 input_offset_ fields into union u_, with new plt field.
3930 (Fde::Fde): Adjust for new union field.
3931 (Fde::Fde) [Output_data version]: New constructor.
3932 (Fde::add_mapping): Only add merge mapping if there is an object.
3933 (class Cie): Update declarations.
3934 (class Eh_frame): Declare add_ehframe_for_plt.
3935 * layout.cc (Layout::layout_eh_frame): Break out code into
3936 make_eh_frame_section, and call it.
3937 (Layout::make_eh_frame_section): New function.
3938 (Layout::add_eh_frame_for_plt): New function.
3939 * layout.h (class Layout): Update declarations.
3940 * merge.cc (Merge_map::add_mapping): Add assertion.
3941 * i386.cc: Include "dwarf.h".
3942 (class Output_data_plt_i386): Make first_plt_entry,
3943 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
3944 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3945 and plt_eh_frame_fde.
3946 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3947 boundary. Call add_eh_frame_for_plt if appropriate.
3948 * x86_64.cc: Include "dwarf.h".
3949 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
3950 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
3951 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3952 and plt_eh_frame_fde.
3953 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3956 2011-06-29 Ian Lance Taylor <iant@google.com>
3959 * object.cc (Sized_relobj_file::layout_section): Change shdr
3960 parameter to be const.
3961 (Sized_relobj_file::layout_eh_frame_section): New function, broken
3963 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3964 appropriate. Call layout_eh_frame_section.
3965 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3967 * object.h (class Sized_relobj_file): Update declarations.
3969 2011-06-29 Ian Lance Taylor <iant@google.com>
3972 * script.cc (Token::integer_value): Accept trailing M/m/K/k
3974 (Lex::gather_token): Accept trailing M/m/K/k for integers.
3976 2011-06-29 Ian Lance Taylor <iant@google.com>
3979 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3981 * layout.cc (Layout::layout_eh_frame): Likewise.
3983 2011-06-29 Ian Lance Taylor <iant@google.com>
3986 * layout.cc (Layout::symtab_section_shndx): New function.
3987 * layout.h (class Layout): Declare symtab_section_shndx.
3988 * output.cc (Output_section::write_header): Call it.
3990 2011-06-29 Ian Lance Taylor <iant@google.com>
3993 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3994 symbols which are not used in a relocation.
3996 2011-06-28 Ian Lance Taylor <iant@google.com>
3999 * layout.cc (Layout::segment_precedes): Don't crash if a linker
4000 script create indistinguishable segments.
4001 (Layout::set_segment_offsets): Use stable_sort when sorting
4002 segments. Pass this to Compare_segments constructor.
4003 * layout.h (class Layout): Make segment_precedes non-static.
4004 (class Compare_segments): Change from struct to class. Add
4005 layout_ field. Add constructor.
4006 * script-sections.cc
4007 (Script_sections::attach_sections_using_phdrs_clause): Rename
4008 local orphan to is_orphan. Don't report failure to put empty
4009 section in segment. On attachment failure, report name of
4010 section, and attach to first PT_LOAD segment.
4012 2011-06-28 Ian Lance Taylor <iant@google.com>
4015 * target-select.cc (Target_selector::Target_selector): Add
4016 emulation parameter. Change all callers.
4017 (select_target_by_bfd_name): Rename from select_target_by_name.
4019 (select_target_by_emulation): New function.
4020 (supported_emulation_names): New function.
4021 * target-select.h (class Target_selector): Add emulation_ field.
4022 Update declarations.
4023 (Target_selector::recognize_by_bfd_name): Rename from
4024 recognize_by_name. Change all callers.
4025 (Target_selector::supported_bfd_names): Rename from
4026 supported_names. Change all callers.
4027 (Target_selector::recognize_by_emulation): New function.
4028 (Target_selector::supported_emulations): New function.
4029 (Target_selector::emulation): New function.
4030 (Target_selector::do_recognize_by_bfd_name): Rename from
4031 do_recognize_by_name. Change all callers.
4032 (Target_selector::do_supported_bfd_names): Rename from
4033 do_supported_names. Change all callers.
4034 (Target_selector::do_recognize_by_emulation): New function.
4035 (Target_selector::do_supported_emulations): New function.
4036 (select_target_by_bfd_name): Change name in declaration.
4037 (select_target_by_emulation): Declare.
4038 (supported_emulation_names): Declare.
4039 * parameters.cc (parameters_force_valid_target): Try to find
4040 target based on emulation from -m option.
4041 * options.h (class General_options): Change doc string for -m.
4042 * options.cc (help): Print emulations.
4043 (General_options::parse_V): Likewise.
4044 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4045 Add emulation parameter. Change all callers.
4047 2011-06-28 Ian Lance Taylor <iant@google.com>
4049 * target.h (class Target): Add osabi_ field.
4050 (Target::osabi): New function.
4051 (Target::set_osabi): New function.
4052 (Target::Target): Initialize osabi_.
4053 (Target::do_adjust_elf_header): Make pure virtual.
4054 (Sized_target::do_adjust_elf_header): Declare.
4055 * target.cc (Sized_target::do_adjust_elf_header): New function.
4056 (class Sized_target): Instantiate all versions.
4057 * freebsd.h (class Target_freebsd): Remove.
4058 (Target_selector_freebsd::do_recognize): Call set_osabi on
4060 (Target_selector_freebsd::do_recognize_by_name): Likewise.
4061 (Target_selector_freebsd::set_osabi): Remove.
4062 * i386.cc (class Target_i386): Inherit from Sized_target rather
4063 than Target_freebsd.
4064 * x86_64.cc (class Target_x86_64): Likewise.
4066 2011-06-28 Ian Lance Taylor <iant@google.com>
4068 * target.h (Target::can_check_for_function_pointers): Rewrite.
4070 (Target::can_icf_inline_merge_sections): Likewise.
4071 (Target::section_may_have_icf_unsafe_poineters): Likewise.
4072 (Target::Target_info): Add can_icf_inline_merge_sections field.
4073 (Target::do_can_check_for_function_pointers): New virtual
4075 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4076 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4077 from can_check_for_function_pointers, move in file.
4078 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4079 section_may_have_icf_unsafe_poineters, move in file.
4080 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4081 * i386.cc (Target_i386::do_can_check_for_function_pointers):
4082 Rename from can_check_for_function_pointers, move in file.
4083 (Target_i386::can_icf_inline_merge_sections): Remove.
4084 (Target_i386::i386_info): Initialize
4085 can_icf_inline_merge_sections.
4086 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4087 Initialize can_icf_inline_merge_sections.
4088 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4089 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4090 Rename from can_check_for_function_pointers, move in file.
4091 (Target_x86_64::can_icf_inline_merge_sections): Remove.
4092 (Target_x86_64::x86_64_info): Initialize
4093 can_icf_inline_merge_sections.
4094 * testsuite/testfile.cc (Target_test::test_target_info):
4096 * icf.cc (get_section_contents): Correct formatting.
4098 2011-06-27 Ian Lance Taylor <iant@google.com>
4100 * symtab.cc (Symbol::versioned_name): New function.
4101 (Symbol_table::add_to_final_symtab): Use versioned_name when
4103 (Symbol_table::sized_write_symbol): Likewise.
4104 * symtab.h (class Symbol): Declare versioned_name.
4105 * stringpool.h (class Stringpool_template): Add variant of add
4106 which takes a std::basic_string.
4107 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4108 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4109 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4110 (ver_test_12.o): New target.
4111 * testsuite/Makefile.in: Rebuild.
4113 2011-06-27 Doug Kwan <dougkwan@google.com>
4115 * arm.cc (Arm_relocate_functions::thm_jump8,
4116 Arm_relocate_functions::thm_jump11): Use a wider signed
4117 type to compute offset.
4118 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4120 * testsuite/Makefile.in: Regenerate.
4121 * testsuite/arm_branch_in_range.sh: Check test results of
4122 arm_thm_jump11 and arm_thm_jump8.
4123 * testsuite/arm_thm_jump11.s: New test source file.
4124 * testsuite/arm_thm_jump11.t: New linker script.
4125 * testsuite/arm_thm_jump8.s: New test source file.
4126 * testsuite/arm_thm_jump8.t: New linker script.
4128 2011-06-24 Ian Lance Taylor <iant@google.com>
4130 * layout.cc: Include "object.h".
4131 (ctors_sections_in_init_array): New static variable.
4132 (Layout::is_ctors_in_init_array): New function.
4133 (Layout::layout): Add entry to ctors_sections_in_init_array if
4135 * layout.h (class Layout): Declare is_ctors_in_init_array.
4136 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4137 is_ctors_reverse_view is set.
4138 (Sized_relobj_file::write_sections): Add layout parameter. Change
4139 all callers. Set is_ctors_reverse_view field of View_size.
4140 (Sized_relobj_file::reverse_words): New function.
4141 * object.h (Sized_relobj_file::View_size): Add
4142 is_ctors_reverse_view field.
4143 (class Sized_relobj_file): Update declarations.
4144 * testsuite/initpri3.c: New test.
4145 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4147 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4148 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4149 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4150 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4151 * testsuite/Makefile.in: Rebuild.
4153 2011-06-24 Cary Coutant <ccoutant@google.com>
4155 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4156 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4157 (debug_msg_cdebug.err): New targets.
4158 * testsuite/Makefile.in: Regenerate.
4159 * testsuite/debug_msg.sh: Check output of link with compressed debug.
4160 Fix checks for link with shared library.
4162 2011-06-24 Doug Kwan <dougkwan@google.com>
4164 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4165 skip empty text sections.
4166 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4168 2011-06-22 Ian Lance Taylor <iant@google.com>
4171 * options.h (class General_options): Add --ctors-in-init-array.
4172 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4173 friends as SHT_PROGBITS for merging sections.
4174 (Layout::layout): Remove special handling of .init_array and
4175 friends. Don't sort if doing relocatable link. Sort for .ctors
4176 and .dtors if ctors_in_init_array.
4177 (Layout::make_output_section): Force correct section types for
4178 .init_array and friends. Don't sort if doing relocatable link,
4179 Don't sort .ctors and .dtors if ctors_in_init_array.
4180 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4181 (Layout::output_section_name): Add relobj parameter. Change all
4182 callers. Handle .ctors. and .dtors. in code rather than table.
4183 Handle .ctors and .dtors if ctors_in_init_array.
4184 (Layout::match_file_name): New function, moved from output.cc.
4185 * layout.h (class Layout): Update declarations.
4186 * output.cc: Include "layout.h".
4187 (Input_section_sort_entry::get_priority): New function.
4188 (Input_section_sort_entry::match_file_name): Just call
4189 Layout::match_file_name.
4190 (Output_section::Input_section_sort_init_fini_compare::operator()):
4191 Handle .ctors and .dtors. Sort by explicit priority rather than
4193 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4194 * testsuite/initpri2.c: New test.
4195 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4196 (check_PROGRAMS): Add initpri2.
4197 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4198 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4199 * configure, testsuite/Makefile.in: Rebuild.
4201 2011-06-19 Ian Lance Taylor <iant@google.com>
4204 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4205 .interp section to a PT_INTERP segment even if we have seen a
4206 --dynamic-linker option. Don't do it if we have seen a PHDRS
4207 clause in a linker script.
4208 (Layout::finalize): Don't create a .interp section if we've
4209 already create a PT_INTERP segment.
4210 (Layout::create_interp): Always call choose_output_section (revert
4211 patch of 2011-06-17). Don't create PT_INTERP segment.
4212 * script-sections.cc
4213 (Script_sections::create_note_and_tls_segments): Add a .interp
4214 section to a PT_INTERP segment even if we have seen a
4215 --dynamic-linker option.
4217 2011-06-18 Ian Lance Taylor <iant@google.com>
4219 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4220 merely because a non-PT_LOAD segment has a dynamic reloc.
4222 2011-06-18 Ian Lance Taylor <iant@google.com>
4224 * layout.cc (Layout::finish_dynamic_section): Don't create
4225 DT_FLAGS entry if not needed.
4227 2011-06-18 Ian Lance Taylor <iant@google.com>
4230 * layout.cc (Layout::layout_eh_frame): Correct handling of
4231 writable .eh_frame section.
4233 2011-06-17 Ian Lance Taylor <iant@google.com>
4236 * resolve.cc (Symbol_table::resolve): Don't give an error if a
4237 symbol is redefined with the exact same object and value.
4239 2011-06-17 Ian Lance Taylor <iant@google.com>
4242 * layout.h (class Layout): Add interp_segment_ field.
4243 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4244 (Layout::attach_allocated_section_to_segment): If making shared
4245 library, put .interp section in PT_INTERP segment.
4246 (Layout::finalize): Also call create_interp if -dynamic-linker
4248 (Layout::create_interp): Assert that there is no PT_INTERP
4249 segment. If not using a SECTIONS clause, use make_output_section.
4250 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4251 * script-sections.cc
4252 (Script_sections::create_note_and_tls_segments): If making shared
4253 library, put .interp section in PT_INTERP segment.
4255 2011-06-17 Ian Lance Taylor <iant@google.com>
4257 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4258 when making a shared library.
4260 2011-06-17 Ian Lance Taylor <iant@google.com>
4262 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4263 parameter. Change all callers. Don't issue warning about PC32
4264 against locally defined symbol.
4266 2011-06-16 Ian Lance Taylor <iant@google.com>
4268 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4269 occurs in same object.
4271 2011-06-14 Alan Modra <amodra@gmail.com>
4273 * po/POTFILES.in: Regenerate.
4275 2011-06-09 Ian Lance Taylor <iant@google.com>
4277 * script-sections.cc
4278 (Orphan_output_section::set_section_addresses): For a relocatable
4279 link set address to 0.
4281 2011-06-09 Cary Coutant <ccoutant@google.com>
4284 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4285 used with --compress-debug-sections.
4286 * gold/object.cc (Sized_relobj_file::do_layout): Report
4287 uncompressed size of compressed input sections.
4289 2011-06-08 Cary Coutant <ccoutant@google.com>
4292 * testsuite/two_file_test_2_v1.cc: Change initialization of
4293 v2 to keep it in .data.
4295 2011-06-07 Cary Coutant <ccoutant@google.com>
4297 * common.cc (Symbol_table::do_allocate_commons_list): Call
4299 * errors.cc (Errors::fatal): Adjust call to gold_exit.
4300 (Errors::fallback): New function.
4301 (gold_fallback): New function.
4302 * errors.h (Errors::fallback): New function.
4303 * gold.cc (gold_exit): Change status parameter to enum; adjust
4305 (queue_initial_tasks): Call gold_fallback.
4306 * gold.h: Include cstdlib.
4307 (Exit_status): New enum type.
4308 (gold_exit): Change status parameter to enum.
4309 (gold_fallback): New function.
4310 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4311 (Layout::create_symtab_sections): Likewise.
4312 (Layout::create_shdrs): Likewise.
4313 * main.cc (main): Adjust call to gold_exit.
4314 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4315 (Output_data_got::add_got_entry_pair): Likewise.
4316 (Output_section::add_input_section): Likewise.
4317 (Output_section::add_output_section_data): Likewise.
4318 (Output_segment::set_section_list_addresses): Likewise.
4319 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4321 2011-06-07 Cary Coutant <ccoutant@google.com>
4323 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4324 for incremental links.
4325 * output.cc (Output_segment::set_section_list_addresses): Remove
4326 FIXME and test for TLS or BSS.
4328 2011-06-07 Cary Coutant <ccoutant@google.com>
4330 * testsuite/Makefile.am: Add incremental_copy_test,
4331 incremental_common_test_1.
4332 * testsuite/Makefile.in: Regenerate.
4333 * testsuite/common_test_1_v1.c: New source file.
4334 * testsuite/common_test_1_v2.c: New source file.
4335 * testsuite/copy_test_v1.cc: New source file.
4337 2011-06-07 Cary Coutant <ccoutant@google.com>
4339 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4340 update, allocate common from bss section's free list.
4341 * incremental-dump.cc (dump_incremental_inputs): Print flag for
4342 linker-defined symbols.
4343 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4344 Skip GOT and PLT entries that are no longer referenced.
4345 (Output_section_incremental_inputs::write_info_blocks): Mark
4346 linker-defined symbols.
4347 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4348 * output.cc (Output_section::allocate): New function.
4349 * output.h (Output_section::allocate): New function.
4350 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4351 linker-defined symbols.
4352 (Symbol::override_base_with_special): Copy is_predefined_ flag.
4353 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4354 (Symbol::init_base_output_data): Likewise.
4355 (Symbol::init_base_output_segment): Likewise.
4356 (Symbol::init_base_constant): Likewise.
4357 (Sized_symbol::init_output_data): Likewise.
4358 (Sized_symbol::init_output_segment): Likewise.
4359 (Sized_symbol::init_constant): Likewise.
4360 (Symbol_table::do_define_in_output_data): Likewise.
4361 (Symbol_table::do_define_in_output_segment): Likewise.
4362 (Symbol_table::do_define_as_constant): Likewise.
4363 * symtab.h (Symbol::is_predefined): New function.
4364 (Symbol::init_base_output_data): Add is_predefined parameter.
4365 (Symbol::init_base_output_segment): Likewise.
4366 (Symbol::init_base_constant): Likewise.
4367 (Symbol::is_predefined_): New data member.
4368 (Sized_symbol::init_output_data): Add is_predefined parameter.
4369 (Sized_symbol::init_output_segment): Likewise.
4370 (Sized_symbol::init_constant): Likewise.
4371 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4373 2011-06-07 Cary Coutant <ccoutant@google.com>
4375 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4376 instead of emit_copy_reloc.
4377 (Copy_relocs::emit_copy_reloc): Refactor.
4378 (Copy_relocs::make_copy_reloc): New function.
4379 (Copy_relocs::add_copy_reloc): Remove.
4380 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4382 (Copy_relocs::make_copy_reloc): New function.
4383 (Copy_relocs::add_copy_reloc): Remove.
4384 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4385 unchanged input files.
4386 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4387 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4388 Reserve BSS space for COPY relocations.
4389 (Sized_incremental_binary::do_emit_copy_relocs): New function.
4390 (Output_section_incremental_inputs::write_info_blocks): Record
4391 whether a symbol is copied from a shared object.
4392 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4393 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4394 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4395 (Incremental_input_entry_reader::get_output_symbol_index): Add
4397 (Incremental_binary::emit_copy_relocs): New function.
4398 (Incremental_binary::do_emit_copy_relocs): New function.
4399 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4401 (Sized_incremental_binary::add_copy_reloc): New function.
4402 (Sized_incremental_binary::do_emit_copy_relocs): New function.
4403 (Sized_incremental_binary::Copy_reloc): New struct.
4404 (Sized_incremental_binary::Copy_relocs): New typedef.
4405 (Sized_incremental_binary::copy_relocs_): New data member.
4406 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4407 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4408 * target.h (Sized_target::emit_copy_reloc): New function.
4409 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4411 2011-06-02 Cary Coutant <ccoutant@google.com>
4414 * gold/archive.cc (Archive::Archive): Initialize new data member.
4415 (Archive::include_all_members): Return if archive has already been
4417 * gold/archive.h (Archive::include_all_members_): New data member.
4419 2011-06-02 Nick Clifton <nickc@redhat.com>
4421 * dynobj.h: Fix spelling mistake in comment.
4422 * output.cc: Likewise.
4424 2011-05-31 Doug Kwan <dougkwan@google.com>
4428 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4429 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4430 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
4431 redundant arm_exidx_test.so.
4432 * testsuite/Makefile.in: Regenerate.
4433 (check_SCRIPTS): Add pr12826.sh
4434 (check_DATA): Add pr12826.stdout
4435 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4436 * testsuite/pr12826.sh: New file.
4437 * testsuite/pr12826_1.s: Ditto.
4438 * testsuite/pr12826_1.s: Ditto.
4440 2011-05-30 Ian Lance Taylor <iant@google.com>
4442 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4445 2011-05-29 Ian Lance Taylor <iant@google.com>
4448 * testsuite/Makefile.am: Use different file name for two_file_test
4449 temporary file for each incremental test.
4450 * testsuite/Makefile.in: Rebuild.
4452 2011-05-29 Ian Lance Taylor <iant@google.com>
4454 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4455 binary input file is empty.
4457 2011-05-27 Ian Lance Taylor <iant@google.com>
4459 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4460 (ver_test_9.so): Likewise.
4461 * testsuite/Makefile.in: Rebuild.
4463 2011-05-26 Cary Coutant <ccoutant@google.com>
4465 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4466 * incremental.cc (Incremental_inputs::report_input_section): Fix
4467 comment, indentation.
4468 (Incremental_inputs::report_comdat_group): New function.
4469 (Output_section_incremental_inputs::set_final_data_size): Adjust size
4470 of data for incremental input file entry.
4471 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4472 group count, COMDAT group signatures.
4473 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4474 an unchanged input file.
4475 * incremental.h (Incremental_object_entry::Incremental_object_entry):
4476 Initialize new data member.
4477 (Incremental_object_entry::add_comdat_group): New function.
4478 (Incremental_object_entry::get_comdat_group_count): New function.
4479 (Incremental_object_entry::get_comdat_signature_key): New function.
4480 (Incremental_object_entry::groups_): New data member.
4481 (Incremental_inputs::report_comdat_group): New function.
4482 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4483 data for incremental input file entry.
4484 (Incremental_input_entry_reader::get_comdat_group_count): New function.
4485 (Incremental_input_entry_reader::get_input_section): Adjust size of
4486 data for incremental input file entry.
4487 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4488 (Incremental_input_entry_reader::get_comdat_group_signature): New
4490 * object.cc (Sized_relobj::include_section_group): Report kept
4491 COMDAT groups for incremental links.
4493 2011-05-24 David Meyer <pdox@google.com>
4495 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4496 with name parameter. Add found_name parameter.
4497 * fileread.cc (Input_file::find_file): Adjust code accordingly.
4498 * dirsearch.h (class Dirsearch): Update declaration.
4500 2011-05-24 Ian Lance Taylor <iant@google.com>
4502 * archive.cc (Library_base::should_include_member): Pull in object
4503 from archive if it defines the entry symbol.
4504 * parameters.cc (Parameters::entry): New function.
4505 * parameters.h (class Parameters): Declare entry.
4506 * output.h (class Output_file_header): Remove entry_ field.
4507 * output.cc (Output_file_header::Output_file_header): Remove entry
4508 parameter. Change all callers.
4509 (Output_file_header::entry): Use parameters->entry.
4510 * gold.cc (queue_middle_tasks): Likewise.
4511 * plugin.cc (Plugin_hook::run): Likewise.
4513 2011-05-24 Cary Coutant <ccoutant@google.com>
4515 * gold.cc (queue_initial_tasks): Pass incremental base filename
4516 to Output_file::open_base_file; don't print error message.
4517 * incremental-dump.cc (main): Adjust call to
4518 Output_file::open_for_modification.
4519 * incremental-dump.cc (main): Likewise.
4520 * incremental.cc (Incremental_inputs::report_command_line):
4521 Ignore --incremental-base option when comparing command lines.
4522 Ignore parameter when given as separate argument.
4523 * options.h (class General_options): Add --incremental-base.
4524 * output.cc (Output_file::Output_file):
4525 (Output_file::open_base_file): Add base_name and writable parameters;
4526 read base file into new file; print error message here.
4527 (Output_file::map_no_anonymous): Add writable parameter; adjust all
4529 * output.h (Output_file::open_for_modification): Rename to...
4530 (Output_file::open_base_file): ...this; add base_name and
4531 writable parameters; adjust all callers.
4532 (Output_file::map_no_anonymous): Add writable parameter; adjust all
4534 * testsuite/Makefile.am (incremental_test_4): Test
4536 * testsuite/Makefile.in: Regenerate.
4538 2011-05-24 Cary Coutant <ccoutant@google.com>
4540 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4542 * testsuite/Makefile.in: Regenerate.
4543 * testsuite/two_file_test_1_v1.cc: New test source file.
4544 * testsuite/two_file_test_1b_v1.cc: New test source file.
4545 * testsuite/two_file_test_2_v1.cc: New test source file.
4547 2011-05-24 Cary Coutant <ccoutant@google.com>
4549 * dynobj.h (Dynobj::do_dynobj): New function.
4550 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4551 flag and soname for shared objects.
4552 * incremental.cc (Incremental_inputs::report_object): Make
4553 either Incremental_object_entry or Incremental_dynobj_entry; add
4554 soname to string table.
4555 (Incremental_inputs::report_input_section): Add assertion.
4556 (Output_section_incremental_inputs::set_final_data_size): Adjust
4557 type of input file entry for shared libraries; adjust size of
4558 shared library info entry.
4559 (Output_section_incremental_inputs::write_input_files): Write
4560 as_needed flag for shared libraries.
4561 (Output_section_incremental_inputs::write_info_blocks): Adjust type
4562 of input file entry for shared libraries; write soname.
4563 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4564 soname from incremental info.
4565 * incremental.h (enum Incremental_input_flags): Add
4566 INCREMENTAL_INPUT_AS_NEEDED.
4567 (Incremental_input_entry::Incremental_input_entry): Initialize new
4569 (Incremental_input_entry::set_as_needed): New function.
4570 (Incremental_input_entry::as_needed): New function.
4571 (Incremental_input_entry::do_dynobj_entry): New function.
4572 (Incremental_input_entry::as_needed_): New data member.
4573 (Incremental_object_entry::Incremental_object_entry): Don't check
4575 (Incremental_object_entry::do_type): Likewise.
4576 (class Incremental_dynobj_entry): New class.
4577 (Incremental_input_entry_reader::as_needed): New function.
4578 (Incremental_input_entry_reader::get_soname): New function.
4579 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4580 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4581 size of shared library info entry.
4582 * layout.cc (Layout::finish_dynamic_section): Don't test for
4583 incremental link when adding DT_NEEDED entries.
4584 * object.h (Object::Object): Initialize new data member.
4585 (Object::dynobj): New function.
4586 (Object::set_as_needed): New function.
4587 (Object::as_needed): New function.
4588 (Object::do_dynobj): New function.
4589 (Object::as_needed_): New data member.
4591 2011-05-24 Cary Coutant <ccoutant@google.com>
4593 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4594 info; adjust display of GOT entries.
4595 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4596 vector of input objects; remove file_status_.
4597 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4598 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4599 got_plt reader; call target hooks to reserve GOT entries.
4600 (Output_section_incremental_inputs::set_final_data_size): Adjust size
4601 of input file info header and GOT info entry.
4602 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4604 (Got_plt_view_info::got_descriptor): Remove.
4605 (Got_plt_view_info::sym_index): New data member.
4606 (Got_plt_view_info::input_index): New data member.
4607 (Local_got_offset_visitor::visit): Write input file index.
4608 (Global_got_offset_visitor::visit): Write 0 for input file index.
4609 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4610 with sym_index and input_index.
4611 (Output_section_incremental_inputs::write_got_plt): Adjust size of
4612 incremental info GOT entry; replace got_descriptor with input_index.
4613 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4614 map from input file index to object.
4615 (Sized_relobj_incr::do_layout): Replace direct data member reference
4616 with accessor function.
4617 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4618 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4619 Adjust size of input file info header.
4620 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4621 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4622 (Incremental_input_entry_reader::get_input_section): Adjust size of
4623 input file info header.
4624 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4625 of incremental info GOT entry.
4626 (Incremental_got_plt_reader::get_got_desc): Remove.
4627 (Incremental_got_plt_reader::get_got_symndx): New function.
4628 (Incremental_got_plt_reader::get_got_input_index): New function.
4629 (Sized_incremental_binary::Sized_incremental_binary): Remove
4630 file_status_; add input_objects_.
4631 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4632 (Sized_incremental_binary::set_file_is_unchanged): Remove.
4633 (Sized_incremental_binary::file_is_unchanged): Remove.
4634 (Sized_incremental_binary::set_input_object): New function.
4635 (Sized_incremental_binary::input_object): New function.
4636 (Sized_incremental_binary::file_status_): Remove.
4637 (Sized_incremental_binary::input_objects_): New data member.
4638 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4640 (Sized_relobj_incr::invalid_address): Move to base class.
4641 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4643 (Sized_relobj_incr::do_output_section_offset): Likewise.
4644 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4645 (Sized_relobj_incr::section_offsets_): Likewise.
4646 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4648 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4649 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4650 with accessor function.
4651 (Sized_relobj_file::do_layout): Likewise.
4652 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4653 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4654 (Sized_relobj_file::compute_final_local_value): Replace refs to
4655 section_offsets_ with accessor function.
4656 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4657 * object.h (Relobj::Relobj): Initialize new data members.
4658 (Relobj::add_dyn_reloc): New function.
4659 (Relobj::first_dyn_reloc): New function.
4660 (Relobj::dyn_reloc_count): New function.
4661 (Relobj::first_dyn_reloc_): New data member.
4662 (Relobj::dyn_reloc_count_): New data member.
4663 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4665 (Sized_relobj::Address): New typedef.
4666 (Sized_relobj::invalid_address): Move here from child class.
4667 (Sized_relobj::Sized_relobj): Initialize new data members.
4668 (Sized_relobj::sized_relobj): New function.
4669 (Sized_relobj::is_output_section_offset_invalid): Move here from
4671 (Sized_relobj::get_output_section_offset): Likewise.
4672 (Sized_relobj::local_has_got_offset): Likewise.
4673 (Sized_relobj::local_got_offset): Likewise.
4674 (Sized_relobj::set_local_got_offset): Likewise.
4675 (Sized_relobj::do_for_all_local_got_entries): Likewise.
4676 (Sized_relobj::clear_got_offsets): New function.
4677 (Sized_relobj::section_offsets): Move here from child class.
4678 (Sized_relobj::do_output_section_offset): Likewise.
4679 (Sized_relobj::do_set_section_offset): Likewise.
4680 (Sized_relobj::Local_got_offsets): Likewise.
4681 (Sized_relobj::local_got_offsets_): Likewise.
4682 (Sized_relobj::section_offsets_): Likewise.
4683 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4685 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4687 (Sized_relobj_file::sized_relobj): New function
4688 (Sized_relobj_file::local_has_got_offset): Move to base class.
4689 (Sized_relobj_file::local_got_offset): Likewise.
4690 (Sized_relobj_file::set_local_got_offset): Likewise.
4691 (Sized_relobj_file::get_output_section_offset): Likewise.
4692 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4693 (Sized_relobj_file::do_output_section_offset): Likewise.
4694 (Sized_relobj_file::do_set_section_offset): Likewise.
4695 (Sized_relobj_file::Local_got_offsets): Likewise.
4696 (Sized_relobj_file::local_got_offsets_): Likewise.
4697 (Sized_relobj_file::section_offsets_): Likewise.
4698 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4700 (set_needs_dynsym_index): Convert relobj to derived class pointer.
4701 (Output_reloc::get_symbol_index): Likewise.
4702 (Output_reloc::local_section_offset): Likewise.
4703 (Output_reloc::get_address): Likewise.
4704 (Output_reloc::symbol_value): Likewise.
4705 (Output_data_got::reserve_slot): Move to class definition.
4706 (Output_data_got::reserve_local): New function.
4707 (Output_data_got::reserve_slot_for_global): Remove.
4708 (Output_data_got::reserve_global): New function.
4709 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4710 (all constructors, two instantiations).
4711 (Output_reloc::get_relobj): New function (two instantiations).
4712 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4713 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4714 (Output_data_reloc::add_global): Adjust type of relobj.
4715 (Output_data_reloc::add_global_relative): Likewise.
4716 (Output_data_reloc::add_symbolless_global_addend): Likewise.
4717 (Output_data_reloc::add_local): Likewise.
4718 (Output_data_reloc::add_local_relative): Likewise.
4719 (Output_data_reloc::add_symbolless_local_addend): Likewise.
4720 (Output_data_reloc::add_local_section): Likewise.
4721 (Output_data_reloc::add_output_section): Likewise.
4722 (Output_data_reloc::add_absolute): Likewise.
4723 (Output_data_reloc::add_target_specific): Likewise.
4724 (Output_data_got::reserve_slot): Move definition here.
4725 (Output_data_got::reserve_local): New function.
4726 (Output_data_got::reserve_global): New function.
4727 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4728 section_offsets_ with accessor function.
4729 (Sized_relobj_file::write_sections): Likewise.
4730 (Sized_relobj_file::do_relocate_sections): Likewise.
4731 * target.h (Sized_target::reserve_local_got_entry): New function.
4732 (Sized_target::reserve_global_got_entry): New function.
4733 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4734 (Target_x86_64::reserve_global_got_entry): New function.
4735 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4737 2011-05-23 Cary Coutant <ccoutant@google.com>
4739 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4740 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4741 bit when checking got_type.
4742 * incremental.cc (Sized_incremental_binary::setup_readers):
4743 Store symbol table and string table locations; initialize bit vector
4744 of file status flags.
4745 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4747 (Sized_incremental_binary::do_process_got_plt): New function.
4748 (Sized_incremental_binary::get_symtab_view): Use stored locations.
4749 (Output_section_incremental_inputs::set_final_data_size): Record
4750 file index for each input file.
4751 (Output_section_incremental_inputs::write_got_plt): Store file index
4752 instead of input entry offset for each GOT entry.
4754 (Incremental_input_entry::Incremental_input_entry): Initialize new
4756 (Incremental_input_entry::set_offset): Store file index.
4757 (Incremental_input_entry::get_file_index): New function.
4758 (Incremental_input_entry::file_index_): New data member.
4759 (Incremental_binary::process_got_plt): New function.
4760 (Incremental_binary::do_process_got_plt): New function.
4761 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4763 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4764 (Sized_incremental_binary::set_file_is_unchanged): New function.
4765 (Sized_incremental_binary::file_is_unchanged): New function.
4766 (Sized_incremental_binary::do_process_got_plt): New function.
4767 (Sized_incremental_binary::file_status_): New data member.
4768 (Sized_incremental_binary::main_symtab_loc_): New data member.
4769 (Sized_incremental_binary::main_strtab_loc_): New data member.
4770 * output.cc (Output_data_got::Got_entry::write): Add case
4772 (Output_data_got::add_global): Call add_got_entry.
4773 (Output_data_got::add_global_plt): Likewise.
4774 (Output_data_got::add_global_with_rel): Likewise.
4775 (Output_data_got::add_global_with_rela): Likewise.
4776 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4777 (Output_data_got::add_global_pair_with_rela): Likewise.
4778 (Output_data_got::add_local): Call add_got_entry.
4779 (Output_data_got::add_local_plt): Likewise.
4780 (Output_data_got::add_local_with_rel): Likewise.
4781 (Output_data_got::add_local_with_rela): Likewise.
4782 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4783 (Output_data_got::add_local_pair_with_rela): Likewise.
4784 (Output_data_got::reserve_slot): New function.
4785 (Output_data_got::reserve_slot_for_global): New function.
4786 (Output_data_got::add_got_entry): New function.
4787 (Output_data_got::add_got_entry_pair): New function.
4788 (Output_section::add_output_section_data): Edit FIXME.
4790 (Output_section_data_build::Output_section_data_build): New
4791 constructor with size parameter.
4792 (Output_data_space::Output_data_space): Likewise.
4793 (Output_data_got::Output_data_got): Initialize new data member; new
4794 constructor with size parameter.
4795 (Output_data_got::add_constant): Call add_got_entry.
4796 (Output_data_got::reserve_slot): New function.
4797 (Output_data_got::reserve_slot_for_global): New function.
4798 (class Output_data_got::Got_entry): Add RESERVED_CODE.
4799 (Output_data_got::add_got_entry): New function.
4800 (Output_data_got::add_got_entry_pair): New function.
4801 (Output_data_got::free_list_): New data member.
4802 * target.h (Sized_target::init_got_plt_for_update): New function.
4803 (Sized_target::register_global_plt_entry): New function.
4804 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4805 Initialize new data member; call init; add constructor with PLT count.
4806 (Output_data_plt_x86_64::init): New function.
4807 (Output_data_plt_x86_64::add_relocation): New function.
4808 (Output_data_plt_x86_64::reserve_slot): New function.
4809 (Output_data_plt_x86_64::free_list_): New data member.
4810 (Target_x86_64::init_got_plt_for_update): New function.
4811 (Target_x86_64::register_global_plt_entry): New function.
4812 (Output_data_plt_x86_64::add_entry): Allocate from free list for
4813 incremental updates.
4814 (Output_data_plt_x86_64::add_relocation): New function.
4815 * testsuite/object_unittest.cc (Object_test): Set default options.
4817 2011-05-16 Ian Lance Taylor <iant@google.com>
4819 * options.h (class General_options): Make -i a synonym for -r.
4821 2011-05-16 Ian Lance Taylor <iant@google.com>
4823 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4825 2011-05-10 Cary Coutant <ccoutant@google.com>
4827 * object.cc (Sized_relobj::do_count_local_symbols): Check for
4830 2011-05-06 Ian Lance Taylor <iant@google.com>
4832 * layout.cc (Layout::layout): If the output section flags change,
4833 update the ordering.
4835 2011-04-25 Cary Coutant <ccoutant@google.com>
4837 * incremental-dump.cc (dump_incremental_inputs): Print local
4838 symbol info for each input file.
4840 (Output_section_incremental_inputs::set_final_data_size): Add local
4841 symbol info to input file entries in incremental info.
4842 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4843 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4844 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4845 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4847 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4848 (Sized_incr_relobj::do_relocate): Write the local symbols.
4849 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4850 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4851 Adjust size of input file header.
4852 (Incremental_inputs_reader::get_local_symbol_offset): New function.
4853 (Incremental_inputs_reader::get_local_symbol_count): New function.
4854 (Incremental_inputs_reader::get_input_section): Adjust size of input
4856 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4857 (Sized_incr_relobj::This): New typedef.
4858 (Sized_incr_relobj::sym_size): New const data member.
4859 (Sized_incr_relobj::Local_symbol): New struct.
4860 (Sized_incr_relobj::do_output_local_symbol_count): New function.
4861 (Sized_incr_relobj::do_local_symbol_offset): New function.
4862 (Sized_incr_relobj::local_symbol_count_): New data member.
4863 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4864 (Sized_incr_relobj::local_symbol_index_): New data member.
4865 (Sized_incr_relobj::local_symbol_offset_): New data member.
4866 (Sized_incr_relobj::local_dynsym_offset_): New data member.
4867 (Sized_incr_relobj::local_symbols_): New data member.
4868 * object.h (Relobj::output_local_symbol_count): New function.
4869 (Relobj::local_symbol_offset): New function.
4870 (Relobj::do_output_local_symbol_count): New function.
4871 (Relobj::do_local_symbol_offset): New function.
4872 (Sized_relobj::do_output_local_symbol_count): New function.
4873 (Sized_relobj::do_local_symbol_offset): New function.
4875 2011-04-22 Vladimir Simonov <sv@sw.ru>
4877 * descriptors.cc (set_close_on_exec): New function.
4878 (Descriptors::open): Use set_close_on_exec.
4879 * output.cc (S_ISLNK): Define if not defined.
4881 2011-04-22 Cary Coutant <ccoutant@google.com>
4883 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4885 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4886 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4887 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4889 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4890 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4891 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4893 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4895 (Incremental_binary::apply_incremental_relocs): New function.
4896 (Incremental_binary::do_apply_incremental_relocs): New function.
4897 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4899 (Sized_incremental_binary::add_global_symbol): New function.
4900 (Sized_incremental_binary::global_symbol): New function.
4901 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4902 (Sized_incremental_binary::symbol_map_): New data member.
4903 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4904 * target.h (Sized_target::apply_relocation): New function.
4905 * target-reloc.h (apply_relocation): New function.
4906 * x86_64.cc (Target_x86_64::apply_relocation): New function.
4908 2011-04-22 Doug Kwan <dougkwan@google.com>
4910 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4911 flag of a SHT_ARM_EXIDX section.
4912 * testsuite/Makefile.am (arm_exidx_test): New test rules.
4913 * testsuite/Makefile.in: Regenerate.
4914 * testsuite/arm_exidx_test.s: New file.
4915 * testsuite/arm_exidx_test.sh: Same.
4917 2011-04-20 Cary Coutant <ccoutant@google.com>
4920 * archive.h (Incremental_archive_entry::Archive_member):
4921 Initialize arg_serial_ (second constructor).
4923 2011-04-17 Ian Lance Taylor <iant@google.com>
4925 * object.cc (Relocate_info::location): Simplify location string.
4926 * errors.cc (Errors::error_at_location): Don't print program
4928 (Errors::warning_at_location): Likewise.
4929 (Errors::undefined_symbol): Likewise.
4930 * testsuite/debug_msg.sh: Update accordingly.
4932 2011-04-14 Cary Coutant <ccoutant@google.com>
4934 * gold/layout.cc (Layout::symtab_section_offset): New function.
4935 * gold/layout.h (Layout::symtab_section_offset): New function.
4936 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4938 2011-04-12 Ian Lance Taylor <iant@google.com>
4940 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
4941 with MREMAP_MAYMOVE.
4942 * output.h (class Output_file): Add map_is_allocated_ field.
4943 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
4944 not available, provide stubs. If mremap is not available, #define
4946 (MREMAP_MAYMOVE): Define if not defined.
4947 (Output_file::Output_file): Initialize map_is_allocated_.
4948 (Output_file::resize): Check map_is_allocated_.
4949 (Output_file::map_anonymous): If mmap fails, use malloc.
4950 (Output_file::unmap): Don't do anything for an anonymous map.
4951 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
4952 is not available, provide stubs.
4953 (File_read::View::~View): Use free rather than delete[].
4954 (File_read::make_view): Use malloc rather than new[]. If mmap
4956 (File_read::find_or_make_view): Use malloc rather than new[].
4957 * gold.h: Remove HAVE_REMAP code.
4958 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
4959 exists. Rename mremap to gold_mremap. If mmap is not available
4961 * configure, config.in: Rebuild.
4963 2011-04-11 Ian Lance Taylor <iant@google.com>
4965 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4966 initialize local variable v.
4968 2011-04-11 Cary Coutant <ccoutant@google.com>
4970 * archive.cc (Archive::include_member): Adjust call to
4972 (Add_archive_symbols::run): Track argument serial numbers.
4973 (Lib_group::include_member): Likewise.
4974 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4975 * archive.h (Incremental_archive_entry::Archive_member):
4976 Initialize arg_serial_.
4977 (Archive_member::arg_serial_): New data member.
4978 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4979 (Sized_dynobj::do_add_symbols): Track symbols when doing an
4981 (Sized_dynobj::do_for_all_local_got_entries): New function.
4982 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4984 * fileread.cc (get_mtime): New function.
4985 * fileread.h (get_mtime): New function.
4986 * gold.cc (queue_initial_tasks): Check for incremental update.
4987 (process_incremental_input): New function.
4988 (queue_middle_tasks): Don't force valid target for incremental
4990 * incremental-dump.cc (find_input_containing_global): Adjust
4991 size of symbol info entry.
4992 (dump_incremental_inputs): Dump argument serial number and
4993 in_system_directory flag; bias shndx by 1; print symbol names
4994 when dumping per-file symbol lists; use new symbol info readers.
4996 (Output_section_incremental_inputs:update_data_size): New function.
4997 (Sized_incremental_binary::setup_readers): Setup input readers
4998 for each input file; build maps for files added from libraries
5000 (Sized_incremental_binary::check_input_args): New function.
5001 (Sized_incremental_binary::do_check_inputs): Build map of argument
5002 serial numbers to input arguments.
5003 (Sized_incremental_binary::do_file_has_changed): Rename
5004 do_file_is_unchanged to this; compare file modification times.
5005 (Sized_incremental_binary::do_init_layout): New function.
5006 (Sized_incremental_binary::do_reserve_layout): New function.
5007 (Sized_incremental_binary::do_get_input_reader): Remove.
5008 (Sized_incremental_binary::get_symtab_view): New function.
5009 (Incremental_checker::can_incrementally_link_output_file): Remove.
5010 (Incremental_inputs::report_command_line): Exclude --debug options.
5011 (Incremental_inputs::report_archive_begin): Add parameter; track
5012 argument serial numbers; don't put input file entry for archive
5013 before archive members.
5014 (Incremental_inputs::report_archive_end): Put input file entry
5015 for archive after archive members.
5016 (Incremental_inputs::report_object): Add parameter; track argument
5017 serial numbers and in_system_directory flag.
5018 (Incremental_inputs::report_script): Add parameter; track argument
5020 (Output_section_incremental_inputs::set_final_data_size): Adjust
5021 size of symbol info entry; check for forwarding symbols.
5022 (Output_section_incremental_inputs::write_input_files): Write
5023 in_system_directory flag and argument serial number.
5024 (Output_section_incremental_inputs::write_info_blocks): Map section
5025 indices between incremental info and original input file; store
5026 input section index for each symbol.
5027 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5028 change operator() to visit().
5029 (class Global_got_offset_visitor): Likewise.
5030 (class Global_symbol_visitor_got_plt):
5031 (Output_section_incremental_inputs::write_got_plt): Use new visitor
5033 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5034 (Sized_incr_relobj::do_read_symbols): New function.
5035 (Sized_incr_relobj::do_layout): New function.
5036 (Sized_incr_relobj::do_layout_deferred_sections): New function.
5037 (Sized_incr_relobj::do_add_symbols): New function.
5038 (Sized_incr_relobj::do_should_include_member): New function.
5039 (Sized_incr_relobj::do_for_all_global_symbols): New function.
5040 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5041 (Sized_incr_relobj::do_section_size): New function.
5042 (Sized_incr_relobj::do_section_name): New function.
5043 (Sized_incr_relobj::do_section_contents): New function.
5044 (Sized_incr_relobj::do_section_flags): New function.
5045 (Sized_incr_relobj::do_section_entsize): New function.
5046 (Sized_incr_relobj::do_section_address): New function.
5047 (Sized_incr_relobj::do_section_type): New function.
5048 (Sized_incr_relobj::do_section_link): New function.
5049 (Sized_incr_relobj::do_section_info): New function.
5050 (Sized_incr_relobj::do_section_addralign): New function.
5051 (Sized_incr_relobj::do_initialize_xindex): New function.
5052 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5053 (Sized_incr_relobj::do_read_relocs): New function.
5054 (Sized_incr_relobj::do_gc_process_relocs): New function.
5055 (Sized_incr_relobj::do_scan_relocs): New function.
5056 (Sized_incr_relobj::do_count_local_symbols): New function.
5057 (Sized_incr_relobj::do_finalize_local_symbols): New function.
5058 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5059 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5060 (Sized_incr_relobj::do_relocate): New function.
5061 (Sized_incr_relobj::do_set_section_offset): New function.
5062 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5063 (Sized_incr_dynobj::do_read_symbols): New function.
5064 (Sized_incr_dynobj::do_layout): New function.
5065 (Sized_incr_dynobj::do_add_symbols): New function.
5066 (Sized_incr_dynobj::do_should_include_member): New function.
5067 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5068 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5069 (Sized_incr_dynobj::do_section_size): New function.
5070 (Sized_incr_dynobj::do_section_name): New function.
5071 (Sized_incr_dynobj::do_section_contents): New function.
5072 (Sized_incr_dynobj::do_section_flags): New function.
5073 (Sized_incr_dynobj::do_section_entsize): New function.
5074 (Sized_incr_dynobj::do_section_address): New function.
5075 (Sized_incr_dynobj::do_section_type): New function.
5076 (Sized_incr_dynobj::do_section_link): New function.
5077 (Sized_incr_dynobj::do_section_info): New function.
5078 (Sized_incr_dynobj::do_section_addralign): New function.
5079 (Sized_incr_dynobj::do_initialize_xindex): New function.
5080 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5081 (make_sized_incremental_object): New function.
5082 (Incremental_library::copy_unused_symbols): New function.
5083 (Incremental_library::do_for_all_unused_symbols): New function.
5084 * incremental.h (enum Incremental_input_flags): New type.
5085 (class Incremental_checker): Remove.
5086 (Incremental_input_entry::Incremental_input_entry): Add argument
5088 (Incremental_input_entry::arg_serial): New function.
5089 (Incremental_input_entry::set_is_in_system_directory): New function.
5090 (Incremental_input_entry::is_in_system_directory): New function.
5091 (Incremental_input_entry::arg_serial_): New data member.
5092 (Incremental_input_entry::is_in_system_directory_): New data member.
5093 (class Script_info): Move here from script.h.
5094 (Script_info::Script_info): Add filename parameter.
5095 (Script_info::filename): New function.
5096 (Script_info::filename_): New data member.
5097 (Incremental_script_entry::Incremental_script_entry): Add argument
5099 (Incremental_object_entry::Incremental_object_entry): Likewise.
5100 (Incremental_object_entry::add_input_section): Build list of input
5101 sections with map to original shndx.
5102 (Incremental_object_entry::get_input_section_index): New function.
5103 (Incremental_object_entry::shndx_): New data member.
5104 (Incremental_object_entry::name_key_): Rename; adjust all refs.
5105 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5106 (Incremental_archive_entry::Incremental_archive_entry): Add argument
5108 (Incremental_inputs::report_archive_begin): Likewise.
5109 (Incremental_inputs::report_object): Likewise.
5110 (Incremental_inputs::report_script): Likewise.
5111 (class Incremental_global_symbol_reader): New class.
5112 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5113 and store flags and input file type.
5114 (Incremental_input_entry_reader::arg_serial): New function.
5115 (Incremental_input_entry_reader::type): Extract type from flags.
5116 (Incremental_input_entry_reader::is_in_system_directory): New function.
5117 (Incremental_input_entry_reader::get_input_section_count): Call
5118 accessor function for type.
5119 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5120 function for type; adjust size of global symbol entry.
5121 (Incremental_input_entry_reader::get_global_symbol_count): Call
5122 accessor function for type.
5123 (Incremental_input_entry_reader::get_object_count): Likewise.
5124 (Incremental_input_entry_reader::get_object_offset): Likewise.
5125 (Incremental_input_entry_reader::get_member_count): Likewise.
5126 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5127 (Incremental_input_entry_reader::get_member_offset): Likewise.
5128 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5129 (Incremental_input_entry_reader::Global_symbol_info): Remove.
5130 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5131 (Incremental_input_entry_reader::get_global_symbol_reader): New
5133 (Incremental_input_entry_reader::get_output_symbol_index): New
5135 (Incremental_input_entry_reader::type_): Remove.
5136 (Incremental_input_entry_reader::flags_): New data member.
5137 (Incremental_inputs_reader::input_file_offset): New function.
5138 (Incremental_inputs_reader::input_file_index): New function.
5139 (Incremental_inputs_reader::input_file): Call input_file_offset.
5140 (Incremental_inputs_reader::input_file_at_offset): New function.
5141 (Incremental_relocs_reader::get_r_type): Reformat.
5142 (Incremental_relocs_reader::get_r_shndx): Reformat.
5143 (Incremental_relocs_reader::get_r_offset): Reformat.
5144 (Incremental_relocs_reader::data): New function.
5145 (Incremental_binary::Incremental_binary): Initialize new data members.
5146 (Incremental_binary::check_inputs): Add cmdline parameter.
5147 (Incremental_binary::file_is_unchanged): Remove.
5148 (Input_reader::arg_serial): New function.
5149 (Input_reader::get_unused_symbol_count): New function.
5150 (Input_reader::get_unused_symbol): New function.
5151 (Input_reader::do_arg_serial): New function.
5152 (Input_reader::do_get_unused_symbol_count): New function.
5153 (Input_reader::do_get_unused_symbol): New function.
5154 (Incremental_binary::input_file_count): New function.
5155 (Incremental_binary::get_input_reader): Change signature to use
5156 index instead of filename.
5157 (Incremental_binary::file_has_changed): New function.
5158 (Incremental_binary::get_input_argument): New function.
5159 (Incremental_binary::get_library): New function.
5160 (Incremental_binary::get_script_info): New function.
5161 (Incremental_binary::init_layout): New function.
5162 (Incremental_binary::reserve_layout): New function.
5163 (Incremental_binary::output_file): New function.
5164 (Incremental_binary::do_check_inputs): New function.
5165 (Incremental_binary::do_file_is_unchanged): Remove.
5166 (Incremental_binary::do_file_has_changed): New function.
5167 (Incremental_binary::do_init_layout): New function.
5168 (Incremental_binary::do_reserve_layout): New function.
5169 (Incremental_binary::do_input_file_count): New function.
5170 (Incremental_binary::do_get_input_reader): Change signature.
5171 (Incremental_binary::input_args_map_): New data member.
5172 (Incremental_binary::library_map_): New data member.
5173 (Incremental_binary::script_map_): New data member.
5174 (Sized_incremental_binary::Sized_incremental_binary): Initialize
5176 (Sized_incremental_binary::output_section): New function.
5177 (Sized_incremental_binary::inputs_reader): Add const.
5178 (Sized_incremental_binary::symtab_reader): Add const.
5179 (Sized_incremental_binary::relocs_reader): Add const.
5180 (Sized_incremental_binary::got_plt_reader): Add const.
5181 (Sized_incremental_binary::get_symtab_view): New function.
5182 (Sized_incremental_binary::Inputs_reader): New typedef.
5183 (Sized_incremental_binary::Input_entry_reader): New typedef.
5184 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5185 (Sized_incremental_binary::do_file_is_unchanged): Remove.
5186 (Sized_incremental_binary::do_file_has_changed): New function.
5187 (Sized_incremental_binary::do_init_layout): New function.
5188 (Sized_incremental_binary::do_reserve_layout): New function.
5189 (Sized_input_reader::Inputs_reader): Remove.
5190 (Sized_input_reader::Input_entry_reader): Remove.
5191 (Sized_input_reader::do_arg_serial): New function.
5192 (Sized_input_reader::do_get_unused_symbol_count): New function.
5193 (Sized_input_reader::do_get_unused_symbol): New function.
5194 (Sized_incremental_binary::do_input_file_count): New function.
5195 (Sized_incremental_binary::do_get_input_reader): Change signature;
5196 use index instead of filename.
5197 (Sized_incremental_binary::section_map_): New data member.
5198 (Sized_incremental_binary::input_entry_readers_): New data member.
5199 (class Sized_incr_relobj): New class.
5200 (class Sized_incr_dynobj): New class.
5201 (make_sized_incremental_object): New function.
5202 (class Incremental_library): New class.
5203 * layout.cc (Free_list::num_lists): New static data member.
5204 (Free_list::num_nodes): New static data member.
5205 (Free_list::num_removes): New static data member.
5206 (Free_list::num_remove_visits): New static data member.
5207 (Free_list::num_allocates): New static data member.
5208 (Free_list::num_allocate_visits): New static data member.
5209 (Free_list::init): New function.
5210 (Free_list::remove): New function.
5211 (Free_list::allocate): New function.
5212 (Free_list::dump): New function.
5213 (Free_list::print_stats): New function.
5214 (Layout_task_runner::run): Resize output file for incremental updates.
5215 (Layout::Layout): Initialize new data members.
5216 (Layout::set_incremental_base): New function.
5217 (Layout::init_fixed_output_section): New function.
5218 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5219 incremental updates.
5220 (Layout::create_gold_note): Do not create gold note section for
5221 incremental updates.
5222 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5223 for incremental updates.
5224 (Layout::set_section_offsets): For incremental updates, allocate space
5226 (Layout::create_symtab_sections): Layout with offsets relative to
5227 start of section; for incremental updates, allocate space from free
5229 (Layout::create_shdrs): For incremental updates, allocate space from
5231 (Layout::finish_dynamic_section): For incremental updates, do not
5232 check --as-needed (fixed in subsequent patch).
5233 * layout.h (class Free_list): New class.
5234 (Layout::set_incremental_base): New function.
5235 (Layout::incremental_base): New function.
5236 (Layout::init_fixed_output_section): New function.
5237 (Layout::allocate): New function.
5238 (Layout::incremental_base_): New data member.
5239 (Layout::free_list_): New data member.
5240 * main.cc (main): Print Free_list statistics.
5241 * object.cc (Relobj::finalize_incremental_relocs): Add
5242 clear_counts parameter; clear counts only when clear_counts is set.
5243 (Sized_relobj::Sized_relobj): Initialize new base class.
5244 (Sized_relobj::do_layout): Don't report special sections.
5245 (Sized_relobj::do_for_all_local_got_entries): New function.
5246 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5247 symtab_off to all symbol table offsets.
5248 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5249 * object.h (class Got_offset_list): Move to top of file.
5250 (Object::Object): Allow case where input_file == NULL.
5251 (Object::~Object): Likewise.
5252 (Object::input_file): Assert that input_file != NULL.
5253 (Object::lock): Allow case where input_file == NULL.
5254 (Object::unlock): Likewise.
5255 (Object::is_locked): Likewise.
5256 (Object::token): Likewise.
5257 (Object::release): Likewise.
5258 (Object::is_incremental): New function.
5259 (Object::get_mtime): New function.
5260 (Object::for_all_local_got_entries): New function.
5261 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5262 (Object::set_is_in_system_directory): New function.
5263 (Object::is_in_system_directory): New function.
5264 (Object::do_is_incremental): New function.
5265 (Object::do_get_mtime): New function.
5266 (Object::do_for_all_local_got_entries): New function.
5267 (Object::is_in_system_directory_): New data member.
5268 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5269 (class Sized_relobj_base): New class.
5270 (class Sized_relobj): Derive from Sized_relobj_base.
5271 (class Sized_relobj::Symbols): Redeclare from base class.
5272 (class Sized_relobj::local_got_offset_list): Remove.
5273 (class Sized_relobj::Output_sections): Redeclare from base class.
5274 (class Sized_relobj::do_for_all_local_got_entries): New function.
5275 (class Sized_relobj::write_local_symbols): Add offset parameter.
5276 (class Sized_relobj::local_symbol_offset_): Update comment.
5277 (class Sized_relobj::local_dynsym_offset_): Update comment.
5278 * options.cc (Input_arguments::add_file): Remove const.
5279 * options.h (Input_file_argument::Input_file_argument):
5280 Initialize arg_serial_ (all constructors).
5281 (Input_file_argument::set_arg_serial): New function.
5282 (Input_file_argument::arg_serial): New function.
5283 (Input_file_argument::arg_serial_): New data member.
5284 (Input_arguments::Input_arguments): Initialize file_count_.
5285 (Input_arguments::add_file): Remove const.
5286 (Input_arguments::number_of_input_files): New function.
5287 (Input_arguments::file_count_): New data member.
5288 (Command_line::number_of_input_files): Call
5289 Input_arguments::number_of_input_files.
5290 * output.cc (Output_segment_headers::Output_segment_headers):
5292 (Output_section::Input_section::current_data_size): New function.
5293 (Output_section::Output_section): Initialize new data members.
5294 (Output_section::add_input_section): Don't do merge sections for
5295 an incremental link; allocate space from free list for an
5297 (Output_section::add_output_section_data): Allocate space from
5298 free list for an incremental update.
5299 (Output_section::update_data_size): New function.
5300 (Output_section::set_fixed_layout): New function.
5301 (Output_section::reserve): New function.
5302 (Output_segment::set_section_addresses): Remove const.
5303 (Output_segment::set_section_list_addresses): Remove const; allocate
5304 space from free list for an incremental update.
5305 (Output_segment::set_offset): Adjust size of RELRO segment for an
5307 * output.h (Output_data::current_data_size): Move here from
5309 (Output_data::pre_finalize_data_size): New function.
5310 (Output_data::update_data_size): New function.
5311 (Output_section_headers::update_data_size): new function.
5312 (Output_section_data_build::current_data_size): Move to Output_data.
5313 (Output_data_strtab::update_data_size): New function.
5314 (Output_section::current_data_size): Move to Output_data.
5315 (Output_section::set_fixed_layout): New function.
5316 (Output_section::has_fixed_layout): New function.
5317 (Output_section::reserve): New function.
5318 (Output_section::update_data_size): New function.
5319 (Output_section::has_fixed_layout_): New data member.
5320 (Output_section::free_list_): New data member.
5321 (Output_segment::set_section_addresses): Remove const.
5322 (Output_segment::set_section_list_addresses): Remove const.
5323 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5325 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5327 * readsyms.cc (Read_symbols::do_read_symbols): Add library
5328 parameter when calling Add_symbols constructor; store argument
5329 serial number for members of a lib group.
5330 (Add_symbols::locks): Allow case where token == NULL.
5331 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5332 (Read_member::~Read_member): New function.
5333 (Read_member::is_runnable): New function.
5334 (Read_member::locks): New function.
5335 (Read_member::run): New function.
5336 (Check_script::~Check_script): New function.
5337 (Check_script::is_runnable): New function.
5338 (Check_script::locks): New function.
5339 (Check_script::run): New function.
5340 (Check_library::~Check_library): New function.
5341 (Check_library::is_runnable): New function.
5342 (Check_library::locks): New function.
5343 (Check_library::run): New function.
5344 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5345 (Add_symbols::library_): New data member.
5346 (class Read_member): New class.
5347 (class Check_script): New class.
5348 (class Check_library): New class.
5349 * reloc.cc (Read_relocs::is_runnable): Allow case where
5351 (Read_relocs::locks): Likewise.
5352 (Scan_relocs::locks): Likewise.
5353 (Relocate_task::locks): Likewise.
5354 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5356 (Sized_relobj::incremental_relocs_scan): Fix comment.
5357 (Sized_relobj::do_relocate): Pass output file offset to
5358 write_local_symbols.
5359 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5360 from class declaration.
5361 * script.cc (read_input_script): Allocate Script_info; pass
5362 argument serial number to report_script.
5363 * script.h (class Script_info): Move to incremental.h.
5364 * symtab.cc (Symbol_table::add_from_incrobj): New function.
5365 * symtab.h (Symbol_table::add_from_incrobj): New function.
5366 (Symbol_table::set_file_offset): New function.
5368 2011-04-05 Cary Coutant <ccoutant@google.com>
5370 * incremental-dump.cc (dump_incremental_inputs): Change signature
5371 to take a Sized_incremental_binary; change caller. Use readers
5372 in Sized_incremental_binary.
5374 (Sized_incremental_binary::find_incremental_inputs_sections):
5375 Rename do_find_incremental_inputs_sections to this.
5376 (Sized_incremental_binary::setup_readers): New function.
5377 (Sized_incremental_binary::do_check_inputs): Check
5378 has_incremental_info_ flag; move setup code to setup_readers;
5380 (Sized_incremental_binary::do_file_is_unchanged): New function.
5381 (Sized_incremental_binary::do_get_input_reader): New function.
5382 * incremental.h (class Incremental_binary): Move to end of file.
5383 (Incremental_binary::file_is_unchanged): New function.
5384 (Incremental_binary::do_file_is_unchanged): New function.
5385 (Incremental_binary::Input_reader): New class.
5386 (Incremental_binary::get_input_reader): New function.
5387 (class Sized_incremental_binary): Move to end of file.
5388 (Sized_incremental_binary::Sized_incremental_binary): Setup the
5389 input section reader classes.
5390 (Sized_incremental_binary::has_incremental_info): New function.
5391 (Sized_incremental_binary::inputs_reader): New function.
5392 (Sized_incremental_binary::symtab_reader): New function.
5393 (Sized_incremental_binary::relocs_reader): New function.
5394 (Sized_incremental_binary::got_plt_reader): New function.
5395 (Sized_incremental_binary::do_file_is_unchanged): New function.
5396 (Sized_incremental_binary::Sized_input_reader): New class.
5397 (Sized_incremental_binary::get_input_reader): New function.
5398 (Sized_incremental_binary::find_incremental_inputs_sections):
5399 Rename do_find_incremental_inputs_sections to this.
5400 (Sized_incremental_binary::setup_readers): New function.
5401 (Sized_incremental_binary::has_incremental_info_): New data member.
5402 (Sized_incremental_binary::inputs_reader_): New data member.
5403 (Sized_incremental_binary::symtab_reader_): New data member.
5404 (Sized_incremental_binary::relocs_reader_): New data member.
5405 (Sized_incremental_binary::got_plt_reader_): New data member.
5406 (Sized_incremental_binary::current_input_file_): New data member.
5408 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
5411 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5414 2011-03-30 Cary Coutant <ccoutant@google.com>
5416 * archive.cc (Archive::include_member): Adjust call to report_object.
5417 (Add_archive_symbols::run): Add script_info to call to
5418 report_archive_begin.
5419 (Lib_group::include_member): Adjust call to report_object.
5420 (Add_lib_group_symbols::run): Adjust call to report_object.
5421 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5422 blocks. Add object count for script input files.
5423 * incremental.cc (Incremental_inputs::report_archive_begin): Add
5424 script_info parameter; change all callers.
5425 (Incremental_inputs::report_object): Add script_info parameter;
5427 (Incremental_inputs::report_script): Store backpointer to
5428 incremental info entry.
5429 (Output_section_incremental_inputs::set_final_data_size): Record
5430 additional information for scripts.
5431 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5432 * incremental.h (Incremental_script_entry::add_object): New function.
5433 (Incremental_script_entry::get_object_count): New function.
5434 (Incremental_script_entry::get_object): New function.
5435 (Incremental_script_entry::objects_): New data member; adjust
5437 (Incremental_inputs::report_archive_begin): Add script_info parameter.
5438 (Incremental_inputs::report_object): Add script_info parameter.
5439 (Incremental_inputs_reader::get_object_count): New function.
5440 (Incremental_inputs_reader::get_object_offset): New function.
5441 * options.cc (Input_arguments::add_file): Return reference to
5443 * options.h (Input_argument::set_script_info): New function.
5444 (Input_argument::script_info): New function.
5445 (Input_argument::script_info_): New data member; adjust all
5447 (Input_file_group::add_file): Return reference to new input argument.
5448 (Input_file_lib::add_file): Likewise.
5449 (Input_arguments::add_file): Likewise.
5450 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5451 * script.cc (Parser_closure::Parser_closure): Add script_info
5452 parameter; adjust all callers.
5453 (Parser_closure::script_info): New function.
5454 (Parser_closure::script_info_): New data member.
5455 (read_input_script): Report scripts earlier to incremental info.
5456 (script_add_file): Set script_info in Input_argument.
5457 (script_add_library): Likewise.
5458 * script.h (Script_options::Script_info): Rewrite class.
5460 2011-03-29 Cary Coutant <ccoutant@google.com>
5462 * archive.cc (Library_base::should_include_member): Move
5463 method here from class Archive.
5464 (Archive::Archive): Initialize base class.
5465 (Archive::should_include_member): Move to base class.
5466 (Archive::do_for_all_unused_symbols): New function.
5467 (Add_archive_symbols::run): Remove redundant access to
5469 (Lib_group::Lib_group): Initialize base class.
5470 (Lib_group::do_filename): New function.
5471 (Lib_group::include_member): Pass pointer to Lib_group to
5473 (Lib_group::do_for_all_unused_symbols): New function.
5474 (Add_lib_group_symbols::run): Report archive information for
5476 * archive.h (class Library_base): New base class.
5477 (class Archive): Derive from Library_base.
5478 (Archive::filename): Move to base class.
5479 (Archive::set_incremental_info): Likewise.
5480 (Archive::incremental_info): Likewise.
5481 (Archive::Should_include): Likewise.
5482 (Archive::should_include_member): Likewise.
5483 (Archive::Armap_entry): Remove.
5484 (Archive::Unused_symbol_iterator): Remove.
5485 (Archive::unused_symbols_begin): Remove.
5486 (Archive::unused_symbols_end): Remove.
5487 (Archive::do_filename): New function.
5488 (Archive::do_get_mtime): New function.
5489 (Archive::do_for_all_unused_symbols): New function.
5490 (Archive::task_): Move to base class.
5491 (Archive::incremental_info_): Likewise.
5492 (class Lib_group): Derive from Library_base.
5493 (Lib_group::do_filename): New function.
5494 (Lib_group::do_get_mtime): New function.
5495 (Lib_group::do_for_all_unused_symbols): New function.
5496 (Lib_group::task_): Move to base class.
5497 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5499 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5501 * incremental.cc (Incremental_inputs::report_archive_begin):
5502 Use Library_base; call library's get_mtime; add incremental inputs
5503 entry before members.
5504 (class Unused_symbol_visitor): New class.
5505 (Incremental_inputs::report_archive_end): Use Library_base; use
5506 visitor class to record unused symbols; don't add incremental inputs
5507 entry after members.
5508 (Incremental_inputs::report_object): Use Library_base.
5510 (Incremental_archive_entry::Incremental_archive_entry): Remove
5511 unused Archive parameter.
5512 (Incremental_inputs::report_archive_begin): Use Library_base.
5513 (Incremental_inputs::report_archive_end): Likewise.
5514 (Incremental_inputs::report_object): Likewise.
5515 * object.cc (Sized_relobj::do_for_all_global_symbols): New
5517 * object.h (Object::for_all_global_symbols): New function.
5518 (Object::do_for_all_global_symbols): New function.
5519 (Sized_relobj::do_for_all_global_symbols): New function.
5520 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
5522 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
5525 2011-03-27 Ian Lance Taylor <iant@google.com>
5527 * archive.cc (Archive::interpret_header): Return -1 if something
5528 goes wrong. Change callers accordingly.
5530 2011-03-25 Cary Coutant <ccoutant@google.com>
5532 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5533 * testsuite/Makefile.in: Regenerate.
5535 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
5537 * plugin.cc (get_view): New.
5538 (Plugin::load): Pass get_view to the plugin.
5539 (Plugin_manager::get_view): New.
5541 2011-03-21 Ian Lance Taylor <iant@google.com>
5543 * testsuite/final_layout.sh: Rewrite to not use dc.
5544 * testsuite/relro_test.sh: Fail if dc is not present.
5546 2011-03-21 Sriraman Tallam <tmsriram@google.com>
5548 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5550 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5551 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5553 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5554 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5556 2011-03-14 Ian Lance Taylor <iant@google.com>
5558 * script-sections.cc (Sort_output_sections::script_compare):
5559 Rename from is_before, change return type.
5560 (Sort_output_sections::operator()): Adjust accordingly.
5562 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
5565 * testsuite/odr_violation2.cc: Add comment to make all error line
5566 numbers double digits.
5567 * testsuite/debug_msg.sh: Adjust expected errors.
5569 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
5571 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5572 but mark earlier ones as non-canonical
5573 (offset_to_iterator): Update search target and example
5574 (do_addr2line): Return extra lines in a vector*
5575 (format_file_lineno): Extract from do_addr2line
5576 (one_addr2line): Add vector* out-param
5577 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5578 when a lineno entry appeared last for its instruction
5579 (Dwarf_line_info): Add vector* out-param
5580 * object.cc (Relocate_info): Pass NULL for the vector* out-param
5581 * symtab.cc (Odr_violation_compare): Include the lineno in the
5583 (linenos_from_loc): New. Combine the canonical line for an
5584 address with its other lines.
5585 (True_if_intersect): New. Helper functor to make
5586 std::set_intersection a query.
5587 (detect_odr_violations): Compare sets of lines instead of just
5588 one line for each function. This became less deterministic, but
5589 has fewer false positives.
5590 * symtab.h: Declarations.
5591 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5592 mix an optimized and non-optimized object in the same binary
5593 (odr_violation2.so): Same.
5594 * testsuite/Makefile.in: Regenerate from Makefile.am.
5595 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5596 * testsuite/debug_msg.sh: Update line numbers and add
5598 * testsuite/odr_violation1.cc: Use OdrDerived, in a
5599 non-optimized context.
5600 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5601 isn't inlined, and use OdrDerived in an optimized context.
5602 * testsuite/odr_header1.h: Defines OdrDerived, where
5603 optimization will change the
5604 first-instruction-in-the-destructor's file and line number.
5605 * testsuite/odr_header2.h: Defines OdrBase.
5607 2011-03-09 Ian Lance Taylor <iant@google.com>
5609 * fileread.cc (File_read::clear_views): Don't delete the whole
5612 2011-03-08 Ian Lance Taylor <iant@google.com>
5615 * fileread.cc: #include <climits>.
5616 (GOLD_IOV_MAX): Define.
5617 (File_read::read_multiple): Limit number of entries by iov_max.
5618 * fileread.h (class File_read): Always set max_readv_entries to
5621 2011-03-07 Ian Lance Taylor <iant@google.com>
5624 * options.h (class General_options): Add -dy and -dn.
5626 2011-03-02 Cary Coutant <ccoutant@google.com>
5628 * testsuite/script_test_9.t: Add TLS segment.
5630 2011-03-02 Simon Baldwin <simonb@google.com>
5632 * configure.ac: Add check for gnu_indirect_function support in
5633 the toolchain building binutils.
5634 * configure: Rebuild.
5636 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
5638 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5639 plugin only symbols.
5640 (Symbol_table::sized_finalize_symbol) Mark symbol only present
5641 in plugin files as not needed in the symbol table.
5643 2011-02-11 Sriraman Tallam <tmsriram@google.com>
5645 * output.cc (Output_section::add_input_section): Delay fill
5646 generation for section ordering.
5648 2011-02-09 Ian Lance Taylor <iant@google.com>
5651 * object.h (class Sized_relobj): Remove clear_local_symbols.
5652 * reloc.cc (Sized_relobj::do_relocate): Don't call
5653 clear_local_symbols.
5655 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
5657 * plugin.cc (is_visible_from_outside): Return true for symbols
5660 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
5662 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5665 2011-02-02 Sriraman Tallam <tmsriram@google.com>
5667 * icf.h (is_section_foldable_candidate): Change type of parameter
5669 * icf.cc (Icf::find_identical_sections): Change type of local variable
5670 section_name to be std::string.
5671 (is_function_ctor_or_dtor): Change type of parameter to std::string.
5673 2011-01-25 Ian Lance Taylor <iant@google.com>
5675 * script.cc (script_add_extern): Rewrite to use
5676 add_symbol_reference.
5678 2011-01-25 Doug Kwan <dougkwan@google.com>
5680 * icf.cc (get_section_contents): Always lock section's object.
5682 2011-01-24 Ian Lance Taylor <iant@google.com>
5684 * options.h (class General_options): Accept
5685 --no-detect-odr-violations.
5687 2011-01-24 Ian Lance Taylor <iant@google.com>
5689 * version.cc (version_string): Bump to 1.11.
5691 2011-01-24 Ian Lance Taylor <iant@google.com>
5693 * plugin.cc (class Plugin_rescan): Define new class.
5694 (Plugin_manager::claim_file): Set any_claimed_.
5695 (Plugin_manager::save_archive): New function.
5696 (Plugin_manager::save_input_group): New function.
5697 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5699 (Plugin_manager::new_undefined_symbol): New function.
5700 (Plugin_manager::rescan): New function.
5701 (Plugin_manager::rescannable_defines): New function.
5702 (Plugin_manager::add_input_file): Set any_added_.
5703 * plugin.h (class Plugin_manager): define new fields rescannable_,
5704 undefined_symbols_, any_claimed_, and any_added_. Declare
5705 Plugin_rescan as friend. Declare new functions.
5706 (Plugin_manager::Rescannable): Define type.
5707 (Plugin_manager::Rescannable_list): Define type.
5708 (Plugin_manager::Undefined_symbol_list): Define type.
5709 (Plugin_manager::Plugin_manager): Initialize new fields.
5710 * archive.cc (Archive::defines_symbol): New function.
5711 (Add_archive_symbols::run): Pass archive to plugins if any.
5712 * archive.h (class Archive): Declare defines_symbol.
5713 * readsyms.cc (Input_group::~Input_group): New function.
5714 (Finish_group::run): Pass input_group to plugins if any.
5715 * readsyms.h (class Input_group): Declare destructor.
5716 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5719 2011-01-10 Ian Lance Taylor <iant@google.com>
5721 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5723 (Layout::set_segment_offsets): Reset increase_relro before calling
5724 set_section_addresses a second time.
5726 2011-01-04 Cary Coutant <ccoutant@google.com>
5728 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5729 sections before NOBITS sections.
5731 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
5733 * version.cc (print_version): Update copyright to 2011.
5735 2010-12-23 Cary Coutant <ccoutant@google.com>
5737 * output.h (Output_data_reloc::add_output_section): Pass OD instead
5738 of OS to this->add. Add OD parameter to second form of the function.
5740 2010-12-20 Ian Lance Taylor <iant@google.com>
5742 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5743 second of two consecutive entries with same offset.
5745 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5747 * testsuite/Makefile.am (ifuncmain2static_LDADD)
5748 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5749 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5750 to avoid unneeded links against $(LDADD).
5751 * testsuite/Makefile.in: Regenerate.
5753 2010-12-15 Ian Lance Taylor <iant@google.com>
5756 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5757 for R_X86_64_32 and R_X86_64_PC32.
5758 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5759 ver_matching_def_pic.o.
5760 (ver_matching_def_pic.o): New target.
5762 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5764 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5765 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5766 Move definition before File_read::View member definitions.
5767 (File_read::View::~View): Initialize and hold lock before
5768 updating current_mapped_bytes.
5770 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5772 * dwarf_reader.cc: Remove outdated comment.
5773 * gold-threads.cc: Fix typo in error message.
5774 * archive.cc: Fix typos in comments.
5775 * archive.h: Likewise.
5776 * arm-reloc-property.cc: Likewise.
5777 * arm-reloc-property.h: Likewise.
5778 * arm-reloc.def: Likewise.
5780 * attributes.h: Likewise.
5781 * cref.cc: Likewise.
5782 * ehframe.cc: Likewise.
5783 * fileread.h: Likewise.
5785 * i386.cc: Likewise.
5787 * incremental.h: Likewise.
5788 * int_encoding.cc: Likewise.
5789 * layout.h: Likewise.
5790 * main.cc: Likewise.
5791 * merge.h: Likewise.
5792 * object.cc: Likewise.
5793 * object.h: Likewise.
5794 * options.cc: Likewise.
5795 * readsyms.cc: Likewise.
5796 * reduced_debug_output.cc: Likewise.
5797 * reloc.cc: Likewise.
5798 * script-sections.cc: Likewise.
5799 * sparc.cc: Likewise.
5800 * symtab.h: Likewise.
5801 * target-reloc.h: Likewise.
5802 * target.cc: Likewise.
5803 * target.h: Likewise.
5804 * timer.cc: Likewise.
5805 * timer.h: Likewise.
5806 * x86_64.cc: Likewise.
5808 2010-12-09 Cary Coutant <ccoutant@google.com>
5810 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5812 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5813 parameter; change all callers.
5814 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5815 * options.h (warn_execstack): New option.
5817 2010-12-07 Doug Kwan <dougkwan@google.com>
5819 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5820 like function call relocations.
5822 2010-12-07 Ian Lance Taylor <iant@google.com>
5824 * archive.cc (Archive::get_elf_object_for_member): Permit
5825 punconfigured to be NULL.
5826 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5827 (Archive::include_member): Pass NULL to get_elf_object_for_member
5828 if we searched for the archive and this is the first included
5831 2010-12-01 Ian Lance Taylor <iant@google.com>
5833 * dwarf_reader.h (class Sized_dwarf_line_info): Add
5834 track_relocs_type_ field.
5835 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5836 Set track_relocs_type_.
5837 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5838 contents when using RELA relocs.
5839 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5841 * reloc.cc (Track_relocs::next_addend): New function.
5842 * reloc.h (class Track_relocs): Declare next_addend.
5844 2010-12-01 Ian Lance Taylor <iant@google.com>
5846 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5849 2010-12-01 Ian Lance Taylor <iant@google.com>
5851 * README: Update compilers known to work and fail.
5853 2010-11-23 Matthias Klose <doko@ubuntu.com>
5855 * configure.in: For --enable-gold, handle value `default' instead of
5856 `both*'. Always install ld as ld.bfd, install as ld if gold is
5858 * configure: Regenerate.
5860 2010-11-18 Doug Kwan <dougkwan@google.com>
5862 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5863 and right_alignment to be zero. Store result alignment only if it is
5864 greater than existing alignment.
5866 2010-11-16 Cary Coutant <ccoutant@google.com>
5869 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5870 Check for ".zdebug_line".
5872 2010-11-16 Doug Kwan <dougkwan@google.com>
5873 Cary Coutant <ccoutant@google.com>
5875 * output.h (Output_segment::set_section_addresses): Pass increase_relro
5876 by reference; adjust all callers.
5877 * output.cc (Output_segment::set_section_addresses): Adjust references
5878 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5880 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5881 end at page boundary.
5883 2010-11-16 Cary Coutant <ccoutant@google.com>
5886 * layout.cc (Layout::choose_output_section): Transform names of
5887 compressed sections even when using a script with a SECTIONS clause.
5888 (Layout::output_section_name): Remove code to transform
5889 compressed debug section names.
5890 * output.cc (Output_section::add_input_section): Use uncompressed
5891 section size when tracking input sections.
5893 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
5895 * symtab.h (Symbol::NON_PIC_REF): Remove.
5896 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5897 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
5898 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5899 (Symbol::use_plt_offset): Take a flags argument and pass it
5900 directly to needs_dynamic_reloc. Restrict check for undefined
5901 weak symbols to function calls.
5902 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5903 (Target_arm::Scan::global): Use it.
5904 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5905 (Target_arm::Relocate::relocate): Likewise.
5906 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5907 parameter with an r_type parameter. Use get_reference_flags
5909 (Target_arm::Relocate::relocate): Update accordingly.
5910 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5911 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5912 (Target_i386::Scan::global): Likewise.
5913 (Target_i386::Relocate::relocate): Likewise.
5914 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5915 parameter with an r_type parameter. Use get_reference_flags
5917 (Target_i386::Relocate::relocate): Update accordingly.
5918 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5919 (Target_powerpc::Scan::global): Use it.
5920 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5921 (Target_powerpc::Relocate::relocate): Likewise.
5922 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5923 (Target_sparc::Scan::global): Use it.
5924 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5925 (Target_sparc::Relocate::relocate): Likewise.
5926 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5927 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5928 (Target_x86_64::Scan::global): Likewise.
5929 (Target_x86_64::Relocate::relocate): Likewise.
5931 2010-11-08 Doug Kwan <dougkwan@google.com>
5932 Cary Coutant <ccoutant@google.com>
5934 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5935 (Arm_exidx_merge_section::section_contents_): New data member.
5936 (Arm_input_section::Arm_input_section): Initialize original_contents_.
5937 (Arm_input_section::~Arm_input_section): De-allocate memory.
5938 (Arm_input_section::original_contents_): New data member.
5939 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5940 in parameters instead of calling Object::section_contents without
5942 (Arm_output_section::group_section): New parameter TASK. Pass it
5943 to callees that need locking objects.
5944 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
5945 to lock EXIDX input sections. Fix a formatting issue. Call
5946 Arm_exidx_merged_section::build_contents to create merged section
5948 (Arm_output_section::create_stub_group): New parameter TASK. Use it
5949 to lock object of stub table owner.
5950 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5951 TEXT_SIZE to initialize data member TEXT_SIZE_.
5952 (Arm_exidx_input_section::addralign): Fix typo in comment.
5953 (Arm_exidx_input_section::text_size): New method.
5954 (Target_arm::do_relax): New parameter TASK. Pass it to callees
5955 that require locking objects. Lock objects before scanning for stubs
5956 and updating local symbols.
5957 (Arm_input_section<big_endian>::init): Copy contents of original
5959 (Arm_input_section<big_endian>::do_write): Use saved contents of
5960 original input section instead of calling Object::section_contents
5962 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5963 size without calling Object::section_size().
5964 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5965 for size. Allocate a buffer for merged EXIDX entries.
5966 (Arm_exidx_merged_section::build_contents): New method.
5967 (Arm_exidx_merged_section::do_write): Move merge section contents
5968 building code to Arm_exidx_merged_section::build_contetns. Write
5969 out contetns in buffer instead of building it on the fly.
5970 (Arm_relobj::make_exidx_input_section): Also pass text section size
5971 to Arm_exidx_input_section constructor.
5972 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
5973 (Arm_dynobj::do_read_symbols): Fix memory leak.
5974 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5975 * target.h: (class Task): Add forward declaration.
5976 (Target::relax): Add new parameter TASK and pass it to
5978 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
5980 2010-11-05 Cary Coutant <ccoutant@google.com>
5983 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5984 object when reading from the file.
5985 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5987 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5988 when reading section contents.
5989 (get_section_contents): Likewise.
5990 (icf::find_identical_sections): Likewise.
5991 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5992 object when reading from the file.
5993 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5994 the object when doing deferred section layout.
5996 2010-11-03 Nick Clifton <nickc@redhat.com>
5999 * script.h (class Symbol_assignment: name): New member. Returns
6000 the name of the symbol.
6001 * scrfipt.cc (Script_options::is_pending_assignment): New member.
6002 Returns true if the given symbol name is on the list of
6003 assignments wating to be processed.
6004 * archive.cc (should_incldue_member): If the symbol is undefined,
6005 check to see if it is on the list of symbols pending assignment.
6007 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
6009 * script-sections.cc (Script_sections::find_memory_region): Check
6010 for a NULL output section pointer.
6012 2010-10-29 Doug Kwan <dougkwan@google.com>
6014 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6015 Output_section::add_relaxed_input_section.
6016 * output.cc (Output_section::add_relaxed_input_section): Add new
6017 arguments LAYOUT and NAME. Set section order index.
6018 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6019 Copy section order index.
6020 * output.h (Output_section::add_relaxed_input_section): Add new
6021 arguments LAYOUT and NAME.
6023 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6025 * testsuite/Makefile.am: Move gcctestdir/ld rule to
6026 NATIVE_OR_CROSS_LINKER.
6027 * testsuite/Makefile.in: Regenerate.
6029 2010-10-20 Doug Kwan <dougkwan@google.com>
6031 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6032 without SHF_LINK_ORDER flags.
6033 * layout.cc (Layout::choose_output_section): Do not filter
6034 SHF_LINK_ORDER flag in a relocatable link.
6036 2010-10-17 Cary Coutant <ccoutant@google.com>
6038 * output.h (Output_segment::set_section_addresses): Change function
6039 signature. Update all callers.
6040 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6042 (Output_segment::set_section_addresses): Align after last TLS
6043 section. Add padding before last relro section instead of after.
6045 2010-10-17 Doug Kwan <dougkwan@google.com>
6047 * gold/arm.cc (Target_arm::got_section): Use correct order and set
6048 GOT output section to be writable.
6050 2010-10-14 Cary Coutant <ccoutant@google.com>
6052 * debug.h (DEBUG_INCREMENTAL): New flag.
6053 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6054 * gold.cc (queue_initial_tasks): Check parameters for incremental link
6056 * incremental.cc (report_command_line): Ignore all forms of
6058 * layout.cc (Layout::Layout): Check parameters for incremental link
6060 * options.cc (General_options::parse_incremental): New function.
6061 (General_options::parse_no_incremental): New function.
6062 (General_options::parse_incremental_full): New function.
6063 (General_options::parse_incremental_update): New function.
6064 (General_options::incremental_mode_): New data member.
6065 (General_options::finalize): Check incremental_mode_.
6066 * options.h (General_options): Update help text for --incremental.
6067 Add --no-incremental, --incremental-full, --incremental-update.
6068 (General_options::Incremental_mode): New enum type.
6069 (General_options::incremental_mode): New function.
6070 (General_options::incremental_mode_): New data member.
6071 * parameters.cc (Parameters::incremental_mode_): New data member.
6072 (Parameters::set_options): Set incremental_mode_.
6073 (Parameters::set_incremental_full): New function.
6074 (Parameters::incremental): New function.
6075 (Parameters::incremental_update): New function.
6076 (set_parameters_incremental_full): New function.
6077 * parameters.h (Parameters::set_incremental_full): New function.
6078 (Parameters::incremental): New function.
6079 (Parameters::incremental_update): New function.
6080 (Parameters::incremental_mode_): New data member.
6081 (set_parameters_incremental_full): New function.
6082 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6083 incremental link mode.
6084 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6085 (Sized_relobj::do_relocate_sections): Likewise.
6086 * testsuite/Makefile.am (incremental_test): Use --incremental-full
6088 * testsuite/Makefile.in: Regenerate.
6089 * testsuite/incremental_test.sh: Filter all forms of --incremental.
6091 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6093 * script-sections.h (class Script_sections): Make
6094 Sections_elements typedef public.
6095 * script-sections.cc (class Sort_output_sections): Add elements_
6096 field. Add constructor which sets it; change all callers.
6097 (Sort_output_sections::is_before): New function.
6098 (Sort_output_sections::operator()): Call is_before.
6099 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6101 * testsuite/script_test_10.sh: New test. Test script section
6103 * testsuite/script_test_10.t: Likewise.
6104 * testsuite/script_test_10.s: Likewise.
6105 * testsuite/Makefile.am: Wrap the cross linker tests and the
6106 common tests into NATIVE_OR_CROSS_LINKER.
6107 (check_SCRIPTS): Add script_test_10.sh.
6108 (check_DATA): Add script_test_10.stdout.
6109 (script_test_10.o, script_test_10): New targets.
6110 (script_test_10.stdout): New target.
6111 * configure, testsuite/Makefile.in: Regenerate.
6113 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6115 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6116 error for the deprecated relocations.
6117 (Target_arm::Scan::global): Likewise.
6118 (Target_arm::Relocate::relocate): Likewise.
6120 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
6122 * fileread.cc (Input_file::find_file): Initialize *found_name
6123 and *namep when using the fallback search for case 4.
6125 2010-10-11 Cary Coutant <ccoutant@google.com>
6127 * options.h (class General_options): Redefine -z lazy as an alias for
6128 the negation of -z now.
6130 2010-10-11 Ian Lance Taylor <iant@google.com>
6132 * resolve.cc (symbol_to_bits): Report the value of the unsupported
6135 2010-10-06 Nick Clifton <nickc@redhat.com>
6137 * script-sections.cc(class Memory_region): Remove
6138 current_lma_offset_ field. Rename current_vma_offset_ to
6139 current_offset_. Add last_section_ field.
6140 (Memory_region::get_current_vma_address): Rename to
6141 get_current_address.
6142 (Memory_region::get_current_lma_address): Delete.
6143 (Memory_region::increment_vma_offset): Rename to
6145 (Memory_region::increment_lma_offset): Delete.
6146 (Memory_region::attributes_compatible): New method. Returns
6147 true if the provided section is compatible with the region.
6148 (Memory_region::get_last_section): New method. Returns the last
6149 section to use the region.
6150 (Memory_region::set_last_section): New method. Stores the last
6151 section to use the region.
6152 (Script_sections::block_in_region): New method. Returns true if
6153 a block of memory is contained within a region.
6154 (Script_sections::find_memory_region): New method. Locates a
6155 memory region to be used to set a VMA or LMA address.
6156 (Output_section_definition::set_section_addresses): Add code to
6157 check for addresses set by memory regions.
6158 (Output_segment::set_section_addresses): Remove memory region
6160 (Script_sections::create_segment): Add a warning if a header
6161 segment is created outside of any region.
6162 * script-sections.h (class Script_sections): Add prototypes for
6163 find_memory_region and block_in_region methods.
6164 * testsuite/memory_test.s: Use .long instead of .word.
6165 * testsuite/memory_test.t: Add some more output sections.
6166 * testsuite/memory_test.sh: Update expected output.
6168 2010-10-02 Doug Kwan <dougkwan@google.com>
6170 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6171 defintion to symtab.h
6172 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6173 declaration to defintion.
6175 2010-10-01 Nick Clifton <nickc@redhat.com>
6177 * expression.cc (eval): Replace dummy argument with NULL.
6178 (eval_maybe_dot): Check for a NULL result section pointer.
6179 (Symbol_expression::value): Likewise.
6180 (Dot_expression::value): Likewise.
6181 (BINARY_EXPRESSION): Likewise.
6182 (Max_expression::value): Likewise.
6183 (Min_expression::value): Likewise.
6184 (Absolute_expression::value): Likewise.
6185 (Addr_expression::value_from_output_section): Likewise.
6186 (Loaddddr_expression::value_from_output_section): Likewise.
6187 (Segment_start_expression::value): Likewise.
6188 * script-sections.cc
6189 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6191 (Sections_elememt_dot_assignment::set_section_addresses):
6193 (Output_data_expression::do_write_to_buffer): Likewise.
6194 (Output_section_definition::finalize_symbols): Likewise.
6195 (Output_section_definition::set_section_addresses): Likewise.
6197 2010-09-30 Doug Kwan <dougkwan@google.com>
6199 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6201 2010-09-28 Sriraman Tallam <tmsriram@google.com>
6203 * target.h (Target::can_icf_inline_merge_sections): New virtual
6205 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6207 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6209 * icf.cc (get_section_contents): Inline merge sections only when
6212 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6214 * configure: Regenerate.
6216 2010-09-17 Ian Lance Taylor <iant@google.com>
6218 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6219 * testsuite/Makefile.am (memory_test.o): New target.
6220 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6222 * testsuite/Makefile.in: Rebuild.
6224 2010-09-17 Doug Kwan <dougkwan@google.com>
6226 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6227 defintion if relocation uses GOT entries of the symbol.
6228 * testsuite/icf_safe_test.sh: Fix test.
6229 * testsuite/icf_safe_so_test.sh: Fix test.
6231 2010-09-16 Cary Coutant <ccoutant@google.com>
6233 * script_sections.cc (class Memory_region): Remove "NULL" from
6234 vector initializations.
6236 2010-09-15 Cary Coutant <ccoutant@google.com>
6238 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6239 Resolve forwarding symbols.
6241 2010-09-15 Doug Kwan <dougkwan@google.com>
6243 * gold/testsuite/script_test_3.t: Add ARM special sections.
6244 * gold/testsuite/script_test_4.t: Same.
6245 * gold/testsuite/script_test_5.t: Same.
6246 * gold/testsuite/script_test_6.t: Same.
6247 * gold/testsuite/script_test_7.t: Same.
6248 * gold/testsuite/script_test_7.t: Same.
6249 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6251 2010-09-14 Cary Coutant <ccoutant@google.com>
6253 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6254 (Target_x86_64::Relocate::relocate_tls): Replace check for
6255 saw_tls_block_reloc_ with test for executable section.
6257 2010-09-12 Cary Coutant <ccoutant@google.com>
6259 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6260 position-independent executables to shared libraries need dynamic
6262 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6263 position-independent executables.
6264 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6265 * testsuite/Makefile.in: Regenerate.
6267 2010-09-10 Nick Clifton <nickc@redhat.com>
6270 * testsuite/memory_test.t: Discard any sections that are not
6273 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
6276 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6277 "This::" to work around a bug in gcc 4.2.
6279 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6281 2010-09-09 Rafael Espindola <espindola@google.com>
6283 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6284 sections with different PF_X flags in the same segment.
6285 (Layout::find_first_load_seg): Search all segments to find the first
6287 * options.h (rosegment): New.
6289 2010-09-08 Rafael Espindola <espindola@google.com>
6291 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6293 2010-09-08 Doug Kwan <dougkwan@google.com>
6295 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6296 (Arm_relobj::do_relocate_sections): Add new parameter for output
6297 file to match the parent.
6298 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6299 of local symbols instead of input values. Update code to track
6300 changes in gold::relocate_section.
6301 * object.cc (Sized_relobj::compute_final_local_value): New methods.
6302 (Sized_relobj::compute_final_local_value_internal): New methods.
6303 (Sized_relobj::do_finalize_local_symbols): Move code from loop
6304 body into private version of Sized_relobj::compute_final_local_value.
6305 Call the inline method.
6306 * object.h (Symbol_value::Symbol_value): Define destructor. Free
6307 merged symbol value if there is one.
6308 (Symbol_value::has_output_value): New method defintiion.
6309 (Sized_relobj::Compute_final_local_value_status): New enum type.
6310 (Sized_relobj::compute_final_local_value): New methods.
6311 (Sized_relobj::compute_final_local_value_internal): New methods.
6312 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6313 and arm_cortex_a8.sh.
6314 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6315 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6317 * Makefile.in: Regenerate.
6318 * testsuite/arm_bl_out_of_range.s: Update test.
6319 * testsuite/thumb_bl_out_of_range.s: Ditto.
6320 * testsuite/thumb_blx_out_of_range.s: Ditto.
6321 * testsuite/arm_branch_out_of_range.sh: New file.
6322 * testsuite/arm_cortex_a8.sh: Ditto.
6323 * testsuite/arm_cortex_a8_b.s: Ditto.
6324 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6325 * testsuite/arm_cortex_a8_b_local.s: Ditto.
6326 * testsuite/arm_cortex_a8_bl.s: Ditto.
6327 * testsuite/arm_cortex_a8_blx.s: Ditto.
6328 * testsuite/arm_cortex_a8_local.s: Ditto.
6329 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6330 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6332 2010-09-08 Rafael Espindola <espindola@google.com>
6334 * Makefile.am (memory_test.stdout): Run readelf with -W.
6335 * Makefile.in: Regenerate.
6336 * testsuite/memory_test.sh: Make the regexps accept both 32 and
6339 2010-09-08 Rafael Espindola <espindola@google.com>
6341 * script-sections.cc (Script_sections::add_memory_region): Convert
6342 field precision to int.
6343 * script.cc (script_set_section_region, script_set_section_region):
6344 Convert field precision to int.
6346 2010-09-08 Rafael Espindola <espindola@google.com>
6348 * arm.cc (do_finalize_sections): Create the __exidx_start and
6349 __exdix_end symbols even when the section is missing.
6351 2010-09-08 Nick Clifton <nickc@redhat.com>
6353 * README: Remove claim that MEMORY is not supported.
6354 * expression.cc (script_exp_function_origin)
6355 (script_exp_function_length): Move from here to ...
6356 * script.cc: ... here.
6357 (script_set_section_region, script_add_memory)
6358 (script_parse_memory_attr, script_include_directive): New
6360 * script-sections.cc
6361 (class Memory_region): New class.
6362 (class Output_section_definition): Add set_memory_region,
6363 set_section_vma, set_section_lma and get_section_name methods.
6364 (class Script_Sections): Add add_memory_region,
6365 find_memory_region, find_memory_region_origin,
6366 find_memory_region_length and set_memory_region methods.
6367 Have set_section_addresses method walk the list of set memory
6369 Extend the print methos to display memory regions.
6370 * script-sections.h: Add prototypes for new methods.
6371 Add enum for MEMORY region attributes.
6372 * yyscript.y: Add support for parsing MEMORY regions.
6373 * script-c.h: Add prototypes for new functions.
6374 * testsuite/Makefile.am: Add test of MEMORY region functionality.
6375 * testsuite/Makefile.in: Regenerate.
6376 * testsuite/memory_test.sh: New script.
6377 * testsuite/memory_test.s: New assembler source file.
6378 * testsuite/memory_test.t: New linker script.
6380 2010-08-27 Doug Kwan <dougkwan@google.com>
6382 * gold/resolve.cc (Symbol_table::should_override): Let a weak
6383 reference override an existing dynamic weak reference.
6384 * testsuite/Makefile.am: Add new test dyn_weak_ref.
6385 * testsuite/Makefile.in: Regenerate.
6386 * testsuite/dyn_weak_ref.sh: New file.
6387 * testsuite/dyn_weak_ref_1.c: Ditto.
6388 * testsuite/dyn_weak_ref_2.c: Ditto.
6390 2010-08-27 Ian Lance Taylor <iant@google.com>
6392 * incremental.h (class Incremental_input_entry): Add virtual
6395 2010-08-27 Ian Lance Taylor <iant@google.com>
6397 * testsuite/start_lib_test_3.c: Mark t3 as used.
6399 2010-08-27 Nick Clifton <nickc@redhat.com>
6401 * options.cc (version_script): Fix small typo in previous
6404 2010-08-25 Nick Clifton <nickc@redhat.com>
6406 * archive.cc: Formatting fixes: Remove whitespace between
6407 typename and following asterisk. Remove whitespace between
6408 function name and opening parenthesis.
6409 * archive.h: Likewise.
6411 * attributes.cc: Likewise.
6412 * attributes.h: Likewise.
6413 * common.cc: Likewise.
6414 * copy-relocs.cc: Likewise.
6415 * dirsearch.h: Likewise.
6416 * dynobj.cc: Likewise.
6417 * ehframe.cc: Likewise.
6418 * ehframe.h: Likewise.
6419 * expression.cc: Likewise.
6420 * fileread.cc: Likewise.
6421 * fileread.h: Likewise.
6423 * gold-threads.cc: Likewise.
6424 * gold.cc: Likewise.
6425 * i386.cc: Likewise.
6427 * incremental-dump.cc: Likewise.
6428 * incremental.cc: Likewise.
6429 * layout.cc: Likewise.
6430 * layout.h: Likewise.
6431 * main.cc: Likewise.
6432 * merge.cc: Likewise.
6433 * merge.h: Likewise.
6434 * object.cc: Likewise.
6435 * object.h: Likewise.
6436 * options.cc: Likewise.
6437 * options.h: Likewise.
6438 * output.cc: Likewise.
6439 * output.h: Likewise.
6440 * plugin.cc: Likewise.
6441 * plugin.h: Likewise.
6442 * powerpc.cc: Likewise.
6443 * reloc.cc: Likewise.
6444 * script-c.h: Likewise.
6445 * script-sections.cc: Likewise.
6446 * script.cc: Likewise.
6447 * stringpool.cc: Likewise.
6448 * symtab.cc: Likewise.
6449 * symtab.h: Likewise.
6450 * target.cc: Likewise.
6451 * timer.cc: Likewise.
6452 * timer.h: Likewise.
6453 * version.cc: Likewise.
6454 * x86_64.cc: Likewise.
6456 2010-08-24 Nick Clifton <nickc@redhat.com>
6459 * layout.cc (segment_precedes): Sort segments by their physical
6460 addresses, if they have been set.
6462 2010-08-23 Cary Coutant <ccoutant@google.com>
6464 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6466 (Lib_group::include_member): Unlock object after deleting its
6468 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6471 2010-08-19 Neil Vachharajani <nvachhar@google.com>
6472 Cary Coutant <ccoutant@google.com>
6474 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6475 constructor, and set_blocker.
6476 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6478 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6479 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6480 * testsuite/Makefile.am (start_lib_test): New test case.
6481 * testsuite/Makefile.in: Regenerate.
6482 * testsuite/start_lib_test_main.c: New file.
6483 * testsuite/start_lib_test_1.c: New file.
6484 * testsuite/start_lib_test_2.c: New file.
6485 * testsuite/start_lib_test_3.c: New file.
6487 2010-08-19 Ian Lance Taylor <iant@google.com>
6489 * Makefile.in: Rebuild with automake 1.11.1.
6490 * aclocal.m4: Likewise.
6491 * testsuite/Makefile.in: Likewise.
6493 2010-08-19 Ian Lance Taylor <iant@google.com>
6496 * i386.cc (class Output_data_plt_i386): Update declarations.
6497 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
6498 local_ifuncs_ fields.
6499 (Target_i386::do_plt_section_for_global): New function.
6500 (Target_i386::do_plt_section_for_local): New function.
6501 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6502 parameter; change all callers. Initialize global_ifuncs_ and
6503 local_ifuncs_. If doing a static link define __rel_iplt_start and
6505 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6506 (Output_data_plt_i386::add_local_ifunc_entry): New function.
6507 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6509 (Target_i386::make_plt_section): New function, broken out of
6510 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
6511 (Target_i386::make_plt_entry): Call make_plt_section.
6512 (Target_i386::make_local_ifunc_plt_entry): New function.
6513 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6514 (Target_i386::Scan::local): Handle IFUNC symbols. Add
6515 R_386_IRELATIVE to switch.
6516 (Target_i386::Scan::global): Likewise.
6517 (Target_i386::Relocate::relocate): Likewise.
6518 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6520 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6521 (Target_x86_64::do_plt_section_for_global): New function.
6522 (Target_x86_64::do_plt_section_for_local): New function.
6523 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6524 parameter; change all callers. If doing a static link define
6525 __rela_iplt_start and __rela_iplt_end.
6526 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6527 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6528 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6530 (Target_x86_64::make_local_ifunc_plt_entry): New function.
6531 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6533 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6534 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
6535 R_X86_64_IRELATIVE to switch.
6536 (Target_x86_64::Scan::global): Likewise.
6537 (Target_x86_64::Relocate::relocate): Likewise.
6538 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6540 * target.h (class Target): Add plt_section_for_global and
6541 plt_section_for_local functions. Add do_plt_section_for_global
6542 and do_plt_section_for_local virtual functions.
6543 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
6544 clarifying comments.
6545 (Symbol::use_plt_offset): Handle IFUNC symbol.
6546 * object.cc (Sized_relobj::Sized_relobj): Initialize
6548 (Sized_relobj::local_has_plt_offset): New function.
6549 (Sized_relobj::local_plt_offset): New function.
6550 (Sized_relobj::set_local_plt_offset): New function.
6551 (Sized_relobj::do_count): Handle IFUNC symbol.
6552 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
6553 a bit away from input_shndx_ field. Add set_is_func_symbol and
6554 is_ifunc_symbol functions.
6555 (class Sized_relobj): Update declarations. Remove Tls_got_entry
6556 and Local_tls_got_offsets. Define Local_plt_offsets. Add
6557 local_plt_offsets_ field.
6558 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6559 * output.h (class Output_section_data): Add non-const
6560 output_section function.
6561 (class Output_data_got): Update declarations.
6562 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6563 Add use_plt_offset parameter to global and local constructors.
6564 Change all callers. Change local_sym_index_ field to 31 bits.
6565 Change GSYM_CODE and CONSTANT_CODE accordingly.
6566 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6567 doing a static link don't set sh_link field.
6568 (Output_data_got::Got_entry::write): Use PLT offset if
6570 (Output_data_got::add_global_plt): New function.
6571 (Output_data_got::add_local_plt): New function.
6572 * target-reloc.h (relocate_section): Handle IFUNC symbol.
6573 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6574 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6575 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6576 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6578 * testsuite/ifunc-sel.h: New file.
6579 * testsuite/ifuncmain1.c: New file.
6580 * testsuite/ifuncmain1vis.c: New file.
6581 * testsuite/ifuncmod1.c: New file.
6582 * testsuite/ifuncdep2.c: New file.
6583 * testsuite/ifuncmain2.c: New file.
6584 * testsuite/ifuncmain3.c: New file.
6585 * testsuite/ifuncmod3.c: New file.
6586 * testsuite/ifuncmain4.c: New file.
6587 * testsuite/ifuncmain5.c: New file.
6588 * testsuite/ifuncmod5.c: New file.
6589 * testsuite/ifuncmain6pie.c: New file.
6590 * testsuite/ifuncmod6.c: New file.
6591 * testsuite/ifuncmain7.c: New file.
6592 * configure, testsuite/Makefile.in: Rebuild.
6594 2010-08-18 Ian Lance Taylor <iant@google.com>
6597 (Output_section_incremental_inputs::write_input_files): Add cast
6598 to avoid signed/unsigned comparison warning.
6599 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6601 2010-08-12 Cary Coutant <ccoutant@google.com>
6603 * common.cc (Sort_commons::operator()): Remove unnecessary code.
6605 2010-08-13 Ian Lance Taylor <iant@google.com>
6607 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6609 2010-08-12 Cary Coutant <ccoutant@google.com>
6610 Doug Kwan <dougkwan@google.com>
6612 * resolve.cc (Symbol_table::should_override): When a weak dynamic
6613 defintion overrides non-weak undef, remember that the original undef
6615 * symtab.cc (Symbol_table::sized_write_global): For undef without
6616 an original weak binding, set binding to global in output.
6617 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6618 * testsuite/Makefile.in: Regenerate.
6619 * testsuite/strong_ref_weak_def.sh: New file.
6620 * testsuite/strong_ref_weak_def_1.c: Ditto.
6621 * testsuite/strong_ref_weak_def_2.c: Ditto.
6623 2010-08-12 Cary Coutant <ccoutant@google.com>
6625 * testsuite/incremental_test.sh: Rewrite.
6626 * testsuite/incremental_test_1.c: Rewrite.
6627 * testsuite/incremental_test_2.c: Rewrite.
6629 2010-08-12 Cary Coutant <ccoutant@google.com>
6631 * arm.cc (Target_arm::got_size): Add const.
6632 (Target_arm::got_entry_count): New function.
6633 (Target_arm::plt_entry_count): New function.
6634 (Target_arm::first_plt_entry_offset): New function.
6635 (Target_arm::plt_entry_size): New function.
6636 (Output_data_plt_arm::entry_count): New function.
6637 (Output_data_plt_arm::first_plt_entry_offset): New function.
6638 (Output_data_plt_arm::get_plt_entry_size): New function.
6639 * i386.cc (Target_i386::got_size): Add const.
6640 (Target_i386::got_entry_count): New function.
6641 (Target_i386::plt_entry_count): New function.
6642 (Target_i386::first_plt_entry_offset): New function.
6643 (Target_i386::plt_entry_size): New function.
6644 (Output_data_plt_i386::entry_count): New function.
6645 (Output_data_plt_i386::first_plt_entry_offset): New function.
6646 (Output_data_plt_i386::get_plt_entry_size): New function.
6647 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6648 find_incremental_inputs_sections. Dump incremental_got_plt section.
6649 * incremental.cc: Include target.h.
6650 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6651 parameter. Adjust all callers. Find incremental_got_plt section.
6652 (Incremental_inputs::create_data_sections): Create incremental_got_plt
6654 (Output_section_incremental_inputs::set_final_data_size): Calculate
6655 size of incremental_got_plt section.
6656 (Output_section_incremental_inputs::do_write): Write the
6657 incremental_got_plt section.
6658 (Got_plt_view_info): New struct.
6659 (Local_got_offset_visitor): New class.
6660 (Global_got_offset_visitor): New class.
6661 (Global_symbol_visitor_got_plt): New class.
6662 (Output_section_incremental_inputs::write_got_plt): New function.
6663 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6664 Add parameter. Adjust all callers.
6665 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6666 (Incremental_inputs::got_plt_section): New function.
6667 (Incremental_inputs::got_plt_section_): New data member.
6668 (Incremental_got_plt_reader): New class.
6669 * layout.cc (Layout::create_incremental_info_sections): Add the
6670 incremental_got_plt section.
6671 * object.h (Got_offset_list::get_list): New function.
6672 (Got offset_list::for_all_got_offsets): New function.
6673 (Sized_relobj::local_got_offset_list): New function.
6674 * powerpc.cc (Target_powerpc::got_size): Add const.
6675 (Target_powerpc::got_entry_count): New function.
6676 (Target_powerpc::plt_entry_count): New function.
6677 (Target_powerpc::first_plt_entry_offset): New function.
6678 (Target_powerpc::plt_entry_size): New function.
6679 (Output_data_plt_powerpc::entry_count): New function.
6680 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6681 (Output_data_plt_powerpc::get_plt_entry_size): New function.
6682 * sparc.cc (Target_sparc::got_size): Add const.
6683 (Target_sparc::got_entry_count): New function.
6684 (Target_sparc::plt_entry_count): New function.
6685 (Target_sparc::first_plt_entry_offset): New function.
6686 (Target_sparc::plt_entry_size): New function.
6687 (Output_data_plt_sparc::entry_count): New function.
6688 (Output_data_plt_sparc::first_plt_entry_offset): New function.
6689 (Output_data_plt_sparc::get_plt_entry_size): New function.
6690 * symtab.h (Symbol::got_offset_list): New function.
6691 (Symbol_table::for_all_symbols): New function.
6692 * target.h (Sized_target::got_entry_count): New function.
6693 (Sized_target::plt_entry_count): New function.
6694 (Sized_target::plt_entry_size): New function.
6695 * x86_64.cc (Target_x86_64::got_size): Add const.
6696 (Target_x86_64::got_entry_count): New function.
6697 (Target_x86_64::plt_entry_count): New function.
6698 (Target_x86_64::first_plt_entry_offset): New function.
6699 (Target_x86_64::plt_entry_size): New function.
6700 (Output_data_plt_x86_64::entry_count): New function.
6701 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6702 (Output_data_plt_x86_64::get_plt_entry_size): New function.
6704 2010-08-12 Cary Coutant <ccoutant@google.com>
6706 * archive.cc: Include incremental.h.
6707 (Archive::Archive): Initialize incremental_info_.
6708 (Archive::include_member): Record archive members in incremental info.
6709 (Add_archive_symbols::run): Record begin and end of an archive in
6711 (Lib_group::include_member): Record objects in incremental info.
6712 * archive.h (Incremental_archive_entry): Forward declaration.
6713 (Archive::set_incremental_info): New member function.
6714 (Archive::incremental_info): New member function.
6715 (Archive::Unused_symbol_iterator): New class.
6716 (Archive::unused_symbols_begin): New member function.
6717 (Archive::unused_symbols_end): New member function.
6718 (Archive::incremental_info_): New data member.
6719 * incremental-dump.cc (find_input_containing_global): New function.
6720 (dump_incremental_inputs): Dump new incremental info sections.
6721 * incremental.cc: Include symtab.h.
6722 (Output_section_incremental_inputs): New class.
6723 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6724 new incremental info sections.
6725 (Sized_incremental_binary::do_check_inputs): Likewise.
6726 (Incremental_inputs::report_archive): Remove.
6727 (Incremental_inputs::report_archive_begin): New function.
6728 (Incremental_inputs::report_archive_end): New function.
6729 (Incremental_inputs::report_object): New function.
6730 (Incremental_inputs::finalize_inputs): Remove.
6731 (Incremental_inputs::report_input_section): New function.
6732 (Incremental_inputs::report_script): Rewrite.
6733 (Incremental_inputs::finalize): Do nothing but finalize string table.
6734 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6735 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6736 (Incremental_inputs::create_data_sections): New function.
6737 (Incremental_inputs::relocs_entsize): New function.
6738 (Output_section_incremental_inputs::set_final_data_size): New function.
6739 (Output_section_incremental_inputs::do_write): New function.
6740 (Output_section_incremental_inputs::write_header): New function.
6741 (Output_section_incremental_inputs::write_input_files): New function.
6742 (Output_section_incremental_inputs::write_info_blocks): New function.
6743 (Output_section_incremental_inputs::write_symtab): New function.
6744 * incremental.h (Incremental_script_entry): Forward declaration.
6745 (Incremental_object_entry): Forward declaration.
6746 (Incremental_archive_entry): Forward declaration.
6747 (Incremental_inputs): Forward declaration.
6748 (Incremental_inputs_header_data): Remove.
6749 (Incremental_inputs_header): Remove.
6750 (Incremental_inputs_header_write): Remove.
6751 (Incremental_inputs_entry_data): Remove.
6752 (Incremental_inputs_entry): Remove.
6753 (Incremental_inputs_entry_write): Remove.
6754 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6755 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6756 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6757 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6759 (Incremental_input_entry): New class.
6760 (Incremental_script_entry): New class.
6761 (Incremental_object_entry): New class.
6762 (Incremental_archive_entry): New class.
6763 (Incremental_inputs::Incremental_inputs): Initialize new data members.
6764 (Incremental_inputs::report_inputs): Remove.
6765 (Incremental_inputs::report_archive): Remove.
6766 (Incremental_inputs::report_archive_begin): New function.
6767 (Incremental_inputs::report_archive_end): New function.
6768 (Incremental_inputs::report_object): Change prototype.
6769 (Incremental_inputs::report_input_section): New function.
6770 (Incremental_inputs::report_script): Change prototype.
6771 (Incremental_inputs::get_reloc_count): New function.
6772 (Incremental_inputs::set_reloc_count): New function.
6773 (Incremental_inputs::create_data_sections): New function.
6774 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6775 (Incremental_inputs::inputs_section): New function.
6776 (Incremental_inputs::symtab_section): New function.
6777 (Incremental_inputs::relocs_section): New function.
6778 (Incremental_inputs::get_stringpool): Add const.
6779 (Incremental_inputs::command_line): Add const.
6780 (Incremental_inputs::inputs): Remove.
6781 (Incremental_inputs::command_line_key): New function.
6782 (Incremental_inputs::input_file_count): New function.
6783 (Incremental_inputs::input_files): New function.
6784 (Incremental_inputs::relocs_entsize): New function.
6785 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6786 (Incremental_inputs::finalize_inputs): Remove.
6787 (Incremental_inputs::Input_info): Remove.
6788 (Incremental_inputs::lock_): Remove.
6789 (Incremental_inputs::inputs_): Change type.
6790 (Incremental_inputs::inputs_map_): Remove.
6791 (Incremental_inputs::current_object_entry_): New data member.
6792 (Incremental_inputs::inputs_section_): New data member.
6793 (Incremental_inputs::symtab_section_): New data member.
6794 (Incremental_inputs::relocs_section_): New data member.
6795 (Incremental_inputs::reloc_count_): New data member.
6796 (Incremental_inputs_reader): New class.
6797 (Incremental_symtab_reader): New class.
6798 (Incremental_relocs_reader): New class.
6799 * layout.cc (Layout::finalize): Move finalization of incremental info
6800 and creation of incremental info sections to follow finalization of
6801 symbol table. Set offsets for postprocessing sections.
6802 (Layout::create_incremental_info_sections): Call
6803 Incremental_inputs::create_data_sections. Add incremental symtab
6804 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
6805 sections to layout after input sections.
6806 * layout.h (struct Timespec): Forward declaration.
6807 (Layout::incremental_inputs): Add const.
6808 (Layout::create_incremental_info_sections): Add parameter.
6809 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6810 * object.cc: Include incremental.h.
6811 (Relobj::finalize_incremental_relocs): New function.
6812 (Sized_relobj::do_layout): Record input sections in incremental info.
6813 * object.h (Object::output_section): New function.
6814 (Object::output_section_offset): Moved from Relobj.
6815 (Object::get_incremental_reloc_base): New function.
6816 (Object::get_incremental_reloc_count): New function.
6817 (Object::do_output_section): New function.
6818 (Object::do_output_section_offset): Moved from Relobj.
6819 (Object::do_get_incremental_reloc_base): New function.
6820 (Object::do_get_incremental_reloc_count): New function.
6821 (Object::Object): Initialize new data members.
6822 (Relobj::output_section): Renamed do_output_section and moved to
6824 (Relobj::output_section_offset): Moved to Object.
6825 (Relobj::do_get_incremental_reloc_base): New function.
6826 (Relobj::do_get_incremental_reloc_count): New function.
6827 (Relobj::allocate_incremental_reloc_counts): New function.
6828 (Relobj::count_incremental_reloc): New function.
6829 (Relobj::finalize_incremental_relocs): New function.
6830 (Relobj::next_incremental_reloc_index): New function.
6831 (Relobj::reloc_counts_): New data member.
6832 (Relobj::reloc_bases_): New data member.
6833 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
6834 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
6835 (Sized_relobj::incremental_relocs_scan): New function.
6836 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6837 (Sized_relobj::incremental_relocs_write): New function.
6838 (Sized_relobj::incremental_relocs_write_reltype): New function.
6839 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6841 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6842 archives and object files elsewhere.
6843 (Add_symbols::run): Report object files here.
6844 (Finish_group::run): Report end of archive at end of group.
6845 * reloc.cc: Include layout.h, incremental.h.
6846 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6847 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6848 (Sized_relobj::incremental_relocs_scan): New function.
6849 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6850 (Sized_relobj::do_relocate_sections): Write incremental relocations.
6851 (Sized_relobj::incremental_relocs_write): New function.
6852 (Sized_relobj::incremental_relocs_write_reltype): New function.
6853 * script.cc (read_input_script): Rewrite test for incremental link.
6854 Change call to Incremental_inputs::report_script.
6855 * symtab.h (Symbol_table::first_global_index): New function.
6856 (Symbol_table::output_count): New function.
6858 2010-08-12 Doug Kwan <dougkwan@google.com>
6860 * arm.cc (Target_arm::merge_object_attributes): Check command line
6861 options --no-wchar-size-warning and --no-enum-size-warning.
6862 * options.h (General_options): Add ld-compatible options
6863 --no-enum-size-warning and --no-wchar-size-warning.
6865 2010-08-04 Ian Lance Taylor <iant@google.com>
6867 * x86_64.cc (Target_x86_64::Scan::local): Use
6868 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6869 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6870 (Target_x86_64::Scan::global): Likewise.
6871 (Target_x86_64::Relocate::relocate): Likewise.
6872 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6875 2010-08-03 Cary Coutant <ccoutant@google.com>
6877 * merge.cc (Output_merge_string::do_add_input_section): Count strings
6878 to reserve space in merged_strings vector. Keep total input size
6880 (Output_merge_string::do_print_merge_stats): Print total input size.
6881 * merge.h (Output_merge_string): Add input_size_ field.
6882 * stringpool.cc (Stringpool_template::string_length): Move
6883 implementations out of Stringpool_template class and place in
6885 * stringpool.h (string_length): Move out of Stringpool_template.
6887 2010-08-03 Ian Lance Taylor <iant@google.com>
6890 * layout.cc (relaxation_loop_body): If address of load segment is
6891 set, adjust address to include headers if possible.
6893 2010-08-03 Ian Lance Taylor <iant@google.com>
6895 * version.cc (version_string): Bump to 1.10.
6897 2010-08-03 Ian Lance Taylor <iant@google.com>
6900 * layout.h (enum Output_section_order): Define.
6901 (class Layout): Update declarations.
6902 * layout.cc (Layout::get_output_section): Add order parameter.
6903 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6904 is_first_non_relro parameters. Change all callers.
6905 (Layout::choose_output_section): Likewise.
6906 (Layout::add_output_section_data): Likewise.
6907 (Layout::make_output_section): Likewise. Set order.
6908 (Layout::default_section_order): New function.
6909 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6910 * output.cc (Output_section::Output_section): Initialize order_.
6911 Don't initialize deleted fields.
6912 (Output_segment::Output_segment): Don't initialize deleted
6914 (Output_segment::add_output_section_to_load): New function
6915 replacing add_output_section. Change all callers to call this or
6916 add_output_section_to_nonload.
6917 (Output_segment::add_output_section_to_nonload): New function.
6918 (Output_segment::remove_output_section): Rewrite.
6919 (Output_segment::add_initial_output_data): Likewise.
6920 (Output_segment::has_any_data_sections): Likewise.
6921 (Output_segment::is_first_section_relro): Likewise.
6922 (Output_segment::maximum_alignment): Likewise.
6923 (Output_segment::has_dynamic_reloc): New function replacing
6924 dynamic_reloc_count. Change all callers.
6925 (Output_segment::has_dynamic_reloc_list): New function replacing
6926 dynamic_reloc_count_list. Change all callers.
6927 (Output_segment::set_section_addresses): Rewrite.
6928 (Output_segment::set_offset): Rewrite.
6929 (Output_segment::find_first_and_last_list): Remove.
6930 (Output_segment::set_tls_offsets): Rewrite.
6931 (Output_segment::first_section_load_address): Likewise.
6932 (Output_segment::output_section_count): Likewise.
6933 (Output_segment::section_with_lowest_load_address): Likewise.
6934 (Output_segment::write_section_headers): Likewise.
6935 (Output_segment::print_sections_to_map): Likewise.
6936 * output.h (class Output_data): Remove dynamic_reloc_count_
6937 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
6938 (Output_data::add_dynamic_reloc): Rewrite.
6939 (Output_data::has_dynamic_reloc): New function.
6940 (Output_data::dynamic_reloc_count): Remove.
6941 (class Output_section): Add order_ field. Remvoe is_relro_local_,
6942 is_last_relro_, is_first_non_relro_, is_interp_,
6943 is_dynamic_linker_section_ fields. Add order and set_order
6944 functions. Remove is_relro_local, set_is_relro_local,
6945 is_last_relro, set_is_last_relro, is_first_non_relro,
6946 set_is_first_non_relro functions, is_interp, set_is_interp,
6947 is_dynamic_linker_section, and set_is_dynamic_linker_section
6949 (class Output_segment): Change Output_data_list from std::list to
6950 std:;vector. Add output_lists_ field. Remove output_data_ and
6951 output_bss_ fields. Update declarations.
6953 2010-08-02 Ian Lance Taylor <iant@google.com>
6955 * arm.cc (Target_arm::gc_process_relocs): Use typename.
6956 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6957 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6959 2010-08-02 Ian Lance Taylor <iant@google.com>
6962 * script.cc (Script_options::Script_options): Initialize
6963 symbol_definitions_ and symbol_references_.
6964 (Script_options::add_symbol_assignment): Update
6965 symbol_definitions_ and symbol_references_.
6966 (Script_options::add_symbol_reference): New function.
6967 (script_symbol): New function.
6968 * script.h (class Script_options): Add symbol_definitions_ and
6969 symbol_references_ fields.
6970 (Script_options::referenced_const_iterator): New type.
6971 (Script_options::referenced_begin): New function.
6972 (Script_options::referenced_end): New function.
6973 (Script_options::is_referenced): New function.
6974 (Script_options::any_unreferenced): New function.
6975 * script-c.h (script_symbol): Declare.
6976 * yyscript.y (exp): Call script_symbol.
6977 * symtab.cc: Include "script.h".
6978 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6979 Change all callers. Check symbols referenced by scripts.
6980 (Symbol_table::add_undefined_symbols_from_command_line): Add
6981 layout parameter. Change all callers.
6982 (Symbol_table::do_add_undefined_symbols_from_command_line):
6983 Likewise. Break out loop body. Check symbols referenced by
6985 (Symbol_table::add_undefined_symbol_from_command_line): New
6986 function broken out of
6987 do_add_undefined_symbols_from_command_line.
6988 * symtab.h (class Symbol_table): Update declarations.
6989 * archive.cc: Include "layout.h".
6990 (Archive::should_include_member): Add layout parameter. Change
6991 all callers. Check for symbol mentioned in expression.
6992 * archive.h (class Archive): Update declaration.
6993 * object.cc (Sized_relobj::do_should_include_member): Add layout
6995 * object.h (Object::should_include_member): Add layout parameter.
6997 (Object::do_should_include_member): Add layout parameter.
6998 (class Sized_relobj): Update declaration.
6999 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7001 * dynobj.h (class Sized_dynobj): Update declaration.
7002 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7004 * plugin.h (class Sized_pluginobj): Update declaration.
7006 2010-08-02 Ian Lance Taylor <iant@google.com>
7009 * output.cc (Output_segment::set_offset): Search for the first and
7010 last sections rather than assuming that the list is in order.
7011 (Output_segment::find_first_and_last_list): New function.
7012 * output.h (class Output_segment): Update declarations.
7013 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7014 (relro_strip_test_SOURCES): New variable.
7015 (relro_strip_test_DEPENDENCIES): New variable.
7016 (relro_strip_test_LDFLAGS): New variable.
7017 (relro_strip_test_LDADD): New variable.
7018 (relro_strip_test.so): New target.
7020 2010-08-02 Ian Lance Taylor <iant@google.com>
7022 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7023 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7024 (Target_i386::got_tlsdesc_section): New function.
7025 (Target_i386::got_section): Create space for GOT entries for
7026 TLSDESC relocations.
7027 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7029 (Target_i386::Scan::global): Likewise.
7030 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7032 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7033 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7034 (Target_x86_64::got_tlsdesc_section): New function.
7035 (Target_x86_64::got_section): Create space for GOT entries for
7036 TLSDESC relocations.
7037 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7039 (Target_x86_64::Scan::global): Likewise.
7040 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7043 2010-08-02 Ian Lance Taylor <iant@google.com>
7045 * testsuite/final_layout.sh: Use dc to convert from hex to
7048 2010-07-29 Sriraman Tallam <tmsriram@google.com>
7050 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7051 paramter to the call to gold::gc_process_relocs.
7052 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7053 paramter to the call to gold::gc_process_relocs.
7054 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7055 parameter to the call to gold::gc_process_relocs.
7056 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7057 template parameter to the call to gold::gc_process_relocs.
7058 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7059 paramter to the call to gold::gc_process_relocs.
7060 * gc.h (get_embedded_addend_size): New function.
7061 (gc_process_relocs): Save the size of the reloc for use by ICF.
7062 * icf.cc (get_section_contents): Get the addend from the text section
7063 for SHT_REL relocation sections.
7064 * icf.h (Icf::Reloc_addend_size_info): New typedef.
7065 (Icf::Reloc_info): Add new member reloc_addend_size_info.
7066 * int_encoding.h (read_from_pointer): New overloaded function.
7067 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7068 * testsuite/icf_sht_rel_addend_test.sh: New file.
7069 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7070 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7072 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7074 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7075 * Makefile.in: Regenerate.
7076 * testsuite/Makefile.in: Regenerate.
7078 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
7080 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7081 * gold/testsuite/debug_msg.cc: Likewise.
7082 * gold/testsuite/odr_violation1.cc
7083 * gold/testsuite/odr_violation2.cc
7085 2010-07-21 Cary Coutant <ccoutant@google.com>
7087 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7088 string, and length fields.
7089 (Output_merge_string::Merged_strings_list): New type.
7090 (Output_merge_string::Merged_strings_lists): New typedef.
7091 (Output_merge_string): Replace merged_strings_ with
7092 merged_strings_lists_.
7093 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7094 Merged_strings_list per input object and section. Don't store pointer
7095 to the string. Don't store length with each merged string entry.
7096 (Output_merge_string::finalize_merged_data): Loop over list of merged
7097 strings lists. Recompute length of each merged string.
7099 2010-07-15 Cary Coutant <ccoutant@google.com>
7101 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7104 2010-07-14 Ian Lance Taylor <iant@google.com>
7106 * descriptors.cc (Descriptors::open): Report correct name in error
7109 2010-07-13 Doug Kwan <dougkwan@google.com>
7111 * arm.cc (Arm_input_section::Arm_input_section): For a
7112 SHT_ARM_EXIDX section, always keeps the input sections.
7113 (Arm_input_section::set_exidx_section_link): New method.
7114 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7115 has_errors_ to false.
7116 (Arm_exidx_input_section::has_errors,
7117 Arm_exidx_input_section::set_has_errors): New methods.
7118 (Arm_exidx_input_section::has_errors_): New data member.
7119 (Arm_relobj::get_exidx_shndx_list): New method.
7120 (Arm_output_section::append_text_sections_to_list): Do not skip
7121 section without SHF_EXECINSTR.
7122 (Arm_output_section::fix_exidx_coverage): Skip input sections with
7124 (Arm_relobj::make_exidx_input_section): Add new parameter for text
7125 section header. Make error messages more verbose. Check for
7126 a non-executable section linked to an EXIDX section.
7127 (Arm_relobj::do_read_symbols): Remove error checking, which has been
7128 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
7129 check that there is no deferred EXIDX section if we exit early.
7130 Instead of not making an EXIDX section in case of an error, make one
7131 and set the has_errors flag of it.
7132 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7133 in a relocatable link.
7134 (Target_arm::do_relax): Look for the EXIDX output section instead of
7135 assuming that it is called .ARM.exidx.
7136 (Target_arm::fix_exidx_coverage): Add a new parameter for input
7137 section list. Do not check for SHF_EXECINSTR section flags but
7138 skip any input section with errors.
7139 * output.cc (Output_section::Output_section): Initialize
7140 always_keeps_input_sections_ to false.
7141 (Output_section::add_input_section): Check for
7142 always_keeps_input_sections_.
7143 * output.h (Output_section::always_keeps_input_sections,
7144 Output_section::set_always_keeps_input_sections): New methods.
7145 (Output_section::always_keeps_input_sections): New data member.
7147 2010-07-13 Rafael Espindola <espindola@google.com>
7149 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7150 * fileread.h (Input_file): Add try_extra_search_path and find_file.
7152 2010-07-13 Philip Herron <herron.philip@googlemail.com>
7153 Ian Lance Taylor <iant@google.com>
7155 * output.h (Output_section_lookup_maps::add_merge_section):
7156 Correct check of whether value was inserted.
7157 (Output_section_lookup_maps::add_merge_input_section): Likewise.
7158 (Output_section_lookup_maps::add_relaxed_input_section):
7160 * arm.cc (Target_arm::got_section): Remove used local os.
7161 * i386.cc (Target_i386::got_section): Likewise.
7162 * x86_64.cc (Target_x86_64::got_section): Likewise.
7163 * sparc.cc (Target_sparc::got_section): Likewise.
7164 (Target_sparc::relocate): Remove unused local have_got_offset.
7165 * powerpc.cc (Target_powerpc::relocate): Likewise.
7167 2010-07-13 Ian Lance Taylor <iant@google.com>
7169 * compressed_output.cc (zlib_decompress): Fix signature in
7172 * archive.cc (Archive::include_member): Unlock an external member
7173 of a thin archive. Don't bother to delete an object we know is
7176 2010-07-12 Cary Coutant <ccoutant@google.com>
7178 * compressed_output.cc (zlib_decompress): New function.
7179 (get_uncompressed_size): New function.
7180 (decompress_input_section): New function.
7181 * compressed_output.h (get_uncompressed_size): New function.
7182 (decompress_input_section): New function.
7183 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7184 Handle compressed debug sections.
7185 * layout.cc (is_compressed_debug_section): New function.
7186 (Layout::output_section_name): Map compressed section names to
7188 * layout.h (is_compressed_debug_section): New function.
7189 (is_debug_info_section): Recognize compressed debug sections.
7190 * merge.cc: Include compressed_output.h.
7191 (Output_merge_data::do_add_input_section): Handle compressed
7193 (Output_merge_string::do_add_input_section): Handle compressed
7195 * object.cc: Include compressed_output.h.
7196 (Sized_relobj::Sized_relobj): Initialize new data members.
7197 (build_compressed_section_map): New function.
7198 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7199 * object.h (Object::section_is_compressed): New method.
7200 (Object::do_section_is_compressed): New method.
7201 (Sized_relobj::Compressed_section_map): New type.
7202 (Sized_relobj::do_section_is_compressed): New method.
7203 (Sized_relobj::compressed_sections_): New data member.
7204 * output.cc (Output_section::add_input_section): Handle compressed
7206 * reloc.cc: Include compressed_output.h.
7207 (Sized_relobj::write_sections): Handle compressed debug sections.
7209 2010-07-08 Cary Coutant <ccoutant@google.com>
7211 * resolve.cc (Symbol_table::resolve): Remember whether undef was
7212 weak when resolving to a dynamic def.
7213 (Symbol_table::should_override): Add adjust_dyndef flag; set it
7214 for weak undef/dynamic def cases. Adjust callers.
7215 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7216 undef_binding_weak_.
7217 (Symbol_table::sized_write_globals): Adjust symbol binding.
7218 (Symbol_table::sized_write_symbol): Add binding parameter.
7219 * symtab.h (Symbol::set_undef_binding): New method.
7220 (Symbol::is_undef_binding_weak): New method.
7221 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7222 (Symbol_table::should_override): Add new parameter.
7223 (Symbol_table::sized_write_symbol): Add new parameter.
7225 * testsuite/weak_undef_file1.cc: Add new test case.
7226 * testsuite/weak_undef_file2.cc: Fix header comment.
7227 * testsuite/weak_undef_test.cc: Add new test case.
7229 2010-06-29 Doug Kwan <dougkwan@google.com>
7231 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7232 Initialize USE_SYMBOL_.
7233 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7235 (Arm_reloc_property::uses_symbol_): New data member declaration.
7236 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7237 uses symbol value and symbol is undefined but not weakly undefined.
7239 2010-06-28 Rafael Espindola <espindola@google.com>
7241 * plugin.cc (Plugin::load): Use dlerror.
7243 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
7245 * symtab.cc (detect_odr_violations): When reporting an ODR
7246 violation, report an object where the symbol is defined.
7248 2010-06-25 Doug Kwan <dougkwan@google.com>
7250 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7251 (Target_arm::section_may_have_icf_unsafe_pointers): New method
7253 (Target_arm::Scan::local_reloc_may_be_function_pointer,
7254 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7255 target hook to detect function points.
7256 (Target_arm::Scan::possible_function_pointer_reloc): New method.
7257 * icf.h (Icf::check_section_for_function_pointers): Change type of
7258 parameter SECTION_NAME to const reference to std::string. Use
7259 target hook to determine if section may have unsafe pointers.
7260 * target.h (Target::section_may_have_icf_unsafe_pointers): New
7263 2010-06-21 Rafael Espindola <espindola@google.com>
7265 * fileread.cc (Input_file::find_fie): New
7266 (Input_file::open): Use Input_file::find_fie.
7267 * fileread.h (Input_file::find_fie): New
7268 * plugin.cc (set_extra_library_path): New.
7269 (Plugin::load): Add set_extra_library_path to the transfer vector.
7270 (Plugin_manager::set_extra_library_path): New.
7271 (Plugin_manager::add_input_file): Use the extra search path if set.
7272 (set_extra_library_path(): New.
7273 * plugin.h (Plugin_manager): Add set_extra_library_path and
7276 2010-06-19 Cary Coutant <ccoutant@google.com>
7278 * layout.cc (gdb_sections): Add .debug_types.
7279 (lines_only_debug_sections): Likewise.
7281 2010-06-18 Rafael Espindola <espindola@google.com>
7283 * plugin.cc (add_input_file,add_input_library)
7284 (Plugin_manager::add_input_file): Make filename arguments const.
7285 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7288 2010-06-16 Doug Kwan <dougkwan@google.com>
7290 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7291 .ARM.attributes section if we have not merged any input
7292 attributes sections.
7294 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7296 * arm.cc: Allow combining objects with no EABI version
7299 2010-06-15 Rafael Espindola <espindola@google.com>
7301 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7303 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7305 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7306 (struct iovec): Correct !HAVE_READV definition.
7308 2010-06-10 Cary Coutant <ccoutant@google.com>
7310 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7311 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7313 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7316 * symtab.h (Symbol::is_placeholder): New member function.
7317 * target-reloc.h (relocate_section): Check for placeholder symbols.
7319 * testsuite/Makefile.am (plugin_test_8): New test.
7320 (plugin_test_9): New test.
7321 * testsuite/Makefile.in: Regenerate.
7323 2010-06-09 Nick Clifton <nickc@redhat.com>
7325 * yyscript.y (input_list_element): Allow strings prefixed with
7326 the '-' character. Treat these as libraries.
7327 * script.cc (script_add_library): New function. Adds a library
7328 specified by "-l<name>" found in an input script.
7329 * script-c.h: Add prototype for script_add_library.
7331 2010-06-07 Doug Kwan <dougkwan@google.com>
7333 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7334 Restrict stub-group size to be within long conditional branch
7335 range when working around cortex-A8 erratum.
7337 2010-06-07 Damien Diederen <dd@crosstwine.com>
7339 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7342 2010-06-03 Sriraman Tallam <tmsriram@google.com>
7346 (Output_section::Input_section_sort_entry::compare_section_ordering):
7347 Change to return non-zero correctly.
7348 (Output_section::Input_section_sort_section_order_index_compare
7349 ::operator()): Change to fix ambiguity in comparisons.
7351 2010-06-01 Sriraman Tallam <tmsriram@google.com>
7353 * gold.h (is_wildcard_string): New function.
7354 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7355 (Layout::layout_eh_frame): Ditto.
7356 (Layout::find_section_order_index): New method.
7357 (Layout::read_layout_from_file): New method.
7358 * layout.h (Layout::find_section_order_index): New method.
7359 (Layout::read_layout_from_file): New method.
7360 (Layout::input_section_position_): New private member.
7361 (Layout::input_section_glob_): New private member.
7362 * main.cc (main): Call read_layout_from_file here.
7363 * options.h (--section-ordering-file): New option.
7364 * output.cc (Output_section::input_section_order_specified_): New
7366 (Output_section::Output_section): Initialize new member.
7367 (Output_section::add_input_section): Add new parameter.
7368 Keep input sections when --section-ordering-file is used.
7369 (Output_section::set_final_data_size): Sort input sections when
7370 section ordering file is specified.
7371 (Output_section::Input_section_sort_entry): Add new parameter.
7373 (Output_section::Input_section_sort_entry::compare_section_ordering):
7375 (Output_section::Input_section_sort_compare::operator()): Change to
7376 consider section_order_index.
7377 (Output_section::Input_section_sort_init_fini_compare::operator()):
7378 Change to consider section_order_index.
7379 (Output_section::Input_section_sort_section_order_index_compare
7380 ::operator()): New method.
7381 (Output_section::sort_attached_input_sections): Change to sort
7382 according to section order when specified.
7383 (Output_section::add_input_section<32, true>): Add new parameter.
7384 (Output_section::add_input_section<64, true>): Add new parameter.
7385 (Output_section::add_input_section<32, false>): Add new parameter.
7386 (Output_section::add_input_section<64, false>): Add new parameter.
7387 * output.h (Output_section::add_input_section): Add new parameter.
7388 (Output_section::input_section_order_specified): New
7390 (Output_section::set_input_section_order_specified): New method.
7391 (Input_section::Input_section): Initialize section_order_index_.
7392 (Input_section::section_order_index): New method.
7393 (Input_section::set_section_order_index): New method.
7394 (Input_section::section_order_index_): New member.
7395 (Input_section::Input_section_sort_section_order_index_compare): New
7397 (Output_section::input_section_order_specified_): New member.
7398 * script-sections.cc (is_wildcard_string): Delete and move modified
7400 (Output_section_element_input::Output_section_element_input): Modify
7401 call to is_wildcard_string.
7402 (Output_section_element_input::Input_section_pattern
7403 ::Input_section_pattern): Ditto.
7404 (Output_section_element_input::Output_section_element_input): Ditto.
7405 * testsuite/Makefile.am (final_layout): New test case.
7406 * testsuite/Makefile.in: Regenerate.
7407 * testsuite/final_layout.cc: New file.
7408 * testsuite/final_layout.sh: New file.
7410 2010-06-01 Rafael Espindola <espindola@google.com>
7412 * plugin.cc (Plugin::load): Pass the output name to the plugin.
7414 2010-06-01 Rafael Espindola <espindola@google.com>
7416 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7417 visibility of symbols.
7419 2010-05-27 Doug Kwan <dougkwan@google.com>
7421 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7422 from start of output section instead of address for a local symbol
7423 in a merged or relaxed section when doing a relocatable link.
7425 2010-05-26 Rafael Espindola <espindola@google.com>
7428 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7429 adding sections the garbage collector removed.
7430 * gold/testsuite/Makefile.am: Add test.
7431 * gold/testsuite/Makefile.in: Regenerate.
7432 * gold/testsuite/plugin_test_7.sh: New.
7433 * gold/testsuite/plugin_test_7_1.c: New.
7434 * gold/testsuite/plugin_test_7_2.c: New.
7436 2010-05-26 Rafael Espindola <espindola@google.com>
7438 * script-sections.cc (Output_section_definition::set_section_addresses):
7439 Check for --section-start.
7441 2010-05-26 Doug Kwan <dougkwan@google.com>
7443 * arm.cc (Arm_scan_relocatable_relocs): New class.
7444 (Target_arm::relocate_special_relocatable): New method.
7445 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7446 (Arm_relocate_functions::thumb_branch_common): Same.
7447 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7448 instead of Default_scan_relocatable_relocs.
7449 * target-reloc.h (relocate_for_relocatable): Let target handle
7450 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7451 * target.h (Sized_target::relocate_special_relocatable): New method.
7453 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7455 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7457 2010-05-23 Doug Kwan <dougkwan@google.com>
7459 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7461 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7462 with a direct branch, not a conditional branch, to a stub.
7463 * merge.cc (Output_merge_base::record_input_section): New method
7465 (Output_merge_data::do_add_input_section): Record input section if
7466 keeps-input-sections flag is set.
7467 (Output_merge_string::do_add_input_section): Ditto.
7468 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7469 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7471 (Output_merge_base::keeps_input_sections,
7472 Output_merge_base::set_keeps_input_sections,
7473 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7475 (Output_merge_base::Input_sections): New type declaration.
7476 (Output_merge_base::input_sections_begin,
7477 Output_merge_base::input_sections_end,
7478 Output_merge_base::do_set_keeps_input_sections): New method definitions.
7479 (Output_merge_base::bool keeps_input_sections_,
7480 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7481 Output_merge_base::input_sections_): New data members.
7482 (Output_merge_data::do_set_keeps_input_sections): New method
7484 (Output_merge_string::do_set_keeps_input_sections): Ditto.
7485 * output.cc (Output_section::Input_section::relobj): Move method
7486 defintion from class declaration to here and handle merge sections.
7487 (Output_section::Input_section::shndx): Ditto.
7488 (Output_section::Output_section): Remove initializations of removed
7489 data members and initialize new data member LOOKUP_MAPS_.
7490 (Output_section::add_input_section): Set keeps-input-sections flag
7491 for a newly created merge output section as appropriate. Adjust code
7492 to use Output_section_lookup_maps class.
7493 (Output_section::add_relaxed_input_section): Adjst code for lookup
7494 maps code refactoring.
7495 (Output_section::add_merge_input_section): Add a new parameter
7496 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
7497 class. If adding input section to a newly created merge output
7498 section fails, remove the new merge section.
7499 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7500 Adjust code for use of the Output_section_lookup_maps class.
7501 (Output_section::find_merge_section): Ditto.
7502 (Output_section::build_lookup_maps): New method defintion.
7503 (Output_section::find_relaxed_input_section): Adjust code to use
7504 Output_section_lookup_maps class.
7505 (Output_section::get_input_sections): Export merge sections. Adjust
7506 code to use Output_section_lookup_maps class.
7507 (Output_section:::add_script_input_section): Adjust code to use
7508 Output_section_lookup_maps class. Update lookup maps for merge
7510 (Output_section::discard_states): Use Output_section_lookup_maps.
7511 (Output_section::restore_states): Same.
7512 * output.h (Merge_section_properties): Move class defintion out of
7514 (Output_section_lookup_maps): New class.
7515 (Output_section::Input_section::is_merge_section): New method
7517 (Output_section::Input_section::relobj): Move defintion out of class
7518 defintion. Declare method only.
7519 (Output_section::Input_section::shndx): Ditto.
7520 (Output_section::Input_section::output_merge_base): New method defintion.
7521 (Output_section::Input_section::u2_.pomb): New union field.
7522 (Output_section::Merge_section_by_properties_map,
7523 Output_section::Output_section_data_by_input_section_map,
7524 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7526 (Output_section::add_merge_input_section): Add new parameter
7527 KEEPS_INPUT_SECTIONS.
7528 (Output_section::build_lookup_maps): New method declaration.
7529 (Output_section::merge_section_map_,
7530 Output_section::merge_section_by_properties_map_,
7531 Output_section::relaxed_input_section_map_,
7532 Output_section::is_relaxed_input_section_map_valid_): Remove data
7534 (Output_section::lookup_maps_): New data member.
7536 2010-05-21 Doug Kwan <dougkwan@google.com>
7539 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7540 avoid a compilation error.
7542 2010-05-19 Rafael Espindola <espindola@google.com>
7544 * script-sections.cc (Output_section_definition::allocate_to_segment):
7545 Update the phdrs_list even when the output section is NULL.
7546 * testsuite/Makefile.am: Add test.
7547 * testsuite/Makefile.in: Regenerate.
7548 * testsuite/script_test_9.cc: New.
7549 * testsuite/script_test_9.sh: New.
7550 * testsuite/script_test_9.t: New.
7552 2010-05-19 Doug Kwan <dougkwan@google.com>
7554 * arm.cc (Arm_input_section::original_size): New method.
7555 (Arm_input_section::do_addralign): Add a cast.
7556 (Arm_input_section::do_output_offset): Remove static cast.
7557 (Arm_input_section::original_addralign,
7558 Arm_input_section::original_size_): Change type to uint32_t.
7559 (Arm_input_section::init): Add safe casts for section alignment
7561 (Arm_input_section::set_final_data_size): Do not set address and
7562 offset of stub table.
7563 (Arm_output_section::fix_exidx_coverage): Change use of of
7564 Output_section::Simple_input_section to that of
7565 Output_section::Input_section.
7566 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7567 except for the first pass.
7568 * output.cc (Output_section::get_input_sections): Change type of
7569 input_sections to std::list<Input_section>.
7570 (Output_section::add_script_input_section): Rename from
7571 Output_section::add_simple_input_section. Change type of SIS
7572 parameter from Simple_input_section to Input_section.
7573 * output.h (Output_section::Simple_input_section): Remove class.
7574 (Output_section::Input_section): Change class visibility to public.
7575 (Output_section::Input_section::addralign): Use stored alignments
7576 for special input sections if set.
7577 (Output_section::Input_section::set_addralign): New method.
7578 (Output_section::get_input_sections): Change parameter type from
7579 list of Simple_input_section to list of Input_section.
7580 (Output_section::add_script_input_section): Rename from
7581 Output_section::add_simple_input_section. Change first parameter's
7582 type from Simple_input_section to Input_section and remove the
7583 second and third parameters.
7584 * script-sections.cc (Input_section::Input_section_list): Change
7585 type to list of Output_section::Input_section/
7586 (Input_section_info::Input_section_info): Change parameter type of
7587 INPUT_SECTION to Output_section::Input_section.
7588 (Input_section_info::input_section): Change return type.
7589 (Input_section_info::input_section_): Change type to
7590 Output_section::Input_section.
7591 (Output_section_element_input::set_section_addresses): Adjust code
7592 to use Output_section::Input_section instead of
7593 Output_section::Simple_input_section. Adjust code for renaming
7594 of Output_section::add_simple_input_section.
7595 (Orphan_output_section::set_section_addresses): Ditto.
7597 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7599 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7600 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7602 2010-05-18 Rafael Espindola <espindola@google.com>
7604 * options.cc (General_options::finalize): Handle -nostdlib.
7605 * options.h (nostdlib): New option.
7606 * script.cc (script_add_search_dir): Handle -nostdlib.
7608 2010-05-12 Doug Kwan <dougkwan@google.com>
7610 * arm.cc (Target_arm::do_finalize_sections): Create an empty
7611 attributes section only if there no attributes section after merging.
7612 (Target_arm::merge_object_attributes): Move value of
7613 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7614 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7615 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7616 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7617 and arm_attr_merge_7.stdout.
7618 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7619 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7620 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7621 arm_attr_merge_7b.o): New rules.
7622 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7624 * testsuite/Makefile.in: Regenerate.
7625 * testsuite/arm_attr_merge.sh: New file.
7626 * testsuite/arm_attr_merge_[67][ab].s: Same.
7628 2010-05-05 Nick Clifton <nickc@redhat.com>
7630 * po/es.po: Updated Spanish translation.
7632 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
7634 * Makefile.am (install-exec-local): Properly install gold as
7635 default cross linker.
7636 * Makefile.in: Regenerated.
7638 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
7639 Nick Clifton <nickc@redhat.com>
7641 * configure.ac (install_as_default): Define and set to false
7642 unless --enable-gold or --enable-gold=both/gold has been
7644 * configure: Regenerate.
7646 * Makefile.am (install-exec-local): Install the executable as
7647 'ld.gold'. If install_as_default is true then also install it as
7649 * Makefile.in: Regenerated.
7651 2010-04-24 Ian Lance Taylor <iant@google.com>
7653 * layout.cc (Layout::layout_reloc): In relocatable link don't
7654 combine reloc sections for grouped sections.
7656 2010-04-23 Sriraman Tallam <tmsriram@google.com>
7658 * gc.h (gc_process_relocs): Pass information on relocs pointing to
7659 sections that are not ordinary to icf.
7660 * icf.cc (get_section_contents): Handle relocation pointing to section
7661 with no object or shndx information.
7662 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7663 * testsuite/Makefile.in: Regenerate.
7664 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7665 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7667 2010-04-22 Ian Lance Taylor <iant@google.com>
7669 * expression.cc (Expression::Expression_eval_info): Add
7670 result_alignment_pointer field.
7671 (Expression::eval_with_dot): Add result_alignment_pointer
7672 parameter. Change all callers.
7673 (Expression::eval_maybe_dot): Likewise.
7674 (class Binary_expression): Add alignment_pointer parameter to
7675 left_value and right_value. Change all callers.
7676 (BINARY_EXPRESSION): Set result alignment.
7677 (class Trinary_expression): Add alignment_pointer parameter to
7678 arg2_value and arg3_value. Change all callers.
7679 (Trinary_cond::value): Set result alignment.
7680 (Max_expression::value, Min_expression::value): Likewise.
7681 (Align_expression::value): Likewise.
7682 * script-sections.cc (class Sections_element): Add dot_alignment
7683 parameter to set_section_addresses virtual function. Update
7685 (class Output_section_element): Likewise.
7686 (Script_sections::create_segments): Add dot_alignment parameter.
7688 (Script_sections::create_segments_from_phdrs_clause): Likewise.
7689 (Script_sections::set_phdrs_clause_addresses): Likewise.
7690 * script-sections.h: Update declarations.
7691 * script.h: Update declarations.
7692 * output.h (Output_segment::set_minimum_p_align): Don't decrease
7694 * testsuite/script_test_3.t: Set large alignment.
7695 * testsuite/script_test_3.sh: Make sure that at least one LOAD
7696 segment has expected alignment.
7698 2010-04-22 Nick Clifton <nickc@redhat.com>
7700 * po/gold.pot: Updated by the Translation project.
7701 * po/vi.po: Updated Vietnamese translation.
7703 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
7705 * testsuite/Makefile.am (check_PROGRAMS): Add
7706 icf_virtual_function_folding_test.
7707 * testsuite/Makefile.in: Regenerated.
7709 2010-04-15 Andrew Haley <aph@redhat.com>
7711 * options.h (merge_exidx_entries): New option.
7712 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7713 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7714 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7715 (Target_arm::merge_exidx_entries): New function.
7716 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7717 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7718 to Arm_exidx_fixup constructor.
7719 Add new arg, merge_exidx_entries.
7720 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7721 Arm_output_section::fix_exidx_coverage.
7723 2010-04-18 Sriraman Tallam <tmsriram@google.com>
7725 * icf.cc (get_section_contents): Check for preemptible functions.
7726 Ignore addend when appropriate.
7727 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
7729 (add_from_relobj): Check for section folded.
7730 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7731 * symtab.h (should_add_dynsym_entry): Add new parameter.
7732 * target-reloc.h (scan_relocs): Check for section folded.
7733 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7734 Check reloc types for function pointers in shared objects.
7735 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7737 (icf_preemptible_functions_test): New test case.
7738 (icf_string_merge_test): New test case.
7739 * testsuite.Makefile.in: Regenerate.
7740 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7741 bar_glob. Refactor code.
7742 * testsuite/icf_preemptible_functions_test.cc: New file.
7743 * testsuite/icf_preemptible_functions_test.sh: New file.
7744 * testsuite/icf_string_merge_test.cc: New file.
7745 * testsuite/icf_string_merge_test.sh: New file.
7746 * testsuite/icf_virtual_function_folding_test.cc: New file.
7747 * testsuite/icf_virtual_function_folding_test.sh: New file.
7749 2010-04-14 Doug Kwan <dougkwan@google.com>
7751 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7752 for local symbol recounting if we remove a section due to ICF.
7753 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7754 there are no regular objects in input.
7756 2010-04-13 Doug Kwan <dougkwan@google.com>
7758 * arm.cc (Arm_input_section::set_final_data_size): Compute
7759 accurate final data size instead of using current data size.
7761 2010-04-09 Doug Kwan <dougkwan@google.com>
7763 * layout.cc (Layout::choose_output_section): Handle script section
7765 (Layout::make_output_section_for_script): Add section type parameter.
7766 Handle script section types.
7767 * layout.h (Layout::make_output_section_for_script): Add section
7769 * output.cc (Output_section::Output_section): Initialize data member
7771 (Output_section::do_reset_address_and_file_offset): Do not set address
7772 to 0 if section is a NOLOAD section.
7773 * output.h (Output_section::is_noload): New method.
7774 (Output_section::set_is_noload): Ditto.
7775 (Output_section::is_noload_): New data member.
7776 * script-c.h (Script_section_type): New enum type.
7777 (struct Parser_output_section_header): Add new file section_type.
7778 * script-sections.cc (Sections_element::output_section_name): Add
7779 parameter for returning script section type.
7780 (Output_section_definition::output_section_name): Ditto.
7781 (Output_section_definition::section_type)P; New method.
7782 (Output_section_definiton::script_section_type_name): Ditto.
7783 (Output_section_definition::script_section_type_): New data member.
7784 (Output_section_definition::Output_section_definition): Initialize
7785 data member Output_section_definition::script_section_type_.
7786 (Output_section_definition::create_sections): Pass script section type
7787 to Layout::make_output_section_for_script.
7788 (Output_section_definition::output_section_name): Return script
7789 section type to caller.
7790 (Output_section_definition::set_section_address): Do not advance
7791 dot value and load address if section type is NOLOAD. Set address
7792 of NOLOAD sections regardless of section flags.
7793 (Output_section_definition::print): Print section type if it is
7794 not SCRIPT_SECTION_TYPE_NONE.
7795 (Output_section_definition::section_type): New method.
7796 (Output_section_definition::script_section_type_name): Ditto.
7797 (Script_sections::output_section_name): Add new parameter
7798 PSECTION_TYPE for returning script section type. Pass it to
7799 section elements. Handle discard sections.
7800 (Sort_output_sections::operator()): Handle NOLOAD sections.
7801 * script-sections.h (Script_sections::Section_type): New enum type.
7802 (Script_sections::output_section_name): Add a new parameter for
7803 returning script section type.
7804 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7806 * yyscript.y (union): Add new field SECTION_TYPE.
7807 (COPY, DSECT, INFO, NOLOAD): New tokens.
7808 (opt_address_and_section_type): Change type to output_section_header.
7809 (section_type): New non-terminal
7810 (section_header): Handle section type.
7811 (opt_address_and_section_type): Return section type value.
7813 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
7815 * testsuite/plugin_common_test_1.c (foo): Add prototype.
7816 * testsuite/plugin_common_test_2.c (foo): Likewise.
7818 2010-04-08 Doug Kwan <dougkwan@google.com>
7820 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7822 * output.cc (Output_section::add_merge_input_section): Simplify
7823 code and return status of Output_merge_base::add_input_section.
7824 Update merge section map only if Output_merge_base::add_input_section
7827 2010-04-07 Doug Kwan <dougkwan@google.com>
7829 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7830 if section is marked as containing instructions but has no mapping
7832 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7833 correct section index.
7834 (Arm_relobj::find_linked_text_section): Ditto.
7836 2010-04-07 Cary Coutant <ccoutant@google.com>
7838 * archive.cc (include_member): Destroy Read_symbols_data object before
7840 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7841 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7842 (Read_symbols_data::~Read_symbols_data) New destructor.
7843 (Section_relocs::Section_relocs) New constructor.
7844 (Section_relocs::~Section_relocs) New destructor.
7845 (Read_relocs_data::Read_relocs_data) New constructor.
7846 (Read_relocs_data::~Read_relocs_data) New destructor.
7847 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7848 pointers to NULL after deleting.
7850 2010-04-07 Doug Kwan <dougkwan@google.com>
7852 * arm.cc: Replace "endianity" with "endianness" in comments.
7853 (Arm_exidx_cantunwind): Ditto.
7854 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7855 (Arm_relobj::merge_flags_and_attributes): New method.
7856 (Arm_relobj::merge_flags_and_attributes_): New data member.
7857 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7858 (Arm_relobj::scan_sections_for_stubs): Ditto.
7859 (Arm_relobj::do_read_symbols): Check to see if we really want to
7860 merge processor-specific flags and attributes. Exit early if
7861 an object is empty except for section names and the undefined symbol.
7862 (Target_arm::do_finalize_sections): Move check for ELF format to
7863 Arm_relobj::do_read_symbols. Merge processor specific flags and
7864 attributes from a regular object only when we have determined that
7865 it is aapropriate. Do not create an .ARM.attributes section in
7866 output if there is no regular input object.
7867 (Target_arm::merge_processor_specific_flags): Check
7868 --warn-mismatch before printing any error.
7869 (Target_arm::merge_object_attributes): Ditto.
7870 * gold.cc (queue_middle_tasks): Handle the case in which there is
7871 no regular object in input.
7872 * options.cc (General_options::parse_EB): New method.
7873 (General_options::parse_EL): Same.
7874 (General_options::General_options): Initialize endianness_.
7875 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7877 (General_options::Endianness): New enum.
7878 (General_options::endianness): New method.
7879 (General_options::endianness_): New data member.
7880 * parameters.cc (Parameters::set_options): Check target endianness.
7881 (Parameters::set_target_once): Ditto.
7882 (Parameters::check_target_endianness): New method.
7883 (parameters_force_valid_target): If either -EL or -EB is specified,
7884 use it to define endianness of default target.
7885 * parameters.h (Parameters::check_target_endianness): New method
7887 * target.h (class Target): Change "endianity" to "endianness"
7890 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7892 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7893 * configure: Regenerate.
7894 * Makefile.in: Regenerate.
7895 * testsuite/Makefile.in: Regenerate.
7897 2010-04-06 Cary Coutant <ccoutant@google.com>
7900 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7901 prevailing definitions of common symbols.
7902 * testsuite/plugin_test_6.sh: New test case.
7903 * testsuite/plugin_common_test_1.c: New test case.
7904 * testsuite/plugin_common_test_2.c: New test case.
7905 * testsuite/Makefile.am (plugin_test_6): New test case.
7906 * testsuite/Makefile.in: Regenerate.
7908 2010-04-06 Nick Clifton <nickc@redhat.com>
7910 * po/vi.po: New Vietnamese translation.
7912 2010-03-30 Doug Kwan <dougkwan@google.com>
7914 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7916 2010-03-25 Doug Kwan <dougkwan@google.com>
7918 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7919 to avoid a conversion warning on a 32-bit host.
7921 2010-03-24 Ian Lance Taylor <iant@google.com>
7923 * testsuite/script_test_3.t: Add a TLS segment.
7924 * testsuite/Makefile.am (check_PROGRAMS): Add
7925 tls_phdrs_script_test.
7926 (tls_phdrs_script_test_SOURCES): Define.
7927 (tls_phdrs_script_test_DEPENDENCIES): Define.
7928 (tls_phdrs_script_test_LDFLAGS): Define.
7929 (tls_phdrs_script_test_LDADD): Define.
7930 * testsuite/Makefile.in: Rebuild.
7932 2010-03-23 Cary Coutant <ccoutant@google.com>
7934 * fileread.cc (find_or_make_view): Fix comment.
7936 2010-03-23 Ian Lance Taylor <iant@google.com>
7938 * script-sections.cc (class Orphan_section_placement): Define
7939 PLACE_TLS and PLACE_TLS_BSS.
7940 (Orphan_section_placement::Orphan_section_placement): Initialize
7942 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7943 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7944 (tls_script_test_SOURCES): Define.
7945 (tls_script_test_DEPENDENCIES): Define.
7946 (tls_script_test_LDFLAGS): Define.
7947 (tls_script_test_LDADD): Define.
7948 * testsuite/Makefile.in: Rebuild.
7950 2010-03-22 Doug Kwan <dougkwan@google.com>
7952 * arm.cc (Arm_relocate_functions::abs8,
7953 Arm_relocate_functions::abs16): Use correct check for overflow
7954 specified in the ARM ELF specs.
7955 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
7956 target of a BLX instruction specially.
7957 (Reloc_stub::stub_type_for_reloc): Ditto.
7958 (Relocate::relocate): Use symbolic names instead of numeric relocation
7959 codes to report error.
7960 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7962 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7963 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7964 thumb2_blx_out_of_range.stdout
7965 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7966 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7967 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7968 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7969 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7970 thumb2_blx_in_range, thumb2_blx_in_range.o,
7971 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7972 thumb2_blx_out_of_range.o): New rules.
7973 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7974 thumb2_blx_in_range and thumb2_blx_out_of_range.
7975 * testsuite/Makefile.in: Regenerate.
7976 * arm_branch_in_range.sh: Add tests for THUMB BLX.
7977 * testsuite/thumb_blx_in_range.s: New file.
7978 * testsuite/thumb_blx_out_of_range.s: New file.
7980 2010-03-22 Rafael Espindola <espindola@google.com>
7982 * archive.cc (Should_include): Move to archive.h.
7983 (should_include_member): Make it a member of Archive.
7985 (Add_lib_group_symbols): New.
7986 * archive.h: Include options.h.
7987 (Archive_member): Moved from Archive.
7988 (Should_include): Moved from archive.cc.
7990 (Add_lib_group_symbols): New.
7991 * dynobj.cc (do_should_include_member): New.
7992 * dynobj.h (do_should_include_member): New.
7993 * gold.cc (queue_initial_tasks): Update call to queue.
7994 * main.cc (main): Print lib group stats.
7995 * object.cc (do_should_include_member): New.
7996 * object.h: Include archive.h.
7997 (Object::should_include_member): New.
7998 (Object::do_should_include_member): New.
7999 (Sized_relobj::do_should_include_member): New.
8000 * options.cc (General_options::parse_start_lib): New.
8001 (General_options::parse_end_lib): New.
8002 (Input_arguments::add_file): Handle lib groups.
8003 (Input_arguments::start_group): Check we are not in a lib.
8004 (Input_arguments::start_lib): New.
8005 (Input_arguments::end_lib): New.
8006 * options.h (General_options): Add start_lib and end_lib.
8007 (Input_argument::lib_): New.
8008 (Input_argument::lib): New.
8009 (Input_argument::is_lib): New.
8010 (Input_file_lib): New.
8011 (Input_arguments::in_lib_): New.
8012 (Input_arguments::in_lib): New.
8013 (Input_arguments::start_lib): New.
8014 (Input_arguments::end_lib_): New.
8015 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8016 in unused members as preempted.
8017 (Sized_pluginobj::do_should_include_member): New.
8018 * plugin.h (Sized_pluginobj::do_should_include_member): New.
8019 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8021 (Read_symbols::do_whole_lib_group): New.
8022 (Read_symbols::do_lib_group): New.
8023 (Read_symbols::do_read_symbols): Handle lib groups.
8024 (Read_symbols::get_name): Handle lib groups.
8025 * readsyms.h (Read_symbols): Add an archive member pointer.
8026 (Read_symbols::do_whole_lib_group): New.
8027 (Read_symbols::do_lib_group): New.
8028 (Read_symbols::member_): New.
8029 * script.cc (read_input_script): Update call to queue_soon.
8031 2010-03-19 Doug Kwan <dougkwan@google.com>
8033 * arm.cc (Stub_table::Stub_table): Initialize new data members
8034 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8035 (Stub_table::add_reloc_stub): Assign stub offset and update
8036 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8037 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8039 (Stub_table::update_data_size_and_addralign): Use
8040 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8041 instead of going over all reloc stubs.
8042 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8043 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8044 Stringpool_template::offset_ to size of Stringpool_char.
8045 (Stringpool_template::new_key_offset): Remove code to initialize
8046 Stringpool_template::offset_.
8047 * stringpool.h (Stringpool_template::set_no_zero_null): Set
8048 Stringpool_template::offset_ to zero.
8050 2010-03-15 Doug Kwan <dougkwan@google.com>
8052 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8054 (Stringpool_template::new_key_offset): New method.
8055 (Stringpool_template::add_string): Assign offsets when adding new
8057 (Stringpool_template::set_string_offsets): Do not set string offsets
8058 when not optimizing.
8059 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8061 (Chunked_vector::clear): Clear size_.
8062 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8063 (Chunked_vector::size): Return size_.
8064 (Chunked_vector::push_back): Use size_ to find insert position.
8065 (Chunked_vector::size_): New data member.
8066 (Stringpool_template::set_no_zero_null): Assert string set is empty.
8067 (Stringpool_template::new_key_offset): New method declaration.
8068 (Stringpool_template::offset_): New data member.
8070 2010-03-15 Rafael Espindola <espindola@google.com>
8072 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8073 Add_symbols' constructor.
8074 * readsyms.h (Add_symbols): Remove the input_group member.
8076 2010-03-10 Ian Lance Taylor <iant@google.com>
8078 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8079 target to ask whether a reference to a symbol requires a stack
8081 * target.h (Target::is_call_to_non_split): New function.
8082 (Target::do_is_call_to_non_split): Declare virtual function.
8083 * target.cc: Include "symtab.h".
8084 (Target::do_is_call_to_non_split): New function.
8085 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8087 2010-03-10 Cary Coutant <ccoutant@google.com>
8089 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8090 (File_read::open[1]): Remove initial mapping of whole_file_view_.
8091 (File_read::open[2]): Add whole_file_view_ to list of views.
8092 (File_read::make_view): Remove test of whole_file_view_.
8093 (File_read::find_or_make_view): Create whole_file_view_ if
8095 (File_read::clear_views): Replace bool parameter with enum;
8096 adjust all callers. Don't delete views with permanent data;
8097 do delete cached views and views from archives if
8098 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
8099 if clearing the corresponding view.
8100 * fileread.h (File_read::Clear_views_mode): New enum.
8101 (File_read::View::is_permanent_view): New method.
8102 (File_read::clear_views): Replace bool parameter
8103 with enum; adjust all callers.
8104 * options.h (General_options): Change keep_files_mapped option;
8105 add map_whole_files.
8106 * readsyms.cc (Add_symbols::run): Delete sd_ object before
8108 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8111 2010-03-10 David S. Miller <davem@davemloft.net>
8113 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8115 2010-03-09 Sriraman Tallam <tmsriram@google.com>
8117 * icf.cc (get_section_contents): Add '@' marker after processing the
8120 2010-03-08 Doug Kwan <dougkwan@google.com>
8122 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8123 due to a conversion warning.
8124 (Arm_relobj::update_output_local_symbol_count): Check for local
8125 symbol with unset output index.
8127 2010-03-05 Ian Lance Taylor <iant@google.com>
8129 * options.h (class General_options): Add --spare-dynamic-tags.
8130 * output.cc (Output_data_dynamic::set_final_data_size): Implement
8131 --spare-dynamic-tags.
8133 2010-03-05 Ian Lance Taylor <iant@google.com>
8135 * incremental.cc: Include "libiberty.h".
8137 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
8139 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8140 function, is_info_ member.
8141 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8142 (Versions::Versions): Update caller.
8143 (Versions::define_base_version): Likewise.
8144 (Versions::add_def): Likewise.
8146 2010-03-03 Sriraman Tallam <tmsriram@google.com>
8148 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8149 (Scan::possible_function_pointer_reloc): New function.
8150 (Scan::local_reloc_may_be_function_pointer): Change to call
8151 possible_function_pointer_reloc.
8152 (Scan::global_reloc_may_be_function_pointer): Ditto.
8153 * icf.h (Icf::check_section_for_function_pointers): Change to reject
8154 relocations in ".data.rel.ro._ZTV" section.
8155 * testsuite/icf_safe_so_test.sh: Change to pass i386.
8156 * testsuite/icf_safe_so_test.cc: Ditto.
8157 * testsuite/icf_safe_test.cc: Ditto.
8158 * testsuite/icf_safe_test.sh: Ditto.
8160 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8161 Ian Lance Taylor <iant@google.com>
8163 * target-reloc.h (relocate_section): Check the symbol table index
8164 for -1U before setting the local symbol index.
8165 (scan_relocatable_relocs): If copying the relocation, record that
8166 the local symbol is required.
8167 * object.h (Symbol_value::is_output_symtab_index_set): New
8169 (Symbol_value::may_be_discarded_from_output_symtab): New
8171 (Symbol_value::has_output_symtab_entry): New function.
8172 (Symbol_value::needs_output_symtab_entry): Remove.
8173 (Symbol_value::output_symtab_index): Make sure the symbol index is
8175 (Symbol_value::set_output_symtab_index): Make sure the symbol
8176 index is not set. Make sure the new index is valid.
8177 (Symbol_value::set_must_have_output_symtab_entry): New function.
8178 (Symbol_value::has_output_dynsym_entry): New function.
8179 (Symbol_value::set_output_dynsym_index): Make sure the new index
8181 (Sized_relobj::set_must_have_output_symtab_entry): New function.
8182 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8183 local symbol if permitted.
8184 (Sized_relobj::do_finalize_local_symbols): Call
8185 is_output_symtab_index_set rather than needs_output_symtab_entry.
8186 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8187 rather than needs_output_symtab_entry. Call
8188 has_output_dynsym_entry rather than needs_output_dynsym_entry.
8189 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8190 is_output_symtab_index_set rather than needs_output_symtab_entry.
8191 * testsuite/discard_locals_relocatable_test.c: New file.
8192 * testsuite/discard_locals_test.sh: Test -r.
8193 * testsuite/Makefile.am (check_DATA): Add
8194 discard_locals_relocatable_test1.syms,
8195 discard_local_relocatable_test2.syms.
8196 (MOSTLYCLEANFILES): Likewise. Also add
8197 discard_locals_relocatable_test1.lout and
8198 discard_locals_relocatable_test2.out.
8199 (discard_locals_relocatable_test1.syms): New target.
8200 (discard_locals_relocatable_test.o): New target.
8201 (discard_locals_relocatable_test1.out): New target.
8202 (discard_locals_relocatable_test2.syms): New target.
8203 (discard_locals_relocatable_test2.out): New target.
8204 (various): Add missing ../ld-new dependencies.
8205 * testsuite/Makefile.in: Rebuild.
8207 2010-03-03 Nick Clifton <nickc@redhat.com>
8209 * po/fi.po: New Finnish translation.
8211 2010-03-01 Doug Kwan <dougkwan@google.com>
8213 * layout.cc (Layout::Layout): Force section types of .init_array*,
8214 .preinit_array* and .fini_array* sections.
8215 * output.cc (Output_section::Input_section_sort_entry::has_priority):
8216 Fix check of return value of std::string::find.().
8217 (Output_section::Input_section_sort_compare::operator()): Remove
8218 comment about .init_array.
8219 (Output_section::Input_section_sort_init_fini_compare::operator()):
8221 (Output_section::sort_attached_input_sections): Handle .init_array
8222 and .fini_array specially.
8223 * output.h (Output_section::Inut_section_sort_compare): Update
8225 (Output_section::Input_section_sort_init_fini_compare): New struct.
8227 2010-02-26 Doug Kwan <dougkwan@google.com>
8229 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8230 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8231 * testsuite/debug_msg.sh: Avoid matching source line number for
8232 use of global variable undef_int.
8234 2010-02-26 Doug Kwan <dougkwan@google.com>
8236 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8237 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8238 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8239 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8240 * options.cc (General_options::General_options): Initialize member
8242 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8243 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8244 and rm_no_fix_v4bx.stdout
8245 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8246 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8247 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8248 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8249 and arm_no_fix_v4bx.
8250 * Makefile.in: Regenerate.
8251 * testsuite/arm_fix_v4bx.s: New file.
8252 * testsuite/arm_fix_v4bx.sh: Ditto.
8254 2010-02-24 Doug Kwan <dougkwan@google.com>
8256 * arm.cc (Target_arm::got_section): Make the .got section the first
8257 non RELRO section in the data segment.
8258 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8259 suffixes of section names.
8261 2010-02-24 Doug Kwan <dougkwan@google.com>
8263 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8264 flags and attributes merging if an input file is a binary file.
8265 * fileread.cc (Input_file::open): Record format of original file.
8266 * fileread.h (Input_file::Format): New enum type.
8267 (Input_file::Input_file): Initialize data member format_.
8268 (Input_file::format): New method definition.
8269 (Input_file::format_):: New data member.
8271 2010-02-24 Doug Kwan <dougkwan@google.com>
8273 * arm.cc (Arm_output_data_got): New class.
8274 (ARM_TCB_SIZE): New constant
8275 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8276 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8277 If user uses a script with a SECTIONS clause, issue only a warning
8278 for a misplaced EXIDX input section. Otherwise, issue an error.
8279 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8281 (Target_arm::got_mode_index_entry): Handle static linking.
8282 (Target_arm::Scan::local): Ditto.
8283 (Target_arm::Scan::global): Ditto.
8284 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
8285 all incorrectly implemented relocations.
8286 (Target_arm::fix_exidx_coverage): Pass layout to
8287 Arm_output_section::fix_exidx_coverage.
8288 * layout.cc (Layout::section_name_mapping): Remove trailing dots
8289 from ".ARM.exidx." and ".ARM.extab.".
8291 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8293 * arm.cc (Target_arm::do_finalize_sections): Create attribute
8294 section if it does not already exist.
8295 * attributes.cc (Attributes_section_data::Attributes_section_data):
8296 Don't crash if size is zero.
8298 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8299 Ian Lance Taylor <iant@google.com>
8301 * gold.cc (queue_middle_tasks): If no input files were opened,
8303 * workqueue.h (Task_function::Task_function): Assert that there is
8306 2010-02-22 Doug Kwan <dougkwan@google.com>
8308 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8309 * icf.cc (get_section_contents): Cast snprintf arguments to long long
8310 types to avoid warnings due to different uint64_t implementations
8313 2010-02-21 Doug Kwan <dougkwan@google.com>
8315 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8316 handling of the maximum backward branch offset.
8317 (Arm_relocate_functions::thumb_branch_common): Ditto.
8318 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8319 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8320 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8321 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8322 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8323 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8324 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8325 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8326 thumb_bl_out_of_range thumb_bl_out_of_range.o,
8327 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8328 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8329 thumb2_bl_out_of_range.o): New rules.
8330 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8331 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8332 thumb2_bl_out_of_range
8333 * testsuite/Makefile.in: Regenerate.
8334 * testsuite/arm_bl_in_range.s: New file.
8335 * testsuite/arm_bl_out_of_range.s: Ditto.
8336 * testsuite/arm_branch_in_range.sh: Ditto.
8337 * testsuite/arm_branch_range.t: Ditto.
8338 * testsuite/thumb2_branch_range.t: Ditto.
8339 * testsuite/thumb_bl_in_range.s: Ditto.
8340 * testsuite/thumb_bl_out_of_range.s: Ditto.
8341 * testsuite/thumb_branch_range.t: Ditto.
8343 2010-02-20 Sriraman Tallam <tmsriram@google.com>
8345 * gc.h (gc_process_relocs): Change vectors to point to the new list.
8346 Add reloc offset information.
8347 * icf.cc (get_section_contents): Change iterators to point to the new
8348 vectors. Add reloc offset information to the contents.
8349 * icf.h (Icf::Sections_reachable_info): New typedef.
8350 (Icf::Sections_reachable_list): New typedef.
8351 (Icf::Offset_info): New typedef.
8352 (Icf::Reloc_info): New struct typedef.
8353 (Icf::Reloc_info_list): New typedef.
8354 (Icf::symbol_reloc_list): Delete method.
8355 (Icf::addend_reloc_list): Delete method.
8356 (Icf::section_reloc_list): Delete method.
8357 (Icf::reloc_info_list): New method.
8358 (Icf::reloc_info_list_): New member.
8360 2010-02-19 Doug Kwan <dougkwan@google.com>
8362 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8363 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8364 * arm.cc (Arm_relocation_functions): New forward declaration.
8365 (Target_arm::Target_arm): Initialize new data members
8366 got_mod_index_offset_ and tls_base_symbol_defined_.
8367 (Target_arm::Relocate::relocate_tls): New method.
8368 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8369 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8371 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8372 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8373 (Target_arm::got_mod_index_offset_,
8374 Target_arm::tls_base_symbol_defined_): New data members.
8375 (Target_arm::Scan::local, Target::Scan::global,
8376 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8379 2010-02-18 Doug Kwan <dougkwan@google.com>
8381 * arm.cc (Arm_relobj::find_linked_text_section): New method.
8382 (Arm_relobj::make_exidx_input_section): Pass section index of linked
8383 text section as a parameter becuase some broken tools may not set
8384 the link in section header.
8385 (Target_arm::has_got_section): New method.
8386 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8387 without any mapping symbol as data only. Remove warning.
8388 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8389 link in its section header, try to discover the link by inspecting the
8390 REL31 relocation at the beginning of the section.
8391 (Target_arm::Scan::check_non_pic): Report name of offending relocation
8393 (Target_arm::Scan::global): Treat any reference to the symbol
8394 _GLOBAL_OFFSET_TABLE_ as a GOT access.
8396 2010-02-12 Sriraman Tallam <tmsriram@google.com>
8398 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8399 (Scan::global_reloc_may_be_function_pointer): New function.
8400 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8401 (Scan::global_reloc_may_be_function_pointer): New function.
8402 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8403 (Scan::global_reloc_may_be_function_pointer): New function.
8404 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8405 (Scan::global_reloc_may_be_function_pointer): New function.
8406 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8407 (Scan::global_reloc_may_be_function_pointer): New function.
8408 (Scan::possible_function_pointer_reloc): New function.
8409 (Target_x86_64::can_check_for_function_pointers): New function.
8410 * gc.h (gc_process_relocs): Scan relocation types to determine if
8411 function pointers were taken for targets that support it.
8412 * icf.cc (Icf::find_identical_sections): Include functions for
8413 folding in safe ICF whose pointer is not taken.
8414 * icf.h (Secn_fptr_taken_set): New typedef.
8415 (fptr_section_id_): New member.
8416 (section_has_function_pointers): New function.
8417 (set_section_has_function_pointers): New function.
8418 (check_section_for_function_pointers): New function.
8419 * options.h: Fix comment for safe ICF option.
8420 * target.h (can_check_for_function_pointers): New function.
8421 * testsuite/Makefile.am: Add icf_safe_so_test test case.
8422 Modify icf_safe_test for X86-64.
8423 * testsuite/Makefile.in: Regenerate.
8424 * testsuite/icf_safe_so_test.cc: New file.
8425 * testsuite/icf_safe_so_test.sh: New file.
8426 * testsuite/icf_safe_test.cc (kept_func_3): New function.
8427 (main): Change to take pointer to function kept_func_3.
8428 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8429 folding is done correctly for X86-64.
8431 2010-02-12 David S. Miller <davem@davemloft.net>
8433 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8434 is_symbolless parameter.
8435 (Output_reloc<SHT_REL>::is_symbolless): New.
8436 (Output_reloc<SHT_REL>::is_symbolless_): New.
8437 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8438 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8439 (Output_reloc<SHT_RELA>::is_symbolless): New.
8440 (Output_data_reloc::add_global): Handle is_symbolless.
8441 (Output_data_reloc::add_global_relative): Likewise.
8442 (Output_data_reloc::add_local): Likewise.
8443 (Output_data_reloc::add_local_relative): Likewise.
8444 (Output_data_reloc::add_symbolless_global_addend): New.
8445 (Output_data_reloc::add_symbolless_local_addend): New.
8446 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8448 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8449 instead of ->is_relative_
8450 (Output_reloc::write): Likewise.
8451 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8452 (Output_reloc::write_rel): Simplify.
8454 * sparc.cc (Target_sparc::Scan::local): Use
8455 ->add_symbolless_local_addend as needed.
8456 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8457 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
8458 based upon relocation offset.
8460 2010-02-11 Doug Kwan <dougkwan@google.com>
8462 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8463 (Target_arm::Scan::global): Ditto. Also remove a comment before the
8464 beginning of function.
8465 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8466 and MOVT_ABS relocations. Those are non issued in scanning. Fix
8467 parameter is_32bit in calls to should_apply_static_reloc.
8468 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8469 (check_DATA): Add arm_abs_global.stdout.
8470 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8471 arm_abs_global.stdout): New rules.
8472 (MOSTLLYCLEANFILES): Add arm_abs_global
8473 * Makefile.in: Regenerate.
8474 * testsuite/arm_abs_global.s: New file.
8475 * testsuite/arm_abs_global.sh: Ditto.
8476 * testsuite/arm_abs_lib.s: Ditto.
8478 2010-02-11 Ian Lance Taylor <iant@google.com>
8480 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8482 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
8483 Allocate_commons_task first.
8484 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8485 task, rather than symtab_lock_.
8486 (Gc_process_relocs::~Gc_process_relocs): New function.
8487 (Gc_process_relocs::is_runnable): Check this_blocker_.
8488 (Gc_process_relocs::locks): Use next_blocker_ rather than
8490 (Scan_relocs::~Scan_relocs): New function.
8491 (Scan_relocs::is_runnable): Check this_blocker_ rather than
8493 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
8495 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8496 fields. Add this_blocker_ and next_blocker_ fields. Adjust
8497 constructor accordingly.
8498 (class Gc_process_relocs): Likewise.
8499 (class Scan_relocs): Likewise.
8500 * common.h (class Allocate_commons_task): Remove symtab_lock_
8501 field, and corresponding constructor parameter.
8502 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8504 (Allocate_commons_task::locks): Likewise.
8506 2010-02-11 Ian Lance Taylor <iant@google.com>
8508 * gold-threads.h (class Once): Define.
8509 (class Initialize_lock): Rewrite as child of Once.
8510 * gold-threads.cc (class Once_initialize): Define.
8511 (once_pointer_control): New static variable.
8512 (once_pointer, once_arg): New static variables.
8513 (c_run_once): New static function.
8514 (Once::Once, Once::run_once, Once::internal_run): New functions.
8515 (class Initialize_lock_once): Remove.
8516 (initialize_lock_control): Remove.
8517 (initialize_lock_pointer): Remove.
8518 (initialize_lock_once): Remove.
8519 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8520 (Initialize_lock::initialize): Rewrite.
8521 (Initialize_lock::do_run_once): New function.
8522 * archive.cc (Archive::interpret_header): Only clear name if it is
8524 * fileread.cc: Include "gold-threads.h"
8525 (file_counts_lock): New static variable.
8526 (file_counts_initialize_lock): Likewise.
8527 (File_read::release): Only increment counts when using --stats.
8528 Use a lock around the increment.
8529 * parameters.cc (class Set_parameters_target_once): Define.
8530 (set_parameters_target_once): New static variable.
8531 (Parameters::Parameters): Move here from parameters.h.
8532 (Parameters::set_target): Rewrite.
8533 (Parameters::set_target_once): New function.
8534 (Parameters::clear_target): Move here and rewrite.
8535 * parameters.h (class Parameters): Update declarations. Add
8536 set_parameters_target_once_ field.
8537 (Parameters::Parameters): Move to parameters.cc.
8538 (Parameters::clear_target): Likewise.
8539 * readsyms.cc (Read_symbols::do_group): Create a Start_group
8541 (Start_group::~Start_group): New function.
8542 (Start_group::is_runnable): New function.
8543 (Start_group::locks, Start_group::run): New functions.
8544 (Finish_group::run): Change saw_undefined to size_t.
8545 * readsyms.h (class Start_group): Define.
8546 (class Finish_group): Change saw_undefined_ field to size_t.
8547 (Finish_group::Finish_group): Remove saw_undefined and
8548 this_blocker parameters. Change all callers.
8549 (Finish_group::set_saw_undefined): New function.
8550 (Finish_group::set_blocker): New function.
8551 * symtab.h (class Symbol_table): Change saw_undefined to return
8552 size_t. Change saw_undefined_ field to size_t.
8553 * target-select.cc (Set_target_once::do_run_once): New function.
8554 (Target_selector::Target_selector): Initialize set_target_once_
8555 field. Don't initialize lock_ and initialize_lock_ fields.
8556 (Target_selector::instantiate_target): Rewrite.
8557 (Target_selector::set_target): New function.
8558 * target-select.h (class Set_target_once): Define.
8559 (class Target_selector): Update declarations. Make
8560 Set_target_once a friend. Remove lock_ and initialize_lock_
8561 fields. Add set_target_once_ field.
8563 2010-02-10 Ian Lance Taylor <iant@google.com>
8565 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8567 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
8568 (queue_middle_tasks): Add all blockers before queueing any tasks.
8569 (queue_final_tasks): Likewise.
8570 * token.h (Task_token::add_blockers): New function.
8571 * object.h (Input_objects::number_of_relobjs): New function.
8573 2010-02-10 Ian Lance Taylor <iant@google.com>
8575 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8576 shared, not if not position independent.
8577 * x86_64.cc (Relocate::relocate_tls): Likewise.
8578 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8579 (tls_pie_pic_test): New target.
8580 * testsuite/Makefile.in: Rebuild.
8582 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8583 (tls_test_main_pie.o, tls_test_pie.o): New targets.
8584 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8585 * testsuite/Makefile.in: Rebuild.
8587 2010-02-09 David S. Miller <davem@davemloft.net>
8589 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8590 R_SPARC_RELATIVE using ->add_local_relative().
8591 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8593 * output.h (Output_data_dynamic::add_section_size): New method
8594 that takes two Output_data objects.
8595 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8596 entry param. Handle it in initializers.
8597 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8598 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8599 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8601 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8602 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8603 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8604 for dynrel_includes_plt.
8605 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8606 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8607 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8609 (Target_sparc::do_finalize_sections): Update to pass true for
8610 dynrel_includes_plt.
8611 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8612 output before .rela.plt
8613 (Target_powerpc::do_finalize_sections): Update to pass true for
8614 dynrel_includes_plt when 32-bit.
8616 2010-02-08 Doug Kwan <dougkwan@google.com>
8618 * arm.cc (Arm_relobj::simple_input_section_output_address): New
8620 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8621 Arm_relobj::scan_section_for_cortex_a8_stubs,
8622 Arm_relobj::do_relocation_section): Instead of calling
8623 Output_section::output_address, use faster
8624 Arm_relobj::simple_input_section_output_address.
8626 2010-02-08 David S. Miller <davem@davemloft.net>
8628 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8629 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8630 relocation helper function.
8632 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8633 just like R_SPARC_GOT{10,13,22}.
8634 (Target_sparc::Scan::local): Likewise.
8635 (Target_sparc::Relocate:relocate): Likewise.
8637 2010-02-06 Ian Lance Taylor <iant@google.com>
8639 * configure.ac: Rewrite targetobjs duplicate removal code to use
8640 only shell constructs.
8641 * configure: Rebuild.
8643 2010-02-05 Doug Kwan <dougkwan@google.com>
8646 * arm.cc (Arm_relobj::section_is_scannable): New method.
8647 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8648 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8650 2010-02-04 Doug Kwan <dougkwan@google.com>
8653 * arm-reloc-property.cc (cstdio): Include.
8654 * configure.ac (targetobjs): Remove duplicates.
8655 * configure: Regenerate.
8656 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8657 big and little endian version for a given address size.
8659 2010-02-03 Doug Kwan <dougkwan@google.com>
8661 * arm-reloc-property.cc
8662 (Arm_reloc_property_table::reloc_name_in_error_message): New method
8664 * arm-reloc-property.h
8665 (Arm_reloc_property_table::get_implemented_static_reloc_property):
8666 New method definition.
8667 (Arm_reloc_property_table::reloc_name_in_error_message): New method
8669 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8671 (GOT_PREL): Change implemented to Y.
8672 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8673 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8674 (Arm_relocate_functions::movw_abs_nc): Remove method.
8675 (Arm_relocate_functions::movt_abs): Ditto.
8676 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8677 (Arm_relocate_functions::thm_movt_abs): Ditto.
8678 (Arm_relocate_functions::movw_rel_nc): Ditto.
8679 (Arm_relocate_functions::movw_rel): Ditto.
8680 (Arm_relocate_functions::movt_rel): Ditto.
8681 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8682 (Arm_relocate_functions:thm_movw_rel): Ditto.
8683 (Arm_relocate_functions:thm_movt_rel): Ditto.
8684 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8685 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8686 New method definitions.
8687 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8688 (Arm_relocation_functions::arm_grp_ldr): Ditto.
8689 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8690 (Arm_relocation_functions::arm_grp_ldc): Ditto.
8691 (Target_arm::Relocate::relocate): Check for non-static or
8692 unimplemented relocation code and exit early. Change calls to
8693 Target_arm::reloc_uses_thumb_bit and
8694 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8695 instead. Refactor code to handle similar relocations to increase
8696 code sharing. Remove check for unsupported relocation code in switch
8698 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8699 relocation property table to find out size. Change error message to
8700 print out the name of a relocation code instead of the numeric value.
8701 (Target_arm::scan_reloc_for_stub): Use relocation property table
8702 instead of calling Target_arm::reloc_uses_thumb_bit().
8704 2010-02-02 Doug Kwan <dougkwan@google.com>
8706 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8707 types of relaxed input section.
8709 2010-02-02 Doug Kwan <dougkwan@google.com>
8711 * Makefile.am (HFILES): Add arm-reloc-property.h.
8713 (TARGETSOURCES): Add arm-reloc-property.cc
8714 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8715 (libgold_a_SOURCES): $(DEFFILES)
8716 * Makefile.in: Regenerate.
8717 * arm-reloc-property.cc: New file.
8718 * arm-reloc-property.h: New file.
8719 * arm-reloc.def: New file.
8720 * arm.cc: Update comments.
8721 (arm-reloc-property.h): New included header.
8722 (arm_reloc_property_table): New global variable.
8723 (Target_arm::do_select_as_default_target): New method definition.
8724 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8725 arm-reloc-property to targ_extra_obj.
8726 * parameters.cc (set_parameters_target): Call
8727 Target::select_as_default_target().
8728 * target.h (Target::select_as_default_target): New method definition.
8729 (Target::do_select_as_default_target): Same.
8731 2010-02-01 Doug Kwan <dougkwan@google.com>
8733 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8734 first_output_text_section_.
8735 (Arm_exidx_fixup::first_output_text_section): New method definition.
8736 (Arm_exidx_fixup::first_output_text_section_): New data member.
8737 (Arm_exidx_fixup::process_exidx_section): Record the first text
8738 output section seen.
8739 (Arm_output_section::fix_exidx_coverage): Set correct linked section
8740 and entsize in output section header.
8742 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8744 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8745 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8746 (Arm_relocate_functions::thm_alu11): New Method.
8747 (Arm_relocate_functions::thm_pc8): New Method.
8748 (Arm_relocate_functions::thm_pc12): New Method.
8749 (Target_arm::Scan::local): Handle the relocations.
8750 (Target_arm::Scan::global): Likewise.
8751 (Target_arm::Relocate::relocate): Likewise.
8752 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8754 2010-01-29 Doug Kwan <dougkwan@google.com>
8756 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8757 of relocation types as ld.
8759 2010-01-29 Doug Kwan <dougkwan@google.com>
8761 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8763 (Arm_relocate_functions::thumb_branch_common): Ditto.
8764 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8765 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8766 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8767 Arm_relocate_functions::jump24): Remove.
8768 (Target_arm::Relocate::relocate): Adjust code to call
8769 Arm_relocation_functions::arm_branch_common and
8770 Arm_relocation_functions::thumb_branch_common instead of their removed
8771 wrappers. Merge switch-cases together to reduce source code size.
8773 2010-01-29 Doug Kwan <dougkwan@google.com>
8775 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8776 output_local_symbol_count_needs_update_.
8777 (Arm_relobj::output_local_symbol_count_needs_update,
8778 Arm_relobj::set_output_local_symbol_count_needs_update,
8779 Arm_relobj::update_output_local_symbol_count): New methods.
8780 (Arm_relobj::output_local_symbol_count_needs_update_): New data
8782 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8783 of pointed function as in a R_ARM_PREL31 relocation.
8784 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8785 for output local symbol count updating.
8786 (Target_arm::do_relax): Update output local symbol counts in objects
8788 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8790 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8792 * arm.cc: Added support for the ARM relocations:
8793 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8794 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8795 (Arm_relocate_functions::movw_rel_nc): Renamed (was
8797 (Arm_relocate_functions::movw_rel): New method.
8798 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8799 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8801 (Arm_relocate_functions::thm_movw_rel): New method.
8802 (Arm_relocate_functions::thm_movt_rel): Renamed (was
8804 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8806 (Target_arm::Scan::global): Likewise.
8807 (Target_arm::Relocate::relocate): Likewise.
8808 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8811 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8813 * arm.cc: Added support for ARM group relocations.
8814 (Target_arm::reloc_needs_sym_origin): New method.
8815 (Arm_relocate_functions::calc_grp_kn): New method.
8816 (Arm_relocate_functions::calc_grp_residual): New method.
8817 (Arm_relocate_functions::calc_grp_gn): New method.
8818 (Arm_relocate_functions::arm_grp_alu): New Method.
8819 (Arm_relocate_functions::arm_grp_ldr): New Method.
8820 (Arm_relocate_functions::arm_grp_ldrs): New Method.
8821 (Arm_relocate_functions::arm_grp_ldc): New Method.
8822 (Target_arm::Scan::local): Handle the ARM group relocations.
8823 (Target_arm::Scan::global): Likewise.
8824 (Target_arm::Relocate::relocate): Likewise.
8825 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8828 2010-01-26 Doug Kwan <dougkwan@google.com>
8830 * arm.cc (set): Include.
8831 (class Arm_exidx_fixup): Change type of last_input_section_ to const
8833 (Arm_output_section::Text_section_list): New type.
8834 (Arm_output_section::append_text_sections_to_list): New method.
8835 (Arm_output_section::fix_exidx_coverage): Ditto.
8836 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8837 (Arm_relobj::convert_input_section_to_relaxed_section): Use
8838 Relobj::set_section_offset() instead of
8839 Sized_relobj::invalidate_section_offset().
8840 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8841 parameter for section headers. Ignore relocation sections for
8842 unallocated sections and EXIDX sections.
8843 (Target_arm::fix_exidx_coverage): New method.
8844 (Target_arm::output_section_address_less_than): New type.
8845 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8846 linked text section instead of the EXIDX section.
8847 (Arm_output_section::create_stub_group): Add an assertion to check
8848 that this is not an EXIDX output section.
8849 (Arm_output_section::append_text_sections_to_list): New method.
8850 (Arm_output_section::fix_exidx_coverage): Ditto.
8851 (Arm_relobj::scan_sections_for_stubs): Adjust call to
8852 Arm_relobj::section_needs_reloc_stub_scanning.
8853 (Target_arm::do_relax): Fix EXIDX output section coverage in the
8855 (Target_arm::fix_exidx_coverage): New method.
8856 * object.h (Relobj::set_output_section): New method.
8857 (Sized_relobj::invalidate_section_offset): Remove method.
8858 (Sized_relobj::do_invalidate_section_offset): Remove method.
8859 (Sized_relobj::do_set_section_offset): Handle offset value -1.
8861 2010-01-25 Doug Kwan <dougkwan@google.com>
8863 * arm.cc (Arm_exidx_merged_section::do_output_offset):
8864 Fix warning due to signed and unsigned comparison on a 32-bit host.
8866 2010-01-22 Doug Kwan <dougkwan@google.com>
8868 * arm.cc (Target_arm::do_relax): Record an output section for section
8869 offset adjustment it contains any stub table that has changed.
8870 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8871 offsets in an output section if necessary.
8872 * output.cc (Output_section::Output_section): Initialize
8873 section_offsets_need_adjustments_.
8874 (Output_section::add_input_section_for_script): Renamed to
8875 Output_section::add_simple_input_section.
8876 (Output_section::save_states): Add a comment.
8877 (Output_section::discard_states): New method defintion.
8878 (Output_section::adjust_section_offsets): Same.
8879 * output.h (Output_section::add_input_section_for_script): Renamed to
8880 Output_section::add_simple_input_section.
8881 (Output_section::discard_states): New method declaration.
8882 (Output_section::adjust_section_offsets): Same.
8883 (Output_section::section_offsets_need_adjustment,
8884 Output_section::set_section_offsets_need_adjustment): New method
8886 (Output_section::section_offsets_need_adjustment_): New data member.
8887 * script-sections.cc
8888 (Output_section_element_input::set_section_address): Adjust code for
8889 renaming of Output_section::add_input_section_for_script.
8890 (Orphan_output_section::set_section_address): Same.
8892 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8894 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8895 Fix_v4bx enum values .
8896 * gold/options.h (General_options): New option definitions.
8897 (General_options::fix_v4bx): New method.
8898 (General_options::Fix_v4bx): New enum.
8899 * gold/options.cc (General_options::parse_fix_v4bx): New method.
8900 (General_options::parse_fix_v4bx_interworking): New method.
8902 2010-01-22 Doug Kwan <dougkwan@google.com>
8904 * arm.cc (Arm_exidx_fixup): New class.
8906 2010-01-21 Doug Kwan <dougkwan@google.com>
8908 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8910 (Arm_exidx_section_offset_map): New type.
8912 2010-01-21 Doug Kwan <dougkwan@google.com>
8914 * arm.cc (Arm_exidx_input_section): New class.
8915 (Arm_relobj::exidx_input_section_by_link,
8916 Arm_relobj::exidx_input_section_by_shndx,
8917 Arm_relobj::make_exidx_input_section): New methods.
8918 (read_arm_attributes_section): Remove.
8919 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8920 information about them.
8921 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8924 2010-01-20 Doug Kwan <dougkwan@google.com>
8926 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8927 Input_section_specifier to Section_id.
8928 (Target_arm::new_arm_input_section: Adjust code for change of key
8930 (Target_arm::find_arm_input_section): Ditto.
8931 * gc.h (object.h): Include for Section_id nand Section_id_hash.
8932 (Section_id): Remove.
8933 (Garbage_collection::Section_id_hash): Remove.
8934 * icf.h (object.h): Include for Section_id nand Section_id_hash.
8935 (Section_id): Remove.
8936 (Icf::Section_id_hash): Remove.
8937 * object.h (Section_id, Const_section_id, Section_id_hash,
8938 Const_section_id_hash): New type definitions.
8939 * output.cc (Output_section::add_relaxed_input_section): Change to
8940 use Const_section_id instead of Input_section_specifier as key type.
8941 (Output_section::add_merge_input_section): Ditto.
8942 (Output_section::build_relaxation_map): Change to use Section_id
8943 instead of Input_section_specifier as key type.
8944 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8946 (Output_section::convert_input_sections_to_relaxed_sections): Change
8947 to use Const_section_id instead of Input_section_specifier as key type.
8948 (Output_section::find_merge_section): Ditto.
8949 (Output_section::find_relaxed_input_section): Ditto.
8950 * output.h (Input_section_specifier): Remove class.
8951 (Output_section::Output_section_data_by_input_section_map): Change
8952 key type to Const_section_id.
8953 (Output_section::Output_relaxed_input_section_by_input_section_map):
8955 (Output_section::Relaxation_map): Change key type to Section_id.
8957 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8959 * gold/arm.cc: Added support for R_ARM_V4BX relocation
8960 (class Arm_v4bx_stub): New class.
8961 (DEF_STUBS): Updated definition to support v4_veneer_bx.
8962 (Stub_factory::make_arm_v4bx_stub): New method.
8963 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8964 (Stub_table::empty): Handle v4bx stubs.
8965 (Stub_table::add_arm_v4bx_stub): New method.
8966 (Stub_table::find_arm_v4bx_stub): New method.
8967 (Arm_relocate_functions::v4bx): New method.
8968 (Target_arm::fix_v4bx): New method.
8969 (Target_arm::Target_arm): Handle R_ARM_V4BX.
8970 (Stub_table::relocate_stubs): Likewise.
8971 (Stub_table::do_write): Likewise.
8972 (Stub_table::update_data_size_and_addralign): Likewise.
8973 (Stub_table::finalize_stubs): Likewise.
8974 (Target_arm::Scan::local): Likewise.
8975 (Target_arm::Scan::global): Likewise.
8976 (Target_arm::do_finalize_sections): Likewise.
8977 (Target_arm::Relocate::relocate): Likewise.
8978 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8980 (Target_arm::scan_reloc_for_stub): Likewise.
8981 (Target_arm::scan_reloc_section_for_stubs): Likewise.
8983 2010-01-19 Ian Lance Taylor <iant@google.com>
8985 * output.cc (Output_section_headers::do_sized_write): Write large
8986 segment count to sh_info field.
8987 (Output_file_header::do_sized_write): For large segment count,
8988 write PN_XNUM to e_phnum field.
8990 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8992 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8993 (Arm_relocate_functions::thm_jump8): New function.
8994 (Arm_relocate_functions::thm_jump11): New function.
8995 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8997 (Target_arm::Scan::global): Likewise.
8998 (Target_arm::Relocate::relocate): Likewise.
8999 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9002 2010-01-14 Doug Kwan <dougkwan@google.com>
9004 * arm.cc (map, utility): Include headers.
9005 (Target_arm::apply_cortex_a8_workaround): New method.
9006 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9007 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9008 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9009 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9010 the --[no-]fix-cortex-a8 command line options.
9011 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9012 (Target_arm::relocate_stub): Use addend in instruction template.
9013 * options.h (DEFINE_bool): Set the user-set flag.
9014 (General_options): Add --[no-]-fix-cortex options.
9015 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9016 : Update fast look-up map after conversion.
9018 2010-01-14 Sriraman Tallam <tmsriram@google.com>
9020 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9021 in the first pass of do_layout.
9023 2010-01-13 Doug Kwan <dougkwan@google.com>
9025 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9026 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9027 apparent compiler problem of not folding static constant integral
9028 data members of elfcpp::Elf_sizes<32>.
9030 2010-01-13 Doug Kwan <dougkwan@google.com>
9032 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9033 Arm_relobj::section_needs_cortex_a8_stub_scanning,
9034 Arm_relobj::scan_section_for_cortex_a8_erratum,
9035 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9036 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9037 sections to scan for relocation stubs into a new method
9038 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
9039 relocation and Cortex-A8 stub scanning.
9040 (Target_arm::do_relax): Force stubs to be after stubbed sections
9041 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
9042 the beginning of a new relaxation pass. Update a comment.
9043 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9045 2010-01-12 Ian Lance Taylor <iant@google.com>
9047 * target-reloc.h (visibility_error): New inline function.
9048 (relocate_section): Call visibility_error.
9049 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9050 (MOSTLYCLEANFILES): Likewise.
9051 (protected_4_pic.o, protected_3.err): New targets.
9052 * testsuite/protected_4.cc: New file.
9054 2010-01-12 Doug Kwan <dougkwan@google.com>
9056 * arm.cc (Cortex_a8_reloc): New class.
9057 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9058 and cortex_a8_relocs_info_.
9059 (Target_arm::fix_cortex_a8): New method definition.
9060 (Target_arm::Cortex_a8_relocs_info): New type.
9061 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9062 New data member declarations.
9063 (Target_arm::scan_reloc_for_stub): Record information about
9064 relocations for THUMB branches that might be exempted from the
9065 Cortex-A8 workaround.
9066 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9067 at the beginning of a relaxation pass.
9069 2010-01-12 Doug Kwan <dougkwan@google.com>
9071 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9072 (Arm_relobj::Mapping_symbol_position,
9073 Arm_reloj::Mapping_symbol_position_less,
9074 Arm_relobj::Mapping_symbols_info): New types.
9075 (Target_arm::is_mapping_symbol_name): New method definition.
9076 (Arm_relobj::do_count_local_symbols): Save information about mapping
9079 2010-01-11 Doug Kwan <dougkwan@google.com>
9081 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9082 Arm_relocate_functions::thumb32_branch_upper,
9083 Arm_relocate_functions::thumb32_branch_lower,
9084 Arm_relocate_functions::thumb32_cond_branch_offset,
9085 Arm_relocate_functions::thumb32_cond_branch_upper,
9086 Arm_relocate_functions::thumb32_cond_branch_lower,
9087 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9088 branch offset encoding.
9089 (Arm_relocate_functions::thumb_branch_common): Use new branch
9090 offset encoding methods to avoid code duplication.
9091 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9092 (Stub_addend_reader::operator()): Use new branch encoding method
9093 to avoid code duplication.
9095 2010-01-11 Doug Kwan <dougkwan@google.com>
9097 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9098 (Target_arm::do_finalize_sections): Define special EXIDX section
9099 symbols only if referenced.
9100 * gc.h (Garbage_collection::add_reference): New method.
9101 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9104 2010-01-11 Ian Lance Taylor <iant@google.com>
9106 * script.cc (Version_script_info::build_expression_list_lookup):
9107 Change complaing about duplicate wildcard match from error to
9110 * script.cc (class Lazy_demangler): Recreate--revert part of patch
9112 (Version_script_info::Version_script_info): Initialize globs_,
9113 default_version_, default_is_global_, and exact_. Don't
9114 initialize globals_ or locals_.
9115 (Version_script_info::build_lookup_tables): Build local symbols
9117 (Version_script_info::unquote): New function.
9118 (Version_script_info::add_exact_match): New function.
9119 (Version_script_info::build_expression_list_lookup): Remove lookup
9120 parameter. Add is_global parameter. Change all callers. Handle
9121 wildcard pattern specially. Unquote pattern. Call
9123 (Version_script_info::get_name_to_match): New function.
9124 (Version_script_info::get_symbol_version): New function.
9125 (Version_script_info::get_symbol_version_helper): Remove.
9126 (Version_script_info::check_unmatched_names): Call unquote.
9127 * script.h (class Version_script_info): Change get_symbol_version
9128 to be non-inline and add is_global parameter; change all callers.
9129 Rewrite symbol_is_local. Update declarations. Define struct
9130 Version_tree_match, Exact, Globs. Don't define struct Lookup.
9131 Remove globals_ and locals_ members. Add exact_, globs_,
9132 default_version_, is_global_.
9133 (Version_script_info::Glob): Remove pattern, add expression and
9134 is_global. Update constructor. Change all callers.
9135 * dynobj.cc (Versions::finalize): Mark the version symbol as the
9137 (Versions::symbol_section_contents): If a symbol is undefined, or
9138 defined in a dynamic object, set the version index to
9140 * symtab.cc (Symbol_table::add_from_relobj): Don't call
9142 (Symbol_table::add_from_pluginobj): Likewise.
9143 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9145 2010-01-11 Doug Kwan <dougkwan@google.com>
9147 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9148 (incremental_dump_LDADD): Add linking option for libintl.
9149 * Makefile.in: Regenerate.
9151 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
9154 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9156 * testsuite/Makefile.in: Regenerated.
9158 2010-01-10 Doug Kwan <dougkwan@google.com>
9160 * options.h (DEFINE_var): Use parentheses around argument varname__
9161 in macro body to avoid any unintended subsequent substitutions.
9163 2010-01-10 Ian Lance Taylor <iant@google.com>
9165 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9166 candidates before doing symbol resolution.
9168 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9169 ODR candidates if only one is weak.
9171 2010-01-08 Ian Lance Taylor <iant@google.com>
9173 * script.cc (Version_script_info::build_expression_list_lookup):
9174 Don't warn about ambiguous version, just record the ambiguity.
9175 (Version_script_info::get_symbol_version_helper): Give error if
9176 version is ambiguous.
9178 2010-01-08 Doug Kwan <dougkwan@google.com>
9180 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9181 prev_data_size_ and prev_addralign_. Remove initializer for
9182 deleted data member has_been_changed_.
9183 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9184 to determine if the table is empty.
9185 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9187 (Stub_table::add_reloc_stub): Define method in class definition
9188 instead of just declaring it there.
9189 (Stub_table::add_cortex_a8_stub): New method definition.
9190 (Stub_table::update_data_size_and_addralign): Ditto.
9191 (Stub_table::finalize_stubs): Ditto.
9192 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9193 (Stub_table::do_addralign_): Return address alignment in the
9194 (Stub_table::do_reset_address_and_file_offset): Define method in
9195 class definition instead of declaring it there. Set current data
9196 size to be the data size of the previous pass.
9197 (Stub_table::set_final_data_size): Use current data size as the
9199 (Stub_table::relocate_stub): Change parameter type of stub from
9200 Reloc_stub pointer to Stub pointer.
9201 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9202 (Stub_table::Cortex_a8_stub_list): New typedef.
9203 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9204 Stub_table::prev_addralign_): New data member.
9205 (Arm_relobj::Arm_relobj): Initialize data member
9206 section_has_cortex_a8_workaround_.
9207 (Arm_relobj::section_has_cortex_a8_workaround,
9208 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9210 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9212 (Target_arm::relocate_stub): Change parameter type of stub from
9213 Reloc_stub pointer to Stub pointer.
9214 (Insn_template::size, Insn_template::alignment): Handle
9215 THUMB16_SPECIAL_TYPE.
9216 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9217 Stub_table::update_data_size_and_addralign,
9218 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9220 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9221 (Stub_table::do_write): Ditto.
9222 (Target_arm::do_relax): Adjust code for changes in Stub_table.
9224 2010-01-08 Ian Lance Taylor <iant@google.com>
9227 * symtab.h (class Symbol): Remove fields is_target_special_ and
9228 has_plt_offset_. Add field is_defined_in_discarded_section_.
9229 (Symbol::is_defined_in_discarded_section): New function.
9230 (Symbol::set_is_defined_in_discarded_section): New function.
9231 (Symbol::has_plt_offset): Rewrite.
9232 (Symbol::set_plt_offset): Verify that new offset is not -1U.
9233 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9234 Don't initialize is_target_special_ or has_plt_offset_.
9235 Initialize is_defined_in_discarded_section_.
9236 (Symbol_table::add_from_relobj): If appropriate, set
9237 is_defined_in_discarded_section.
9238 * resolve.cc (Symbol::override_base_with_special): Don't test
9239 is_target_special_. Change has_plt_offset_ to has_plt_offset().
9240 * target-reloc.h (relocate_section): Do special handling for
9241 symbols defined in discarded sections for global symbols as well
9244 2010-01-08 Ian Lance Taylor <iant@google.com>
9246 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9247 the SHT_SYMTAB case.
9249 2010-01-08 Ian Lance Taylor <iant@google.com>
9251 * object.cc (Sized_relobj::do_layout): Don't get confused if
9252 layout_eh_frame returns NULL.
9254 2010-01-08 Ian Lance Taylor <iant@google.com>
9257 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9258 dynamic symbol table, use the normal symbol table.
9259 (Sized_dynobj::do_read_symbols): Remove assertion about type of
9262 2010-01-08 Ian Lance Taylor <iant@google.com>
9265 * layout.cc (Layout::include_section): Remove .gnu_debuglink
9268 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
9270 * version.cc (print_version): Change to "Copyright 2010".
9272 2010-01-08 Ian Lance Taylor <iant@google.com>
9276 * i386.cc (class Target_i386): Change return type of plt_section
9278 (class Output_data_plt_i386): Add tls_desc_rel_ field.
9279 (Output_data_plt_i386::Output_data_plt_i386): Initialize
9280 tls_desc_rel_ field.
9281 (Output_data_plt_i386::rel_tls_desc): New function.
9282 (Target_i386::rel_tls_desc_section): New function.
9283 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9284 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9285 R_386_TLS_DESC reloc in rel_tls_desc_section.
9286 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9287 Define struct Tlsdesc_info.
9288 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9289 (Target_x86_64::do_reloc_symbol_index): New function.
9290 (Target_x86_64::add_tlsdesc_info): New function.
9291 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9292 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9294 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
9296 (Output_data_plt_x86_64::rela_tlsdesc): New function.
9297 (Target_x86_64::rela_tlsdesc_section): New function.
9298 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9300 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9301 (Target_x86_64::do_reloc_addend): New function.
9302 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9303 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9304 declarations. Define TARGET_CODE. Add arg field to u1_ union.
9305 (Output_reloc::type): New function.
9306 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9307 (Output_reloc::is_target_specific): New function.
9308 (Output_reloc::target_arg): New function.
9309 (class Output_reloc) [SHT_RELA]: Add four new constructors for
9310 absolute relocs and target specific relocs.
9311 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9312 add_target_specific.
9313 (class Output_data_reloc) [SHT_RELA]: Likewise.
9314 * output.cc (Output_reloc::Output_reloc): Add four new versions
9315 for absolute relocs and target specific relocs.
9316 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9317 (Output_reloc::get_symbol_index): Likewise.
9318 (Output_reloc::local_section_offset): Check that local_sym_index_
9319 is not TARGET_CODE or 0.
9320 (Output_reloc::symbol_value): Likewise.
9321 (Output_reloc::write) [SHT_RELA]: Call target for target specific
9323 * target.h (class Target): Add reloc_symbol_index and reloc_addend
9324 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
9326 * layout.cc (add_target_dynamic_tags): Use output section for
9327 DT_PLTRELSZ and DT_JMPREL.
9329 2010-01-07 Ian Lance Taylor <iant@google.com>
9332 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9334 (class Output_data_reloc_generic): Define.
9335 (class Output_data_reloc_base): Change base class to
9336 Output_data_reloc_generic. Change add() method to call
9337 bump_relative_reloc_count for a relative reloc. Remove
9339 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9341 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9342 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
9344 * layout.h (class Layout): Update declaration.
9346 2010-01-07 Ian Lance Taylor <iant@google.com>
9348 * output.h (class Output_data): Add const version of
9349 output_section and do_output_section.
9350 (class Output_section_data): Add const version of
9352 (class Output_section): Likewise.
9353 * layout.cc (Layout::add_target_dynamic_tags): New function.
9354 * layout.h (class Layout): Update declarations.
9355 * arm.cc (Target_arm::do_finalize_sections): Use
9356 add_target_dynamic_tags.
9357 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9358 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9359 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9360 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9362 2010-01-07 Ian Lance Taylor <iant@google.com>
9365 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9368 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
9369 Ian Lance Taylor <iant@google.com>
9372 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9373 Xindex::read_symtab_xindex.
9375 2010-01-07 Doug Kwan <dougkwan@google.com>
9377 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9378 (Insn_template::thumb16_bcond_insn): New method declaration.
9379 (Insn_template): Fix spelling.
9380 (Stub::thumb16_special): New method declaration.
9381 (Stub::do_write): Define virtual method which was previously pure
9383 (Stub::do_thumb16_special): New method declaration.
9384 (Stub::do_fixed_endian_write): New template member.
9385 (Reloc_stub::do_write): Remove.
9386 (Reloc_stub::do_fixed_endian_write): Remove.
9387 (Cortex_a8_stub): New class definition.
9388 (Stub_factory::make_cortex_a8_stub): New method definition.
9389 (Stub_factory::Stub_factory): Add missing static storage class
9390 qualifier for elf32_arm_stub_a8_veneer_blx.
9392 2010-01-07 Ian Lance Taylor <iant@google.com>
9395 * options.h (class General_options): Add --warn-unresolved-symbols
9396 and --error-unresolved-symbols.
9397 * errors.cc (Errors::undefined_symbol): Implement
9398 --warn-unresolved-symbols.
9400 * options.h (class General_options): Add -z text and -z textoff.
9401 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9403 2010-01-06 Sriraman Tallam <tmsriram@google.com>
9405 * gc.h (Garbage_collection::Cident_section_map): New typedef.
9406 (Garbage_collection::cident_sections): New function.
9407 (Garbage_collection::add_cident_section): New function.
9408 (Garbage_collection::cident_sections_): New member.
9409 (gc_process_relocs): Add references to sections whose names are C
9411 * gold.h (cident_section_start_prefix): New constant.
9412 (cident_section_stop_prefix): New constant.
9413 (is_cident): New function.
9414 * layout.cc (Layout::define_section_symbols): Replace string constants
9415 with the newly defined constants.
9416 * object.cc (Sized_relobj::do_layout): Track sections whose names are
9418 * testsuite/Makefile.am: Add gc_orphan_section_test.
9419 * testsuite/Makefile.in: Regenerate.
9420 * testsuite/gc_orphan_section_test.cc: New file.
9421 * testsuite/gc_orphan_section_test.sh: New file.
9423 2010-01-06 Ian Lance Taylor <iant@google.com>
9426 * options.h (class General_options): Add --warn-shared-textrel.
9427 * layout.cc (Layout::finish_dynamic_section): Implement
9428 --warn-shared-textrel.
9431 * options.h (class General_options): Add --warn-multiple-gp.
9433 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9435 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9436 $(THREADSLIB) and $(LIBDL).
9437 * Makefile.in: Rebuild.
9439 2010-01-06 Ian Lance Taylor <iant@google.com>
9442 * options.cc (General_options::parse_section_start): New function.
9443 (General_options::section_start): New function.
9444 (General_options::General_options): Initialize all members.
9445 * options.h: Include <map>
9446 (class General_options): Add --section-start. Add section_starts_
9448 * layout.cc (Layout::attach_allocated_section_to_segment): If
9449 --section-start was used, set the address of the segment. Remove
9450 local sort_sections.
9451 (Layout::relaxation_loop_body): If the address of the load segment
9452 has been set by --section-start, don't use it.
9453 * output.h (Output_segment::update_flags_for_output_section): New
9455 * output.cc (Output_segment::add_output_section): Call
9456 update_flags_for_output_section.
9458 2010-01-05 Ian Lance Taylor <iant@google.com>
9461 * options.h (class General_options): Add --undefined-version.
9462 * script.cc (struct Version_expression): Add was_matched_by_symbol
9464 (Version_script_info::matched_symbol): New function.
9465 (Version_script_info::get_symbol_version_helper): Call
9467 (Version_script_info::check_unmatched_names): New function.
9468 * script.h (class Version_script_info): Update declarations.
9469 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9471 * options.h (class General_options): Use DEFINE_bool_alias for
9472 allow_multiple_definition.
9473 * resolve.cc (Symbol_table::should_override): Don't test
9474 allow_multiple_definition.
9477 * options.h (class General_options): Add --cref.
9478 * main.cc (main): Print cref table if --cref. Don't close mapfile
9479 until after printing cref table.
9480 * cref.cc: Include "symtab.h".
9481 (class Cref_inputs): Define Cref_table_compare and Cref_table.
9482 (Cref_table_compare::operator()): New function.
9483 (Cref_inputs::gather_cref): New function.
9484 (filecol): New static const.
9485 (Cref_inputs::print_cref): New function.
9486 (Cref::print_cref): New function.
9487 * cref.h: Include <cstdio>.
9488 (class Cref): Update declarations.
9489 * mapfile.h (Mapfile::file): New function.
9490 * object.h (class Object): Define Symbols. Declare virtual
9491 do_get_global_symbols.
9492 (Object::get_global_symbols): New function.
9493 * object.cc (Input_objects::add_object): Pass object to cref_ if
9495 (Input_objects::archive_start): Likewise.
9496 (Input_objects::archive_stop): Likewise.
9497 (Input_objects::print_cref): New function.
9498 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9499 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9501 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9503 * plugin.h (class Sized_pluginobj): Update declarations.
9505 2010-01-05 Ian Lance Taylor <iant@google.com>
9507 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9508 to is_default_version. Rename insdef to insdefault.
9509 (Symbol_table::add_from_relobj): Rename def to is_default_version
9510 and local to is_forced_local.
9511 (Symbol_table::add_from_pluginobj): Likewise.
9512 (Symbol_table::add_from_dynobj): Likewise.
9513 (Symbol_table::define_special_symbol): Rename insdef to
9516 2010-01-04 Ian Lance Taylor <iant@google.com>
9519 * options.h (class General_options): Add
9520 --allow-multiple-definition and -z muldefs.
9521 * resolve.cc (Symbol_table::should_override): Don't warn about a
9522 multiple symbol definition if --allow-multiple-definition or -z
9526 * options.h (class General_options): Add --add-needed and
9527 --copy-dt-needed-entries. Tweak --as-needed help entry.
9528 * object.cc (Input_objects::check_dynamic_dependencies): Give an
9529 error if --copy-dt-needed-entries aka --add-needed is used and
9530 would cause a change in behaviour.
9533 * options.h (class General_options): Add -G as a short version of
9534 --shared. Add no-op options -assert, -g, and -i.
9536 2010-01-04 Sriraman Tallam <tmsriram@google.com>
9538 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9539 check for .text or .gnu.linkonce.t sections.
9540 * icf.cc (Icf::find_identical_sections): Ditto.
9541 Change the detection for mangled function name within the section
9543 * icf.h (is_section_foldable_candidate): New function.
9545 2009-12-30 Ian Lance Taylor <iant@google.com>
9548 * options.h (class General_options): Permit two dashes with
9549 --retain-symbols-file.
9551 2009-12-30 Ian Lance Taylor <iant@google.com>
9554 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9555 don't put the file header and segment headers in the text
9559 * common.cc (Sort_commons::operator()): Stabilize sort when both
9561 (Symbol_table::do_allocate_commons_list): When allocating common
9562 symbols, skip a symbol which is no longer common.
9563 * symtab.h (Symbol::is_common): Test whether the symbol comes from
9564 an object before checking its type.
9565 * testsuite/common_test_2.c: New file.
9566 * testsuite/common_test_3.c: New file.
9567 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9568 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9569 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9570 (common_test_2_pic.o, common_test_2.so): New targets.
9571 (common_test_3_pic.o, common_test_3.so): New targets.
9572 * testsuite/Makefile.in: Rebuild.
9575 * script.cc (read_input_script): If we see a new SECTIONS clause,
9576 and we have added an input section, give an error.
9577 * layout.h (class Layout): Add have_added_input_section function.
9578 Add have_added_input_section_ field.
9579 * layout.cc (Layout::Layout): Initialize
9580 have_added_input_section_.
9581 (Layout::layout): Set have_added_input_section_.
9582 (Layout::layout_eh_frame): Likewise.
9584 2009-12-30 Ian Lance Taylor <iant@google.com>
9587 * options.h (class General_options): Add --sort-common option.
9588 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9589 * common.cc (Sort_common): Add sort_order parameter to
9590 constructor. Add sort_order_ field.
9591 (Sort_commons::operator): Check sort_order_.
9592 (Symbol_table::allocate_commons): Determine the sort order.
9593 (Symbol_table::do_allocate_commons): Add sort_order parameter.
9595 (Symbol_table::do_allocate_commons_list): Likewise.
9597 2009-12-30 Ian Lance Taylor <iant@google.com>
9600 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9601 symbols from this object, don't change the visibility of an
9603 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9605 2009-12-30 Ian Lance Taylor <iant@google.com>
9608 * script.h (class Version_script_info): Define Language enum.
9609 Update declarations. Define Glob, Exact, and Lookup types. Add
9610 new fields globals_, locals_, and is_finalized_.
9611 * script.cc: Various formatting fixes.
9612 (class Parser_closure): Change language_stack_ from a vector of
9613 std::string to one of Version_script_info::Language. Adjust all
9615 (class Lazy_demangler): Remove.
9616 (struct Version_expression): Change language from std::string to
9617 Version_script_info::Language.
9618 (Version_script_info::Version_script_info): New function.
9619 (Version_script_info::~Version_script_info): Don't call clear.
9620 (Version_script_info::finalize): New function.
9621 (Version_script_info::build_lookup_tables): New function.
9622 (Version_script_info::build_expression_list_lookup): New
9624 (Version_script_info::get_symbol_version_helper): Rewrite to use
9626 (Version_script_info::print_expression_list): Adjust to use
9627 Version_script_info::Language.
9628 (script_push_lex_into_version_mode): Check that the version script
9629 has not been finalized.
9630 (version_script_push_lang): Change language string to
9631 Version_script_info::Language.
9632 * options.cc (Command_line::version_script): New function.
9633 * options.h (class General_options): Add finalize_dynamic_list
9634 function. Change version_script from declaration to definition.
9635 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9636 * testsuite/version_script.map: Remove duplicate def of foo.
9637 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9639 * testsuite/Makefile.in: Rebuild.
9641 2009-12-30 Ian Lance Taylor <iant@google.com>
9644 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9645 if the input symbol index is 0, make the output symbol index 0.
9647 2009-12-30 Ian Lance Taylor <iant@google.com>
9650 * options.h (class General_options): Add -x/--discard-all.
9651 * object.cc (Sized_relobj::do_count_local_symbols): Handle
9652 --discard-all. If the local symbol needs a dynamic entry, check
9653 that before handling --discard-locals.
9655 2009-12-30 Ian Lance Taylor <iant@google.com>
9658 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9660 (Output_segment::add_output_section): Don't change the flags if
9664 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9665 GNU hash table if they need a dynamic value. Otherwise, don't add
9666 them if they are defined in a dynamic object or are forced local.
9668 2009-12-29 Ian Lance Taylor <iant@google.com>
9671 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9672 .gnu.hash table for a 32-bit target.
9675 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9676 regular and a dynamic object only needs a dynamic symbol table
9677 entry if it is externally visible.
9680 * i386.cc (class Target_i386): Initialize global_offset_table_ in
9681 constructor. Add global_offset_table_ field.
9682 (Target_i386::got_section): Set global_offset_table_.
9683 (Target_i386::do_finalize_sections): Set global_offset_table_
9685 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9686 in constructor. Add global_offset_table_ field.
9687 (Target_x86_64::got_section): Set global_offset_table_.
9688 (Target_x86_64::do_finalize_sections): Set global_offset_table_
9691 * layout.cc (Layout::Layout): Initialize increase_relro_.
9692 (Layout::get_output_section): Add is_relro, is_last_relro, and
9693 is_first_non_relro parameters. Change all callers.
9694 (Layout::choose_output_section): Likewise.
9695 (Layout::add_output_section_data): Likewise.
9696 (Layout::make_output_section): Likewise.
9697 (Layout::set_segment_offsets): Clear increase_relro when using a
9699 * layout.h (class Layout): Add increase_relro method. Add
9700 increase_relro_ field. Update declarations.
9701 * output.cc (Output_section::Output_section): Initialize
9702 is_last_relro_ and is_first_non_relro_.
9703 (Output_segment::add_output_section): Group relro sections is
9704 do_sort is true. Handle is_last_relro and is_first_non_relro.
9705 (Output_segment::maximum_alignment): Remove relro handling.
9706 (Output_segment::set_section_addresses): Add increase_relro
9707 parameter. Change all callers. Add initial alignment to align
9708 relro sections on separate page. Remove old relro handling.
9709 (Output_segment::set_section_list_addresses): Remove in_relro
9710 parameter. Change all callers.
9711 (Output_segment::set_offset): Add increase parameter. Change all
9712 callers. Remove old relro handling.
9713 * output.h (class Output_section): Add new methods: is_last_relro,
9714 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9715 Add is_last_relro_ and is_first_non_relro_ fields.
9716 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9717 Create separate .got.plt section. Call increase_relro.
9718 * x86_64.cc (Target_x86_64::got_section): Likewise.
9719 * testsuite/relro_script_test.t: Add .got.plt.
9722 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9723 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9724 (Layout::finalize): Call set_dynamic_symbol_size.
9725 (Layout::set_dynamic_symbol_size): New function.
9726 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
9727 set_dynamic_symbol_size.
9730 * output.h (class Output_section): Add is_entsize_zero_ field.
9731 * output.cc (Output_section::Output_section): Initialize
9733 (Output_section::set_entsize): If two different entsizes are
9734 requested, force it to zero.
9735 (Output_section::add_input_section): Set flags for .debug_str
9736 before updating section flags. Set entsize.
9737 (Output_section::update_flags_for_input_section): Set SHF_MERGE
9738 and SHF_STRING if all input sections have those flags.
9740 2009-12-29 Rafael Espindola <espindola@google.com>
9742 * main.cc (main): Fix the sys time reporting.
9743 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9746 2009-12-29 Sriraman Tallam <tmsriram@google.com>
9748 * options.cc (General_options::parse_version): Allow -v to exit
9749 without an error if there is nothing to link.
9751 2009-12-29 Ian Lance Taylor <iant@google.com>
9753 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9754 using a version of gcc before 4.1.
9755 * configure: Rebuild.
9757 2009-12-28 Chris Demetriou <cgd@google.com>
9759 * attributes.cc (Output_attributes_section_data::do_write): Use
9760 std::vector::front rather than std::vector::data.
9762 2009-12-28 Ian Lance Taylor <iant@google.com>
9764 * symtab.h (class Symbol_table): Add enum Defined.
9765 * resolve.cc (Symbol_table::should_override): Add defined
9766 parameter. Change all callers. Test whether object is NULL
9767 before calling a method on it.
9768 (Symbol_table::report_resolve_problem): Add defined parameter.
9770 (Symbol_table::should_override_with_special): Likewise.
9771 * symtab.cc (Symbol_table::define_in_output_data): Add defined
9772 parameter. Change all callers.
9773 (Symbol_table::do_define_in_output_data): Likewise.
9774 (Symbol_table::define_in_output_segment): Likewise.
9775 (Symbol_table::do_define_in_output_segment): Likewise.
9776 (Symbol_table::define_as_constant): Likewise.
9777 (Symbol_table::do_define_as_constant): Likewise.
9778 * script.h (class Symbol_assignment): Add is_defsym parameter to
9779 constructor; change all callers.
9780 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9781 parameter. Change all callers. Add is_defsym_ field.
9782 (class Parser_closure): Add parsing_defsym parameter to
9783 constructor; change all callers. Add parsing_defsym accessor
9784 function. Add parsing_defsym_ field.
9786 2009-12-28 Ian Lance Taylor <iant@google.com>
9788 * gold.cc (queue_middle_tasks): Fix formatting.
9789 * object.cc (Relobj::is_section_name_included): Likewise.
9791 2009-12-23 Ian Lance Taylor <iant@google.com>
9793 * i386.cc (Target_i386::do_calls_non_split): Recognize
9794 -fsplit-stack prologue for a function with a static chain.
9795 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9796 -fsplit-stack prologue when using %r11.
9798 2009-12-21 Sriraman Tallam <tmsriram@google.com>
9800 * options.cc (General_options::parse_version): Make -v continue and do
9801 the link like GNU ld does.
9803 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
9805 * Makefile.am (CCFILES): Add timer.cc.
9806 (HFILES): Add timer.h.
9807 * configure.ac: Check for sysconf and times.
9808 * main.cc: include timer.h.
9809 (main): Use Timer instead of get_run_time.
9812 * workqueue.cc: include timer.h.
9813 (Workqueue::find_and_run_task):
9814 Report user, sys and wall time.
9815 * Makefile.in: Regenerate.
9816 * config.in: Regenerate.
9817 * configure: Regenerate.
9819 2009-12-16 Doug Kwan <dougkwan@google.com>
9821 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9823 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9824 relaxed input sections.
9825 * output.cc (Output_section::find_relaxed_input_section): Change
9826 return type to Output_relaxed_input_section pointer. Adjust code
9827 for new type of relaxed_input_section_map_.
9828 * output.h (Output_section::find_relaxed_input_section): Change
9829 return type to Output_relaxed_input_section pointer.
9830 (Output_section::Output_relaxed_input_section_by_input_section_map):
9832 (Output_section::relaxed_input_section_map_): Change type to
9833 Output_section::Output_relaxed_input_section_by_input_section_map.
9834 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9837 2009-12-15 Ian Lance Taylor <iant@google.com>
9839 * layout.cc (Layout::create_shstrtab): Only write out after input
9840 sections if we are compressing debug sections.
9842 2009-12-15 Ian Lance Taylor <iant@google.com>
9844 * archive.cc (Archive::add_symbols): Only look up a symbol without
9845 a version if there is, in fact, a version.
9847 2009-12-14 Ian Lance Taylor <iant@google.com>
9849 Revert -Wshadow changes, all changes from:
9850 2009-12-11 Doug Kwan <dougkwan@google.com>
9851 2009-12-11 Nick Clifton <nickc@redhat.com>
9852 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9854 2009-12-11 Doug Kwan <dougkwan@google.com>
9856 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9858 * attributes.cc (Object_attribute::size): Ditto.
9859 (Attributes_section_data::size): Ditto.
9860 (Attributes_section_data::Attributes_section_data): Ditto.
9861 (Output_attributes_section_data::do_write): Ditto.
9862 * attributes.h (Object_attribute::set_type): Ditto.
9863 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9865 2009-12-11 Nick Clifton <nickc@redhat.com>
9867 * archive.cc: Fix shadowed variable warnings.
9869 * compressed_output.cc: Likewise.
9870 * compressed_output.h: Likewise.
9871 * configure: Likewise.
9872 * dwarf_reader.cc: Likewise.
9873 * dynobj.cc: Likewise.
9874 * dynobj.h: Likewise.
9875 * ehframe.cc: Likewise.
9876 * ehframe.h: Likewise.
9877 * errors.cc: Likewise.
9878 * expression.cc: Likewise.
9879 * fileread.cc: Likewise.
9880 * fileread.h: Likewise.
9881 * freebsd.h: Likewise.
9882 * i386.cc: Likewise.
9884 * incremental.h: Likewise.
9885 * layout.cc: Likewise.
9886 * layout.h: Likewise.
9887 * mapfile.cc: Likewise.
9888 * merge.cc: Likewise.
9889 * merge.h: Likewise.
9890 * object.cc: Likewise.
9891 * object.h: Likewise.
9892 * options.h: Likewise.
9893 * output.cc: Likewise.
9894 * output.h: Likewise.
9895 * parameters.cc: Likewise.
9896 * plugin.cc: Likewise.
9897 * powerpc.cc: Likewise.
9898 * reduced_debug_output.cc: Likewise.
9899 * reduced_debug_output.h: Likewise.
9900 * reloc.cc: Likewise.
9901 * reloc.h: Likewise.
9902 * resolve.cc: Likewise.
9903 * script-sections.cc: Likewise.
9904 * script.cc: Likewise.
9905 * script.h: Likewise.
9906 * sparc.cc: Likewise.
9907 * symtab.cc: Likewise.
9908 * symtab.h: Likewise.
9909 * target-select.cc: Likewise.
9910 * target-select.h: Likewise.
9911 * token.h: Likewise.
9912 * workqueue.cc: Likewise.
9913 * workqueue.h: Likewise.
9914 * x86_64.cc: Likewise.
9916 2009-12-10 Doug Kwan <dougkwan@google.com>
9918 * arm.cc (attributes.h): New include.
9919 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9920 (Arm_relobj::~Arm_relobj): Delete object pointed by
9921 attributes_section_data_.
9922 (Arm_relobj::attributes_section_data): New method definition.
9923 (Arm_relobj::attributes_section_data_): New data member declaration.
9924 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9925 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9926 attributes_section_data_.
9927 (Arm_dynobj::attributes_section_data): New method definition.
9928 (Arm_dynobj::attributes_section_data_): New data member declaration.
9929 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
9930 initialization value of may_use_blx_ to false.
9931 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9932 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9933 object attributes to compute results instead of hard-coding.
9934 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9935 Target_arm::get_secondary_compatible_arch,
9936 Target_arm::set_secondary_compatible_arch
9937 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9938 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9939 New method declarations.
9940 (Target_arm::get_aeabi_object_attribute): New method definition.
9941 (Target_arm::attributes_section_data_): New data member declaration.
9942 (read_arm_attributes_section): New template definition.
9943 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9944 (Arm_dynobj::do_read_symbols): Ditto.
9945 (Target_arm::do_finalize_sections): Merge attributes sections from
9946 input. Check for BLX use after attributes section merging.
9947 Fix __exidx_start and __exidx_end visibility. Create an
9948 .ARM.attributes section if necessary.
9949 (Target_arm::get_secondary_compatible_arch,
9950 Target_arm::set_secondary_compatible_arch,
9951 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9952 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9953 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9954 New method definitions.
9956 2009-12-09 Ian Lance Taylor <iant@google.com>
9958 * plugin.cc (Plugin::load): Don't cast from void* to a function
9961 2009-12-09 Ian Lance Taylor <iant@google.com>
9963 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9966 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
9968 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9969 Replace two_file_shared_1.so with two_file_shared_2.so.
9970 * testsuite/Makefile.in: Regenerated.
9972 2009-12-08 Doug Kwan <dougkwan@google.com>
9974 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9975 (HFILES): Add attributes.h and int_encoding.h.
9976 * Makefile.in: Regenerate.
9977 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9978 function definitions to int_encoding.cc
9979 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9980 prototypes to int_encoding.h
9981 * reduced_debug_output.cc (int_encoding.h): New include.
9982 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9983 function definitions to int_encoding.cc
9984 (insert_into_vector, read_from_pointer): Move template definitions to
9986 * attributes.cc: New file.
9987 * attributes.h: New file.
9988 * int_encoding.cc: New file.
9989 * int_encoding.h: New file.
9991 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
9994 * incremental-dump.cc (dump_incremental_inputs): New.
9995 (main): Use dump_incremental_inputs.
9997 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
10000 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10001 checking elfcpp::STT_FUNC.
10002 (Target_i386::Relocate::relocate): Likewise.
10003 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10005 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10006 symbols from shared libraries into normal FUNC symbols.
10008 * symtab.h (Symbol): Add is_func and use it.
10010 2009-12-05 Doug Kwan <dougkwan@google.com>
10012 * arm.cc (Target_arm::arm_info): Initialize new fields
10013 attributes_section and attributes_vendor.
10014 * i386.cc (Target_i386::i386_info): Same.
10015 * object.cc (Sized_relobj::do_layout): Skip attribute section.
10016 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10017 fields attributes_section and attributes_vendor.
10018 * sparc.cc (Target_sparc::sparc_info): Same.
10019 * target.h (Target::attributes_section, Target::attributes_vendor,
10020 Target::is_attributes_section, Target::attribute_arg_type,
10021 Target::attributes_order): New method definitions.
10022 (Target::Target_info::attributes_section,
10023 Target::Target_info::attributes_vendor): New fields.
10024 (Target::do_attribute_arg_type, Target::do_attributes_order): New
10025 virtual method definitions.
10026 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10027 attributes_section and attributes_vendor.
10028 * testsuite/testfile.cc (Target_test::test_target_info): Same.
10030 2009-12-05 Doug Kwan <dougkwan@google.com>
10032 * arm.cc: Update comments about interworking and stub generation.
10033 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10034 considered as non-PIC.
10035 (Arm_relocate_functions::base_abs): Fix formatting.
10036 (Arm_relocate_functions::got_prel): Fix comment. Change interface
10037 of function to use GOT entry address instead of offset.
10038 (Target_arm::Scan::global): Issue an error if a symbol would need a
10039 PLT does not get one because it is untyped. Remove code to create
10040 dynamic symbols for relative branches.
10041 (Target_arm::Relocate::relocate: Use 0 instead of false since function
10042 takes unsigned integer instead of boolean.
10044 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
10046 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10047 (two_file_test_LDADD): Likewise.
10048 (common_test_1_LDADD): Likewise.
10049 (exception_test_LDADD) Likewise.
10050 (weak_test_LDADD): Likewise.
10051 (many_sections_test_LDADD): Likewise.
10052 (initpri1_LDADD): Likewise.
10053 (script_test_1_LDADD): Likewise.
10054 (script_test_2_LDADD): Likewise.
10055 (justsyms_LDADD): Likewise.
10056 (binary_test_LDADD): Likewise.
10057 (large_LDADD): Likewise.
10058 * testsuite/Makefile.in: Regenerated.
10060 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
10062 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10063 (Symbol_table::override_with_special): Likewise.
10064 (Symbol_table::add_from_object): Likewise.
10066 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
10068 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10069 Don't set the data_offset twice.
10071 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
10073 * testsuite/Makefile.in: Regenerate.
10075 2009-12-03 Doug Kwan <dougkwan@google.com>
10077 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10078 (Target_arm::do_finalize_sections): Add parameter for symbol table
10079 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
10080 * i386.cc (Target_i386::do_finalize_sections): Add an additional
10081 parameter for symbol table pointer.
10082 * layout.cc (Layout::finalize): Call Target::finalize_sections with
10083 an additional parameter for a pointer to symbol table.
10084 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10085 parameter for a symbol table pointer.
10086 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10087 * target.h (Target::finalize_sections, Target::do_finalize_sections):
10089 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10090 parameter for a symbol table pointer.
10092 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
10094 * incremental.cc (Incremental_inputs_header)
10095 (Incremental_inputs_header_write, Incremental_inputs_entry)
10096 (Incremental_inputs_entry_write): Move ...
10097 * incremental.h (Incremental_inputs_header)
10098 (Incremental_inputs_header_write, Incremental_inputs_entry)
10099 (Incremental_inputs_entry_write): here.
10101 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10103 * incremental.cc (make_sized_incremental_binary): Set the target.
10104 Error if it is incompatible.
10105 * output.h (Output_file): Add filename method.
10107 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10109 * incremental.cc (Incremental_inputs_entry): Remove unused argument
10110 from the get_* methods.
10112 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10114 * incremental-dump.cc (main): Check that the offeset of a script is 0.
10115 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10116 Write 0 for the data_offset of scripts.
10118 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10120 * testsuite/Makefile.am: Add the incremental_test.sh test.
10121 * testsuite/incremental_test.sh: New.
10122 * testsuite/incremental_test_1.c: New.
10123 * testsuite/incremental_test_2.c: New.
10125 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
10127 * incremental-dump.cc (main): Fix typos.
10129 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
10132 * incremental-dump.cc (main): Use llu to print 64 bit values.
10134 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
10135 H.J. Lu <hongjiu.lu@intel.com>
10137 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10139 (incremental_dump_LDADD): Likewise.
10140 * Makefile.in: Regenerated.
10142 2009-11-25 Doug Kwan <dougkwan@google.com>
10146 2009-11-25 Doug Kwan <dougkwan@google.com>
10148 * arm.cc (Target_arm::Target_arm): Move method definition
10149 outside of class definition. Add code to handle
10150 --target1-rel, --target1-abs and --target2= options.
10151 (Target_arm::get_reloc_reloc_type): Change method to be
10152 non-static and const.
10153 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10154 New data member declaration.
10155 (Target_arm::Scan::local, Target_arm::Scan::global,
10156 Target_arm::Relocate::relocate,
10157 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10158 Adjust call to Target_arm::get_real_reloc_type.
10159 (Target_arm::get_real_reloc_type): Use command line options
10160 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10161 * options.h (--target1-rel, --target1-abs, --target2): New
10164 2009-11-25 Doug Kwan <dougkwan@google.com>
10166 * arm.cc (Target_arm::Target_arm): Move method definition outside of
10167 class definition. Add code to handle --target1-rel, --target1-abs
10168 and --target2= options.
10169 (Target_arm::get_reloc_reloc_type): Change method to be non-static
10171 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10172 member declaration.
10173 (Target_arm::Scan::local, Target_arm::Scan::global,
10174 Target_arm::Relocate::relocate,
10175 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10176 call to Target_arm::get_real_reloc_type.
10177 (Target_arm::get_real_reloc_type): Use command line options to
10178 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10179 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10182 2009-11-25 Doug Kwan <dougkwan@google.com>
10184 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10185 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10186 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10188 (Arm_relocate_functions::thm_call): Replace body with a call to
10189 Arm_relocate_functions::thumb_branch_common.
10190 (Arm_relocate_functions::thm_jump24,
10191 Arm_relocate_functions::thm_xpc22): New method definitions.
10192 (Arm_relocate_functions::thumb_branch_common): New method definition.
10193 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10195 (Target_arm::Relocate::relocate): Adjust call to thm_call.
10196 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10198 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10200 * Makefile.am: Build incremental-dump
10201 * Makefile.in: Regenerate.
10202 * incremental-dump.cc: New.
10203 * incremental.cc (Incremental_inputs_header_data,
10204 Incremental_inputs_entry_data): Move to incremental.h
10205 * incremental.h: (Incremental_inputs_header_data,
10206 Incremental_inputs_entry_data): Move from incremental.cc
10208 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10210 * incremental.cc (Incremental_inputs_header,
10211 Incremental_inputs_header_write, Incremental_inputs_entry,
10212 Incremental_inputs_entry_write): Add a typedef with the data type.
10214 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10216 * incremental.cc (Incremental_inputs_header,
10217 Incremental_inputs_header_write, Incremental_inputs_entry,
10218 Incremental_inputs_entry_write): Update comment about which
10219 type has the filed descriptions.
10221 2009-11-15 Doug Kwan <dougkwan@google.com>
10223 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10224 (Arm_relocate_functions::arm_branch_common): Change method defintion
10225 in class definition to a method declaration and update list of formal
10227 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10228 Arm_relocation_functions::jump24): Adjust call to
10229 Arm_relocate_functions::arm_branch_common. Update list of formal
10231 (Arm_relocate_functions::xpc25): New method definition.
10232 (Arm_relocate_functions::arm_branch_common): Move method defintion
10233 out from class definition. Use stubs for mode-switching and extending
10235 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10236 specially. Change code to enable use of stubs in ARM branches.
10238 2009-11-10 Doug Kwan <dougkwan@google.com>
10240 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10241 in method declaration.
10242 (Target_arm::relocate_stub): New method declaration.
10243 (Target_arm::default_target): Change to return a pointer instead of
10245 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10246 Target_arm::default_target.
10247 (Arm_Relobj::do_relocate_sections): Remove options paramater in
10249 (Target_arm::relocate_section): Adjust view.
10250 (Target_arm::relocate_stub): New method definition.
10252 2009-11-10 Doug Kwan <dougkwan@google.com>
10254 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10256 * incremental.cc (open_incremental_binary): Initialized local
10257 variables to avoid warnings.
10258 * object.cc (make_elf_object): Ditto.
10259 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10262 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
10265 * testsuite/plugin_test.c: Include "config.h".
10267 2009-11-09 Doug Kwan <dougkwan@google.com>
10269 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10270 (arm_symbol_value): Remove.
10271 (Arm_relocate_functions::arm_branch_common,
10272 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10273 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10274 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10275 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10276 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10277 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10278 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10279 Arm_relocate_functions::thm_mobw_abs_nc,
10280 Arm_relocate_functions::thm_mov_abs,
10281 Arm_relocate_functions::movw_prel_nc,
10282 Arm_relocate_functions::thm_movt_abs,
10283 Arm_relocate_functions::movt_prel,
10284 Arm_relocate_functions::thm_movw_prel_nc,
10285 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10286 (Target_arm::Relocate::relocate): Only decompose address into two
10287 parts if relocation type uses the thumb-bit and pass the actual
10288 bit instead of a flag indicating that the thumb-bit is used. Adjust
10289 calls to methods in Arm_relocate_functions for this change.
10291 2009-11-08 Ian Lance Taylor <iant@google.com>
10294 * reloc.cc: Instantiate
10295 Sized_relobj::initialize_input_to_output_maps and
10296 Sized_relobj:free_input_to_output_maps.
10298 2009-11-06 Ian Lance Taylor <iant@google.com>
10301 * defstd.cc (in_segment): Set only_if_ref true for "end".
10303 2009-11-06 Doug Kwan <dougkwan@google.com>
10305 * arm.cc (class Reloc_stub): Correct a comment.
10306 (Target_arm::Target_arm): Initialize arm_input_section_map_.
10307 (Target_arm::scan_section_for_stubs): New method declaration.
10308 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10309 Change methods from private to protected.
10310 (Target_arm::do_may_relax): New method definition.
10311 (Target_arm::do_relax, Target_arm::group_sections,
10312 Target_arm::scan_reloc_for_stub,
10313 Target_arm::scan_reloc_section_for_stubs): New method declarations.
10314 (Target_arm::arm_input_section_map_): New data member declaration.
10315 (Target_arm::scan_reloc_for_stub,
10316 Target_arm::scan_reloc_section_for_stubs,
10317 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10318 Target_arm::do_relax): New method definitions.
10320 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
10322 * configure.ac: Check for (struct stat)::st_mtim
10323 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10324 * config.in: Regenerate.
10325 * configure: Regenerate.
10327 2009-11-05 Ian Lance Taylor <iant@google.com>
10330 * output.cc (Output_segment::add_output_section): Add missing
10333 2009-11-04 Ian Lance Taylor <iant@google.com>
10336 * object.h (class Object): Add is_needed and set_is_needed
10337 methods. Add is_needed_ field. Make bool fields into bitfields.
10338 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10339 defined in a dynamic object and referenced by a regular object,
10340 set is_needed for the dynamic object.
10341 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10342 if the file is marked with as_needed and it is not needed.
10344 2009-11-04 Ian Lance Taylor <iant@google.com>
10347 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10348 tags if data is discarded by linker script.
10349 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10350 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10351 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10352 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10354 2009-11-04 Ian Lance Taylor <iant@google.com>
10356 * layout.cc (Layout::get_output_section): Add is_interp and
10357 is_dynamic_linker_section parameters. Change all callers.
10358 (Layout::choose_output_section): Likewise.
10359 (Layout::make_output_section): Likewise.
10360 (Layout::add_output_section_data): Add is_dynamic_linker_section
10361 parameter. Change all callers.
10362 * layout.h (class Layout): Update declarations.
10363 * output.h (class Output_section): Add is_interp, set_is_interp,
10364 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10365 Add is_interp_, is_dynamic_linker_section_ fields. Change
10366 generate_code_fills_at_write_ to a bitfield.
10367 * output.cc (Output_section::Output_sections): Initialize new
10369 (Output_segment::add_output_section): Add do_sort parameter.
10370 Change all callers.
10372 2009-11-03 Ian Lance Taylor <iant@google.com>
10375 * options.h (class General_options): Add --warn-common.
10376 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10377 merging two common symbols.
10378 (Symbol_table::should_override): Handle --warn-common when merging
10379 a common symbol with a defined symbol. Use report_resolve_problem
10380 for multiple definitions.
10381 (Symbol_table::report_resolve_problem): New function.
10382 * symtab.h (class Symbol_table): Declare report_resolve_problem.
10384 2009-11-03 Doug Kwan <dougkwan@google.com>
10386 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10388 (Target_arm::stub_factory): New method definition.
10389 (Target_arm::new_arm_input_section,
10390 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10391 Target_arm::reloc_uses_thumb_bit): New method declarations.
10392 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10393 New type definitions.
10394 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10395 member declarations.
10396 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10397 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10398 New method definitions.
10400 2009-11-03 Ian Lance Taylor <iant@google.com>
10402 * options.h (class General_options): Add --warn_constructors.
10404 2009-11-03 Ian Lance Taylor <iant@google.com>
10407 * defstd.cc (in_section): Add entries for __rel_iplt_start,
10408 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10410 2009-11-03 Ian Lance Taylor <iant@google.com>
10413 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10414 --msgid-bugs-address.
10415 (install-pdf): New target.
10416 (install-data_yes): Look up one directory to find mkinstalldirs.
10418 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
10420 * po/Make-in (.po.gmo): Don't generate .gmo files in source
10423 2009-10-30 Doug Kwan <dougkwan@google.com>
10425 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10427 2009-10-30 Doug Kwan <dougkwan@google.com>
10429 * arm.cc (Stub_addend_reader): New struct template definition
10430 and partial specializations.
10431 (Stub_addend_reader::operator()): New method definition for a
10432 partially specialized template.
10434 2009-10-30 Doug Kwan <dougkwan@google.com>
10436 * arm.cc (Arm_relobj::processor_specific_flags): New method
10438 (Arm_relobj::do_read_symbols): New method declaration.
10439 (Arm_relobj::processor_specific_flags_): New data member declaration.
10440 (Arm_dynobj): New class definition.
10441 (Target_arm::do_finalize_sections): Add input_objects parameter.
10442 (Target_arm::do_adjust_elf_header): New method declaration.
10443 (Target_arm::are_eabi_versions_compatible,
10444 (Target_arm::merge_processor_specific_flags): New method declaration.
10445 (Target_arm::do_make_elf_object): New overloaded method definitions
10447 (Arm_relobj::do_read_symbols): New method definition.
10448 (Arm_dynobj::do_read_symbols): Ditto.
10449 (Target_arm::do_finalize_sections): Add input_objects parameters.
10450 Merge processor-specific flags from all input objects.
10451 (Target_arm::are_eabi_versions_compatible,
10452 Target_arm::merge_processor_specific_flags,
10453 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10454 New method definitions.
10455 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10456 Input_objects pointer type parameter.
10457 * layout.cc (Layout::finalize): Pass input objects to target's.
10458 finalize_sections function.
10459 * output.cc (Output_file_header::do_sized_write): Set ELF file
10460 header's processor-specific flags.
10461 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10462 Input_objects pointer type parameter.
10463 * sparc.cc (Target_sparc::do_finalize_sections): Same.
10464 * target.h (Input_objects): New forward class declaration.
10465 (Target::processor_specific_flags,
10466 Target::are_processor_specific_flags_sect): New method definitions.
10467 (Target::finalize_sections): Add input_objects parameter.
10468 (Target::Target): Initialize processor_specific_flags_ and
10469 are_processor_specific_flags_set_.
10470 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10472 (Target::set_processor_specific_flags): New method definition.
10473 (Target::processor_specific_flags_,
10474 Target::are_processor_specific_flags_set_): New data member
10476 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10477 Input_objects pointer type parameter.
10479 2009-10-30 Doug Kwan <dougkwan@google.com>
10481 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10483 2009-10-28 Ian Lance Taylor <iant@google.com>
10485 * object.h (class Relobj): Drop options parameter from
10486 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10487 do_scan_relocs, do_relocate. Change all callers.
10488 (class Sized_relobj): Drop options parameters from
10489 do_gc_process_relocs, do_scan_relocs, do_relocate,
10490 do_relocate_sections, relocate_sections, emit_relocs_scan,
10491 emit_relocs_scan_reltype. Change all callers.
10492 (struct Relocate_info): Remove options field and all references to
10494 * reloc.h (class Read_relocs): Remove options constructor
10495 parameter and options_ field. Change all callers.
10496 (class Gc_process_relocs, class Scan_relocs): Likewise.
10497 (class Relocate_task): Likewise.
10498 * target-reloc.h (scan_relocs): Remove options parameter. Change
10500 (scan_relocatable_relocs): Likewise.
10501 * target.h (class Sized_target): Remove options parameter from
10502 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
10504 * gc.h (gc_process_relocs): Remove options parameter. Change all
10506 * arm.cc: Update functions to remove options parameters.
10507 * i386.cc: Likewise.
10508 * powerpc.cc: Likewise.
10509 * sparc.cc: Likewise.
10510 * x86_64.cc: Likewise.
10511 * testsuite/testfile.cc: Likewise.
10513 2009-10-28 Doug Kwan <dougkwan@google.com>
10515 * arm.cc (Arm_relobj): New class definition.
10516 (Arm_relobj::scan_sections_for_stubs,
10517 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10518 New method definitions.
10520 2009-10-28 Cary Coutant <ccoutant@google.com>
10522 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10523 (Plugin::cleanup_done_): New member.
10524 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10525 (Plugin_manager::cleanup_done_): Remove.
10526 (Plugin_manager::add_input_file): Edit error message.
10527 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10528 (Plugin_manager::cleanup): Remove use of cleanup_done_.
10530 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
10532 * fileread.cc: (File_read::View::~View): Use the new
10533 data_ownership_ filed.
10534 (File_read::~File_read): Dispose the new whole_file_view_.
10535 (File_read::open): Mmap the whole file if needed.
10536 (File_read::open): Use whole_file_view_ instead of contents_.
10537 (File_read::find_view): Use whole_file_view_ if applicable.
10538 (File_read::do_read): Use whole_file_view_ instead of contents_.
10539 (File_read::make_view): Use whole_file_view_ instead of contents_,
10540 update File_read::View::View call.
10541 (File_read::find_or_make_view): Update File_read::View::View
10543 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10545 (File_read::View::Data_ownership): New enum.
10546 (File_read::View::View): Replace bool mapped_ with Data_ownership
10548 (File_read::View::mapped_): Remove (replaced by data_ownership_).
10549 (File_read::View::data_ownership_): New field.
10550 (File_read::contents_): Remove (replaced by whole_file_view_).
10551 (File_read::whole_file_view_): New field.
10552 * options.h (class General_options): Add --keep-files-mapped.
10554 2009-10-27 Cary Coutant <ccoutant@google.com>
10556 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10557 * testsuite/Makefile.am (plugin_test_5): New test case.
10558 * testsuite/Makefile.in: Regenerate.
10560 2009-10-25 Doug Kwan <dougkwan@google.com>
10562 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10563 from private to protected to allow access by child class.
10564 (Sized_relobj::do_relocate_sections): New method declaration.
10565 (Sized_relobj::relocate_sections): Virtualize.
10566 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10567 Sized_relobj::relocate_sections. Instantiate template explicitly
10568 for different target sizes and endianity.
10570 2009-10-24 Doug Kwan <dougkwan@google.com>
10572 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10573 (Arm_input_section::as_arm_input_section): New method.
10574 (Arm_output_section): New class definition.
10575 (Arm_output_section::create_stub_group,
10576 Arm_output_section::group_sections): New method definitions.
10578 2009-10-22 Doug Kwan <dougkwan@google.com>
10580 * arm.cc (Arm_input_section): New class definition.
10581 (Arm_input_section::init, Arm_input_section:do_write,
10582 Arm_input_section::set_final_data_size,
10583 Arm_input_section::do_reset_address_and_file_offset): New method
10586 2009-10-21 Doug Kwan <dougkwan@google.com>
10588 * arm.cc (Stub_table, Arm_input_section): New forward class
10590 (Stub_table): New class defintion.
10591 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10592 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10593 New method definition.
10595 2009-10-21 Doug Kwan <dougkwan@google.com>
10597 * arm.cc: Update copyright comments.
10598 (Target_arm): New forward class template declaration.
10599 (Arm_address): New type.
10600 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10601 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10602 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10604 (Insn_template): Same.
10605 (DEF_STUBS): New macro.
10606 (Stub_type): New enum type.
10607 (Stub_template): New class definition.
10609 (Reloc_stub): Same.
10610 (Stub_factory): Same.
10611 (Target_arm::Target_arm): Initialize may_use_blx_ and
10612 should_force_pic_veneer_.
10613 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10614 Target_arm::should_force_pic_veneer,
10615 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10616 Target_arm::using_thumb_only, Target_arm:;default_target): New
10618 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10619 New data member declarations.
10620 (Insn_template::size, Insn_template::alignment): New method defintions.
10621 (Stub_template::Stub_template): New method definition.
10622 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10623 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10624 (Stub_factory::Stub_factory): New method definition.
10625 * gold.h (string_hash): New template.
10626 * output.h (Input_section_specifier::hash_value): Use
10628 (Input_section_specifier::string_hash): Remove.
10629 * stringpool.cc (Stringpool_template::string_hash): Use
10632 2009-10-20 Doug Kwan <dougkwan@google.com>
10634 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10635 symbols of relaxed input sections.
10636 * output.h (Output_section::find_relaxed_input_section): Make
10639 2009-10-16 Doug Kwan <dougkwan@google.com>
10641 * dynobj.cc (Versions::Versions): Initialize version_script_.
10642 Only insert base version symbol definition for a shared object
10643 if version script defines any version versions.
10644 (Versions::define_base_version): New method definition.
10645 (Versions::add_def): Check that base version is not needed.
10646 (Versions::add_need): Define base version lazily.
10647 * dynobj.h (Versions::define_base_version): New method declaration.
10648 (Versions::needs_base_version_): New data member declaration.
10649 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10650 (check_DATA): Add no_version_test.stdout.
10651 (libno_version_test.so, no_version_test.o no_version_test.stdout):
10653 * testsuite/Makefile.in: Regenerate.
10654 * testsuite/no_version_test.c: New file.
10655 * testsuite/no_version_test.sh: Ditto.
10657 2009-10-16 Doug Kwan <dougkwan@google.com>
10659 * expression.cc (class Segment_start_expression): New class definition.
10660 (Segment_start_expression::value): New method definition.
10661 (script_exp_function_segment_start): Return a new
10662 Segment_start_expression.
10663 * gold/script-c.h (script_saw_segment_start_expression): New function
10665 * script-sections.cc (Script_sections::Script_sections): Initialize
10666 SAW_SEGMENT_START_EXPRESSION_ to false.
10667 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10668 and -Tbbs options to specify section addresses if given in
10669 command line and no SEGMENT_START expression is seen in a script.
10670 * script-sections.h (Script_sections::saw_segment_start_expression,
10671 Script_sections::set_saw_segment_start_expression): New method
10673 (Script_sections::saw_segment_start_expression_): New data member
10675 * script.cc (script_saw_segment_start_expression): New function.
10676 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10677 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10678 script_test_7.sh and script_test_8.sh.
10679 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10680 script_test_8.stdout.
10681 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10682 (script_test_6, script_test_6.stdout, script_test_7,
10683 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10684 * Makefile.in: Regenerate.
10685 * testsuite/script_test_6.sh: New file.
10686 * testsuite/script_test_6.t: Same.
10687 * testsuite/script_test_7.sh: Same.
10688 * testsuite/script_test_7.t: Same.
10689 * testsuite/script_test_8.sh: Same.
10691 2009-10-16 Doug Kwan <dougkwan@google.com>
10693 * output.cc (Output_segment::set_section_list_address): Cast
10694 expressions to unsigned long long type to avoid format warnings.
10696 2009-10-15 Ian Lance Taylor <iant@google.com>
10698 * script.cc (Script_options::add_symbol_assignment): Always add a
10699 dot assignment to script_sections_.
10700 * script-sections.cc (Script_sections::add_dot_assignment):
10701 Initialize if necessary.
10703 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10704 program headers with no load segment if there is a linker script.
10706 * layout.cc (Layout::set_segment_offsets): Align the file offset
10707 to the segment aligment for -N or -n with no load segment.
10708 * output.cc (Output_segment::add_output_section): Don't crash if
10709 the first section is a TLS section.
10710 (Output_segment::set_section_list_addresses): Print an error
10711 message if the address moves backward in a linker script.
10712 * script-sections.cc
10713 (Output_section_element_input::set_section_addresses): Don't
10714 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10715 (Orphan_output_section::set_section_addresses): Likewise.
10717 2009-10-15 Doug Kwan <dougkwan@google.com>
10719 * layout.cc (Layout::finish_dynamic_section): Generate tags
10720 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10721 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10722 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10724 2009-10-14 Ian Lance Taylor <iant@google.com>
10726 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10728 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10729 data_shdr fields of relinfo.
10730 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10731 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
10732 R_386_TLS_LDO_32, adjust based on section flags.
10733 (Target_i386::Relocate::fix_up_ldo): Remove.
10735 2009-10-13 Ian Lance Taylor <iant@google.com>
10737 Add support for -pie.
10738 * options.h (class General_options): Add -pie and
10740 (General_options::output_is_position_independent): Test -pie.
10741 (General_options::output_is_executable): Return true if not shared
10742 and not relocatable.
10743 (General_options::output_is_pie): Remove.
10744 * options.cc (General_options::finalize): Reject incompatible uses
10746 * gold.cc (queue_middle_tasks): A -pie link is not static.
10747 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10748 * symtab.cc (Symbol::final_value_is_known): Return false if
10749 output_is_position_independent.
10750 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10751 output_is_position_independent.
10752 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10753 output_is_position_independent.
10754 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10755 output_is_position_independent.
10756 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10758 (basic_pie_test.o, basic_pie_test): New targets.
10759 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10760 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10761 (two_file_pie_test): New target.
10762 * testsuite/Makefile.in: Rebuild.
10763 * README: Remove note saying that -pie is not supported.
10765 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
10767 * options.h (class General_options): Add -init and -fini.
10768 * layout.cc (Layout::finish_dynamic_section): Emit
10769 given init and fini functions.
10771 2009-10-13 Sriraman Tallam <tmsriram@google.com>
10773 * gc.h (gc_process_relocs): Check if icf is enabled using new
10775 * gold.cc (queue_initial_tasks): Likewise.
10776 (queue_middle_tasks): Likewise.
10777 * object.cc (do_layout): Likewise.
10778 * symtab.cc (is_section_folded): Likewise.
10779 * main.cc (main): Likewise.
10780 * reloc.cc (Read_relocs::run): Likewise.
10781 (Sized_relobj::do_scan_relocs): Likewise.
10782 * icf.cc (is_function_ctor_or_dtor): New function.
10783 (Icf::find_identical_sections): Check if function is ctor or dtor when
10784 safe icf is chosen.
10785 * options.h (General_options::icf): Change option to be an enum.
10786 (Icf_status): New enum.
10787 (icf_enabled): New method.
10788 (icf_safe_folding): New method.
10789 (set_icf_status): New method.
10790 (icf_status_): New variable.
10791 * (options.cc) (General_options::finalize): Set icf_status_.
10792 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10793 icf_test and icf_keep_unique_test to use the --icf enum flag.
10794 * testsuite/icf_safe_test.sh: New file.
10795 * testsuite/icf_safe_test.cc: New file.
10797 2009-10-12 Sriraman Tallam <tmsriram@google.com>
10799 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10800 includes to gc.h and icf.h.
10801 * arm.cc: Include gc.h.
10802 * gold.cc: Likewise.
10803 * i386.cc: Likewise.
10804 * powerpc.cc: Likewise.
10805 * sparc.cc: Likewise.
10806 * x86_64.cc: Likewise.
10807 * gc.h: Include icf.h.
10809 2009-10-11 Ian Lance Taylor <iant@google.com>
10811 * plugin.cc: Include "gold.h" before other header files.
10813 2009-10-10 Chris Demetriou <cgd@google.com>
10815 * options.h (Input_file_argument::Input_file_type): New enum.
10816 (Input_file_argument::is_lib_): Replace with...
10817 (Input_file_argument::type_): New member.
10818 (Input_file_argument::Input_file_argument): Take Input_file_type
10819 'type' rather than boolean 'is_lib' as second argument.
10820 (Input_file_argument::is_lib): Use type_.
10821 (Input_file_argument::is_searched_file): New function.
10822 (Input_file_argument::may_need_search): Handle is_searched_file.
10823 * options.cc (General_options::parse_library): Support -l:filename.
10824 (General_options::parse_just_symbols): Update for Input_file_argument
10826 (Command_line::process): Likewise.
10827 * archive.cc (Archive::get_file_and_offset): Likewise.
10828 * plugin.cc (Plugin_manager::release_input_file): Likewise.
10829 * script.cc (read_script_file, script_add_file): Likewise.
10830 * fileread.cc (Input_file::Input_file): Likewise.
10831 (Input_file::will_search_for): Handle is_searched_file.
10832 (Input_file::open): Likewise.
10833 * readsyms.cc (Read_symbols::get_name): Likewise.
10834 * testsuite/Makefile.am (searched_file_test): New test.
10835 * testsuite/Makefile.in: Regenerate.
10836 * testsuite/searched_file_test.cc: New file.
10837 * testsuite/searched_file_test_lib.cc: New file.
10839 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10840 Ian Lance Taylor <iant@google.com>
10842 * descriptor.cc: Include <cstdio> and "binary-io.h".
10843 (Descriptors::open): Open the files in binary mode always.
10844 * script.cc (Lex::get_token): Treat \r as whitespace.
10846 2009-10-09 Ian Lance Taylor <iant@google.com>
10848 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10850 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10851 Ian Lance Taylor <iant@google.com>
10853 * configure.ac: Check for readv function also.
10854 * fileread.cc (readv): Define if not HAVE_READV.
10855 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10857 * config.in: Regenerate.
10858 * configure: Regenerate.
10860 2009-10-09 Doug Kwan <dougkwan@google.com>
10862 * layout.cc (Layout::make_output_section): Call target hook to make
10863 ordinary output section.
10864 (Layout::finalize): Adjust parameter list of call the
10865 Target::may_relax().
10866 * layout.h (class Layout::section_list): New method.
10867 * merge.h (Output_merge_base::entsize): Change visibility to public.
10868 (Output_merge_base::is_string, Output_merge_base::do_is_string):
10870 (Output_merge_string::do_is_string): New method.
10871 * object.cc (Sized_relobj::do_setup): renamed from
10872 Sized_relobj::set_up.
10873 * object.h (Sized_relobj::adjust_shndx,
10874 Sized_relobj::initializ_input_to_output_maps,
10875 Sized_relobj::free_input_to_output_maps): Change visibilities to
10877 (Sized_relobj::setup): Virtualize.
10878 (Sized_relobj::do_setup): New method declaration.
10879 (Sized_relobj::invalidate_section_offset,
10880 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10881 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10882 * options.cc (parse_int): New function.
10883 * options.h (parse_int): New declaration.
10884 (DEFINE_int): New macro.
10885 (stub_group_size): New option.
10886 * output.cc (Output_section::Output_section): Initialize memebers
10887 merge_section_map_, merge_section_by_properties_map_,
10888 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10889 (Output_section::add_input_section): Handled deferred code-fill
10890 generation and remove an old comment.
10891 (Output_section::add_relaxed_input_section): New method definition.
10892 (Output_section::add_merge_input_section): Use merge section by
10893 properties map to speed to search. Update merge section maps
10895 (Output_section::build_relaxation_map): New method definition.
10896 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10898 (Output_section::relax_input_section): Renamed to
10899 Output_section::convert_input_sections_to_relaxed_sections and change
10900 interface to take a vector of pointers to relaxed sections.
10901 (Output_section::find_merge_section,
10902 Output_section::find_relaxed_input_section): New method definitions.
10903 (Output_section::is_input_address_mapped,
10904 Output_section::output_offset, Output_section::output_address):
10905 Use output section data maps to speed up searching.
10906 (Output_section::find_starting_output_address): Add comments.
10907 (Output_section::do_write,
10908 Output_section::write_to_postprocessing_buffer): Do code-fill
10909 generation as appropriate.
10910 (Output_section::get_input_sections): Invalidate relaxed input section
10912 (Output_section::restore_states): Adjust type of checkpoint .
10913 Invalidate relaxed input section map.
10914 * output.h (Output_merge_base): New class declaration.
10915 (Input_section_specifier): New class defintion.
10916 (class Output_relaxed_input_section) Change base class to
10917 Output_section_data_build.
10918 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10919 base class initializer.
10920 (Output_section::add_relaxed_input_section): New method declaration.
10921 (Output_section::Input_section): Change visibility to protected.
10922 (Output_section::Input_section::relobj,
10923 Output_section::Input_section::shndx): Handle relaxed input sections.
10924 Output_section::input_sections) Change visibility to protected. Also
10925 define overload to return a non-const pointer.
10926 (Output_section::Merge_section_properties): New class defintion.
10927 (Output_section::Merge_section_by_properties_map,
10928 Output_section::Output_section_data_by_input_section_map,
10929 Output_section::Relaxation_map): New types.
10930 (Output_section::relax_input_section): Rename method to
10931 Output_section::convert_input_sections_to_relaxed_sections and change
10932 interface to take a vector of relaxed section pointers.
10933 (Output_section::find_merge_section,
10934 Output_section::find_relaxed_input_section,
10935 Output_section::build_relaxation_map,
10936 Output_section::convert_input_sections_in_list_to_relaxed_sections):
10937 New method declarations.
10938 (Output_section::merge_section_map_
10939 Output_section::merge_section_by_properties_map_,
10940 Output_section::relaxed_input_section_map_,
10941 Output_section::is_relaxed_input_section_map_valid_,
10942 Output_section::generate_code_fills_at_write_): New data members.
10943 * script-sections.cc
10944 (Output_section_element_input::set_section_addresses): Call
10945 current_data_size and addralign methods of relaxed input sections.
10946 (Orphan_output_section::set_section_addresses): Call current_data_size
10947 and addralign methods of relaxed input sections.
10948 * symtab.cc (Symbol_table::compute_final_value): Extract template
10949 from the body of Symbol_table::sized_finalize_symbol.
10950 (Symbol_table::sized_finalized_symbol): Call
10951 Symbol_table::compute_final_value.
10952 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10953 (Symbol_table::compute_final_value): New templated method declaration.
10954 * target.cc (Target::do_make_output_section): New method defintion.
10955 * target.h (Target::make_output_section): New method declaration.
10956 (Target::relax): Add more parameters for input objects, symbol table
10957 and layout. Adjust call to do_relax.
10958 (Target::do_make_output_section): New method declaration.
10959 (Target::do_relax): Add parameters for input objects, symbol table
10962 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10964 * pread.c: Include stdio.h.
10966 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10968 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10971 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10973 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10974 Change read_shndx type to unsigned int.
10975 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10977 (Sized_dwarf_line_info::read_line_mappings): Likewise.
10978 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10979 Change read_shndx type to unsigned int.
10980 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10982 (Sized_dwarf_line_info::read_line_mappings): Likewise.
10983 * layout.cc (Layout::create_symtab_sections): Cast the result of
10984 local_symcount * symsize to off_t in the gold_assert.
10986 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10988 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10989 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10991 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10992 (Arm_relocate_functions::thm_abs5): New function.
10993 (Arm_relocate_functions::abs12): New function.
10994 (Arm_relocate_functions::abs16): New function.
10995 (Arm_relocate_functions::base_abs): New function.
10996 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10997 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
10998 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11000 (Scan::global): Likewise.
11001 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11002 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11003 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11004 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11007 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11009 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11010 (Arm_relocate_functions::movt_prel): New function.
11011 (Arm_relocate_functions::thm_movw_prel_nc): New function.
11012 (Arm_relocate_functions::thm_movt_prel): New function.
11013 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11014 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11015 (Scan::global, Relocate::relocate): Likewise.
11016 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11018 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
11020 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11021 Incremental_checker.
11022 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11024 (class Incremental_inputs_header): New class.
11025 (Incremental_inputs_header_writer): Edit comment.
11026 (Incremental_inputs_entry): New class.
11027 (Incremental_inputs_entry_writer): Edit comment.
11028 (Sized_incremental_binary::do_find_incremental_inputs_section):
11029 Add *strtab_shndx parameter, fill it.
11030 (Sized_incremental_binary::do_check_inputs): New method.
11031 (Incremental_checker::can_incrementally_link_output_file): Use
11032 Sized_incremental_binary::check_inputs.
11033 (Incremental_inputs::report_command_line): Save command line in
11036 (Incremental_binary::find_incremental_inputs_section): New
11038 (Incremental_binary::do_find_incremental_inputs_section): Add
11039 strtab_shndx parameter.
11040 (Incremental_binary::do_check_inputs): New pure virtual method.
11041 (Sized_incremental_binary::do_check_inputs): Declare.
11042 (Incremental_checker::Incremental_checker): Add incremental_inputs
11043 parameter, use it to initialize incremental_inputs_.
11044 (Incremental_checker::incremental_inputs_): New field.
11045 (Incremental_checker::command_line): New method.
11046 (Incremental_checker::inputs): New method.
11047 (Incremental_checker::command_line_): New field.
11049 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
11051 * incremental.cc: Include <cstdarg> and "target-select.h".
11052 (vexplain_no_incremental): New function.
11053 (explain_no_incremental): New function.
11054 (Incremental_binary::error): New method.
11055 (Sized_incremental_binary::do_find_incremental_inputs_section): New
11057 (make_sized_incremental_binary): New function.
11058 (open_incremental_binary): New function.
11059 (can_incrementally_link_file): Add checks if output is ELF and has
11061 * incremental.h: Include "elfcpp_file.h" and "output.h".
11062 (Incremental_binary): New class.
11063 (Sized_incremental_binary): New class.
11064 (open_incremental_binary): Declare.
11065 * object.cc (is_elf_object): Use
11066 elfcpp::Elf_recognizer::is_elf_file.
11067 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11068 * output.h (Output_file::filesize): New method.
11070 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11072 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11074 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11075 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11077 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11079 (Arm_relocate_functions::movw_abs_nc): New function.
11080 (Arm_relocate_functions::movt_abs): New function.
11081 (Arm_relocate_functions::thm_movw_abs_nc): New function.
11082 (Arm_relocate_functions::thm_movt_abs): New function.
11083 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11084 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11085 (Scan::global): Likewise.
11086 (Relocate::relocate): Likewise.
11087 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11089 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11091 * arm.cc (Arm_relocate_functions::got_prel) New function.
11092 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11093 (Relocate::relocate): Likewise.
11094 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11096 2009-10-06 Ian Lance Taylor <iant@google.com>
11098 * options.h (class General_options): Define
11099 split_stack_adjust_size parameter.
11100 * object.h (class Object): Add uses_split_stack_ and
11101 has_no_split_stack_ fields. Add uses_split_stack and
11102 has_no_split_stack accessor functions. Declare
11103 handle_split_stack_section.
11104 (class Reloc_symbol_changes): Define.
11105 (class Sized_relobj): Define Function_offsets. Declare
11106 split_stack_adjust, split_stack_adjust_reltype, and
11108 * object.cc (Object::handle_split_stack_section): New function.
11109 (Sized_relobj::do_layout): Call handle_split_stack_section.
11110 * dynobj.cc (Sized_dynobj::do_layout): Call
11111 handle_split_stack_section.
11112 * reloc.cc (Sized_relobj::relocate_sections): Call
11113 split_stack_adjust for executable sections in split_stack
11114 objects. Pass reloc_map to relocate_section.
11115 (Sized_relobj::split_stack_adjust): New function.
11116 (Sized_relobj::split_stack_adjust_reltype): New function.
11117 (Sized_relobj::find_functions): New function.
11118 * target-reloc.h: Include "object.h".
11119 (relocate_section): Add reloc_symbol_changes parameter. Change
11121 * target.h (class Target): Add calls_non_split method. Declare
11122 do_calls_non_split virtual method. Declare match_view and
11124 * target.cc: Include "elfcpp.h".
11125 (Target::do_calls_non_split): New function.
11126 (Target::match_view): New function.
11127 (Target::set_view_to_nop): New function.
11128 * gold.cc (queue_middle_tasks): Give an error if mixing
11129 split-stack and non-split-stack objects with -r.
11130 * i386.cc (Target_i386::relocate_section): Add
11131 reloc_symbol_changes parameter.
11132 (Target_i386::do_calls_non_split): New function.
11133 * x86_64.cc (Target_x86_64::relocate_section): Add
11134 reloc_symbol_changes parameter.
11135 (Target_x86_64::do_calls_non_split): New function.
11136 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11138 * powerpc.cc (Target_powerpc::relocate_section): Add
11139 reloc_symbol_changes parameter.
11140 * sparc.cc (Target_sparc::relocate_section): Add
11141 reloc_symbol_changes parameter.
11142 * configure.ac: Call AM_CONDITIONAL for the default target.
11143 * configure: Rebuild.
11144 * testsuite/Makefile.am (TEST_AS): New variable.
11145 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11146 (check_DATA): Add split_i386 and split_x86_64 files.
11147 (SPLIT_DEFSYMS): Define.
11148 (split_i386_[1234n].o): New targets.
11149 (split_i386_[124]): New targets.
11150 (split_i386_[1234r].stdout): New targets.
11151 (split_x86_64_[1234n].o): New targets.
11152 (split_x86_64_[124]): New targets.
11153 (split_x86_64_[1234r].stdout): New targets.
11154 (MOSTLYCLEANFILES): Add new executables.
11155 * testsuite/split_i386.sh: New file.
11156 * testsuite/split_x86_64.sh: New file.
11157 * testsuite/split_i386_1.s: New file.
11158 * testsuite/split_i386_2.s: New file.
11159 * testsuite/split_i386_3.s: New file.
11160 * testsuite/split_i386_4.s: New file.
11161 * testsuite/split_i386_n.s: New file.
11162 * testsuite/split_x86_64_1.s: New file.
11163 * testsuite/split_x86_64_2.s: New file.
11164 * testsuite/split_x86_64_3.s: New file.
11165 * testsuite/split_x86_64_4.s: New file.
11166 * testsuite/split_x86_64_n.s: New file.
11167 * testsuite/testfile.cc (Target_test): Update relocation_section
11169 * testsuite/Makefile.in: Rebuild.
11171 2009-10-06 Ian Lance Taylor <iant@google.com>
11173 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11174 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11175 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
11176 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11177 the address on ldo_addrs_.
11178 (Target_i386::Relocate::fix_up_ldo): New function.
11180 2009-10-06 Rafael Espindola <espindola@google.com>
11182 * plugin.cc (add_input_library): New.
11183 (Plugin::load): Add add_input_library to tv.
11184 (Plugin_manager::add_input_file): Add the is_lib argument.
11185 (add_input_file): Update call to Plugin_manager::add_input_file.
11186 (add_input_library): New.
11187 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11189 2009-09-30 Doug Kwan <dougkwan@google.com>
11191 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11192 symbol and call Symbol::may_need_copy_reloc to determine if
11193 a copy reloc is needed.
11194 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11195 nocopyreloc is given in command line.
11196 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11197 given in command line.
11198 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11199 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11200 of the removed Target_i386::may_need_copy_reloc.
11201 * options.h (copyreloc): New option with default value false.
11202 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11203 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11204 instead of the removed Target_powerpc::may_need_copy_reloc.
11205 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11206 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11207 instead of the removed Target_sparc::may_need_copy_reloc.
11208 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11209 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11210 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11211 instead of the removed Target_x86_64::may_need_copy_reloc.
11213 2009-09-30 Ian Lance Taylor <iant@google.com>
11215 * object.h (class Object): Remove target_ field, and target,
11216 sized_target, and set_target methods.
11217 (Object::sized_target): Remove.
11218 (class Sized_relobj): Update declarations. Remove sized_target.
11219 * object.cc (Sized_relobj::setup): Remove target parameter.
11220 Change all callers.
11221 (Input_objects::add_object): Don't do anything with the target.
11222 (make_elf_sized_object): Add punconfigured parameter. Change all
11223 callers. Set or test parameter target.
11224 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11225 Change all callers.
11226 * parameters.cc (Parameters::set_target): Change parameter type to
11228 (Parameters::default_target): Remove.
11229 (set_parameters_target): Change parameter type to be non-const.
11230 (parameters_force_valid_target): New function.
11231 (parameters_clear_target): New function.
11232 * parameters.h (class Parameters): Update declarations. Remove
11233 default_target method. Add sized_target and clear_target
11234 methods. Change target_ to be non-const.
11235 (set_parameters_target): Update declaration.
11236 (parameters_force_valid_target): Declare.
11237 (parameters_clear_target): Declare.
11238 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11239 as NULL if we aren't searching.
11240 (Add_symbols::run): Don't check for compatible target.
11241 * fileread.cc (Input_file::open_binary): Call
11242 parameters_force_valid_target.
11243 * gold.cc (queue_middle_tasks): Likewise.
11244 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
11245 set_target on object.
11246 * dynobj.h (class Sized_dynobj): Update declarations.
11247 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11248 make_elf_object returns NULL.
11249 (Archive::include_member): Don't check whether object target is
11251 * output.cc (Output_section::add_input_section): Get target from
11253 (Output_section::relax_input_section): Likewise.
11254 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11256 (Sized_relobj::do_scan_relocs): Likewise.
11257 (Sized_relobj::relocate_sections): Likewise.
11258 * resolve.cc (Symbol_table::resolve): Likewise.
11259 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
11260 parameter. Change all callers.
11261 (Symbol_table::add_from_object): Get target from parameters.
11262 (Symbol_table::add_from_relobj): Don't check object target.
11263 (Symbol_table::add_from_dynobj): Likewise.
11264 (Symbol_table::define_special_symbol): Get target from
11266 * symtab.h (class Symbol_table): Update declaration.
11267 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11268 parameter. Change all callers. Clear parameter target.
11269 (Binary_test): Test target here.
11270 * testsuite/object_unittest.cc (gold_testsuite): Remove
11271 target_test_pointer parameter. Change all callers.
11272 (Object_test): Test target here.
11274 2009-09-26 Ian Lance Taylor <iant@google.com>
11276 * testsuite/initpri1.c: Don't try to use constructor priorities if
11277 compiling with gcc before 4.3.
11279 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
11281 * testsuite/retain_symbols_file_test.sh (check_present): Change
11282 output file name to retain_symbols_file_test.stdout.
11283 (check_absent): Likewise.
11285 2009-09-18 Craig Silverstein <csilvers@google.com>
11287 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11288 * options.cc: Include <cerrno> and <fstream>.
11289 (General_options::finalize): Parse -retain-symbols-file tag.
11290 * options.h: New flag.
11291 (General_options): New method should_retain_symbol, new
11292 variable symbols_to_retain.
11293 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11294 should_retain_symbol map.
11295 * testsuite/Makefile.am (retain_symbols_file_test): New test.
11296 * testsuite/Makefile.in: Regenerate.
11297 * testsuite/retain_symbols_file_test.sh: New file.
11299 2009-09-18 Nick Clifton <nickc@redhat.com>
11301 * po/es.po: Updated Spanish translation.
11303 2009-09-17 Doug Kwan <dougkwan@google.com>
11305 * debug.h (DEBUG_RELAXATION): New constant.
11306 (DEBUG_ALL): Add DEBUG_RELAXATION.
11307 (debug_string_to_enum): Add relaxation debug option.
11309 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11310 Layout::Relaxation_debug_check::read_sections,
11311 Layout::Relaxation_debug_check::read_sections): New method definitions.
11312 (Layout::Layout): Initialize data members
11313 record_output_section_data_from_scrips_,
11314 script_output_section_data_list_ and relaxation_debug_check_.
11315 (Layout::save_segments, Layout::restore_segments,
11316 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11317 Layout::relaxation_loop_body): New method definitions.
11318 (Layout::finalize): Support relaxation. Move section layout code to
11319 Layout::relaxation_loop_body.
11320 (Layout::set_asection_address_from_script): Move code for orphan
11321 section placement out.
11322 (Layout::place_orphan_sections_in_script): New method definition.
11323 * layout.h (Output_segment_headers, Output_file_header):
11324 New forward class declarations.
11325 (Layout::~Layout): Define.
11326 (Layout::new_output_section_data_from_script): New method definition.
11327 (Layout::place_orphan_sections_in_script): New method declaration.
11328 (Layout::Segment_states): New type declaration.
11329 (Layout::save_segments, Layout::restore_segments,
11330 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11331 Layout::relaxation_loop_body): New method declarations.
11332 (Layout::Output_section_data_list): New type declaration.
11333 (Layout::Relaxation_debug_check): New class definition.
11334 (Layout::record_output_section_data_from_script_,
11335 Layout::script_output_section_data_list_, Layout::segment_states_,
11336 Layout::relaxation_debug_check_): New data members.
11337 * output.cc: (Output_section_headers::do_size): New method definition.
11338 (Output_section_headers::Output_section_headers): Move size
11339 computation to Output_section_headers::do_size.
11340 (Output_segment_headers::do_size): New method definition.
11341 (Output_file_header::Output_file_header): Move size computation to
11342 Output_file_header::do_size and call it.
11343 (Output_file_header::do_size): New method definition.
11344 (Output_data_group::Output_data_group): Adjust call to
11345 Output_section_data.
11346 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11347 (Output_symtab_xindex::do_write): Add array bound check.
11348 (Output_section::Input_section::print_to_mapfile): Handle
11349 RELAXED_INPUT_SECTION_CODE.
11350 (Output_section::Output_section): Initialize data member checkpoint_.
11351 (Output_section::~Output_section): Delete checkpoint object pointed
11353 (Output_section::add_input_section): Always add an Input_section if
11355 (Output_section::add_merge_input_section): Add assert.
11356 (Output_section::relax_input_section): New method definition.
11357 (Output_section::set_final_data_size): Set load address to zero for
11358 an unallocated section.
11359 (Output_section::do_address_and_file_offset_have_reset_values):
11360 New method definition.
11361 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11362 Handle relaxed input section.
11363 (Output_section::sort_attached_input_sections): Checkpoint input
11364 section list lazily.
11365 (Output_section::get_input_sections): Change type of input_sections to
11366 list of Simple_input_section pointers. Checkpoint input section list
11367 lazily. Also handle relaxed input sections.
11368 (Output_section::add_input_section_for_script): Take a reference to
11369 a Simple_input_section object instead of Relobj pointer and section
11370 index as parameter. Handle relaxed input sections.
11371 (Output_section::save_states, Output_section::restore_states): New
11372 method definitions.
11373 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11374 (Output_data::is_data_size_fixed): New method definition.
11375 (Output_data::reset_addresss_and_file_offset): Do not reset data size
11377 (Output_data::address_and_file_offset_have_reset_values): New method
11379 (Output_data::do_address_and_file_offset_have_reset_values): New method
11381 (Output_data::set_data_size): Check that data size is not fixed.
11382 (Output_data::fix_data_size): New method definition.
11383 (Output_data::is_data_size_fixed_): New data member.
11384 (Output_section_headers::set_final_data_size): New method definition.
11385 (Output_section_headers::do_size): New method declaration.
11386 (Output_segment_headers::set_final_data_size): New method definition.
11387 (Output_segment_headers::do_size): New method declaration.
11388 (Output_file_header::set_final_data_size)::New method definition.
11389 (Output_file_header::do_size)::New method declaration.
11390 (Output_section_data::Output_section_data): Add new parameter
11391 is_data_size_fixed and use it to fix data size.
11392 (Output_data_const::Output_data_const): Adjust call to base class
11393 constructor and fix data size.
11394 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11395 base class constructor and fix data size.
11396 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11397 base class constructor and fix data size.
11398 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11399 class constructor and fix data size.
11400 (Output_data_group::set_final_data_size): New method definition.
11401 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11402 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11403 class constructor and fix data size.
11404 (Output_relaxed_input_section): New class definition.
11405 (Output_section::Simple_input_section): New class definition.
11406 (Output_section::get_input_sections): Adjust parameter list.
11407 (Output_section::add_input_section_for_script): Same.
11408 (Output_section::save_states, Output_section::restore_states,
11409 Output_section::do_address_and_file_offset_have_reset_values,
11410 (Output_section::Input_section::Input_section): Handle
11411 RELAXED_INPUT_SECTION_CODE. Add new overload for
11412 Output_relaxed_input_section.
11413 (Output_section::Input_section::is_input_section,
11414 Output_section::Input_section::set_output_section): Handle relaxed
11416 (Output_section::Input_section::is_relaxed_input_section,
11417 Output_section::Input_section::output_section_data,
11418 Output_section::Input_section::relaxed_input_section): New method
11420 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11422 (Output_section::Input_section::u1_): Update comments.
11423 (Output_section::Input_section::u2_): Add new union member poris.
11424 (Output_section::Checkpoint_output_section): New classs definition.
11425 (Output_section::relax_input_section): New method declaration.
11426 (Output_section::checkpoint_): New data member.
11427 (Output_segment): Update comments.
11428 (Output_segment::Output_segment): Un-privatize copy constructor.
11429 (Output_segment::operator=): Un-privatize.
11430 * script-sections.cc (Output_section_element::Input_section_list):
11431 Change element type to Output_section::Simple_input_section.
11432 (Output_section_element_dot_assignment::set_section_addresses):
11433 Register output section data for relaxation clean up.
11434 (Output_data_exression::Output_data_expression): Adjust call to base
11435 constructor to fix data size.
11436 (Output_section_element_data::set_section_addresses): Register
11437 Output_data_expression object for relaxation clean up.
11438 (struct Input_section_info): Replace Relobj pointer and section index
11439 pair with Output_section::Simple_input_section and Convert struct to a
11441 (Input_section_sorter::operator()): Adjust access to
11442 Input_section_info data member to use accessors.
11443 (Output_section_element_input::set_section_addresses): Use layout
11444 parameter. Adjust code to use Output_section::Simple_input_section
11445 and Input_secction_info classes. Register filler for relaxation
11447 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11448 and section index pair with Output_section::Simple_input_section
11449 class. Adjust code accordingly.
11450 (Phdrs_element::release_segment): New method definition.
11451 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11453 (Script_sections::release_segments): New method definition.
11454 * gold/script-sections.h (Script_sections::release_segments): New
11455 method declaration.
11456 * gold/target.h (Target::may_relax, Target::relax,
11457 Target::do_may_relax, Target::do_relax): New method definitions.
11459 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11461 * arm.cc (has_signed_unsigned_overflow): New function.
11462 (Arm_relocate_functions::abs8): New function.
11463 (Target_arm::Scan::local): Handle R_ARM_ABS8.
11464 (Target_arm::Scan::global): Likewise.
11465 (Target_arm::relocate::relocate): Likewise.
11466 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11469 2009-09-16 Cary Coutant <ccoutant@google.com>
11471 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11472 * testsuite/Makefile.in: Regenerate.
11474 2009-09-11 Nick Clifton <nickc@redhat.com>
11476 * po/gold.pot: Updated by the Translation project.
11478 2009-09-08 Cary Coutant <ccoutant@google.com>
11480 * output.cc (Output_file::open): Add execute permission to empty file.
11481 * testsuite/Makefile.am (permission_test): New test.
11482 * testsuite/Makefile.in: Regenerate.
11484 2009-09-02 Ian Lance Taylor <iant@google.com>
11486 * output.cc (Output_file::resize): Call map_no_anonymous rather
11489 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
11491 * gold.cc: Include "incremental.h".
11492 (queue_initial_tasks): Call Incremental_checker methods.
11493 * incremental.cc: Include "output.h".
11494 (Incremental_checker::can_incrementally_link_output_file): New
11496 * incremental.h (Incremental_checker): New class.
11498 * output.cc (Output_file::open_for_modification): New method.
11499 (Output_file::map_anonymous): Changed return type to bool. Record
11500 map in base_ field.
11501 (Output_file::map_no_anonymous): New method, broken out of map.
11502 (Output_file::map): Use map_no_anonymous and map_anonymous.
11503 * output.h (class Output_file): Update declarations.
11505 2009-08-24 Cary Coutant <ccoutant@google.com>
11507 * options.h (Command_line::Pre_options): New class.
11508 (Command_line::pre_options): New member.
11509 * options.cc (gold::options::ready_to_register): New variable.
11510 (One_option::register_option): Do nothing if not registering options.
11511 Assert if same short option registered twice.
11512 (General_options::General_options): Turn off option registration when
11514 (Command_line::Pre_options::Pre_options): New constructor.
11516 2009-08-24 Cary Coutant <ccoutant@google.com>
11518 * options.h (General_options::no_keep_memory): Remove incorrect
11521 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
11523 * Makefile.am (am__skiplex, am__skipyacc): New.
11524 * Makefile.in: Regenerate.
11526 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
11528 * Makefile.am (AM_CPPFLAGS): Renamed from ...
11529 (INCLUDES): ... this.
11530 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11531 (AM_CPPFLAGS): Renamed from ...
11532 (INCLUDE): ... this.
11533 * Makefile.in, testsuite/Makefile.in: Regenerate.
11535 * Makefile.in: Regenerate.
11536 * aclocal.m4: Likewise.
11537 * config.in: Likewise.
11538 * configure: Likewise.
11539 * testsuite/Makefile.in: Likewise.
11541 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11542 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11543 * Makefile.in: Regenerate.
11544 * testsuite/Makefile.in: Regenerate.
11546 2009-08-19 Cary Coutant <ccoutant@google.com>
11548 * resolve.cc (Symbol_table::resolve): Don't complain about defined
11549 symbols in shared libraries overridden by hidden or internal symbols
11550 in the main program.
11552 2009-08-19 Chris Demetriou <cgd@google.com>
11554 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11555 checking source file names in error messages.
11557 2009-08-18 Doug Kwan <dougkwan@google.com>
11559 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11560 an elcpp::Ehdr as parameter. Adjust call to set_target.
11561 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11562 an elfcpp::Ehdr as parameter.
11563 * object.cc (Object::set_target): Remove the version that looks up
11564 a target and sets it.
11565 (Sized_relobj::setup): Take a Target object instead of
11566 an elfcpp::Ehdr as parameter. Adjust call to set_target.
11567 (make_elf_sized_object): Find target and ask target to
11568 make an ELF object.
11569 * object.h: (Object::set_target): Remove the version that looks up
11570 a target and sets it.
11571 (Sized_relobj::setup): Take a Target object instead of
11572 an elfcpp:Ehdr as parameter.
11573 * target.cc: Include dynobj.h.
11574 (Target::do_make_elf_object_implementation): New.
11575 (Target::do_make_elf_object): New.
11576 * target.h (Target::make_elf_object): New template declaration.
11577 (Target::do_make_elf_object): New method declarations.
11578 (Target::do_make_elf_object_implementation): New template declaration.
11580 2009-08-14 Ian Lance Taylor <iant@google.com>
11582 * gold.h (FUNCTION_NAME): Define.
11583 (gold_unreachable): Use FUNCTION_NAME.
11585 2009-08-12 Sriraman Tallam <tmsriram@google.com>
11587 * icf.cc (Icf::find_identical_sections): Issue a warning when a
11588 symbol in the --keep-unique list is not found.
11590 2009-08-12 Sriraman Tallam <tmsriram@google.com>
11592 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11593 been maked as --keep-unique.
11594 (Icf::unfold_section): New function.
11595 * icf.h (Icf::unfold_section): New function.
11596 * options.h (General_options::keep_unique): New option.
11597 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11598 * testsuite/Makefile.in: Regenerate.
11599 * testsuite/icf_keep_unique_test.sh: New file.
11600 * testsuite/icf_keep_unique_test.cc: New file.
11602 2009-08-12 Cary Coutant <ccoutant@google.com>
11605 * resolve.cc (Symbol_table::resolve): Check for references from
11606 dynamic objects to hidden and internal symbols.
11607 * testsuite/Makefile.am (hidden_test.sh): New test.
11608 * testsuite/Makefile.in: Regenerate.
11609 * testsuite/hidden_test.sh: New script.
11610 * testsuite/hidden_test_1.c: New test source.
11611 * testsuite/hidden_test_main.c: New test source.
11613 2009-08-11 Doug Kwan <dougkwan@google.com>
11615 * arm.cc: Update comments.
11616 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11617 segment to locate the .ARM.exidx section if present.
11619 2009-08-09 Doug Kwan <dougkwan@google.com>
11621 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11624 2009-08-07 Sriraman Tallam <tmsriram@google.com>
11625 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11628 2009-08-06 Sriraman Tallam <tmsriram@google.com>
11630 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11631 valid tls_segment only for non-debug-section relocations.
11632 * testsuite/Makefile.am: Add gc_tls_test.
11633 * testsuite/Makefile.in: Regenerate.
11634 * testsuite/gc_tls_test.cc: New file.
11635 * testsuite/gc_tls_test.sh: New file.
11637 2009-08-05 Sriraman Tallam <tmsriram@google.com>
11639 * icf.cc: New file.
11641 * Makefile.am (CCFILES): Add icf.cc.
11642 (HFILES): Add icf.h
11643 * Makefile.in: Regenerate.
11644 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11645 * gc.h (gc_process_relocs): Populate lists used by icf to contain
11646 section, symbol and addend information for the relocs.
11647 * gold.cc (queue_middle_tasks): Call identical code folding.
11648 * gold.h: Add defines for multimap.
11649 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11650 to the call of finalize_local_symbols.
11651 * main.cc (main): Create object of class Icf.
11652 * object.cc (Sized_relobj::do_layout): Allow this function to be
11653 called twice during icf.
11654 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11655 to sections marked as identical by icf.
11656 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11658 (Sized_relobj::do_section_entsize): New function.
11659 * object.h (Object::section_entsize): New function.
11660 (Object::do_section_entsize): New pure virtual function.
11661 (Relobj::finalize_local_symbols): Add new parameter.
11662 (Relobj::do_section_entsize): New function.
11663 * options.h (General_options::icf): New option.
11664 (General_options::icf_iterations): New option.
11665 (General_options::print_icf_sections): New option.
11666 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11667 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11668 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11670 * symtab.cc (Symbol_table::is_section_folded): New function.
11671 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
11672 to sections marked as identical by icf.
11673 * symtab.h (Symbol_table::set_icf): New function.
11674 (Symbol_table::icf): New function.
11675 (Symbol_table::is_section_folded): New function.
11676 (Symbol_table::icf_): New data member.
11677 * target-reloc.h (relocate_section): Ignore sections folded by icf.
11678 * testsuite/Makefile.am: Add commands to build icf_test.
11679 * testsuite/Makefile.in: Regenerate.
11680 * testsuite/icf_test.sh: New file.
11681 * testsuite/icf_test.cc: New file.
11683 2009-07-24 Chris Demetriou <cgd@google.com>
11685 * layout.cc (is_compressible_debug_section): Fix incorrect
11686 comment about compressed section names.
11688 2009-07-20 Ian Lance Taylor <ian@airs.com>
11691 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11693 2009-07-16 Ian Lance Taylor <iant@google.com>
11696 * layout.h: #include <map>.
11697 (class Kept_section): Change from struct to class. Add accessors
11698 and setters. Add section size to Comdat_group mapping. Change
11699 Comdat_group to std::map. Add is_comdat_ field. Add
11700 linkonce_size field in union.
11701 (class Layout): Update declaration of find_or_add_kept_section.
11702 Don't declare find_kept_object.
11703 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11704 parameter. Add object, shndx, is_comdat, and is_group_name
11705 parameters. Change all callers. Adjust for new Kept_section.
11706 (Layout::find_kept_object): Remove.
11707 * object.cc (Sized_relobj::include_section_group): Update use of
11708 Kept_section. Rename secnum to shndx. Only record
11709 Kept_comdat_section if sections are the same size.
11710 (Sized_relobj::include_linkonce_section): Update use of
11711 Kept_section. Only record Kept_comdat_section if sections are the
11712 same size. Set size of linkonce section.
11713 (Sized_relobj::map_to_kept_section): Update call to
11714 get_kept_comdat_section.
11715 * object.h (class Sized_relobj): Rename fields in
11716 Kept_comdat_section to drop trailing underscores; change object
11717 field to Relobj*. Change Kept_comdat_section_table to store
11718 struct rather than pointer.
11719 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11720 Add kept_object and kept_shndx parameters. Change all callers.
11721 (Sized_relobj::get_kept_comdat_section): Change return type to
11722 bool. Add kept_object and kept_shndx parameters. Change all
11724 * plugin.cc (Pluginobj::include_comdat_group): Update call to
11725 Layout::find_or_add_kept_section.
11727 2009-07-09 Ian Lance Taylor <iant@google.com>
11729 * merge.cc (Object_merge_map::initialize_input_to_output_map):
11730 Reserve space in the hash table.
11732 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
11734 * fileread.cc (File_read::get_mtime): New method.
11735 * fileread.h (Timespec): New structure.
11736 (File_read::get_mtime): New method.
11737 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11738 Renamed from timestamp_nsec.
11739 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11741 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11743 (Incremental_inputs::report_archive): Save mtime; style fix.
11744 (Incremental_inputs::report_obejct): Save mtime; style fix.
11745 (Incremental_inputs::report_script): Save mtime; style fix.
11746 (Incremental_inputs::finalize_inputs): Style fix.
11747 (Incremental_inputs::finalize): Style fix.
11748 (Incremental_inputs::create_input_section_data): Store inputs
11750 * incremental.h (Incremental_inputs::report_script): Add mtime
11752 (Incremental_inputs::Input_info::Input_info): Intialize only one
11754 (Incremental_inputs::Input_info::archive): Move to nameless
11756 (Incremental_inputs::Input_info::obejct): Move to nameless union.
11757 (Incremental_inputs::Input_info::script): Move to nameless union.
11758 (Incremental_inputs::mtime): New field.
11759 * script.cc (read_input_script): Pass file mtime to
11761 * script.h (Script_info::inputs): Style fix.
11763 2009-07-01 Ian Lance Taylor <ian@airs.com>
11765 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11768 2009-06-24 Ian Lance Taylor <iant@google.com>
11771 * layout.cc (Layout::choose_output_section): If we find an
11772 existing section, update the flags.
11773 (Layout::create_notes): New function, broken out of
11775 (Layout::finalize): Don't create note sections.
11776 (Layout::create_note): Don't crash if linker script discards
11778 (Layout::create_gold_note): Likewise.
11779 (Layout::create_build_id): Likewise. Don't set
11780 after_input_sections on the section.
11781 (Layout::create_executable_stack_info): Remove target parameter.
11783 * layout.h (class Layout): Declare create_notes. Update
11784 declaration of create_executable_stack_info.
11785 * gold.cc (queue_middle_tasks): Call create_notes.
11786 * output.cc (Output_section::update_flags_for_input_section): Move
11787 here from output.h. If SHF_ALLOC flag is newly set, mark address
11789 * output.h (Output_data::mark_address_invalid): New function.
11790 (class Output_section): Only declare, not define,
11791 update_flags_for_input_section. Remove set_flags.
11793 2009-06-24 Ian Lance Taylor <iant@google.com>
11795 * script-sections.cc (Output_section_definition::
11796 set_section_addresses): Rename shadowing local load_address to
11799 2009-06-24 Ian Lance Taylor <iant@google.com>
11802 * reloc.cc (relocate_sections): Skip empty relocation sections.
11804 2009-06-23 Ian Lance Taylor <iant@google.com>
11807 * layout.cc (Layout::create_note): Use choose_output_section
11808 rather than make_output_section.
11810 2009-06-23 Ian Lance Taylor <iant@google.com>
11813 * options.cc (General_options::parse_V): Set printed_version_.
11814 (General_options::General_options): Initialize printed_version_.
11815 * options.h (class General_options): Add printed_version_ field.
11816 * gold.cc (queue_initial_tasks): If there are no input files,
11817 don't give a fatal error if we printed the version information.
11818 (queue_middle_tasks): If using -r with a shared object, give a
11819 fatal error rather than an ordinary error.
11821 2009-06-23 Ian Lance Taylor <iant@google.com>
11824 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11825 (Layout::make_output_section): Set have_stabstr_section_ if we see
11826 a .stab*str section.
11827 (Layout::finalize): Call link_stabs_sections.
11828 (Layout::link_stabs_sections): New file.
11829 * layout.h (class Layout): Add have_stabstr_section_ field.
11830 Declare link_stabs_sections.
11832 2009-06-23 Doug Kwan <dougkwan@google.com>
11834 * Makefile.am (libgold_a_LIBADD): New.
11835 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11836 * Makefile.in: Regenerate.
11837 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11838 * configure: Regenerate.
11839 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11840 * fileread.cc: Include sys/state.h
11841 * gold.h: Declare memmem and strndup if found missing.
11842 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11844 2009-06-23 Ian Lance Taylor <iant@google.com>
11846 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11847 * configure: Rebuild.
11849 2009-06-23 Ian Lance Taylor <iant@google.com>
11852 * object.cc (Object::section_contents): Don't try to get a view if
11853 the section has length zero.
11854 (Object::handle_gnu_warning_section): If the section is empty, use
11855 the name of the section as the warning.
11857 2009-06-23 Ian Lance Taylor <iant@google.com>
11860 * stringpool.h (class Stringpool_template): Add optimize_ field.
11861 (Stringpool_template::set_optimize): New function.
11862 * stringpool.cc (Stringpool_template::Stringpool_template):
11863 Initialize optimize_ field.
11864 (Stringpool_template::set_string_offsets): Test local optimize
11865 fild rather than parameter.
11866 * layout.cc (Layout::Layout): Call set_optimize on the section
11869 2009-06-22 Ian Lance Taylor <iant@google.com>
11872 * yyscript.y: Parse TARGET.
11873 * script.cc (script_set_target): New function.
11874 * script-c.h (script_set_target): Declare.
11875 * options.cc (General_options::string_to_object_format): Rename
11876 from string_to_object_format in anonymous namespace. Change
11878 * options.h (class General_options): Declare
11879 string_to_object_format.
11881 2009-06-22 Ian Lance Taylor <iant@google.com>
11883 * script-sections.cc (Script_sections::create_segments): Don't put
11884 program headers in a PT_LOAD segment if -n or -N.
11886 2009-06-22 Ian Lance Taylor <iant@google.com>
11889 * options.h (class General_options): Add -z lazy and -z now. Sort
11890 -z options into alphabetical order.
11891 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11893 2009-06-21 Ian Lance Taylor <iant@google.com>
11895 * layout.cc (Layout::make_output_section): Call
11896 Target::new_output_section.
11897 (Layout::attach_allocated_section_to_segment): Put large section
11898 sections in a separate load segment with the large segment flag
11900 (Layout::segment_precedes): Sort large data segments after other
11902 (align_file_offset): New static function.
11903 (Layout::set_segment_offsets): Use align_file_offset.
11904 * output.h (class Output_section): Add is_small_section_ and
11905 is_large_section_ fields.
11906 (Output_section::is_small_section): New function.
11907 (Output_section::set_is_small_section): New function.
11908 (Output_section::is_large_section): New function.
11909 (Output_section::set_is_large_section): New function.
11910 (Output_section::is_large_data_section): New function.
11911 (class Output_segment): Add is_large_data_segment_ field.
11912 (Output_segment::is_large_data_segment): New function.
11913 (Output_segment::set_is_large_data_segment): New function.
11914 * output.cc (Output_section::Output_section): Initialize new
11916 (Output_segment::Output_segment): Likewise.
11917 (Output_segment::add_output_section): Add assertion that large
11918 data sections always go in large data segments. Force small data
11919 sections to the end of the list of data sections. Force small BSS
11920 sections to the start of the list of BSS sections. For large BSS
11921 sections to the end of the list of BSS sections.
11922 * symtab.h (class Symbol): Declare is_common_shndx.
11923 (Symbol::is_defined): Check Symbol::is_common_shndx.
11924 (Symbol::is_common): Likewise.
11925 (class Symbol_table): Define enum Commons_section_type. Update
11926 declarations. Add small_commons_ and large_commons_ fields.
11927 * symtab.cc (Symbol::is_common_shndx): New function.
11928 (Symbol_table::Symbol_table): Initialize new fields.
11929 (Symbol_table::add_from_object): Put small and large common
11930 symbols in the right list.
11931 (Symbol_table::sized_finalized_symbol): Check
11932 Symbol::is_common_shndx.
11933 (Symbol_table::sized_write_globals): Likewise.
11934 * common.cc (Symbol_table::do_allocate_commons): Allocate new
11935 common symbol lists. Don't call do_allocate_commons_list if the
11937 (Symbol_table::do_allocate_commons_list): Remove is_tls
11938 parameter. Add comons_section_type parameter. Change all
11939 callers. Handle small and large common symbols.
11940 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11941 Symbol::is_common_shndx.
11942 * resolve.cc (symbol_to_bits): Likewise.
11943 * target.h (Target::small_common_shndx): New function.
11944 (Target::small_common_section_flags): New function.
11945 (Target::large_common_shndx): New function.
11946 (Target::large_common_section_flags): New function.
11947 (Target::new_output_section): New function.
11948 (Target::Target_info): Add small_common_shndx, large_common_shndx,
11949 small_common_section_flags, and large_common_section_flags
11951 (Target::do_new_output_section): New virtual function.
11952 * arm.cc (Target_arm::arm_info): Initialize new fields.
11953 * i386.cc (Target_i386::i386_info): Likewise.
11954 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11956 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11957 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11958 (Target_x86_64::do_new_output_section): New function.
11959 * configure.ac: Define conditional MCMODEL_MEDIUM.
11960 * testsuite/Makefile.am (check_PROGRAMS): Add large.
11961 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11962 (large_LDFLAGS): Define.
11963 * testsuite/large.c: New file.
11964 * testsuite/testfile.cc (Target_test::test_target_info):
11965 Initialize new fields.
11966 * configure, testsuite/Makefile.in: Rebuild.
11968 2009-06-05 Doug Kwan <dougkwan@google.com>
11970 * Makefile.am (CCFILES): Add target.cc.
11971 * Makefile.in: Regenerate.
11972 * i386.cc (class Target_i386): Define new virtual method to
11973 override do_is_local_label_name in parent.
11974 * object.cc (Sized_relobj::do_count_local_symbols): Discard
11975 local symbols if --discard-locals or -X is given.
11976 * options.h (class General_options): Declare new options
11977 '--discard-locals' and '-X' for discarding locals.
11978 * target.h (class Target): Define new methods is_local_label_name.
11979 Declare new virtual method do_is_local_label_name.
11980 * target.cc: New file.
11981 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11982 (check_SCRIPTS): Add discard_locals_test.sh.
11983 (check_DATA): Add discard_local_tests.syms.
11984 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11985 (discard_local_tests.syms, discard_locals_test.o): New make rules.
11986 * testsuite/Makefile.in: Regenerate.
11987 * testsuite/discard_locals_test.c: New file.
11988 * testsuite/discard_locals_test.sh: Same.
11990 2009-06-05 Doug Kwan <dougkwan@google.com>
11992 * object.cc (Sized_relobj::Sized_relobj): Initialize
11993 discarded_eh_frame_shndx_ to -1U.
11994 (Sized_relobj::do_layout): Record index of a discard .eh_frame
11996 (Sized_relobj::do_count_local_symbols): Skip local symbols in
11997 a discarded .eh_frame section.
11998 (Sized_relobj::do_finalize_local_symbols): Ditto.
11999 * object.h (class Sized_relobj): Declare new member
12000 discarded_eh_frame_shndx_.
12001 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12002 (local_labels_test.o, local_labels_test): New rules.
12003 * testsuite/Makefile.in: Regenerate.
12005 2009-06-04 Doug Kwan <dougkwan@google.com>
12007 * layout.cc (Layout::section_name_mapping): Add mapping for
12008 special ARM sections.
12010 2009-06-03 Doug Kwan <dougkwan@google.com>
12012 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12013 (utils::has_overflow): Same.
12015 2009-06-03 Ian Lance Taylor <iant@google.com>
12017 * layout.cc (Layout::section_name_mapping): New array, replacing
12018 Layout::linkonce_mapping.
12019 (Layout::section_name_mapping_count): New variable, replacing
12020 Layout::linkonce_mapping_count.
12021 (Layout::linkonce_output_name): Remove.
12022 (Layout::output_section_name): Rewrite.
12023 * layout.h (class Layout): Rename Linkonce_mapping to
12024 Section_name_mapping, linkonce_mapping to section_name_mapping,
12025 linkonce_mapping_count to section_name_mapping_count. Don't
12026 declare linkonce_output_name.
12028 2009-06-03 Doug Kwan <dougkwan@google.com>
12030 * gold/arm.cc (namespace utils): New.
12031 (Target_arm::reloc_is_non_pic): Define new method.
12032 (class Arm_relocate_functions): New.
12033 (Target_arm::Relocate::relocate): Handle relocation types used by
12036 2009-06-03 Ian Lance Taylor <iant@google.com>
12038 * arm.cc (Target_arm::scan::global): Use || instead of |.
12040 2009-06-02 Doug Kwan <dougkwan@google.com>
12042 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
12043 issued_non_pic_error_.
12044 (class Target_arm::Scan): Declare new method check_non_pic.
12045 Define new method symbol_needs_plt_entry.
12046 Declare new data member issued_non_pic_error_.
12047 (class Target_arm::Relocate): Declare new method
12048 should_apply_static_reloc.
12049 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12050 (Target_arm::Scan::check_non_pic): Define new method.
12051 (Target_arm::Scan::local): Handle a small subset of reloc types used
12053 (Target_arm::Scan::local): Same.
12054 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12056 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
12058 * incremental.cc (Incremental_inputs::report_command_line): Filter
12059 out --incremental-* options.
12061 2009-05-29 Doug Kwan <dougkwan@google.com>
12063 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12065 (class Target_arm): Update comment.
12066 (Target_arm::Target_arm): Initialize new data members GOT_,
12067 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12068 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12069 and Target_arm::rel_dyn_section.
12070 Declare new_enum Target_arm::Got_type.
12071 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12073 Update commments for member do_dynsym_value.
12074 (Target_arm::got_size, Target_arm::plt_section,
12075 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12076 new methods inside class defintion.
12077 (Target_arm::got_section): Define new method.
12078 (Target_arm::rel_dyn_section): Same.
12079 (Output_data_plt_arm): New template class.
12080 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12081 (Output_data_plt_arm:do_adjust_output_section): Define new method.
12082 (Output_data_plt_arm::add_entry): Same.
12083 (Output_data_plt_arm::first_plt_entry): Define new
12084 static data member for PLT instruction template.
12085 (Output_data_plt_arm::plt_entry): Same.
12086 (Output_data_plt_arm::do_write): Define new method.
12087 (Target_arm::make_plt_entry): Same.
12088 (Target_arm::do_finalize_sections): Same.
12089 (Target_arm::do_dynsym_value): Same.
12091 2009-05-28 Doug Kwan <dougkwan@google.com>
12093 * Makefile.am (TARGETSOURCES): Add arm.cc.
12094 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12095 * Makefile.in: Regenerate.
12096 * arm.cc: New file.
12097 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12099 2009-05-26 Doug Kwan <dougkwan@google.com>
12101 * options.cc (General_options::parse_exclude_libs). Fix a comment.
12102 (General_options::check_excluded_libs): Strip off directories in
12103 archive name before matching like GNU ld does.
12104 * testsuite/Makefile.am (MOSTLYCLEANFILES,
12105 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12106 (exclude_libs_test_LDFLAGS): Add linker option
12107 -Wl,--exclude-libs,libexclude_libs_test_3
12108 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12109 an explicit archive without using -l.
12110 (alt/libexclude_libs_test_3.a): New make rule.
12111 * testsuite/Makefile.in: Regenerate.
12112 * testsuite/exclude_libs_test.c : Declare lib3_default().
12114 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12115 * exclude_libs_test_3.c: New file.
12117 2009-05-26 Nick Clifton <nickc@redhat.com>
12119 * po/id.po: New Indonesian translation.
12120 * po/gold.pot: Updated template file.
12122 2009-05-22 Sriraman Tallam <tmsriram@google.com>
12124 * testsuite/Makefile.am: Add -ffunction-sections to compile
12125 gc_comdat_test files. Add -Wl,--gc-sections to build
12127 * testsuite/Makefile.in: Regenerate.
12128 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12130 2009-05-21 Sriraman Tallam <tmsriram@google.com>
12132 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12133 kept comdat section was garbage collected.
12134 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12135 * testsuite/Makefile.in: Regenerate.
12136 * testsuite/gc_comdat_test.sh: New file.
12137 * testsuite/gc_comdat_test_1.cc: New file.
12138 * testsuite/gc_comdat_test_2.cc: New file.
12140 2009-05-19 Doug Kwan <dougkwan@google.com>
12142 * archive.cc (Archive::Archive): Move constructor from archive.h
12143 to here. Initialize no_export_.
12144 (Archive::get_elf_object_for_member): Set no_export flag of object.
12145 * archive.h (Archive::Archive): Move constructor body to
12147 (Archive::no_export): New method.
12148 (Archive::no_export_): New field.
12149 * object.h (Object::Object): Initialize no_export_ to false.
12150 (Object::no_export, Object::set_no_export): New methods.
12151 (Object::no_export_): New field.
12152 * options.cc (General_options::parse_exclude_libs): New method.
12153 (General_options::check_excluded_libs) Same.
12154 * options.h (exclude_libs): New option.
12155 (General_options::check_excluded_libs): New method declaration.
12156 (General_options::excluded_libs_): New field.
12157 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12158 default or protected visibility if an object has no-export flag set.
12159 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12160 (check_SCRIPTS): Add exclude_libs_test.sh.
12161 (check_DATA): Add exclude_libs_test.syms.
12162 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12163 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12164 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12165 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12166 (exclude_libs_test.syms, libexclude_libs_test_1.a,
12167 libexclude_libs_test_2.a): New rules.
12168 * testsuite/Makefile.in: Regenerate.
12169 * testsuite/exclude_libs_test.c: New file.
12170 * testsuite/exclude_libs_test.sh: Ditto.
12171 * testsuite/exclude_libs_test_1.c: Ditto.
12172 * testsuite/exclude_libs_test_2.c: Ditto.
12174 2009-05-15 Ian Lance Taylor <iant@google.com>
12176 * configure.ac: Check for declarations for cases where libiberty.h
12177 checks HAVE_DECL_xxx.
12178 * configure, config.in: Rebuild.
12180 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
12182 * gold.h (Incremental_argument_list): Remove (invalid) forward
12184 * incremental.cc (Incremental_inputs::report_achive): New method.
12185 (Incremental_inputs::report_object): New method.
12186 (Incremental_inputs::report_script): New method.
12187 (Incremental_inputs::finalize_inputs): New method.
12188 (Incremental_inputs::finalize): Call finalize_inputs().
12189 (Incremental_inputs::sized_create_incremental_inputs_section_data):
12190 Create inputs entries.
12191 * incremental.h (Incremental_input_type): New enum.
12192 (Incremental_inputs::Incremental_input): Initialize new fields.
12193 (Incremental_inputs::report_inputs): New method.
12194 (Incremental_inputs::report_achive): New method.
12195 (Incremental_inputs::report_object): New method.
12196 (Incremental_inputs::report_script): New method.
12197 (Incremental_inputs::finalize_inputs): New method.
12198 (Incremental_inputs::Input_info): New struct.
12199 (Incremental_inputs::Input_info_map): New typedef.
12200 (Incremental_inputs::lock_): New field.
12201 (Incremental_inputs::Inputs_): New field.
12202 (Incremental_inputs::Inputs_map): New field.
12203 * main.cc (main): Call Incremental_input::report_inputs.
12204 * options.h (Input_argument_list): Typedef moved from
12206 (Input_file_group::Files): Remove, use ::Input_argument_list.
12207 (Input_file_group::Input_argument_list): Remove, use
12208 ::Input_argument_list.
12209 * plugin.cc (Plugin_manager::add_input_file): Add error in
12211 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12213 * script.cc (read_input_script): Call
12214 Incremental_input::report_script.
12215 * script.h (Script_info): New class.
12217 2009-04-27 Ian Lance Taylor <iant@google.com>
12219 * x86_64.cc (do_adjust_output_section): Set entsize to
12222 2009-04-23 Elliott Hughes <enh@google.com>
12224 * output.cc (Output_file::close): After short writes, continue
12225 writing from the correct offset in the buffer being written.
12227 2009-04-23 Chris Demetriou <cgd@google.com>
12229 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12230 * configure: Regenerate.
12231 * config.in: Regenerate.
12232 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12233 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12235 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
12237 * incremental.cc (Incremental_inputs_header_data): Renamed from
12238 Incremental_input_header_data.
12239 (Incremental_inputs_header_data::data_size): New field.
12240 (Incremental_inputs_header_data::put_input_file_count): Renamed
12241 from input_file_count.
12242 (Incremental_inputs_header_data::put_command_line_offset): Renamed
12243 from command_line_offset.
12244 (Incremental_inputs_header_data::put_reserved): Renamed from
12246 (Incremental_inputs_entry_data): Renamed from
12247 Incremental_input_entry_data.
12248 (Incremental_inputs_entry_data::data_size): New field.
12249 (Incremental_inputs::report_command_line): New method.
12250 (Incremental_inputs::finalize): New method.
12251 (Incremental_inputs::create_incremental_inputs_data): New method.
12252 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12253 * incremental.h: New file.
12254 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12255 (Layout::finalize): Create incremental inputs section in
12256 incremental builds.
12257 (Layout::create_incremental_info_sections): New method.
12258 * layout.h (Layout::incremental_inputs): New method.
12259 (Layout::create_incremental_info_sections): New method.
12260 (Layout::incremental_inputs_): New field.
12261 * main.cc (main): Notify Incremental_input of the command line.
12263 2009-04-01 Ian Lance Taylor <iant@google.com>
12264 Mikolaj Zalewski <mikolajz@google.com>
12266 * gold.h (reserve_unordered_map): Define, three versions, one for
12267 each version of Unordered_map.
12268 * layout.cc (Layout::Layout): Remove options parameter. Add
12269 number_of_input_files parameter. Don't initialize options_.
12270 Initialize number_of_input_files_ and resized_signatures_. Move
12271 sections_are_attached_.
12272 (Layout::layout_group): Reserve space for group_signatures_.
12273 (Layout::find_or_add_kept_section): Change name parameter to be a
12274 reference. Resize signatures_ map when it gets large enough.
12275 (Layout::layout_eh_frame): Use parameters->options() instead of
12277 (Layout::make_output_section): Likewise.
12278 (Layout::attach_allocated_section_to_segment): Likewise.
12279 (Layout::finalize, Layout::create_executable_stack): Likewise.
12280 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12281 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12282 * layout.h (class Layout): Update declarations. Remove options_
12283 field. Add number_of_input_files_ and resized_signatures_
12284 fields. Move sections_are_attached_ field.
12285 * main.cc (main): Pass number of input files to Layout
12286 constructor. Don't pass options.
12288 2009-03-30 Ian Lance Taylor <iant@google.com>
12290 * ffsll.c (ffsll): Correct implementation.
12292 2009-03-27 Ian Lance Taylor <iant@google.com>
12294 * ffsll.c: New file.
12295 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12296 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12297 * ftruncate.c (ftruncate): Declare before definition.
12298 * mremap.c (mremap): Likewise.
12299 * pread.c (pread): Likewise.
12300 * configure, Makefile.in, config.in: Rebuild.
12302 * mremap.c: New file.
12303 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12304 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12305 (mremap): Declare if HAVE_MREMAP is not defined.
12306 * configure, Makefile.in, config.in: Rebuild.
12308 2009-03-27 Cary Coutant <ccoutant@google.com>
12310 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12311 position independent.
12312 * sparc.cc (Target_sparc::check_non_pic): Likewise.
12313 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12315 2009-03-24 Cary Coutant <ccoutant@google.com>
12317 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12319 (needs_dynamic_reloc): Likewise.
12321 2009-03-24 Ian Lance Taylor <iant@google.com>
12323 * yyscript.y (file_cmd): Recognize EXTERN.
12324 (extern_name_list, extern_name_list_body): New nonterminals.
12325 * script.cc (script_add_extern): Define.
12326 * script-c.h (script_add_extern): Declare.
12328 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
12330 * object.cc (is_elf_object): Define.
12331 * object.h (is_elf_object): Declare.
12332 * archive.cc (Archive::get_elf_object_for_member): Call
12334 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12336 2009-03-24 Elliott Hughes <enh@google.com>
12338 * output.cc (Output_file::map_anonymous): Define.
12339 (Output_file::map): Use map_anonymous. If the regular mmap fails,
12340 try an anonymous one. Report the size if the mmap fails.
12341 * output.h (class Output_file): Declare map_anonymous.
12343 2009-03-24 Ian Lance Taylor <iant@google.com>
12345 * target-select.cc (instantiate_target): Don't acquire the lock if
12346 the instantiated_target_ field has already been set.
12348 2009-03-23 Ian Lance Taylor <iant@google.com>
12350 * gold-threads.h (class Initialize_lock): Define.
12351 * gold-threads.cc (class Initialize_lock_once): Define.
12352 (initialize_lock_control): New static variable.
12353 (initialize_lock_pointer): New static variable.
12354 (initialize_lock_once): New static function.
12355 (Initialize_lock::Initialize_lock): Define.
12356 (Initialize_lock::initialize): Define.
12357 * target-select.h: Include "gold-threads.h".
12358 (class Target_selector): Add lock_ and initialize_lock_ fields.
12359 Don't define instantiate_target, just declare it.
12360 * target-select.cc (Target_selector::Target_selector): Initialize
12362 (Target_selector::instantiate_target): Define.
12363 * descriptors.h: Include "gold-threads.h".
12364 (class Descriptors): Add initialize_lock_ field.
12365 * descriptors.cc (Descriptors::Descriptors): Initialize new
12367 (Descriptors::open): Use initialize_lock_ field
12368 * errors.h (class Errors): Add initialize_lock_ field.
12369 * errors.cc (Errors::Errors): Initialize new field.
12370 (Errors::initialize_lock): Use initialize_lock_ field.
12371 * powerpc.cc (class Target_selector_powerpc): Remove
12372 instantiated_target_ field. In do_recognize call
12373 instantiate_target rather than do_instantiate_target. In
12374 do_instantiate_target just allocate a new target.
12375 * sparc.cc (class Target_selector_sparc): Likewise.
12377 * freebsd.h: New file.
12378 * i386.cc: Include "freebsd.h".
12379 (Target_i386): Derive from Target_freebsd rather than
12381 (Target_selector_i386): Derive from Target_selector_freebsd rather
12382 than Target_selector.
12383 * x86_64.cc: Include "freebsd.h".
12384 (Target_x86_64): Derive from Target_freebsd rather than
12386 (Target_selector_x86_64): Derive from Target_selector_freebsd
12387 rather than Target_selector.
12388 * target.h (class Target): Add adjust_elf_header and
12389 do_adjust_elf_header.
12390 * output.cc (Output_file_header:: do_sized_write): Call target
12391 adjust_elf_header routine.
12392 * configure.tgt: Set targ_osabi.
12393 * configure.ac: Define GOLD_DEFAULT_OSABI.
12394 * parameters.cc (Parameters::default_target): Pass
12395 GOLD_DEFAULT_OSABI to select_target.
12396 * target-select.h (class Target_selector): Make instantiate_target
12397 protected rather than private.
12398 * Makefile.am (HFILES): Add freebsd.h.
12399 * configure, Makefile.in, config.in: Rebuild.
12401 * merge.cc (do_add_input_section): Correct pend value. Change
12402 message about last entry not being null terminated from error to
12405 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
12407 * incremental.cc: New file.
12408 * Makefile.am (CCFILES): Add incremental.cc.
12409 * Makefile.in: Rebuild.
12411 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
12413 * layout.cc (Layout::output_section_name): Preserve names
12414 of '.note.' sections.
12416 2009-03-19 Ian Lance Taylor <iant@google.com>
12418 * descriptors.cc (Descriptors::open): Check that the options are
12419 valid before using them.
12421 2009-03-18 Ian Lance Taylor <iant@google.com>
12423 * script-sections.h: Include <list>.
12424 (class Script_sections): Change Sections_elements from std::vector
12425 to std::list. Typedef public Elements_iterator. Add
12426 orphan_section_placement_, data_segment_align_start_, and
12427 saw_data_segment_align_ fields. Remove data_segment_align_index_
12429 * script-sections.cc (class Orphan_section_placement): New class.
12430 (class Sections_element): Add virtual functions is_relro and
12431 orphan_section_init. Remove virtual function place_orphan_here.
12432 (class Output_section_definition): Add is_relro and
12433 orphan_section_init. Remove place_orphan_here.
12434 (class Orphan_output_section): Likewise.
12435 (Script_sections::Script_sections): Update for field changes.
12436 (Script_sections::data_segment_align): Set saw_data_segment_align_
12437 and data_segment_align_start_, not data_segment_align_index.
12438 (Script_sections::data_segment_relro_end): Check
12439 saw_data_segment_align_. Use data_segment_align_start_ rather
12440 than data_segment_align_index_.
12441 (Script_sections::place_orphan): Rewrite to use
12442 Orphan_section_placement.
12444 2009-03-17 Ian Lance Taylor <iant@google.com>
12446 * archive.cc (Archive::add_symbols): Check for a version attached
12447 to the symbol name in the archive map.
12448 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12449 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12450 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12451 (ver_test_11.a): New target.
12452 * testsuite/Makefile.in: Rebuild.
12454 * configure.ac: Check for chsize and posix_fallocate. Replace
12456 * ftruncate.c: New file, from gnulib.
12457 * output.cc (posix_fallocate): Define dummy version if not
12458 HAVE_POSIX_FALLOCATE.
12459 (Output_file::map): Call posix_fallocate rather than lseek and
12461 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12462 * configure, Makefile.in, config.in: Rebuild.
12464 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
12466 * layout.h (Layout::create_note): Add section_name parameter.
12467 * layout.cc (Layout::create_note): Likewise.
12468 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12470 2009-03-17 Ian Lance Taylor <iant@google.com>
12472 * descriptors.cc: Include "options.h".
12473 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12474 (Descriptors::open): Always use O_CLOEXEC when opening a new
12475 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
12476 then set FD_CLOEXEC.
12478 * sparc.cc (class Target_sparc): Add has_got_section.
12479 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12480 make sure we have a GOT section.
12482 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12483 (Target_sparc::Scan::local): Likewise.
12484 (Target_sparc::Scan::global): Likewise.
12485 (Target_sparc::Relocate::relocate): Likewise.
12486 (Target_sparc::Relocate::relocate_tls): Likewise.
12488 * symtab.cc (Symbol_table::define_default_version): New function,
12489 broken out of add_from_object.
12490 (Symbol_table::add_from_object): Call define_default_version.
12491 (Symbol_table::define_special_symbol): Add resolve_oldsym
12492 parameter. Change all callers. If the version for a symbol comes
12493 from a version script, resolve it with the symbol with the same
12494 name with no version. Also add the symbol without a version if
12496 (do_define_in_output_data): If resolving with oldsym, don't delete
12498 (do_define_in_output_segment): Likewise.
12499 (do_define_as_constant): Likewise.
12500 * symtab.h (class Symbol_table): Update declarations.
12502 2009-03-13 Ian Lance Taylor <iant@google.com>
12504 * readsyms.cc (Read_symbols::incompatible_warning): New function.
12505 (Read_symbols::requeue): New function.
12506 (Read_symbols::do_read_symbols): If make_elf_object fails because
12507 the target type is not configured, and the file was searched for,
12508 issue a warning and retry with the next directory.
12509 (Add_symbols::run): If the file has an incompatible format, and
12510 it was searched for, requeue the Read_symbols task. On error,
12511 release the object.
12512 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
12513 dirindex parameter to constructor. Change all callers. Declare
12514 incompatible_warning and requeue.
12515 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12516 input_argument_ and input_group_ fields. Add them to
12517 constructor. Change all callers.
12518 (class Read_script): Add dirindex_ field. Add it to constructor.
12519 Change all callers.
12520 * archive.cc (Archive::setup): Remove input_objects parameter.
12521 Change all callers.
12522 (Archive::get_file_and_offset): Likewise.
12523 (Archive::read_all_symbols): Likewise.
12524 (Archive::read_symbols): Likewise.
12525 (Archive::get_elf_object_for_member): Remove input_objects
12526 parameter. Add punconfigured parameter. Change all callers.
12527 (Archive::add_symbols): Change return type to bool. Check return
12528 value of include_member.
12529 (Archive::include_all_members): Likewise.
12530 (Archive::include_member): Change return type to bool. Return
12531 false if first included object has incompatible target. Set
12532 included_member_ field.
12533 (Add_archive_symbols::run): If add_symbols returns false, requeue
12535 * archive.h (class Archive): Add included_member_ field.
12536 Initialize it in constructor. Add input_file and searched_for
12537 methods. Update declarations.
12538 (class Add_archive_symbols): Add dirpath_, dirindex_, and
12539 input_argument_ fields. Add them to constructor. Change all
12541 * script.cc: Include "target-select.h".
12542 (class Parser_closure): Add skip_on_incompatible_target_ and
12543 found_incompatible_target_ fields. Add
12544 skip_on_incompatible_target parameter to constructor. Change all
12545 callers. Add methods skip_on_incompatible_target,
12546 clear_skip_on_incompatible_target, found_incompatible_target, and
12547 set_found_incompatible_target.
12548 (read_input_script): Add dirindex parameter. Change all callers.
12549 If parser finds an incompatible target, requeue Read_symbols
12551 (script_set_symbol): Clear skip_on_incompatible_target in
12553 (script_add_assertion, script_parse_option): Likewise.
12554 (script_start_sections, script_add_phdr): Likewise.
12555 (script_check_output_format): New function.
12556 * script.h (read_input_script): Update declaration.
12557 * script-c.h (script_check_output_format): Declare.
12558 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12559 (ignore_cmd): Remove OUTPUT_FORMAT.
12560 * fileread.cc (Input_file::Input_file): Add explicit this.
12561 (Input_file::will_search_for): New function.
12562 (Input_file::open): Add pindex parameter. Change all callers.
12563 * fileread.h (class Input_file): Add input_file_argument method.
12564 Declare will_search_for. Update declarations.
12565 * object.cc (make_elf_object): Add punconfigured parameter.
12566 Change all callers.
12567 * object.h (class Object): Make input_file public. Add
12568 searched_for method.
12569 (make_elf_object): Update declaration.
12570 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
12572 * dirsearch.h (class Dirsearch): Update declaration.
12573 * options.h (class General_options): Add --warn-search-mismatch.
12574 * parameters.cc (Parameters::is_compatible_target): New function.
12575 * parameters.h (class Parameters): Declare is_compatible_target.
12576 * workqueue.cc (Workqueue::add_blocker): New function.
12577 * workqueue.h (class Workqueue): Declare add_blocker.
12579 * fileread.cc (Input_file::open): Remove options parameter.
12580 Change all callers.
12581 (Input_file::open_binary): Likewise.
12582 * script.cc (read_input_script): Likewise.
12583 * readsyms.h (class Read_symbols): Remove options_ field. Remove
12584 options parameter from constructor. Change all callers.
12585 (class Read_script): Likewise.
12586 * fileread.h (class Input_file): Update declarations.
12587 * script.h (read_input_script): Update declaration.
12589 2009-03-10 Nick Clifton <nickc@redhat.com>
12591 * po/es.po: New Spanish translation.
12593 2009-03-06 Cary Coutant <ccoutant@google.com>
12595 * options.cc (parse_short_option): Keep dash_z from registering itself.
12597 2009-03-03 Ian Lance Taylor <iant@google.com>
12600 * target-reloc.h (relocate_section): Pass output_section to
12602 * i386.cc (Target_i386::should_apply_static_reloc): Add
12603 output_section parameter. Change all callers.
12604 (Target_i386::Relocate::relocate): Add output_section parameter.
12605 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12606 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12607 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12608 * testsuite/two_file_shared.sh: New script.
12609 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12610 (check_DATA): Add two_file_shared.dbg.
12611 (two_file_shared.dbg): New target.
12612 * testsuite/Makefile.in: Rebuild.
12614 2009-03-01 Ian Lance Taylor <iant@google.com>
12616 * configure.ac: Check for byteswap.h.
12617 * configure: Rebuild.
12618 * config.in: Rebuild.
12620 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
12622 * layout.cc (Layout::find_or_add_kept_section): New function.
12623 (Layout::add_comdat): Removed.
12624 * layout.h (struct Kept_section): Move out of class Layout.
12625 Remove trailing underscores from field names. Add group_sections
12626 field. Rename group_ field to is_group. Change all uses.
12627 (class Layout): Declare find_or_add_kept_section, not add_comdat.
12628 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12629 comdat_groups_ field.
12630 (Sized_relobj::include_section_group): Use
12631 find_or_add_kept_section and Kept_section::group_sections.
12632 (Sized_relobj::include_linkonce_section): Likewise.
12633 * object.cc (class Sized_relobj): Don't define Comdat_group or
12634 Comdat_group_table. Remove find_comdat_group and
12635 add_comdat_group. Remove comdat_groups_ field.
12636 * plugin.cc (include_comdat_group): Use
12637 Layout::find_or_add_kept_section.
12639 2009-02-28 Ian Lance Taylor <iant@google.com>
12641 * README: --gc-sections and map files are now supported. Document
12642 some build requirements.
12645 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12646 relocatable link set the value of the section symbol to zero.
12647 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12648 relocatable link don't include the section address in the local
12651 2009-02-27 Ian Lance Taylor <iant@google.com>
12654 * options.h (class Search_directory): Add is_system_directory.
12655 (class General_options): Declare is_in_system_directory.
12656 * options.cc (get_relative_sysroot): Make static.
12657 (get_default_sysroot): Make static.
12658 (General_optoins::is_in_system_directory): New function.
12659 * fileread.cc (Input_file::is_in_system_directory): New function.
12660 * fileread.h (class Input_file): Declare is_in_system_directory.
12661 * object.h (class Object): Add is_in_system_directory.
12662 (class Input_objects): Remove system_library_directory_ field.
12663 * object.cc (Input_objects::add_object): Don't set
12664 system_library_directory_.
12665 (input_objects::found_in_system_library_directory): Remove.
12666 * symtab.cc (Symbol_table::write_globals): Remove input_objects
12667 parameter. Change all callers.
12668 (Symbol_table::sized_write_globals): Likewise.
12669 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12670 Call Object::is_in_system_directory.
12671 * symtab.h (class Symbol_table): Update declarations.
12674 * descriptors.h (Open_descriptor): Add is_on_stack field.
12675 * descriptors.cc (Descriptors::open): If the descriptor is on the
12676 top of the stack, remove it. Initialize is_on_stack field.
12677 (Descriptors::release): Only add pod to stack if it is not on the
12679 (Descriptors::close_some_descriptor): Clear stack_next and
12680 is_on_stack fields.
12683 * output.cc (Output_section::find_starting_output_address): Rename
12684 from starting_output_address; add PADDR parameter; change return
12686 * output.h (class Output_section): Declare
12687 find_starting_output_address instead of starting_output_address.
12688 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12689 section symbol for which we can't find a merge section.
12692 * symtab.cc (Symbol_table::add_from_object): If the visibility is
12693 hidden or internal, force the symbol to be local.
12694 * resolve.cc (Symbol::override_visibility): Define.
12695 (Symbol::override_base): Use override_visibility.
12696 (Symbol_table::resolve): Likewise.
12697 (Symbol::override_base_with_special): Likewise.
12698 (Symbol_table::override_with_special): If the visibility is hidden
12699 or internal, force the symbol to be local.
12700 * symtab.h (class Symbol): Add set_visibility and
12701 override_visibility.
12702 * testsuite/ver_test_1.sh: New file.
12703 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12704 (check_DATA): Add ver_test_1.syms.
12705 (ver_test_1.syms): New target.
12706 * testsuite/Makefile.in: Rebuild.
12708 2009-02-25 Cary Coutant <ccoutant@google.com>
12710 * layout.cc (Layout::choose_output_section): Don't rename sections
12711 when using a linker script that has a SECTIONS clause.
12712 * Makefile.in: Regenerate.
12714 * testsuite/Makefile.am (script_test_5.sh): New test case.
12715 * testsuite/Makefile.in: Regenerate.
12716 * testsuite/script_test_5.cc: New file.
12717 * testsuite/script_test_5.sh: New file.
12718 * testsuite/script_test_5.t: New file.
12720 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
12722 * archive.cc (Archive::include_member): Update calls to add_symbols.
12723 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12724 the Layout argument.
12725 * dynobj.h (do_add_symbols): Add the Layout argument.
12726 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12728 * object.h (Object::add_symbols): Add the Layout argument.
12729 (Object::do_add_symbols): Add the Layout argument.
12730 (Sized_relobj::do_add_symbols): Add the Layout argument.
12731 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12732 Unify the two versions.
12733 (Add_plugin_symbols): Remove.
12734 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12735 (Sized_pluginobj::do_add_symbols): Unify the two versions.
12736 (Add_plugin_symbols): Remove.
12737 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12738 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12739 (Add_symbols::run): Make it work with Pulginobj.
12741 2009-02-06 Ian Lance Taylor <iant@google.com>
12743 * object.cc (Sized_relobj::do_layout): Make info message start
12744 with lower case letter.
12746 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
12748 * binary.cc: Fix file comment.
12750 * options.h (enum Incremental_disposition): Define.
12751 (class General_options): Add new options: --incremental,
12752 --incremental_changed, --incremental_unchanged,
12753 --incremental_unknown. Add incremental_disposition_ and
12754 implicit_incremental_ fields.
12755 (General_options::incremental_disposition): New function.
12756 (class Position_dependent_options): Add incremental_disposition
12758 (Position_dependent_options::copy_from_options): Set incremental
12760 * options.cc (General_options::parse_incremental_changed): New
12762 (General_options::parse_incremental_unchanged): New function.
12763 (General_options::parse_incremental_unknown): New function.
12764 (General_options::General_options): Initialize new fields
12765 incremental_disposition_ and implicit_incremental_.
12766 (General_options::finalize): Check for uasge of --incremental-*
12767 without --incremental.
12769 2009-02-06 Chris Demetriou <cgd@google.com>
12771 * gold.h (gold_undefined_symbol): Change to take only a Symbol
12772 pointer and to report location as the file name associated with
12774 (gold_undefined_symbol_at_location): New function to replace the
12775 old gold_undefined_symbol functionality.
12776 * target-reloc.h (relocate_section): Update to use
12777 gold_undefined_symbol_at_location.
12778 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12779 Call gold_undefined_symbol function rather than gold_error.
12780 * errors.h (Errors::undefined_symbol): Take location as a
12781 string, rather than calculating it from a relocation.
12782 * errors.cc (Errors::fatal): Print "fatal error:" before the
12784 (Errors::error, Errors::error_at_location): Print "error: "
12785 before the formatted message.
12786 (Errors::undefined_symbol): Take location as a string, rather
12787 than calculating it from a relocation.
12788 (gold_undefined_symbol_at_location): New function akin to
12789 old gold_undefined_symbol, calculates location from relocation.
12790 (gold_undefined_symbol): Change to take only a Symbol pointer
12791 and to report location as the file name associated with the symbol.
12792 * testsuite/debug_msg.sh: Update for changed error messages.
12793 * testsuite/undef_symbol.sh: Likewise.
12795 2009-02-04 Duncan Sands <baldrick@free.fr>
12798 * reduced_debug_output.h
12799 (Output_reduced_debug_abbrev_section::failed): Use format for
12801 (Output_reduced_debug_info_section::faild): Likewise.
12803 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
12805 * script.cc (Lazy_demangler): New class.
12806 (Version_script_info::get_symbol_version_helper): Demangle a
12809 2009-01-29 Cary Coutant <ccoutant@google.com>
12811 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12813 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12815 2009-01-28 Ian Lance Taylor <iant@google.com>
12817 * version.cc (version_string): Bump to 1.9.
12819 * gold.h: Include <cstring> and <stdint.h>.
12820 * version.cc: Include <cstdio>.
12821 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12823 * reduced_debug_output.cc (insert_into_vector): Rename from
12824 Insert_into_vector; change all callers. Use Swap_unaligned to
12825 avoid aliasing issue; remove union since it is unnecessary.
12827 2009-01-27 Sriraman Tallam <tmsriram@google.com>
12829 * Makefile.am (CCFILES): Add gc.cc.
12830 (HFILES): Add gc.h.
12831 * Makefile.in: Regenerate.
12832 * gold.cc (Gc_runner): New class.
12833 (queue_initial_tasks): Call garbage collection related tasks
12834 when corresponding options are invoked.
12835 (queue_middle_gc_tasks): New function.
12836 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12837 processed early before laying out sections during garbage collection.
12838 * gold.h (queue_middle_gc_tasks): New function.
12839 (is_prefix_of): Move from "layout.cc".
12840 * i386.cc (Target_i386::gc_process_relocs): New function.
12841 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12842 * main.cc (main): Create object of class "Garbage_collection".
12843 * object.cc (Relobj::copy_symbols_data): New function.
12844 (Relobj::is_section_name_included): New function.
12845 (Sized_relobj::do_layout): Allow this function to be called twice
12846 during garbage collection and defer layout of section during the
12848 * object.h (Relobj::get_symbols_data): New function.
12849 (Relobj::is_section_name_included): New function.
12850 (Relobj::copy_symbols_data): New function.
12851 (Relobj::set_symbols_data): New function.
12852 (Relobj::get_relocs_data): New function.
12853 (Relobj::set_relocs_data): New function.
12854 (Relobj::is_output_section_offset_invalid): New pure virtual function.
12855 (Relobj::gc_process_relocs): New function.
12856 (Relobj::do_gc_process_relocs): New pure virtual function.
12857 (Relobj::sd_): New data member.
12858 (Sized_relobj::is_output_section_offset_invalid): New function.
12859 (Sized_relobj::do_gc_process_relocs): New function.
12860 * options.h (General_options::gc_sections): Modify to not be a no-op.
12861 (General_options::print_gc_sections): New option.
12862 * plugin.cc (Plugin_finish::run): Remove function call to
12863 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
12864 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12865 * reloc.cc (Read_relocs::run): Add task to process relocs and
12866 determine unreferenced sections when doing garbage collection.
12867 (Gc_process_relocs): New class.
12868 (Sized_relobj::do_gc_process_relocs): New function.
12869 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12870 sections that are garbage collected.
12871 * reloc.h (Gc_process_relocs): New class.
12872 * sparc.cc (Target_sparc::gc_process_relocs): New function.
12873 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12874 symbols whose corresponding sections are garbage collected.
12875 (Symbol_table::Symbol_table): Add new parameter for the garbage
12877 (Symbol_table::gc_mark_undef_symbols): New function.
12878 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12879 (Symbol_table::gc_mark_dyn_syms): New function.
12880 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12882 (Symbol_table::add_from_object): Likewise.
12883 (Symbol_table::add_from_relobj): When building shared objects, do not
12884 treat externally visible symbols as garbage.
12885 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12886 table information for static and relocatable links.
12887 * symtab.h (Symbol_table::set_gc): New function.
12888 (Symbol_table::gc): New function.
12889 (Symbol_table::gc_mark_undef_symbols): New function.
12890 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12891 (Symbol_table::gc_mark_dyn_syms): New function.
12892 (Symbol_table::gc_): New data member.
12893 * target.h (Sized_target::gc_process_relocs): New pure virtual
12895 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12896 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12898 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
12900 * options.h (General_options::gc_sections): Define as a no-op for now.
12901 (General_options::no_keep_memory): Ditto.
12902 (General_options::Bshareable): Define.
12903 * options.cc (General_options::finalize): Honor -Bshareable.
12905 2009-01-20 Andreas Schwab <schwab@suse.de>
12907 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12908 read the value in the contents, since we don't use it. Use the
12909 template endianness when writing.
12910 (Relocate::relocate): Use it for R_PPC_REL16_HA.
12912 2009-01-19 Andreas Schwab <schwab@suse.de>
12914 * configure.tgt (powerpc64-*): Fix targ_obj.
12916 2009-01-15 Ian Lance Taylor <iant@google.com>
12918 * object.cc (Sized_relobj::write_local_symbols): Don't write out
12919 local symbols when stripping all symbols.
12921 2009-01-14 Cary Coutant <ccoutant@google.com>
12923 * output.cc (Output_reloc): Add explicit instantiations.
12925 2009-01-14 Cary Coutant <ccoutant@google.com>
12927 * archive.cc (Archive::get_elf_object_for_member): Remove call
12928 to File_read::claim_for_plugin.
12929 * descriptors.cc (Descriptors::open): Remove reference to
12931 (Descriptors::claim_for_plugin): Remove.
12932 * descriptors.h (Descriptors::claim_for_plugin): Remove.
12933 (Descriptors::is_claimed): Remove.
12934 (claim_descriptor_for_plugin): Remove.
12935 * fileread.cc (File_read::claim_for_plugin): Remove.
12936 * fileread.h (File_read::claim_for_plugin): Remove.
12937 (File_read::descriptor): Reopen descriptor if necessary.
12938 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
12939 (Plugin_manager::all_symbols_read): Add task parameter. Change
12941 (Plugin_manager::get_input_file): New function.
12942 (Plugin_manager::release_input_file): New function.
12943 (Pluginobj::Pluginobj): Add filesize parameter and initialize
12944 corresponding data member.
12945 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12946 and pass to base constructor. Change all callers.
12947 (get_input_file, release_input_file): New functions.
12948 (make_sized_plugin_object): Add filesize parameter. Change all callers.
12949 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12950 (Plugin_manager::all_symbols_read): Add task parameter.
12951 (Plugin_manager::get_input_file): New function.
12952 (Plugin_manager::release_input_file): New function.
12953 (Plugin_manager::task_): New data member.
12954 (Pluginobj::Pluginobj): Add filesize parameter.
12955 (Pluginobj::filename): New function.
12956 (Pluginobj::descriptor): New function.
12957 (Pluginobj::filesize): New function.
12958 (Pluginobj::filesize_): New data member.
12959 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12960 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12961 File_read::claim_for_plugin; use Object::unlock to unlock the file.
12963 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12964 with archive libraries.
12965 * testsuite/Makefile.in: Regenerate.
12966 * testsuite/plugin_test.c (struct sym_info): New type.
12967 (get_input_file, release_input_file): New static variables.
12968 (onload): Capture new transfer vector entries.
12969 (claim_file_hook): Stop reading at end of file according to filesize.
12970 Factor out parsing of readelf output into separate function.
12971 (all_symbols_read_hook): Exercise get_input_file and release_input_file
12972 APIs and get the source file name from the symbol table. Convert
12973 source file name to corresponding object file name. Print info
12974 message when adding new input files.
12975 (parse_readelf_line): New function.
12976 * testsuite/plugin_test_1.sh: Add checks for new info messages.
12977 * testsuite/plugin_test_2.sh: Likewise.
12978 * testsuite/plugin_test_3.sh: Likewise.
12979 * testsuite/plugin_test_4.sh: New test case.
12981 2009-01-07 Ian Lance Taylor <iant@google.com>
12983 * version.cc (version_string): Bump to 1.8.
12985 2008-12-23 Cary Coutant <ccoutant@google.com>
12987 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12988 * plugin.cc (Plugin_manager::finish): Rename as
12989 layout_deferred_objects. Move cleanup to separate function.
12990 (Plugin_manager::cleanup): New function.
12991 (Plugin_finish::run): Call layout_deferred_objects and cleanup
12993 * plugin.h (Plugin_manager::finish): Rename as
12994 layout_deferred_objects.
12995 (Plugin_manager::cleanup): New function.
12996 (Plugin_manager::cleanup_done): New field.
12998 2008-12-23 Cary Coutant <ccoutant@google.com>
13000 * plugin.cc (is_visible_from_outside): New function.
13001 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13002 so we don't return "IR only" status for exported symbols or -r links.
13004 * testsuite/Makefile.am (plugin_test_3): New test case.
13005 * testsuite/Makefile.in: Regenerate.
13006 * testsuite/plugin_test_3.sh: New file.
13008 2008-12-22 Cary Coutant <ccoutant@google.com>
13010 * object.cc (Sized_relobj::layout_section): New function.
13011 (Sized_relobj::do_layout): Defer layout of input sections until after
13012 plugin has provided replacement files.
13013 (Sized_relobj::do_layout_deferred_sections): New function.
13014 * object.h (Relobj::set_section_offset): Remove virtual keyword.
13015 (Relobj::layout_deferred_sections): New function.
13016 (Relobj::do_layout_deferred_sections): New function.
13017 (Sized_relobj::do_layout_deferred_sections): New function.
13018 (Sized_relobj::layout_section): New function.
13019 (Sized_relobj::Deferred_layout): New structure.
13020 (Sized_relobj::deferred_layout_): New field.
13021 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13022 Change all callers. Layout deferred sections.
13023 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
13025 (Plugin_hook::run): Move code from do_plugin_hook inline.
13026 (Plugin_hook::do_plugin_hook): Remove.
13027 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13028 (Plugin_manager::finish): Renamed, was cleanup.
13029 (Plugin_manager::should_defer_layout): New function.
13030 (Plugin_manager::add_deferred_layout_object): New function.
13031 (Plugin_manager::Deferred_layout_list): New type.
13032 (Plugin_manager::deferred_layout_objects_): New field.
13033 (Plugin_hook::do_plugin_hook): Remove.
13035 2008-12-17 Ian Lance Taylor <iant@google.com>
13037 * options.h (class General_options): Add --no case for
13040 2008-12-16 Cary Coutant <ccoutant@google.com>
13042 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13044 (Plugin_manager::claim_file): Create plugin object even if
13045 plugin did not call the add_symbols callback.
13046 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13047 asking for more symbols than were added.
13048 * testsuite/Makefile.am (plugin_test_1): Add test case with
13050 (empty.syms): New target.
13051 * testsuite/Makefile.in: Regenerate.
13052 * testsuite/plugin_test.c (claim_file_hook): Add new debug
13053 message. Don't call add_symbols if no globals.
13054 (all_symbols_read_hook): Don't provide replacement for empty
13057 2008-12-12 Ian Lance Taylor <iant@google.com>
13059 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13060 r_type == 0 for a local symbol with r_sym == 0.
13061 (scan_relocatable_relocs): Pass r_sym to
13062 local_non_section_strategy.
13063 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13066 * configure.ac: Update test for TLS descriptors: they are
13067 supported as of glibc 2.9.
13068 * configure: Rebuild.
13070 2008-12-11 Ian Lance Taylor <iant@google.com>
13073 * target-reloc.h (Default_scan_relocatable_relocs): For each
13074 function, map r_type == 0 to RELOC_DISCARD.
13076 2008-12-10 Cary Coutant <ccoutant@google.com>
13078 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13079 object to override a kept COMDAT group from a plugin object.
13081 2008-12-09 Ian Lance Taylor <iant@google.com>
13084 * yyscript.y (file_cmd): Handle INPUT.
13086 * testsuite/initpri1.c: Change all declarations to be full
13087 prototypes by adding void, to avoid compiler warnings.
13089 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
13091 * options.cc (General_options::parse_plugin_opt): New.
13092 (General_options::add_plugin): The argument now is just the filename.
13093 (General_options::add_plugin_option): New.
13094 * options.h (plugin_opt): New.
13095 (add_plugin): Change argument name.
13096 (add_plugin_option): New.
13097 * plugin.cc (Plugin::load): Don't parse the plugin option.
13098 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13099 (Plugin::add_option): New.
13100 (Plugin::args_): Change type.
13101 (Plugin::filename_): New.
13102 (Plugin_manager::add_plugin_option): New.
13103 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13104 * testsuite/Makefile.in: Regenerate.
13106 2008-12-05 Cary Coutant <ccoutant@google.com>
13108 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13109 Handle --strip-lto-sections option.
13110 * options.h (strip_lto_sections): New option.
13112 2008-12-01 Cary Coutant <ccoutant@google.com>
13114 * plugin.cc (ld_plugin_message): Change format parameter to const.
13115 Fix mismatch between new[] and delete.
13117 2008-11-14 Cary Coutant <ccoutant@google.com>
13119 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13122 2008-11-05 Craig Silverstein <csilvers@google.com>
13124 * options.cc (General_options::parse_dynamic_list): New function.
13125 * options.h (General_options): New flags dynamic_list,
13126 dynamic_list_data, dynamic_list_cpp_new, and
13127 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
13128 (General_options::in_dynamic_list): New function.
13129 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13130 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13131 (Lex::can_continue_name): Likewise.
13133 (read_script_file): New parameter script_options.
13134 (read_dynamic_list): New function.
13135 (Script_options::define_dynamic_list): New function.
13136 (dynamic_list_keyword_parsecodes): New variable.
13137 (dynamic_list_keywords): New variable.
13138 * script.h (Script_options::define_dynamic_list): New function
13140 (read_dynamic_list): New function prototype.
13141 * symtab.cc (strprefix): New macro.
13142 (Symbol::should_add_dynsym_entry): Support dynamic_list,
13143 dynamic_list_data, dynamic_list_cpp_new, and
13144 dynamic_list_cpp_typeinfo.
13145 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13146 (dynamic_list_expr): New rule.
13147 (dynamic_list_nodes): Likewise.
13148 (dynamic_list_node): Likewise.
13149 * testsuite/Makefile.am (dynamic_list): New test.
13150 * testsuite/Makefile.in: Regenerated.
13151 * testsuite/dynamic_list.t: New file.
13152 * testsuite/dynamic_list.sh: New file.
13154 2008-11-05 Craig Silverstein <csilvers@google.com>
13156 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13157 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13158 (t11_last): Likewise.
13159 * testsuite/ver_test_6.c (main): Likewise.
13161 2008-10-07 Cary Coutant <ccoutant@google.com>
13163 * options.c (General_options::finalize): Add check for -static and
13165 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13168 2008-10-02 Cary Coutant <ccoutant@google.com>
13170 * plugin.cc (make_sized_plugin_object): Fix conditional
13171 compilation to work when not all targets are enabled.
13173 2008-09-29 Cary Coutant <ccoutant@google.com>
13175 * archive.cc (Archive::get_file_and_offset): Use filename instead
13176 of name to get library path.
13177 (Archive::include_member): Unlock external member of a thin archive.
13179 * testsuite/Makefile.am (TEST_AR): New variable.
13180 (thin_archive_test_1): New test.
13181 (thin_archive_test_2): New test.
13182 * testsuite/Makefile.in: Regenerate.
13183 * testsuite/thin_archive_main.cc: New file.
13184 * testsuite/thin_archive_test_1.cc: New file.
13185 * testsuite/thin_archive_test_2.cc: New file.
13186 * testsuite/thin_archive_test_3.cc: New file.
13187 * testsuite/thin_archive_test_4.cc: New file.
13189 2008-09-29 Cary Coutant <ccoutant@google.com>
13191 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13192 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13194 (Sized_relobj::do_finalize_local_symbols): Likewise.
13195 (Sized_relobj::map_to_kept_section): Likewise.
13196 * object.h (Sized_relobj::invalid_address): New constant.
13197 (Sized_relobj::do_output_section_offset): Check for invalid_address
13199 * output.cc (Output_reloc::local_section_offset): Use constant
13200 invalid_address instead of -1U.
13201 (Output_reloc::get_address): Likewise.
13202 (Output_section::output_address): Change -1U to -1ULL.
13203 * output.h (Output_reloc::invalid_address): New constant.
13204 * reloc.cc (Sized_relobj::write_sections): Use constant
13205 invalid_address instead of -1U.
13206 (Sized_relobj::relocate_sections): Likewise.
13207 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13208 values for merge sections.
13209 * target-reloc.h (relocate_for_relocatable): Use constant
13210 invalid_address instead of -1U.
13212 2008-09-19 Cary Coutant <ccoutant@google.com>
13214 Add plugin functionality for link-time optimization (LTO).
13215 * configure.ac (plugins): Add --enable-plugins option.
13216 * configure: Regenerate.
13217 * config.in: Regenerate.
13218 * Makefile.am (LIBDL): New variable.
13219 (CCFILES): Add plugin.cc.
13220 (HFILES): Add plugin.h.
13221 (ldadd_var): Add LIBDL.
13222 * Makefile.in: Regenerate.
13224 * archive.cc: Include "plugin.h".
13225 (Archive::setup): Don't preread archive symbols when using a plugin.
13226 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
13227 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13229 (Archive::include_member): Add symbols from plugin objects.
13230 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13231 * descriptors.cc (Descriptors::open): Check for file descriptors
13232 abandoned by plugins.
13233 (Descriptors::claim_for_plugin): New function.
13234 * descriptors.h (Descriptors::claim_for_plugin): New function.
13235 (Open_descriptor::is_claimed): New field.
13236 (claim_descriptor_for_plugin): New function.
13237 * fileread.cc (File_read::claim_for_plugin): New function.
13238 * fileread.h (File_read::claim_for_plugin): New function.
13239 (File_read::descriptor): New function.
13240 * gold.cc: Include "plugin.h".
13241 (queue_initial_tasks): Add task to call plugin hooks for generating
13243 * main.cc: Include "plugin.h".
13244 (main): Load plugin libraries.
13245 * object.h (Pluginobj): Declare.
13246 (Object::pluginobj): New function.
13247 (Object::do_pluginobj): New function.
13248 (Object::set_target): New function.
13249 * options.cc: Include "plugin.h".
13250 (General_options::parse_plugin): New function.
13251 (General_options::General_options): Initialize plugins_ field.
13252 (General_options::add_plugin): New function.
13253 * options.h (Plugin_manager): Declare.
13254 (General_options): Add --plugin option.
13255 (General_options::has_plugins): New function.
13256 (General_options::plugins): New function.
13257 (General_options::add_plugin): New function.
13258 (General_options::plugins_): New field.
13259 * plugin.cc: New file.
13260 * plugin.h: New file.
13261 * readsyms.cc: Include "plugin.h".
13262 (Read_symbols::do_read_symbols): Check for archive before checking
13263 for ELF file. Call plugin hooks to claim files.
13264 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13265 from a real object file; force override when processing replacement
13267 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13268 (Symbol::init_base_object): Likewise.
13269 (Symbol::init_base_output_data): Likewise.
13270 (Symbol::init_base_output_segment): Likewise.
13271 (Symbol::init_base_constant): Likewise.
13272 (Symbol::init_base_undefined): Likewise.
13273 (Symbol::output_section): Assert that object is not a plugin.
13274 (Symbol_table::add_from_pluginobj): New function.
13275 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13277 (Symbol_table::sized_write_globals): Likewise.
13278 (Symbol_table::add_from_pluginobj): Instantiate template.
13279 * symtab.h (Sized_pluginobj): Declare.
13280 (Symbol::in_real_elf): New function.
13281 (Symbol::set_in_real_elf): New function.
13282 (Symbol::in_real_elf_): New field.
13283 (Symbol_table::add_from_pluginobj): New function.
13285 * testsuite/Makefile.am (AM_CFLAGS): New variable.
13286 (LIBDL): New variable.
13287 (LDADD): Add LIBDL.
13288 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13289 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13290 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13291 (MOSTLYCLEANFILES): Likewise.
13292 * testsuite/Makefile.in: Regenerate.
13293 * testsuite/plugin_test.c: New file.
13294 * testsuite/plugin_test_1.sh: New file.
13295 * testsuite/plugin_test_2.sh: New file.
13297 2008-09-16 Ian Lance Taylor <iant@google.com>
13299 * target-reloc.h (relocate_section): Check whether a symbol is
13300 defined by the ABI before reporting an undefined symbol error.
13301 * target.h (Target::is_defined_by_abi): Make parameter const.
13302 (Target::do_is_defined_by_abi): Likewise.
13303 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13304 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13305 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13306 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13307 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13308 * testsuite/Makefile.in: Rebuild.
13310 * fileread.cc (make_view): Add casts to avoid warning.
13312 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13314 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13315 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13317 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13319 * options.h (General_options::output_is_executable): New.
13320 (General_options::output_is_pie): New.
13321 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13322 for shared libraries.
13323 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13325 2008-09-11 Chris Demetriou <cgd@google.com>
13327 * options.h (origin): New -z option.
13328 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13329 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13332 2008-09-05 Cary Coutant <ccoutant@google.com>
13334 * fileread.cc (File_read::make_view): Add check for attempt to map
13335 beyond end of file.
13337 2008-09-05 Cary Coutant <ccoutant@google.com>
13339 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13340 explicit instantiations.
13342 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
13345 * options.cc (General_options::finalize): Allow undefined symbols
13346 in shlibs if linking -shared.
13349 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13350 symbols as not needing a dynsym entry.
13352 2008-08-20 Craig Silverstein <csilvers@google.com>
13354 * fileread.cc (File_read::open): Do not lock the file unless it
13355 was successfully opened.
13357 2008-08-14 Cary Coutant <ccoutant@google.com>
13359 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13360 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13361 * testsuite/tls_test.cc (struct int128): 128-bit struct
13362 for testing TLS relocs with non-zero addend.
13363 (v12): New TLS variable.
13365 (t_last): Add check for v12.
13366 * testsuite/tls_test.h (t12): New function.
13367 * testsuite/tls_test_main.cc (thread_routine): Call new test.
13369 2008-08-13 Ian Lance Taylor <iant@google.com>
13371 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13372 set tls_segment_ or relro_segment_.
13373 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13375 * output.h (Output_section::clear_is_relro): New function.
13376 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13377 sections specially even when output_data_ is empty.
13378 (Output_segment::maximum_alignment): When first section is relro,
13379 only force alignment for PT_LOAD segments.
13380 * script.cc (script_data_segment_align): New function.
13381 (script_data_segment_relro_end): New function.
13382 * script-c.h (script_data_segment_align): Declare.
13383 (script_data_segment_relro_end): Declare.
13384 * script-sections.h (class Script_sections): Declare
13385 data_segment_align and data_segment_relro_end. Add fields
13386 segment_align_index_ and saw_relro_end_.
13387 * script-sections.cc (class Sections_element): Add set_is_relro
13388 virtual function. Add new bool* parameter to place_orphan_here.
13389 Add get_output_section virtual function.
13390 (class Output_section_definition): Add set_is_relro. Add new
13391 bool* parameter to place_orphan_here. Add get_output_section.
13392 Add is_relro_ field.
13393 (Output_section_definition::Output_section_definition): Initialize
13394 evaluated_address_, evaluated_load_address, evaluated_addralign_,
13395 and is_relro_ fields.
13396 (Output_section_definition::place_orphan_here): Add is_relro
13398 (Output_section_definition::set_section_addresses): Set relro for
13400 (Output_section_definition::alternate_constraint): Likewise.
13401 (class Orphan_output_section): Add new bool* parameter to
13402 place_orphan_here. Add get_output_section.
13403 (Orphan_output_section::place_orphan_here): Add is_relro
13405 (Script_sections::Script_sections): Initialize
13406 data_segment_align_index_ and saw_relro_end_.
13407 (Script_sections::data_segment_align): New function.
13408 (Script_sections::data_segment_relro_end): New function.
13409 (Script_sections::place_orphan): Set or clear is_relro.
13410 (Script_sections::set_section_addresses): Force alignment of first
13412 * yyscript.y (exp): Call script_data_segment_align and
13413 script_data_segment_relro_end.
13414 * testsuite/relro_script_test.t: New file.
13415 * testsuite/relro_test.cc (using_script): Declare.
13416 (t1, t2): Test using_script.
13417 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13418 (relro_script_test_SOURCES): Define.
13419 (relro_script_test_DEPENDENCIES): Define.
13420 (relro_script_test_LDFLAGS): Define.
13421 (relro_script_test_LDADD): Define.
13422 (relro_script_test.so): New target.
13423 * testsuite/Makefile.in: Rebuild.
13425 2008-08-06 Cary Coutant <ccoutant@google.com>
13427 * archive.cc (Archive::total_archives, Archive::total_members)
13428 (Archive::total_members_loaded): New variables.
13429 (Archive::setup): Add parameter. Add option to preread
13431 (Archive::read_armap): Add counter.
13432 (Archive::get_file_and_offset): New function.
13433 (Archive::get_elf_object_for_member): New function.
13434 (Archive::read_all_symbols): New function.
13435 (Archive::read_symbols): New function.
13436 (Archive::add_symbols): Add counters.
13437 (Archive::include_all_members): Use armap to find members if it's
13439 (Archive::include_member): Skip reading symbols if already read.
13440 Factored code into Archive::get_file_and_offset and
13441 Archive::get_elf_object_for_member. Changed call to
13442 Mapfile::report_include_archive_member.
13443 (Archive::print_stats): New function.
13444 * archive.h: Declare Object and Read_symbols_data classes.
13445 (Archive::Archive): Add initializers for new members.
13446 (Archive::setup): Add parameter.
13447 (Archive::print_stats): New function.
13448 (Archive::total_archives, Archive::total_members)
13449 (Archive::total_members_loaded): New variables.
13450 (Archive::get_file_and_offset): New function.
13451 (Archive::get_elf_object_for_member): New function.
13452 (Archive::read_all_symbols): New function.
13453 (Archive::read_symbols): New function.
13454 (Archive::Archive_member): New class.
13455 (Archive::members_): New member.
13456 (Archive::num_members_): New member.
13457 * main.cc: Include archive.h.
13458 (main): Call Archive::print_stats.
13459 * mapfile.cc (Mapfile::report_include_archive_member): Delete
13460 archive parameter; member_name is now the fully-decorated name.
13461 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13462 * options.h: (General_options): Add --preread-archive-symbols option.
13463 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13466 2008-08-04 Ian Lance Taylor <iant@google.com>
13468 * symtab.h (Symbol::use_plt_offset): New function.
13469 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13470 * powerpc.cc (Relocate::relocate): Likewise.
13471 * sparc.cc (Relocate::relocate): Likewise.
13472 * x86_64.cc (Relocate::relocate): Likewise.
13473 * testsuite/weak_plt.sh: New test.
13474 * testsuite/weak_plt_main.cc: New test.
13475 * testsuite/weak_plt_shared.cc: New test.
13476 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13477 (check_PROGRAMS): Add weak_plt.
13478 (check_DATA): Add weak_plt_shared.so.
13479 (weak_plt_main_pic.o, weak_plt): New targets.
13480 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13481 * testsuite/Makefile.in: Rebuild.
13483 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13485 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13486 * testsuite/Makefile.in: Rebuild.
13488 2008-08-04 Alan Modra <amodra@bigpond.net.au>
13490 * Makefile.am (POTFILES.in): Set LC_ALL=C.
13491 * Makefile.in: Regenerate.
13492 * po/POTFILES.in: Regenerate.
13494 2008-07-29 Ian Lance Taylor <iant@google.com>
13496 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13497 symbols before other symbols.
13498 * testsuite/script_test_2.cc (test_addr): Declare.
13499 (test_addr_alias): Declare.
13500 (main): Check that test_addr and test_addr_alias have the right
13502 * testsuite/script_test_2.t: Define test_addr_alias and
13505 2008-07-24 Ian Lance Taylor <iant@google.com>
13508 * descriptors.cc: New file.
13509 * descriptors.h: New file.
13510 * gold-threads.h (class Hold_optional_lock): New class.
13511 * fileread.cc: Include "descriptors.h".
13512 (File_read::~File_read): Release descriptor rather than closing
13514 (File_read::open) [file]: Call open_descriptor rather than open.
13515 Set is_descriptor_opened_.
13516 (File_read::open) [memory]: Assert that descriptor is not open.
13517 (File_read::reopen_descriptor): New function.
13518 (File_read::release): Release descriptor.
13519 (File_read::do_read): Make non-const. Reopen descriptor.
13520 (File_read::read): Make non-const.
13521 (File_read::make_view): Reopen descriptor.
13522 (File_read::do_readv): Likewise.
13523 * fileread.h (class File_read): Add is_descriptor_opened_ field.
13524 Update declarations.
13525 * layout.cc: Include "descriptors.h".
13526 (Layout::create_build_id): Use open_descriptor rather than open.
13527 * output.cc: Include "descriptors.h".
13528 (Output_file::open): Use open_descriptor rather than open.
13529 * archive.cc (Archive::const_iterator): Change Archive to be
13531 (Archive::begin, Archive::end): Make non-const.
13532 (Archive::count_members): Likewise.
13533 * archive.h (class Archive): Update declarations.
13534 * object.h (Object::read): Make non-const.
13535 * Makefile.am (CCFILES): Add descriptors.cc.
13536 (HFILES): Add descriptors.h.
13537 * Makefile.in: Rebuild.
13540 * gold.h: Always include <clocale>. Add Solaris workarounds
13541 following code in binutils/sysdep.h.
13544 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13545 this->eh_frame_hdr_ is NULL before using it.
13547 * dynobj.cc (Versions::Versions): Update comment.
13549 * dynobj.cc (Versions::Versions): If there is an soname, use it as
13550 the base version name.
13552 * stringpool.cc (Stringpool_template::add_with_length): Set key to
13553 array size plus one.
13554 (Stringpool_template::set_string_offsets): Subtract one from key
13555 before using it as an array index.
13556 (Stringpool_template::get_offset_with_length): Likewise.
13557 (Stringpool_template::write_to_buffer): Likewise.
13558 * stringpool.h (Stringpool_template::get_offset_from_key):
13561 2008-07-23 Ian Lance Taylor <iant@google.com>
13564 * object.h (Merged_symbol_value::value): Do our best to handle a
13568 * script.cc (Version_script_info::get_versions): Don't add empty
13569 version tag to return value.
13570 (Version_script_info::get_symbol_version_helper): Change return
13571 type to bool. Add pversion parameter. Change all callers.
13572 (script_register_vers_node): Don't require a non-NULL tag.
13573 * script.h (class Version_script_info): Update declarations.
13574 (Version_script_info::get_symbol_version): Change return type to
13575 bool. Add version parameter. Change all callers.
13576 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13577 handling. Handle an empty version from a version script.
13578 (Symbol_table::define_special_symbol): Likewise.
13579 * testsuite/ver_test_10.script: New file.
13580 * testsuite/ver_test_10.sh: New file.
13581 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13582 (check_DATA): Add ver_test_10.syms.
13583 (ver_test_10.syms, ver_test_10.so): New target.
13584 * testsuite/Makefile.in: Rebuild.
13586 2008-07-23 Simon Baldwin <simonb@google.com>
13588 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13589 to zero for undefined symbols from dynamic libraries.
13591 2008-07-23 Ian Lance Taylor <iant@google.com>
13593 * symtab.cc (Symbol_table::resolve): Remove version parameter.
13594 Change all callers.
13595 * symtab.h (class Symbol_table): Update declaration.
13596 * testsuite/ver_test_9.cc: New file.
13597 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13598 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13599 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13600 (ver_test_9.so, ver_test_9.o): New targets.
13601 * testsuite/Makefile.in: Rebuild.
13603 2008-07-22 Ian Lance Taylor <iant@google.com>
13605 * options.h (class General_options): Define --check-sections.
13606 * layout.cc (Layout::set_segment_offsets): Handle
13609 * options.h (class General_options): Define -n/--nmagic and
13611 * options.cc (General_options::finalize): For -n/--nmagic or
13612 -N/--omagic, set -static.
13613 * layout.cc (Layout::attach_allocated_section_to_segment): If
13614 -N/--omagic, don't put read-only and read-write sections in
13615 different segments.
13616 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13617 finding a read-only segment.
13618 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13619 don't set the minimum segment alignment to the common page size,
13620 and don't set the file offset to the address modulo the page size.
13621 * script-sections.cc (Script_sections::create_segments): If
13622 -n/--omagic, don't put read-only and read-write sections in
13623 different segments.
13625 * cref.cc: New file.
13626 * cref.h: New file.
13627 * options.h (class General_options): Add --print-symbol-counts.
13628 * main.cc (main): Issue defined symbol report if requested.
13629 * archive.cc (Archive::interpret_header): Make into a const member
13631 (Archive::add_symbols): Call Input_objects::archive_start and
13633 (Archive::const_iterator): Define new class.
13634 (Archive::begin, Archive::end): New functions.
13635 (Archive::include_all_members): Rewrite to use iterator.
13636 (Archive::count_members): New function.
13637 * archive.h (class Archive): Update declarations.
13638 (Archive::filename): New function.
13639 * object.cc: Include "cref.h".
13640 (Sized_relobj::Sized_relobj): Initialize defined_count_.
13641 (Sized_relobj::do_get_global_symbol_counts): New function.
13642 (Input_objects::add_object): Add object to cross-referencer.
13643 (Input_objects::archive_start): New function.
13644 (Input_objects::archive_stop): New function.
13645 (Input_objects::print_symbol_counts): New function.
13646 * object.h: Declare Cref and Archive.
13647 (Object::get_global_symbol_counts): New function.
13648 (Object::do_get_global_symbol_counts): New pure virtual function.
13649 (class Sized_relobj): Add defined_count_ field. Update
13651 (class Input_objects): Add cref_ field. Update constructor.
13652 Update declarations.
13653 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13655 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13657 (Sized_dynobj::do_get_global_symbol_counts): New function.
13658 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13659 defined_count_. Update declarations. Define Symbols typedef.
13660 * symtab.cc (Symbol_table::add_from_relobj): Add defined
13661 parameter. Change all callers.
13662 (Symbol_table::add_from_dynobj): Add sympointers and defined
13663 parameters. Change all callers.
13664 * symtab.h (class Symbol_table): Update declarations.
13665 * Makefile.am (CCFILES): Add cref.cc.
13666 (HFILES): Add cref.h.
13667 * Makefile.in: Rebuild.
13669 2008-07-22 Simon Baldwin <simonb@google.com>
13671 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13672 to zero when writing undefined symbols.
13674 2008-07-22 Ian Lance Taylor <iant@google.com>
13676 * output.cc (Output_section::add_input_section): Don't try to
13677 merge empty merge sections.
13679 2008-07-21 Craig Silverstein <csilvers@google.com>
13681 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13682 Include symbol version in error message.
13684 2008-07-20 Chris Demetriou <cgd@google.com>
13686 * configure.ac (gold_cv_c_random_seed): New configured variable.
13687 (RANDOM_SEED_CFLAGS): New substituted variable.
13688 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13689 * configure: Rebuild.
13690 * Makefile.in: Likewise.
13691 * testsuite/Makefile.in: Likewise.
13693 2008-07-18 Ian Lance Taylor <iant@google.com>
13695 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13696 where we see NAME/NULL and NAME/VERSION as separate symbols.
13697 * testsuite/ver_test_main.cc (main): Call t4.
13698 (t4, t4_2a): Define.
13699 * testsuite/ver_test_2.cc (t4_2): Define.
13700 * testsuite/ver_test_2.script: Put t4_2a in VER2.
13701 * testsuite/ver_test_4.cc (t4_2a): Define.
13702 * testsuite/ver_test_4.script: Put t4_2a in VER2.
13703 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13705 2008-07-17 Ian Lance Taylor <iant@google.com>
13707 * dynobj.cc (Versions::add_def): If we give an error about a
13708 missing version, go ahead and create the version anyhow.
13710 2008-07-10 Ian Lance Taylor <iant@google.com>
13712 Handle output sections with more than 0x7fffffff bytes.
13713 * object.h (class Relobj): Change map_to_output_ to
13714 output_sections_, and just keep a section pointer. Change all
13715 uses. Move comdat group support to Sized_relobj.
13716 (Relobj::is_section_specially_mapped): Remove.
13717 (Relobj::output_section): Remove poff parameter. Change all
13719 (Relobj::output_section_offset): New function.
13720 (Relobj::set_section_offset): Rewrite.
13721 (Relobj::map_to_output): Remove.
13722 (Relobj::output_sections): New function.
13723 (Relobj::do_output_section_offset): New pure virtual function.
13724 (Relobj::do_set_section_offset): Likewise.
13725 (class Sized_relobj): Add section_offsets_ field. Add comdat
13726 group support from Relobj. Update declarations.
13727 (Sized_relobj::get_output_section_offset): New function.
13728 (Sized_relobj::do_output_section_offset): New function.
13729 (Sized_relobj::do_set_section_offset): New function.
13730 * object.cc (Relobj::output_section_address): Remove.
13731 (Sized_relobj::Sized_relobj): Initialize new fields.
13732 (Sized_relobj::include_section_group): Cast find_kept_object to
13734 (Sized_relobj::include_linkonce_section): Likewise.
13735 (Sized_relobj::do_layout): Use separate arrays for output section
13737 (Sized_relobj::do_count_local_symbols): Change map_to_output to
13739 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13740 output_sections and section_offsets.
13741 (Sized_relobj::write_local_symbols): Likewise.
13742 (map_to_kept_section): Compute output address directly.
13743 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13744 output_sections and section_offsets.
13745 (Sized_relobj::write_sections): Likewise.
13746 (Sized_relobj::relocate_sections): Likewise.
13747 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13748 * output.h (class Output_reloc): Update declarations. Change
13749 u2_.relobj to Sized_relobj*.
13750 (class Output_data_reloc): Change add functions to use
13752 * output.cc (Output_reloc::Output_reloc): Change relobj to
13754 (Output_reloc::local_section_offset): Change return type to
13755 Elf_Addr. Use get_output_section_offset.
13756 (Output_reloc::get_address): Likewise.
13757 (Output_section::is_input_address_mapped): Don't call
13758 is_section_specially_mapped.
13759 (Output_section::output_offset): Likewise.
13760 (Output_section::output_address): Likewise.
13761 (Output_section::starting_output_address): Likewise.
13762 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13763 parameter to Sized_relobj*.
13764 (Copy_relocs::need_copy_reloc): Likewise.
13765 (Copy_relocs::save): Likewise.
13766 * copy-relocs.h (class Copy_relocs): Update declarations.
13767 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13768 Sized_relobj*. Change relobj_ field to Sized_relobj*.
13769 * target-reloc.h (relocate_for_relocatable): Change
13770 offset_in_output_section type to Elf_Addr. Change code that uses
13772 * layout.cc (Layout::layout): Always set *off.
13773 * mapfile.cc (Mapfile::print_input_section): Use
13774 output_section_offset.
13775 * i386.cc (Target_i386::copy_reloc): Change object parameter to
13777 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13778 * sparc.cc (Target_sparc::copy_reloc): Likewise.
13779 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13781 2008-07-03 Ian Lance Taylor <iant@google.com>
13783 * layout.cc (Layout::include_section): Do not discard unrecognized
13784 SHT_STRTAB sections.
13786 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
13788 * script.cc (Lex::can_continue_name): Make '?' allowable in
13789 version-script names.
13790 * testsuite/version_script.map: Change glob pattern to use '?'
13792 2008-06-30 Manish Singh <yosh@gimp.org>
13795 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13798 2008-06-30 Ian Lance Taylor <iant@google.com>
13802 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13803 versions]: Don't try to read the value in the contents, since we
13804 don't use it. Use the template endianness when writing.
13806 2008-06-25 Cary Coutant <ccoutant@google.com>
13808 * fileread.cc (File_read::make_view): Assert on zero-length view.
13809 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13810 symbol table when there are no symbols to read.
13812 2008-06-23 Craig Silverstein <csilvers@google.com>
13814 * version.cc (version_string): Bump to 1.7
13816 2008-06-18 Craig Silverstein <csilvers@google.com>
13818 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13819 constant 0xFFFF to type Valtype.
13820 (Powerpc_relocate_functions::rel16_ha): Likewise.
13822 2008-06-17 Ian Lance Taylor <iant@google.com>
13824 * output.h (Output_section::Input_section): Initialize p2align_ to
13825 zero for Output_section_data constructors.
13826 (Output_section::Input_section::addralign): If not an input
13827 section, return the alignment of the Output_section_data.
13828 * testsuite/copy_test.cc: New file.
13829 * testsuite/copy_test_1.cc: New file.
13830 * testsuite/copy_test_2.cc: New file.
13831 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13832 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13833 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13834 (copy_test_1_pic.o, copy_test_1.so): New targets.
13835 (copy_test_2_pic.o, copy_test_2.so): New targets.
13836 * testsuite/Makefile.in: Rebuild.
13838 * script-sections.cc (Script_sections::place_orphan): Initialize
13839 local variable exact.
13841 2008-06-13 David Edelsohn <edelsohn@gnu.org>
13843 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13845 2008-06-12 David Edelsohn <edelsohn@gnu.org>
13846 David S. Miller <davem@davemloft.net>
13848 * powerpc.cc: New file.
13849 * Makefile.am (TARGETSOURCES): Add powerpc.cc
13850 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13851 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13852 * Makefile.in: Rebuild.
13854 2008-06-09 Ian Lance Taylor <iant@google.com>
13856 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13858 (throwing, orig_terminate): New static variables.
13859 (terminate_handler): New static function.
13860 (t2): Set terminate handler.
13862 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
13865 * binary.cc (Binary_to_elf::sized_convert): Fix .data
13868 2008-05-30 Cary Coutant <ccoutant@google.com>
13870 * archive.cc (Archive::include_all_members) Correct to step
13871 over symbol table and extended name table in thin archives.
13873 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
13876 * target-reloc.h (relocate_for_relocatable): Fix new_offset
13879 2008-05-28 Caleb Howe <cshowe@google.com>
13881 * reduced_debug_output.cc: New file.
13882 * reduced_debug_output.h: New file.
13883 * options.h (class General_options): Add --strip-debug-non-line.
13884 * options.cc (General_options::finalize): Add strip_debug_non_line
13885 to the strip heirarchy.
13886 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13888 * layout.cc: Include "reduced_debug_output.h".
13889 (Layout::Layout): Initialize new fields.
13890 (line_only_debug_sections): New static array.
13891 (is_lines_only_debug_sections): New static inline function.
13892 (Layout::include_section): Handle --strip-debug-non-line.
13893 (Layout::make_output_section): If --strip-debug-non-line, build
13894 new output sections for .debug_abbrev and .debug_info.
13895 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13896 gold. Warn about possible overflow.
13897 (read_signed_LEB_128): Likewise.
13898 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13899 (read_signed_LEB_128): Declare.
13900 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13901 (HFILES): Add reduced_debug_output.h.
13902 * Makefile.in: Rebuild.
13904 2008-05-21 Ian Lance Taylor <iant@google.com>
13906 * mapfile.cc: New file.
13907 * mapfile.h: New file.
13908 * options.h (class General_options): Add -M/--print-map and -Map.
13909 * options.cc (General_options::finalize): Make -M equivalent to
13911 * main.cc: Include <cstdio> and "mapfile.h".
13912 (main): Open mapfile if requested.
13913 * gold.cc (class Middle_runner): Add mapfile_ field. Update
13914 constructor. Change caller.
13915 (queue_initial_tasks): Add mapfile parameter. Change caller.
13916 (queue_middle_tasks): Likewise.
13917 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13919 * archive.cc: Include "mapfile.h".
13920 (Archive::add_symbols): Add mapfile parameter. Change all
13921 callers. Pass mapfile, symbol, and reason to include_member.
13922 (Archive::include_all_members): Add mapfile parameter. Change all
13924 (Archive::include_member): Add mapfile, sym, and why parameters.
13925 Change all callers. Report inclusion to map file.
13926 * archive.h: Include "fileread.h".
13927 (class Archive): Update declarations.
13928 (Archive::file): New const method.
13929 (class Add_archive_symbols): Add mapfile_ field. Update
13930 constructor. Change all callers.
13931 * readsyms.h (class Read_symbols): Likewise.
13932 (class Finish_group): Likewise.
13933 (class Read_script): Likewise.
13934 * common.cc: Include "mapfile.h".
13935 (Symbol_table::allocate_commons): Add mapfile parameter. Change
13937 (Symbol_table::do_allocate_commons): Likewise.
13938 (Symbol_table::do_allocate_commons_list): Likewise. Report common
13939 symbol allocation to mapfile.
13940 * common.h (class Allocate_commons_task): Add mapfile_ field.
13941 Update constructor. Change all callers.
13942 * symtab.h (class Symbol_table): Update declarations.
13943 * layout.cc: Include "mapfile.h".
13944 (Layout_task_runner::run): Print information to mapfile.
13945 (Layout::create_gold_note): Change Output_data_fixed_space to
13946 Output_data_zero_fill.
13947 (Layout::create_build_id): Likewise.
13948 (Layout::print_to_mapfile): New function.
13949 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
13950 constructor. Change caller.
13951 (class Layout): Declare print_to_mapfile.
13952 * output.cc (Output_section::Input_section::print_to_mapfile): New
13954 (Output_section::add_input_section): If producing a map, always
13955 add to input_sections_ list.
13956 (Output_section::do_print_to_mapfile): New function.
13957 (Output_segment::print_sections_to_mapfile): New function.
13958 (Output_segment::print_section_list_to_mapfile): New function.
13959 * output.h: Include "mapfile.h".
13960 (Output_data::print_to_mapfile): New function.
13961 (Output_data::do_print_to_mapfile): New virtual function.
13962 (Output_segment_headers::do_print_to_mapfile): New function.
13963 (Output_file_header::do_print_to_mapfile): New function.
13964 (Output_data_const::do_print_to_mapfile): New function.
13965 (class Output_data_const_buffer): Add map_name_ field. Update
13966 constructor. Change all callers. Add do_print_to_mapfile
13968 (class Output_data_fixed_space): Likewise.
13969 (class Output_data_space): Likewise.
13970 (class Output_data_zero_fill): New class.
13971 (Output_data_strtab::do_print_to_mapfile): New function.
13972 (Output_data_reloc_base::do_print_to_mapfile): New function.
13973 (Output_relocatable_relocs::do_print_to_mapfile): New function.
13974 (Output_data_group::do_print_to_mapfile): New function.
13975 (Output_data_got::do_print_to_mapfile): New function.
13976 (Output_data_dynamic::do_print_to_mapfile): New function.
13977 (Output_symtab_xindex::do_print_to_mapfile): New function.
13978 (class Output_section): Declare do_print_to_mapflie. Declare
13979 print_to_mapfile in Input_section.
13980 (class Output_segment): Declare new functions.
13981 * object.h (Sized_relobj::symbol_count): New function.
13982 * script-sections.cc
13983 (Output_section_element_dot_assignment::set_section_addresses):
13984 Change Output_data_fixed_space to Output_data_zero_fill.
13985 (Output_data_expression::do_print_to_mapfile): New function.
13986 * script.cc (read_input_script): Add mapfile parameter. Change
13988 * script.h (read_input_script): Update declaration.
13989 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13990 (Eh_frame::do_print_to_mapfile): New function.
13991 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13992 (Output_merge_string::do_print_to_mapfile): New function.
13993 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13995 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13997 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13999 * Makefile.am (CCFILES): Add mapfile.cc.
14000 (HFILES): Add mapfile.h.
14001 * Makefile.in: Rebuild.
14003 2008-05-19 Ian Lance Taylor <iant@google.com>
14005 * options.h (class General_options): Add -z relro.
14006 * layout.cc (Layout::Layout): Initialize relro_segment_.
14007 (Layout::add_output_section_data): Return the output section.
14008 (Layout::make_output_section): Rcognize relro sections and mark
14009 them appropriately.
14010 (Layout::attach_allocated_section_to_segment): Put relro sections
14011 in a PT_GNU_RELRO segment.
14012 (Layout::create_initial_dynamic_sections): Mark the .dynamic
14014 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14016 (Layout::linkonce_mapping): Map d.rel.ro.local to
14017 .data.rel.ro.local.
14018 (Layout::output_section_name): Us .data.rel.ro.local for any
14019 section which begins with that.
14020 * layout.h (class Layout): Update add_output_section_data
14021 declaration. Add relro_segment_ field.
14022 * output.cc (Output_section::Output_section): Initialize is_relro_
14023 and is_relro_local_ fields.
14024 (Output_segment::add_output_section): Group relro sections.
14025 (Output_segment::is_first_section_relro): New function.
14026 (Output_segment::maximum_alignment): If there is a relro section,
14027 align the segment to the common page size.
14028 (Output_segment::set_section_addresses): Track whether we are
14029 looking at relro sections. If the last section is a relro
14030 section, align to the common page size.
14031 (Output_segment::set_section_list_addresses): Add in_relro
14032 parameter. Change all callers. Align to the page size when
14033 moving from relro to non-relro section.
14034 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14036 * output.h (class Output_section): Add is_relro_ and
14037 is_relro_local_ fields.
14038 (Output_section::is_relro): New function.
14039 (Output_section::set_is_relro): New function.
14040 (Output_section::is_relro_local): New function.
14041 (Output_section::set_is_relro_local): New function.
14042 (class Output_segment): Update declarations.
14043 * i386.cc (Target_i386::got_section): Mark .got section as relro.
14044 * sparc.cc (Target_sparc::got_section): Likewise.
14045 * x86_64.cc (Target_x86_64::got_section): Likewise.
14046 * testsuite/relro_test_main.cc: New file.
14047 * testsuite/relro_test.cc: New file.
14048 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14049 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14050 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14051 (relro_test.so, relro_test_pic.o): New targets.
14052 * testsuite/Makefile.in: Rebuild.
14054 2008-05-16 Ian Lance Taylor <iant@google.com>
14056 * output.cc (Output_segment::add_output_section): Remove front
14058 * output.h (class Output_segment): Remove
14059 add_initial_output_section and overloaded add_output_section.
14060 Update declaration of remaining add_output_section.
14061 * layout.cc (Layout::create_interp): Call add_output_section
14062 rather than add_initial_output_section.
14063 (Layout::finish_dynamic_section): Likewise.
14065 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14066 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
14067 know the dynamic type.
14068 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14069 field. Initialize it in constructor.
14070 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14071 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14072 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14075 * output.cc (Output_reloc::get_address): Change return type to
14077 * output.h (class Output_reloc): Update get_address declaration.
14078 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14079 for section addresses.
14081 2008-05-09 Ian Lance Taylor <iant@google.com>
14084 * gold.cc (gold_nomem): Use return value of write.
14086 2008-05-08 Ian Lance Taylor <iant@google.com>
14088 * symtab.c (Symbol::init_base_output_data): Add version
14089 parameter. Change all callers.
14090 (Symbol::init_base_output_segment): Likewise.
14091 (Symbol::init_base_constant): Likewise.
14092 (Symbol::init_base_undefined): Likewise.
14093 (Sized_symbol::init_output_data): Likewise.
14094 (Sized_symbol::init_output_segment): Likewise.
14095 (Sized_symbol::init_constant): Likewise.
14096 (Sized_symbol::init_undefined): Likewise.
14097 (Symbol_table::do_define_in_output_data): If the new symbol has a
14098 version, mark it as the default.
14099 (Symbol_table::do_define_in_output_segment): Likewise.
14100 (Symbol_table::do_define_as_constant): Likewise.
14101 * symtab.h (class Symbol): Update declarations.
14102 (class Sized_symbol): Likewise.
14103 * resolve.cc (Symbol::override_version): New function.
14104 (Symbol::override_base): Call override_version.
14105 (Symbol::override_base_with_special): Likewise.
14106 * testsuite/ver_script_8.script: New file.
14107 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14108 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14109 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14110 (ver_test_8_1.so, ver_test_8_2.so): New targets.
14112 2008-05-06 Ian Lance Taylor <iant@google.com>
14115 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14117 (class General_options): Remove existing --undefined, and add
14118 --no-undefined instead. Add new --undefined as synonym for -u.
14119 * archive.cc (Archive::add_symbols): Check whether symbol was
14121 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14122 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14123 all uses. Add IS_UNDEFINED. Update declarations to split
14124 different versions of init_base. Declare init_base_undefined.
14125 (Symbol::is_defined): Handle IS_UNDEFINED.
14126 (Symbol::is_undefined): Likewise.
14127 (Symbol::is_weak_undefined): Call is_undefined.
14128 (Symbol::is_absolute): Handle IS_CONSTANT.
14129 (class Sized_symbol): Update declarations to split different
14130 versions of init. Declare init_undefined.
14131 (class Symbol_table): Declare new functions.
14132 * symtab.cc (Symbol::init_base_object): Rename from init_base.
14133 Change all callers.
14134 (Symbol::init_base_output_data): Likewise.
14135 (Symbol::init_base_output_segment): Likewise.
14136 (Symbol::init_base_constant): Likewise.
14137 (Symbol::init_base_undefined): New function.
14138 (Sized_symbol::init_object): Rename from init. Change all
14140 (Sized_symbol::init_output_data): Likewise.
14141 (Sized_symbol::init_output_segment): Likewise.
14142 (Sized_symbol::init_constant): Likewise.
14143 (Sized_symbol::init_undefined): New function.
14144 (Symbol_table::add_undefined_symbols_from_command_line): New
14146 (Symbol_table::do_add_undefined_symbols_from_command_line): New
14148 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14149 (Symbol::output_section): Likewise.
14150 (Symbol::set_output_section): Likewise.
14151 (Symbol_table::sized_finalize_symbol): Likewise.
14152 (Symbol_table::sized_write_globals): Likewise.
14153 * resolve.cc (Symbol_table::should_override): Likewise.
14154 (Symbol::override_base_with_special): Likewise.
14156 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14157 symbol, change it to have default visibility.
14158 * testsuite/protected_1.cc: New file.
14159 * testsuite/protected_2.cc: New file.
14160 * testsuite/protected_3.cc: New file.
14161 * testsuite/protected_main_1.cc: New file.
14162 * testsuite/protected_main_2.cc: New file.
14163 * testsuite/protected_main_3.cc: New file.
14164 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14165 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14166 (protected_1_LDFLAGS, protected_1_LDADD): Define.
14167 (protected_1.so): New target.
14168 (protected_1_pic.o, protected_2_pic.o): New targets.
14169 (protected_3_pic.o): New target.
14170 (check_PROGRAMS): Add protected_2.
14171 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14172 (protected_2_LDFLAGS, protected_2_LDADD): Define.
14173 * testsuite/Makefile.in: Rebuild.
14175 * options.h (DEFINE_var): Add set_user_set_##varname__.
14176 (DEFINE_bool_alias): New macro.
14177 (class General_options): Define -Bstatic using DEFINE_bool_alias
14178 rather than DEFINE_special. Add --undefined as an alias for -z
14180 * options.cc (General_options::parse_Bstatic): Remove.
14182 * options.h (class General_options): Add --fatal-warnings.
14183 * main.cc (main): Implement --fatal-warnings.
14184 * errors.h (Errors::warning_count): New function.
14186 * options.h (class General_options): Add -Bsymbolic-functions.
14187 * symtab.h (Symbol::is_preemptible): Check for
14188 -Bsymbolic-functions.
14190 2008-05-05 Ian Lance Taylor <iant@google.com>
14192 * options.h (DEFINE_bool): For DASH_Z, create the negative option
14193 as noVARNAME rather than no-VARNAME.
14194 (class General_options): Add option -z combreloc.
14195 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14197 (Output_reloc::sort_before) [SHT_REL]: New function.
14198 (Output_reloc::sort_before) [SHT_RELA]: New function.
14199 (class Output_data_reloc_base): Add sort_relocs_ field. Define
14200 Sort_relocs_comparison.
14201 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14202 parameter. Change all callers.
14203 (Output_data_reloc::Output_data_reloc) [both versions]: Add
14204 sort_relocs parameter. Change all callers.
14205 * output.cc (Output_reloc::get_address): New function, broken out
14207 (Output_reloc::write_rel): Call it.
14208 (Output_reloc::compare): New function.
14209 (Output_data_reloc_base::do_write): Optionally sort relocs.
14211 * configure.ac: If targ_extra_obj is set, link it in.
14212 * configure.tgt: Initialize all variables.
14213 (x86_64*): Set targ_extra_obj and targ_extra_size.
14214 * configure: Rebuild.
14216 * object.cc (Sized_relobj::include_section_group): Adjust section
14217 indexes read from group data. Build vector to pass to
14219 * layout.cc (Layout::layout_group): Add flags and shndxes
14220 parameters. Remove contents parameter. Change caller. Update
14221 explicit instantiations.
14222 * layout.h (class Layout): Update layout_group declaration.
14223 * output.cc (Output_data_group::Output_data_group): Add flags and
14224 input_shndxes parameters. Remove contents parameter. Change
14226 (Output_data_group::do_write): Change input_sections_ to
14228 * output.h (class Output_data_group): Update constructor
14229 declaration. Rename input_sections_ to input_shndxes_.
14230 * testsuite/many_sections_test.cc: Add template.
14232 2008-04-30 Cary Coutant <ccoutant@google.com>
14234 * target-reloc.h (relocate_section): Fix dead-pointer bug.
14236 * layout.cc (Layout::include_section): Refactored check for debug
14238 (Layout::add_comdat): Add new parameters. Change type
14239 of signature parameter. Add object and shndx to signatures table.
14240 (Layout::find_kept_object): New function.
14241 * layout.h: Include <cstring>.
14242 (Layout::is_debug_info_section): New function.
14243 (Layout::add_comdat): Add new parameters.
14244 (Layout::find_kept_object): New function.
14245 (Layout::Kept_section): New struct.
14246 (Layout::Signatures): Change type of map range.
14247 * object.cc (Relobj::output_section_address): New function.
14248 (Sized_relobj::include_section_group): Add new parameters. Change
14249 calls to Layout::add_comdat. Change to build table of kept comdat
14250 groups and table mapping discarded sections to kept sections.
14251 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
14252 (Sized_relobj::do_layout): Change calls to include_section_group and
14253 include_linkonce_section.
14254 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14255 value to zero when section is discarded.
14256 (Sized_relobj::map_to_kept_section): New function.
14257 * object.h (Relobj::output_section_address): New function.
14258 (Relobj::Comdat_group): New type.
14259 (Relobj::find_comdat_group): New function.
14260 (Relobj::Comdat_group_table): New type.
14261 (Relobj::Kept_comdat_section): New type.
14262 (Relobj::Kept_comdat_section_table): New type.
14263 (Relobj::add_comdat_group): New function.
14264 (Relobj::set_kept_comdat_section): New function.
14265 (Relobj::get_kept_comdat_section): New function.
14266 (Relobj::comdat_groups_): New field.
14267 (Relobj::kept_comdat_sections_): New field.
14268 (Symbol_value::input_value): Update comment.
14269 (Sized_relobj::map_to_kept_section) New function.
14270 (Sized_relobj::include_linkonce_section): Add new parameter.
14271 * target-reloc.h (Comdat_behavior): New type.
14272 (get_comdat_behavior): New function.
14273 (relocate_section): Add code to map a discarded section to the
14274 corresponding kept section when applying a relocation.
14276 2008-04-30 Craig Silverstein <csilvers@google.com>
14278 * dwarf_reader.cc (next_generation_count): New static var.
14279 (Addr2line_cache_entry): New struct.
14280 (addr2line_cache): New static var.
14281 (Dwarf_line_info::one_addr2line): Added caching.
14282 (Dwarf_line_info::clear_addr2line_cache): New function.
14283 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14284 cache-size parameter.
14285 (Dwarf_line_info::one_addr2line_cache): New function.
14286 * symtab.cc (Symbol_table::detect_odr_violations): Pass
14287 new cache-size argument to one_addr2line(), and clear cache.
14289 2008-04-28 Cary Coutant <ccoutant@google.com>
14291 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14292 R_386_PC8 relocations.
14294 2008-04-23 Ian Lance Taylor <iant@google.com>
14296 * object.cc (Sized_relobj::include_section_group): Check for
14297 invalid section group.
14299 * object.cc (make_elf_object): Correct test for 64-bit ELF file
14302 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14303 than read for file header.
14304 * archive.cc (Archive::include_member): Likewise.
14306 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
14308 * aclocal.m4: Regenerate.
14309 * configure: Regenerate.
14311 2008-04-19 Ian Lance Taylor <iant@google.com>
14313 * version.cc (version_string): Bump to 1.6.
14315 * testsuite/Makefile.am (many_sections_r_test): New target.
14316 (many_sections_r_test_SOURCES): Remove.
14317 (many_sections_r_test_DEPENDENCIES): Remove.
14318 (many_sections_r_test_LDFLAGS): Remove.
14319 (many_sections_r_test_LDADD): Remove.
14321 * object.cc (Sized_relobj::do_add_symbols): Always pass
14322 local_symbol_count_ to add_from_relobj.
14324 * testsuite/Makefile.am (many_sections_check.h): Only check one in
14325 every thousand variables.
14326 * testsuite/Makefile.in: Rebuild.
14328 * object.cc (Xindex::initialize_symtab_xindex): New function.
14329 (Xindex::read_symtab_xindex): New function.
14330 (Xindex::sym_xindex_to_shndx): New function.
14331 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14333 (Sized_relobj::do_initialize_xindex): New function.
14334 (Sized_relobj::do_read_symbols): Adjust section links.
14335 (Sized_relobj::symbol_section_and_value): Add is_ordinary
14336 parameter. Change all callers.
14337 (Sized_relobj::include_section_group): Adjust section links and
14338 symbol section indexes.
14339 (Sized_relobj::do_layout): Adjust section links.
14340 (Sized_relobj::do_count_local_symbols): Adjust section links and
14341 symbol section indexes.
14342 (Sized_relobj::do_finalize_local_symbols): Distinguish between
14343 ordinary and special symbols.
14344 (Sized_relobj::write_local_symbols): Add symtab_xindex and
14345 dynsym_xindex parameters. Change all callers. Adjust section
14346 links. Use SHN_XINDEX when needed.
14347 (Sized_relobj::get_symbol_location_info): Adjust section links.
14348 Don't get fooled by special symbols.
14349 * object.h (class Xindex): Define.
14350 (class Object): Add xindex_ parameter. Declare virtual functoin
14351 do_initialize_xindex.
14352 (Object::adjust_sym_shndx): New function.
14353 (Object::set_xindex): New protected function.
14354 (class Symbol_value): Add is_ordinary_shndx_ field.
14355 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14356 (Symbol_value::value): Assert ordinary section.
14357 (Symbol_value::initialize_input_to_output_map): Likewise.
14358 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14359 Change all callers.
14360 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
14362 (class Sized_relobj): Update declarations.
14363 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14364 parameter. Change all callers.
14365 (Sized_relobj::adjust_shndx): New function.
14366 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14368 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14369 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
14370 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
14371 (Sized_dynobj::read_dynsym_section): Adjust section links.
14372 (Sized_dynobj::read_dynamic): Likewise.
14373 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
14375 (Sized_dynobj::do_initialize_xindex): New function.
14376 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
14377 do_initialize_xindex.
14378 (Sized_dynobj::adjust_shndx): New function.
14379 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14380 dynsym_xindex_ fields.
14381 (Layout::finalize): Add a call to set_section_indexes before
14382 creating the symtab sections.
14383 (Layout::set_section_indexes): Don't do anything if the section
14384 already has a section index.
14385 (Layout::create_symtab_sections): Add shnum parameter. Change
14386 caller. Create .symtab_shndx section if needed.
14387 (Layout::create_shdrs): Add shstrtab_section parameter. Change
14389 (Layout::allocated_output_section_count): New function.
14390 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14392 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14393 fields. Update declarations.
14394 (Layout::symtab_xindex): New function.
14395 (Layout::dynsym_xindex): New function.
14396 (class Write_symbols_task): Add layout_ field.
14397 (Write_symbols_task::Write_symbols_task): Add layout parameter.
14399 * output.cc (Output_section_headers::Output_section_headers): Add
14400 shstrtab_section parameter. Change all callers.
14401 (Output_section_headers::do_sized_write): Store overflow values
14402 for section count and section string table section index in
14403 section header zero.
14404 (Output_file_header::do_sized_write): Check for overflow of
14405 section count and section string table section index.
14406 (Output_symtab_xindex::do_write): New function.
14407 (Output_symtab_xindex::endian_do_write): New function.
14408 * output.h (class Output_section_headers): Add shstrtab_section_.
14409 Update declarations.
14410 (class Output_symtab_xindex): Define.
14411 (Output_section::has_out_shndx): New function.
14412 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14414 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14415 Change all callers.
14416 (Sized_symbol::init): Likewise.
14417 (Symbol::output_section): Check for ordinary symbol.
14418 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
14419 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
14421 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14422 Change all callers. Simplify handling of symbols from sections
14423 not included in the link.
14424 (Symbol_table::add_from_dynobj): Handle ordinary symbol
14426 (Weak_alias_sorter::operator()): Assert that symbols are
14428 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14430 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14431 parameters. Change all callers.
14432 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
14433 symbol distinction. Use SHN_XINDEX when needed.
14434 (Symbol_table::write_section_symbol): Add symtab_xindex
14435 parameter. Change all callers.
14436 (Symbol_table::sized_write_section_symbol): Likewise. Use
14437 SHN_XINDEX when needed.
14438 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
14440 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
14441 (Symbol::is_defined): Check is_ordinary.
14442 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14443 (Symbol::is_absolute, Symbol::is_common): Likewise.
14444 (class Sized_symbol): Update declarations.
14445 (class Symbol_table): Update declarations.
14446 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14447 parameters. Change all callers.
14448 (Sized_symbol::override): Likewise.
14449 (Symbol_table::override): Likewise.
14450 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
14451 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
14452 is_ordinary, and orig_st_shndx parameters. Change all callers.
14453 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14454 to be in an ordinary section.
14455 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14456 object and is_ordinary parameters. Change all callers.
14457 (Sized_dwarf_line_info::read_relocs): Add object parameter.
14458 Change all callers. Don't add undefined or non-ordinary symbols
14460 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14461 Change all callers.
14462 * dwarf_reader.h (class Sized_dwarf_line_info): Update
14464 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14465 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14466 (Sized_relobj::relocate_sections): Likewise.
14467 * target-reloc.h (scan_relocs): Adjust section symbol index.
14468 (scan_relocatable_relocs): Likewise.
14469 * i386.cc (Scan::local): Check for ordinary symbols.
14470 * sparc.cc (Scan::local): Likewise.
14471 * x86_64.cc (Scan::local): Likewise.
14472 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14473 to symbol_section_and_value.
14474 * testsuite/many_sections_test.cc: New file.
14475 * testsuite/Makefile.am (BUILT_SOURCES): Define.
14476 (check_PROGRAMS): Add many_sections_test.
14477 (many_sections_test_SOURCES): Define.
14478 (many_sections_test_DEPENDENCIES): Define.
14479 (many_sections_test_LDFLAGS): Define.
14480 (BUILT_SOURCES): Add many_sections_define.h.
14481 (many_sections_define.h): New target.
14482 (BUILT_SOURCES): Add many_sections_check.h.
14483 (many_sections_check.h): New target.
14484 (check_PROGRAMS): Add many_sections_r_test.
14485 (many_sections_r_test_SOURCES): Define.
14486 (many_sections_r_test_DEPENDENCIES): Define.
14487 (many_sections_r_test_LDFLAGS): Define.
14488 (many_sections_r_test_LDADD): Define.
14489 (many_sections_r_test.o): New target.
14490 * testsuite/Makefile.in: Rebuild.
14492 2008-04-17 Cary Coutant <ccoutant@google.com>
14494 * errors.cc (Errors::info): New function.
14495 (gold_info): New function.
14496 * errors.h (Errors::info): New function.
14497 * gold.h (gold_info): New function.
14498 * object.cc (Input_objects::add_object): Print trace output.
14499 * options.cc (options::parse_set): New function.
14500 (General_options::parse_wrap): Deleted.
14501 (General_options::General_options): Deleted initializer.
14502 * options.h (options::String_set): New typedef.
14503 (options::parse_set): New function.
14504 (DEFINE_set): New macro.
14505 (General_options::wrap): Changed to use DEFINE_set. Changed
14506 callers of any_wrap_symbols and is_wrap_symbol.
14507 (General_options::trace, General_options::trace_symbol):
14509 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14510 (General_options::wrap_symbols_): Deleted.
14511 * symtab.cc (Symbol_table::add_from_object): Print trace output.
14513 2008-04-17 David S. Miller <davem@davemloft.net>
14515 * options.cc (General_options::parse_V): New function.
14516 * options.h: Add entries for -V and -Qy.
14518 2008-04-17 Ian Lance Taylor <iant@google.com>
14520 * common.cc (Symbol_table::allocate_commons): Remove options
14521 parameter. Change caller.
14522 (Symbol_table::do_allocate_commons): Remove options parameter.
14523 Change caller. Just call do_allocate_commons_list twice.
14524 (Symbol_table::do_allocate_commons_list): New function, broken out
14525 of do_allocate_commons.
14526 * common.h (class Allocate_commons_task): Remove options_ field.
14527 Update constructor.
14528 * symtab.cc (Symbol_table::Symbol_table): Initialize
14530 (Symbol_table::add_from_object): Put TLS common symbols on
14532 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14533 which are IN_OUTPUT_DATA.
14534 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
14535 allocate_commons and do_allocate_commons declarations. Declare
14536 do_allocate_commons_list.
14537 * gold.cc (queue_middle_tasks): Update creation of
14538 Allocate_commons_task to not pass options.
14539 * testsuite/Makefile.am (INCLUDES): Add -I.. .
14540 (TLS_TEST_C_FLAGS): New variable.
14541 (tls_test_c_pic.o): New target.
14542 (tls_test_shared.so): Link in tls_test_c_pic.o.
14543 (tls_test_c_pic_ie.o): New target.
14544 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14545 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14546 (tls_test_c.o): New target.
14547 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14548 (tls_pic_test_LDADD): Likewise.
14549 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14550 (tls_shared_gd_to_ie_test_LDADD): Likewise.
14551 (tls_test_c_gnu2.o): New target.
14552 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14554 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14555 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14556 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14557 * testsuite/tls_test.cc: Include "config.h".
14558 (t_last): Call t11_last.
14559 * testsuite/tls_test.h (t11, t11_last): Declare.
14560 * testsuite/tls_test_c.c: New file.
14561 * testsuite/tls_test_main.cc (thread_routine): Call t11.
14562 * configure.ac: Check for OpenMP support.
14563 * configure, config.in, Makefile.in: Rebuild.
14564 * testsuite/Makefile.in: Rebuild.
14566 2008-04-16 Cary Coutant <ccoutant@google.com>
14568 * i386.cc (Target_i386::define_tls_base_symbol): New function.
14569 (Target_i386::tls_base_symbol_defined_): New field.
14570 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14571 (Target_i386::Scan::global): Likewise.
14572 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14573 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14574 (Target_x86_64::tls_base_symbol_defined_): New field.
14575 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14576 (Target_x86_64::Scan::global): Likewise.
14578 2008-04-16 Cary Coutant <ccoutant@google.com>
14580 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14581 (Symbol::needs_plt_entry): Allow weak undefined symbols.
14582 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14583 building shared libraries.
14584 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14585 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14586 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14587 * testsuite/Makefile.in: Rebuild.
14588 * testsuite/weak_undef.h: New file.
14589 * testsuite/weak_undef_file1.cc: Add extra test cases.
14590 * testsuite/weak_undef_file2.cc: Likewise.
14591 * testsuite/weak_undef_test.cc: Likewise.
14593 2008-04-16 David S. Miller <davem@davemloft.net>
14595 * sparc.cc (Target_sparc::Scan): Change from struct to class.
14596 Add issued_non_pic_error_ field. Declare check_non_pic.
14597 (Target_sparc::Scan::check_non_pic): New function.
14598 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14599 (Target_sparc::Scan::global): Likewise.
14601 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14602 * configure: Rebuild.
14604 * options.h (DEFINE_enable): New macro.
14605 (new_dtags): New enable option.
14606 (initfirst, interpose, loadfltr, nodefaultlib,
14607 nodelete, nodlopen, nodump): New -z options.
14608 * layout.cc (Layout:finish_dynamic_section): If new
14609 dtags enabled, emit DT_RUNPATH. Also, emit a
14610 DT_FLAGS_1 containing any specified -z flags.
14612 2008-04-16 Ian Lance Taylor <iant@google.com>
14614 * copy-relocs.cc: New file.
14615 * copy-relocs.h: New file.
14616 * reloc.cc: Remove Copy_relocs code.
14617 * reloc.h: Likewise.
14618 * reloc-types.h (struct Reloc_types) [both versions]: Add
14619 get_reloc_addend_noerror.
14620 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14621 variants of add_global which take an addend which must be zero.
14622 * i386.cc: Include "copy-relocs.h".
14623 (class Target_i386): Change type of copy_relocs_ to variable,
14624 update initializer.
14625 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14626 Change all callers.
14627 (Target_i386::do_finalize_sections): Change handling of
14629 * sparc.cc: Include "copy-relocs.h".
14630 (class Target_sparc): Change type of copy_relocs_ to variable,
14631 update initializer.
14632 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14633 Change all callers.
14634 (Target_sparc::do_finalize_sections): Change handling of
14636 * x86_64.cc: Include "copy-relocs.h".
14637 (class Target_x86_64): Change type of copy_relocs_ to variable,
14638 update initializer.
14639 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14640 class. Change all callers.
14641 (Target_x86_64::do_finalize_sections): Change handling of
14643 * Makefile.am (CCFILES): Add copy-relocs.cc.
14644 (HFILES): Add copy-relocs.h.
14646 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14648 * testsuite/script_test_4.sh: Permit leading zeroes.
14650 2008-04-15 Ian Lance Taylor <iant@google.com>
14652 * script-sections.cc (Script_sections::create_segments): Use
14653 header_size_adjustment even when there is enough room for the
14655 * testsuite/script_test_4.sh: New file.
14656 * testsuite/script_test_4.t: New file.
14657 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14658 (check_DATA): Add script_test_4.stdout.
14659 (MOSTLYCLEANFILES): Likewise.
14660 (script_test_4): New target.
14661 (script_test_4.stdout): New target.
14662 * testsuite/Makefile.in: Rebuild.
14664 * sparc.cc: Add definitions for Output_data_plt_sparc class
14667 2008-04-14 David S. Miller <davem@davemloft.net>
14669 * sparc.cc: New file.
14670 * Makefile.am (TARGETSOURCES): Add sparc.cc
14671 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14672 * configure.tgt: Document targ_extra_size and
14673 targ_extra_big_endian. Add entries for sparc-* and
14675 * configure.ac: Handle targ_extra_size and
14676 targ_extra_big_endian.
14677 * Makefile.in: Rebuild.
14678 * configure: Likewise.
14679 * po/POTFILES.in: Likewise.
14680 * po/gold.pot: Likewise.
14682 2008-04-14 Ian Lance Taylor <iant@google.com>
14684 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14685 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14686 in the name/type/flags to section mapping. Don't call
14687 allocate_output_section.
14688 (Layout::choose_output_section): Change parameter from adjust_name
14689 to is_input_section. Don't permit input sections after sections
14690 are attached to segments. Don't call allocate_output_section.
14691 (Layout::layout_eh_frame): Call update_flags_for_input_section,
14692 not write_enable_output_section.
14693 (Layout::make_output_section): Don't push to
14694 unattached_section_list_ nor call attach_to_segment. Call
14695 attach_section_to_segment if sections are attached.
14696 (Layout::attach_sections_to_segments): New function.
14697 (Layout::attach_section_to_segment): New function.
14698 (Layout::attach_allocated_section_to_segment): Rename from
14699 attach_to_segment. Remove flags parameter.
14700 (Layout::allocate_output_section): Remove function.
14701 (Layout::write_enable_output_section): Remove function.
14702 * layout.h (class Layout): Update for above changes. Add new
14703 field sections_are_attached_.
14704 * output.h (Output_section::update_flags_for_input_section): New
14706 * output.cc (Output_section::add_input_section): Call
14707 update_flags_for_input_section.
14708 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14710 2008-04-11 Cary Coutant <ccoutant@google.com>
14712 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14713 thought unnecessary.
14714 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14716 2008-04-11 Ian Lance Taylor <iant@google.com>
14718 * output.h (class Output_section_data): Remove inline definition
14720 * output.cc (Output_section_data::set_addralign): New function.
14722 2008-04-11 Cary Coutant <ccoutant@google.com>
14724 Add support for TLS descriptors for i386 and x86_64.
14725 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14726 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14727 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14729 (Target_i386::got_mod_index_entry): Remove unnecessary code.
14730 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14731 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
14733 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14734 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14735 Fix problem with initial-exec relocations.
14736 (Target_i386::Relocate::relocate_tls): Likewise.
14737 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14739 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14740 support for section-plus-offset dynamic table entries.
14741 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14742 (Output_data_dynamic::Dynamic_entry): Add support for
14743 section-plus-offset dynamic table entries.
14744 (Output_data_dynamic::Classification): Likewise.
14745 (Output_data_dynamic::classification_): Renamed offset_.
14746 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14747 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14748 (Target_x86_64::make_plt_section): New function.
14749 (Target_x86_64::reserve_tlsdesc_entries): New function.
14750 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14751 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14752 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14753 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14754 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14755 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14756 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14757 add extra PLT entry for TLS descriptors.
14758 (Output_data_plt_x86_64::got_): New field.
14759 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14760 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14762 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14764 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14765 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14766 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14767 R_386_TLS_DESC_CALL relocations.
14768 (Target_x86_64::Scan::global): Likewise.
14769 (Target_x86_64::do_finalize_sections): Add dynamic table entries
14770 for TLS descriptors.
14771 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14772 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14773 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14774 GD-to-IE relaxation.
14775 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14776 and TLS_DESCRIPTORS.
14777 * Makefile.in: Rebuild.
14778 * configure: Rebuild.
14779 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14780 (tls_test_shared2.so): New target.
14781 (tls_shared_gd_to_ie_test_SOURCES): New variable.
14782 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14783 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14784 (tls_shared_gd_to_ie_test_LDADD): New variable.
14785 (tls_shared_gnu2_gd_to_ie_test): New target.
14786 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14788 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14789 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14790 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14791 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14792 (tls_shared_gnu2_test): New target.
14793 (tls_test_gnu2_shared.so): New target.
14794 (tls_shared_gnu2_test_SOURCES): New variable.
14795 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14796 (tls_shared_gnu2_test_LDFLAGS): New variable.
14797 (tls_shared_gnu2_test_LDADD): New variable.
14798 * testsuite/Makefile.in: Rebuild.
14799 * testsuite/Makefile.
14801 2008-04-11 Ian Lance Taylor <iant@google.com>
14803 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14805 * testsuite/Makefile.in: Rebuild.
14807 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14809 * testsuite/script_test_2.cc (main): Adjust test.
14811 2008-04-11 David S. Miller <davem@davemloft.net>
14812 Ian Lance Taylor <iant@google.com>
14814 * options.h (General_options): Add entries for '-Y' and
14816 * options.cc (General_options:finalize): If -Y was used, add those
14817 entries to the library path instead of the default "/lib" and
14820 2008-04-11 David S. Miller <davem@davemloft.net>
14822 * testsuite/justsyms.t: Start at 0x100.
14823 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14824 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14826 * testsuite/script_test_2.cc: Adjust string and section length
14829 2008-04-09 Ian Lance Taylor <iant@google.com>
14832 * script-sections.cc (Sections_element::allocate_to_segment): Add
14834 (Output_section_definition::allocate_to_segment): Likewise.
14835 (Orphan_output_section::allocate_to_segment): Likewise.
14836 (Script_sections::attach_sections_using_phdrs_clause): Don't
14837 propagate non-PT_LOAD segments to orphan sections.
14838 * testsuite/Makefile.am (script_test_3.stdout): Generate using
14839 readelf rather than objdump.
14840 * testsuite/script_test_3.sh: Adjust accordingly. Test that
14841 .interp section and PT_INTERP segment are the same size.
14842 * testsuite/Makefile.in: Rebuild.
14844 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14845 aliases for symbols defined in the same object.
14846 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14847 (weak_alias_test_SOURCES): New variable.
14848 (weak_alias_test_DEPENDENCIES): New variable.
14849 (weak_alias_test_LDFLAGS): New variable.
14850 (weak_alias_test_LDADD): New variable.
14851 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14852 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14853 (weak_alias_test_3.o): New target.
14854 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14855 * testsuite/weak_alias_test_main.cc: New file.
14856 * testsuite/weak_alias_test_1.cc: New file.
14857 * testsuite/weak_alias_test_2.cc: New file.
14858 * testsuite/weak_alias_test_3.cc: New file.
14860 2008-04-08 Ian Lance Taylor <iant@google.com>
14862 * options.h (class General_options): Add --noinhibit-exec option.
14863 * main.cc (main): Check --noinhibit-exec.
14865 * options.h (class General_options): Define --wrap as a special
14866 option. Add wrap_symbols_ field.
14867 (General_options::any_wrap_symbols): New function.
14868 (General_options::is_wrap_symbol): New function.
14869 * options.cc (General_options::parse_wrap): New function.
14870 (General_options::General_options): Initialize wrap_symbols_.
14871 * symtab.cc (Symbol_table::wrap_symbol): New function.
14872 (Symbol_table::add_from_object): Handle --wrap.
14873 * symtab.h (class Symbol_table): Declare wrap_symbol.
14874 * target.h (Target::wrap_char): New function.
14875 (Target::Target_info): Add wrap_char field.
14876 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14877 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14878 * testsuite/testfile.cc (Target_test::test_target_info):
14881 * errors.cc (Errors::undefined_symbol): Mention symbol version if
14884 * layout.h (class Layout): Add added_eh_frame_data_ field.
14885 * layout.cc (Layout::Layout): Initialize new field.
14886 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14887 output section until we find a section we merged successfully.
14888 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14889 that the size be non-zero.
14891 * merge.cc (Object_merge_map::get_output_offset): Remove inline
14894 2008-04-08 Craig Silverstein <csilvers@google.com>
14896 * configure.ac: Export new conditional variable HAVE_ZLIB.
14897 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14899 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14900 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14902 2008-04-07 Ian Lance Taylor <iant@google.com>
14904 * version.cc (version_string): Set to "1.5".
14906 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14907 Add issued_non_pic_error_ field. Declare check_non_pic.
14908 (Target_x86_64::Scan::check_non_pic): New function.
14909 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14910 (Target_x86_64::Scan::global): Likewise.
14912 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14913 addend parameter. Change caller. Handle merge sections.
14914 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14915 Address to Addend. Don't add in the result of
14916 local_section_offset, pass down the addend and use the returned
14918 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14919 Update declarations of local_section_offset and symbol_value.
14920 * testsuite/two_file_test_1.cc (t18): New function.
14921 * testsuite/two_file_test_2.cc (f18): New function.
14922 * testsuite/two_file_test_main.cc (main): Call t18.
14923 * testsuite/two_file_test.h (t18, f18): Declare.
14925 * configure.ac: Don't test for objdump, c++filt, or readelf.
14926 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14928 (TEST_READELF): New variable.
14929 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14930 (check_PROGRAMS): Add two_file_strip_test.
14931 (two_file_strip_test): New target.
14932 (check_PROGRAMS): Add two_file_same_shared_strip_test.
14933 (two_file_same_shared_strip_test_SOURCES): New variable.
14934 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14935 (two_file_same_shared_strip_test_LDFLAGS): New variable.
14936 (two_file_same_shared_strip_test_LDADD): New variable.
14937 (two_file_shared_strip.so): New target.
14938 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14939 (ver_test_5.syms, ver_test_7.syms): Likewise.
14940 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14941 (strip_test_3.stdout): Use TEST_OBJDUMP.
14942 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14944 2008-04-04 Cary Coutant <ccoutant@google.com>
14946 * symtab.h (Symbol::is_weak_undefined): New function.
14947 (Symbol::is_strong_undefined): New function.
14948 (Symbol::is_absolute): New function.
14949 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14950 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14952 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14953 (weak_undef_test): New target.
14954 * testsuite/Makefile.in: Rebuild.
14955 * testsuite/weak_undef_file1.cc: New file.
14956 * testsuite/weak_undef_file2.cc: New file.
14957 * testsuite/weak_undef_test.cc: New file.
14959 2008-04-03 Craig Silverstein <csilvers@google.com>
14961 * compressed_output.h (class Output_compressed_section): Use
14963 * compressed_output.cc (zlib_compress): Use unsigned buffers,
14965 (zlib_compressed_suffix): Removed.
14966 (Output_compressed_section::set_final_data_size): Use unsigned
14968 * testsuite/Makefile.am (flagstest_compress_debug_sections):
14969 Fix linker invocation.
14970 (flagstest_o_specialfile_and_compress_debug_sections):
14972 * testsuite/Makefile.in: Regenerated.
14974 2008-04-02 David S. Miller <davem@davemloft.net>
14976 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14977 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14979 2008-04-02 Craig Silverstein <csilvers@google.com>
14983 2008-04-02 Ian Lance Taylor <iant@google.com>
14985 * fileread.cc (File_read::find_view): Add byteshift and vshifted
14986 parameters. Update for new key type to views_. Change all
14988 (File_read::read): Adjust for byteshift in returned view.
14989 (File_read::add_view): New function, broken out of
14990 find_and_make_view.
14991 (File_read::make_view): New function, broken out of
14992 find_and_make_view.
14993 (File_read::find_or_make_view): Add offset and aligned
14994 parameters. Rewrite accordingly. Change all callers.
14995 (File_read::get_view): Add offset and aligned parameters. Adjust
14996 for byteshift in return value.
14997 (File_read::get_lasting_view): Likewise.
14998 * fileread.h (class File_read): Update declarations.
14999 (class File_read::View): Add byteshift_ field. Add byteshift to
15000 constructor. Add byteshift method.
15001 * archive.h (Archive::clear_uncached_views): New function.
15002 (Archive::get_view): Add aligned parameter. Change all callers.
15003 * object.h (Object::get_view): Add aligned parameter. Change all
15005 (Object::get_lasting_view): Likewise.
15007 * fileread.cc (File_read::release): Don't call clear_views if
15008 there are multiple objects.
15009 * fileread.h (File_read::clear_uncached_views): New function.
15010 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15013 2008-03-31 Cary Coutant <ccoutant@google.com>
15015 Add thin archive support.
15016 * archive.cc (Archive::armagt): New const.
15017 (Archive::setup): Remove task parameter and calls to unlock.
15018 (Archive::unlock_nested_archives): New function.
15019 (Archive::read_header): Add nested_off parameter. Change
15021 (Archive::interpret_header): Likewise.
15022 (Archive::include_all_members): Change to handle thin
15024 (Archive::include_member): Likewise.
15025 * archive.h (Archive::Archive): Add new parameters and
15027 (Archive::armagt): New const.
15028 (Archive::setup): Remove task parameter.
15029 (Archive::unlock_nested_archives): New function.
15030 (Archive::read_header): Add nested_off parameter.
15031 (Archive::interpret_header): Likewise.
15032 (Archive::Nested_archive_table): New typedef.
15033 (Archive::is_thin_archive_): New field.
15034 (Archive::nested_archives_): New field.
15035 (Archive::options_): New field.
15036 (Archive::dirpath_): New field.
15037 (Archive::task_): New field.
15038 * readsyms.cc (Read_symbols::do_read_symbols): Add check
15039 for thin archives. Pass additional parameters to
15040 Archive::Archive. Unlock the archive file after calling
15043 2008-03-29 Ian Lance Taylor <iant@google.com>
15045 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15046 version symbol to be local.
15047 * testsuite/ver_test_4.sh: New file.
15048 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15049 (check_DATA): Add ver_test_4.syms.
15050 (ver_test_4.syms): New target.
15051 * testsuite/Makefile.in: Rebuild.
15054 (Output_section::Input_section_sort_entry::has_priority): New
15056 (Output_section::Input_section_sort_entry::match_file_name): New
15058 (Output_section::Input_section_sort_entry::match_section_name):
15060 (Output_section::Input_section_sort_entry::match_section_name_prefix):
15062 (Output_section::Input_section_sort_entry::match_section_file):
15064 (Output_section::Input_section_sort_compare::operator()): Rewrite
15065 using new Input_section_sort_entry functions. Sort crtbegin and
15066 crtend first. Sort sections with no priority before sections with
15068 * testsuite/initpri1.c (d3): Check j != 4.
15069 (cd5): New constructor/destructor function.
15070 (main): Check j != 2.
15072 * symtab.cc (Symbol_table::add_from_object): If we don't use the
15073 new symbol when resolving, don't call set_is_default.
15074 * testsuite/ver_test_7.cc: New file.
15075 * testsuite/ver_test_7.sh: New file.
15076 * testsuite/Makefile.am (ver_test_7.so): New target.
15077 (ver_test_7.o): New target.
15078 (check_SCRIPTS): Add ver_test_7.sh.
15079 (check_DATA): Add ver_test_7.syms.
15080 (ver_test_7.syms): New target.
15082 2008-03-28 Ian Lance Taylor <iant@google.com>
15084 * layout.cc (Layout::layout): If we see an input section with a
15085 name that needs sorting, set the must_sort flag for the output
15087 (Layout::make_output_section): If the name of the output section
15088 indicates that it might require sorting, set the may_sort flag.
15089 * output.h (Output_section::may_sort_attached_input_sections): New
15091 (Output_section::set_may_sort_attached_input_sections): New
15093 (Output_section::must_sort_attached_input_sections): New
15095 (Output_section::set_must_sort_attached_input_sections): New
15097 (class Output_section): Declare Input_section_sort_entry. Define
15098 Input_section_sort_compare. Declare
15099 sort_attached_input_sections. Add new fields:
15100 may_sort_attached_input_sections_,
15101 must_sort_attached_input_sections_,
15102 attached_input_sections_are_sorted_.
15103 * output.cc (Output_section::Output_section): Initialize new
15105 (Output_section::add_input_section): Add an entry to
15106 input_sections_ if may_sort or must_sort are true.
15107 (Output_section::set_final_data_size): Call
15108 sort_attached_input_sections if necessary.
15109 (Output_section::Input_section_sort_entry): Define new class.
15110 (Output_section::Input_section_sort_compare::operator()): New
15112 (Output_section::sort_attached_input_sections): New function.
15113 * configure.ac: Check whether the compiler supports constructor
15114 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
15115 * testsuite/initpri1.c: New file.
15116 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15117 CONSTRUCTOR_PRIORITY.
15118 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15119 (initpri1_LDFLAGS): New variable.
15120 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15122 2008-03-27 Ian Lance Taylor <iant@google.com>
15124 * common.cc (Sort_commons::operator): Correct sorting algorithm.
15125 * testsuite/common_test_1.c: New file.
15126 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15127 (common_test_1_SOURCES): New variable.
15128 (common_test_1_DEPENDENCIES): New variable.
15129 (common_test_1_LDFLAGS): New variable.
15131 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15132 and commons_ correctly when NAME/VERSION does not override
15134 * testsuite/ver_test_6.c: New file.
15135 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15136 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15137 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15139 2008-03-26 Ian Lance Taylor <iant@google.com>
15141 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15142 of an undefined symbol from a version script.
15143 * testsuite/Makefile.am (ver_test_5.so): New target.
15144 (ver_test_5.o): New target.
15145 (check_SCRIPTS): Add ver_test_5.sh.
15146 (check_DATA): Add ver_test_5.syms.
15147 (ver_test_5.syms): New target.
15148 * testsuite/ver_test_5.cc: New file.
15149 * testsuite/ver_test_5.script: New file.
15150 * testsuite/ver_test_5.sh: New file.
15151 * Makefile.in, testsuite/Makefile.in: Rebuild.
15154 Fix problems building gold with gcc 4.3.0.
15155 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15156 (gold_error_at_location, gold_warning_at_location): Use it.
15157 * configure.ac: Check whether we can compile and use a template
15158 function with a printf attribute.
15159 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15160 when jumping over bytes.
15161 * object.cc: Instantiate Object::read_section_data.
15162 * debug.h: Include <cstring>
15163 * dwarf_reader.cc: Include <algorithm>
15164 * main.cc: Include <cstring>.
15165 * options.cc: Include <cstring>.
15166 * output.cc: Include <cstring>.
15167 * script.cc: Include <cstring>.
15168 * script.h: Include <string>.
15169 * symtab.cc: Include <cstring> and <algorithm>.
15170 * target-select.cc: Include <cstring>.
15171 * version.cc: Include <string>.
15172 * testsuite/testmain.cc: Include <cstdlib>.
15173 * configure, config.in: Rebuild.
15175 2008-03-25 Ian Lance Taylor <iant@google.com>
15177 * options.cc: Include "../bfd/bfdver.h".
15178 (options::help): Print bug reporting address.
15180 * version.cc (print_version): Adjust output for current value of
15181 BFD_VERSION_STRING.
15185 * options.cc (options::help): Print list of supported targets.
15186 * target-select.h: Include <vector>.
15187 (class Target_selector): Make machine_, size_, and is_big_endian_
15188 fields const. Add bfd_name_ and instantiated_target_ fields.
15189 (Target_selector::Target_selector): Add bfd_name parameter.
15190 (Target_selector::recognize): Make non-virtual, call
15192 (Target_selector::recognize_by_name): Make non-virtual, call
15193 do_recognize_by_name.
15194 (Target_selector::supported_names): New function.
15195 (Target_selector::bfd_name): New function.
15196 (Target_selector::do_instantiate_target): New pure virtual
15198 (Target_selector::do_recognize): New virtual function.
15199 (Target_selector::do_recognize_by_name): New virtual function.
15200 (Target_selector::instantiate_target): New private function.
15201 (supported_target_names): Declare.
15202 * target-select.cc (Target_selector::Target_selector): Update for
15203 new parameter and fields.
15204 (select_target_by_name): Check that the name matches before
15205 calling recognize_by_name.
15206 (supported_target_names): New function.
15207 * i386.cc (class Target_selector_i386): Update Target_selector
15208 constructor call. Remove recognize and recognize_by_name. Add
15209 do_instantiate_target.
15210 * x86_64.cc (class Target_selector_x86_64): Likewise.
15211 * testsuite/testfile.cc (class Target_selector_test): Update for
15212 changes to Target_selector.
15214 * README: Rewrite, with some notes on unsupported features.
15216 2008-03-24 Cary Coutant <ccoutant@google.com>
15218 * i386.cc (Target_i386::Got_type): New enum declaration.
15219 (Target_i386::Scan::local): Updated callers of Output_data_got
15221 (Target_i386::Scan::global): Likewise.
15222 (Target_i386::Relocate::relocate): Likewise.
15223 (Target_i386::Relocate::relocate_tls): Likewise.
15224 * object.h (Got_offset_list): New class.
15225 (Sized_relobj::local_has_got_offset): Added got_type parameter.
15226 (Sized_relobj::local_got_offset): Likewise.
15227 (Sized_relobj::set_local_got_offset): Likewise.
15228 (Sized_relobj::local_has_tls_got_offset): Removed.
15229 (Sized_relobj::local_tls_got_offset): Removed.
15230 (Sized_relobj::set_local_tls_got_offset): Removed.
15231 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15232 * output.cc (Output_data_got::add_global): Added got_type parameter.
15233 (Output_data_got::add_global_with_rel): Likewise.
15234 (Output_data_got::add_global_with_rela): Likewise.
15235 (Output_data_got::add_global_pair_with_rel): New function.
15236 (Output_data_got::add_global_pair_with_rela): New function.
15237 (Output_data_got::add_local): Added got_type parameter.
15238 (Output_data_got::add_local_with_rel): Likewise.
15239 (Output_data_got::add_local_with_rela): Likewise.
15240 (Output_data_got::add_local_pair_with_rel): New function.
15241 (Output_data_got::add_local_pair_with_rela): New function.
15242 (Output_data_got::add_global_tls): Removed.
15243 (Output_data_got::add_global_tls_with_rel): Removed.
15244 (Output_data_got::add_global_tls_with_rela): Removed.
15245 (Output_data_got::add_local_tls): Removed.
15246 (Output_data_got::add_local_tls_with_rel): Removed.
15247 (Output_data_got::add_local_tls_with_rela): Removed.
15248 * output.h (Output_data_got::add_global): Added got_type parameter.
15249 (Output_data_got::add_global_with_rel): Likewise.
15250 (Output_data_got::add_global_with_rela): Likewise.
15251 (Output_data_got::add_global_pair_with_rel): New function.
15252 (Output_data_got::add_global_pair_with_rela): New function.
15253 (Output_data_got::add_local): Added got_type parameter.
15254 (Output_data_got::add_local_with_rel): Likewise.
15255 (Output_data_got::add_local_with_rela): Likewise.
15256 (Output_data_got::add_local_pair_with_rel): New function.
15257 (Output_data_got::add_local_pair_with_rela): New function.
15258 (Output_data_got::add_global_tls): Removed.
15259 (Output_data_got::add_global_tls_with_rel): Removed.
15260 (Output_data_got::add_global_tls_with_rela): Removed.
15261 (Output_data_got::add_local_tls): Removed.
15262 (Output_data_got::add_local_tls_with_rel): Removed.
15263 (Output_data_got::add_local_tls_with_rela): Removed.
15264 * resolve.cc (Symbol::override_base_with_special): Removed
15265 reference to has_got_offset_ field.
15266 * symtab.cc (Symbol::init_fields): Replaced initialization
15267 of got_offset_ with got_offsets_. Removed initialization
15269 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15270 (Symbol::got_offset): Likewise.
15271 (Symbol::set_got_offset): Likewise.
15272 (Symbol::has_tls_got_offset): Removed.
15273 (Symbol::tls_got_offset): Removed.
15274 (Symbol::set_tls_got_offset): Removed.
15275 (Symbol::got_offset_): Removed.
15276 (Symbol::tls_mod_got_offset_): Removed.
15277 (Symbol::tls_pair_got_offset_): Removed.
15278 (Symbol::got_offsets_): New field.
15279 (Symbol::has_got_offset): Removed.
15280 (Symbol::has_tls_mod_got_offset): Removed.
15281 (Symbol::has_tls_pair_got_offset): Removed.
15282 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15283 (Target_x86_64::Scan::local): Updated callers of Output_data_got
15285 (Target_x86_64::Scan::global): Likewise.
15286 (Target_x86_64::Relocate::relocate): Likewise.
15287 (Target_x86_64::Relocate::relocate_tls): Likewise.
15289 2008-03-25 Ben Elliston <bje@au.ibm.com>
15291 * yyscript.y: Fix spelling error in comment.
15293 2008-03-24 Ian Lance Taylor <iant@google.com>
15295 * options.h (class General_options): Define build_id option.
15296 * layout.h (class Layout): Declare write_build_id, create_note,
15297 create_build_id. Add build_id_note_ member.
15298 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15299 "libiberty.h", "md5.h", "sha1.h".
15300 (Layout::Layout): Initialize eh_frame_data_,
15301 eh_frame_hdr_section_, and build_id_note_.
15302 (Layout::finalize): Call create_build_id.
15303 (Layout::create_note): New function, broken out of
15304 Layout::create_gold_note.
15305 (Layout::create_gold_note): Call create_note.
15306 (Layout::create_build_id): New function.
15307 (Layout::write_build_id): New function.
15308 (Close_task_runner::run): Call write_build_id.
15310 * x86_64.cc: Correct license to GPLv3.
15312 2008-03-23 Ian Lance Taylor <iant@google.com>
15314 * options.cc: Include "demangle.h".
15315 (parse_optional_string): New function.
15316 (parse_long_option): Handle takes_optional_argument.
15317 (parse_short_option): Update dash_z initializer. Handle
15318 takes_optional_argument.
15319 (General_options::General_options): Initialize do_demangle_.
15320 (General_options::finalize): Set do_demangle_. Handle demangling
15322 * options.h (parse_optional_string): Declare.
15323 (struct One_option): Add optional_arg field. Update constructor.
15324 Update call constructor calls. Add takes_optional_argument
15326 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
15327 (DEFINE_optional_string): Define.
15328 (General_options::demangle): Change from DEFINE_bool to
15329 DEFINE_optional_string.
15330 (General_options::no_demangle): New function.
15331 (General_options::do_demangle): New function.
15332 (General_options::set_do_demangle): New function.
15333 (General_options::execstack_status_): Move definition to end of
15335 (General_options::static_): Likewise.
15336 (General_options::do_demangle_): New field.
15337 * object.cc (big_endian>::get_symbol_location_info): Call
15338 Options::do_demangle, not Options::demangle.
15339 * symtab.cc (demangle): Likewise.
15341 2008-03-22 Ian Lance Taylor <iant@google.com>
15343 * gold.h: Include <cstddef> and <sys/types.h>
15344 * options.h: Include <cstring>.
15346 2008-03-21 Ian Lance Taylor <iant@google.com>
15348 * Added source code to GNU binutils.
15350 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15352 Copying and distribution of this file, with or without modification,
15353 are permitted in any medium without royalty provided the copyright
15354 notice and this notice are preserved.
15360 version-control: never