1 2012-10-18 Alan Modra <amodra@gmail.com>
3 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
4 dynamic relocs for GOT_TPREL got entries, without symbol if
6 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
7 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
8 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
10 2012-10-17 Alan Modra <amodra@gmail.com>
13 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
15 2012-10-16 Sriraman Tallam <tmsriram@google.com>
17 * layout.cc (Layout::include_section): Keep sections marked
18 SHF_EXCLUDE when doing relocatable links.
20 2012-10-16 Alan Modra <amodra@gmail.com>
22 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
23 (Target_powerpc::do_finalize_sections): Call it.
24 (Output_data_save_res): New class and supporting functions.
25 (Target_powerpc::symval_for_branch): Only look up .opd entry for
26 normal symbols defined in object files.
28 2012-10-12 Alan Modra <amodra@gmail.com>
30 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
31 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
32 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
33 section if scan_opd_relocs not yet called.
34 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
36 2012-10-12 Alan Modra <amodra@gmail.com>
38 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
39 add_local_ifunc_entry): Revert last change.
40 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
42 2012-10-05 Alan Modra <amodra@gmail.com>
44 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
45 do_plt_address_for_global): New functions.
46 (Output_data_got_powerpc::do_write): Don't segfault when linking
48 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
49 add_local_ifunc_entry): Return true on adding entry..
50 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
51 glink->add_entry call. Remove unused symtab param. Adjust calls.
52 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
53 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
55 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
56 syms here. Do so even when no .iplt. Don't segfault when linking
58 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
59 new variants without reloc param.
60 (Glink_sym_ent::Glink_sym_ent): Likewise.
61 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
62 reloc when refs will resolve to plt call stub.
63 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
64 R_PPC_PLTREL24 to resolve locally.
65 (Target_powerpc::Scan::global): Correct ifunc handling.
66 (Target_powerpc::Relocate::relocate): Correct local sym glink
67 lookup. Don't destroy "value" when we have a plt call stub,
68 and when checking plt call validity.
69 (Target_powerpc::do_dynsym_value): Simplify.
71 2012-10-05 Alan Modra <amodra@gmail.com>
73 * i386.cc (Output_data_plt_i386::address_for_global,
74 address_for_local): Add plt offset to returned value. Adjust uses.
75 * sparc.cc (Output_data_plt_sparc::address_for_global,
76 address_for_local): Likewise.
77 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
78 address_for_local): Likewise.
79 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
80 address_for_local): Likewise.
81 * target.h (Target::plt_address_for_global, plt_address_for_local):
83 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
84 (Output_data_got::Got_entry::write): Nor here.
85 * output.h: Comment fix.
87 2012-10-02 Jiong Wang <jiwang@tilera.com>
89 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
90 global_offset_table_ value for larget got.
91 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
93 2012-09-29 Alan Modra <amodra@gmail.com>
95 * powerpc.cc (Target_powerpc::iplt_): New output section.
96 (Target_powerpc::iplt_section, make_iplt_section,
97 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
98 (Target_powerpc::make_plt_entry): Handle ifunc syms.
99 Target_powerpc::plt_entry_count): Count iplt entries too.
100 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
101 reloc section in constructor. New params.
102 (Target_powerpc::make_plt_section): Create reloc section here instead.
103 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
105 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
106 (Output_data_glink::add_entry, find_entry): New functions to
107 deal with local syms.
108 (Glink_sym_ent): Add support for local syms.
109 (Output_data_glink::do_write): Handle ifunc plt entries.
110 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
111 (Target_powerpc::Scan::local, global): Handle ifunc syms.
112 (Target_powerpc::Relocate::relocate): Likewise.
113 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
115 2012-09-25 Alan Modra <amodra@gmail.com>
117 * object.h (Sized_relobj_file::adjust_local_symbol,
118 do_adjust_local_symbol): New functions.
119 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
120 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
121 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
122 and irregular opd entry spacing.
123 (Powerpc_relobj::do_read_relocs): Add opd size checks.
124 (Global_symbol_visitor_opd): New functor.
125 (Target_powerpc::do_finalize_sections): Omit global symbols defined
126 on deleted opd entries.
128 2012-09-15 Jiong Wang <jiwang@tilera.com>
130 * tilegx.cc: New file.
131 * Makefile.am (TARGETSOURCES): Add tilegx.cc
132 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
133 * configure.tgt: Add entries for tilegx*.
134 * configure.ac: Likewise.
135 * Makefile.in: Rebuild.
136 * configure: Likewise.
137 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
140 2012-09-13 Alan Modra <amodra@gmail.com>
142 * target-reloc.h (scan_relocs): Call scan.local for relocs
143 against symbols in discarded sections. Pass is_discarded
145 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
146 Add is_discarded param.
147 * powerpc (Target_powerpc::Scan::local): Likewise. Use
148 is_discarded to flag opd entry as discarded. Don't emit dyn
149 relocs on such entries.
150 (Target_powerpc::Scan::global): Similarly detect and handle
152 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
153 opd_ent_. Update all uses.
154 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
155 (Target_powerpc::relocate_section): Zero out discarded opd
158 2012-09-12 Ian Lance Taylor <iant@google.com>
161 * output.cc: Rename Output_data_got template parameter from size
162 to got_size for all functions. Compile all variants of
164 (Output_data_got::Got_entry::write): Correct use of size for
165 symbol value. Use local_is_tls rather than casting to
167 * object.h (class Object): Add local_is_tls and do_local_is_tls.
168 (class Sized_relobj_file): Add do_local_is_tls.
169 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
171 2012-09-11 Alan Modra <amodra@gmail.com>
174 * layout.cc (Layout::set_segment_offsets): When using
175 common-page-size alignment, ensure we are on a new max-page-size
177 * output.cc (Output_segment::set_section_addresses): Use
178 abi_pagesize, not common_pagesize for relro boundary.
179 (Output_segment::set_offset): Likewise.
181 2012-09-11 Alan Modra <amodra@gmail.com>
183 * output.h (Output_data_got::add_global_tls, add_local_tls,
184 add_local_tls_pair): New functions.
185 (Output_data_got::add_local_pair_with_rel): Remove second
186 reloc param. Expand comment.
187 (Output_data_got::Got_entry): Rename use_plt_offset_ to
188 use_plt_or_tls_offset_, similarly for constructor param.
189 (Output_data_got::Got_entry::write): Add got_index param.
190 * output.cc (Output_data_got::add_global_tls, add_local_tls,
191 add_local_tls_pair): New functions.
192 (Output_data_got::Got_entry::write): Handle tls symbols
193 with use_plt_or_tls_offset_ set specially.
194 (Output_data_got::add_local_pair_with_rel): Only one reloc.
195 (Output_data_got::do_write): Replace iterator with index, pass
196 index to entry write function.
197 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
198 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
199 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
201 * i386.cc (Target_i386::Scan::local): Likewise.
202 * sparc.cc (Target_sparc::Scan::local): Likewise.
203 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
204 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
205 do_tls_offset_for_global): New functions.
206 (Target_powerpc::Scan::local): Correct TLS relocations and got
208 (Target_powerpc::Scan::global): Don't emit unnecessary
209 dynamic relocations on TLS GOT entries.
211 2012-09-10 Matthias Klose <doko@ubuntu.com>
213 * config.in: Disable sanity check for kfreebsd.
215 2012-09-10 Sterling Augustine <saugustine@google.com>
217 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
218 (Gdb_index::pubtypes_read): New parameter.
219 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
221 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
224 2012-09-09 Alan Modra <amodra@gmail.com>
226 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
227 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
228 * gc.h (gc_process_relocs): Call target gc_add_reference.
229 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
230 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
231 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
233 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
234 to cater for when we don't need code offset. Update use.
235 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
236 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
237 set_opd_valid): New functions.
238 (Target_powerpc::do_gc_add_reference): New function.
239 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
241 (Target_powerpc::do_gc_mark_symbol): New function.
243 2012-09-06 Cary Coutant <ccoutant@google.com>
245 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
246 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
247 (Dwarf_die::skip_attributes): Likewise.
248 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
249 * testsuite/gdb_index_test.cc (inline_func_1): New function.
251 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
253 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
255 * testsuite/script_test_3.t: Add .got.plt output section
257 * testsuite/script_test_4.t: Likewise.
259 2012-09-05 Alan Modra <amodra@gmail.com>
261 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
262 update all uses and lose "enum" when using type.
264 2012-09-05 Alan Modra <amodra@gmail.com>
266 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
267 * configure: Regenerate.
268 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
269 (plugin_final_layout.stdout): Likewise.
270 (memory_test): Set page sizes to 0x1000.
271 * testsuite/Makefile.in: Regenerate.
272 * testsuite/discard_locals_test.sh: Add FIXME comment.
273 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
274 * testsuite/pr14265.t: Add .got output section statement.
275 * testsuite/script_test_2.t: Likewise.
276 * testsuite/script_test_3.t: Likewise.
277 * testsuite/script_test_4.t: Likewise.
278 * testsuite/script_test_5.t: Likewise.
279 * testsuite/script_test_6.t: Likewise.
280 * testsuite/script_test_7.t: Likewise.
281 * testsuite/script_test_9.t: Likewise.
283 2012-09-05 Alan Modra <amodra@gmail.com>
285 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
286 (Powerpc_relocate_functions::Status): New typedef.
287 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
288 (Target_powerpc::Scan::local): Handle REL64.
289 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
291 (Target_powerpc::symval_for_branch): New function, extracted from..
292 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
293 checks. Report overflow errors.
295 2012-09-05 Alan Modra <amodra@gmail.com>
297 * object.h (Sized_relobj_file::emit_relocs): Delete.
298 (Sized_relobj_file::emit_relocs_reltype): Delete.
299 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
300 relocate_relocs for --emit-relocs.
301 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
302 * output.h: Update comment.
303 (Output_segment::first_section): New function.
304 (Output_segment::first_section_load_address): Use first_section.
305 * output.cc (Output_segment::first_section): New function extracted..
306 (Output_segment::first_section_load_address): ..from here. Delete.
307 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
308 * target.h (Sized_target::relocate_for_relocatable): Likewise.
309 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
310 adjust call to target.h function.
311 * i386.cc (Target_i386): Likewise.
312 * sparc.cc (Target_sparc): Likewise.
313 * x86_64.cc (Target_x86_64): Likewise.
314 * powerpc.cc (Target_powerpc): Likewise.
315 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
316 first tls section has section symbol for optimised local dynamic
318 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
319 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
321 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
322 Rename to relocate_relocs. Update error message.
324 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
326 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
329 2012-08-31 Alan Modra <amodra@gmail.com>
331 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
332 (Powerpc_relobj::toc_base_offset): New stub function.
333 (Target_powerpc): Add tp_offset, dtp_offset. Rename
334 got_mod_index_offset to tlsld_got_offset. Update all refs.
335 (Target_powerpc::Relocate::enum skip_tls): New.
336 (Target_powerpc::call_tls_get_addr_): New var.
337 (Target_powerpc::is_branch_reloc): Move to file scope.
338 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
339 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
341 (Target_powerpc::enum Got_type): Delete old values, add new ones.
342 (powerpc_info): Correct common_pagesize for ppc64.
343 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
344 (Powerpc_relocate_functions): Add overflow check enums and functions.
345 Add non-shift version of rela, rela_ua. Delete all rel public
346 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
347 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
348 addr16_ha3, addr14 functions.
349 (Output_data_got_powerpc::add_constant_pair): New function.
350 (Output_data_got_powerpc::got_base_offset): Likewise.
351 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
352 (instruction constants): Sort, add some more.
353 (Output_data_glink::do_write): Add and use Address typedef. Use
354 object->toc_base_offset() stub for 64-bit.
355 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
356 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
357 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
358 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
359 Always treat .opd relocs as against locally defined symbol.
360 Correct condition for RELATIVE relocs.
361 (Target_powerpc::do_finalize_sections): Test for NULL sections.
362 (Target_powerpc::Relocate::relocate): Use plt call stub as value
363 for 32-bit syms with a plt entry. Correct ppc64 toc base
364 calculations. Handle TLS relocs, and more. Add overflow
365 checking and adjust for Powerpc_relocate_functions changes.
366 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
367 Reinstate --emit-relocs code with FIXME.
369 2012-08-30 Alan Modra <amodra@gmail.com>
371 * layout.cc (Layout::set_segment_offsets): Set p_align to
372 abi_pagesize, not common_pagesize.
373 (Layout::relaxation_loop_body): Similarly use abi_pagesize
374 to determine whether file header can go in segment.
376 2012-08-30 Alan Modra <amodra@gmail.com>
378 * output.h (Output_reloc::Output_reloc <output section>): Add
379 is_relative param. Adjust calls.
380 (Output_reloc::add_output_section_relative): New functions.
381 * output.cc (Output_reloc::Output_reloc <output section>): Handle
383 (Output_reloc::symbol_value): Handle SECTION_CODE.
385 2012-08-24 Sriraman Tallam <tmsriram@google.com>
387 * gold.cc (queue_middle_tasks): Call layout again when unique
388 segments for sections is desired.
389 * layout.cc (Layout::Layout): Initialize new members.
390 (Layout::get_output_section_flags): New function.
391 (Layout::choose_output_section): Call get_output_section_flags.
392 (Layout::layout): Make output section for mapping to a unique segment.
393 (Layout::insert_section_segment_map): New function.
394 (Layout::attach_allocated_section_to_segment): Make unique segment for
395 output sections marked so.
396 (Layout::segment_precedes): Check for unique segments when sorting.
397 * layout.h (Layout::Unique_segment_info): New struct.
398 (Layout::Section_segment_map): New typedef.
399 (Layout::insert_section_segment_map): New function.
400 (Layout::get_output_section_flags): New function.
401 (Layout::is_unique_segment_for_sections_specified): New function.
402 (Layout::set_unique_segment_for_sections_specified): New function.
403 (Layout::unique_segment_for_sections_specified_): New member.
404 (Layout::section_segment_map_): New member.
405 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
406 Rename is_gc_pass_one to is_pass_one.
407 Rename is_gc_pass_two to is_pass_two.
408 Rename is_gc_or_icf to is_two_pass.
409 Check for which pass based on whether symbols data is present.
410 Make it two pass when unique segments for sections is desired.
411 * output.cc (Output_section::Output_section): Initialize new
413 * output.h (Output_section::is_unique_segment): New function.
414 (Output_section::set_is_unique_segment): New function.
415 (Output_section::is_unique_segment_): New member.
416 (Output_section::extra_segment_flags): New function.
417 (Output_section::set_extra_segment_flags): New function.
418 (Output_section::extra_segment_flags_): New member.
419 (Output_section::segment_alignment): New function.
420 (Output_section::set_segment_alignment): New function.
421 (Output_section::segment_alignment_): New member.
422 (Output_segment::Output_segment): Initialize is_unique_segment_.
423 (Output_segment::is_unique_segment): New function.
424 (Output_segment::set_is_unique_segment): New function.
425 (Output_segment::is_unique_segment_): New member.
426 * plugin.cc (allow_unique_segment_for_sections): New function.
427 (unique_segment_for_sections): New function.
428 (Plugin::load): Add new functions to transfer vector.
429 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
430 * Makefile.in: Regenerate.
431 * testsuite/plugin_final_layout.sh: Check if unique segment
433 * testsuite/plugin_section_order.c (onload): Check if new interfaces
435 (allow_unique_segment_for_sections): New global.
436 (unique_segment_for_sections): New global.
437 (claim_file_hook): Call allow_unique_segment_for_sections.
438 (all_symbols_read_hook): Call unique_segment_for_sections.
440 2012-08-22 Cary Coutant <ccoutant@google.com>
442 * layout.cc (Layout::include_section): Don't assert on GROUP
443 sections with --emit-relocs.
445 2012-08-21 Cary Coutant <ccoutant@google.com>
447 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
448 if --export-dynamic-symbol names an undef symbol.
450 2012-08-18 Alan Modra <amodra@gmail.com>
452 * powerpc.cc: Formatting and white space.
453 (Powerpc_relobj): Rename got2_section_ to special_.
454 Add opd_ent_shndx_ and opd_ent_off_ vectors.
455 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
456 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
457 (Target_powerpc): Add Address typedef and invalid_address. Use
459 (Target_powerpc::is_branch_reloc): New function.
460 (Powerpc_relocate_functions): Add Address typedef, use throughout.
461 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
462 for dst_mask, value and addend.
463 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
464 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
465 (Output_data_glink::do_write): Correct toc base. Don't try to use
466 uint16_t for 24-bit offset. Use get_output_section_offset and
468 (Target_powerpc::Scan::local): Handle more relocs.
469 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
470 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
471 Plug in toc restoring insn after plt calls. Translate branches
472 to function descriptor symbols to corresponding entry point.
473 (Target_powerpc::relocate_for_relocatable): Check return from
474 get_output_section_offset.
475 * symtab.h: Comment typo.
477 2012-08-14 Ian Lance Taylor <iant@google.com>
479 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
480 unsupported_relocal_local to call unsupported_reloc_global.
482 2012-08-14 Nick Clifton <nickc@redhat.com>
485 * script-sections.cc (Sections_element::output_section_name): Add
486 keep return parameter.
487 (Output_section_element::match_name): Add keep return parameter.
488 Return the value of the keep_ member.
489 * script-sections.h (class Output_section): Update
490 output_section_name prototype.
491 * layout.cc (Layout::keep_input_section): New public member
493 (Layout::choose_output_section): Pass keep parameter to
495 * layout.h (class Layout): Add keep_input_section.
496 * object.cc (Sized_relobj_file::do_layout): Check for kept input
498 * testsuite/Makefile.am: Add a test.
499 * testsuite/Makefile.in: Regenerate.
500 * testsuite/pr14265.c: Source file for the test.
501 * testsuite/pr14265.t: Linker script for the test.
502 * testsuite/pr14265.sh: Shell script for the test.
504 2012-08-14 Alan Modra <amodra@gmail.com>
506 * target.h (Target::output_section_name): New function.
507 (Target::do_output_section_name): New function.
508 * layout.cc (Layout::choose_output_section): Call the above.
509 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
511 2012-08-14 Alan Modra <amodra@gmail.com>
513 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
514 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
515 for replace_constant call.
516 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
517 (Output_data_glink::do_print_to_mapfile): New function.
518 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
519 (Target_powerpc::Relocate::relocate): Likewise.
521 2012-08-14 Alan Modra <amodra@gmail.com>
523 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
524 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
525 (Output_data_glink::add_entry,find_entry): Remove shndx param.
526 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
527 all references to shndx_. Handle special case for R_PPC_PLTREL24
529 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
530 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
531 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
533 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
534 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
536 2012-08-12 Alan Modra <amodra@gmail.com>
538 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
539 (glink insn constants): Use uint32_t.
540 (Output_data_glink::add_entry): Use insert, not [] operator.
542 2012-08-11 Alan Modra <amodra@gmail.com>
544 * object.h (Sized_relobj_file::find_shdr): New function.
545 (Sized_relobj_file::find_special_sections): New function.
546 * object.cc (Sized_relobj_file::find_shdr): New function.
547 (Sized_relobj_file::find_eh_frame): Use find_shdr.
548 (Sized_relobj_file::find_special_sections): New function, split out..
549 (Sized_relobj_file::do_read_symbols): ..from here.
550 * output.h (Output_data_got::replace_constant): New function.
551 (Output_data_got::num_entries): New function.
552 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
553 (Output_data_got::got_offset): Protected rather than private.
554 (Output_data_got::replace_got_entry): New function.
555 * output.cc (Output_data_got::replace_got_entry): New function.
556 * powerpc.cc (class Powerpc_relobj): New.
557 (class Powerpc_relocate_functions): Delete all psymval variants or
558 convert to value,addend type. Delete pcrela, pcrela_unaligned.
559 Implement _ha functions using corresponding _hi function.
560 (Powerpc_relobj::find_special_sections): New function.
561 (Target_powerpc::do_make_elf_object): New function.
562 (class Output_data_got_powerpc): New.
563 (class Output_data_glink): New.
564 (class Powerpc_scan_relocatable_reloc): New.
565 Many more changes througout file.
567 2012-08-09 Nick Clifton <nickc@redhat.com>
569 * po/vi.po: Updated Vietnamese translation.
571 2012-08-07 Ian Lance Taylor <iant@google.com>
573 * layout.cc (Layout::add_target_dynamic_tags): If
574 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
577 2012-07-30 Nick Clifton <nickc@redhat.com>
579 * po/gold.pot: Updated template.
580 * po/es.po: Updated Spanish translation.
582 2012-07-18 Cary Coutant <ccoutant@google.com>
585 * configure.ac: Add check for -gpubnames support.
586 * configure: Regenerate.
587 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
588 support; force -gno-pubnames.
589 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
591 (gdb_index_test_4): New test.
592 * testsuite/Makefile.in: Regenerate.
593 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
594 * testsuite/gdb_index_test_2.sh: Likewise.
595 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
596 * testsuite/gdb_index_test_4.sh: New script.
597 * testsuite/gdb_index_test_comm.sh: New script with common code;
598 don't look for space after colon.
600 2012-07-16 Sriraman Tallam <tmsriram@google.com>
602 * gold.cc (queue_middle_tasks): Update function order only after
603 deferred objects due to plugins are processed.
605 2012-07-11 Ian Lance Taylor <iant@google.com>
607 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
608 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
609 (Target_arm::scan_reloc_for_stub): Likewise.
610 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
611 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
612 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
613 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
614 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
616 2012-07-10 Dodji Seketeli <dodji@redhat.com>
617 Ian Lance Taylor <iant@google.com>
620 * configure.ac: Test whether std::tr1::hash<off_t> works.
621 * gold.h: Add a specialization for std::tr1::hash<off_t> if
623 * output.h (class Output_fill): Add virtual destructor.
624 * configure, config.in: Rebuild.
626 2012-06-22 Roland McGrath <mcgrathr@google.com>
628 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
630 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
632 * plugin.cc (Plugin::load): Handle position independent executables.
634 2012-06-06 Cary Coutant <ccoutant@google.com>
636 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
638 (lines_only_debug_sections): Likewise.
639 (gdb_fast_lookup_sections): New static array.
640 (is_gdb_debug_section): Rename formal parameter.
641 (is_lines_only_debug_section): Likewise.
642 (is_gdb_fast_lookup_section): New function.
643 (Layout::include_section): Check for ".zdebug_" prefix; pass
644 section name suffix to is_gdb_debug_section, et al.; check for
645 fast-lookup sections when building .gdb_index.
646 * options.h (--strip-debug-gdb): Update GDB version number.
648 2012-06-06 Cary Coutant <ccoutant@google.com>
650 * configure.ac: Add check for fallocate.
651 * configure: Regenerate.
652 * config.in: Regenerate.
654 * options.h (class General_options): Add --mmap-output-file and
655 --posix-fallocate options.
656 * output.cc: (posix_fallocate): Remove; replace with...
657 (gold_fallocate): New function.
658 (Output_file::map_no_anonymous): Call gold_fallocate.
659 (Output_file::map): Check --mmap-output-file option.
661 2012-06-05 Jing Yu <jingyu@google.com>
663 * gold.h (textdomain): Add do {} to empty while(0).
664 (bindtextdomain): Likewise.
666 2012-06-04 Cary Coutant <ccoutant@google.com>
668 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
671 2012-05-25 Sriraman Tallam <tmsriram@google.com>
673 * symtab.cc (Symbol_table::define_special_symbol):
674 Initialize *poldsym to prevent uninitialized variable errors.
676 2012-05-23 Cary Coutant <ccoutant@google.com>
678 * layout.cc (Layout::section_name_mapping): Add rules to handle
679 exact match on .data.rel.ro.local or .data.rel.ro.
680 (Layout::output_section_name): Check for exact matches.
682 2012-05-23 Cary Coutant <ccoutant@google.com>
684 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
687 2012-05-22 Cary Coutant <ccoutant@google.com>
689 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
690 object before exporting symbol.
692 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
694 * testsuite/tls_test.cc: Include "config.h" first.
695 * testsuite/tls_test_c.c: Likewise.
697 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
698 Nick Clifton <nickc@redhat.com>
701 * configure.in: Add check that sysdep.h has been included before
702 any system header files.
703 * configure: Regenerate.
704 * config.in: Regenerate.
706 2012-05-14 Cary Coutant <ccoutant@google.com>
708 * layout.cc (Layout::make_output_section): Mark .tdata section
710 * testsuite/relro_test.cc: Add a TLS variable.
712 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
715 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
716 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
719 2012-05-08 Cary Coutant <ccoutant@google.com>
721 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
722 (lines_only_debug_sections): Likewise.
724 2012-05-02 Roland McGrath <mcgrathr@google.com>
728 * Makefile.am (CCFILES, HFILES): Add them.
729 * Makefile.in: Regenerate.
730 * i386.cc (Output_data_plt_i386_nacl): New class.
731 (Output_data_plt_i386_nacl_exec): New class.
732 (Output_data_plt_i386_nacl_dyn): New class.
733 (Target_i386_nacl): New class.
734 (Target_selector_i386_nacl): New class.
735 (target_selector_i386): Use it instead of Target_selector_i386.
736 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
737 (Target_x86_64_nacl): New class.
738 (Target_selector_x86_64_nacl): New class.
739 (target_selector_x86_64, target_selector_x32): Use it instead of
740 Target_selector_x86_64.
741 * arm.cc (Output_data_plt_arm_nacl): New class.
742 (Target_arm_nacl): New class.
743 (Target_selector_arm_nacl): New class.
744 (target_selector_arm, target_selector_armbe): Use it instead of
747 * target-select.cc (select_target): Take new Input_file* and off_t
748 arguments, pass them on to recognize method of selector.
749 * object.cc (make_elf_sized_object): Update caller.
750 * parameters.cc (parameters_force_valid_target): Likewise.
751 * incremental.cc (make_sized_incremental_binary): Likewise.
752 * target-select.h: Update decl.
753 (Target_selector::recognize): Take new Input_file* argument,
754 pass it on to do_recognize.
755 (Target_selector::do_recognize): Take new Input_file* argument.
756 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
757 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
758 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
759 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
761 * target.h (Target::Target_info): New members isolate_execinstr
763 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
764 * arm.cc (Target_arm::arm_info): Update initializer.
765 * i386.cc (Target_i386::i386_info): Likewise.
766 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
767 * sparc.cc (Target_sparc::sparc_info): Likewise.
768 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
769 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
770 * layout.cc (Layout::attach_allocated_section_to_segment):
771 Take new const Target* argument. If target->isolate_execinstr(), act
773 (Layout::find_first_load_seg): Take new const Target* argument;
774 if target->isolate_execinstr(), reject PF_X segments.
775 (Layout::relaxation_loop_body): Update caller.
776 (Layout::set_segment_offsets): If target->isolate_execinstr(),
777 reset file offset to zero when we hit LOAD_SEG, and then do a second
778 loop over the segments before LOAD_SEG to reassign offsets after
779 addresses have been determined. Handle target->rosegment_gap().
780 (Layout::attach_section_to_segment): Take new const Target* argument;
781 pass it to attach_allocated_section_to_segment.
782 (Layout::make_output_section): Update caller.
783 (Layout::attach_sections_to_segments): Take new const Target* argument;
784 pass it to attach_section_to_segment.
785 * gold.cc (queue_middle_tasks): Update caller.
786 * layout.h (Layout): Update method decls with new arguments.
788 * arm.cc (Target_arm::Target_arm): Take optional argument for the
789 Target_info pointer to use.
790 (Target_arm::do_make_data_plt): New virtual method.
791 (Target_arm::make_data_plt): New method that calls it.
792 (Target_arm::make_plt_entry): Use it.
793 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
794 for the section alignment.
795 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
797 (Output_data_plt_arm::first_plt_entry_offset): Call it.
798 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
800 (Output_data_plt_arm::get_plt_entry_size): Call it.
801 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
802 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
803 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
805 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
806 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
807 method instead of sizeof(plt_entry).
808 (Output_data_plt_arm::add_entry): Likewise.
809 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
810 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
812 (Target_arm::plt_entry_size): Likewise.
813 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
815 (Output_data_plt_arm_standard): ... here, new class.
816 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
817 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
818 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
820 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
821 Take additional argument for the PLT entry size.
822 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
823 Use get_plt_entry_size method rather than plt_entry_size variable.
824 (Output_data_plt_x86_64::reserve_slot): Likewise.
825 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
826 (Output_data_plt_x86_64::add_entry): Likewise.
827 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
828 (Output_data_plt_x86_64::address_for_global): Likewise.
829 (Output_data_plt_x86_64::address_for_local): Likewise.
830 (Output_data_plt_x86_64::set_final_data_size): Likewise.
831 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
832 Make method non-static.
833 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
835 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
836 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
837 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
838 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
840 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
841 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
843 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
844 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
846 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
847 (Output_data_plt_x86_64::plt_entry_size)
848 (Output_data_plt_x86_64::first_plt_entry)
849 (Output_data_plt_x86_64::plt_entry)
850 (Output_data_plt_x86_64::tlsdesc_plt_entry)
851 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
852 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
853 (Output_data_plt_x86_64_standard): ... here, new class.
854 (Target_x86_64::Target_x86_64): Take optional argument for the
855 Target_info pointer to use.
856 (Target_x86_64::do_make_data_plt): New virtual method.
857 (Target_x86_64::make_data_plt): New method to call it.
858 (Target_x86_64::init_got_plt_for_update): Use that.
859 Call this->plt_->add_eh_frame method here.
860 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
861 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
862 rather than static method.
863 (Target_x86_64::plt_entry_size): Likewise.
864 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
865 rather than plt_entry_size variable. Move guts of PLT filling to...
866 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
867 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
868 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
870 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
871 additional argument for the section alignment.
872 Don't do add_eh_frame_for_plt here.
873 (Output_data_plt_i386::first_plt_entry_offset): Make the method
874 non-static. Use get_plt_entry_size method rather than plt_entry_size
876 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
878 (Output_data_plt_i386::get_plt_entry_size): Call it.
879 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
880 (Output_data_plt_i386::add_eh_frame): New method to call it.
881 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
883 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
884 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
886 (Output_data_plt_i386::fill_plt_entry): New method to call it.
887 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
888 method instead of plt_entry_size.
889 (Output_data_plt_i386::plt_entry_size)
890 (Output_data_plt_i386::plt_eh_frame_fde_size)
891 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
892 (Output_data_plt_i386_standard): ... here, new class.
893 (Output_data_plt_i386_exec): New class.
894 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
895 (Output_data_plt_i386_exec::first_plt_entry): ... here.
896 (Output_data_plt_i386::exec_plt_entry): Move to ...
897 (Output_data_plt_i386_exec::plt_entry): ... here.
898 (Output_data_plt_i386_dyn): New class.
899 (Output_data_plt_i386::first_plt_entry): Move to ...
900 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
901 (Output_data_plt_i386::dyn_plt_entry): Move to ...
902 (Output_data_plt_i386_dyn::plt_entry): ... here.
903 (Target_i386::Target_i386): Take optional argument for the Target_info
905 (Target_i386::do_make_data_plt): New virtual method.
906 (Target_i386::make_data_plt): New method to call it.
907 (Target_i386::make_plt_section): Use that.
908 Call this->plt_->add_eh_frame method here.
909 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
910 rather than plt_entry_size variable.
911 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
912 (Output_data_plt_i386::address_for_local): Likewise.
913 (Output_data_plt_i386::do_write): Likewise.
914 Move guts of PLT filling to...
915 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
916 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
917 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
918 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
920 2012-05-01 Cary Coutant <ccoutant@google.com>
922 * dwarf_reader.cc (Dwarf_die::read_attributes)
923 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
924 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
925 * reduced_debug_output.cc
926 (Output_reduced_debug_info_section::get_die_end): Remove
927 DW_FORM_GNU_ref_index. Add default case.
929 2012-04-26 Mark Wielaard <mjw@redhat.com>
931 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
932 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
933 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
934 DW_AT_high_pc as offset from DW_AT_low_pc.
936 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
937 * testsuite/Makefile.in: Regenerate.
938 * testsuite/gdb_index_test_3.c: New test source file.
939 * testsuite/gdb_index_test_3.sh: New test source file.
941 2012-04-25 Ian Lance Taylor <iant@google.com>
943 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
945 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
946 as a class, not a struct.
947 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
948 (Target_arm::apply_cortex_a8_workaround): Likewise.
949 * gc.h: Declare Reloc_types as a struct, not a class.
950 * object.h: Declare Symbols_data as a struct.
951 * reloc.h: Declare Read_relocs_data as a struct.
952 * target.h: Declare Relocate_info as a struct.
954 2012-04-24 David S. Miller <davem@davemloft.net>
956 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
957 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
960 2012-04-24 Cary Coutant <ccoutant@google.com>
962 * incremental-dump.cc (find_input_containing_global): Replace
963 magic number with symbolic constant.
964 (dump_incremental_inputs): Update version number.
965 * incremental.cc (Output_section_incremental_inputs): Update version
966 number; import symbolic constants from Incremental_inputs_reader.
967 (Incremental_inputs::create_data_sections): Align relocations
968 section correctly for 64-bit targets.
969 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
970 constants; add padding.
971 (Output_section_incremental_inputs::write_header): Add assert for
973 (Output_section_incremental_inputs::write_input_files): Add assert
974 for input_entry_size.
975 (Output_section_incremental_inputs::write_info_blocks): Add padding;
976 add assert for object_info_size, input_section_entry_size,
977 global_sym_entry_size.
978 * incremental.h (Incremental_inputs_reader): Add symbolic constants
979 for data structure sizes; use them.
980 (Incremental_input_entry_reader): Import symbolic constants from
981 Incremental_inputs_reader; use them.
983 2012-04-23 David S. Miller <davem@davemloft.net>
985 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
987 (Target_sparc::Target_sparc): Initialize new fields.
988 (Target_sparc::do_make_elf_object): New function.
989 (Target_sparc::do_adjust_elf_header): New function.
991 2012-04-23 Cary Coutant <ccoutant@google.com>
993 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
994 CU range table of gdb index.
996 2012-04-20 David S. Miller <davem@davemloft.net>
998 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1001 2012-04-16 David S. Miller <davem@davemloft.net>
1003 * sparc.cc (Target_sparc::got_address): New function.
1004 (Sparc_relocate_functions::gdop_hix22): New function.
1005 (Sparc_relocate_functions::gdop_lox10): New function.
1006 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1008 (Target_sparc::Scan::local): Likewise if the global symbol is not
1009 preemptible and is not IFUNC.
1010 (Target_sparc::Relocate::relocate): Perform GOTDATA code
1011 transformations for local and non-preemptible non-IFUNC global
1014 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1015 writing out 64-bit part of ranges.
1017 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1018 -fpic and -fpie respectively.
1019 * Makefile.in: Regenerate.
1021 * sparc.cc (class Target_sparc): Add rela_ifunc_.
1022 (Target_sparc::Target_sparc): Initialize new field.
1023 (Target_sparc::do_plt_section_for_global): New function.
1024 (Target_sparc::do_plt_section_for_local): New function.
1025 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1026 (Target_sparc::make_plt_section): New function, broken out of
1027 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
1028 (Target_sparc::make_plt_entry): Call make_plt_section.
1029 (Target_sparc::make_local_ifunc_plt_entry): New function.
1030 (Target_sparc::rela_ifunc_section): New function.
1031 (Target_sparc::plt_section): Remove const.
1032 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
1033 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1034 and ifunc_count_ fields.
1035 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1036 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1037 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1038 (Output_data_plt_sparc::rela_ifunc): New function.
1039 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1040 (Output_data_plt_sparc::has_ifunc_section): New function.
1041 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1042 (Output_data_plt_sparc::address_for_global): New function.
1043 (Output_data_plt_sparc::address_for_local): New function.
1044 (Output_data_plt_sparc::plt_index_to_offset): New function.
1045 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1047 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1049 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1050 R_SPARC_JMP_IREL to switch.
1051 (Target_sparc::Scan::check_non_pic): Likewise.
1052 (Target_sparc::Scan::local): Handle IFUNC symbols.
1053 (Target_sparc::Scan::local): Likewise.
1054 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1055 and plt_address_for_local.
1056 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1057 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1059 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1060 (class Output_data_reloc): Adjust calls to Output_reloc_type.
1061 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1062 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1064 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1065 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1067 * sparc.cc (Target_sparc::Scan::global): Likewise.
1068 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1070 2012-04-16 Cary Coutant <ccoutant@google.com>
1072 * archive.cc (Library_base::should_include_member): Check for
1073 --export-dynamic-symbol.
1074 * options.h (class General_options): Add --export-dynamic-symbol.
1075 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1076 --export-dynamic-symbol.
1077 (Symbol_table::gc_mark_undef_symbols): Likewise.
1078 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1080 2012-04-12 David S. Miller <davem@davemloft.net>
1082 * sparc.cc (Reloc::wdisp10): New relocation method.
1083 (Reloc::h34): Likewise.
1084 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1085 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1087 (Target_sparc::Scan::local): Likewise.
1088 (Target_sparc::Scan::global): Likewise.
1089 (Target_sparc::Relocate::relocate): Likewise.
1091 2012-04-09 Cary Coutant <ccoutant@google.com>
1093 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1096 2012-04-06 Ian Lance Taylor <iant@google.com>
1098 * timer.cc: #include <unistd.h>.
1100 2012-04-06 Roland McGrath <mcgrathr@google.com>
1102 * configure.in (AC_CHECK_HEADERS): Add locale.h.
1103 * config.in: Regenerate.
1104 * configure: Regenerate.
1106 2012-04-05 Nick Clifton <nickc@redhat.com>
1108 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1109 (AM_LC_MESSAGES): Add.
1110 * aclocal.m4: Regenerate.
1111 * config.in: Regenerate.
1112 * configure: Regenerate.
1114 2012-03-21 Cary Coutant <ccoutant@google.com>
1116 * Makefile.am: Add gdb-index.cc, gdb-index.h.
1117 * Makefile.in: Regenerate.
1118 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1119 (Sized_elf_reloc_mapper::symbol_section): New function.
1120 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1121 (make_elf_reloc_mapper): New function.
1122 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1123 (Dwarf_abbrev_table::do_read_abbrevs): New function.
1124 (Dwarf_abbrev_table::do_get_abbrev): New function.
1125 (Dwarf_ranges_table::read_ranges_table): New function.
1126 (Dwarf_ranges_table::read_range_list): New function.
1127 (Dwarf_pubnames_table::read_section): New function.
1128 (Dwarf_pubnames_table::read_header): New function.
1129 (Dwarf_pubnames_table::next_name): New function.
1130 (Dwarf_die::Dwarf_die): New function.
1131 (Dwarf_die::read_attributes): New function.
1132 (Dwarf_die::skip_attributes): New function.
1133 (Dwarf_die::set_name): New function.
1134 (Dwarf_die::set_linkage_name): New function.
1135 (Dwarf_die::attribute): New function.
1136 (Dwarf_die::string_attribute): New function.
1137 (Dwarf_die::int_attribute): New function.
1138 (Dwarf_die::uint_attribute): New function.
1139 (Dwarf_die::ref_attribute): New function.
1140 (Dwarf_die::child_offset): New function.
1141 (Dwarf_die::sibling_offset): New function.
1142 (Dwarf_info_reader::check_buffer): New function.
1143 (Dwarf_info_reader::parse): New function.
1144 (Dwarf_info_reader::do_parse): New function.
1145 (Dwarf_info_reader::do_read_string_table): New function.
1146 (Dwarf_info_reader::lookup_reloc): New function.
1147 (Dwarf_info_reader::get_string): New function.
1148 (Dwarf_info_reader::visit_compilation_unit): New function.
1149 (Dwarf_info_reader::visit_type_unit): New function.
1150 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1151 Sized_elf_reloc_mapper.
1152 (Sized_dwarf_line_info::symbol_section): Remove function.
1153 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1154 (Sized_dwarf_line_info::read_line_mappings): Remove object
1155 parameter, adjust callers.
1156 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1157 * dwarf_reader.h: Include <sys/types.h>.
1158 (class Track_relocs): Remove forward declaration.
1159 (class Elf_reloc_mapper): New class.
1160 (class Sized_elf_reloc_mapper): New class.
1161 (class Dwarf_abbrev_table): New class.
1162 (class Dwarf_range_list): New class.
1163 (class Dwarf_ranges_table): New class.
1164 (class Dwarf_pubnames_table): New class.
1165 (class Dwarf_die): New class.
1166 (class Dwarf_info_reader): New class.
1167 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1168 (Sized_dwarf_line_info::symbol_section): Remove member function.
1169 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1171 * gdb-index.cc: New source file.
1172 * gdb-index.h: New source file.
1173 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1174 and .debug_types sections, call Layout::add_to_gdb_index.
1175 (Sized_relobj_incr::do_section_name): Implement.
1176 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1177 return type; Implement.
1178 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1180 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1181 parameter list and return type.
1182 (Sized_incr_dynobj::do_section_contents): Likewise.
1183 * layout.cc: Include gdb-index.h.
1184 (Layout::Layout): Initialize gdb_index_data_.
1185 (Layout::init_fixed_output_section): Check for .gdb_index section.
1186 (Layout::add_to_gdb_index): New function. Instantiate.
1187 * layout.h: Add forward declaration for class Gdb_index.
1188 (Layout::add_to_gdb_index): New member function.
1189 (Layout::gdb_index_data_): New data member.
1190 * main.cc: Include gdb-index.h.
1191 (main): Print statistics for gdb index.
1192 * object.cc (Object::section_contents): Move code into
1193 do_section_contents.
1194 (need_decompressed_section): Check for sections needed when building
1196 (build_compressed_section_map): Likewise.
1197 (Sized_relobj_file::do_read_symbols): Need local symbols when building
1199 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1200 sections; call Layout::add_to_gdb_index.
1201 (Sized_relobj_file::do_decompressed_section_contents): Call
1202 do_section_contents directly.
1203 * object.h (Object::do_section_contents): Adjust parameter list and
1205 (Object::do_decompressed_section_contents): Call do_section_contents
1207 (Sized_relobj_file::do_section_contents): Adjust parameter list and
1209 * options.h (class General_options): Add --gdb-index option.
1210 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1211 list and return type.
1212 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1213 * reloc.h (Track_relocs::checkpoint): New function.
1214 (Track_relocs::reset): New function.
1216 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1218 * testsuite/Makefile.in: Regenerate.
1219 * testsuite/gdb_index_test.cc: New test source file.
1220 * testsuite/gdb_index_test_1.sh: New test source file.
1221 * testsuite/gdb_index_test_2.sh: New test source file.
1223 2012-03-19 Doug Kwan <dougkwan@google.com>
1225 * arm.cc (Target_arm::do_define_standard_symbols): New method.
1226 (Target_arm::do_finalize_sections): Remove code which defines
1227 __exidx_start and __exidx_end. Make symbol table parameter
1228 anonymous as it is not used.
1229 * gold.cc (queue_middle_tasks): Call target hook to define any
1230 target-specific symbols.
1231 * target.h (Target::define_standard_symbols): New method.
1232 (Target::do_define_standard_symbols): Same.
1233 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1234 * testsuite/Makefile.in: Regenerate.
1235 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1237 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1238 relocations are generated for __exidx_start and __exidx_end.
1240 2012-03-16 Doug Kwan <dougkwan@google.com>
1242 * testsuite/Makefile.am: Disable test initpri3b.
1243 * testsuite/Makefile.in: Regenerate.
1245 2012-03-15 Doug Kwan <dougkwan@google.com>
1247 * arm.cc (Target_arm::got_section): Make .got section read-only
1250 2012-03-15 Ian Lance Taylor <iant@google.com>
1253 * layout.cc (Layout::make_output_section): Correctly mark
1254 SHT_INIT_ARRAY, et. al., as relro.
1256 2012-03-14 Doug Kwan <dougkwan@google.com>
1258 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1259 dynamic relocations for protected symbols in shared objects.
1261 2012-03-13 Ian Lance Taylor <iant@google.com>
1263 * resolve.cc (Symbol_table::resolve): When merging common symbols,
1264 keep the larger alignment.
1266 2012-03-12 Cary Coutant <ccoutant@google.com>
1268 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1269 handling of DW_LNE_define_file.
1271 2012-03-12 Cary Coutant <ccoutant@google.com>
1273 * reduced_debug_output.cc
1274 (Output_reduced_debug_info_section::get_die_end): Add new FORM
1277 2012-02-29 Cary Coutant <ccoutant@google.com>
1279 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1281 2012-02-29 Cary Coutant <ccoutant@google.com>
1283 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1284 Call Object::decompressed_section_contents.
1285 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1287 (Sized_dwarf_line_info::buffer_start_): New data member.
1288 * merge.cc (Output_merge_data::do_add_input_section): Call
1289 Object::decompressed_section_contents.
1290 (Output_merge_string::do_add_input_section): Likewise.
1291 * object.cc (need_decompressed_section): New function.
1292 (build_compressed_section_map): Decompress sections needed later.
1293 (Sized_relobj_file::do_decompressed_section_contents): New function.
1294 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1295 * object.h (Object::decompressed_section_contents): New function.
1296 (Object::discard_decompressed_sections): New function.
1297 (Object::do_decompressed_section_contents): New function.
1298 (Object::do_discard_decompressed_sections): New function.
1299 (Compressed_section_info): New type.
1300 (Compressed_section_map): Include decompressed section contents.
1301 (Sized_relobj_file::do_decompressed_section_contents): New function.
1302 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1304 2012-02-16 Cary Coutant <ccoutant@google.com>
1306 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1307 * testsuite/Makefile.in: Regenerate.
1309 2012-02-14 Cary Coutant <ccoutant@google.com>
1311 * options.cc (General_options::finalize): Disallow -pie and -static.
1313 2012-02-03 Doug Kwan <dougkwan@google.com>
1315 * arm.cc (Arm_relocate_functions::abs8,
1316 Arm_relocate_functions::abs16): Use
1317 Bits::has_signed_unsigned_overflow32.
1318 (Arm_relocate_functions::thm_abs8): Correct range of
1320 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1323 2012-02-02 Doug Kwan <dougkwan@google.com>
1325 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1326 position independent outputs, not just shared objects.
1328 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
1330 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1331 * configure: Regenerated.
1333 2012-01-27 Ian Lance Taylor <iant@google.com>
1335 * reloc.h (Bits): New class with static functions, copied from
1336 namespace utils in arm.cc.
1337 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
1340 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1342 * incremental.cc (write_info_blocks): Correct relocation offset.
1344 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1346 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1347 (Relocate::tls_gd_to_le): Likewise.
1349 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1351 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1353 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1355 * configure.ac: Check if -mcmodel=medium works.
1356 * configure: Regenerated.
1358 2012-01-24 Cary Coutant <ccoutant@google.com>
1360 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1362 (read_unsigned_LEB_128_x): ... this new function.
1363 (read_signed_LEB_128): Replaced with inline definition and ...
1364 (read_signed_LEB_128_x): ... this new function.
1365 * int_encoding.h (read_unsigned_LEB_128_x): New function.
1366 (read_unsigned_LEB_128): Add inline definition.
1367 (read_signed_LEB_128_x): New function.
1368 (read_signed_LEB_128): Add inline definition.
1369 * testsuite/Makefile.am (leb128_unittest): New unit test.
1370 * testsuite/Makefile.in: Regenerate.
1371 * testsuite/leb128_unittest.cc: New unit test.
1373 2012-01-23 Ian Lance Taylor <iant@google.com>
1376 * i386.cc (Target_i386::do_code_fill): When using a jmp
1377 instruction, pad with nop instructions.
1378 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1380 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
1382 * x86_64.cc (gc_process_relocs): Add typename on types used in
1384 (scan_relocs): Likewise.
1385 (relocate_section): Likewise.
1386 (apply_relocation): Likewise.
1388 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
1390 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1391 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1394 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
1396 * x86_64.cc: Initial support for x32.
1398 2012-01-03 Cary Coutant <ccoutant@google.com>
1400 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1401 Use abstract base class for GOT.
1402 * gold/output.h (class Output_data_got_base): New abstract base class.
1403 (class Output_data_got): Derive from new base class, adjust ctors.
1404 (Output_data_got::reserve_slot): Make virtual; rename to
1405 do_reserve_slot; Adjust callers.
1406 * gold/target.h (Sized_target::init_got_plt_for_update): Return
1407 pointer to abstract base class.
1408 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1410 2011-12-18 Ian Lance Taylor <iant@google.com>
1412 * object.h (Relobj::local_symbol_value): New function.
1413 (Relobj::local_plt_offset): New function.
1414 (Relobj::local_has_got_offset): New function.
1415 (Relobj::local_got_offset): New function.
1416 (Relobj::set_local_got_offset): New function.
1417 (Relobj::do_local_symbol_value): New pure virtual function.
1418 (Relobj::do_local_plt_offset): Likewise.
1419 (Relobj::do_local_has_got_offset): Likewise.
1420 (Relobj::do_local_got_offset): Likewise.
1421 (Relobj::do_set_local_got_offset): Likewise.
1422 (Sized_relobj::do_local_has_got_offset): Rename from
1423 local_has_got_offset.
1424 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1425 (Sized_relobj::do_set_local_got_offset): Rename from
1426 set_local_got_offset.
1427 (Sized_relobj_file::do_local_plt_offset): Rename from
1429 (Sized_relobj_file::do_local_symbol_value): New function.
1430 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1432 * output.cc (Output_data_got::Got_entry::write): Change object to
1433 Relobj. Use local_symbol_value.
1434 (Output_data_got::add_global_with_rel): Change rel_dyn to
1435 Output_data_reloc_generic*. Use add_global_generic.
1436 (Output_data_got::add_global_with_rela): Remove. Change all
1437 callers to use add_global_with_rel.
1438 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1439 Output_data_reloc_generic*. Use add_global_generic.
1440 (Output_data_got::add_global_pair_with_rela): Remove. Change all
1441 callers to use add_global_pair_with_rel.
1442 (Output_data_got::add_local): Change object to Relobj*.
1443 (Output_data_got::add_local_plt): Likewise.
1444 (Output_data_got::add_local_with_rel): Change object to Relobj*,
1445 change rel_dyn to Output_data_reloc_generic*. Use
1447 (Output_data_got::add_local_with_rela): Remove. Change all
1448 callers to use all_local_with_rel.
1449 (Output_data_got::add_local_pair_with_rel): Change object to
1450 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
1451 add_output_section_generic.
1452 (Output_data_got::add_local_pair_with_rela): Remove. Change all
1453 callers to use add_local_pair_with_rel.
1454 (Output_data_got::reserve_local): Change object to Relobj*.
1455 * output.h: (class Output_data_reloc_generic): Add pure virtual
1456 declarations for add_global_generic, add_local_generic,
1457 add_output_section_generic.
1458 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1459 functions for Output_data_reloc_generic. Update declarations for
1460 changes listed in output.cc.
1461 (class Output_data_got): Change template parameter to got_size.
1462 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
1463 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1465 (Sized_relobj_incr::do_local_plt_offset): New function.
1466 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1469 2011-12-17 Cary Coutant <ccoutant@google.com>
1471 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1472 * resolve.cc (Symbol_table::resolve): Likewise.
1473 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1475 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1477 2011-12-16 Ian Lance Taylor <iant@google.com>
1479 * output.h (Output_data_reloc_generic::add): Only call
1480 add_dynamic_reloc if this is a dynamic reloc section.
1482 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
1485 * target-reloc.h (apply_relocation): Replace <64, false> with
1488 2011-11-25 Nick Clifton <nickc@redhat.com>
1490 * po/it.po: New Italian translation.
1492 2011-11-17 Sterling Augustine <saugustine@google.com>
1494 * script.cc (script_include_directive): Implement.
1495 (read_script_file): New local variables name and search_path. Update
1496 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1497 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1498 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1500 2011-11-11 Sterling Augustine <saugustine@google.com>
1502 * yyscript.y (section_cmd): Add support for INCLUDE directive.
1503 (file_or_sections_cmd): Likewise.
1505 2011-11-11 Doug Kwan <dougkwan@google.com>
1507 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1508 if --just-symbols is given.
1510 2011-11-10 Doug Kwan <dougkwan@google.com>
1513 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1514 when processing data relocs.
1515 * reloc.h (Relocate_functions::rel_unaligned): New method.
1516 (Relocate_functions::pcrel_unaligned): Ditto.
1517 (Relocate_functions::rel32_unaligned): Ditto.
1518 (Relocate_functions::pcrel32_unaligned): Ditto.
1520 2011-11-09 Doug Kwan <dougkwan@google.com>
1523 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1524 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1525 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1526 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1527 (Relocate_functions::rel_unaligned): New.
1528 (Relocate_functions::rel32_unaligned): New.
1529 * target-reloc.h (relocate_for_relocatable): Add code to handle
1530 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1531 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1532 arm_unaligned_reloc_r): New targets.
1533 * testsuite/Makefile.in: Regenerate.
1534 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1537 2011-11-02 Ian Lance Taylor <iant@google.com>
1539 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
1541 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1542 * options.cc (General_options::finalize): Use library search path
1543 from configure script if specified. If not native and no sysroot,
1544 only search TOOLLIBDIR.
1545 * options.h (Search_directory::Search_directory): Change name to
1547 (General_options::add_to_library_path_with_sysroot): Change arg to
1549 * configure, Makefile.in, config.in: Rebuild.
1551 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1553 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1554 we are working around the ARM1176 Erratum.
1555 * options.h (General_options::fix_arm1176): Add option.
1556 * testsuite/Makefile.am: Add testcases, and keep current ones
1558 * testsuite/Makefile.in: Regenerate.
1559 * testsuite/arm_fix_1176.s: New file.
1560 * testsuite/arm_fix_1176.sh: Likewise.
1562 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1564 * arm.cc (Target_arm::Target_arm): Remove initialisation of
1566 (Target_arm::may_use_blx): Remove method.
1567 (Target_arm::set_may_use_blx): Likewise.
1568 (Target_arm::may_use_v4t_interworking): New method.
1569 (Target_arm::may_use_v5t_interworking): Likewise.
1570 (Target_arm::may_use_blx_): Remove member variable.
1571 (Arm_relocate_functions::arm_branch_common): Check for v5T
1573 (Arm_relocate_functions::thumb_branch_common): Likewise.
1574 (Reloc_stub::stub_type_for_reloc): Likewise.
1575 (Target_arm::do_finalize_sections): Correct interworking checks.
1576 * testsuite/Makefile.am: Add new tests.
1577 * testsuite/Makefile.in: Regenerate.
1578 * testsuite/arm_farcall_arm_arm.s: New test.
1579 * testsuite/arm_farcall_arm_arm.sh: Likewise.
1580 * testsuite/arm_farcall_arm_thumb.s: Likewise.
1581 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1582 * testsuite/arm_farcall_thumb_arm.s: Likewise.
1583 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1584 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1585 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1587 2011-10-31 Cary Coutant <ccoutant@google.com>
1590 * expression.cc (Expression::eval_with_dot): Add
1591 is_section_dot_assignment parameter.
1592 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
1593 absolute and assigning to dot within a section.
1594 * script-sections.cc
1595 (Output_section_element_assignment::set_section_addresses): Pass
1596 dot_section to set_if_absolute.
1597 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1598 as is_section_dot_assignment flag to eval_with_dot.
1599 (Output_section_element_dot_assignment::set_section_addresses):
1601 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1602 parameter. Also set value if relative to dot_section; set the
1603 symbol's output_section.
1604 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1605 parameter. Adjust all callers.
1606 (Expression::eval_maybe_dot): Likewise.
1607 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1609 * testsuite/script_test_2.t: Test assignment of an absolute value
1610 to dot within an output section element.
1612 2011-10-31 Cary Coutant <ccoutant@google.com>
1614 * options.h (class General_options): Add --[no-]gnu-unique options.
1615 * symtab.cc (Symbol_table::sized_write_globals): Convert
1616 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1618 2011-10-31 Cary Coutant <ccoutant@google.com>
1621 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1622 unnecessary assertion.
1623 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1625 2011-10-31 Sriraman Tallam <tmsriram@google.com>
1627 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1629 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1631 Change to just keep the section associated with symbol.
1632 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1633 they are externally visible and --export-dynamic is turned on.
1634 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1636 2011-10-19 Ian Lance Taylor <iant@google.com>
1639 * script-sections.cc
1640 (Output_section_element_dot_assignment::needs_output_section): New
1643 2011-10-19 Ian Lance Taylor <iant@google.com>
1646 * layout.cc (Layout::segment_precedes): Don't assert failure if a
1647 --section-start option was seen.
1648 * options.h (General_options::any_section_start): New function.
1650 2011-10-18 David S. Miller <davem@davemloft.net>
1653 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1654 member to track relocation locations that have moved during TLS
1655 reloc optimizations.
1656 (Target_sparc::Relocate::Relocate): Initialize to NULL.
1657 (Target_sparc::Relocate::relocate): Adjust view down by 4
1658 bytes if it matches reloc_adjust_addr_.
1659 (Target_sparc::Relocate::relocate_tls): Always move the
1660 __tls_get_addr call delay slot instruction forward 4 bytes when
1661 performing relaxation.
1663 2011-10-18 Cary Coutant <ccoutant@google.com>
1665 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1666 (Output_file::map_no_anonymous): Check for non-zero
1667 return code from posix_fallocate.
1669 2011-10-17 Cary Coutant <ccoutant@google.com>
1672 * plugin.cc (is_visible_from_outside): Check for symbols
1673 referenced from dynamic objects.
1674 * resolve.cc (Symbol_table::resolve): Don't count references
1675 from dynamic objects as references from real ELF files.
1676 * testsuite/plugin_test_2.sh: Adjust expected result.
1678 2011-10-17 Cary Coutant <ccoutant@google.com>
1680 * gold.cc: Include timer.h.
1681 (queue_middle_tasks): Stamp time.
1682 (queue_final_tasks): Likewise.
1683 * main.cc (main): Store timer in parameters. Print timers
1685 * parameters.cc (Parameters::Parameters): Initialize timer_.
1686 (Parameters::set_timer): New function.
1687 (set_parameters_timer): New function.
1688 * parameters.h (Parameters::set_timer): New function.
1689 (Parameters::timer): New function.
1690 (Parameters::timer_): New data member.
1691 (set_parameters_timer): New function.
1692 * timer.cc (Timer::stamp): New function.
1693 (Timer::get_pass_time): New function.
1694 * timer.h (Timer::stamp): New function.
1695 (Timer::get_pass_time): New function.
1696 (Timer::pass_times_): New data member.
1698 2011-10-17 Cary Coutant <ccoutant@google.com>
1700 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1701 task for members of lib groups.
1703 2011-10-17 Cary Coutant <ccoutant@google.com>
1706 * fileread.cc (File_read::find_view): Add assert.
1707 (File_read::make_view): Move bounds check (replace with assert)...
1708 (File_read::find_or_make_view): ... to here.
1710 2011-10-12 Cary Coutant <ccoutant@google.com>
1712 * output.cc (Output_file::open_base_file): Handle case where
1713 ::read returns less than requested size.
1715 2011-10-10 Cary Coutant <ccoutant@google.com>
1717 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1718 Initialize defined_count_.
1719 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1720 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1721 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1722 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1723 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1724 * incremental.h (Sized_relobj_incr::defined_count_): New data
1726 (Sized_incr_dynobj::defined_count_): New data member.
1727 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1728 Return zeroes instead of internal error.
1730 2011-10-10 Cary Coutant <ccoutant@google.com>
1733 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1734 (Output_reloc::symbol_value): Return PLT offset if flag is set.
1735 * output.h (class Output_reloc): Add use_plt_offset flag.
1736 (Output_reloc::type_): Adjust size of bit field.
1737 (Output_reloc::use_plt_offset_): New bit field.
1738 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1739 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1740 flag. Adjust all callers.
1741 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1742 creating RELATIVE relocations.
1744 2011-10-10 Nick Clifton <nickc@redhat.com>
1746 * po/es.po: Updated Spanish translation.
1747 * po/fi.po: Updated Finnish translation.
1749 2011-10-03 Diego Novillo <dnovillo@google.com>
1751 * options.cc (parse_uint): Fix dereference of RETVAL.
1753 2011-09-29 Sriraman Tallam <tmsriram@google.com>
1755 * layout.h (section_order_map_): New member.
1756 (get_section_order_map): New member function.
1757 * output.cc (Output_section::add_input_section): Check for patterns
1758 only when --section-ordering-file is specified.
1759 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1760 output_sections have been formed.
1761 * layout.cc (Layout_Layout): Initialize section_order_map_.
1762 * plugin.cc (update_section_order): Store order in order_map. Do not
1764 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1765 * testsuite/Makefile.in: Regenerate.
1766 * testsuite/plugin_section_order.c: New file.
1767 * testsuite/plugin_final_layout.cc: New file.
1768 * testsuite/plugin_final_layout.sh: New file.
1770 2011-09-29 Cary Coutant <ccoutant@google.com>
1772 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1774 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1775 symbols during incremental update.
1776 (Symbol_table::add_from_dynobj): Likewise.
1778 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1779 Ian Lance Taylor <iant@google.com>
1781 * symtab.cc (Symbol_table::define_special_symbol): Always
1782 canonicalize version string.
1784 2011-09-26 Cary Coutant <ccoutant@google.com>
1786 * gold.cc (queue_initial_tasks): Move option checks ...
1787 * options.cc (General_options::finalize): ... to here. Disable
1788 some options; make others fatal.
1790 2011-09-26 Cary Coutant <ccoutant@google.com>
1793 * plugin.cc (get_symbols_v2): New function.
1794 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1795 (is_referenced_from_outside): New function.
1796 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1797 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1798 (get_symbols): Pass version parameter.
1799 (get_symbols_v2): New function.
1800 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1802 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1803 (onload): Add LDPT_GET_SYMBOLS_V2.
1804 (all_symbols_read_hook): Use get_symbols_v2; check for
1805 LDPR_PREVAILING_DEF_IRONLY_EXP.
1806 * testsuite/plugin_test_3.sh: Update expected results.
1808 2011-09-23 Simon Baldwin <simonb@google.com>
1810 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1811 configuration options.
1812 * configure: Regenerate.
1813 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1814 * Makefile.in: Regenerate.
1815 * testsuite/Makefile.in: Regenerate.
1817 2011-09-19 Sriraman Tallam <tmsriram@google.com>
1819 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1821 2011-09-19 Cary Coutant <ccoutant@google.com>
1823 * incremental.cc (can_incremental_update): Fix typo in comment.
1824 * incremental.h (can_incremental_update): Likewise.
1826 2011-09-18 Cary Coutant <ccoutant@google.com>
1828 * incremental.cc (can_incremental_update): New function.
1829 * incremental.h (can_incremental_update): New function.
1830 * layout.cc (Layout::init_fixed_output_section): Call it.
1831 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1832 * object.cc (Sized_relobj_file::do_layout): Call
1833 can_incremental_update.
1835 2011-09-13 Cary Coutant <ccoutant@google.com>
1837 * configure.ac: Check for glibc support for gnu_indirect_function
1838 support with static linking, setting automake conditional
1840 * Makefile.in: Regenerate.
1841 * configure: Regenerate.
1843 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1844 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1846 * testsuite/Makefile.in: Regenerate.
1848 2011-09-13 Cary Coutant <ccoutant@google.com>
1850 * incremental.cc (Sized_relobj_incr::do_layout): Call
1851 report_comdat_group for kept comdat sections.
1852 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1853 * testsuite/Makefile.in: Regenerate.
1854 * testsuite/incr_comdat_test_1.cc: New source file.
1855 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1856 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1857 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1859 2011-09-13 Ian Lance Taylor <iant@google.com>
1861 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1862 variable external_symbols_offset.
1864 2011-09-12 Ian Lance Taylor <iant@google.com>
1866 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1867 triggered if object has no symbols.
1869 2011-09-09 David S. Miller <davem@davemloft.net>
1871 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1872 (Output_fill_debug_line::do_write): Likewise.
1874 2011-08-29 Cary Coutant <ccoutant@google.com>
1876 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1877 casts to match formatting specs.
1878 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1880 2011-08-26 Cary Coutant <ccoutant@google.com>
1882 * layout.cc (Free_list::allocate): Provide guarantee of minimum
1883 remaining hole size when allocating.
1884 (Layout::make_output_section): Set fill methods for debug sections.
1885 * layout.h (Free_list::Free_list_node): Move from private to
1887 (Free_list::set_min_hole_size): New function.
1888 (Free_list::begin, Free_list::end): New functions.
1889 (Free_list::min_hole_): New data member.
1890 * output.cc: Include dwarf.h.
1891 (Output_fill_debug_info::do_minimum_hole_size): New function.
1892 (Output_fill_debug_info::do_write): New function.
1893 (Output_fill_debug_line::do_minimum_hole_size): New function.
1894 (Output_fill_debug_line::do_write): New function.
1895 (Output_section::Output_section): Initialize new data member.
1896 (Output_section::set_final_data_size): Ensure patch space is larger
1897 than minimum hole size.
1898 (Output_section::do_write): Fill holes in debug sections.
1899 * output.h (Output_fill): New class.
1900 (Output_fill_debug_info): New class.
1901 (Output_fill_debug_line): New class.
1902 (Output_section::set_free_space_fill): New function.
1903 (Output_section::free_space_fill_): New data member.
1904 * testsuite/Makefile.am (incremental_test_3): Add
1905 --incremental-patch option.
1906 (incremental_test_4): Likewise.
1907 (incremental_test_5): Likewise.
1908 (incremental_test_6): Likewise.
1909 (incremental_copy_test): Likewise.
1910 (incremental_common_test_1): Likewise.
1911 * testsuite/Makefile.in: Regenerate.
1913 2011-08-26 Nick Clifton <nickc@redhat.com>
1915 * po/es.po: Updated Spanish translation.
1917 2011-08-01 Cary Coutant <ccoutant@google.com>
1919 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1920 * gold/testsuite/Makefile.in: Regenerate.
1921 * gold/testsuite/justsyms_exec.c: New source file.
1922 * gold/testsuite/justsyms_lib.c: New source file.
1924 2011-08-01 Cary Coutant <ccoutant@google.com>
1926 * layout.cc (Layout::set_segment_offsets): Don't realign text
1927 segment if -Ttext was specified.
1928 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1930 * object.h (Sized_relobj_file::e_type): New function.
1931 (Sized_relobj_file::e_type_): New data member.
1932 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1933 base address for ET_EXEC files.
1934 * target.cc (Target::do_make_elf_object_implementation): Allow
1935 ET_EXEC files with --just-symbols option.
1937 2011-07-28 Cary Coutant <ccoutant@google.com>
1939 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1940 Add thread_number parameter.
1941 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1942 * workqueue-threads.cc
1943 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1944 current thread if its thread number is greater than desired thread
1946 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1947 Add thread_number parameter.
1948 (Workqueue::should_cancel_thread): Likewise.
1949 (Workqueue::find_runnable_or_wait): Pass thread_number to
1950 should_cancel_thread.
1951 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1954 2011-07-22 Sriraman Tallam <tmsriram@google.com>
1956 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1957 only after checking if it cannot be forced local.
1958 * symtab.h (is_externally_visible): Check if the symbol is not forced
1961 2011-07-15 Ian Lance Taylor <iant@google.com>
1963 * options.h (class General_options): Add --print-output-format.
1964 Move -EL next to -EB, for better --help output.
1965 * target-select.cc: Include <cstdio>, "options.h", and
1967 (Target_selector::do_target_bfd_name): New function.
1968 (print_output_format): New function.
1969 * target-select.h (class Target_selector): Update declarations.
1970 (Target_selector::target_bfd_name): New function.
1971 (print_output_format): Declare.
1972 * main.cc: Include "target-select.h".
1973 (main): Handle --print-output-format.
1974 * gold.cc: Include "target-select.h".
1975 (queue_initial_tasks): Handle --print-output-format when there are
1977 * parameters.cc (parameters_force_valid_target): Give a better
1978 error message if -EB/-EL does not match target.
1979 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1982 2011-07-15 Ian Lance Taylor <iant@google.com>
1984 * i386.cc (class Output_data_plt_i386): Add layout_ field.
1985 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1986 (Output_data_plt_i386::do_write): Write address of .dynamic
1987 section to first entry in .got.plt section.
1988 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1989 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1991 (Output_data_plt_x86_64::do_write): Write address of .dynamic
1992 section to first entry in .got.plt section.
1993 * layout.h (Layout::dynamic_section): New function.
1995 2011-07-13 Sriraman Tallam <tmsriram@google.com>
1997 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1999 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2000 input_section_position_, and input_section_glob_.
2001 (read_layout_from_file): Call function section_ordering_specified.
2002 * layout.h (is_section_ordering_specified): New function.
2003 (section_ordering_specified): New function.
2004 (section_ordering_specified_): New boolean member.
2005 * main.cc(main): Call load_plugins after layout object is defined.
2006 * output.cc (Output_section::add_input_section): Use
2007 function section_ordering_specified to check if section ordering is
2009 * output.cc (Output_section::add_relaxed_input_section): Use
2010 function section_ordering_specified to check if section ordering is
2012 (Output_section::update_section_layout): New function.
2013 (Output_section::sort_attached_input_sections): Check if input section
2015 * output.h (Output_section::update_section_layout): New function.
2016 * plugin.cc (get_section_count): New function.
2017 (get_section_type): New function.
2018 (get_section_name): New function.
2019 (get_section_contents): New function.
2020 (update_section_order): New function.
2021 (allow_section_ordering): New function.
2022 (Plugin::load): Add the new interfaces to the transfer vector.
2023 (Plugin_manager::load_plugins): New parameter.
2024 (Plugin_manager::all_symbols_read): New parameter.
2025 (Plugin_manager::claim_file): New parameter. Save the elf object for
2027 (Plugin_manager::get_elf_object): New function.
2028 (Plugin_manager::get_view): Change to directly use the bool to check
2029 if get_view is called from claim_file_hook.
2030 * plugin.h (input_objects): New function
2031 (Plugin__manager::load_plugins): New parameter.
2032 (Plugin_manager::claim_file): New parameter.
2033 (Plugin_manager::get_elf_object): New function.
2034 (Plugin_manager::in_claim_file_handler): New function.
2035 (Plugin_manager::in_claim_file_handler_): New member.
2036 (layout): New function.
2037 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2038 handler with an extra parameter. Make the elf object before calling
2040 * testsuite/plugin_test.c (get_section_count): New function pointer.
2041 (get_section_type): New function pointer.
2042 (get_section_name): New function pointer.
2043 (get_section_contents): New function pointer.
2044 (update_section_order): New function pointer.
2045 (allow_section_ordering): New function pointer.
2046 (onload): Check if the new interfaces exist.
2048 2011-07-13 Ian Lance Taylor <iant@google.com>
2050 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2052 * x86_64.cc (Target_x86_64::got_section): Likewise.
2053 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2054 (relro_now_test_SOURCES): New variable.
2055 (relro_now_test_DEPENDENCIES): New variable.
2056 (relro_now_test_LDFLAGS): New variable.
2057 (relro_now_test_LDADD): New variable.
2058 (relro_now_test.so): New target.
2059 * testsuite/Makefile.in: Rebuild.
2061 2011-07-12 Ian Lance Taylor <iant@google.com>
2064 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2065 GLOB_DAT relocation rather than a RELATIVE relocation for a
2066 protected symbol when creating a shared library.
2067 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2068 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2069 * testsuite/protected_main_1.cc (main): Test that protected
2070 function has same address.
2072 2011-07-11 Ian Lance Taylor <iant@google.com>
2075 * options.h (class General_options): Add -Bgroup.
2076 * options.cc (General_options::finalize): If -Bgroup is set,
2077 default to --unresolved-symbols=report-all.
2078 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2079 * target-reloc.h (issue_undefined_symbol_error): Handle
2080 --unresolved-symbols=report-all.
2082 2011-07-08 Ian Lance Taylor <iant@google.com>
2085 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2086 if linker script discards key sections.
2087 (Layout::create_dynamic_symtab): Likewise.
2088 (Layout::assign_local_dynsym_offsets): Likewise.
2089 (Layout::sized_create_version_sections): Likewise.
2090 (Layout::create_interp): Likewise.
2091 (Layout::finish_dynamic_section): Likewise.
2092 (Layout::set_dynamic_symbol_size): Likewise.
2094 2011-07-08 Ian Lance Taylor <iant@google.com>
2097 * options.h (class General_options): Add --unresolved-symbols.
2098 * target-reloc.h (issue_undefined_symbol_error): Check
2099 --unresolved-symbols. Add comments.
2101 2011-07-08 Ian Lance Taylor <iant@google.com>
2103 * testsuite/odr_violation2.cc (Ordering::operator()): Make
2104 expression more complex.
2106 2011-07-08 Ian Lance Taylor <iant@google.com>
2109 * target-reloc.h (issue_undefined_symbol_error): New inline
2110 function, broken out of relocate_section.
2111 (relocate_section): Call issue_undefined_symbol_error.
2112 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2113 there is no TLS segment if we are about to issue an undefined
2115 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2117 2011-07-08 Ian Lance Taylor <iant@google.com>
2120 * resolve.cc (Symbol_table::should_override): Add fromtype
2121 parameter. Change all callers. Give error when linking together
2122 TLS and non-TLS symbol.
2123 (Symbol_table::should_override_with_special): Add fromtype
2124 parameter. Change all callers.
2125 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2126 there is no TLS segment if we have reported some errors.
2127 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2129 2011-07-08 Ian Lance Taylor <iant@google.com>
2132 * target.h (Target::plt_address_for_global): New function.
2133 (Target::plt_address_for_local): New function.
2134 (Target::plt_section_for_global): Remove.
2135 (Target::plt_section_for_local): Remove.
2136 (Target::do_plt_address_for_global): New virtual function.
2137 (Target::do_plt_address_for_local): New virtual function.
2138 (Target::do_plt_section_for_global): Remove.
2139 (Target::do_plt_section_for_local): Remove.
2140 (Target::register_global_plt_entry): Add Symbol_table and Layout
2142 * output.cc (Output_data_got::Got_entry::write): Use
2143 plt_address_for_global and plt_address_for_local.
2144 * layout.cc (Layout::add_target_dynamic_tags): Use size and
2145 address of output section.
2146 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2147 got_irelative_, and irelative_count_ fields. Update
2149 (Output_data_plt_i386::has_irelative_section): New function.
2150 (Output_data_plt_i386::entry_count): Add irelative_count_.
2151 (Output_data_plt_i386::set_final_data_size): Likewise.
2152 (class Target_i386): Add got_irelative_ and rel_irelative_
2153 fields. Update declarations.
2154 (Target_i386::Target_i386): Initialize new fields.
2155 (Target_i386::do_plt_address_for_global): New function replacing
2156 do_plt_section_for_global.
2157 (Target_i386::do_plt_address_for_local): New function replacing
2158 do_plt_section_for_local.
2159 (Target_i386::got_section): Create got_irelative_.
2160 (Target_i386::rel_irelative_section): New function.
2161 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2162 fields. Don't define __rel_iplt_{start,end}.
2163 (Output_data_plt_i386::add_entry): Add symtab and layout
2164 parameters. Change all callers. Use different PLT and GOT for
2166 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2167 layout parameters. Change all callers. Use different PLT and
2169 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2170 (Output_data_plt_i386::rel_irelative): New function.
2171 (Output_data_plt_i386::address_for_global): New function.
2172 (Output_data_plt_i386::address_for_local): New function.
2173 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
2174 IRELATIVE GOT when changing IFUNC GOT entries.
2175 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2177 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2178 if we didn't create an IRELATIVE GOT.
2179 (Target_i386::Relocate::relocate): Use plt_address_for_global and
2180 plt_address_for_local.
2181 (Target_i386::do_dynsym_value): Use plt_address_for_global.
2182 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2183 got_irelative_, and irelative_count_ fields. Update
2185 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2186 Initialize new fields. Remove symtab parameter. Change all
2188 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2190 (Output_data_plt_x86_64::has_irelative_section): New function.
2191 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2192 (class Target_x86_64): Add got_irelative_ and rel_irelative_
2193 fields. Update declarations.
2194 (Target_x86_64::Target_x86_64): Initialize new fields.
2195 (Target_x86_64::do_plt_address_for_global): New function replacing
2196 do_plt_section_for_global.
2197 (Target_x86_64::do_plt_address_for_local): New function replacing
2198 do_plt_section_for_local.
2199 (Target_x86_64::got_section): Create got_irelative_.
2200 (Target_x86_64::rela_irelative_section): New function.
2201 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
2202 all callers. Don't create __rel_iplt_{start,end}.
2203 (Output_data_plt_x86_64::add_entry): Add symtab and layout
2204 parameters. Change all callers. Use different PLT and GOT for
2206 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2207 layout parameters. Change all callers. Use different PLT and
2209 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2210 parameters. Change all callers. Use different PLT and GOT for
2212 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2213 (Output_data_plt_x86_64::rela_irelative): New function.
2214 (Output_data_plt_x86_64::address_for_global): New function.
2215 (Output_data_plt_x86_64::address_for_local): New function.
2216 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2217 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2218 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2219 (Target_x86_64::register_global_plt_entry): Add symtab and layout
2221 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2223 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2224 symbols if we didn't create an IRELATIVE GOT.
2225 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2226 plt_address_for_local.
2227 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2228 * testsuite/ifuncvar1.c: New test file.
2229 * testsuite/ifuncvar2.c: New test file.
2230 * testsuite/ifuncvar3.c: New test file.
2231 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2232 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2233 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2234 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2235 * testsuite/Makefile.in: Rebuild.
2237 2011-07-07 Cary Coutant <ccoutant@google.com>
2239 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2240 (two_file_test_1_ndebug.o): Likewise.
2241 (two_file_test_1b_ndebug.o): Likewise.
2242 (two_file_test_2_ndebug.o): Likewise.
2243 (two_file_test_main_ndebug.o): Likewise.
2244 (incremental_test_2): Link with no-debug versions.
2246 2011-07-06 Cary Coutant <ccoutant@google.com>
2248 * gold/incremental.cc
2249 (Output_section_incremental_inputs::write_info_blocks): Check for
2250 hidden and internal symbols.
2252 2011-07-06 Cary Coutant <ccoutant@google.com>
2254 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2255 Check disposition for startup file.
2256 (Incremental_inputs::report_command_line): Ignore
2257 --incremental-startup-unchanged option.
2258 * options.cc (General_options::parse_incremental_startup_unchanged):
2260 (General_options::General_options): Initialize new data member.
2261 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2262 (General_options): Add --incremental-startup-unchanged option.
2263 (General_options::incremental_startup_disposition): New function.
2264 (General_options::incremental_startup_disposition_): New data member.
2266 2011-07-06 Cary Coutant <ccoutant@google.com>
2268 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2269 input file index to Script_info ctor.
2270 (Sized_incremental_binary::do_file_has_changed): Find the
2271 command-line argument for files named in scripts.
2272 * incremental.h (Script_info::Script_info): New ctor
2273 with input file index.
2274 (Script_info::input_file_index): New function.
2275 (Script_info::input_file_index_): New data member.
2276 (Incremental_binary::get_library): Add const.
2277 (Incremental_binary::get_script_info): Add const.
2278 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2279 * testsuite/Makefile.am (incremental_test_5): New test case.
2280 (incremental_test_6): New test case.
2281 * testsuite/Makefile.in: Regenerate.
2283 2011-07-06 Cary Coutant <ccoutant@google.com>
2285 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2286 debug output when command lines differ.
2288 2011-07-06 Cary Coutant <ccoutant@google.com>
2290 * incremental.cc (Incremental_inputs::report_command_line): Ignore
2291 --incremental-patch option.
2292 * layout.cc (Free_list::allocate): Extend allocation beyond original
2294 (Layout::make_output_section): Mark sections that should get
2296 * options.cc (parse_percent): New function.
2297 * options.h (parse_percent): New function.
2298 (DEFINE_percent): New macro.
2299 (General_options): Add --incremental-patch option.
2300 * output.cc (Output_section::Output_section): Initialize new data
2302 (Output_section::add_input_section): Print section name when out
2304 (Output_section::add_output_section_data): Likewise.
2305 (Output_section::set_final_data_size): Add patch space when
2306 doing --incremental-full.
2307 (Output_section::do_reset_address_and_file_offset): Remove patch
2309 (Output_segment::set_section_list_addresses): Print debug output
2310 only if --incremental-update.
2311 * output.h (Output_section::set_is_patch_space_allowed): New function.
2312 (Output_section::is_patch_space_allowed_): New data member.
2313 (Output_section::patch_space_): New data member.
2314 * parameters.cc (Parameters::incremental_full): New function.
2315 * parameters.h (Parameters::incremental_full): New function
2316 * testsuite/Makefile.am (incremental_test_2): Add test for
2317 --incremental-patch option.
2318 * testsuite/Makefile.in: Regenerate.
2319 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2320 (t18): Remove function body.
2322 2011-07-05 Doug Kwan <dougkwan@google.com>
2325 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2326 Arm_Address type for relocation result.
2327 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
2329 (Arm_relocate_functions::abs32): Use unaligned access.
2330 (Arm_relocate_functions::rel32): Ditto.
2331 (Arm_relocate_functions::prel31): Ditto.
2332 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2333 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2334 static data relocations.
2335 * testsuite/Makefile.in: Regnerate.
2336 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2338 2011-07-05 Ian Lance Taylor <iant@google.com>
2341 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2342 symbols if necessary.
2343 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2345 2011-07-05 Ian Lance Taylor <iant@google.com>
2348 * resolve.cc (Symbol::override_base_with_special): Simply override
2349 version with special symbol version, ignoring previous version.
2351 2011-07-05 Ian Lance Taylor <iant@google.com>
2353 * object.cc (Sized_relobj_file::include_section_group): Add
2354 information to comment about signature location.
2356 2011-07-02 Ian Lance Taylor <iant@google.com>
2359 * options.h (class General_options): Add -f and -F.
2360 * options.cc (General_options::finalize): Fatal error if -f/-F
2361 are used without -shared.
2362 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2364 2011-07-02 Ian Lance Taylor <iant@google.com>
2366 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2368 2011-07-01 Ian Lance Taylor <iant@google.com>
2372 * resolve.cc (Symbol::override_base_with_special): Don't override
2373 the version if the overriding symbol has a different name.
2374 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
2375 all callers. If we give an error about an undefined version,
2376 define the base version if necessary.
2377 * dynobj.h (class Versions): Update declaration.
2378 * testsuite/weak_alias_test_5.cc: New file.
2379 * testsuite/weak_alias_test.script: New file.
2380 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2381 and versioned_alias have the right value, and call t2.
2382 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2383 weak_alias_test_5.so.
2384 (weak_alias_test_LDADD): Likewise.
2385 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2386 * testsuite/Makefile.in: Rebuild.
2388 2011-07-01 Ian Lance Taylor <iant@google.com>
2391 * options.h (class General_options): Support -z notext.
2392 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2394 (two_file_shared_nonpic.so): Likewise.
2395 (two_file_shared_mixed.so): Likewise.
2396 (two_file_shared_mixed_1.so): Likewise.
2397 (weak_undef_lib_nonpic.so): Likewise.
2398 (alt/weak_undef_lib_nonpic.so): Likewise.
2399 (tls_test_shared_nonpic.so): Likewise.
2400 * testsuite/Makefile.in: Rebuild.
2402 2011-07-01 Ian Lance Taylor <iant@google.com>
2405 * configure.ac: Test whether static linking works, setting
2406 the automake conditional HAVE_STATIC.
2407 * testsuite/Makefile.am: Disable tests using -static if
2408 HAVE_STATIC is not true.
2409 * configure, testsuite/Makefile.in: Rebuild.
2411 2011-07-01 Ian Lance Taylor <iant@google.com>
2414 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2415 Assert if we see DW_EH_PE_indirect.
2416 * target.h (Target::ehframe_datarel_base): New function.
2417 (Target::do_ehframe_datarel_base): New target function.
2418 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2419 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2422 2011-07-01 Ian Lance Taylor <iant@google.com>
2425 * options.h (class General_options): Add
2426 --ld-generated-unwind-info.
2427 * ehframe.cc (Fde::write): Add address parameter. Change all
2428 callers. If associated with PLT, fill in address and size.
2429 (Cie::set_output_offset): Only add merge mapping if there is an
2431 (Cie::write): Add address parameter. Change all callers.
2432 (Eh_frame::add_ehframe_for_plt): New function.
2433 * ehframe.h (class Fde): Update declarations. Move shndx_ and
2434 input_offset_ fields into union u_, with new plt field.
2435 (Fde::Fde): Adjust for new union field.
2436 (Fde::Fde) [Output_data version]: New constructor.
2437 (Fde::add_mapping): Only add merge mapping if there is an object.
2438 (class Cie): Update declarations.
2439 (class Eh_frame): Declare add_ehframe_for_plt.
2440 * layout.cc (Layout::layout_eh_frame): Break out code into
2441 make_eh_frame_section, and call it.
2442 (Layout::make_eh_frame_section): New function.
2443 (Layout::add_eh_frame_for_plt): New function.
2444 * layout.h (class Layout): Update declarations.
2445 * merge.cc (Merge_map::add_mapping): Add assertion.
2446 * i386.cc: Include "dwarf.h".
2447 (class Output_data_plt_i386): Make first_plt_entry,
2448 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
2449 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2450 and plt_eh_frame_fde.
2451 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2452 boundary. Call add_eh_frame_for_plt if appropriate.
2453 * x86_64.cc: Include "dwarf.h".
2454 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
2455 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
2456 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2457 and plt_eh_frame_fde.
2458 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2461 2011-06-29 Ian Lance Taylor <iant@google.com>
2464 * object.cc (Sized_relobj_file::layout_section): Change shdr
2465 parameter to be const.
2466 (Sized_relobj_file::layout_eh_frame_section): New function, broken
2468 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2469 appropriate. Call layout_eh_frame_section.
2470 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2472 * object.h (class Sized_relobj_file): Update declarations.
2474 2011-06-29 Ian Lance Taylor <iant@google.com>
2477 * script.cc (Token::integer_value): Accept trailing M/m/K/k
2479 (Lex::gather_token): Accept trailing M/m/K/k for integers.
2481 2011-06-29 Ian Lance Taylor <iant@google.com>
2484 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2486 * layout.cc (Layout::layout_eh_frame): Likewise.
2488 2011-06-29 Ian Lance Taylor <iant@google.com>
2491 * layout.cc (Layout::symtab_section_shndx): New function.
2492 * layout.h (class Layout): Declare symtab_section_shndx.
2493 * output.cc (Output_section::write_header): Call it.
2495 2011-06-29 Ian Lance Taylor <iant@google.com>
2498 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2499 symbols which are not used in a relocation.
2501 2011-06-28 Ian Lance Taylor <iant@google.com>
2504 * layout.cc (Layout::segment_precedes): Don't crash if a linker
2505 script create indistinguishable segments.
2506 (Layout::set_segment_offsets): Use stable_sort when sorting
2507 segments. Pass this to Compare_segments constructor.
2508 * layout.h (class Layout): Make segment_precedes non-static.
2509 (class Compare_segments): Change from struct to class. Add
2510 layout_ field. Add constructor.
2511 * script-sections.cc
2512 (Script_sections::attach_sections_using_phdrs_clause): Rename
2513 local orphan to is_orphan. Don't report failure to put empty
2514 section in segment. On attachment failure, report name of
2515 section, and attach to first PT_LOAD segment.
2517 2011-06-28 Ian Lance Taylor <iant@google.com>
2520 * target-select.cc (Target_selector::Target_selector): Add
2521 emulation parameter. Change all callers.
2522 (select_target_by_bfd_name): Rename from select_target_by_name.
2524 (select_target_by_emulation): New function.
2525 (supported_emulation_names): New function.
2526 * target-select.h (class Target_selector): Add emulation_ field.
2527 Update declarations.
2528 (Target_selector::recognize_by_bfd_name): Rename from
2529 recognize_by_name. Change all callers.
2530 (Target_selector::supported_bfd_names): Rename from
2531 supported_names. Change all callers.
2532 (Target_selector::recognize_by_emulation): New function.
2533 (Target_selector::supported_emulations): New function.
2534 (Target_selector::emulation): New function.
2535 (Target_selector::do_recognize_by_bfd_name): Rename from
2536 do_recognize_by_name. Change all callers.
2537 (Target_selector::do_supported_bfd_names): Rename from
2538 do_supported_names. Change all callers.
2539 (Target_selector::do_recognize_by_emulation): New function.
2540 (Target_selector::do_supported_emulations): New function.
2541 (select_target_by_bfd_name): Change name in declaration.
2542 (select_target_by_emulation): Declare.
2543 (supported_emulation_names): Declare.
2544 * parameters.cc (parameters_force_valid_target): Try to find
2545 target based on emulation from -m option.
2546 * options.h (class General_options): Change doc string for -m.
2547 * options.cc (help): Print emulations.
2548 (General_options::parse_V): Likewise.
2549 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2550 Add emulation parameter. Change all callers.
2552 2011-06-28 Ian Lance Taylor <iant@google.com>
2554 * target.h (class Target): Add osabi_ field.
2555 (Target::osabi): New function.
2556 (Target::set_osabi): New function.
2557 (Target::Target): Initialize osabi_.
2558 (Target::do_adjust_elf_header): Make pure virtual.
2559 (Sized_target::do_adjust_elf_header): Declare.
2560 * target.cc (Sized_target::do_adjust_elf_header): New function.
2561 (class Sized_target): Instantiate all versions.
2562 * freebsd.h (class Target_freebsd): Remove.
2563 (Target_selector_freebsd::do_recognize): Call set_osabi on
2565 (Target_selector_freebsd::do_recognize_by_name): Likewise.
2566 (Target_selector_freebsd::set_osabi): Remove.
2567 * i386.cc (class Target_i386): Inherit from Sized_target rather
2568 than Target_freebsd.
2569 * x86_64.cc (class Target_x86_64): Likewise.
2571 2011-06-28 Ian Lance Taylor <iant@google.com>
2573 * target.h (Target::can_check_for_function_pointers): Rewrite.
2575 (Target::can_icf_inline_merge_sections): Likewise.
2576 (Target::section_may_have_icf_unsafe_poineters): Likewise.
2577 (Target::Target_info): Add can_icf_inline_merge_sections field.
2578 (Target::do_can_check_for_function_pointers): New virtual
2580 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2581 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2582 from can_check_for_function_pointers, move in file.
2583 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2584 section_may_have_icf_unsafe_poineters, move in file.
2585 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2586 * i386.cc (Target_i386::do_can_check_for_function_pointers):
2587 Rename from can_check_for_function_pointers, move in file.
2588 (Target_i386::can_icf_inline_merge_sections): Remove.
2589 (Target_i386::i386_info): Initialize
2590 can_icf_inline_merge_sections.
2591 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2592 Initialize can_icf_inline_merge_sections.
2593 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2594 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2595 Rename from can_check_for_function_pointers, move in file.
2596 (Target_x86_64::can_icf_inline_merge_sections): Remove.
2597 (Target_x86_64::x86_64_info): Initialize
2598 can_icf_inline_merge_sections.
2599 * testsuite/testfile.cc (Target_test::test_target_info):
2601 * icf.cc (get_section_contents): Correct formatting.
2603 2011-06-27 Ian Lance Taylor <iant@google.com>
2605 * symtab.cc (Symbol::versioned_name): New function.
2606 (Symbol_table::add_to_final_symtab): Use versioned_name when
2608 (Symbol_table::sized_write_symbol): Likewise.
2609 * symtab.h (class Symbol): Declare versioned_name.
2610 * stringpool.h (class Stringpool_template): Add variant of add
2611 which takes a std::basic_string.
2612 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2613 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2614 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2615 (ver_test_12.o): New target.
2616 * testsuite/Makefile.in: Rebuild.
2618 2011-06-27 Doug Kwan <dougkwan@google.com>
2620 * arm.cc (Arm_relocate_functions::thm_jump8,
2621 Arm_relocate_functions::thm_jump11): Use a wider signed
2622 type to compute offset.
2623 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2625 * testsuite/Makefile.in: Regenerate.
2626 * testsuite/arm_branch_in_range.sh: Check test results of
2627 arm_thm_jump11 and arm_thm_jump8.
2628 * testsuite/arm_thm_jump11.s: New test source file.
2629 * testsuite/arm_thm_jump11.t: New linker script.
2630 * testsuite/arm_thm_jump8.s: New test source file.
2631 * testsuite/arm_thm_jump8.t: New linker script.
2633 2011-06-24 Ian Lance Taylor <iant@google.com>
2635 * layout.cc: Include "object.h".
2636 (ctors_sections_in_init_array): New static variable.
2637 (Layout::is_ctors_in_init_array): New function.
2638 (Layout::layout): Add entry to ctors_sections_in_init_array if
2640 * layout.h (class Layout): Declare is_ctors_in_init_array.
2641 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2642 is_ctors_reverse_view is set.
2643 (Sized_relobj_file::write_sections): Add layout parameter. Change
2644 all callers. Set is_ctors_reverse_view field of View_size.
2645 (Sized_relobj_file::reverse_words): New function.
2646 * object.h (Sized_relobj_file::View_size): Add
2647 is_ctors_reverse_view field.
2648 (class Sized_relobj_file): Update declarations.
2649 * testsuite/initpri3.c: New test.
2650 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2652 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2653 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2654 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2655 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2656 * testsuite/Makefile.in: Rebuild.
2658 2011-06-24 Cary Coutant <ccoutant@google.com>
2660 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2661 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2662 (debug_msg_cdebug.err): New targets.
2663 * testsuite/Makefile.in: Regenerate.
2664 * testsuite/debug_msg.sh: Check output of link with compressed debug.
2665 Fix checks for link with shared library.
2667 2011-06-24 Doug Kwan <dougkwan@google.com>
2669 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2670 skip empty text sections.
2671 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2673 2011-06-22 Ian Lance Taylor <iant@google.com>
2676 * options.h (class General_options): Add --ctors-in-init-array.
2677 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2678 friends as SHT_PROGBITS for merging sections.
2679 (Layout::layout): Remove special handling of .init_array and
2680 friends. Don't sort if doing relocatable link. Sort for .ctors
2681 and .dtors if ctors_in_init_array.
2682 (Layout::make_output_section): Force correct section types for
2683 .init_array and friends. Don't sort if doing relocatable link,
2684 Don't sort .ctors and .dtors if ctors_in_init_array.
2685 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2686 (Layout::output_section_name): Add relobj parameter. Change all
2687 callers. Handle .ctors. and .dtors. in code rather than table.
2688 Handle .ctors and .dtors if ctors_in_init_array.
2689 (Layout::match_file_name): New function, moved from output.cc.
2690 * layout.h (class Layout): Update declarations.
2691 * output.cc: Include "layout.h".
2692 (Input_section_sort_entry::get_priority): New function.
2693 (Input_section_sort_entry::match_file_name): Just call
2694 Layout::match_file_name.
2695 (Output_section::Input_section_sort_init_fini_compare::operator()):
2696 Handle .ctors and .dtors. Sort by explicit priority rather than
2698 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2699 * testsuite/initpri2.c: New test.
2700 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2701 (check_PROGRAMS): Add initpri2.
2702 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2703 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2704 * configure, testsuite/Makefile.in: Rebuild.
2706 2011-06-19 Ian Lance Taylor <iant@google.com>
2709 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2710 .interp section to a PT_INTERP segment even if we have seen a
2711 --dynamic-linker option. Don't do it if we have seen a PHDRS
2712 clause in a linker script.
2713 (Layout::finalize): Don't create a .interp section if we've
2714 already create a PT_INTERP segment.
2715 (Layout::create_interp): Always call choose_output_section (revert
2716 patch of 2011-06-17). Don't create PT_INTERP segment.
2717 * script-sections.cc
2718 (Script_sections::create_note_and_tls_segments): Add a .interp
2719 section to a PT_INTERP segment even if we have seen a
2720 --dynamic-linker option.
2722 2011-06-18 Ian Lance Taylor <iant@google.com>
2724 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2725 merely because a non-PT_LOAD segment has a dynamic reloc.
2727 2011-06-18 Ian Lance Taylor <iant@google.com>
2729 * layout.cc (Layout::finish_dynamic_section): Don't create
2730 DT_FLAGS entry if not needed.
2732 2011-06-18 Ian Lance Taylor <iant@google.com>
2735 * layout.cc (Layout::layout_eh_frame): Correct handling of
2736 writable .eh_frame section.
2738 2011-06-17 Ian Lance Taylor <iant@google.com>
2741 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2742 symbol is redefined with the exact same object and value.
2744 2011-06-17 Ian Lance Taylor <iant@google.com>
2747 * layout.h (class Layout): Add interp_segment_ field.
2748 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2749 (Layout::attach_allocated_section_to_segment): If making shared
2750 library, put .interp section in PT_INTERP segment.
2751 (Layout::finalize): Also call create_interp if -dynamic-linker
2753 (Layout::create_interp): Assert that there is no PT_INTERP
2754 segment. If not using a SECTIONS clause, use make_output_section.
2755 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2756 * script-sections.cc
2757 (Script_sections::create_note_and_tls_segments): If making shared
2758 library, put .interp section in PT_INTERP segment.
2760 2011-06-17 Ian Lance Taylor <iant@google.com>
2762 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2763 when making a shared library.
2765 2011-06-17 Ian Lance Taylor <iant@google.com>
2767 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2768 parameter. Change all callers. Don't issue warning about PC32
2769 against locally defined symbol.
2771 2011-06-16 Ian Lance Taylor <iant@google.com>
2773 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2774 occurs in same object.
2776 2011-06-14 Alan Modra <amodra@gmail.com>
2778 * po/POTFILES.in: Regenerate.
2780 2011-06-09 Ian Lance Taylor <iant@google.com>
2782 * script-sections.cc
2783 (Orphan_output_section::set_section_addresses): For a relocatable
2784 link set address to 0.
2786 2011-06-09 Cary Coutant <ccoutant@google.com>
2789 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2790 used with --compress-debug-sections.
2791 * gold/object.cc (Sized_relobj_file::do_layout): Report
2792 uncompressed size of compressed input sections.
2794 2011-06-08 Cary Coutant <ccoutant@google.com>
2797 * testsuite/two_file_test_2_v1.cc: Change initialization of
2798 v2 to keep it in .data.
2800 2011-06-07 Cary Coutant <ccoutant@google.com>
2802 * common.cc (Symbol_table::do_allocate_commons_list): Call
2804 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2805 (Errors::fallback): New function.
2806 (gold_fallback): New function.
2807 * errors.h (Errors::fallback): New function.
2808 * gold.cc (gold_exit): Change status parameter to enum; adjust
2810 (queue_initial_tasks): Call gold_fallback.
2811 * gold.h: Include cstdlib.
2812 (Exit_status): New enum type.
2813 (gold_exit): Change status parameter to enum.
2814 (gold_fallback): New function.
2815 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2816 (Layout::create_symtab_sections): Likewise.
2817 (Layout::create_shdrs): Likewise.
2818 * main.cc (main): Adjust call to gold_exit.
2819 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2820 (Output_data_got::add_got_entry_pair): Likewise.
2821 (Output_section::add_input_section): Likewise.
2822 (Output_section::add_output_section_data): Likewise.
2823 (Output_segment::set_section_list_addresses): Likewise.
2824 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2826 2011-06-07 Cary Coutant <ccoutant@google.com>
2828 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2829 for incremental links.
2830 * output.cc (Output_segment::set_section_list_addresses): Remove
2831 FIXME and test for TLS or BSS.
2833 2011-06-07 Cary Coutant <ccoutant@google.com>
2835 * testsuite/Makefile.am: Add incremental_copy_test,
2836 incremental_common_test_1.
2837 * testsuite/Makefile.in: Regenerate.
2838 * testsuite/common_test_1_v1.c: New source file.
2839 * testsuite/common_test_1_v2.c: New source file.
2840 * testsuite/copy_test_v1.cc: New source file.
2842 2011-06-07 Cary Coutant <ccoutant@google.com>
2844 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2845 update, allocate common from bss section's free list.
2846 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2847 linker-defined symbols.
2848 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2849 Skip GOT and PLT entries that are no longer referenced.
2850 (Output_section_incremental_inputs::write_info_blocks): Mark
2851 linker-defined symbols.
2852 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2853 * output.cc (Output_section::allocate): New function.
2854 * output.h (Output_section::allocate): New function.
2855 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2856 linker-defined symbols.
2857 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2858 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2859 (Symbol::init_base_output_data): Likewise.
2860 (Symbol::init_base_output_segment): Likewise.
2861 (Symbol::init_base_constant): Likewise.
2862 (Sized_symbol::init_output_data): Likewise.
2863 (Sized_symbol::init_output_segment): Likewise.
2864 (Sized_symbol::init_constant): Likewise.
2865 (Symbol_table::do_define_in_output_data): Likewise.
2866 (Symbol_table::do_define_in_output_segment): Likewise.
2867 (Symbol_table::do_define_as_constant): Likewise.
2868 * symtab.h (Symbol::is_predefined): New function.
2869 (Symbol::init_base_output_data): Add is_predefined parameter.
2870 (Symbol::init_base_output_segment): Likewise.
2871 (Symbol::init_base_constant): Likewise.
2872 (Symbol::is_predefined_): New data member.
2873 (Sized_symbol::init_output_data): Add is_predefined parameter.
2874 (Sized_symbol::init_output_segment): Likewise.
2875 (Sized_symbol::init_constant): Likewise.
2876 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2878 2011-06-07 Cary Coutant <ccoutant@google.com>
2880 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2881 instead of emit_copy_reloc.
2882 (Copy_relocs::emit_copy_reloc): Refactor.
2883 (Copy_relocs::make_copy_reloc): New function.
2884 (Copy_relocs::add_copy_reloc): Remove.
2885 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2887 (Copy_relocs::make_copy_reloc): New function.
2888 (Copy_relocs::add_copy_reloc): Remove.
2889 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2890 unchanged input files.
2891 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2892 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2893 Reserve BSS space for COPY relocations.
2894 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2895 (Output_section_incremental_inputs::write_info_blocks): Record
2896 whether a symbol is copied from a shared object.
2897 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2898 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2899 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2900 (Incremental_input_entry_reader::get_output_symbol_index): Add
2902 (Incremental_binary::emit_copy_relocs): New function.
2903 (Incremental_binary::do_emit_copy_relocs): New function.
2904 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2906 (Sized_incremental_binary::add_copy_reloc): New function.
2907 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2908 (Sized_incremental_binary::Copy_reloc): New struct.
2909 (Sized_incremental_binary::Copy_relocs): New typedef.
2910 (Sized_incremental_binary::copy_relocs_): New data member.
2911 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2912 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2913 * target.h (Sized_target::emit_copy_reloc): New function.
2914 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2916 2011-06-02 Cary Coutant <ccoutant@google.com>
2919 * gold/archive.cc (Archive::Archive): Initialize new data member.
2920 (Archive::include_all_members): Return if archive has already been
2922 * gold/archive.h (Archive::include_all_members_): New data member.
2924 2011-06-02 Nick Clifton <nickc@redhat.com>
2926 * dynobj.h: Fix spelling mistake in comment.
2927 * output.cc: Likewise.
2929 2011-05-31 Doug Kwan <dougkwan@google.com>
2933 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2934 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2935 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
2936 redundant arm_exidx_test.so.
2937 * testsuite/Makefile.in: Regenerate.
2938 (check_SCRIPTS): Add pr12826.sh
2939 (check_DATA): Add pr12826.stdout
2940 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2941 * testsuite/pr12826.sh: New file.
2942 * testsuite/pr12826_1.s: Ditto.
2943 * testsuite/pr12826_1.s: Ditto.
2945 2011-05-30 Ian Lance Taylor <iant@google.com>
2947 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2950 2011-05-29 Ian Lance Taylor <iant@google.com>
2953 * testsuite/Makefile.am: Use different file name for two_file_test
2954 temporary file for each incremental test.
2955 * testsuite/Makefile.in: Rebuild.
2957 2011-05-29 Ian Lance Taylor <iant@google.com>
2959 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2960 binary input file is empty.
2962 2011-05-27 Ian Lance Taylor <iant@google.com>
2964 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2965 (ver_test_9.so): Likewise.
2966 * testsuite/Makefile.in: Rebuild.
2968 2011-05-26 Cary Coutant <ccoutant@google.com>
2970 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2971 * incremental.cc (Incremental_inputs::report_input_section): Fix
2972 comment, indentation.
2973 (Incremental_inputs::report_comdat_group): New function.
2974 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2975 of data for incremental input file entry.
2976 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2977 group count, COMDAT group signatures.
2978 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2979 an unchanged input file.
2980 * incremental.h (Incremental_object_entry::Incremental_object_entry):
2981 Initialize new data member.
2982 (Incremental_object_entry::add_comdat_group): New function.
2983 (Incremental_object_entry::get_comdat_group_count): New function.
2984 (Incremental_object_entry::get_comdat_signature_key): New function.
2985 (Incremental_object_entry::groups_): New data member.
2986 (Incremental_inputs::report_comdat_group): New function.
2987 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2988 data for incremental input file entry.
2989 (Incremental_input_entry_reader::get_comdat_group_count): New function.
2990 (Incremental_input_entry_reader::get_input_section): Adjust size of
2991 data for incremental input file entry.
2992 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2993 (Incremental_input_entry_reader::get_comdat_group_signature): New
2995 * object.cc (Sized_relobj::include_section_group): Report kept
2996 COMDAT groups for incremental links.
2998 2011-05-24 David Meyer <pdox@google.com>
3000 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3001 with name parameter. Add found_name parameter.
3002 * fileread.cc (Input_file::find_file): Adjust code accordingly.
3003 * dirsearch.h (class Dirsearch): Update declaration.
3005 2011-05-24 Ian Lance Taylor <iant@google.com>
3007 * archive.cc (Library_base::should_include_member): Pull in object
3008 from archive if it defines the entry symbol.
3009 * parameters.cc (Parameters::entry): New function.
3010 * parameters.h (class Parameters): Declare entry.
3011 * output.h (class Output_file_header): Remove entry_ field.
3012 * output.cc (Output_file_header::Output_file_header): Remove entry
3013 parameter. Change all callers.
3014 (Output_file_header::entry): Use parameters->entry.
3015 * gold.cc (queue_middle_tasks): Likewise.
3016 * plugin.cc (Plugin_hook::run): Likewise.
3018 2011-05-24 Cary Coutant <ccoutant@google.com>
3020 * gold.cc (queue_initial_tasks): Pass incremental base filename
3021 to Output_file::open_base_file; don't print error message.
3022 * incremental-dump.cc (main): Adjust call to
3023 Output_file::open_for_modification.
3024 * incremental-dump.cc (main): Likewise.
3025 * incremental.cc (Incremental_inputs::report_command_line):
3026 Ignore --incremental-base option when comparing command lines.
3027 Ignore parameter when given as separate argument.
3028 * options.h (class General_options): Add --incremental-base.
3029 * output.cc (Output_file::Output_file):
3030 (Output_file::open_base_file): Add base_name and writable parameters;
3031 read base file into new file; print error message here.
3032 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3034 * output.h (Output_file::open_for_modification): Rename to...
3035 (Output_file::open_base_file): ...this; add base_name and
3036 writable parameters; adjust all callers.
3037 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3039 * testsuite/Makefile.am (incremental_test_4): Test
3041 * testsuite/Makefile.in: Regenerate.
3043 2011-05-24 Cary Coutant <ccoutant@google.com>
3045 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3047 * testsuite/Makefile.in: Regenerate.
3048 * testsuite/two_file_test_1_v1.cc: New test source file.
3049 * testsuite/two_file_test_1b_v1.cc: New test source file.
3050 * testsuite/two_file_test_2_v1.cc: New test source file.
3052 2011-05-24 Cary Coutant <ccoutant@google.com>
3054 * dynobj.h (Dynobj::do_dynobj): New function.
3055 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3056 flag and soname for shared objects.
3057 * incremental.cc (Incremental_inputs::report_object): Make
3058 either Incremental_object_entry or Incremental_dynobj_entry; add
3059 soname to string table.
3060 (Incremental_inputs::report_input_section): Add assertion.
3061 (Output_section_incremental_inputs::set_final_data_size): Adjust
3062 type of input file entry for shared libraries; adjust size of
3063 shared library info entry.
3064 (Output_section_incremental_inputs::write_input_files): Write
3065 as_needed flag for shared libraries.
3066 (Output_section_incremental_inputs::write_info_blocks): Adjust type
3067 of input file entry for shared libraries; write soname.
3068 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3069 soname from incremental info.
3070 * incremental.h (enum Incremental_input_flags): Add
3071 INCREMENTAL_INPUT_AS_NEEDED.
3072 (Incremental_input_entry::Incremental_input_entry): Initialize new
3074 (Incremental_input_entry::set_as_needed): New function.
3075 (Incremental_input_entry::as_needed): New function.
3076 (Incremental_input_entry::do_dynobj_entry): New function.
3077 (Incremental_input_entry::as_needed_): New data member.
3078 (Incremental_object_entry::Incremental_object_entry): Don't check
3080 (Incremental_object_entry::do_type): Likewise.
3081 (class Incremental_dynobj_entry): New class.
3082 (Incremental_input_entry_reader::as_needed): New function.
3083 (Incremental_input_entry_reader::get_soname): New function.
3084 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3085 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3086 size of shared library info entry.
3087 * layout.cc (Layout::finish_dynamic_section): Don't test for
3088 incremental link when adding DT_NEEDED entries.
3089 * object.h (Object::Object): Initialize new data member.
3090 (Object::dynobj): New function.
3091 (Object::set_as_needed): New function.
3092 (Object::as_needed): New function.
3093 (Object::do_dynobj): New function.
3094 (Object::as_needed_): New data member.
3096 2011-05-24 Cary Coutant <ccoutant@google.com>
3098 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3099 info; adjust display of GOT entries.
3100 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3101 vector of input objects; remove file_status_.
3102 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3103 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3104 got_plt reader; call target hooks to reserve GOT entries.
3105 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3106 of input file info header and GOT info entry.
3107 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3109 (Got_plt_view_info::got_descriptor): Remove.
3110 (Got_plt_view_info::sym_index): New data member.
3111 (Got_plt_view_info::input_index): New data member.
3112 (Local_got_offset_visitor::visit): Write input file index.
3113 (Global_got_offset_visitor::visit): Write 0 for input file index.
3114 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3115 with sym_index and input_index.
3116 (Output_section_incremental_inputs::write_got_plt): Adjust size of
3117 incremental info GOT entry; replace got_descriptor with input_index.
3118 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3119 map from input file index to object.
3120 (Sized_relobj_incr::do_layout): Replace direct data member reference
3121 with accessor function.
3122 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3123 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3124 Adjust size of input file info header.
3125 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3126 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3127 (Incremental_input_entry_reader::get_input_section): Adjust size of
3128 input file info header.
3129 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3130 of incremental info GOT entry.
3131 (Incremental_got_plt_reader::get_got_desc): Remove.
3132 (Incremental_got_plt_reader::get_got_symndx): New function.
3133 (Incremental_got_plt_reader::get_got_input_index): New function.
3134 (Sized_incremental_binary::Sized_incremental_binary): Remove
3135 file_status_; add input_objects_.
3136 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3137 (Sized_incremental_binary::set_file_is_unchanged): Remove.
3138 (Sized_incremental_binary::file_is_unchanged): Remove.
3139 (Sized_incremental_binary::set_input_object): New function.
3140 (Sized_incremental_binary::input_object): New function.
3141 (Sized_incremental_binary::file_status_): Remove.
3142 (Sized_incremental_binary::input_objects_): New data member.
3143 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3145 (Sized_relobj_incr::invalid_address): Move to base class.
3146 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3148 (Sized_relobj_incr::do_output_section_offset): Likewise.
3149 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3150 (Sized_relobj_incr::section_offsets_): Likewise.
3151 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3153 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3154 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3155 with accessor function.
3156 (Sized_relobj_file::do_layout): Likewise.
3157 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3158 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3159 (Sized_relobj_file::compute_final_local_value): Replace refs to
3160 section_offsets_ with accessor function.
3161 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3162 * object.h (Relobj::Relobj): Initialize new data members.
3163 (Relobj::add_dyn_reloc): New function.
3164 (Relobj::first_dyn_reloc): New function.
3165 (Relobj::dyn_reloc_count): New function.
3166 (Relobj::first_dyn_reloc_): New data member.
3167 (Relobj::dyn_reloc_count_): New data member.
3168 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3170 (Sized_relobj::Address): New typedef.
3171 (Sized_relobj::invalid_address): Move here from child class.
3172 (Sized_relobj::Sized_relobj): Initialize new data members.
3173 (Sized_relobj::sized_relobj): New function.
3174 (Sized_relobj::is_output_section_offset_invalid): Move here from
3176 (Sized_relobj::get_output_section_offset): Likewise.
3177 (Sized_relobj::local_has_got_offset): Likewise.
3178 (Sized_relobj::local_got_offset): Likewise.
3179 (Sized_relobj::set_local_got_offset): Likewise.
3180 (Sized_relobj::do_for_all_local_got_entries): Likewise.
3181 (Sized_relobj::clear_got_offsets): New function.
3182 (Sized_relobj::section_offsets): Move here from child class.
3183 (Sized_relobj::do_output_section_offset): Likewise.
3184 (Sized_relobj::do_set_section_offset): Likewise.
3185 (Sized_relobj::Local_got_offsets): Likewise.
3186 (Sized_relobj::local_got_offsets_): Likewise.
3187 (Sized_relobj::section_offsets_): Likewise.
3188 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3190 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3192 (Sized_relobj_file::sized_relobj): New function
3193 (Sized_relobj_file::local_has_got_offset): Move to base class.
3194 (Sized_relobj_file::local_got_offset): Likewise.
3195 (Sized_relobj_file::set_local_got_offset): Likewise.
3196 (Sized_relobj_file::get_output_section_offset): Likewise.
3197 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3198 (Sized_relobj_file::do_output_section_offset): Likewise.
3199 (Sized_relobj_file::do_set_section_offset): Likewise.
3200 (Sized_relobj_file::Local_got_offsets): Likewise.
3201 (Sized_relobj_file::local_got_offsets_): Likewise.
3202 (Sized_relobj_file::section_offsets_): Likewise.
3203 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3205 (set_needs_dynsym_index): Convert relobj to derived class pointer.
3206 (Output_reloc::get_symbol_index): Likewise.
3207 (Output_reloc::local_section_offset): Likewise.
3208 (Output_reloc::get_address): Likewise.
3209 (Output_reloc::symbol_value): Likewise.
3210 (Output_data_got::reserve_slot): Move to class definition.
3211 (Output_data_got::reserve_local): New function.
3212 (Output_data_got::reserve_slot_for_global): Remove.
3213 (Output_data_got::reserve_global): New function.
3214 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3215 (all constructors, two instantiations).
3216 (Output_reloc::get_relobj): New function (two instantiations).
3217 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3218 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3219 (Output_data_reloc::add_global): Adjust type of relobj.
3220 (Output_data_reloc::add_global_relative): Likewise.
3221 (Output_data_reloc::add_symbolless_global_addend): Likewise.
3222 (Output_data_reloc::add_local): Likewise.
3223 (Output_data_reloc::add_local_relative): Likewise.
3224 (Output_data_reloc::add_symbolless_local_addend): Likewise.
3225 (Output_data_reloc::add_local_section): Likewise.
3226 (Output_data_reloc::add_output_section): Likewise.
3227 (Output_data_reloc::add_absolute): Likewise.
3228 (Output_data_reloc::add_target_specific): Likewise.
3229 (Output_data_got::reserve_slot): Move definition here.
3230 (Output_data_got::reserve_local): New function.
3231 (Output_data_got::reserve_global): New function.
3232 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3233 section_offsets_ with accessor function.
3234 (Sized_relobj_file::write_sections): Likewise.
3235 (Sized_relobj_file::do_relocate_sections): Likewise.
3236 * target.h (Sized_target::reserve_local_got_entry): New function.
3237 (Sized_target::reserve_global_got_entry): New function.
3238 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3239 (Target_x86_64::reserve_global_got_entry): New function.
3240 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3242 2011-05-23 Cary Coutant <ccoutant@google.com>
3244 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3245 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3246 bit when checking got_type.
3247 * incremental.cc (Sized_incremental_binary::setup_readers):
3248 Store symbol table and string table locations; initialize bit vector
3249 of file status flags.
3250 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3252 (Sized_incremental_binary::do_process_got_plt): New function.
3253 (Sized_incremental_binary::get_symtab_view): Use stored locations.
3254 (Output_section_incremental_inputs::set_final_data_size): Record
3255 file index for each input file.
3256 (Output_section_incremental_inputs::write_got_plt): Store file index
3257 instead of input entry offset for each GOT entry.
3259 (Incremental_input_entry::Incremental_input_entry): Initialize new
3261 (Incremental_input_entry::set_offset): Store file index.
3262 (Incremental_input_entry::get_file_index): New function.
3263 (Incremental_input_entry::file_index_): New data member.
3264 (Incremental_binary::process_got_plt): New function.
3265 (Incremental_binary::do_process_got_plt): New function.
3266 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3268 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3269 (Sized_incremental_binary::set_file_is_unchanged): New function.
3270 (Sized_incremental_binary::file_is_unchanged): New function.
3271 (Sized_incremental_binary::do_process_got_plt): New function.
3272 (Sized_incremental_binary::file_status_): New data member.
3273 (Sized_incremental_binary::main_symtab_loc_): New data member.
3274 (Sized_incremental_binary::main_strtab_loc_): New data member.
3275 * output.cc (Output_data_got::Got_entry::write): Add case
3277 (Output_data_got::add_global): Call add_got_entry.
3278 (Output_data_got::add_global_plt): Likewise.
3279 (Output_data_got::add_global_with_rel): Likewise.
3280 (Output_data_got::add_global_with_rela): Likewise.
3281 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3282 (Output_data_got::add_global_pair_with_rela): Likewise.
3283 (Output_data_got::add_local): Call add_got_entry.
3284 (Output_data_got::add_local_plt): Likewise.
3285 (Output_data_got::add_local_with_rel): Likewise.
3286 (Output_data_got::add_local_with_rela): Likewise.
3287 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3288 (Output_data_got::add_local_pair_with_rela): Likewise.
3289 (Output_data_got::reserve_slot): New function.
3290 (Output_data_got::reserve_slot_for_global): New function.
3291 (Output_data_got::add_got_entry): New function.
3292 (Output_data_got::add_got_entry_pair): New function.
3293 (Output_section::add_output_section_data): Edit FIXME.
3295 (Output_section_data_build::Output_section_data_build): New
3296 constructor with size parameter.
3297 (Output_data_space::Output_data_space): Likewise.
3298 (Output_data_got::Output_data_got): Initialize new data member; new
3299 constructor with size parameter.
3300 (Output_data_got::add_constant): Call add_got_entry.
3301 (Output_data_got::reserve_slot): New function.
3302 (Output_data_got::reserve_slot_for_global): New function.
3303 (class Output_data_got::Got_entry): Add RESERVED_CODE.
3304 (Output_data_got::add_got_entry): New function.
3305 (Output_data_got::add_got_entry_pair): New function.
3306 (Output_data_got::free_list_): New data member.
3307 * target.h (Sized_target::init_got_plt_for_update): New function.
3308 (Sized_target::register_global_plt_entry): New function.
3309 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3310 Initialize new data member; call init; add constructor with PLT count.
3311 (Output_data_plt_x86_64::init): New function.
3312 (Output_data_plt_x86_64::add_relocation): New function.
3313 (Output_data_plt_x86_64::reserve_slot): New function.
3314 (Output_data_plt_x86_64::free_list_): New data member.
3315 (Target_x86_64::init_got_plt_for_update): New function.
3316 (Target_x86_64::register_global_plt_entry): New function.
3317 (Output_data_plt_x86_64::add_entry): Allocate from free list for
3318 incremental updates.
3319 (Output_data_plt_x86_64::add_relocation): New function.
3320 * testsuite/object_unittest.cc (Object_test): Set default options.
3322 2011-05-16 Ian Lance Taylor <iant@google.com>
3324 * options.h (class General_options): Make -i a synonym for -r.
3326 2011-05-16 Ian Lance Taylor <iant@google.com>
3328 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3330 2011-05-10 Cary Coutant <ccoutant@google.com>
3332 * object.cc (Sized_relobj::do_count_local_symbols): Check for
3335 2011-05-06 Ian Lance Taylor <iant@google.com>
3337 * layout.cc (Layout::layout): If the output section flags change,
3338 update the ordering.
3340 2011-04-25 Cary Coutant <ccoutant@google.com>
3342 * incremental-dump.cc (dump_incremental_inputs): Print local
3343 symbol info for each input file.
3345 (Output_section_incremental_inputs::set_final_data_size): Add local
3346 symbol info to input file entries in incremental info.
3347 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3348 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3349 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3350 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3352 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3353 (Sized_incr_relobj::do_relocate): Write the local symbols.
3354 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3355 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3356 Adjust size of input file header.
3357 (Incremental_inputs_reader::get_local_symbol_offset): New function.
3358 (Incremental_inputs_reader::get_local_symbol_count): New function.
3359 (Incremental_inputs_reader::get_input_section): Adjust size of input
3361 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3362 (Sized_incr_relobj::This): New typedef.
3363 (Sized_incr_relobj::sym_size): New const data member.
3364 (Sized_incr_relobj::Local_symbol): New struct.
3365 (Sized_incr_relobj::do_output_local_symbol_count): New function.
3366 (Sized_incr_relobj::do_local_symbol_offset): New function.
3367 (Sized_incr_relobj::local_symbol_count_): New data member.
3368 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3369 (Sized_incr_relobj::local_symbol_index_): New data member.
3370 (Sized_incr_relobj::local_symbol_offset_): New data member.
3371 (Sized_incr_relobj::local_dynsym_offset_): New data member.
3372 (Sized_incr_relobj::local_symbols_): New data member.
3373 * object.h (Relobj::output_local_symbol_count): New function.
3374 (Relobj::local_symbol_offset): New function.
3375 (Relobj::do_output_local_symbol_count): New function.
3376 (Relobj::do_local_symbol_offset): New function.
3377 (Sized_relobj::do_output_local_symbol_count): New function.
3378 (Sized_relobj::do_local_symbol_offset): New function.
3380 2011-04-22 Vladimir Simonov <sv@sw.ru>
3382 * descriptors.cc (set_close_on_exec): New function.
3383 (Descriptors::open): Use set_close_on_exec.
3384 * output.cc (S_ISLNK): Define if not defined.
3386 2011-04-22 Cary Coutant <ccoutant@google.com>
3388 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3390 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3391 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3392 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3394 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3395 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3396 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3398 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3400 (Incremental_binary::apply_incremental_relocs): New function.
3401 (Incremental_binary::do_apply_incremental_relocs): New function.
3402 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3404 (Sized_incremental_binary::add_global_symbol): New function.
3405 (Sized_incremental_binary::global_symbol): New function.
3406 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3407 (Sized_incremental_binary::symbol_map_): New data member.
3408 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3409 * target.h (Sized_target::apply_relocation): New function.
3410 * target-reloc.h (apply_relocation): New function.
3411 * x86_64.cc (Target_x86_64::apply_relocation): New function.
3413 2011-04-22 Doug Kwan <dougkwan@google.com>
3415 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3416 flag of a SHT_ARM_EXIDX section.
3417 * testsuite/Makefile.am (arm_exidx_test): New test rules.
3418 * testsuite/Makefile.in: Regenerate.
3419 * testsuite/arm_exidx_test.s: New file.
3420 * testsuite/arm_exidx_test.sh: Same.
3422 2011-04-20 Cary Coutant <ccoutant@google.com>
3425 * archive.h (Incremental_archive_entry::Archive_member):
3426 Initialize arg_serial_ (second constructor).
3428 2011-04-17 Ian Lance Taylor <iant@google.com>
3430 * object.cc (Relocate_info::location): Simplify location string.
3431 * errors.cc (Errors::error_at_location): Don't print program
3433 (Errors::warning_at_location): Likewise.
3434 (Errors::undefined_symbol): Likewise.
3435 * testsuite/debug_msg.sh: Update accordingly.
3437 2011-04-14 Cary Coutant <ccoutant@google.com>
3439 * gold/layout.cc (Layout::symtab_section_offset): New function.
3440 * gold/layout.h (Layout::symtab_section_offset): New function.
3441 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3443 2011-04-12 Ian Lance Taylor <iant@google.com>
3445 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
3446 with MREMAP_MAYMOVE.
3447 * output.h (class Output_file): Add map_is_allocated_ field.
3448 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
3449 not available, provide stubs. If mremap is not available, #define
3451 (MREMAP_MAYMOVE): Define if not defined.
3452 (Output_file::Output_file): Initialize map_is_allocated_.
3453 (Output_file::resize): Check map_is_allocated_.
3454 (Output_file::map_anonymous): If mmap fails, use malloc.
3455 (Output_file::unmap): Don't do anything for an anonymous map.
3456 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
3457 is not available, provide stubs.
3458 (File_read::View::~View): Use free rather than delete[].
3459 (File_read::make_view): Use malloc rather than new[]. If mmap
3461 (File_read::find_or_make_view): Use malloc rather than new[].
3462 * gold.h: Remove HAVE_REMAP code.
3463 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
3464 exists. Rename mremap to gold_mremap. If mmap is not available
3466 * configure, config.in: Rebuild.
3468 2011-04-11 Ian Lance Taylor <iant@google.com>
3470 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3471 initialize local variable v.
3473 2011-04-11 Cary Coutant <ccoutant@google.com>
3475 * archive.cc (Archive::include_member): Adjust call to
3477 (Add_archive_symbols::run): Track argument serial numbers.
3478 (Lib_group::include_member): Likewise.
3479 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3480 * archive.h (Incremental_archive_entry::Archive_member):
3481 Initialize arg_serial_.
3482 (Archive_member::arg_serial_): New data member.
3483 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3484 (Sized_dynobj::do_add_symbols): Track symbols when doing an
3486 (Sized_dynobj::do_for_all_local_got_entries): New function.
3487 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3489 * fileread.cc (get_mtime): New function.
3490 * fileread.h (get_mtime): New function.
3491 * gold.cc (queue_initial_tasks): Check for incremental update.
3492 (process_incremental_input): New function.
3493 (queue_middle_tasks): Don't force valid target for incremental
3495 * incremental-dump.cc (find_input_containing_global): Adjust
3496 size of symbol info entry.
3497 (dump_incremental_inputs): Dump argument serial number and
3498 in_system_directory flag; bias shndx by 1; print symbol names
3499 when dumping per-file symbol lists; use new symbol info readers.
3501 (Output_section_incremental_inputs:update_data_size): New function.
3502 (Sized_incremental_binary::setup_readers): Setup input readers
3503 for each input file; build maps for files added from libraries
3505 (Sized_incremental_binary::check_input_args): New function.
3506 (Sized_incremental_binary::do_check_inputs): Build map of argument
3507 serial numbers to input arguments.
3508 (Sized_incremental_binary::do_file_has_changed): Rename
3509 do_file_is_unchanged to this; compare file modification times.
3510 (Sized_incremental_binary::do_init_layout): New function.
3511 (Sized_incremental_binary::do_reserve_layout): New function.
3512 (Sized_incremental_binary::do_get_input_reader): Remove.
3513 (Sized_incremental_binary::get_symtab_view): New function.
3514 (Incremental_checker::can_incrementally_link_output_file): Remove.
3515 (Incremental_inputs::report_command_line): Exclude --debug options.
3516 (Incremental_inputs::report_archive_begin): Add parameter; track
3517 argument serial numbers; don't put input file entry for archive
3518 before archive members.
3519 (Incremental_inputs::report_archive_end): Put input file entry
3520 for archive after archive members.
3521 (Incremental_inputs::report_object): Add parameter; track argument
3522 serial numbers and in_system_directory flag.
3523 (Incremental_inputs::report_script): Add parameter; track argument
3525 (Output_section_incremental_inputs::set_final_data_size): Adjust
3526 size of symbol info entry; check for forwarding symbols.
3527 (Output_section_incremental_inputs::write_input_files): Write
3528 in_system_directory flag and argument serial number.
3529 (Output_section_incremental_inputs::write_info_blocks): Map section
3530 indices between incremental info and original input file; store
3531 input section index for each symbol.
3532 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3533 change operator() to visit().
3534 (class Global_got_offset_visitor): Likewise.
3535 (class Global_symbol_visitor_got_plt):
3536 (Output_section_incremental_inputs::write_got_plt): Use new visitor
3538 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3539 (Sized_incr_relobj::do_read_symbols): New function.
3540 (Sized_incr_relobj::do_layout): New function.
3541 (Sized_incr_relobj::do_layout_deferred_sections): New function.
3542 (Sized_incr_relobj::do_add_symbols): New function.
3543 (Sized_incr_relobj::do_should_include_member): New function.
3544 (Sized_incr_relobj::do_for_all_global_symbols): New function.
3545 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3546 (Sized_incr_relobj::do_section_size): New function.
3547 (Sized_incr_relobj::do_section_name): New function.
3548 (Sized_incr_relobj::do_section_contents): New function.
3549 (Sized_incr_relobj::do_section_flags): New function.
3550 (Sized_incr_relobj::do_section_entsize): New function.
3551 (Sized_incr_relobj::do_section_address): New function.
3552 (Sized_incr_relobj::do_section_type): New function.
3553 (Sized_incr_relobj::do_section_link): New function.
3554 (Sized_incr_relobj::do_section_info): New function.
3555 (Sized_incr_relobj::do_section_addralign): New function.
3556 (Sized_incr_relobj::do_initialize_xindex): New function.
3557 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3558 (Sized_incr_relobj::do_read_relocs): New function.
3559 (Sized_incr_relobj::do_gc_process_relocs): New function.
3560 (Sized_incr_relobj::do_scan_relocs): New function.
3561 (Sized_incr_relobj::do_count_local_symbols): New function.
3562 (Sized_incr_relobj::do_finalize_local_symbols): New function.
3563 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3564 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3565 (Sized_incr_relobj::do_relocate): New function.
3566 (Sized_incr_relobj::do_set_section_offset): New function.
3567 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3568 (Sized_incr_dynobj::do_read_symbols): New function.
3569 (Sized_incr_dynobj::do_layout): New function.
3570 (Sized_incr_dynobj::do_add_symbols): New function.
3571 (Sized_incr_dynobj::do_should_include_member): New function.
3572 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3573 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3574 (Sized_incr_dynobj::do_section_size): New function.
3575 (Sized_incr_dynobj::do_section_name): New function.
3576 (Sized_incr_dynobj::do_section_contents): New function.
3577 (Sized_incr_dynobj::do_section_flags): New function.
3578 (Sized_incr_dynobj::do_section_entsize): New function.
3579 (Sized_incr_dynobj::do_section_address): New function.
3580 (Sized_incr_dynobj::do_section_type): New function.
3581 (Sized_incr_dynobj::do_section_link): New function.
3582 (Sized_incr_dynobj::do_section_info): New function.
3583 (Sized_incr_dynobj::do_section_addralign): New function.
3584 (Sized_incr_dynobj::do_initialize_xindex): New function.
3585 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3586 (make_sized_incremental_object): New function.
3587 (Incremental_library::copy_unused_symbols): New function.
3588 (Incremental_library::do_for_all_unused_symbols): New function.
3589 * incremental.h (enum Incremental_input_flags): New type.
3590 (class Incremental_checker): Remove.
3591 (Incremental_input_entry::Incremental_input_entry): Add argument
3593 (Incremental_input_entry::arg_serial): New function.
3594 (Incremental_input_entry::set_is_in_system_directory): New function.
3595 (Incremental_input_entry::is_in_system_directory): New function.
3596 (Incremental_input_entry::arg_serial_): New data member.
3597 (Incremental_input_entry::is_in_system_directory_): New data member.
3598 (class Script_info): Move here from script.h.
3599 (Script_info::Script_info): Add filename parameter.
3600 (Script_info::filename): New function.
3601 (Script_info::filename_): New data member.
3602 (Incremental_script_entry::Incremental_script_entry): Add argument
3604 (Incremental_object_entry::Incremental_object_entry): Likewise.
3605 (Incremental_object_entry::add_input_section): Build list of input
3606 sections with map to original shndx.
3607 (Incremental_object_entry::get_input_section_index): New function.
3608 (Incremental_object_entry::shndx_): New data member.
3609 (Incremental_object_entry::name_key_): Rename; adjust all refs.
3610 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3611 (Incremental_archive_entry::Incremental_archive_entry): Add argument
3613 (Incremental_inputs::report_archive_begin): Likewise.
3614 (Incremental_inputs::report_object): Likewise.
3615 (Incremental_inputs::report_script): Likewise.
3616 (class Incremental_global_symbol_reader): New class.
3617 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3618 and store flags and input file type.
3619 (Incremental_input_entry_reader::arg_serial): New function.
3620 (Incremental_input_entry_reader::type): Extract type from flags.
3621 (Incremental_input_entry_reader::is_in_system_directory): New function.
3622 (Incremental_input_entry_reader::get_input_section_count): Call
3623 accessor function for type.
3624 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3625 function for type; adjust size of global symbol entry.
3626 (Incremental_input_entry_reader::get_global_symbol_count): Call
3627 accessor function for type.
3628 (Incremental_input_entry_reader::get_object_count): Likewise.
3629 (Incremental_input_entry_reader::get_object_offset): Likewise.
3630 (Incremental_input_entry_reader::get_member_count): Likewise.
3631 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3632 (Incremental_input_entry_reader::get_member_offset): Likewise.
3633 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3634 (Incremental_input_entry_reader::Global_symbol_info): Remove.
3635 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3636 (Incremental_input_entry_reader::get_global_symbol_reader): New
3638 (Incremental_input_entry_reader::get_output_symbol_index): New
3640 (Incremental_input_entry_reader::type_): Remove.
3641 (Incremental_input_entry_reader::flags_): New data member.
3642 (Incremental_inputs_reader::input_file_offset): New function.
3643 (Incremental_inputs_reader::input_file_index): New function.
3644 (Incremental_inputs_reader::input_file): Call input_file_offset.
3645 (Incremental_inputs_reader::input_file_at_offset): New function.
3646 (Incremental_relocs_reader::get_r_type): Reformat.
3647 (Incremental_relocs_reader::get_r_shndx): Reformat.
3648 (Incremental_relocs_reader::get_r_offset): Reformat.
3649 (Incremental_relocs_reader::data): New function.
3650 (Incremental_binary::Incremental_binary): Initialize new data members.
3651 (Incremental_binary::check_inputs): Add cmdline parameter.
3652 (Incremental_binary::file_is_unchanged): Remove.
3653 (Input_reader::arg_serial): New function.
3654 (Input_reader::get_unused_symbol_count): New function.
3655 (Input_reader::get_unused_symbol): New function.
3656 (Input_reader::do_arg_serial): New function.
3657 (Input_reader::do_get_unused_symbol_count): New function.
3658 (Input_reader::do_get_unused_symbol): New function.
3659 (Incremental_binary::input_file_count): New function.
3660 (Incremental_binary::get_input_reader): Change signature to use
3661 index instead of filename.
3662 (Incremental_binary::file_has_changed): New function.
3663 (Incremental_binary::get_input_argument): New function.
3664 (Incremental_binary::get_library): New function.
3665 (Incremental_binary::get_script_info): New function.
3666 (Incremental_binary::init_layout): New function.
3667 (Incremental_binary::reserve_layout): New function.
3668 (Incremental_binary::output_file): New function.
3669 (Incremental_binary::do_check_inputs): New function.
3670 (Incremental_binary::do_file_is_unchanged): Remove.
3671 (Incremental_binary::do_file_has_changed): New function.
3672 (Incremental_binary::do_init_layout): New function.
3673 (Incremental_binary::do_reserve_layout): New function.
3674 (Incremental_binary::do_input_file_count): New function.
3675 (Incremental_binary::do_get_input_reader): Change signature.
3676 (Incremental_binary::input_args_map_): New data member.
3677 (Incremental_binary::library_map_): New data member.
3678 (Incremental_binary::script_map_): New data member.
3679 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3681 (Sized_incremental_binary::output_section): New function.
3682 (Sized_incremental_binary::inputs_reader): Add const.
3683 (Sized_incremental_binary::symtab_reader): Add const.
3684 (Sized_incremental_binary::relocs_reader): Add const.
3685 (Sized_incremental_binary::got_plt_reader): Add const.
3686 (Sized_incremental_binary::get_symtab_view): New function.
3687 (Sized_incremental_binary::Inputs_reader): New typedef.
3688 (Sized_incremental_binary::Input_entry_reader): New typedef.
3689 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3690 (Sized_incremental_binary::do_file_is_unchanged): Remove.
3691 (Sized_incremental_binary::do_file_has_changed): New function.
3692 (Sized_incremental_binary::do_init_layout): New function.
3693 (Sized_incremental_binary::do_reserve_layout): New function.
3694 (Sized_input_reader::Inputs_reader): Remove.
3695 (Sized_input_reader::Input_entry_reader): Remove.
3696 (Sized_input_reader::do_arg_serial): New function.
3697 (Sized_input_reader::do_get_unused_symbol_count): New function.
3698 (Sized_input_reader::do_get_unused_symbol): New function.
3699 (Sized_incremental_binary::do_input_file_count): New function.
3700 (Sized_incremental_binary::do_get_input_reader): Change signature;
3701 use index instead of filename.
3702 (Sized_incremental_binary::section_map_): New data member.
3703 (Sized_incremental_binary::input_entry_readers_): New data member.
3704 (class Sized_incr_relobj): New class.
3705 (class Sized_incr_dynobj): New class.
3706 (make_sized_incremental_object): New function.
3707 (class Incremental_library): New class.
3708 * layout.cc (Free_list::num_lists): New static data member.
3709 (Free_list::num_nodes): New static data member.
3710 (Free_list::num_removes): New static data member.
3711 (Free_list::num_remove_visits): New static data member.
3712 (Free_list::num_allocates): New static data member.
3713 (Free_list::num_allocate_visits): New static data member.
3714 (Free_list::init): New function.
3715 (Free_list::remove): New function.
3716 (Free_list::allocate): New function.
3717 (Free_list::dump): New function.
3718 (Free_list::print_stats): New function.
3719 (Layout_task_runner::run): Resize output file for incremental updates.
3720 (Layout::Layout): Initialize new data members.
3721 (Layout::set_incremental_base): New function.
3722 (Layout::init_fixed_output_section): New function.
3723 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3724 incremental updates.
3725 (Layout::create_gold_note): Do not create gold note section for
3726 incremental updates.
3727 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3728 for incremental updates.
3729 (Layout::set_section_offsets): For incremental updates, allocate space
3731 (Layout::create_symtab_sections): Layout with offsets relative to
3732 start of section; for incremental updates, allocate space from free
3734 (Layout::create_shdrs): For incremental updates, allocate space from
3736 (Layout::finish_dynamic_section): For incremental updates, do not
3737 check --as-needed (fixed in subsequent patch).
3738 * layout.h (class Free_list): New class.
3739 (Layout::set_incremental_base): New function.
3740 (Layout::incremental_base): New function.
3741 (Layout::init_fixed_output_section): New function.
3742 (Layout::allocate): New function.
3743 (Layout::incremental_base_): New data member.
3744 (Layout::free_list_): New data member.
3745 * main.cc (main): Print Free_list statistics.
3746 * object.cc (Relobj::finalize_incremental_relocs): Add
3747 clear_counts parameter; clear counts only when clear_counts is set.
3748 (Sized_relobj::Sized_relobj): Initialize new base class.
3749 (Sized_relobj::do_layout): Don't report special sections.
3750 (Sized_relobj::do_for_all_local_got_entries): New function.
3751 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3752 symtab_off to all symbol table offsets.
3753 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3754 * object.h (class Got_offset_list): Move to top of file.
3755 (Object::Object): Allow case where input_file == NULL.
3756 (Object::~Object): Likewise.
3757 (Object::input_file): Assert that input_file != NULL.
3758 (Object::lock): Allow case where input_file == NULL.
3759 (Object::unlock): Likewise.
3760 (Object::is_locked): Likewise.
3761 (Object::token): Likewise.
3762 (Object::release): Likewise.
3763 (Object::is_incremental): New function.
3764 (Object::get_mtime): New function.
3765 (Object::for_all_local_got_entries): New function.
3766 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3767 (Object::set_is_in_system_directory): New function.
3768 (Object::is_in_system_directory): New function.
3769 (Object::do_is_incremental): New function.
3770 (Object::do_get_mtime): New function.
3771 (Object::do_for_all_local_got_entries): New function.
3772 (Object::is_in_system_directory_): New data member.
3773 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3774 (class Sized_relobj_base): New class.
3775 (class Sized_relobj): Derive from Sized_relobj_base.
3776 (class Sized_relobj::Symbols): Redeclare from base class.
3777 (class Sized_relobj::local_got_offset_list): Remove.
3778 (class Sized_relobj::Output_sections): Redeclare from base class.
3779 (class Sized_relobj::do_for_all_local_got_entries): New function.
3780 (class Sized_relobj::write_local_symbols): Add offset parameter.
3781 (class Sized_relobj::local_symbol_offset_): Update comment.
3782 (class Sized_relobj::local_dynsym_offset_): Update comment.
3783 * options.cc (Input_arguments::add_file): Remove const.
3784 * options.h (Input_file_argument::Input_file_argument):
3785 Initialize arg_serial_ (all constructors).
3786 (Input_file_argument::set_arg_serial): New function.
3787 (Input_file_argument::arg_serial): New function.
3788 (Input_file_argument::arg_serial_): New data member.
3789 (Input_arguments::Input_arguments): Initialize file_count_.
3790 (Input_arguments::add_file): Remove const.
3791 (Input_arguments::number_of_input_files): New function.
3792 (Input_arguments::file_count_): New data member.
3793 (Command_line::number_of_input_files): Call
3794 Input_arguments::number_of_input_files.
3795 * output.cc (Output_segment_headers::Output_segment_headers):
3797 (Output_section::Input_section::current_data_size): New function.
3798 (Output_section::Output_section): Initialize new data members.
3799 (Output_section::add_input_section): Don't do merge sections for
3800 an incremental link; allocate space from free list for an
3802 (Output_section::add_output_section_data): Allocate space from
3803 free list for an incremental update.
3804 (Output_section::update_data_size): New function.
3805 (Output_section::set_fixed_layout): New function.
3806 (Output_section::reserve): New function.
3807 (Output_segment::set_section_addresses): Remove const.
3808 (Output_segment::set_section_list_addresses): Remove const; allocate
3809 space from free list for an incremental update.
3810 (Output_segment::set_offset): Adjust size of RELRO segment for an
3812 * output.h (Output_data::current_data_size): Move here from
3814 (Output_data::pre_finalize_data_size): New function.
3815 (Output_data::update_data_size): New function.
3816 (Output_section_headers::update_data_size): new function.
3817 (Output_section_data_build::current_data_size): Move to Output_data.
3818 (Output_data_strtab::update_data_size): New function.
3819 (Output_section::current_data_size): Move to Output_data.
3820 (Output_section::set_fixed_layout): New function.
3821 (Output_section::has_fixed_layout): New function.
3822 (Output_section::reserve): New function.
3823 (Output_section::update_data_size): New function.
3824 (Output_section::has_fixed_layout_): New data member.
3825 (Output_section::free_list_): New data member.
3826 (Output_segment::set_section_addresses): Remove const.
3827 (Output_segment::set_section_list_addresses): Remove const.
3828 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3830 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3832 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3833 parameter when calling Add_symbols constructor; store argument
3834 serial number for members of a lib group.
3835 (Add_symbols::locks): Allow case where token == NULL.
3836 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3837 (Read_member::~Read_member): New function.
3838 (Read_member::is_runnable): New function.
3839 (Read_member::locks): New function.
3840 (Read_member::run): New function.
3841 (Check_script::~Check_script): New function.
3842 (Check_script::is_runnable): New function.
3843 (Check_script::locks): New function.
3844 (Check_script::run): New function.
3845 (Check_library::~Check_library): New function.
3846 (Check_library::is_runnable): New function.
3847 (Check_library::locks): New function.
3848 (Check_library::run): New function.
3849 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3850 (Add_symbols::library_): New data member.
3851 (class Read_member): New class.
3852 (class Check_script): New class.
3853 (class Check_library): New class.
3854 * reloc.cc (Read_relocs::is_runnable): Allow case where
3856 (Read_relocs::locks): Likewise.
3857 (Scan_relocs::locks): Likewise.
3858 (Relocate_task::locks): Likewise.
3859 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3861 (Sized_relobj::incremental_relocs_scan): Fix comment.
3862 (Sized_relobj::do_relocate): Pass output file offset to
3863 write_local_symbols.
3864 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3865 from class declaration.
3866 * script.cc (read_input_script): Allocate Script_info; pass
3867 argument serial number to report_script.
3868 * script.h (class Script_info): Move to incremental.h.
3869 * symtab.cc (Symbol_table::add_from_incrobj): New function.
3870 * symtab.h (Symbol_table::add_from_incrobj): New function.
3871 (Symbol_table::set_file_offset): New function.
3873 2011-04-05 Cary Coutant <ccoutant@google.com>
3875 * incremental-dump.cc (dump_incremental_inputs): Change signature
3876 to take a Sized_incremental_binary; change caller. Use readers
3877 in Sized_incremental_binary.
3879 (Sized_incremental_binary::find_incremental_inputs_sections):
3880 Rename do_find_incremental_inputs_sections to this.
3881 (Sized_incremental_binary::setup_readers): New function.
3882 (Sized_incremental_binary::do_check_inputs): Check
3883 has_incremental_info_ flag; move setup code to setup_readers;
3885 (Sized_incremental_binary::do_file_is_unchanged): New function.
3886 (Sized_incremental_binary::do_get_input_reader): New function.
3887 * incremental.h (class Incremental_binary): Move to end of file.
3888 (Incremental_binary::file_is_unchanged): New function.
3889 (Incremental_binary::do_file_is_unchanged): New function.
3890 (Incremental_binary::Input_reader): New class.
3891 (Incremental_binary::get_input_reader): New function.
3892 (class Sized_incremental_binary): Move to end of file.
3893 (Sized_incremental_binary::Sized_incremental_binary): Setup the
3894 input section reader classes.
3895 (Sized_incremental_binary::has_incremental_info): New function.
3896 (Sized_incremental_binary::inputs_reader): New function.
3897 (Sized_incremental_binary::symtab_reader): New function.
3898 (Sized_incremental_binary::relocs_reader): New function.
3899 (Sized_incremental_binary::got_plt_reader): New function.
3900 (Sized_incremental_binary::do_file_is_unchanged): New function.
3901 (Sized_incremental_binary::Sized_input_reader): New class.
3902 (Sized_incremental_binary::get_input_reader): New function.
3903 (Sized_incremental_binary::find_incremental_inputs_sections):
3904 Rename do_find_incremental_inputs_sections to this.
3905 (Sized_incremental_binary::setup_readers): New function.
3906 (Sized_incremental_binary::has_incremental_info_): New data member.
3907 (Sized_incremental_binary::inputs_reader_): New data member.
3908 (Sized_incremental_binary::symtab_reader_): New data member.
3909 (Sized_incremental_binary::relocs_reader_): New data member.
3910 (Sized_incremental_binary::got_plt_reader_): New data member.
3911 (Sized_incremental_binary::current_input_file_): New data member.
3913 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
3916 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3919 2011-03-30 Cary Coutant <ccoutant@google.com>
3921 * archive.cc (Archive::include_member): Adjust call to report_object.
3922 (Add_archive_symbols::run): Add script_info to call to
3923 report_archive_begin.
3924 (Lib_group::include_member): Adjust call to report_object.
3925 (Add_lib_group_symbols::run): Adjust call to report_object.
3926 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3927 blocks. Add object count for script input files.
3928 * incremental.cc (Incremental_inputs::report_archive_begin): Add
3929 script_info parameter; change all callers.
3930 (Incremental_inputs::report_object): Add script_info parameter;
3932 (Incremental_inputs::report_script): Store backpointer to
3933 incremental info entry.
3934 (Output_section_incremental_inputs::set_final_data_size): Record
3935 additional information for scripts.
3936 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3937 * incremental.h (Incremental_script_entry::add_object): New function.
3938 (Incremental_script_entry::get_object_count): New function.
3939 (Incremental_script_entry::get_object): New function.
3940 (Incremental_script_entry::objects_): New data member; adjust
3942 (Incremental_inputs::report_archive_begin): Add script_info parameter.
3943 (Incremental_inputs::report_object): Add script_info parameter.
3944 (Incremental_inputs_reader::get_object_count): New function.
3945 (Incremental_inputs_reader::get_object_offset): New function.
3946 * options.cc (Input_arguments::add_file): Return reference to
3948 * options.h (Input_argument::set_script_info): New function.
3949 (Input_argument::script_info): New function.
3950 (Input_argument::script_info_): New data member; adjust all
3952 (Input_file_group::add_file): Return reference to new input argument.
3953 (Input_file_lib::add_file): Likewise.
3954 (Input_arguments::add_file): Likewise.
3955 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3956 * script.cc (Parser_closure::Parser_closure): Add script_info
3957 parameter; adjust all callers.
3958 (Parser_closure::script_info): New function.
3959 (Parser_closure::script_info_): New data member.
3960 (read_input_script): Report scripts earlier to incremental info.
3961 (script_add_file): Set script_info in Input_argument.
3962 (script_add_library): Likewise.
3963 * script.h (Script_options::Script_info): Rewrite class.
3965 2011-03-29 Cary Coutant <ccoutant@google.com>
3967 * archive.cc (Library_base::should_include_member): Move
3968 method here from class Archive.
3969 (Archive::Archive): Initialize base class.
3970 (Archive::should_include_member): Move to base class.
3971 (Archive::do_for_all_unused_symbols): New function.
3972 (Add_archive_symbols::run): Remove redundant access to
3974 (Lib_group::Lib_group): Initialize base class.
3975 (Lib_group::do_filename): New function.
3976 (Lib_group::include_member): Pass pointer to Lib_group to
3978 (Lib_group::do_for_all_unused_symbols): New function.
3979 (Add_lib_group_symbols::run): Report archive information for
3981 * archive.h (class Library_base): New base class.
3982 (class Archive): Derive from Library_base.
3983 (Archive::filename): Move to base class.
3984 (Archive::set_incremental_info): Likewise.
3985 (Archive::incremental_info): Likewise.
3986 (Archive::Should_include): Likewise.
3987 (Archive::should_include_member): Likewise.
3988 (Archive::Armap_entry): Remove.
3989 (Archive::Unused_symbol_iterator): Remove.
3990 (Archive::unused_symbols_begin): Remove.
3991 (Archive::unused_symbols_end): Remove.
3992 (Archive::do_filename): New function.
3993 (Archive::do_get_mtime): New function.
3994 (Archive::do_for_all_unused_symbols): New function.
3995 (Archive::task_): Move to base class.
3996 (Archive::incremental_info_): Likewise.
3997 (class Lib_group): Derive from Library_base.
3998 (Lib_group::do_filename): New function.
3999 (Lib_group::do_get_mtime): New function.
4000 (Lib_group::do_for_all_unused_symbols): New function.
4001 (Lib_group::task_): Move to base class.
4002 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4004 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4006 * incremental.cc (Incremental_inputs::report_archive_begin):
4007 Use Library_base; call library's get_mtime; add incremental inputs
4008 entry before members.
4009 (class Unused_symbol_visitor): New class.
4010 (Incremental_inputs::report_archive_end): Use Library_base; use
4011 visitor class to record unused symbols; don't add incremental inputs
4012 entry after members.
4013 (Incremental_inputs::report_object): Use Library_base.
4015 (Incremental_archive_entry::Incremental_archive_entry): Remove
4016 unused Archive parameter.
4017 (Incremental_inputs::report_archive_begin): Use Library_base.
4018 (Incremental_inputs::report_archive_end): Likewise.
4019 (Incremental_inputs::report_object): Likewise.
4020 * object.cc (Sized_relobj::do_for_all_global_symbols): New
4022 * object.h (Object::for_all_global_symbols): New function.
4023 (Object::do_for_all_global_symbols): New function.
4024 (Sized_relobj::do_for_all_global_symbols): New function.
4025 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
4027 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
4030 2011-03-27 Ian Lance Taylor <iant@google.com>
4032 * archive.cc (Archive::interpret_header): Return -1 if something
4033 goes wrong. Change callers accordingly.
4035 2011-03-25 Cary Coutant <ccoutant@google.com>
4037 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4038 * testsuite/Makefile.in: Regenerate.
4040 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
4042 * plugin.cc (get_view): New.
4043 (Plugin::load): Pass get_view to the plugin.
4044 (Plugin_manager::get_view): New.
4046 2011-03-21 Ian Lance Taylor <iant@google.com>
4048 * testsuite/final_layout.sh: Rewrite to not use dc.
4049 * testsuite/relro_test.sh: Fail if dc is not present.
4051 2011-03-21 Sriraman Tallam <tmsriram@google.com>
4053 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4055 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4056 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4058 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4059 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4061 2011-03-14 Ian Lance Taylor <iant@google.com>
4063 * script-sections.cc (Sort_output_sections::script_compare):
4064 Rename from is_before, change return type.
4065 (Sort_output_sections::operator()): Adjust accordingly.
4067 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
4070 * testsuite/odr_violation2.cc: Add comment to make all error line
4071 numbers double digits.
4072 * testsuite/debug_msg.sh: Adjust expected errors.
4074 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
4076 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4077 but mark earlier ones as non-canonical
4078 (offset_to_iterator): Update search target and example
4079 (do_addr2line): Return extra lines in a vector*
4080 (format_file_lineno): Extract from do_addr2line
4081 (one_addr2line): Add vector* out-param
4082 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4083 when a lineno entry appeared last for its instruction
4084 (Dwarf_line_info): Add vector* out-param
4085 * object.cc (Relocate_info): Pass NULL for the vector* out-param
4086 * symtab.cc (Odr_violation_compare): Include the lineno in the
4088 (linenos_from_loc): New. Combine the canonical line for an
4089 address with its other lines.
4090 (True_if_intersect): New. Helper functor to make
4091 std::set_intersection a query.
4092 (detect_odr_violations): Compare sets of lines instead of just
4093 one line for each function. This became less deterministic, but
4094 has fewer false positives.
4095 * symtab.h: Declarations.
4096 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4097 mix an optimized and non-optimized object in the same binary
4098 (odr_violation2.so): Same.
4099 * testsuite/Makefile.in: Regenerate from Makefile.am.
4100 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4101 * testsuite/debug_msg.sh: Update line numbers and add
4103 * testsuite/odr_violation1.cc: Use OdrDerived, in a
4104 non-optimized context.
4105 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4106 isn't inlined, and use OdrDerived in an optimized context.
4107 * testsuite/odr_header1.h: Defines OdrDerived, where
4108 optimization will change the
4109 first-instruction-in-the-destructor's file and line number.
4110 * testsuite/odr_header2.h: Defines OdrBase.
4112 2011-03-09 Ian Lance Taylor <iant@google.com>
4114 * fileread.cc (File_read::clear_views): Don't delete the whole
4117 2011-03-08 Ian Lance Taylor <iant@google.com>
4120 * fileread.cc: #include <climits>.
4121 (GOLD_IOV_MAX): Define.
4122 (File_read::read_multiple): Limit number of entries by iov_max.
4123 * fileread.h (class File_read): Always set max_readv_entries to
4126 2011-03-07 Ian Lance Taylor <iant@google.com>
4129 * options.h (class General_options): Add -dy and -dn.
4131 2011-03-02 Cary Coutant <ccoutant@google.com>
4133 * testsuite/script_test_9.t: Add TLS segment.
4135 2011-03-02 Simon Baldwin <simonb@google.com>
4137 * configure.ac: Add check for gnu_indirect_function support in
4138 the toolchain building binutils.
4139 * configure: Rebuild.
4141 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
4143 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4144 plugin only symbols.
4145 (Symbol_table::sized_finalize_symbol) Mark symbol only present
4146 in plugin files as not needed in the symbol table.
4148 2011-02-11 Sriraman Tallam <tmsriram@google.com>
4150 * output.cc (Output_section::add_input_section): Delay fill
4151 generation for section ordering.
4153 2011-02-09 Ian Lance Taylor <iant@google.com>
4156 * object.h (class Sized_relobj): Remove clear_local_symbols.
4157 * reloc.cc (Sized_relobj::do_relocate): Don't call
4158 clear_local_symbols.
4160 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
4162 * plugin.cc (is_visible_from_outside): Return true for symbols
4165 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
4167 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4170 2011-02-02 Sriraman Tallam <tmsriram@google.com>
4172 * icf.h (is_section_foldable_candidate): Change type of parameter
4174 * icf.cc (Icf::find_identical_sections): Change type of local variable
4175 section_name to be std::string.
4176 (is_function_ctor_or_dtor): Change type of parameter to std::string.
4178 2011-01-25 Ian Lance Taylor <iant@google.com>
4180 * script.cc (script_add_extern): Rewrite to use
4181 add_symbol_reference.
4183 2011-01-25 Doug Kwan <dougkwan@google.com>
4185 * icf.cc (get_section_contents): Always lock section's object.
4187 2011-01-24 Ian Lance Taylor <iant@google.com>
4189 * options.h (class General_options): Accept
4190 --no-detect-odr-violations.
4192 2011-01-24 Ian Lance Taylor <iant@google.com>
4194 * version.cc (version_string): Bump to 1.11.
4196 2011-01-24 Ian Lance Taylor <iant@google.com>
4198 * plugin.cc (class Plugin_rescan): Define new class.
4199 (Plugin_manager::claim_file): Set any_claimed_.
4200 (Plugin_manager::save_archive): New function.
4201 (Plugin_manager::save_input_group): New function.
4202 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4204 (Plugin_manager::new_undefined_symbol): New function.
4205 (Plugin_manager::rescan): New function.
4206 (Plugin_manager::rescannable_defines): New function.
4207 (Plugin_manager::add_input_file): Set any_added_.
4208 * plugin.h (class Plugin_manager): define new fields rescannable_,
4209 undefined_symbols_, any_claimed_, and any_added_. Declare
4210 Plugin_rescan as friend. Declare new functions.
4211 (Plugin_manager::Rescannable): Define type.
4212 (Plugin_manager::Rescannable_list): Define type.
4213 (Plugin_manager::Undefined_symbol_list): Define type.
4214 (Plugin_manager::Plugin_manager): Initialize new fields.
4215 * archive.cc (Archive::defines_symbol): New function.
4216 (Add_archive_symbols::run): Pass archive to plugins if any.
4217 * archive.h (class Archive): Declare defines_symbol.
4218 * readsyms.cc (Input_group::~Input_group): New function.
4219 (Finish_group::run): Pass input_group to plugins if any.
4220 * readsyms.h (class Input_group): Declare destructor.
4221 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4224 2011-01-10 Ian Lance Taylor <iant@google.com>
4226 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4228 (Layout::set_segment_offsets): Reset increase_relro before calling
4229 set_section_addresses a second time.
4231 2011-01-04 Cary Coutant <ccoutant@google.com>
4233 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4234 sections before NOBITS sections.
4236 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
4238 * version.cc (print_version): Update copyright to 2011.
4240 2010-12-23 Cary Coutant <ccoutant@google.com>
4242 * output.h (Output_data_reloc::add_output_section): Pass OD instead
4243 of OS to this->add. Add OD parameter to second form of the function.
4245 2010-12-20 Ian Lance Taylor <iant@google.com>
4247 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4248 second of two consecutive entries with same offset.
4250 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4252 * testsuite/Makefile.am (ifuncmain2static_LDADD)
4253 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4254 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4255 to avoid unneeded links against $(LDADD).
4256 * testsuite/Makefile.in: Regenerate.
4258 2010-12-15 Ian Lance Taylor <iant@google.com>
4261 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4262 for R_X86_64_32 and R_X86_64_PC32.
4263 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4264 ver_matching_def_pic.o.
4265 (ver_matching_def_pic.o): New target.
4267 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4269 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4270 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4271 Move definition before File_read::View member definitions.
4272 (File_read::View::~View): Initialize and hold lock before
4273 updating current_mapped_bytes.
4275 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4277 * dwarf_reader.cc: Remove outdated comment.
4278 * gold-threads.cc: Fix typo in error message.
4279 * archive.cc: Fix typos in comments.
4280 * archive.h: Likewise.
4281 * arm-reloc-property.cc: Likewise.
4282 * arm-reloc-property.h: Likewise.
4283 * arm-reloc.def: Likewise.
4285 * attributes.h: Likewise.
4286 * cref.cc: Likewise.
4287 * ehframe.cc: Likewise.
4288 * fileread.h: Likewise.
4290 * i386.cc: Likewise.
4292 * incremental.h: Likewise.
4293 * int_encoding.cc: Likewise.
4294 * layout.h: Likewise.
4295 * main.cc: Likewise.
4296 * merge.h: Likewise.
4297 * object.cc: Likewise.
4298 * object.h: Likewise.
4299 * options.cc: Likewise.
4300 * readsyms.cc: Likewise.
4301 * reduced_debug_output.cc: Likewise.
4302 * reloc.cc: Likewise.
4303 * script-sections.cc: Likewise.
4304 * sparc.cc: Likewise.
4305 * symtab.h: Likewise.
4306 * target-reloc.h: Likewise.
4307 * target.cc: Likewise.
4308 * target.h: Likewise.
4309 * timer.cc: Likewise.
4310 * timer.h: Likewise.
4311 * x86_64.cc: Likewise.
4313 2010-12-09 Cary Coutant <ccoutant@google.com>
4315 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4317 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4318 parameter; change all callers.
4319 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4320 * options.h (warn_execstack): New option.
4322 2010-12-07 Doug Kwan <dougkwan@google.com>
4324 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4325 like function call relocations.
4327 2010-12-07 Ian Lance Taylor <iant@google.com>
4329 * archive.cc (Archive::get_elf_object_for_member): Permit
4330 punconfigured to be NULL.
4331 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4332 (Archive::include_member): Pass NULL to get_elf_object_for_member
4333 if we searched for the archive and this is the first included
4336 2010-12-01 Ian Lance Taylor <iant@google.com>
4338 * dwarf_reader.h (class Sized_dwarf_line_info): Add
4339 track_relocs_type_ field.
4340 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4341 Set track_relocs_type_.
4342 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4343 contents when using RELA relocs.
4344 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4346 * reloc.cc (Track_relocs::next_addend): New function.
4347 * reloc.h (class Track_relocs): Declare next_addend.
4349 2010-12-01 Ian Lance Taylor <iant@google.com>
4351 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4354 2010-12-01 Ian Lance Taylor <iant@google.com>
4356 * README: Update compilers known to work and fail.
4358 2010-11-23 Matthias Klose <doko@ubuntu.com>
4360 * configure.in: For --enable-gold, handle value `default' instead of
4361 `both*'. Always install ld as ld.bfd, install as ld if gold is
4363 * configure: Regenerate.
4365 2010-11-18 Doug Kwan <dougkwan@google.com>
4367 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4368 and right_alignment to be zero. Store result alignment only if it is
4369 greater than existing alignment.
4371 2010-11-16 Cary Coutant <ccoutant@google.com>
4374 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4375 Check for ".zdebug_line".
4377 2010-11-16 Doug Kwan <dougkwan@google.com>
4378 Cary Coutant <ccoutant@google.com>
4380 * output.h (Output_segment::set_section_addresses): Pass increase_relro
4381 by reference; adjust all callers.
4382 * output.cc (Output_segment::set_section_addresses): Adjust references
4383 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4385 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4386 end at page boundary.
4388 2010-11-16 Cary Coutant <ccoutant@google.com>
4391 * layout.cc (Layout::choose_output_section): Transform names of
4392 compressed sections even when using a script with a SECTIONS clause.
4393 (Layout::output_section_name): Remove code to transform
4394 compressed debug section names.
4395 * output.cc (Output_section::add_input_section): Use uncompressed
4396 section size when tracking input sections.
4398 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
4400 * symtab.h (Symbol::NON_PIC_REF): Remove.
4401 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4402 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
4403 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4404 (Symbol::use_plt_offset): Take a flags argument and pass it
4405 directly to needs_dynamic_reloc. Restrict check for undefined
4406 weak symbols to function calls.
4407 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4408 (Target_arm::Scan::global): Use it.
4409 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4410 (Target_arm::Relocate::relocate): Likewise.
4411 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4412 parameter with an r_type parameter. Use get_reference_flags
4414 (Target_arm::Relocate::relocate): Update accordingly.
4415 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4416 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4417 (Target_i386::Scan::global): Likewise.
4418 (Target_i386::Relocate::relocate): Likewise.
4419 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4420 parameter with an r_type parameter. Use get_reference_flags
4422 (Target_i386::Relocate::relocate): Update accordingly.
4423 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4424 (Target_powerpc::Scan::global): Use it.
4425 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4426 (Target_powerpc::Relocate::relocate): Likewise.
4427 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4428 (Target_sparc::Scan::global): Use it.
4429 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4430 (Target_sparc::Relocate::relocate): Likewise.
4431 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4432 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4433 (Target_x86_64::Scan::global): Likewise.
4434 (Target_x86_64::Relocate::relocate): Likewise.
4436 2010-11-08 Doug Kwan <dougkwan@google.com>
4437 Cary Coutant <ccoutant@google.com>
4439 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4440 (Arm_exidx_merge_section::section_contents_): New data member.
4441 (Arm_input_section::Arm_input_section): Initialize original_contents_.
4442 (Arm_input_section::~Arm_input_section): De-allocate memory.
4443 (Arm_input_section::original_contents_): New data member.
4444 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4445 in parameters instead of calling Object::section_contents without
4447 (Arm_output_section::group_section): New parameter TASK. Pass it
4448 to callees that need locking objects.
4449 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
4450 to lock EXIDX input sections. Fix a formatting issue. Call
4451 Arm_exidx_merged_section::build_contents to create merged section
4453 (Arm_output_section::create_stub_group): New parameter TASK. Use it
4454 to lock object of stub table owner.
4455 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4456 TEXT_SIZE to initialize data member TEXT_SIZE_.
4457 (Arm_exidx_input_section::addralign): Fix typo in comment.
4458 (Arm_exidx_input_section::text_size): New method.
4459 (Target_arm::do_relax): New parameter TASK. Pass it to callees
4460 that require locking objects. Lock objects before scanning for stubs
4461 and updating local symbols.
4462 (Arm_input_section<big_endian>::init): Copy contents of original
4464 (Arm_input_section<big_endian>::do_write): Use saved contents of
4465 original input section instead of calling Object::section_contents
4467 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4468 size without calling Object::section_size().
4469 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4470 for size. Allocate a buffer for merged EXIDX entries.
4471 (Arm_exidx_merged_section::build_contents): New method.
4472 (Arm_exidx_merged_section::do_write): Move merge section contents
4473 building code to Arm_exidx_merged_section::build_contetns. Write
4474 out contetns in buffer instead of building it on the fly.
4475 (Arm_relobj::make_exidx_input_section): Also pass text section size
4476 to Arm_exidx_input_section constructor.
4477 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
4478 (Arm_dynobj::do_read_symbols): Fix memory leak.
4479 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4480 * target.h: (class Task): Add forward declaration.
4481 (Target::relax): Add new parameter TASK and pass it to
4483 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
4485 2010-11-05 Cary Coutant <ccoutant@google.com>
4488 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4489 object when reading from the file.
4490 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4492 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4493 when reading section contents.
4494 (get_section_contents): Likewise.
4495 (icf::find_identical_sections): Likewise.
4496 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4497 object when reading from the file.
4498 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4499 the object when doing deferred section layout.
4501 2010-11-03 Nick Clifton <nickc@redhat.com>
4504 * script.h (class Symbol_assignment: name): New member. Returns
4505 the name of the symbol.
4506 * scrfipt.cc (Script_options::is_pending_assignment): New member.
4507 Returns true if the given symbol name is on the list of
4508 assignments wating to be processed.
4509 * archive.cc (should_incldue_member): If the symbol is undefined,
4510 check to see if it is on the list of symbols pending assignment.
4512 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
4514 * script-sections.cc (Script_sections::find_memory_region): Check
4515 for a NULL output section pointer.
4517 2010-10-29 Doug Kwan <dougkwan@google.com>
4519 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4520 Output_section::add_relaxed_input_section.
4521 * output.cc (Output_section::add_relaxed_input_section): Add new
4522 arguments LAYOUT and NAME. Set section order index.
4523 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4524 Copy section order index.
4525 * output.h (Output_section::add_relaxed_input_section): Add new
4526 arguments LAYOUT and NAME.
4528 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4530 * testsuite/Makefile.am: Move gcctestdir/ld rule to
4531 NATIVE_OR_CROSS_LINKER.
4532 * testsuite/Makefile.in: Regenerate.
4534 2010-10-20 Doug Kwan <dougkwan@google.com>
4536 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4537 without SHF_LINK_ORDER flags.
4538 * layout.cc (Layout::choose_output_section): Do not filter
4539 SHF_LINK_ORDER flag in a relocatable link.
4541 2010-10-17 Cary Coutant <ccoutant@google.com>
4543 * output.h (Output_segment::set_section_addresses): Change function
4544 signature. Update all callers.
4545 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4547 (Output_segment::set_section_addresses): Align after last TLS
4548 section. Add padding before last relro section instead of after.
4550 2010-10-17 Doug Kwan <dougkwan@google.com>
4552 * gold/arm.cc (Target_arm::got_section): Use correct order and set
4553 GOT output section to be writable.
4555 2010-10-14 Cary Coutant <ccoutant@google.com>
4557 * debug.h (DEBUG_INCREMENTAL): New flag.
4558 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4559 * gold.cc (queue_initial_tasks): Check parameters for incremental link
4561 * incremental.cc (report_command_line): Ignore all forms of
4563 * layout.cc (Layout::Layout): Check parameters for incremental link
4565 * options.cc (General_options::parse_incremental): New function.
4566 (General_options::parse_no_incremental): New function.
4567 (General_options::parse_incremental_full): New function.
4568 (General_options::parse_incremental_update): New function.
4569 (General_options::incremental_mode_): New data member.
4570 (General_options::finalize): Check incremental_mode_.
4571 * options.h (General_options): Update help text for --incremental.
4572 Add --no-incremental, --incremental-full, --incremental-update.
4573 (General_options::Incremental_mode): New enum type.
4574 (General_options::incremental_mode): New function.
4575 (General_options::incremental_mode_): New data member.
4576 * parameters.cc (Parameters::incremental_mode_): New data member.
4577 (Parameters::set_options): Set incremental_mode_.
4578 (Parameters::set_incremental_full): New function.
4579 (Parameters::incremental): New function.
4580 (Parameters::incremental_update): New function.
4581 (set_parameters_incremental_full): New function.
4582 * parameters.h (Parameters::set_incremental_full): New function.
4583 (Parameters::incremental): New function.
4584 (Parameters::incremental_update): New function.
4585 (Parameters::incremental_mode_): New data member.
4586 (set_parameters_incremental_full): New function.
4587 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4588 incremental link mode.
4589 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4590 (Sized_relobj::do_relocate_sections): Likewise.
4591 * testsuite/Makefile.am (incremental_test): Use --incremental-full
4593 * testsuite/Makefile.in: Regenerate.
4594 * testsuite/incremental_test.sh: Filter all forms of --incremental.
4596 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4598 * script-sections.h (class Script_sections): Make
4599 Sections_elements typedef public.
4600 * script-sections.cc (class Sort_output_sections): Add elements_
4601 field. Add constructor which sets it; change all callers.
4602 (Sort_output_sections::is_before): New function.
4603 (Sort_output_sections::operator()): Call is_before.
4604 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4606 * testsuite/script_test_10.sh: New test. Test script section
4608 * testsuite/script_test_10.t: Likewise.
4609 * testsuite/script_test_10.s: Likewise.
4610 * testsuite/Makefile.am: Wrap the cross linker tests and the
4611 common tests into NATIVE_OR_CROSS_LINKER.
4612 (check_SCRIPTS): Add script_test_10.sh.
4613 (check_DATA): Add script_test_10.stdout.
4614 (script_test_10.o, script_test_10): New targets.
4615 (script_test_10.stdout): New target.
4616 * configure, testsuite/Makefile.in: Regenerate.
4618 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4620 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4621 error for the deprecated relocations.
4622 (Target_arm::Scan::global): Likewise.
4623 (Target_arm::Relocate::relocate): Likewise.
4625 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
4627 * fileread.cc (Input_file::find_file): Initialize *found_name
4628 and *namep when using the fallback search for case 4.
4630 2010-10-11 Cary Coutant <ccoutant@google.com>
4632 * options.h (class General_options): Redefine -z lazy as an alias for
4633 the negation of -z now.
4635 2010-10-11 Ian Lance Taylor <iant@google.com>
4637 * resolve.cc (symbol_to_bits): Report the value of the unsupported
4640 2010-10-06 Nick Clifton <nickc@redhat.com>
4642 * script-sections.cc(class Memory_region): Remove
4643 current_lma_offset_ field. Rename current_vma_offset_ to
4644 current_offset_. Add last_section_ field.
4645 (Memory_region::get_current_vma_address): Rename to
4646 get_current_address.
4647 (Memory_region::get_current_lma_address): Delete.
4648 (Memory_region::increment_vma_offset): Rename to
4650 (Memory_region::increment_lma_offset): Delete.
4651 (Memory_region::attributes_compatible): New method. Returns
4652 true if the provided section is compatible with the region.
4653 (Memory_region::get_last_section): New method. Returns the last
4654 section to use the region.
4655 (Memory_region::set_last_section): New method. Stores the last
4656 section to use the region.
4657 (Script_sections::block_in_region): New method. Returns true if
4658 a block of memory is contained within a region.
4659 (Script_sections::find_memory_region): New method. Locates a
4660 memory region to be used to set a VMA or LMA address.
4661 (Output_section_definition::set_section_addresses): Add code to
4662 check for addresses set by memory regions.
4663 (Output_segment::set_section_addresses): Remove memory region
4665 (Script_sections::create_segment): Add a warning if a header
4666 segment is created outside of any region.
4667 * script-sections.h (class Script_sections): Add prototypes for
4668 find_memory_region and block_in_region methods.
4669 * testsuite/memory_test.s: Use .long instead of .word.
4670 * testsuite/memory_test.t: Add some more output sections.
4671 * testsuite/memory_test.sh: Update expected output.
4673 2010-10-02 Doug Kwan <dougkwan@google.com>
4675 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4676 defintion to symtab.h
4677 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4678 declaration to defintion.
4680 2010-10-01 Nick Clifton <nickc@redhat.com>
4682 * expression.cc (eval): Replace dummy argument with NULL.
4683 (eval_maybe_dot): Check for a NULL result section pointer.
4684 (Symbol_expression::value): Likewise.
4685 (Dot_expression::value): Likewise.
4686 (BINARY_EXPRESSION): Likewise.
4687 (Max_expression::value): Likewise.
4688 (Min_expression::value): Likewise.
4689 (Absolute_expression::value): Likewise.
4690 (Addr_expression::value_from_output_section): Likewise.
4691 (Loaddddr_expression::value_from_output_section): Likewise.
4692 (Segment_start_expression::value): Likewise.
4693 * script-sections.cc
4694 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4696 (Sections_elememt_dot_assignment::set_section_addresses):
4698 (Output_data_expression::do_write_to_buffer): Likewise.
4699 (Output_section_definition::finalize_symbols): Likewise.
4700 (Output_section_definition::set_section_addresses): Likewise.
4702 2010-09-30 Doug Kwan <dougkwan@google.com>
4704 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4706 2010-09-28 Sriraman Tallam <tmsriram@google.com>
4708 * target.h (Target::can_icf_inline_merge_sections): New virtual
4710 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4712 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4714 * icf.cc (get_section_contents): Inline merge sections only when
4717 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4719 * configure: Regenerate.
4721 2010-09-17 Ian Lance Taylor <iant@google.com>
4723 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4724 * testsuite/Makefile.am (memory_test.o): New target.
4725 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4727 * testsuite/Makefile.in: Rebuild.
4729 2010-09-17 Doug Kwan <dougkwan@google.com>
4731 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4732 defintion if relocation uses GOT entries of the symbol.
4733 * testsuite/icf_safe_test.sh: Fix test.
4734 * testsuite/icf_safe_so_test.sh: Fix test.
4736 2010-09-16 Cary Coutant <ccoutant@google.com>
4738 * script_sections.cc (class Memory_region): Remove "NULL" from
4739 vector initializations.
4741 2010-09-15 Cary Coutant <ccoutant@google.com>
4743 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4744 Resolve forwarding symbols.
4746 2010-09-15 Doug Kwan <dougkwan@google.com>
4748 * gold/testsuite/script_test_3.t: Add ARM special sections.
4749 * gold/testsuite/script_test_4.t: Same.
4750 * gold/testsuite/script_test_5.t: Same.
4751 * gold/testsuite/script_test_6.t: Same.
4752 * gold/testsuite/script_test_7.t: Same.
4753 * gold/testsuite/script_test_7.t: Same.
4754 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4756 2010-09-14 Cary Coutant <ccoutant@google.com>
4758 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4759 (Target_x86_64::Relocate::relocate_tls): Replace check for
4760 saw_tls_block_reloc_ with test for executable section.
4762 2010-09-12 Cary Coutant <ccoutant@google.com>
4764 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4765 position-independent executables to shared libraries need dynamic
4767 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4768 position-independent executables.
4769 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4770 * testsuite/Makefile.in: Regenerate.
4772 2010-09-10 Nick Clifton <nickc@redhat.com>
4775 * testsuite/memory_test.t: Discard any sections that are not
4778 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4781 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4782 "This::" to work around a bug in gcc 4.2.
4784 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4786 2010-09-09 Rafael Espindola <espindola@google.com>
4788 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4789 sections with different PF_X flags in the same segment.
4790 (Layout::find_first_load_seg): Search all segments to find the first
4792 * options.h (rosegment): New.
4794 2010-09-08 Rafael Espindola <espindola@google.com>
4796 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4798 2010-09-08 Doug Kwan <dougkwan@google.com>
4800 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4801 (Arm_relobj::do_relocate_sections): Add new parameter for output
4802 file to match the parent.
4803 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4804 of local symbols instead of input values. Update code to track
4805 changes in gold::relocate_section.
4806 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4807 (Sized_relobj::compute_final_local_value_internal): New methods.
4808 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4809 body into private version of Sized_relobj::compute_final_local_value.
4810 Call the inline method.
4811 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4812 merged symbol value if there is one.
4813 (Symbol_value::has_output_value): New method defintiion.
4814 (Sized_relobj::Compute_final_local_value_status): New enum type.
4815 (Sized_relobj::compute_final_local_value): New methods.
4816 (Sized_relobj::compute_final_local_value_internal): New methods.
4817 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4818 and arm_cortex_a8.sh.
4819 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4820 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4822 * Makefile.in: Regenerate.
4823 * testsuite/arm_bl_out_of_range.s: Update test.
4824 * testsuite/thumb_bl_out_of_range.s: Ditto.
4825 * testsuite/thumb_blx_out_of_range.s: Ditto.
4826 * testsuite/arm_branch_out_of_range.sh: New file.
4827 * testsuite/arm_cortex_a8.sh: Ditto.
4828 * testsuite/arm_cortex_a8_b.s: Ditto.
4829 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4830 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4831 * testsuite/arm_cortex_a8_bl.s: Ditto.
4832 * testsuite/arm_cortex_a8_blx.s: Ditto.
4833 * testsuite/arm_cortex_a8_local.s: Ditto.
4834 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4835 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4837 2010-09-08 Rafael Espindola <espindola@google.com>
4839 * Makefile.am (memory_test.stdout): Run readelf with -W.
4840 * Makefile.in: Regenerate.
4841 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4844 2010-09-08 Rafael Espindola <espindola@google.com>
4846 * script-sections.cc (Script_sections::add_memory_region): Convert
4847 field precision to int.
4848 * script.cc (script_set_section_region, script_set_section_region):
4849 Convert field precision to int.
4851 2010-09-08 Rafael Espindola <espindola@google.com>
4853 * arm.cc (do_finalize_sections): Create the __exidx_start and
4854 __exdix_end symbols even when the section is missing.
4856 2010-09-08 Nick Clifton <nickc@redhat.com>
4858 * README: Remove claim that MEMORY is not supported.
4859 * expression.cc (script_exp_function_origin)
4860 (script_exp_function_length): Move from here to ...
4861 * script.cc: ... here.
4862 (script_set_section_region, script_add_memory)
4863 (script_parse_memory_attr, script_include_directive): New
4865 * script-sections.cc
4866 (class Memory_region): New class.
4867 (class Output_section_definition): Add set_memory_region,
4868 set_section_vma, set_section_lma and get_section_name methods.
4869 (class Script_Sections): Add add_memory_region,
4870 find_memory_region, find_memory_region_origin,
4871 find_memory_region_length and set_memory_region methods.
4872 Have set_section_addresses method walk the list of set memory
4874 Extend the print methos to display memory regions.
4875 * script-sections.h: Add prototypes for new methods.
4876 Add enum for MEMORY region attributes.
4877 * yyscript.y: Add support for parsing MEMORY regions.
4878 * script-c.h: Add prototypes for new functions.
4879 * testsuite/Makefile.am: Add test of MEMORY region functionality.
4880 * testsuite/Makefile.in: Regenerate.
4881 * testsuite/memory_test.sh: New script.
4882 * testsuite/memory_test.s: New assembler source file.
4883 * testsuite/memory_test.t: New linker script.
4885 2010-08-27 Doug Kwan <dougkwan@google.com>
4887 * gold/resolve.cc (Symbol_table::should_override): Let a weak
4888 reference override an existing dynamic weak reference.
4889 * testsuite/Makefile.am: Add new test dyn_weak_ref.
4890 * testsuite/Makefile.in: Regenerate.
4891 * testsuite/dyn_weak_ref.sh: New file.
4892 * testsuite/dyn_weak_ref_1.c: Ditto.
4893 * testsuite/dyn_weak_ref_2.c: Ditto.
4895 2010-08-27 Ian Lance Taylor <iant@google.com>
4897 * incremental.h (class Incremental_input_entry): Add virtual
4900 2010-08-27 Ian Lance Taylor <iant@google.com>
4902 * testsuite/start_lib_test_3.c: Mark t3 as used.
4904 2010-08-27 Nick Clifton <nickc@redhat.com>
4906 * options.cc (version_script): Fix small typo in previous
4909 2010-08-25 Nick Clifton <nickc@redhat.com>
4911 * archive.cc: Formatting fixes: Remove whitespace between
4912 typename and following asterisk. Remove whitespace between
4913 function name and opening parenthesis.
4914 * archive.h: Likewise.
4916 * attributes.cc: Likewise.
4917 * attributes.h: Likewise.
4918 * common.cc: Likewise.
4919 * copy-relocs.cc: Likewise.
4920 * dirsearch.h: Likewise.
4921 * dynobj.cc: Likewise.
4922 * ehframe.cc: Likewise.
4923 * ehframe.h: Likewise.
4924 * expression.cc: Likewise.
4925 * fileread.cc: Likewise.
4926 * fileread.h: Likewise.
4928 * gold-threads.cc: Likewise.
4929 * gold.cc: Likewise.
4930 * i386.cc: Likewise.
4932 * incremental-dump.cc: Likewise.
4933 * incremental.cc: Likewise.
4934 * layout.cc: Likewise.
4935 * layout.h: Likewise.
4936 * main.cc: Likewise.
4937 * merge.cc: Likewise.
4938 * merge.h: Likewise.
4939 * object.cc: Likewise.
4940 * object.h: Likewise.
4941 * options.cc: Likewise.
4942 * options.h: Likewise.
4943 * output.cc: Likewise.
4944 * output.h: Likewise.
4945 * plugin.cc: Likewise.
4946 * plugin.h: Likewise.
4947 * powerpc.cc: Likewise.
4948 * reloc.cc: Likewise.
4949 * script-c.h: Likewise.
4950 * script-sections.cc: Likewise.
4951 * script.cc: Likewise.
4952 * stringpool.cc: Likewise.
4953 * symtab.cc: Likewise.
4954 * symtab.h: Likewise.
4955 * target.cc: Likewise.
4956 * timer.cc: Likewise.
4957 * timer.h: Likewise.
4958 * version.cc: Likewise.
4959 * x86_64.cc: Likewise.
4961 2010-08-24 Nick Clifton <nickc@redhat.com>
4964 * layout.cc (segment_precedes): Sort segments by their physical
4965 addresses, if they have been set.
4967 2010-08-23 Cary Coutant <ccoutant@google.com>
4969 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4971 (Lib_group::include_member): Unlock object after deleting its
4973 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4976 2010-08-19 Neil Vachharajani <nvachhar@google.com>
4977 Cary Coutant <ccoutant@google.com>
4979 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4980 constructor, and set_blocker.
4981 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4983 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4984 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4985 * testsuite/Makefile.am (start_lib_test): New test case.
4986 * testsuite/Makefile.in: Regenerate.
4987 * testsuite/start_lib_test_main.c: New file.
4988 * testsuite/start_lib_test_1.c: New file.
4989 * testsuite/start_lib_test_2.c: New file.
4990 * testsuite/start_lib_test_3.c: New file.
4992 2010-08-19 Ian Lance Taylor <iant@google.com>
4994 * Makefile.in: Rebuild with automake 1.11.1.
4995 * aclocal.m4: Likewise.
4996 * testsuite/Makefile.in: Likewise.
4998 2010-08-19 Ian Lance Taylor <iant@google.com>
5001 * i386.cc (class Output_data_plt_i386): Update declarations.
5002 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
5003 local_ifuncs_ fields.
5004 (Target_i386::do_plt_section_for_global): New function.
5005 (Target_i386::do_plt_section_for_local): New function.
5006 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5007 parameter; change all callers. Initialize global_ifuncs_ and
5008 local_ifuncs_. If doing a static link define __rel_iplt_start and
5010 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5011 (Output_data_plt_i386::add_local_ifunc_entry): New function.
5012 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5014 (Target_i386::make_plt_section): New function, broken out of
5015 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
5016 (Target_i386::make_plt_entry): Call make_plt_section.
5017 (Target_i386::make_local_ifunc_plt_entry): New function.
5018 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5019 (Target_i386::Scan::local): Handle IFUNC symbols. Add
5020 R_386_IRELATIVE to switch.
5021 (Target_i386::Scan::global): Likewise.
5022 (Target_i386::Relocate::relocate): Likewise.
5023 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5025 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5026 (Target_x86_64::do_plt_section_for_global): New function.
5027 (Target_x86_64::do_plt_section_for_local): New function.
5028 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5029 parameter; change all callers. If doing a static link define
5030 __rela_iplt_start and __rela_iplt_end.
5031 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5032 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5033 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5035 (Target_x86_64::make_local_ifunc_plt_entry): New function.
5036 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5038 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5039 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
5040 R_X86_64_IRELATIVE to switch.
5041 (Target_x86_64::Scan::global): Likewise.
5042 (Target_x86_64::Relocate::relocate): Likewise.
5043 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5045 * target.h (class Target): Add plt_section_for_global and
5046 plt_section_for_local functions. Add do_plt_section_for_global
5047 and do_plt_section_for_local virtual functions.
5048 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
5049 clarifying comments.
5050 (Symbol::use_plt_offset): Handle IFUNC symbol.
5051 * object.cc (Sized_relobj::Sized_relobj): Initialize
5053 (Sized_relobj::local_has_plt_offset): New function.
5054 (Sized_relobj::local_plt_offset): New function.
5055 (Sized_relobj::set_local_plt_offset): New function.
5056 (Sized_relobj::do_count): Handle IFUNC symbol.
5057 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
5058 a bit away from input_shndx_ field. Add set_is_func_symbol and
5059 is_ifunc_symbol functions.
5060 (class Sized_relobj): Update declarations. Remove Tls_got_entry
5061 and Local_tls_got_offsets. Define Local_plt_offsets. Add
5062 local_plt_offsets_ field.
5063 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5064 * output.h (class Output_section_data): Add non-const
5065 output_section function.
5066 (class Output_data_got): Update declarations.
5067 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5068 Add use_plt_offset parameter to global and local constructors.
5069 Change all callers. Change local_sym_index_ field to 31 bits.
5070 Change GSYM_CODE and CONSTANT_CODE accordingly.
5071 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5072 doing a static link don't set sh_link field.
5073 (Output_data_got::Got_entry::write): Use PLT offset if
5075 (Output_data_got::add_global_plt): New function.
5076 (Output_data_got::add_local_plt): New function.
5077 * target-reloc.h (relocate_section): Handle IFUNC symbol.
5078 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5079 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5080 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5081 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5083 * testsuite/ifunc-sel.h: New file.
5084 * testsuite/ifuncmain1.c: New file.
5085 * testsuite/ifuncmain1vis.c: New file.
5086 * testsuite/ifuncmod1.c: New file.
5087 * testsuite/ifuncdep2.c: New file.
5088 * testsuite/ifuncmain2.c: New file.
5089 * testsuite/ifuncmain3.c: New file.
5090 * testsuite/ifuncmod3.c: New file.
5091 * testsuite/ifuncmain4.c: New file.
5092 * testsuite/ifuncmain5.c: New file.
5093 * testsuite/ifuncmod5.c: New file.
5094 * testsuite/ifuncmain6pie.c: New file.
5095 * testsuite/ifuncmod6.c: New file.
5096 * testsuite/ifuncmain7.c: New file.
5097 * configure, testsuite/Makefile.in: Rebuild.
5099 2010-08-18 Ian Lance Taylor <iant@google.com>
5102 (Output_section_incremental_inputs::write_input_files): Add cast
5103 to avoid signed/unsigned comparison warning.
5104 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5106 2010-08-12 Cary Coutant <ccoutant@google.com>
5108 * common.cc (Sort_commons::operator()): Remove unnecessary code.
5110 2010-08-13 Ian Lance Taylor <iant@google.com>
5112 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5114 2010-08-12 Cary Coutant <ccoutant@google.com>
5115 Doug Kwan <dougkwan@google.com>
5117 * resolve.cc (Symbol_table::should_override): When a weak dynamic
5118 defintion overrides non-weak undef, remember that the original undef
5120 * symtab.cc (Symbol_table::sized_write_global): For undef without
5121 an original weak binding, set binding to global in output.
5122 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5123 * testsuite/Makefile.in: Regenerate.
5124 * testsuite/strong_ref_weak_def.sh: New file.
5125 * testsuite/strong_ref_weak_def_1.c: Ditto.
5126 * testsuite/strong_ref_weak_def_2.c: Ditto.
5128 2010-08-12 Cary Coutant <ccoutant@google.com>
5130 * testsuite/incremental_test.sh: Rewrite.
5131 * testsuite/incremental_test_1.c: Rewrite.
5132 * testsuite/incremental_test_2.c: Rewrite.
5134 2010-08-12 Cary Coutant <ccoutant@google.com>
5136 * arm.cc (Target_arm::got_size): Add const.
5137 (Target_arm::got_entry_count): New function.
5138 (Target_arm::plt_entry_count): New function.
5139 (Target_arm::first_plt_entry_offset): New function.
5140 (Target_arm::plt_entry_size): New function.
5141 (Output_data_plt_arm::entry_count): New function.
5142 (Output_data_plt_arm::first_plt_entry_offset): New function.
5143 (Output_data_plt_arm::get_plt_entry_size): New function.
5144 * i386.cc (Target_i386::got_size): Add const.
5145 (Target_i386::got_entry_count): New function.
5146 (Target_i386::plt_entry_count): New function.
5147 (Target_i386::first_plt_entry_offset): New function.
5148 (Target_i386::plt_entry_size): New function.
5149 (Output_data_plt_i386::entry_count): New function.
5150 (Output_data_plt_i386::first_plt_entry_offset): New function.
5151 (Output_data_plt_i386::get_plt_entry_size): New function.
5152 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5153 find_incremental_inputs_sections. Dump incremental_got_plt section.
5154 * incremental.cc: Include target.h.
5155 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5156 parameter. Adjust all callers. Find incremental_got_plt section.
5157 (Incremental_inputs::create_data_sections): Create incremental_got_plt
5159 (Output_section_incremental_inputs::set_final_data_size): Calculate
5160 size of incremental_got_plt section.
5161 (Output_section_incremental_inputs::do_write): Write the
5162 incremental_got_plt section.
5163 (Got_plt_view_info): New struct.
5164 (Local_got_offset_visitor): New class.
5165 (Global_got_offset_visitor): New class.
5166 (Global_symbol_visitor_got_plt): New class.
5167 (Output_section_incremental_inputs::write_got_plt): New function.
5168 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5169 Add parameter. Adjust all callers.
5170 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5171 (Incremental_inputs::got_plt_section): New function.
5172 (Incremental_inputs::got_plt_section_): New data member.
5173 (Incremental_got_plt_reader): New class.
5174 * layout.cc (Layout::create_incremental_info_sections): Add the
5175 incremental_got_plt section.
5176 * object.h (Got_offset_list::get_list): New function.
5177 (Got offset_list::for_all_got_offsets): New function.
5178 (Sized_relobj::local_got_offset_list): New function.
5179 * powerpc.cc (Target_powerpc::got_size): Add const.
5180 (Target_powerpc::got_entry_count): New function.
5181 (Target_powerpc::plt_entry_count): New function.
5182 (Target_powerpc::first_plt_entry_offset): New function.
5183 (Target_powerpc::plt_entry_size): New function.
5184 (Output_data_plt_powerpc::entry_count): New function.
5185 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5186 (Output_data_plt_powerpc::get_plt_entry_size): New function.
5187 * sparc.cc (Target_sparc::got_size): Add const.
5188 (Target_sparc::got_entry_count): New function.
5189 (Target_sparc::plt_entry_count): New function.
5190 (Target_sparc::first_plt_entry_offset): New function.
5191 (Target_sparc::plt_entry_size): New function.
5192 (Output_data_plt_sparc::entry_count): New function.
5193 (Output_data_plt_sparc::first_plt_entry_offset): New function.
5194 (Output_data_plt_sparc::get_plt_entry_size): New function.
5195 * symtab.h (Symbol::got_offset_list): New function.
5196 (Symbol_table::for_all_symbols): New function.
5197 * target.h (Sized_target::got_entry_count): New function.
5198 (Sized_target::plt_entry_count): New function.
5199 (Sized_target::plt_entry_size): New function.
5200 * x86_64.cc (Target_x86_64::got_size): Add const.
5201 (Target_x86_64::got_entry_count): New function.
5202 (Target_x86_64::plt_entry_count): New function.
5203 (Target_x86_64::first_plt_entry_offset): New function.
5204 (Target_x86_64::plt_entry_size): New function.
5205 (Output_data_plt_x86_64::entry_count): New function.
5206 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5207 (Output_data_plt_x86_64::get_plt_entry_size): New function.
5209 2010-08-12 Cary Coutant <ccoutant@google.com>
5211 * archive.cc: Include incremental.h.
5212 (Archive::Archive): Initialize incremental_info_.
5213 (Archive::include_member): Record archive members in incremental info.
5214 (Add_archive_symbols::run): Record begin and end of an archive in
5216 (Lib_group::include_member): Record objects in incremental info.
5217 * archive.h (Incremental_archive_entry): Forward declaration.
5218 (Archive::set_incremental_info): New member function.
5219 (Archive::incremental_info): New member function.
5220 (Archive::Unused_symbol_iterator): New class.
5221 (Archive::unused_symbols_begin): New member function.
5222 (Archive::unused_symbols_end): New member function.
5223 (Archive::incremental_info_): New data member.
5224 * incremental-dump.cc (find_input_containing_global): New function.
5225 (dump_incremental_inputs): Dump new incremental info sections.
5226 * incremental.cc: Include symtab.h.
5227 (Output_section_incremental_inputs): New class.
5228 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5229 new incremental info sections.
5230 (Sized_incremental_binary::do_check_inputs): Likewise.
5231 (Incremental_inputs::report_archive): Remove.
5232 (Incremental_inputs::report_archive_begin): New function.
5233 (Incremental_inputs::report_archive_end): New function.
5234 (Incremental_inputs::report_object): New function.
5235 (Incremental_inputs::finalize_inputs): Remove.
5236 (Incremental_inputs::report_input_section): New function.
5237 (Incremental_inputs::report_script): Rewrite.
5238 (Incremental_inputs::finalize): Do nothing but finalize string table.
5239 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5240 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5241 (Incremental_inputs::create_data_sections): New function.
5242 (Incremental_inputs::relocs_entsize): New function.
5243 (Output_section_incremental_inputs::set_final_data_size): New function.
5244 (Output_section_incremental_inputs::do_write): New function.
5245 (Output_section_incremental_inputs::write_header): New function.
5246 (Output_section_incremental_inputs::write_input_files): New function.
5247 (Output_section_incremental_inputs::write_info_blocks): New function.
5248 (Output_section_incremental_inputs::write_symtab): New function.
5249 * incremental.h (Incremental_script_entry): Forward declaration.
5250 (Incremental_object_entry): Forward declaration.
5251 (Incremental_archive_entry): Forward declaration.
5252 (Incremental_inputs): Forward declaration.
5253 (Incremental_inputs_header_data): Remove.
5254 (Incremental_inputs_header): Remove.
5255 (Incremental_inputs_header_write): Remove.
5256 (Incremental_inputs_entry_data): Remove.
5257 (Incremental_inputs_entry): Remove.
5258 (Incremental_inputs_entry_write): Remove.
5259 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5260 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5261 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5262 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5264 (Incremental_input_entry): New class.
5265 (Incremental_script_entry): New class.
5266 (Incremental_object_entry): New class.
5267 (Incremental_archive_entry): New class.
5268 (Incremental_inputs::Incremental_inputs): Initialize new data members.
5269 (Incremental_inputs::report_inputs): Remove.
5270 (Incremental_inputs::report_archive): Remove.
5271 (Incremental_inputs::report_archive_begin): New function.
5272 (Incremental_inputs::report_archive_end): New function.
5273 (Incremental_inputs::report_object): Change prototype.
5274 (Incremental_inputs::report_input_section): New function.
5275 (Incremental_inputs::report_script): Change prototype.
5276 (Incremental_inputs::get_reloc_count): New function.
5277 (Incremental_inputs::set_reloc_count): New function.
5278 (Incremental_inputs::create_data_sections): New function.
5279 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5280 (Incremental_inputs::inputs_section): New function.
5281 (Incremental_inputs::symtab_section): New function.
5282 (Incremental_inputs::relocs_section): New function.
5283 (Incremental_inputs::get_stringpool): Add const.
5284 (Incremental_inputs::command_line): Add const.
5285 (Incremental_inputs::inputs): Remove.
5286 (Incremental_inputs::command_line_key): New function.
5287 (Incremental_inputs::input_file_count): New function.
5288 (Incremental_inputs::input_files): New function.
5289 (Incremental_inputs::relocs_entsize): New function.
5290 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5291 (Incremental_inputs::finalize_inputs): Remove.
5292 (Incremental_inputs::Input_info): Remove.
5293 (Incremental_inputs::lock_): Remove.
5294 (Incremental_inputs::inputs_): Change type.
5295 (Incremental_inputs::inputs_map_): Remove.
5296 (Incremental_inputs::current_object_entry_): New data member.
5297 (Incremental_inputs::inputs_section_): New data member.
5298 (Incremental_inputs::symtab_section_): New data member.
5299 (Incremental_inputs::relocs_section_): New data member.
5300 (Incremental_inputs::reloc_count_): New data member.
5301 (Incremental_inputs_reader): New class.
5302 (Incremental_symtab_reader): New class.
5303 (Incremental_relocs_reader): New class.
5304 * layout.cc (Layout::finalize): Move finalization of incremental info
5305 and creation of incremental info sections to follow finalization of
5306 symbol table. Set offsets for postprocessing sections.
5307 (Layout::create_incremental_info_sections): Call
5308 Incremental_inputs::create_data_sections. Add incremental symtab
5309 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
5310 sections to layout after input sections.
5311 * layout.h (struct Timespec): Forward declaration.
5312 (Layout::incremental_inputs): Add const.
5313 (Layout::create_incremental_info_sections): Add parameter.
5314 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5315 * object.cc: Include incremental.h.
5316 (Relobj::finalize_incremental_relocs): New function.
5317 (Sized_relobj::do_layout): Record input sections in incremental info.
5318 * object.h (Object::output_section): New function.
5319 (Object::output_section_offset): Moved from Relobj.
5320 (Object::get_incremental_reloc_base): New function.
5321 (Object::get_incremental_reloc_count): New function.
5322 (Object::do_output_section): New function.
5323 (Object::do_output_section_offset): Moved from Relobj.
5324 (Object::do_get_incremental_reloc_base): New function.
5325 (Object::do_get_incremental_reloc_count): New function.
5326 (Object::Object): Initialize new data members.
5327 (Relobj::output_section): Renamed do_output_section and moved to
5329 (Relobj::output_section_offset): Moved to Object.
5330 (Relobj::do_get_incremental_reloc_base): New function.
5331 (Relobj::do_get_incremental_reloc_count): New function.
5332 (Relobj::allocate_incremental_reloc_counts): New function.
5333 (Relobj::count_incremental_reloc): New function.
5334 (Relobj::finalize_incremental_relocs): New function.
5335 (Relobj::next_incremental_reloc_index): New function.
5336 (Relobj::reloc_counts_): New data member.
5337 (Relobj::reloc_bases_): New data member.
5338 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
5339 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
5340 (Sized_relobj::incremental_relocs_scan): New function.
5341 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5342 (Sized_relobj::incremental_relocs_write): New function.
5343 (Sized_relobj::incremental_relocs_write_reltype): New function.
5344 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5346 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5347 archives and object files elsewhere.
5348 (Add_symbols::run): Report object files here.
5349 (Finish_group::run): Report end of archive at end of group.
5350 * reloc.cc: Include layout.h, incremental.h.
5351 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5352 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5353 (Sized_relobj::incremental_relocs_scan): New function.
5354 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5355 (Sized_relobj::do_relocate_sections): Write incremental relocations.
5356 (Sized_relobj::incremental_relocs_write): New function.
5357 (Sized_relobj::incremental_relocs_write_reltype): New function.
5358 * script.cc (read_input_script): Rewrite test for incremental link.
5359 Change call to Incremental_inputs::report_script.
5360 * symtab.h (Symbol_table::first_global_index): New function.
5361 (Symbol_table::output_count): New function.
5363 2010-08-12 Doug Kwan <dougkwan@google.com>
5365 * arm.cc (Target_arm::merge_object_attributes): Check command line
5366 options --no-wchar-size-warning and --no-enum-size-warning.
5367 * options.h (General_options): Add ld-compatible options
5368 --no-enum-size-warning and --no-wchar-size-warning.
5370 2010-08-04 Ian Lance Taylor <iant@google.com>
5372 * x86_64.cc (Target_x86_64::Scan::local): Use
5373 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5374 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5375 (Target_x86_64::Scan::global): Likewise.
5376 (Target_x86_64::Relocate::relocate): Likewise.
5377 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5380 2010-08-03 Cary Coutant <ccoutant@google.com>
5382 * merge.cc (Output_merge_string::do_add_input_section): Count strings
5383 to reserve space in merged_strings vector. Keep total input size
5385 (Output_merge_string::do_print_merge_stats): Print total input size.
5386 * merge.h (Output_merge_string): Add input_size_ field.
5387 * stringpool.cc (Stringpool_template::string_length): Move
5388 implementations out of Stringpool_template class and place in
5390 * stringpool.h (string_length): Move out of Stringpool_template.
5392 2010-08-03 Ian Lance Taylor <iant@google.com>
5395 * layout.cc (relaxation_loop_body): If address of load segment is
5396 set, adjust address to include headers if possible.
5398 2010-08-03 Ian Lance Taylor <iant@google.com>
5400 * version.cc (version_string): Bump to 1.10.
5402 2010-08-03 Ian Lance Taylor <iant@google.com>
5405 * layout.h (enum Output_section_order): Define.
5406 (class Layout): Update declarations.
5407 * layout.cc (Layout::get_output_section): Add order parameter.
5408 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5409 is_first_non_relro parameters. Change all callers.
5410 (Layout::choose_output_section): Likewise.
5411 (Layout::add_output_section_data): Likewise.
5412 (Layout::make_output_section): Likewise. Set order.
5413 (Layout::default_section_order): New function.
5414 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5415 * output.cc (Output_section::Output_section): Initialize order_.
5416 Don't initialize deleted fields.
5417 (Output_segment::Output_segment): Don't initialize deleted
5419 (Output_segment::add_output_section_to_load): New function
5420 replacing add_output_section. Change all callers to call this or
5421 add_output_section_to_nonload.
5422 (Output_segment::add_output_section_to_nonload): New function.
5423 (Output_segment::remove_output_section): Rewrite.
5424 (Output_segment::add_initial_output_data): Likewise.
5425 (Output_segment::has_any_data_sections): Likewise.
5426 (Output_segment::is_first_section_relro): Likewise.
5427 (Output_segment::maximum_alignment): Likewise.
5428 (Output_segment::has_dynamic_reloc): New function replacing
5429 dynamic_reloc_count. Change all callers.
5430 (Output_segment::has_dynamic_reloc_list): New function replacing
5431 dynamic_reloc_count_list. Change all callers.
5432 (Output_segment::set_section_addresses): Rewrite.
5433 (Output_segment::set_offset): Rewrite.
5434 (Output_segment::find_first_and_last_list): Remove.
5435 (Output_segment::set_tls_offsets): Rewrite.
5436 (Output_segment::first_section_load_address): Likewise.
5437 (Output_segment::output_section_count): Likewise.
5438 (Output_segment::section_with_lowest_load_address): Likewise.
5439 (Output_segment::write_section_headers): Likewise.
5440 (Output_segment::print_sections_to_map): Likewise.
5441 * output.h (class Output_data): Remove dynamic_reloc_count_
5442 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
5443 (Output_data::add_dynamic_reloc): Rewrite.
5444 (Output_data::has_dynamic_reloc): New function.
5445 (Output_data::dynamic_reloc_count): Remove.
5446 (class Output_section): Add order_ field. Remvoe is_relro_local_,
5447 is_last_relro_, is_first_non_relro_, is_interp_,
5448 is_dynamic_linker_section_ fields. Add order and set_order
5449 functions. Remove is_relro_local, set_is_relro_local,
5450 is_last_relro, set_is_last_relro, is_first_non_relro,
5451 set_is_first_non_relro functions, is_interp, set_is_interp,
5452 is_dynamic_linker_section, and set_is_dynamic_linker_section
5454 (class Output_segment): Change Output_data_list from std::list to
5455 std:;vector. Add output_lists_ field. Remove output_data_ and
5456 output_bss_ fields. Update declarations.
5458 2010-08-02 Ian Lance Taylor <iant@google.com>
5460 * arm.cc (Target_arm::gc_process_relocs): Use typename.
5461 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5462 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5464 2010-08-02 Ian Lance Taylor <iant@google.com>
5467 * script.cc (Script_options::Script_options): Initialize
5468 symbol_definitions_ and symbol_references_.
5469 (Script_options::add_symbol_assignment): Update
5470 symbol_definitions_ and symbol_references_.
5471 (Script_options::add_symbol_reference): New function.
5472 (script_symbol): New function.
5473 * script.h (class Script_options): Add symbol_definitions_ and
5474 symbol_references_ fields.
5475 (Script_options::referenced_const_iterator): New type.
5476 (Script_options::referenced_begin): New function.
5477 (Script_options::referenced_end): New function.
5478 (Script_options::is_referenced): New function.
5479 (Script_options::any_unreferenced): New function.
5480 * script-c.h (script_symbol): Declare.
5481 * yyscript.y (exp): Call script_symbol.
5482 * symtab.cc: Include "script.h".
5483 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5484 Change all callers. Check symbols referenced by scripts.
5485 (Symbol_table::add_undefined_symbols_from_command_line): Add
5486 layout parameter. Change all callers.
5487 (Symbol_table::do_add_undefined_symbols_from_command_line):
5488 Likewise. Break out loop body. Check symbols referenced by
5490 (Symbol_table::add_undefined_symbol_from_command_line): New
5491 function broken out of
5492 do_add_undefined_symbols_from_command_line.
5493 * symtab.h (class Symbol_table): Update declarations.
5494 * archive.cc: Include "layout.h".
5495 (Archive::should_include_member): Add layout parameter. Change
5496 all callers. Check for symbol mentioned in expression.
5497 * archive.h (class Archive): Update declaration.
5498 * object.cc (Sized_relobj::do_should_include_member): Add layout
5500 * object.h (Object::should_include_member): Add layout parameter.
5502 (Object::do_should_include_member): Add layout parameter.
5503 (class Sized_relobj): Update declaration.
5504 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5506 * dynobj.h (class Sized_dynobj): Update declaration.
5507 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5509 * plugin.h (class Sized_pluginobj): Update declaration.
5511 2010-08-02 Ian Lance Taylor <iant@google.com>
5514 * output.cc (Output_segment::set_offset): Search for the first and
5515 last sections rather than assuming that the list is in order.
5516 (Output_segment::find_first_and_last_list): New function.
5517 * output.h (class Output_segment): Update declarations.
5518 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5519 (relro_strip_test_SOURCES): New variable.
5520 (relro_strip_test_DEPENDENCIES): New variable.
5521 (relro_strip_test_LDFLAGS): New variable.
5522 (relro_strip_test_LDADD): New variable.
5523 (relro_strip_test.so): New target.
5525 2010-08-02 Ian Lance Taylor <iant@google.com>
5527 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5528 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5529 (Target_i386::got_tlsdesc_section): New function.
5530 (Target_i386::got_section): Create space for GOT entries for
5531 TLSDESC relocations.
5532 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5534 (Target_i386::Scan::global): Likewise.
5535 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5537 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5538 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5539 (Target_x86_64::got_tlsdesc_section): New function.
5540 (Target_x86_64::got_section): Create space for GOT entries for
5541 TLSDESC relocations.
5542 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5544 (Target_x86_64::Scan::global): Likewise.
5545 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5548 2010-08-02 Ian Lance Taylor <iant@google.com>
5550 * testsuite/final_layout.sh: Use dc to convert from hex to
5553 2010-07-29 Sriraman Tallam <tmsriram@google.com>
5555 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5556 paramter to the call to gold::gc_process_relocs.
5557 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5558 paramter to the call to gold::gc_process_relocs.
5559 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5560 parameter to the call to gold::gc_process_relocs.
5561 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5562 template parameter to the call to gold::gc_process_relocs.
5563 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5564 paramter to the call to gold::gc_process_relocs.
5565 * gc.h (get_embedded_addend_size): New function.
5566 (gc_process_relocs): Save the size of the reloc for use by ICF.
5567 * icf.cc (get_section_contents): Get the addend from the text section
5568 for SHT_REL relocation sections.
5569 * icf.h (Icf::Reloc_addend_size_info): New typedef.
5570 (Icf::Reloc_info): Add new member reloc_addend_size_info.
5571 * int_encoding.h (read_from_pointer): New overloaded function.
5572 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5573 * testsuite/icf_sht_rel_addend_test.sh: New file.
5574 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5575 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5577 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5579 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5580 * Makefile.in: Regenerate.
5581 * testsuite/Makefile.in: Regenerate.
5583 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
5585 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5586 * gold/testsuite/debug_msg.cc: Likewise.
5587 * gold/testsuite/odr_violation1.cc
5588 * gold/testsuite/odr_violation2.cc
5590 2010-07-21 Cary Coutant <ccoutant@google.com>
5592 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5593 string, and length fields.
5594 (Output_merge_string::Merged_strings_list): New type.
5595 (Output_merge_string::Merged_strings_lists): New typedef.
5596 (Output_merge_string): Replace merged_strings_ with
5597 merged_strings_lists_.
5598 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5599 Merged_strings_list per input object and section. Don't store pointer
5600 to the string. Don't store length with each merged string entry.
5601 (Output_merge_string::finalize_merged_data): Loop over list of merged
5602 strings lists. Recompute length of each merged string.
5604 2010-07-15 Cary Coutant <ccoutant@google.com>
5606 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5609 2010-07-14 Ian Lance Taylor <iant@google.com>
5611 * descriptors.cc (Descriptors::open): Report correct name in error
5614 2010-07-13 Doug Kwan <dougkwan@google.com>
5616 * arm.cc (Arm_input_section::Arm_input_section): For a
5617 SHT_ARM_EXIDX section, always keeps the input sections.
5618 (Arm_input_section::set_exidx_section_link): New method.
5619 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5620 has_errors_ to false.
5621 (Arm_exidx_input_section::has_errors,
5622 Arm_exidx_input_section::set_has_errors): New methods.
5623 (Arm_exidx_input_section::has_errors_): New data member.
5624 (Arm_relobj::get_exidx_shndx_list): New method.
5625 (Arm_output_section::append_text_sections_to_list): Do not skip
5626 section without SHF_EXECINSTR.
5627 (Arm_output_section::fix_exidx_coverage): Skip input sections with
5629 (Arm_relobj::make_exidx_input_section): Add new parameter for text
5630 section header. Make error messages more verbose. Check for
5631 a non-executable section linked to an EXIDX section.
5632 (Arm_relobj::do_read_symbols): Remove error checking, which has been
5633 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
5634 check that there is no deferred EXIDX section if we exit early.
5635 Instead of not making an EXIDX section in case of an error, make one
5636 and set the has_errors flag of it.
5637 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5638 in a relocatable link.
5639 (Target_arm::do_relax): Look for the EXIDX output section instead of
5640 assuming that it is called .ARM.exidx.
5641 (Target_arm::fix_exidx_coverage): Add a new parameter for input
5642 section list. Do not check for SHF_EXECINSTR section flags but
5643 skip any input section with errors.
5644 * output.cc (Output_section::Output_section): Initialize
5645 always_keeps_input_sections_ to false.
5646 (Output_section::add_input_section): Check for
5647 always_keeps_input_sections_.
5648 * output.h (Output_section::always_keeps_input_sections,
5649 Output_section::set_always_keeps_input_sections): New methods.
5650 (Output_section::always_keeps_input_sections): New data member.
5652 2010-07-13 Rafael Espindola <espindola@google.com>
5654 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5655 * fileread.h (Input_file): Add try_extra_search_path and find_file.
5657 2010-07-13 Philip Herron <herron.philip@googlemail.com>
5658 Ian Lance Taylor <iant@google.com>
5660 * output.h (Output_section_lookup_maps::add_merge_section):
5661 Correct check of whether value was inserted.
5662 (Output_section_lookup_maps::add_merge_input_section): Likewise.
5663 (Output_section_lookup_maps::add_relaxed_input_section):
5665 * arm.cc (Target_arm::got_section): Remove used local os.
5666 * i386.cc (Target_i386::got_section): Likewise.
5667 * x86_64.cc (Target_x86_64::got_section): Likewise.
5668 * sparc.cc (Target_sparc::got_section): Likewise.
5669 (Target_sparc::relocate): Remove unused local have_got_offset.
5670 * powerpc.cc (Target_powerpc::relocate): Likewise.
5672 2010-07-13 Ian Lance Taylor <iant@google.com>
5674 * compressed_output.cc (zlib_decompress): Fix signature in
5677 * archive.cc (Archive::include_member): Unlock an external member
5678 of a thin archive. Don't bother to delete an object we know is
5681 2010-07-12 Cary Coutant <ccoutant@google.com>
5683 * compressed_output.cc (zlib_decompress): New function.
5684 (get_uncompressed_size): New function.
5685 (decompress_input_section): New function.
5686 * compressed_output.h (get_uncompressed_size): New function.
5687 (decompress_input_section): New function.
5688 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5689 Handle compressed debug sections.
5690 * layout.cc (is_compressed_debug_section): New function.
5691 (Layout::output_section_name): Map compressed section names to
5693 * layout.h (is_compressed_debug_section): New function.
5694 (is_debug_info_section): Recognize compressed debug sections.
5695 * merge.cc: Include compressed_output.h.
5696 (Output_merge_data::do_add_input_section): Handle compressed
5698 (Output_merge_string::do_add_input_section): Handle compressed
5700 * object.cc: Include compressed_output.h.
5701 (Sized_relobj::Sized_relobj): Initialize new data members.
5702 (build_compressed_section_map): New function.
5703 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5704 * object.h (Object::section_is_compressed): New method.
5705 (Object::do_section_is_compressed): New method.
5706 (Sized_relobj::Compressed_section_map): New type.
5707 (Sized_relobj::do_section_is_compressed): New method.
5708 (Sized_relobj::compressed_sections_): New data member.
5709 * output.cc (Output_section::add_input_section): Handle compressed
5711 * reloc.cc: Include compressed_output.h.
5712 (Sized_relobj::write_sections): Handle compressed debug sections.
5714 2010-07-08 Cary Coutant <ccoutant@google.com>
5716 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5717 weak when resolving to a dynamic def.
5718 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5719 for weak undef/dynamic def cases. Adjust callers.
5720 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5721 undef_binding_weak_.
5722 (Symbol_table::sized_write_globals): Adjust symbol binding.
5723 (Symbol_table::sized_write_symbol): Add binding parameter.
5724 * symtab.h (Symbol::set_undef_binding): New method.
5725 (Symbol::is_undef_binding_weak): New method.
5726 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5727 (Symbol_table::should_override): Add new parameter.
5728 (Symbol_table::sized_write_symbol): Add new parameter.
5730 * testsuite/weak_undef_file1.cc: Add new test case.
5731 * testsuite/weak_undef_file2.cc: Fix header comment.
5732 * testsuite/weak_undef_test.cc: Add new test case.
5734 2010-06-29 Doug Kwan <dougkwan@google.com>
5736 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5737 Initialize USE_SYMBOL_.
5738 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5740 (Arm_reloc_property::uses_symbol_): New data member declaration.
5741 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5742 uses symbol value and symbol is undefined but not weakly undefined.
5744 2010-06-28 Rafael Espindola <espindola@google.com>
5746 * plugin.cc (Plugin::load): Use dlerror.
5748 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5750 * symtab.cc (detect_odr_violations): When reporting an ODR
5751 violation, report an object where the symbol is defined.
5753 2010-06-25 Doug Kwan <dougkwan@google.com>
5755 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5756 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5758 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5759 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5760 target hook to detect function points.
5761 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5762 * icf.h (Icf::check_section_for_function_pointers): Change type of
5763 parameter SECTION_NAME to const reference to std::string. Use
5764 target hook to determine if section may have unsafe pointers.
5765 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5768 2010-06-21 Rafael Espindola <espindola@google.com>
5770 * fileread.cc (Input_file::find_fie): New
5771 (Input_file::open): Use Input_file::find_fie.
5772 * fileread.h (Input_file::find_fie): New
5773 * plugin.cc (set_extra_library_path): New.
5774 (Plugin::load): Add set_extra_library_path to the transfer vector.
5775 (Plugin_manager::set_extra_library_path): New.
5776 (Plugin_manager::add_input_file): Use the extra search path if set.
5777 (set_extra_library_path(): New.
5778 * plugin.h (Plugin_manager): Add set_extra_library_path and
5781 2010-06-19 Cary Coutant <ccoutant@google.com>
5783 * layout.cc (gdb_sections): Add .debug_types.
5784 (lines_only_debug_sections): Likewise.
5786 2010-06-18 Rafael Espindola <espindola@google.com>
5788 * plugin.cc (add_input_file,add_input_library)
5789 (Plugin_manager::add_input_file): Make filename arguments const.
5790 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5793 2010-06-16 Doug Kwan <dougkwan@google.com>
5795 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5796 .ARM.attributes section if we have not merged any input
5797 attributes sections.
5799 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5801 * arm.cc: Allow combining objects with no EABI version
5804 2010-06-15 Rafael Espindola <espindola@google.com>
5806 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5808 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5810 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5811 (struct iovec): Correct !HAVE_READV definition.
5813 2010-06-10 Cary Coutant <ccoutant@google.com>
5815 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5816 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5818 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5821 * symtab.h (Symbol::is_placeholder): New member function.
5822 * target-reloc.h (relocate_section): Check for placeholder symbols.
5824 * testsuite/Makefile.am (plugin_test_8): New test.
5825 (plugin_test_9): New test.
5826 * testsuite/Makefile.in: Regenerate.
5828 2010-06-09 Nick Clifton <nickc@redhat.com>
5830 * yyscript.y (input_list_element): Allow strings prefixed with
5831 the '-' character. Treat these as libraries.
5832 * script.cc (script_add_library): New function. Adds a library
5833 specified by "-l<name>" found in an input script.
5834 * script-c.h: Add prototype for script_add_library.
5836 2010-06-07 Doug Kwan <dougkwan@google.com>
5838 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5839 Restrict stub-group size to be within long conditional branch
5840 range when working around cortex-A8 erratum.
5842 2010-06-07 Damien Diederen <dd@crosstwine.com>
5844 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5847 2010-06-03 Sriraman Tallam <tmsriram@google.com>
5851 (Output_section::Input_section_sort_entry::compare_section_ordering):
5852 Change to return non-zero correctly.
5853 (Output_section::Input_section_sort_section_order_index_compare
5854 ::operator()): Change to fix ambiguity in comparisons.
5856 2010-06-01 Sriraman Tallam <tmsriram@google.com>
5858 * gold.h (is_wildcard_string): New function.
5859 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5860 (Layout::layout_eh_frame): Ditto.
5861 (Layout::find_section_order_index): New method.
5862 (Layout::read_layout_from_file): New method.
5863 * layout.h (Layout::find_section_order_index): New method.
5864 (Layout::read_layout_from_file): New method.
5865 (Layout::input_section_position_): New private member.
5866 (Layout::input_section_glob_): New private member.
5867 * main.cc (main): Call read_layout_from_file here.
5868 * options.h (--section-ordering-file): New option.
5869 * output.cc (Output_section::input_section_order_specified_): New
5871 (Output_section::Output_section): Initialize new member.
5872 (Output_section::add_input_section): Add new parameter.
5873 Keep input sections when --section-ordering-file is used.
5874 (Output_section::set_final_data_size): Sort input sections when
5875 section ordering file is specified.
5876 (Output_section::Input_section_sort_entry): Add new parameter.
5878 (Output_section::Input_section_sort_entry::compare_section_ordering):
5880 (Output_section::Input_section_sort_compare::operator()): Change to
5881 consider section_order_index.
5882 (Output_section::Input_section_sort_init_fini_compare::operator()):
5883 Change to consider section_order_index.
5884 (Output_section::Input_section_sort_section_order_index_compare
5885 ::operator()): New method.
5886 (Output_section::sort_attached_input_sections): Change to sort
5887 according to section order when specified.
5888 (Output_section::add_input_section<32, true>): Add new parameter.
5889 (Output_section::add_input_section<64, true>): Add new parameter.
5890 (Output_section::add_input_section<32, false>): Add new parameter.
5891 (Output_section::add_input_section<64, false>): Add new parameter.
5892 * output.h (Output_section::add_input_section): Add new parameter.
5893 (Output_section::input_section_order_specified): New
5895 (Output_section::set_input_section_order_specified): New method.
5896 (Input_section::Input_section): Initialize section_order_index_.
5897 (Input_section::section_order_index): New method.
5898 (Input_section::set_section_order_index): New method.
5899 (Input_section::section_order_index_): New member.
5900 (Input_section::Input_section_sort_section_order_index_compare): New
5902 (Output_section::input_section_order_specified_): New member.
5903 * script-sections.cc (is_wildcard_string): Delete and move modified
5905 (Output_section_element_input::Output_section_element_input): Modify
5906 call to is_wildcard_string.
5907 (Output_section_element_input::Input_section_pattern
5908 ::Input_section_pattern): Ditto.
5909 (Output_section_element_input::Output_section_element_input): Ditto.
5910 * testsuite/Makefile.am (final_layout): New test case.
5911 * testsuite/Makefile.in: Regenerate.
5912 * testsuite/final_layout.cc: New file.
5913 * testsuite/final_layout.sh: New file.
5915 2010-06-01 Rafael Espindola <espindola@google.com>
5917 * plugin.cc (Plugin::load): Pass the output name to the plugin.
5919 2010-06-01 Rafael Espindola <espindola@google.com>
5921 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5922 visibility of symbols.
5924 2010-05-27 Doug Kwan <dougkwan@google.com>
5926 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5927 from start of output section instead of address for a local symbol
5928 in a merged or relaxed section when doing a relocatable link.
5930 2010-05-26 Rafael Espindola <espindola@google.com>
5933 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5934 adding sections the garbage collector removed.
5935 * gold/testsuite/Makefile.am: Add test.
5936 * gold/testsuite/Makefile.in: Regenerate.
5937 * gold/testsuite/plugin_test_7.sh: New.
5938 * gold/testsuite/plugin_test_7_1.c: New.
5939 * gold/testsuite/plugin_test_7_2.c: New.
5941 2010-05-26 Rafael Espindola <espindola@google.com>
5943 * script-sections.cc (Output_section_definition::set_section_addresses):
5944 Check for --section-start.
5946 2010-05-26 Doug Kwan <dougkwan@google.com>
5948 * arm.cc (Arm_scan_relocatable_relocs): New class.
5949 (Target_arm::relocate_special_relocatable): New method.
5950 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5951 (Arm_relocate_functions::thumb_branch_common): Same.
5952 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5953 instead of Default_scan_relocatable_relocs.
5954 * target-reloc.h (relocate_for_relocatable): Let target handle
5955 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5956 * target.h (Sized_target::relocate_special_relocatable): New method.
5958 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5960 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5962 2010-05-23 Doug Kwan <dougkwan@google.com>
5964 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5966 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5967 with a direct branch, not a conditional branch, to a stub.
5968 * merge.cc (Output_merge_base::record_input_section): New method
5970 (Output_merge_data::do_add_input_section): Record input section if
5971 keeps-input-sections flag is set.
5972 (Output_merge_string::do_add_input_section): Ditto.
5973 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5974 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5976 (Output_merge_base::keeps_input_sections,
5977 Output_merge_base::set_keeps_input_sections,
5978 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5980 (Output_merge_base::Input_sections): New type declaration.
5981 (Output_merge_base::input_sections_begin,
5982 Output_merge_base::input_sections_end,
5983 Output_merge_base::do_set_keeps_input_sections): New method definitions.
5984 (Output_merge_base::bool keeps_input_sections_,
5985 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5986 Output_merge_base::input_sections_): New data members.
5987 (Output_merge_data::do_set_keeps_input_sections): New method
5989 (Output_merge_string::do_set_keeps_input_sections): Ditto.
5990 * output.cc (Output_section::Input_section::relobj): Move method
5991 defintion from class declaration to here and handle merge sections.
5992 (Output_section::Input_section::shndx): Ditto.
5993 (Output_section::Output_section): Remove initializations of removed
5994 data members and initialize new data member LOOKUP_MAPS_.
5995 (Output_section::add_input_section): Set keeps-input-sections flag
5996 for a newly created merge output section as appropriate. Adjust code
5997 to use Output_section_lookup_maps class.
5998 (Output_section::add_relaxed_input_section): Adjst code for lookup
5999 maps code refactoring.
6000 (Output_section::add_merge_input_section): Add a new parameter
6001 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
6002 class. If adding input section to a newly created merge output
6003 section fails, remove the new merge section.
6004 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6005 Adjust code for use of the Output_section_lookup_maps class.
6006 (Output_section::find_merge_section): Ditto.
6007 (Output_section::build_lookup_maps): New method defintion.
6008 (Output_section::find_relaxed_input_section): Adjust code to use
6009 Output_section_lookup_maps class.
6010 (Output_section::get_input_sections): Export merge sections. Adjust
6011 code to use Output_section_lookup_maps class.
6012 (Output_section:::add_script_input_section): Adjust code to use
6013 Output_section_lookup_maps class. Update lookup maps for merge
6015 (Output_section::discard_states): Use Output_section_lookup_maps.
6016 (Output_section::restore_states): Same.
6017 * output.h (Merge_section_properties): Move class defintion out of
6019 (Output_section_lookup_maps): New class.
6020 (Output_section::Input_section::is_merge_section): New method
6022 (Output_section::Input_section::relobj): Move defintion out of class
6023 defintion. Declare method only.
6024 (Output_section::Input_section::shndx): Ditto.
6025 (Output_section::Input_section::output_merge_base): New method defintion.
6026 (Output_section::Input_section::u2_.pomb): New union field.
6027 (Output_section::Merge_section_by_properties_map,
6028 Output_section::Output_section_data_by_input_section_map,
6029 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6031 (Output_section::add_merge_input_section): Add new parameter
6032 KEEPS_INPUT_SECTIONS.
6033 (Output_section::build_lookup_maps): New method declaration.
6034 (Output_section::merge_section_map_,
6035 Output_section::merge_section_by_properties_map_,
6036 Output_section::relaxed_input_section_map_,
6037 Output_section::is_relaxed_input_section_map_valid_): Remove data
6039 (Output_section::lookup_maps_): New data member.
6041 2010-05-21 Doug Kwan <dougkwan@google.com>
6044 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6045 avoid a compilation error.
6047 2010-05-19 Rafael Espindola <espindola@google.com>
6049 * script-sections.cc (Output_section_definition::allocate_to_segment):
6050 Update the phdrs_list even when the output section is NULL.
6051 * testsuite/Makefile.am: Add test.
6052 * testsuite/Makefile.in: Regenerate.
6053 * testsuite/script_test_9.cc: New.
6054 * testsuite/script_test_9.sh: New.
6055 * testsuite/script_test_9.t: New.
6057 2010-05-19 Doug Kwan <dougkwan@google.com>
6059 * arm.cc (Arm_input_section::original_size): New method.
6060 (Arm_input_section::do_addralign): Add a cast.
6061 (Arm_input_section::do_output_offset): Remove static cast.
6062 (Arm_input_section::original_addralign,
6063 Arm_input_section::original_size_): Change type to uint32_t.
6064 (Arm_input_section::init): Add safe casts for section alignment
6066 (Arm_input_section::set_final_data_size): Do not set address and
6067 offset of stub table.
6068 (Arm_output_section::fix_exidx_coverage): Change use of of
6069 Output_section::Simple_input_section to that of
6070 Output_section::Input_section.
6071 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6072 except for the first pass.
6073 * output.cc (Output_section::get_input_sections): Change type of
6074 input_sections to std::list<Input_section>.
6075 (Output_section::add_script_input_section): Rename from
6076 Output_section::add_simple_input_section. Change type of SIS
6077 parameter from Simple_input_section to Input_section.
6078 * output.h (Output_section::Simple_input_section): Remove class.
6079 (Output_section::Input_section): Change class visibility to public.
6080 (Output_section::Input_section::addralign): Use stored alignments
6081 for special input sections if set.
6082 (Output_section::Input_section::set_addralign): New method.
6083 (Output_section::get_input_sections): Change parameter type from
6084 list of Simple_input_section to list of Input_section.
6085 (Output_section::add_script_input_section): Rename from
6086 Output_section::add_simple_input_section. Change first parameter's
6087 type from Simple_input_section to Input_section and remove the
6088 second and third parameters.
6089 * script-sections.cc (Input_section::Input_section_list): Change
6090 type to list of Output_section::Input_section/
6091 (Input_section_info::Input_section_info): Change parameter type of
6092 INPUT_SECTION to Output_section::Input_section.
6093 (Input_section_info::input_section): Change return type.
6094 (Input_section_info::input_section_): Change type to
6095 Output_section::Input_section.
6096 (Output_section_element_input::set_section_addresses): Adjust code
6097 to use Output_section::Input_section instead of
6098 Output_section::Simple_input_section. Adjust code for renaming
6099 of Output_section::add_simple_input_section.
6100 (Orphan_output_section::set_section_addresses): Ditto.
6102 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6104 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6105 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6107 2010-05-18 Rafael Espindola <espindola@google.com>
6109 * options.cc (General_options::finalize): Handle -nostdlib.
6110 * options.h (nostdlib): New option.
6111 * script.cc (script_add_search_dir): Handle -nostdlib.
6113 2010-05-12 Doug Kwan <dougkwan@google.com>
6115 * arm.cc (Target_arm::do_finalize_sections): Create an empty
6116 attributes section only if there no attributes section after merging.
6117 (Target_arm::merge_object_attributes): Move value of
6118 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6119 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6120 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6121 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6122 and arm_attr_merge_7.stdout.
6123 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6124 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6125 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6126 arm_attr_merge_7b.o): New rules.
6127 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6129 * testsuite/Makefile.in: Regenerate.
6130 * testsuite/arm_attr_merge.sh: New file.
6131 * testsuite/arm_attr_merge_[67][ab].s: Same.
6133 2010-05-05 Nick Clifton <nickc@redhat.com>
6135 * po/es.po: Updated Spanish translation.
6137 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6139 * Makefile.am (install-exec-local): Properly install gold as
6140 default cross linker.
6141 * Makefile.in: Regenerated.
6143 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6144 Nick Clifton <nickc@redhat.com>
6146 * configure.ac (install_as_default): Define and set to false
6147 unless --enable-gold or --enable-gold=both/gold has been
6149 * configure: Regenerate.
6151 * Makefile.am (install-exec-local): Install the executable as
6152 'ld.gold'. If install_as_default is true then also install it as
6154 * Makefile.in: Regenerated.
6156 2010-04-24 Ian Lance Taylor <iant@google.com>
6158 * layout.cc (Layout::layout_reloc): In relocatable link don't
6159 combine reloc sections for grouped sections.
6161 2010-04-23 Sriraman Tallam <tmsriram@google.com>
6163 * gc.h (gc_process_relocs): Pass information on relocs pointing to
6164 sections that are not ordinary to icf.
6165 * icf.cc (get_section_contents): Handle relocation pointing to section
6166 with no object or shndx information.
6167 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6168 * testsuite/Makefile.in: Regenerate.
6169 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6170 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6172 2010-04-22 Ian Lance Taylor <iant@google.com>
6174 * expression.cc (Expression::Expression_eval_info): Add
6175 result_alignment_pointer field.
6176 (Expression::eval_with_dot): Add result_alignment_pointer
6177 parameter. Change all callers.
6178 (Expression::eval_maybe_dot): Likewise.
6179 (class Binary_expression): Add alignment_pointer parameter to
6180 left_value and right_value. Change all callers.
6181 (BINARY_EXPRESSION): Set result alignment.
6182 (class Trinary_expression): Add alignment_pointer parameter to
6183 arg2_value and arg3_value. Change all callers.
6184 (Trinary_cond::value): Set result alignment.
6185 (Max_expression::value, Min_expression::value): Likewise.
6186 (Align_expression::value): Likewise.
6187 * script-sections.cc (class Sections_element): Add dot_alignment
6188 parameter to set_section_addresses virtual function. Update
6190 (class Output_section_element): Likewise.
6191 (Script_sections::create_segments): Add dot_alignment parameter.
6193 (Script_sections::create_segments_from_phdrs_clause): Likewise.
6194 (Script_sections::set_phdrs_clause_addresses): Likewise.
6195 * script-sections.h: Update declarations.
6196 * script.h: Update declarations.
6197 * output.h (Output_segment::set_minimum_p_align): Don't decrease
6199 * testsuite/script_test_3.t: Set large alignment.
6200 * testsuite/script_test_3.sh: Make sure that at least one LOAD
6201 segment has expected alignment.
6203 2010-04-22 Nick Clifton <nickc@redhat.com>
6205 * po/gold.pot: Updated by the Translation project.
6206 * po/vi.po: Updated Vietnamese translation.
6208 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
6210 * testsuite/Makefile.am (check_PROGRAMS): Add
6211 icf_virtual_function_folding_test.
6212 * testsuite/Makefile.in: Regenerated.
6214 2010-04-15 Andrew Haley <aph@redhat.com>
6216 * options.h (merge_exidx_entries): New option.
6217 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6218 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6219 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6220 (Target_arm::merge_exidx_entries): New function.
6221 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6222 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6223 to Arm_exidx_fixup constructor.
6224 Add new arg, merge_exidx_entries.
6225 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6226 Arm_output_section::fix_exidx_coverage.
6228 2010-04-18 Sriraman Tallam <tmsriram@google.com>
6230 * icf.cc (get_section_contents): Check for preemptible functions.
6231 Ignore addend when appropriate.
6232 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
6234 (add_from_relobj): Check for section folded.
6235 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6236 * symtab.h (should_add_dynsym_entry): Add new parameter.
6237 * target-reloc.h (scan_relocs): Check for section folded.
6238 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6239 Check reloc types for function pointers in shared objects.
6240 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6242 (icf_preemptible_functions_test): New test case.
6243 (icf_string_merge_test): New test case.
6244 * testsuite.Makefile.in: Regenerate.
6245 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6246 bar_glob. Refactor code.
6247 * testsuite/icf_preemptible_functions_test.cc: New file.
6248 * testsuite/icf_preemptible_functions_test.sh: New file.
6249 * testsuite/icf_string_merge_test.cc: New file.
6250 * testsuite/icf_string_merge_test.sh: New file.
6251 * testsuite/icf_virtual_function_folding_test.cc: New file.
6252 * testsuite/icf_virtual_function_folding_test.sh: New file.
6254 2010-04-14 Doug Kwan <dougkwan@google.com>
6256 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6257 for local symbol recounting if we remove a section due to ICF.
6258 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6259 there are no regular objects in input.
6261 2010-04-13 Doug Kwan <dougkwan@google.com>
6263 * arm.cc (Arm_input_section::set_final_data_size): Compute
6264 accurate final data size instead of using current data size.
6266 2010-04-09 Doug Kwan <dougkwan@google.com>
6268 * layout.cc (Layout::choose_output_section): Handle script section
6270 (Layout::make_output_section_for_script): Add section type parameter.
6271 Handle script section types.
6272 * layout.h (Layout::make_output_section_for_script): Add section
6274 * output.cc (Output_section::Output_section): Initialize data member
6276 (Output_section::do_reset_address_and_file_offset): Do not set address
6277 to 0 if section is a NOLOAD section.
6278 * output.h (Output_section::is_noload): New method.
6279 (Output_section::set_is_noload): Ditto.
6280 (Output_section::is_noload_): New data member.
6281 * script-c.h (Script_section_type): New enum type.
6282 (struct Parser_output_section_header): Add new file section_type.
6283 * script-sections.cc (Sections_element::output_section_name): Add
6284 parameter for returning script section type.
6285 (Output_section_definition::output_section_name): Ditto.
6286 (Output_section_definition::section_type)P; New method.
6287 (Output_section_definiton::script_section_type_name): Ditto.
6288 (Output_section_definition::script_section_type_): New data member.
6289 (Output_section_definition::Output_section_definition): Initialize
6290 data member Output_section_definition::script_section_type_.
6291 (Output_section_definition::create_sections): Pass script section type
6292 to Layout::make_output_section_for_script.
6293 (Output_section_definition::output_section_name): Return script
6294 section type to caller.
6295 (Output_section_definition::set_section_address): Do not advance
6296 dot value and load address if section type is NOLOAD. Set address
6297 of NOLOAD sections regardless of section flags.
6298 (Output_section_definition::print): Print section type if it is
6299 not SCRIPT_SECTION_TYPE_NONE.
6300 (Output_section_definition::section_type): New method.
6301 (Output_section_definition::script_section_type_name): Ditto.
6302 (Script_sections::output_section_name): Add new parameter
6303 PSECTION_TYPE for returning script section type. Pass it to
6304 section elements. Handle discard sections.
6305 (Sort_output_sections::operator()): Handle NOLOAD sections.
6306 * script-sections.h (Script_sections::Section_type): New enum type.
6307 (Script_sections::output_section_name): Add a new parameter for
6308 returning script section type.
6309 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6311 * yyscript.y (union): Add new field SECTION_TYPE.
6312 (COPY, DSECT, INFO, NOLOAD): New tokens.
6313 (opt_address_and_section_type): Change type to output_section_header.
6314 (section_type): New non-terminal
6315 (section_header): Handle section type.
6316 (opt_address_and_section_type): Return section type value.
6318 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
6320 * testsuite/plugin_common_test_1.c (foo): Add prototype.
6321 * testsuite/plugin_common_test_2.c (foo): Likewise.
6323 2010-04-08 Doug Kwan <dougkwan@google.com>
6325 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6327 * output.cc (Output_section::add_merge_input_section): Simplify
6328 code and return status of Output_merge_base::add_input_section.
6329 Update merge section map only if Output_merge_base::add_input_section
6332 2010-04-07 Doug Kwan <dougkwan@google.com>
6334 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6335 if section is marked as containing instructions but has no mapping
6337 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6338 correct section index.
6339 (Arm_relobj::find_linked_text_section): Ditto.
6341 2010-04-07 Cary Coutant <ccoutant@google.com>
6343 * archive.cc (include_member): Destroy Read_symbols_data object before
6345 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6346 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6347 (Read_symbols_data::~Read_symbols_data) New destructor.
6348 (Section_relocs::Section_relocs) New constructor.
6349 (Section_relocs::~Section_relocs) New destructor.
6350 (Read_relocs_data::Read_relocs_data) New constructor.
6351 (Read_relocs_data::~Read_relocs_data) New destructor.
6352 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6353 pointers to NULL after deleting.
6355 2010-04-07 Doug Kwan <dougkwan@google.com>
6357 * arm.cc: Replace "endianity" with "endianness" in comments.
6358 (Arm_exidx_cantunwind): Ditto.
6359 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6360 (Arm_relobj::merge_flags_and_attributes): New method.
6361 (Arm_relobj::merge_flags_and_attributes_): New data member.
6362 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6363 (Arm_relobj::scan_sections_for_stubs): Ditto.
6364 (Arm_relobj::do_read_symbols): Check to see if we really want to
6365 merge processor-specific flags and attributes. Exit early if
6366 an object is empty except for section names and the undefined symbol.
6367 (Target_arm::do_finalize_sections): Move check for ELF format to
6368 Arm_relobj::do_read_symbols. Merge processor specific flags and
6369 attributes from a regular object only when we have determined that
6370 it is aapropriate. Do not create an .ARM.attributes section in
6371 output if there is no regular input object.
6372 (Target_arm::merge_processor_specific_flags): Check
6373 --warn-mismatch before printing any error.
6374 (Target_arm::merge_object_attributes): Ditto.
6375 * gold.cc (queue_middle_tasks): Handle the case in which there is
6376 no regular object in input.
6377 * options.cc (General_options::parse_EB): New method.
6378 (General_options::parse_EL): Same.
6379 (General_options::General_options): Initialize endianness_.
6380 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6382 (General_options::Endianness): New enum.
6383 (General_options::endianness): New method.
6384 (General_options::endianness_): New data member.
6385 * parameters.cc (Parameters::set_options): Check target endianness.
6386 (Parameters::set_target_once): Ditto.
6387 (Parameters::check_target_endianness): New method.
6388 (parameters_force_valid_target): If either -EL or -EB is specified,
6389 use it to define endianness of default target.
6390 * parameters.h (Parameters::check_target_endianness): New method
6392 * target.h (class Target): Change "endianity" to "endianness"
6395 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6397 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6398 * configure: Regenerate.
6399 * Makefile.in: Regenerate.
6400 * testsuite/Makefile.in: Regenerate.
6402 2010-04-06 Cary Coutant <ccoutant@google.com>
6405 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6406 prevailing definitions of common symbols.
6407 * testsuite/plugin_test_6.sh: New test case.
6408 * testsuite/plugin_common_test_1.c: New test case.
6409 * testsuite/plugin_common_test_2.c: New test case.
6410 * testsuite/Makefile.am (plugin_test_6): New test case.
6411 * testsuite/Makefile.in: Regenerate.
6413 2010-04-06 Nick Clifton <nickc@redhat.com>
6415 * po/vi.po: New Vietnamese translation.
6417 2010-03-30 Doug Kwan <dougkwan@google.com>
6419 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6421 2010-03-25 Doug Kwan <dougkwan@google.com>
6423 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6424 to avoid a conversion warning on a 32-bit host.
6426 2010-03-24 Ian Lance Taylor <iant@google.com>
6428 * testsuite/script_test_3.t: Add a TLS segment.
6429 * testsuite/Makefile.am (check_PROGRAMS): Add
6430 tls_phdrs_script_test.
6431 (tls_phdrs_script_test_SOURCES): Define.
6432 (tls_phdrs_script_test_DEPENDENCIES): Define.
6433 (tls_phdrs_script_test_LDFLAGS): Define.
6434 (tls_phdrs_script_test_LDADD): Define.
6435 * testsuite/Makefile.in: Rebuild.
6437 2010-03-23 Cary Coutant <ccoutant@google.com>
6439 * fileread.cc (find_or_make_view): Fix comment.
6441 2010-03-23 Ian Lance Taylor <iant@google.com>
6443 * script-sections.cc (class Orphan_section_placement): Define
6444 PLACE_TLS and PLACE_TLS_BSS.
6445 (Orphan_section_placement::Orphan_section_placement): Initialize
6447 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6448 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6449 (tls_script_test_SOURCES): Define.
6450 (tls_script_test_DEPENDENCIES): Define.
6451 (tls_script_test_LDFLAGS): Define.
6452 (tls_script_test_LDADD): Define.
6453 * testsuite/Makefile.in: Rebuild.
6455 2010-03-22 Doug Kwan <dougkwan@google.com>
6457 * arm.cc (Arm_relocate_functions::abs8,
6458 Arm_relocate_functions::abs16): Use correct check for overflow
6459 specified in the ARM ELF specs.
6460 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
6461 target of a BLX instruction specially.
6462 (Reloc_stub::stub_type_for_reloc): Ditto.
6463 (Relocate::relocate): Use symbolic names instead of numeric relocation
6464 codes to report error.
6465 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6467 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6468 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6469 thumb2_blx_out_of_range.stdout
6470 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6471 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6472 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6473 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6474 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6475 thumb2_blx_in_range, thumb2_blx_in_range.o,
6476 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6477 thumb2_blx_out_of_range.o): New rules.
6478 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6479 thumb2_blx_in_range and thumb2_blx_out_of_range.
6480 * testsuite/Makefile.in: Regenerate.
6481 * arm_branch_in_range.sh: Add tests for THUMB BLX.
6482 * testsuite/thumb_blx_in_range.s: New file.
6483 * testsuite/thumb_blx_out_of_range.s: New file.
6485 2010-03-22 Rafael Espindola <espindola@google.com>
6487 * archive.cc (Should_include): Move to archive.h.
6488 (should_include_member): Make it a member of Archive.
6490 (Add_lib_group_symbols): New.
6491 * archive.h: Include options.h.
6492 (Archive_member): Moved from Archive.
6493 (Should_include): Moved from archive.cc.
6495 (Add_lib_group_symbols): New.
6496 * dynobj.cc (do_should_include_member): New.
6497 * dynobj.h (do_should_include_member): New.
6498 * gold.cc (queue_initial_tasks): Update call to queue.
6499 * main.cc (main): Print lib group stats.
6500 * object.cc (do_should_include_member): New.
6501 * object.h: Include archive.h.
6502 (Object::should_include_member): New.
6503 (Object::do_should_include_member): New.
6504 (Sized_relobj::do_should_include_member): New.
6505 * options.cc (General_options::parse_start_lib): New.
6506 (General_options::parse_end_lib): New.
6507 (Input_arguments::add_file): Handle lib groups.
6508 (Input_arguments::start_group): Check we are not in a lib.
6509 (Input_arguments::start_lib): New.
6510 (Input_arguments::end_lib): New.
6511 * options.h (General_options): Add start_lib and end_lib.
6512 (Input_argument::lib_): New.
6513 (Input_argument::lib): New.
6514 (Input_argument::is_lib): New.
6515 (Input_file_lib): New.
6516 (Input_arguments::in_lib_): New.
6517 (Input_arguments::in_lib): New.
6518 (Input_arguments::start_lib): New.
6519 (Input_arguments::end_lib_): New.
6520 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6521 in unused members as preempted.
6522 (Sized_pluginobj::do_should_include_member): New.
6523 * plugin.h (Sized_pluginobj::do_should_include_member): New.
6524 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6526 (Read_symbols::do_whole_lib_group): New.
6527 (Read_symbols::do_lib_group): New.
6528 (Read_symbols::do_read_symbols): Handle lib groups.
6529 (Read_symbols::get_name): Handle lib groups.
6530 * readsyms.h (Read_symbols): Add an archive member pointer.
6531 (Read_symbols::do_whole_lib_group): New.
6532 (Read_symbols::do_lib_group): New.
6533 (Read_symbols::member_): New.
6534 * script.cc (read_input_script): Update call to queue_soon.
6536 2010-03-19 Doug Kwan <dougkwan@google.com>
6538 * arm.cc (Stub_table::Stub_table): Initialize new data members
6539 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6540 (Stub_table::add_reloc_stub): Assign stub offset and update
6541 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6542 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6544 (Stub_table::update_data_size_and_addralign): Use
6545 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6546 instead of going over all reloc stubs.
6547 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6548 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6549 Stringpool_template::offset_ to size of Stringpool_char.
6550 (Stringpool_template::new_key_offset): Remove code to initialize
6551 Stringpool_template::offset_.
6552 * stringpool.h (Stringpool_template::set_no_zero_null): Set
6553 Stringpool_template::offset_ to zero.
6555 2010-03-15 Doug Kwan <dougkwan@google.com>
6557 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6559 (Stringpool_template::new_key_offset): New method.
6560 (Stringpool_template::add_string): Assign offsets when adding new
6562 (Stringpool_template::set_string_offsets): Do not set string offsets
6563 when not optimizing.
6564 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6566 (Chunked_vector::clear): Clear size_.
6567 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6568 (Chunked_vector::size): Return size_.
6569 (Chunked_vector::push_back): Use size_ to find insert position.
6570 (Chunked_vector::size_): New data member.
6571 (Stringpool_template::set_no_zero_null): Assert string set is empty.
6572 (Stringpool_template::new_key_offset): New method declaration.
6573 (Stringpool_template::offset_): New data member.
6575 2010-03-15 Rafael Espindola <espindola@google.com>
6577 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6578 Add_symbols' constructor.
6579 * readsyms.h (Add_symbols): Remove the input_group member.
6581 2010-03-10 Ian Lance Taylor <iant@google.com>
6583 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6584 target to ask whether a reference to a symbol requires a stack
6586 * target.h (Target::is_call_to_non_split): New function.
6587 (Target::do_is_call_to_non_split): Declare virtual function.
6588 * target.cc: Include "symtab.h".
6589 (Target::do_is_call_to_non_split): New function.
6590 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6592 2010-03-10 Cary Coutant <ccoutant@google.com>
6594 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6595 (File_read::open[1]): Remove initial mapping of whole_file_view_.
6596 (File_read::open[2]): Add whole_file_view_ to list of views.
6597 (File_read::make_view): Remove test of whole_file_view_.
6598 (File_read::find_or_make_view): Create whole_file_view_ if
6600 (File_read::clear_views): Replace bool parameter with enum;
6601 adjust all callers. Don't delete views with permanent data;
6602 do delete cached views and views from archives if
6603 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
6604 if clearing the corresponding view.
6605 * fileread.h (File_read::Clear_views_mode): New enum.
6606 (File_read::View::is_permanent_view): New method.
6607 (File_read::clear_views): Replace bool parameter
6608 with enum; adjust all callers.
6609 * options.h (General_options): Change keep_files_mapped option;
6610 add map_whole_files.
6611 * readsyms.cc (Add_symbols::run): Delete sd_ object before
6613 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6616 2010-03-10 David S. Miller <davem@davemloft.net>
6618 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6620 2010-03-09 Sriraman Tallam <tmsriram@google.com>
6622 * icf.cc (get_section_contents): Add '@' marker after processing the
6625 2010-03-08 Doug Kwan <dougkwan@google.com>
6627 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6628 due to a conversion warning.
6629 (Arm_relobj::update_output_local_symbol_count): Check for local
6630 symbol with unset output index.
6632 2010-03-05 Ian Lance Taylor <iant@google.com>
6634 * options.h (class General_options): Add --spare-dynamic-tags.
6635 * output.cc (Output_data_dynamic::set_final_data_size): Implement
6636 --spare-dynamic-tags.
6638 2010-03-05 Ian Lance Taylor <iant@google.com>
6640 * incremental.cc: Include "libiberty.h".
6642 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
6644 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6645 function, is_info_ member.
6646 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6647 (Versions::Versions): Update caller.
6648 (Versions::define_base_version): Likewise.
6649 (Versions::add_def): Likewise.
6651 2010-03-03 Sriraman Tallam <tmsriram@google.com>
6653 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6654 (Scan::possible_function_pointer_reloc): New function.
6655 (Scan::local_reloc_may_be_function_pointer): Change to call
6656 possible_function_pointer_reloc.
6657 (Scan::global_reloc_may_be_function_pointer): Ditto.
6658 * icf.h (Icf::check_section_for_function_pointers): Change to reject
6659 relocations in ".data.rel.ro._ZTV" section.
6660 * testsuite/icf_safe_so_test.sh: Change to pass i386.
6661 * testsuite/icf_safe_so_test.cc: Ditto.
6662 * testsuite/icf_safe_test.cc: Ditto.
6663 * testsuite/icf_safe_test.sh: Ditto.
6665 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6666 Ian Lance Taylor <iant@google.com>
6668 * target-reloc.h (relocate_section): Check the symbol table index
6669 for -1U before setting the local symbol index.
6670 (scan_relocatable_relocs): If copying the relocation, record that
6671 the local symbol is required.
6672 * object.h (Symbol_value::is_output_symtab_index_set): New
6674 (Symbol_value::may_be_discarded_from_output_symtab): New
6676 (Symbol_value::has_output_symtab_entry): New function.
6677 (Symbol_value::needs_output_symtab_entry): Remove.
6678 (Symbol_value::output_symtab_index): Make sure the symbol index is
6680 (Symbol_value::set_output_symtab_index): Make sure the symbol
6681 index is not set. Make sure the new index is valid.
6682 (Symbol_value::set_must_have_output_symtab_entry): New function.
6683 (Symbol_value::has_output_dynsym_entry): New function.
6684 (Symbol_value::set_output_dynsym_index): Make sure the new index
6686 (Sized_relobj::set_must_have_output_symtab_entry): New function.
6687 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6688 local symbol if permitted.
6689 (Sized_relobj::do_finalize_local_symbols): Call
6690 is_output_symtab_index_set rather than needs_output_symtab_entry.
6691 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6692 rather than needs_output_symtab_entry. Call
6693 has_output_dynsym_entry rather than needs_output_dynsym_entry.
6694 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6695 is_output_symtab_index_set rather than needs_output_symtab_entry.
6696 * testsuite/discard_locals_relocatable_test.c: New file.
6697 * testsuite/discard_locals_test.sh: Test -r.
6698 * testsuite/Makefile.am (check_DATA): Add
6699 discard_locals_relocatable_test1.syms,
6700 discard_local_relocatable_test2.syms.
6701 (MOSTLYCLEANFILES): Likewise. Also add
6702 discard_locals_relocatable_test1.lout and
6703 discard_locals_relocatable_test2.out.
6704 (discard_locals_relocatable_test1.syms): New target.
6705 (discard_locals_relocatable_test.o): New target.
6706 (discard_locals_relocatable_test1.out): New target.
6707 (discard_locals_relocatable_test2.syms): New target.
6708 (discard_locals_relocatable_test2.out): New target.
6709 (various): Add missing ../ld-new dependencies.
6710 * testsuite/Makefile.in: Rebuild.
6712 2010-03-03 Nick Clifton <nickc@redhat.com>
6714 * po/fi.po: New Finnish translation.
6716 2010-03-01 Doug Kwan <dougkwan@google.com>
6718 * layout.cc (Layout::Layout): Force section types of .init_array*,
6719 .preinit_array* and .fini_array* sections.
6720 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6721 Fix check of return value of std::string::find.().
6722 (Output_section::Input_section_sort_compare::operator()): Remove
6723 comment about .init_array.
6724 (Output_section::Input_section_sort_init_fini_compare::operator()):
6726 (Output_section::sort_attached_input_sections): Handle .init_array
6727 and .fini_array specially.
6728 * output.h (Output_section::Inut_section_sort_compare): Update
6730 (Output_section::Input_section_sort_init_fini_compare): New struct.
6732 2010-02-26 Doug Kwan <dougkwan@google.com>
6734 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6735 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6736 * testsuite/debug_msg.sh: Avoid matching source line number for
6737 use of global variable undef_int.
6739 2010-02-26 Doug Kwan <dougkwan@google.com>
6741 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6742 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6743 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6744 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6745 * options.cc (General_options::General_options): Initialize member
6747 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6748 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6749 and rm_no_fix_v4bx.stdout
6750 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6751 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6752 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6753 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6754 and arm_no_fix_v4bx.
6755 * Makefile.in: Regenerate.
6756 * testsuite/arm_fix_v4bx.s: New file.
6757 * testsuite/arm_fix_v4bx.sh: Ditto.
6759 2010-02-24 Doug Kwan <dougkwan@google.com>
6761 * arm.cc (Target_arm::got_section): Make the .got section the first
6762 non RELRO section in the data segment.
6763 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6764 suffixes of section names.
6766 2010-02-24 Doug Kwan <dougkwan@google.com>
6768 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6769 flags and attributes merging if an input file is a binary file.
6770 * fileread.cc (Input_file::open): Record format of original file.
6771 * fileread.h (Input_file::Format): New enum type.
6772 (Input_file::Input_file): Initialize data member format_.
6773 (Input_file::format): New method definition.
6774 (Input_file::format_):: New data member.
6776 2010-02-24 Doug Kwan <dougkwan@google.com>
6778 * arm.cc (Arm_output_data_got): New class.
6779 (ARM_TCB_SIZE): New constant
6780 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6781 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6782 If user uses a script with a SECTIONS clause, issue only a warning
6783 for a misplaced EXIDX input section. Otherwise, issue an error.
6784 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6786 (Target_arm::got_mode_index_entry): Handle static linking.
6787 (Target_arm::Scan::local): Ditto.
6788 (Target_arm::Scan::global): Ditto.
6789 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6790 all incorrectly implemented relocations.
6791 (Target_arm::fix_exidx_coverage): Pass layout to
6792 Arm_output_section::fix_exidx_coverage.
6793 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6794 from ".ARM.exidx." and ".ARM.extab.".
6796 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6798 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6799 section if it does not already exist.
6800 * attributes.cc (Attributes_section_data::Attributes_section_data):
6801 Don't crash if size is zero.
6803 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6804 Ian Lance Taylor <iant@google.com>
6806 * gold.cc (queue_middle_tasks): If no input files were opened,
6808 * workqueue.h (Task_function::Task_function): Assert that there is
6811 2010-02-22 Doug Kwan <dougkwan@google.com>
6813 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6814 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6815 types to avoid warnings due to different uint64_t implementations
6818 2010-02-21 Doug Kwan <dougkwan@google.com>
6820 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6821 handling of the maximum backward branch offset.
6822 (Arm_relocate_functions::thumb_branch_common): Ditto.
6823 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6824 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6825 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6826 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6827 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6828 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6829 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6830 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6831 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6832 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6833 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6834 thumb2_bl_out_of_range.o): New rules.
6835 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6836 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6837 thumb2_bl_out_of_range
6838 * testsuite/Makefile.in: Regenerate.
6839 * testsuite/arm_bl_in_range.s: New file.
6840 * testsuite/arm_bl_out_of_range.s: Ditto.
6841 * testsuite/arm_branch_in_range.sh: Ditto.
6842 * testsuite/arm_branch_range.t: Ditto.
6843 * testsuite/thumb2_branch_range.t: Ditto.
6844 * testsuite/thumb_bl_in_range.s: Ditto.
6845 * testsuite/thumb_bl_out_of_range.s: Ditto.
6846 * testsuite/thumb_branch_range.t: Ditto.
6848 2010-02-20 Sriraman Tallam <tmsriram@google.com>
6850 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6851 Add reloc offset information.
6852 * icf.cc (get_section_contents): Change iterators to point to the new
6853 vectors. Add reloc offset information to the contents.
6854 * icf.h (Icf::Sections_reachable_info): New typedef.
6855 (Icf::Sections_reachable_list): New typedef.
6856 (Icf::Offset_info): New typedef.
6857 (Icf::Reloc_info): New struct typedef.
6858 (Icf::Reloc_info_list): New typedef.
6859 (Icf::symbol_reloc_list): Delete method.
6860 (Icf::addend_reloc_list): Delete method.
6861 (Icf::section_reloc_list): Delete method.
6862 (Icf::reloc_info_list): New method.
6863 (Icf::reloc_info_list_): New member.
6865 2010-02-19 Doug Kwan <dougkwan@google.com>
6867 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6868 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6869 * arm.cc (Arm_relocation_functions): New forward declaration.
6870 (Target_arm::Target_arm): Initialize new data members
6871 got_mod_index_offset_ and tls_base_symbol_defined_.
6872 (Target_arm::Relocate::relocate_tls): New method.
6873 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6874 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6876 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6877 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6878 (Target_arm::got_mod_index_offset_,
6879 Target_arm::tls_base_symbol_defined_): New data members.
6880 (Target_arm::Scan::local, Target::Scan::global,
6881 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6884 2010-02-18 Doug Kwan <dougkwan@google.com>
6886 * arm.cc (Arm_relobj::find_linked_text_section): New method.
6887 (Arm_relobj::make_exidx_input_section): Pass section index of linked
6888 text section as a parameter becuase some broken tools may not set
6889 the link in section header.
6890 (Target_arm::has_got_section): New method.
6891 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6892 without any mapping symbol as data only. Remove warning.
6893 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6894 link in its section header, try to discover the link by inspecting the
6895 REL31 relocation at the beginning of the section.
6896 (Target_arm::Scan::check_non_pic): Report name of offending relocation
6898 (Target_arm::Scan::global): Treat any reference to the symbol
6899 _GLOBAL_OFFSET_TABLE_ as a GOT access.
6901 2010-02-12 Sriraman Tallam <tmsriram@google.com>
6903 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6904 (Scan::global_reloc_may_be_function_pointer): New function.
6905 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6906 (Scan::global_reloc_may_be_function_pointer): New function.
6907 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6908 (Scan::global_reloc_may_be_function_pointer): New function.
6909 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6910 (Scan::global_reloc_may_be_function_pointer): New function.
6911 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6912 (Scan::global_reloc_may_be_function_pointer): New function.
6913 (Scan::possible_function_pointer_reloc): New function.
6914 (Target_x86_64::can_check_for_function_pointers): New function.
6915 * gc.h (gc_process_relocs): Scan relocation types to determine if
6916 function pointers were taken for targets that support it.
6917 * icf.cc (Icf::find_identical_sections): Include functions for
6918 folding in safe ICF whose pointer is not taken.
6919 * icf.h (Secn_fptr_taken_set): New typedef.
6920 (fptr_section_id_): New member.
6921 (section_has_function_pointers): New function.
6922 (set_section_has_function_pointers): New function.
6923 (check_section_for_function_pointers): New function.
6924 * options.h: Fix comment for safe ICF option.
6925 * target.h (can_check_for_function_pointers): New function.
6926 * testsuite/Makefile.am: Add icf_safe_so_test test case.
6927 Modify icf_safe_test for X86-64.
6928 * testsuite/Makefile.in: Regenerate.
6929 * testsuite/icf_safe_so_test.cc: New file.
6930 * testsuite/icf_safe_so_test.sh: New file.
6931 * testsuite/icf_safe_test.cc (kept_func_3): New function.
6932 (main): Change to take pointer to function kept_func_3.
6933 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6934 folding is done correctly for X86-64.
6936 2010-02-12 David S. Miller <davem@davemloft.net>
6938 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6939 is_symbolless parameter.
6940 (Output_reloc<SHT_REL>::is_symbolless): New.
6941 (Output_reloc<SHT_REL>::is_symbolless_): New.
6942 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6943 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6944 (Output_reloc<SHT_RELA>::is_symbolless): New.
6945 (Output_data_reloc::add_global): Handle is_symbolless.
6946 (Output_data_reloc::add_global_relative): Likewise.
6947 (Output_data_reloc::add_local): Likewise.
6948 (Output_data_reloc::add_local_relative): Likewise.
6949 (Output_data_reloc::add_symbolless_global_addend): New.
6950 (Output_data_reloc::add_symbolless_local_addend): New.
6951 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6953 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6954 instead of ->is_relative_
6955 (Output_reloc::write): Likewise.
6956 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6957 (Output_reloc::write_rel): Simplify.
6959 * sparc.cc (Target_sparc::Scan::local): Use
6960 ->add_symbolless_local_addend as needed.
6961 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6962 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
6963 based upon relocation offset.
6965 2010-02-11 Doug Kwan <dougkwan@google.com>
6967 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6968 (Target_arm::Scan::global): Ditto. Also remove a comment before the
6969 beginning of function.
6970 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6971 and MOVT_ABS relocations. Those are non issued in scanning. Fix
6972 parameter is_32bit in calls to should_apply_static_reloc.
6973 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6974 (check_DATA): Add arm_abs_global.stdout.
6975 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6976 arm_abs_global.stdout): New rules.
6977 (MOSTLLYCLEANFILES): Add arm_abs_global
6978 * Makefile.in: Regenerate.
6979 * testsuite/arm_abs_global.s: New file.
6980 * testsuite/arm_abs_global.sh: Ditto.
6981 * testsuite/arm_abs_lib.s: Ditto.
6983 2010-02-11 Ian Lance Taylor <iant@google.com>
6985 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6987 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
6988 Allocate_commons_task first.
6989 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6990 task, rather than symtab_lock_.
6991 (Gc_process_relocs::~Gc_process_relocs): New function.
6992 (Gc_process_relocs::is_runnable): Check this_blocker_.
6993 (Gc_process_relocs::locks): Use next_blocker_ rather than
6995 (Scan_relocs::~Scan_relocs): New function.
6996 (Scan_relocs::is_runnable): Check this_blocker_ rather than
6998 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
7000 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7001 fields. Add this_blocker_ and next_blocker_ fields. Adjust
7002 constructor accordingly.
7003 (class Gc_process_relocs): Likewise.
7004 (class Scan_relocs): Likewise.
7005 * common.h (class Allocate_commons_task): Remove symtab_lock_
7006 field, and corresponding constructor parameter.
7007 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7009 (Allocate_commons_task::locks): Likewise.
7011 2010-02-11 Ian Lance Taylor <iant@google.com>
7013 * gold-threads.h (class Once): Define.
7014 (class Initialize_lock): Rewrite as child of Once.
7015 * gold-threads.cc (class Once_initialize): Define.
7016 (once_pointer_control): New static variable.
7017 (once_pointer, once_arg): New static variables.
7018 (c_run_once): New static function.
7019 (Once::Once, Once::run_once, Once::internal_run): New functions.
7020 (class Initialize_lock_once): Remove.
7021 (initialize_lock_control): Remove.
7022 (initialize_lock_pointer): Remove.
7023 (initialize_lock_once): Remove.
7024 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7025 (Initialize_lock::initialize): Rewrite.
7026 (Initialize_lock::do_run_once): New function.
7027 * archive.cc (Archive::interpret_header): Only clear name if it is
7029 * fileread.cc: Include "gold-threads.h"
7030 (file_counts_lock): New static variable.
7031 (file_counts_initialize_lock): Likewise.
7032 (File_read::release): Only increment counts when using --stats.
7033 Use a lock around the increment.
7034 * parameters.cc (class Set_parameters_target_once): Define.
7035 (set_parameters_target_once): New static variable.
7036 (Parameters::Parameters): Move here from parameters.h.
7037 (Parameters::set_target): Rewrite.
7038 (Parameters::set_target_once): New function.
7039 (Parameters::clear_target): Move here and rewrite.
7040 * parameters.h (class Parameters): Update declarations. Add
7041 set_parameters_target_once_ field.
7042 (Parameters::Parameters): Move to parameters.cc.
7043 (Parameters::clear_target): Likewise.
7044 * readsyms.cc (Read_symbols::do_group): Create a Start_group
7046 (Start_group::~Start_group): New function.
7047 (Start_group::is_runnable): New function.
7048 (Start_group::locks, Start_group::run): New functions.
7049 (Finish_group::run): Change saw_undefined to size_t.
7050 * readsyms.h (class Start_group): Define.
7051 (class Finish_group): Change saw_undefined_ field to size_t.
7052 (Finish_group::Finish_group): Remove saw_undefined and
7053 this_blocker parameters. Change all callers.
7054 (Finish_group::set_saw_undefined): New function.
7055 (Finish_group::set_blocker): New function.
7056 * symtab.h (class Symbol_table): Change saw_undefined to return
7057 size_t. Change saw_undefined_ field to size_t.
7058 * target-select.cc (Set_target_once::do_run_once): New function.
7059 (Target_selector::Target_selector): Initialize set_target_once_
7060 field. Don't initialize lock_ and initialize_lock_ fields.
7061 (Target_selector::instantiate_target): Rewrite.
7062 (Target_selector::set_target): New function.
7063 * target-select.h (class Set_target_once): Define.
7064 (class Target_selector): Update declarations. Make
7065 Set_target_once a friend. Remove lock_ and initialize_lock_
7066 fields. Add set_target_once_ field.
7068 2010-02-10 Ian Lance Taylor <iant@google.com>
7070 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7072 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
7073 (queue_middle_tasks): Add all blockers before queueing any tasks.
7074 (queue_final_tasks): Likewise.
7075 * token.h (Task_token::add_blockers): New function.
7076 * object.h (Input_objects::number_of_relobjs): New function.
7078 2010-02-10 Ian Lance Taylor <iant@google.com>
7080 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7081 shared, not if not position independent.
7082 * x86_64.cc (Relocate::relocate_tls): Likewise.
7083 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7084 (tls_pie_pic_test): New target.
7085 * testsuite/Makefile.in: Rebuild.
7087 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7088 (tls_test_main_pie.o, tls_test_pie.o): New targets.
7089 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7090 * testsuite/Makefile.in: Rebuild.
7092 2010-02-09 David S. Miller <davem@davemloft.net>
7094 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7095 R_SPARC_RELATIVE using ->add_local_relative().
7096 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7098 * output.h (Output_data_dynamic::add_section_size): New method
7099 that takes two Output_data objects.
7100 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7101 entry param. Handle it in initializers.
7102 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7103 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7104 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7106 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7107 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7108 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7109 for dynrel_includes_plt.
7110 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7111 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7112 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7114 (Target_sparc::do_finalize_sections): Update to pass true for
7115 dynrel_includes_plt.
7116 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7117 output before .rela.plt
7118 (Target_powerpc::do_finalize_sections): Update to pass true for
7119 dynrel_includes_plt when 32-bit.
7121 2010-02-08 Doug Kwan <dougkwan@google.com>
7123 * arm.cc (Arm_relobj::simple_input_section_output_address): New
7125 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7126 Arm_relobj::scan_section_for_cortex_a8_stubs,
7127 Arm_relobj::do_relocation_section): Instead of calling
7128 Output_section::output_address, use faster
7129 Arm_relobj::simple_input_section_output_address.
7131 2010-02-08 David S. Miller <davem@davemloft.net>
7133 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7134 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7135 relocation helper function.
7137 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7138 just like R_SPARC_GOT{10,13,22}.
7139 (Target_sparc::Scan::local): Likewise.
7140 (Target_sparc::Relocate:relocate): Likewise.
7142 2010-02-06 Ian Lance Taylor <iant@google.com>
7144 * configure.ac: Rewrite targetobjs duplicate removal code to use
7145 only shell constructs.
7146 * configure: Rebuild.
7148 2010-02-05 Doug Kwan <dougkwan@google.com>
7151 * arm.cc (Arm_relobj::section_is_scannable): New method.
7152 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7153 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7155 2010-02-04 Doug Kwan <dougkwan@google.com>
7158 * arm-reloc-property.cc (cstdio): Include.
7159 * configure.ac (targetobjs): Remove duplicates.
7160 * configure: Regenerate.
7161 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7162 big and little endian version for a given address size.
7164 2010-02-03 Doug Kwan <dougkwan@google.com>
7166 * arm-reloc-property.cc
7167 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7169 * arm-reloc-property.h
7170 (Arm_reloc_property_table::get_implemented_static_reloc_property):
7171 New method definition.
7172 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7174 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7176 (GOT_PREL): Change implemented to Y.
7177 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7178 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7179 (Arm_relocate_functions::movw_abs_nc): Remove method.
7180 (Arm_relocate_functions::movt_abs): Ditto.
7181 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7182 (Arm_relocate_functions::thm_movt_abs): Ditto.
7183 (Arm_relocate_functions::movw_rel_nc): Ditto.
7184 (Arm_relocate_functions::movw_rel): Ditto.
7185 (Arm_relocate_functions::movt_rel): Ditto.
7186 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7187 (Arm_relocate_functions:thm_movw_rel): Ditto.
7188 (Arm_relocate_functions:thm_movt_rel): Ditto.
7189 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7190 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7191 New method definitions.
7192 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7193 (Arm_relocation_functions::arm_grp_ldr): Ditto.
7194 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7195 (Arm_relocation_functions::arm_grp_ldc): Ditto.
7196 (Target_arm::Relocate::relocate): Check for non-static or
7197 unimplemented relocation code and exit early. Change calls to
7198 Target_arm::reloc_uses_thumb_bit and
7199 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7200 instead. Refactor code to handle similar relocations to increase
7201 code sharing. Remove check for unsupported relocation code in switch
7203 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7204 relocation property table to find out size. Change error message to
7205 print out the name of a relocation code instead of the numeric value.
7206 (Target_arm::scan_reloc_for_stub): Use relocation property table
7207 instead of calling Target_arm::reloc_uses_thumb_bit().
7209 2010-02-02 Doug Kwan <dougkwan@google.com>
7211 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7212 types of relaxed input section.
7214 2010-02-02 Doug Kwan <dougkwan@google.com>
7216 * Makefile.am (HFILES): Add arm-reloc-property.h.
7218 (TARGETSOURCES): Add arm-reloc-property.cc
7219 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7220 (libgold_a_SOURCES): $(DEFFILES)
7221 * Makefile.in: Regenerate.
7222 * arm-reloc-property.cc: New file.
7223 * arm-reloc-property.h: New file.
7224 * arm-reloc.def: New file.
7225 * arm.cc: Update comments.
7226 (arm-reloc-property.h): New included header.
7227 (arm_reloc_property_table): New global variable.
7228 (Target_arm::do_select_as_default_target): New method definition.
7229 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7230 arm-reloc-property to targ_extra_obj.
7231 * parameters.cc (set_parameters_target): Call
7232 Target::select_as_default_target().
7233 * target.h (Target::select_as_default_target): New method definition.
7234 (Target::do_select_as_default_target): Same.
7236 2010-02-01 Doug Kwan <dougkwan@google.com>
7238 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7239 first_output_text_section_.
7240 (Arm_exidx_fixup::first_output_text_section): New method definition.
7241 (Arm_exidx_fixup::first_output_text_section_): New data member.
7242 (Arm_exidx_fixup::process_exidx_section): Record the first text
7243 output section seen.
7244 (Arm_output_section::fix_exidx_coverage): Set correct linked section
7245 and entsize in output section header.
7247 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7249 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7250 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7251 (Arm_relocate_functions::thm_alu11): New Method.
7252 (Arm_relocate_functions::thm_pc8): New Method.
7253 (Arm_relocate_functions::thm_pc12): New Method.
7254 (Target_arm::Scan::local): Handle the relocations.
7255 (Target_arm::Scan::global): Likewise.
7256 (Target_arm::Relocate::relocate): Likewise.
7257 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7259 2010-01-29 Doug Kwan <dougkwan@google.com>
7261 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7262 of relocation types as ld.
7264 2010-01-29 Doug Kwan <dougkwan@google.com>
7266 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7268 (Arm_relocate_functions::thumb_branch_common): Ditto.
7269 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7270 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7271 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7272 Arm_relocate_functions::jump24): Remove.
7273 (Target_arm::Relocate::relocate): Adjust code to call
7274 Arm_relocation_functions::arm_branch_common and
7275 Arm_relocation_functions::thumb_branch_common instead of their removed
7276 wrappers. Merge switch-cases together to reduce source code size.
7278 2010-01-29 Doug Kwan <dougkwan@google.com>
7280 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7281 output_local_symbol_count_needs_update_.
7282 (Arm_relobj::output_local_symbol_count_needs_update,
7283 Arm_relobj::set_output_local_symbol_count_needs_update,
7284 Arm_relobj::update_output_local_symbol_count): New methods.
7285 (Arm_relobj::output_local_symbol_count_needs_update_): New data
7287 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7288 of pointed function as in a R_ARM_PREL31 relocation.
7289 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7290 for output local symbol count updating.
7291 (Target_arm::do_relax): Update output local symbol counts in objects
7293 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7295 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7297 * arm.cc: Added support for the ARM relocations:
7298 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7299 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7300 (Arm_relocate_functions::movw_rel_nc): Renamed (was
7302 (Arm_relocate_functions::movw_rel): New method.
7303 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7304 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7306 (Arm_relocate_functions::thm_movw_rel): New method.
7307 (Arm_relocate_functions::thm_movt_rel): Renamed (was
7309 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7311 (Target_arm::Scan::global): Likewise.
7312 (Target_arm::Relocate::relocate): Likewise.
7313 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7316 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7318 * arm.cc: Added support for ARM group relocations.
7319 (Target_arm::reloc_needs_sym_origin): New method.
7320 (Arm_relocate_functions::calc_grp_kn): New method.
7321 (Arm_relocate_functions::calc_grp_residual): New method.
7322 (Arm_relocate_functions::calc_grp_gn): New method.
7323 (Arm_relocate_functions::arm_grp_alu): New Method.
7324 (Arm_relocate_functions::arm_grp_ldr): New Method.
7325 (Arm_relocate_functions::arm_grp_ldrs): New Method.
7326 (Arm_relocate_functions::arm_grp_ldc): New Method.
7327 (Target_arm::Scan::local): Handle the ARM group relocations.
7328 (Target_arm::Scan::global): Likewise.
7329 (Target_arm::Relocate::relocate): Likewise.
7330 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7333 2010-01-26 Doug Kwan <dougkwan@google.com>
7335 * arm.cc (set): Include.
7336 (class Arm_exidx_fixup): Change type of last_input_section_ to const
7338 (Arm_output_section::Text_section_list): New type.
7339 (Arm_output_section::append_text_sections_to_list): New method.
7340 (Arm_output_section::fix_exidx_coverage): Ditto.
7341 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7342 (Arm_relobj::convert_input_section_to_relaxed_section): Use
7343 Relobj::set_section_offset() instead of
7344 Sized_relobj::invalidate_section_offset().
7345 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7346 parameter for section headers. Ignore relocation sections for
7347 unallocated sections and EXIDX sections.
7348 (Target_arm::fix_exidx_coverage): New method.
7349 (Target_arm::output_section_address_less_than): New type.
7350 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7351 linked text section instead of the EXIDX section.
7352 (Arm_output_section::create_stub_group): Add an assertion to check
7353 that this is not an EXIDX output section.
7354 (Arm_output_section::append_text_sections_to_list): New method.
7355 (Arm_output_section::fix_exidx_coverage): Ditto.
7356 (Arm_relobj::scan_sections_for_stubs): Adjust call to
7357 Arm_relobj::section_needs_reloc_stub_scanning.
7358 (Target_arm::do_relax): Fix EXIDX output section coverage in the
7360 (Target_arm::fix_exidx_coverage): New method.
7361 * object.h (Relobj::set_output_section): New method.
7362 (Sized_relobj::invalidate_section_offset): Remove method.
7363 (Sized_relobj::do_invalidate_section_offset): Remove method.
7364 (Sized_relobj::do_set_section_offset): Handle offset value -1.
7366 2010-01-25 Doug Kwan <dougkwan@google.com>
7368 * arm.cc (Arm_exidx_merged_section::do_output_offset):
7369 Fix warning due to signed and unsigned comparison on a 32-bit host.
7371 2010-01-22 Doug Kwan <dougkwan@google.com>
7373 * arm.cc (Target_arm::do_relax): Record an output section for section
7374 offset adjustment it contains any stub table that has changed.
7375 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7376 offsets in an output section if necessary.
7377 * output.cc (Output_section::Output_section): Initialize
7378 section_offsets_need_adjustments_.
7379 (Output_section::add_input_section_for_script): Renamed to
7380 Output_section::add_simple_input_section.
7381 (Output_section::save_states): Add a comment.
7382 (Output_section::discard_states): New method defintion.
7383 (Output_section::adjust_section_offsets): Same.
7384 * output.h (Output_section::add_input_section_for_script): Renamed to
7385 Output_section::add_simple_input_section.
7386 (Output_section::discard_states): New method declaration.
7387 (Output_section::adjust_section_offsets): Same.
7388 (Output_section::section_offsets_need_adjustment,
7389 Output_section::set_section_offsets_need_adjustment): New method
7391 (Output_section::section_offsets_need_adjustment_): New data member.
7392 * script-sections.cc
7393 (Output_section_element_input::set_section_address): Adjust code for
7394 renaming of Output_section::add_input_section_for_script.
7395 (Orphan_output_section::set_section_address): Same.
7397 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7399 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7400 Fix_v4bx enum values .
7401 * gold/options.h (General_options): New option definitions.
7402 (General_options::fix_v4bx): New method.
7403 (General_options::Fix_v4bx): New enum.
7404 * gold/options.cc (General_options::parse_fix_v4bx): New method.
7405 (General_options::parse_fix_v4bx_interworking): New method.
7407 2010-01-22 Doug Kwan <dougkwan@google.com>
7409 * arm.cc (Arm_exidx_fixup): New class.
7411 2010-01-21 Doug Kwan <dougkwan@google.com>
7413 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7415 (Arm_exidx_section_offset_map): New type.
7417 2010-01-21 Doug Kwan <dougkwan@google.com>
7419 * arm.cc (Arm_exidx_input_section): New class.
7420 (Arm_relobj::exidx_input_section_by_link,
7421 Arm_relobj::exidx_input_section_by_shndx,
7422 Arm_relobj::make_exidx_input_section): New methods.
7423 (read_arm_attributes_section): Remove.
7424 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7425 information about them.
7426 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7429 2010-01-20 Doug Kwan <dougkwan@google.com>
7431 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7432 Input_section_specifier to Section_id.
7433 (Target_arm::new_arm_input_section: Adjust code for change of key
7435 (Target_arm::find_arm_input_section): Ditto.
7436 * gc.h (object.h): Include for Section_id nand Section_id_hash.
7437 (Section_id): Remove.
7438 (Garbage_collection::Section_id_hash): Remove.
7439 * icf.h (object.h): Include for Section_id nand Section_id_hash.
7440 (Section_id): Remove.
7441 (Icf::Section_id_hash): Remove.
7442 * object.h (Section_id, Const_section_id, Section_id_hash,
7443 Const_section_id_hash): New type definitions.
7444 * output.cc (Output_section::add_relaxed_input_section): Change to
7445 use Const_section_id instead of Input_section_specifier as key type.
7446 (Output_section::add_merge_input_section): Ditto.
7447 (Output_section::build_relaxation_map): Change to use Section_id
7448 instead of Input_section_specifier as key type.
7449 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7451 (Output_section::convert_input_sections_to_relaxed_sections): Change
7452 to use Const_section_id instead of Input_section_specifier as key type.
7453 (Output_section::find_merge_section): Ditto.
7454 (Output_section::find_relaxed_input_section): Ditto.
7455 * output.h (Input_section_specifier): Remove class.
7456 (Output_section::Output_section_data_by_input_section_map): Change
7457 key type to Const_section_id.
7458 (Output_section::Output_relaxed_input_section_by_input_section_map):
7460 (Output_section::Relaxation_map): Change key type to Section_id.
7462 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7464 * gold/arm.cc: Added support for R_ARM_V4BX relocation
7465 (class Arm_v4bx_stub): New class.
7466 (DEF_STUBS): Updated definition to support v4_veneer_bx.
7467 (Stub_factory::make_arm_v4bx_stub): New method.
7468 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7469 (Stub_table::empty): Handle v4bx stubs.
7470 (Stub_table::add_arm_v4bx_stub): New method.
7471 (Stub_table::find_arm_v4bx_stub): New method.
7472 (Arm_relocate_functions::v4bx): New method.
7473 (Target_arm::fix_v4bx): New method.
7474 (Target_arm::Target_arm): Handle R_ARM_V4BX.
7475 (Stub_table::relocate_stubs): Likewise.
7476 (Stub_table::do_write): Likewise.
7477 (Stub_table::update_data_size_and_addralign): Likewise.
7478 (Stub_table::finalize_stubs): Likewise.
7479 (Target_arm::Scan::local): Likewise.
7480 (Target_arm::Scan::global): Likewise.
7481 (Target_arm::do_finalize_sections): Likewise.
7482 (Target_arm::Relocate::relocate): Likewise.
7483 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7485 (Target_arm::scan_reloc_for_stub): Likewise.
7486 (Target_arm::scan_reloc_section_for_stubs): Likewise.
7488 2010-01-19 Ian Lance Taylor <iant@google.com>
7490 * output.cc (Output_section_headers::do_sized_write): Write large
7491 segment count to sh_info field.
7492 (Output_file_header::do_sized_write): For large segment count,
7493 write PN_XNUM to e_phnum field.
7495 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7497 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7498 (Arm_relocate_functions::thm_jump8): New function.
7499 (Arm_relocate_functions::thm_jump11): New function.
7500 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7502 (Target_arm::Scan::global): Likewise.
7503 (Target_arm::Relocate::relocate): Likewise.
7504 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7507 2010-01-14 Doug Kwan <dougkwan@google.com>
7509 * arm.cc (map, utility): Include headers.
7510 (Target_arm::apply_cortex_a8_workaround): New method.
7511 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7512 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7513 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7514 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7515 the --[no-]fix-cortex-a8 command line options.
7516 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7517 (Target_arm::relocate_stub): Use addend in instruction template.
7518 * options.h (DEFINE_bool): Set the user-set flag.
7519 (General_options): Add --[no-]-fix-cortex options.
7520 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7521 : Update fast look-up map after conversion.
7523 2010-01-14 Sriraman Tallam <tmsriram@google.com>
7525 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7526 in the first pass of do_layout.
7528 2010-01-13 Doug Kwan <dougkwan@google.com>
7530 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7531 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7532 apparent compiler problem of not folding static constant integral
7533 data members of elfcpp::Elf_sizes<32>.
7535 2010-01-13 Doug Kwan <dougkwan@google.com>
7537 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7538 Arm_relobj::section_needs_cortex_a8_stub_scanning,
7539 Arm_relobj::scan_section_for_cortex_a8_erratum,
7540 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7541 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7542 sections to scan for relocation stubs into a new method
7543 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
7544 relocation and Cortex-A8 stub scanning.
7545 (Target_arm::do_relax): Force stubs to be after stubbed sections
7546 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
7547 the beginning of a new relaxation pass. Update a comment.
7548 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7550 2010-01-12 Ian Lance Taylor <iant@google.com>
7552 * target-reloc.h (visibility_error): New inline function.
7553 (relocate_section): Call visibility_error.
7554 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7555 (MOSTLYCLEANFILES): Likewise.
7556 (protected_4_pic.o, protected_3.err): New targets.
7557 * testsuite/protected_4.cc: New file.
7559 2010-01-12 Doug Kwan <dougkwan@google.com>
7561 * arm.cc (Cortex_a8_reloc): New class.
7562 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7563 and cortex_a8_relocs_info_.
7564 (Target_arm::fix_cortex_a8): New method definition.
7565 (Target_arm::Cortex_a8_relocs_info): New type.
7566 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7567 New data member declarations.
7568 (Target_arm::scan_reloc_for_stub): Record information about
7569 relocations for THUMB branches that might be exempted from the
7570 Cortex-A8 workaround.
7571 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7572 at the beginning of a relaxation pass.
7574 2010-01-12 Doug Kwan <dougkwan@google.com>
7576 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7577 (Arm_relobj::Mapping_symbol_position,
7578 Arm_reloj::Mapping_symbol_position_less,
7579 Arm_relobj::Mapping_symbols_info): New types.
7580 (Target_arm::is_mapping_symbol_name): New method definition.
7581 (Arm_relobj::do_count_local_symbols): Save information about mapping
7584 2010-01-11 Doug Kwan <dougkwan@google.com>
7586 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7587 Arm_relocate_functions::thumb32_branch_upper,
7588 Arm_relocate_functions::thumb32_branch_lower,
7589 Arm_relocate_functions::thumb32_cond_branch_offset,
7590 Arm_relocate_functions::thumb32_cond_branch_upper,
7591 Arm_relocate_functions::thumb32_cond_branch_lower,
7592 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7593 branch offset encoding.
7594 (Arm_relocate_functions::thumb_branch_common): Use new branch
7595 offset encoding methods to avoid code duplication.
7596 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7597 (Stub_addend_reader::operator()): Use new branch encoding method
7598 to avoid code duplication.
7600 2010-01-11 Doug Kwan <dougkwan@google.com>
7602 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7603 (Target_arm::do_finalize_sections): Define special EXIDX section
7604 symbols only if referenced.
7605 * gc.h (Garbage_collection::add_reference): New method.
7606 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7609 2010-01-11 Ian Lance Taylor <iant@google.com>
7611 * script.cc (Version_script_info::build_expression_list_lookup):
7612 Change complaing about duplicate wildcard match from error to
7615 * script.cc (class Lazy_demangler): Recreate--revert part of patch
7617 (Version_script_info::Version_script_info): Initialize globs_,
7618 default_version_, default_is_global_, and exact_. Don't
7619 initialize globals_ or locals_.
7620 (Version_script_info::build_lookup_tables): Build local symbols
7622 (Version_script_info::unquote): New function.
7623 (Version_script_info::add_exact_match): New function.
7624 (Version_script_info::build_expression_list_lookup): Remove lookup
7625 parameter. Add is_global parameter. Change all callers. Handle
7626 wildcard pattern specially. Unquote pattern. Call
7628 (Version_script_info::get_name_to_match): New function.
7629 (Version_script_info::get_symbol_version): New function.
7630 (Version_script_info::get_symbol_version_helper): Remove.
7631 (Version_script_info::check_unmatched_names): Call unquote.
7632 * script.h (class Version_script_info): Change get_symbol_version
7633 to be non-inline and add is_global parameter; change all callers.
7634 Rewrite symbol_is_local. Update declarations. Define struct
7635 Version_tree_match, Exact, Globs. Don't define struct Lookup.
7636 Remove globals_ and locals_ members. Add exact_, globs_,
7637 default_version_, is_global_.
7638 (Version_script_info::Glob): Remove pattern, add expression and
7639 is_global. Update constructor. Change all callers.
7640 * dynobj.cc (Versions::finalize): Mark the version symbol as the
7642 (Versions::symbol_section_contents): If a symbol is undefined, or
7643 defined in a dynamic object, set the version index to
7645 * symtab.cc (Symbol_table::add_from_relobj): Don't call
7647 (Symbol_table::add_from_pluginobj): Likewise.
7648 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7650 2010-01-11 Doug Kwan <dougkwan@google.com>
7652 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7653 (incremental_dump_LDADD): Add linking option for libintl.
7654 * Makefile.in: Regenerate.
7656 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
7659 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7661 * testsuite/Makefile.in: Regenerated.
7663 2010-01-10 Doug Kwan <dougkwan@google.com>
7665 * options.h (DEFINE_var): Use parentheses around argument varname__
7666 in macro body to avoid any unintended subsequent substitutions.
7668 2010-01-10 Ian Lance Taylor <iant@google.com>
7670 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7671 candidates before doing symbol resolution.
7673 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7674 ODR candidates if only one is weak.
7676 2010-01-08 Ian Lance Taylor <iant@google.com>
7678 * script.cc (Version_script_info::build_expression_list_lookup):
7679 Don't warn about ambiguous version, just record the ambiguity.
7680 (Version_script_info::get_symbol_version_helper): Give error if
7681 version is ambiguous.
7683 2010-01-08 Doug Kwan <dougkwan@google.com>
7685 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7686 prev_data_size_ and prev_addralign_. Remove initializer for
7687 deleted data member has_been_changed_.
7688 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7689 to determine if the table is empty.
7690 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7692 (Stub_table::add_reloc_stub): Define method in class definition
7693 instead of just declaring it there.
7694 (Stub_table::add_cortex_a8_stub): New method definition.
7695 (Stub_table::update_data_size_and_addralign): Ditto.
7696 (Stub_table::finalize_stubs): Ditto.
7697 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7698 (Stub_table::do_addralign_): Return address alignment in the
7699 (Stub_table::do_reset_address_and_file_offset): Define method in
7700 class definition instead of declaring it there. Set current data
7701 size to be the data size of the previous pass.
7702 (Stub_table::set_final_data_size): Use current data size as the
7704 (Stub_table::relocate_stub): Change parameter type of stub from
7705 Reloc_stub pointer to Stub pointer.
7706 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7707 (Stub_table::Cortex_a8_stub_list): New typedef.
7708 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7709 Stub_table::prev_addralign_): New data member.
7710 (Arm_relobj::Arm_relobj): Initialize data member
7711 section_has_cortex_a8_workaround_.
7712 (Arm_relobj::section_has_cortex_a8_workaround,
7713 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7715 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7717 (Target_arm::relocate_stub): Change parameter type of stub from
7718 Reloc_stub pointer to Stub pointer.
7719 (Insn_template::size, Insn_template::alignment): Handle
7720 THUMB16_SPECIAL_TYPE.
7721 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7722 Stub_table::update_data_size_and_addralign,
7723 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7725 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7726 (Stub_table::do_write): Ditto.
7727 (Target_arm::do_relax): Adjust code for changes in Stub_table.
7729 2010-01-08 Ian Lance Taylor <iant@google.com>
7732 * symtab.h (class Symbol): Remove fields is_target_special_ and
7733 has_plt_offset_. Add field is_defined_in_discarded_section_.
7734 (Symbol::is_defined_in_discarded_section): New function.
7735 (Symbol::set_is_defined_in_discarded_section): New function.
7736 (Symbol::has_plt_offset): Rewrite.
7737 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7738 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7739 Don't initialize is_target_special_ or has_plt_offset_.
7740 Initialize is_defined_in_discarded_section_.
7741 (Symbol_table::add_from_relobj): If appropriate, set
7742 is_defined_in_discarded_section.
7743 * resolve.cc (Symbol::override_base_with_special): Don't test
7744 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7745 * target-reloc.h (relocate_section): Do special handling for
7746 symbols defined in discarded sections for global symbols as well
7749 2010-01-08 Ian Lance Taylor <iant@google.com>
7751 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7752 the SHT_SYMTAB case.
7754 2010-01-08 Ian Lance Taylor <iant@google.com>
7756 * object.cc (Sized_relobj::do_layout): Don't get confused if
7757 layout_eh_frame returns NULL.
7759 2010-01-08 Ian Lance Taylor <iant@google.com>
7762 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7763 dynamic symbol table, use the normal symbol table.
7764 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7767 2010-01-08 Ian Lance Taylor <iant@google.com>
7770 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7773 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7775 * version.cc (print_version): Change to "Copyright 2010".
7777 2010-01-08 Ian Lance Taylor <iant@google.com>
7781 * i386.cc (class Target_i386): Change return type of plt_section
7783 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7784 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7785 tls_desc_rel_ field.
7786 (Output_data_plt_i386::rel_tls_desc): New function.
7787 (Target_i386::rel_tls_desc_section): New function.
7788 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7789 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7790 R_386_TLS_DESC reloc in rel_tls_desc_section.
7791 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7792 Define struct Tlsdesc_info.
7793 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7794 (Target_x86_64::do_reloc_symbol_index): New function.
7795 (Target_x86_64::add_tlsdesc_info): New function.
7796 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7797 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7799 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7801 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7802 (Target_x86_64::rela_tlsdesc_section): New function.
7803 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7805 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7806 (Target_x86_64::do_reloc_addend): New function.
7807 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7808 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7809 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7810 (Output_reloc::type): New function.
7811 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7812 (Output_reloc::is_target_specific): New function.
7813 (Output_reloc::target_arg): New function.
7814 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7815 absolute relocs and target specific relocs.
7816 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7817 add_target_specific.
7818 (class Output_data_reloc) [SHT_RELA]: Likewise.
7819 * output.cc (Output_reloc::Output_reloc): Add four new versions
7820 for absolute relocs and target specific relocs.
7821 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7822 (Output_reloc::get_symbol_index): Likewise.
7823 (Output_reloc::local_section_offset): Check that local_sym_index_
7824 is not TARGET_CODE or 0.
7825 (Output_reloc::symbol_value): Likewise.
7826 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7828 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7829 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7831 * layout.cc (add_target_dynamic_tags): Use output section for
7832 DT_PLTRELSZ and DT_JMPREL.
7834 2010-01-07 Ian Lance Taylor <iant@google.com>
7837 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7839 (class Output_data_reloc_generic): Define.
7840 (class Output_data_reloc_base): Change base class to
7841 Output_data_reloc_generic. Change add() method to call
7842 bump_relative_reloc_count for a relative reloc. Remove
7844 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7846 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7847 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7849 * layout.h (class Layout): Update declaration.
7851 2010-01-07 Ian Lance Taylor <iant@google.com>
7853 * output.h (class Output_data): Add const version of
7854 output_section and do_output_section.
7855 (class Output_section_data): Add const version of
7857 (class Output_section): Likewise.
7858 * layout.cc (Layout::add_target_dynamic_tags): New function.
7859 * layout.h (class Layout): Update declarations.
7860 * arm.cc (Target_arm::do_finalize_sections): Use
7861 add_target_dynamic_tags.
7862 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7863 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7864 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7865 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7867 2010-01-07 Ian Lance Taylor <iant@google.com>
7870 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7873 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
7874 Ian Lance Taylor <iant@google.com>
7877 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7878 Xindex::read_symtab_xindex.
7880 2010-01-07 Doug Kwan <dougkwan@google.com>
7882 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7883 (Insn_template::thumb16_bcond_insn): New method declaration.
7884 (Insn_template): Fix spelling.
7885 (Stub::thumb16_special): New method declaration.
7886 (Stub::do_write): Define virtual method which was previously pure
7888 (Stub::do_thumb16_special): New method declaration.
7889 (Stub::do_fixed_endian_write): New template member.
7890 (Reloc_stub::do_write): Remove.
7891 (Reloc_stub::do_fixed_endian_write): Remove.
7892 (Cortex_a8_stub): New class definition.
7893 (Stub_factory::make_cortex_a8_stub): New method definition.
7894 (Stub_factory::Stub_factory): Add missing static storage class
7895 qualifier for elf32_arm_stub_a8_veneer_blx.
7897 2010-01-07 Ian Lance Taylor <iant@google.com>
7900 * options.h (class General_options): Add --warn-unresolved-symbols
7901 and --error-unresolved-symbols.
7902 * errors.cc (Errors::undefined_symbol): Implement
7903 --warn-unresolved-symbols.
7905 * options.h (class General_options): Add -z text and -z textoff.
7906 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7908 2010-01-06 Sriraman Tallam <tmsriram@google.com>
7910 * gc.h (Garbage_collection::Cident_section_map): New typedef.
7911 (Garbage_collection::cident_sections): New function.
7912 (Garbage_collection::add_cident_section): New function.
7913 (Garbage_collection::cident_sections_): New member.
7914 (gc_process_relocs): Add references to sections whose names are C
7916 * gold.h (cident_section_start_prefix): New constant.
7917 (cident_section_stop_prefix): New constant.
7918 (is_cident): New function.
7919 * layout.cc (Layout::define_section_symbols): Replace string constants
7920 with the newly defined constants.
7921 * object.cc (Sized_relobj::do_layout): Track sections whose names are
7923 * testsuite/Makefile.am: Add gc_orphan_section_test.
7924 * testsuite/Makefile.in: Regenerate.
7925 * testsuite/gc_orphan_section_test.cc: New file.
7926 * testsuite/gc_orphan_section_test.sh: New file.
7928 2010-01-06 Ian Lance Taylor <iant@google.com>
7931 * options.h (class General_options): Add --warn-shared-textrel.
7932 * layout.cc (Layout::finish_dynamic_section): Implement
7933 --warn-shared-textrel.
7936 * options.h (class General_options): Add --warn-multiple-gp.
7938 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7940 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7941 $(THREADSLIB) and $(LIBDL).
7942 * Makefile.in: Rebuild.
7944 2010-01-06 Ian Lance Taylor <iant@google.com>
7947 * options.cc (General_options::parse_section_start): New function.
7948 (General_options::section_start): New function.
7949 (General_options::General_options): Initialize all members.
7950 * options.h: Include <map>
7951 (class General_options): Add --section-start. Add section_starts_
7953 * layout.cc (Layout::attach_allocated_section_to_segment): If
7954 --section-start was used, set the address of the segment. Remove
7955 local sort_sections.
7956 (Layout::relaxation_loop_body): If the address of the load segment
7957 has been set by --section-start, don't use it.
7958 * output.h (Output_segment::update_flags_for_output_section): New
7960 * output.cc (Output_segment::add_output_section): Call
7961 update_flags_for_output_section.
7963 2010-01-05 Ian Lance Taylor <iant@google.com>
7966 * options.h (class General_options): Add --undefined-version.
7967 * script.cc (struct Version_expression): Add was_matched_by_symbol
7969 (Version_script_info::matched_symbol): New function.
7970 (Version_script_info::get_symbol_version_helper): Call
7972 (Version_script_info::check_unmatched_names): New function.
7973 * script.h (class Version_script_info): Update declarations.
7974 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7976 * options.h (class General_options): Use DEFINE_bool_alias for
7977 allow_multiple_definition.
7978 * resolve.cc (Symbol_table::should_override): Don't test
7979 allow_multiple_definition.
7982 * options.h (class General_options): Add --cref.
7983 * main.cc (main): Print cref table if --cref. Don't close mapfile
7984 until after printing cref table.
7985 * cref.cc: Include "symtab.h".
7986 (class Cref_inputs): Define Cref_table_compare and Cref_table.
7987 (Cref_table_compare::operator()): New function.
7988 (Cref_inputs::gather_cref): New function.
7989 (filecol): New static const.
7990 (Cref_inputs::print_cref): New function.
7991 (Cref::print_cref): New function.
7992 * cref.h: Include <cstdio>.
7993 (class Cref): Update declarations.
7994 * mapfile.h (Mapfile::file): New function.
7995 * object.h (class Object): Define Symbols. Declare virtual
7996 do_get_global_symbols.
7997 (Object::get_global_symbols): New function.
7998 * object.cc (Input_objects::add_object): Pass object to cref_ if
8000 (Input_objects::archive_start): Likewise.
8001 (Input_objects::archive_stop): Likewise.
8002 (Input_objects::print_cref): New function.
8003 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8004 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8006 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8008 * plugin.h (class Sized_pluginobj): Update declarations.
8010 2010-01-05 Ian Lance Taylor <iant@google.com>
8012 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8013 to is_default_version. Rename insdef to insdefault.
8014 (Symbol_table::add_from_relobj): Rename def to is_default_version
8015 and local to is_forced_local.
8016 (Symbol_table::add_from_pluginobj): Likewise.
8017 (Symbol_table::add_from_dynobj): Likewise.
8018 (Symbol_table::define_special_symbol): Rename insdef to
8021 2010-01-04 Ian Lance Taylor <iant@google.com>
8024 * options.h (class General_options): Add
8025 --allow-multiple-definition and -z muldefs.
8026 * resolve.cc (Symbol_table::should_override): Don't warn about a
8027 multiple symbol definition if --allow-multiple-definition or -z
8031 * options.h (class General_options): Add --add-needed and
8032 --copy-dt-needed-entries. Tweak --as-needed help entry.
8033 * object.cc (Input_objects::check_dynamic_dependencies): Give an
8034 error if --copy-dt-needed-entries aka --add-needed is used and
8035 would cause a change in behaviour.
8038 * options.h (class General_options): Add -G as a short version of
8039 --shared. Add no-op options -assert, -g, and -i.
8041 2010-01-04 Sriraman Tallam <tmsriram@google.com>
8043 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8044 check for .text or .gnu.linkonce.t sections.
8045 * icf.cc (Icf::find_identical_sections): Ditto.
8046 Change the detection for mangled function name within the section
8048 * icf.h (is_section_foldable_candidate): New function.
8050 2009-12-30 Ian Lance Taylor <iant@google.com>
8053 * options.h (class General_options): Permit two dashes with
8054 --retain-symbols-file.
8056 2009-12-30 Ian Lance Taylor <iant@google.com>
8059 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8060 don't put the file header and segment headers in the text
8064 * common.cc (Sort_commons::operator()): Stabilize sort when both
8066 (Symbol_table::do_allocate_commons_list): When allocating common
8067 symbols, skip a symbol which is no longer common.
8068 * symtab.h (Symbol::is_common): Test whether the symbol comes from
8069 an object before checking its type.
8070 * testsuite/common_test_2.c: New file.
8071 * testsuite/common_test_3.c: New file.
8072 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8073 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8074 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8075 (common_test_2_pic.o, common_test_2.so): New targets.
8076 (common_test_3_pic.o, common_test_3.so): New targets.
8077 * testsuite/Makefile.in: Rebuild.
8080 * script.cc (read_input_script): If we see a new SECTIONS clause,
8081 and we have added an input section, give an error.
8082 * layout.h (class Layout): Add have_added_input_section function.
8083 Add have_added_input_section_ field.
8084 * layout.cc (Layout::Layout): Initialize
8085 have_added_input_section_.
8086 (Layout::layout): Set have_added_input_section_.
8087 (Layout::layout_eh_frame): Likewise.
8089 2009-12-30 Ian Lance Taylor <iant@google.com>
8092 * options.h (class General_options): Add --sort-common option.
8093 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8094 * common.cc (Sort_common): Add sort_order parameter to
8095 constructor. Add sort_order_ field.
8096 (Sort_commons::operator): Check sort_order_.
8097 (Symbol_table::allocate_commons): Determine the sort order.
8098 (Symbol_table::do_allocate_commons): Add sort_order parameter.
8100 (Symbol_table::do_allocate_commons_list): Likewise.
8102 2009-12-30 Ian Lance Taylor <iant@google.com>
8105 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8106 symbols from this object, don't change the visibility of an
8108 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8110 2009-12-30 Ian Lance Taylor <iant@google.com>
8113 * script.h (class Version_script_info): Define Language enum.
8114 Update declarations. Define Glob, Exact, and Lookup types. Add
8115 new fields globals_, locals_, and is_finalized_.
8116 * script.cc: Various formatting fixes.
8117 (class Parser_closure): Change language_stack_ from a vector of
8118 std::string to one of Version_script_info::Language. Adjust all
8120 (class Lazy_demangler): Remove.
8121 (struct Version_expression): Change language from std::string to
8122 Version_script_info::Language.
8123 (Version_script_info::Version_script_info): New function.
8124 (Version_script_info::~Version_script_info): Don't call clear.
8125 (Version_script_info::finalize): New function.
8126 (Version_script_info::build_lookup_tables): New function.
8127 (Version_script_info::build_expression_list_lookup): New
8129 (Version_script_info::get_symbol_version_helper): Rewrite to use
8131 (Version_script_info::print_expression_list): Adjust to use
8132 Version_script_info::Language.
8133 (script_push_lex_into_version_mode): Check that the version script
8134 has not been finalized.
8135 (version_script_push_lang): Change language string to
8136 Version_script_info::Language.
8137 * options.cc (Command_line::version_script): New function.
8138 * options.h (class General_options): Add finalize_dynamic_list
8139 function. Change version_script from declaration to definition.
8140 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8141 * testsuite/version_script.map: Remove duplicate def of foo.
8142 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8144 * testsuite/Makefile.in: Rebuild.
8146 2009-12-30 Ian Lance Taylor <iant@google.com>
8149 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8150 if the input symbol index is 0, make the output symbol index 0.
8152 2009-12-30 Ian Lance Taylor <iant@google.com>
8155 * options.h (class General_options): Add -x/--discard-all.
8156 * object.cc (Sized_relobj::do_count_local_symbols): Handle
8157 --discard-all. If the local symbol needs a dynamic entry, check
8158 that before handling --discard-locals.
8160 2009-12-30 Ian Lance Taylor <iant@google.com>
8163 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8165 (Output_segment::add_output_section): Don't change the flags if
8169 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8170 GNU hash table if they need a dynamic value. Otherwise, don't add
8171 them if they are defined in a dynamic object or are forced local.
8173 2009-12-29 Ian Lance Taylor <iant@google.com>
8176 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8177 .gnu.hash table for a 32-bit target.
8180 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8181 regular and a dynamic object only needs a dynamic symbol table
8182 entry if it is externally visible.
8185 * i386.cc (class Target_i386): Initialize global_offset_table_ in
8186 constructor. Add global_offset_table_ field.
8187 (Target_i386::got_section): Set global_offset_table_.
8188 (Target_i386::do_finalize_sections): Set global_offset_table_
8190 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8191 in constructor. Add global_offset_table_ field.
8192 (Target_x86_64::got_section): Set global_offset_table_.
8193 (Target_x86_64::do_finalize_sections): Set global_offset_table_
8196 * layout.cc (Layout::Layout): Initialize increase_relro_.
8197 (Layout::get_output_section): Add is_relro, is_last_relro, and
8198 is_first_non_relro parameters. Change all callers.
8199 (Layout::choose_output_section): Likewise.
8200 (Layout::add_output_section_data): Likewise.
8201 (Layout::make_output_section): Likewise.
8202 (Layout::set_segment_offsets): Clear increase_relro when using a
8204 * layout.h (class Layout): Add increase_relro method. Add
8205 increase_relro_ field. Update declarations.
8206 * output.cc (Output_section::Output_section): Initialize
8207 is_last_relro_ and is_first_non_relro_.
8208 (Output_segment::add_output_section): Group relro sections is
8209 do_sort is true. Handle is_last_relro and is_first_non_relro.
8210 (Output_segment::maximum_alignment): Remove relro handling.
8211 (Output_segment::set_section_addresses): Add increase_relro
8212 parameter. Change all callers. Add initial alignment to align
8213 relro sections on separate page. Remove old relro handling.
8214 (Output_segment::set_section_list_addresses): Remove in_relro
8215 parameter. Change all callers.
8216 (Output_segment::set_offset): Add increase parameter. Change all
8217 callers. Remove old relro handling.
8218 * output.h (class Output_section): Add new methods: is_last_relro,
8219 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8220 Add is_last_relro_ and is_first_non_relro_ fields.
8221 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8222 Create separate .got.plt section. Call increase_relro.
8223 * x86_64.cc (Target_x86_64::got_section): Likewise.
8224 * testsuite/relro_script_test.t: Add .got.plt.
8227 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8228 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8229 (Layout::finalize): Call set_dynamic_symbol_size.
8230 (Layout::set_dynamic_symbol_size): New function.
8231 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
8232 set_dynamic_symbol_size.
8235 * output.h (class Output_section): Add is_entsize_zero_ field.
8236 * output.cc (Output_section::Output_section): Initialize
8238 (Output_section::set_entsize): If two different entsizes are
8239 requested, force it to zero.
8240 (Output_section::add_input_section): Set flags for .debug_str
8241 before updating section flags. Set entsize.
8242 (Output_section::update_flags_for_input_section): Set SHF_MERGE
8243 and SHF_STRING if all input sections have those flags.
8245 2009-12-29 Rafael Espindola <espindola@google.com>
8247 * main.cc (main): Fix the sys time reporting.
8248 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8251 2009-12-29 Sriraman Tallam <tmsriram@google.com>
8253 * options.cc (General_options::parse_version): Allow -v to exit
8254 without an error if there is nothing to link.
8256 2009-12-29 Ian Lance Taylor <iant@google.com>
8258 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8259 using a version of gcc before 4.1.
8260 * configure: Rebuild.
8262 2009-12-28 Chris Demetriou <cgd@google.com>
8264 * attributes.cc (Output_attributes_section_data::do_write): Use
8265 std::vector::front rather than std::vector::data.
8267 2009-12-28 Ian Lance Taylor <iant@google.com>
8269 * symtab.h (class Symbol_table): Add enum Defined.
8270 * resolve.cc (Symbol_table::should_override): Add defined
8271 parameter. Change all callers. Test whether object is NULL
8272 before calling a method on it.
8273 (Symbol_table::report_resolve_problem): Add defined parameter.
8275 (Symbol_table::should_override_with_special): Likewise.
8276 * symtab.cc (Symbol_table::define_in_output_data): Add defined
8277 parameter. Change all callers.
8278 (Symbol_table::do_define_in_output_data): Likewise.
8279 (Symbol_table::define_in_output_segment): Likewise.
8280 (Symbol_table::do_define_in_output_segment): Likewise.
8281 (Symbol_table::define_as_constant): Likewise.
8282 (Symbol_table::do_define_as_constant): Likewise.
8283 * script.h (class Symbol_assignment): Add is_defsym parameter to
8284 constructor; change all callers.
8285 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8286 parameter. Change all callers. Add is_defsym_ field.
8287 (class Parser_closure): Add parsing_defsym parameter to
8288 constructor; change all callers. Add parsing_defsym accessor
8289 function. Add parsing_defsym_ field.
8291 2009-12-28 Ian Lance Taylor <iant@google.com>
8293 * gold.cc (queue_middle_tasks): Fix formatting.
8294 * object.cc (Relobj::is_section_name_included): Likewise.
8296 2009-12-23 Ian Lance Taylor <iant@google.com>
8298 * i386.cc (Target_i386::do_calls_non_split): Recognize
8299 -fsplit-stack prologue for a function with a static chain.
8300 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8301 -fsplit-stack prologue when using %r11.
8303 2009-12-21 Sriraman Tallam <tmsriram@google.com>
8305 * options.cc (General_options::parse_version): Make -v continue and do
8306 the link like GNU ld does.
8308 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
8310 * Makefile.am (CCFILES): Add timer.cc.
8311 (HFILES): Add timer.h.
8312 * configure.ac: Check for sysconf and times.
8313 * main.cc: include timer.h.
8314 (main): Use Timer instead of get_run_time.
8317 * workqueue.cc: include timer.h.
8318 (Workqueue::find_and_run_task):
8319 Report user, sys and wall time.
8320 * Makefile.in: Regenerate.
8321 * config.in: Regenerate.
8322 * configure: Regenerate.
8324 2009-12-16 Doug Kwan <dougkwan@google.com>
8326 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8328 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8329 relaxed input sections.
8330 * output.cc (Output_section::find_relaxed_input_section): Change
8331 return type to Output_relaxed_input_section pointer. Adjust code
8332 for new type of relaxed_input_section_map_.
8333 * output.h (Output_section::find_relaxed_input_section): Change
8334 return type to Output_relaxed_input_section pointer.
8335 (Output_section::Output_relaxed_input_section_by_input_section_map):
8337 (Output_section::relaxed_input_section_map_): Change type to
8338 Output_section::Output_relaxed_input_section_by_input_section_map.
8339 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8342 2009-12-15 Ian Lance Taylor <iant@google.com>
8344 * layout.cc (Layout::create_shstrtab): Only write out after input
8345 sections if we are compressing debug sections.
8347 2009-12-15 Ian Lance Taylor <iant@google.com>
8349 * archive.cc (Archive::add_symbols): Only look up a symbol without
8350 a version if there is, in fact, a version.
8352 2009-12-14 Ian Lance Taylor <iant@google.com>
8354 Revert -Wshadow changes, all changes from:
8355 2009-12-11 Doug Kwan <dougkwan@google.com>
8356 2009-12-11 Nick Clifton <nickc@redhat.com>
8357 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8359 2009-12-11 Doug Kwan <dougkwan@google.com>
8361 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8363 * attributes.cc (Object_attribute::size): Ditto.
8364 (Attributes_section_data::size): Ditto.
8365 (Attributes_section_data::Attributes_section_data): Ditto.
8366 (Output_attributes_section_data::do_write): Ditto.
8367 * attributes.h (Object_attribute::set_type): Ditto.
8368 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8370 2009-12-11 Nick Clifton <nickc@redhat.com>
8372 * archive.cc: Fix shadowed variable warnings.
8374 * compressed_output.cc: Likewise.
8375 * compressed_output.h: Likewise.
8376 * configure: Likewise.
8377 * dwarf_reader.cc: Likewise.
8378 * dynobj.cc: Likewise.
8379 * dynobj.h: Likewise.
8380 * ehframe.cc: Likewise.
8381 * ehframe.h: Likewise.
8382 * errors.cc: Likewise.
8383 * expression.cc: Likewise.
8384 * fileread.cc: Likewise.
8385 * fileread.h: Likewise.
8386 * freebsd.h: Likewise.
8387 * i386.cc: Likewise.
8389 * incremental.h: Likewise.
8390 * layout.cc: Likewise.
8391 * layout.h: Likewise.
8392 * mapfile.cc: Likewise.
8393 * merge.cc: Likewise.
8394 * merge.h: Likewise.
8395 * object.cc: Likewise.
8396 * object.h: Likewise.
8397 * options.h: Likewise.
8398 * output.cc: Likewise.
8399 * output.h: Likewise.
8400 * parameters.cc: Likewise.
8401 * plugin.cc: Likewise.
8402 * powerpc.cc: Likewise.
8403 * reduced_debug_output.cc: Likewise.
8404 * reduced_debug_output.h: Likewise.
8405 * reloc.cc: Likewise.
8406 * reloc.h: Likewise.
8407 * resolve.cc: Likewise.
8408 * script-sections.cc: Likewise.
8409 * script.cc: Likewise.
8410 * script.h: Likewise.
8411 * sparc.cc: Likewise.
8412 * symtab.cc: Likewise.
8413 * symtab.h: Likewise.
8414 * target-select.cc: Likewise.
8415 * target-select.h: Likewise.
8416 * token.h: Likewise.
8417 * workqueue.cc: Likewise.
8418 * workqueue.h: Likewise.
8419 * x86_64.cc: Likewise.
8421 2009-12-10 Doug Kwan <dougkwan@google.com>
8423 * arm.cc (attributes.h): New include.
8424 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8425 (Arm_relobj::~Arm_relobj): Delete object pointed by
8426 attributes_section_data_.
8427 (Arm_relobj::attributes_section_data): New method definition.
8428 (Arm_relobj::attributes_section_data_): New data member declaration.
8429 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8430 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8431 attributes_section_data_.
8432 (Arm_dynobj::attributes_section_data): New method definition.
8433 (Arm_dynobj::attributes_section_data_): New data member declaration.
8434 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
8435 initialization value of may_use_blx_ to false.
8436 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8437 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8438 object attributes to compute results instead of hard-coding.
8439 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8440 Target_arm::get_secondary_compatible_arch,
8441 Target_arm::set_secondary_compatible_arch
8442 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8443 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8444 New method declarations.
8445 (Target_arm::get_aeabi_object_attribute): New method definition.
8446 (Target_arm::attributes_section_data_): New data member declaration.
8447 (read_arm_attributes_section): New template definition.
8448 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8449 (Arm_dynobj::do_read_symbols): Ditto.
8450 (Target_arm::do_finalize_sections): Merge attributes sections from
8451 input. Check for BLX use after attributes section merging.
8452 Fix __exidx_start and __exidx_end visibility. Create an
8453 .ARM.attributes section if necessary.
8454 (Target_arm::get_secondary_compatible_arch,
8455 Target_arm::set_secondary_compatible_arch,
8456 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8457 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8458 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8459 New method definitions.
8461 2009-12-09 Ian Lance Taylor <iant@google.com>
8463 * plugin.cc (Plugin::load): Don't cast from void* to a function
8466 2009-12-09 Ian Lance Taylor <iant@google.com>
8468 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8471 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
8473 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8474 Replace two_file_shared_1.so with two_file_shared_2.so.
8475 * testsuite/Makefile.in: Regenerated.
8477 2009-12-08 Doug Kwan <dougkwan@google.com>
8479 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8480 (HFILES): Add attributes.h and int_encoding.h.
8481 * Makefile.in: Regenerate.
8482 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8483 function definitions to int_encoding.cc
8484 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8485 prototypes to int_encoding.h
8486 * reduced_debug_output.cc (int_encoding.h): New include.
8487 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8488 function definitions to int_encoding.cc
8489 (insert_into_vector, read_from_pointer): Move template definitions to
8491 * attributes.cc: New file.
8492 * attributes.h: New file.
8493 * int_encoding.cc: New file.
8494 * int_encoding.h: New file.
8496 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
8499 * incremental-dump.cc (dump_incremental_inputs): New.
8500 (main): Use dump_incremental_inputs.
8502 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
8505 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8506 checking elfcpp::STT_FUNC.
8507 (Target_i386::Relocate::relocate): Likewise.
8508 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8510 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8511 symbols from shared libraries into normal FUNC symbols.
8513 * symtab.h (Symbol): Add is_func and use it.
8515 2009-12-05 Doug Kwan <dougkwan@google.com>
8517 * arm.cc (Target_arm::arm_info): Initialize new fields
8518 attributes_section and attributes_vendor.
8519 * i386.cc (Target_i386::i386_info): Same.
8520 * object.cc (Sized_relobj::do_layout): Skip attribute section.
8521 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8522 fields attributes_section and attributes_vendor.
8523 * sparc.cc (Target_sparc::sparc_info): Same.
8524 * target.h (Target::attributes_section, Target::attributes_vendor,
8525 Target::is_attributes_section, Target::attribute_arg_type,
8526 Target::attributes_order): New method definitions.
8527 (Target::Target_info::attributes_section,
8528 Target::Target_info::attributes_vendor): New fields.
8529 (Target::do_attribute_arg_type, Target::do_attributes_order): New
8530 virtual method definitions.
8531 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8532 attributes_section and attributes_vendor.
8533 * testsuite/testfile.cc (Target_test::test_target_info): Same.
8535 2009-12-05 Doug Kwan <dougkwan@google.com>
8537 * arm.cc: Update comments about interworking and stub generation.
8538 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8539 considered as non-PIC.
8540 (Arm_relocate_functions::base_abs): Fix formatting.
8541 (Arm_relocate_functions::got_prel): Fix comment. Change interface
8542 of function to use GOT entry address instead of offset.
8543 (Target_arm::Scan::global): Issue an error if a symbol would need a
8544 PLT does not get one because it is untyped. Remove code to create
8545 dynamic symbols for relative branches.
8546 (Target_arm::Relocate::relocate: Use 0 instead of false since function
8547 takes unsigned integer instead of boolean.
8549 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
8551 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8552 (two_file_test_LDADD): Likewise.
8553 (common_test_1_LDADD): Likewise.
8554 (exception_test_LDADD) Likewise.
8555 (weak_test_LDADD): Likewise.
8556 (many_sections_test_LDADD): Likewise.
8557 (initpri1_LDADD): Likewise.
8558 (script_test_1_LDADD): Likewise.
8559 (script_test_2_LDADD): Likewise.
8560 (justsyms_LDADD): Likewise.
8561 (binary_test_LDADD): Likewise.
8562 (large_LDADD): Likewise.
8563 * testsuite/Makefile.in: Regenerated.
8565 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
8567 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8568 (Symbol_table::override_with_special): Likewise.
8569 (Symbol_table::add_from_object): Likewise.
8571 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8573 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8574 Don't set the data_offset twice.
8576 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8578 * testsuite/Makefile.in: Regenerate.
8580 2009-12-03 Doug Kwan <dougkwan@google.com>
8582 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8583 (Target_arm::do_finalize_sections): Add parameter for symbol table
8584 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
8585 * i386.cc (Target_i386::do_finalize_sections): Add an additional
8586 parameter for symbol table pointer.
8587 * layout.cc (Layout::finalize): Call Target::finalize_sections with
8588 an additional parameter for a pointer to symbol table.
8589 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8590 parameter for a symbol table pointer.
8591 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8592 * target.h (Target::finalize_sections, Target::do_finalize_sections):
8594 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8595 parameter for a symbol table pointer.
8597 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
8599 * incremental.cc (Incremental_inputs_header)
8600 (Incremental_inputs_header_write, Incremental_inputs_entry)
8601 (Incremental_inputs_entry_write): Move ...
8602 * incremental.h (Incremental_inputs_header)
8603 (Incremental_inputs_header_write, Incremental_inputs_entry)
8604 (Incremental_inputs_entry_write): here.
8606 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8608 * incremental.cc (make_sized_incremental_binary): Set the target.
8609 Error if it is incompatible.
8610 * output.h (Output_file): Add filename method.
8612 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8614 * incremental.cc (Incremental_inputs_entry): Remove unused argument
8615 from the get_* methods.
8617 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8619 * incremental-dump.cc (main): Check that the offeset of a script is 0.
8620 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8621 Write 0 for the data_offset of scripts.
8623 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8625 * testsuite/Makefile.am: Add the incremental_test.sh test.
8626 * testsuite/incremental_test.sh: New.
8627 * testsuite/incremental_test_1.c: New.
8628 * testsuite/incremental_test_2.c: New.
8630 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
8632 * incremental-dump.cc (main): Fix typos.
8634 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
8637 * incremental-dump.cc (main): Use llu to print 64 bit values.
8639 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
8640 H.J. Lu <hongjiu.lu@intel.com>
8642 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8644 (incremental_dump_LDADD): Likewise.
8645 * Makefile.in: Regenerated.
8647 2009-11-25 Doug Kwan <dougkwan@google.com>
8651 2009-11-25 Doug Kwan <dougkwan@google.com>
8653 * arm.cc (Target_arm::Target_arm): Move method definition
8654 outside of class definition. Add code to handle
8655 --target1-rel, --target1-abs and --target2= options.
8656 (Target_arm::get_reloc_reloc_type): Change method to be
8657 non-static and const.
8658 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8659 New data member declaration.
8660 (Target_arm::Scan::local, Target_arm::Scan::global,
8661 Target_arm::Relocate::relocate,
8662 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8663 Adjust call to Target_arm::get_real_reloc_type.
8664 (Target_arm::get_real_reloc_type): Use command line options
8665 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8666 * options.h (--target1-rel, --target1-abs, --target2): New
8669 2009-11-25 Doug Kwan <dougkwan@google.com>
8671 * arm.cc (Target_arm::Target_arm): Move method definition outside of
8672 class definition. Add code to handle --target1-rel, --target1-abs
8673 and --target2= options.
8674 (Target_arm::get_reloc_reloc_type): Change method to be non-static
8676 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8678 (Target_arm::Scan::local, Target_arm::Scan::global,
8679 Target_arm::Relocate::relocate,
8680 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8681 call to Target_arm::get_real_reloc_type.
8682 (Target_arm::get_real_reloc_type): Use command line options to
8683 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8684 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8687 2009-11-25 Doug Kwan <dougkwan@google.com>
8689 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8690 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8691 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8693 (Arm_relocate_functions::thm_call): Replace body with a call to
8694 Arm_relocate_functions::thumb_branch_common.
8695 (Arm_relocate_functions::thm_jump24,
8696 Arm_relocate_functions::thm_xpc22): New method definitions.
8697 (Arm_relocate_functions::thumb_branch_common): New method definition.
8698 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8700 (Target_arm::Relocate::relocate): Adjust call to thm_call.
8701 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8703 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8705 * Makefile.am: Build incremental-dump
8706 * Makefile.in: Regenerate.
8707 * incremental-dump.cc: New.
8708 * incremental.cc (Incremental_inputs_header_data,
8709 Incremental_inputs_entry_data): Move to incremental.h
8710 * incremental.h: (Incremental_inputs_header_data,
8711 Incremental_inputs_entry_data): Move from incremental.cc
8713 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8715 * incremental.cc (Incremental_inputs_header,
8716 Incremental_inputs_header_write, Incremental_inputs_entry,
8717 Incremental_inputs_entry_write): Add a typedef with the data type.
8719 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8721 * incremental.cc (Incremental_inputs_header,
8722 Incremental_inputs_header_write, Incremental_inputs_entry,
8723 Incremental_inputs_entry_write): Update comment about which
8724 type has the filed descriptions.
8726 2009-11-15 Doug Kwan <dougkwan@google.com>
8728 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8729 (Arm_relocate_functions::arm_branch_common): Change method defintion
8730 in class definition to a method declaration and update list of formal
8732 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8733 Arm_relocation_functions::jump24): Adjust call to
8734 Arm_relocate_functions::arm_branch_common. Update list of formal
8736 (Arm_relocate_functions::xpc25): New method definition.
8737 (Arm_relocate_functions::arm_branch_common): Move method defintion
8738 out from class definition. Use stubs for mode-switching and extending
8740 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8741 specially. Change code to enable use of stubs in ARM branches.
8743 2009-11-10 Doug Kwan <dougkwan@google.com>
8745 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8746 in method declaration.
8747 (Target_arm::relocate_stub): New method declaration.
8748 (Target_arm::default_target): Change to return a pointer instead of
8750 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8751 Target_arm::default_target.
8752 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8754 (Target_arm::relocate_section): Adjust view.
8755 (Target_arm::relocate_stub): New method definition.
8757 2009-11-10 Doug Kwan <dougkwan@google.com>
8759 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8761 * incremental.cc (open_incremental_binary): Initialized local
8762 variables to avoid warnings.
8763 * object.cc (make_elf_object): Ditto.
8764 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8767 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8770 * testsuite/plugin_test.c: Include "config.h".
8772 2009-11-09 Doug Kwan <dougkwan@google.com>
8774 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8775 (arm_symbol_value): Remove.
8776 (Arm_relocate_functions::arm_branch_common,
8777 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8778 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8779 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8780 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8781 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8782 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8783 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8784 Arm_relocate_functions::thm_mobw_abs_nc,
8785 Arm_relocate_functions::thm_mov_abs,
8786 Arm_relocate_functions::movw_prel_nc,
8787 Arm_relocate_functions::thm_movt_abs,
8788 Arm_relocate_functions::movt_prel,
8789 Arm_relocate_functions::thm_movw_prel_nc,
8790 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8791 (Target_arm::Relocate::relocate): Only decompose address into two
8792 parts if relocation type uses the thumb-bit and pass the actual
8793 bit instead of a flag indicating that the thumb-bit is used. Adjust
8794 calls to methods in Arm_relocate_functions for this change.
8796 2009-11-08 Ian Lance Taylor <iant@google.com>
8799 * reloc.cc: Instantiate
8800 Sized_relobj::initialize_input_to_output_maps and
8801 Sized_relobj:free_input_to_output_maps.
8803 2009-11-06 Ian Lance Taylor <iant@google.com>
8806 * defstd.cc (in_segment): Set only_if_ref true for "end".
8808 2009-11-06 Doug Kwan <dougkwan@google.com>
8810 * arm.cc (class Reloc_stub): Correct a comment.
8811 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8812 (Target_arm::scan_section_for_stubs): New method declaration.
8813 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8814 Change methods from private to protected.
8815 (Target_arm::do_may_relax): New method definition.
8816 (Target_arm::do_relax, Target_arm::group_sections,
8817 Target_arm::scan_reloc_for_stub,
8818 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8819 (Target_arm::arm_input_section_map_): New data member declaration.
8820 (Target_arm::scan_reloc_for_stub,
8821 Target_arm::scan_reloc_section_for_stubs,
8822 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8823 Target_arm::do_relax): New method definitions.
8825 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8827 * configure.ac: Check for (struct stat)::st_mtim
8828 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8829 * config.in: Regenerate.
8830 * configure: Regenerate.
8832 2009-11-05 Ian Lance Taylor <iant@google.com>
8835 * output.cc (Output_segment::add_output_section): Add missing
8838 2009-11-04 Ian Lance Taylor <iant@google.com>
8841 * object.h (class Object): Add is_needed and set_is_needed
8842 methods. Add is_needed_ field. Make bool fields into bitfields.
8843 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8844 defined in a dynamic object and referenced by a regular object,
8845 set is_needed for the dynamic object.
8846 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8847 if the file is marked with as_needed and it is not needed.
8849 2009-11-04 Ian Lance Taylor <iant@google.com>
8852 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8853 tags if data is discarded by linker script.
8854 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8855 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8856 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8857 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8859 2009-11-04 Ian Lance Taylor <iant@google.com>
8861 * layout.cc (Layout::get_output_section): Add is_interp and
8862 is_dynamic_linker_section parameters. Change all callers.
8863 (Layout::choose_output_section): Likewise.
8864 (Layout::make_output_section): Likewise.
8865 (Layout::add_output_section_data): Add is_dynamic_linker_section
8866 parameter. Change all callers.
8867 * layout.h (class Layout): Update declarations.
8868 * output.h (class Output_section): Add is_interp, set_is_interp,
8869 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8870 Add is_interp_, is_dynamic_linker_section_ fields. Change
8871 generate_code_fills_at_write_ to a bitfield.
8872 * output.cc (Output_section::Output_sections): Initialize new
8874 (Output_segment::add_output_section): Add do_sort parameter.
8877 2009-11-03 Ian Lance Taylor <iant@google.com>
8880 * options.h (class General_options): Add --warn-common.
8881 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8882 merging two common symbols.
8883 (Symbol_table::should_override): Handle --warn-common when merging
8884 a common symbol with a defined symbol. Use report_resolve_problem
8885 for multiple definitions.
8886 (Symbol_table::report_resolve_problem): New function.
8887 * symtab.h (class Symbol_table): Declare report_resolve_problem.
8889 2009-11-03 Doug Kwan <dougkwan@google.com>
8891 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8893 (Target_arm::stub_factory): New method definition.
8894 (Target_arm::new_arm_input_section,
8895 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8896 Target_arm::reloc_uses_thumb_bit): New method declarations.
8897 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8898 New type definitions.
8899 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8900 member declarations.
8901 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8902 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8903 New method definitions.
8905 2009-11-03 Ian Lance Taylor <iant@google.com>
8907 * options.h (class General_options): Add --warn_constructors.
8909 2009-11-03 Ian Lance Taylor <iant@google.com>
8912 * defstd.cc (in_section): Add entries for __rel_iplt_start,
8913 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8915 2009-11-03 Ian Lance Taylor <iant@google.com>
8918 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8919 --msgid-bugs-address.
8920 (install-pdf): New target.
8921 (install-data_yes): Look up one directory to find mkinstalldirs.
8923 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
8925 * po/Make-in (.po.gmo): Don't generate .gmo files in source
8928 2009-10-30 Doug Kwan <dougkwan@google.com>
8930 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8932 2009-10-30 Doug Kwan <dougkwan@google.com>
8934 * arm.cc (Stub_addend_reader): New struct template definition
8935 and partial specializations.
8936 (Stub_addend_reader::operator()): New method definition for a
8937 partially specialized template.
8939 2009-10-30 Doug Kwan <dougkwan@google.com>
8941 * arm.cc (Arm_relobj::processor_specific_flags): New method
8943 (Arm_relobj::do_read_symbols): New method declaration.
8944 (Arm_relobj::processor_specific_flags_): New data member declaration.
8945 (Arm_dynobj): New class definition.
8946 (Target_arm::do_finalize_sections): Add input_objects parameter.
8947 (Target_arm::do_adjust_elf_header): New method declaration.
8948 (Target_arm::are_eabi_versions_compatible,
8949 (Target_arm::merge_processor_specific_flags): New method declaration.
8950 (Target_arm::do_make_elf_object): New overloaded method definitions
8952 (Arm_relobj::do_read_symbols): New method definition.
8953 (Arm_dynobj::do_read_symbols): Ditto.
8954 (Target_arm::do_finalize_sections): Add input_objects parameters.
8955 Merge processor-specific flags from all input objects.
8956 (Target_arm::are_eabi_versions_compatible,
8957 Target_arm::merge_processor_specific_flags,
8958 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8959 New method definitions.
8960 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8961 Input_objects pointer type parameter.
8962 * layout.cc (Layout::finalize): Pass input objects to target's.
8963 finalize_sections function.
8964 * output.cc (Output_file_header::do_sized_write): Set ELF file
8965 header's processor-specific flags.
8966 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8967 Input_objects pointer type parameter.
8968 * sparc.cc (Target_sparc::do_finalize_sections): Same.
8969 * target.h (Input_objects): New forward class declaration.
8970 (Target::processor_specific_flags,
8971 Target::are_processor_specific_flags_sect): New method definitions.
8972 (Target::finalize_sections): Add input_objects parameter.
8973 (Target::Target): Initialize processor_specific_flags_ and
8974 are_processor_specific_flags_set_.
8975 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8977 (Target::set_processor_specific_flags): New method definition.
8978 (Target::processor_specific_flags_,
8979 Target::are_processor_specific_flags_set_): New data member
8981 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8982 Input_objects pointer type parameter.
8984 2009-10-30 Doug Kwan <dougkwan@google.com>
8986 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8988 2009-10-28 Ian Lance Taylor <iant@google.com>
8990 * object.h (class Relobj): Drop options parameter from
8991 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8992 do_scan_relocs, do_relocate. Change all callers.
8993 (class Sized_relobj): Drop options parameters from
8994 do_gc_process_relocs, do_scan_relocs, do_relocate,
8995 do_relocate_sections, relocate_sections, emit_relocs_scan,
8996 emit_relocs_scan_reltype. Change all callers.
8997 (struct Relocate_info): Remove options field and all references to
8999 * reloc.h (class Read_relocs): Remove options constructor
9000 parameter and options_ field. Change all callers.
9001 (class Gc_process_relocs, class Scan_relocs): Likewise.
9002 (class Relocate_task): Likewise.
9003 * target-reloc.h (scan_relocs): Remove options parameter. Change
9005 (scan_relocatable_relocs): Likewise.
9006 * target.h (class Sized_target): Remove options parameter from
9007 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
9009 * gc.h (gc_process_relocs): Remove options parameter. Change all
9011 * arm.cc: Update functions to remove options parameters.
9012 * i386.cc: Likewise.
9013 * powerpc.cc: Likewise.
9014 * sparc.cc: Likewise.
9015 * x86_64.cc: Likewise.
9016 * testsuite/testfile.cc: Likewise.
9018 2009-10-28 Doug Kwan <dougkwan@google.com>
9020 * arm.cc (Arm_relobj): New class definition.
9021 (Arm_relobj::scan_sections_for_stubs,
9022 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9023 New method definitions.
9025 2009-10-28 Cary Coutant <ccoutant@google.com>
9027 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9028 (Plugin::cleanup_done_): New member.
9029 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9030 (Plugin_manager::cleanup_done_): Remove.
9031 (Plugin_manager::add_input_file): Edit error message.
9032 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9033 (Plugin_manager::cleanup): Remove use of cleanup_done_.
9035 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
9037 * fileread.cc: (File_read::View::~View): Use the new
9038 data_ownership_ filed.
9039 (File_read::~File_read): Dispose the new whole_file_view_.
9040 (File_read::open): Mmap the whole file if needed.
9041 (File_read::open): Use whole_file_view_ instead of contents_.
9042 (File_read::find_view): Use whole_file_view_ if applicable.
9043 (File_read::do_read): Use whole_file_view_ instead of contents_.
9044 (File_read::make_view): Use whole_file_view_ instead of contents_,
9045 update File_read::View::View call.
9046 (File_read::find_or_make_view): Update File_read::View::View
9048 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9050 (File_read::View::Data_ownership): New enum.
9051 (File_read::View::View): Replace bool mapped_ with Data_ownership
9053 (File_read::View::mapped_): Remove (replaced by data_ownership_).
9054 (File_read::View::data_ownership_): New field.
9055 (File_read::contents_): Remove (replaced by whole_file_view_).
9056 (File_read::whole_file_view_): New field.
9057 * options.h (class General_options): Add --keep-files-mapped.
9059 2009-10-27 Cary Coutant <ccoutant@google.com>
9061 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9062 * testsuite/Makefile.am (plugin_test_5): New test case.
9063 * testsuite/Makefile.in: Regenerate.
9065 2009-10-25 Doug Kwan <dougkwan@google.com>
9067 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9068 from private to protected to allow access by child class.
9069 (Sized_relobj::do_relocate_sections): New method declaration.
9070 (Sized_relobj::relocate_sections): Virtualize.
9071 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9072 Sized_relobj::relocate_sections. Instantiate template explicitly
9073 for different target sizes and endianity.
9075 2009-10-24 Doug Kwan <dougkwan@google.com>
9077 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9078 (Arm_input_section::as_arm_input_section): New method.
9079 (Arm_output_section): New class definition.
9080 (Arm_output_section::create_stub_group,
9081 Arm_output_section::group_sections): New method definitions.
9083 2009-10-22 Doug Kwan <dougkwan@google.com>
9085 * arm.cc (Arm_input_section): New class definition.
9086 (Arm_input_section::init, Arm_input_section:do_write,
9087 Arm_input_section::set_final_data_size,
9088 Arm_input_section::do_reset_address_and_file_offset): New method
9091 2009-10-21 Doug Kwan <dougkwan@google.com>
9093 * arm.cc (Stub_table, Arm_input_section): New forward class
9095 (Stub_table): New class defintion.
9096 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9097 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9098 New method definition.
9100 2009-10-21 Doug Kwan <dougkwan@google.com>
9102 * arm.cc: Update copyright comments.
9103 (Target_arm): New forward class template declaration.
9104 (Arm_address): New type.
9105 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9106 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9107 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9109 (Insn_template): Same.
9110 (DEF_STUBS): New macro.
9111 (Stub_type): New enum type.
9112 (Stub_template): New class definition.
9115 (Stub_factory): Same.
9116 (Target_arm::Target_arm): Initialize may_use_blx_ and
9117 should_force_pic_veneer_.
9118 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9119 Target_arm::should_force_pic_veneer,
9120 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9121 Target_arm::using_thumb_only, Target_arm:;default_target): New
9123 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9124 New data member declarations.
9125 (Insn_template::size, Insn_template::alignment): New method defintions.
9126 (Stub_template::Stub_template): New method definition.
9127 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9128 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9129 (Stub_factory::Stub_factory): New method definition.
9130 * gold.h (string_hash): New template.
9131 * output.h (Input_section_specifier::hash_value): Use
9133 (Input_section_specifier::string_hash): Remove.
9134 * stringpool.cc (Stringpool_template::string_hash): Use
9137 2009-10-20 Doug Kwan <dougkwan@google.com>
9139 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9140 symbols of relaxed input sections.
9141 * output.h (Output_section::find_relaxed_input_section): Make
9144 2009-10-16 Doug Kwan <dougkwan@google.com>
9146 * dynobj.cc (Versions::Versions): Initialize version_script_.
9147 Only insert base version symbol definition for a shared object
9148 if version script defines any version versions.
9149 (Versions::define_base_version): New method definition.
9150 (Versions::add_def): Check that base version is not needed.
9151 (Versions::add_need): Define base version lazily.
9152 * dynobj.h (Versions::define_base_version): New method declaration.
9153 (Versions::needs_base_version_): New data member declaration.
9154 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9155 (check_DATA): Add no_version_test.stdout.
9156 (libno_version_test.so, no_version_test.o no_version_test.stdout):
9158 * testsuite/Makefile.in: Regenerate.
9159 * testsuite/no_version_test.c: New file.
9160 * testsuite/no_version_test.sh: Ditto.
9162 2009-10-16 Doug Kwan <dougkwan@google.com>
9164 * expression.cc (class Segment_start_expression): New class definition.
9165 (Segment_start_expression::value): New method definition.
9166 (script_exp_function_segment_start): Return a new
9167 Segment_start_expression.
9168 * gold/script-c.h (script_saw_segment_start_expression): New function
9170 * script-sections.cc (Script_sections::Script_sections): Initialize
9171 SAW_SEGMENT_START_EXPRESSION_ to false.
9172 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9173 and -Tbbs options to specify section addresses if given in
9174 command line and no SEGMENT_START expression is seen in a script.
9175 * script-sections.h (Script_sections::saw_segment_start_expression,
9176 Script_sections::set_saw_segment_start_expression): New method
9178 (Script_sections::saw_segment_start_expression_): New data member
9180 * script.cc (script_saw_segment_start_expression): New function.
9181 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9182 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9183 script_test_7.sh and script_test_8.sh.
9184 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9185 script_test_8.stdout.
9186 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9187 (script_test_6, script_test_6.stdout, script_test_7,
9188 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9189 * Makefile.in: Regenerate.
9190 * testsuite/script_test_6.sh: New file.
9191 * testsuite/script_test_6.t: Same.
9192 * testsuite/script_test_7.sh: Same.
9193 * testsuite/script_test_7.t: Same.
9194 * testsuite/script_test_8.sh: Same.
9196 2009-10-16 Doug Kwan <dougkwan@google.com>
9198 * output.cc (Output_segment::set_section_list_address): Cast
9199 expressions to unsigned long long type to avoid format warnings.
9201 2009-10-15 Ian Lance Taylor <iant@google.com>
9203 * script.cc (Script_options::add_symbol_assignment): Always add a
9204 dot assignment to script_sections_.
9205 * script-sections.cc (Script_sections::add_dot_assignment):
9206 Initialize if necessary.
9208 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9209 program headers with no load segment if there is a linker script.
9211 * layout.cc (Layout::set_segment_offsets): Align the file offset
9212 to the segment aligment for -N or -n with no load segment.
9213 * output.cc (Output_segment::add_output_section): Don't crash if
9214 the first section is a TLS section.
9215 (Output_segment::set_section_list_addresses): Print an error
9216 message if the address moves backward in a linker script.
9217 * script-sections.cc
9218 (Output_section_element_input::set_section_addresses): Don't
9219 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9220 (Orphan_output_section::set_section_addresses): Likewise.
9222 2009-10-15 Doug Kwan <dougkwan@google.com>
9224 * layout.cc (Layout::finish_dynamic_section): Generate tags
9225 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9226 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9227 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9229 2009-10-14 Ian Lance Taylor <iant@google.com>
9231 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9233 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9234 data_shdr fields of relinfo.
9235 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9236 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
9237 R_386_TLS_LDO_32, adjust based on section flags.
9238 (Target_i386::Relocate::fix_up_ldo): Remove.
9240 2009-10-13 Ian Lance Taylor <iant@google.com>
9242 Add support for -pie.
9243 * options.h (class General_options): Add -pie and
9245 (General_options::output_is_position_independent): Test -pie.
9246 (General_options::output_is_executable): Return true if not shared
9247 and not relocatable.
9248 (General_options::output_is_pie): Remove.
9249 * options.cc (General_options::finalize): Reject incompatible uses
9251 * gold.cc (queue_middle_tasks): A -pie link is not static.
9252 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9253 * symtab.cc (Symbol::final_value_is_known): Return false if
9254 output_is_position_independent.
9255 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9256 output_is_position_independent.
9257 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9258 output_is_position_independent.
9259 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9260 output_is_position_independent.
9261 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9263 (basic_pie_test.o, basic_pie_test): New targets.
9264 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9265 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9266 (two_file_pie_test): New target.
9267 * testsuite/Makefile.in: Rebuild.
9268 * README: Remove note saying that -pie is not supported.
9270 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
9272 * options.h (class General_options): Add -init and -fini.
9273 * layout.cc (Layout::finish_dynamic_section): Emit
9274 given init and fini functions.
9276 2009-10-13 Sriraman Tallam <tmsriram@google.com>
9278 * gc.h (gc_process_relocs): Check if icf is enabled using new
9280 * gold.cc (queue_initial_tasks): Likewise.
9281 (queue_middle_tasks): Likewise.
9282 * object.cc (do_layout): Likewise.
9283 * symtab.cc (is_section_folded): Likewise.
9284 * main.cc (main): Likewise.
9285 * reloc.cc (Read_relocs::run): Likewise.
9286 (Sized_relobj::do_scan_relocs): Likewise.
9287 * icf.cc (is_function_ctor_or_dtor): New function.
9288 (Icf::find_identical_sections): Check if function is ctor or dtor when
9290 * options.h (General_options::icf): Change option to be an enum.
9291 (Icf_status): New enum.
9292 (icf_enabled): New method.
9293 (icf_safe_folding): New method.
9294 (set_icf_status): New method.
9295 (icf_status_): New variable.
9296 * (options.cc) (General_options::finalize): Set icf_status_.
9297 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9298 icf_test and icf_keep_unique_test to use the --icf enum flag.
9299 * testsuite/icf_safe_test.sh: New file.
9300 * testsuite/icf_safe_test.cc: New file.
9302 2009-10-12 Sriraman Tallam <tmsriram@google.com>
9304 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9305 includes to gc.h and icf.h.
9306 * arm.cc: Include gc.h.
9307 * gold.cc: Likewise.
9308 * i386.cc: Likewise.
9309 * powerpc.cc: Likewise.
9310 * sparc.cc: Likewise.
9311 * x86_64.cc: Likewise.
9312 * gc.h: Include icf.h.
9314 2009-10-11 Ian Lance Taylor <iant@google.com>
9316 * plugin.cc: Include "gold.h" before other header files.
9318 2009-10-10 Chris Demetriou <cgd@google.com>
9320 * options.h (Input_file_argument::Input_file_type): New enum.
9321 (Input_file_argument::is_lib_): Replace with...
9322 (Input_file_argument::type_): New member.
9323 (Input_file_argument::Input_file_argument): Take Input_file_type
9324 'type' rather than boolean 'is_lib' as second argument.
9325 (Input_file_argument::is_lib): Use type_.
9326 (Input_file_argument::is_searched_file): New function.
9327 (Input_file_argument::may_need_search): Handle is_searched_file.
9328 * options.cc (General_options::parse_library): Support -l:filename.
9329 (General_options::parse_just_symbols): Update for Input_file_argument
9331 (Command_line::process): Likewise.
9332 * archive.cc (Archive::get_file_and_offset): Likewise.
9333 * plugin.cc (Plugin_manager::release_input_file): Likewise.
9334 * script.cc (read_script_file, script_add_file): Likewise.
9335 * fileread.cc (Input_file::Input_file): Likewise.
9336 (Input_file::will_search_for): Handle is_searched_file.
9337 (Input_file::open): Likewise.
9338 * readsyms.cc (Read_symbols::get_name): Likewise.
9339 * testsuite/Makefile.am (searched_file_test): New test.
9340 * testsuite/Makefile.in: Regenerate.
9341 * testsuite/searched_file_test.cc: New file.
9342 * testsuite/searched_file_test_lib.cc: New file.
9344 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9345 Ian Lance Taylor <iant@google.com>
9347 * descriptor.cc: Include <cstdio> and "binary-io.h".
9348 (Descriptors::open): Open the files in binary mode always.
9349 * script.cc (Lex::get_token): Treat \r as whitespace.
9351 2009-10-09 Ian Lance Taylor <iant@google.com>
9353 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9355 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9356 Ian Lance Taylor <iant@google.com>
9358 * configure.ac: Check for readv function also.
9359 * fileread.cc (readv): Define if not HAVE_READV.
9360 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9362 * config.in: Regenerate.
9363 * configure: Regenerate.
9365 2009-10-09 Doug Kwan <dougkwan@google.com>
9367 * layout.cc (Layout::make_output_section): Call target hook to make
9368 ordinary output section.
9369 (Layout::finalize): Adjust parameter list of call the
9370 Target::may_relax().
9371 * layout.h (class Layout::section_list): New method.
9372 * merge.h (Output_merge_base::entsize): Change visibility to public.
9373 (Output_merge_base::is_string, Output_merge_base::do_is_string):
9375 (Output_merge_string::do_is_string): New method.
9376 * object.cc (Sized_relobj::do_setup): renamed from
9377 Sized_relobj::set_up.
9378 * object.h (Sized_relobj::adjust_shndx,
9379 Sized_relobj::initializ_input_to_output_maps,
9380 Sized_relobj::free_input_to_output_maps): Change visibilities to
9382 (Sized_relobj::setup): Virtualize.
9383 (Sized_relobj::do_setup): New method declaration.
9384 (Sized_relobj::invalidate_section_offset,
9385 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9386 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9387 * options.cc (parse_int): New function.
9388 * options.h (parse_int): New declaration.
9389 (DEFINE_int): New macro.
9390 (stub_group_size): New option.
9391 * output.cc (Output_section::Output_section): Initialize memebers
9392 merge_section_map_, merge_section_by_properties_map_,
9393 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9394 (Output_section::add_input_section): Handled deferred code-fill
9395 generation and remove an old comment.
9396 (Output_section::add_relaxed_input_section): New method definition.
9397 (Output_section::add_merge_input_section): Use merge section by
9398 properties map to speed to search. Update merge section maps
9400 (Output_section::build_relaxation_map): New method definition.
9401 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9403 (Output_section::relax_input_section): Renamed to
9404 Output_section::convert_input_sections_to_relaxed_sections and change
9405 interface to take a vector of pointers to relaxed sections.
9406 (Output_section::find_merge_section,
9407 Output_section::find_relaxed_input_section): New method definitions.
9408 (Output_section::is_input_address_mapped,
9409 Output_section::output_offset, Output_section::output_address):
9410 Use output section data maps to speed up searching.
9411 (Output_section::find_starting_output_address): Add comments.
9412 (Output_section::do_write,
9413 Output_section::write_to_postprocessing_buffer): Do code-fill
9414 generation as appropriate.
9415 (Output_section::get_input_sections): Invalidate relaxed input section
9417 (Output_section::restore_states): Adjust type of checkpoint .
9418 Invalidate relaxed input section map.
9419 * output.h (Output_merge_base): New class declaration.
9420 (Input_section_specifier): New class defintion.
9421 (class Output_relaxed_input_section) Change base class to
9422 Output_section_data_build.
9423 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9424 base class initializer.
9425 (Output_section::add_relaxed_input_section): New method declaration.
9426 (Output_section::Input_section): Change visibility to protected.
9427 (Output_section::Input_section::relobj,
9428 Output_section::Input_section::shndx): Handle relaxed input sections.
9429 Output_section::input_sections) Change visibility to protected. Also
9430 define overload to return a non-const pointer.
9431 (Output_section::Merge_section_properties): New class defintion.
9432 (Output_section::Merge_section_by_properties_map,
9433 Output_section::Output_section_data_by_input_section_map,
9434 Output_section::Relaxation_map): New types.
9435 (Output_section::relax_input_section): Rename method to
9436 Output_section::convert_input_sections_to_relaxed_sections and change
9437 interface to take a vector of relaxed section pointers.
9438 (Output_section::find_merge_section,
9439 Output_section::find_relaxed_input_section,
9440 Output_section::build_relaxation_map,
9441 Output_section::convert_input_sections_in_list_to_relaxed_sections):
9442 New method declarations.
9443 (Output_section::merge_section_map_
9444 Output_section::merge_section_by_properties_map_,
9445 Output_section::relaxed_input_section_map_,
9446 Output_section::is_relaxed_input_section_map_valid_,
9447 Output_section::generate_code_fills_at_write_): New data members.
9448 * script-sections.cc
9449 (Output_section_element_input::set_section_addresses): Call
9450 current_data_size and addralign methods of relaxed input sections.
9451 (Orphan_output_section::set_section_addresses): Call current_data_size
9452 and addralign methods of relaxed input sections.
9453 * symtab.cc (Symbol_table::compute_final_value): Extract template
9454 from the body of Symbol_table::sized_finalize_symbol.
9455 (Symbol_table::sized_finalized_symbol): Call
9456 Symbol_table::compute_final_value.
9457 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9458 (Symbol_table::compute_final_value): New templated method declaration.
9459 * target.cc (Target::do_make_output_section): New method defintion.
9460 * target.h (Target::make_output_section): New method declaration.
9461 (Target::relax): Add more parameters for input objects, symbol table
9462 and layout. Adjust call to do_relax.
9463 (Target::do_make_output_section): New method declaration.
9464 (Target::do_relax): Add parameters for input objects, symbol table
9467 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9469 * pread.c: Include stdio.h.
9471 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9473 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9476 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9478 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9479 Change read_shndx type to unsigned int.
9480 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9482 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9483 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9484 Change read_shndx type to unsigned int.
9485 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9487 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9488 * layout.cc (Layout::create_symtab_sections): Cast the result of
9489 local_symcount * symsize to off_t in the gold_assert.
9491 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9493 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9494 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9496 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9497 (Arm_relocate_functions::thm_abs5): New function.
9498 (Arm_relocate_functions::abs12): New function.
9499 (Arm_relocate_functions::abs16): New function.
9500 (Arm_relocate_functions::base_abs): New function.
9501 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9502 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
9503 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9505 (Scan::global): Likewise.
9506 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9507 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9508 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9509 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9512 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9514 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9515 (Arm_relocate_functions::movt_prel): New function.
9516 (Arm_relocate_functions::thm_movw_prel_nc): New function.
9517 (Arm_relocate_functions::thm_movt_prel): New function.
9518 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9519 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9520 (Scan::global, Relocate::relocate): Likewise.
9521 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9523 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9525 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9526 Incremental_checker.
9527 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9529 (class Incremental_inputs_header): New class.
9530 (Incremental_inputs_header_writer): Edit comment.
9531 (Incremental_inputs_entry): New class.
9532 (Incremental_inputs_entry_writer): Edit comment.
9533 (Sized_incremental_binary::do_find_incremental_inputs_section):
9534 Add *strtab_shndx parameter, fill it.
9535 (Sized_incremental_binary::do_check_inputs): New method.
9536 (Incremental_checker::can_incrementally_link_output_file): Use
9537 Sized_incremental_binary::check_inputs.
9538 (Incremental_inputs::report_command_line): Save command line in
9541 (Incremental_binary::find_incremental_inputs_section): New
9543 (Incremental_binary::do_find_incremental_inputs_section): Add
9544 strtab_shndx parameter.
9545 (Incremental_binary::do_check_inputs): New pure virtual method.
9546 (Sized_incremental_binary::do_check_inputs): Declare.
9547 (Incremental_checker::Incremental_checker): Add incremental_inputs
9548 parameter, use it to initialize incremental_inputs_.
9549 (Incremental_checker::incremental_inputs_): New field.
9550 (Incremental_checker::command_line): New method.
9551 (Incremental_checker::inputs): New method.
9552 (Incremental_checker::command_line_): New field.
9554 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9556 * incremental.cc: Include <cstdarg> and "target-select.h".
9557 (vexplain_no_incremental): New function.
9558 (explain_no_incremental): New function.
9559 (Incremental_binary::error): New method.
9560 (Sized_incremental_binary::do_find_incremental_inputs_section): New
9562 (make_sized_incremental_binary): New function.
9563 (open_incremental_binary): New function.
9564 (can_incrementally_link_file): Add checks if output is ELF and has
9566 * incremental.h: Include "elfcpp_file.h" and "output.h".
9567 (Incremental_binary): New class.
9568 (Sized_incremental_binary): New class.
9569 (open_incremental_binary): Declare.
9570 * object.cc (is_elf_object): Use
9571 elfcpp::Elf_recognizer::is_elf_file.
9572 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9573 * output.h (Output_file::filesize): New method.
9575 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9577 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9579 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9580 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9582 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9584 (Arm_relocate_functions::movw_abs_nc): New function.
9585 (Arm_relocate_functions::movt_abs): New function.
9586 (Arm_relocate_functions::thm_movw_abs_nc): New function.
9587 (Arm_relocate_functions::thm_movt_abs): New function.
9588 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9589 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9590 (Scan::global): Likewise.
9591 (Relocate::relocate): Likewise.
9592 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9594 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9596 * arm.cc (Arm_relocate_functions::got_prel) New function.
9597 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9598 (Relocate::relocate): Likewise.
9599 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9601 2009-10-06 Ian Lance Taylor <iant@google.com>
9603 * options.h (class General_options): Define
9604 split_stack_adjust_size parameter.
9605 * object.h (class Object): Add uses_split_stack_ and
9606 has_no_split_stack_ fields. Add uses_split_stack and
9607 has_no_split_stack accessor functions. Declare
9608 handle_split_stack_section.
9609 (class Reloc_symbol_changes): Define.
9610 (class Sized_relobj): Define Function_offsets. Declare
9611 split_stack_adjust, split_stack_adjust_reltype, and
9613 * object.cc (Object::handle_split_stack_section): New function.
9614 (Sized_relobj::do_layout): Call handle_split_stack_section.
9615 * dynobj.cc (Sized_dynobj::do_layout): Call
9616 handle_split_stack_section.
9617 * reloc.cc (Sized_relobj::relocate_sections): Call
9618 split_stack_adjust for executable sections in split_stack
9619 objects. Pass reloc_map to relocate_section.
9620 (Sized_relobj::split_stack_adjust): New function.
9621 (Sized_relobj::split_stack_adjust_reltype): New function.
9622 (Sized_relobj::find_functions): New function.
9623 * target-reloc.h: Include "object.h".
9624 (relocate_section): Add reloc_symbol_changes parameter. Change
9626 * target.h (class Target): Add calls_non_split method. Declare
9627 do_calls_non_split virtual method. Declare match_view and
9629 * target.cc: Include "elfcpp.h".
9630 (Target::do_calls_non_split): New function.
9631 (Target::match_view): New function.
9632 (Target::set_view_to_nop): New function.
9633 * gold.cc (queue_middle_tasks): Give an error if mixing
9634 split-stack and non-split-stack objects with -r.
9635 * i386.cc (Target_i386::relocate_section): Add
9636 reloc_symbol_changes parameter.
9637 (Target_i386::do_calls_non_split): New function.
9638 * x86_64.cc (Target_x86_64::relocate_section): Add
9639 reloc_symbol_changes parameter.
9640 (Target_x86_64::do_calls_non_split): New function.
9641 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9643 * powerpc.cc (Target_powerpc::relocate_section): Add
9644 reloc_symbol_changes parameter.
9645 * sparc.cc (Target_sparc::relocate_section): Add
9646 reloc_symbol_changes parameter.
9647 * configure.ac: Call AM_CONDITIONAL for the default target.
9648 * configure: Rebuild.
9649 * testsuite/Makefile.am (TEST_AS): New variable.
9650 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9651 (check_DATA): Add split_i386 and split_x86_64 files.
9652 (SPLIT_DEFSYMS): Define.
9653 (split_i386_[1234n].o): New targets.
9654 (split_i386_[124]): New targets.
9655 (split_i386_[1234r].stdout): New targets.
9656 (split_x86_64_[1234n].o): New targets.
9657 (split_x86_64_[124]): New targets.
9658 (split_x86_64_[1234r].stdout): New targets.
9659 (MOSTLYCLEANFILES): Add new executables.
9660 * testsuite/split_i386.sh: New file.
9661 * testsuite/split_x86_64.sh: New file.
9662 * testsuite/split_i386_1.s: New file.
9663 * testsuite/split_i386_2.s: New file.
9664 * testsuite/split_i386_3.s: New file.
9665 * testsuite/split_i386_4.s: New file.
9666 * testsuite/split_i386_n.s: New file.
9667 * testsuite/split_x86_64_1.s: New file.
9668 * testsuite/split_x86_64_2.s: New file.
9669 * testsuite/split_x86_64_3.s: New file.
9670 * testsuite/split_x86_64_4.s: New file.
9671 * testsuite/split_x86_64_n.s: New file.
9672 * testsuite/testfile.cc (Target_test): Update relocation_section
9674 * testsuite/Makefile.in: Rebuild.
9676 2009-10-06 Ian Lance Taylor <iant@google.com>
9678 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9679 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9680 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
9681 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9682 the address on ldo_addrs_.
9683 (Target_i386::Relocate::fix_up_ldo): New function.
9685 2009-10-06 Rafael Espindola <espindola@google.com>
9687 * plugin.cc (add_input_library): New.
9688 (Plugin::load): Add add_input_library to tv.
9689 (Plugin_manager::add_input_file): Add the is_lib argument.
9690 (add_input_file): Update call to Plugin_manager::add_input_file.
9691 (add_input_library): New.
9692 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9694 2009-09-30 Doug Kwan <dougkwan@google.com>
9696 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9697 symbol and call Symbol::may_need_copy_reloc to determine if
9698 a copy reloc is needed.
9699 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9700 nocopyreloc is given in command line.
9701 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9702 given in command line.
9703 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9704 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9705 of the removed Target_i386::may_need_copy_reloc.
9706 * options.h (copyreloc): New option with default value false.
9707 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9708 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9709 instead of the removed Target_powerpc::may_need_copy_reloc.
9710 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9711 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9712 instead of the removed Target_sparc::may_need_copy_reloc.
9713 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9714 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9715 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9716 instead of the removed Target_x86_64::may_need_copy_reloc.
9718 2009-09-30 Ian Lance Taylor <iant@google.com>
9720 * object.h (class Object): Remove target_ field, and target,
9721 sized_target, and set_target methods.
9722 (Object::sized_target): Remove.
9723 (class Sized_relobj): Update declarations. Remove sized_target.
9724 * object.cc (Sized_relobj::setup): Remove target parameter.
9726 (Input_objects::add_object): Don't do anything with the target.
9727 (make_elf_sized_object): Add punconfigured parameter. Change all
9728 callers. Set or test parameter target.
9729 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9731 * parameters.cc (Parameters::set_target): Change parameter type to
9733 (Parameters::default_target): Remove.
9734 (set_parameters_target): Change parameter type to be non-const.
9735 (parameters_force_valid_target): New function.
9736 (parameters_clear_target): New function.
9737 * parameters.h (class Parameters): Update declarations. Remove
9738 default_target method. Add sized_target and clear_target
9739 methods. Change target_ to be non-const.
9740 (set_parameters_target): Update declaration.
9741 (parameters_force_valid_target): Declare.
9742 (parameters_clear_target): Declare.
9743 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9744 as NULL if we aren't searching.
9745 (Add_symbols::run): Don't check for compatible target.
9746 * fileread.cc (Input_file::open_binary): Call
9747 parameters_force_valid_target.
9748 * gold.cc (queue_middle_tasks): Likewise.
9749 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9750 set_target on object.
9751 * dynobj.h (class Sized_dynobj): Update declarations.
9752 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9753 make_elf_object returns NULL.
9754 (Archive::include_member): Don't check whether object target is
9756 * output.cc (Output_section::add_input_section): Get target from
9758 (Output_section::relax_input_section): Likewise.
9759 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9761 (Sized_relobj::do_scan_relocs): Likewise.
9762 (Sized_relobj::relocate_sections): Likewise.
9763 * resolve.cc (Symbol_table::resolve): Likewise.
9764 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9765 parameter. Change all callers.
9766 (Symbol_table::add_from_object): Get target from parameters.
9767 (Symbol_table::add_from_relobj): Don't check object target.
9768 (Symbol_table::add_from_dynobj): Likewise.
9769 (Symbol_table::define_special_symbol): Get target from
9771 * symtab.h (class Symbol_table): Update declaration.
9772 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9773 parameter. Change all callers. Clear parameter target.
9774 (Binary_test): Test target here.
9775 * testsuite/object_unittest.cc (gold_testsuite): Remove
9776 target_test_pointer parameter. Change all callers.
9777 (Object_test): Test target here.
9779 2009-09-26 Ian Lance Taylor <iant@google.com>
9781 * testsuite/initpri1.c: Don't try to use constructor priorities if
9782 compiling with gcc before 4.3.
9784 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9786 * testsuite/retain_symbols_file_test.sh (check_present): Change
9787 output file name to retain_symbols_file_test.stdout.
9788 (check_absent): Likewise.
9790 2009-09-18 Craig Silverstein <csilvers@google.com>
9792 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9793 * options.cc: Include <cerrno> and <fstream>.
9794 (General_options::finalize): Parse -retain-symbols-file tag.
9795 * options.h: New flag.
9796 (General_options): New method should_retain_symbol, new
9797 variable symbols_to_retain.
9798 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9799 should_retain_symbol map.
9800 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9801 * testsuite/Makefile.in: Regenerate.
9802 * testsuite/retain_symbols_file_test.sh: New file.
9804 2009-09-18 Nick Clifton <nickc@redhat.com>
9806 * po/es.po: Updated Spanish translation.
9808 2009-09-17 Doug Kwan <dougkwan@google.com>
9810 * debug.h (DEBUG_RELAXATION): New constant.
9811 (DEBUG_ALL): Add DEBUG_RELAXATION.
9812 (debug_string_to_enum): Add relaxation debug option.
9814 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9815 Layout::Relaxation_debug_check::read_sections,
9816 Layout::Relaxation_debug_check::read_sections): New method definitions.
9817 (Layout::Layout): Initialize data members
9818 record_output_section_data_from_scrips_,
9819 script_output_section_data_list_ and relaxation_debug_check_.
9820 (Layout::save_segments, Layout::restore_segments,
9821 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9822 Layout::relaxation_loop_body): New method definitions.
9823 (Layout::finalize): Support relaxation. Move section layout code to
9824 Layout::relaxation_loop_body.
9825 (Layout::set_asection_address_from_script): Move code for orphan
9826 section placement out.
9827 (Layout::place_orphan_sections_in_script): New method definition.
9828 * layout.h (Output_segment_headers, Output_file_header):
9829 New forward class declarations.
9830 (Layout::~Layout): Define.
9831 (Layout::new_output_section_data_from_script): New method definition.
9832 (Layout::place_orphan_sections_in_script): New method declaration.
9833 (Layout::Segment_states): New type declaration.
9834 (Layout::save_segments, Layout::restore_segments,
9835 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9836 Layout::relaxation_loop_body): New method declarations.
9837 (Layout::Output_section_data_list): New type declaration.
9838 (Layout::Relaxation_debug_check): New class definition.
9839 (Layout::record_output_section_data_from_script_,
9840 Layout::script_output_section_data_list_, Layout::segment_states_,
9841 Layout::relaxation_debug_check_): New data members.
9842 * output.cc: (Output_section_headers::do_size): New method definition.
9843 (Output_section_headers::Output_section_headers): Move size
9844 computation to Output_section_headers::do_size.
9845 (Output_segment_headers::do_size): New method definition.
9846 (Output_file_header::Output_file_header): Move size computation to
9847 Output_file_header::do_size and call it.
9848 (Output_file_header::do_size): New method definition.
9849 (Output_data_group::Output_data_group): Adjust call to
9850 Output_section_data.
9851 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9852 (Output_symtab_xindex::do_write): Add array bound check.
9853 (Output_section::Input_section::print_to_mapfile): Handle
9854 RELAXED_INPUT_SECTION_CODE.
9855 (Output_section::Output_section): Initialize data member checkpoint_.
9856 (Output_section::~Output_section): Delete checkpoint object pointed
9858 (Output_section::add_input_section): Always add an Input_section if
9860 (Output_section::add_merge_input_section): Add assert.
9861 (Output_section::relax_input_section): New method definition.
9862 (Output_section::set_final_data_size): Set load address to zero for
9863 an unallocated section.
9864 (Output_section::do_address_and_file_offset_have_reset_values):
9865 New method definition.
9866 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9867 Handle relaxed input section.
9868 (Output_section::sort_attached_input_sections): Checkpoint input
9869 section list lazily.
9870 (Output_section::get_input_sections): Change type of input_sections to
9871 list of Simple_input_section pointers. Checkpoint input section list
9872 lazily. Also handle relaxed input sections.
9873 (Output_section::add_input_section_for_script): Take a reference to
9874 a Simple_input_section object instead of Relobj pointer and section
9875 index as parameter. Handle relaxed input sections.
9876 (Output_section::save_states, Output_section::restore_states): New
9878 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9879 (Output_data::is_data_size_fixed): New method definition.
9880 (Output_data::reset_addresss_and_file_offset): Do not reset data size
9882 (Output_data::address_and_file_offset_have_reset_values): New method
9884 (Output_data::do_address_and_file_offset_have_reset_values): New method
9886 (Output_data::set_data_size): Check that data size is not fixed.
9887 (Output_data::fix_data_size): New method definition.
9888 (Output_data::is_data_size_fixed_): New data member.
9889 (Output_section_headers::set_final_data_size): New method definition.
9890 (Output_section_headers::do_size): New method declaration.
9891 (Output_segment_headers::set_final_data_size): New method definition.
9892 (Output_segment_headers::do_size): New method declaration.
9893 (Output_file_header::set_final_data_size)::New method definition.
9894 (Output_file_header::do_size)::New method declaration.
9895 (Output_section_data::Output_section_data): Add new parameter
9896 is_data_size_fixed and use it to fix data size.
9897 (Output_data_const::Output_data_const): Adjust call to base class
9898 constructor and fix data size.
9899 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9900 base class constructor and fix data size.
9901 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9902 base class constructor and fix data size.
9903 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9904 class constructor and fix data size.
9905 (Output_data_group::set_final_data_size): New method definition.
9906 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9907 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9908 class constructor and fix data size.
9909 (Output_relaxed_input_section): New class definition.
9910 (Output_section::Simple_input_section): New class definition.
9911 (Output_section::get_input_sections): Adjust parameter list.
9912 (Output_section::add_input_section_for_script): Same.
9913 (Output_section::save_states, Output_section::restore_states,
9914 Output_section::do_address_and_file_offset_have_reset_values,
9915 (Output_section::Input_section::Input_section): Handle
9916 RELAXED_INPUT_SECTION_CODE. Add new overload for
9917 Output_relaxed_input_section.
9918 (Output_section::Input_section::is_input_section,
9919 Output_section::Input_section::set_output_section): Handle relaxed
9921 (Output_section::Input_section::is_relaxed_input_section,
9922 Output_section::Input_section::output_section_data,
9923 Output_section::Input_section::relaxed_input_section): New method
9925 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9927 (Output_section::Input_section::u1_): Update comments.
9928 (Output_section::Input_section::u2_): Add new union member poris.
9929 (Output_section::Checkpoint_output_section): New classs definition.
9930 (Output_section::relax_input_section): New method declaration.
9931 (Output_section::checkpoint_): New data member.
9932 (Output_segment): Update comments.
9933 (Output_segment::Output_segment): Un-privatize copy constructor.
9934 (Output_segment::operator=): Un-privatize.
9935 * script-sections.cc (Output_section_element::Input_section_list):
9936 Change element type to Output_section::Simple_input_section.
9937 (Output_section_element_dot_assignment::set_section_addresses):
9938 Register output section data for relaxation clean up.
9939 (Output_data_exression::Output_data_expression): Adjust call to base
9940 constructor to fix data size.
9941 (Output_section_element_data::set_section_addresses): Register
9942 Output_data_expression object for relaxation clean up.
9943 (struct Input_section_info): Replace Relobj pointer and section index
9944 pair with Output_section::Simple_input_section and Convert struct to a
9946 (Input_section_sorter::operator()): Adjust access to
9947 Input_section_info data member to use accessors.
9948 (Output_section_element_input::set_section_addresses): Use layout
9949 parameter. Adjust code to use Output_section::Simple_input_section
9950 and Input_secction_info classes. Register filler for relaxation
9952 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9953 and section index pair with Output_section::Simple_input_section
9954 class. Adjust code accordingly.
9955 (Phdrs_element::release_segment): New method definition.
9956 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9958 (Script_sections::release_segments): New method definition.
9959 * gold/script-sections.h (Script_sections::release_segments): New
9961 * gold/target.h (Target::may_relax, Target::relax,
9962 Target::do_may_relax, Target::do_relax): New method definitions.
9964 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9966 * arm.cc (has_signed_unsigned_overflow): New function.
9967 (Arm_relocate_functions::abs8): New function.
9968 (Target_arm::Scan::local): Handle R_ARM_ABS8.
9969 (Target_arm::Scan::global): Likewise.
9970 (Target_arm::relocate::relocate): Likewise.
9971 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9974 2009-09-16 Cary Coutant <ccoutant@google.com>
9976 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9977 * testsuite/Makefile.in: Regenerate.
9979 2009-09-11 Nick Clifton <nickc@redhat.com>
9981 * po/gold.pot: Updated by the Translation project.
9983 2009-09-08 Cary Coutant <ccoutant@google.com>
9985 * output.cc (Output_file::open): Add execute permission to empty file.
9986 * testsuite/Makefile.am (permission_test): New test.
9987 * testsuite/Makefile.in: Regenerate.
9989 2009-09-02 Ian Lance Taylor <iant@google.com>
9991 * output.cc (Output_file::resize): Call map_no_anonymous rather
9994 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
9996 * gold.cc: Include "incremental.h".
9997 (queue_initial_tasks): Call Incremental_checker methods.
9998 * incremental.cc: Include "output.h".
9999 (Incremental_checker::can_incrementally_link_output_file): New
10001 * incremental.h (Incremental_checker): New class.
10003 * output.cc (Output_file::open_for_modification): New method.
10004 (Output_file::map_anonymous): Changed return type to bool. Record
10005 map in base_ field.
10006 (Output_file::map_no_anonymous): New method, broken out of map.
10007 (Output_file::map): Use map_no_anonymous and map_anonymous.
10008 * output.h (class Output_file): Update declarations.
10010 2009-08-24 Cary Coutant <ccoutant@google.com>
10012 * options.h (Command_line::Pre_options): New class.
10013 (Command_line::pre_options): New member.
10014 * options.cc (gold::options::ready_to_register): New variable.
10015 (One_option::register_option): Do nothing if not registering options.
10016 Assert if same short option registered twice.
10017 (General_options::General_options): Turn off option registration when
10019 (Command_line::Pre_options::Pre_options): New constructor.
10021 2009-08-24 Cary Coutant <ccoutant@google.com>
10023 * options.h (General_options::no_keep_memory): Remove incorrect
10026 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10028 * Makefile.am (am__skiplex, am__skipyacc): New.
10029 * Makefile.in: Regenerate.
10031 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10033 * Makefile.am (AM_CPPFLAGS): Renamed from ...
10034 (INCLUDES): ... this.
10035 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10036 (AM_CPPFLAGS): Renamed from ...
10037 (INCLUDE): ... this.
10038 * Makefile.in, testsuite/Makefile.in: Regenerate.
10040 * Makefile.in: Regenerate.
10041 * aclocal.m4: Likewise.
10042 * config.in: Likewise.
10043 * configure: Likewise.
10044 * testsuite/Makefile.in: Likewise.
10046 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10047 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10048 * Makefile.in: Regenerate.
10049 * testsuite/Makefile.in: Regenerate.
10051 2009-08-19 Cary Coutant <ccoutant@google.com>
10053 * resolve.cc (Symbol_table::resolve): Don't complain about defined
10054 symbols in shared libraries overridden by hidden or internal symbols
10055 in the main program.
10057 2009-08-19 Chris Demetriou <cgd@google.com>
10059 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10060 checking source file names in error messages.
10062 2009-08-18 Doug Kwan <dougkwan@google.com>
10064 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10065 an elcpp::Ehdr as parameter. Adjust call to set_target.
10066 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10067 an elfcpp::Ehdr as parameter.
10068 * object.cc (Object::set_target): Remove the version that looks up
10069 a target and sets it.
10070 (Sized_relobj::setup): Take a Target object instead of
10071 an elfcpp::Ehdr as parameter. Adjust call to set_target.
10072 (make_elf_sized_object): Find target and ask target to
10073 make an ELF object.
10074 * object.h: (Object::set_target): Remove the version that looks up
10075 a target and sets it.
10076 (Sized_relobj::setup): Take a Target object instead of
10077 an elfcpp:Ehdr as parameter.
10078 * target.cc: Include dynobj.h.
10079 (Target::do_make_elf_object_implementation): New.
10080 (Target::do_make_elf_object): New.
10081 * target.h (Target::make_elf_object): New template declaration.
10082 (Target::do_make_elf_object): New method declarations.
10083 (Target::do_make_elf_object_implementation): New template declaration.
10085 2009-08-14 Ian Lance Taylor <iant@google.com>
10087 * gold.h (FUNCTION_NAME): Define.
10088 (gold_unreachable): Use FUNCTION_NAME.
10090 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10092 * icf.cc (Icf::find_identical_sections): Issue a warning when a
10093 symbol in the --keep-unique list is not found.
10095 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10097 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10098 been maked as --keep-unique.
10099 (Icf::unfold_section): New function.
10100 * icf.h (Icf::unfold_section): New function.
10101 * options.h (General_options::keep_unique): New option.
10102 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10103 * testsuite/Makefile.in: Regenerate.
10104 * testsuite/icf_keep_unique_test.sh: New file.
10105 * testsuite/icf_keep_unique_test.cc: New file.
10107 2009-08-12 Cary Coutant <ccoutant@google.com>
10110 * resolve.cc (Symbol_table::resolve): Check for references from
10111 dynamic objects to hidden and internal symbols.
10112 * testsuite/Makefile.am (hidden_test.sh): New test.
10113 * testsuite/Makefile.in: Regenerate.
10114 * testsuite/hidden_test.sh: New script.
10115 * testsuite/hidden_test_1.c: New test source.
10116 * testsuite/hidden_test_main.c: New test source.
10118 2009-08-11 Doug Kwan <dougkwan@google.com>
10120 * arm.cc: Update comments.
10121 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10122 segment to locate the .ARM.exidx section if present.
10124 2009-08-09 Doug Kwan <dougkwan@google.com>
10126 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10129 2009-08-07 Sriraman Tallam <tmsriram@google.com>
10130 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10133 2009-08-06 Sriraman Tallam <tmsriram@google.com>
10135 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10136 valid tls_segment only for non-debug-section relocations.
10137 * testsuite/Makefile.am: Add gc_tls_test.
10138 * testsuite/Makefile.in: Regenerate.
10139 * testsuite/gc_tls_test.cc: New file.
10140 * testsuite/gc_tls_test.sh: New file.
10142 2009-08-05 Sriraman Tallam <tmsriram@google.com>
10144 * icf.cc: New file.
10146 * Makefile.am (CCFILES): Add icf.cc.
10147 (HFILES): Add icf.h
10148 * Makefile.in: Regenerate.
10149 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10150 * gc.h (gc_process_relocs): Populate lists used by icf to contain
10151 section, symbol and addend information for the relocs.
10152 * gold.cc (queue_middle_tasks): Call identical code folding.
10153 * gold.h: Add defines for multimap.
10154 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10155 to the call of finalize_local_symbols.
10156 * main.cc (main): Create object of class Icf.
10157 * object.cc (Sized_relobj::do_layout): Allow this function to be
10158 called twice during icf.
10159 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10160 to sections marked as identical by icf.
10161 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10163 (Sized_relobj::do_section_entsize): New function.
10164 * object.h (Object::section_entsize): New function.
10165 (Object::do_section_entsize): New pure virtual function.
10166 (Relobj::finalize_local_symbols): Add new parameter.
10167 (Relobj::do_section_entsize): New function.
10168 * options.h (General_options::icf): New option.
10169 (General_options::icf_iterations): New option.
10170 (General_options::print_icf_sections): New option.
10171 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10172 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10173 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10175 * symtab.cc (Symbol_table::is_section_folded): New function.
10176 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
10177 to sections marked as identical by icf.
10178 * symtab.h (Symbol_table::set_icf): New function.
10179 (Symbol_table::icf): New function.
10180 (Symbol_table::is_section_folded): New function.
10181 (Symbol_table::icf_): New data member.
10182 * target-reloc.h (relocate_section): Ignore sections folded by icf.
10183 * testsuite/Makefile.am: Add commands to build icf_test.
10184 * testsuite/Makefile.in: Regenerate.
10185 * testsuite/icf_test.sh: New file.
10186 * testsuite/icf_test.cc: New file.
10188 2009-07-24 Chris Demetriou <cgd@google.com>
10190 * layout.cc (is_compressible_debug_section): Fix incorrect
10191 comment about compressed section names.
10193 2009-07-20 Ian Lance Taylor <ian@airs.com>
10196 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10198 2009-07-16 Ian Lance Taylor <iant@google.com>
10201 * layout.h: #include <map>.
10202 (class Kept_section): Change from struct to class. Add accessors
10203 and setters. Add section size to Comdat_group mapping. Change
10204 Comdat_group to std::map. Add is_comdat_ field. Add
10205 linkonce_size field in union.
10206 (class Layout): Update declaration of find_or_add_kept_section.
10207 Don't declare find_kept_object.
10208 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10209 parameter. Add object, shndx, is_comdat, and is_group_name
10210 parameters. Change all callers. Adjust for new Kept_section.
10211 (Layout::find_kept_object): Remove.
10212 * object.cc (Sized_relobj::include_section_group): Update use of
10213 Kept_section. Rename secnum to shndx. Only record
10214 Kept_comdat_section if sections are the same size.
10215 (Sized_relobj::include_linkonce_section): Update use of
10216 Kept_section. Only record Kept_comdat_section if sections are the
10217 same size. Set size of linkonce section.
10218 (Sized_relobj::map_to_kept_section): Update call to
10219 get_kept_comdat_section.
10220 * object.h (class Sized_relobj): Rename fields in
10221 Kept_comdat_section to drop trailing underscores; change object
10222 field to Relobj*. Change Kept_comdat_section_table to store
10223 struct rather than pointer.
10224 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10225 Add kept_object and kept_shndx parameters. Change all callers.
10226 (Sized_relobj::get_kept_comdat_section): Change return type to
10227 bool. Add kept_object and kept_shndx parameters. Change all
10229 * plugin.cc (Pluginobj::include_comdat_group): Update call to
10230 Layout::find_or_add_kept_section.
10232 2009-07-09 Ian Lance Taylor <iant@google.com>
10234 * merge.cc (Object_merge_map::initialize_input_to_output_map):
10235 Reserve space in the hash table.
10237 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
10239 * fileread.cc (File_read::get_mtime): New method.
10240 * fileread.h (Timespec): New structure.
10241 (File_read::get_mtime): New method.
10242 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10243 Renamed from timestamp_nsec.
10244 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10246 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10248 (Incremental_inputs::report_archive): Save mtime; style fix.
10249 (Incremental_inputs::report_obejct): Save mtime; style fix.
10250 (Incremental_inputs::report_script): Save mtime; style fix.
10251 (Incremental_inputs::finalize_inputs): Style fix.
10252 (Incremental_inputs::finalize): Style fix.
10253 (Incremental_inputs::create_input_section_data): Store inputs
10255 * incremental.h (Incremental_inputs::report_script): Add mtime
10257 (Incremental_inputs::Input_info::Input_info): Intialize only one
10259 (Incremental_inputs::Input_info::archive): Move to nameless
10261 (Incremental_inputs::Input_info::obejct): Move to nameless union.
10262 (Incremental_inputs::Input_info::script): Move to nameless union.
10263 (Incremental_inputs::mtime): New field.
10264 * script.cc (read_input_script): Pass file mtime to
10266 * script.h (Script_info::inputs): Style fix.
10268 2009-07-01 Ian Lance Taylor <ian@airs.com>
10270 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10273 2009-06-24 Ian Lance Taylor <iant@google.com>
10276 * layout.cc (Layout::choose_output_section): If we find an
10277 existing section, update the flags.
10278 (Layout::create_notes): New function, broken out of
10280 (Layout::finalize): Don't create note sections.
10281 (Layout::create_note): Don't crash if linker script discards
10283 (Layout::create_gold_note): Likewise.
10284 (Layout::create_build_id): Likewise. Don't set
10285 after_input_sections on the section.
10286 (Layout::create_executable_stack_info): Remove target parameter.
10288 * layout.h (class Layout): Declare create_notes. Update
10289 declaration of create_executable_stack_info.
10290 * gold.cc (queue_middle_tasks): Call create_notes.
10291 * output.cc (Output_section::update_flags_for_input_section): Move
10292 here from output.h. If SHF_ALLOC flag is newly set, mark address
10294 * output.h (Output_data::mark_address_invalid): New function.
10295 (class Output_section): Only declare, not define,
10296 update_flags_for_input_section. Remove set_flags.
10298 2009-06-24 Ian Lance Taylor <iant@google.com>
10300 * script-sections.cc (Output_section_definition::
10301 set_section_addresses): Rename shadowing local load_address to
10304 2009-06-24 Ian Lance Taylor <iant@google.com>
10307 * reloc.cc (relocate_sections): Skip empty relocation sections.
10309 2009-06-23 Ian Lance Taylor <iant@google.com>
10312 * layout.cc (Layout::create_note): Use choose_output_section
10313 rather than make_output_section.
10315 2009-06-23 Ian Lance Taylor <iant@google.com>
10318 * options.cc (General_options::parse_V): Set printed_version_.
10319 (General_options::General_options): Initialize printed_version_.
10320 * options.h (class General_options): Add printed_version_ field.
10321 * gold.cc (queue_initial_tasks): If there are no input files,
10322 don't give a fatal error if we printed the version information.
10323 (queue_middle_tasks): If using -r with a shared object, give a
10324 fatal error rather than an ordinary error.
10326 2009-06-23 Ian Lance Taylor <iant@google.com>
10329 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10330 (Layout::make_output_section): Set have_stabstr_section_ if we see
10331 a .stab*str section.
10332 (Layout::finalize): Call link_stabs_sections.
10333 (Layout::link_stabs_sections): New file.
10334 * layout.h (class Layout): Add have_stabstr_section_ field.
10335 Declare link_stabs_sections.
10337 2009-06-23 Doug Kwan <dougkwan@google.com>
10339 * Makefile.am (libgold_a_LIBADD): New.
10340 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10341 * Makefile.in: Regenerate.
10342 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10343 * configure: Regenerate.
10344 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10345 * fileread.cc: Include sys/state.h
10346 * gold.h: Declare memmem and strndup if found missing.
10347 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10349 2009-06-23 Ian Lance Taylor <iant@google.com>
10351 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10352 * configure: Rebuild.
10354 2009-06-23 Ian Lance Taylor <iant@google.com>
10357 * object.cc (Object::section_contents): Don't try to get a view if
10358 the section has length zero.
10359 (Object::handle_gnu_warning_section): If the section is empty, use
10360 the name of the section as the warning.
10362 2009-06-23 Ian Lance Taylor <iant@google.com>
10365 * stringpool.h (class Stringpool_template): Add optimize_ field.
10366 (Stringpool_template::set_optimize): New function.
10367 * stringpool.cc (Stringpool_template::Stringpool_template):
10368 Initialize optimize_ field.
10369 (Stringpool_template::set_string_offsets): Test local optimize
10370 fild rather than parameter.
10371 * layout.cc (Layout::Layout): Call set_optimize on the section
10374 2009-06-22 Ian Lance Taylor <iant@google.com>
10377 * yyscript.y: Parse TARGET.
10378 * script.cc (script_set_target): New function.
10379 * script-c.h (script_set_target): Declare.
10380 * options.cc (General_options::string_to_object_format): Rename
10381 from string_to_object_format in anonymous namespace. Change
10383 * options.h (class General_options): Declare
10384 string_to_object_format.
10386 2009-06-22 Ian Lance Taylor <iant@google.com>
10388 * script-sections.cc (Script_sections::create_segments): Don't put
10389 program headers in a PT_LOAD segment if -n or -N.
10391 2009-06-22 Ian Lance Taylor <iant@google.com>
10394 * options.h (class General_options): Add -z lazy and -z now. Sort
10395 -z options into alphabetical order.
10396 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10398 2009-06-21 Ian Lance Taylor <iant@google.com>
10400 * layout.cc (Layout::make_output_section): Call
10401 Target::new_output_section.
10402 (Layout::attach_allocated_section_to_segment): Put large section
10403 sections in a separate load segment with the large segment flag
10405 (Layout::segment_precedes): Sort large data segments after other
10407 (align_file_offset): New static function.
10408 (Layout::set_segment_offsets): Use align_file_offset.
10409 * output.h (class Output_section): Add is_small_section_ and
10410 is_large_section_ fields.
10411 (Output_section::is_small_section): New function.
10412 (Output_section::set_is_small_section): New function.
10413 (Output_section::is_large_section): New function.
10414 (Output_section::set_is_large_section): New function.
10415 (Output_section::is_large_data_section): New function.
10416 (class Output_segment): Add is_large_data_segment_ field.
10417 (Output_segment::is_large_data_segment): New function.
10418 (Output_segment::set_is_large_data_segment): New function.
10419 * output.cc (Output_section::Output_section): Initialize new
10421 (Output_segment::Output_segment): Likewise.
10422 (Output_segment::add_output_section): Add assertion that large
10423 data sections always go in large data segments. Force small data
10424 sections to the end of the list of data sections. Force small BSS
10425 sections to the start of the list of BSS sections. For large BSS
10426 sections to the end of the list of BSS sections.
10427 * symtab.h (class Symbol): Declare is_common_shndx.
10428 (Symbol::is_defined): Check Symbol::is_common_shndx.
10429 (Symbol::is_common): Likewise.
10430 (class Symbol_table): Define enum Commons_section_type. Update
10431 declarations. Add small_commons_ and large_commons_ fields.
10432 * symtab.cc (Symbol::is_common_shndx): New function.
10433 (Symbol_table::Symbol_table): Initialize new fields.
10434 (Symbol_table::add_from_object): Put small and large common
10435 symbols in the right list.
10436 (Symbol_table::sized_finalized_symbol): Check
10437 Symbol::is_common_shndx.
10438 (Symbol_table::sized_write_globals): Likewise.
10439 * common.cc (Symbol_table::do_allocate_commons): Allocate new
10440 common symbol lists. Don't call do_allocate_commons_list if the
10442 (Symbol_table::do_allocate_commons_list): Remove is_tls
10443 parameter. Add comons_section_type parameter. Change all
10444 callers. Handle small and large common symbols.
10445 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10446 Symbol::is_common_shndx.
10447 * resolve.cc (symbol_to_bits): Likewise.
10448 * target.h (Target::small_common_shndx): New function.
10449 (Target::small_common_section_flags): New function.
10450 (Target::large_common_shndx): New function.
10451 (Target::large_common_section_flags): New function.
10452 (Target::new_output_section): New function.
10453 (Target::Target_info): Add small_common_shndx, large_common_shndx,
10454 small_common_section_flags, and large_common_section_flags
10456 (Target::do_new_output_section): New virtual function.
10457 * arm.cc (Target_arm::arm_info): Initialize new fields.
10458 * i386.cc (Target_i386::i386_info): Likewise.
10459 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10461 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10462 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10463 (Target_x86_64::do_new_output_section): New function.
10464 * configure.ac: Define conditional MCMODEL_MEDIUM.
10465 * testsuite/Makefile.am (check_PROGRAMS): Add large.
10466 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10467 (large_LDFLAGS): Define.
10468 * testsuite/large.c: New file.
10469 * testsuite/testfile.cc (Target_test::test_target_info):
10470 Initialize new fields.
10471 * configure, testsuite/Makefile.in: Rebuild.
10473 2009-06-05 Doug Kwan <dougkwan@google.com>
10475 * Makefile.am (CCFILES): Add target.cc.
10476 * Makefile.in: Regenerate.
10477 * i386.cc (class Target_i386): Define new virtual method to
10478 override do_is_local_label_name in parent.
10479 * object.cc (Sized_relobj::do_count_local_symbols): Discard
10480 local symbols if --discard-locals or -X is given.
10481 * options.h (class General_options): Declare new options
10482 '--discard-locals' and '-X' for discarding locals.
10483 * target.h (class Target): Define new methods is_local_label_name.
10484 Declare new virtual method do_is_local_label_name.
10485 * target.cc: New file.
10486 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10487 (check_SCRIPTS): Add discard_locals_test.sh.
10488 (check_DATA): Add discard_local_tests.syms.
10489 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10490 (discard_local_tests.syms, discard_locals_test.o): New make rules.
10491 * testsuite/Makefile.in: Regenerate.
10492 * testsuite/discard_locals_test.c: New file.
10493 * testsuite/discard_locals_test.sh: Same.
10495 2009-06-05 Doug Kwan <dougkwan@google.com>
10497 * object.cc (Sized_relobj::Sized_relobj): Initialize
10498 discarded_eh_frame_shndx_ to -1U.
10499 (Sized_relobj::do_layout): Record index of a discard .eh_frame
10501 (Sized_relobj::do_count_local_symbols): Skip local symbols in
10502 a discarded .eh_frame section.
10503 (Sized_relobj::do_finalize_local_symbols): Ditto.
10504 * object.h (class Sized_relobj): Declare new member
10505 discarded_eh_frame_shndx_.
10506 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10507 (local_labels_test.o, local_labels_test): New rules.
10508 * testsuite/Makefile.in: Regenerate.
10510 2009-06-04 Doug Kwan <dougkwan@google.com>
10512 * layout.cc (Layout::section_name_mapping): Add mapping for
10513 special ARM sections.
10515 2009-06-03 Doug Kwan <dougkwan@google.com>
10517 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10518 (utils::has_overflow): Same.
10520 2009-06-03 Ian Lance Taylor <iant@google.com>
10522 * layout.cc (Layout::section_name_mapping): New array, replacing
10523 Layout::linkonce_mapping.
10524 (Layout::section_name_mapping_count): New variable, replacing
10525 Layout::linkonce_mapping_count.
10526 (Layout::linkonce_output_name): Remove.
10527 (Layout::output_section_name): Rewrite.
10528 * layout.h (class Layout): Rename Linkonce_mapping to
10529 Section_name_mapping, linkonce_mapping to section_name_mapping,
10530 linkonce_mapping_count to section_name_mapping_count. Don't
10531 declare linkonce_output_name.
10533 2009-06-03 Doug Kwan <dougkwan@google.com>
10535 * gold/arm.cc (namespace utils): New.
10536 (Target_arm::reloc_is_non_pic): Define new method.
10537 (class Arm_relocate_functions): New.
10538 (Target_arm::Relocate::relocate): Handle relocation types used by
10541 2009-06-03 Ian Lance Taylor <iant@google.com>
10543 * arm.cc (Target_arm::scan::global): Use || instead of |.
10545 2009-06-02 Doug Kwan <dougkwan@google.com>
10547 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
10548 issued_non_pic_error_.
10549 (class Target_arm::Scan): Declare new method check_non_pic.
10550 Define new method symbol_needs_plt_entry.
10551 Declare new data member issued_non_pic_error_.
10552 (class Target_arm::Relocate): Declare new method
10553 should_apply_static_reloc.
10554 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10555 (Target_arm::Scan::check_non_pic): Define new method.
10556 (Target_arm::Scan::local): Handle a small subset of reloc types used
10558 (Target_arm::Scan::local): Same.
10559 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10561 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
10563 * incremental.cc (Incremental_inputs::report_command_line): Filter
10564 out --incremental-* options.
10566 2009-05-29 Doug Kwan <dougkwan@google.com>
10568 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10570 (class Target_arm): Update comment.
10571 (Target_arm::Target_arm): Initialize new data members GOT_,
10572 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10573 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10574 and Target_arm::rel_dyn_section.
10575 Declare new_enum Target_arm::Got_type.
10576 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10578 Update commments for member do_dynsym_value.
10579 (Target_arm::got_size, Target_arm::plt_section,
10580 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10581 new methods inside class defintion.
10582 (Target_arm::got_section): Define new method.
10583 (Target_arm::rel_dyn_section): Same.
10584 (Output_data_plt_arm): New template class.
10585 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10586 (Output_data_plt_arm:do_adjust_output_section): Define new method.
10587 (Output_data_plt_arm::add_entry): Same.
10588 (Output_data_plt_arm::first_plt_entry): Define new
10589 static data member for PLT instruction template.
10590 (Output_data_plt_arm::plt_entry): Same.
10591 (Output_data_plt_arm::do_write): Define new method.
10592 (Target_arm::make_plt_entry): Same.
10593 (Target_arm::do_finalize_sections): Same.
10594 (Target_arm::do_dynsym_value): Same.
10596 2009-05-28 Doug Kwan <dougkwan@google.com>
10598 * Makefile.am (TARGETSOURCES): Add arm.cc.
10599 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10600 * Makefile.in: Regenerate.
10601 * arm.cc: New file.
10602 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10604 2009-05-26 Doug Kwan <dougkwan@google.com>
10606 * options.cc (General_options::parse_exclude_libs). Fix a comment.
10607 (General_options::check_excluded_libs): Strip off directories in
10608 archive name before matching like GNU ld does.
10609 * testsuite/Makefile.am (MOSTLYCLEANFILES,
10610 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10611 (exclude_libs_test_LDFLAGS): Add linker option
10612 -Wl,--exclude-libs,libexclude_libs_test_3
10613 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10614 an explicit archive without using -l.
10615 (alt/libexclude_libs_test_3.a): New make rule.
10616 * testsuite/Makefile.in: Regenerate.
10617 * testsuite/exclude_libs_test.c : Declare lib3_default().
10619 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10620 * exclude_libs_test_3.c: New file.
10622 2009-05-26 Nick Clifton <nickc@redhat.com>
10624 * po/id.po: New Indonesian translation.
10625 * po/gold.pot: Updated template file.
10627 2009-05-22 Sriraman Tallam <tmsriram@google.com>
10629 * testsuite/Makefile.am: Add -ffunction-sections to compile
10630 gc_comdat_test files. Add -Wl,--gc-sections to build
10632 * testsuite/Makefile.in: Regenerate.
10633 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10635 2009-05-21 Sriraman Tallam <tmsriram@google.com>
10637 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10638 kept comdat section was garbage collected.
10639 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10640 * testsuite/Makefile.in: Regenerate.
10641 * testsuite/gc_comdat_test.sh: New file.
10642 * testsuite/gc_comdat_test_1.cc: New file.
10643 * testsuite/gc_comdat_test_2.cc: New file.
10645 2009-05-19 Doug Kwan <dougkwan@google.com>
10647 * archive.cc (Archive::Archive): Move constructor from archive.h
10648 to here. Initialize no_export_.
10649 (Archive::get_elf_object_for_member): Set no_export flag of object.
10650 * archive.h (Archive::Archive): Move constructor body to
10652 (Archive::no_export): New method.
10653 (Archive::no_export_): New field.
10654 * object.h (Object::Object): Initialize no_export_ to false.
10655 (Object::no_export, Object::set_no_export): New methods.
10656 (Object::no_export_): New field.
10657 * options.cc (General_options::parse_exclude_libs): New method.
10658 (General_options::check_excluded_libs) Same.
10659 * options.h (exclude_libs): New option.
10660 (General_options::check_excluded_libs): New method declaration.
10661 (General_options::excluded_libs_): New field.
10662 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10663 default or protected visibility if an object has no-export flag set.
10664 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10665 (check_SCRIPTS): Add exclude_libs_test.sh.
10666 (check_DATA): Add exclude_libs_test.syms.
10667 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10668 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10669 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10670 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10671 (exclude_libs_test.syms, libexclude_libs_test_1.a,
10672 libexclude_libs_test_2.a): New rules.
10673 * testsuite/Makefile.in: Regenerate.
10674 * testsuite/exclude_libs_test.c: New file.
10675 * testsuite/exclude_libs_test.sh: Ditto.
10676 * testsuite/exclude_libs_test_1.c: Ditto.
10677 * testsuite/exclude_libs_test_2.c: Ditto.
10679 2009-05-15 Ian Lance Taylor <iant@google.com>
10681 * configure.ac: Check for declarations for cases where libiberty.h
10682 checks HAVE_DECL_xxx.
10683 * configure, config.in: Rebuild.
10685 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
10687 * gold.h (Incremental_argument_list): Remove (invalid) forward
10689 * incremental.cc (Incremental_inputs::report_achive): New method.
10690 (Incremental_inputs::report_object): New method.
10691 (Incremental_inputs::report_script): New method.
10692 (Incremental_inputs::finalize_inputs): New method.
10693 (Incremental_inputs::finalize): Call finalize_inputs().
10694 (Incremental_inputs::sized_create_incremental_inputs_section_data):
10695 Create inputs entries.
10696 * incremental.h (Incremental_input_type): New enum.
10697 (Incremental_inputs::Incremental_input): Initialize new fields.
10698 (Incremental_inputs::report_inputs): New method.
10699 (Incremental_inputs::report_achive): New method.
10700 (Incremental_inputs::report_object): New method.
10701 (Incremental_inputs::report_script): New method.
10702 (Incremental_inputs::finalize_inputs): New method.
10703 (Incremental_inputs::Input_info): New struct.
10704 (Incremental_inputs::Input_info_map): New typedef.
10705 (Incremental_inputs::lock_): New field.
10706 (Incremental_inputs::Inputs_): New field.
10707 (Incremental_inputs::Inputs_map): New field.
10708 * main.cc (main): Call Incremental_input::report_inputs.
10709 * options.h (Input_argument_list): Typedef moved from
10711 (Input_file_group::Files): Remove, use ::Input_argument_list.
10712 (Input_file_group::Input_argument_list): Remove, use
10713 ::Input_argument_list.
10714 * plugin.cc (Plugin_manager::add_input_file): Add error in
10716 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10718 * script.cc (read_input_script): Call
10719 Incremental_input::report_script.
10720 * script.h (Script_info): New class.
10722 2009-04-27 Ian Lance Taylor <iant@google.com>
10724 * x86_64.cc (do_adjust_output_section): Set entsize to
10727 2009-04-23 Elliott Hughes <enh@google.com>
10729 * output.cc (Output_file::close): After short writes, continue
10730 writing from the correct offset in the buffer being written.
10732 2009-04-23 Chris Demetriou <cgd@google.com>
10734 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10735 * configure: Regenerate.
10736 * config.in: Regenerate.
10737 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10738 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10740 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10742 * incremental.cc (Incremental_inputs_header_data): Renamed from
10743 Incremental_input_header_data.
10744 (Incremental_inputs_header_data::data_size): New field.
10745 (Incremental_inputs_header_data::put_input_file_count): Renamed
10746 from input_file_count.
10747 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10748 from command_line_offset.
10749 (Incremental_inputs_header_data::put_reserved): Renamed from
10751 (Incremental_inputs_entry_data): Renamed from
10752 Incremental_input_entry_data.
10753 (Incremental_inputs_entry_data::data_size): New field.
10754 (Incremental_inputs::report_command_line): New method.
10755 (Incremental_inputs::finalize): New method.
10756 (Incremental_inputs::create_incremental_inputs_data): New method.
10757 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10758 * incremental.h: New file.
10759 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10760 (Layout::finalize): Create incremental inputs section in
10761 incremental builds.
10762 (Layout::create_incremental_info_sections): New method.
10763 * layout.h (Layout::incremental_inputs): New method.
10764 (Layout::create_incremental_info_sections): New method.
10765 (Layout::incremental_inputs_): New field.
10766 * main.cc (main): Notify Incremental_input of the command line.
10768 2009-04-01 Ian Lance Taylor <iant@google.com>
10769 Mikolaj Zalewski <mikolajz@google.com>
10771 * gold.h (reserve_unordered_map): Define, three versions, one for
10772 each version of Unordered_map.
10773 * layout.cc (Layout::Layout): Remove options parameter. Add
10774 number_of_input_files parameter. Don't initialize options_.
10775 Initialize number_of_input_files_ and resized_signatures_. Move
10776 sections_are_attached_.
10777 (Layout::layout_group): Reserve space for group_signatures_.
10778 (Layout::find_or_add_kept_section): Change name parameter to be a
10779 reference. Resize signatures_ map when it gets large enough.
10780 (Layout::layout_eh_frame): Use parameters->options() instead of
10782 (Layout::make_output_section): Likewise.
10783 (Layout::attach_allocated_section_to_segment): Likewise.
10784 (Layout::finalize, Layout::create_executable_stack): Likewise.
10785 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10786 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10787 * layout.h (class Layout): Update declarations. Remove options_
10788 field. Add number_of_input_files_ and resized_signatures_
10789 fields. Move sections_are_attached_ field.
10790 * main.cc (main): Pass number of input files to Layout
10791 constructor. Don't pass options.
10793 2009-03-30 Ian Lance Taylor <iant@google.com>
10795 * ffsll.c (ffsll): Correct implementation.
10797 2009-03-27 Ian Lance Taylor <iant@google.com>
10799 * ffsll.c: New file.
10800 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10801 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10802 * ftruncate.c (ftruncate): Declare before definition.
10803 * mremap.c (mremap): Likewise.
10804 * pread.c (pread): Likewise.
10805 * configure, Makefile.in, config.in: Rebuild.
10807 * mremap.c: New file.
10808 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10809 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10810 (mremap): Declare if HAVE_MREMAP is not defined.
10811 * configure, Makefile.in, config.in: Rebuild.
10813 2009-03-27 Cary Coutant <ccoutant@google.com>
10815 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10816 position independent.
10817 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10818 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10820 2009-03-24 Cary Coutant <ccoutant@google.com>
10822 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10824 (needs_dynamic_reloc): Likewise.
10826 2009-03-24 Ian Lance Taylor <iant@google.com>
10828 * yyscript.y (file_cmd): Recognize EXTERN.
10829 (extern_name_list, extern_name_list_body): New nonterminals.
10830 * script.cc (script_add_extern): Define.
10831 * script-c.h (script_add_extern): Declare.
10833 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
10835 * object.cc (is_elf_object): Define.
10836 * object.h (is_elf_object): Declare.
10837 * archive.cc (Archive::get_elf_object_for_member): Call
10839 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10841 2009-03-24 Elliott Hughes <enh@google.com>
10843 * output.cc (Output_file::map_anonymous): Define.
10844 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10845 try an anonymous one. Report the size if the mmap fails.
10846 * output.h (class Output_file): Declare map_anonymous.
10848 2009-03-24 Ian Lance Taylor <iant@google.com>
10850 * target-select.cc (instantiate_target): Don't acquire the lock if
10851 the instantiated_target_ field has already been set.
10853 2009-03-23 Ian Lance Taylor <iant@google.com>
10855 * gold-threads.h (class Initialize_lock): Define.
10856 * gold-threads.cc (class Initialize_lock_once): Define.
10857 (initialize_lock_control): New static variable.
10858 (initialize_lock_pointer): New static variable.
10859 (initialize_lock_once): New static function.
10860 (Initialize_lock::Initialize_lock): Define.
10861 (Initialize_lock::initialize): Define.
10862 * target-select.h: Include "gold-threads.h".
10863 (class Target_selector): Add lock_ and initialize_lock_ fields.
10864 Don't define instantiate_target, just declare it.
10865 * target-select.cc (Target_selector::Target_selector): Initialize
10867 (Target_selector::instantiate_target): Define.
10868 * descriptors.h: Include "gold-threads.h".
10869 (class Descriptors): Add initialize_lock_ field.
10870 * descriptors.cc (Descriptors::Descriptors): Initialize new
10872 (Descriptors::open): Use initialize_lock_ field
10873 * errors.h (class Errors): Add initialize_lock_ field.
10874 * errors.cc (Errors::Errors): Initialize new field.
10875 (Errors::initialize_lock): Use initialize_lock_ field.
10876 * powerpc.cc (class Target_selector_powerpc): Remove
10877 instantiated_target_ field. In do_recognize call
10878 instantiate_target rather than do_instantiate_target. In
10879 do_instantiate_target just allocate a new target.
10880 * sparc.cc (class Target_selector_sparc): Likewise.
10882 * freebsd.h: New file.
10883 * i386.cc: Include "freebsd.h".
10884 (Target_i386): Derive from Target_freebsd rather than
10886 (Target_selector_i386): Derive from Target_selector_freebsd rather
10887 than Target_selector.
10888 * x86_64.cc: Include "freebsd.h".
10889 (Target_x86_64): Derive from Target_freebsd rather than
10891 (Target_selector_x86_64): Derive from Target_selector_freebsd
10892 rather than Target_selector.
10893 * target.h (class Target): Add adjust_elf_header and
10894 do_adjust_elf_header.
10895 * output.cc (Output_file_header:: do_sized_write): Call target
10896 adjust_elf_header routine.
10897 * configure.tgt: Set targ_osabi.
10898 * configure.ac: Define GOLD_DEFAULT_OSABI.
10899 * parameters.cc (Parameters::default_target): Pass
10900 GOLD_DEFAULT_OSABI to select_target.
10901 * target-select.h (class Target_selector): Make instantiate_target
10902 protected rather than private.
10903 * Makefile.am (HFILES): Add freebsd.h.
10904 * configure, Makefile.in, config.in: Rebuild.
10906 * merge.cc (do_add_input_section): Correct pend value. Change
10907 message about last entry not being null terminated from error to
10910 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
10912 * incremental.cc: New file.
10913 * Makefile.am (CCFILES): Add incremental.cc.
10914 * Makefile.in: Rebuild.
10916 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
10918 * layout.cc (Layout::output_section_name): Preserve names
10919 of '.note.' sections.
10921 2009-03-19 Ian Lance Taylor <iant@google.com>
10923 * descriptors.cc (Descriptors::open): Check that the options are
10924 valid before using them.
10926 2009-03-18 Ian Lance Taylor <iant@google.com>
10928 * script-sections.h: Include <list>.
10929 (class Script_sections): Change Sections_elements from std::vector
10930 to std::list. Typedef public Elements_iterator. Add
10931 orphan_section_placement_, data_segment_align_start_, and
10932 saw_data_segment_align_ fields. Remove data_segment_align_index_
10934 * script-sections.cc (class Orphan_section_placement): New class.
10935 (class Sections_element): Add virtual functions is_relro and
10936 orphan_section_init. Remove virtual function place_orphan_here.
10937 (class Output_section_definition): Add is_relro and
10938 orphan_section_init. Remove place_orphan_here.
10939 (class Orphan_output_section): Likewise.
10940 (Script_sections::Script_sections): Update for field changes.
10941 (Script_sections::data_segment_align): Set saw_data_segment_align_
10942 and data_segment_align_start_, not data_segment_align_index.
10943 (Script_sections::data_segment_relro_end): Check
10944 saw_data_segment_align_. Use data_segment_align_start_ rather
10945 than data_segment_align_index_.
10946 (Script_sections::place_orphan): Rewrite to use
10947 Orphan_section_placement.
10949 2009-03-17 Ian Lance Taylor <iant@google.com>
10951 * archive.cc (Archive::add_symbols): Check for a version attached
10952 to the symbol name in the archive map.
10953 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10954 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10955 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10956 (ver_test_11.a): New target.
10957 * testsuite/Makefile.in: Rebuild.
10959 * configure.ac: Check for chsize and posix_fallocate. Replace
10961 * ftruncate.c: New file, from gnulib.
10962 * output.cc (posix_fallocate): Define dummy version if not
10963 HAVE_POSIX_FALLOCATE.
10964 (Output_file::map): Call posix_fallocate rather than lseek and
10966 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10967 * configure, Makefile.in, config.in: Rebuild.
10969 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
10971 * layout.h (Layout::create_note): Add section_name parameter.
10972 * layout.cc (Layout::create_note): Likewise.
10973 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10975 2009-03-17 Ian Lance Taylor <iant@google.com>
10977 * descriptors.cc: Include "options.h".
10978 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10979 (Descriptors::open): Always use O_CLOEXEC when opening a new
10980 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
10981 then set FD_CLOEXEC.
10983 * sparc.cc (class Target_sparc): Add has_got_section.
10984 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10985 make sure we have a GOT section.
10987 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10988 (Target_sparc::Scan::local): Likewise.
10989 (Target_sparc::Scan::global): Likewise.
10990 (Target_sparc::Relocate::relocate): Likewise.
10991 (Target_sparc::Relocate::relocate_tls): Likewise.
10993 * symtab.cc (Symbol_table::define_default_version): New function,
10994 broken out of add_from_object.
10995 (Symbol_table::add_from_object): Call define_default_version.
10996 (Symbol_table::define_special_symbol): Add resolve_oldsym
10997 parameter. Change all callers. If the version for a symbol comes
10998 from a version script, resolve it with the symbol with the same
10999 name with no version. Also add the symbol without a version if
11001 (do_define_in_output_data): If resolving with oldsym, don't delete
11003 (do_define_in_output_segment): Likewise.
11004 (do_define_as_constant): Likewise.
11005 * symtab.h (class Symbol_table): Update declarations.
11007 2009-03-13 Ian Lance Taylor <iant@google.com>
11009 * readsyms.cc (Read_symbols::incompatible_warning): New function.
11010 (Read_symbols::requeue): New function.
11011 (Read_symbols::do_read_symbols): If make_elf_object fails because
11012 the target type is not configured, and the file was searched for,
11013 issue a warning and retry with the next directory.
11014 (Add_symbols::run): If the file has an incompatible format, and
11015 it was searched for, requeue the Read_symbols task. On error,
11016 release the object.
11017 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
11018 dirindex parameter to constructor. Change all callers. Declare
11019 incompatible_warning and requeue.
11020 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11021 input_argument_ and input_group_ fields. Add them to
11022 constructor. Change all callers.
11023 (class Read_script): Add dirindex_ field. Add it to constructor.
11024 Change all callers.
11025 * archive.cc (Archive::setup): Remove input_objects parameter.
11026 Change all callers.
11027 (Archive::get_file_and_offset): Likewise.
11028 (Archive::read_all_symbols): Likewise.
11029 (Archive::read_symbols): Likewise.
11030 (Archive::get_elf_object_for_member): Remove input_objects
11031 parameter. Add punconfigured parameter. Change all callers.
11032 (Archive::add_symbols): Change return type to bool. Check return
11033 value of include_member.
11034 (Archive::include_all_members): Likewise.
11035 (Archive::include_member): Change return type to bool. Return
11036 false if first included object has incompatible target. Set
11037 included_member_ field.
11038 (Add_archive_symbols::run): If add_symbols returns false, requeue
11040 * archive.h (class Archive): Add included_member_ field.
11041 Initialize it in constructor. Add input_file and searched_for
11042 methods. Update declarations.
11043 (class Add_archive_symbols): Add dirpath_, dirindex_, and
11044 input_argument_ fields. Add them to constructor. Change all
11046 * script.cc: Include "target-select.h".
11047 (class Parser_closure): Add skip_on_incompatible_target_ and
11048 found_incompatible_target_ fields. Add
11049 skip_on_incompatible_target parameter to constructor. Change all
11050 callers. Add methods skip_on_incompatible_target,
11051 clear_skip_on_incompatible_target, found_incompatible_target, and
11052 set_found_incompatible_target.
11053 (read_input_script): Add dirindex parameter. Change all callers.
11054 If parser finds an incompatible target, requeue Read_symbols
11056 (script_set_symbol): Clear skip_on_incompatible_target in
11058 (script_add_assertion, script_parse_option): Likewise.
11059 (script_start_sections, script_add_phdr): Likewise.
11060 (script_check_output_format): New function.
11061 * script.h (read_input_script): Update declaration.
11062 * script-c.h (script_check_output_format): Declare.
11063 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11064 (ignore_cmd): Remove OUTPUT_FORMAT.
11065 * fileread.cc (Input_file::Input_file): Add explicit this.
11066 (Input_file::will_search_for): New function.
11067 (Input_file::open): Add pindex parameter. Change all callers.
11068 * fileread.h (class Input_file): Add input_file_argument method.
11069 Declare will_search_for. Update declarations.
11070 * object.cc (make_elf_object): Add punconfigured parameter.
11071 Change all callers.
11072 * object.h (class Object): Make input_file public. Add
11073 searched_for method.
11074 (make_elf_object): Update declaration.
11075 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
11077 * dirsearch.h (class Dirsearch): Update declaration.
11078 * options.h (class General_options): Add --warn-search-mismatch.
11079 * parameters.cc (Parameters::is_compatible_target): New function.
11080 * parameters.h (class Parameters): Declare is_compatible_target.
11081 * workqueue.cc (Workqueue::add_blocker): New function.
11082 * workqueue.h (class Workqueue): Declare add_blocker.
11084 * fileread.cc (Input_file::open): Remove options parameter.
11085 Change all callers.
11086 (Input_file::open_binary): Likewise.
11087 * script.cc (read_input_script): Likewise.
11088 * readsyms.h (class Read_symbols): Remove options_ field. Remove
11089 options parameter from constructor. Change all callers.
11090 (class Read_script): Likewise.
11091 * fileread.h (class Input_file): Update declarations.
11092 * script.h (read_input_script): Update declaration.
11094 2009-03-10 Nick Clifton <nickc@redhat.com>
11096 * po/es.po: New Spanish translation.
11098 2009-03-06 Cary Coutant <ccoutant@google.com>
11100 * options.cc (parse_short_option): Keep dash_z from registering itself.
11102 2009-03-03 Ian Lance Taylor <iant@google.com>
11105 * target-reloc.h (relocate_section): Pass output_section to
11107 * i386.cc (Target_i386::should_apply_static_reloc): Add
11108 output_section parameter. Change all callers.
11109 (Target_i386::Relocate::relocate): Add output_section parameter.
11110 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11111 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11112 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11113 * testsuite/two_file_shared.sh: New script.
11114 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11115 (check_DATA): Add two_file_shared.dbg.
11116 (two_file_shared.dbg): New target.
11117 * testsuite/Makefile.in: Rebuild.
11119 2009-03-01 Ian Lance Taylor <iant@google.com>
11121 * configure.ac: Check for byteswap.h.
11122 * configure: Rebuild.
11123 * config.in: Rebuild.
11125 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
11127 * layout.cc (Layout::find_or_add_kept_section): New function.
11128 (Layout::add_comdat): Removed.
11129 * layout.h (struct Kept_section): Move out of class Layout.
11130 Remove trailing underscores from field names. Add group_sections
11131 field. Rename group_ field to is_group. Change all uses.
11132 (class Layout): Declare find_or_add_kept_section, not add_comdat.
11133 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11134 comdat_groups_ field.
11135 (Sized_relobj::include_section_group): Use
11136 find_or_add_kept_section and Kept_section::group_sections.
11137 (Sized_relobj::include_linkonce_section): Likewise.
11138 * object.cc (class Sized_relobj): Don't define Comdat_group or
11139 Comdat_group_table. Remove find_comdat_group and
11140 add_comdat_group. Remove comdat_groups_ field.
11141 * plugin.cc (include_comdat_group): Use
11142 Layout::find_or_add_kept_section.
11144 2009-02-28 Ian Lance Taylor <iant@google.com>
11146 * README: --gc-sections and map files are now supported. Document
11147 some build requirements.
11150 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11151 relocatable link set the value of the section symbol to zero.
11152 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11153 relocatable link don't include the section address in the local
11156 2009-02-27 Ian Lance Taylor <iant@google.com>
11159 * options.h (class Search_directory): Add is_system_directory.
11160 (class General_options): Declare is_in_system_directory.
11161 * options.cc (get_relative_sysroot): Make static.
11162 (get_default_sysroot): Make static.
11163 (General_optoins::is_in_system_directory): New function.
11164 * fileread.cc (Input_file::is_in_system_directory): New function.
11165 * fileread.h (class Input_file): Declare is_in_system_directory.
11166 * object.h (class Object): Add is_in_system_directory.
11167 (class Input_objects): Remove system_library_directory_ field.
11168 * object.cc (Input_objects::add_object): Don't set
11169 system_library_directory_.
11170 (input_objects::found_in_system_library_directory): Remove.
11171 * symtab.cc (Symbol_table::write_globals): Remove input_objects
11172 parameter. Change all callers.
11173 (Symbol_table::sized_write_globals): Likewise.
11174 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11175 Call Object::is_in_system_directory.
11176 * symtab.h (class Symbol_table): Update declarations.
11179 * descriptors.h (Open_descriptor): Add is_on_stack field.
11180 * descriptors.cc (Descriptors::open): If the descriptor is on the
11181 top of the stack, remove it. Initialize is_on_stack field.
11182 (Descriptors::release): Only add pod to stack if it is not on the
11184 (Descriptors::close_some_descriptor): Clear stack_next and
11185 is_on_stack fields.
11188 * output.cc (Output_section::find_starting_output_address): Rename
11189 from starting_output_address; add PADDR parameter; change return
11191 * output.h (class Output_section): Declare
11192 find_starting_output_address instead of starting_output_address.
11193 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11194 section symbol for which we can't find a merge section.
11197 * symtab.cc (Symbol_table::add_from_object): If the visibility is
11198 hidden or internal, force the symbol to be local.
11199 * resolve.cc (Symbol::override_visibility): Define.
11200 (Symbol::override_base): Use override_visibility.
11201 (Symbol_table::resolve): Likewise.
11202 (Symbol::override_base_with_special): Likewise.
11203 (Symbol_table::override_with_special): If the visibility is hidden
11204 or internal, force the symbol to be local.
11205 * symtab.h (class Symbol): Add set_visibility and
11206 override_visibility.
11207 * testsuite/ver_test_1.sh: New file.
11208 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11209 (check_DATA): Add ver_test_1.syms.
11210 (ver_test_1.syms): New target.
11211 * testsuite/Makefile.in: Rebuild.
11213 2009-02-25 Cary Coutant <ccoutant@google.com>
11215 * layout.cc (Layout::choose_output_section): Don't rename sections
11216 when using a linker script that has a SECTIONS clause.
11217 * Makefile.in: Regenerate.
11219 * testsuite/Makefile.am (script_test_5.sh): New test case.
11220 * testsuite/Makefile.in: Regenerate.
11221 * testsuite/script_test_5.cc: New file.
11222 * testsuite/script_test_5.sh: New file.
11223 * testsuite/script_test_5.t: New file.
11225 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
11227 * archive.cc (Archive::include_member): Update calls to add_symbols.
11228 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11229 the Layout argument.
11230 * dynobj.h (do_add_symbols): Add the Layout argument.
11231 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11233 * object.h (Object::add_symbols): Add the Layout argument.
11234 (Object::do_add_symbols): Add the Layout argument.
11235 (Sized_relobj::do_add_symbols): Add the Layout argument.
11236 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11237 Unify the two versions.
11238 (Add_plugin_symbols): Remove.
11239 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11240 (Sized_pluginobj::do_add_symbols): Unify the two versions.
11241 (Add_plugin_symbols): Remove.
11242 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11243 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11244 (Add_symbols::run): Make it work with Pulginobj.
11246 2009-02-06 Ian Lance Taylor <iant@google.com>
11248 * object.cc (Sized_relobj::do_layout): Make info message start
11249 with lower case letter.
11251 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
11253 * binary.cc: Fix file comment.
11255 * options.h (enum Incremental_disposition): Define.
11256 (class General_options): Add new options: --incremental,
11257 --incremental_changed, --incremental_unchanged,
11258 --incremental_unknown. Add incremental_disposition_ and
11259 implicit_incremental_ fields.
11260 (General_options::incremental_disposition): New function.
11261 (class Position_dependent_options): Add incremental_disposition
11263 (Position_dependent_options::copy_from_options): Set incremental
11265 * options.cc (General_options::parse_incremental_changed): New
11267 (General_options::parse_incremental_unchanged): New function.
11268 (General_options::parse_incremental_unknown): New function.
11269 (General_options::General_options): Initialize new fields
11270 incremental_disposition_ and implicit_incremental_.
11271 (General_options::finalize): Check for uasge of --incremental-*
11272 without --incremental.
11274 2009-02-06 Chris Demetriou <cgd@google.com>
11276 * gold.h (gold_undefined_symbol): Change to take only a Symbol
11277 pointer and to report location as the file name associated with
11279 (gold_undefined_symbol_at_location): New function to replace the
11280 old gold_undefined_symbol functionality.
11281 * target-reloc.h (relocate_section): Update to use
11282 gold_undefined_symbol_at_location.
11283 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11284 Call gold_undefined_symbol function rather than gold_error.
11285 * errors.h (Errors::undefined_symbol): Take location as a
11286 string, rather than calculating it from a relocation.
11287 * errors.cc (Errors::fatal): Print "fatal error:" before the
11289 (Errors::error, Errors::error_at_location): Print "error: "
11290 before the formatted message.
11291 (Errors::undefined_symbol): Take location as a string, rather
11292 than calculating it from a relocation.
11293 (gold_undefined_symbol_at_location): New function akin to
11294 old gold_undefined_symbol, calculates location from relocation.
11295 (gold_undefined_symbol): Change to take only a Symbol pointer
11296 and to report location as the file name associated with the symbol.
11297 * testsuite/debug_msg.sh: Update for changed error messages.
11298 * testsuite/undef_symbol.sh: Likewise.
11300 2009-02-04 Duncan Sands <baldrick@free.fr>
11303 * reduced_debug_output.h
11304 (Output_reduced_debug_abbrev_section::failed): Use format for
11306 (Output_reduced_debug_info_section::faild): Likewise.
11308 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
11310 * script.cc (Lazy_demangler): New class.
11311 (Version_script_info::get_symbol_version_helper): Demangle a
11314 2009-01-29 Cary Coutant <ccoutant@google.com>
11316 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11318 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11320 2009-01-28 Ian Lance Taylor <iant@google.com>
11322 * version.cc (version_string): Bump to 1.9.
11324 * gold.h: Include <cstring> and <stdint.h>.
11325 * version.cc: Include <cstdio>.
11326 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11328 * reduced_debug_output.cc (insert_into_vector): Rename from
11329 Insert_into_vector; change all callers. Use Swap_unaligned to
11330 avoid aliasing issue; remove union since it is unnecessary.
11332 2009-01-27 Sriraman Tallam <tmsriram@google.com>
11334 * Makefile.am (CCFILES): Add gc.cc.
11335 (HFILES): Add gc.h.
11336 * Makefile.in: Regenerate.
11337 * gold.cc (Gc_runner): New class.
11338 (queue_initial_tasks): Call garbage collection related tasks
11339 when corresponding options are invoked.
11340 (queue_middle_gc_tasks): New function.
11341 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11342 processed early before laying out sections during garbage collection.
11343 * gold.h (queue_middle_gc_tasks): New function.
11344 (is_prefix_of): Move from "layout.cc".
11345 * i386.cc (Target_i386::gc_process_relocs): New function.
11346 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11347 * main.cc (main): Create object of class "Garbage_collection".
11348 * object.cc (Relobj::copy_symbols_data): New function.
11349 (Relobj::is_section_name_included): New function.
11350 (Sized_relobj::do_layout): Allow this function to be called twice
11351 during garbage collection and defer layout of section during the
11353 * object.h (Relobj::get_symbols_data): New function.
11354 (Relobj::is_section_name_included): New function.
11355 (Relobj::copy_symbols_data): New function.
11356 (Relobj::set_symbols_data): New function.
11357 (Relobj::get_relocs_data): New function.
11358 (Relobj::set_relocs_data): New function.
11359 (Relobj::is_output_section_offset_invalid): New pure virtual function.
11360 (Relobj::gc_process_relocs): New function.
11361 (Relobj::do_gc_process_relocs): New pure virtual function.
11362 (Relobj::sd_): New data member.
11363 (Sized_relobj::is_output_section_offset_invalid): New function.
11364 (Sized_relobj::do_gc_process_relocs): New function.
11365 * options.h (General_options::gc_sections): Modify to not be a no-op.
11366 (General_options::print_gc_sections): New option.
11367 * plugin.cc (Plugin_finish::run): Remove function call to
11368 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
11369 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11370 * reloc.cc (Read_relocs::run): Add task to process relocs and
11371 determine unreferenced sections when doing garbage collection.
11372 (Gc_process_relocs): New class.
11373 (Sized_relobj::do_gc_process_relocs): New function.
11374 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11375 sections that are garbage collected.
11376 * reloc.h (Gc_process_relocs): New class.
11377 * sparc.cc (Target_sparc::gc_process_relocs): New function.
11378 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11379 symbols whose corresponding sections are garbage collected.
11380 (Symbol_table::Symbol_table): Add new parameter for the garbage
11382 (Symbol_table::gc_mark_undef_symbols): New function.
11383 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11384 (Symbol_table::gc_mark_dyn_syms): New function.
11385 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11387 (Symbol_table::add_from_object): Likewise.
11388 (Symbol_table::add_from_relobj): When building shared objects, do not
11389 treat externally visible symbols as garbage.
11390 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11391 table information for static and relocatable links.
11392 * symtab.h (Symbol_table::set_gc): New function.
11393 (Symbol_table::gc): New function.
11394 (Symbol_table::gc_mark_undef_symbols): New function.
11395 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11396 (Symbol_table::gc_mark_dyn_syms): New function.
11397 (Symbol_table::gc_): New data member.
11398 * target.h (Sized_target::gc_process_relocs): New pure virtual
11400 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11401 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11403 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
11405 * options.h (General_options::gc_sections): Define as a no-op for now.
11406 (General_options::no_keep_memory): Ditto.
11407 (General_options::Bshareable): Define.
11408 * options.cc (General_options::finalize): Honor -Bshareable.
11410 2009-01-20 Andreas Schwab <schwab@suse.de>
11412 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11413 read the value in the contents, since we don't use it. Use the
11414 template endianness when writing.
11415 (Relocate::relocate): Use it for R_PPC_REL16_HA.
11417 2009-01-19 Andreas Schwab <schwab@suse.de>
11419 * configure.tgt (powerpc64-*): Fix targ_obj.
11421 2009-01-15 Ian Lance Taylor <iant@google.com>
11423 * object.cc (Sized_relobj::write_local_symbols): Don't write out
11424 local symbols when stripping all symbols.
11426 2009-01-14 Cary Coutant <ccoutant@google.com>
11428 * output.cc (Output_reloc): Add explicit instantiations.
11430 2009-01-14 Cary Coutant <ccoutant@google.com>
11432 * archive.cc (Archive::get_elf_object_for_member): Remove call
11433 to File_read::claim_for_plugin.
11434 * descriptors.cc (Descriptors::open): Remove reference to
11436 (Descriptors::claim_for_plugin): Remove.
11437 * descriptors.h (Descriptors::claim_for_plugin): Remove.
11438 (Descriptors::is_claimed): Remove.
11439 (claim_descriptor_for_plugin): Remove.
11440 * fileread.cc (File_read::claim_for_plugin): Remove.
11441 * fileread.h (File_read::claim_for_plugin): Remove.
11442 (File_read::descriptor): Reopen descriptor if necessary.
11443 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
11444 (Plugin_manager::all_symbols_read): Add task parameter. Change
11446 (Plugin_manager::get_input_file): New function.
11447 (Plugin_manager::release_input_file): New function.
11448 (Pluginobj::Pluginobj): Add filesize parameter and initialize
11449 corresponding data member.
11450 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11451 and pass to base constructor. Change all callers.
11452 (get_input_file, release_input_file): New functions.
11453 (make_sized_plugin_object): Add filesize parameter. Change all callers.
11454 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11455 (Plugin_manager::all_symbols_read): Add task parameter.
11456 (Plugin_manager::get_input_file): New function.
11457 (Plugin_manager::release_input_file): New function.
11458 (Plugin_manager::task_): New data member.
11459 (Pluginobj::Pluginobj): Add filesize parameter.
11460 (Pluginobj::filename): New function.
11461 (Pluginobj::descriptor): New function.
11462 (Pluginobj::filesize): New function.
11463 (Pluginobj::filesize_): New data member.
11464 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11465 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11466 File_read::claim_for_plugin; use Object::unlock to unlock the file.
11468 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11469 with archive libraries.
11470 * testsuite/Makefile.in: Regenerate.
11471 * testsuite/plugin_test.c (struct sym_info): New type.
11472 (get_input_file, release_input_file): New static variables.
11473 (onload): Capture new transfer vector entries.
11474 (claim_file_hook): Stop reading at end of file according to filesize.
11475 Factor out parsing of readelf output into separate function.
11476 (all_symbols_read_hook): Exercise get_input_file and release_input_file
11477 APIs and get the source file name from the symbol table. Convert
11478 source file name to corresponding object file name. Print info
11479 message when adding new input files.
11480 (parse_readelf_line): New function.
11481 * testsuite/plugin_test_1.sh: Add checks for new info messages.
11482 * testsuite/plugin_test_2.sh: Likewise.
11483 * testsuite/plugin_test_3.sh: Likewise.
11484 * testsuite/plugin_test_4.sh: New test case.
11486 2009-01-07 Ian Lance Taylor <iant@google.com>
11488 * version.cc (version_string): Bump to 1.8.
11490 2008-12-23 Cary Coutant <ccoutant@google.com>
11492 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11493 * plugin.cc (Plugin_manager::finish): Rename as
11494 layout_deferred_objects. Move cleanup to separate function.
11495 (Plugin_manager::cleanup): New function.
11496 (Plugin_finish::run): Call layout_deferred_objects and cleanup
11498 * plugin.h (Plugin_manager::finish): Rename as
11499 layout_deferred_objects.
11500 (Plugin_manager::cleanup): New function.
11501 (Plugin_manager::cleanup_done): New field.
11503 2008-12-23 Cary Coutant <ccoutant@google.com>
11505 * plugin.cc (is_visible_from_outside): New function.
11506 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11507 so we don't return "IR only" status for exported symbols or -r links.
11509 * testsuite/Makefile.am (plugin_test_3): New test case.
11510 * testsuite/Makefile.in: Regenerate.
11511 * testsuite/plugin_test_3.sh: New file.
11513 2008-12-22 Cary Coutant <ccoutant@google.com>
11515 * object.cc (Sized_relobj::layout_section): New function.
11516 (Sized_relobj::do_layout): Defer layout of input sections until after
11517 plugin has provided replacement files.
11518 (Sized_relobj::do_layout_deferred_sections): New function.
11519 * object.h (Relobj::set_section_offset): Remove virtual keyword.
11520 (Relobj::layout_deferred_sections): New function.
11521 (Relobj::do_layout_deferred_sections): New function.
11522 (Sized_relobj::do_layout_deferred_sections): New function.
11523 (Sized_relobj::layout_section): New function.
11524 (Sized_relobj::Deferred_layout): New structure.
11525 (Sized_relobj::deferred_layout_): New field.
11526 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11527 Change all callers. Layout deferred sections.
11528 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
11530 (Plugin_hook::run): Move code from do_plugin_hook inline.
11531 (Plugin_hook::do_plugin_hook): Remove.
11532 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11533 (Plugin_manager::finish): Renamed, was cleanup.
11534 (Plugin_manager::should_defer_layout): New function.
11535 (Plugin_manager::add_deferred_layout_object): New function.
11536 (Plugin_manager::Deferred_layout_list): New type.
11537 (Plugin_manager::deferred_layout_objects_): New field.
11538 (Plugin_hook::do_plugin_hook): Remove.
11540 2008-12-17 Ian Lance Taylor <iant@google.com>
11542 * options.h (class General_options): Add --no case for
11545 2008-12-16 Cary Coutant <ccoutant@google.com>
11547 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11549 (Plugin_manager::claim_file): Create plugin object even if
11550 plugin did not call the add_symbols callback.
11551 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11552 asking for more symbols than were added.
11553 * testsuite/Makefile.am (plugin_test_1): Add test case with
11555 (empty.syms): New target.
11556 * testsuite/Makefile.in: Regenerate.
11557 * testsuite/plugin_test.c (claim_file_hook): Add new debug
11558 message. Don't call add_symbols if no globals.
11559 (all_symbols_read_hook): Don't provide replacement for empty
11562 2008-12-12 Ian Lance Taylor <iant@google.com>
11564 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11565 r_type == 0 for a local symbol with r_sym == 0.
11566 (scan_relocatable_relocs): Pass r_sym to
11567 local_non_section_strategy.
11568 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11571 * configure.ac: Update test for TLS descriptors: they are
11572 supported as of glibc 2.9.
11573 * configure: Rebuild.
11575 2008-12-11 Ian Lance Taylor <iant@google.com>
11578 * target-reloc.h (Default_scan_relocatable_relocs): For each
11579 function, map r_type == 0 to RELOC_DISCARD.
11581 2008-12-10 Cary Coutant <ccoutant@google.com>
11583 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11584 object to override a kept COMDAT group from a plugin object.
11586 2008-12-09 Ian Lance Taylor <iant@google.com>
11589 * yyscript.y (file_cmd): Handle INPUT.
11591 * testsuite/initpri1.c: Change all declarations to be full
11592 prototypes by adding void, to avoid compiler warnings.
11594 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
11596 * options.cc (General_options::parse_plugin_opt): New.
11597 (General_options::add_plugin): The argument now is just the filename.
11598 (General_options::add_plugin_option): New.
11599 * options.h (plugin_opt): New.
11600 (add_plugin): Change argument name.
11601 (add_plugin_option): New.
11602 * plugin.cc (Plugin::load): Don't parse the plugin option.
11603 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11604 (Plugin::add_option): New.
11605 (Plugin::args_): Change type.
11606 (Plugin::filename_): New.
11607 (Plugin_manager::add_plugin_option): New.
11608 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11609 * testsuite/Makefile.in: Regenerate.
11611 2008-12-05 Cary Coutant <ccoutant@google.com>
11613 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11614 Handle --strip-lto-sections option.
11615 * options.h (strip_lto_sections): New option.
11617 2008-12-01 Cary Coutant <ccoutant@google.com>
11619 * plugin.cc (ld_plugin_message): Change format parameter to const.
11620 Fix mismatch between new[] and delete.
11622 2008-11-14 Cary Coutant <ccoutant@google.com>
11624 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11627 2008-11-05 Craig Silverstein <csilvers@google.com>
11629 * options.cc (General_options::parse_dynamic_list): New function.
11630 * options.h (General_options): New flags dynamic_list,
11631 dynamic_list_data, dynamic_list_cpp_new, and
11632 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
11633 (General_options::in_dynamic_list): New function.
11634 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11635 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11636 (Lex::can_continue_name): Likewise.
11638 (read_script_file): New parameter script_options.
11639 (read_dynamic_list): New function.
11640 (Script_options::define_dynamic_list): New function.
11641 (dynamic_list_keyword_parsecodes): New variable.
11642 (dynamic_list_keywords): New variable.
11643 * script.h (Script_options::define_dynamic_list): New function
11645 (read_dynamic_list): New function prototype.
11646 * symtab.cc (strprefix): New macro.
11647 (Symbol::should_add_dynsym_entry): Support dynamic_list,
11648 dynamic_list_data, dynamic_list_cpp_new, and
11649 dynamic_list_cpp_typeinfo.
11650 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11651 (dynamic_list_expr): New rule.
11652 (dynamic_list_nodes): Likewise.
11653 (dynamic_list_node): Likewise.
11654 * testsuite/Makefile.am (dynamic_list): New test.
11655 * testsuite/Makefile.in: Regenerated.
11656 * testsuite/dynamic_list.t: New file.
11657 * testsuite/dynamic_list.sh: New file.
11659 2008-11-05 Craig Silverstein <csilvers@google.com>
11661 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11662 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11663 (t11_last): Likewise.
11664 * testsuite/ver_test_6.c (main): Likewise.
11666 2008-10-07 Cary Coutant <ccoutant@google.com>
11668 * options.c (General_options::finalize): Add check for -static and
11670 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11673 2008-10-02 Cary Coutant <ccoutant@google.com>
11675 * plugin.cc (make_sized_plugin_object): Fix conditional
11676 compilation to work when not all targets are enabled.
11678 2008-09-29 Cary Coutant <ccoutant@google.com>
11680 * archive.cc (Archive::get_file_and_offset): Use filename instead
11681 of name to get library path.
11682 (Archive::include_member): Unlock external member of a thin archive.
11684 * testsuite/Makefile.am (TEST_AR): New variable.
11685 (thin_archive_test_1): New test.
11686 (thin_archive_test_2): New test.
11687 * testsuite/Makefile.in: Regenerate.
11688 * testsuite/thin_archive_main.cc: New file.
11689 * testsuite/thin_archive_test_1.cc: New file.
11690 * testsuite/thin_archive_test_2.cc: New file.
11691 * testsuite/thin_archive_test_3.cc: New file.
11692 * testsuite/thin_archive_test_4.cc: New file.
11694 2008-09-29 Cary Coutant <ccoutant@google.com>
11696 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11697 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11699 (Sized_relobj::do_finalize_local_symbols): Likewise.
11700 (Sized_relobj::map_to_kept_section): Likewise.
11701 * object.h (Sized_relobj::invalid_address): New constant.
11702 (Sized_relobj::do_output_section_offset): Check for invalid_address
11704 * output.cc (Output_reloc::local_section_offset): Use constant
11705 invalid_address instead of -1U.
11706 (Output_reloc::get_address): Likewise.
11707 (Output_section::output_address): Change -1U to -1ULL.
11708 * output.h (Output_reloc::invalid_address): New constant.
11709 * reloc.cc (Sized_relobj::write_sections): Use constant
11710 invalid_address instead of -1U.
11711 (Sized_relobj::relocate_sections): Likewise.
11712 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11713 values for merge sections.
11714 * target-reloc.h (relocate_for_relocatable): Use constant
11715 invalid_address instead of -1U.
11717 2008-09-19 Cary Coutant <ccoutant@google.com>
11719 Add plugin functionality for link-time optimization (LTO).
11720 * configure.ac (plugins): Add --enable-plugins option.
11721 * configure: Regenerate.
11722 * config.in: Regenerate.
11723 * Makefile.am (LIBDL): New variable.
11724 (CCFILES): Add plugin.cc.
11725 (HFILES): Add plugin.h.
11726 (ldadd_var): Add LIBDL.
11727 * Makefile.in: Regenerate.
11729 * archive.cc: Include "plugin.h".
11730 (Archive::setup): Don't preread archive symbols when using a plugin.
11731 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11732 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11734 (Archive::include_member): Add symbols from plugin objects.
11735 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11736 * descriptors.cc (Descriptors::open): Check for file descriptors
11737 abandoned by plugins.
11738 (Descriptors::claim_for_plugin): New function.
11739 * descriptors.h (Descriptors::claim_for_plugin): New function.
11740 (Open_descriptor::is_claimed): New field.
11741 (claim_descriptor_for_plugin): New function.
11742 * fileread.cc (File_read::claim_for_plugin): New function.
11743 * fileread.h (File_read::claim_for_plugin): New function.
11744 (File_read::descriptor): New function.
11745 * gold.cc: Include "plugin.h".
11746 (queue_initial_tasks): Add task to call plugin hooks for generating
11748 * main.cc: Include "plugin.h".
11749 (main): Load plugin libraries.
11750 * object.h (Pluginobj): Declare.
11751 (Object::pluginobj): New function.
11752 (Object::do_pluginobj): New function.
11753 (Object::set_target): New function.
11754 * options.cc: Include "plugin.h".
11755 (General_options::parse_plugin): New function.
11756 (General_options::General_options): Initialize plugins_ field.
11757 (General_options::add_plugin): New function.
11758 * options.h (Plugin_manager): Declare.
11759 (General_options): Add --plugin option.
11760 (General_options::has_plugins): New function.
11761 (General_options::plugins): New function.
11762 (General_options::add_plugin): New function.
11763 (General_options::plugins_): New field.
11764 * plugin.cc: New file.
11765 * plugin.h: New file.
11766 * readsyms.cc: Include "plugin.h".
11767 (Read_symbols::do_read_symbols): Check for archive before checking
11768 for ELF file. Call plugin hooks to claim files.
11769 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11770 from a real object file; force override when processing replacement
11772 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11773 (Symbol::init_base_object): Likewise.
11774 (Symbol::init_base_output_data): Likewise.
11775 (Symbol::init_base_output_segment): Likewise.
11776 (Symbol::init_base_constant): Likewise.
11777 (Symbol::init_base_undefined): Likewise.
11778 (Symbol::output_section): Assert that object is not a plugin.
11779 (Symbol_table::add_from_pluginobj): New function.
11780 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11782 (Symbol_table::sized_write_globals): Likewise.
11783 (Symbol_table::add_from_pluginobj): Instantiate template.
11784 * symtab.h (Sized_pluginobj): Declare.
11785 (Symbol::in_real_elf): New function.
11786 (Symbol::set_in_real_elf): New function.
11787 (Symbol::in_real_elf_): New field.
11788 (Symbol_table::add_from_pluginobj): New function.
11790 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11791 (LIBDL): New variable.
11792 (LDADD): Add LIBDL.
11793 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11794 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11795 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11796 (MOSTLYCLEANFILES): Likewise.
11797 * testsuite/Makefile.in: Regenerate.
11798 * testsuite/plugin_test.c: New file.
11799 * testsuite/plugin_test_1.sh: New file.
11800 * testsuite/plugin_test_2.sh: New file.
11802 2008-09-16 Ian Lance Taylor <iant@google.com>
11804 * target-reloc.h (relocate_section): Check whether a symbol is
11805 defined by the ABI before reporting an undefined symbol error.
11806 * target.h (Target::is_defined_by_abi): Make parameter const.
11807 (Target::do_is_defined_by_abi): Likewise.
11808 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11809 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11810 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11811 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11812 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11813 * testsuite/Makefile.in: Rebuild.
11815 * fileread.cc (make_view): Add casts to avoid warning.
11817 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11819 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11820 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11822 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11824 * options.h (General_options::output_is_executable): New.
11825 (General_options::output_is_pie): New.
11826 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11827 for shared libraries.
11828 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11830 2008-09-11 Chris Demetriou <cgd@google.com>
11832 * options.h (origin): New -z option.
11833 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11834 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11837 2008-09-05 Cary Coutant <ccoutant@google.com>
11839 * fileread.cc (File_read::make_view): Add check for attempt to map
11840 beyond end of file.
11842 2008-09-05 Cary Coutant <ccoutant@google.com>
11844 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11845 explicit instantiations.
11847 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11850 * options.cc (General_options::finalize): Allow undefined symbols
11851 in shlibs if linking -shared.
11854 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11855 symbols as not needing a dynsym entry.
11857 2008-08-20 Craig Silverstein <csilvers@google.com>
11859 * fileread.cc (File_read::open): Do not lock the file unless it
11860 was successfully opened.
11862 2008-08-14 Cary Coutant <ccoutant@google.com>
11864 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11865 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11866 * testsuite/tls_test.cc (struct int128): 128-bit struct
11867 for testing TLS relocs with non-zero addend.
11868 (v12): New TLS variable.
11870 (t_last): Add check for v12.
11871 * testsuite/tls_test.h (t12): New function.
11872 * testsuite/tls_test_main.cc (thread_routine): Call new test.
11874 2008-08-13 Ian Lance Taylor <iant@google.com>
11876 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11877 set tls_segment_ or relro_segment_.
11878 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11880 * output.h (Output_section::clear_is_relro): New function.
11881 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11882 sections specially even when output_data_ is empty.
11883 (Output_segment::maximum_alignment): When first section is relro,
11884 only force alignment for PT_LOAD segments.
11885 * script.cc (script_data_segment_align): New function.
11886 (script_data_segment_relro_end): New function.
11887 * script-c.h (script_data_segment_align): Declare.
11888 (script_data_segment_relro_end): Declare.
11889 * script-sections.h (class Script_sections): Declare
11890 data_segment_align and data_segment_relro_end. Add fields
11891 segment_align_index_ and saw_relro_end_.
11892 * script-sections.cc (class Sections_element): Add set_is_relro
11893 virtual function. Add new bool* parameter to place_orphan_here.
11894 Add get_output_section virtual function.
11895 (class Output_section_definition): Add set_is_relro. Add new
11896 bool* parameter to place_orphan_here. Add get_output_section.
11897 Add is_relro_ field.
11898 (Output_section_definition::Output_section_definition): Initialize
11899 evaluated_address_, evaluated_load_address, evaluated_addralign_,
11900 and is_relro_ fields.
11901 (Output_section_definition::place_orphan_here): Add is_relro
11903 (Output_section_definition::set_section_addresses): Set relro for
11905 (Output_section_definition::alternate_constraint): Likewise.
11906 (class Orphan_output_section): Add new bool* parameter to
11907 place_orphan_here. Add get_output_section.
11908 (Orphan_output_section::place_orphan_here): Add is_relro
11910 (Script_sections::Script_sections): Initialize
11911 data_segment_align_index_ and saw_relro_end_.
11912 (Script_sections::data_segment_align): New function.
11913 (Script_sections::data_segment_relro_end): New function.
11914 (Script_sections::place_orphan): Set or clear is_relro.
11915 (Script_sections::set_section_addresses): Force alignment of first
11917 * yyscript.y (exp): Call script_data_segment_align and
11918 script_data_segment_relro_end.
11919 * testsuite/relro_script_test.t: New file.
11920 * testsuite/relro_test.cc (using_script): Declare.
11921 (t1, t2): Test using_script.
11922 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11923 (relro_script_test_SOURCES): Define.
11924 (relro_script_test_DEPENDENCIES): Define.
11925 (relro_script_test_LDFLAGS): Define.
11926 (relro_script_test_LDADD): Define.
11927 (relro_script_test.so): New target.
11928 * testsuite/Makefile.in: Rebuild.
11930 2008-08-06 Cary Coutant <ccoutant@google.com>
11932 * archive.cc (Archive::total_archives, Archive::total_members)
11933 (Archive::total_members_loaded): New variables.
11934 (Archive::setup): Add parameter. Add option to preread
11936 (Archive::read_armap): Add counter.
11937 (Archive::get_file_and_offset): New function.
11938 (Archive::get_elf_object_for_member): New function.
11939 (Archive::read_all_symbols): New function.
11940 (Archive::read_symbols): New function.
11941 (Archive::add_symbols): Add counters.
11942 (Archive::include_all_members): Use armap to find members if it's
11944 (Archive::include_member): Skip reading symbols if already read.
11945 Factored code into Archive::get_file_and_offset and
11946 Archive::get_elf_object_for_member. Changed call to
11947 Mapfile::report_include_archive_member.
11948 (Archive::print_stats): New function.
11949 * archive.h: Declare Object and Read_symbols_data classes.
11950 (Archive::Archive): Add initializers for new members.
11951 (Archive::setup): Add parameter.
11952 (Archive::print_stats): New function.
11953 (Archive::total_archives, Archive::total_members)
11954 (Archive::total_members_loaded): New variables.
11955 (Archive::get_file_and_offset): New function.
11956 (Archive::get_elf_object_for_member): New function.
11957 (Archive::read_all_symbols): New function.
11958 (Archive::read_symbols): New function.
11959 (Archive::Archive_member): New class.
11960 (Archive::members_): New member.
11961 (Archive::num_members_): New member.
11962 * main.cc: Include archive.h.
11963 (main): Call Archive::print_stats.
11964 * mapfile.cc (Mapfile::report_include_archive_member): Delete
11965 archive parameter; member_name is now the fully-decorated name.
11966 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11967 * options.h: (General_options): Add --preread-archive-symbols option.
11968 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11971 2008-08-04 Ian Lance Taylor <iant@google.com>
11973 * symtab.h (Symbol::use_plt_offset): New function.
11974 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11975 * powerpc.cc (Relocate::relocate): Likewise.
11976 * sparc.cc (Relocate::relocate): Likewise.
11977 * x86_64.cc (Relocate::relocate): Likewise.
11978 * testsuite/weak_plt.sh: New test.
11979 * testsuite/weak_plt_main.cc: New test.
11980 * testsuite/weak_plt_shared.cc: New test.
11981 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11982 (check_PROGRAMS): Add weak_plt.
11983 (check_DATA): Add weak_plt_shared.so.
11984 (weak_plt_main_pic.o, weak_plt): New targets.
11985 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11986 * testsuite/Makefile.in: Rebuild.
11988 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11990 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11991 * testsuite/Makefile.in: Rebuild.
11993 2008-08-04 Alan Modra <amodra@bigpond.net.au>
11995 * Makefile.am (POTFILES.in): Set LC_ALL=C.
11996 * Makefile.in: Regenerate.
11997 * po/POTFILES.in: Regenerate.
11999 2008-07-29 Ian Lance Taylor <iant@google.com>
12001 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12002 symbols before other symbols.
12003 * testsuite/script_test_2.cc (test_addr): Declare.
12004 (test_addr_alias): Declare.
12005 (main): Check that test_addr and test_addr_alias have the right
12007 * testsuite/script_test_2.t: Define test_addr_alias and
12010 2008-07-24 Ian Lance Taylor <iant@google.com>
12013 * descriptors.cc: New file.
12014 * descriptors.h: New file.
12015 * gold-threads.h (class Hold_optional_lock): New class.
12016 * fileread.cc: Include "descriptors.h".
12017 (File_read::~File_read): Release descriptor rather than closing
12019 (File_read::open) [file]: Call open_descriptor rather than open.
12020 Set is_descriptor_opened_.
12021 (File_read::open) [memory]: Assert that descriptor is not open.
12022 (File_read::reopen_descriptor): New function.
12023 (File_read::release): Release descriptor.
12024 (File_read::do_read): Make non-const. Reopen descriptor.
12025 (File_read::read): Make non-const.
12026 (File_read::make_view): Reopen descriptor.
12027 (File_read::do_readv): Likewise.
12028 * fileread.h (class File_read): Add is_descriptor_opened_ field.
12029 Update declarations.
12030 * layout.cc: Include "descriptors.h".
12031 (Layout::create_build_id): Use open_descriptor rather than open.
12032 * output.cc: Include "descriptors.h".
12033 (Output_file::open): Use open_descriptor rather than open.
12034 * archive.cc (Archive::const_iterator): Change Archive to be
12036 (Archive::begin, Archive::end): Make non-const.
12037 (Archive::count_members): Likewise.
12038 * archive.h (class Archive): Update declarations.
12039 * object.h (Object::read): Make non-const.
12040 * Makefile.am (CCFILES): Add descriptors.cc.
12041 (HFILES): Add descriptors.h.
12042 * Makefile.in: Rebuild.
12045 * gold.h: Always include <clocale>. Add Solaris workarounds
12046 following code in binutils/sysdep.h.
12049 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12050 this->eh_frame_hdr_ is NULL before using it.
12052 * dynobj.cc (Versions::Versions): Update comment.
12054 * dynobj.cc (Versions::Versions): If there is an soname, use it as
12055 the base version name.
12057 * stringpool.cc (Stringpool_template::add_with_length): Set key to
12058 array size plus one.
12059 (Stringpool_template::set_string_offsets): Subtract one from key
12060 before using it as an array index.
12061 (Stringpool_template::get_offset_with_length): Likewise.
12062 (Stringpool_template::write_to_buffer): Likewise.
12063 * stringpool.h (Stringpool_template::get_offset_from_key):
12066 2008-07-23 Ian Lance Taylor <iant@google.com>
12069 * object.h (Merged_symbol_value::value): Do our best to handle a
12073 * script.cc (Version_script_info::get_versions): Don't add empty
12074 version tag to return value.
12075 (Version_script_info::get_symbol_version_helper): Change return
12076 type to bool. Add pversion parameter. Change all callers.
12077 (script_register_vers_node): Don't require a non-NULL tag.
12078 * script.h (class Version_script_info): Update declarations.
12079 (Version_script_info::get_symbol_version): Change return type to
12080 bool. Add version parameter. Change all callers.
12081 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12082 handling. Handle an empty version from a version script.
12083 (Symbol_table::define_special_symbol): Likewise.
12084 * testsuite/ver_test_10.script: New file.
12085 * testsuite/ver_test_10.sh: New file.
12086 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12087 (check_DATA): Add ver_test_10.syms.
12088 (ver_test_10.syms, ver_test_10.so): New target.
12089 * testsuite/Makefile.in: Rebuild.
12091 2008-07-23 Simon Baldwin <simonb@google.com>
12093 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12094 to zero for undefined symbols from dynamic libraries.
12096 2008-07-23 Ian Lance Taylor <iant@google.com>
12098 * symtab.cc (Symbol_table::resolve): Remove version parameter.
12099 Change all callers.
12100 * symtab.h (class Symbol_table): Update declaration.
12101 * testsuite/ver_test_9.cc: New file.
12102 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12103 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12104 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12105 (ver_test_9.so, ver_test_9.o): New targets.
12106 * testsuite/Makefile.in: Rebuild.
12108 2008-07-22 Ian Lance Taylor <iant@google.com>
12110 * options.h (class General_options): Define --check-sections.
12111 * layout.cc (Layout::set_segment_offsets): Handle
12114 * options.h (class General_options): Define -n/--nmagic and
12116 * options.cc (General_options::finalize): For -n/--nmagic or
12117 -N/--omagic, set -static.
12118 * layout.cc (Layout::attach_allocated_section_to_segment): If
12119 -N/--omagic, don't put read-only and read-write sections in
12120 different segments.
12121 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12122 finding a read-only segment.
12123 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12124 don't set the minimum segment alignment to the common page size,
12125 and don't set the file offset to the address modulo the page size.
12126 * script-sections.cc (Script_sections::create_segments): If
12127 -n/--omagic, don't put read-only and read-write sections in
12128 different segments.
12130 * cref.cc: New file.
12131 * cref.h: New file.
12132 * options.h (class General_options): Add --print-symbol-counts.
12133 * main.cc (main): Issue defined symbol report if requested.
12134 * archive.cc (Archive::interpret_header): Make into a const member
12136 (Archive::add_symbols): Call Input_objects::archive_start and
12138 (Archive::const_iterator): Define new class.
12139 (Archive::begin, Archive::end): New functions.
12140 (Archive::include_all_members): Rewrite to use iterator.
12141 (Archive::count_members): New function.
12142 * archive.h (class Archive): Update declarations.
12143 (Archive::filename): New function.
12144 * object.cc: Include "cref.h".
12145 (Sized_relobj::Sized_relobj): Initialize defined_count_.
12146 (Sized_relobj::do_get_global_symbol_counts): New function.
12147 (Input_objects::add_object): Add object to cross-referencer.
12148 (Input_objects::archive_start): New function.
12149 (Input_objects::archive_stop): New function.
12150 (Input_objects::print_symbol_counts): New function.
12151 * object.h: Declare Cref and Archive.
12152 (Object::get_global_symbol_counts): New function.
12153 (Object::do_get_global_symbol_counts): New pure virtual function.
12154 (class Sized_relobj): Add defined_count_ field. Update
12156 (class Input_objects): Add cref_ field. Update constructor.
12157 Update declarations.
12158 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12160 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12162 (Sized_dynobj::do_get_global_symbol_counts): New function.
12163 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12164 defined_count_. Update declarations. Define Symbols typedef.
12165 * symtab.cc (Symbol_table::add_from_relobj): Add defined
12166 parameter. Change all callers.
12167 (Symbol_table::add_from_dynobj): Add sympointers and defined
12168 parameters. Change all callers.
12169 * symtab.h (class Symbol_table): Update declarations.
12170 * Makefile.am (CCFILES): Add cref.cc.
12171 (HFILES): Add cref.h.
12172 * Makefile.in: Rebuild.
12174 2008-07-22 Simon Baldwin <simonb@google.com>
12176 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12177 to zero when writing undefined symbols.
12179 2008-07-22 Ian Lance Taylor <iant@google.com>
12181 * output.cc (Output_section::add_input_section): Don't try to
12182 merge empty merge sections.
12184 2008-07-21 Craig Silverstein <csilvers@google.com>
12186 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12187 Include symbol version in error message.
12189 2008-07-20 Chris Demetriou <cgd@google.com>
12191 * configure.ac (gold_cv_c_random_seed): New configured variable.
12192 (RANDOM_SEED_CFLAGS): New substituted variable.
12193 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12194 * configure: Rebuild.
12195 * Makefile.in: Likewise.
12196 * testsuite/Makefile.in: Likewise.
12198 2008-07-18 Ian Lance Taylor <iant@google.com>
12200 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12201 where we see NAME/NULL and NAME/VERSION as separate symbols.
12202 * testsuite/ver_test_main.cc (main): Call t4.
12203 (t4, t4_2a): Define.
12204 * testsuite/ver_test_2.cc (t4_2): Define.
12205 * testsuite/ver_test_2.script: Put t4_2a in VER2.
12206 * testsuite/ver_test_4.cc (t4_2a): Define.
12207 * testsuite/ver_test_4.script: Put t4_2a in VER2.
12208 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12210 2008-07-17 Ian Lance Taylor <iant@google.com>
12212 * dynobj.cc (Versions::add_def): If we give an error about a
12213 missing version, go ahead and create the version anyhow.
12215 2008-07-10 Ian Lance Taylor <iant@google.com>
12217 Handle output sections with more than 0x7fffffff bytes.
12218 * object.h (class Relobj): Change map_to_output_ to
12219 output_sections_, and just keep a section pointer. Change all
12220 uses. Move comdat group support to Sized_relobj.
12221 (Relobj::is_section_specially_mapped): Remove.
12222 (Relobj::output_section): Remove poff parameter. Change all
12224 (Relobj::output_section_offset): New function.
12225 (Relobj::set_section_offset): Rewrite.
12226 (Relobj::map_to_output): Remove.
12227 (Relobj::output_sections): New function.
12228 (Relobj::do_output_section_offset): New pure virtual function.
12229 (Relobj::do_set_section_offset): Likewise.
12230 (class Sized_relobj): Add section_offsets_ field. Add comdat
12231 group support from Relobj. Update declarations.
12232 (Sized_relobj::get_output_section_offset): New function.
12233 (Sized_relobj::do_output_section_offset): New function.
12234 (Sized_relobj::do_set_section_offset): New function.
12235 * object.cc (Relobj::output_section_address): Remove.
12236 (Sized_relobj::Sized_relobj): Initialize new fields.
12237 (Sized_relobj::include_section_group): Cast find_kept_object to
12239 (Sized_relobj::include_linkonce_section): Likewise.
12240 (Sized_relobj::do_layout): Use separate arrays for output section
12242 (Sized_relobj::do_count_local_symbols): Change map_to_output to
12244 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12245 output_sections and section_offsets.
12246 (Sized_relobj::write_local_symbols): Likewise.
12247 (map_to_kept_section): Compute output address directly.
12248 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12249 output_sections and section_offsets.
12250 (Sized_relobj::write_sections): Likewise.
12251 (Sized_relobj::relocate_sections): Likewise.
12252 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12253 * output.h (class Output_reloc): Update declarations. Change
12254 u2_.relobj to Sized_relobj*.
12255 (class Output_data_reloc): Change add functions to use
12257 * output.cc (Output_reloc::Output_reloc): Change relobj to
12259 (Output_reloc::local_section_offset): Change return type to
12260 Elf_Addr. Use get_output_section_offset.
12261 (Output_reloc::get_address): Likewise.
12262 (Output_section::is_input_address_mapped): Don't call
12263 is_section_specially_mapped.
12264 (Output_section::output_offset): Likewise.
12265 (Output_section::output_address): Likewise.
12266 (Output_section::starting_output_address): Likewise.
12267 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12268 parameter to Sized_relobj*.
12269 (Copy_relocs::need_copy_reloc): Likewise.
12270 (Copy_relocs::save): Likewise.
12271 * copy-relocs.h (class Copy_relocs): Update declarations.
12272 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12273 Sized_relobj*. Change relobj_ field to Sized_relobj*.
12274 * target-reloc.h (relocate_for_relocatable): Change
12275 offset_in_output_section type to Elf_Addr. Change code that uses
12277 * layout.cc (Layout::layout): Always set *off.
12278 * mapfile.cc (Mapfile::print_input_section): Use
12279 output_section_offset.
12280 * i386.cc (Target_i386::copy_reloc): Change object parameter to
12282 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12283 * sparc.cc (Target_sparc::copy_reloc): Likewise.
12284 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12286 2008-07-03 Ian Lance Taylor <iant@google.com>
12288 * layout.cc (Layout::include_section): Do not discard unrecognized
12289 SHT_STRTAB sections.
12291 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
12293 * script.cc (Lex::can_continue_name): Make '?' allowable in
12294 version-script names.
12295 * testsuite/version_script.map: Change glob pattern to use '?'
12297 2008-06-30 Manish Singh <yosh@gimp.org>
12300 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12303 2008-06-30 Ian Lance Taylor <iant@google.com>
12307 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12308 versions]: Don't try to read the value in the contents, since we
12309 don't use it. Use the template endianness when writing.
12311 2008-06-25 Cary Coutant <ccoutant@google.com>
12313 * fileread.cc (File_read::make_view): Assert on zero-length view.
12314 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12315 symbol table when there are no symbols to read.
12317 2008-06-23 Craig Silverstein <csilvers@google.com>
12319 * version.cc (version_string): Bump to 1.7
12321 2008-06-18 Craig Silverstein <csilvers@google.com>
12323 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12324 constant 0xFFFF to type Valtype.
12325 (Powerpc_relocate_functions::rel16_ha): Likewise.
12327 2008-06-17 Ian Lance Taylor <iant@google.com>
12329 * output.h (Output_section::Input_section): Initialize p2align_ to
12330 zero for Output_section_data constructors.
12331 (Output_section::Input_section::addralign): If not an input
12332 section, return the alignment of the Output_section_data.
12333 * testsuite/copy_test.cc: New file.
12334 * testsuite/copy_test_1.cc: New file.
12335 * testsuite/copy_test_2.cc: New file.
12336 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12337 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12338 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12339 (copy_test_1_pic.o, copy_test_1.so): New targets.
12340 (copy_test_2_pic.o, copy_test_2.so): New targets.
12341 * testsuite/Makefile.in: Rebuild.
12343 * script-sections.cc (Script_sections::place_orphan): Initialize
12344 local variable exact.
12346 2008-06-13 David Edelsohn <edelsohn@gnu.org>
12348 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12350 2008-06-12 David Edelsohn <edelsohn@gnu.org>
12351 David S. Miller <davem@davemloft.net>
12353 * powerpc.cc: New file.
12354 * Makefile.am (TARGETSOURCES): Add powerpc.cc
12355 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12356 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12357 * Makefile.in: Rebuild.
12359 2008-06-09 Ian Lance Taylor <iant@google.com>
12361 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12363 (throwing, orig_terminate): New static variables.
12364 (terminate_handler): New static function.
12365 (t2): Set terminate handler.
12367 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
12370 * binary.cc (Binary_to_elf::sized_convert): Fix .data
12373 2008-05-30 Cary Coutant <ccoutant@google.com>
12375 * archive.cc (Archive::include_all_members) Correct to step
12376 over symbol table and extended name table in thin archives.
12378 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
12381 * target-reloc.h (relocate_for_relocatable): Fix new_offset
12384 2008-05-28 Caleb Howe <cshowe@google.com>
12386 * reduced_debug_output.cc: New file.
12387 * reduced_debug_output.h: New file.
12388 * options.h (class General_options): Add --strip-debug-non-line.
12389 * options.cc (General_options::finalize): Add strip_debug_non_line
12390 to the strip heirarchy.
12391 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12393 * layout.cc: Include "reduced_debug_output.h".
12394 (Layout::Layout): Initialize new fields.
12395 (line_only_debug_sections): New static array.
12396 (is_lines_only_debug_sections): New static inline function.
12397 (Layout::include_section): Handle --strip-debug-non-line.
12398 (Layout::make_output_section): If --strip-debug-non-line, build
12399 new output sections for .debug_abbrev and .debug_info.
12400 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12401 gold. Warn about possible overflow.
12402 (read_signed_LEB_128): Likewise.
12403 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12404 (read_signed_LEB_128): Declare.
12405 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12406 (HFILES): Add reduced_debug_output.h.
12407 * Makefile.in: Rebuild.
12409 2008-05-21 Ian Lance Taylor <iant@google.com>
12411 * mapfile.cc: New file.
12412 * mapfile.h: New file.
12413 * options.h (class General_options): Add -M/--print-map and -Map.
12414 * options.cc (General_options::finalize): Make -M equivalent to
12416 * main.cc: Include <cstdio> and "mapfile.h".
12417 (main): Open mapfile if requested.
12418 * gold.cc (class Middle_runner): Add mapfile_ field. Update
12419 constructor. Change caller.
12420 (queue_initial_tasks): Add mapfile parameter. Change caller.
12421 (queue_middle_tasks): Likewise.
12422 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12424 * archive.cc: Include "mapfile.h".
12425 (Archive::add_symbols): Add mapfile parameter. Change all
12426 callers. Pass mapfile, symbol, and reason to include_member.
12427 (Archive::include_all_members): Add mapfile parameter. Change all
12429 (Archive::include_member): Add mapfile, sym, and why parameters.
12430 Change all callers. Report inclusion to map file.
12431 * archive.h: Include "fileread.h".
12432 (class Archive): Update declarations.
12433 (Archive::file): New const method.
12434 (class Add_archive_symbols): Add mapfile_ field. Update
12435 constructor. Change all callers.
12436 * readsyms.h (class Read_symbols): Likewise.
12437 (class Finish_group): Likewise.
12438 (class Read_script): Likewise.
12439 * common.cc: Include "mapfile.h".
12440 (Symbol_table::allocate_commons): Add mapfile parameter. Change
12442 (Symbol_table::do_allocate_commons): Likewise.
12443 (Symbol_table::do_allocate_commons_list): Likewise. Report common
12444 symbol allocation to mapfile.
12445 * common.h (class Allocate_commons_task): Add mapfile_ field.
12446 Update constructor. Change all callers.
12447 * symtab.h (class Symbol_table): Update declarations.
12448 * layout.cc: Include "mapfile.h".
12449 (Layout_task_runner::run): Print information to mapfile.
12450 (Layout::create_gold_note): Change Output_data_fixed_space to
12451 Output_data_zero_fill.
12452 (Layout::create_build_id): Likewise.
12453 (Layout::print_to_mapfile): New function.
12454 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
12455 constructor. Change caller.
12456 (class Layout): Declare print_to_mapfile.
12457 * output.cc (Output_section::Input_section::print_to_mapfile): New
12459 (Output_section::add_input_section): If producing a map, always
12460 add to input_sections_ list.
12461 (Output_section::do_print_to_mapfile): New function.
12462 (Output_segment::print_sections_to_mapfile): New function.
12463 (Output_segment::print_section_list_to_mapfile): New function.
12464 * output.h: Include "mapfile.h".
12465 (Output_data::print_to_mapfile): New function.
12466 (Output_data::do_print_to_mapfile): New virtual function.
12467 (Output_segment_headers::do_print_to_mapfile): New function.
12468 (Output_file_header::do_print_to_mapfile): New function.
12469 (Output_data_const::do_print_to_mapfile): New function.
12470 (class Output_data_const_buffer): Add map_name_ field. Update
12471 constructor. Change all callers. Add do_print_to_mapfile
12473 (class Output_data_fixed_space): Likewise.
12474 (class Output_data_space): Likewise.
12475 (class Output_data_zero_fill): New class.
12476 (Output_data_strtab::do_print_to_mapfile): New function.
12477 (Output_data_reloc_base::do_print_to_mapfile): New function.
12478 (Output_relocatable_relocs::do_print_to_mapfile): New function.
12479 (Output_data_group::do_print_to_mapfile): New function.
12480 (Output_data_got::do_print_to_mapfile): New function.
12481 (Output_data_dynamic::do_print_to_mapfile): New function.
12482 (Output_symtab_xindex::do_print_to_mapfile): New function.
12483 (class Output_section): Declare do_print_to_mapflie. Declare
12484 print_to_mapfile in Input_section.
12485 (class Output_segment): Declare new functions.
12486 * object.h (Sized_relobj::symbol_count): New function.
12487 * script-sections.cc
12488 (Output_section_element_dot_assignment::set_section_addresses):
12489 Change Output_data_fixed_space to Output_data_zero_fill.
12490 (Output_data_expression::do_print_to_mapfile): New function.
12491 * script.cc (read_input_script): Add mapfile parameter. Change
12493 * script.h (read_input_script): Update declaration.
12494 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12495 (Eh_frame::do_print_to_mapfile): New function.
12496 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12497 (Output_merge_string::do_print_to_mapfile): New function.
12498 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12500 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12502 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12504 * Makefile.am (CCFILES): Add mapfile.cc.
12505 (HFILES): Add mapfile.h.
12506 * Makefile.in: Rebuild.
12508 2008-05-19 Ian Lance Taylor <iant@google.com>
12510 * options.h (class General_options): Add -z relro.
12511 * layout.cc (Layout::Layout): Initialize relro_segment_.
12512 (Layout::add_output_section_data): Return the output section.
12513 (Layout::make_output_section): Rcognize relro sections and mark
12514 them appropriately.
12515 (Layout::attach_allocated_section_to_segment): Put relro sections
12516 in a PT_GNU_RELRO segment.
12517 (Layout::create_initial_dynamic_sections): Mark the .dynamic
12519 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12521 (Layout::linkonce_mapping): Map d.rel.ro.local to
12522 .data.rel.ro.local.
12523 (Layout::output_section_name): Us .data.rel.ro.local for any
12524 section which begins with that.
12525 * layout.h (class Layout): Update add_output_section_data
12526 declaration. Add relro_segment_ field.
12527 * output.cc (Output_section::Output_section): Initialize is_relro_
12528 and is_relro_local_ fields.
12529 (Output_segment::add_output_section): Group relro sections.
12530 (Output_segment::is_first_section_relro): New function.
12531 (Output_segment::maximum_alignment): If there is a relro section,
12532 align the segment to the common page size.
12533 (Output_segment::set_section_addresses): Track whether we are
12534 looking at relro sections. If the last section is a relro
12535 section, align to the common page size.
12536 (Output_segment::set_section_list_addresses): Add in_relro
12537 parameter. Change all callers. Align to the page size when
12538 moving from relro to non-relro section.
12539 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12541 * output.h (class Output_section): Add is_relro_ and
12542 is_relro_local_ fields.
12543 (Output_section::is_relro): New function.
12544 (Output_section::set_is_relro): New function.
12545 (Output_section::is_relro_local): New function.
12546 (Output_section::set_is_relro_local): New function.
12547 (class Output_segment): Update declarations.
12548 * i386.cc (Target_i386::got_section): Mark .got section as relro.
12549 * sparc.cc (Target_sparc::got_section): Likewise.
12550 * x86_64.cc (Target_x86_64::got_section): Likewise.
12551 * testsuite/relro_test_main.cc: New file.
12552 * testsuite/relro_test.cc: New file.
12553 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12554 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12555 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12556 (relro_test.so, relro_test_pic.o): New targets.
12557 * testsuite/Makefile.in: Rebuild.
12559 2008-05-16 Ian Lance Taylor <iant@google.com>
12561 * output.cc (Output_segment::add_output_section): Remove front
12563 * output.h (class Output_segment): Remove
12564 add_initial_output_section and overloaded add_output_section.
12565 Update declaration of remaining add_output_section.
12566 * layout.cc (Layout::create_interp): Call add_output_section
12567 rather than add_initial_output_section.
12568 (Layout::finish_dynamic_section): Likewise.
12570 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12571 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
12572 know the dynamic type.
12573 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12574 field. Initialize it in constructor.
12575 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12576 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12577 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12580 * output.cc (Output_reloc::get_address): Change return type to
12582 * output.h (class Output_reloc): Update get_address declaration.
12583 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12584 for section addresses.
12586 2008-05-09 Ian Lance Taylor <iant@google.com>
12589 * gold.cc (gold_nomem): Use return value of write.
12591 2008-05-08 Ian Lance Taylor <iant@google.com>
12593 * symtab.c (Symbol::init_base_output_data): Add version
12594 parameter. Change all callers.
12595 (Symbol::init_base_output_segment): Likewise.
12596 (Symbol::init_base_constant): Likewise.
12597 (Symbol::init_base_undefined): Likewise.
12598 (Sized_symbol::init_output_data): Likewise.
12599 (Sized_symbol::init_output_segment): Likewise.
12600 (Sized_symbol::init_constant): Likewise.
12601 (Sized_symbol::init_undefined): Likewise.
12602 (Symbol_table::do_define_in_output_data): If the new symbol has a
12603 version, mark it as the default.
12604 (Symbol_table::do_define_in_output_segment): Likewise.
12605 (Symbol_table::do_define_as_constant): Likewise.
12606 * symtab.h (class Symbol): Update declarations.
12607 (class Sized_symbol): Likewise.
12608 * resolve.cc (Symbol::override_version): New function.
12609 (Symbol::override_base): Call override_version.
12610 (Symbol::override_base_with_special): Likewise.
12611 * testsuite/ver_script_8.script: New file.
12612 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12613 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12614 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12615 (ver_test_8_1.so, ver_test_8_2.so): New targets.
12617 2008-05-06 Ian Lance Taylor <iant@google.com>
12620 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12622 (class General_options): Remove existing --undefined, and add
12623 --no-undefined instead. Add new --undefined as synonym for -u.
12624 * archive.cc (Archive::add_symbols): Check whether symbol was
12626 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12627 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12628 all uses. Add IS_UNDEFINED. Update declarations to split
12629 different versions of init_base. Declare init_base_undefined.
12630 (Symbol::is_defined): Handle IS_UNDEFINED.
12631 (Symbol::is_undefined): Likewise.
12632 (Symbol::is_weak_undefined): Call is_undefined.
12633 (Symbol::is_absolute): Handle IS_CONSTANT.
12634 (class Sized_symbol): Update declarations to split different
12635 versions of init. Declare init_undefined.
12636 (class Symbol_table): Declare new functions.
12637 * symtab.cc (Symbol::init_base_object): Rename from init_base.
12638 Change all callers.
12639 (Symbol::init_base_output_data): Likewise.
12640 (Symbol::init_base_output_segment): Likewise.
12641 (Symbol::init_base_constant): Likewise.
12642 (Symbol::init_base_undefined): New function.
12643 (Sized_symbol::init_object): Rename from init. Change all
12645 (Sized_symbol::init_output_data): Likewise.
12646 (Sized_symbol::init_output_segment): Likewise.
12647 (Sized_symbol::init_constant): Likewise.
12648 (Sized_symbol::init_undefined): New function.
12649 (Symbol_table::add_undefined_symbols_from_command_line): New
12651 (Symbol_table::do_add_undefined_symbols_from_command_line): New
12653 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12654 (Symbol::output_section): Likewise.
12655 (Symbol::set_output_section): Likewise.
12656 (Symbol_table::sized_finalize_symbol): Likewise.
12657 (Symbol_table::sized_write_globals): Likewise.
12658 * resolve.cc (Symbol_table::should_override): Likewise.
12659 (Symbol::override_base_with_special): Likewise.
12661 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12662 symbol, change it to have default visibility.
12663 * testsuite/protected_1.cc: New file.
12664 * testsuite/protected_2.cc: New file.
12665 * testsuite/protected_3.cc: New file.
12666 * testsuite/protected_main_1.cc: New file.
12667 * testsuite/protected_main_2.cc: New file.
12668 * testsuite/protected_main_3.cc: New file.
12669 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12670 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12671 (protected_1_LDFLAGS, protected_1_LDADD): Define.
12672 (protected_1.so): New target.
12673 (protected_1_pic.o, protected_2_pic.o): New targets.
12674 (protected_3_pic.o): New target.
12675 (check_PROGRAMS): Add protected_2.
12676 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12677 (protected_2_LDFLAGS, protected_2_LDADD): Define.
12678 * testsuite/Makefile.in: Rebuild.
12680 * options.h (DEFINE_var): Add set_user_set_##varname__.
12681 (DEFINE_bool_alias): New macro.
12682 (class General_options): Define -Bstatic using DEFINE_bool_alias
12683 rather than DEFINE_special. Add --undefined as an alias for -z
12685 * options.cc (General_options::parse_Bstatic): Remove.
12687 * options.h (class General_options): Add --fatal-warnings.
12688 * main.cc (main): Implement --fatal-warnings.
12689 * errors.h (Errors::warning_count): New function.
12691 * options.h (class General_options): Add -Bsymbolic-functions.
12692 * symtab.h (Symbol::is_preemptible): Check for
12693 -Bsymbolic-functions.
12695 2008-05-05 Ian Lance Taylor <iant@google.com>
12697 * options.h (DEFINE_bool): For DASH_Z, create the negative option
12698 as noVARNAME rather than no-VARNAME.
12699 (class General_options): Add option -z combreloc.
12700 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12702 (Output_reloc::sort_before) [SHT_REL]: New function.
12703 (Output_reloc::sort_before) [SHT_RELA]: New function.
12704 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12705 Sort_relocs_comparison.
12706 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12707 parameter. Change all callers.
12708 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12709 sort_relocs parameter. Change all callers.
12710 * output.cc (Output_reloc::get_address): New function, broken out
12712 (Output_reloc::write_rel): Call it.
12713 (Output_reloc::compare): New function.
12714 (Output_data_reloc_base::do_write): Optionally sort relocs.
12716 * configure.ac: If targ_extra_obj is set, link it in.
12717 * configure.tgt: Initialize all variables.
12718 (x86_64*): Set targ_extra_obj and targ_extra_size.
12719 * configure: Rebuild.
12721 * object.cc (Sized_relobj::include_section_group): Adjust section
12722 indexes read from group data. Build vector to pass to
12724 * layout.cc (Layout::layout_group): Add flags and shndxes
12725 parameters. Remove contents parameter. Change caller. Update
12726 explicit instantiations.
12727 * layout.h (class Layout): Update layout_group declaration.
12728 * output.cc (Output_data_group::Output_data_group): Add flags and
12729 input_shndxes parameters. Remove contents parameter. Change
12731 (Output_data_group::do_write): Change input_sections_ to
12733 * output.h (class Output_data_group): Update constructor
12734 declaration. Rename input_sections_ to input_shndxes_.
12735 * testsuite/many_sections_test.cc: Add template.
12737 2008-04-30 Cary Coutant <ccoutant@google.com>
12739 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12741 * layout.cc (Layout::include_section): Refactored check for debug
12743 (Layout::add_comdat): Add new parameters. Change type
12744 of signature parameter. Add object and shndx to signatures table.
12745 (Layout::find_kept_object): New function.
12746 * layout.h: Include <cstring>.
12747 (Layout::is_debug_info_section): New function.
12748 (Layout::add_comdat): Add new parameters.
12749 (Layout::find_kept_object): New function.
12750 (Layout::Kept_section): New struct.
12751 (Layout::Signatures): Change type of map range.
12752 * object.cc (Relobj::output_section_address): New function.
12753 (Sized_relobj::include_section_group): Add new parameters. Change
12754 calls to Layout::add_comdat. Change to build table of kept comdat
12755 groups and table mapping discarded sections to kept sections.
12756 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12757 (Sized_relobj::do_layout): Change calls to include_section_group and
12758 include_linkonce_section.
12759 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12760 value to zero when section is discarded.
12761 (Sized_relobj::map_to_kept_section): New function.
12762 * object.h (Relobj::output_section_address): New function.
12763 (Relobj::Comdat_group): New type.
12764 (Relobj::find_comdat_group): New function.
12765 (Relobj::Comdat_group_table): New type.
12766 (Relobj::Kept_comdat_section): New type.
12767 (Relobj::Kept_comdat_section_table): New type.
12768 (Relobj::add_comdat_group): New function.
12769 (Relobj::set_kept_comdat_section): New function.
12770 (Relobj::get_kept_comdat_section): New function.
12771 (Relobj::comdat_groups_): New field.
12772 (Relobj::kept_comdat_sections_): New field.
12773 (Symbol_value::input_value): Update comment.
12774 (Sized_relobj::map_to_kept_section) New function.
12775 (Sized_relobj::include_linkonce_section): Add new parameter.
12776 * target-reloc.h (Comdat_behavior): New type.
12777 (get_comdat_behavior): New function.
12778 (relocate_section): Add code to map a discarded section to the
12779 corresponding kept section when applying a relocation.
12781 2008-04-30 Craig Silverstein <csilvers@google.com>
12783 * dwarf_reader.cc (next_generation_count): New static var.
12784 (Addr2line_cache_entry): New struct.
12785 (addr2line_cache): New static var.
12786 (Dwarf_line_info::one_addr2line): Added caching.
12787 (Dwarf_line_info::clear_addr2line_cache): New function.
12788 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12789 cache-size parameter.
12790 (Dwarf_line_info::one_addr2line_cache): New function.
12791 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12792 new cache-size argument to one_addr2line(), and clear cache.
12794 2008-04-28 Cary Coutant <ccoutant@google.com>
12796 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12797 R_386_PC8 relocations.
12799 2008-04-23 Ian Lance Taylor <iant@google.com>
12801 * object.cc (Sized_relobj::include_section_group): Check for
12802 invalid section group.
12804 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12807 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12808 than read for file header.
12809 * archive.cc (Archive::include_member): Likewise.
12811 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
12813 * aclocal.m4: Regenerate.
12814 * configure: Regenerate.
12816 2008-04-19 Ian Lance Taylor <iant@google.com>
12818 * version.cc (version_string): Bump to 1.6.
12820 * testsuite/Makefile.am (many_sections_r_test): New target.
12821 (many_sections_r_test_SOURCES): Remove.
12822 (many_sections_r_test_DEPENDENCIES): Remove.
12823 (many_sections_r_test_LDFLAGS): Remove.
12824 (many_sections_r_test_LDADD): Remove.
12826 * object.cc (Sized_relobj::do_add_symbols): Always pass
12827 local_symbol_count_ to add_from_relobj.
12829 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12830 every thousand variables.
12831 * testsuite/Makefile.in: Rebuild.
12833 * object.cc (Xindex::initialize_symtab_xindex): New function.
12834 (Xindex::read_symtab_xindex): New function.
12835 (Xindex::sym_xindex_to_shndx): New function.
12836 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12838 (Sized_relobj::do_initialize_xindex): New function.
12839 (Sized_relobj::do_read_symbols): Adjust section links.
12840 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12841 parameter. Change all callers.
12842 (Sized_relobj::include_section_group): Adjust section links and
12843 symbol section indexes.
12844 (Sized_relobj::do_layout): Adjust section links.
12845 (Sized_relobj::do_count_local_symbols): Adjust section links and
12846 symbol section indexes.
12847 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12848 ordinary and special symbols.
12849 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12850 dynsym_xindex parameters. Change all callers. Adjust section
12851 links. Use SHN_XINDEX when needed.
12852 (Sized_relobj::get_symbol_location_info): Adjust section links.
12853 Don't get fooled by special symbols.
12854 * object.h (class Xindex): Define.
12855 (class Object): Add xindex_ parameter. Declare virtual functoin
12856 do_initialize_xindex.
12857 (Object::adjust_sym_shndx): New function.
12858 (Object::set_xindex): New protected function.
12859 (class Symbol_value): Add is_ordinary_shndx_ field.
12860 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12861 (Symbol_value::value): Assert ordinary section.
12862 (Symbol_value::initialize_input_to_output_map): Likewise.
12863 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12864 Change all callers.
12865 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12867 (class Sized_relobj): Update declarations.
12868 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12869 parameter. Change all callers.
12870 (Sized_relobj::adjust_shndx): New function.
12871 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12873 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12874 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
12875 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
12876 (Sized_dynobj::read_dynsym_section): Adjust section links.
12877 (Sized_dynobj::read_dynamic): Likewise.
12878 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
12880 (Sized_dynobj::do_initialize_xindex): New function.
12881 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
12882 do_initialize_xindex.
12883 (Sized_dynobj::adjust_shndx): New function.
12884 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12885 dynsym_xindex_ fields.
12886 (Layout::finalize): Add a call to set_section_indexes before
12887 creating the symtab sections.
12888 (Layout::set_section_indexes): Don't do anything if the section
12889 already has a section index.
12890 (Layout::create_symtab_sections): Add shnum parameter. Change
12891 caller. Create .symtab_shndx section if needed.
12892 (Layout::create_shdrs): Add shstrtab_section parameter. Change
12894 (Layout::allocated_output_section_count): New function.
12895 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12897 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12898 fields. Update declarations.
12899 (Layout::symtab_xindex): New function.
12900 (Layout::dynsym_xindex): New function.
12901 (class Write_symbols_task): Add layout_ field.
12902 (Write_symbols_task::Write_symbols_task): Add layout parameter.
12904 * output.cc (Output_section_headers::Output_section_headers): Add
12905 shstrtab_section parameter. Change all callers.
12906 (Output_section_headers::do_sized_write): Store overflow values
12907 for section count and section string table section index in
12908 section header zero.
12909 (Output_file_header::do_sized_write): Check for overflow of
12910 section count and section string table section index.
12911 (Output_symtab_xindex::do_write): New function.
12912 (Output_symtab_xindex::endian_do_write): New function.
12913 * output.h (class Output_section_headers): Add shstrtab_section_.
12914 Update declarations.
12915 (class Output_symtab_xindex): Define.
12916 (Output_section::has_out_shndx): New function.
12917 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12919 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12920 Change all callers.
12921 (Sized_symbol::init): Likewise.
12922 (Symbol::output_section): Check for ordinary symbol.
12923 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
12924 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
12926 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12927 Change all callers. Simplify handling of symbols from sections
12928 not included in the link.
12929 (Symbol_table::add_from_dynobj): Handle ordinary symbol
12931 (Weak_alias_sorter::operator()): Assert that symbols are
12933 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12935 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12936 parameters. Change all callers.
12937 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
12938 symbol distinction. Use SHN_XINDEX when needed.
12939 (Symbol_table::write_section_symbol): Add symtab_xindex
12940 parameter. Change all callers.
12941 (Symbol_table::sized_write_section_symbol): Likewise. Use
12942 SHN_XINDEX when needed.
12943 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
12945 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
12946 (Symbol::is_defined): Check is_ordinary.
12947 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12948 (Symbol::is_absolute, Symbol::is_common): Likewise.
12949 (class Sized_symbol): Update declarations.
12950 (class Symbol_table): Update declarations.
12951 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12952 parameters. Change all callers.
12953 (Sized_symbol::override): Likewise.
12954 (Symbol_table::override): Likewise.
12955 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
12956 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
12957 is_ordinary, and orig_st_shndx parameters. Change all callers.
12958 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12959 to be in an ordinary section.
12960 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12961 object and is_ordinary parameters. Change all callers.
12962 (Sized_dwarf_line_info::read_relocs): Add object parameter.
12963 Change all callers. Don't add undefined or non-ordinary symbols
12965 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12966 Change all callers.
12967 * dwarf_reader.h (class Sized_dwarf_line_info): Update
12969 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12970 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12971 (Sized_relobj::relocate_sections): Likewise.
12972 * target-reloc.h (scan_relocs): Adjust section symbol index.
12973 (scan_relocatable_relocs): Likewise.
12974 * i386.cc (Scan::local): Check for ordinary symbols.
12975 * sparc.cc (Scan::local): Likewise.
12976 * x86_64.cc (Scan::local): Likewise.
12977 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12978 to symbol_section_and_value.
12979 * testsuite/many_sections_test.cc: New file.
12980 * testsuite/Makefile.am (BUILT_SOURCES): Define.
12981 (check_PROGRAMS): Add many_sections_test.
12982 (many_sections_test_SOURCES): Define.
12983 (many_sections_test_DEPENDENCIES): Define.
12984 (many_sections_test_LDFLAGS): Define.
12985 (BUILT_SOURCES): Add many_sections_define.h.
12986 (many_sections_define.h): New target.
12987 (BUILT_SOURCES): Add many_sections_check.h.
12988 (many_sections_check.h): New target.
12989 (check_PROGRAMS): Add many_sections_r_test.
12990 (many_sections_r_test_SOURCES): Define.
12991 (many_sections_r_test_DEPENDENCIES): Define.
12992 (many_sections_r_test_LDFLAGS): Define.
12993 (many_sections_r_test_LDADD): Define.
12994 (many_sections_r_test.o): New target.
12995 * testsuite/Makefile.in: Rebuild.
12997 2008-04-17 Cary Coutant <ccoutant@google.com>
12999 * errors.cc (Errors::info): New function.
13000 (gold_info): New function.
13001 * errors.h (Errors::info): New function.
13002 * gold.h (gold_info): New function.
13003 * object.cc (Input_objects::add_object): Print trace output.
13004 * options.cc (options::parse_set): New function.
13005 (General_options::parse_wrap): Deleted.
13006 (General_options::General_options): Deleted initializer.
13007 * options.h (options::String_set): New typedef.
13008 (options::parse_set): New function.
13009 (DEFINE_set): New macro.
13010 (General_options::wrap): Changed to use DEFINE_set. Changed
13011 callers of any_wrap_symbols and is_wrap_symbol.
13012 (General_options::trace, General_options::trace_symbol):
13014 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13015 (General_options::wrap_symbols_): Deleted.
13016 * symtab.cc (Symbol_table::add_from_object): Print trace output.
13018 2008-04-17 David S. Miller <davem@davemloft.net>
13020 * options.cc (General_options::parse_V): New function.
13021 * options.h: Add entries for -V and -Qy.
13023 2008-04-17 Ian Lance Taylor <iant@google.com>
13025 * common.cc (Symbol_table::allocate_commons): Remove options
13026 parameter. Change caller.
13027 (Symbol_table::do_allocate_commons): Remove options parameter.
13028 Change caller. Just call do_allocate_commons_list twice.
13029 (Symbol_table::do_allocate_commons_list): New function, broken out
13030 of do_allocate_commons.
13031 * common.h (class Allocate_commons_task): Remove options_ field.
13032 Update constructor.
13033 * symtab.cc (Symbol_table::Symbol_table): Initialize
13035 (Symbol_table::add_from_object): Put TLS common symbols on
13037 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13038 which are IN_OUTPUT_DATA.
13039 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
13040 allocate_commons and do_allocate_commons declarations. Declare
13041 do_allocate_commons_list.
13042 * gold.cc (queue_middle_tasks): Update creation of
13043 Allocate_commons_task to not pass options.
13044 * testsuite/Makefile.am (INCLUDES): Add -I.. .
13045 (TLS_TEST_C_FLAGS): New variable.
13046 (tls_test_c_pic.o): New target.
13047 (tls_test_shared.so): Link in tls_test_c_pic.o.
13048 (tls_test_c_pic_ie.o): New target.
13049 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13050 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13051 (tls_test_c.o): New target.
13052 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13053 (tls_pic_test_LDADD): Likewise.
13054 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13055 (tls_shared_gd_to_ie_test_LDADD): Likewise.
13056 (tls_test_c_gnu2.o): New target.
13057 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13059 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13060 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13061 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13062 * testsuite/tls_test.cc: Include "config.h".
13063 (t_last): Call t11_last.
13064 * testsuite/tls_test.h (t11, t11_last): Declare.
13065 * testsuite/tls_test_c.c: New file.
13066 * testsuite/tls_test_main.cc (thread_routine): Call t11.
13067 * configure.ac: Check for OpenMP support.
13068 * configure, config.in, Makefile.in: Rebuild.
13069 * testsuite/Makefile.in: Rebuild.
13071 2008-04-16 Cary Coutant <ccoutant@google.com>
13073 * i386.cc (Target_i386::define_tls_base_symbol): New function.
13074 (Target_i386::tls_base_symbol_defined_): New field.
13075 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13076 (Target_i386::Scan::global): Likewise.
13077 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13078 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13079 (Target_x86_64::tls_base_symbol_defined_): New field.
13080 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13081 (Target_x86_64::Scan::global): Likewise.
13083 2008-04-16 Cary Coutant <ccoutant@google.com>
13085 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13086 (Symbol::needs_plt_entry): Allow weak undefined symbols.
13087 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13088 building shared libraries.
13089 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13090 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13091 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13092 * testsuite/Makefile.in: Rebuild.
13093 * testsuite/weak_undef.h: New file.
13094 * testsuite/weak_undef_file1.cc: Add extra test cases.
13095 * testsuite/weak_undef_file2.cc: Likewise.
13096 * testsuite/weak_undef_test.cc: Likewise.
13098 2008-04-16 David S. Miller <davem@davemloft.net>
13100 * sparc.cc (Target_sparc::Scan): Change from struct to class.
13101 Add issued_non_pic_error_ field. Declare check_non_pic.
13102 (Target_sparc::Scan::check_non_pic): New function.
13103 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13104 (Target_sparc::Scan::global): Likewise.
13106 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13107 * configure: Rebuild.
13109 * options.h (DEFINE_enable): New macro.
13110 (new_dtags): New enable option.
13111 (initfirst, interpose, loadfltr, nodefaultlib,
13112 nodelete, nodlopen, nodump): New -z options.
13113 * layout.cc (Layout:finish_dynamic_section): If new
13114 dtags enabled, emit DT_RUNPATH. Also, emit a
13115 DT_FLAGS_1 containing any specified -z flags.
13117 2008-04-16 Ian Lance Taylor <iant@google.com>
13119 * copy-relocs.cc: New file.
13120 * copy-relocs.h: New file.
13121 * reloc.cc: Remove Copy_relocs code.
13122 * reloc.h: Likewise.
13123 * reloc-types.h (struct Reloc_types) [both versions]: Add
13124 get_reloc_addend_noerror.
13125 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13126 variants of add_global which take an addend which must be zero.
13127 * i386.cc: Include "copy-relocs.h".
13128 (class Target_i386): Change type of copy_relocs_ to variable,
13129 update initializer.
13130 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13131 Change all callers.
13132 (Target_i386::do_finalize_sections): Change handling of
13134 * sparc.cc: Include "copy-relocs.h".
13135 (class Target_sparc): Change type of copy_relocs_ to variable,
13136 update initializer.
13137 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13138 Change all callers.
13139 (Target_sparc::do_finalize_sections): Change handling of
13141 * x86_64.cc: Include "copy-relocs.h".
13142 (class Target_x86_64): Change type of copy_relocs_ to variable,
13143 update initializer.
13144 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13145 class. Change all callers.
13146 (Target_x86_64::do_finalize_sections): Change handling of
13148 * Makefile.am (CCFILES): Add copy-relocs.cc.
13149 (HFILES): Add copy-relocs.h.
13151 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13153 * testsuite/script_test_4.sh: Permit leading zeroes.
13155 2008-04-15 Ian Lance Taylor <iant@google.com>
13157 * script-sections.cc (Script_sections::create_segments): Use
13158 header_size_adjustment even when there is enough room for the
13160 * testsuite/script_test_4.sh: New file.
13161 * testsuite/script_test_4.t: New file.
13162 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13163 (check_DATA): Add script_test_4.stdout.
13164 (MOSTLYCLEANFILES): Likewise.
13165 (script_test_4): New target.
13166 (script_test_4.stdout): New target.
13167 * testsuite/Makefile.in: Rebuild.
13169 * sparc.cc: Add definitions for Output_data_plt_sparc class
13172 2008-04-14 David S. Miller <davem@davemloft.net>
13174 * sparc.cc: New file.
13175 * Makefile.am (TARGETSOURCES): Add sparc.cc
13176 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13177 * configure.tgt: Document targ_extra_size and
13178 targ_extra_big_endian. Add entries for sparc-* and
13180 * configure.ac: Handle targ_extra_size and
13181 targ_extra_big_endian.
13182 * Makefile.in: Rebuild.
13183 * configure: Likewise.
13184 * po/POTFILES.in: Likewise.
13185 * po/gold.pot: Likewise.
13187 2008-04-14 Ian Lance Taylor <iant@google.com>
13189 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13190 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13191 in the name/type/flags to section mapping. Don't call
13192 allocate_output_section.
13193 (Layout::choose_output_section): Change parameter from adjust_name
13194 to is_input_section. Don't permit input sections after sections
13195 are attached to segments. Don't call allocate_output_section.
13196 (Layout::layout_eh_frame): Call update_flags_for_input_section,
13197 not write_enable_output_section.
13198 (Layout::make_output_section): Don't push to
13199 unattached_section_list_ nor call attach_to_segment. Call
13200 attach_section_to_segment if sections are attached.
13201 (Layout::attach_sections_to_segments): New function.
13202 (Layout::attach_section_to_segment): New function.
13203 (Layout::attach_allocated_section_to_segment): Rename from
13204 attach_to_segment. Remove flags parameter.
13205 (Layout::allocate_output_section): Remove function.
13206 (Layout::write_enable_output_section): Remove function.
13207 * layout.h (class Layout): Update for above changes. Add new
13208 field sections_are_attached_.
13209 * output.h (Output_section::update_flags_for_input_section): New
13211 * output.cc (Output_section::add_input_section): Call
13212 update_flags_for_input_section.
13213 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13215 2008-04-11 Cary Coutant <ccoutant@google.com>
13217 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13218 thought unnecessary.
13219 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13221 2008-04-11 Ian Lance Taylor <iant@google.com>
13223 * output.h (class Output_section_data): Remove inline definition
13225 * output.cc (Output_section_data::set_addralign): New function.
13227 2008-04-11 Cary Coutant <ccoutant@google.com>
13229 Add support for TLS descriptors for i386 and x86_64.
13230 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13231 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13232 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13234 (Target_i386::got_mod_index_entry): Remove unnecessary code.
13235 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13236 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
13238 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13239 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13240 Fix problem with initial-exec relocations.
13241 (Target_i386::Relocate::relocate_tls): Likewise.
13242 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13244 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13245 support for section-plus-offset dynamic table entries.
13246 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13247 (Output_data_dynamic::Dynamic_entry): Add support for
13248 section-plus-offset dynamic table entries.
13249 (Output_data_dynamic::Classification): Likewise.
13250 (Output_data_dynamic::classification_): Renamed offset_.
13251 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13252 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13253 (Target_x86_64::make_plt_section): New function.
13254 (Target_x86_64::reserve_tlsdesc_entries): New function.
13255 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13256 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13257 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13258 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13259 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13260 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13261 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13262 add extra PLT entry for TLS descriptors.
13263 (Output_data_plt_x86_64::got_): New field.
13264 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13265 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13267 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13269 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13270 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13271 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13272 R_386_TLS_DESC_CALL relocations.
13273 (Target_x86_64::Scan::global): Likewise.
13274 (Target_x86_64::do_finalize_sections): Add dynamic table entries
13275 for TLS descriptors.
13276 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13277 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13278 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13279 GD-to-IE relaxation.
13280 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13281 and TLS_DESCRIPTORS.
13282 * Makefile.in: Rebuild.
13283 * configure: Rebuild.
13284 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13285 (tls_test_shared2.so): New target.
13286 (tls_shared_gd_to_ie_test_SOURCES): New variable.
13287 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13288 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13289 (tls_shared_gd_to_ie_test_LDADD): New variable.
13290 (tls_shared_gnu2_gd_to_ie_test): New target.
13291 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13293 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13294 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13295 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13296 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13297 (tls_shared_gnu2_test): New target.
13298 (tls_test_gnu2_shared.so): New target.
13299 (tls_shared_gnu2_test_SOURCES): New variable.
13300 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13301 (tls_shared_gnu2_test_LDFLAGS): New variable.
13302 (tls_shared_gnu2_test_LDADD): New variable.
13303 * testsuite/Makefile.in: Rebuild.
13304 * testsuite/Makefile.
13306 2008-04-11 Ian Lance Taylor <iant@google.com>
13308 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13310 * testsuite/Makefile.in: Rebuild.
13312 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13314 * testsuite/script_test_2.cc (main): Adjust test.
13316 2008-04-11 David S. Miller <davem@davemloft.net>
13317 Ian Lance Taylor <iant@google.com>
13319 * options.h (General_options): Add entries for '-Y' and
13321 * options.cc (General_options:finalize): If -Y was used, add those
13322 entries to the library path instead of the default "/lib" and
13325 2008-04-11 David S. Miller <davem@davemloft.net>
13327 * testsuite/justsyms.t: Start at 0x100.
13328 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13329 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13331 * testsuite/script_test_2.cc: Adjust string and section length
13334 2008-04-09 Ian Lance Taylor <iant@google.com>
13337 * script-sections.cc (Sections_element::allocate_to_segment): Add
13339 (Output_section_definition::allocate_to_segment): Likewise.
13340 (Orphan_output_section::allocate_to_segment): Likewise.
13341 (Script_sections::attach_sections_using_phdrs_clause): Don't
13342 propagate non-PT_LOAD segments to orphan sections.
13343 * testsuite/Makefile.am (script_test_3.stdout): Generate using
13344 readelf rather than objdump.
13345 * testsuite/script_test_3.sh: Adjust accordingly. Test that
13346 .interp section and PT_INTERP segment are the same size.
13347 * testsuite/Makefile.in: Rebuild.
13349 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13350 aliases for symbols defined in the same object.
13351 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13352 (weak_alias_test_SOURCES): New variable.
13353 (weak_alias_test_DEPENDENCIES): New variable.
13354 (weak_alias_test_LDFLAGS): New variable.
13355 (weak_alias_test_LDADD): New variable.
13356 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13357 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13358 (weak_alias_test_3.o): New target.
13359 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13360 * testsuite/weak_alias_test_main.cc: New file.
13361 * testsuite/weak_alias_test_1.cc: New file.
13362 * testsuite/weak_alias_test_2.cc: New file.
13363 * testsuite/weak_alias_test_3.cc: New file.
13365 2008-04-08 Ian Lance Taylor <iant@google.com>
13367 * options.h (class General_options): Add --noinhibit-exec option.
13368 * main.cc (main): Check --noinhibit-exec.
13370 * options.h (class General_options): Define --wrap as a special
13371 option. Add wrap_symbols_ field.
13372 (General_options::any_wrap_symbols): New function.
13373 (General_options::is_wrap_symbol): New function.
13374 * options.cc (General_options::parse_wrap): New function.
13375 (General_options::General_options): Initialize wrap_symbols_.
13376 * symtab.cc (Symbol_table::wrap_symbol): New function.
13377 (Symbol_table::add_from_object): Handle --wrap.
13378 * symtab.h (class Symbol_table): Declare wrap_symbol.
13379 * target.h (Target::wrap_char): New function.
13380 (Target::Target_info): Add wrap_char field.
13381 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13382 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13383 * testsuite/testfile.cc (Target_test::test_target_info):
13386 * errors.cc (Errors::undefined_symbol): Mention symbol version if
13389 * layout.h (class Layout): Add added_eh_frame_data_ field.
13390 * layout.cc (Layout::Layout): Initialize new field.
13391 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13392 output section until we find a section we merged successfully.
13393 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13394 that the size be non-zero.
13396 * merge.cc (Object_merge_map::get_output_offset): Remove inline
13399 2008-04-08 Craig Silverstein <csilvers@google.com>
13401 * configure.ac: Export new conditional variable HAVE_ZLIB.
13402 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13404 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13405 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13407 2008-04-07 Ian Lance Taylor <iant@google.com>
13409 * version.cc (version_string): Set to "1.5".
13411 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13412 Add issued_non_pic_error_ field. Declare check_non_pic.
13413 (Target_x86_64::Scan::check_non_pic): New function.
13414 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13415 (Target_x86_64::Scan::global): Likewise.
13417 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13418 addend parameter. Change caller. Handle merge sections.
13419 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13420 Address to Addend. Don't add in the result of
13421 local_section_offset, pass down the addend and use the returned
13423 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13424 Update declarations of local_section_offset and symbol_value.
13425 * testsuite/two_file_test_1.cc (t18): New function.
13426 * testsuite/two_file_test_2.cc (f18): New function.
13427 * testsuite/two_file_test_main.cc (main): Call t18.
13428 * testsuite/two_file_test.h (t18, f18): Declare.
13430 * configure.ac: Don't test for objdump, c++filt, or readelf.
13431 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13433 (TEST_READELF): New variable.
13434 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13435 (check_PROGRAMS): Add two_file_strip_test.
13436 (two_file_strip_test): New target.
13437 (check_PROGRAMS): Add two_file_same_shared_strip_test.
13438 (two_file_same_shared_strip_test_SOURCES): New variable.
13439 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13440 (two_file_same_shared_strip_test_LDFLAGS): New variable.
13441 (two_file_same_shared_strip_test_LDADD): New variable.
13442 (two_file_shared_strip.so): New target.
13443 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13444 (ver_test_5.syms, ver_test_7.syms): Likewise.
13445 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13446 (strip_test_3.stdout): Use TEST_OBJDUMP.
13447 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13449 2008-04-04 Cary Coutant <ccoutant@google.com>
13451 * symtab.h (Symbol::is_weak_undefined): New function.
13452 (Symbol::is_strong_undefined): New function.
13453 (Symbol::is_absolute): New function.
13454 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13455 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13457 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13458 (weak_undef_test): New target.
13459 * testsuite/Makefile.in: Rebuild.
13460 * testsuite/weak_undef_file1.cc: New file.
13461 * testsuite/weak_undef_file2.cc: New file.
13462 * testsuite/weak_undef_test.cc: New file.
13464 2008-04-03 Craig Silverstein <csilvers@google.com>
13466 * compressed_output.h (class Output_compressed_section): Use
13468 * compressed_output.cc (zlib_compress): Use unsigned buffers,
13470 (zlib_compressed_suffix): Removed.
13471 (Output_compressed_section::set_final_data_size): Use unsigned
13473 * testsuite/Makefile.am (flagstest_compress_debug_sections):
13474 Fix linker invocation.
13475 (flagstest_o_specialfile_and_compress_debug_sections):
13477 * testsuite/Makefile.in: Regenerated.
13479 2008-04-02 David S. Miller <davem@davemloft.net>
13481 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13482 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13484 2008-04-02 Craig Silverstein <csilvers@google.com>
13488 2008-04-02 Ian Lance Taylor <iant@google.com>
13490 * fileread.cc (File_read::find_view): Add byteshift and vshifted
13491 parameters. Update for new key type to views_. Change all
13493 (File_read::read): Adjust for byteshift in returned view.
13494 (File_read::add_view): New function, broken out of
13495 find_and_make_view.
13496 (File_read::make_view): New function, broken out of
13497 find_and_make_view.
13498 (File_read::find_or_make_view): Add offset and aligned
13499 parameters. Rewrite accordingly. Change all callers.
13500 (File_read::get_view): Add offset and aligned parameters. Adjust
13501 for byteshift in return value.
13502 (File_read::get_lasting_view): Likewise.
13503 * fileread.h (class File_read): Update declarations.
13504 (class File_read::View): Add byteshift_ field. Add byteshift to
13505 constructor. Add byteshift method.
13506 * archive.h (Archive::clear_uncached_views): New function.
13507 (Archive::get_view): Add aligned parameter. Change all callers.
13508 * object.h (Object::get_view): Add aligned parameter. Change all
13510 (Object::get_lasting_view): Likewise.
13512 * fileread.cc (File_read::release): Don't call clear_views if
13513 there are multiple objects.
13514 * fileread.h (File_read::clear_uncached_views): New function.
13515 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13518 2008-03-31 Cary Coutant <ccoutant@google.com>
13520 Add thin archive support.
13521 * archive.cc (Archive::armagt): New const.
13522 (Archive::setup): Remove task parameter and calls to unlock.
13523 (Archive::unlock_nested_archives): New function.
13524 (Archive::read_header): Add nested_off parameter. Change
13526 (Archive::interpret_header): Likewise.
13527 (Archive::include_all_members): Change to handle thin
13529 (Archive::include_member): Likewise.
13530 * archive.h (Archive::Archive): Add new parameters and
13532 (Archive::armagt): New const.
13533 (Archive::setup): Remove task parameter.
13534 (Archive::unlock_nested_archives): New function.
13535 (Archive::read_header): Add nested_off parameter.
13536 (Archive::interpret_header): Likewise.
13537 (Archive::Nested_archive_table): New typedef.
13538 (Archive::is_thin_archive_): New field.
13539 (Archive::nested_archives_): New field.
13540 (Archive::options_): New field.
13541 (Archive::dirpath_): New field.
13542 (Archive::task_): New field.
13543 * readsyms.cc (Read_symbols::do_read_symbols): Add check
13544 for thin archives. Pass additional parameters to
13545 Archive::Archive. Unlock the archive file after calling
13548 2008-03-29 Ian Lance Taylor <iant@google.com>
13550 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13551 version symbol to be local.
13552 * testsuite/ver_test_4.sh: New file.
13553 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13554 (check_DATA): Add ver_test_4.syms.
13555 (ver_test_4.syms): New target.
13556 * testsuite/Makefile.in: Rebuild.
13559 (Output_section::Input_section_sort_entry::has_priority): New
13561 (Output_section::Input_section_sort_entry::match_file_name): New
13563 (Output_section::Input_section_sort_entry::match_section_name):
13565 (Output_section::Input_section_sort_entry::match_section_name_prefix):
13567 (Output_section::Input_section_sort_entry::match_section_file):
13569 (Output_section::Input_section_sort_compare::operator()): Rewrite
13570 using new Input_section_sort_entry functions. Sort crtbegin and
13571 crtend first. Sort sections with no priority before sections with
13573 * testsuite/initpri1.c (d3): Check j != 4.
13574 (cd5): New constructor/destructor function.
13575 (main): Check j != 2.
13577 * symtab.cc (Symbol_table::add_from_object): If we don't use the
13578 new symbol when resolving, don't call set_is_default.
13579 * testsuite/ver_test_7.cc: New file.
13580 * testsuite/ver_test_7.sh: New file.
13581 * testsuite/Makefile.am (ver_test_7.so): New target.
13582 (ver_test_7.o): New target.
13583 (check_SCRIPTS): Add ver_test_7.sh.
13584 (check_DATA): Add ver_test_7.syms.
13585 (ver_test_7.syms): New target.
13587 2008-03-28 Ian Lance Taylor <iant@google.com>
13589 * layout.cc (Layout::layout): If we see an input section with a
13590 name that needs sorting, set the must_sort flag for the output
13592 (Layout::make_output_section): If the name of the output section
13593 indicates that it might require sorting, set the may_sort flag.
13594 * output.h (Output_section::may_sort_attached_input_sections): New
13596 (Output_section::set_may_sort_attached_input_sections): New
13598 (Output_section::must_sort_attached_input_sections): New
13600 (Output_section::set_must_sort_attached_input_sections): New
13602 (class Output_section): Declare Input_section_sort_entry. Define
13603 Input_section_sort_compare. Declare
13604 sort_attached_input_sections. Add new fields:
13605 may_sort_attached_input_sections_,
13606 must_sort_attached_input_sections_,
13607 attached_input_sections_are_sorted_.
13608 * output.cc (Output_section::Output_section): Initialize new
13610 (Output_section::add_input_section): Add an entry to
13611 input_sections_ if may_sort or must_sort are true.
13612 (Output_section::set_final_data_size): Call
13613 sort_attached_input_sections if necessary.
13614 (Output_section::Input_section_sort_entry): Define new class.
13615 (Output_section::Input_section_sort_compare::operator()): New
13617 (Output_section::sort_attached_input_sections): New function.
13618 * configure.ac: Check whether the compiler supports constructor
13619 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
13620 * testsuite/initpri1.c: New file.
13621 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13622 CONSTRUCTOR_PRIORITY.
13623 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13624 (initpri1_LDFLAGS): New variable.
13625 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13627 2008-03-27 Ian Lance Taylor <iant@google.com>
13629 * common.cc (Sort_commons::operator): Correct sorting algorithm.
13630 * testsuite/common_test_1.c: New file.
13631 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13632 (common_test_1_SOURCES): New variable.
13633 (common_test_1_DEPENDENCIES): New variable.
13634 (common_test_1_LDFLAGS): New variable.
13636 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13637 and commons_ correctly when NAME/VERSION does not override
13639 * testsuite/ver_test_6.c: New file.
13640 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13641 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13642 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13644 2008-03-26 Ian Lance Taylor <iant@google.com>
13646 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13647 of an undefined symbol from a version script.
13648 * testsuite/Makefile.am (ver_test_5.so): New target.
13649 (ver_test_5.o): New target.
13650 (check_SCRIPTS): Add ver_test_5.sh.
13651 (check_DATA): Add ver_test_5.syms.
13652 (ver_test_5.syms): New target.
13653 * testsuite/ver_test_5.cc: New file.
13654 * testsuite/ver_test_5.script: New file.
13655 * testsuite/ver_test_5.sh: New file.
13656 * Makefile.in, testsuite/Makefile.in: Rebuild.
13659 Fix problems building gold with gcc 4.3.0.
13660 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13661 (gold_error_at_location, gold_warning_at_location): Use it.
13662 * configure.ac: Check whether we can compile and use a template
13663 function with a printf attribute.
13664 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13665 when jumping over bytes.
13666 * object.cc: Instantiate Object::read_section_data.
13667 * debug.h: Include <cstring>
13668 * dwarf_reader.cc: Include <algorithm>
13669 * main.cc: Include <cstring>.
13670 * options.cc: Include <cstring>.
13671 * output.cc: Include <cstring>.
13672 * script.cc: Include <cstring>.
13673 * script.h: Include <string>.
13674 * symtab.cc: Include <cstring> and <algorithm>.
13675 * target-select.cc: Include <cstring>.
13676 * version.cc: Include <string>.
13677 * testsuite/testmain.cc: Include <cstdlib>.
13678 * configure, config.in: Rebuild.
13680 2008-03-25 Ian Lance Taylor <iant@google.com>
13682 * options.cc: Include "../bfd/bfdver.h".
13683 (options::help): Print bug reporting address.
13685 * version.cc (print_version): Adjust output for current value of
13686 BFD_VERSION_STRING.
13690 * options.cc (options::help): Print list of supported targets.
13691 * target-select.h: Include <vector>.
13692 (class Target_selector): Make machine_, size_, and is_big_endian_
13693 fields const. Add bfd_name_ and instantiated_target_ fields.
13694 (Target_selector::Target_selector): Add bfd_name parameter.
13695 (Target_selector::recognize): Make non-virtual, call
13697 (Target_selector::recognize_by_name): Make non-virtual, call
13698 do_recognize_by_name.
13699 (Target_selector::supported_names): New function.
13700 (Target_selector::bfd_name): New function.
13701 (Target_selector::do_instantiate_target): New pure virtual
13703 (Target_selector::do_recognize): New virtual function.
13704 (Target_selector::do_recognize_by_name): New virtual function.
13705 (Target_selector::instantiate_target): New private function.
13706 (supported_target_names): Declare.
13707 * target-select.cc (Target_selector::Target_selector): Update for
13708 new parameter and fields.
13709 (select_target_by_name): Check that the name matches before
13710 calling recognize_by_name.
13711 (supported_target_names): New function.
13712 * i386.cc (class Target_selector_i386): Update Target_selector
13713 constructor call. Remove recognize and recognize_by_name. Add
13714 do_instantiate_target.
13715 * x86_64.cc (class Target_selector_x86_64): Likewise.
13716 * testsuite/testfile.cc (class Target_selector_test): Update for
13717 changes to Target_selector.
13719 * README: Rewrite, with some notes on unsupported features.
13721 2008-03-24 Cary Coutant <ccoutant@google.com>
13723 * i386.cc (Target_i386::Got_type): New enum declaration.
13724 (Target_i386::Scan::local): Updated callers of Output_data_got
13726 (Target_i386::Scan::global): Likewise.
13727 (Target_i386::Relocate::relocate): Likewise.
13728 (Target_i386::Relocate::relocate_tls): Likewise.
13729 * object.h (Got_offset_list): New class.
13730 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13731 (Sized_relobj::local_got_offset): Likewise.
13732 (Sized_relobj::set_local_got_offset): Likewise.
13733 (Sized_relobj::local_has_tls_got_offset): Removed.
13734 (Sized_relobj::local_tls_got_offset): Removed.
13735 (Sized_relobj::set_local_tls_got_offset): Removed.
13736 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13737 * output.cc (Output_data_got::add_global): Added got_type parameter.
13738 (Output_data_got::add_global_with_rel): Likewise.
13739 (Output_data_got::add_global_with_rela): Likewise.
13740 (Output_data_got::add_global_pair_with_rel): New function.
13741 (Output_data_got::add_global_pair_with_rela): New function.
13742 (Output_data_got::add_local): Added got_type parameter.
13743 (Output_data_got::add_local_with_rel): Likewise.
13744 (Output_data_got::add_local_with_rela): Likewise.
13745 (Output_data_got::add_local_pair_with_rel): New function.
13746 (Output_data_got::add_local_pair_with_rela): New function.
13747 (Output_data_got::add_global_tls): Removed.
13748 (Output_data_got::add_global_tls_with_rel): Removed.
13749 (Output_data_got::add_global_tls_with_rela): Removed.
13750 (Output_data_got::add_local_tls): Removed.
13751 (Output_data_got::add_local_tls_with_rel): Removed.
13752 (Output_data_got::add_local_tls_with_rela): Removed.
13753 * output.h (Output_data_got::add_global): Added got_type parameter.
13754 (Output_data_got::add_global_with_rel): Likewise.
13755 (Output_data_got::add_global_with_rela): Likewise.
13756 (Output_data_got::add_global_pair_with_rel): New function.
13757 (Output_data_got::add_global_pair_with_rela): New function.
13758 (Output_data_got::add_local): Added got_type parameter.
13759 (Output_data_got::add_local_with_rel): Likewise.
13760 (Output_data_got::add_local_with_rela): Likewise.
13761 (Output_data_got::add_local_pair_with_rel): New function.
13762 (Output_data_got::add_local_pair_with_rela): New function.
13763 (Output_data_got::add_global_tls): Removed.
13764 (Output_data_got::add_global_tls_with_rel): Removed.
13765 (Output_data_got::add_global_tls_with_rela): Removed.
13766 (Output_data_got::add_local_tls): Removed.
13767 (Output_data_got::add_local_tls_with_rel): Removed.
13768 (Output_data_got::add_local_tls_with_rela): Removed.
13769 * resolve.cc (Symbol::override_base_with_special): Removed
13770 reference to has_got_offset_ field.
13771 * symtab.cc (Symbol::init_fields): Replaced initialization
13772 of got_offset_ with got_offsets_. Removed initialization
13774 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13775 (Symbol::got_offset): Likewise.
13776 (Symbol::set_got_offset): Likewise.
13777 (Symbol::has_tls_got_offset): Removed.
13778 (Symbol::tls_got_offset): Removed.
13779 (Symbol::set_tls_got_offset): Removed.
13780 (Symbol::got_offset_): Removed.
13781 (Symbol::tls_mod_got_offset_): Removed.
13782 (Symbol::tls_pair_got_offset_): Removed.
13783 (Symbol::got_offsets_): New field.
13784 (Symbol::has_got_offset): Removed.
13785 (Symbol::has_tls_mod_got_offset): Removed.
13786 (Symbol::has_tls_pair_got_offset): Removed.
13787 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13788 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13790 (Target_x86_64::Scan::global): Likewise.
13791 (Target_x86_64::Relocate::relocate): Likewise.
13792 (Target_x86_64::Relocate::relocate_tls): Likewise.
13794 2008-03-25 Ben Elliston <bje@au.ibm.com>
13796 * yyscript.y: Fix spelling error in comment.
13798 2008-03-24 Ian Lance Taylor <iant@google.com>
13800 * options.h (class General_options): Define build_id option.
13801 * layout.h (class Layout): Declare write_build_id, create_note,
13802 create_build_id. Add build_id_note_ member.
13803 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13804 "libiberty.h", "md5.h", "sha1.h".
13805 (Layout::Layout): Initialize eh_frame_data_,
13806 eh_frame_hdr_section_, and build_id_note_.
13807 (Layout::finalize): Call create_build_id.
13808 (Layout::create_note): New function, broken out of
13809 Layout::create_gold_note.
13810 (Layout::create_gold_note): Call create_note.
13811 (Layout::create_build_id): New function.
13812 (Layout::write_build_id): New function.
13813 (Close_task_runner::run): Call write_build_id.
13815 * x86_64.cc: Correct license to GPLv3.
13817 2008-03-23 Ian Lance Taylor <iant@google.com>
13819 * options.cc: Include "demangle.h".
13820 (parse_optional_string): New function.
13821 (parse_long_option): Handle takes_optional_argument.
13822 (parse_short_option): Update dash_z initializer. Handle
13823 takes_optional_argument.
13824 (General_options::General_options): Initialize do_demangle_.
13825 (General_options::finalize): Set do_demangle_. Handle demangling
13827 * options.h (parse_optional_string): Declare.
13828 (struct One_option): Add optional_arg field. Update constructor.
13829 Update call constructor calls. Add takes_optional_argument
13831 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13832 (DEFINE_optional_string): Define.
13833 (General_options::demangle): Change from DEFINE_bool to
13834 DEFINE_optional_string.
13835 (General_options::no_demangle): New function.
13836 (General_options::do_demangle): New function.
13837 (General_options::set_do_demangle): New function.
13838 (General_options::execstack_status_): Move definition to end of
13840 (General_options::static_): Likewise.
13841 (General_options::do_demangle_): New field.
13842 * object.cc (big_endian>::get_symbol_location_info): Call
13843 Options::do_demangle, not Options::demangle.
13844 * symtab.cc (demangle): Likewise.
13846 2008-03-22 Ian Lance Taylor <iant@google.com>
13848 * gold.h: Include <cstddef> and <sys/types.h>
13849 * options.h: Include <cstring>.
13851 2008-03-21 Ian Lance Taylor <iant@google.com>
13853 * Added source code to GNU binutils.