1 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
3 * gold.cc (Target_arm::do_adjust_elf_header): Add the
4 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
7 2012-10-29 Cary Coutant <ccoutant@google.com>
9 * dwp.cc (usage): Add file and exit status parameters;
10 add --help and --version options.
11 (print_version): New function.
12 (main): Add --help and --version options.
14 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
16 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
17 final_layout_sequence.txt.
18 * testsuite/Makefile.in: Regenerated.
20 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
22 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
23 COMPILE generated by automake.
25 (CXXCOMPILE1): Likewise.
27 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
29 (CXXCOMPILE): Likewise.
31 * testsuite/Makefile.in: Regenerated.
33 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
35 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
38 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
40 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
43 2012-10-23 Cary Coutant <ccoutant@google.com>
45 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
46 * testsuite/Makefile.in: Regenerate.
47 * testsuite/dwp_test.h: New source file.
48 * testsuite/dwp_test_1.cc: New source file.
49 * testsuite/dwp_test_1.s: New source file.
50 * testsuite/dwp_test_1.sh: New source file.
51 * testsuite/dwp_test_1b.cc: New source file.
52 * testsuite/dwp_test_1b.s: New source file.
53 * testsuite/dwp_test_2.cc: New source file.
54 * testsuite/dwp_test_2.s: New source file.
55 * testsuite/dwp_test_2.sh: New source file.
56 * testsuite/dwp_test_main.cc: New source file.
57 * testsuite/dwp_test_main.s: New source file.
59 2012-10-23 Cary Coutant <ccoutant@google.com>
61 * dwp.h: New header file.
62 * dwp.cc: New source file.
63 * gold.h: Move shared declarations to system.h.
64 * system.h: New header file.
65 * Makefile.am: Add dwp.
66 * Makefile.in: Regenerate.
68 2012-10-23 Cary Coutant <ccoutant@google.com>
70 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
71 Dwarf_info_reader::read_from_pointer.
72 (Dwarf_pubnames_table::read_header): Likewise.
73 (Dwarf_pubnames_table::next_name): Likewise.
74 (Dwarf_die::read_attributes): Likewise.
75 (Dwarf_die::skip_attributes): Likewise.
76 (Dwarf_info_reader::read_from_pointer): New function template.
77 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
78 (Dwarf_pubnames_table): Likewise.
79 (Dwarf_info_reader::read_from_pointer): New function template.
80 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
81 Dwarf_pubnames_table ctor.
83 2012-10-23 Cary Coutant <ccoutant@google.com>
85 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
87 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
89 (Dwarf_info_reader::set_abbrev_shndx): New method.
90 (Dwarf_info_reader::abbrev_shndx_): New data member.
92 2012-10-23 Cary Coutant <ccoutant@google.com>
94 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
95 from object, not parameters.
96 (Dwarf_info_reader::parse): Likewise.
97 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
98 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
99 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
102 2012-10-23 Cary Coutant <ccoutant@google.com>
104 * fileread.cc (Input_file::Input_file): New constructor.
105 * fileread.h (class Input_file): Add new constructor.
107 2012-10-18 Alan Modra <amodra@gmail.com>
110 * object.cc (Relobj::is_section_name_included): Also match
111 .sdata personality section.
113 2012-10-18 Alan Modra <amodra@gmail.com>
115 * target-reloc.h (class Default_comdat_behavior): New, package up..
116 (get_comdat_behaviour): ..this.
117 (relocate_section): Add Relocate_comdat_behavior template arg,
119 * arm.cc (Target_arm::relocate_section): Adjust to suit.
120 (Target_arm::scan_reloc_section): Likewise.
121 * i386.cc (Target_i386::relocate_section): Likewise.
122 * sparc.cc (Target_sparc::relocate_section): Likewise.
123 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
124 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
125 * powerpc.cc (class Relocate_comdat_behavior): New.
126 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
127 gold::relocate_section with new template arg.
129 2012-10-18 Alan Modra <amodra@gmail.com>
131 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
132 dynamic relocs for GOT_TPREL got entries, without symbol if
134 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
135 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
136 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
138 2012-10-17 Alan Modra <amodra@gmail.com>
141 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
143 2012-10-16 Sriraman Tallam <tmsriram@google.com>
145 * layout.cc (Layout::include_section): Keep sections marked
146 SHF_EXCLUDE when doing relocatable links.
148 2012-10-16 Alan Modra <amodra@gmail.com>
150 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
151 (Target_powerpc::do_finalize_sections): Call it.
152 (Output_data_save_res): New class and supporting functions.
153 (Target_powerpc::symval_for_branch): Only look up .opd entry for
154 normal symbols defined in object files.
156 2012-10-12 Alan Modra <amodra@gmail.com>
158 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
159 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
160 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
161 section if scan_opd_relocs not yet called.
162 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
164 2012-10-12 Alan Modra <amodra@gmail.com>
166 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
167 add_local_ifunc_entry): Revert last change.
168 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
170 2012-10-05 Alan Modra <amodra@gmail.com>
172 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
173 do_plt_address_for_global): New functions.
174 (Output_data_got_powerpc::do_write): Don't segfault when linking
176 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
177 add_local_ifunc_entry): Return true on adding entry..
178 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
179 glink->add_entry call. Remove unused symtab param. Adjust calls.
180 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
181 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
183 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
184 syms here. Do so even when no .iplt. Don't segfault when linking
186 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
187 new variants without reloc param.
188 (Glink_sym_ent::Glink_sym_ent): Likewise.
189 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
190 reloc when refs will resolve to plt call stub.
191 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
192 R_PPC_PLTREL24 to resolve locally.
193 (Target_powerpc::Scan::global): Correct ifunc handling.
194 (Target_powerpc::Relocate::relocate): Correct local sym glink
195 lookup. Don't destroy "value" when we have a plt call stub,
196 and when checking plt call validity.
197 (Target_powerpc::do_dynsym_value): Simplify.
199 2012-10-05 Alan Modra <amodra@gmail.com>
201 * i386.cc (Output_data_plt_i386::address_for_global,
202 address_for_local): Add plt offset to returned value. Adjust uses.
203 * sparc.cc (Output_data_plt_sparc::address_for_global,
204 address_for_local): Likewise.
205 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
206 address_for_local): Likewise.
207 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
208 address_for_local): Likewise.
209 * target.h (Target::plt_address_for_global, plt_address_for_local):
211 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
212 (Output_data_got::Got_entry::write): Nor here.
213 * output.h: Comment fix.
215 2012-10-02 Jiong Wang <jiwang@tilera.com>
217 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
218 global_offset_table_ value for larget got.
219 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
221 2012-09-29 Alan Modra <amodra@gmail.com>
223 * powerpc.cc (Target_powerpc::iplt_): New output section.
224 (Target_powerpc::iplt_section, make_iplt_section,
225 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
226 (Target_powerpc::make_plt_entry): Handle ifunc syms.
227 Target_powerpc::plt_entry_count): Count iplt entries too.
228 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
229 reloc section in constructor. New params.
230 (Target_powerpc::make_plt_section): Create reloc section here instead.
231 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
233 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
234 (Output_data_glink::add_entry, find_entry): New functions to
235 deal with local syms.
236 (Glink_sym_ent): Add support for local syms.
237 (Output_data_glink::do_write): Handle ifunc plt entries.
238 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
239 (Target_powerpc::Scan::local, global): Handle ifunc syms.
240 (Target_powerpc::Relocate::relocate): Likewise.
241 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
243 2012-09-25 Alan Modra <amodra@gmail.com>
245 * object.h (Sized_relobj_file::adjust_local_symbol,
246 do_adjust_local_symbol): New functions.
247 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
248 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
249 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
250 and irregular opd entry spacing.
251 (Powerpc_relobj::do_read_relocs): Add opd size checks.
252 (Global_symbol_visitor_opd): New functor.
253 (Target_powerpc::do_finalize_sections): Omit global symbols defined
254 on deleted opd entries.
256 2012-09-15 Jiong Wang <jiwang@tilera.com>
258 * tilegx.cc: New file.
259 * Makefile.am (TARGETSOURCES): Add tilegx.cc
260 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
261 * configure.tgt: Add entries for tilegx*.
262 * configure.ac: Likewise.
263 * Makefile.in: Rebuild.
264 * configure: Likewise.
265 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
268 2012-09-13 Alan Modra <amodra@gmail.com>
270 * target-reloc.h (scan_relocs): Call scan.local for relocs
271 against symbols in discarded sections. Pass is_discarded
273 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
274 Add is_discarded param.
275 * powerpc (Target_powerpc::Scan::local): Likewise. Use
276 is_discarded to flag opd entry as discarded. Don't emit dyn
277 relocs on such entries.
278 (Target_powerpc::Scan::global): Similarly detect and handle
280 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
281 opd_ent_. Update all uses.
282 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
283 (Target_powerpc::relocate_section): Zero out discarded opd
286 2012-09-12 Ian Lance Taylor <iant@google.com>
289 * output.cc: Rename Output_data_got template parameter from size
290 to got_size for all functions. Compile all variants of
292 (Output_data_got::Got_entry::write): Correct use of size for
293 symbol value. Use local_is_tls rather than casting to
295 * object.h (class Object): Add local_is_tls and do_local_is_tls.
296 (class Sized_relobj_file): Add do_local_is_tls.
297 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
299 2012-09-11 Alan Modra <amodra@gmail.com>
302 * layout.cc (Layout::set_segment_offsets): When using
303 common-page-size alignment, ensure we are on a new max-page-size
305 * output.cc (Output_segment::set_section_addresses): Use
306 abi_pagesize, not common_pagesize for relro boundary.
307 (Output_segment::set_offset): Likewise.
309 2012-09-11 Alan Modra <amodra@gmail.com>
311 * output.h (Output_data_got::add_global_tls, add_local_tls,
312 add_local_tls_pair): New functions.
313 (Output_data_got::add_local_pair_with_rel): Remove second
314 reloc param. Expand comment.
315 (Output_data_got::Got_entry): Rename use_plt_offset_ to
316 use_plt_or_tls_offset_, similarly for constructor param.
317 (Output_data_got::Got_entry::write): Add got_index param.
318 * output.cc (Output_data_got::add_global_tls, add_local_tls,
319 add_local_tls_pair): New functions.
320 (Output_data_got::Got_entry::write): Handle tls symbols
321 with use_plt_or_tls_offset_ set specially.
322 (Output_data_got::add_local_pair_with_rel): Only one reloc.
323 (Output_data_got::do_write): Replace iterator with index, pass
324 index to entry write function.
325 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
326 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
327 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
329 * i386.cc (Target_i386::Scan::local): Likewise.
330 * sparc.cc (Target_sparc::Scan::local): Likewise.
331 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
332 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
333 do_tls_offset_for_global): New functions.
334 (Target_powerpc::Scan::local): Correct TLS relocations and got
336 (Target_powerpc::Scan::global): Don't emit unnecessary
337 dynamic relocations on TLS GOT entries.
339 2012-09-10 Matthias Klose <doko@ubuntu.com>
341 * config.in: Disable sanity check for kfreebsd.
343 2012-09-10 Sterling Augustine <saugustine@google.com>
345 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
346 (Gdb_index::pubtypes_read): New parameter.
347 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
349 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
352 2012-09-09 Alan Modra <amodra@gmail.com>
354 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
355 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
356 * gc.h (gc_process_relocs): Call target gc_add_reference.
357 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
358 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
359 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
361 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
362 to cater for when we don't need code offset. Update use.
363 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
364 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
365 set_opd_valid): New functions.
366 (Target_powerpc::do_gc_add_reference): New function.
367 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
369 (Target_powerpc::do_gc_mark_symbol): New function.
371 2012-09-06 Cary Coutant <ccoutant@google.com>
373 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
374 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
375 (Dwarf_die::skip_attributes): Likewise.
376 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
377 * testsuite/gdb_index_test.cc (inline_func_1): New function.
379 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
381 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
383 * testsuite/script_test_3.t: Add .got.plt output section
385 * testsuite/script_test_4.t: Likewise.
387 2012-09-05 Alan Modra <amodra@gmail.com>
389 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
390 update all uses and lose "enum" when using type.
392 2012-09-05 Alan Modra <amodra@gmail.com>
394 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
395 * configure: Regenerate.
396 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
397 (plugin_final_layout.stdout): Likewise.
398 (memory_test): Set page sizes to 0x1000.
399 * testsuite/Makefile.in: Regenerate.
400 * testsuite/discard_locals_test.sh: Add FIXME comment.
401 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
402 * testsuite/pr14265.t: Add .got output section statement.
403 * testsuite/script_test_2.t: Likewise.
404 * testsuite/script_test_3.t: Likewise.
405 * testsuite/script_test_4.t: Likewise.
406 * testsuite/script_test_5.t: Likewise.
407 * testsuite/script_test_6.t: Likewise.
408 * testsuite/script_test_7.t: Likewise.
409 * testsuite/script_test_9.t: Likewise.
411 2012-09-05 Alan Modra <amodra@gmail.com>
413 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
414 (Powerpc_relocate_functions::Status): New typedef.
415 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
416 (Target_powerpc::Scan::local): Handle REL64.
417 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
419 (Target_powerpc::symval_for_branch): New function, extracted from..
420 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
421 checks. Report overflow errors.
423 2012-09-05 Alan Modra <amodra@gmail.com>
425 * object.h (Sized_relobj_file::emit_relocs): Delete.
426 (Sized_relobj_file::emit_relocs_reltype): Delete.
427 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
428 relocate_relocs for --emit-relocs.
429 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
430 * output.h: Update comment.
431 (Output_segment::first_section): New function.
432 (Output_segment::first_section_load_address): Use first_section.
433 * output.cc (Output_segment::first_section): New function extracted..
434 (Output_segment::first_section_load_address): ..from here. Delete.
435 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
436 * target.h (Sized_target::relocate_for_relocatable): Likewise.
437 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
438 adjust call to target.h function.
439 * i386.cc (Target_i386): Likewise.
440 * sparc.cc (Target_sparc): Likewise.
441 * x86_64.cc (Target_x86_64): Likewise.
442 * powerpc.cc (Target_powerpc): Likewise.
443 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
444 first tls section has section symbol for optimised local dynamic
446 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
447 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
449 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
450 Rename to relocate_relocs. Update error message.
452 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
454 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
457 2012-08-31 Alan Modra <amodra@gmail.com>
459 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
460 (Powerpc_relobj::toc_base_offset): New stub function.
461 (Target_powerpc): Add tp_offset, dtp_offset. Rename
462 got_mod_index_offset to tlsld_got_offset. Update all refs.
463 (Target_powerpc::Relocate::enum skip_tls): New.
464 (Target_powerpc::call_tls_get_addr_): New var.
465 (Target_powerpc::is_branch_reloc): Move to file scope.
466 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
467 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
469 (Target_powerpc::enum Got_type): Delete old values, add new ones.
470 (powerpc_info): Correct common_pagesize for ppc64.
471 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
472 (Powerpc_relocate_functions): Add overflow check enums and functions.
473 Add non-shift version of rela, rela_ua. Delete all rel public
474 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
475 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
476 addr16_ha3, addr14 functions.
477 (Output_data_got_powerpc::add_constant_pair): New function.
478 (Output_data_got_powerpc::got_base_offset): Likewise.
479 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
480 (instruction constants): Sort, add some more.
481 (Output_data_glink::do_write): Add and use Address typedef. Use
482 object->toc_base_offset() stub for 64-bit.
483 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
484 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
485 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
486 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
487 Always treat .opd relocs as against locally defined symbol.
488 Correct condition for RELATIVE relocs.
489 (Target_powerpc::do_finalize_sections): Test for NULL sections.
490 (Target_powerpc::Relocate::relocate): Use plt call stub as value
491 for 32-bit syms with a plt entry. Correct ppc64 toc base
492 calculations. Handle TLS relocs, and more. Add overflow
493 checking and adjust for Powerpc_relocate_functions changes.
494 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
495 Reinstate --emit-relocs code with FIXME.
497 2012-08-30 Alan Modra <amodra@gmail.com>
499 * layout.cc (Layout::set_segment_offsets): Set p_align to
500 abi_pagesize, not common_pagesize.
501 (Layout::relaxation_loop_body): Similarly use abi_pagesize
502 to determine whether file header can go in segment.
504 2012-08-30 Alan Modra <amodra@gmail.com>
506 * output.h (Output_reloc::Output_reloc <output section>): Add
507 is_relative param. Adjust calls.
508 (Output_reloc::add_output_section_relative): New functions.
509 * output.cc (Output_reloc::Output_reloc <output section>): Handle
511 (Output_reloc::symbol_value): Handle SECTION_CODE.
513 2012-08-24 Sriraman Tallam <tmsriram@google.com>
515 * gold.cc (queue_middle_tasks): Call layout again when unique
516 segments for sections is desired.
517 * layout.cc (Layout::Layout): Initialize new members.
518 (Layout::get_output_section_flags): New function.
519 (Layout::choose_output_section): Call get_output_section_flags.
520 (Layout::layout): Make output section for mapping to a unique segment.
521 (Layout::insert_section_segment_map): New function.
522 (Layout::attach_allocated_section_to_segment): Make unique segment for
523 output sections marked so.
524 (Layout::segment_precedes): Check for unique segments when sorting.
525 * layout.h (Layout::Unique_segment_info): New struct.
526 (Layout::Section_segment_map): New typedef.
527 (Layout::insert_section_segment_map): New function.
528 (Layout::get_output_section_flags): New function.
529 (Layout::is_unique_segment_for_sections_specified): New function.
530 (Layout::set_unique_segment_for_sections_specified): New function.
531 (Layout::unique_segment_for_sections_specified_): New member.
532 (Layout::section_segment_map_): New member.
533 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
534 Rename is_gc_pass_one to is_pass_one.
535 Rename is_gc_pass_two to is_pass_two.
536 Rename is_gc_or_icf to is_two_pass.
537 Check for which pass based on whether symbols data is present.
538 Make it two pass when unique segments for sections is desired.
539 * output.cc (Output_section::Output_section): Initialize new
541 * output.h (Output_section::is_unique_segment): New function.
542 (Output_section::set_is_unique_segment): New function.
543 (Output_section::is_unique_segment_): New member.
544 (Output_section::extra_segment_flags): New function.
545 (Output_section::set_extra_segment_flags): New function.
546 (Output_section::extra_segment_flags_): New member.
547 (Output_section::segment_alignment): New function.
548 (Output_section::set_segment_alignment): New function.
549 (Output_section::segment_alignment_): New member.
550 (Output_segment::Output_segment): Initialize is_unique_segment_.
551 (Output_segment::is_unique_segment): New function.
552 (Output_segment::set_is_unique_segment): New function.
553 (Output_segment::is_unique_segment_): New member.
554 * plugin.cc (allow_unique_segment_for_sections): New function.
555 (unique_segment_for_sections): New function.
556 (Plugin::load): Add new functions to transfer vector.
557 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
558 * Makefile.in: Regenerate.
559 * testsuite/plugin_final_layout.sh: Check if unique segment
561 * testsuite/plugin_section_order.c (onload): Check if new interfaces
563 (allow_unique_segment_for_sections): New global.
564 (unique_segment_for_sections): New global.
565 (claim_file_hook): Call allow_unique_segment_for_sections.
566 (all_symbols_read_hook): Call unique_segment_for_sections.
568 2012-08-22 Cary Coutant <ccoutant@google.com>
570 * layout.cc (Layout::include_section): Don't assert on GROUP
571 sections with --emit-relocs.
573 2012-08-21 Cary Coutant <ccoutant@google.com>
575 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
576 if --export-dynamic-symbol names an undef symbol.
578 2012-08-18 Alan Modra <amodra@gmail.com>
580 * powerpc.cc: Formatting and white space.
581 (Powerpc_relobj): Rename got2_section_ to special_.
582 Add opd_ent_shndx_ and opd_ent_off_ vectors.
583 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
584 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
585 (Target_powerpc): Add Address typedef and invalid_address. Use
587 (Target_powerpc::is_branch_reloc): New function.
588 (Powerpc_relocate_functions): Add Address typedef, use throughout.
589 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
590 for dst_mask, value and addend.
591 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
592 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
593 (Output_data_glink::do_write): Correct toc base. Don't try to use
594 uint16_t for 24-bit offset. Use get_output_section_offset and
596 (Target_powerpc::Scan::local): Handle more relocs.
597 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
598 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
599 Plug in toc restoring insn after plt calls. Translate branches
600 to function descriptor symbols to corresponding entry point.
601 (Target_powerpc::relocate_for_relocatable): Check return from
602 get_output_section_offset.
603 * symtab.h: Comment typo.
605 2012-08-14 Ian Lance Taylor <iant@google.com>
607 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
608 unsupported_relocal_local to call unsupported_reloc_global.
610 2012-08-14 Nick Clifton <nickc@redhat.com>
613 * script-sections.cc (Sections_element::output_section_name): Add
614 keep return parameter.
615 (Output_section_element::match_name): Add keep return parameter.
616 Return the value of the keep_ member.
617 * script-sections.h (class Output_section): Update
618 output_section_name prototype.
619 * layout.cc (Layout::keep_input_section): New public member
621 (Layout::choose_output_section): Pass keep parameter to
623 * layout.h (class Layout): Add keep_input_section.
624 * object.cc (Sized_relobj_file::do_layout): Check for kept input
626 * testsuite/Makefile.am: Add a test.
627 * testsuite/Makefile.in: Regenerate.
628 * testsuite/pr14265.c: Source file for the test.
629 * testsuite/pr14265.t: Linker script for the test.
630 * testsuite/pr14265.sh: Shell script for the test.
632 2012-08-14 Alan Modra <amodra@gmail.com>
634 * target.h (Target::output_section_name): New function.
635 (Target::do_output_section_name): New function.
636 * layout.cc (Layout::choose_output_section): Call the above.
637 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
639 2012-08-14 Alan Modra <amodra@gmail.com>
641 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
642 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
643 for replace_constant call.
644 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
645 (Output_data_glink::do_print_to_mapfile): New function.
646 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
647 (Target_powerpc::Relocate::relocate): Likewise.
649 2012-08-14 Alan Modra <amodra@gmail.com>
651 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
652 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
653 (Output_data_glink::add_entry,find_entry): Remove shndx param.
654 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
655 all references to shndx_. Handle special case for R_PPC_PLTREL24
657 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
658 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
659 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
661 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
662 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
664 2012-08-12 Alan Modra <amodra@gmail.com>
666 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
667 (glink insn constants): Use uint32_t.
668 (Output_data_glink::add_entry): Use insert, not [] operator.
670 2012-08-11 Alan Modra <amodra@gmail.com>
672 * object.h (Sized_relobj_file::find_shdr): New function.
673 (Sized_relobj_file::find_special_sections): New function.
674 * object.cc (Sized_relobj_file::find_shdr): New function.
675 (Sized_relobj_file::find_eh_frame): Use find_shdr.
676 (Sized_relobj_file::find_special_sections): New function, split out..
677 (Sized_relobj_file::do_read_symbols): ..from here.
678 * output.h (Output_data_got::replace_constant): New function.
679 (Output_data_got::num_entries): New function.
680 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
681 (Output_data_got::got_offset): Protected rather than private.
682 (Output_data_got::replace_got_entry): New function.
683 * output.cc (Output_data_got::replace_got_entry): New function.
684 * powerpc.cc (class Powerpc_relobj): New.
685 (class Powerpc_relocate_functions): Delete all psymval variants or
686 convert to value,addend type. Delete pcrela, pcrela_unaligned.
687 Implement _ha functions using corresponding _hi function.
688 (Powerpc_relobj::find_special_sections): New function.
689 (Target_powerpc::do_make_elf_object): New function.
690 (class Output_data_got_powerpc): New.
691 (class Output_data_glink): New.
692 (class Powerpc_scan_relocatable_reloc): New.
693 Many more changes througout file.
695 2012-08-09 Nick Clifton <nickc@redhat.com>
697 * po/vi.po: Updated Vietnamese translation.
699 2012-08-07 Ian Lance Taylor <iant@google.com>
701 * layout.cc (Layout::add_target_dynamic_tags): If
702 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
705 2012-07-30 Nick Clifton <nickc@redhat.com>
707 * po/gold.pot: Updated template.
708 * po/es.po: Updated Spanish translation.
710 2012-07-18 Cary Coutant <ccoutant@google.com>
713 * configure.ac: Add check for -gpubnames support.
714 * configure: Regenerate.
715 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
716 support; force -gno-pubnames.
717 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
719 (gdb_index_test_4): New test.
720 * testsuite/Makefile.in: Regenerate.
721 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
722 * testsuite/gdb_index_test_2.sh: Likewise.
723 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
724 * testsuite/gdb_index_test_4.sh: New script.
725 * testsuite/gdb_index_test_comm.sh: New script with common code;
726 don't look for space after colon.
728 2012-07-16 Sriraman Tallam <tmsriram@google.com>
730 * gold.cc (queue_middle_tasks): Update function order only after
731 deferred objects due to plugins are processed.
733 2012-07-11 Ian Lance Taylor <iant@google.com>
735 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
736 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
737 (Target_arm::scan_reloc_for_stub): Likewise.
738 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
739 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
740 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
741 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
742 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
744 2012-07-10 Dodji Seketeli <dodji@redhat.com>
745 Ian Lance Taylor <iant@google.com>
748 * configure.ac: Test whether std::tr1::hash<off_t> works.
749 * gold.h: Add a specialization for std::tr1::hash<off_t> if
751 * output.h (class Output_fill): Add virtual destructor.
752 * configure, config.in: Rebuild.
754 2012-06-22 Roland McGrath <mcgrathr@google.com>
756 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
758 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
760 * plugin.cc (Plugin::load): Handle position independent executables.
762 2012-06-06 Cary Coutant <ccoutant@google.com>
764 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
766 (lines_only_debug_sections): Likewise.
767 (gdb_fast_lookup_sections): New static array.
768 (is_gdb_debug_section): Rename formal parameter.
769 (is_lines_only_debug_section): Likewise.
770 (is_gdb_fast_lookup_section): New function.
771 (Layout::include_section): Check for ".zdebug_" prefix; pass
772 section name suffix to is_gdb_debug_section, et al.; check for
773 fast-lookup sections when building .gdb_index.
774 * options.h (--strip-debug-gdb): Update GDB version number.
776 2012-06-06 Cary Coutant <ccoutant@google.com>
778 * configure.ac: Add check for fallocate.
779 * configure: Regenerate.
780 * config.in: Regenerate.
782 * options.h (class General_options): Add --mmap-output-file and
783 --posix-fallocate options.
784 * output.cc: (posix_fallocate): Remove; replace with...
785 (gold_fallocate): New function.
786 (Output_file::map_no_anonymous): Call gold_fallocate.
787 (Output_file::map): Check --mmap-output-file option.
789 2012-06-05 Jing Yu <jingyu@google.com>
791 * gold.h (textdomain): Add do {} to empty while(0).
792 (bindtextdomain): Likewise.
794 2012-06-04 Cary Coutant <ccoutant@google.com>
796 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
799 2012-05-25 Sriraman Tallam <tmsriram@google.com>
801 * symtab.cc (Symbol_table::define_special_symbol):
802 Initialize *poldsym to prevent uninitialized variable errors.
804 2012-05-23 Cary Coutant <ccoutant@google.com>
806 * layout.cc (Layout::section_name_mapping): Add rules to handle
807 exact match on .data.rel.ro.local or .data.rel.ro.
808 (Layout::output_section_name): Check for exact matches.
810 2012-05-23 Cary Coutant <ccoutant@google.com>
812 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
815 2012-05-22 Cary Coutant <ccoutant@google.com>
817 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
818 object before exporting symbol.
820 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
822 * testsuite/tls_test.cc: Include "config.h" first.
823 * testsuite/tls_test_c.c: Likewise.
825 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
826 Nick Clifton <nickc@redhat.com>
829 * configure.in: Add check that sysdep.h has been included before
830 any system header files.
831 * configure: Regenerate.
832 * config.in: Regenerate.
834 2012-05-14 Cary Coutant <ccoutant@google.com>
836 * layout.cc (Layout::make_output_section): Mark .tdata section
838 * testsuite/relro_test.cc: Add a TLS variable.
840 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
843 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
844 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
847 2012-05-08 Cary Coutant <ccoutant@google.com>
849 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
850 (lines_only_debug_sections): Likewise.
852 2012-05-02 Roland McGrath <mcgrathr@google.com>
856 * Makefile.am (CCFILES, HFILES): Add them.
857 * Makefile.in: Regenerate.
858 * i386.cc (Output_data_plt_i386_nacl): New class.
859 (Output_data_plt_i386_nacl_exec): New class.
860 (Output_data_plt_i386_nacl_dyn): New class.
861 (Target_i386_nacl): New class.
862 (Target_selector_i386_nacl): New class.
863 (target_selector_i386): Use it instead of Target_selector_i386.
864 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
865 (Target_x86_64_nacl): New class.
866 (Target_selector_x86_64_nacl): New class.
867 (target_selector_x86_64, target_selector_x32): Use it instead of
868 Target_selector_x86_64.
869 * arm.cc (Output_data_plt_arm_nacl): New class.
870 (Target_arm_nacl): New class.
871 (Target_selector_arm_nacl): New class.
872 (target_selector_arm, target_selector_armbe): Use it instead of
875 * target-select.cc (select_target): Take new Input_file* and off_t
876 arguments, pass them on to recognize method of selector.
877 * object.cc (make_elf_sized_object): Update caller.
878 * parameters.cc (parameters_force_valid_target): Likewise.
879 * incremental.cc (make_sized_incremental_binary): Likewise.
880 * target-select.h: Update decl.
881 (Target_selector::recognize): Take new Input_file* argument,
882 pass it on to do_recognize.
883 (Target_selector::do_recognize): Take new Input_file* argument.
884 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
885 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
886 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
887 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
889 * target.h (Target::Target_info): New members isolate_execinstr
891 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
892 * arm.cc (Target_arm::arm_info): Update initializer.
893 * i386.cc (Target_i386::i386_info): Likewise.
894 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
895 * sparc.cc (Target_sparc::sparc_info): Likewise.
896 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
897 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
898 * layout.cc (Layout::attach_allocated_section_to_segment):
899 Take new const Target* argument. If target->isolate_execinstr(), act
901 (Layout::find_first_load_seg): Take new const Target* argument;
902 if target->isolate_execinstr(), reject PF_X segments.
903 (Layout::relaxation_loop_body): Update caller.
904 (Layout::set_segment_offsets): If target->isolate_execinstr(),
905 reset file offset to zero when we hit LOAD_SEG, and then do a second
906 loop over the segments before LOAD_SEG to reassign offsets after
907 addresses have been determined. Handle target->rosegment_gap().
908 (Layout::attach_section_to_segment): Take new const Target* argument;
909 pass it to attach_allocated_section_to_segment.
910 (Layout::make_output_section): Update caller.
911 (Layout::attach_sections_to_segments): Take new const Target* argument;
912 pass it to attach_section_to_segment.
913 * gold.cc (queue_middle_tasks): Update caller.
914 * layout.h (Layout): Update method decls with new arguments.
916 * arm.cc (Target_arm::Target_arm): Take optional argument for the
917 Target_info pointer to use.
918 (Target_arm::do_make_data_plt): New virtual method.
919 (Target_arm::make_data_plt): New method that calls it.
920 (Target_arm::make_plt_entry): Use it.
921 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
922 for the section alignment.
923 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
925 (Output_data_plt_arm::first_plt_entry_offset): Call it.
926 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
928 (Output_data_plt_arm::get_plt_entry_size): Call it.
929 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
930 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
931 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
933 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
934 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
935 method instead of sizeof(plt_entry).
936 (Output_data_plt_arm::add_entry): Likewise.
937 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
938 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
940 (Target_arm::plt_entry_size): Likewise.
941 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
943 (Output_data_plt_arm_standard): ... here, new class.
944 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
945 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
946 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
948 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
949 Take additional argument for the PLT entry size.
950 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
951 Use get_plt_entry_size method rather than plt_entry_size variable.
952 (Output_data_plt_x86_64::reserve_slot): Likewise.
953 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
954 (Output_data_plt_x86_64::add_entry): Likewise.
955 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
956 (Output_data_plt_x86_64::address_for_global): Likewise.
957 (Output_data_plt_x86_64::address_for_local): Likewise.
958 (Output_data_plt_x86_64::set_final_data_size): Likewise.
959 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
960 Make method non-static.
961 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
963 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
964 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
965 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
966 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
968 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
969 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
971 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
972 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
974 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
975 (Output_data_plt_x86_64::plt_entry_size)
976 (Output_data_plt_x86_64::first_plt_entry)
977 (Output_data_plt_x86_64::plt_entry)
978 (Output_data_plt_x86_64::tlsdesc_plt_entry)
979 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
980 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
981 (Output_data_plt_x86_64_standard): ... here, new class.
982 (Target_x86_64::Target_x86_64): Take optional argument for the
983 Target_info pointer to use.
984 (Target_x86_64::do_make_data_plt): New virtual method.
985 (Target_x86_64::make_data_plt): New method to call it.
986 (Target_x86_64::init_got_plt_for_update): Use that.
987 Call this->plt_->add_eh_frame method here.
988 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
989 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
990 rather than static method.
991 (Target_x86_64::plt_entry_size): Likewise.
992 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
993 rather than plt_entry_size variable. Move guts of PLT filling to...
994 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
995 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
996 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
998 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
999 additional argument for the section alignment.
1000 Don't do add_eh_frame_for_plt here.
1001 (Output_data_plt_i386::first_plt_entry_offset): Make the method
1002 non-static. Use get_plt_entry_size method rather than plt_entry_size
1004 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1006 (Output_data_plt_i386::get_plt_entry_size): Call it.
1007 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1008 (Output_data_plt_i386::add_eh_frame): New method to call it.
1009 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1011 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1012 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1014 (Output_data_plt_i386::fill_plt_entry): New method to call it.
1015 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1016 method instead of plt_entry_size.
1017 (Output_data_plt_i386::plt_entry_size)
1018 (Output_data_plt_i386::plt_eh_frame_fde_size)
1019 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1020 (Output_data_plt_i386_standard): ... here, new class.
1021 (Output_data_plt_i386_exec): New class.
1022 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1023 (Output_data_plt_i386_exec::first_plt_entry): ... here.
1024 (Output_data_plt_i386::exec_plt_entry): Move to ...
1025 (Output_data_plt_i386_exec::plt_entry): ... here.
1026 (Output_data_plt_i386_dyn): New class.
1027 (Output_data_plt_i386::first_plt_entry): Move to ...
1028 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1029 (Output_data_plt_i386::dyn_plt_entry): Move to ...
1030 (Output_data_plt_i386_dyn::plt_entry): ... here.
1031 (Target_i386::Target_i386): Take optional argument for the Target_info
1033 (Target_i386::do_make_data_plt): New virtual method.
1034 (Target_i386::make_data_plt): New method to call it.
1035 (Target_i386::make_plt_section): Use that.
1036 Call this->plt_->add_eh_frame method here.
1037 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1038 rather than plt_entry_size variable.
1039 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1040 (Output_data_plt_i386::address_for_local): Likewise.
1041 (Output_data_plt_i386::do_write): Likewise.
1042 Move guts of PLT filling to...
1043 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1044 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1045 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1046 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1048 2012-05-01 Cary Coutant <ccoutant@google.com>
1050 * dwarf_reader.cc (Dwarf_die::read_attributes)
1051 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1052 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1053 * reduced_debug_output.cc
1054 (Output_reduced_debug_info_section::get_die_end): Remove
1055 DW_FORM_GNU_ref_index. Add default case.
1057 2012-04-26 Mark Wielaard <mjw@redhat.com>
1059 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1060 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1061 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1062 DW_AT_high_pc as offset from DW_AT_low_pc.
1064 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1065 * testsuite/Makefile.in: Regenerate.
1066 * testsuite/gdb_index_test_3.c: New test source file.
1067 * testsuite/gdb_index_test_3.sh: New test source file.
1069 2012-04-25 Ian Lance Taylor <iant@google.com>
1071 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1073 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1074 as a class, not a struct.
1075 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1076 (Target_arm::apply_cortex_a8_workaround): Likewise.
1077 * gc.h: Declare Reloc_types as a struct, not a class.
1078 * object.h: Declare Symbols_data as a struct.
1079 * reloc.h: Declare Read_relocs_data as a struct.
1080 * target.h: Declare Relocate_info as a struct.
1082 2012-04-24 David S. Miller <davem@davemloft.net>
1084 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1085 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1088 2012-04-24 Cary Coutant <ccoutant@google.com>
1090 * incremental-dump.cc (find_input_containing_global): Replace
1091 magic number with symbolic constant.
1092 (dump_incremental_inputs): Update version number.
1093 * incremental.cc (Output_section_incremental_inputs): Update version
1094 number; import symbolic constants from Incremental_inputs_reader.
1095 (Incremental_inputs::create_data_sections): Align relocations
1096 section correctly for 64-bit targets.
1097 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1098 constants; add padding.
1099 (Output_section_incremental_inputs::write_header): Add assert for
1101 (Output_section_incremental_inputs::write_input_files): Add assert
1102 for input_entry_size.
1103 (Output_section_incremental_inputs::write_info_blocks): Add padding;
1104 add assert for object_info_size, input_section_entry_size,
1105 global_sym_entry_size.
1106 * incremental.h (Incremental_inputs_reader): Add symbolic constants
1107 for data structure sizes; use them.
1108 (Incremental_input_entry_reader): Import symbolic constants from
1109 Incremental_inputs_reader; use them.
1111 2012-04-23 David S. Miller <davem@davemloft.net>
1113 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1115 (Target_sparc::Target_sparc): Initialize new fields.
1116 (Target_sparc::do_make_elf_object): New function.
1117 (Target_sparc::do_adjust_elf_header): New function.
1119 2012-04-23 Cary Coutant <ccoutant@google.com>
1121 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1122 CU range table of gdb index.
1124 2012-04-20 David S. Miller <davem@davemloft.net>
1126 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1129 2012-04-16 David S. Miller <davem@davemloft.net>
1131 * sparc.cc (Target_sparc::got_address): New function.
1132 (Sparc_relocate_functions::gdop_hix22): New function.
1133 (Sparc_relocate_functions::gdop_lox10): New function.
1134 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1136 (Target_sparc::Scan::local): Likewise if the global symbol is not
1137 preemptible and is not IFUNC.
1138 (Target_sparc::Relocate::relocate): Perform GOTDATA code
1139 transformations for local and non-preemptible non-IFUNC global
1142 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1143 writing out 64-bit part of ranges.
1145 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1146 -fpic and -fpie respectively.
1147 * Makefile.in: Regenerate.
1149 * sparc.cc (class Target_sparc): Add rela_ifunc_.
1150 (Target_sparc::Target_sparc): Initialize new field.
1151 (Target_sparc::do_plt_section_for_global): New function.
1152 (Target_sparc::do_plt_section_for_local): New function.
1153 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1154 (Target_sparc::make_plt_section): New function, broken out of
1155 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
1156 (Target_sparc::make_plt_entry): Call make_plt_section.
1157 (Target_sparc::make_local_ifunc_plt_entry): New function.
1158 (Target_sparc::rela_ifunc_section): New function.
1159 (Target_sparc::plt_section): Remove const.
1160 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
1161 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1162 and ifunc_count_ fields.
1163 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1164 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1165 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1166 (Output_data_plt_sparc::rela_ifunc): New function.
1167 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1168 (Output_data_plt_sparc::has_ifunc_section): New function.
1169 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1170 (Output_data_plt_sparc::address_for_global): New function.
1171 (Output_data_plt_sparc::address_for_local): New function.
1172 (Output_data_plt_sparc::plt_index_to_offset): New function.
1173 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1175 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1177 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1178 R_SPARC_JMP_IREL to switch.
1179 (Target_sparc::Scan::check_non_pic): Likewise.
1180 (Target_sparc::Scan::local): Handle IFUNC symbols.
1181 (Target_sparc::Scan::local): Likewise.
1182 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1183 and plt_address_for_local.
1184 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1185 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1187 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1188 (class Output_data_reloc): Adjust calls to Output_reloc_type.
1189 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1190 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1192 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1193 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1195 * sparc.cc (Target_sparc::Scan::global): Likewise.
1196 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1198 2012-04-16 Cary Coutant <ccoutant@google.com>
1200 * archive.cc (Library_base::should_include_member): Check for
1201 --export-dynamic-symbol.
1202 * options.h (class General_options): Add --export-dynamic-symbol.
1203 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1204 --export-dynamic-symbol.
1205 (Symbol_table::gc_mark_undef_symbols): Likewise.
1206 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1208 2012-04-12 David S. Miller <davem@davemloft.net>
1210 * sparc.cc (Reloc::wdisp10): New relocation method.
1211 (Reloc::h34): Likewise.
1212 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1213 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1215 (Target_sparc::Scan::local): Likewise.
1216 (Target_sparc::Scan::global): Likewise.
1217 (Target_sparc::Relocate::relocate): Likewise.
1219 2012-04-09 Cary Coutant <ccoutant@google.com>
1221 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1224 2012-04-06 Ian Lance Taylor <iant@google.com>
1226 * timer.cc: #include <unistd.h>.
1228 2012-04-06 Roland McGrath <mcgrathr@google.com>
1230 * configure.in (AC_CHECK_HEADERS): Add locale.h.
1231 * config.in: Regenerate.
1232 * configure: Regenerate.
1234 2012-04-05 Nick Clifton <nickc@redhat.com>
1236 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1237 (AM_LC_MESSAGES): Add.
1238 * aclocal.m4: Regenerate.
1239 * config.in: Regenerate.
1240 * configure: Regenerate.
1242 2012-03-21 Cary Coutant <ccoutant@google.com>
1244 * Makefile.am: Add gdb-index.cc, gdb-index.h.
1245 * Makefile.in: Regenerate.
1246 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1247 (Sized_elf_reloc_mapper::symbol_section): New function.
1248 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1249 (make_elf_reloc_mapper): New function.
1250 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1251 (Dwarf_abbrev_table::do_read_abbrevs): New function.
1252 (Dwarf_abbrev_table::do_get_abbrev): New function.
1253 (Dwarf_ranges_table::read_ranges_table): New function.
1254 (Dwarf_ranges_table::read_range_list): New function.
1255 (Dwarf_pubnames_table::read_section): New function.
1256 (Dwarf_pubnames_table::read_header): New function.
1257 (Dwarf_pubnames_table::next_name): New function.
1258 (Dwarf_die::Dwarf_die): New function.
1259 (Dwarf_die::read_attributes): New function.
1260 (Dwarf_die::skip_attributes): New function.
1261 (Dwarf_die::set_name): New function.
1262 (Dwarf_die::set_linkage_name): New function.
1263 (Dwarf_die::attribute): New function.
1264 (Dwarf_die::string_attribute): New function.
1265 (Dwarf_die::int_attribute): New function.
1266 (Dwarf_die::uint_attribute): New function.
1267 (Dwarf_die::ref_attribute): New function.
1268 (Dwarf_die::child_offset): New function.
1269 (Dwarf_die::sibling_offset): New function.
1270 (Dwarf_info_reader::check_buffer): New function.
1271 (Dwarf_info_reader::parse): New function.
1272 (Dwarf_info_reader::do_parse): New function.
1273 (Dwarf_info_reader::do_read_string_table): New function.
1274 (Dwarf_info_reader::lookup_reloc): New function.
1275 (Dwarf_info_reader::get_string): New function.
1276 (Dwarf_info_reader::visit_compilation_unit): New function.
1277 (Dwarf_info_reader::visit_type_unit): New function.
1278 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1279 Sized_elf_reloc_mapper.
1280 (Sized_dwarf_line_info::symbol_section): Remove function.
1281 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1282 (Sized_dwarf_line_info::read_line_mappings): Remove object
1283 parameter, adjust callers.
1284 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1285 * dwarf_reader.h: Include <sys/types.h>.
1286 (class Track_relocs): Remove forward declaration.
1287 (class Elf_reloc_mapper): New class.
1288 (class Sized_elf_reloc_mapper): New class.
1289 (class Dwarf_abbrev_table): New class.
1290 (class Dwarf_range_list): New class.
1291 (class Dwarf_ranges_table): New class.
1292 (class Dwarf_pubnames_table): New class.
1293 (class Dwarf_die): New class.
1294 (class Dwarf_info_reader): New class.
1295 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1296 (Sized_dwarf_line_info::symbol_section): Remove member function.
1297 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1299 * gdb-index.cc: New source file.
1300 * gdb-index.h: New source file.
1301 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1302 and .debug_types sections, call Layout::add_to_gdb_index.
1303 (Sized_relobj_incr::do_section_name): Implement.
1304 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1305 return type; Implement.
1306 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1308 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1309 parameter list and return type.
1310 (Sized_incr_dynobj::do_section_contents): Likewise.
1311 * layout.cc: Include gdb-index.h.
1312 (Layout::Layout): Initialize gdb_index_data_.
1313 (Layout::init_fixed_output_section): Check for .gdb_index section.
1314 (Layout::add_to_gdb_index): New function. Instantiate.
1315 * layout.h: Add forward declaration for class Gdb_index.
1316 (Layout::add_to_gdb_index): New member function.
1317 (Layout::gdb_index_data_): New data member.
1318 * main.cc: Include gdb-index.h.
1319 (main): Print statistics for gdb index.
1320 * object.cc (Object::section_contents): Move code into
1321 do_section_contents.
1322 (need_decompressed_section): Check for sections needed when building
1324 (build_compressed_section_map): Likewise.
1325 (Sized_relobj_file::do_read_symbols): Need local symbols when building
1327 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1328 sections; call Layout::add_to_gdb_index.
1329 (Sized_relobj_file::do_decompressed_section_contents): Call
1330 do_section_contents directly.
1331 * object.h (Object::do_section_contents): Adjust parameter list and
1333 (Object::do_decompressed_section_contents): Call do_section_contents
1335 (Sized_relobj_file::do_section_contents): Adjust parameter list and
1337 * options.h (class General_options): Add --gdb-index option.
1338 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1339 list and return type.
1340 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1341 * reloc.h (Track_relocs::checkpoint): New function.
1342 (Track_relocs::reset): New function.
1344 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1346 * testsuite/Makefile.in: Regenerate.
1347 * testsuite/gdb_index_test.cc: New test source file.
1348 * testsuite/gdb_index_test_1.sh: New test source file.
1349 * testsuite/gdb_index_test_2.sh: New test source file.
1351 2012-03-19 Doug Kwan <dougkwan@google.com>
1353 * arm.cc (Target_arm::do_define_standard_symbols): New method.
1354 (Target_arm::do_finalize_sections): Remove code which defines
1355 __exidx_start and __exidx_end. Make symbol table parameter
1356 anonymous as it is not used.
1357 * gold.cc (queue_middle_tasks): Call target hook to define any
1358 target-specific symbols.
1359 * target.h (Target::define_standard_symbols): New method.
1360 (Target::do_define_standard_symbols): Same.
1361 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1362 * testsuite/Makefile.in: Regenerate.
1363 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1365 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1366 relocations are generated for __exidx_start and __exidx_end.
1368 2012-03-16 Doug Kwan <dougkwan@google.com>
1370 * testsuite/Makefile.am: Disable test initpri3b.
1371 * testsuite/Makefile.in: Regenerate.
1373 2012-03-15 Doug Kwan <dougkwan@google.com>
1375 * arm.cc (Target_arm::got_section): Make .got section read-only
1378 2012-03-15 Ian Lance Taylor <iant@google.com>
1381 * layout.cc (Layout::make_output_section): Correctly mark
1382 SHT_INIT_ARRAY, et. al., as relro.
1384 2012-03-14 Doug Kwan <dougkwan@google.com>
1386 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1387 dynamic relocations for protected symbols in shared objects.
1389 2012-03-13 Ian Lance Taylor <iant@google.com>
1391 * resolve.cc (Symbol_table::resolve): When merging common symbols,
1392 keep the larger alignment.
1394 2012-03-12 Cary Coutant <ccoutant@google.com>
1396 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1397 handling of DW_LNE_define_file.
1399 2012-03-12 Cary Coutant <ccoutant@google.com>
1401 * reduced_debug_output.cc
1402 (Output_reduced_debug_info_section::get_die_end): Add new FORM
1405 2012-02-29 Cary Coutant <ccoutant@google.com>
1407 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1409 2012-02-29 Cary Coutant <ccoutant@google.com>
1411 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1412 Call Object::decompressed_section_contents.
1413 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1415 (Sized_dwarf_line_info::buffer_start_): New data member.
1416 * merge.cc (Output_merge_data::do_add_input_section): Call
1417 Object::decompressed_section_contents.
1418 (Output_merge_string::do_add_input_section): Likewise.
1419 * object.cc (need_decompressed_section): New function.
1420 (build_compressed_section_map): Decompress sections needed later.
1421 (Sized_relobj_file::do_decompressed_section_contents): New function.
1422 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1423 * object.h (Object::decompressed_section_contents): New function.
1424 (Object::discard_decompressed_sections): New function.
1425 (Object::do_decompressed_section_contents): New function.
1426 (Object::do_discard_decompressed_sections): New function.
1427 (Compressed_section_info): New type.
1428 (Compressed_section_map): Include decompressed section contents.
1429 (Sized_relobj_file::do_decompressed_section_contents): New function.
1430 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1432 2012-02-16 Cary Coutant <ccoutant@google.com>
1434 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1435 * testsuite/Makefile.in: Regenerate.
1437 2012-02-14 Cary Coutant <ccoutant@google.com>
1439 * options.cc (General_options::finalize): Disallow -pie and -static.
1441 2012-02-03 Doug Kwan <dougkwan@google.com>
1443 * arm.cc (Arm_relocate_functions::abs8,
1444 Arm_relocate_functions::abs16): Use
1445 Bits::has_signed_unsigned_overflow32.
1446 (Arm_relocate_functions::thm_abs8): Correct range of
1448 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1451 2012-02-02 Doug Kwan <dougkwan@google.com>
1453 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1454 position independent outputs, not just shared objects.
1456 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
1458 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1459 * configure: Regenerated.
1461 2012-01-27 Ian Lance Taylor <iant@google.com>
1463 * reloc.h (Bits): New class with static functions, copied from
1464 namespace utils in arm.cc.
1465 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
1468 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1470 * incremental.cc (write_info_blocks): Correct relocation offset.
1472 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1474 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1475 (Relocate::tls_gd_to_le): Likewise.
1477 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1479 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1481 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1483 * configure.ac: Check if -mcmodel=medium works.
1484 * configure: Regenerated.
1486 2012-01-24 Cary Coutant <ccoutant@google.com>
1488 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1490 (read_unsigned_LEB_128_x): ... this new function.
1491 (read_signed_LEB_128): Replaced with inline definition and ...
1492 (read_signed_LEB_128_x): ... this new function.
1493 * int_encoding.h (read_unsigned_LEB_128_x): New function.
1494 (read_unsigned_LEB_128): Add inline definition.
1495 (read_signed_LEB_128_x): New function.
1496 (read_signed_LEB_128): Add inline definition.
1497 * testsuite/Makefile.am (leb128_unittest): New unit test.
1498 * testsuite/Makefile.in: Regenerate.
1499 * testsuite/leb128_unittest.cc: New unit test.
1501 2012-01-23 Ian Lance Taylor <iant@google.com>
1504 * i386.cc (Target_i386::do_code_fill): When using a jmp
1505 instruction, pad with nop instructions.
1506 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1508 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
1510 * x86_64.cc (gc_process_relocs): Add typename on types used in
1512 (scan_relocs): Likewise.
1513 (relocate_section): Likewise.
1514 (apply_relocation): Likewise.
1516 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
1518 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1519 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1522 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
1524 * x86_64.cc: Initial support for x32.
1526 2012-01-03 Cary Coutant <ccoutant@google.com>
1528 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1529 Use abstract base class for GOT.
1530 * gold/output.h (class Output_data_got_base): New abstract base class.
1531 (class Output_data_got): Derive from new base class, adjust ctors.
1532 (Output_data_got::reserve_slot): Make virtual; rename to
1533 do_reserve_slot; Adjust callers.
1534 * gold/target.h (Sized_target::init_got_plt_for_update): Return
1535 pointer to abstract base class.
1536 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1538 2011-12-18 Ian Lance Taylor <iant@google.com>
1540 * object.h (Relobj::local_symbol_value): New function.
1541 (Relobj::local_plt_offset): New function.
1542 (Relobj::local_has_got_offset): New function.
1543 (Relobj::local_got_offset): New function.
1544 (Relobj::set_local_got_offset): New function.
1545 (Relobj::do_local_symbol_value): New pure virtual function.
1546 (Relobj::do_local_plt_offset): Likewise.
1547 (Relobj::do_local_has_got_offset): Likewise.
1548 (Relobj::do_local_got_offset): Likewise.
1549 (Relobj::do_set_local_got_offset): Likewise.
1550 (Sized_relobj::do_local_has_got_offset): Rename from
1551 local_has_got_offset.
1552 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1553 (Sized_relobj::do_set_local_got_offset): Rename from
1554 set_local_got_offset.
1555 (Sized_relobj_file::do_local_plt_offset): Rename from
1557 (Sized_relobj_file::do_local_symbol_value): New function.
1558 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1560 * output.cc (Output_data_got::Got_entry::write): Change object to
1561 Relobj. Use local_symbol_value.
1562 (Output_data_got::add_global_with_rel): Change rel_dyn to
1563 Output_data_reloc_generic*. Use add_global_generic.
1564 (Output_data_got::add_global_with_rela): Remove. Change all
1565 callers to use add_global_with_rel.
1566 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1567 Output_data_reloc_generic*. Use add_global_generic.
1568 (Output_data_got::add_global_pair_with_rela): Remove. Change all
1569 callers to use add_global_pair_with_rel.
1570 (Output_data_got::add_local): Change object to Relobj*.
1571 (Output_data_got::add_local_plt): Likewise.
1572 (Output_data_got::add_local_with_rel): Change object to Relobj*,
1573 change rel_dyn to Output_data_reloc_generic*. Use
1575 (Output_data_got::add_local_with_rela): Remove. Change all
1576 callers to use all_local_with_rel.
1577 (Output_data_got::add_local_pair_with_rel): Change object to
1578 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
1579 add_output_section_generic.
1580 (Output_data_got::add_local_pair_with_rela): Remove. Change all
1581 callers to use add_local_pair_with_rel.
1582 (Output_data_got::reserve_local): Change object to Relobj*.
1583 * output.h: (class Output_data_reloc_generic): Add pure virtual
1584 declarations for add_global_generic, add_local_generic,
1585 add_output_section_generic.
1586 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1587 functions for Output_data_reloc_generic. Update declarations for
1588 changes listed in output.cc.
1589 (class Output_data_got): Change template parameter to got_size.
1590 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
1591 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1593 (Sized_relobj_incr::do_local_plt_offset): New function.
1594 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1597 2011-12-17 Cary Coutant <ccoutant@google.com>
1599 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1600 * resolve.cc (Symbol_table::resolve): Likewise.
1601 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1603 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1605 2011-12-16 Ian Lance Taylor <iant@google.com>
1607 * output.h (Output_data_reloc_generic::add): Only call
1608 add_dynamic_reloc if this is a dynamic reloc section.
1610 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
1613 * target-reloc.h (apply_relocation): Replace <64, false> with
1616 2011-11-25 Nick Clifton <nickc@redhat.com>
1618 * po/it.po: New Italian translation.
1620 2011-11-17 Sterling Augustine <saugustine@google.com>
1622 * script.cc (script_include_directive): Implement.
1623 (read_script_file): New local variables name and search_path. Update
1624 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1625 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1626 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1628 2011-11-11 Sterling Augustine <saugustine@google.com>
1630 * yyscript.y (section_cmd): Add support for INCLUDE directive.
1631 (file_or_sections_cmd): Likewise.
1633 2011-11-11 Doug Kwan <dougkwan@google.com>
1635 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1636 if --just-symbols is given.
1638 2011-11-10 Doug Kwan <dougkwan@google.com>
1641 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1642 when processing data relocs.
1643 * reloc.h (Relocate_functions::rel_unaligned): New method.
1644 (Relocate_functions::pcrel_unaligned): Ditto.
1645 (Relocate_functions::rel32_unaligned): Ditto.
1646 (Relocate_functions::pcrel32_unaligned): Ditto.
1648 2011-11-09 Doug Kwan <dougkwan@google.com>
1651 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1652 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1653 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1654 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1655 (Relocate_functions::rel_unaligned): New.
1656 (Relocate_functions::rel32_unaligned): New.
1657 * target-reloc.h (relocate_for_relocatable): Add code to handle
1658 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1659 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1660 arm_unaligned_reloc_r): New targets.
1661 * testsuite/Makefile.in: Regenerate.
1662 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1665 2011-11-02 Ian Lance Taylor <iant@google.com>
1667 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
1669 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1670 * options.cc (General_options::finalize): Use library search path
1671 from configure script if specified. If not native and no sysroot,
1672 only search TOOLLIBDIR.
1673 * options.h (Search_directory::Search_directory): Change name to
1675 (General_options::add_to_library_path_with_sysroot): Change arg to
1677 * configure, Makefile.in, config.in: Rebuild.
1679 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1681 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1682 we are working around the ARM1176 Erratum.
1683 * options.h (General_options::fix_arm1176): Add option.
1684 * testsuite/Makefile.am: Add testcases, and keep current ones
1686 * testsuite/Makefile.in: Regenerate.
1687 * testsuite/arm_fix_1176.s: New file.
1688 * testsuite/arm_fix_1176.sh: Likewise.
1690 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1692 * arm.cc (Target_arm::Target_arm): Remove initialisation of
1694 (Target_arm::may_use_blx): Remove method.
1695 (Target_arm::set_may_use_blx): Likewise.
1696 (Target_arm::may_use_v4t_interworking): New method.
1697 (Target_arm::may_use_v5t_interworking): Likewise.
1698 (Target_arm::may_use_blx_): Remove member variable.
1699 (Arm_relocate_functions::arm_branch_common): Check for v5T
1701 (Arm_relocate_functions::thumb_branch_common): Likewise.
1702 (Reloc_stub::stub_type_for_reloc): Likewise.
1703 (Target_arm::do_finalize_sections): Correct interworking checks.
1704 * testsuite/Makefile.am: Add new tests.
1705 * testsuite/Makefile.in: Regenerate.
1706 * testsuite/arm_farcall_arm_arm.s: New test.
1707 * testsuite/arm_farcall_arm_arm.sh: Likewise.
1708 * testsuite/arm_farcall_arm_thumb.s: Likewise.
1709 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1710 * testsuite/arm_farcall_thumb_arm.s: Likewise.
1711 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1712 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1713 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1715 2011-10-31 Cary Coutant <ccoutant@google.com>
1718 * expression.cc (Expression::eval_with_dot): Add
1719 is_section_dot_assignment parameter.
1720 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
1721 absolute and assigning to dot within a section.
1722 * script-sections.cc
1723 (Output_section_element_assignment::set_section_addresses): Pass
1724 dot_section to set_if_absolute.
1725 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1726 as is_section_dot_assignment flag to eval_with_dot.
1727 (Output_section_element_dot_assignment::set_section_addresses):
1729 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1730 parameter. Also set value if relative to dot_section; set the
1731 symbol's output_section.
1732 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1733 parameter. Adjust all callers.
1734 (Expression::eval_maybe_dot): Likewise.
1735 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1737 * testsuite/script_test_2.t: Test assignment of an absolute value
1738 to dot within an output section element.
1740 2011-10-31 Cary Coutant <ccoutant@google.com>
1742 * options.h (class General_options): Add --[no-]gnu-unique options.
1743 * symtab.cc (Symbol_table::sized_write_globals): Convert
1744 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1746 2011-10-31 Cary Coutant <ccoutant@google.com>
1749 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1750 unnecessary assertion.
1751 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1753 2011-10-31 Sriraman Tallam <tmsriram@google.com>
1755 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1757 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1759 Change to just keep the section associated with symbol.
1760 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1761 they are externally visible and --export-dynamic is turned on.
1762 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1764 2011-10-19 Ian Lance Taylor <iant@google.com>
1767 * script-sections.cc
1768 (Output_section_element_dot_assignment::needs_output_section): New
1771 2011-10-19 Ian Lance Taylor <iant@google.com>
1774 * layout.cc (Layout::segment_precedes): Don't assert failure if a
1775 --section-start option was seen.
1776 * options.h (General_options::any_section_start): New function.
1778 2011-10-18 David S. Miller <davem@davemloft.net>
1781 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1782 member to track relocation locations that have moved during TLS
1783 reloc optimizations.
1784 (Target_sparc::Relocate::Relocate): Initialize to NULL.
1785 (Target_sparc::Relocate::relocate): Adjust view down by 4
1786 bytes if it matches reloc_adjust_addr_.
1787 (Target_sparc::Relocate::relocate_tls): Always move the
1788 __tls_get_addr call delay slot instruction forward 4 bytes when
1789 performing relaxation.
1791 2011-10-18 Cary Coutant <ccoutant@google.com>
1793 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1794 (Output_file::map_no_anonymous): Check for non-zero
1795 return code from posix_fallocate.
1797 2011-10-17 Cary Coutant <ccoutant@google.com>
1800 * plugin.cc (is_visible_from_outside): Check for symbols
1801 referenced from dynamic objects.
1802 * resolve.cc (Symbol_table::resolve): Don't count references
1803 from dynamic objects as references from real ELF files.
1804 * testsuite/plugin_test_2.sh: Adjust expected result.
1806 2011-10-17 Cary Coutant <ccoutant@google.com>
1808 * gold.cc: Include timer.h.
1809 (queue_middle_tasks): Stamp time.
1810 (queue_final_tasks): Likewise.
1811 * main.cc (main): Store timer in parameters. Print timers
1813 * parameters.cc (Parameters::Parameters): Initialize timer_.
1814 (Parameters::set_timer): New function.
1815 (set_parameters_timer): New function.
1816 * parameters.h (Parameters::set_timer): New function.
1817 (Parameters::timer): New function.
1818 (Parameters::timer_): New data member.
1819 (set_parameters_timer): New function.
1820 * timer.cc (Timer::stamp): New function.
1821 (Timer::get_pass_time): New function.
1822 * timer.h (Timer::stamp): New function.
1823 (Timer::get_pass_time): New function.
1824 (Timer::pass_times_): New data member.
1826 2011-10-17 Cary Coutant <ccoutant@google.com>
1828 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1829 task for members of lib groups.
1831 2011-10-17 Cary Coutant <ccoutant@google.com>
1834 * fileread.cc (File_read::find_view): Add assert.
1835 (File_read::make_view): Move bounds check (replace with assert)...
1836 (File_read::find_or_make_view): ... to here.
1838 2011-10-12 Cary Coutant <ccoutant@google.com>
1840 * output.cc (Output_file::open_base_file): Handle case where
1841 ::read returns less than requested size.
1843 2011-10-10 Cary Coutant <ccoutant@google.com>
1845 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1846 Initialize defined_count_.
1847 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1848 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1849 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1850 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1851 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1852 * incremental.h (Sized_relobj_incr::defined_count_): New data
1854 (Sized_incr_dynobj::defined_count_): New data member.
1855 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1856 Return zeroes instead of internal error.
1858 2011-10-10 Cary Coutant <ccoutant@google.com>
1861 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1862 (Output_reloc::symbol_value): Return PLT offset if flag is set.
1863 * output.h (class Output_reloc): Add use_plt_offset flag.
1864 (Output_reloc::type_): Adjust size of bit field.
1865 (Output_reloc::use_plt_offset_): New bit field.
1866 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1867 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1868 flag. Adjust all callers.
1869 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1870 creating RELATIVE relocations.
1872 2011-10-10 Nick Clifton <nickc@redhat.com>
1874 * po/es.po: Updated Spanish translation.
1875 * po/fi.po: Updated Finnish translation.
1877 2011-10-03 Diego Novillo <dnovillo@google.com>
1879 * options.cc (parse_uint): Fix dereference of RETVAL.
1881 2011-09-29 Sriraman Tallam <tmsriram@google.com>
1883 * layout.h (section_order_map_): New member.
1884 (get_section_order_map): New member function.
1885 * output.cc (Output_section::add_input_section): Check for patterns
1886 only when --section-ordering-file is specified.
1887 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1888 output_sections have been formed.
1889 * layout.cc (Layout_Layout): Initialize section_order_map_.
1890 * plugin.cc (update_section_order): Store order in order_map. Do not
1892 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1893 * testsuite/Makefile.in: Regenerate.
1894 * testsuite/plugin_section_order.c: New file.
1895 * testsuite/plugin_final_layout.cc: New file.
1896 * testsuite/plugin_final_layout.sh: New file.
1898 2011-09-29 Cary Coutant <ccoutant@google.com>
1900 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1902 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1903 symbols during incremental update.
1904 (Symbol_table::add_from_dynobj): Likewise.
1906 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1907 Ian Lance Taylor <iant@google.com>
1909 * symtab.cc (Symbol_table::define_special_symbol): Always
1910 canonicalize version string.
1912 2011-09-26 Cary Coutant <ccoutant@google.com>
1914 * gold.cc (queue_initial_tasks): Move option checks ...
1915 * options.cc (General_options::finalize): ... to here. Disable
1916 some options; make others fatal.
1918 2011-09-26 Cary Coutant <ccoutant@google.com>
1921 * plugin.cc (get_symbols_v2): New function.
1922 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1923 (is_referenced_from_outside): New function.
1924 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1925 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1926 (get_symbols): Pass version parameter.
1927 (get_symbols_v2): New function.
1928 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1930 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1931 (onload): Add LDPT_GET_SYMBOLS_V2.
1932 (all_symbols_read_hook): Use get_symbols_v2; check for
1933 LDPR_PREVAILING_DEF_IRONLY_EXP.
1934 * testsuite/plugin_test_3.sh: Update expected results.
1936 2011-09-23 Simon Baldwin <simonb@google.com>
1938 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1939 configuration options.
1940 * configure: Regenerate.
1941 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1942 * Makefile.in: Regenerate.
1943 * testsuite/Makefile.in: Regenerate.
1945 2011-09-19 Sriraman Tallam <tmsriram@google.com>
1947 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1949 2011-09-19 Cary Coutant <ccoutant@google.com>
1951 * incremental.cc (can_incremental_update): Fix typo in comment.
1952 * incremental.h (can_incremental_update): Likewise.
1954 2011-09-18 Cary Coutant <ccoutant@google.com>
1956 * incremental.cc (can_incremental_update): New function.
1957 * incremental.h (can_incremental_update): New function.
1958 * layout.cc (Layout::init_fixed_output_section): Call it.
1959 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1960 * object.cc (Sized_relobj_file::do_layout): Call
1961 can_incremental_update.
1963 2011-09-13 Cary Coutant <ccoutant@google.com>
1965 * configure.ac: Check for glibc support for gnu_indirect_function
1966 support with static linking, setting automake conditional
1968 * Makefile.in: Regenerate.
1969 * configure: Regenerate.
1971 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1972 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1974 * testsuite/Makefile.in: Regenerate.
1976 2011-09-13 Cary Coutant <ccoutant@google.com>
1978 * incremental.cc (Sized_relobj_incr::do_layout): Call
1979 report_comdat_group for kept comdat sections.
1980 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1981 * testsuite/Makefile.in: Regenerate.
1982 * testsuite/incr_comdat_test_1.cc: New source file.
1983 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1984 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1985 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1987 2011-09-13 Ian Lance Taylor <iant@google.com>
1989 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1990 variable external_symbols_offset.
1992 2011-09-12 Ian Lance Taylor <iant@google.com>
1994 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1995 triggered if object has no symbols.
1997 2011-09-09 David S. Miller <davem@davemloft.net>
1999 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2000 (Output_fill_debug_line::do_write): Likewise.
2002 2011-08-29 Cary Coutant <ccoutant@google.com>
2004 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2005 casts to match formatting specs.
2006 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2008 2011-08-26 Cary Coutant <ccoutant@google.com>
2010 * layout.cc (Free_list::allocate): Provide guarantee of minimum
2011 remaining hole size when allocating.
2012 (Layout::make_output_section): Set fill methods for debug sections.
2013 * layout.h (Free_list::Free_list_node): Move from private to
2015 (Free_list::set_min_hole_size): New function.
2016 (Free_list::begin, Free_list::end): New functions.
2017 (Free_list::min_hole_): New data member.
2018 * output.cc: Include dwarf.h.
2019 (Output_fill_debug_info::do_minimum_hole_size): New function.
2020 (Output_fill_debug_info::do_write): New function.
2021 (Output_fill_debug_line::do_minimum_hole_size): New function.
2022 (Output_fill_debug_line::do_write): New function.
2023 (Output_section::Output_section): Initialize new data member.
2024 (Output_section::set_final_data_size): Ensure patch space is larger
2025 than minimum hole size.
2026 (Output_section::do_write): Fill holes in debug sections.
2027 * output.h (Output_fill): New class.
2028 (Output_fill_debug_info): New class.
2029 (Output_fill_debug_line): New class.
2030 (Output_section::set_free_space_fill): New function.
2031 (Output_section::free_space_fill_): New data member.
2032 * testsuite/Makefile.am (incremental_test_3): Add
2033 --incremental-patch option.
2034 (incremental_test_4): Likewise.
2035 (incremental_test_5): Likewise.
2036 (incremental_test_6): Likewise.
2037 (incremental_copy_test): Likewise.
2038 (incremental_common_test_1): Likewise.
2039 * testsuite/Makefile.in: Regenerate.
2041 2011-08-26 Nick Clifton <nickc@redhat.com>
2043 * po/es.po: Updated Spanish translation.
2045 2011-08-01 Cary Coutant <ccoutant@google.com>
2047 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2048 * gold/testsuite/Makefile.in: Regenerate.
2049 * gold/testsuite/justsyms_exec.c: New source file.
2050 * gold/testsuite/justsyms_lib.c: New source file.
2052 2011-08-01 Cary Coutant <ccoutant@google.com>
2054 * layout.cc (Layout::set_segment_offsets): Don't realign text
2055 segment if -Ttext was specified.
2056 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2058 * object.h (Sized_relobj_file::e_type): New function.
2059 (Sized_relobj_file::e_type_): New data member.
2060 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2061 base address for ET_EXEC files.
2062 * target.cc (Target::do_make_elf_object_implementation): Allow
2063 ET_EXEC files with --just-symbols option.
2065 2011-07-28 Cary Coutant <ccoutant@google.com>
2067 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2068 Add thread_number parameter.
2069 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2070 * workqueue-threads.cc
2071 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2072 current thread if its thread number is greater than desired thread
2074 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2075 Add thread_number parameter.
2076 (Workqueue::should_cancel_thread): Likewise.
2077 (Workqueue::find_runnable_or_wait): Pass thread_number to
2078 should_cancel_thread.
2079 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2082 2011-07-22 Sriraman Tallam <tmsriram@google.com>
2084 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2085 only after checking if it cannot be forced local.
2086 * symtab.h (is_externally_visible): Check if the symbol is not forced
2089 2011-07-15 Ian Lance Taylor <iant@google.com>
2091 * options.h (class General_options): Add --print-output-format.
2092 Move -EL next to -EB, for better --help output.
2093 * target-select.cc: Include <cstdio>, "options.h", and
2095 (Target_selector::do_target_bfd_name): New function.
2096 (print_output_format): New function.
2097 * target-select.h (class Target_selector): Update declarations.
2098 (Target_selector::target_bfd_name): New function.
2099 (print_output_format): Declare.
2100 * main.cc: Include "target-select.h".
2101 (main): Handle --print-output-format.
2102 * gold.cc: Include "target-select.h".
2103 (queue_initial_tasks): Handle --print-output-format when there are
2105 * parameters.cc (parameters_force_valid_target): Give a better
2106 error message if -EB/-EL does not match target.
2107 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2110 2011-07-15 Ian Lance Taylor <iant@google.com>
2112 * i386.cc (class Output_data_plt_i386): Add layout_ field.
2113 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2114 (Output_data_plt_i386::do_write): Write address of .dynamic
2115 section to first entry in .got.plt section.
2116 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2117 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2119 (Output_data_plt_x86_64::do_write): Write address of .dynamic
2120 section to first entry in .got.plt section.
2121 * layout.h (Layout::dynamic_section): New function.
2123 2011-07-13 Sriraman Tallam <tmsriram@google.com>
2125 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2127 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2128 input_section_position_, and input_section_glob_.
2129 (read_layout_from_file): Call function section_ordering_specified.
2130 * layout.h (is_section_ordering_specified): New function.
2131 (section_ordering_specified): New function.
2132 (section_ordering_specified_): New boolean member.
2133 * main.cc(main): Call load_plugins after layout object is defined.
2134 * output.cc (Output_section::add_input_section): Use
2135 function section_ordering_specified to check if section ordering is
2137 * output.cc (Output_section::add_relaxed_input_section): Use
2138 function section_ordering_specified to check if section ordering is
2140 (Output_section::update_section_layout): New function.
2141 (Output_section::sort_attached_input_sections): Check if input section
2143 * output.h (Output_section::update_section_layout): New function.
2144 * plugin.cc (get_section_count): New function.
2145 (get_section_type): New function.
2146 (get_section_name): New function.
2147 (get_section_contents): New function.
2148 (update_section_order): New function.
2149 (allow_section_ordering): New function.
2150 (Plugin::load): Add the new interfaces to the transfer vector.
2151 (Plugin_manager::load_plugins): New parameter.
2152 (Plugin_manager::all_symbols_read): New parameter.
2153 (Plugin_manager::claim_file): New parameter. Save the elf object for
2155 (Plugin_manager::get_elf_object): New function.
2156 (Plugin_manager::get_view): Change to directly use the bool to check
2157 if get_view is called from claim_file_hook.
2158 * plugin.h (input_objects): New function
2159 (Plugin__manager::load_plugins): New parameter.
2160 (Plugin_manager::claim_file): New parameter.
2161 (Plugin_manager::get_elf_object): New function.
2162 (Plugin_manager::in_claim_file_handler): New function.
2163 (Plugin_manager::in_claim_file_handler_): New member.
2164 (layout): New function.
2165 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2166 handler with an extra parameter. Make the elf object before calling
2168 * testsuite/plugin_test.c (get_section_count): New function pointer.
2169 (get_section_type): New function pointer.
2170 (get_section_name): New function pointer.
2171 (get_section_contents): New function pointer.
2172 (update_section_order): New function pointer.
2173 (allow_section_ordering): New function pointer.
2174 (onload): Check if the new interfaces exist.
2176 2011-07-13 Ian Lance Taylor <iant@google.com>
2178 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2180 * x86_64.cc (Target_x86_64::got_section): Likewise.
2181 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2182 (relro_now_test_SOURCES): New variable.
2183 (relro_now_test_DEPENDENCIES): New variable.
2184 (relro_now_test_LDFLAGS): New variable.
2185 (relro_now_test_LDADD): New variable.
2186 (relro_now_test.so): New target.
2187 * testsuite/Makefile.in: Rebuild.
2189 2011-07-12 Ian Lance Taylor <iant@google.com>
2192 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2193 GLOB_DAT relocation rather than a RELATIVE relocation for a
2194 protected symbol when creating a shared library.
2195 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2196 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2197 * testsuite/protected_main_1.cc (main): Test that protected
2198 function has same address.
2200 2011-07-11 Ian Lance Taylor <iant@google.com>
2203 * options.h (class General_options): Add -Bgroup.
2204 * options.cc (General_options::finalize): If -Bgroup is set,
2205 default to --unresolved-symbols=report-all.
2206 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2207 * target-reloc.h (issue_undefined_symbol_error): Handle
2208 --unresolved-symbols=report-all.
2210 2011-07-08 Ian Lance Taylor <iant@google.com>
2213 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2214 if linker script discards key sections.
2215 (Layout::create_dynamic_symtab): Likewise.
2216 (Layout::assign_local_dynsym_offsets): Likewise.
2217 (Layout::sized_create_version_sections): Likewise.
2218 (Layout::create_interp): Likewise.
2219 (Layout::finish_dynamic_section): Likewise.
2220 (Layout::set_dynamic_symbol_size): Likewise.
2222 2011-07-08 Ian Lance Taylor <iant@google.com>
2225 * options.h (class General_options): Add --unresolved-symbols.
2226 * target-reloc.h (issue_undefined_symbol_error): Check
2227 --unresolved-symbols. Add comments.
2229 2011-07-08 Ian Lance Taylor <iant@google.com>
2231 * testsuite/odr_violation2.cc (Ordering::operator()): Make
2232 expression more complex.
2234 2011-07-08 Ian Lance Taylor <iant@google.com>
2237 * target-reloc.h (issue_undefined_symbol_error): New inline
2238 function, broken out of relocate_section.
2239 (relocate_section): Call issue_undefined_symbol_error.
2240 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2241 there is no TLS segment if we are about to issue an undefined
2243 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2245 2011-07-08 Ian Lance Taylor <iant@google.com>
2248 * resolve.cc (Symbol_table::should_override): Add fromtype
2249 parameter. Change all callers. Give error when linking together
2250 TLS and non-TLS symbol.
2251 (Symbol_table::should_override_with_special): Add fromtype
2252 parameter. Change all callers.
2253 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2254 there is no TLS segment if we have reported some errors.
2255 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2257 2011-07-08 Ian Lance Taylor <iant@google.com>
2260 * target.h (Target::plt_address_for_global): New function.
2261 (Target::plt_address_for_local): New function.
2262 (Target::plt_section_for_global): Remove.
2263 (Target::plt_section_for_local): Remove.
2264 (Target::do_plt_address_for_global): New virtual function.
2265 (Target::do_plt_address_for_local): New virtual function.
2266 (Target::do_plt_section_for_global): Remove.
2267 (Target::do_plt_section_for_local): Remove.
2268 (Target::register_global_plt_entry): Add Symbol_table and Layout
2270 * output.cc (Output_data_got::Got_entry::write): Use
2271 plt_address_for_global and plt_address_for_local.
2272 * layout.cc (Layout::add_target_dynamic_tags): Use size and
2273 address of output section.
2274 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2275 got_irelative_, and irelative_count_ fields. Update
2277 (Output_data_plt_i386::has_irelative_section): New function.
2278 (Output_data_plt_i386::entry_count): Add irelative_count_.
2279 (Output_data_plt_i386::set_final_data_size): Likewise.
2280 (class Target_i386): Add got_irelative_ and rel_irelative_
2281 fields. Update declarations.
2282 (Target_i386::Target_i386): Initialize new fields.
2283 (Target_i386::do_plt_address_for_global): New function replacing
2284 do_plt_section_for_global.
2285 (Target_i386::do_plt_address_for_local): New function replacing
2286 do_plt_section_for_local.
2287 (Target_i386::got_section): Create got_irelative_.
2288 (Target_i386::rel_irelative_section): New function.
2289 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2290 fields. Don't define __rel_iplt_{start,end}.
2291 (Output_data_plt_i386::add_entry): Add symtab and layout
2292 parameters. Change all callers. Use different PLT and GOT for
2294 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2295 layout parameters. Change all callers. Use different PLT and
2297 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2298 (Output_data_plt_i386::rel_irelative): New function.
2299 (Output_data_plt_i386::address_for_global): New function.
2300 (Output_data_plt_i386::address_for_local): New function.
2301 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
2302 IRELATIVE GOT when changing IFUNC GOT entries.
2303 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2305 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2306 if we didn't create an IRELATIVE GOT.
2307 (Target_i386::Relocate::relocate): Use plt_address_for_global and
2308 plt_address_for_local.
2309 (Target_i386::do_dynsym_value): Use plt_address_for_global.
2310 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2311 got_irelative_, and irelative_count_ fields. Update
2313 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2314 Initialize new fields. Remove symtab parameter. Change all
2316 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2318 (Output_data_plt_x86_64::has_irelative_section): New function.
2319 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2320 (class Target_x86_64): Add got_irelative_ and rel_irelative_
2321 fields. Update declarations.
2322 (Target_x86_64::Target_x86_64): Initialize new fields.
2323 (Target_x86_64::do_plt_address_for_global): New function replacing
2324 do_plt_section_for_global.
2325 (Target_x86_64::do_plt_address_for_local): New function replacing
2326 do_plt_section_for_local.
2327 (Target_x86_64::got_section): Create got_irelative_.
2328 (Target_x86_64::rela_irelative_section): New function.
2329 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
2330 all callers. Don't create __rel_iplt_{start,end}.
2331 (Output_data_plt_x86_64::add_entry): Add symtab and layout
2332 parameters. Change all callers. Use different PLT and GOT for
2334 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2335 layout parameters. Change all callers. Use different PLT and
2337 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2338 parameters. Change all callers. Use different PLT and GOT for
2340 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2341 (Output_data_plt_x86_64::rela_irelative): New function.
2342 (Output_data_plt_x86_64::address_for_global): New function.
2343 (Output_data_plt_x86_64::address_for_local): New function.
2344 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2345 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2346 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2347 (Target_x86_64::register_global_plt_entry): Add symtab and layout
2349 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2351 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2352 symbols if we didn't create an IRELATIVE GOT.
2353 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2354 plt_address_for_local.
2355 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2356 * testsuite/ifuncvar1.c: New test file.
2357 * testsuite/ifuncvar2.c: New test file.
2358 * testsuite/ifuncvar3.c: New test file.
2359 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2360 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2361 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2362 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2363 * testsuite/Makefile.in: Rebuild.
2365 2011-07-07 Cary Coutant <ccoutant@google.com>
2367 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2368 (two_file_test_1_ndebug.o): Likewise.
2369 (two_file_test_1b_ndebug.o): Likewise.
2370 (two_file_test_2_ndebug.o): Likewise.
2371 (two_file_test_main_ndebug.o): Likewise.
2372 (incremental_test_2): Link with no-debug versions.
2374 2011-07-06 Cary Coutant <ccoutant@google.com>
2376 * gold/incremental.cc
2377 (Output_section_incremental_inputs::write_info_blocks): Check for
2378 hidden and internal symbols.
2380 2011-07-06 Cary Coutant <ccoutant@google.com>
2382 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2383 Check disposition for startup file.
2384 (Incremental_inputs::report_command_line): Ignore
2385 --incremental-startup-unchanged option.
2386 * options.cc (General_options::parse_incremental_startup_unchanged):
2388 (General_options::General_options): Initialize new data member.
2389 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2390 (General_options): Add --incremental-startup-unchanged option.
2391 (General_options::incremental_startup_disposition): New function.
2392 (General_options::incremental_startup_disposition_): New data member.
2394 2011-07-06 Cary Coutant <ccoutant@google.com>
2396 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2397 input file index to Script_info ctor.
2398 (Sized_incremental_binary::do_file_has_changed): Find the
2399 command-line argument for files named in scripts.
2400 * incremental.h (Script_info::Script_info): New ctor
2401 with input file index.
2402 (Script_info::input_file_index): New function.
2403 (Script_info::input_file_index_): New data member.
2404 (Incremental_binary::get_library): Add const.
2405 (Incremental_binary::get_script_info): Add const.
2406 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2407 * testsuite/Makefile.am (incremental_test_5): New test case.
2408 (incremental_test_6): New test case.
2409 * testsuite/Makefile.in: Regenerate.
2411 2011-07-06 Cary Coutant <ccoutant@google.com>
2413 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2414 debug output when command lines differ.
2416 2011-07-06 Cary Coutant <ccoutant@google.com>
2418 * incremental.cc (Incremental_inputs::report_command_line): Ignore
2419 --incremental-patch option.
2420 * layout.cc (Free_list::allocate): Extend allocation beyond original
2422 (Layout::make_output_section): Mark sections that should get
2424 * options.cc (parse_percent): New function.
2425 * options.h (parse_percent): New function.
2426 (DEFINE_percent): New macro.
2427 (General_options): Add --incremental-patch option.
2428 * output.cc (Output_section::Output_section): Initialize new data
2430 (Output_section::add_input_section): Print section name when out
2432 (Output_section::add_output_section_data): Likewise.
2433 (Output_section::set_final_data_size): Add patch space when
2434 doing --incremental-full.
2435 (Output_section::do_reset_address_and_file_offset): Remove patch
2437 (Output_segment::set_section_list_addresses): Print debug output
2438 only if --incremental-update.
2439 * output.h (Output_section::set_is_patch_space_allowed): New function.
2440 (Output_section::is_patch_space_allowed_): New data member.
2441 (Output_section::patch_space_): New data member.
2442 * parameters.cc (Parameters::incremental_full): New function.
2443 * parameters.h (Parameters::incremental_full): New function
2444 * testsuite/Makefile.am (incremental_test_2): Add test for
2445 --incremental-patch option.
2446 * testsuite/Makefile.in: Regenerate.
2447 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2448 (t18): Remove function body.
2450 2011-07-05 Doug Kwan <dougkwan@google.com>
2453 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2454 Arm_Address type for relocation result.
2455 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
2457 (Arm_relocate_functions::abs32): Use unaligned access.
2458 (Arm_relocate_functions::rel32): Ditto.
2459 (Arm_relocate_functions::prel31): Ditto.
2460 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2461 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2462 static data relocations.
2463 * testsuite/Makefile.in: Regnerate.
2464 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2466 2011-07-05 Ian Lance Taylor <iant@google.com>
2469 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2470 symbols if necessary.
2471 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2473 2011-07-05 Ian Lance Taylor <iant@google.com>
2476 * resolve.cc (Symbol::override_base_with_special): Simply override
2477 version with special symbol version, ignoring previous version.
2479 2011-07-05 Ian Lance Taylor <iant@google.com>
2481 * object.cc (Sized_relobj_file::include_section_group): Add
2482 information to comment about signature location.
2484 2011-07-02 Ian Lance Taylor <iant@google.com>
2487 * options.h (class General_options): Add -f and -F.
2488 * options.cc (General_options::finalize): Fatal error if -f/-F
2489 are used without -shared.
2490 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2492 2011-07-02 Ian Lance Taylor <iant@google.com>
2494 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2496 2011-07-01 Ian Lance Taylor <iant@google.com>
2500 * resolve.cc (Symbol::override_base_with_special): Don't override
2501 the version if the overriding symbol has a different name.
2502 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
2503 all callers. If we give an error about an undefined version,
2504 define the base version if necessary.
2505 * dynobj.h (class Versions): Update declaration.
2506 * testsuite/weak_alias_test_5.cc: New file.
2507 * testsuite/weak_alias_test.script: New file.
2508 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2509 and versioned_alias have the right value, and call t2.
2510 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2511 weak_alias_test_5.so.
2512 (weak_alias_test_LDADD): Likewise.
2513 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2514 * testsuite/Makefile.in: Rebuild.
2516 2011-07-01 Ian Lance Taylor <iant@google.com>
2519 * options.h (class General_options): Support -z notext.
2520 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2522 (two_file_shared_nonpic.so): Likewise.
2523 (two_file_shared_mixed.so): Likewise.
2524 (two_file_shared_mixed_1.so): Likewise.
2525 (weak_undef_lib_nonpic.so): Likewise.
2526 (alt/weak_undef_lib_nonpic.so): Likewise.
2527 (tls_test_shared_nonpic.so): Likewise.
2528 * testsuite/Makefile.in: Rebuild.
2530 2011-07-01 Ian Lance Taylor <iant@google.com>
2533 * configure.ac: Test whether static linking works, setting
2534 the automake conditional HAVE_STATIC.
2535 * testsuite/Makefile.am: Disable tests using -static if
2536 HAVE_STATIC is not true.
2537 * configure, testsuite/Makefile.in: Rebuild.
2539 2011-07-01 Ian Lance Taylor <iant@google.com>
2542 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2543 Assert if we see DW_EH_PE_indirect.
2544 * target.h (Target::ehframe_datarel_base): New function.
2545 (Target::do_ehframe_datarel_base): New target function.
2546 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2547 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2550 2011-07-01 Ian Lance Taylor <iant@google.com>
2553 * options.h (class General_options): Add
2554 --ld-generated-unwind-info.
2555 * ehframe.cc (Fde::write): Add address parameter. Change all
2556 callers. If associated with PLT, fill in address and size.
2557 (Cie::set_output_offset): Only add merge mapping if there is an
2559 (Cie::write): Add address parameter. Change all callers.
2560 (Eh_frame::add_ehframe_for_plt): New function.
2561 * ehframe.h (class Fde): Update declarations. Move shndx_ and
2562 input_offset_ fields into union u_, with new plt field.
2563 (Fde::Fde): Adjust for new union field.
2564 (Fde::Fde) [Output_data version]: New constructor.
2565 (Fde::add_mapping): Only add merge mapping if there is an object.
2566 (class Cie): Update declarations.
2567 (class Eh_frame): Declare add_ehframe_for_plt.
2568 * layout.cc (Layout::layout_eh_frame): Break out code into
2569 make_eh_frame_section, and call it.
2570 (Layout::make_eh_frame_section): New function.
2571 (Layout::add_eh_frame_for_plt): New function.
2572 * layout.h (class Layout): Update declarations.
2573 * merge.cc (Merge_map::add_mapping): Add assertion.
2574 * i386.cc: Include "dwarf.h".
2575 (class Output_data_plt_i386): Make first_plt_entry,
2576 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
2577 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2578 and plt_eh_frame_fde.
2579 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2580 boundary. Call add_eh_frame_for_plt if appropriate.
2581 * x86_64.cc: Include "dwarf.h".
2582 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
2583 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
2584 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2585 and plt_eh_frame_fde.
2586 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2589 2011-06-29 Ian Lance Taylor <iant@google.com>
2592 * object.cc (Sized_relobj_file::layout_section): Change shdr
2593 parameter to be const.
2594 (Sized_relobj_file::layout_eh_frame_section): New function, broken
2596 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2597 appropriate. Call layout_eh_frame_section.
2598 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2600 * object.h (class Sized_relobj_file): Update declarations.
2602 2011-06-29 Ian Lance Taylor <iant@google.com>
2605 * script.cc (Token::integer_value): Accept trailing M/m/K/k
2607 (Lex::gather_token): Accept trailing M/m/K/k for integers.
2609 2011-06-29 Ian Lance Taylor <iant@google.com>
2612 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2614 * layout.cc (Layout::layout_eh_frame): Likewise.
2616 2011-06-29 Ian Lance Taylor <iant@google.com>
2619 * layout.cc (Layout::symtab_section_shndx): New function.
2620 * layout.h (class Layout): Declare symtab_section_shndx.
2621 * output.cc (Output_section::write_header): Call it.
2623 2011-06-29 Ian Lance Taylor <iant@google.com>
2626 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2627 symbols which are not used in a relocation.
2629 2011-06-28 Ian Lance Taylor <iant@google.com>
2632 * layout.cc (Layout::segment_precedes): Don't crash if a linker
2633 script create indistinguishable segments.
2634 (Layout::set_segment_offsets): Use stable_sort when sorting
2635 segments. Pass this to Compare_segments constructor.
2636 * layout.h (class Layout): Make segment_precedes non-static.
2637 (class Compare_segments): Change from struct to class. Add
2638 layout_ field. Add constructor.
2639 * script-sections.cc
2640 (Script_sections::attach_sections_using_phdrs_clause): Rename
2641 local orphan to is_orphan. Don't report failure to put empty
2642 section in segment. On attachment failure, report name of
2643 section, and attach to first PT_LOAD segment.
2645 2011-06-28 Ian Lance Taylor <iant@google.com>
2648 * target-select.cc (Target_selector::Target_selector): Add
2649 emulation parameter. Change all callers.
2650 (select_target_by_bfd_name): Rename from select_target_by_name.
2652 (select_target_by_emulation): New function.
2653 (supported_emulation_names): New function.
2654 * target-select.h (class Target_selector): Add emulation_ field.
2655 Update declarations.
2656 (Target_selector::recognize_by_bfd_name): Rename from
2657 recognize_by_name. Change all callers.
2658 (Target_selector::supported_bfd_names): Rename from
2659 supported_names. Change all callers.
2660 (Target_selector::recognize_by_emulation): New function.
2661 (Target_selector::supported_emulations): New function.
2662 (Target_selector::emulation): New function.
2663 (Target_selector::do_recognize_by_bfd_name): Rename from
2664 do_recognize_by_name. Change all callers.
2665 (Target_selector::do_supported_bfd_names): Rename from
2666 do_supported_names. Change all callers.
2667 (Target_selector::do_recognize_by_emulation): New function.
2668 (Target_selector::do_supported_emulations): New function.
2669 (select_target_by_bfd_name): Change name in declaration.
2670 (select_target_by_emulation): Declare.
2671 (supported_emulation_names): Declare.
2672 * parameters.cc (parameters_force_valid_target): Try to find
2673 target based on emulation from -m option.
2674 * options.h (class General_options): Change doc string for -m.
2675 * options.cc (help): Print emulations.
2676 (General_options::parse_V): Likewise.
2677 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2678 Add emulation parameter. Change all callers.
2680 2011-06-28 Ian Lance Taylor <iant@google.com>
2682 * target.h (class Target): Add osabi_ field.
2683 (Target::osabi): New function.
2684 (Target::set_osabi): New function.
2685 (Target::Target): Initialize osabi_.
2686 (Target::do_adjust_elf_header): Make pure virtual.
2687 (Sized_target::do_adjust_elf_header): Declare.
2688 * target.cc (Sized_target::do_adjust_elf_header): New function.
2689 (class Sized_target): Instantiate all versions.
2690 * freebsd.h (class Target_freebsd): Remove.
2691 (Target_selector_freebsd::do_recognize): Call set_osabi on
2693 (Target_selector_freebsd::do_recognize_by_name): Likewise.
2694 (Target_selector_freebsd::set_osabi): Remove.
2695 * i386.cc (class Target_i386): Inherit from Sized_target rather
2696 than Target_freebsd.
2697 * x86_64.cc (class Target_x86_64): Likewise.
2699 2011-06-28 Ian Lance Taylor <iant@google.com>
2701 * target.h (Target::can_check_for_function_pointers): Rewrite.
2703 (Target::can_icf_inline_merge_sections): Likewise.
2704 (Target::section_may_have_icf_unsafe_poineters): Likewise.
2705 (Target::Target_info): Add can_icf_inline_merge_sections field.
2706 (Target::do_can_check_for_function_pointers): New virtual
2708 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2709 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2710 from can_check_for_function_pointers, move in file.
2711 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2712 section_may_have_icf_unsafe_poineters, move in file.
2713 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2714 * i386.cc (Target_i386::do_can_check_for_function_pointers):
2715 Rename from can_check_for_function_pointers, move in file.
2716 (Target_i386::can_icf_inline_merge_sections): Remove.
2717 (Target_i386::i386_info): Initialize
2718 can_icf_inline_merge_sections.
2719 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2720 Initialize can_icf_inline_merge_sections.
2721 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2722 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2723 Rename from can_check_for_function_pointers, move in file.
2724 (Target_x86_64::can_icf_inline_merge_sections): Remove.
2725 (Target_x86_64::x86_64_info): Initialize
2726 can_icf_inline_merge_sections.
2727 * testsuite/testfile.cc (Target_test::test_target_info):
2729 * icf.cc (get_section_contents): Correct formatting.
2731 2011-06-27 Ian Lance Taylor <iant@google.com>
2733 * symtab.cc (Symbol::versioned_name): New function.
2734 (Symbol_table::add_to_final_symtab): Use versioned_name when
2736 (Symbol_table::sized_write_symbol): Likewise.
2737 * symtab.h (class Symbol): Declare versioned_name.
2738 * stringpool.h (class Stringpool_template): Add variant of add
2739 which takes a std::basic_string.
2740 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2741 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2742 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2743 (ver_test_12.o): New target.
2744 * testsuite/Makefile.in: Rebuild.
2746 2011-06-27 Doug Kwan <dougkwan@google.com>
2748 * arm.cc (Arm_relocate_functions::thm_jump8,
2749 Arm_relocate_functions::thm_jump11): Use a wider signed
2750 type to compute offset.
2751 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2753 * testsuite/Makefile.in: Regenerate.
2754 * testsuite/arm_branch_in_range.sh: Check test results of
2755 arm_thm_jump11 and arm_thm_jump8.
2756 * testsuite/arm_thm_jump11.s: New test source file.
2757 * testsuite/arm_thm_jump11.t: New linker script.
2758 * testsuite/arm_thm_jump8.s: New test source file.
2759 * testsuite/arm_thm_jump8.t: New linker script.
2761 2011-06-24 Ian Lance Taylor <iant@google.com>
2763 * layout.cc: Include "object.h".
2764 (ctors_sections_in_init_array): New static variable.
2765 (Layout::is_ctors_in_init_array): New function.
2766 (Layout::layout): Add entry to ctors_sections_in_init_array if
2768 * layout.h (class Layout): Declare is_ctors_in_init_array.
2769 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2770 is_ctors_reverse_view is set.
2771 (Sized_relobj_file::write_sections): Add layout parameter. Change
2772 all callers. Set is_ctors_reverse_view field of View_size.
2773 (Sized_relobj_file::reverse_words): New function.
2774 * object.h (Sized_relobj_file::View_size): Add
2775 is_ctors_reverse_view field.
2776 (class Sized_relobj_file): Update declarations.
2777 * testsuite/initpri3.c: New test.
2778 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2780 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2781 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2782 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2783 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2784 * testsuite/Makefile.in: Rebuild.
2786 2011-06-24 Cary Coutant <ccoutant@google.com>
2788 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2789 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2790 (debug_msg_cdebug.err): New targets.
2791 * testsuite/Makefile.in: Regenerate.
2792 * testsuite/debug_msg.sh: Check output of link with compressed debug.
2793 Fix checks for link with shared library.
2795 2011-06-24 Doug Kwan <dougkwan@google.com>
2797 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2798 skip empty text sections.
2799 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2801 2011-06-22 Ian Lance Taylor <iant@google.com>
2804 * options.h (class General_options): Add --ctors-in-init-array.
2805 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2806 friends as SHT_PROGBITS for merging sections.
2807 (Layout::layout): Remove special handling of .init_array and
2808 friends. Don't sort if doing relocatable link. Sort for .ctors
2809 and .dtors if ctors_in_init_array.
2810 (Layout::make_output_section): Force correct section types for
2811 .init_array and friends. Don't sort if doing relocatable link,
2812 Don't sort .ctors and .dtors if ctors_in_init_array.
2813 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2814 (Layout::output_section_name): Add relobj parameter. Change all
2815 callers. Handle .ctors. and .dtors. in code rather than table.
2816 Handle .ctors and .dtors if ctors_in_init_array.
2817 (Layout::match_file_name): New function, moved from output.cc.
2818 * layout.h (class Layout): Update declarations.
2819 * output.cc: Include "layout.h".
2820 (Input_section_sort_entry::get_priority): New function.
2821 (Input_section_sort_entry::match_file_name): Just call
2822 Layout::match_file_name.
2823 (Output_section::Input_section_sort_init_fini_compare::operator()):
2824 Handle .ctors and .dtors. Sort by explicit priority rather than
2826 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2827 * testsuite/initpri2.c: New test.
2828 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2829 (check_PROGRAMS): Add initpri2.
2830 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2831 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2832 * configure, testsuite/Makefile.in: Rebuild.
2834 2011-06-19 Ian Lance Taylor <iant@google.com>
2837 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2838 .interp section to a PT_INTERP segment even if we have seen a
2839 --dynamic-linker option. Don't do it if we have seen a PHDRS
2840 clause in a linker script.
2841 (Layout::finalize): Don't create a .interp section if we've
2842 already create a PT_INTERP segment.
2843 (Layout::create_interp): Always call choose_output_section (revert
2844 patch of 2011-06-17). Don't create PT_INTERP segment.
2845 * script-sections.cc
2846 (Script_sections::create_note_and_tls_segments): Add a .interp
2847 section to a PT_INTERP segment even if we have seen a
2848 --dynamic-linker option.
2850 2011-06-18 Ian Lance Taylor <iant@google.com>
2852 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2853 merely because a non-PT_LOAD segment has a dynamic reloc.
2855 2011-06-18 Ian Lance Taylor <iant@google.com>
2857 * layout.cc (Layout::finish_dynamic_section): Don't create
2858 DT_FLAGS entry if not needed.
2860 2011-06-18 Ian Lance Taylor <iant@google.com>
2863 * layout.cc (Layout::layout_eh_frame): Correct handling of
2864 writable .eh_frame section.
2866 2011-06-17 Ian Lance Taylor <iant@google.com>
2869 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2870 symbol is redefined with the exact same object and value.
2872 2011-06-17 Ian Lance Taylor <iant@google.com>
2875 * layout.h (class Layout): Add interp_segment_ field.
2876 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2877 (Layout::attach_allocated_section_to_segment): If making shared
2878 library, put .interp section in PT_INTERP segment.
2879 (Layout::finalize): Also call create_interp if -dynamic-linker
2881 (Layout::create_interp): Assert that there is no PT_INTERP
2882 segment. If not using a SECTIONS clause, use make_output_section.
2883 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2884 * script-sections.cc
2885 (Script_sections::create_note_and_tls_segments): If making shared
2886 library, put .interp section in PT_INTERP segment.
2888 2011-06-17 Ian Lance Taylor <iant@google.com>
2890 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2891 when making a shared library.
2893 2011-06-17 Ian Lance Taylor <iant@google.com>
2895 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2896 parameter. Change all callers. Don't issue warning about PC32
2897 against locally defined symbol.
2899 2011-06-16 Ian Lance Taylor <iant@google.com>
2901 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2902 occurs in same object.
2904 2011-06-14 Alan Modra <amodra@gmail.com>
2906 * po/POTFILES.in: Regenerate.
2908 2011-06-09 Ian Lance Taylor <iant@google.com>
2910 * script-sections.cc
2911 (Orphan_output_section::set_section_addresses): For a relocatable
2912 link set address to 0.
2914 2011-06-09 Cary Coutant <ccoutant@google.com>
2917 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2918 used with --compress-debug-sections.
2919 * gold/object.cc (Sized_relobj_file::do_layout): Report
2920 uncompressed size of compressed input sections.
2922 2011-06-08 Cary Coutant <ccoutant@google.com>
2925 * testsuite/two_file_test_2_v1.cc: Change initialization of
2926 v2 to keep it in .data.
2928 2011-06-07 Cary Coutant <ccoutant@google.com>
2930 * common.cc (Symbol_table::do_allocate_commons_list): Call
2932 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2933 (Errors::fallback): New function.
2934 (gold_fallback): New function.
2935 * errors.h (Errors::fallback): New function.
2936 * gold.cc (gold_exit): Change status parameter to enum; adjust
2938 (queue_initial_tasks): Call gold_fallback.
2939 * gold.h: Include cstdlib.
2940 (Exit_status): New enum type.
2941 (gold_exit): Change status parameter to enum.
2942 (gold_fallback): New function.
2943 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2944 (Layout::create_symtab_sections): Likewise.
2945 (Layout::create_shdrs): Likewise.
2946 * main.cc (main): Adjust call to gold_exit.
2947 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2948 (Output_data_got::add_got_entry_pair): Likewise.
2949 (Output_section::add_input_section): Likewise.
2950 (Output_section::add_output_section_data): Likewise.
2951 (Output_segment::set_section_list_addresses): Likewise.
2952 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2954 2011-06-07 Cary Coutant <ccoutant@google.com>
2956 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2957 for incremental links.
2958 * output.cc (Output_segment::set_section_list_addresses): Remove
2959 FIXME and test for TLS or BSS.
2961 2011-06-07 Cary Coutant <ccoutant@google.com>
2963 * testsuite/Makefile.am: Add incremental_copy_test,
2964 incremental_common_test_1.
2965 * testsuite/Makefile.in: Regenerate.
2966 * testsuite/common_test_1_v1.c: New source file.
2967 * testsuite/common_test_1_v2.c: New source file.
2968 * testsuite/copy_test_v1.cc: New source file.
2970 2011-06-07 Cary Coutant <ccoutant@google.com>
2972 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2973 update, allocate common from bss section's free list.
2974 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2975 linker-defined symbols.
2976 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2977 Skip GOT and PLT entries that are no longer referenced.
2978 (Output_section_incremental_inputs::write_info_blocks): Mark
2979 linker-defined symbols.
2980 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2981 * output.cc (Output_section::allocate): New function.
2982 * output.h (Output_section::allocate): New function.
2983 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2984 linker-defined symbols.
2985 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2986 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2987 (Symbol::init_base_output_data): Likewise.
2988 (Symbol::init_base_output_segment): Likewise.
2989 (Symbol::init_base_constant): Likewise.
2990 (Sized_symbol::init_output_data): Likewise.
2991 (Sized_symbol::init_output_segment): Likewise.
2992 (Sized_symbol::init_constant): Likewise.
2993 (Symbol_table::do_define_in_output_data): Likewise.
2994 (Symbol_table::do_define_in_output_segment): Likewise.
2995 (Symbol_table::do_define_as_constant): Likewise.
2996 * symtab.h (Symbol::is_predefined): New function.
2997 (Symbol::init_base_output_data): Add is_predefined parameter.
2998 (Symbol::init_base_output_segment): Likewise.
2999 (Symbol::init_base_constant): Likewise.
3000 (Symbol::is_predefined_): New data member.
3001 (Sized_symbol::init_output_data): Add is_predefined parameter.
3002 (Sized_symbol::init_output_segment): Likewise.
3003 (Sized_symbol::init_constant): Likewise.
3004 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3006 2011-06-07 Cary Coutant <ccoutant@google.com>
3008 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3009 instead of emit_copy_reloc.
3010 (Copy_relocs::emit_copy_reloc): Refactor.
3011 (Copy_relocs::make_copy_reloc): New function.
3012 (Copy_relocs::add_copy_reloc): Remove.
3013 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3015 (Copy_relocs::make_copy_reloc): New function.
3016 (Copy_relocs::add_copy_reloc): Remove.
3017 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3018 unchanged input files.
3019 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3020 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3021 Reserve BSS space for COPY relocations.
3022 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3023 (Output_section_incremental_inputs::write_info_blocks): Record
3024 whether a symbol is copied from a shared object.
3025 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3026 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3027 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3028 (Incremental_input_entry_reader::get_output_symbol_index): Add
3030 (Incremental_binary::emit_copy_relocs): New function.
3031 (Incremental_binary::do_emit_copy_relocs): New function.
3032 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3034 (Sized_incremental_binary::add_copy_reloc): New function.
3035 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3036 (Sized_incremental_binary::Copy_reloc): New struct.
3037 (Sized_incremental_binary::Copy_relocs): New typedef.
3038 (Sized_incremental_binary::copy_relocs_): New data member.
3039 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3040 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3041 * target.h (Sized_target::emit_copy_reloc): New function.
3042 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3044 2011-06-02 Cary Coutant <ccoutant@google.com>
3047 * gold/archive.cc (Archive::Archive): Initialize new data member.
3048 (Archive::include_all_members): Return if archive has already been
3050 * gold/archive.h (Archive::include_all_members_): New data member.
3052 2011-06-02 Nick Clifton <nickc@redhat.com>
3054 * dynobj.h: Fix spelling mistake in comment.
3055 * output.cc: Likewise.
3057 2011-05-31 Doug Kwan <dougkwan@google.com>
3061 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3062 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3063 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
3064 redundant arm_exidx_test.so.
3065 * testsuite/Makefile.in: Regenerate.
3066 (check_SCRIPTS): Add pr12826.sh
3067 (check_DATA): Add pr12826.stdout
3068 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3069 * testsuite/pr12826.sh: New file.
3070 * testsuite/pr12826_1.s: Ditto.
3071 * testsuite/pr12826_1.s: Ditto.
3073 2011-05-30 Ian Lance Taylor <iant@google.com>
3075 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3078 2011-05-29 Ian Lance Taylor <iant@google.com>
3081 * testsuite/Makefile.am: Use different file name for two_file_test
3082 temporary file for each incremental test.
3083 * testsuite/Makefile.in: Rebuild.
3085 2011-05-29 Ian Lance Taylor <iant@google.com>
3087 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3088 binary input file is empty.
3090 2011-05-27 Ian Lance Taylor <iant@google.com>
3092 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3093 (ver_test_9.so): Likewise.
3094 * testsuite/Makefile.in: Rebuild.
3096 2011-05-26 Cary Coutant <ccoutant@google.com>
3098 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3099 * incremental.cc (Incremental_inputs::report_input_section): Fix
3100 comment, indentation.
3101 (Incremental_inputs::report_comdat_group): New function.
3102 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3103 of data for incremental input file entry.
3104 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3105 group count, COMDAT group signatures.
3106 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3107 an unchanged input file.
3108 * incremental.h (Incremental_object_entry::Incremental_object_entry):
3109 Initialize new data member.
3110 (Incremental_object_entry::add_comdat_group): New function.
3111 (Incremental_object_entry::get_comdat_group_count): New function.
3112 (Incremental_object_entry::get_comdat_signature_key): New function.
3113 (Incremental_object_entry::groups_): New data member.
3114 (Incremental_inputs::report_comdat_group): New function.
3115 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3116 data for incremental input file entry.
3117 (Incremental_input_entry_reader::get_comdat_group_count): New function.
3118 (Incremental_input_entry_reader::get_input_section): Adjust size of
3119 data for incremental input file entry.
3120 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3121 (Incremental_input_entry_reader::get_comdat_group_signature): New
3123 * object.cc (Sized_relobj::include_section_group): Report kept
3124 COMDAT groups for incremental links.
3126 2011-05-24 David Meyer <pdox@google.com>
3128 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3129 with name parameter. Add found_name parameter.
3130 * fileread.cc (Input_file::find_file): Adjust code accordingly.
3131 * dirsearch.h (class Dirsearch): Update declaration.
3133 2011-05-24 Ian Lance Taylor <iant@google.com>
3135 * archive.cc (Library_base::should_include_member): Pull in object
3136 from archive if it defines the entry symbol.
3137 * parameters.cc (Parameters::entry): New function.
3138 * parameters.h (class Parameters): Declare entry.
3139 * output.h (class Output_file_header): Remove entry_ field.
3140 * output.cc (Output_file_header::Output_file_header): Remove entry
3141 parameter. Change all callers.
3142 (Output_file_header::entry): Use parameters->entry.
3143 * gold.cc (queue_middle_tasks): Likewise.
3144 * plugin.cc (Plugin_hook::run): Likewise.
3146 2011-05-24 Cary Coutant <ccoutant@google.com>
3148 * gold.cc (queue_initial_tasks): Pass incremental base filename
3149 to Output_file::open_base_file; don't print error message.
3150 * incremental-dump.cc (main): Adjust call to
3151 Output_file::open_for_modification.
3152 * incremental-dump.cc (main): Likewise.
3153 * incremental.cc (Incremental_inputs::report_command_line):
3154 Ignore --incremental-base option when comparing command lines.
3155 Ignore parameter when given as separate argument.
3156 * options.h (class General_options): Add --incremental-base.
3157 * output.cc (Output_file::Output_file):
3158 (Output_file::open_base_file): Add base_name and writable parameters;
3159 read base file into new file; print error message here.
3160 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3162 * output.h (Output_file::open_for_modification): Rename to...
3163 (Output_file::open_base_file): ...this; add base_name and
3164 writable parameters; adjust all callers.
3165 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3167 * testsuite/Makefile.am (incremental_test_4): Test
3169 * testsuite/Makefile.in: Regenerate.
3171 2011-05-24 Cary Coutant <ccoutant@google.com>
3173 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3175 * testsuite/Makefile.in: Regenerate.
3176 * testsuite/two_file_test_1_v1.cc: New test source file.
3177 * testsuite/two_file_test_1b_v1.cc: New test source file.
3178 * testsuite/two_file_test_2_v1.cc: New test source file.
3180 2011-05-24 Cary Coutant <ccoutant@google.com>
3182 * dynobj.h (Dynobj::do_dynobj): New function.
3183 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3184 flag and soname for shared objects.
3185 * incremental.cc (Incremental_inputs::report_object): Make
3186 either Incremental_object_entry or Incremental_dynobj_entry; add
3187 soname to string table.
3188 (Incremental_inputs::report_input_section): Add assertion.
3189 (Output_section_incremental_inputs::set_final_data_size): Adjust
3190 type of input file entry for shared libraries; adjust size of
3191 shared library info entry.
3192 (Output_section_incremental_inputs::write_input_files): Write
3193 as_needed flag for shared libraries.
3194 (Output_section_incremental_inputs::write_info_blocks): Adjust type
3195 of input file entry for shared libraries; write soname.
3196 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3197 soname from incremental info.
3198 * incremental.h (enum Incremental_input_flags): Add
3199 INCREMENTAL_INPUT_AS_NEEDED.
3200 (Incremental_input_entry::Incremental_input_entry): Initialize new
3202 (Incremental_input_entry::set_as_needed): New function.
3203 (Incremental_input_entry::as_needed): New function.
3204 (Incremental_input_entry::do_dynobj_entry): New function.
3205 (Incremental_input_entry::as_needed_): New data member.
3206 (Incremental_object_entry::Incremental_object_entry): Don't check
3208 (Incremental_object_entry::do_type): Likewise.
3209 (class Incremental_dynobj_entry): New class.
3210 (Incremental_input_entry_reader::as_needed): New function.
3211 (Incremental_input_entry_reader::get_soname): New function.
3212 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3213 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3214 size of shared library info entry.
3215 * layout.cc (Layout::finish_dynamic_section): Don't test for
3216 incremental link when adding DT_NEEDED entries.
3217 * object.h (Object::Object): Initialize new data member.
3218 (Object::dynobj): New function.
3219 (Object::set_as_needed): New function.
3220 (Object::as_needed): New function.
3221 (Object::do_dynobj): New function.
3222 (Object::as_needed_): New data member.
3224 2011-05-24 Cary Coutant <ccoutant@google.com>
3226 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3227 info; adjust display of GOT entries.
3228 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3229 vector of input objects; remove file_status_.
3230 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3231 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3232 got_plt reader; call target hooks to reserve GOT entries.
3233 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3234 of input file info header and GOT info entry.
3235 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3237 (Got_plt_view_info::got_descriptor): Remove.
3238 (Got_plt_view_info::sym_index): New data member.
3239 (Got_plt_view_info::input_index): New data member.
3240 (Local_got_offset_visitor::visit): Write input file index.
3241 (Global_got_offset_visitor::visit): Write 0 for input file index.
3242 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3243 with sym_index and input_index.
3244 (Output_section_incremental_inputs::write_got_plt): Adjust size of
3245 incremental info GOT entry; replace got_descriptor with input_index.
3246 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3247 map from input file index to object.
3248 (Sized_relobj_incr::do_layout): Replace direct data member reference
3249 with accessor function.
3250 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3251 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3252 Adjust size of input file info header.
3253 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3254 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3255 (Incremental_input_entry_reader::get_input_section): Adjust size of
3256 input file info header.
3257 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3258 of incremental info GOT entry.
3259 (Incremental_got_plt_reader::get_got_desc): Remove.
3260 (Incremental_got_plt_reader::get_got_symndx): New function.
3261 (Incremental_got_plt_reader::get_got_input_index): New function.
3262 (Sized_incremental_binary::Sized_incremental_binary): Remove
3263 file_status_; add input_objects_.
3264 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3265 (Sized_incremental_binary::set_file_is_unchanged): Remove.
3266 (Sized_incremental_binary::file_is_unchanged): Remove.
3267 (Sized_incremental_binary::set_input_object): New function.
3268 (Sized_incremental_binary::input_object): New function.
3269 (Sized_incremental_binary::file_status_): Remove.
3270 (Sized_incremental_binary::input_objects_): New data member.
3271 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3273 (Sized_relobj_incr::invalid_address): Move to base class.
3274 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3276 (Sized_relobj_incr::do_output_section_offset): Likewise.
3277 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3278 (Sized_relobj_incr::section_offsets_): Likewise.
3279 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3281 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3282 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3283 with accessor function.
3284 (Sized_relobj_file::do_layout): Likewise.
3285 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3286 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3287 (Sized_relobj_file::compute_final_local_value): Replace refs to
3288 section_offsets_ with accessor function.
3289 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3290 * object.h (Relobj::Relobj): Initialize new data members.
3291 (Relobj::add_dyn_reloc): New function.
3292 (Relobj::first_dyn_reloc): New function.
3293 (Relobj::dyn_reloc_count): New function.
3294 (Relobj::first_dyn_reloc_): New data member.
3295 (Relobj::dyn_reloc_count_): New data member.
3296 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3298 (Sized_relobj::Address): New typedef.
3299 (Sized_relobj::invalid_address): Move here from child class.
3300 (Sized_relobj::Sized_relobj): Initialize new data members.
3301 (Sized_relobj::sized_relobj): New function.
3302 (Sized_relobj::is_output_section_offset_invalid): Move here from
3304 (Sized_relobj::get_output_section_offset): Likewise.
3305 (Sized_relobj::local_has_got_offset): Likewise.
3306 (Sized_relobj::local_got_offset): Likewise.
3307 (Sized_relobj::set_local_got_offset): Likewise.
3308 (Sized_relobj::do_for_all_local_got_entries): Likewise.
3309 (Sized_relobj::clear_got_offsets): New function.
3310 (Sized_relobj::section_offsets): Move here from child class.
3311 (Sized_relobj::do_output_section_offset): Likewise.
3312 (Sized_relobj::do_set_section_offset): Likewise.
3313 (Sized_relobj::Local_got_offsets): Likewise.
3314 (Sized_relobj::local_got_offsets_): Likewise.
3315 (Sized_relobj::section_offsets_): Likewise.
3316 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3318 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3320 (Sized_relobj_file::sized_relobj): New function
3321 (Sized_relobj_file::local_has_got_offset): Move to base class.
3322 (Sized_relobj_file::local_got_offset): Likewise.
3323 (Sized_relobj_file::set_local_got_offset): Likewise.
3324 (Sized_relobj_file::get_output_section_offset): Likewise.
3325 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3326 (Sized_relobj_file::do_output_section_offset): Likewise.
3327 (Sized_relobj_file::do_set_section_offset): Likewise.
3328 (Sized_relobj_file::Local_got_offsets): Likewise.
3329 (Sized_relobj_file::local_got_offsets_): Likewise.
3330 (Sized_relobj_file::section_offsets_): Likewise.
3331 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3333 (set_needs_dynsym_index): Convert relobj to derived class pointer.
3334 (Output_reloc::get_symbol_index): Likewise.
3335 (Output_reloc::local_section_offset): Likewise.
3336 (Output_reloc::get_address): Likewise.
3337 (Output_reloc::symbol_value): Likewise.
3338 (Output_data_got::reserve_slot): Move to class definition.
3339 (Output_data_got::reserve_local): New function.
3340 (Output_data_got::reserve_slot_for_global): Remove.
3341 (Output_data_got::reserve_global): New function.
3342 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3343 (all constructors, two instantiations).
3344 (Output_reloc::get_relobj): New function (two instantiations).
3345 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3346 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3347 (Output_data_reloc::add_global): Adjust type of relobj.
3348 (Output_data_reloc::add_global_relative): Likewise.
3349 (Output_data_reloc::add_symbolless_global_addend): Likewise.
3350 (Output_data_reloc::add_local): Likewise.
3351 (Output_data_reloc::add_local_relative): Likewise.
3352 (Output_data_reloc::add_symbolless_local_addend): Likewise.
3353 (Output_data_reloc::add_local_section): Likewise.
3354 (Output_data_reloc::add_output_section): Likewise.
3355 (Output_data_reloc::add_absolute): Likewise.
3356 (Output_data_reloc::add_target_specific): Likewise.
3357 (Output_data_got::reserve_slot): Move definition here.
3358 (Output_data_got::reserve_local): New function.
3359 (Output_data_got::reserve_global): New function.
3360 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3361 section_offsets_ with accessor function.
3362 (Sized_relobj_file::write_sections): Likewise.
3363 (Sized_relobj_file::do_relocate_sections): Likewise.
3364 * target.h (Sized_target::reserve_local_got_entry): New function.
3365 (Sized_target::reserve_global_got_entry): New function.
3366 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3367 (Target_x86_64::reserve_global_got_entry): New function.
3368 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3370 2011-05-23 Cary Coutant <ccoutant@google.com>
3372 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3373 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3374 bit when checking got_type.
3375 * incremental.cc (Sized_incremental_binary::setup_readers):
3376 Store symbol table and string table locations; initialize bit vector
3377 of file status flags.
3378 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3380 (Sized_incremental_binary::do_process_got_plt): New function.
3381 (Sized_incremental_binary::get_symtab_view): Use stored locations.
3382 (Output_section_incremental_inputs::set_final_data_size): Record
3383 file index for each input file.
3384 (Output_section_incremental_inputs::write_got_plt): Store file index
3385 instead of input entry offset for each GOT entry.
3387 (Incremental_input_entry::Incremental_input_entry): Initialize new
3389 (Incremental_input_entry::set_offset): Store file index.
3390 (Incremental_input_entry::get_file_index): New function.
3391 (Incremental_input_entry::file_index_): New data member.
3392 (Incremental_binary::process_got_plt): New function.
3393 (Incremental_binary::do_process_got_plt): New function.
3394 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3396 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3397 (Sized_incremental_binary::set_file_is_unchanged): New function.
3398 (Sized_incremental_binary::file_is_unchanged): New function.
3399 (Sized_incremental_binary::do_process_got_plt): New function.
3400 (Sized_incremental_binary::file_status_): New data member.
3401 (Sized_incremental_binary::main_symtab_loc_): New data member.
3402 (Sized_incremental_binary::main_strtab_loc_): New data member.
3403 * output.cc (Output_data_got::Got_entry::write): Add case
3405 (Output_data_got::add_global): Call add_got_entry.
3406 (Output_data_got::add_global_plt): Likewise.
3407 (Output_data_got::add_global_with_rel): Likewise.
3408 (Output_data_got::add_global_with_rela): Likewise.
3409 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3410 (Output_data_got::add_global_pair_with_rela): Likewise.
3411 (Output_data_got::add_local): Call add_got_entry.
3412 (Output_data_got::add_local_plt): Likewise.
3413 (Output_data_got::add_local_with_rel): Likewise.
3414 (Output_data_got::add_local_with_rela): Likewise.
3415 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3416 (Output_data_got::add_local_pair_with_rela): Likewise.
3417 (Output_data_got::reserve_slot): New function.
3418 (Output_data_got::reserve_slot_for_global): New function.
3419 (Output_data_got::add_got_entry): New function.
3420 (Output_data_got::add_got_entry_pair): New function.
3421 (Output_section::add_output_section_data): Edit FIXME.
3423 (Output_section_data_build::Output_section_data_build): New
3424 constructor with size parameter.
3425 (Output_data_space::Output_data_space): Likewise.
3426 (Output_data_got::Output_data_got): Initialize new data member; new
3427 constructor with size parameter.
3428 (Output_data_got::add_constant): Call add_got_entry.
3429 (Output_data_got::reserve_slot): New function.
3430 (Output_data_got::reserve_slot_for_global): New function.
3431 (class Output_data_got::Got_entry): Add RESERVED_CODE.
3432 (Output_data_got::add_got_entry): New function.
3433 (Output_data_got::add_got_entry_pair): New function.
3434 (Output_data_got::free_list_): New data member.
3435 * target.h (Sized_target::init_got_plt_for_update): New function.
3436 (Sized_target::register_global_plt_entry): New function.
3437 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3438 Initialize new data member; call init; add constructor with PLT count.
3439 (Output_data_plt_x86_64::init): New function.
3440 (Output_data_plt_x86_64::add_relocation): New function.
3441 (Output_data_plt_x86_64::reserve_slot): New function.
3442 (Output_data_plt_x86_64::free_list_): New data member.
3443 (Target_x86_64::init_got_plt_for_update): New function.
3444 (Target_x86_64::register_global_plt_entry): New function.
3445 (Output_data_plt_x86_64::add_entry): Allocate from free list for
3446 incremental updates.
3447 (Output_data_plt_x86_64::add_relocation): New function.
3448 * testsuite/object_unittest.cc (Object_test): Set default options.
3450 2011-05-16 Ian Lance Taylor <iant@google.com>
3452 * options.h (class General_options): Make -i a synonym for -r.
3454 2011-05-16 Ian Lance Taylor <iant@google.com>
3456 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3458 2011-05-10 Cary Coutant <ccoutant@google.com>
3460 * object.cc (Sized_relobj::do_count_local_symbols): Check for
3463 2011-05-06 Ian Lance Taylor <iant@google.com>
3465 * layout.cc (Layout::layout): If the output section flags change,
3466 update the ordering.
3468 2011-04-25 Cary Coutant <ccoutant@google.com>
3470 * incremental-dump.cc (dump_incremental_inputs): Print local
3471 symbol info for each input file.
3473 (Output_section_incremental_inputs::set_final_data_size): Add local
3474 symbol info to input file entries in incremental info.
3475 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3476 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3477 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3478 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3480 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3481 (Sized_incr_relobj::do_relocate): Write the local symbols.
3482 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3483 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3484 Adjust size of input file header.
3485 (Incremental_inputs_reader::get_local_symbol_offset): New function.
3486 (Incremental_inputs_reader::get_local_symbol_count): New function.
3487 (Incremental_inputs_reader::get_input_section): Adjust size of input
3489 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3490 (Sized_incr_relobj::This): New typedef.
3491 (Sized_incr_relobj::sym_size): New const data member.
3492 (Sized_incr_relobj::Local_symbol): New struct.
3493 (Sized_incr_relobj::do_output_local_symbol_count): New function.
3494 (Sized_incr_relobj::do_local_symbol_offset): New function.
3495 (Sized_incr_relobj::local_symbol_count_): New data member.
3496 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3497 (Sized_incr_relobj::local_symbol_index_): New data member.
3498 (Sized_incr_relobj::local_symbol_offset_): New data member.
3499 (Sized_incr_relobj::local_dynsym_offset_): New data member.
3500 (Sized_incr_relobj::local_symbols_): New data member.
3501 * object.h (Relobj::output_local_symbol_count): New function.
3502 (Relobj::local_symbol_offset): New function.
3503 (Relobj::do_output_local_symbol_count): New function.
3504 (Relobj::do_local_symbol_offset): New function.
3505 (Sized_relobj::do_output_local_symbol_count): New function.
3506 (Sized_relobj::do_local_symbol_offset): New function.
3508 2011-04-22 Vladimir Simonov <sv@sw.ru>
3510 * descriptors.cc (set_close_on_exec): New function.
3511 (Descriptors::open): Use set_close_on_exec.
3512 * output.cc (S_ISLNK): Define if not defined.
3514 2011-04-22 Cary Coutant <ccoutant@google.com>
3516 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3518 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3519 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3520 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3522 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3523 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3524 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3526 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3528 (Incremental_binary::apply_incremental_relocs): New function.
3529 (Incremental_binary::do_apply_incremental_relocs): New function.
3530 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3532 (Sized_incremental_binary::add_global_symbol): New function.
3533 (Sized_incremental_binary::global_symbol): New function.
3534 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3535 (Sized_incremental_binary::symbol_map_): New data member.
3536 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3537 * target.h (Sized_target::apply_relocation): New function.
3538 * target-reloc.h (apply_relocation): New function.
3539 * x86_64.cc (Target_x86_64::apply_relocation): New function.
3541 2011-04-22 Doug Kwan <dougkwan@google.com>
3543 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3544 flag of a SHT_ARM_EXIDX section.
3545 * testsuite/Makefile.am (arm_exidx_test): New test rules.
3546 * testsuite/Makefile.in: Regenerate.
3547 * testsuite/arm_exidx_test.s: New file.
3548 * testsuite/arm_exidx_test.sh: Same.
3550 2011-04-20 Cary Coutant <ccoutant@google.com>
3553 * archive.h (Incremental_archive_entry::Archive_member):
3554 Initialize arg_serial_ (second constructor).
3556 2011-04-17 Ian Lance Taylor <iant@google.com>
3558 * object.cc (Relocate_info::location): Simplify location string.
3559 * errors.cc (Errors::error_at_location): Don't print program
3561 (Errors::warning_at_location): Likewise.
3562 (Errors::undefined_symbol): Likewise.
3563 * testsuite/debug_msg.sh: Update accordingly.
3565 2011-04-14 Cary Coutant <ccoutant@google.com>
3567 * gold/layout.cc (Layout::symtab_section_offset): New function.
3568 * gold/layout.h (Layout::symtab_section_offset): New function.
3569 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3571 2011-04-12 Ian Lance Taylor <iant@google.com>
3573 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
3574 with MREMAP_MAYMOVE.
3575 * output.h (class Output_file): Add map_is_allocated_ field.
3576 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
3577 not available, provide stubs. If mremap is not available, #define
3579 (MREMAP_MAYMOVE): Define if not defined.
3580 (Output_file::Output_file): Initialize map_is_allocated_.
3581 (Output_file::resize): Check map_is_allocated_.
3582 (Output_file::map_anonymous): If mmap fails, use malloc.
3583 (Output_file::unmap): Don't do anything for an anonymous map.
3584 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
3585 is not available, provide stubs.
3586 (File_read::View::~View): Use free rather than delete[].
3587 (File_read::make_view): Use malloc rather than new[]. If mmap
3589 (File_read::find_or_make_view): Use malloc rather than new[].
3590 * gold.h: Remove HAVE_REMAP code.
3591 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
3592 exists. Rename mremap to gold_mremap. If mmap is not available
3594 * configure, config.in: Rebuild.
3596 2011-04-11 Ian Lance Taylor <iant@google.com>
3598 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3599 initialize local variable v.
3601 2011-04-11 Cary Coutant <ccoutant@google.com>
3603 * archive.cc (Archive::include_member): Adjust call to
3605 (Add_archive_symbols::run): Track argument serial numbers.
3606 (Lib_group::include_member): Likewise.
3607 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3608 * archive.h (Incremental_archive_entry::Archive_member):
3609 Initialize arg_serial_.
3610 (Archive_member::arg_serial_): New data member.
3611 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3612 (Sized_dynobj::do_add_symbols): Track symbols when doing an
3614 (Sized_dynobj::do_for_all_local_got_entries): New function.
3615 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3617 * fileread.cc (get_mtime): New function.
3618 * fileread.h (get_mtime): New function.
3619 * gold.cc (queue_initial_tasks): Check for incremental update.
3620 (process_incremental_input): New function.
3621 (queue_middle_tasks): Don't force valid target for incremental
3623 * incremental-dump.cc (find_input_containing_global): Adjust
3624 size of symbol info entry.
3625 (dump_incremental_inputs): Dump argument serial number and
3626 in_system_directory flag; bias shndx by 1; print symbol names
3627 when dumping per-file symbol lists; use new symbol info readers.
3629 (Output_section_incremental_inputs:update_data_size): New function.
3630 (Sized_incremental_binary::setup_readers): Setup input readers
3631 for each input file; build maps for files added from libraries
3633 (Sized_incremental_binary::check_input_args): New function.
3634 (Sized_incremental_binary::do_check_inputs): Build map of argument
3635 serial numbers to input arguments.
3636 (Sized_incremental_binary::do_file_has_changed): Rename
3637 do_file_is_unchanged to this; compare file modification times.
3638 (Sized_incremental_binary::do_init_layout): New function.
3639 (Sized_incremental_binary::do_reserve_layout): New function.
3640 (Sized_incremental_binary::do_get_input_reader): Remove.
3641 (Sized_incremental_binary::get_symtab_view): New function.
3642 (Incremental_checker::can_incrementally_link_output_file): Remove.
3643 (Incremental_inputs::report_command_line): Exclude --debug options.
3644 (Incremental_inputs::report_archive_begin): Add parameter; track
3645 argument serial numbers; don't put input file entry for archive
3646 before archive members.
3647 (Incremental_inputs::report_archive_end): Put input file entry
3648 for archive after archive members.
3649 (Incremental_inputs::report_object): Add parameter; track argument
3650 serial numbers and in_system_directory flag.
3651 (Incremental_inputs::report_script): Add parameter; track argument
3653 (Output_section_incremental_inputs::set_final_data_size): Adjust
3654 size of symbol info entry; check for forwarding symbols.
3655 (Output_section_incremental_inputs::write_input_files): Write
3656 in_system_directory flag and argument serial number.
3657 (Output_section_incremental_inputs::write_info_blocks): Map section
3658 indices between incremental info and original input file; store
3659 input section index for each symbol.
3660 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3661 change operator() to visit().
3662 (class Global_got_offset_visitor): Likewise.
3663 (class Global_symbol_visitor_got_plt):
3664 (Output_section_incremental_inputs::write_got_plt): Use new visitor
3666 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3667 (Sized_incr_relobj::do_read_symbols): New function.
3668 (Sized_incr_relobj::do_layout): New function.
3669 (Sized_incr_relobj::do_layout_deferred_sections): New function.
3670 (Sized_incr_relobj::do_add_symbols): New function.
3671 (Sized_incr_relobj::do_should_include_member): New function.
3672 (Sized_incr_relobj::do_for_all_global_symbols): New function.
3673 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3674 (Sized_incr_relobj::do_section_size): New function.
3675 (Sized_incr_relobj::do_section_name): New function.
3676 (Sized_incr_relobj::do_section_contents): New function.
3677 (Sized_incr_relobj::do_section_flags): New function.
3678 (Sized_incr_relobj::do_section_entsize): New function.
3679 (Sized_incr_relobj::do_section_address): New function.
3680 (Sized_incr_relobj::do_section_type): New function.
3681 (Sized_incr_relobj::do_section_link): New function.
3682 (Sized_incr_relobj::do_section_info): New function.
3683 (Sized_incr_relobj::do_section_addralign): New function.
3684 (Sized_incr_relobj::do_initialize_xindex): New function.
3685 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3686 (Sized_incr_relobj::do_read_relocs): New function.
3687 (Sized_incr_relobj::do_gc_process_relocs): New function.
3688 (Sized_incr_relobj::do_scan_relocs): New function.
3689 (Sized_incr_relobj::do_count_local_symbols): New function.
3690 (Sized_incr_relobj::do_finalize_local_symbols): New function.
3691 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3692 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3693 (Sized_incr_relobj::do_relocate): New function.
3694 (Sized_incr_relobj::do_set_section_offset): New function.
3695 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3696 (Sized_incr_dynobj::do_read_symbols): New function.
3697 (Sized_incr_dynobj::do_layout): New function.
3698 (Sized_incr_dynobj::do_add_symbols): New function.
3699 (Sized_incr_dynobj::do_should_include_member): New function.
3700 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3701 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3702 (Sized_incr_dynobj::do_section_size): New function.
3703 (Sized_incr_dynobj::do_section_name): New function.
3704 (Sized_incr_dynobj::do_section_contents): New function.
3705 (Sized_incr_dynobj::do_section_flags): New function.
3706 (Sized_incr_dynobj::do_section_entsize): New function.
3707 (Sized_incr_dynobj::do_section_address): New function.
3708 (Sized_incr_dynobj::do_section_type): New function.
3709 (Sized_incr_dynobj::do_section_link): New function.
3710 (Sized_incr_dynobj::do_section_info): New function.
3711 (Sized_incr_dynobj::do_section_addralign): New function.
3712 (Sized_incr_dynobj::do_initialize_xindex): New function.
3713 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3714 (make_sized_incremental_object): New function.
3715 (Incremental_library::copy_unused_symbols): New function.
3716 (Incremental_library::do_for_all_unused_symbols): New function.
3717 * incremental.h (enum Incremental_input_flags): New type.
3718 (class Incremental_checker): Remove.
3719 (Incremental_input_entry::Incremental_input_entry): Add argument
3721 (Incremental_input_entry::arg_serial): New function.
3722 (Incremental_input_entry::set_is_in_system_directory): New function.
3723 (Incremental_input_entry::is_in_system_directory): New function.
3724 (Incremental_input_entry::arg_serial_): New data member.
3725 (Incremental_input_entry::is_in_system_directory_): New data member.
3726 (class Script_info): Move here from script.h.
3727 (Script_info::Script_info): Add filename parameter.
3728 (Script_info::filename): New function.
3729 (Script_info::filename_): New data member.
3730 (Incremental_script_entry::Incremental_script_entry): Add argument
3732 (Incremental_object_entry::Incremental_object_entry): Likewise.
3733 (Incremental_object_entry::add_input_section): Build list of input
3734 sections with map to original shndx.
3735 (Incremental_object_entry::get_input_section_index): New function.
3736 (Incremental_object_entry::shndx_): New data member.
3737 (Incremental_object_entry::name_key_): Rename; adjust all refs.
3738 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3739 (Incremental_archive_entry::Incremental_archive_entry): Add argument
3741 (Incremental_inputs::report_archive_begin): Likewise.
3742 (Incremental_inputs::report_object): Likewise.
3743 (Incremental_inputs::report_script): Likewise.
3744 (class Incremental_global_symbol_reader): New class.
3745 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3746 and store flags and input file type.
3747 (Incremental_input_entry_reader::arg_serial): New function.
3748 (Incremental_input_entry_reader::type): Extract type from flags.
3749 (Incremental_input_entry_reader::is_in_system_directory): New function.
3750 (Incremental_input_entry_reader::get_input_section_count): Call
3751 accessor function for type.
3752 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3753 function for type; adjust size of global symbol entry.
3754 (Incremental_input_entry_reader::get_global_symbol_count): Call
3755 accessor function for type.
3756 (Incremental_input_entry_reader::get_object_count): Likewise.
3757 (Incremental_input_entry_reader::get_object_offset): Likewise.
3758 (Incremental_input_entry_reader::get_member_count): Likewise.
3759 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3760 (Incremental_input_entry_reader::get_member_offset): Likewise.
3761 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3762 (Incremental_input_entry_reader::Global_symbol_info): Remove.
3763 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3764 (Incremental_input_entry_reader::get_global_symbol_reader): New
3766 (Incremental_input_entry_reader::get_output_symbol_index): New
3768 (Incremental_input_entry_reader::type_): Remove.
3769 (Incremental_input_entry_reader::flags_): New data member.
3770 (Incremental_inputs_reader::input_file_offset): New function.
3771 (Incremental_inputs_reader::input_file_index): New function.
3772 (Incremental_inputs_reader::input_file): Call input_file_offset.
3773 (Incremental_inputs_reader::input_file_at_offset): New function.
3774 (Incremental_relocs_reader::get_r_type): Reformat.
3775 (Incremental_relocs_reader::get_r_shndx): Reformat.
3776 (Incremental_relocs_reader::get_r_offset): Reformat.
3777 (Incremental_relocs_reader::data): New function.
3778 (Incremental_binary::Incremental_binary): Initialize new data members.
3779 (Incremental_binary::check_inputs): Add cmdline parameter.
3780 (Incremental_binary::file_is_unchanged): Remove.
3781 (Input_reader::arg_serial): New function.
3782 (Input_reader::get_unused_symbol_count): New function.
3783 (Input_reader::get_unused_symbol): New function.
3784 (Input_reader::do_arg_serial): New function.
3785 (Input_reader::do_get_unused_symbol_count): New function.
3786 (Input_reader::do_get_unused_symbol): New function.
3787 (Incremental_binary::input_file_count): New function.
3788 (Incremental_binary::get_input_reader): Change signature to use
3789 index instead of filename.
3790 (Incremental_binary::file_has_changed): New function.
3791 (Incremental_binary::get_input_argument): New function.
3792 (Incremental_binary::get_library): New function.
3793 (Incremental_binary::get_script_info): New function.
3794 (Incremental_binary::init_layout): New function.
3795 (Incremental_binary::reserve_layout): New function.
3796 (Incremental_binary::output_file): New function.
3797 (Incremental_binary::do_check_inputs): New function.
3798 (Incremental_binary::do_file_is_unchanged): Remove.
3799 (Incremental_binary::do_file_has_changed): New function.
3800 (Incremental_binary::do_init_layout): New function.
3801 (Incremental_binary::do_reserve_layout): New function.
3802 (Incremental_binary::do_input_file_count): New function.
3803 (Incremental_binary::do_get_input_reader): Change signature.
3804 (Incremental_binary::input_args_map_): New data member.
3805 (Incremental_binary::library_map_): New data member.
3806 (Incremental_binary::script_map_): New data member.
3807 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3809 (Sized_incremental_binary::output_section): New function.
3810 (Sized_incremental_binary::inputs_reader): Add const.
3811 (Sized_incremental_binary::symtab_reader): Add const.
3812 (Sized_incremental_binary::relocs_reader): Add const.
3813 (Sized_incremental_binary::got_plt_reader): Add const.
3814 (Sized_incremental_binary::get_symtab_view): New function.
3815 (Sized_incremental_binary::Inputs_reader): New typedef.
3816 (Sized_incremental_binary::Input_entry_reader): New typedef.
3817 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3818 (Sized_incremental_binary::do_file_is_unchanged): Remove.
3819 (Sized_incremental_binary::do_file_has_changed): New function.
3820 (Sized_incremental_binary::do_init_layout): New function.
3821 (Sized_incremental_binary::do_reserve_layout): New function.
3822 (Sized_input_reader::Inputs_reader): Remove.
3823 (Sized_input_reader::Input_entry_reader): Remove.
3824 (Sized_input_reader::do_arg_serial): New function.
3825 (Sized_input_reader::do_get_unused_symbol_count): New function.
3826 (Sized_input_reader::do_get_unused_symbol): New function.
3827 (Sized_incremental_binary::do_input_file_count): New function.
3828 (Sized_incremental_binary::do_get_input_reader): Change signature;
3829 use index instead of filename.
3830 (Sized_incremental_binary::section_map_): New data member.
3831 (Sized_incremental_binary::input_entry_readers_): New data member.
3832 (class Sized_incr_relobj): New class.
3833 (class Sized_incr_dynobj): New class.
3834 (make_sized_incremental_object): New function.
3835 (class Incremental_library): New class.
3836 * layout.cc (Free_list::num_lists): New static data member.
3837 (Free_list::num_nodes): New static data member.
3838 (Free_list::num_removes): New static data member.
3839 (Free_list::num_remove_visits): New static data member.
3840 (Free_list::num_allocates): New static data member.
3841 (Free_list::num_allocate_visits): New static data member.
3842 (Free_list::init): New function.
3843 (Free_list::remove): New function.
3844 (Free_list::allocate): New function.
3845 (Free_list::dump): New function.
3846 (Free_list::print_stats): New function.
3847 (Layout_task_runner::run): Resize output file for incremental updates.
3848 (Layout::Layout): Initialize new data members.
3849 (Layout::set_incremental_base): New function.
3850 (Layout::init_fixed_output_section): New function.
3851 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3852 incremental updates.
3853 (Layout::create_gold_note): Do not create gold note section for
3854 incremental updates.
3855 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3856 for incremental updates.
3857 (Layout::set_section_offsets): For incremental updates, allocate space
3859 (Layout::create_symtab_sections): Layout with offsets relative to
3860 start of section; for incremental updates, allocate space from free
3862 (Layout::create_shdrs): For incremental updates, allocate space from
3864 (Layout::finish_dynamic_section): For incremental updates, do not
3865 check --as-needed (fixed in subsequent patch).
3866 * layout.h (class Free_list): New class.
3867 (Layout::set_incremental_base): New function.
3868 (Layout::incremental_base): New function.
3869 (Layout::init_fixed_output_section): New function.
3870 (Layout::allocate): New function.
3871 (Layout::incremental_base_): New data member.
3872 (Layout::free_list_): New data member.
3873 * main.cc (main): Print Free_list statistics.
3874 * object.cc (Relobj::finalize_incremental_relocs): Add
3875 clear_counts parameter; clear counts only when clear_counts is set.
3876 (Sized_relobj::Sized_relobj): Initialize new base class.
3877 (Sized_relobj::do_layout): Don't report special sections.
3878 (Sized_relobj::do_for_all_local_got_entries): New function.
3879 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3880 symtab_off to all symbol table offsets.
3881 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3882 * object.h (class Got_offset_list): Move to top of file.
3883 (Object::Object): Allow case where input_file == NULL.
3884 (Object::~Object): Likewise.
3885 (Object::input_file): Assert that input_file != NULL.
3886 (Object::lock): Allow case where input_file == NULL.
3887 (Object::unlock): Likewise.
3888 (Object::is_locked): Likewise.
3889 (Object::token): Likewise.
3890 (Object::release): Likewise.
3891 (Object::is_incremental): New function.
3892 (Object::get_mtime): New function.
3893 (Object::for_all_local_got_entries): New function.
3894 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3895 (Object::set_is_in_system_directory): New function.
3896 (Object::is_in_system_directory): New function.
3897 (Object::do_is_incremental): New function.
3898 (Object::do_get_mtime): New function.
3899 (Object::do_for_all_local_got_entries): New function.
3900 (Object::is_in_system_directory_): New data member.
3901 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3902 (class Sized_relobj_base): New class.
3903 (class Sized_relobj): Derive from Sized_relobj_base.
3904 (class Sized_relobj::Symbols): Redeclare from base class.
3905 (class Sized_relobj::local_got_offset_list): Remove.
3906 (class Sized_relobj::Output_sections): Redeclare from base class.
3907 (class Sized_relobj::do_for_all_local_got_entries): New function.
3908 (class Sized_relobj::write_local_symbols): Add offset parameter.
3909 (class Sized_relobj::local_symbol_offset_): Update comment.
3910 (class Sized_relobj::local_dynsym_offset_): Update comment.
3911 * options.cc (Input_arguments::add_file): Remove const.
3912 * options.h (Input_file_argument::Input_file_argument):
3913 Initialize arg_serial_ (all constructors).
3914 (Input_file_argument::set_arg_serial): New function.
3915 (Input_file_argument::arg_serial): New function.
3916 (Input_file_argument::arg_serial_): New data member.
3917 (Input_arguments::Input_arguments): Initialize file_count_.
3918 (Input_arguments::add_file): Remove const.
3919 (Input_arguments::number_of_input_files): New function.
3920 (Input_arguments::file_count_): New data member.
3921 (Command_line::number_of_input_files): Call
3922 Input_arguments::number_of_input_files.
3923 * output.cc (Output_segment_headers::Output_segment_headers):
3925 (Output_section::Input_section::current_data_size): New function.
3926 (Output_section::Output_section): Initialize new data members.
3927 (Output_section::add_input_section): Don't do merge sections for
3928 an incremental link; allocate space from free list for an
3930 (Output_section::add_output_section_data): Allocate space from
3931 free list for an incremental update.
3932 (Output_section::update_data_size): New function.
3933 (Output_section::set_fixed_layout): New function.
3934 (Output_section::reserve): New function.
3935 (Output_segment::set_section_addresses): Remove const.
3936 (Output_segment::set_section_list_addresses): Remove const; allocate
3937 space from free list for an incremental update.
3938 (Output_segment::set_offset): Adjust size of RELRO segment for an
3940 * output.h (Output_data::current_data_size): Move here from
3942 (Output_data::pre_finalize_data_size): New function.
3943 (Output_data::update_data_size): New function.
3944 (Output_section_headers::update_data_size): new function.
3945 (Output_section_data_build::current_data_size): Move to Output_data.
3946 (Output_data_strtab::update_data_size): New function.
3947 (Output_section::current_data_size): Move to Output_data.
3948 (Output_section::set_fixed_layout): New function.
3949 (Output_section::has_fixed_layout): New function.
3950 (Output_section::reserve): New function.
3951 (Output_section::update_data_size): New function.
3952 (Output_section::has_fixed_layout_): New data member.
3953 (Output_section::free_list_): New data member.
3954 (Output_segment::set_section_addresses): Remove const.
3955 (Output_segment::set_section_list_addresses): Remove const.
3956 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3958 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3960 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3961 parameter when calling Add_symbols constructor; store argument
3962 serial number for members of a lib group.
3963 (Add_symbols::locks): Allow case where token == NULL.
3964 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3965 (Read_member::~Read_member): New function.
3966 (Read_member::is_runnable): New function.
3967 (Read_member::locks): New function.
3968 (Read_member::run): New function.
3969 (Check_script::~Check_script): New function.
3970 (Check_script::is_runnable): New function.
3971 (Check_script::locks): New function.
3972 (Check_script::run): New function.
3973 (Check_library::~Check_library): New function.
3974 (Check_library::is_runnable): New function.
3975 (Check_library::locks): New function.
3976 (Check_library::run): New function.
3977 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3978 (Add_symbols::library_): New data member.
3979 (class Read_member): New class.
3980 (class Check_script): New class.
3981 (class Check_library): New class.
3982 * reloc.cc (Read_relocs::is_runnable): Allow case where
3984 (Read_relocs::locks): Likewise.
3985 (Scan_relocs::locks): Likewise.
3986 (Relocate_task::locks): Likewise.
3987 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3989 (Sized_relobj::incremental_relocs_scan): Fix comment.
3990 (Sized_relobj::do_relocate): Pass output file offset to
3991 write_local_symbols.
3992 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3993 from class declaration.
3994 * script.cc (read_input_script): Allocate Script_info; pass
3995 argument serial number to report_script.
3996 * script.h (class Script_info): Move to incremental.h.
3997 * symtab.cc (Symbol_table::add_from_incrobj): New function.
3998 * symtab.h (Symbol_table::add_from_incrobj): New function.
3999 (Symbol_table::set_file_offset): New function.
4001 2011-04-05 Cary Coutant <ccoutant@google.com>
4003 * incremental-dump.cc (dump_incremental_inputs): Change signature
4004 to take a Sized_incremental_binary; change caller. Use readers
4005 in Sized_incremental_binary.
4007 (Sized_incremental_binary::find_incremental_inputs_sections):
4008 Rename do_find_incremental_inputs_sections to this.
4009 (Sized_incremental_binary::setup_readers): New function.
4010 (Sized_incremental_binary::do_check_inputs): Check
4011 has_incremental_info_ flag; move setup code to setup_readers;
4013 (Sized_incremental_binary::do_file_is_unchanged): New function.
4014 (Sized_incremental_binary::do_get_input_reader): New function.
4015 * incremental.h (class Incremental_binary): Move to end of file.
4016 (Incremental_binary::file_is_unchanged): New function.
4017 (Incremental_binary::do_file_is_unchanged): New function.
4018 (Incremental_binary::Input_reader): New class.
4019 (Incremental_binary::get_input_reader): New function.
4020 (class Sized_incremental_binary): Move to end of file.
4021 (Sized_incremental_binary::Sized_incremental_binary): Setup the
4022 input section reader classes.
4023 (Sized_incremental_binary::has_incremental_info): New function.
4024 (Sized_incremental_binary::inputs_reader): New function.
4025 (Sized_incremental_binary::symtab_reader): New function.
4026 (Sized_incremental_binary::relocs_reader): New function.
4027 (Sized_incremental_binary::got_plt_reader): New function.
4028 (Sized_incremental_binary::do_file_is_unchanged): New function.
4029 (Sized_incremental_binary::Sized_input_reader): New class.
4030 (Sized_incremental_binary::get_input_reader): New function.
4031 (Sized_incremental_binary::find_incremental_inputs_sections):
4032 Rename do_find_incremental_inputs_sections to this.
4033 (Sized_incremental_binary::setup_readers): New function.
4034 (Sized_incremental_binary::has_incremental_info_): New data member.
4035 (Sized_incremental_binary::inputs_reader_): New data member.
4036 (Sized_incremental_binary::symtab_reader_): New data member.
4037 (Sized_incremental_binary::relocs_reader_): New data member.
4038 (Sized_incremental_binary::got_plt_reader_): New data member.
4039 (Sized_incremental_binary::current_input_file_): New data member.
4041 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
4044 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4047 2011-03-30 Cary Coutant <ccoutant@google.com>
4049 * archive.cc (Archive::include_member): Adjust call to report_object.
4050 (Add_archive_symbols::run): Add script_info to call to
4051 report_archive_begin.
4052 (Lib_group::include_member): Adjust call to report_object.
4053 (Add_lib_group_symbols::run): Adjust call to report_object.
4054 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4055 blocks. Add object count for script input files.
4056 * incremental.cc (Incremental_inputs::report_archive_begin): Add
4057 script_info parameter; change all callers.
4058 (Incremental_inputs::report_object): Add script_info parameter;
4060 (Incremental_inputs::report_script): Store backpointer to
4061 incremental info entry.
4062 (Output_section_incremental_inputs::set_final_data_size): Record
4063 additional information for scripts.
4064 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4065 * incremental.h (Incremental_script_entry::add_object): New function.
4066 (Incremental_script_entry::get_object_count): New function.
4067 (Incremental_script_entry::get_object): New function.
4068 (Incremental_script_entry::objects_): New data member; adjust
4070 (Incremental_inputs::report_archive_begin): Add script_info parameter.
4071 (Incremental_inputs::report_object): Add script_info parameter.
4072 (Incremental_inputs_reader::get_object_count): New function.
4073 (Incremental_inputs_reader::get_object_offset): New function.
4074 * options.cc (Input_arguments::add_file): Return reference to
4076 * options.h (Input_argument::set_script_info): New function.
4077 (Input_argument::script_info): New function.
4078 (Input_argument::script_info_): New data member; adjust all
4080 (Input_file_group::add_file): Return reference to new input argument.
4081 (Input_file_lib::add_file): Likewise.
4082 (Input_arguments::add_file): Likewise.
4083 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4084 * script.cc (Parser_closure::Parser_closure): Add script_info
4085 parameter; adjust all callers.
4086 (Parser_closure::script_info): New function.
4087 (Parser_closure::script_info_): New data member.
4088 (read_input_script): Report scripts earlier to incremental info.
4089 (script_add_file): Set script_info in Input_argument.
4090 (script_add_library): Likewise.
4091 * script.h (Script_options::Script_info): Rewrite class.
4093 2011-03-29 Cary Coutant <ccoutant@google.com>
4095 * archive.cc (Library_base::should_include_member): Move
4096 method here from class Archive.
4097 (Archive::Archive): Initialize base class.
4098 (Archive::should_include_member): Move to base class.
4099 (Archive::do_for_all_unused_symbols): New function.
4100 (Add_archive_symbols::run): Remove redundant access to
4102 (Lib_group::Lib_group): Initialize base class.
4103 (Lib_group::do_filename): New function.
4104 (Lib_group::include_member): Pass pointer to Lib_group to
4106 (Lib_group::do_for_all_unused_symbols): New function.
4107 (Add_lib_group_symbols::run): Report archive information for
4109 * archive.h (class Library_base): New base class.
4110 (class Archive): Derive from Library_base.
4111 (Archive::filename): Move to base class.
4112 (Archive::set_incremental_info): Likewise.
4113 (Archive::incremental_info): Likewise.
4114 (Archive::Should_include): Likewise.
4115 (Archive::should_include_member): Likewise.
4116 (Archive::Armap_entry): Remove.
4117 (Archive::Unused_symbol_iterator): Remove.
4118 (Archive::unused_symbols_begin): Remove.
4119 (Archive::unused_symbols_end): Remove.
4120 (Archive::do_filename): New function.
4121 (Archive::do_get_mtime): New function.
4122 (Archive::do_for_all_unused_symbols): New function.
4123 (Archive::task_): Move to base class.
4124 (Archive::incremental_info_): Likewise.
4125 (class Lib_group): Derive from Library_base.
4126 (Lib_group::do_filename): New function.
4127 (Lib_group::do_get_mtime): New function.
4128 (Lib_group::do_for_all_unused_symbols): New function.
4129 (Lib_group::task_): Move to base class.
4130 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4132 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4134 * incremental.cc (Incremental_inputs::report_archive_begin):
4135 Use Library_base; call library's get_mtime; add incremental inputs
4136 entry before members.
4137 (class Unused_symbol_visitor): New class.
4138 (Incremental_inputs::report_archive_end): Use Library_base; use
4139 visitor class to record unused symbols; don't add incremental inputs
4140 entry after members.
4141 (Incremental_inputs::report_object): Use Library_base.
4143 (Incremental_archive_entry::Incremental_archive_entry): Remove
4144 unused Archive parameter.
4145 (Incremental_inputs::report_archive_begin): Use Library_base.
4146 (Incremental_inputs::report_archive_end): Likewise.
4147 (Incremental_inputs::report_object): Likewise.
4148 * object.cc (Sized_relobj::do_for_all_global_symbols): New
4150 * object.h (Object::for_all_global_symbols): New function.
4151 (Object::do_for_all_global_symbols): New function.
4152 (Sized_relobj::do_for_all_global_symbols): New function.
4153 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
4155 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
4158 2011-03-27 Ian Lance Taylor <iant@google.com>
4160 * archive.cc (Archive::interpret_header): Return -1 if something
4161 goes wrong. Change callers accordingly.
4163 2011-03-25 Cary Coutant <ccoutant@google.com>
4165 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4166 * testsuite/Makefile.in: Regenerate.
4168 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
4170 * plugin.cc (get_view): New.
4171 (Plugin::load): Pass get_view to the plugin.
4172 (Plugin_manager::get_view): New.
4174 2011-03-21 Ian Lance Taylor <iant@google.com>
4176 * testsuite/final_layout.sh: Rewrite to not use dc.
4177 * testsuite/relro_test.sh: Fail if dc is not present.
4179 2011-03-21 Sriraman Tallam <tmsriram@google.com>
4181 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4183 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4184 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4186 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4187 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4189 2011-03-14 Ian Lance Taylor <iant@google.com>
4191 * script-sections.cc (Sort_output_sections::script_compare):
4192 Rename from is_before, change return type.
4193 (Sort_output_sections::operator()): Adjust accordingly.
4195 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
4198 * testsuite/odr_violation2.cc: Add comment to make all error line
4199 numbers double digits.
4200 * testsuite/debug_msg.sh: Adjust expected errors.
4202 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
4204 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4205 but mark earlier ones as non-canonical
4206 (offset_to_iterator): Update search target and example
4207 (do_addr2line): Return extra lines in a vector*
4208 (format_file_lineno): Extract from do_addr2line
4209 (one_addr2line): Add vector* out-param
4210 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4211 when a lineno entry appeared last for its instruction
4212 (Dwarf_line_info): Add vector* out-param
4213 * object.cc (Relocate_info): Pass NULL for the vector* out-param
4214 * symtab.cc (Odr_violation_compare): Include the lineno in the
4216 (linenos_from_loc): New. Combine the canonical line for an
4217 address with its other lines.
4218 (True_if_intersect): New. Helper functor to make
4219 std::set_intersection a query.
4220 (detect_odr_violations): Compare sets of lines instead of just
4221 one line for each function. This became less deterministic, but
4222 has fewer false positives.
4223 * symtab.h: Declarations.
4224 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4225 mix an optimized and non-optimized object in the same binary
4226 (odr_violation2.so): Same.
4227 * testsuite/Makefile.in: Regenerate from Makefile.am.
4228 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4229 * testsuite/debug_msg.sh: Update line numbers and add
4231 * testsuite/odr_violation1.cc: Use OdrDerived, in a
4232 non-optimized context.
4233 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4234 isn't inlined, and use OdrDerived in an optimized context.
4235 * testsuite/odr_header1.h: Defines OdrDerived, where
4236 optimization will change the
4237 first-instruction-in-the-destructor's file and line number.
4238 * testsuite/odr_header2.h: Defines OdrBase.
4240 2011-03-09 Ian Lance Taylor <iant@google.com>
4242 * fileread.cc (File_read::clear_views): Don't delete the whole
4245 2011-03-08 Ian Lance Taylor <iant@google.com>
4248 * fileread.cc: #include <climits>.
4249 (GOLD_IOV_MAX): Define.
4250 (File_read::read_multiple): Limit number of entries by iov_max.
4251 * fileread.h (class File_read): Always set max_readv_entries to
4254 2011-03-07 Ian Lance Taylor <iant@google.com>
4257 * options.h (class General_options): Add -dy and -dn.
4259 2011-03-02 Cary Coutant <ccoutant@google.com>
4261 * testsuite/script_test_9.t: Add TLS segment.
4263 2011-03-02 Simon Baldwin <simonb@google.com>
4265 * configure.ac: Add check for gnu_indirect_function support in
4266 the toolchain building binutils.
4267 * configure: Rebuild.
4269 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
4271 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4272 plugin only symbols.
4273 (Symbol_table::sized_finalize_symbol) Mark symbol only present
4274 in plugin files as not needed in the symbol table.
4276 2011-02-11 Sriraman Tallam <tmsriram@google.com>
4278 * output.cc (Output_section::add_input_section): Delay fill
4279 generation for section ordering.
4281 2011-02-09 Ian Lance Taylor <iant@google.com>
4284 * object.h (class Sized_relobj): Remove clear_local_symbols.
4285 * reloc.cc (Sized_relobj::do_relocate): Don't call
4286 clear_local_symbols.
4288 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
4290 * plugin.cc (is_visible_from_outside): Return true for symbols
4293 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
4295 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4298 2011-02-02 Sriraman Tallam <tmsriram@google.com>
4300 * icf.h (is_section_foldable_candidate): Change type of parameter
4302 * icf.cc (Icf::find_identical_sections): Change type of local variable
4303 section_name to be std::string.
4304 (is_function_ctor_or_dtor): Change type of parameter to std::string.
4306 2011-01-25 Ian Lance Taylor <iant@google.com>
4308 * script.cc (script_add_extern): Rewrite to use
4309 add_symbol_reference.
4311 2011-01-25 Doug Kwan <dougkwan@google.com>
4313 * icf.cc (get_section_contents): Always lock section's object.
4315 2011-01-24 Ian Lance Taylor <iant@google.com>
4317 * options.h (class General_options): Accept
4318 --no-detect-odr-violations.
4320 2011-01-24 Ian Lance Taylor <iant@google.com>
4322 * version.cc (version_string): Bump to 1.11.
4324 2011-01-24 Ian Lance Taylor <iant@google.com>
4326 * plugin.cc (class Plugin_rescan): Define new class.
4327 (Plugin_manager::claim_file): Set any_claimed_.
4328 (Plugin_manager::save_archive): New function.
4329 (Plugin_manager::save_input_group): New function.
4330 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4332 (Plugin_manager::new_undefined_symbol): New function.
4333 (Plugin_manager::rescan): New function.
4334 (Plugin_manager::rescannable_defines): New function.
4335 (Plugin_manager::add_input_file): Set any_added_.
4336 * plugin.h (class Plugin_manager): define new fields rescannable_,
4337 undefined_symbols_, any_claimed_, and any_added_. Declare
4338 Plugin_rescan as friend. Declare new functions.
4339 (Plugin_manager::Rescannable): Define type.
4340 (Plugin_manager::Rescannable_list): Define type.
4341 (Plugin_manager::Undefined_symbol_list): Define type.
4342 (Plugin_manager::Plugin_manager): Initialize new fields.
4343 * archive.cc (Archive::defines_symbol): New function.
4344 (Add_archive_symbols::run): Pass archive to plugins if any.
4345 * archive.h (class Archive): Declare defines_symbol.
4346 * readsyms.cc (Input_group::~Input_group): New function.
4347 (Finish_group::run): Pass input_group to plugins if any.
4348 * readsyms.h (class Input_group): Declare destructor.
4349 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4352 2011-01-10 Ian Lance Taylor <iant@google.com>
4354 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4356 (Layout::set_segment_offsets): Reset increase_relro before calling
4357 set_section_addresses a second time.
4359 2011-01-04 Cary Coutant <ccoutant@google.com>
4361 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4362 sections before NOBITS sections.
4364 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
4366 * version.cc (print_version): Update copyright to 2011.
4368 2010-12-23 Cary Coutant <ccoutant@google.com>
4370 * output.h (Output_data_reloc::add_output_section): Pass OD instead
4371 of OS to this->add. Add OD parameter to second form of the function.
4373 2010-12-20 Ian Lance Taylor <iant@google.com>
4375 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4376 second of two consecutive entries with same offset.
4378 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4380 * testsuite/Makefile.am (ifuncmain2static_LDADD)
4381 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4382 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4383 to avoid unneeded links against $(LDADD).
4384 * testsuite/Makefile.in: Regenerate.
4386 2010-12-15 Ian Lance Taylor <iant@google.com>
4389 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4390 for R_X86_64_32 and R_X86_64_PC32.
4391 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4392 ver_matching_def_pic.o.
4393 (ver_matching_def_pic.o): New target.
4395 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4397 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4398 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4399 Move definition before File_read::View member definitions.
4400 (File_read::View::~View): Initialize and hold lock before
4401 updating current_mapped_bytes.
4403 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4405 * dwarf_reader.cc: Remove outdated comment.
4406 * gold-threads.cc: Fix typo in error message.
4407 * archive.cc: Fix typos in comments.
4408 * archive.h: Likewise.
4409 * arm-reloc-property.cc: Likewise.
4410 * arm-reloc-property.h: Likewise.
4411 * arm-reloc.def: Likewise.
4413 * attributes.h: Likewise.
4414 * cref.cc: Likewise.
4415 * ehframe.cc: Likewise.
4416 * fileread.h: Likewise.
4418 * i386.cc: Likewise.
4420 * incremental.h: Likewise.
4421 * int_encoding.cc: Likewise.
4422 * layout.h: Likewise.
4423 * main.cc: Likewise.
4424 * merge.h: Likewise.
4425 * object.cc: Likewise.
4426 * object.h: Likewise.
4427 * options.cc: Likewise.
4428 * readsyms.cc: Likewise.
4429 * reduced_debug_output.cc: Likewise.
4430 * reloc.cc: Likewise.
4431 * script-sections.cc: Likewise.
4432 * sparc.cc: Likewise.
4433 * symtab.h: Likewise.
4434 * target-reloc.h: Likewise.
4435 * target.cc: Likewise.
4436 * target.h: Likewise.
4437 * timer.cc: Likewise.
4438 * timer.h: Likewise.
4439 * x86_64.cc: Likewise.
4441 2010-12-09 Cary Coutant <ccoutant@google.com>
4443 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4445 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4446 parameter; change all callers.
4447 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4448 * options.h (warn_execstack): New option.
4450 2010-12-07 Doug Kwan <dougkwan@google.com>
4452 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4453 like function call relocations.
4455 2010-12-07 Ian Lance Taylor <iant@google.com>
4457 * archive.cc (Archive::get_elf_object_for_member): Permit
4458 punconfigured to be NULL.
4459 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4460 (Archive::include_member): Pass NULL to get_elf_object_for_member
4461 if we searched for the archive and this is the first included
4464 2010-12-01 Ian Lance Taylor <iant@google.com>
4466 * dwarf_reader.h (class Sized_dwarf_line_info): Add
4467 track_relocs_type_ field.
4468 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4469 Set track_relocs_type_.
4470 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4471 contents when using RELA relocs.
4472 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4474 * reloc.cc (Track_relocs::next_addend): New function.
4475 * reloc.h (class Track_relocs): Declare next_addend.
4477 2010-12-01 Ian Lance Taylor <iant@google.com>
4479 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4482 2010-12-01 Ian Lance Taylor <iant@google.com>
4484 * README: Update compilers known to work and fail.
4486 2010-11-23 Matthias Klose <doko@ubuntu.com>
4488 * configure.in: For --enable-gold, handle value `default' instead of
4489 `both*'. Always install ld as ld.bfd, install as ld if gold is
4491 * configure: Regenerate.
4493 2010-11-18 Doug Kwan <dougkwan@google.com>
4495 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4496 and right_alignment to be zero. Store result alignment only if it is
4497 greater than existing alignment.
4499 2010-11-16 Cary Coutant <ccoutant@google.com>
4502 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4503 Check for ".zdebug_line".
4505 2010-11-16 Doug Kwan <dougkwan@google.com>
4506 Cary Coutant <ccoutant@google.com>
4508 * output.h (Output_segment::set_section_addresses): Pass increase_relro
4509 by reference; adjust all callers.
4510 * output.cc (Output_segment::set_section_addresses): Adjust references
4511 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4513 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4514 end at page boundary.
4516 2010-11-16 Cary Coutant <ccoutant@google.com>
4519 * layout.cc (Layout::choose_output_section): Transform names of
4520 compressed sections even when using a script with a SECTIONS clause.
4521 (Layout::output_section_name): Remove code to transform
4522 compressed debug section names.
4523 * output.cc (Output_section::add_input_section): Use uncompressed
4524 section size when tracking input sections.
4526 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
4528 * symtab.h (Symbol::NON_PIC_REF): Remove.
4529 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4530 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
4531 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4532 (Symbol::use_plt_offset): Take a flags argument and pass it
4533 directly to needs_dynamic_reloc. Restrict check for undefined
4534 weak symbols to function calls.
4535 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4536 (Target_arm::Scan::global): Use it.
4537 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4538 (Target_arm::Relocate::relocate): Likewise.
4539 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4540 parameter with an r_type parameter. Use get_reference_flags
4542 (Target_arm::Relocate::relocate): Update accordingly.
4543 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4544 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4545 (Target_i386::Scan::global): Likewise.
4546 (Target_i386::Relocate::relocate): Likewise.
4547 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4548 parameter with an r_type parameter. Use get_reference_flags
4550 (Target_i386::Relocate::relocate): Update accordingly.
4551 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4552 (Target_powerpc::Scan::global): Use it.
4553 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4554 (Target_powerpc::Relocate::relocate): Likewise.
4555 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4556 (Target_sparc::Scan::global): Use it.
4557 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4558 (Target_sparc::Relocate::relocate): Likewise.
4559 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4560 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4561 (Target_x86_64::Scan::global): Likewise.
4562 (Target_x86_64::Relocate::relocate): Likewise.
4564 2010-11-08 Doug Kwan <dougkwan@google.com>
4565 Cary Coutant <ccoutant@google.com>
4567 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4568 (Arm_exidx_merge_section::section_contents_): New data member.
4569 (Arm_input_section::Arm_input_section): Initialize original_contents_.
4570 (Arm_input_section::~Arm_input_section): De-allocate memory.
4571 (Arm_input_section::original_contents_): New data member.
4572 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4573 in parameters instead of calling Object::section_contents without
4575 (Arm_output_section::group_section): New parameter TASK. Pass it
4576 to callees that need locking objects.
4577 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
4578 to lock EXIDX input sections. Fix a formatting issue. Call
4579 Arm_exidx_merged_section::build_contents to create merged section
4581 (Arm_output_section::create_stub_group): New parameter TASK. Use it
4582 to lock object of stub table owner.
4583 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4584 TEXT_SIZE to initialize data member TEXT_SIZE_.
4585 (Arm_exidx_input_section::addralign): Fix typo in comment.
4586 (Arm_exidx_input_section::text_size): New method.
4587 (Target_arm::do_relax): New parameter TASK. Pass it to callees
4588 that require locking objects. Lock objects before scanning for stubs
4589 and updating local symbols.
4590 (Arm_input_section<big_endian>::init): Copy contents of original
4592 (Arm_input_section<big_endian>::do_write): Use saved contents of
4593 original input section instead of calling Object::section_contents
4595 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4596 size without calling Object::section_size().
4597 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4598 for size. Allocate a buffer for merged EXIDX entries.
4599 (Arm_exidx_merged_section::build_contents): New method.
4600 (Arm_exidx_merged_section::do_write): Move merge section contents
4601 building code to Arm_exidx_merged_section::build_contetns. Write
4602 out contetns in buffer instead of building it on the fly.
4603 (Arm_relobj::make_exidx_input_section): Also pass text section size
4604 to Arm_exidx_input_section constructor.
4605 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
4606 (Arm_dynobj::do_read_symbols): Fix memory leak.
4607 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4608 * target.h: (class Task): Add forward declaration.
4609 (Target::relax): Add new parameter TASK and pass it to
4611 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
4613 2010-11-05 Cary Coutant <ccoutant@google.com>
4616 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4617 object when reading from the file.
4618 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4620 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4621 when reading section contents.
4622 (get_section_contents): Likewise.
4623 (icf::find_identical_sections): Likewise.
4624 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4625 object when reading from the file.
4626 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4627 the object when doing deferred section layout.
4629 2010-11-03 Nick Clifton <nickc@redhat.com>
4632 * script.h (class Symbol_assignment: name): New member. Returns
4633 the name of the symbol.
4634 * scrfipt.cc (Script_options::is_pending_assignment): New member.
4635 Returns true if the given symbol name is on the list of
4636 assignments wating to be processed.
4637 * archive.cc (should_incldue_member): If the symbol is undefined,
4638 check to see if it is on the list of symbols pending assignment.
4640 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
4642 * script-sections.cc (Script_sections::find_memory_region): Check
4643 for a NULL output section pointer.
4645 2010-10-29 Doug Kwan <dougkwan@google.com>
4647 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4648 Output_section::add_relaxed_input_section.
4649 * output.cc (Output_section::add_relaxed_input_section): Add new
4650 arguments LAYOUT and NAME. Set section order index.
4651 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4652 Copy section order index.
4653 * output.h (Output_section::add_relaxed_input_section): Add new
4654 arguments LAYOUT and NAME.
4656 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4658 * testsuite/Makefile.am: Move gcctestdir/ld rule to
4659 NATIVE_OR_CROSS_LINKER.
4660 * testsuite/Makefile.in: Regenerate.
4662 2010-10-20 Doug Kwan <dougkwan@google.com>
4664 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4665 without SHF_LINK_ORDER flags.
4666 * layout.cc (Layout::choose_output_section): Do not filter
4667 SHF_LINK_ORDER flag in a relocatable link.
4669 2010-10-17 Cary Coutant <ccoutant@google.com>
4671 * output.h (Output_segment::set_section_addresses): Change function
4672 signature. Update all callers.
4673 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4675 (Output_segment::set_section_addresses): Align after last TLS
4676 section. Add padding before last relro section instead of after.
4678 2010-10-17 Doug Kwan <dougkwan@google.com>
4680 * gold/arm.cc (Target_arm::got_section): Use correct order and set
4681 GOT output section to be writable.
4683 2010-10-14 Cary Coutant <ccoutant@google.com>
4685 * debug.h (DEBUG_INCREMENTAL): New flag.
4686 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4687 * gold.cc (queue_initial_tasks): Check parameters for incremental link
4689 * incremental.cc (report_command_line): Ignore all forms of
4691 * layout.cc (Layout::Layout): Check parameters for incremental link
4693 * options.cc (General_options::parse_incremental): New function.
4694 (General_options::parse_no_incremental): New function.
4695 (General_options::parse_incremental_full): New function.
4696 (General_options::parse_incremental_update): New function.
4697 (General_options::incremental_mode_): New data member.
4698 (General_options::finalize): Check incremental_mode_.
4699 * options.h (General_options): Update help text for --incremental.
4700 Add --no-incremental, --incremental-full, --incremental-update.
4701 (General_options::Incremental_mode): New enum type.
4702 (General_options::incremental_mode): New function.
4703 (General_options::incremental_mode_): New data member.
4704 * parameters.cc (Parameters::incremental_mode_): New data member.
4705 (Parameters::set_options): Set incremental_mode_.
4706 (Parameters::set_incremental_full): New function.
4707 (Parameters::incremental): New function.
4708 (Parameters::incremental_update): New function.
4709 (set_parameters_incremental_full): New function.
4710 * parameters.h (Parameters::set_incremental_full): New function.
4711 (Parameters::incremental): New function.
4712 (Parameters::incremental_update): New function.
4713 (Parameters::incremental_mode_): New data member.
4714 (set_parameters_incremental_full): New function.
4715 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4716 incremental link mode.
4717 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4718 (Sized_relobj::do_relocate_sections): Likewise.
4719 * testsuite/Makefile.am (incremental_test): Use --incremental-full
4721 * testsuite/Makefile.in: Regenerate.
4722 * testsuite/incremental_test.sh: Filter all forms of --incremental.
4724 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4726 * script-sections.h (class Script_sections): Make
4727 Sections_elements typedef public.
4728 * script-sections.cc (class Sort_output_sections): Add elements_
4729 field. Add constructor which sets it; change all callers.
4730 (Sort_output_sections::is_before): New function.
4731 (Sort_output_sections::operator()): Call is_before.
4732 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4734 * testsuite/script_test_10.sh: New test. Test script section
4736 * testsuite/script_test_10.t: Likewise.
4737 * testsuite/script_test_10.s: Likewise.
4738 * testsuite/Makefile.am: Wrap the cross linker tests and the
4739 common tests into NATIVE_OR_CROSS_LINKER.
4740 (check_SCRIPTS): Add script_test_10.sh.
4741 (check_DATA): Add script_test_10.stdout.
4742 (script_test_10.o, script_test_10): New targets.
4743 (script_test_10.stdout): New target.
4744 * configure, testsuite/Makefile.in: Regenerate.
4746 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4748 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4749 error for the deprecated relocations.
4750 (Target_arm::Scan::global): Likewise.
4751 (Target_arm::Relocate::relocate): Likewise.
4753 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
4755 * fileread.cc (Input_file::find_file): Initialize *found_name
4756 and *namep when using the fallback search for case 4.
4758 2010-10-11 Cary Coutant <ccoutant@google.com>
4760 * options.h (class General_options): Redefine -z lazy as an alias for
4761 the negation of -z now.
4763 2010-10-11 Ian Lance Taylor <iant@google.com>
4765 * resolve.cc (symbol_to_bits): Report the value of the unsupported
4768 2010-10-06 Nick Clifton <nickc@redhat.com>
4770 * script-sections.cc(class Memory_region): Remove
4771 current_lma_offset_ field. Rename current_vma_offset_ to
4772 current_offset_. Add last_section_ field.
4773 (Memory_region::get_current_vma_address): Rename to
4774 get_current_address.
4775 (Memory_region::get_current_lma_address): Delete.
4776 (Memory_region::increment_vma_offset): Rename to
4778 (Memory_region::increment_lma_offset): Delete.
4779 (Memory_region::attributes_compatible): New method. Returns
4780 true if the provided section is compatible with the region.
4781 (Memory_region::get_last_section): New method. Returns the last
4782 section to use the region.
4783 (Memory_region::set_last_section): New method. Stores the last
4784 section to use the region.
4785 (Script_sections::block_in_region): New method. Returns true if
4786 a block of memory is contained within a region.
4787 (Script_sections::find_memory_region): New method. Locates a
4788 memory region to be used to set a VMA or LMA address.
4789 (Output_section_definition::set_section_addresses): Add code to
4790 check for addresses set by memory regions.
4791 (Output_segment::set_section_addresses): Remove memory region
4793 (Script_sections::create_segment): Add a warning if a header
4794 segment is created outside of any region.
4795 * script-sections.h (class Script_sections): Add prototypes for
4796 find_memory_region and block_in_region methods.
4797 * testsuite/memory_test.s: Use .long instead of .word.
4798 * testsuite/memory_test.t: Add some more output sections.
4799 * testsuite/memory_test.sh: Update expected output.
4801 2010-10-02 Doug Kwan <dougkwan@google.com>
4803 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4804 defintion to symtab.h
4805 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4806 declaration to defintion.
4808 2010-10-01 Nick Clifton <nickc@redhat.com>
4810 * expression.cc (eval): Replace dummy argument with NULL.
4811 (eval_maybe_dot): Check for a NULL result section pointer.
4812 (Symbol_expression::value): Likewise.
4813 (Dot_expression::value): Likewise.
4814 (BINARY_EXPRESSION): Likewise.
4815 (Max_expression::value): Likewise.
4816 (Min_expression::value): Likewise.
4817 (Absolute_expression::value): Likewise.
4818 (Addr_expression::value_from_output_section): Likewise.
4819 (Loaddddr_expression::value_from_output_section): Likewise.
4820 (Segment_start_expression::value): Likewise.
4821 * script-sections.cc
4822 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4824 (Sections_elememt_dot_assignment::set_section_addresses):
4826 (Output_data_expression::do_write_to_buffer): Likewise.
4827 (Output_section_definition::finalize_symbols): Likewise.
4828 (Output_section_definition::set_section_addresses): Likewise.
4830 2010-09-30 Doug Kwan <dougkwan@google.com>
4832 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4834 2010-09-28 Sriraman Tallam <tmsriram@google.com>
4836 * target.h (Target::can_icf_inline_merge_sections): New virtual
4838 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4840 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4842 * icf.cc (get_section_contents): Inline merge sections only when
4845 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4847 * configure: Regenerate.
4849 2010-09-17 Ian Lance Taylor <iant@google.com>
4851 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4852 * testsuite/Makefile.am (memory_test.o): New target.
4853 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4855 * testsuite/Makefile.in: Rebuild.
4857 2010-09-17 Doug Kwan <dougkwan@google.com>
4859 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4860 defintion if relocation uses GOT entries of the symbol.
4861 * testsuite/icf_safe_test.sh: Fix test.
4862 * testsuite/icf_safe_so_test.sh: Fix test.
4864 2010-09-16 Cary Coutant <ccoutant@google.com>
4866 * script_sections.cc (class Memory_region): Remove "NULL" from
4867 vector initializations.
4869 2010-09-15 Cary Coutant <ccoutant@google.com>
4871 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4872 Resolve forwarding symbols.
4874 2010-09-15 Doug Kwan <dougkwan@google.com>
4876 * gold/testsuite/script_test_3.t: Add ARM special sections.
4877 * gold/testsuite/script_test_4.t: Same.
4878 * gold/testsuite/script_test_5.t: Same.
4879 * gold/testsuite/script_test_6.t: Same.
4880 * gold/testsuite/script_test_7.t: Same.
4881 * gold/testsuite/script_test_7.t: Same.
4882 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4884 2010-09-14 Cary Coutant <ccoutant@google.com>
4886 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4887 (Target_x86_64::Relocate::relocate_tls): Replace check for
4888 saw_tls_block_reloc_ with test for executable section.
4890 2010-09-12 Cary Coutant <ccoutant@google.com>
4892 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4893 position-independent executables to shared libraries need dynamic
4895 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4896 position-independent executables.
4897 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4898 * testsuite/Makefile.in: Regenerate.
4900 2010-09-10 Nick Clifton <nickc@redhat.com>
4903 * testsuite/memory_test.t: Discard any sections that are not
4906 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4909 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4910 "This::" to work around a bug in gcc 4.2.
4912 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4914 2010-09-09 Rafael Espindola <espindola@google.com>
4916 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4917 sections with different PF_X flags in the same segment.
4918 (Layout::find_first_load_seg): Search all segments to find the first
4920 * options.h (rosegment): New.
4922 2010-09-08 Rafael Espindola <espindola@google.com>
4924 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4926 2010-09-08 Doug Kwan <dougkwan@google.com>
4928 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4929 (Arm_relobj::do_relocate_sections): Add new parameter for output
4930 file to match the parent.
4931 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4932 of local symbols instead of input values. Update code to track
4933 changes in gold::relocate_section.
4934 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4935 (Sized_relobj::compute_final_local_value_internal): New methods.
4936 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4937 body into private version of Sized_relobj::compute_final_local_value.
4938 Call the inline method.
4939 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4940 merged symbol value if there is one.
4941 (Symbol_value::has_output_value): New method defintiion.
4942 (Sized_relobj::Compute_final_local_value_status): New enum type.
4943 (Sized_relobj::compute_final_local_value): New methods.
4944 (Sized_relobj::compute_final_local_value_internal): New methods.
4945 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4946 and arm_cortex_a8.sh.
4947 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4948 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4950 * Makefile.in: Regenerate.
4951 * testsuite/arm_bl_out_of_range.s: Update test.
4952 * testsuite/thumb_bl_out_of_range.s: Ditto.
4953 * testsuite/thumb_blx_out_of_range.s: Ditto.
4954 * testsuite/arm_branch_out_of_range.sh: New file.
4955 * testsuite/arm_cortex_a8.sh: Ditto.
4956 * testsuite/arm_cortex_a8_b.s: Ditto.
4957 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4958 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4959 * testsuite/arm_cortex_a8_bl.s: Ditto.
4960 * testsuite/arm_cortex_a8_blx.s: Ditto.
4961 * testsuite/arm_cortex_a8_local.s: Ditto.
4962 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4963 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4965 2010-09-08 Rafael Espindola <espindola@google.com>
4967 * Makefile.am (memory_test.stdout): Run readelf with -W.
4968 * Makefile.in: Regenerate.
4969 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4972 2010-09-08 Rafael Espindola <espindola@google.com>
4974 * script-sections.cc (Script_sections::add_memory_region): Convert
4975 field precision to int.
4976 * script.cc (script_set_section_region, script_set_section_region):
4977 Convert field precision to int.
4979 2010-09-08 Rafael Espindola <espindola@google.com>
4981 * arm.cc (do_finalize_sections): Create the __exidx_start and
4982 __exdix_end symbols even when the section is missing.
4984 2010-09-08 Nick Clifton <nickc@redhat.com>
4986 * README: Remove claim that MEMORY is not supported.
4987 * expression.cc (script_exp_function_origin)
4988 (script_exp_function_length): Move from here to ...
4989 * script.cc: ... here.
4990 (script_set_section_region, script_add_memory)
4991 (script_parse_memory_attr, script_include_directive): New
4993 * script-sections.cc
4994 (class Memory_region): New class.
4995 (class Output_section_definition): Add set_memory_region,
4996 set_section_vma, set_section_lma and get_section_name methods.
4997 (class Script_Sections): Add add_memory_region,
4998 find_memory_region, find_memory_region_origin,
4999 find_memory_region_length and set_memory_region methods.
5000 Have set_section_addresses method walk the list of set memory
5002 Extend the print methos to display memory regions.
5003 * script-sections.h: Add prototypes for new methods.
5004 Add enum for MEMORY region attributes.
5005 * yyscript.y: Add support for parsing MEMORY regions.
5006 * script-c.h: Add prototypes for new functions.
5007 * testsuite/Makefile.am: Add test of MEMORY region functionality.
5008 * testsuite/Makefile.in: Regenerate.
5009 * testsuite/memory_test.sh: New script.
5010 * testsuite/memory_test.s: New assembler source file.
5011 * testsuite/memory_test.t: New linker script.
5013 2010-08-27 Doug Kwan <dougkwan@google.com>
5015 * gold/resolve.cc (Symbol_table::should_override): Let a weak
5016 reference override an existing dynamic weak reference.
5017 * testsuite/Makefile.am: Add new test dyn_weak_ref.
5018 * testsuite/Makefile.in: Regenerate.
5019 * testsuite/dyn_weak_ref.sh: New file.
5020 * testsuite/dyn_weak_ref_1.c: Ditto.
5021 * testsuite/dyn_weak_ref_2.c: Ditto.
5023 2010-08-27 Ian Lance Taylor <iant@google.com>
5025 * incremental.h (class Incremental_input_entry): Add virtual
5028 2010-08-27 Ian Lance Taylor <iant@google.com>
5030 * testsuite/start_lib_test_3.c: Mark t3 as used.
5032 2010-08-27 Nick Clifton <nickc@redhat.com>
5034 * options.cc (version_script): Fix small typo in previous
5037 2010-08-25 Nick Clifton <nickc@redhat.com>
5039 * archive.cc: Formatting fixes: Remove whitespace between
5040 typename and following asterisk. Remove whitespace between
5041 function name and opening parenthesis.
5042 * archive.h: Likewise.
5044 * attributes.cc: Likewise.
5045 * attributes.h: Likewise.
5046 * common.cc: Likewise.
5047 * copy-relocs.cc: Likewise.
5048 * dirsearch.h: Likewise.
5049 * dynobj.cc: Likewise.
5050 * ehframe.cc: Likewise.
5051 * ehframe.h: Likewise.
5052 * expression.cc: Likewise.
5053 * fileread.cc: Likewise.
5054 * fileread.h: Likewise.
5056 * gold-threads.cc: Likewise.
5057 * gold.cc: Likewise.
5058 * i386.cc: Likewise.
5060 * incremental-dump.cc: Likewise.
5061 * incremental.cc: Likewise.
5062 * layout.cc: Likewise.
5063 * layout.h: Likewise.
5064 * main.cc: Likewise.
5065 * merge.cc: Likewise.
5066 * merge.h: Likewise.
5067 * object.cc: Likewise.
5068 * object.h: Likewise.
5069 * options.cc: Likewise.
5070 * options.h: Likewise.
5071 * output.cc: Likewise.
5072 * output.h: Likewise.
5073 * plugin.cc: Likewise.
5074 * plugin.h: Likewise.
5075 * powerpc.cc: Likewise.
5076 * reloc.cc: Likewise.
5077 * script-c.h: Likewise.
5078 * script-sections.cc: Likewise.
5079 * script.cc: Likewise.
5080 * stringpool.cc: Likewise.
5081 * symtab.cc: Likewise.
5082 * symtab.h: Likewise.
5083 * target.cc: Likewise.
5084 * timer.cc: Likewise.
5085 * timer.h: Likewise.
5086 * version.cc: Likewise.
5087 * x86_64.cc: Likewise.
5089 2010-08-24 Nick Clifton <nickc@redhat.com>
5092 * layout.cc (segment_precedes): Sort segments by their physical
5093 addresses, if they have been set.
5095 2010-08-23 Cary Coutant <ccoutant@google.com>
5097 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5099 (Lib_group::include_member): Unlock object after deleting its
5101 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5104 2010-08-19 Neil Vachharajani <nvachhar@google.com>
5105 Cary Coutant <ccoutant@google.com>
5107 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5108 constructor, and set_blocker.
5109 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5111 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5112 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5113 * testsuite/Makefile.am (start_lib_test): New test case.
5114 * testsuite/Makefile.in: Regenerate.
5115 * testsuite/start_lib_test_main.c: New file.
5116 * testsuite/start_lib_test_1.c: New file.
5117 * testsuite/start_lib_test_2.c: New file.
5118 * testsuite/start_lib_test_3.c: New file.
5120 2010-08-19 Ian Lance Taylor <iant@google.com>
5122 * Makefile.in: Rebuild with automake 1.11.1.
5123 * aclocal.m4: Likewise.
5124 * testsuite/Makefile.in: Likewise.
5126 2010-08-19 Ian Lance Taylor <iant@google.com>
5129 * i386.cc (class Output_data_plt_i386): Update declarations.
5130 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
5131 local_ifuncs_ fields.
5132 (Target_i386::do_plt_section_for_global): New function.
5133 (Target_i386::do_plt_section_for_local): New function.
5134 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5135 parameter; change all callers. Initialize global_ifuncs_ and
5136 local_ifuncs_. If doing a static link define __rel_iplt_start and
5138 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5139 (Output_data_plt_i386::add_local_ifunc_entry): New function.
5140 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5142 (Target_i386::make_plt_section): New function, broken out of
5143 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
5144 (Target_i386::make_plt_entry): Call make_plt_section.
5145 (Target_i386::make_local_ifunc_plt_entry): New function.
5146 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5147 (Target_i386::Scan::local): Handle IFUNC symbols. Add
5148 R_386_IRELATIVE to switch.
5149 (Target_i386::Scan::global): Likewise.
5150 (Target_i386::Relocate::relocate): Likewise.
5151 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5153 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5154 (Target_x86_64::do_plt_section_for_global): New function.
5155 (Target_x86_64::do_plt_section_for_local): New function.
5156 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5157 parameter; change all callers. If doing a static link define
5158 __rela_iplt_start and __rela_iplt_end.
5159 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5160 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5161 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5163 (Target_x86_64::make_local_ifunc_plt_entry): New function.
5164 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5166 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5167 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
5168 R_X86_64_IRELATIVE to switch.
5169 (Target_x86_64::Scan::global): Likewise.
5170 (Target_x86_64::Relocate::relocate): Likewise.
5171 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5173 * target.h (class Target): Add plt_section_for_global and
5174 plt_section_for_local functions. Add do_plt_section_for_global
5175 and do_plt_section_for_local virtual functions.
5176 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
5177 clarifying comments.
5178 (Symbol::use_plt_offset): Handle IFUNC symbol.
5179 * object.cc (Sized_relobj::Sized_relobj): Initialize
5181 (Sized_relobj::local_has_plt_offset): New function.
5182 (Sized_relobj::local_plt_offset): New function.
5183 (Sized_relobj::set_local_plt_offset): New function.
5184 (Sized_relobj::do_count): Handle IFUNC symbol.
5185 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
5186 a bit away from input_shndx_ field. Add set_is_func_symbol and
5187 is_ifunc_symbol functions.
5188 (class Sized_relobj): Update declarations. Remove Tls_got_entry
5189 and Local_tls_got_offsets. Define Local_plt_offsets. Add
5190 local_plt_offsets_ field.
5191 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5192 * output.h (class Output_section_data): Add non-const
5193 output_section function.
5194 (class Output_data_got): Update declarations.
5195 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5196 Add use_plt_offset parameter to global and local constructors.
5197 Change all callers. Change local_sym_index_ field to 31 bits.
5198 Change GSYM_CODE and CONSTANT_CODE accordingly.
5199 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5200 doing a static link don't set sh_link field.
5201 (Output_data_got::Got_entry::write): Use PLT offset if
5203 (Output_data_got::add_global_plt): New function.
5204 (Output_data_got::add_local_plt): New function.
5205 * target-reloc.h (relocate_section): Handle IFUNC symbol.
5206 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5207 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5208 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5209 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5211 * testsuite/ifunc-sel.h: New file.
5212 * testsuite/ifuncmain1.c: New file.
5213 * testsuite/ifuncmain1vis.c: New file.
5214 * testsuite/ifuncmod1.c: New file.
5215 * testsuite/ifuncdep2.c: New file.
5216 * testsuite/ifuncmain2.c: New file.
5217 * testsuite/ifuncmain3.c: New file.
5218 * testsuite/ifuncmod3.c: New file.
5219 * testsuite/ifuncmain4.c: New file.
5220 * testsuite/ifuncmain5.c: New file.
5221 * testsuite/ifuncmod5.c: New file.
5222 * testsuite/ifuncmain6pie.c: New file.
5223 * testsuite/ifuncmod6.c: New file.
5224 * testsuite/ifuncmain7.c: New file.
5225 * configure, testsuite/Makefile.in: Rebuild.
5227 2010-08-18 Ian Lance Taylor <iant@google.com>
5230 (Output_section_incremental_inputs::write_input_files): Add cast
5231 to avoid signed/unsigned comparison warning.
5232 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5234 2010-08-12 Cary Coutant <ccoutant@google.com>
5236 * common.cc (Sort_commons::operator()): Remove unnecessary code.
5238 2010-08-13 Ian Lance Taylor <iant@google.com>
5240 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5242 2010-08-12 Cary Coutant <ccoutant@google.com>
5243 Doug Kwan <dougkwan@google.com>
5245 * resolve.cc (Symbol_table::should_override): When a weak dynamic
5246 defintion overrides non-weak undef, remember that the original undef
5248 * symtab.cc (Symbol_table::sized_write_global): For undef without
5249 an original weak binding, set binding to global in output.
5250 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5251 * testsuite/Makefile.in: Regenerate.
5252 * testsuite/strong_ref_weak_def.sh: New file.
5253 * testsuite/strong_ref_weak_def_1.c: Ditto.
5254 * testsuite/strong_ref_weak_def_2.c: Ditto.
5256 2010-08-12 Cary Coutant <ccoutant@google.com>
5258 * testsuite/incremental_test.sh: Rewrite.
5259 * testsuite/incremental_test_1.c: Rewrite.
5260 * testsuite/incremental_test_2.c: Rewrite.
5262 2010-08-12 Cary Coutant <ccoutant@google.com>
5264 * arm.cc (Target_arm::got_size): Add const.
5265 (Target_arm::got_entry_count): New function.
5266 (Target_arm::plt_entry_count): New function.
5267 (Target_arm::first_plt_entry_offset): New function.
5268 (Target_arm::plt_entry_size): New function.
5269 (Output_data_plt_arm::entry_count): New function.
5270 (Output_data_plt_arm::first_plt_entry_offset): New function.
5271 (Output_data_plt_arm::get_plt_entry_size): New function.
5272 * i386.cc (Target_i386::got_size): Add const.
5273 (Target_i386::got_entry_count): New function.
5274 (Target_i386::plt_entry_count): New function.
5275 (Target_i386::first_plt_entry_offset): New function.
5276 (Target_i386::plt_entry_size): New function.
5277 (Output_data_plt_i386::entry_count): New function.
5278 (Output_data_plt_i386::first_plt_entry_offset): New function.
5279 (Output_data_plt_i386::get_plt_entry_size): New function.
5280 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5281 find_incremental_inputs_sections. Dump incremental_got_plt section.
5282 * incremental.cc: Include target.h.
5283 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5284 parameter. Adjust all callers. Find incremental_got_plt section.
5285 (Incremental_inputs::create_data_sections): Create incremental_got_plt
5287 (Output_section_incremental_inputs::set_final_data_size): Calculate
5288 size of incremental_got_plt section.
5289 (Output_section_incremental_inputs::do_write): Write the
5290 incremental_got_plt section.
5291 (Got_plt_view_info): New struct.
5292 (Local_got_offset_visitor): New class.
5293 (Global_got_offset_visitor): New class.
5294 (Global_symbol_visitor_got_plt): New class.
5295 (Output_section_incremental_inputs::write_got_plt): New function.
5296 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5297 Add parameter. Adjust all callers.
5298 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5299 (Incremental_inputs::got_plt_section): New function.
5300 (Incremental_inputs::got_plt_section_): New data member.
5301 (Incremental_got_plt_reader): New class.
5302 * layout.cc (Layout::create_incremental_info_sections): Add the
5303 incremental_got_plt section.
5304 * object.h (Got_offset_list::get_list): New function.
5305 (Got offset_list::for_all_got_offsets): New function.
5306 (Sized_relobj::local_got_offset_list): New function.
5307 * powerpc.cc (Target_powerpc::got_size): Add const.
5308 (Target_powerpc::got_entry_count): New function.
5309 (Target_powerpc::plt_entry_count): New function.
5310 (Target_powerpc::first_plt_entry_offset): New function.
5311 (Target_powerpc::plt_entry_size): New function.
5312 (Output_data_plt_powerpc::entry_count): New function.
5313 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5314 (Output_data_plt_powerpc::get_plt_entry_size): New function.
5315 * sparc.cc (Target_sparc::got_size): Add const.
5316 (Target_sparc::got_entry_count): New function.
5317 (Target_sparc::plt_entry_count): New function.
5318 (Target_sparc::first_plt_entry_offset): New function.
5319 (Target_sparc::plt_entry_size): New function.
5320 (Output_data_plt_sparc::entry_count): New function.
5321 (Output_data_plt_sparc::first_plt_entry_offset): New function.
5322 (Output_data_plt_sparc::get_plt_entry_size): New function.
5323 * symtab.h (Symbol::got_offset_list): New function.
5324 (Symbol_table::for_all_symbols): New function.
5325 * target.h (Sized_target::got_entry_count): New function.
5326 (Sized_target::plt_entry_count): New function.
5327 (Sized_target::plt_entry_size): New function.
5328 * x86_64.cc (Target_x86_64::got_size): Add const.
5329 (Target_x86_64::got_entry_count): New function.
5330 (Target_x86_64::plt_entry_count): New function.
5331 (Target_x86_64::first_plt_entry_offset): New function.
5332 (Target_x86_64::plt_entry_size): New function.
5333 (Output_data_plt_x86_64::entry_count): New function.
5334 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5335 (Output_data_plt_x86_64::get_plt_entry_size): New function.
5337 2010-08-12 Cary Coutant <ccoutant@google.com>
5339 * archive.cc: Include incremental.h.
5340 (Archive::Archive): Initialize incremental_info_.
5341 (Archive::include_member): Record archive members in incremental info.
5342 (Add_archive_symbols::run): Record begin and end of an archive in
5344 (Lib_group::include_member): Record objects in incremental info.
5345 * archive.h (Incremental_archive_entry): Forward declaration.
5346 (Archive::set_incremental_info): New member function.
5347 (Archive::incremental_info): New member function.
5348 (Archive::Unused_symbol_iterator): New class.
5349 (Archive::unused_symbols_begin): New member function.
5350 (Archive::unused_symbols_end): New member function.
5351 (Archive::incremental_info_): New data member.
5352 * incremental-dump.cc (find_input_containing_global): New function.
5353 (dump_incremental_inputs): Dump new incremental info sections.
5354 * incremental.cc: Include symtab.h.
5355 (Output_section_incremental_inputs): New class.
5356 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5357 new incremental info sections.
5358 (Sized_incremental_binary::do_check_inputs): Likewise.
5359 (Incremental_inputs::report_archive): Remove.
5360 (Incremental_inputs::report_archive_begin): New function.
5361 (Incremental_inputs::report_archive_end): New function.
5362 (Incremental_inputs::report_object): New function.
5363 (Incremental_inputs::finalize_inputs): Remove.
5364 (Incremental_inputs::report_input_section): New function.
5365 (Incremental_inputs::report_script): Rewrite.
5366 (Incremental_inputs::finalize): Do nothing but finalize string table.
5367 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5368 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5369 (Incremental_inputs::create_data_sections): New function.
5370 (Incremental_inputs::relocs_entsize): New function.
5371 (Output_section_incremental_inputs::set_final_data_size): New function.
5372 (Output_section_incremental_inputs::do_write): New function.
5373 (Output_section_incremental_inputs::write_header): New function.
5374 (Output_section_incremental_inputs::write_input_files): New function.
5375 (Output_section_incremental_inputs::write_info_blocks): New function.
5376 (Output_section_incremental_inputs::write_symtab): New function.
5377 * incremental.h (Incremental_script_entry): Forward declaration.
5378 (Incremental_object_entry): Forward declaration.
5379 (Incremental_archive_entry): Forward declaration.
5380 (Incremental_inputs): Forward declaration.
5381 (Incremental_inputs_header_data): Remove.
5382 (Incremental_inputs_header): Remove.
5383 (Incremental_inputs_header_write): Remove.
5384 (Incremental_inputs_entry_data): Remove.
5385 (Incremental_inputs_entry): Remove.
5386 (Incremental_inputs_entry_write): Remove.
5387 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5388 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5389 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5390 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5392 (Incremental_input_entry): New class.
5393 (Incremental_script_entry): New class.
5394 (Incremental_object_entry): New class.
5395 (Incremental_archive_entry): New class.
5396 (Incremental_inputs::Incremental_inputs): Initialize new data members.
5397 (Incremental_inputs::report_inputs): Remove.
5398 (Incremental_inputs::report_archive): Remove.
5399 (Incremental_inputs::report_archive_begin): New function.
5400 (Incremental_inputs::report_archive_end): New function.
5401 (Incremental_inputs::report_object): Change prototype.
5402 (Incremental_inputs::report_input_section): New function.
5403 (Incremental_inputs::report_script): Change prototype.
5404 (Incremental_inputs::get_reloc_count): New function.
5405 (Incremental_inputs::set_reloc_count): New function.
5406 (Incremental_inputs::create_data_sections): New function.
5407 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5408 (Incremental_inputs::inputs_section): New function.
5409 (Incremental_inputs::symtab_section): New function.
5410 (Incremental_inputs::relocs_section): New function.
5411 (Incremental_inputs::get_stringpool): Add const.
5412 (Incremental_inputs::command_line): Add const.
5413 (Incremental_inputs::inputs): Remove.
5414 (Incremental_inputs::command_line_key): New function.
5415 (Incremental_inputs::input_file_count): New function.
5416 (Incremental_inputs::input_files): New function.
5417 (Incremental_inputs::relocs_entsize): New function.
5418 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5419 (Incremental_inputs::finalize_inputs): Remove.
5420 (Incremental_inputs::Input_info): Remove.
5421 (Incremental_inputs::lock_): Remove.
5422 (Incremental_inputs::inputs_): Change type.
5423 (Incremental_inputs::inputs_map_): Remove.
5424 (Incremental_inputs::current_object_entry_): New data member.
5425 (Incremental_inputs::inputs_section_): New data member.
5426 (Incremental_inputs::symtab_section_): New data member.
5427 (Incremental_inputs::relocs_section_): New data member.
5428 (Incremental_inputs::reloc_count_): New data member.
5429 (Incremental_inputs_reader): New class.
5430 (Incremental_symtab_reader): New class.
5431 (Incremental_relocs_reader): New class.
5432 * layout.cc (Layout::finalize): Move finalization of incremental info
5433 and creation of incremental info sections to follow finalization of
5434 symbol table. Set offsets for postprocessing sections.
5435 (Layout::create_incremental_info_sections): Call
5436 Incremental_inputs::create_data_sections. Add incremental symtab
5437 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
5438 sections to layout after input sections.
5439 * layout.h (struct Timespec): Forward declaration.
5440 (Layout::incremental_inputs): Add const.
5441 (Layout::create_incremental_info_sections): Add parameter.
5442 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5443 * object.cc: Include incremental.h.
5444 (Relobj::finalize_incremental_relocs): New function.
5445 (Sized_relobj::do_layout): Record input sections in incremental info.
5446 * object.h (Object::output_section): New function.
5447 (Object::output_section_offset): Moved from Relobj.
5448 (Object::get_incremental_reloc_base): New function.
5449 (Object::get_incremental_reloc_count): New function.
5450 (Object::do_output_section): New function.
5451 (Object::do_output_section_offset): Moved from Relobj.
5452 (Object::do_get_incremental_reloc_base): New function.
5453 (Object::do_get_incremental_reloc_count): New function.
5454 (Object::Object): Initialize new data members.
5455 (Relobj::output_section): Renamed do_output_section and moved to
5457 (Relobj::output_section_offset): Moved to Object.
5458 (Relobj::do_get_incremental_reloc_base): New function.
5459 (Relobj::do_get_incremental_reloc_count): New function.
5460 (Relobj::allocate_incremental_reloc_counts): New function.
5461 (Relobj::count_incremental_reloc): New function.
5462 (Relobj::finalize_incremental_relocs): New function.
5463 (Relobj::next_incremental_reloc_index): New function.
5464 (Relobj::reloc_counts_): New data member.
5465 (Relobj::reloc_bases_): New data member.
5466 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
5467 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
5468 (Sized_relobj::incremental_relocs_scan): New function.
5469 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5470 (Sized_relobj::incremental_relocs_write): New function.
5471 (Sized_relobj::incremental_relocs_write_reltype): New function.
5472 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5474 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5475 archives and object files elsewhere.
5476 (Add_symbols::run): Report object files here.
5477 (Finish_group::run): Report end of archive at end of group.
5478 * reloc.cc: Include layout.h, incremental.h.
5479 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5480 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5481 (Sized_relobj::incremental_relocs_scan): New function.
5482 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5483 (Sized_relobj::do_relocate_sections): Write incremental relocations.
5484 (Sized_relobj::incremental_relocs_write): New function.
5485 (Sized_relobj::incremental_relocs_write_reltype): New function.
5486 * script.cc (read_input_script): Rewrite test for incremental link.
5487 Change call to Incremental_inputs::report_script.
5488 * symtab.h (Symbol_table::first_global_index): New function.
5489 (Symbol_table::output_count): New function.
5491 2010-08-12 Doug Kwan <dougkwan@google.com>
5493 * arm.cc (Target_arm::merge_object_attributes): Check command line
5494 options --no-wchar-size-warning and --no-enum-size-warning.
5495 * options.h (General_options): Add ld-compatible options
5496 --no-enum-size-warning and --no-wchar-size-warning.
5498 2010-08-04 Ian Lance Taylor <iant@google.com>
5500 * x86_64.cc (Target_x86_64::Scan::local): Use
5501 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5502 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5503 (Target_x86_64::Scan::global): Likewise.
5504 (Target_x86_64::Relocate::relocate): Likewise.
5505 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5508 2010-08-03 Cary Coutant <ccoutant@google.com>
5510 * merge.cc (Output_merge_string::do_add_input_section): Count strings
5511 to reserve space in merged_strings vector. Keep total input size
5513 (Output_merge_string::do_print_merge_stats): Print total input size.
5514 * merge.h (Output_merge_string): Add input_size_ field.
5515 * stringpool.cc (Stringpool_template::string_length): Move
5516 implementations out of Stringpool_template class and place in
5518 * stringpool.h (string_length): Move out of Stringpool_template.
5520 2010-08-03 Ian Lance Taylor <iant@google.com>
5523 * layout.cc (relaxation_loop_body): If address of load segment is
5524 set, adjust address to include headers if possible.
5526 2010-08-03 Ian Lance Taylor <iant@google.com>
5528 * version.cc (version_string): Bump to 1.10.
5530 2010-08-03 Ian Lance Taylor <iant@google.com>
5533 * layout.h (enum Output_section_order): Define.
5534 (class Layout): Update declarations.
5535 * layout.cc (Layout::get_output_section): Add order parameter.
5536 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5537 is_first_non_relro parameters. Change all callers.
5538 (Layout::choose_output_section): Likewise.
5539 (Layout::add_output_section_data): Likewise.
5540 (Layout::make_output_section): Likewise. Set order.
5541 (Layout::default_section_order): New function.
5542 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5543 * output.cc (Output_section::Output_section): Initialize order_.
5544 Don't initialize deleted fields.
5545 (Output_segment::Output_segment): Don't initialize deleted
5547 (Output_segment::add_output_section_to_load): New function
5548 replacing add_output_section. Change all callers to call this or
5549 add_output_section_to_nonload.
5550 (Output_segment::add_output_section_to_nonload): New function.
5551 (Output_segment::remove_output_section): Rewrite.
5552 (Output_segment::add_initial_output_data): Likewise.
5553 (Output_segment::has_any_data_sections): Likewise.
5554 (Output_segment::is_first_section_relro): Likewise.
5555 (Output_segment::maximum_alignment): Likewise.
5556 (Output_segment::has_dynamic_reloc): New function replacing
5557 dynamic_reloc_count. Change all callers.
5558 (Output_segment::has_dynamic_reloc_list): New function replacing
5559 dynamic_reloc_count_list. Change all callers.
5560 (Output_segment::set_section_addresses): Rewrite.
5561 (Output_segment::set_offset): Rewrite.
5562 (Output_segment::find_first_and_last_list): Remove.
5563 (Output_segment::set_tls_offsets): Rewrite.
5564 (Output_segment::first_section_load_address): Likewise.
5565 (Output_segment::output_section_count): Likewise.
5566 (Output_segment::section_with_lowest_load_address): Likewise.
5567 (Output_segment::write_section_headers): Likewise.
5568 (Output_segment::print_sections_to_map): Likewise.
5569 * output.h (class Output_data): Remove dynamic_reloc_count_
5570 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
5571 (Output_data::add_dynamic_reloc): Rewrite.
5572 (Output_data::has_dynamic_reloc): New function.
5573 (Output_data::dynamic_reloc_count): Remove.
5574 (class Output_section): Add order_ field. Remvoe is_relro_local_,
5575 is_last_relro_, is_first_non_relro_, is_interp_,
5576 is_dynamic_linker_section_ fields. Add order and set_order
5577 functions. Remove is_relro_local, set_is_relro_local,
5578 is_last_relro, set_is_last_relro, is_first_non_relro,
5579 set_is_first_non_relro functions, is_interp, set_is_interp,
5580 is_dynamic_linker_section, and set_is_dynamic_linker_section
5582 (class Output_segment): Change Output_data_list from std::list to
5583 std:;vector. Add output_lists_ field. Remove output_data_ and
5584 output_bss_ fields. Update declarations.
5586 2010-08-02 Ian Lance Taylor <iant@google.com>
5588 * arm.cc (Target_arm::gc_process_relocs): Use typename.
5589 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5590 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5592 2010-08-02 Ian Lance Taylor <iant@google.com>
5595 * script.cc (Script_options::Script_options): Initialize
5596 symbol_definitions_ and symbol_references_.
5597 (Script_options::add_symbol_assignment): Update
5598 symbol_definitions_ and symbol_references_.
5599 (Script_options::add_symbol_reference): New function.
5600 (script_symbol): New function.
5601 * script.h (class Script_options): Add symbol_definitions_ and
5602 symbol_references_ fields.
5603 (Script_options::referenced_const_iterator): New type.
5604 (Script_options::referenced_begin): New function.
5605 (Script_options::referenced_end): New function.
5606 (Script_options::is_referenced): New function.
5607 (Script_options::any_unreferenced): New function.
5608 * script-c.h (script_symbol): Declare.
5609 * yyscript.y (exp): Call script_symbol.
5610 * symtab.cc: Include "script.h".
5611 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5612 Change all callers. Check symbols referenced by scripts.
5613 (Symbol_table::add_undefined_symbols_from_command_line): Add
5614 layout parameter. Change all callers.
5615 (Symbol_table::do_add_undefined_symbols_from_command_line):
5616 Likewise. Break out loop body. Check symbols referenced by
5618 (Symbol_table::add_undefined_symbol_from_command_line): New
5619 function broken out of
5620 do_add_undefined_symbols_from_command_line.
5621 * symtab.h (class Symbol_table): Update declarations.
5622 * archive.cc: Include "layout.h".
5623 (Archive::should_include_member): Add layout parameter. Change
5624 all callers. Check for symbol mentioned in expression.
5625 * archive.h (class Archive): Update declaration.
5626 * object.cc (Sized_relobj::do_should_include_member): Add layout
5628 * object.h (Object::should_include_member): Add layout parameter.
5630 (Object::do_should_include_member): Add layout parameter.
5631 (class Sized_relobj): Update declaration.
5632 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5634 * dynobj.h (class Sized_dynobj): Update declaration.
5635 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5637 * plugin.h (class Sized_pluginobj): Update declaration.
5639 2010-08-02 Ian Lance Taylor <iant@google.com>
5642 * output.cc (Output_segment::set_offset): Search for the first and
5643 last sections rather than assuming that the list is in order.
5644 (Output_segment::find_first_and_last_list): New function.
5645 * output.h (class Output_segment): Update declarations.
5646 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5647 (relro_strip_test_SOURCES): New variable.
5648 (relro_strip_test_DEPENDENCIES): New variable.
5649 (relro_strip_test_LDFLAGS): New variable.
5650 (relro_strip_test_LDADD): New variable.
5651 (relro_strip_test.so): New target.
5653 2010-08-02 Ian Lance Taylor <iant@google.com>
5655 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5656 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5657 (Target_i386::got_tlsdesc_section): New function.
5658 (Target_i386::got_section): Create space for GOT entries for
5659 TLSDESC relocations.
5660 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5662 (Target_i386::Scan::global): Likewise.
5663 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5665 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5666 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5667 (Target_x86_64::got_tlsdesc_section): New function.
5668 (Target_x86_64::got_section): Create space for GOT entries for
5669 TLSDESC relocations.
5670 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5672 (Target_x86_64::Scan::global): Likewise.
5673 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5676 2010-08-02 Ian Lance Taylor <iant@google.com>
5678 * testsuite/final_layout.sh: Use dc to convert from hex to
5681 2010-07-29 Sriraman Tallam <tmsriram@google.com>
5683 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5684 paramter to the call to gold::gc_process_relocs.
5685 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5686 paramter to the call to gold::gc_process_relocs.
5687 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5688 parameter to the call to gold::gc_process_relocs.
5689 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5690 template parameter to the call to gold::gc_process_relocs.
5691 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5692 paramter to the call to gold::gc_process_relocs.
5693 * gc.h (get_embedded_addend_size): New function.
5694 (gc_process_relocs): Save the size of the reloc for use by ICF.
5695 * icf.cc (get_section_contents): Get the addend from the text section
5696 for SHT_REL relocation sections.
5697 * icf.h (Icf::Reloc_addend_size_info): New typedef.
5698 (Icf::Reloc_info): Add new member reloc_addend_size_info.
5699 * int_encoding.h (read_from_pointer): New overloaded function.
5700 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5701 * testsuite/icf_sht_rel_addend_test.sh: New file.
5702 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5703 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5705 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5707 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5708 * Makefile.in: Regenerate.
5709 * testsuite/Makefile.in: Regenerate.
5711 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
5713 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5714 * gold/testsuite/debug_msg.cc: Likewise.
5715 * gold/testsuite/odr_violation1.cc
5716 * gold/testsuite/odr_violation2.cc
5718 2010-07-21 Cary Coutant <ccoutant@google.com>
5720 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5721 string, and length fields.
5722 (Output_merge_string::Merged_strings_list): New type.
5723 (Output_merge_string::Merged_strings_lists): New typedef.
5724 (Output_merge_string): Replace merged_strings_ with
5725 merged_strings_lists_.
5726 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5727 Merged_strings_list per input object and section. Don't store pointer
5728 to the string. Don't store length with each merged string entry.
5729 (Output_merge_string::finalize_merged_data): Loop over list of merged
5730 strings lists. Recompute length of each merged string.
5732 2010-07-15 Cary Coutant <ccoutant@google.com>
5734 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5737 2010-07-14 Ian Lance Taylor <iant@google.com>
5739 * descriptors.cc (Descriptors::open): Report correct name in error
5742 2010-07-13 Doug Kwan <dougkwan@google.com>
5744 * arm.cc (Arm_input_section::Arm_input_section): For a
5745 SHT_ARM_EXIDX section, always keeps the input sections.
5746 (Arm_input_section::set_exidx_section_link): New method.
5747 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5748 has_errors_ to false.
5749 (Arm_exidx_input_section::has_errors,
5750 Arm_exidx_input_section::set_has_errors): New methods.
5751 (Arm_exidx_input_section::has_errors_): New data member.
5752 (Arm_relobj::get_exidx_shndx_list): New method.
5753 (Arm_output_section::append_text_sections_to_list): Do not skip
5754 section without SHF_EXECINSTR.
5755 (Arm_output_section::fix_exidx_coverage): Skip input sections with
5757 (Arm_relobj::make_exidx_input_section): Add new parameter for text
5758 section header. Make error messages more verbose. Check for
5759 a non-executable section linked to an EXIDX section.
5760 (Arm_relobj::do_read_symbols): Remove error checking, which has been
5761 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
5762 check that there is no deferred EXIDX section if we exit early.
5763 Instead of not making an EXIDX section in case of an error, make one
5764 and set the has_errors flag of it.
5765 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5766 in a relocatable link.
5767 (Target_arm::do_relax): Look for the EXIDX output section instead of
5768 assuming that it is called .ARM.exidx.
5769 (Target_arm::fix_exidx_coverage): Add a new parameter for input
5770 section list. Do not check for SHF_EXECINSTR section flags but
5771 skip any input section with errors.
5772 * output.cc (Output_section::Output_section): Initialize
5773 always_keeps_input_sections_ to false.
5774 (Output_section::add_input_section): Check for
5775 always_keeps_input_sections_.
5776 * output.h (Output_section::always_keeps_input_sections,
5777 Output_section::set_always_keeps_input_sections): New methods.
5778 (Output_section::always_keeps_input_sections): New data member.
5780 2010-07-13 Rafael Espindola <espindola@google.com>
5782 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5783 * fileread.h (Input_file): Add try_extra_search_path and find_file.
5785 2010-07-13 Philip Herron <herron.philip@googlemail.com>
5786 Ian Lance Taylor <iant@google.com>
5788 * output.h (Output_section_lookup_maps::add_merge_section):
5789 Correct check of whether value was inserted.
5790 (Output_section_lookup_maps::add_merge_input_section): Likewise.
5791 (Output_section_lookup_maps::add_relaxed_input_section):
5793 * arm.cc (Target_arm::got_section): Remove used local os.
5794 * i386.cc (Target_i386::got_section): Likewise.
5795 * x86_64.cc (Target_x86_64::got_section): Likewise.
5796 * sparc.cc (Target_sparc::got_section): Likewise.
5797 (Target_sparc::relocate): Remove unused local have_got_offset.
5798 * powerpc.cc (Target_powerpc::relocate): Likewise.
5800 2010-07-13 Ian Lance Taylor <iant@google.com>
5802 * compressed_output.cc (zlib_decompress): Fix signature in
5805 * archive.cc (Archive::include_member): Unlock an external member
5806 of a thin archive. Don't bother to delete an object we know is
5809 2010-07-12 Cary Coutant <ccoutant@google.com>
5811 * compressed_output.cc (zlib_decompress): New function.
5812 (get_uncompressed_size): New function.
5813 (decompress_input_section): New function.
5814 * compressed_output.h (get_uncompressed_size): New function.
5815 (decompress_input_section): New function.
5816 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5817 Handle compressed debug sections.
5818 * layout.cc (is_compressed_debug_section): New function.
5819 (Layout::output_section_name): Map compressed section names to
5821 * layout.h (is_compressed_debug_section): New function.
5822 (is_debug_info_section): Recognize compressed debug sections.
5823 * merge.cc: Include compressed_output.h.
5824 (Output_merge_data::do_add_input_section): Handle compressed
5826 (Output_merge_string::do_add_input_section): Handle compressed
5828 * object.cc: Include compressed_output.h.
5829 (Sized_relobj::Sized_relobj): Initialize new data members.
5830 (build_compressed_section_map): New function.
5831 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5832 * object.h (Object::section_is_compressed): New method.
5833 (Object::do_section_is_compressed): New method.
5834 (Sized_relobj::Compressed_section_map): New type.
5835 (Sized_relobj::do_section_is_compressed): New method.
5836 (Sized_relobj::compressed_sections_): New data member.
5837 * output.cc (Output_section::add_input_section): Handle compressed
5839 * reloc.cc: Include compressed_output.h.
5840 (Sized_relobj::write_sections): Handle compressed debug sections.
5842 2010-07-08 Cary Coutant <ccoutant@google.com>
5844 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5845 weak when resolving to a dynamic def.
5846 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5847 for weak undef/dynamic def cases. Adjust callers.
5848 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5849 undef_binding_weak_.
5850 (Symbol_table::sized_write_globals): Adjust symbol binding.
5851 (Symbol_table::sized_write_symbol): Add binding parameter.
5852 * symtab.h (Symbol::set_undef_binding): New method.
5853 (Symbol::is_undef_binding_weak): New method.
5854 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5855 (Symbol_table::should_override): Add new parameter.
5856 (Symbol_table::sized_write_symbol): Add new parameter.
5858 * testsuite/weak_undef_file1.cc: Add new test case.
5859 * testsuite/weak_undef_file2.cc: Fix header comment.
5860 * testsuite/weak_undef_test.cc: Add new test case.
5862 2010-06-29 Doug Kwan <dougkwan@google.com>
5864 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5865 Initialize USE_SYMBOL_.
5866 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5868 (Arm_reloc_property::uses_symbol_): New data member declaration.
5869 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5870 uses symbol value and symbol is undefined but not weakly undefined.
5872 2010-06-28 Rafael Espindola <espindola@google.com>
5874 * plugin.cc (Plugin::load): Use dlerror.
5876 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5878 * symtab.cc (detect_odr_violations): When reporting an ODR
5879 violation, report an object where the symbol is defined.
5881 2010-06-25 Doug Kwan <dougkwan@google.com>
5883 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5884 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5886 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5887 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5888 target hook to detect function points.
5889 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5890 * icf.h (Icf::check_section_for_function_pointers): Change type of
5891 parameter SECTION_NAME to const reference to std::string. Use
5892 target hook to determine if section may have unsafe pointers.
5893 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5896 2010-06-21 Rafael Espindola <espindola@google.com>
5898 * fileread.cc (Input_file::find_fie): New
5899 (Input_file::open): Use Input_file::find_fie.
5900 * fileread.h (Input_file::find_fie): New
5901 * plugin.cc (set_extra_library_path): New.
5902 (Plugin::load): Add set_extra_library_path to the transfer vector.
5903 (Plugin_manager::set_extra_library_path): New.
5904 (Plugin_manager::add_input_file): Use the extra search path if set.
5905 (set_extra_library_path(): New.
5906 * plugin.h (Plugin_manager): Add set_extra_library_path and
5909 2010-06-19 Cary Coutant <ccoutant@google.com>
5911 * layout.cc (gdb_sections): Add .debug_types.
5912 (lines_only_debug_sections): Likewise.
5914 2010-06-18 Rafael Espindola <espindola@google.com>
5916 * plugin.cc (add_input_file,add_input_library)
5917 (Plugin_manager::add_input_file): Make filename arguments const.
5918 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5921 2010-06-16 Doug Kwan <dougkwan@google.com>
5923 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5924 .ARM.attributes section if we have not merged any input
5925 attributes sections.
5927 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5929 * arm.cc: Allow combining objects with no EABI version
5932 2010-06-15 Rafael Espindola <espindola@google.com>
5934 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5936 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5938 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5939 (struct iovec): Correct !HAVE_READV definition.
5941 2010-06-10 Cary Coutant <ccoutant@google.com>
5943 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5944 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5946 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5949 * symtab.h (Symbol::is_placeholder): New member function.
5950 * target-reloc.h (relocate_section): Check for placeholder symbols.
5952 * testsuite/Makefile.am (plugin_test_8): New test.
5953 (plugin_test_9): New test.
5954 * testsuite/Makefile.in: Regenerate.
5956 2010-06-09 Nick Clifton <nickc@redhat.com>
5958 * yyscript.y (input_list_element): Allow strings prefixed with
5959 the '-' character. Treat these as libraries.
5960 * script.cc (script_add_library): New function. Adds a library
5961 specified by "-l<name>" found in an input script.
5962 * script-c.h: Add prototype for script_add_library.
5964 2010-06-07 Doug Kwan <dougkwan@google.com>
5966 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5967 Restrict stub-group size to be within long conditional branch
5968 range when working around cortex-A8 erratum.
5970 2010-06-07 Damien Diederen <dd@crosstwine.com>
5972 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5975 2010-06-03 Sriraman Tallam <tmsriram@google.com>
5979 (Output_section::Input_section_sort_entry::compare_section_ordering):
5980 Change to return non-zero correctly.
5981 (Output_section::Input_section_sort_section_order_index_compare
5982 ::operator()): Change to fix ambiguity in comparisons.
5984 2010-06-01 Sriraman Tallam <tmsriram@google.com>
5986 * gold.h (is_wildcard_string): New function.
5987 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5988 (Layout::layout_eh_frame): Ditto.
5989 (Layout::find_section_order_index): New method.
5990 (Layout::read_layout_from_file): New method.
5991 * layout.h (Layout::find_section_order_index): New method.
5992 (Layout::read_layout_from_file): New method.
5993 (Layout::input_section_position_): New private member.
5994 (Layout::input_section_glob_): New private member.
5995 * main.cc (main): Call read_layout_from_file here.
5996 * options.h (--section-ordering-file): New option.
5997 * output.cc (Output_section::input_section_order_specified_): New
5999 (Output_section::Output_section): Initialize new member.
6000 (Output_section::add_input_section): Add new parameter.
6001 Keep input sections when --section-ordering-file is used.
6002 (Output_section::set_final_data_size): Sort input sections when
6003 section ordering file is specified.
6004 (Output_section::Input_section_sort_entry): Add new parameter.
6006 (Output_section::Input_section_sort_entry::compare_section_ordering):
6008 (Output_section::Input_section_sort_compare::operator()): Change to
6009 consider section_order_index.
6010 (Output_section::Input_section_sort_init_fini_compare::operator()):
6011 Change to consider section_order_index.
6012 (Output_section::Input_section_sort_section_order_index_compare
6013 ::operator()): New method.
6014 (Output_section::sort_attached_input_sections): Change to sort
6015 according to section order when specified.
6016 (Output_section::add_input_section<32, true>): Add new parameter.
6017 (Output_section::add_input_section<64, true>): Add new parameter.
6018 (Output_section::add_input_section<32, false>): Add new parameter.
6019 (Output_section::add_input_section<64, false>): Add new parameter.
6020 * output.h (Output_section::add_input_section): Add new parameter.
6021 (Output_section::input_section_order_specified): New
6023 (Output_section::set_input_section_order_specified): New method.
6024 (Input_section::Input_section): Initialize section_order_index_.
6025 (Input_section::section_order_index): New method.
6026 (Input_section::set_section_order_index): New method.
6027 (Input_section::section_order_index_): New member.
6028 (Input_section::Input_section_sort_section_order_index_compare): New
6030 (Output_section::input_section_order_specified_): New member.
6031 * script-sections.cc (is_wildcard_string): Delete and move modified
6033 (Output_section_element_input::Output_section_element_input): Modify
6034 call to is_wildcard_string.
6035 (Output_section_element_input::Input_section_pattern
6036 ::Input_section_pattern): Ditto.
6037 (Output_section_element_input::Output_section_element_input): Ditto.
6038 * testsuite/Makefile.am (final_layout): New test case.
6039 * testsuite/Makefile.in: Regenerate.
6040 * testsuite/final_layout.cc: New file.
6041 * testsuite/final_layout.sh: New file.
6043 2010-06-01 Rafael Espindola <espindola@google.com>
6045 * plugin.cc (Plugin::load): Pass the output name to the plugin.
6047 2010-06-01 Rafael Espindola <espindola@google.com>
6049 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6050 visibility of symbols.
6052 2010-05-27 Doug Kwan <dougkwan@google.com>
6054 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6055 from start of output section instead of address for a local symbol
6056 in a merged or relaxed section when doing a relocatable link.
6058 2010-05-26 Rafael Espindola <espindola@google.com>
6061 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6062 adding sections the garbage collector removed.
6063 * gold/testsuite/Makefile.am: Add test.
6064 * gold/testsuite/Makefile.in: Regenerate.
6065 * gold/testsuite/plugin_test_7.sh: New.
6066 * gold/testsuite/plugin_test_7_1.c: New.
6067 * gold/testsuite/plugin_test_7_2.c: New.
6069 2010-05-26 Rafael Espindola <espindola@google.com>
6071 * script-sections.cc (Output_section_definition::set_section_addresses):
6072 Check for --section-start.
6074 2010-05-26 Doug Kwan <dougkwan@google.com>
6076 * arm.cc (Arm_scan_relocatable_relocs): New class.
6077 (Target_arm::relocate_special_relocatable): New method.
6078 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6079 (Arm_relocate_functions::thumb_branch_common): Same.
6080 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6081 instead of Default_scan_relocatable_relocs.
6082 * target-reloc.h (relocate_for_relocatable): Let target handle
6083 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6084 * target.h (Sized_target::relocate_special_relocatable): New method.
6086 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6088 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6090 2010-05-23 Doug Kwan <dougkwan@google.com>
6092 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6094 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6095 with a direct branch, not a conditional branch, to a stub.
6096 * merge.cc (Output_merge_base::record_input_section): New method
6098 (Output_merge_data::do_add_input_section): Record input section if
6099 keeps-input-sections flag is set.
6100 (Output_merge_string::do_add_input_section): Ditto.
6101 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6102 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6104 (Output_merge_base::keeps_input_sections,
6105 Output_merge_base::set_keeps_input_sections,
6106 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6108 (Output_merge_base::Input_sections): New type declaration.
6109 (Output_merge_base::input_sections_begin,
6110 Output_merge_base::input_sections_end,
6111 Output_merge_base::do_set_keeps_input_sections): New method definitions.
6112 (Output_merge_base::bool keeps_input_sections_,
6113 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6114 Output_merge_base::input_sections_): New data members.
6115 (Output_merge_data::do_set_keeps_input_sections): New method
6117 (Output_merge_string::do_set_keeps_input_sections): Ditto.
6118 * output.cc (Output_section::Input_section::relobj): Move method
6119 defintion from class declaration to here and handle merge sections.
6120 (Output_section::Input_section::shndx): Ditto.
6121 (Output_section::Output_section): Remove initializations of removed
6122 data members and initialize new data member LOOKUP_MAPS_.
6123 (Output_section::add_input_section): Set keeps-input-sections flag
6124 for a newly created merge output section as appropriate. Adjust code
6125 to use Output_section_lookup_maps class.
6126 (Output_section::add_relaxed_input_section): Adjst code for lookup
6127 maps code refactoring.
6128 (Output_section::add_merge_input_section): Add a new parameter
6129 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
6130 class. If adding input section to a newly created merge output
6131 section fails, remove the new merge section.
6132 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6133 Adjust code for use of the Output_section_lookup_maps class.
6134 (Output_section::find_merge_section): Ditto.
6135 (Output_section::build_lookup_maps): New method defintion.
6136 (Output_section::find_relaxed_input_section): Adjust code to use
6137 Output_section_lookup_maps class.
6138 (Output_section::get_input_sections): Export merge sections. Adjust
6139 code to use Output_section_lookup_maps class.
6140 (Output_section:::add_script_input_section): Adjust code to use
6141 Output_section_lookup_maps class. Update lookup maps for merge
6143 (Output_section::discard_states): Use Output_section_lookup_maps.
6144 (Output_section::restore_states): Same.
6145 * output.h (Merge_section_properties): Move class defintion out of
6147 (Output_section_lookup_maps): New class.
6148 (Output_section::Input_section::is_merge_section): New method
6150 (Output_section::Input_section::relobj): Move defintion out of class
6151 defintion. Declare method only.
6152 (Output_section::Input_section::shndx): Ditto.
6153 (Output_section::Input_section::output_merge_base): New method defintion.
6154 (Output_section::Input_section::u2_.pomb): New union field.
6155 (Output_section::Merge_section_by_properties_map,
6156 Output_section::Output_section_data_by_input_section_map,
6157 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6159 (Output_section::add_merge_input_section): Add new parameter
6160 KEEPS_INPUT_SECTIONS.
6161 (Output_section::build_lookup_maps): New method declaration.
6162 (Output_section::merge_section_map_,
6163 Output_section::merge_section_by_properties_map_,
6164 Output_section::relaxed_input_section_map_,
6165 Output_section::is_relaxed_input_section_map_valid_): Remove data
6167 (Output_section::lookup_maps_): New data member.
6169 2010-05-21 Doug Kwan <dougkwan@google.com>
6172 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6173 avoid a compilation error.
6175 2010-05-19 Rafael Espindola <espindola@google.com>
6177 * script-sections.cc (Output_section_definition::allocate_to_segment):
6178 Update the phdrs_list even when the output section is NULL.
6179 * testsuite/Makefile.am: Add test.
6180 * testsuite/Makefile.in: Regenerate.
6181 * testsuite/script_test_9.cc: New.
6182 * testsuite/script_test_9.sh: New.
6183 * testsuite/script_test_9.t: New.
6185 2010-05-19 Doug Kwan <dougkwan@google.com>
6187 * arm.cc (Arm_input_section::original_size): New method.
6188 (Arm_input_section::do_addralign): Add a cast.
6189 (Arm_input_section::do_output_offset): Remove static cast.
6190 (Arm_input_section::original_addralign,
6191 Arm_input_section::original_size_): Change type to uint32_t.
6192 (Arm_input_section::init): Add safe casts for section alignment
6194 (Arm_input_section::set_final_data_size): Do not set address and
6195 offset of stub table.
6196 (Arm_output_section::fix_exidx_coverage): Change use of of
6197 Output_section::Simple_input_section to that of
6198 Output_section::Input_section.
6199 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6200 except for the first pass.
6201 * output.cc (Output_section::get_input_sections): Change type of
6202 input_sections to std::list<Input_section>.
6203 (Output_section::add_script_input_section): Rename from
6204 Output_section::add_simple_input_section. Change type of SIS
6205 parameter from Simple_input_section to Input_section.
6206 * output.h (Output_section::Simple_input_section): Remove class.
6207 (Output_section::Input_section): Change class visibility to public.
6208 (Output_section::Input_section::addralign): Use stored alignments
6209 for special input sections if set.
6210 (Output_section::Input_section::set_addralign): New method.
6211 (Output_section::get_input_sections): Change parameter type from
6212 list of Simple_input_section to list of Input_section.
6213 (Output_section::add_script_input_section): Rename from
6214 Output_section::add_simple_input_section. Change first parameter's
6215 type from Simple_input_section to Input_section and remove the
6216 second and third parameters.
6217 * script-sections.cc (Input_section::Input_section_list): Change
6218 type to list of Output_section::Input_section/
6219 (Input_section_info::Input_section_info): Change parameter type of
6220 INPUT_SECTION to Output_section::Input_section.
6221 (Input_section_info::input_section): Change return type.
6222 (Input_section_info::input_section_): Change type to
6223 Output_section::Input_section.
6224 (Output_section_element_input::set_section_addresses): Adjust code
6225 to use Output_section::Input_section instead of
6226 Output_section::Simple_input_section. Adjust code for renaming
6227 of Output_section::add_simple_input_section.
6228 (Orphan_output_section::set_section_addresses): Ditto.
6230 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6232 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6233 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6235 2010-05-18 Rafael Espindola <espindola@google.com>
6237 * options.cc (General_options::finalize): Handle -nostdlib.
6238 * options.h (nostdlib): New option.
6239 * script.cc (script_add_search_dir): Handle -nostdlib.
6241 2010-05-12 Doug Kwan <dougkwan@google.com>
6243 * arm.cc (Target_arm::do_finalize_sections): Create an empty
6244 attributes section only if there no attributes section after merging.
6245 (Target_arm::merge_object_attributes): Move value of
6246 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6247 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6248 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6249 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6250 and arm_attr_merge_7.stdout.
6251 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6252 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6253 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6254 arm_attr_merge_7b.o): New rules.
6255 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6257 * testsuite/Makefile.in: Regenerate.
6258 * testsuite/arm_attr_merge.sh: New file.
6259 * testsuite/arm_attr_merge_[67][ab].s: Same.
6261 2010-05-05 Nick Clifton <nickc@redhat.com>
6263 * po/es.po: Updated Spanish translation.
6265 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6267 * Makefile.am (install-exec-local): Properly install gold as
6268 default cross linker.
6269 * Makefile.in: Regenerated.
6271 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6272 Nick Clifton <nickc@redhat.com>
6274 * configure.ac (install_as_default): Define and set to false
6275 unless --enable-gold or --enable-gold=both/gold has been
6277 * configure: Regenerate.
6279 * Makefile.am (install-exec-local): Install the executable as
6280 'ld.gold'. If install_as_default is true then also install it as
6282 * Makefile.in: Regenerated.
6284 2010-04-24 Ian Lance Taylor <iant@google.com>
6286 * layout.cc (Layout::layout_reloc): In relocatable link don't
6287 combine reloc sections for grouped sections.
6289 2010-04-23 Sriraman Tallam <tmsriram@google.com>
6291 * gc.h (gc_process_relocs): Pass information on relocs pointing to
6292 sections that are not ordinary to icf.
6293 * icf.cc (get_section_contents): Handle relocation pointing to section
6294 with no object or shndx information.
6295 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6296 * testsuite/Makefile.in: Regenerate.
6297 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6298 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6300 2010-04-22 Ian Lance Taylor <iant@google.com>
6302 * expression.cc (Expression::Expression_eval_info): Add
6303 result_alignment_pointer field.
6304 (Expression::eval_with_dot): Add result_alignment_pointer
6305 parameter. Change all callers.
6306 (Expression::eval_maybe_dot): Likewise.
6307 (class Binary_expression): Add alignment_pointer parameter to
6308 left_value and right_value. Change all callers.
6309 (BINARY_EXPRESSION): Set result alignment.
6310 (class Trinary_expression): Add alignment_pointer parameter to
6311 arg2_value and arg3_value. Change all callers.
6312 (Trinary_cond::value): Set result alignment.
6313 (Max_expression::value, Min_expression::value): Likewise.
6314 (Align_expression::value): Likewise.
6315 * script-sections.cc (class Sections_element): Add dot_alignment
6316 parameter to set_section_addresses virtual function. Update
6318 (class Output_section_element): Likewise.
6319 (Script_sections::create_segments): Add dot_alignment parameter.
6321 (Script_sections::create_segments_from_phdrs_clause): Likewise.
6322 (Script_sections::set_phdrs_clause_addresses): Likewise.
6323 * script-sections.h: Update declarations.
6324 * script.h: Update declarations.
6325 * output.h (Output_segment::set_minimum_p_align): Don't decrease
6327 * testsuite/script_test_3.t: Set large alignment.
6328 * testsuite/script_test_3.sh: Make sure that at least one LOAD
6329 segment has expected alignment.
6331 2010-04-22 Nick Clifton <nickc@redhat.com>
6333 * po/gold.pot: Updated by the Translation project.
6334 * po/vi.po: Updated Vietnamese translation.
6336 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
6338 * testsuite/Makefile.am (check_PROGRAMS): Add
6339 icf_virtual_function_folding_test.
6340 * testsuite/Makefile.in: Regenerated.
6342 2010-04-15 Andrew Haley <aph@redhat.com>
6344 * options.h (merge_exidx_entries): New option.
6345 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6346 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6347 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6348 (Target_arm::merge_exidx_entries): New function.
6349 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6350 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6351 to Arm_exidx_fixup constructor.
6352 Add new arg, merge_exidx_entries.
6353 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6354 Arm_output_section::fix_exidx_coverage.
6356 2010-04-18 Sriraman Tallam <tmsriram@google.com>
6358 * icf.cc (get_section_contents): Check for preemptible functions.
6359 Ignore addend when appropriate.
6360 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
6362 (add_from_relobj): Check for section folded.
6363 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6364 * symtab.h (should_add_dynsym_entry): Add new parameter.
6365 * target-reloc.h (scan_relocs): Check for section folded.
6366 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6367 Check reloc types for function pointers in shared objects.
6368 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6370 (icf_preemptible_functions_test): New test case.
6371 (icf_string_merge_test): New test case.
6372 * testsuite.Makefile.in: Regenerate.
6373 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6374 bar_glob. Refactor code.
6375 * testsuite/icf_preemptible_functions_test.cc: New file.
6376 * testsuite/icf_preemptible_functions_test.sh: New file.
6377 * testsuite/icf_string_merge_test.cc: New file.
6378 * testsuite/icf_string_merge_test.sh: New file.
6379 * testsuite/icf_virtual_function_folding_test.cc: New file.
6380 * testsuite/icf_virtual_function_folding_test.sh: New file.
6382 2010-04-14 Doug Kwan <dougkwan@google.com>
6384 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6385 for local symbol recounting if we remove a section due to ICF.
6386 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6387 there are no regular objects in input.
6389 2010-04-13 Doug Kwan <dougkwan@google.com>
6391 * arm.cc (Arm_input_section::set_final_data_size): Compute
6392 accurate final data size instead of using current data size.
6394 2010-04-09 Doug Kwan <dougkwan@google.com>
6396 * layout.cc (Layout::choose_output_section): Handle script section
6398 (Layout::make_output_section_for_script): Add section type parameter.
6399 Handle script section types.
6400 * layout.h (Layout::make_output_section_for_script): Add section
6402 * output.cc (Output_section::Output_section): Initialize data member
6404 (Output_section::do_reset_address_and_file_offset): Do not set address
6405 to 0 if section is a NOLOAD section.
6406 * output.h (Output_section::is_noload): New method.
6407 (Output_section::set_is_noload): Ditto.
6408 (Output_section::is_noload_): New data member.
6409 * script-c.h (Script_section_type): New enum type.
6410 (struct Parser_output_section_header): Add new file section_type.
6411 * script-sections.cc (Sections_element::output_section_name): Add
6412 parameter for returning script section type.
6413 (Output_section_definition::output_section_name): Ditto.
6414 (Output_section_definition::section_type)P; New method.
6415 (Output_section_definiton::script_section_type_name): Ditto.
6416 (Output_section_definition::script_section_type_): New data member.
6417 (Output_section_definition::Output_section_definition): Initialize
6418 data member Output_section_definition::script_section_type_.
6419 (Output_section_definition::create_sections): Pass script section type
6420 to Layout::make_output_section_for_script.
6421 (Output_section_definition::output_section_name): Return script
6422 section type to caller.
6423 (Output_section_definition::set_section_address): Do not advance
6424 dot value and load address if section type is NOLOAD. Set address
6425 of NOLOAD sections regardless of section flags.
6426 (Output_section_definition::print): Print section type if it is
6427 not SCRIPT_SECTION_TYPE_NONE.
6428 (Output_section_definition::section_type): New method.
6429 (Output_section_definition::script_section_type_name): Ditto.
6430 (Script_sections::output_section_name): Add new parameter
6431 PSECTION_TYPE for returning script section type. Pass it to
6432 section elements. Handle discard sections.
6433 (Sort_output_sections::operator()): Handle NOLOAD sections.
6434 * script-sections.h (Script_sections::Section_type): New enum type.
6435 (Script_sections::output_section_name): Add a new parameter for
6436 returning script section type.
6437 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6439 * yyscript.y (union): Add new field SECTION_TYPE.
6440 (COPY, DSECT, INFO, NOLOAD): New tokens.
6441 (opt_address_and_section_type): Change type to output_section_header.
6442 (section_type): New non-terminal
6443 (section_header): Handle section type.
6444 (opt_address_and_section_type): Return section type value.
6446 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
6448 * testsuite/plugin_common_test_1.c (foo): Add prototype.
6449 * testsuite/plugin_common_test_2.c (foo): Likewise.
6451 2010-04-08 Doug Kwan <dougkwan@google.com>
6453 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6455 * output.cc (Output_section::add_merge_input_section): Simplify
6456 code and return status of Output_merge_base::add_input_section.
6457 Update merge section map only if Output_merge_base::add_input_section
6460 2010-04-07 Doug Kwan <dougkwan@google.com>
6462 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6463 if section is marked as containing instructions but has no mapping
6465 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6466 correct section index.
6467 (Arm_relobj::find_linked_text_section): Ditto.
6469 2010-04-07 Cary Coutant <ccoutant@google.com>
6471 * archive.cc (include_member): Destroy Read_symbols_data object before
6473 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6474 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6475 (Read_symbols_data::~Read_symbols_data) New destructor.
6476 (Section_relocs::Section_relocs) New constructor.
6477 (Section_relocs::~Section_relocs) New destructor.
6478 (Read_relocs_data::Read_relocs_data) New constructor.
6479 (Read_relocs_data::~Read_relocs_data) New destructor.
6480 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6481 pointers to NULL after deleting.
6483 2010-04-07 Doug Kwan <dougkwan@google.com>
6485 * arm.cc: Replace "endianity" with "endianness" in comments.
6486 (Arm_exidx_cantunwind): Ditto.
6487 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6488 (Arm_relobj::merge_flags_and_attributes): New method.
6489 (Arm_relobj::merge_flags_and_attributes_): New data member.
6490 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6491 (Arm_relobj::scan_sections_for_stubs): Ditto.
6492 (Arm_relobj::do_read_symbols): Check to see if we really want to
6493 merge processor-specific flags and attributes. Exit early if
6494 an object is empty except for section names and the undefined symbol.
6495 (Target_arm::do_finalize_sections): Move check for ELF format to
6496 Arm_relobj::do_read_symbols. Merge processor specific flags and
6497 attributes from a regular object only when we have determined that
6498 it is aapropriate. Do not create an .ARM.attributes section in
6499 output if there is no regular input object.
6500 (Target_arm::merge_processor_specific_flags): Check
6501 --warn-mismatch before printing any error.
6502 (Target_arm::merge_object_attributes): Ditto.
6503 * gold.cc (queue_middle_tasks): Handle the case in which there is
6504 no regular object in input.
6505 * options.cc (General_options::parse_EB): New method.
6506 (General_options::parse_EL): Same.
6507 (General_options::General_options): Initialize endianness_.
6508 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6510 (General_options::Endianness): New enum.
6511 (General_options::endianness): New method.
6512 (General_options::endianness_): New data member.
6513 * parameters.cc (Parameters::set_options): Check target endianness.
6514 (Parameters::set_target_once): Ditto.
6515 (Parameters::check_target_endianness): New method.
6516 (parameters_force_valid_target): If either -EL or -EB is specified,
6517 use it to define endianness of default target.
6518 * parameters.h (Parameters::check_target_endianness): New method
6520 * target.h (class Target): Change "endianity" to "endianness"
6523 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6525 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6526 * configure: Regenerate.
6527 * Makefile.in: Regenerate.
6528 * testsuite/Makefile.in: Regenerate.
6530 2010-04-06 Cary Coutant <ccoutant@google.com>
6533 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6534 prevailing definitions of common symbols.
6535 * testsuite/plugin_test_6.sh: New test case.
6536 * testsuite/plugin_common_test_1.c: New test case.
6537 * testsuite/plugin_common_test_2.c: New test case.
6538 * testsuite/Makefile.am (plugin_test_6): New test case.
6539 * testsuite/Makefile.in: Regenerate.
6541 2010-04-06 Nick Clifton <nickc@redhat.com>
6543 * po/vi.po: New Vietnamese translation.
6545 2010-03-30 Doug Kwan <dougkwan@google.com>
6547 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6549 2010-03-25 Doug Kwan <dougkwan@google.com>
6551 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6552 to avoid a conversion warning on a 32-bit host.
6554 2010-03-24 Ian Lance Taylor <iant@google.com>
6556 * testsuite/script_test_3.t: Add a TLS segment.
6557 * testsuite/Makefile.am (check_PROGRAMS): Add
6558 tls_phdrs_script_test.
6559 (tls_phdrs_script_test_SOURCES): Define.
6560 (tls_phdrs_script_test_DEPENDENCIES): Define.
6561 (tls_phdrs_script_test_LDFLAGS): Define.
6562 (tls_phdrs_script_test_LDADD): Define.
6563 * testsuite/Makefile.in: Rebuild.
6565 2010-03-23 Cary Coutant <ccoutant@google.com>
6567 * fileread.cc (find_or_make_view): Fix comment.
6569 2010-03-23 Ian Lance Taylor <iant@google.com>
6571 * script-sections.cc (class Orphan_section_placement): Define
6572 PLACE_TLS and PLACE_TLS_BSS.
6573 (Orphan_section_placement::Orphan_section_placement): Initialize
6575 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6576 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6577 (tls_script_test_SOURCES): Define.
6578 (tls_script_test_DEPENDENCIES): Define.
6579 (tls_script_test_LDFLAGS): Define.
6580 (tls_script_test_LDADD): Define.
6581 * testsuite/Makefile.in: Rebuild.
6583 2010-03-22 Doug Kwan <dougkwan@google.com>
6585 * arm.cc (Arm_relocate_functions::abs8,
6586 Arm_relocate_functions::abs16): Use correct check for overflow
6587 specified in the ARM ELF specs.
6588 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
6589 target of a BLX instruction specially.
6590 (Reloc_stub::stub_type_for_reloc): Ditto.
6591 (Relocate::relocate): Use symbolic names instead of numeric relocation
6592 codes to report error.
6593 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6595 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6596 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6597 thumb2_blx_out_of_range.stdout
6598 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6599 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6600 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6601 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6602 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6603 thumb2_blx_in_range, thumb2_blx_in_range.o,
6604 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6605 thumb2_blx_out_of_range.o): New rules.
6606 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6607 thumb2_blx_in_range and thumb2_blx_out_of_range.
6608 * testsuite/Makefile.in: Regenerate.
6609 * arm_branch_in_range.sh: Add tests for THUMB BLX.
6610 * testsuite/thumb_blx_in_range.s: New file.
6611 * testsuite/thumb_blx_out_of_range.s: New file.
6613 2010-03-22 Rafael Espindola <espindola@google.com>
6615 * archive.cc (Should_include): Move to archive.h.
6616 (should_include_member): Make it a member of Archive.
6618 (Add_lib_group_symbols): New.
6619 * archive.h: Include options.h.
6620 (Archive_member): Moved from Archive.
6621 (Should_include): Moved from archive.cc.
6623 (Add_lib_group_symbols): New.
6624 * dynobj.cc (do_should_include_member): New.
6625 * dynobj.h (do_should_include_member): New.
6626 * gold.cc (queue_initial_tasks): Update call to queue.
6627 * main.cc (main): Print lib group stats.
6628 * object.cc (do_should_include_member): New.
6629 * object.h: Include archive.h.
6630 (Object::should_include_member): New.
6631 (Object::do_should_include_member): New.
6632 (Sized_relobj::do_should_include_member): New.
6633 * options.cc (General_options::parse_start_lib): New.
6634 (General_options::parse_end_lib): New.
6635 (Input_arguments::add_file): Handle lib groups.
6636 (Input_arguments::start_group): Check we are not in a lib.
6637 (Input_arguments::start_lib): New.
6638 (Input_arguments::end_lib): New.
6639 * options.h (General_options): Add start_lib and end_lib.
6640 (Input_argument::lib_): New.
6641 (Input_argument::lib): New.
6642 (Input_argument::is_lib): New.
6643 (Input_file_lib): New.
6644 (Input_arguments::in_lib_): New.
6645 (Input_arguments::in_lib): New.
6646 (Input_arguments::start_lib): New.
6647 (Input_arguments::end_lib_): New.
6648 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6649 in unused members as preempted.
6650 (Sized_pluginobj::do_should_include_member): New.
6651 * plugin.h (Sized_pluginobj::do_should_include_member): New.
6652 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6654 (Read_symbols::do_whole_lib_group): New.
6655 (Read_symbols::do_lib_group): New.
6656 (Read_symbols::do_read_symbols): Handle lib groups.
6657 (Read_symbols::get_name): Handle lib groups.
6658 * readsyms.h (Read_symbols): Add an archive member pointer.
6659 (Read_symbols::do_whole_lib_group): New.
6660 (Read_symbols::do_lib_group): New.
6661 (Read_symbols::member_): New.
6662 * script.cc (read_input_script): Update call to queue_soon.
6664 2010-03-19 Doug Kwan <dougkwan@google.com>
6666 * arm.cc (Stub_table::Stub_table): Initialize new data members
6667 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6668 (Stub_table::add_reloc_stub): Assign stub offset and update
6669 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6670 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6672 (Stub_table::update_data_size_and_addralign): Use
6673 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6674 instead of going over all reloc stubs.
6675 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6676 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6677 Stringpool_template::offset_ to size of Stringpool_char.
6678 (Stringpool_template::new_key_offset): Remove code to initialize
6679 Stringpool_template::offset_.
6680 * stringpool.h (Stringpool_template::set_no_zero_null): Set
6681 Stringpool_template::offset_ to zero.
6683 2010-03-15 Doug Kwan <dougkwan@google.com>
6685 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6687 (Stringpool_template::new_key_offset): New method.
6688 (Stringpool_template::add_string): Assign offsets when adding new
6690 (Stringpool_template::set_string_offsets): Do not set string offsets
6691 when not optimizing.
6692 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6694 (Chunked_vector::clear): Clear size_.
6695 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6696 (Chunked_vector::size): Return size_.
6697 (Chunked_vector::push_back): Use size_ to find insert position.
6698 (Chunked_vector::size_): New data member.
6699 (Stringpool_template::set_no_zero_null): Assert string set is empty.
6700 (Stringpool_template::new_key_offset): New method declaration.
6701 (Stringpool_template::offset_): New data member.
6703 2010-03-15 Rafael Espindola <espindola@google.com>
6705 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6706 Add_symbols' constructor.
6707 * readsyms.h (Add_symbols): Remove the input_group member.
6709 2010-03-10 Ian Lance Taylor <iant@google.com>
6711 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6712 target to ask whether a reference to a symbol requires a stack
6714 * target.h (Target::is_call_to_non_split): New function.
6715 (Target::do_is_call_to_non_split): Declare virtual function.
6716 * target.cc: Include "symtab.h".
6717 (Target::do_is_call_to_non_split): New function.
6718 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6720 2010-03-10 Cary Coutant <ccoutant@google.com>
6722 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6723 (File_read::open[1]): Remove initial mapping of whole_file_view_.
6724 (File_read::open[2]): Add whole_file_view_ to list of views.
6725 (File_read::make_view): Remove test of whole_file_view_.
6726 (File_read::find_or_make_view): Create whole_file_view_ if
6728 (File_read::clear_views): Replace bool parameter with enum;
6729 adjust all callers. Don't delete views with permanent data;
6730 do delete cached views and views from archives if
6731 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
6732 if clearing the corresponding view.
6733 * fileread.h (File_read::Clear_views_mode): New enum.
6734 (File_read::View::is_permanent_view): New method.
6735 (File_read::clear_views): Replace bool parameter
6736 with enum; adjust all callers.
6737 * options.h (General_options): Change keep_files_mapped option;
6738 add map_whole_files.
6739 * readsyms.cc (Add_symbols::run): Delete sd_ object before
6741 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6744 2010-03-10 David S. Miller <davem@davemloft.net>
6746 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6748 2010-03-09 Sriraman Tallam <tmsriram@google.com>
6750 * icf.cc (get_section_contents): Add '@' marker after processing the
6753 2010-03-08 Doug Kwan <dougkwan@google.com>
6755 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6756 due to a conversion warning.
6757 (Arm_relobj::update_output_local_symbol_count): Check for local
6758 symbol with unset output index.
6760 2010-03-05 Ian Lance Taylor <iant@google.com>
6762 * options.h (class General_options): Add --spare-dynamic-tags.
6763 * output.cc (Output_data_dynamic::set_final_data_size): Implement
6764 --spare-dynamic-tags.
6766 2010-03-05 Ian Lance Taylor <iant@google.com>
6768 * incremental.cc: Include "libiberty.h".
6770 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
6772 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6773 function, is_info_ member.
6774 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6775 (Versions::Versions): Update caller.
6776 (Versions::define_base_version): Likewise.
6777 (Versions::add_def): Likewise.
6779 2010-03-03 Sriraman Tallam <tmsriram@google.com>
6781 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6782 (Scan::possible_function_pointer_reloc): New function.
6783 (Scan::local_reloc_may_be_function_pointer): Change to call
6784 possible_function_pointer_reloc.
6785 (Scan::global_reloc_may_be_function_pointer): Ditto.
6786 * icf.h (Icf::check_section_for_function_pointers): Change to reject
6787 relocations in ".data.rel.ro._ZTV" section.
6788 * testsuite/icf_safe_so_test.sh: Change to pass i386.
6789 * testsuite/icf_safe_so_test.cc: Ditto.
6790 * testsuite/icf_safe_test.cc: Ditto.
6791 * testsuite/icf_safe_test.sh: Ditto.
6793 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6794 Ian Lance Taylor <iant@google.com>
6796 * target-reloc.h (relocate_section): Check the symbol table index
6797 for -1U before setting the local symbol index.
6798 (scan_relocatable_relocs): If copying the relocation, record that
6799 the local symbol is required.
6800 * object.h (Symbol_value::is_output_symtab_index_set): New
6802 (Symbol_value::may_be_discarded_from_output_symtab): New
6804 (Symbol_value::has_output_symtab_entry): New function.
6805 (Symbol_value::needs_output_symtab_entry): Remove.
6806 (Symbol_value::output_symtab_index): Make sure the symbol index is
6808 (Symbol_value::set_output_symtab_index): Make sure the symbol
6809 index is not set. Make sure the new index is valid.
6810 (Symbol_value::set_must_have_output_symtab_entry): New function.
6811 (Symbol_value::has_output_dynsym_entry): New function.
6812 (Symbol_value::set_output_dynsym_index): Make sure the new index
6814 (Sized_relobj::set_must_have_output_symtab_entry): New function.
6815 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6816 local symbol if permitted.
6817 (Sized_relobj::do_finalize_local_symbols): Call
6818 is_output_symtab_index_set rather than needs_output_symtab_entry.
6819 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6820 rather than needs_output_symtab_entry. Call
6821 has_output_dynsym_entry rather than needs_output_dynsym_entry.
6822 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6823 is_output_symtab_index_set rather than needs_output_symtab_entry.
6824 * testsuite/discard_locals_relocatable_test.c: New file.
6825 * testsuite/discard_locals_test.sh: Test -r.
6826 * testsuite/Makefile.am (check_DATA): Add
6827 discard_locals_relocatable_test1.syms,
6828 discard_local_relocatable_test2.syms.
6829 (MOSTLYCLEANFILES): Likewise. Also add
6830 discard_locals_relocatable_test1.lout and
6831 discard_locals_relocatable_test2.out.
6832 (discard_locals_relocatable_test1.syms): New target.
6833 (discard_locals_relocatable_test.o): New target.
6834 (discard_locals_relocatable_test1.out): New target.
6835 (discard_locals_relocatable_test2.syms): New target.
6836 (discard_locals_relocatable_test2.out): New target.
6837 (various): Add missing ../ld-new dependencies.
6838 * testsuite/Makefile.in: Rebuild.
6840 2010-03-03 Nick Clifton <nickc@redhat.com>
6842 * po/fi.po: New Finnish translation.
6844 2010-03-01 Doug Kwan <dougkwan@google.com>
6846 * layout.cc (Layout::Layout): Force section types of .init_array*,
6847 .preinit_array* and .fini_array* sections.
6848 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6849 Fix check of return value of std::string::find.().
6850 (Output_section::Input_section_sort_compare::operator()): Remove
6851 comment about .init_array.
6852 (Output_section::Input_section_sort_init_fini_compare::operator()):
6854 (Output_section::sort_attached_input_sections): Handle .init_array
6855 and .fini_array specially.
6856 * output.h (Output_section::Inut_section_sort_compare): Update
6858 (Output_section::Input_section_sort_init_fini_compare): New struct.
6860 2010-02-26 Doug Kwan <dougkwan@google.com>
6862 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6863 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6864 * testsuite/debug_msg.sh: Avoid matching source line number for
6865 use of global variable undef_int.
6867 2010-02-26 Doug Kwan <dougkwan@google.com>
6869 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6870 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6871 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6872 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6873 * options.cc (General_options::General_options): Initialize member
6875 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6876 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6877 and rm_no_fix_v4bx.stdout
6878 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6879 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6880 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6881 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6882 and arm_no_fix_v4bx.
6883 * Makefile.in: Regenerate.
6884 * testsuite/arm_fix_v4bx.s: New file.
6885 * testsuite/arm_fix_v4bx.sh: Ditto.
6887 2010-02-24 Doug Kwan <dougkwan@google.com>
6889 * arm.cc (Target_arm::got_section): Make the .got section the first
6890 non RELRO section in the data segment.
6891 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6892 suffixes of section names.
6894 2010-02-24 Doug Kwan <dougkwan@google.com>
6896 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6897 flags and attributes merging if an input file is a binary file.
6898 * fileread.cc (Input_file::open): Record format of original file.
6899 * fileread.h (Input_file::Format): New enum type.
6900 (Input_file::Input_file): Initialize data member format_.
6901 (Input_file::format): New method definition.
6902 (Input_file::format_):: New data member.
6904 2010-02-24 Doug Kwan <dougkwan@google.com>
6906 * arm.cc (Arm_output_data_got): New class.
6907 (ARM_TCB_SIZE): New constant
6908 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6909 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6910 If user uses a script with a SECTIONS clause, issue only a warning
6911 for a misplaced EXIDX input section. Otherwise, issue an error.
6912 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6914 (Target_arm::got_mode_index_entry): Handle static linking.
6915 (Target_arm::Scan::local): Ditto.
6916 (Target_arm::Scan::global): Ditto.
6917 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6918 all incorrectly implemented relocations.
6919 (Target_arm::fix_exidx_coverage): Pass layout to
6920 Arm_output_section::fix_exidx_coverage.
6921 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6922 from ".ARM.exidx." and ".ARM.extab.".
6924 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6926 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6927 section if it does not already exist.
6928 * attributes.cc (Attributes_section_data::Attributes_section_data):
6929 Don't crash if size is zero.
6931 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6932 Ian Lance Taylor <iant@google.com>
6934 * gold.cc (queue_middle_tasks): If no input files were opened,
6936 * workqueue.h (Task_function::Task_function): Assert that there is
6939 2010-02-22 Doug Kwan <dougkwan@google.com>
6941 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6942 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6943 types to avoid warnings due to different uint64_t implementations
6946 2010-02-21 Doug Kwan <dougkwan@google.com>
6948 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6949 handling of the maximum backward branch offset.
6950 (Arm_relocate_functions::thumb_branch_common): Ditto.
6951 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6952 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6953 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6954 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6955 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6956 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6957 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6958 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6959 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6960 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6961 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6962 thumb2_bl_out_of_range.o): New rules.
6963 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6964 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6965 thumb2_bl_out_of_range
6966 * testsuite/Makefile.in: Regenerate.
6967 * testsuite/arm_bl_in_range.s: New file.
6968 * testsuite/arm_bl_out_of_range.s: Ditto.
6969 * testsuite/arm_branch_in_range.sh: Ditto.
6970 * testsuite/arm_branch_range.t: Ditto.
6971 * testsuite/thumb2_branch_range.t: Ditto.
6972 * testsuite/thumb_bl_in_range.s: Ditto.
6973 * testsuite/thumb_bl_out_of_range.s: Ditto.
6974 * testsuite/thumb_branch_range.t: Ditto.
6976 2010-02-20 Sriraman Tallam <tmsriram@google.com>
6978 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6979 Add reloc offset information.
6980 * icf.cc (get_section_contents): Change iterators to point to the new
6981 vectors. Add reloc offset information to the contents.
6982 * icf.h (Icf::Sections_reachable_info): New typedef.
6983 (Icf::Sections_reachable_list): New typedef.
6984 (Icf::Offset_info): New typedef.
6985 (Icf::Reloc_info): New struct typedef.
6986 (Icf::Reloc_info_list): New typedef.
6987 (Icf::symbol_reloc_list): Delete method.
6988 (Icf::addend_reloc_list): Delete method.
6989 (Icf::section_reloc_list): Delete method.
6990 (Icf::reloc_info_list): New method.
6991 (Icf::reloc_info_list_): New member.
6993 2010-02-19 Doug Kwan <dougkwan@google.com>
6995 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6996 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6997 * arm.cc (Arm_relocation_functions): New forward declaration.
6998 (Target_arm::Target_arm): Initialize new data members
6999 got_mod_index_offset_ and tls_base_symbol_defined_.
7000 (Target_arm::Relocate::relocate_tls): New method.
7001 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7002 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7004 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7005 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7006 (Target_arm::got_mod_index_offset_,
7007 Target_arm::tls_base_symbol_defined_): New data members.
7008 (Target_arm::Scan::local, Target::Scan::global,
7009 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7012 2010-02-18 Doug Kwan <dougkwan@google.com>
7014 * arm.cc (Arm_relobj::find_linked_text_section): New method.
7015 (Arm_relobj::make_exidx_input_section): Pass section index of linked
7016 text section as a parameter becuase some broken tools may not set
7017 the link in section header.
7018 (Target_arm::has_got_section): New method.
7019 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7020 without any mapping symbol as data only. Remove warning.
7021 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7022 link in its section header, try to discover the link by inspecting the
7023 REL31 relocation at the beginning of the section.
7024 (Target_arm::Scan::check_non_pic): Report name of offending relocation
7026 (Target_arm::Scan::global): Treat any reference to the symbol
7027 _GLOBAL_OFFSET_TABLE_ as a GOT access.
7029 2010-02-12 Sriraman Tallam <tmsriram@google.com>
7031 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7032 (Scan::global_reloc_may_be_function_pointer): New function.
7033 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7034 (Scan::global_reloc_may_be_function_pointer): New function.
7035 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7036 (Scan::global_reloc_may_be_function_pointer): New function.
7037 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7038 (Scan::global_reloc_may_be_function_pointer): New function.
7039 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7040 (Scan::global_reloc_may_be_function_pointer): New function.
7041 (Scan::possible_function_pointer_reloc): New function.
7042 (Target_x86_64::can_check_for_function_pointers): New function.
7043 * gc.h (gc_process_relocs): Scan relocation types to determine if
7044 function pointers were taken for targets that support it.
7045 * icf.cc (Icf::find_identical_sections): Include functions for
7046 folding in safe ICF whose pointer is not taken.
7047 * icf.h (Secn_fptr_taken_set): New typedef.
7048 (fptr_section_id_): New member.
7049 (section_has_function_pointers): New function.
7050 (set_section_has_function_pointers): New function.
7051 (check_section_for_function_pointers): New function.
7052 * options.h: Fix comment for safe ICF option.
7053 * target.h (can_check_for_function_pointers): New function.
7054 * testsuite/Makefile.am: Add icf_safe_so_test test case.
7055 Modify icf_safe_test for X86-64.
7056 * testsuite/Makefile.in: Regenerate.
7057 * testsuite/icf_safe_so_test.cc: New file.
7058 * testsuite/icf_safe_so_test.sh: New file.
7059 * testsuite/icf_safe_test.cc (kept_func_3): New function.
7060 (main): Change to take pointer to function kept_func_3.
7061 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7062 folding is done correctly for X86-64.
7064 2010-02-12 David S. Miller <davem@davemloft.net>
7066 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7067 is_symbolless parameter.
7068 (Output_reloc<SHT_REL>::is_symbolless): New.
7069 (Output_reloc<SHT_REL>::is_symbolless_): New.
7070 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7071 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7072 (Output_reloc<SHT_RELA>::is_symbolless): New.
7073 (Output_data_reloc::add_global): Handle is_symbolless.
7074 (Output_data_reloc::add_global_relative): Likewise.
7075 (Output_data_reloc::add_local): Likewise.
7076 (Output_data_reloc::add_local_relative): Likewise.
7077 (Output_data_reloc::add_symbolless_global_addend): New.
7078 (Output_data_reloc::add_symbolless_local_addend): New.
7079 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7081 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7082 instead of ->is_relative_
7083 (Output_reloc::write): Likewise.
7084 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7085 (Output_reloc::write_rel): Simplify.
7087 * sparc.cc (Target_sparc::Scan::local): Use
7088 ->add_symbolless_local_addend as needed.
7089 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7090 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
7091 based upon relocation offset.
7093 2010-02-11 Doug Kwan <dougkwan@google.com>
7095 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7096 (Target_arm::Scan::global): Ditto. Also remove a comment before the
7097 beginning of function.
7098 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7099 and MOVT_ABS relocations. Those are non issued in scanning. Fix
7100 parameter is_32bit in calls to should_apply_static_reloc.
7101 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7102 (check_DATA): Add arm_abs_global.stdout.
7103 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7104 arm_abs_global.stdout): New rules.
7105 (MOSTLLYCLEANFILES): Add arm_abs_global
7106 * Makefile.in: Regenerate.
7107 * testsuite/arm_abs_global.s: New file.
7108 * testsuite/arm_abs_global.sh: Ditto.
7109 * testsuite/arm_abs_lib.s: Ditto.
7111 2010-02-11 Ian Lance Taylor <iant@google.com>
7113 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7115 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
7116 Allocate_commons_task first.
7117 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7118 task, rather than symtab_lock_.
7119 (Gc_process_relocs::~Gc_process_relocs): New function.
7120 (Gc_process_relocs::is_runnable): Check this_blocker_.
7121 (Gc_process_relocs::locks): Use next_blocker_ rather than
7123 (Scan_relocs::~Scan_relocs): New function.
7124 (Scan_relocs::is_runnable): Check this_blocker_ rather than
7126 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
7128 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7129 fields. Add this_blocker_ and next_blocker_ fields. Adjust
7130 constructor accordingly.
7131 (class Gc_process_relocs): Likewise.
7132 (class Scan_relocs): Likewise.
7133 * common.h (class Allocate_commons_task): Remove symtab_lock_
7134 field, and corresponding constructor parameter.
7135 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7137 (Allocate_commons_task::locks): Likewise.
7139 2010-02-11 Ian Lance Taylor <iant@google.com>
7141 * gold-threads.h (class Once): Define.
7142 (class Initialize_lock): Rewrite as child of Once.
7143 * gold-threads.cc (class Once_initialize): Define.
7144 (once_pointer_control): New static variable.
7145 (once_pointer, once_arg): New static variables.
7146 (c_run_once): New static function.
7147 (Once::Once, Once::run_once, Once::internal_run): New functions.
7148 (class Initialize_lock_once): Remove.
7149 (initialize_lock_control): Remove.
7150 (initialize_lock_pointer): Remove.
7151 (initialize_lock_once): Remove.
7152 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7153 (Initialize_lock::initialize): Rewrite.
7154 (Initialize_lock::do_run_once): New function.
7155 * archive.cc (Archive::interpret_header): Only clear name if it is
7157 * fileread.cc: Include "gold-threads.h"
7158 (file_counts_lock): New static variable.
7159 (file_counts_initialize_lock): Likewise.
7160 (File_read::release): Only increment counts when using --stats.
7161 Use a lock around the increment.
7162 * parameters.cc (class Set_parameters_target_once): Define.
7163 (set_parameters_target_once): New static variable.
7164 (Parameters::Parameters): Move here from parameters.h.
7165 (Parameters::set_target): Rewrite.
7166 (Parameters::set_target_once): New function.
7167 (Parameters::clear_target): Move here and rewrite.
7168 * parameters.h (class Parameters): Update declarations. Add
7169 set_parameters_target_once_ field.
7170 (Parameters::Parameters): Move to parameters.cc.
7171 (Parameters::clear_target): Likewise.
7172 * readsyms.cc (Read_symbols::do_group): Create a Start_group
7174 (Start_group::~Start_group): New function.
7175 (Start_group::is_runnable): New function.
7176 (Start_group::locks, Start_group::run): New functions.
7177 (Finish_group::run): Change saw_undefined to size_t.
7178 * readsyms.h (class Start_group): Define.
7179 (class Finish_group): Change saw_undefined_ field to size_t.
7180 (Finish_group::Finish_group): Remove saw_undefined and
7181 this_blocker parameters. Change all callers.
7182 (Finish_group::set_saw_undefined): New function.
7183 (Finish_group::set_blocker): New function.
7184 * symtab.h (class Symbol_table): Change saw_undefined to return
7185 size_t. Change saw_undefined_ field to size_t.
7186 * target-select.cc (Set_target_once::do_run_once): New function.
7187 (Target_selector::Target_selector): Initialize set_target_once_
7188 field. Don't initialize lock_ and initialize_lock_ fields.
7189 (Target_selector::instantiate_target): Rewrite.
7190 (Target_selector::set_target): New function.
7191 * target-select.h (class Set_target_once): Define.
7192 (class Target_selector): Update declarations. Make
7193 Set_target_once a friend. Remove lock_ and initialize_lock_
7194 fields. Add set_target_once_ field.
7196 2010-02-10 Ian Lance Taylor <iant@google.com>
7198 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7200 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
7201 (queue_middle_tasks): Add all blockers before queueing any tasks.
7202 (queue_final_tasks): Likewise.
7203 * token.h (Task_token::add_blockers): New function.
7204 * object.h (Input_objects::number_of_relobjs): New function.
7206 2010-02-10 Ian Lance Taylor <iant@google.com>
7208 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7209 shared, not if not position independent.
7210 * x86_64.cc (Relocate::relocate_tls): Likewise.
7211 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7212 (tls_pie_pic_test): New target.
7213 * testsuite/Makefile.in: Rebuild.
7215 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7216 (tls_test_main_pie.o, tls_test_pie.o): New targets.
7217 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7218 * testsuite/Makefile.in: Rebuild.
7220 2010-02-09 David S. Miller <davem@davemloft.net>
7222 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7223 R_SPARC_RELATIVE using ->add_local_relative().
7224 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7226 * output.h (Output_data_dynamic::add_section_size): New method
7227 that takes two Output_data objects.
7228 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7229 entry param. Handle it in initializers.
7230 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7231 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7232 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7234 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7235 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7236 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7237 for dynrel_includes_plt.
7238 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7239 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7240 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7242 (Target_sparc::do_finalize_sections): Update to pass true for
7243 dynrel_includes_plt.
7244 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7245 output before .rela.plt
7246 (Target_powerpc::do_finalize_sections): Update to pass true for
7247 dynrel_includes_plt when 32-bit.
7249 2010-02-08 Doug Kwan <dougkwan@google.com>
7251 * arm.cc (Arm_relobj::simple_input_section_output_address): New
7253 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7254 Arm_relobj::scan_section_for_cortex_a8_stubs,
7255 Arm_relobj::do_relocation_section): Instead of calling
7256 Output_section::output_address, use faster
7257 Arm_relobj::simple_input_section_output_address.
7259 2010-02-08 David S. Miller <davem@davemloft.net>
7261 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7262 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7263 relocation helper function.
7265 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7266 just like R_SPARC_GOT{10,13,22}.
7267 (Target_sparc::Scan::local): Likewise.
7268 (Target_sparc::Relocate:relocate): Likewise.
7270 2010-02-06 Ian Lance Taylor <iant@google.com>
7272 * configure.ac: Rewrite targetobjs duplicate removal code to use
7273 only shell constructs.
7274 * configure: Rebuild.
7276 2010-02-05 Doug Kwan <dougkwan@google.com>
7279 * arm.cc (Arm_relobj::section_is_scannable): New method.
7280 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7281 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7283 2010-02-04 Doug Kwan <dougkwan@google.com>
7286 * arm-reloc-property.cc (cstdio): Include.
7287 * configure.ac (targetobjs): Remove duplicates.
7288 * configure: Regenerate.
7289 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7290 big and little endian version for a given address size.
7292 2010-02-03 Doug Kwan <dougkwan@google.com>
7294 * arm-reloc-property.cc
7295 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7297 * arm-reloc-property.h
7298 (Arm_reloc_property_table::get_implemented_static_reloc_property):
7299 New method definition.
7300 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7302 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7304 (GOT_PREL): Change implemented to Y.
7305 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7306 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7307 (Arm_relocate_functions::movw_abs_nc): Remove method.
7308 (Arm_relocate_functions::movt_abs): Ditto.
7309 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7310 (Arm_relocate_functions::thm_movt_abs): Ditto.
7311 (Arm_relocate_functions::movw_rel_nc): Ditto.
7312 (Arm_relocate_functions::movw_rel): Ditto.
7313 (Arm_relocate_functions::movt_rel): Ditto.
7314 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7315 (Arm_relocate_functions:thm_movw_rel): Ditto.
7316 (Arm_relocate_functions:thm_movt_rel): Ditto.
7317 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7318 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7319 New method definitions.
7320 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7321 (Arm_relocation_functions::arm_grp_ldr): Ditto.
7322 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7323 (Arm_relocation_functions::arm_grp_ldc): Ditto.
7324 (Target_arm::Relocate::relocate): Check for non-static or
7325 unimplemented relocation code and exit early. Change calls to
7326 Target_arm::reloc_uses_thumb_bit and
7327 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7328 instead. Refactor code to handle similar relocations to increase
7329 code sharing. Remove check for unsupported relocation code in switch
7331 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7332 relocation property table to find out size. Change error message to
7333 print out the name of a relocation code instead of the numeric value.
7334 (Target_arm::scan_reloc_for_stub): Use relocation property table
7335 instead of calling Target_arm::reloc_uses_thumb_bit().
7337 2010-02-02 Doug Kwan <dougkwan@google.com>
7339 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7340 types of relaxed input section.
7342 2010-02-02 Doug Kwan <dougkwan@google.com>
7344 * Makefile.am (HFILES): Add arm-reloc-property.h.
7346 (TARGETSOURCES): Add arm-reloc-property.cc
7347 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7348 (libgold_a_SOURCES): $(DEFFILES)
7349 * Makefile.in: Regenerate.
7350 * arm-reloc-property.cc: New file.
7351 * arm-reloc-property.h: New file.
7352 * arm-reloc.def: New file.
7353 * arm.cc: Update comments.
7354 (arm-reloc-property.h): New included header.
7355 (arm_reloc_property_table): New global variable.
7356 (Target_arm::do_select_as_default_target): New method definition.
7357 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7358 arm-reloc-property to targ_extra_obj.
7359 * parameters.cc (set_parameters_target): Call
7360 Target::select_as_default_target().
7361 * target.h (Target::select_as_default_target): New method definition.
7362 (Target::do_select_as_default_target): Same.
7364 2010-02-01 Doug Kwan <dougkwan@google.com>
7366 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7367 first_output_text_section_.
7368 (Arm_exidx_fixup::first_output_text_section): New method definition.
7369 (Arm_exidx_fixup::first_output_text_section_): New data member.
7370 (Arm_exidx_fixup::process_exidx_section): Record the first text
7371 output section seen.
7372 (Arm_output_section::fix_exidx_coverage): Set correct linked section
7373 and entsize in output section header.
7375 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7377 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7378 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7379 (Arm_relocate_functions::thm_alu11): New Method.
7380 (Arm_relocate_functions::thm_pc8): New Method.
7381 (Arm_relocate_functions::thm_pc12): New Method.
7382 (Target_arm::Scan::local): Handle the relocations.
7383 (Target_arm::Scan::global): Likewise.
7384 (Target_arm::Relocate::relocate): Likewise.
7385 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7387 2010-01-29 Doug Kwan <dougkwan@google.com>
7389 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7390 of relocation types as ld.
7392 2010-01-29 Doug Kwan <dougkwan@google.com>
7394 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7396 (Arm_relocate_functions::thumb_branch_common): Ditto.
7397 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7398 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7399 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7400 Arm_relocate_functions::jump24): Remove.
7401 (Target_arm::Relocate::relocate): Adjust code to call
7402 Arm_relocation_functions::arm_branch_common and
7403 Arm_relocation_functions::thumb_branch_common instead of their removed
7404 wrappers. Merge switch-cases together to reduce source code size.
7406 2010-01-29 Doug Kwan <dougkwan@google.com>
7408 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7409 output_local_symbol_count_needs_update_.
7410 (Arm_relobj::output_local_symbol_count_needs_update,
7411 Arm_relobj::set_output_local_symbol_count_needs_update,
7412 Arm_relobj::update_output_local_symbol_count): New methods.
7413 (Arm_relobj::output_local_symbol_count_needs_update_): New data
7415 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7416 of pointed function as in a R_ARM_PREL31 relocation.
7417 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7418 for output local symbol count updating.
7419 (Target_arm::do_relax): Update output local symbol counts in objects
7421 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7423 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7425 * arm.cc: Added support for the ARM relocations:
7426 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7427 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7428 (Arm_relocate_functions::movw_rel_nc): Renamed (was
7430 (Arm_relocate_functions::movw_rel): New method.
7431 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7432 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7434 (Arm_relocate_functions::thm_movw_rel): New method.
7435 (Arm_relocate_functions::thm_movt_rel): Renamed (was
7437 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7439 (Target_arm::Scan::global): Likewise.
7440 (Target_arm::Relocate::relocate): Likewise.
7441 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7444 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7446 * arm.cc: Added support for ARM group relocations.
7447 (Target_arm::reloc_needs_sym_origin): New method.
7448 (Arm_relocate_functions::calc_grp_kn): New method.
7449 (Arm_relocate_functions::calc_grp_residual): New method.
7450 (Arm_relocate_functions::calc_grp_gn): New method.
7451 (Arm_relocate_functions::arm_grp_alu): New Method.
7452 (Arm_relocate_functions::arm_grp_ldr): New Method.
7453 (Arm_relocate_functions::arm_grp_ldrs): New Method.
7454 (Arm_relocate_functions::arm_grp_ldc): New Method.
7455 (Target_arm::Scan::local): Handle the ARM group relocations.
7456 (Target_arm::Scan::global): Likewise.
7457 (Target_arm::Relocate::relocate): Likewise.
7458 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7461 2010-01-26 Doug Kwan <dougkwan@google.com>
7463 * arm.cc (set): Include.
7464 (class Arm_exidx_fixup): Change type of last_input_section_ to const
7466 (Arm_output_section::Text_section_list): New type.
7467 (Arm_output_section::append_text_sections_to_list): New method.
7468 (Arm_output_section::fix_exidx_coverage): Ditto.
7469 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7470 (Arm_relobj::convert_input_section_to_relaxed_section): Use
7471 Relobj::set_section_offset() instead of
7472 Sized_relobj::invalidate_section_offset().
7473 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7474 parameter for section headers. Ignore relocation sections for
7475 unallocated sections and EXIDX sections.
7476 (Target_arm::fix_exidx_coverage): New method.
7477 (Target_arm::output_section_address_less_than): New type.
7478 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7479 linked text section instead of the EXIDX section.
7480 (Arm_output_section::create_stub_group): Add an assertion to check
7481 that this is not an EXIDX output section.
7482 (Arm_output_section::append_text_sections_to_list): New method.
7483 (Arm_output_section::fix_exidx_coverage): Ditto.
7484 (Arm_relobj::scan_sections_for_stubs): Adjust call to
7485 Arm_relobj::section_needs_reloc_stub_scanning.
7486 (Target_arm::do_relax): Fix EXIDX output section coverage in the
7488 (Target_arm::fix_exidx_coverage): New method.
7489 * object.h (Relobj::set_output_section): New method.
7490 (Sized_relobj::invalidate_section_offset): Remove method.
7491 (Sized_relobj::do_invalidate_section_offset): Remove method.
7492 (Sized_relobj::do_set_section_offset): Handle offset value -1.
7494 2010-01-25 Doug Kwan <dougkwan@google.com>
7496 * arm.cc (Arm_exidx_merged_section::do_output_offset):
7497 Fix warning due to signed and unsigned comparison on a 32-bit host.
7499 2010-01-22 Doug Kwan <dougkwan@google.com>
7501 * arm.cc (Target_arm::do_relax): Record an output section for section
7502 offset adjustment it contains any stub table that has changed.
7503 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7504 offsets in an output section if necessary.
7505 * output.cc (Output_section::Output_section): Initialize
7506 section_offsets_need_adjustments_.
7507 (Output_section::add_input_section_for_script): Renamed to
7508 Output_section::add_simple_input_section.
7509 (Output_section::save_states): Add a comment.
7510 (Output_section::discard_states): New method defintion.
7511 (Output_section::adjust_section_offsets): Same.
7512 * output.h (Output_section::add_input_section_for_script): Renamed to
7513 Output_section::add_simple_input_section.
7514 (Output_section::discard_states): New method declaration.
7515 (Output_section::adjust_section_offsets): Same.
7516 (Output_section::section_offsets_need_adjustment,
7517 Output_section::set_section_offsets_need_adjustment): New method
7519 (Output_section::section_offsets_need_adjustment_): New data member.
7520 * script-sections.cc
7521 (Output_section_element_input::set_section_address): Adjust code for
7522 renaming of Output_section::add_input_section_for_script.
7523 (Orphan_output_section::set_section_address): Same.
7525 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7527 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7528 Fix_v4bx enum values .
7529 * gold/options.h (General_options): New option definitions.
7530 (General_options::fix_v4bx): New method.
7531 (General_options::Fix_v4bx): New enum.
7532 * gold/options.cc (General_options::parse_fix_v4bx): New method.
7533 (General_options::parse_fix_v4bx_interworking): New method.
7535 2010-01-22 Doug Kwan <dougkwan@google.com>
7537 * arm.cc (Arm_exidx_fixup): New class.
7539 2010-01-21 Doug Kwan <dougkwan@google.com>
7541 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7543 (Arm_exidx_section_offset_map): New type.
7545 2010-01-21 Doug Kwan <dougkwan@google.com>
7547 * arm.cc (Arm_exidx_input_section): New class.
7548 (Arm_relobj::exidx_input_section_by_link,
7549 Arm_relobj::exidx_input_section_by_shndx,
7550 Arm_relobj::make_exidx_input_section): New methods.
7551 (read_arm_attributes_section): Remove.
7552 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7553 information about them.
7554 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7557 2010-01-20 Doug Kwan <dougkwan@google.com>
7559 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7560 Input_section_specifier to Section_id.
7561 (Target_arm::new_arm_input_section: Adjust code for change of key
7563 (Target_arm::find_arm_input_section): Ditto.
7564 * gc.h (object.h): Include for Section_id nand Section_id_hash.
7565 (Section_id): Remove.
7566 (Garbage_collection::Section_id_hash): Remove.
7567 * icf.h (object.h): Include for Section_id nand Section_id_hash.
7568 (Section_id): Remove.
7569 (Icf::Section_id_hash): Remove.
7570 * object.h (Section_id, Const_section_id, Section_id_hash,
7571 Const_section_id_hash): New type definitions.
7572 * output.cc (Output_section::add_relaxed_input_section): Change to
7573 use Const_section_id instead of Input_section_specifier as key type.
7574 (Output_section::add_merge_input_section): Ditto.
7575 (Output_section::build_relaxation_map): Change to use Section_id
7576 instead of Input_section_specifier as key type.
7577 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7579 (Output_section::convert_input_sections_to_relaxed_sections): Change
7580 to use Const_section_id instead of Input_section_specifier as key type.
7581 (Output_section::find_merge_section): Ditto.
7582 (Output_section::find_relaxed_input_section): Ditto.
7583 * output.h (Input_section_specifier): Remove class.
7584 (Output_section::Output_section_data_by_input_section_map): Change
7585 key type to Const_section_id.
7586 (Output_section::Output_relaxed_input_section_by_input_section_map):
7588 (Output_section::Relaxation_map): Change key type to Section_id.
7590 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7592 * gold/arm.cc: Added support for R_ARM_V4BX relocation
7593 (class Arm_v4bx_stub): New class.
7594 (DEF_STUBS): Updated definition to support v4_veneer_bx.
7595 (Stub_factory::make_arm_v4bx_stub): New method.
7596 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7597 (Stub_table::empty): Handle v4bx stubs.
7598 (Stub_table::add_arm_v4bx_stub): New method.
7599 (Stub_table::find_arm_v4bx_stub): New method.
7600 (Arm_relocate_functions::v4bx): New method.
7601 (Target_arm::fix_v4bx): New method.
7602 (Target_arm::Target_arm): Handle R_ARM_V4BX.
7603 (Stub_table::relocate_stubs): Likewise.
7604 (Stub_table::do_write): Likewise.
7605 (Stub_table::update_data_size_and_addralign): Likewise.
7606 (Stub_table::finalize_stubs): Likewise.
7607 (Target_arm::Scan::local): Likewise.
7608 (Target_arm::Scan::global): Likewise.
7609 (Target_arm::do_finalize_sections): Likewise.
7610 (Target_arm::Relocate::relocate): Likewise.
7611 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7613 (Target_arm::scan_reloc_for_stub): Likewise.
7614 (Target_arm::scan_reloc_section_for_stubs): Likewise.
7616 2010-01-19 Ian Lance Taylor <iant@google.com>
7618 * output.cc (Output_section_headers::do_sized_write): Write large
7619 segment count to sh_info field.
7620 (Output_file_header::do_sized_write): For large segment count,
7621 write PN_XNUM to e_phnum field.
7623 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7625 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7626 (Arm_relocate_functions::thm_jump8): New function.
7627 (Arm_relocate_functions::thm_jump11): New function.
7628 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7630 (Target_arm::Scan::global): Likewise.
7631 (Target_arm::Relocate::relocate): Likewise.
7632 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7635 2010-01-14 Doug Kwan <dougkwan@google.com>
7637 * arm.cc (map, utility): Include headers.
7638 (Target_arm::apply_cortex_a8_workaround): New method.
7639 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7640 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7641 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7642 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7643 the --[no-]fix-cortex-a8 command line options.
7644 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7645 (Target_arm::relocate_stub): Use addend in instruction template.
7646 * options.h (DEFINE_bool): Set the user-set flag.
7647 (General_options): Add --[no-]-fix-cortex options.
7648 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7649 : Update fast look-up map after conversion.
7651 2010-01-14 Sriraman Tallam <tmsriram@google.com>
7653 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7654 in the first pass of do_layout.
7656 2010-01-13 Doug Kwan <dougkwan@google.com>
7658 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7659 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7660 apparent compiler problem of not folding static constant integral
7661 data members of elfcpp::Elf_sizes<32>.
7663 2010-01-13 Doug Kwan <dougkwan@google.com>
7665 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7666 Arm_relobj::section_needs_cortex_a8_stub_scanning,
7667 Arm_relobj::scan_section_for_cortex_a8_erratum,
7668 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7669 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7670 sections to scan for relocation stubs into a new method
7671 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
7672 relocation and Cortex-A8 stub scanning.
7673 (Target_arm::do_relax): Force stubs to be after stubbed sections
7674 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
7675 the beginning of a new relaxation pass. Update a comment.
7676 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7678 2010-01-12 Ian Lance Taylor <iant@google.com>
7680 * target-reloc.h (visibility_error): New inline function.
7681 (relocate_section): Call visibility_error.
7682 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7683 (MOSTLYCLEANFILES): Likewise.
7684 (protected_4_pic.o, protected_3.err): New targets.
7685 * testsuite/protected_4.cc: New file.
7687 2010-01-12 Doug Kwan <dougkwan@google.com>
7689 * arm.cc (Cortex_a8_reloc): New class.
7690 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7691 and cortex_a8_relocs_info_.
7692 (Target_arm::fix_cortex_a8): New method definition.
7693 (Target_arm::Cortex_a8_relocs_info): New type.
7694 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7695 New data member declarations.
7696 (Target_arm::scan_reloc_for_stub): Record information about
7697 relocations for THUMB branches that might be exempted from the
7698 Cortex-A8 workaround.
7699 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7700 at the beginning of a relaxation pass.
7702 2010-01-12 Doug Kwan <dougkwan@google.com>
7704 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7705 (Arm_relobj::Mapping_symbol_position,
7706 Arm_reloj::Mapping_symbol_position_less,
7707 Arm_relobj::Mapping_symbols_info): New types.
7708 (Target_arm::is_mapping_symbol_name): New method definition.
7709 (Arm_relobj::do_count_local_symbols): Save information about mapping
7712 2010-01-11 Doug Kwan <dougkwan@google.com>
7714 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7715 Arm_relocate_functions::thumb32_branch_upper,
7716 Arm_relocate_functions::thumb32_branch_lower,
7717 Arm_relocate_functions::thumb32_cond_branch_offset,
7718 Arm_relocate_functions::thumb32_cond_branch_upper,
7719 Arm_relocate_functions::thumb32_cond_branch_lower,
7720 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7721 branch offset encoding.
7722 (Arm_relocate_functions::thumb_branch_common): Use new branch
7723 offset encoding methods to avoid code duplication.
7724 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7725 (Stub_addend_reader::operator()): Use new branch encoding method
7726 to avoid code duplication.
7728 2010-01-11 Doug Kwan <dougkwan@google.com>
7730 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7731 (Target_arm::do_finalize_sections): Define special EXIDX section
7732 symbols only if referenced.
7733 * gc.h (Garbage_collection::add_reference): New method.
7734 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7737 2010-01-11 Ian Lance Taylor <iant@google.com>
7739 * script.cc (Version_script_info::build_expression_list_lookup):
7740 Change complaing about duplicate wildcard match from error to
7743 * script.cc (class Lazy_demangler): Recreate--revert part of patch
7745 (Version_script_info::Version_script_info): Initialize globs_,
7746 default_version_, default_is_global_, and exact_. Don't
7747 initialize globals_ or locals_.
7748 (Version_script_info::build_lookup_tables): Build local symbols
7750 (Version_script_info::unquote): New function.
7751 (Version_script_info::add_exact_match): New function.
7752 (Version_script_info::build_expression_list_lookup): Remove lookup
7753 parameter. Add is_global parameter. Change all callers. Handle
7754 wildcard pattern specially. Unquote pattern. Call
7756 (Version_script_info::get_name_to_match): New function.
7757 (Version_script_info::get_symbol_version): New function.
7758 (Version_script_info::get_symbol_version_helper): Remove.
7759 (Version_script_info::check_unmatched_names): Call unquote.
7760 * script.h (class Version_script_info): Change get_symbol_version
7761 to be non-inline and add is_global parameter; change all callers.
7762 Rewrite symbol_is_local. Update declarations. Define struct
7763 Version_tree_match, Exact, Globs. Don't define struct Lookup.
7764 Remove globals_ and locals_ members. Add exact_, globs_,
7765 default_version_, is_global_.
7766 (Version_script_info::Glob): Remove pattern, add expression and
7767 is_global. Update constructor. Change all callers.
7768 * dynobj.cc (Versions::finalize): Mark the version symbol as the
7770 (Versions::symbol_section_contents): If a symbol is undefined, or
7771 defined in a dynamic object, set the version index to
7773 * symtab.cc (Symbol_table::add_from_relobj): Don't call
7775 (Symbol_table::add_from_pluginobj): Likewise.
7776 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7778 2010-01-11 Doug Kwan <dougkwan@google.com>
7780 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7781 (incremental_dump_LDADD): Add linking option for libintl.
7782 * Makefile.in: Regenerate.
7784 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
7787 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7789 * testsuite/Makefile.in: Regenerated.
7791 2010-01-10 Doug Kwan <dougkwan@google.com>
7793 * options.h (DEFINE_var): Use parentheses around argument varname__
7794 in macro body to avoid any unintended subsequent substitutions.
7796 2010-01-10 Ian Lance Taylor <iant@google.com>
7798 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7799 candidates before doing symbol resolution.
7801 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7802 ODR candidates if only one is weak.
7804 2010-01-08 Ian Lance Taylor <iant@google.com>
7806 * script.cc (Version_script_info::build_expression_list_lookup):
7807 Don't warn about ambiguous version, just record the ambiguity.
7808 (Version_script_info::get_symbol_version_helper): Give error if
7809 version is ambiguous.
7811 2010-01-08 Doug Kwan <dougkwan@google.com>
7813 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7814 prev_data_size_ and prev_addralign_. Remove initializer for
7815 deleted data member has_been_changed_.
7816 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7817 to determine if the table is empty.
7818 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7820 (Stub_table::add_reloc_stub): Define method in class definition
7821 instead of just declaring it there.
7822 (Stub_table::add_cortex_a8_stub): New method definition.
7823 (Stub_table::update_data_size_and_addralign): Ditto.
7824 (Stub_table::finalize_stubs): Ditto.
7825 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7826 (Stub_table::do_addralign_): Return address alignment in the
7827 (Stub_table::do_reset_address_and_file_offset): Define method in
7828 class definition instead of declaring it there. Set current data
7829 size to be the data size of the previous pass.
7830 (Stub_table::set_final_data_size): Use current data size as the
7832 (Stub_table::relocate_stub): Change parameter type of stub from
7833 Reloc_stub pointer to Stub pointer.
7834 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7835 (Stub_table::Cortex_a8_stub_list): New typedef.
7836 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7837 Stub_table::prev_addralign_): New data member.
7838 (Arm_relobj::Arm_relobj): Initialize data member
7839 section_has_cortex_a8_workaround_.
7840 (Arm_relobj::section_has_cortex_a8_workaround,
7841 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7843 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7845 (Target_arm::relocate_stub): Change parameter type of stub from
7846 Reloc_stub pointer to Stub pointer.
7847 (Insn_template::size, Insn_template::alignment): Handle
7848 THUMB16_SPECIAL_TYPE.
7849 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7850 Stub_table::update_data_size_and_addralign,
7851 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7853 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7854 (Stub_table::do_write): Ditto.
7855 (Target_arm::do_relax): Adjust code for changes in Stub_table.
7857 2010-01-08 Ian Lance Taylor <iant@google.com>
7860 * symtab.h (class Symbol): Remove fields is_target_special_ and
7861 has_plt_offset_. Add field is_defined_in_discarded_section_.
7862 (Symbol::is_defined_in_discarded_section): New function.
7863 (Symbol::set_is_defined_in_discarded_section): New function.
7864 (Symbol::has_plt_offset): Rewrite.
7865 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7866 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7867 Don't initialize is_target_special_ or has_plt_offset_.
7868 Initialize is_defined_in_discarded_section_.
7869 (Symbol_table::add_from_relobj): If appropriate, set
7870 is_defined_in_discarded_section.
7871 * resolve.cc (Symbol::override_base_with_special): Don't test
7872 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7873 * target-reloc.h (relocate_section): Do special handling for
7874 symbols defined in discarded sections for global symbols as well
7877 2010-01-08 Ian Lance Taylor <iant@google.com>
7879 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7880 the SHT_SYMTAB case.
7882 2010-01-08 Ian Lance Taylor <iant@google.com>
7884 * object.cc (Sized_relobj::do_layout): Don't get confused if
7885 layout_eh_frame returns NULL.
7887 2010-01-08 Ian Lance Taylor <iant@google.com>
7890 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7891 dynamic symbol table, use the normal symbol table.
7892 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7895 2010-01-08 Ian Lance Taylor <iant@google.com>
7898 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7901 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7903 * version.cc (print_version): Change to "Copyright 2010".
7905 2010-01-08 Ian Lance Taylor <iant@google.com>
7909 * i386.cc (class Target_i386): Change return type of plt_section
7911 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7912 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7913 tls_desc_rel_ field.
7914 (Output_data_plt_i386::rel_tls_desc): New function.
7915 (Target_i386::rel_tls_desc_section): New function.
7916 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7917 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7918 R_386_TLS_DESC reloc in rel_tls_desc_section.
7919 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7920 Define struct Tlsdesc_info.
7921 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7922 (Target_x86_64::do_reloc_symbol_index): New function.
7923 (Target_x86_64::add_tlsdesc_info): New function.
7924 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7925 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7927 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7929 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7930 (Target_x86_64::rela_tlsdesc_section): New function.
7931 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7933 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7934 (Target_x86_64::do_reloc_addend): New function.
7935 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7936 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7937 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7938 (Output_reloc::type): New function.
7939 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7940 (Output_reloc::is_target_specific): New function.
7941 (Output_reloc::target_arg): New function.
7942 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7943 absolute relocs and target specific relocs.
7944 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7945 add_target_specific.
7946 (class Output_data_reloc) [SHT_RELA]: Likewise.
7947 * output.cc (Output_reloc::Output_reloc): Add four new versions
7948 for absolute relocs and target specific relocs.
7949 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7950 (Output_reloc::get_symbol_index): Likewise.
7951 (Output_reloc::local_section_offset): Check that local_sym_index_
7952 is not TARGET_CODE or 0.
7953 (Output_reloc::symbol_value): Likewise.
7954 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7956 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7957 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7959 * layout.cc (add_target_dynamic_tags): Use output section for
7960 DT_PLTRELSZ and DT_JMPREL.
7962 2010-01-07 Ian Lance Taylor <iant@google.com>
7965 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7967 (class Output_data_reloc_generic): Define.
7968 (class Output_data_reloc_base): Change base class to
7969 Output_data_reloc_generic. Change add() method to call
7970 bump_relative_reloc_count for a relative reloc. Remove
7972 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7974 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7975 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7977 * layout.h (class Layout): Update declaration.
7979 2010-01-07 Ian Lance Taylor <iant@google.com>
7981 * output.h (class Output_data): Add const version of
7982 output_section and do_output_section.
7983 (class Output_section_data): Add const version of
7985 (class Output_section): Likewise.
7986 * layout.cc (Layout::add_target_dynamic_tags): New function.
7987 * layout.h (class Layout): Update declarations.
7988 * arm.cc (Target_arm::do_finalize_sections): Use
7989 add_target_dynamic_tags.
7990 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7991 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7992 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7993 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7995 2010-01-07 Ian Lance Taylor <iant@google.com>
7998 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8001 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
8002 Ian Lance Taylor <iant@google.com>
8005 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8006 Xindex::read_symtab_xindex.
8008 2010-01-07 Doug Kwan <dougkwan@google.com>
8010 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8011 (Insn_template::thumb16_bcond_insn): New method declaration.
8012 (Insn_template): Fix spelling.
8013 (Stub::thumb16_special): New method declaration.
8014 (Stub::do_write): Define virtual method which was previously pure
8016 (Stub::do_thumb16_special): New method declaration.
8017 (Stub::do_fixed_endian_write): New template member.
8018 (Reloc_stub::do_write): Remove.
8019 (Reloc_stub::do_fixed_endian_write): Remove.
8020 (Cortex_a8_stub): New class definition.
8021 (Stub_factory::make_cortex_a8_stub): New method definition.
8022 (Stub_factory::Stub_factory): Add missing static storage class
8023 qualifier for elf32_arm_stub_a8_veneer_blx.
8025 2010-01-07 Ian Lance Taylor <iant@google.com>
8028 * options.h (class General_options): Add --warn-unresolved-symbols
8029 and --error-unresolved-symbols.
8030 * errors.cc (Errors::undefined_symbol): Implement
8031 --warn-unresolved-symbols.
8033 * options.h (class General_options): Add -z text and -z textoff.
8034 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8036 2010-01-06 Sriraman Tallam <tmsriram@google.com>
8038 * gc.h (Garbage_collection::Cident_section_map): New typedef.
8039 (Garbage_collection::cident_sections): New function.
8040 (Garbage_collection::add_cident_section): New function.
8041 (Garbage_collection::cident_sections_): New member.
8042 (gc_process_relocs): Add references to sections whose names are C
8044 * gold.h (cident_section_start_prefix): New constant.
8045 (cident_section_stop_prefix): New constant.
8046 (is_cident): New function.
8047 * layout.cc (Layout::define_section_symbols): Replace string constants
8048 with the newly defined constants.
8049 * object.cc (Sized_relobj::do_layout): Track sections whose names are
8051 * testsuite/Makefile.am: Add gc_orphan_section_test.
8052 * testsuite/Makefile.in: Regenerate.
8053 * testsuite/gc_orphan_section_test.cc: New file.
8054 * testsuite/gc_orphan_section_test.sh: New file.
8056 2010-01-06 Ian Lance Taylor <iant@google.com>
8059 * options.h (class General_options): Add --warn-shared-textrel.
8060 * layout.cc (Layout::finish_dynamic_section): Implement
8061 --warn-shared-textrel.
8064 * options.h (class General_options): Add --warn-multiple-gp.
8066 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8068 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8069 $(THREADSLIB) and $(LIBDL).
8070 * Makefile.in: Rebuild.
8072 2010-01-06 Ian Lance Taylor <iant@google.com>
8075 * options.cc (General_options::parse_section_start): New function.
8076 (General_options::section_start): New function.
8077 (General_options::General_options): Initialize all members.
8078 * options.h: Include <map>
8079 (class General_options): Add --section-start. Add section_starts_
8081 * layout.cc (Layout::attach_allocated_section_to_segment): If
8082 --section-start was used, set the address of the segment. Remove
8083 local sort_sections.
8084 (Layout::relaxation_loop_body): If the address of the load segment
8085 has been set by --section-start, don't use it.
8086 * output.h (Output_segment::update_flags_for_output_section): New
8088 * output.cc (Output_segment::add_output_section): Call
8089 update_flags_for_output_section.
8091 2010-01-05 Ian Lance Taylor <iant@google.com>
8094 * options.h (class General_options): Add --undefined-version.
8095 * script.cc (struct Version_expression): Add was_matched_by_symbol
8097 (Version_script_info::matched_symbol): New function.
8098 (Version_script_info::get_symbol_version_helper): Call
8100 (Version_script_info::check_unmatched_names): New function.
8101 * script.h (class Version_script_info): Update declarations.
8102 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8104 * options.h (class General_options): Use DEFINE_bool_alias for
8105 allow_multiple_definition.
8106 * resolve.cc (Symbol_table::should_override): Don't test
8107 allow_multiple_definition.
8110 * options.h (class General_options): Add --cref.
8111 * main.cc (main): Print cref table if --cref. Don't close mapfile
8112 until after printing cref table.
8113 * cref.cc: Include "symtab.h".
8114 (class Cref_inputs): Define Cref_table_compare and Cref_table.
8115 (Cref_table_compare::operator()): New function.
8116 (Cref_inputs::gather_cref): New function.
8117 (filecol): New static const.
8118 (Cref_inputs::print_cref): New function.
8119 (Cref::print_cref): New function.
8120 * cref.h: Include <cstdio>.
8121 (class Cref): Update declarations.
8122 * mapfile.h (Mapfile::file): New function.
8123 * object.h (class Object): Define Symbols. Declare virtual
8124 do_get_global_symbols.
8125 (Object::get_global_symbols): New function.
8126 * object.cc (Input_objects::add_object): Pass object to cref_ if
8128 (Input_objects::archive_start): Likewise.
8129 (Input_objects::archive_stop): Likewise.
8130 (Input_objects::print_cref): New function.
8131 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8132 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8134 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8136 * plugin.h (class Sized_pluginobj): Update declarations.
8138 2010-01-05 Ian Lance Taylor <iant@google.com>
8140 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8141 to is_default_version. Rename insdef to insdefault.
8142 (Symbol_table::add_from_relobj): Rename def to is_default_version
8143 and local to is_forced_local.
8144 (Symbol_table::add_from_pluginobj): Likewise.
8145 (Symbol_table::add_from_dynobj): Likewise.
8146 (Symbol_table::define_special_symbol): Rename insdef to
8149 2010-01-04 Ian Lance Taylor <iant@google.com>
8152 * options.h (class General_options): Add
8153 --allow-multiple-definition and -z muldefs.
8154 * resolve.cc (Symbol_table::should_override): Don't warn about a
8155 multiple symbol definition if --allow-multiple-definition or -z
8159 * options.h (class General_options): Add --add-needed and
8160 --copy-dt-needed-entries. Tweak --as-needed help entry.
8161 * object.cc (Input_objects::check_dynamic_dependencies): Give an
8162 error if --copy-dt-needed-entries aka --add-needed is used and
8163 would cause a change in behaviour.
8166 * options.h (class General_options): Add -G as a short version of
8167 --shared. Add no-op options -assert, -g, and -i.
8169 2010-01-04 Sriraman Tallam <tmsriram@google.com>
8171 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8172 check for .text or .gnu.linkonce.t sections.
8173 * icf.cc (Icf::find_identical_sections): Ditto.
8174 Change the detection for mangled function name within the section
8176 * icf.h (is_section_foldable_candidate): New function.
8178 2009-12-30 Ian Lance Taylor <iant@google.com>
8181 * options.h (class General_options): Permit two dashes with
8182 --retain-symbols-file.
8184 2009-12-30 Ian Lance Taylor <iant@google.com>
8187 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8188 don't put the file header and segment headers in the text
8192 * common.cc (Sort_commons::operator()): Stabilize sort when both
8194 (Symbol_table::do_allocate_commons_list): When allocating common
8195 symbols, skip a symbol which is no longer common.
8196 * symtab.h (Symbol::is_common): Test whether the symbol comes from
8197 an object before checking its type.
8198 * testsuite/common_test_2.c: New file.
8199 * testsuite/common_test_3.c: New file.
8200 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8201 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8202 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8203 (common_test_2_pic.o, common_test_2.so): New targets.
8204 (common_test_3_pic.o, common_test_3.so): New targets.
8205 * testsuite/Makefile.in: Rebuild.
8208 * script.cc (read_input_script): If we see a new SECTIONS clause,
8209 and we have added an input section, give an error.
8210 * layout.h (class Layout): Add have_added_input_section function.
8211 Add have_added_input_section_ field.
8212 * layout.cc (Layout::Layout): Initialize
8213 have_added_input_section_.
8214 (Layout::layout): Set have_added_input_section_.
8215 (Layout::layout_eh_frame): Likewise.
8217 2009-12-30 Ian Lance Taylor <iant@google.com>
8220 * options.h (class General_options): Add --sort-common option.
8221 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8222 * common.cc (Sort_common): Add sort_order parameter to
8223 constructor. Add sort_order_ field.
8224 (Sort_commons::operator): Check sort_order_.
8225 (Symbol_table::allocate_commons): Determine the sort order.
8226 (Symbol_table::do_allocate_commons): Add sort_order parameter.
8228 (Symbol_table::do_allocate_commons_list): Likewise.
8230 2009-12-30 Ian Lance Taylor <iant@google.com>
8233 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8234 symbols from this object, don't change the visibility of an
8236 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8238 2009-12-30 Ian Lance Taylor <iant@google.com>
8241 * script.h (class Version_script_info): Define Language enum.
8242 Update declarations. Define Glob, Exact, and Lookup types. Add
8243 new fields globals_, locals_, and is_finalized_.
8244 * script.cc: Various formatting fixes.
8245 (class Parser_closure): Change language_stack_ from a vector of
8246 std::string to one of Version_script_info::Language. Adjust all
8248 (class Lazy_demangler): Remove.
8249 (struct Version_expression): Change language from std::string to
8250 Version_script_info::Language.
8251 (Version_script_info::Version_script_info): New function.
8252 (Version_script_info::~Version_script_info): Don't call clear.
8253 (Version_script_info::finalize): New function.
8254 (Version_script_info::build_lookup_tables): New function.
8255 (Version_script_info::build_expression_list_lookup): New
8257 (Version_script_info::get_symbol_version_helper): Rewrite to use
8259 (Version_script_info::print_expression_list): Adjust to use
8260 Version_script_info::Language.
8261 (script_push_lex_into_version_mode): Check that the version script
8262 has not been finalized.
8263 (version_script_push_lang): Change language string to
8264 Version_script_info::Language.
8265 * options.cc (Command_line::version_script): New function.
8266 * options.h (class General_options): Add finalize_dynamic_list
8267 function. Change version_script from declaration to definition.
8268 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8269 * testsuite/version_script.map: Remove duplicate def of foo.
8270 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8272 * testsuite/Makefile.in: Rebuild.
8274 2009-12-30 Ian Lance Taylor <iant@google.com>
8277 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8278 if the input symbol index is 0, make the output symbol index 0.
8280 2009-12-30 Ian Lance Taylor <iant@google.com>
8283 * options.h (class General_options): Add -x/--discard-all.
8284 * object.cc (Sized_relobj::do_count_local_symbols): Handle
8285 --discard-all. If the local symbol needs a dynamic entry, check
8286 that before handling --discard-locals.
8288 2009-12-30 Ian Lance Taylor <iant@google.com>
8291 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8293 (Output_segment::add_output_section): Don't change the flags if
8297 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8298 GNU hash table if they need a dynamic value. Otherwise, don't add
8299 them if they are defined in a dynamic object or are forced local.
8301 2009-12-29 Ian Lance Taylor <iant@google.com>
8304 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8305 .gnu.hash table for a 32-bit target.
8308 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8309 regular and a dynamic object only needs a dynamic symbol table
8310 entry if it is externally visible.
8313 * i386.cc (class Target_i386): Initialize global_offset_table_ in
8314 constructor. Add global_offset_table_ field.
8315 (Target_i386::got_section): Set global_offset_table_.
8316 (Target_i386::do_finalize_sections): Set global_offset_table_
8318 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8319 in constructor. Add global_offset_table_ field.
8320 (Target_x86_64::got_section): Set global_offset_table_.
8321 (Target_x86_64::do_finalize_sections): Set global_offset_table_
8324 * layout.cc (Layout::Layout): Initialize increase_relro_.
8325 (Layout::get_output_section): Add is_relro, is_last_relro, and
8326 is_first_non_relro parameters. Change all callers.
8327 (Layout::choose_output_section): Likewise.
8328 (Layout::add_output_section_data): Likewise.
8329 (Layout::make_output_section): Likewise.
8330 (Layout::set_segment_offsets): Clear increase_relro when using a
8332 * layout.h (class Layout): Add increase_relro method. Add
8333 increase_relro_ field. Update declarations.
8334 * output.cc (Output_section::Output_section): Initialize
8335 is_last_relro_ and is_first_non_relro_.
8336 (Output_segment::add_output_section): Group relro sections is
8337 do_sort is true. Handle is_last_relro and is_first_non_relro.
8338 (Output_segment::maximum_alignment): Remove relro handling.
8339 (Output_segment::set_section_addresses): Add increase_relro
8340 parameter. Change all callers. Add initial alignment to align
8341 relro sections on separate page. Remove old relro handling.
8342 (Output_segment::set_section_list_addresses): Remove in_relro
8343 parameter. Change all callers.
8344 (Output_segment::set_offset): Add increase parameter. Change all
8345 callers. Remove old relro handling.
8346 * output.h (class Output_section): Add new methods: is_last_relro,
8347 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8348 Add is_last_relro_ and is_first_non_relro_ fields.
8349 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8350 Create separate .got.plt section. Call increase_relro.
8351 * x86_64.cc (Target_x86_64::got_section): Likewise.
8352 * testsuite/relro_script_test.t: Add .got.plt.
8355 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8356 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8357 (Layout::finalize): Call set_dynamic_symbol_size.
8358 (Layout::set_dynamic_symbol_size): New function.
8359 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
8360 set_dynamic_symbol_size.
8363 * output.h (class Output_section): Add is_entsize_zero_ field.
8364 * output.cc (Output_section::Output_section): Initialize
8366 (Output_section::set_entsize): If two different entsizes are
8367 requested, force it to zero.
8368 (Output_section::add_input_section): Set flags for .debug_str
8369 before updating section flags. Set entsize.
8370 (Output_section::update_flags_for_input_section): Set SHF_MERGE
8371 and SHF_STRING if all input sections have those flags.
8373 2009-12-29 Rafael Espindola <espindola@google.com>
8375 * main.cc (main): Fix the sys time reporting.
8376 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8379 2009-12-29 Sriraman Tallam <tmsriram@google.com>
8381 * options.cc (General_options::parse_version): Allow -v to exit
8382 without an error if there is nothing to link.
8384 2009-12-29 Ian Lance Taylor <iant@google.com>
8386 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8387 using a version of gcc before 4.1.
8388 * configure: Rebuild.
8390 2009-12-28 Chris Demetriou <cgd@google.com>
8392 * attributes.cc (Output_attributes_section_data::do_write): Use
8393 std::vector::front rather than std::vector::data.
8395 2009-12-28 Ian Lance Taylor <iant@google.com>
8397 * symtab.h (class Symbol_table): Add enum Defined.
8398 * resolve.cc (Symbol_table::should_override): Add defined
8399 parameter. Change all callers. Test whether object is NULL
8400 before calling a method on it.
8401 (Symbol_table::report_resolve_problem): Add defined parameter.
8403 (Symbol_table::should_override_with_special): Likewise.
8404 * symtab.cc (Symbol_table::define_in_output_data): Add defined
8405 parameter. Change all callers.
8406 (Symbol_table::do_define_in_output_data): Likewise.
8407 (Symbol_table::define_in_output_segment): Likewise.
8408 (Symbol_table::do_define_in_output_segment): Likewise.
8409 (Symbol_table::define_as_constant): Likewise.
8410 (Symbol_table::do_define_as_constant): Likewise.
8411 * script.h (class Symbol_assignment): Add is_defsym parameter to
8412 constructor; change all callers.
8413 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8414 parameter. Change all callers. Add is_defsym_ field.
8415 (class Parser_closure): Add parsing_defsym parameter to
8416 constructor; change all callers. Add parsing_defsym accessor
8417 function. Add parsing_defsym_ field.
8419 2009-12-28 Ian Lance Taylor <iant@google.com>
8421 * gold.cc (queue_middle_tasks): Fix formatting.
8422 * object.cc (Relobj::is_section_name_included): Likewise.
8424 2009-12-23 Ian Lance Taylor <iant@google.com>
8426 * i386.cc (Target_i386::do_calls_non_split): Recognize
8427 -fsplit-stack prologue for a function with a static chain.
8428 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8429 -fsplit-stack prologue when using %r11.
8431 2009-12-21 Sriraman Tallam <tmsriram@google.com>
8433 * options.cc (General_options::parse_version): Make -v continue and do
8434 the link like GNU ld does.
8436 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
8438 * Makefile.am (CCFILES): Add timer.cc.
8439 (HFILES): Add timer.h.
8440 * configure.ac: Check for sysconf and times.
8441 * main.cc: include timer.h.
8442 (main): Use Timer instead of get_run_time.
8445 * workqueue.cc: include timer.h.
8446 (Workqueue::find_and_run_task):
8447 Report user, sys and wall time.
8448 * Makefile.in: Regenerate.
8449 * config.in: Regenerate.
8450 * configure: Regenerate.
8452 2009-12-16 Doug Kwan <dougkwan@google.com>
8454 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8456 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8457 relaxed input sections.
8458 * output.cc (Output_section::find_relaxed_input_section): Change
8459 return type to Output_relaxed_input_section pointer. Adjust code
8460 for new type of relaxed_input_section_map_.
8461 * output.h (Output_section::find_relaxed_input_section): Change
8462 return type to Output_relaxed_input_section pointer.
8463 (Output_section::Output_relaxed_input_section_by_input_section_map):
8465 (Output_section::relaxed_input_section_map_): Change type to
8466 Output_section::Output_relaxed_input_section_by_input_section_map.
8467 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8470 2009-12-15 Ian Lance Taylor <iant@google.com>
8472 * layout.cc (Layout::create_shstrtab): Only write out after input
8473 sections if we are compressing debug sections.
8475 2009-12-15 Ian Lance Taylor <iant@google.com>
8477 * archive.cc (Archive::add_symbols): Only look up a symbol without
8478 a version if there is, in fact, a version.
8480 2009-12-14 Ian Lance Taylor <iant@google.com>
8482 Revert -Wshadow changes, all changes from:
8483 2009-12-11 Doug Kwan <dougkwan@google.com>
8484 2009-12-11 Nick Clifton <nickc@redhat.com>
8485 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8487 2009-12-11 Doug Kwan <dougkwan@google.com>
8489 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8491 * attributes.cc (Object_attribute::size): Ditto.
8492 (Attributes_section_data::size): Ditto.
8493 (Attributes_section_data::Attributes_section_data): Ditto.
8494 (Output_attributes_section_data::do_write): Ditto.
8495 * attributes.h (Object_attribute::set_type): Ditto.
8496 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8498 2009-12-11 Nick Clifton <nickc@redhat.com>
8500 * archive.cc: Fix shadowed variable warnings.
8502 * compressed_output.cc: Likewise.
8503 * compressed_output.h: Likewise.
8504 * configure: Likewise.
8505 * dwarf_reader.cc: Likewise.
8506 * dynobj.cc: Likewise.
8507 * dynobj.h: Likewise.
8508 * ehframe.cc: Likewise.
8509 * ehframe.h: Likewise.
8510 * errors.cc: Likewise.
8511 * expression.cc: Likewise.
8512 * fileread.cc: Likewise.
8513 * fileread.h: Likewise.
8514 * freebsd.h: Likewise.
8515 * i386.cc: Likewise.
8517 * incremental.h: Likewise.
8518 * layout.cc: Likewise.
8519 * layout.h: Likewise.
8520 * mapfile.cc: Likewise.
8521 * merge.cc: Likewise.
8522 * merge.h: Likewise.
8523 * object.cc: Likewise.
8524 * object.h: Likewise.
8525 * options.h: Likewise.
8526 * output.cc: Likewise.
8527 * output.h: Likewise.
8528 * parameters.cc: Likewise.
8529 * plugin.cc: Likewise.
8530 * powerpc.cc: Likewise.
8531 * reduced_debug_output.cc: Likewise.
8532 * reduced_debug_output.h: Likewise.
8533 * reloc.cc: Likewise.
8534 * reloc.h: Likewise.
8535 * resolve.cc: Likewise.
8536 * script-sections.cc: Likewise.
8537 * script.cc: Likewise.
8538 * script.h: Likewise.
8539 * sparc.cc: Likewise.
8540 * symtab.cc: Likewise.
8541 * symtab.h: Likewise.
8542 * target-select.cc: Likewise.
8543 * target-select.h: Likewise.
8544 * token.h: Likewise.
8545 * workqueue.cc: Likewise.
8546 * workqueue.h: Likewise.
8547 * x86_64.cc: Likewise.
8549 2009-12-10 Doug Kwan <dougkwan@google.com>
8551 * arm.cc (attributes.h): New include.
8552 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8553 (Arm_relobj::~Arm_relobj): Delete object pointed by
8554 attributes_section_data_.
8555 (Arm_relobj::attributes_section_data): New method definition.
8556 (Arm_relobj::attributes_section_data_): New data member declaration.
8557 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8558 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8559 attributes_section_data_.
8560 (Arm_dynobj::attributes_section_data): New method definition.
8561 (Arm_dynobj::attributes_section_data_): New data member declaration.
8562 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
8563 initialization value of may_use_blx_ to false.
8564 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8565 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8566 object attributes to compute results instead of hard-coding.
8567 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8568 Target_arm::get_secondary_compatible_arch,
8569 Target_arm::set_secondary_compatible_arch
8570 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8571 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8572 New method declarations.
8573 (Target_arm::get_aeabi_object_attribute): New method definition.
8574 (Target_arm::attributes_section_data_): New data member declaration.
8575 (read_arm_attributes_section): New template definition.
8576 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8577 (Arm_dynobj::do_read_symbols): Ditto.
8578 (Target_arm::do_finalize_sections): Merge attributes sections from
8579 input. Check for BLX use after attributes section merging.
8580 Fix __exidx_start and __exidx_end visibility. Create an
8581 .ARM.attributes section if necessary.
8582 (Target_arm::get_secondary_compatible_arch,
8583 Target_arm::set_secondary_compatible_arch,
8584 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8585 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8586 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8587 New method definitions.
8589 2009-12-09 Ian Lance Taylor <iant@google.com>
8591 * plugin.cc (Plugin::load): Don't cast from void* to a function
8594 2009-12-09 Ian Lance Taylor <iant@google.com>
8596 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8599 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
8601 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8602 Replace two_file_shared_1.so with two_file_shared_2.so.
8603 * testsuite/Makefile.in: Regenerated.
8605 2009-12-08 Doug Kwan <dougkwan@google.com>
8607 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8608 (HFILES): Add attributes.h and int_encoding.h.
8609 * Makefile.in: Regenerate.
8610 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8611 function definitions to int_encoding.cc
8612 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8613 prototypes to int_encoding.h
8614 * reduced_debug_output.cc (int_encoding.h): New include.
8615 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8616 function definitions to int_encoding.cc
8617 (insert_into_vector, read_from_pointer): Move template definitions to
8619 * attributes.cc: New file.
8620 * attributes.h: New file.
8621 * int_encoding.cc: New file.
8622 * int_encoding.h: New file.
8624 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
8627 * incremental-dump.cc (dump_incremental_inputs): New.
8628 (main): Use dump_incremental_inputs.
8630 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
8633 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8634 checking elfcpp::STT_FUNC.
8635 (Target_i386::Relocate::relocate): Likewise.
8636 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8638 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8639 symbols from shared libraries into normal FUNC symbols.
8641 * symtab.h (Symbol): Add is_func and use it.
8643 2009-12-05 Doug Kwan <dougkwan@google.com>
8645 * arm.cc (Target_arm::arm_info): Initialize new fields
8646 attributes_section and attributes_vendor.
8647 * i386.cc (Target_i386::i386_info): Same.
8648 * object.cc (Sized_relobj::do_layout): Skip attribute section.
8649 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8650 fields attributes_section and attributes_vendor.
8651 * sparc.cc (Target_sparc::sparc_info): Same.
8652 * target.h (Target::attributes_section, Target::attributes_vendor,
8653 Target::is_attributes_section, Target::attribute_arg_type,
8654 Target::attributes_order): New method definitions.
8655 (Target::Target_info::attributes_section,
8656 Target::Target_info::attributes_vendor): New fields.
8657 (Target::do_attribute_arg_type, Target::do_attributes_order): New
8658 virtual method definitions.
8659 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8660 attributes_section and attributes_vendor.
8661 * testsuite/testfile.cc (Target_test::test_target_info): Same.
8663 2009-12-05 Doug Kwan <dougkwan@google.com>
8665 * arm.cc: Update comments about interworking and stub generation.
8666 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8667 considered as non-PIC.
8668 (Arm_relocate_functions::base_abs): Fix formatting.
8669 (Arm_relocate_functions::got_prel): Fix comment. Change interface
8670 of function to use GOT entry address instead of offset.
8671 (Target_arm::Scan::global): Issue an error if a symbol would need a
8672 PLT does not get one because it is untyped. Remove code to create
8673 dynamic symbols for relative branches.
8674 (Target_arm::Relocate::relocate: Use 0 instead of false since function
8675 takes unsigned integer instead of boolean.
8677 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
8679 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8680 (two_file_test_LDADD): Likewise.
8681 (common_test_1_LDADD): Likewise.
8682 (exception_test_LDADD) Likewise.
8683 (weak_test_LDADD): Likewise.
8684 (many_sections_test_LDADD): Likewise.
8685 (initpri1_LDADD): Likewise.
8686 (script_test_1_LDADD): Likewise.
8687 (script_test_2_LDADD): Likewise.
8688 (justsyms_LDADD): Likewise.
8689 (binary_test_LDADD): Likewise.
8690 (large_LDADD): Likewise.
8691 * testsuite/Makefile.in: Regenerated.
8693 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
8695 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8696 (Symbol_table::override_with_special): Likewise.
8697 (Symbol_table::add_from_object): Likewise.
8699 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8701 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8702 Don't set the data_offset twice.
8704 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8706 * testsuite/Makefile.in: Regenerate.
8708 2009-12-03 Doug Kwan <dougkwan@google.com>
8710 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8711 (Target_arm::do_finalize_sections): Add parameter for symbol table
8712 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
8713 * i386.cc (Target_i386::do_finalize_sections): Add an additional
8714 parameter for symbol table pointer.
8715 * layout.cc (Layout::finalize): Call Target::finalize_sections with
8716 an additional parameter for a pointer to symbol table.
8717 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8718 parameter for a symbol table pointer.
8719 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8720 * target.h (Target::finalize_sections, Target::do_finalize_sections):
8722 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8723 parameter for a symbol table pointer.
8725 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
8727 * incremental.cc (Incremental_inputs_header)
8728 (Incremental_inputs_header_write, Incremental_inputs_entry)
8729 (Incremental_inputs_entry_write): Move ...
8730 * incremental.h (Incremental_inputs_header)
8731 (Incremental_inputs_header_write, Incremental_inputs_entry)
8732 (Incremental_inputs_entry_write): here.
8734 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8736 * incremental.cc (make_sized_incremental_binary): Set the target.
8737 Error if it is incompatible.
8738 * output.h (Output_file): Add filename method.
8740 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8742 * incremental.cc (Incremental_inputs_entry): Remove unused argument
8743 from the get_* methods.
8745 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8747 * incremental-dump.cc (main): Check that the offeset of a script is 0.
8748 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8749 Write 0 for the data_offset of scripts.
8751 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8753 * testsuite/Makefile.am: Add the incremental_test.sh test.
8754 * testsuite/incremental_test.sh: New.
8755 * testsuite/incremental_test_1.c: New.
8756 * testsuite/incremental_test_2.c: New.
8758 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
8760 * incremental-dump.cc (main): Fix typos.
8762 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
8765 * incremental-dump.cc (main): Use llu to print 64 bit values.
8767 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
8768 H.J. Lu <hongjiu.lu@intel.com>
8770 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8772 (incremental_dump_LDADD): Likewise.
8773 * Makefile.in: Regenerated.
8775 2009-11-25 Doug Kwan <dougkwan@google.com>
8779 2009-11-25 Doug Kwan <dougkwan@google.com>
8781 * arm.cc (Target_arm::Target_arm): Move method definition
8782 outside of class definition. Add code to handle
8783 --target1-rel, --target1-abs and --target2= options.
8784 (Target_arm::get_reloc_reloc_type): Change method to be
8785 non-static and const.
8786 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8787 New data member declaration.
8788 (Target_arm::Scan::local, Target_arm::Scan::global,
8789 Target_arm::Relocate::relocate,
8790 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8791 Adjust call to Target_arm::get_real_reloc_type.
8792 (Target_arm::get_real_reloc_type): Use command line options
8793 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8794 * options.h (--target1-rel, --target1-abs, --target2): New
8797 2009-11-25 Doug Kwan <dougkwan@google.com>
8799 * arm.cc (Target_arm::Target_arm): Move method definition outside of
8800 class definition. Add code to handle --target1-rel, --target1-abs
8801 and --target2= options.
8802 (Target_arm::get_reloc_reloc_type): Change method to be non-static
8804 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8806 (Target_arm::Scan::local, Target_arm::Scan::global,
8807 Target_arm::Relocate::relocate,
8808 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8809 call to Target_arm::get_real_reloc_type.
8810 (Target_arm::get_real_reloc_type): Use command line options to
8811 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8812 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8815 2009-11-25 Doug Kwan <dougkwan@google.com>
8817 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8818 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8819 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8821 (Arm_relocate_functions::thm_call): Replace body with a call to
8822 Arm_relocate_functions::thumb_branch_common.
8823 (Arm_relocate_functions::thm_jump24,
8824 Arm_relocate_functions::thm_xpc22): New method definitions.
8825 (Arm_relocate_functions::thumb_branch_common): New method definition.
8826 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8828 (Target_arm::Relocate::relocate): Adjust call to thm_call.
8829 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8831 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8833 * Makefile.am: Build incremental-dump
8834 * Makefile.in: Regenerate.
8835 * incremental-dump.cc: New.
8836 * incremental.cc (Incremental_inputs_header_data,
8837 Incremental_inputs_entry_data): Move to incremental.h
8838 * incremental.h: (Incremental_inputs_header_data,
8839 Incremental_inputs_entry_data): Move from incremental.cc
8841 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8843 * incremental.cc (Incremental_inputs_header,
8844 Incremental_inputs_header_write, Incremental_inputs_entry,
8845 Incremental_inputs_entry_write): Add a typedef with the data type.
8847 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8849 * incremental.cc (Incremental_inputs_header,
8850 Incremental_inputs_header_write, Incremental_inputs_entry,
8851 Incremental_inputs_entry_write): Update comment about which
8852 type has the filed descriptions.
8854 2009-11-15 Doug Kwan <dougkwan@google.com>
8856 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8857 (Arm_relocate_functions::arm_branch_common): Change method defintion
8858 in class definition to a method declaration and update list of formal
8860 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8861 Arm_relocation_functions::jump24): Adjust call to
8862 Arm_relocate_functions::arm_branch_common. Update list of formal
8864 (Arm_relocate_functions::xpc25): New method definition.
8865 (Arm_relocate_functions::arm_branch_common): Move method defintion
8866 out from class definition. Use stubs for mode-switching and extending
8868 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8869 specially. Change code to enable use of stubs in ARM branches.
8871 2009-11-10 Doug Kwan <dougkwan@google.com>
8873 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8874 in method declaration.
8875 (Target_arm::relocate_stub): New method declaration.
8876 (Target_arm::default_target): Change to return a pointer instead of
8878 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8879 Target_arm::default_target.
8880 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8882 (Target_arm::relocate_section): Adjust view.
8883 (Target_arm::relocate_stub): New method definition.
8885 2009-11-10 Doug Kwan <dougkwan@google.com>
8887 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8889 * incremental.cc (open_incremental_binary): Initialized local
8890 variables to avoid warnings.
8891 * object.cc (make_elf_object): Ditto.
8892 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8895 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8898 * testsuite/plugin_test.c: Include "config.h".
8900 2009-11-09 Doug Kwan <dougkwan@google.com>
8902 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8903 (arm_symbol_value): Remove.
8904 (Arm_relocate_functions::arm_branch_common,
8905 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8906 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8907 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8908 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8909 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8910 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8911 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8912 Arm_relocate_functions::thm_mobw_abs_nc,
8913 Arm_relocate_functions::thm_mov_abs,
8914 Arm_relocate_functions::movw_prel_nc,
8915 Arm_relocate_functions::thm_movt_abs,
8916 Arm_relocate_functions::movt_prel,
8917 Arm_relocate_functions::thm_movw_prel_nc,
8918 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8919 (Target_arm::Relocate::relocate): Only decompose address into two
8920 parts if relocation type uses the thumb-bit and pass the actual
8921 bit instead of a flag indicating that the thumb-bit is used. Adjust
8922 calls to methods in Arm_relocate_functions for this change.
8924 2009-11-08 Ian Lance Taylor <iant@google.com>
8927 * reloc.cc: Instantiate
8928 Sized_relobj::initialize_input_to_output_maps and
8929 Sized_relobj:free_input_to_output_maps.
8931 2009-11-06 Ian Lance Taylor <iant@google.com>
8934 * defstd.cc (in_segment): Set only_if_ref true for "end".
8936 2009-11-06 Doug Kwan <dougkwan@google.com>
8938 * arm.cc (class Reloc_stub): Correct a comment.
8939 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8940 (Target_arm::scan_section_for_stubs): New method declaration.
8941 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8942 Change methods from private to protected.
8943 (Target_arm::do_may_relax): New method definition.
8944 (Target_arm::do_relax, Target_arm::group_sections,
8945 Target_arm::scan_reloc_for_stub,
8946 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8947 (Target_arm::arm_input_section_map_): New data member declaration.
8948 (Target_arm::scan_reloc_for_stub,
8949 Target_arm::scan_reloc_section_for_stubs,
8950 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8951 Target_arm::do_relax): New method definitions.
8953 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8955 * configure.ac: Check for (struct stat)::st_mtim
8956 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8957 * config.in: Regenerate.
8958 * configure: Regenerate.
8960 2009-11-05 Ian Lance Taylor <iant@google.com>
8963 * output.cc (Output_segment::add_output_section): Add missing
8966 2009-11-04 Ian Lance Taylor <iant@google.com>
8969 * object.h (class Object): Add is_needed and set_is_needed
8970 methods. Add is_needed_ field. Make bool fields into bitfields.
8971 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8972 defined in a dynamic object and referenced by a regular object,
8973 set is_needed for the dynamic object.
8974 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8975 if the file is marked with as_needed and it is not needed.
8977 2009-11-04 Ian Lance Taylor <iant@google.com>
8980 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8981 tags if data is discarded by linker script.
8982 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8983 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8984 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8985 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8987 2009-11-04 Ian Lance Taylor <iant@google.com>
8989 * layout.cc (Layout::get_output_section): Add is_interp and
8990 is_dynamic_linker_section parameters. Change all callers.
8991 (Layout::choose_output_section): Likewise.
8992 (Layout::make_output_section): Likewise.
8993 (Layout::add_output_section_data): Add is_dynamic_linker_section
8994 parameter. Change all callers.
8995 * layout.h (class Layout): Update declarations.
8996 * output.h (class Output_section): Add is_interp, set_is_interp,
8997 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8998 Add is_interp_, is_dynamic_linker_section_ fields. Change
8999 generate_code_fills_at_write_ to a bitfield.
9000 * output.cc (Output_section::Output_sections): Initialize new
9002 (Output_segment::add_output_section): Add do_sort parameter.
9005 2009-11-03 Ian Lance Taylor <iant@google.com>
9008 * options.h (class General_options): Add --warn-common.
9009 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9010 merging two common symbols.
9011 (Symbol_table::should_override): Handle --warn-common when merging
9012 a common symbol with a defined symbol. Use report_resolve_problem
9013 for multiple definitions.
9014 (Symbol_table::report_resolve_problem): New function.
9015 * symtab.h (class Symbol_table): Declare report_resolve_problem.
9017 2009-11-03 Doug Kwan <dougkwan@google.com>
9019 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9021 (Target_arm::stub_factory): New method definition.
9022 (Target_arm::new_arm_input_section,
9023 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9024 Target_arm::reloc_uses_thumb_bit): New method declarations.
9025 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9026 New type definitions.
9027 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9028 member declarations.
9029 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9030 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9031 New method definitions.
9033 2009-11-03 Ian Lance Taylor <iant@google.com>
9035 * options.h (class General_options): Add --warn_constructors.
9037 2009-11-03 Ian Lance Taylor <iant@google.com>
9040 * defstd.cc (in_section): Add entries for __rel_iplt_start,
9041 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9043 2009-11-03 Ian Lance Taylor <iant@google.com>
9046 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9047 --msgid-bugs-address.
9048 (install-pdf): New target.
9049 (install-data_yes): Look up one directory to find mkinstalldirs.
9051 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
9053 * po/Make-in (.po.gmo): Don't generate .gmo files in source
9056 2009-10-30 Doug Kwan <dougkwan@google.com>
9058 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9060 2009-10-30 Doug Kwan <dougkwan@google.com>
9062 * arm.cc (Stub_addend_reader): New struct template definition
9063 and partial specializations.
9064 (Stub_addend_reader::operator()): New method definition for a
9065 partially specialized template.
9067 2009-10-30 Doug Kwan <dougkwan@google.com>
9069 * arm.cc (Arm_relobj::processor_specific_flags): New method
9071 (Arm_relobj::do_read_symbols): New method declaration.
9072 (Arm_relobj::processor_specific_flags_): New data member declaration.
9073 (Arm_dynobj): New class definition.
9074 (Target_arm::do_finalize_sections): Add input_objects parameter.
9075 (Target_arm::do_adjust_elf_header): New method declaration.
9076 (Target_arm::are_eabi_versions_compatible,
9077 (Target_arm::merge_processor_specific_flags): New method declaration.
9078 (Target_arm::do_make_elf_object): New overloaded method definitions
9080 (Arm_relobj::do_read_symbols): New method definition.
9081 (Arm_dynobj::do_read_symbols): Ditto.
9082 (Target_arm::do_finalize_sections): Add input_objects parameters.
9083 Merge processor-specific flags from all input objects.
9084 (Target_arm::are_eabi_versions_compatible,
9085 Target_arm::merge_processor_specific_flags,
9086 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9087 New method definitions.
9088 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9089 Input_objects pointer type parameter.
9090 * layout.cc (Layout::finalize): Pass input objects to target's.
9091 finalize_sections function.
9092 * output.cc (Output_file_header::do_sized_write): Set ELF file
9093 header's processor-specific flags.
9094 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9095 Input_objects pointer type parameter.
9096 * sparc.cc (Target_sparc::do_finalize_sections): Same.
9097 * target.h (Input_objects): New forward class declaration.
9098 (Target::processor_specific_flags,
9099 Target::are_processor_specific_flags_sect): New method definitions.
9100 (Target::finalize_sections): Add input_objects parameter.
9101 (Target::Target): Initialize processor_specific_flags_ and
9102 are_processor_specific_flags_set_.
9103 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9105 (Target::set_processor_specific_flags): New method definition.
9106 (Target::processor_specific_flags_,
9107 Target::are_processor_specific_flags_set_): New data member
9109 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9110 Input_objects pointer type parameter.
9112 2009-10-30 Doug Kwan <dougkwan@google.com>
9114 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9116 2009-10-28 Ian Lance Taylor <iant@google.com>
9118 * object.h (class Relobj): Drop options parameter from
9119 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9120 do_scan_relocs, do_relocate. Change all callers.
9121 (class Sized_relobj): Drop options parameters from
9122 do_gc_process_relocs, do_scan_relocs, do_relocate,
9123 do_relocate_sections, relocate_sections, emit_relocs_scan,
9124 emit_relocs_scan_reltype. Change all callers.
9125 (struct Relocate_info): Remove options field and all references to
9127 * reloc.h (class Read_relocs): Remove options constructor
9128 parameter and options_ field. Change all callers.
9129 (class Gc_process_relocs, class Scan_relocs): Likewise.
9130 (class Relocate_task): Likewise.
9131 * target-reloc.h (scan_relocs): Remove options parameter. Change
9133 (scan_relocatable_relocs): Likewise.
9134 * target.h (class Sized_target): Remove options parameter from
9135 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
9137 * gc.h (gc_process_relocs): Remove options parameter. Change all
9139 * arm.cc: Update functions to remove options parameters.
9140 * i386.cc: Likewise.
9141 * powerpc.cc: Likewise.
9142 * sparc.cc: Likewise.
9143 * x86_64.cc: Likewise.
9144 * testsuite/testfile.cc: Likewise.
9146 2009-10-28 Doug Kwan <dougkwan@google.com>
9148 * arm.cc (Arm_relobj): New class definition.
9149 (Arm_relobj::scan_sections_for_stubs,
9150 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9151 New method definitions.
9153 2009-10-28 Cary Coutant <ccoutant@google.com>
9155 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9156 (Plugin::cleanup_done_): New member.
9157 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9158 (Plugin_manager::cleanup_done_): Remove.
9159 (Plugin_manager::add_input_file): Edit error message.
9160 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9161 (Plugin_manager::cleanup): Remove use of cleanup_done_.
9163 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
9165 * fileread.cc: (File_read::View::~View): Use the new
9166 data_ownership_ filed.
9167 (File_read::~File_read): Dispose the new whole_file_view_.
9168 (File_read::open): Mmap the whole file if needed.
9169 (File_read::open): Use whole_file_view_ instead of contents_.
9170 (File_read::find_view): Use whole_file_view_ if applicable.
9171 (File_read::do_read): Use whole_file_view_ instead of contents_.
9172 (File_read::make_view): Use whole_file_view_ instead of contents_,
9173 update File_read::View::View call.
9174 (File_read::find_or_make_view): Update File_read::View::View
9176 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9178 (File_read::View::Data_ownership): New enum.
9179 (File_read::View::View): Replace bool mapped_ with Data_ownership
9181 (File_read::View::mapped_): Remove (replaced by data_ownership_).
9182 (File_read::View::data_ownership_): New field.
9183 (File_read::contents_): Remove (replaced by whole_file_view_).
9184 (File_read::whole_file_view_): New field.
9185 * options.h (class General_options): Add --keep-files-mapped.
9187 2009-10-27 Cary Coutant <ccoutant@google.com>
9189 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9190 * testsuite/Makefile.am (plugin_test_5): New test case.
9191 * testsuite/Makefile.in: Regenerate.
9193 2009-10-25 Doug Kwan <dougkwan@google.com>
9195 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9196 from private to protected to allow access by child class.
9197 (Sized_relobj::do_relocate_sections): New method declaration.
9198 (Sized_relobj::relocate_sections): Virtualize.
9199 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9200 Sized_relobj::relocate_sections. Instantiate template explicitly
9201 for different target sizes and endianity.
9203 2009-10-24 Doug Kwan <dougkwan@google.com>
9205 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9206 (Arm_input_section::as_arm_input_section): New method.
9207 (Arm_output_section): New class definition.
9208 (Arm_output_section::create_stub_group,
9209 Arm_output_section::group_sections): New method definitions.
9211 2009-10-22 Doug Kwan <dougkwan@google.com>
9213 * arm.cc (Arm_input_section): New class definition.
9214 (Arm_input_section::init, Arm_input_section:do_write,
9215 Arm_input_section::set_final_data_size,
9216 Arm_input_section::do_reset_address_and_file_offset): New method
9219 2009-10-21 Doug Kwan <dougkwan@google.com>
9221 * arm.cc (Stub_table, Arm_input_section): New forward class
9223 (Stub_table): New class defintion.
9224 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9225 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9226 New method definition.
9228 2009-10-21 Doug Kwan <dougkwan@google.com>
9230 * arm.cc: Update copyright comments.
9231 (Target_arm): New forward class template declaration.
9232 (Arm_address): New type.
9233 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9234 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9235 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9237 (Insn_template): Same.
9238 (DEF_STUBS): New macro.
9239 (Stub_type): New enum type.
9240 (Stub_template): New class definition.
9243 (Stub_factory): Same.
9244 (Target_arm::Target_arm): Initialize may_use_blx_ and
9245 should_force_pic_veneer_.
9246 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9247 Target_arm::should_force_pic_veneer,
9248 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9249 Target_arm::using_thumb_only, Target_arm:;default_target): New
9251 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9252 New data member declarations.
9253 (Insn_template::size, Insn_template::alignment): New method defintions.
9254 (Stub_template::Stub_template): New method definition.
9255 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9256 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9257 (Stub_factory::Stub_factory): New method definition.
9258 * gold.h (string_hash): New template.
9259 * output.h (Input_section_specifier::hash_value): Use
9261 (Input_section_specifier::string_hash): Remove.
9262 * stringpool.cc (Stringpool_template::string_hash): Use
9265 2009-10-20 Doug Kwan <dougkwan@google.com>
9267 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9268 symbols of relaxed input sections.
9269 * output.h (Output_section::find_relaxed_input_section): Make
9272 2009-10-16 Doug Kwan <dougkwan@google.com>
9274 * dynobj.cc (Versions::Versions): Initialize version_script_.
9275 Only insert base version symbol definition for a shared object
9276 if version script defines any version versions.
9277 (Versions::define_base_version): New method definition.
9278 (Versions::add_def): Check that base version is not needed.
9279 (Versions::add_need): Define base version lazily.
9280 * dynobj.h (Versions::define_base_version): New method declaration.
9281 (Versions::needs_base_version_): New data member declaration.
9282 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9283 (check_DATA): Add no_version_test.stdout.
9284 (libno_version_test.so, no_version_test.o no_version_test.stdout):
9286 * testsuite/Makefile.in: Regenerate.
9287 * testsuite/no_version_test.c: New file.
9288 * testsuite/no_version_test.sh: Ditto.
9290 2009-10-16 Doug Kwan <dougkwan@google.com>
9292 * expression.cc (class Segment_start_expression): New class definition.
9293 (Segment_start_expression::value): New method definition.
9294 (script_exp_function_segment_start): Return a new
9295 Segment_start_expression.
9296 * gold/script-c.h (script_saw_segment_start_expression): New function
9298 * script-sections.cc (Script_sections::Script_sections): Initialize
9299 SAW_SEGMENT_START_EXPRESSION_ to false.
9300 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9301 and -Tbbs options to specify section addresses if given in
9302 command line and no SEGMENT_START expression is seen in a script.
9303 * script-sections.h (Script_sections::saw_segment_start_expression,
9304 Script_sections::set_saw_segment_start_expression): New method
9306 (Script_sections::saw_segment_start_expression_): New data member
9308 * script.cc (script_saw_segment_start_expression): New function.
9309 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9310 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9311 script_test_7.sh and script_test_8.sh.
9312 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9313 script_test_8.stdout.
9314 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9315 (script_test_6, script_test_6.stdout, script_test_7,
9316 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9317 * Makefile.in: Regenerate.
9318 * testsuite/script_test_6.sh: New file.
9319 * testsuite/script_test_6.t: Same.
9320 * testsuite/script_test_7.sh: Same.
9321 * testsuite/script_test_7.t: Same.
9322 * testsuite/script_test_8.sh: Same.
9324 2009-10-16 Doug Kwan <dougkwan@google.com>
9326 * output.cc (Output_segment::set_section_list_address): Cast
9327 expressions to unsigned long long type to avoid format warnings.
9329 2009-10-15 Ian Lance Taylor <iant@google.com>
9331 * script.cc (Script_options::add_symbol_assignment): Always add a
9332 dot assignment to script_sections_.
9333 * script-sections.cc (Script_sections::add_dot_assignment):
9334 Initialize if necessary.
9336 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9337 program headers with no load segment if there is a linker script.
9339 * layout.cc (Layout::set_segment_offsets): Align the file offset
9340 to the segment aligment for -N or -n with no load segment.
9341 * output.cc (Output_segment::add_output_section): Don't crash if
9342 the first section is a TLS section.
9343 (Output_segment::set_section_list_addresses): Print an error
9344 message if the address moves backward in a linker script.
9345 * script-sections.cc
9346 (Output_section_element_input::set_section_addresses): Don't
9347 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9348 (Orphan_output_section::set_section_addresses): Likewise.
9350 2009-10-15 Doug Kwan <dougkwan@google.com>
9352 * layout.cc (Layout::finish_dynamic_section): Generate tags
9353 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9354 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9355 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9357 2009-10-14 Ian Lance Taylor <iant@google.com>
9359 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9361 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9362 data_shdr fields of relinfo.
9363 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9364 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
9365 R_386_TLS_LDO_32, adjust based on section flags.
9366 (Target_i386::Relocate::fix_up_ldo): Remove.
9368 2009-10-13 Ian Lance Taylor <iant@google.com>
9370 Add support for -pie.
9371 * options.h (class General_options): Add -pie and
9373 (General_options::output_is_position_independent): Test -pie.
9374 (General_options::output_is_executable): Return true if not shared
9375 and not relocatable.
9376 (General_options::output_is_pie): Remove.
9377 * options.cc (General_options::finalize): Reject incompatible uses
9379 * gold.cc (queue_middle_tasks): A -pie link is not static.
9380 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9381 * symtab.cc (Symbol::final_value_is_known): Return false if
9382 output_is_position_independent.
9383 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9384 output_is_position_independent.
9385 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9386 output_is_position_independent.
9387 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9388 output_is_position_independent.
9389 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9391 (basic_pie_test.o, basic_pie_test): New targets.
9392 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9393 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9394 (two_file_pie_test): New target.
9395 * testsuite/Makefile.in: Rebuild.
9396 * README: Remove note saying that -pie is not supported.
9398 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
9400 * options.h (class General_options): Add -init and -fini.
9401 * layout.cc (Layout::finish_dynamic_section): Emit
9402 given init and fini functions.
9404 2009-10-13 Sriraman Tallam <tmsriram@google.com>
9406 * gc.h (gc_process_relocs): Check if icf is enabled using new
9408 * gold.cc (queue_initial_tasks): Likewise.
9409 (queue_middle_tasks): Likewise.
9410 * object.cc (do_layout): Likewise.
9411 * symtab.cc (is_section_folded): Likewise.
9412 * main.cc (main): Likewise.
9413 * reloc.cc (Read_relocs::run): Likewise.
9414 (Sized_relobj::do_scan_relocs): Likewise.
9415 * icf.cc (is_function_ctor_or_dtor): New function.
9416 (Icf::find_identical_sections): Check if function is ctor or dtor when
9418 * options.h (General_options::icf): Change option to be an enum.
9419 (Icf_status): New enum.
9420 (icf_enabled): New method.
9421 (icf_safe_folding): New method.
9422 (set_icf_status): New method.
9423 (icf_status_): New variable.
9424 * (options.cc) (General_options::finalize): Set icf_status_.
9425 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9426 icf_test and icf_keep_unique_test to use the --icf enum flag.
9427 * testsuite/icf_safe_test.sh: New file.
9428 * testsuite/icf_safe_test.cc: New file.
9430 2009-10-12 Sriraman Tallam <tmsriram@google.com>
9432 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9433 includes to gc.h and icf.h.
9434 * arm.cc: Include gc.h.
9435 * gold.cc: Likewise.
9436 * i386.cc: Likewise.
9437 * powerpc.cc: Likewise.
9438 * sparc.cc: Likewise.
9439 * x86_64.cc: Likewise.
9440 * gc.h: Include icf.h.
9442 2009-10-11 Ian Lance Taylor <iant@google.com>
9444 * plugin.cc: Include "gold.h" before other header files.
9446 2009-10-10 Chris Demetriou <cgd@google.com>
9448 * options.h (Input_file_argument::Input_file_type): New enum.
9449 (Input_file_argument::is_lib_): Replace with...
9450 (Input_file_argument::type_): New member.
9451 (Input_file_argument::Input_file_argument): Take Input_file_type
9452 'type' rather than boolean 'is_lib' as second argument.
9453 (Input_file_argument::is_lib): Use type_.
9454 (Input_file_argument::is_searched_file): New function.
9455 (Input_file_argument::may_need_search): Handle is_searched_file.
9456 * options.cc (General_options::parse_library): Support -l:filename.
9457 (General_options::parse_just_symbols): Update for Input_file_argument
9459 (Command_line::process): Likewise.
9460 * archive.cc (Archive::get_file_and_offset): Likewise.
9461 * plugin.cc (Plugin_manager::release_input_file): Likewise.
9462 * script.cc (read_script_file, script_add_file): Likewise.
9463 * fileread.cc (Input_file::Input_file): Likewise.
9464 (Input_file::will_search_for): Handle is_searched_file.
9465 (Input_file::open): Likewise.
9466 * readsyms.cc (Read_symbols::get_name): Likewise.
9467 * testsuite/Makefile.am (searched_file_test): New test.
9468 * testsuite/Makefile.in: Regenerate.
9469 * testsuite/searched_file_test.cc: New file.
9470 * testsuite/searched_file_test_lib.cc: New file.
9472 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9473 Ian Lance Taylor <iant@google.com>
9475 * descriptor.cc: Include <cstdio> and "binary-io.h".
9476 (Descriptors::open): Open the files in binary mode always.
9477 * script.cc (Lex::get_token): Treat \r as whitespace.
9479 2009-10-09 Ian Lance Taylor <iant@google.com>
9481 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9483 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9484 Ian Lance Taylor <iant@google.com>
9486 * configure.ac: Check for readv function also.
9487 * fileread.cc (readv): Define if not HAVE_READV.
9488 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9490 * config.in: Regenerate.
9491 * configure: Regenerate.
9493 2009-10-09 Doug Kwan <dougkwan@google.com>
9495 * layout.cc (Layout::make_output_section): Call target hook to make
9496 ordinary output section.
9497 (Layout::finalize): Adjust parameter list of call the
9498 Target::may_relax().
9499 * layout.h (class Layout::section_list): New method.
9500 * merge.h (Output_merge_base::entsize): Change visibility to public.
9501 (Output_merge_base::is_string, Output_merge_base::do_is_string):
9503 (Output_merge_string::do_is_string): New method.
9504 * object.cc (Sized_relobj::do_setup): renamed from
9505 Sized_relobj::set_up.
9506 * object.h (Sized_relobj::adjust_shndx,
9507 Sized_relobj::initializ_input_to_output_maps,
9508 Sized_relobj::free_input_to_output_maps): Change visibilities to
9510 (Sized_relobj::setup): Virtualize.
9511 (Sized_relobj::do_setup): New method declaration.
9512 (Sized_relobj::invalidate_section_offset,
9513 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9514 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9515 * options.cc (parse_int): New function.
9516 * options.h (parse_int): New declaration.
9517 (DEFINE_int): New macro.
9518 (stub_group_size): New option.
9519 * output.cc (Output_section::Output_section): Initialize memebers
9520 merge_section_map_, merge_section_by_properties_map_,
9521 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9522 (Output_section::add_input_section): Handled deferred code-fill
9523 generation and remove an old comment.
9524 (Output_section::add_relaxed_input_section): New method definition.
9525 (Output_section::add_merge_input_section): Use merge section by
9526 properties map to speed to search. Update merge section maps
9528 (Output_section::build_relaxation_map): New method definition.
9529 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9531 (Output_section::relax_input_section): Renamed to
9532 Output_section::convert_input_sections_to_relaxed_sections and change
9533 interface to take a vector of pointers to relaxed sections.
9534 (Output_section::find_merge_section,
9535 Output_section::find_relaxed_input_section): New method definitions.
9536 (Output_section::is_input_address_mapped,
9537 Output_section::output_offset, Output_section::output_address):
9538 Use output section data maps to speed up searching.
9539 (Output_section::find_starting_output_address): Add comments.
9540 (Output_section::do_write,
9541 Output_section::write_to_postprocessing_buffer): Do code-fill
9542 generation as appropriate.
9543 (Output_section::get_input_sections): Invalidate relaxed input section
9545 (Output_section::restore_states): Adjust type of checkpoint .
9546 Invalidate relaxed input section map.
9547 * output.h (Output_merge_base): New class declaration.
9548 (Input_section_specifier): New class defintion.
9549 (class Output_relaxed_input_section) Change base class to
9550 Output_section_data_build.
9551 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9552 base class initializer.
9553 (Output_section::add_relaxed_input_section): New method declaration.
9554 (Output_section::Input_section): Change visibility to protected.
9555 (Output_section::Input_section::relobj,
9556 Output_section::Input_section::shndx): Handle relaxed input sections.
9557 Output_section::input_sections) Change visibility to protected. Also
9558 define overload to return a non-const pointer.
9559 (Output_section::Merge_section_properties): New class defintion.
9560 (Output_section::Merge_section_by_properties_map,
9561 Output_section::Output_section_data_by_input_section_map,
9562 Output_section::Relaxation_map): New types.
9563 (Output_section::relax_input_section): Rename method to
9564 Output_section::convert_input_sections_to_relaxed_sections and change
9565 interface to take a vector of relaxed section pointers.
9566 (Output_section::find_merge_section,
9567 Output_section::find_relaxed_input_section,
9568 Output_section::build_relaxation_map,
9569 Output_section::convert_input_sections_in_list_to_relaxed_sections):
9570 New method declarations.
9571 (Output_section::merge_section_map_
9572 Output_section::merge_section_by_properties_map_,
9573 Output_section::relaxed_input_section_map_,
9574 Output_section::is_relaxed_input_section_map_valid_,
9575 Output_section::generate_code_fills_at_write_): New data members.
9576 * script-sections.cc
9577 (Output_section_element_input::set_section_addresses): Call
9578 current_data_size and addralign methods of relaxed input sections.
9579 (Orphan_output_section::set_section_addresses): Call current_data_size
9580 and addralign methods of relaxed input sections.
9581 * symtab.cc (Symbol_table::compute_final_value): Extract template
9582 from the body of Symbol_table::sized_finalize_symbol.
9583 (Symbol_table::sized_finalized_symbol): Call
9584 Symbol_table::compute_final_value.
9585 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9586 (Symbol_table::compute_final_value): New templated method declaration.
9587 * target.cc (Target::do_make_output_section): New method defintion.
9588 * target.h (Target::make_output_section): New method declaration.
9589 (Target::relax): Add more parameters for input objects, symbol table
9590 and layout. Adjust call to do_relax.
9591 (Target::do_make_output_section): New method declaration.
9592 (Target::do_relax): Add parameters for input objects, symbol table
9595 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9597 * pread.c: Include stdio.h.
9599 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9601 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9604 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9606 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9607 Change read_shndx type to unsigned int.
9608 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9610 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9611 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9612 Change read_shndx type to unsigned int.
9613 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9615 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9616 * layout.cc (Layout::create_symtab_sections): Cast the result of
9617 local_symcount * symsize to off_t in the gold_assert.
9619 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9621 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9622 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9624 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9625 (Arm_relocate_functions::thm_abs5): New function.
9626 (Arm_relocate_functions::abs12): New function.
9627 (Arm_relocate_functions::abs16): New function.
9628 (Arm_relocate_functions::base_abs): New function.
9629 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9630 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
9631 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9633 (Scan::global): Likewise.
9634 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9635 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9636 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9637 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9640 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9642 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9643 (Arm_relocate_functions::movt_prel): New function.
9644 (Arm_relocate_functions::thm_movw_prel_nc): New function.
9645 (Arm_relocate_functions::thm_movt_prel): New function.
9646 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9647 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9648 (Scan::global, Relocate::relocate): Likewise.
9649 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9651 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9653 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9654 Incremental_checker.
9655 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9657 (class Incremental_inputs_header): New class.
9658 (Incremental_inputs_header_writer): Edit comment.
9659 (Incremental_inputs_entry): New class.
9660 (Incremental_inputs_entry_writer): Edit comment.
9661 (Sized_incremental_binary::do_find_incremental_inputs_section):
9662 Add *strtab_shndx parameter, fill it.
9663 (Sized_incremental_binary::do_check_inputs): New method.
9664 (Incremental_checker::can_incrementally_link_output_file): Use
9665 Sized_incremental_binary::check_inputs.
9666 (Incremental_inputs::report_command_line): Save command line in
9669 (Incremental_binary::find_incremental_inputs_section): New
9671 (Incremental_binary::do_find_incremental_inputs_section): Add
9672 strtab_shndx parameter.
9673 (Incremental_binary::do_check_inputs): New pure virtual method.
9674 (Sized_incremental_binary::do_check_inputs): Declare.
9675 (Incremental_checker::Incremental_checker): Add incremental_inputs
9676 parameter, use it to initialize incremental_inputs_.
9677 (Incremental_checker::incremental_inputs_): New field.
9678 (Incremental_checker::command_line): New method.
9679 (Incremental_checker::inputs): New method.
9680 (Incremental_checker::command_line_): New field.
9682 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9684 * incremental.cc: Include <cstdarg> and "target-select.h".
9685 (vexplain_no_incremental): New function.
9686 (explain_no_incremental): New function.
9687 (Incremental_binary::error): New method.
9688 (Sized_incremental_binary::do_find_incremental_inputs_section): New
9690 (make_sized_incremental_binary): New function.
9691 (open_incremental_binary): New function.
9692 (can_incrementally_link_file): Add checks if output is ELF and has
9694 * incremental.h: Include "elfcpp_file.h" and "output.h".
9695 (Incremental_binary): New class.
9696 (Sized_incremental_binary): New class.
9697 (open_incremental_binary): Declare.
9698 * object.cc (is_elf_object): Use
9699 elfcpp::Elf_recognizer::is_elf_file.
9700 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9701 * output.h (Output_file::filesize): New method.
9703 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9705 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9707 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9708 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9710 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9712 (Arm_relocate_functions::movw_abs_nc): New function.
9713 (Arm_relocate_functions::movt_abs): New function.
9714 (Arm_relocate_functions::thm_movw_abs_nc): New function.
9715 (Arm_relocate_functions::thm_movt_abs): New function.
9716 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9717 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9718 (Scan::global): Likewise.
9719 (Relocate::relocate): Likewise.
9720 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9722 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9724 * arm.cc (Arm_relocate_functions::got_prel) New function.
9725 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9726 (Relocate::relocate): Likewise.
9727 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9729 2009-10-06 Ian Lance Taylor <iant@google.com>
9731 * options.h (class General_options): Define
9732 split_stack_adjust_size parameter.
9733 * object.h (class Object): Add uses_split_stack_ and
9734 has_no_split_stack_ fields. Add uses_split_stack and
9735 has_no_split_stack accessor functions. Declare
9736 handle_split_stack_section.
9737 (class Reloc_symbol_changes): Define.
9738 (class Sized_relobj): Define Function_offsets. Declare
9739 split_stack_adjust, split_stack_adjust_reltype, and
9741 * object.cc (Object::handle_split_stack_section): New function.
9742 (Sized_relobj::do_layout): Call handle_split_stack_section.
9743 * dynobj.cc (Sized_dynobj::do_layout): Call
9744 handle_split_stack_section.
9745 * reloc.cc (Sized_relobj::relocate_sections): Call
9746 split_stack_adjust for executable sections in split_stack
9747 objects. Pass reloc_map to relocate_section.
9748 (Sized_relobj::split_stack_adjust): New function.
9749 (Sized_relobj::split_stack_adjust_reltype): New function.
9750 (Sized_relobj::find_functions): New function.
9751 * target-reloc.h: Include "object.h".
9752 (relocate_section): Add reloc_symbol_changes parameter. Change
9754 * target.h (class Target): Add calls_non_split method. Declare
9755 do_calls_non_split virtual method. Declare match_view and
9757 * target.cc: Include "elfcpp.h".
9758 (Target::do_calls_non_split): New function.
9759 (Target::match_view): New function.
9760 (Target::set_view_to_nop): New function.
9761 * gold.cc (queue_middle_tasks): Give an error if mixing
9762 split-stack and non-split-stack objects with -r.
9763 * i386.cc (Target_i386::relocate_section): Add
9764 reloc_symbol_changes parameter.
9765 (Target_i386::do_calls_non_split): New function.
9766 * x86_64.cc (Target_x86_64::relocate_section): Add
9767 reloc_symbol_changes parameter.
9768 (Target_x86_64::do_calls_non_split): New function.
9769 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9771 * powerpc.cc (Target_powerpc::relocate_section): Add
9772 reloc_symbol_changes parameter.
9773 * sparc.cc (Target_sparc::relocate_section): Add
9774 reloc_symbol_changes parameter.
9775 * configure.ac: Call AM_CONDITIONAL for the default target.
9776 * configure: Rebuild.
9777 * testsuite/Makefile.am (TEST_AS): New variable.
9778 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9779 (check_DATA): Add split_i386 and split_x86_64 files.
9780 (SPLIT_DEFSYMS): Define.
9781 (split_i386_[1234n].o): New targets.
9782 (split_i386_[124]): New targets.
9783 (split_i386_[1234r].stdout): New targets.
9784 (split_x86_64_[1234n].o): New targets.
9785 (split_x86_64_[124]): New targets.
9786 (split_x86_64_[1234r].stdout): New targets.
9787 (MOSTLYCLEANFILES): Add new executables.
9788 * testsuite/split_i386.sh: New file.
9789 * testsuite/split_x86_64.sh: New file.
9790 * testsuite/split_i386_1.s: New file.
9791 * testsuite/split_i386_2.s: New file.
9792 * testsuite/split_i386_3.s: New file.
9793 * testsuite/split_i386_4.s: New file.
9794 * testsuite/split_i386_n.s: New file.
9795 * testsuite/split_x86_64_1.s: New file.
9796 * testsuite/split_x86_64_2.s: New file.
9797 * testsuite/split_x86_64_3.s: New file.
9798 * testsuite/split_x86_64_4.s: New file.
9799 * testsuite/split_x86_64_n.s: New file.
9800 * testsuite/testfile.cc (Target_test): Update relocation_section
9802 * testsuite/Makefile.in: Rebuild.
9804 2009-10-06 Ian Lance Taylor <iant@google.com>
9806 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9807 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9808 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
9809 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9810 the address on ldo_addrs_.
9811 (Target_i386::Relocate::fix_up_ldo): New function.
9813 2009-10-06 Rafael Espindola <espindola@google.com>
9815 * plugin.cc (add_input_library): New.
9816 (Plugin::load): Add add_input_library to tv.
9817 (Plugin_manager::add_input_file): Add the is_lib argument.
9818 (add_input_file): Update call to Plugin_manager::add_input_file.
9819 (add_input_library): New.
9820 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9822 2009-09-30 Doug Kwan <dougkwan@google.com>
9824 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9825 symbol and call Symbol::may_need_copy_reloc to determine if
9826 a copy reloc is needed.
9827 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9828 nocopyreloc is given in command line.
9829 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9830 given in command line.
9831 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9832 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9833 of the removed Target_i386::may_need_copy_reloc.
9834 * options.h (copyreloc): New option with default value false.
9835 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9836 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9837 instead of the removed Target_powerpc::may_need_copy_reloc.
9838 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9839 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9840 instead of the removed Target_sparc::may_need_copy_reloc.
9841 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9842 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9843 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9844 instead of the removed Target_x86_64::may_need_copy_reloc.
9846 2009-09-30 Ian Lance Taylor <iant@google.com>
9848 * object.h (class Object): Remove target_ field, and target,
9849 sized_target, and set_target methods.
9850 (Object::sized_target): Remove.
9851 (class Sized_relobj): Update declarations. Remove sized_target.
9852 * object.cc (Sized_relobj::setup): Remove target parameter.
9854 (Input_objects::add_object): Don't do anything with the target.
9855 (make_elf_sized_object): Add punconfigured parameter. Change all
9856 callers. Set or test parameter target.
9857 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9859 * parameters.cc (Parameters::set_target): Change parameter type to
9861 (Parameters::default_target): Remove.
9862 (set_parameters_target): Change parameter type to be non-const.
9863 (parameters_force_valid_target): New function.
9864 (parameters_clear_target): New function.
9865 * parameters.h (class Parameters): Update declarations. Remove
9866 default_target method. Add sized_target and clear_target
9867 methods. Change target_ to be non-const.
9868 (set_parameters_target): Update declaration.
9869 (parameters_force_valid_target): Declare.
9870 (parameters_clear_target): Declare.
9871 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9872 as NULL if we aren't searching.
9873 (Add_symbols::run): Don't check for compatible target.
9874 * fileread.cc (Input_file::open_binary): Call
9875 parameters_force_valid_target.
9876 * gold.cc (queue_middle_tasks): Likewise.
9877 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9878 set_target on object.
9879 * dynobj.h (class Sized_dynobj): Update declarations.
9880 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9881 make_elf_object returns NULL.
9882 (Archive::include_member): Don't check whether object target is
9884 * output.cc (Output_section::add_input_section): Get target from
9886 (Output_section::relax_input_section): Likewise.
9887 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9889 (Sized_relobj::do_scan_relocs): Likewise.
9890 (Sized_relobj::relocate_sections): Likewise.
9891 * resolve.cc (Symbol_table::resolve): Likewise.
9892 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9893 parameter. Change all callers.
9894 (Symbol_table::add_from_object): Get target from parameters.
9895 (Symbol_table::add_from_relobj): Don't check object target.
9896 (Symbol_table::add_from_dynobj): Likewise.
9897 (Symbol_table::define_special_symbol): Get target from
9899 * symtab.h (class Symbol_table): Update declaration.
9900 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9901 parameter. Change all callers. Clear parameter target.
9902 (Binary_test): Test target here.
9903 * testsuite/object_unittest.cc (gold_testsuite): Remove
9904 target_test_pointer parameter. Change all callers.
9905 (Object_test): Test target here.
9907 2009-09-26 Ian Lance Taylor <iant@google.com>
9909 * testsuite/initpri1.c: Don't try to use constructor priorities if
9910 compiling with gcc before 4.3.
9912 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9914 * testsuite/retain_symbols_file_test.sh (check_present): Change
9915 output file name to retain_symbols_file_test.stdout.
9916 (check_absent): Likewise.
9918 2009-09-18 Craig Silverstein <csilvers@google.com>
9920 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9921 * options.cc: Include <cerrno> and <fstream>.
9922 (General_options::finalize): Parse -retain-symbols-file tag.
9923 * options.h: New flag.
9924 (General_options): New method should_retain_symbol, new
9925 variable symbols_to_retain.
9926 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9927 should_retain_symbol map.
9928 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9929 * testsuite/Makefile.in: Regenerate.
9930 * testsuite/retain_symbols_file_test.sh: New file.
9932 2009-09-18 Nick Clifton <nickc@redhat.com>
9934 * po/es.po: Updated Spanish translation.
9936 2009-09-17 Doug Kwan <dougkwan@google.com>
9938 * debug.h (DEBUG_RELAXATION): New constant.
9939 (DEBUG_ALL): Add DEBUG_RELAXATION.
9940 (debug_string_to_enum): Add relaxation debug option.
9942 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9943 Layout::Relaxation_debug_check::read_sections,
9944 Layout::Relaxation_debug_check::read_sections): New method definitions.
9945 (Layout::Layout): Initialize data members
9946 record_output_section_data_from_scrips_,
9947 script_output_section_data_list_ and relaxation_debug_check_.
9948 (Layout::save_segments, Layout::restore_segments,
9949 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9950 Layout::relaxation_loop_body): New method definitions.
9951 (Layout::finalize): Support relaxation. Move section layout code to
9952 Layout::relaxation_loop_body.
9953 (Layout::set_asection_address_from_script): Move code for orphan
9954 section placement out.
9955 (Layout::place_orphan_sections_in_script): New method definition.
9956 * layout.h (Output_segment_headers, Output_file_header):
9957 New forward class declarations.
9958 (Layout::~Layout): Define.
9959 (Layout::new_output_section_data_from_script): New method definition.
9960 (Layout::place_orphan_sections_in_script): New method declaration.
9961 (Layout::Segment_states): New type declaration.
9962 (Layout::save_segments, Layout::restore_segments,
9963 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9964 Layout::relaxation_loop_body): New method declarations.
9965 (Layout::Output_section_data_list): New type declaration.
9966 (Layout::Relaxation_debug_check): New class definition.
9967 (Layout::record_output_section_data_from_script_,
9968 Layout::script_output_section_data_list_, Layout::segment_states_,
9969 Layout::relaxation_debug_check_): New data members.
9970 * output.cc: (Output_section_headers::do_size): New method definition.
9971 (Output_section_headers::Output_section_headers): Move size
9972 computation to Output_section_headers::do_size.
9973 (Output_segment_headers::do_size): New method definition.
9974 (Output_file_header::Output_file_header): Move size computation to
9975 Output_file_header::do_size and call it.
9976 (Output_file_header::do_size): New method definition.
9977 (Output_data_group::Output_data_group): Adjust call to
9978 Output_section_data.
9979 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9980 (Output_symtab_xindex::do_write): Add array bound check.
9981 (Output_section::Input_section::print_to_mapfile): Handle
9982 RELAXED_INPUT_SECTION_CODE.
9983 (Output_section::Output_section): Initialize data member checkpoint_.
9984 (Output_section::~Output_section): Delete checkpoint object pointed
9986 (Output_section::add_input_section): Always add an Input_section if
9988 (Output_section::add_merge_input_section): Add assert.
9989 (Output_section::relax_input_section): New method definition.
9990 (Output_section::set_final_data_size): Set load address to zero for
9991 an unallocated section.
9992 (Output_section::do_address_and_file_offset_have_reset_values):
9993 New method definition.
9994 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9995 Handle relaxed input section.
9996 (Output_section::sort_attached_input_sections): Checkpoint input
9997 section list lazily.
9998 (Output_section::get_input_sections): Change type of input_sections to
9999 list of Simple_input_section pointers. Checkpoint input section list
10000 lazily. Also handle relaxed input sections.
10001 (Output_section::add_input_section_for_script): Take a reference to
10002 a Simple_input_section object instead of Relobj pointer and section
10003 index as parameter. Handle relaxed input sections.
10004 (Output_section::save_states, Output_section::restore_states): New
10005 method definitions.
10006 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10007 (Output_data::is_data_size_fixed): New method definition.
10008 (Output_data::reset_addresss_and_file_offset): Do not reset data size
10010 (Output_data::address_and_file_offset_have_reset_values): New method
10012 (Output_data::do_address_and_file_offset_have_reset_values): New method
10014 (Output_data::set_data_size): Check that data size is not fixed.
10015 (Output_data::fix_data_size): New method definition.
10016 (Output_data::is_data_size_fixed_): New data member.
10017 (Output_section_headers::set_final_data_size): New method definition.
10018 (Output_section_headers::do_size): New method declaration.
10019 (Output_segment_headers::set_final_data_size): New method definition.
10020 (Output_segment_headers::do_size): New method declaration.
10021 (Output_file_header::set_final_data_size)::New method definition.
10022 (Output_file_header::do_size)::New method declaration.
10023 (Output_section_data::Output_section_data): Add new parameter
10024 is_data_size_fixed and use it to fix data size.
10025 (Output_data_const::Output_data_const): Adjust call to base class
10026 constructor and fix data size.
10027 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10028 base class constructor and fix data size.
10029 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10030 base class constructor and fix data size.
10031 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10032 class constructor and fix data size.
10033 (Output_data_group::set_final_data_size): New method definition.
10034 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10035 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10036 class constructor and fix data size.
10037 (Output_relaxed_input_section): New class definition.
10038 (Output_section::Simple_input_section): New class definition.
10039 (Output_section::get_input_sections): Adjust parameter list.
10040 (Output_section::add_input_section_for_script): Same.
10041 (Output_section::save_states, Output_section::restore_states,
10042 Output_section::do_address_and_file_offset_have_reset_values,
10043 (Output_section::Input_section::Input_section): Handle
10044 RELAXED_INPUT_SECTION_CODE. Add new overload for
10045 Output_relaxed_input_section.
10046 (Output_section::Input_section::is_input_section,
10047 Output_section::Input_section::set_output_section): Handle relaxed
10049 (Output_section::Input_section::is_relaxed_input_section,
10050 Output_section::Input_section::output_section_data,
10051 Output_section::Input_section::relaxed_input_section): New method
10053 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10055 (Output_section::Input_section::u1_): Update comments.
10056 (Output_section::Input_section::u2_): Add new union member poris.
10057 (Output_section::Checkpoint_output_section): New classs definition.
10058 (Output_section::relax_input_section): New method declaration.
10059 (Output_section::checkpoint_): New data member.
10060 (Output_segment): Update comments.
10061 (Output_segment::Output_segment): Un-privatize copy constructor.
10062 (Output_segment::operator=): Un-privatize.
10063 * script-sections.cc (Output_section_element::Input_section_list):
10064 Change element type to Output_section::Simple_input_section.
10065 (Output_section_element_dot_assignment::set_section_addresses):
10066 Register output section data for relaxation clean up.
10067 (Output_data_exression::Output_data_expression): Adjust call to base
10068 constructor to fix data size.
10069 (Output_section_element_data::set_section_addresses): Register
10070 Output_data_expression object for relaxation clean up.
10071 (struct Input_section_info): Replace Relobj pointer and section index
10072 pair with Output_section::Simple_input_section and Convert struct to a
10074 (Input_section_sorter::operator()): Adjust access to
10075 Input_section_info data member to use accessors.
10076 (Output_section_element_input::set_section_addresses): Use layout
10077 parameter. Adjust code to use Output_section::Simple_input_section
10078 and Input_secction_info classes. Register filler for relaxation
10080 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10081 and section index pair with Output_section::Simple_input_section
10082 class. Adjust code accordingly.
10083 (Phdrs_element::release_segment): New method definition.
10084 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10086 (Script_sections::release_segments): New method definition.
10087 * gold/script-sections.h (Script_sections::release_segments): New
10088 method declaration.
10089 * gold/target.h (Target::may_relax, Target::relax,
10090 Target::do_may_relax, Target::do_relax): New method definitions.
10092 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10094 * arm.cc (has_signed_unsigned_overflow): New function.
10095 (Arm_relocate_functions::abs8): New function.
10096 (Target_arm::Scan::local): Handle R_ARM_ABS8.
10097 (Target_arm::Scan::global): Likewise.
10098 (Target_arm::relocate::relocate): Likewise.
10099 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10102 2009-09-16 Cary Coutant <ccoutant@google.com>
10104 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10105 * testsuite/Makefile.in: Regenerate.
10107 2009-09-11 Nick Clifton <nickc@redhat.com>
10109 * po/gold.pot: Updated by the Translation project.
10111 2009-09-08 Cary Coutant <ccoutant@google.com>
10113 * output.cc (Output_file::open): Add execute permission to empty file.
10114 * testsuite/Makefile.am (permission_test): New test.
10115 * testsuite/Makefile.in: Regenerate.
10117 2009-09-02 Ian Lance Taylor <iant@google.com>
10119 * output.cc (Output_file::resize): Call map_no_anonymous rather
10122 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
10124 * gold.cc: Include "incremental.h".
10125 (queue_initial_tasks): Call Incremental_checker methods.
10126 * incremental.cc: Include "output.h".
10127 (Incremental_checker::can_incrementally_link_output_file): New
10129 * incremental.h (Incremental_checker): New class.
10131 * output.cc (Output_file::open_for_modification): New method.
10132 (Output_file::map_anonymous): Changed return type to bool. Record
10133 map in base_ field.
10134 (Output_file::map_no_anonymous): New method, broken out of map.
10135 (Output_file::map): Use map_no_anonymous and map_anonymous.
10136 * output.h (class Output_file): Update declarations.
10138 2009-08-24 Cary Coutant <ccoutant@google.com>
10140 * options.h (Command_line::Pre_options): New class.
10141 (Command_line::pre_options): New member.
10142 * options.cc (gold::options::ready_to_register): New variable.
10143 (One_option::register_option): Do nothing if not registering options.
10144 Assert if same short option registered twice.
10145 (General_options::General_options): Turn off option registration when
10147 (Command_line::Pre_options::Pre_options): New constructor.
10149 2009-08-24 Cary Coutant <ccoutant@google.com>
10151 * options.h (General_options::no_keep_memory): Remove incorrect
10154 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10156 * Makefile.am (am__skiplex, am__skipyacc): New.
10157 * Makefile.in: Regenerate.
10159 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10161 * Makefile.am (AM_CPPFLAGS): Renamed from ...
10162 (INCLUDES): ... this.
10163 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10164 (AM_CPPFLAGS): Renamed from ...
10165 (INCLUDE): ... this.
10166 * Makefile.in, testsuite/Makefile.in: Regenerate.
10168 * Makefile.in: Regenerate.
10169 * aclocal.m4: Likewise.
10170 * config.in: Likewise.
10171 * configure: Likewise.
10172 * testsuite/Makefile.in: Likewise.
10174 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10175 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10176 * Makefile.in: Regenerate.
10177 * testsuite/Makefile.in: Regenerate.
10179 2009-08-19 Cary Coutant <ccoutant@google.com>
10181 * resolve.cc (Symbol_table::resolve): Don't complain about defined
10182 symbols in shared libraries overridden by hidden or internal symbols
10183 in the main program.
10185 2009-08-19 Chris Demetriou <cgd@google.com>
10187 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10188 checking source file names in error messages.
10190 2009-08-18 Doug Kwan <dougkwan@google.com>
10192 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10193 an elcpp::Ehdr as parameter. Adjust call to set_target.
10194 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10195 an elfcpp::Ehdr as parameter.
10196 * object.cc (Object::set_target): Remove the version that looks up
10197 a target and sets it.
10198 (Sized_relobj::setup): Take a Target object instead of
10199 an elfcpp::Ehdr as parameter. Adjust call to set_target.
10200 (make_elf_sized_object): Find target and ask target to
10201 make an ELF object.
10202 * object.h: (Object::set_target): Remove the version that looks up
10203 a target and sets it.
10204 (Sized_relobj::setup): Take a Target object instead of
10205 an elfcpp:Ehdr as parameter.
10206 * target.cc: Include dynobj.h.
10207 (Target::do_make_elf_object_implementation): New.
10208 (Target::do_make_elf_object): New.
10209 * target.h (Target::make_elf_object): New template declaration.
10210 (Target::do_make_elf_object): New method declarations.
10211 (Target::do_make_elf_object_implementation): New template declaration.
10213 2009-08-14 Ian Lance Taylor <iant@google.com>
10215 * gold.h (FUNCTION_NAME): Define.
10216 (gold_unreachable): Use FUNCTION_NAME.
10218 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10220 * icf.cc (Icf::find_identical_sections): Issue a warning when a
10221 symbol in the --keep-unique list is not found.
10223 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10225 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10226 been maked as --keep-unique.
10227 (Icf::unfold_section): New function.
10228 * icf.h (Icf::unfold_section): New function.
10229 * options.h (General_options::keep_unique): New option.
10230 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10231 * testsuite/Makefile.in: Regenerate.
10232 * testsuite/icf_keep_unique_test.sh: New file.
10233 * testsuite/icf_keep_unique_test.cc: New file.
10235 2009-08-12 Cary Coutant <ccoutant@google.com>
10238 * resolve.cc (Symbol_table::resolve): Check for references from
10239 dynamic objects to hidden and internal symbols.
10240 * testsuite/Makefile.am (hidden_test.sh): New test.
10241 * testsuite/Makefile.in: Regenerate.
10242 * testsuite/hidden_test.sh: New script.
10243 * testsuite/hidden_test_1.c: New test source.
10244 * testsuite/hidden_test_main.c: New test source.
10246 2009-08-11 Doug Kwan <dougkwan@google.com>
10248 * arm.cc: Update comments.
10249 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10250 segment to locate the .ARM.exidx section if present.
10252 2009-08-09 Doug Kwan <dougkwan@google.com>
10254 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10257 2009-08-07 Sriraman Tallam <tmsriram@google.com>
10258 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10261 2009-08-06 Sriraman Tallam <tmsriram@google.com>
10263 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10264 valid tls_segment only for non-debug-section relocations.
10265 * testsuite/Makefile.am: Add gc_tls_test.
10266 * testsuite/Makefile.in: Regenerate.
10267 * testsuite/gc_tls_test.cc: New file.
10268 * testsuite/gc_tls_test.sh: New file.
10270 2009-08-05 Sriraman Tallam <tmsriram@google.com>
10272 * icf.cc: New file.
10274 * Makefile.am (CCFILES): Add icf.cc.
10275 (HFILES): Add icf.h
10276 * Makefile.in: Regenerate.
10277 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10278 * gc.h (gc_process_relocs): Populate lists used by icf to contain
10279 section, symbol and addend information for the relocs.
10280 * gold.cc (queue_middle_tasks): Call identical code folding.
10281 * gold.h: Add defines for multimap.
10282 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10283 to the call of finalize_local_symbols.
10284 * main.cc (main): Create object of class Icf.
10285 * object.cc (Sized_relobj::do_layout): Allow this function to be
10286 called twice during icf.
10287 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10288 to sections marked as identical by icf.
10289 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10291 (Sized_relobj::do_section_entsize): New function.
10292 * object.h (Object::section_entsize): New function.
10293 (Object::do_section_entsize): New pure virtual function.
10294 (Relobj::finalize_local_symbols): Add new parameter.
10295 (Relobj::do_section_entsize): New function.
10296 * options.h (General_options::icf): New option.
10297 (General_options::icf_iterations): New option.
10298 (General_options::print_icf_sections): New option.
10299 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10300 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10301 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10303 * symtab.cc (Symbol_table::is_section_folded): New function.
10304 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
10305 to sections marked as identical by icf.
10306 * symtab.h (Symbol_table::set_icf): New function.
10307 (Symbol_table::icf): New function.
10308 (Symbol_table::is_section_folded): New function.
10309 (Symbol_table::icf_): New data member.
10310 * target-reloc.h (relocate_section): Ignore sections folded by icf.
10311 * testsuite/Makefile.am: Add commands to build icf_test.
10312 * testsuite/Makefile.in: Regenerate.
10313 * testsuite/icf_test.sh: New file.
10314 * testsuite/icf_test.cc: New file.
10316 2009-07-24 Chris Demetriou <cgd@google.com>
10318 * layout.cc (is_compressible_debug_section): Fix incorrect
10319 comment about compressed section names.
10321 2009-07-20 Ian Lance Taylor <ian@airs.com>
10324 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10326 2009-07-16 Ian Lance Taylor <iant@google.com>
10329 * layout.h: #include <map>.
10330 (class Kept_section): Change from struct to class. Add accessors
10331 and setters. Add section size to Comdat_group mapping. Change
10332 Comdat_group to std::map. Add is_comdat_ field. Add
10333 linkonce_size field in union.
10334 (class Layout): Update declaration of find_or_add_kept_section.
10335 Don't declare find_kept_object.
10336 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10337 parameter. Add object, shndx, is_comdat, and is_group_name
10338 parameters. Change all callers. Adjust for new Kept_section.
10339 (Layout::find_kept_object): Remove.
10340 * object.cc (Sized_relobj::include_section_group): Update use of
10341 Kept_section. Rename secnum to shndx. Only record
10342 Kept_comdat_section if sections are the same size.
10343 (Sized_relobj::include_linkonce_section): Update use of
10344 Kept_section. Only record Kept_comdat_section if sections are the
10345 same size. Set size of linkonce section.
10346 (Sized_relobj::map_to_kept_section): Update call to
10347 get_kept_comdat_section.
10348 * object.h (class Sized_relobj): Rename fields in
10349 Kept_comdat_section to drop trailing underscores; change object
10350 field to Relobj*. Change Kept_comdat_section_table to store
10351 struct rather than pointer.
10352 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10353 Add kept_object and kept_shndx parameters. Change all callers.
10354 (Sized_relobj::get_kept_comdat_section): Change return type to
10355 bool. Add kept_object and kept_shndx parameters. Change all
10357 * plugin.cc (Pluginobj::include_comdat_group): Update call to
10358 Layout::find_or_add_kept_section.
10360 2009-07-09 Ian Lance Taylor <iant@google.com>
10362 * merge.cc (Object_merge_map::initialize_input_to_output_map):
10363 Reserve space in the hash table.
10365 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
10367 * fileread.cc (File_read::get_mtime): New method.
10368 * fileread.h (Timespec): New structure.
10369 (File_read::get_mtime): New method.
10370 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10371 Renamed from timestamp_nsec.
10372 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10374 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10376 (Incremental_inputs::report_archive): Save mtime; style fix.
10377 (Incremental_inputs::report_obejct): Save mtime; style fix.
10378 (Incremental_inputs::report_script): Save mtime; style fix.
10379 (Incremental_inputs::finalize_inputs): Style fix.
10380 (Incremental_inputs::finalize): Style fix.
10381 (Incremental_inputs::create_input_section_data): Store inputs
10383 * incremental.h (Incremental_inputs::report_script): Add mtime
10385 (Incremental_inputs::Input_info::Input_info): Intialize only one
10387 (Incremental_inputs::Input_info::archive): Move to nameless
10389 (Incremental_inputs::Input_info::obejct): Move to nameless union.
10390 (Incremental_inputs::Input_info::script): Move to nameless union.
10391 (Incremental_inputs::mtime): New field.
10392 * script.cc (read_input_script): Pass file mtime to
10394 * script.h (Script_info::inputs): Style fix.
10396 2009-07-01 Ian Lance Taylor <ian@airs.com>
10398 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10401 2009-06-24 Ian Lance Taylor <iant@google.com>
10404 * layout.cc (Layout::choose_output_section): If we find an
10405 existing section, update the flags.
10406 (Layout::create_notes): New function, broken out of
10408 (Layout::finalize): Don't create note sections.
10409 (Layout::create_note): Don't crash if linker script discards
10411 (Layout::create_gold_note): Likewise.
10412 (Layout::create_build_id): Likewise. Don't set
10413 after_input_sections on the section.
10414 (Layout::create_executable_stack_info): Remove target parameter.
10416 * layout.h (class Layout): Declare create_notes. Update
10417 declaration of create_executable_stack_info.
10418 * gold.cc (queue_middle_tasks): Call create_notes.
10419 * output.cc (Output_section::update_flags_for_input_section): Move
10420 here from output.h. If SHF_ALLOC flag is newly set, mark address
10422 * output.h (Output_data::mark_address_invalid): New function.
10423 (class Output_section): Only declare, not define,
10424 update_flags_for_input_section. Remove set_flags.
10426 2009-06-24 Ian Lance Taylor <iant@google.com>
10428 * script-sections.cc (Output_section_definition::
10429 set_section_addresses): Rename shadowing local load_address to
10432 2009-06-24 Ian Lance Taylor <iant@google.com>
10435 * reloc.cc (relocate_sections): Skip empty relocation sections.
10437 2009-06-23 Ian Lance Taylor <iant@google.com>
10440 * layout.cc (Layout::create_note): Use choose_output_section
10441 rather than make_output_section.
10443 2009-06-23 Ian Lance Taylor <iant@google.com>
10446 * options.cc (General_options::parse_V): Set printed_version_.
10447 (General_options::General_options): Initialize printed_version_.
10448 * options.h (class General_options): Add printed_version_ field.
10449 * gold.cc (queue_initial_tasks): If there are no input files,
10450 don't give a fatal error if we printed the version information.
10451 (queue_middle_tasks): If using -r with a shared object, give a
10452 fatal error rather than an ordinary error.
10454 2009-06-23 Ian Lance Taylor <iant@google.com>
10457 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10458 (Layout::make_output_section): Set have_stabstr_section_ if we see
10459 a .stab*str section.
10460 (Layout::finalize): Call link_stabs_sections.
10461 (Layout::link_stabs_sections): New file.
10462 * layout.h (class Layout): Add have_stabstr_section_ field.
10463 Declare link_stabs_sections.
10465 2009-06-23 Doug Kwan <dougkwan@google.com>
10467 * Makefile.am (libgold_a_LIBADD): New.
10468 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10469 * Makefile.in: Regenerate.
10470 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10471 * configure: Regenerate.
10472 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10473 * fileread.cc: Include sys/state.h
10474 * gold.h: Declare memmem and strndup if found missing.
10475 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10477 2009-06-23 Ian Lance Taylor <iant@google.com>
10479 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10480 * configure: Rebuild.
10482 2009-06-23 Ian Lance Taylor <iant@google.com>
10485 * object.cc (Object::section_contents): Don't try to get a view if
10486 the section has length zero.
10487 (Object::handle_gnu_warning_section): If the section is empty, use
10488 the name of the section as the warning.
10490 2009-06-23 Ian Lance Taylor <iant@google.com>
10493 * stringpool.h (class Stringpool_template): Add optimize_ field.
10494 (Stringpool_template::set_optimize): New function.
10495 * stringpool.cc (Stringpool_template::Stringpool_template):
10496 Initialize optimize_ field.
10497 (Stringpool_template::set_string_offsets): Test local optimize
10498 fild rather than parameter.
10499 * layout.cc (Layout::Layout): Call set_optimize on the section
10502 2009-06-22 Ian Lance Taylor <iant@google.com>
10505 * yyscript.y: Parse TARGET.
10506 * script.cc (script_set_target): New function.
10507 * script-c.h (script_set_target): Declare.
10508 * options.cc (General_options::string_to_object_format): Rename
10509 from string_to_object_format in anonymous namespace. Change
10511 * options.h (class General_options): Declare
10512 string_to_object_format.
10514 2009-06-22 Ian Lance Taylor <iant@google.com>
10516 * script-sections.cc (Script_sections::create_segments): Don't put
10517 program headers in a PT_LOAD segment if -n or -N.
10519 2009-06-22 Ian Lance Taylor <iant@google.com>
10522 * options.h (class General_options): Add -z lazy and -z now. Sort
10523 -z options into alphabetical order.
10524 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10526 2009-06-21 Ian Lance Taylor <iant@google.com>
10528 * layout.cc (Layout::make_output_section): Call
10529 Target::new_output_section.
10530 (Layout::attach_allocated_section_to_segment): Put large section
10531 sections in a separate load segment with the large segment flag
10533 (Layout::segment_precedes): Sort large data segments after other
10535 (align_file_offset): New static function.
10536 (Layout::set_segment_offsets): Use align_file_offset.
10537 * output.h (class Output_section): Add is_small_section_ and
10538 is_large_section_ fields.
10539 (Output_section::is_small_section): New function.
10540 (Output_section::set_is_small_section): New function.
10541 (Output_section::is_large_section): New function.
10542 (Output_section::set_is_large_section): New function.
10543 (Output_section::is_large_data_section): New function.
10544 (class Output_segment): Add is_large_data_segment_ field.
10545 (Output_segment::is_large_data_segment): New function.
10546 (Output_segment::set_is_large_data_segment): New function.
10547 * output.cc (Output_section::Output_section): Initialize new
10549 (Output_segment::Output_segment): Likewise.
10550 (Output_segment::add_output_section): Add assertion that large
10551 data sections always go in large data segments. Force small data
10552 sections to the end of the list of data sections. Force small BSS
10553 sections to the start of the list of BSS sections. For large BSS
10554 sections to the end of the list of BSS sections.
10555 * symtab.h (class Symbol): Declare is_common_shndx.
10556 (Symbol::is_defined): Check Symbol::is_common_shndx.
10557 (Symbol::is_common): Likewise.
10558 (class Symbol_table): Define enum Commons_section_type. Update
10559 declarations. Add small_commons_ and large_commons_ fields.
10560 * symtab.cc (Symbol::is_common_shndx): New function.
10561 (Symbol_table::Symbol_table): Initialize new fields.
10562 (Symbol_table::add_from_object): Put small and large common
10563 symbols in the right list.
10564 (Symbol_table::sized_finalized_symbol): Check
10565 Symbol::is_common_shndx.
10566 (Symbol_table::sized_write_globals): Likewise.
10567 * common.cc (Symbol_table::do_allocate_commons): Allocate new
10568 common symbol lists. Don't call do_allocate_commons_list if the
10570 (Symbol_table::do_allocate_commons_list): Remove is_tls
10571 parameter. Add comons_section_type parameter. Change all
10572 callers. Handle small and large common symbols.
10573 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10574 Symbol::is_common_shndx.
10575 * resolve.cc (symbol_to_bits): Likewise.
10576 * target.h (Target::small_common_shndx): New function.
10577 (Target::small_common_section_flags): New function.
10578 (Target::large_common_shndx): New function.
10579 (Target::large_common_section_flags): New function.
10580 (Target::new_output_section): New function.
10581 (Target::Target_info): Add small_common_shndx, large_common_shndx,
10582 small_common_section_flags, and large_common_section_flags
10584 (Target::do_new_output_section): New virtual function.
10585 * arm.cc (Target_arm::arm_info): Initialize new fields.
10586 * i386.cc (Target_i386::i386_info): Likewise.
10587 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10589 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10590 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10591 (Target_x86_64::do_new_output_section): New function.
10592 * configure.ac: Define conditional MCMODEL_MEDIUM.
10593 * testsuite/Makefile.am (check_PROGRAMS): Add large.
10594 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10595 (large_LDFLAGS): Define.
10596 * testsuite/large.c: New file.
10597 * testsuite/testfile.cc (Target_test::test_target_info):
10598 Initialize new fields.
10599 * configure, testsuite/Makefile.in: Rebuild.
10601 2009-06-05 Doug Kwan <dougkwan@google.com>
10603 * Makefile.am (CCFILES): Add target.cc.
10604 * Makefile.in: Regenerate.
10605 * i386.cc (class Target_i386): Define new virtual method to
10606 override do_is_local_label_name in parent.
10607 * object.cc (Sized_relobj::do_count_local_symbols): Discard
10608 local symbols if --discard-locals or -X is given.
10609 * options.h (class General_options): Declare new options
10610 '--discard-locals' and '-X' for discarding locals.
10611 * target.h (class Target): Define new methods is_local_label_name.
10612 Declare new virtual method do_is_local_label_name.
10613 * target.cc: New file.
10614 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10615 (check_SCRIPTS): Add discard_locals_test.sh.
10616 (check_DATA): Add discard_local_tests.syms.
10617 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10618 (discard_local_tests.syms, discard_locals_test.o): New make rules.
10619 * testsuite/Makefile.in: Regenerate.
10620 * testsuite/discard_locals_test.c: New file.
10621 * testsuite/discard_locals_test.sh: Same.
10623 2009-06-05 Doug Kwan <dougkwan@google.com>
10625 * object.cc (Sized_relobj::Sized_relobj): Initialize
10626 discarded_eh_frame_shndx_ to -1U.
10627 (Sized_relobj::do_layout): Record index of a discard .eh_frame
10629 (Sized_relobj::do_count_local_symbols): Skip local symbols in
10630 a discarded .eh_frame section.
10631 (Sized_relobj::do_finalize_local_symbols): Ditto.
10632 * object.h (class Sized_relobj): Declare new member
10633 discarded_eh_frame_shndx_.
10634 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10635 (local_labels_test.o, local_labels_test): New rules.
10636 * testsuite/Makefile.in: Regenerate.
10638 2009-06-04 Doug Kwan <dougkwan@google.com>
10640 * layout.cc (Layout::section_name_mapping): Add mapping for
10641 special ARM sections.
10643 2009-06-03 Doug Kwan <dougkwan@google.com>
10645 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10646 (utils::has_overflow): Same.
10648 2009-06-03 Ian Lance Taylor <iant@google.com>
10650 * layout.cc (Layout::section_name_mapping): New array, replacing
10651 Layout::linkonce_mapping.
10652 (Layout::section_name_mapping_count): New variable, replacing
10653 Layout::linkonce_mapping_count.
10654 (Layout::linkonce_output_name): Remove.
10655 (Layout::output_section_name): Rewrite.
10656 * layout.h (class Layout): Rename Linkonce_mapping to
10657 Section_name_mapping, linkonce_mapping to section_name_mapping,
10658 linkonce_mapping_count to section_name_mapping_count. Don't
10659 declare linkonce_output_name.
10661 2009-06-03 Doug Kwan <dougkwan@google.com>
10663 * gold/arm.cc (namespace utils): New.
10664 (Target_arm::reloc_is_non_pic): Define new method.
10665 (class Arm_relocate_functions): New.
10666 (Target_arm::Relocate::relocate): Handle relocation types used by
10669 2009-06-03 Ian Lance Taylor <iant@google.com>
10671 * arm.cc (Target_arm::scan::global): Use || instead of |.
10673 2009-06-02 Doug Kwan <dougkwan@google.com>
10675 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
10676 issued_non_pic_error_.
10677 (class Target_arm::Scan): Declare new method check_non_pic.
10678 Define new method symbol_needs_plt_entry.
10679 Declare new data member issued_non_pic_error_.
10680 (class Target_arm::Relocate): Declare new method
10681 should_apply_static_reloc.
10682 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10683 (Target_arm::Scan::check_non_pic): Define new method.
10684 (Target_arm::Scan::local): Handle a small subset of reloc types used
10686 (Target_arm::Scan::local): Same.
10687 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10689 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
10691 * incremental.cc (Incremental_inputs::report_command_line): Filter
10692 out --incremental-* options.
10694 2009-05-29 Doug Kwan <dougkwan@google.com>
10696 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10698 (class Target_arm): Update comment.
10699 (Target_arm::Target_arm): Initialize new data members GOT_,
10700 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10701 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10702 and Target_arm::rel_dyn_section.
10703 Declare new_enum Target_arm::Got_type.
10704 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10706 Update commments for member do_dynsym_value.
10707 (Target_arm::got_size, Target_arm::plt_section,
10708 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10709 new methods inside class defintion.
10710 (Target_arm::got_section): Define new method.
10711 (Target_arm::rel_dyn_section): Same.
10712 (Output_data_plt_arm): New template class.
10713 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10714 (Output_data_plt_arm:do_adjust_output_section): Define new method.
10715 (Output_data_plt_arm::add_entry): Same.
10716 (Output_data_plt_arm::first_plt_entry): Define new
10717 static data member for PLT instruction template.
10718 (Output_data_plt_arm::plt_entry): Same.
10719 (Output_data_plt_arm::do_write): Define new method.
10720 (Target_arm::make_plt_entry): Same.
10721 (Target_arm::do_finalize_sections): Same.
10722 (Target_arm::do_dynsym_value): Same.
10724 2009-05-28 Doug Kwan <dougkwan@google.com>
10726 * Makefile.am (TARGETSOURCES): Add arm.cc.
10727 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10728 * Makefile.in: Regenerate.
10729 * arm.cc: New file.
10730 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10732 2009-05-26 Doug Kwan <dougkwan@google.com>
10734 * options.cc (General_options::parse_exclude_libs). Fix a comment.
10735 (General_options::check_excluded_libs): Strip off directories in
10736 archive name before matching like GNU ld does.
10737 * testsuite/Makefile.am (MOSTLYCLEANFILES,
10738 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10739 (exclude_libs_test_LDFLAGS): Add linker option
10740 -Wl,--exclude-libs,libexclude_libs_test_3
10741 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10742 an explicit archive without using -l.
10743 (alt/libexclude_libs_test_3.a): New make rule.
10744 * testsuite/Makefile.in: Regenerate.
10745 * testsuite/exclude_libs_test.c : Declare lib3_default().
10747 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10748 * exclude_libs_test_3.c: New file.
10750 2009-05-26 Nick Clifton <nickc@redhat.com>
10752 * po/id.po: New Indonesian translation.
10753 * po/gold.pot: Updated template file.
10755 2009-05-22 Sriraman Tallam <tmsriram@google.com>
10757 * testsuite/Makefile.am: Add -ffunction-sections to compile
10758 gc_comdat_test files. Add -Wl,--gc-sections to build
10760 * testsuite/Makefile.in: Regenerate.
10761 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10763 2009-05-21 Sriraman Tallam <tmsriram@google.com>
10765 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10766 kept comdat section was garbage collected.
10767 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10768 * testsuite/Makefile.in: Regenerate.
10769 * testsuite/gc_comdat_test.sh: New file.
10770 * testsuite/gc_comdat_test_1.cc: New file.
10771 * testsuite/gc_comdat_test_2.cc: New file.
10773 2009-05-19 Doug Kwan <dougkwan@google.com>
10775 * archive.cc (Archive::Archive): Move constructor from archive.h
10776 to here. Initialize no_export_.
10777 (Archive::get_elf_object_for_member): Set no_export flag of object.
10778 * archive.h (Archive::Archive): Move constructor body to
10780 (Archive::no_export): New method.
10781 (Archive::no_export_): New field.
10782 * object.h (Object::Object): Initialize no_export_ to false.
10783 (Object::no_export, Object::set_no_export): New methods.
10784 (Object::no_export_): New field.
10785 * options.cc (General_options::parse_exclude_libs): New method.
10786 (General_options::check_excluded_libs) Same.
10787 * options.h (exclude_libs): New option.
10788 (General_options::check_excluded_libs): New method declaration.
10789 (General_options::excluded_libs_): New field.
10790 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10791 default or protected visibility if an object has no-export flag set.
10792 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10793 (check_SCRIPTS): Add exclude_libs_test.sh.
10794 (check_DATA): Add exclude_libs_test.syms.
10795 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10796 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10797 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10798 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10799 (exclude_libs_test.syms, libexclude_libs_test_1.a,
10800 libexclude_libs_test_2.a): New rules.
10801 * testsuite/Makefile.in: Regenerate.
10802 * testsuite/exclude_libs_test.c: New file.
10803 * testsuite/exclude_libs_test.sh: Ditto.
10804 * testsuite/exclude_libs_test_1.c: Ditto.
10805 * testsuite/exclude_libs_test_2.c: Ditto.
10807 2009-05-15 Ian Lance Taylor <iant@google.com>
10809 * configure.ac: Check for declarations for cases where libiberty.h
10810 checks HAVE_DECL_xxx.
10811 * configure, config.in: Rebuild.
10813 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
10815 * gold.h (Incremental_argument_list): Remove (invalid) forward
10817 * incremental.cc (Incremental_inputs::report_achive): New method.
10818 (Incremental_inputs::report_object): New method.
10819 (Incremental_inputs::report_script): New method.
10820 (Incremental_inputs::finalize_inputs): New method.
10821 (Incremental_inputs::finalize): Call finalize_inputs().
10822 (Incremental_inputs::sized_create_incremental_inputs_section_data):
10823 Create inputs entries.
10824 * incremental.h (Incremental_input_type): New enum.
10825 (Incremental_inputs::Incremental_input): Initialize new fields.
10826 (Incremental_inputs::report_inputs): New method.
10827 (Incremental_inputs::report_achive): New method.
10828 (Incremental_inputs::report_object): New method.
10829 (Incremental_inputs::report_script): New method.
10830 (Incremental_inputs::finalize_inputs): New method.
10831 (Incremental_inputs::Input_info): New struct.
10832 (Incremental_inputs::Input_info_map): New typedef.
10833 (Incremental_inputs::lock_): New field.
10834 (Incremental_inputs::Inputs_): New field.
10835 (Incremental_inputs::Inputs_map): New field.
10836 * main.cc (main): Call Incremental_input::report_inputs.
10837 * options.h (Input_argument_list): Typedef moved from
10839 (Input_file_group::Files): Remove, use ::Input_argument_list.
10840 (Input_file_group::Input_argument_list): Remove, use
10841 ::Input_argument_list.
10842 * plugin.cc (Plugin_manager::add_input_file): Add error in
10844 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10846 * script.cc (read_input_script): Call
10847 Incremental_input::report_script.
10848 * script.h (Script_info): New class.
10850 2009-04-27 Ian Lance Taylor <iant@google.com>
10852 * x86_64.cc (do_adjust_output_section): Set entsize to
10855 2009-04-23 Elliott Hughes <enh@google.com>
10857 * output.cc (Output_file::close): After short writes, continue
10858 writing from the correct offset in the buffer being written.
10860 2009-04-23 Chris Demetriou <cgd@google.com>
10862 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10863 * configure: Regenerate.
10864 * config.in: Regenerate.
10865 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10866 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10868 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10870 * incremental.cc (Incremental_inputs_header_data): Renamed from
10871 Incremental_input_header_data.
10872 (Incremental_inputs_header_data::data_size): New field.
10873 (Incremental_inputs_header_data::put_input_file_count): Renamed
10874 from input_file_count.
10875 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10876 from command_line_offset.
10877 (Incremental_inputs_header_data::put_reserved): Renamed from
10879 (Incremental_inputs_entry_data): Renamed from
10880 Incremental_input_entry_data.
10881 (Incremental_inputs_entry_data::data_size): New field.
10882 (Incremental_inputs::report_command_line): New method.
10883 (Incremental_inputs::finalize): New method.
10884 (Incremental_inputs::create_incremental_inputs_data): New method.
10885 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10886 * incremental.h: New file.
10887 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10888 (Layout::finalize): Create incremental inputs section in
10889 incremental builds.
10890 (Layout::create_incremental_info_sections): New method.
10891 * layout.h (Layout::incremental_inputs): New method.
10892 (Layout::create_incremental_info_sections): New method.
10893 (Layout::incremental_inputs_): New field.
10894 * main.cc (main): Notify Incremental_input of the command line.
10896 2009-04-01 Ian Lance Taylor <iant@google.com>
10897 Mikolaj Zalewski <mikolajz@google.com>
10899 * gold.h (reserve_unordered_map): Define, three versions, one for
10900 each version of Unordered_map.
10901 * layout.cc (Layout::Layout): Remove options parameter. Add
10902 number_of_input_files parameter. Don't initialize options_.
10903 Initialize number_of_input_files_ and resized_signatures_. Move
10904 sections_are_attached_.
10905 (Layout::layout_group): Reserve space for group_signatures_.
10906 (Layout::find_or_add_kept_section): Change name parameter to be a
10907 reference. Resize signatures_ map when it gets large enough.
10908 (Layout::layout_eh_frame): Use parameters->options() instead of
10910 (Layout::make_output_section): Likewise.
10911 (Layout::attach_allocated_section_to_segment): Likewise.
10912 (Layout::finalize, Layout::create_executable_stack): Likewise.
10913 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10914 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10915 * layout.h (class Layout): Update declarations. Remove options_
10916 field. Add number_of_input_files_ and resized_signatures_
10917 fields. Move sections_are_attached_ field.
10918 * main.cc (main): Pass number of input files to Layout
10919 constructor. Don't pass options.
10921 2009-03-30 Ian Lance Taylor <iant@google.com>
10923 * ffsll.c (ffsll): Correct implementation.
10925 2009-03-27 Ian Lance Taylor <iant@google.com>
10927 * ffsll.c: New file.
10928 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10929 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10930 * ftruncate.c (ftruncate): Declare before definition.
10931 * mremap.c (mremap): Likewise.
10932 * pread.c (pread): Likewise.
10933 * configure, Makefile.in, config.in: Rebuild.
10935 * mremap.c: New file.
10936 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10937 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10938 (mremap): Declare if HAVE_MREMAP is not defined.
10939 * configure, Makefile.in, config.in: Rebuild.
10941 2009-03-27 Cary Coutant <ccoutant@google.com>
10943 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10944 position independent.
10945 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10946 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10948 2009-03-24 Cary Coutant <ccoutant@google.com>
10950 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10952 (needs_dynamic_reloc): Likewise.
10954 2009-03-24 Ian Lance Taylor <iant@google.com>
10956 * yyscript.y (file_cmd): Recognize EXTERN.
10957 (extern_name_list, extern_name_list_body): New nonterminals.
10958 * script.cc (script_add_extern): Define.
10959 * script-c.h (script_add_extern): Declare.
10961 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
10963 * object.cc (is_elf_object): Define.
10964 * object.h (is_elf_object): Declare.
10965 * archive.cc (Archive::get_elf_object_for_member): Call
10967 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10969 2009-03-24 Elliott Hughes <enh@google.com>
10971 * output.cc (Output_file::map_anonymous): Define.
10972 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10973 try an anonymous one. Report the size if the mmap fails.
10974 * output.h (class Output_file): Declare map_anonymous.
10976 2009-03-24 Ian Lance Taylor <iant@google.com>
10978 * target-select.cc (instantiate_target): Don't acquire the lock if
10979 the instantiated_target_ field has already been set.
10981 2009-03-23 Ian Lance Taylor <iant@google.com>
10983 * gold-threads.h (class Initialize_lock): Define.
10984 * gold-threads.cc (class Initialize_lock_once): Define.
10985 (initialize_lock_control): New static variable.
10986 (initialize_lock_pointer): New static variable.
10987 (initialize_lock_once): New static function.
10988 (Initialize_lock::Initialize_lock): Define.
10989 (Initialize_lock::initialize): Define.
10990 * target-select.h: Include "gold-threads.h".
10991 (class Target_selector): Add lock_ and initialize_lock_ fields.
10992 Don't define instantiate_target, just declare it.
10993 * target-select.cc (Target_selector::Target_selector): Initialize
10995 (Target_selector::instantiate_target): Define.
10996 * descriptors.h: Include "gold-threads.h".
10997 (class Descriptors): Add initialize_lock_ field.
10998 * descriptors.cc (Descriptors::Descriptors): Initialize new
11000 (Descriptors::open): Use initialize_lock_ field
11001 * errors.h (class Errors): Add initialize_lock_ field.
11002 * errors.cc (Errors::Errors): Initialize new field.
11003 (Errors::initialize_lock): Use initialize_lock_ field.
11004 * powerpc.cc (class Target_selector_powerpc): Remove
11005 instantiated_target_ field. In do_recognize call
11006 instantiate_target rather than do_instantiate_target. In
11007 do_instantiate_target just allocate a new target.
11008 * sparc.cc (class Target_selector_sparc): Likewise.
11010 * freebsd.h: New file.
11011 * i386.cc: Include "freebsd.h".
11012 (Target_i386): Derive from Target_freebsd rather than
11014 (Target_selector_i386): Derive from Target_selector_freebsd rather
11015 than Target_selector.
11016 * x86_64.cc: Include "freebsd.h".
11017 (Target_x86_64): Derive from Target_freebsd rather than
11019 (Target_selector_x86_64): Derive from Target_selector_freebsd
11020 rather than Target_selector.
11021 * target.h (class Target): Add adjust_elf_header and
11022 do_adjust_elf_header.
11023 * output.cc (Output_file_header:: do_sized_write): Call target
11024 adjust_elf_header routine.
11025 * configure.tgt: Set targ_osabi.
11026 * configure.ac: Define GOLD_DEFAULT_OSABI.
11027 * parameters.cc (Parameters::default_target): Pass
11028 GOLD_DEFAULT_OSABI to select_target.
11029 * target-select.h (class Target_selector): Make instantiate_target
11030 protected rather than private.
11031 * Makefile.am (HFILES): Add freebsd.h.
11032 * configure, Makefile.in, config.in: Rebuild.
11034 * merge.cc (do_add_input_section): Correct pend value. Change
11035 message about last entry not being null terminated from error to
11038 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
11040 * incremental.cc: New file.
11041 * Makefile.am (CCFILES): Add incremental.cc.
11042 * Makefile.in: Rebuild.
11044 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
11046 * layout.cc (Layout::output_section_name): Preserve names
11047 of '.note.' sections.
11049 2009-03-19 Ian Lance Taylor <iant@google.com>
11051 * descriptors.cc (Descriptors::open): Check that the options are
11052 valid before using them.
11054 2009-03-18 Ian Lance Taylor <iant@google.com>
11056 * script-sections.h: Include <list>.
11057 (class Script_sections): Change Sections_elements from std::vector
11058 to std::list. Typedef public Elements_iterator. Add
11059 orphan_section_placement_, data_segment_align_start_, and
11060 saw_data_segment_align_ fields. Remove data_segment_align_index_
11062 * script-sections.cc (class Orphan_section_placement): New class.
11063 (class Sections_element): Add virtual functions is_relro and
11064 orphan_section_init. Remove virtual function place_orphan_here.
11065 (class Output_section_definition): Add is_relro and
11066 orphan_section_init. Remove place_orphan_here.
11067 (class Orphan_output_section): Likewise.
11068 (Script_sections::Script_sections): Update for field changes.
11069 (Script_sections::data_segment_align): Set saw_data_segment_align_
11070 and data_segment_align_start_, not data_segment_align_index.
11071 (Script_sections::data_segment_relro_end): Check
11072 saw_data_segment_align_. Use data_segment_align_start_ rather
11073 than data_segment_align_index_.
11074 (Script_sections::place_orphan): Rewrite to use
11075 Orphan_section_placement.
11077 2009-03-17 Ian Lance Taylor <iant@google.com>
11079 * archive.cc (Archive::add_symbols): Check for a version attached
11080 to the symbol name in the archive map.
11081 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11082 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11083 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11084 (ver_test_11.a): New target.
11085 * testsuite/Makefile.in: Rebuild.
11087 * configure.ac: Check for chsize and posix_fallocate. Replace
11089 * ftruncate.c: New file, from gnulib.
11090 * output.cc (posix_fallocate): Define dummy version if not
11091 HAVE_POSIX_FALLOCATE.
11092 (Output_file::map): Call posix_fallocate rather than lseek and
11094 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11095 * configure, Makefile.in, config.in: Rebuild.
11097 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
11099 * layout.h (Layout::create_note): Add section_name parameter.
11100 * layout.cc (Layout::create_note): Likewise.
11101 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11103 2009-03-17 Ian Lance Taylor <iant@google.com>
11105 * descriptors.cc: Include "options.h".
11106 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11107 (Descriptors::open): Always use O_CLOEXEC when opening a new
11108 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
11109 then set FD_CLOEXEC.
11111 * sparc.cc (class Target_sparc): Add has_got_section.
11112 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11113 make sure we have a GOT section.
11115 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11116 (Target_sparc::Scan::local): Likewise.
11117 (Target_sparc::Scan::global): Likewise.
11118 (Target_sparc::Relocate::relocate): Likewise.
11119 (Target_sparc::Relocate::relocate_tls): Likewise.
11121 * symtab.cc (Symbol_table::define_default_version): New function,
11122 broken out of add_from_object.
11123 (Symbol_table::add_from_object): Call define_default_version.
11124 (Symbol_table::define_special_symbol): Add resolve_oldsym
11125 parameter. Change all callers. If the version for a symbol comes
11126 from a version script, resolve it with the symbol with the same
11127 name with no version. Also add the symbol without a version if
11129 (do_define_in_output_data): If resolving with oldsym, don't delete
11131 (do_define_in_output_segment): Likewise.
11132 (do_define_as_constant): Likewise.
11133 * symtab.h (class Symbol_table): Update declarations.
11135 2009-03-13 Ian Lance Taylor <iant@google.com>
11137 * readsyms.cc (Read_symbols::incompatible_warning): New function.
11138 (Read_symbols::requeue): New function.
11139 (Read_symbols::do_read_symbols): If make_elf_object fails because
11140 the target type is not configured, and the file was searched for,
11141 issue a warning and retry with the next directory.
11142 (Add_symbols::run): If the file has an incompatible format, and
11143 it was searched for, requeue the Read_symbols task. On error,
11144 release the object.
11145 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
11146 dirindex parameter to constructor. Change all callers. Declare
11147 incompatible_warning and requeue.
11148 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11149 input_argument_ and input_group_ fields. Add them to
11150 constructor. Change all callers.
11151 (class Read_script): Add dirindex_ field. Add it to constructor.
11152 Change all callers.
11153 * archive.cc (Archive::setup): Remove input_objects parameter.
11154 Change all callers.
11155 (Archive::get_file_and_offset): Likewise.
11156 (Archive::read_all_symbols): Likewise.
11157 (Archive::read_symbols): Likewise.
11158 (Archive::get_elf_object_for_member): Remove input_objects
11159 parameter. Add punconfigured parameter. Change all callers.
11160 (Archive::add_symbols): Change return type to bool. Check return
11161 value of include_member.
11162 (Archive::include_all_members): Likewise.
11163 (Archive::include_member): Change return type to bool. Return
11164 false if first included object has incompatible target. Set
11165 included_member_ field.
11166 (Add_archive_symbols::run): If add_symbols returns false, requeue
11168 * archive.h (class Archive): Add included_member_ field.
11169 Initialize it in constructor. Add input_file and searched_for
11170 methods. Update declarations.
11171 (class Add_archive_symbols): Add dirpath_, dirindex_, and
11172 input_argument_ fields. Add them to constructor. Change all
11174 * script.cc: Include "target-select.h".
11175 (class Parser_closure): Add skip_on_incompatible_target_ and
11176 found_incompatible_target_ fields. Add
11177 skip_on_incompatible_target parameter to constructor. Change all
11178 callers. Add methods skip_on_incompatible_target,
11179 clear_skip_on_incompatible_target, found_incompatible_target, and
11180 set_found_incompatible_target.
11181 (read_input_script): Add dirindex parameter. Change all callers.
11182 If parser finds an incompatible target, requeue Read_symbols
11184 (script_set_symbol): Clear skip_on_incompatible_target in
11186 (script_add_assertion, script_parse_option): Likewise.
11187 (script_start_sections, script_add_phdr): Likewise.
11188 (script_check_output_format): New function.
11189 * script.h (read_input_script): Update declaration.
11190 * script-c.h (script_check_output_format): Declare.
11191 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11192 (ignore_cmd): Remove OUTPUT_FORMAT.
11193 * fileread.cc (Input_file::Input_file): Add explicit this.
11194 (Input_file::will_search_for): New function.
11195 (Input_file::open): Add pindex parameter. Change all callers.
11196 * fileread.h (class Input_file): Add input_file_argument method.
11197 Declare will_search_for. Update declarations.
11198 * object.cc (make_elf_object): Add punconfigured parameter.
11199 Change all callers.
11200 * object.h (class Object): Make input_file public. Add
11201 searched_for method.
11202 (make_elf_object): Update declaration.
11203 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
11205 * dirsearch.h (class Dirsearch): Update declaration.
11206 * options.h (class General_options): Add --warn-search-mismatch.
11207 * parameters.cc (Parameters::is_compatible_target): New function.
11208 * parameters.h (class Parameters): Declare is_compatible_target.
11209 * workqueue.cc (Workqueue::add_blocker): New function.
11210 * workqueue.h (class Workqueue): Declare add_blocker.
11212 * fileread.cc (Input_file::open): Remove options parameter.
11213 Change all callers.
11214 (Input_file::open_binary): Likewise.
11215 * script.cc (read_input_script): Likewise.
11216 * readsyms.h (class Read_symbols): Remove options_ field. Remove
11217 options parameter from constructor. Change all callers.
11218 (class Read_script): Likewise.
11219 * fileread.h (class Input_file): Update declarations.
11220 * script.h (read_input_script): Update declaration.
11222 2009-03-10 Nick Clifton <nickc@redhat.com>
11224 * po/es.po: New Spanish translation.
11226 2009-03-06 Cary Coutant <ccoutant@google.com>
11228 * options.cc (parse_short_option): Keep dash_z from registering itself.
11230 2009-03-03 Ian Lance Taylor <iant@google.com>
11233 * target-reloc.h (relocate_section): Pass output_section to
11235 * i386.cc (Target_i386::should_apply_static_reloc): Add
11236 output_section parameter. Change all callers.
11237 (Target_i386::Relocate::relocate): Add output_section parameter.
11238 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11239 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11240 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11241 * testsuite/two_file_shared.sh: New script.
11242 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11243 (check_DATA): Add two_file_shared.dbg.
11244 (two_file_shared.dbg): New target.
11245 * testsuite/Makefile.in: Rebuild.
11247 2009-03-01 Ian Lance Taylor <iant@google.com>
11249 * configure.ac: Check for byteswap.h.
11250 * configure: Rebuild.
11251 * config.in: Rebuild.
11253 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
11255 * layout.cc (Layout::find_or_add_kept_section): New function.
11256 (Layout::add_comdat): Removed.
11257 * layout.h (struct Kept_section): Move out of class Layout.
11258 Remove trailing underscores from field names. Add group_sections
11259 field. Rename group_ field to is_group. Change all uses.
11260 (class Layout): Declare find_or_add_kept_section, not add_comdat.
11261 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11262 comdat_groups_ field.
11263 (Sized_relobj::include_section_group): Use
11264 find_or_add_kept_section and Kept_section::group_sections.
11265 (Sized_relobj::include_linkonce_section): Likewise.
11266 * object.cc (class Sized_relobj): Don't define Comdat_group or
11267 Comdat_group_table. Remove find_comdat_group and
11268 add_comdat_group. Remove comdat_groups_ field.
11269 * plugin.cc (include_comdat_group): Use
11270 Layout::find_or_add_kept_section.
11272 2009-02-28 Ian Lance Taylor <iant@google.com>
11274 * README: --gc-sections and map files are now supported. Document
11275 some build requirements.
11278 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11279 relocatable link set the value of the section symbol to zero.
11280 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11281 relocatable link don't include the section address in the local
11284 2009-02-27 Ian Lance Taylor <iant@google.com>
11287 * options.h (class Search_directory): Add is_system_directory.
11288 (class General_options): Declare is_in_system_directory.
11289 * options.cc (get_relative_sysroot): Make static.
11290 (get_default_sysroot): Make static.
11291 (General_optoins::is_in_system_directory): New function.
11292 * fileread.cc (Input_file::is_in_system_directory): New function.
11293 * fileread.h (class Input_file): Declare is_in_system_directory.
11294 * object.h (class Object): Add is_in_system_directory.
11295 (class Input_objects): Remove system_library_directory_ field.
11296 * object.cc (Input_objects::add_object): Don't set
11297 system_library_directory_.
11298 (input_objects::found_in_system_library_directory): Remove.
11299 * symtab.cc (Symbol_table::write_globals): Remove input_objects
11300 parameter. Change all callers.
11301 (Symbol_table::sized_write_globals): Likewise.
11302 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11303 Call Object::is_in_system_directory.
11304 * symtab.h (class Symbol_table): Update declarations.
11307 * descriptors.h (Open_descriptor): Add is_on_stack field.
11308 * descriptors.cc (Descriptors::open): If the descriptor is on the
11309 top of the stack, remove it. Initialize is_on_stack field.
11310 (Descriptors::release): Only add pod to stack if it is not on the
11312 (Descriptors::close_some_descriptor): Clear stack_next and
11313 is_on_stack fields.
11316 * output.cc (Output_section::find_starting_output_address): Rename
11317 from starting_output_address; add PADDR parameter; change return
11319 * output.h (class Output_section): Declare
11320 find_starting_output_address instead of starting_output_address.
11321 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11322 section symbol for which we can't find a merge section.
11325 * symtab.cc (Symbol_table::add_from_object): If the visibility is
11326 hidden or internal, force the symbol to be local.
11327 * resolve.cc (Symbol::override_visibility): Define.
11328 (Symbol::override_base): Use override_visibility.
11329 (Symbol_table::resolve): Likewise.
11330 (Symbol::override_base_with_special): Likewise.
11331 (Symbol_table::override_with_special): If the visibility is hidden
11332 or internal, force the symbol to be local.
11333 * symtab.h (class Symbol): Add set_visibility and
11334 override_visibility.
11335 * testsuite/ver_test_1.sh: New file.
11336 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11337 (check_DATA): Add ver_test_1.syms.
11338 (ver_test_1.syms): New target.
11339 * testsuite/Makefile.in: Rebuild.
11341 2009-02-25 Cary Coutant <ccoutant@google.com>
11343 * layout.cc (Layout::choose_output_section): Don't rename sections
11344 when using a linker script that has a SECTIONS clause.
11345 * Makefile.in: Regenerate.
11347 * testsuite/Makefile.am (script_test_5.sh): New test case.
11348 * testsuite/Makefile.in: Regenerate.
11349 * testsuite/script_test_5.cc: New file.
11350 * testsuite/script_test_5.sh: New file.
11351 * testsuite/script_test_5.t: New file.
11353 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
11355 * archive.cc (Archive::include_member): Update calls to add_symbols.
11356 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11357 the Layout argument.
11358 * dynobj.h (do_add_symbols): Add the Layout argument.
11359 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11361 * object.h (Object::add_symbols): Add the Layout argument.
11362 (Object::do_add_symbols): Add the Layout argument.
11363 (Sized_relobj::do_add_symbols): Add the Layout argument.
11364 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11365 Unify the two versions.
11366 (Add_plugin_symbols): Remove.
11367 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11368 (Sized_pluginobj::do_add_symbols): Unify the two versions.
11369 (Add_plugin_symbols): Remove.
11370 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11371 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11372 (Add_symbols::run): Make it work with Pulginobj.
11374 2009-02-06 Ian Lance Taylor <iant@google.com>
11376 * object.cc (Sized_relobj::do_layout): Make info message start
11377 with lower case letter.
11379 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
11381 * binary.cc: Fix file comment.
11383 * options.h (enum Incremental_disposition): Define.
11384 (class General_options): Add new options: --incremental,
11385 --incremental_changed, --incremental_unchanged,
11386 --incremental_unknown. Add incremental_disposition_ and
11387 implicit_incremental_ fields.
11388 (General_options::incremental_disposition): New function.
11389 (class Position_dependent_options): Add incremental_disposition
11391 (Position_dependent_options::copy_from_options): Set incremental
11393 * options.cc (General_options::parse_incremental_changed): New
11395 (General_options::parse_incremental_unchanged): New function.
11396 (General_options::parse_incremental_unknown): New function.
11397 (General_options::General_options): Initialize new fields
11398 incremental_disposition_ and implicit_incremental_.
11399 (General_options::finalize): Check for uasge of --incremental-*
11400 without --incremental.
11402 2009-02-06 Chris Demetriou <cgd@google.com>
11404 * gold.h (gold_undefined_symbol): Change to take only a Symbol
11405 pointer and to report location as the file name associated with
11407 (gold_undefined_symbol_at_location): New function to replace the
11408 old gold_undefined_symbol functionality.
11409 * target-reloc.h (relocate_section): Update to use
11410 gold_undefined_symbol_at_location.
11411 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11412 Call gold_undefined_symbol function rather than gold_error.
11413 * errors.h (Errors::undefined_symbol): Take location as a
11414 string, rather than calculating it from a relocation.
11415 * errors.cc (Errors::fatal): Print "fatal error:" before the
11417 (Errors::error, Errors::error_at_location): Print "error: "
11418 before the formatted message.
11419 (Errors::undefined_symbol): Take location as a string, rather
11420 than calculating it from a relocation.
11421 (gold_undefined_symbol_at_location): New function akin to
11422 old gold_undefined_symbol, calculates location from relocation.
11423 (gold_undefined_symbol): Change to take only a Symbol pointer
11424 and to report location as the file name associated with the symbol.
11425 * testsuite/debug_msg.sh: Update for changed error messages.
11426 * testsuite/undef_symbol.sh: Likewise.
11428 2009-02-04 Duncan Sands <baldrick@free.fr>
11431 * reduced_debug_output.h
11432 (Output_reduced_debug_abbrev_section::failed): Use format for
11434 (Output_reduced_debug_info_section::faild): Likewise.
11436 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
11438 * script.cc (Lazy_demangler): New class.
11439 (Version_script_info::get_symbol_version_helper): Demangle a
11442 2009-01-29 Cary Coutant <ccoutant@google.com>
11444 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11446 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11448 2009-01-28 Ian Lance Taylor <iant@google.com>
11450 * version.cc (version_string): Bump to 1.9.
11452 * gold.h: Include <cstring> and <stdint.h>.
11453 * version.cc: Include <cstdio>.
11454 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11456 * reduced_debug_output.cc (insert_into_vector): Rename from
11457 Insert_into_vector; change all callers. Use Swap_unaligned to
11458 avoid aliasing issue; remove union since it is unnecessary.
11460 2009-01-27 Sriraman Tallam <tmsriram@google.com>
11462 * Makefile.am (CCFILES): Add gc.cc.
11463 (HFILES): Add gc.h.
11464 * Makefile.in: Regenerate.
11465 * gold.cc (Gc_runner): New class.
11466 (queue_initial_tasks): Call garbage collection related tasks
11467 when corresponding options are invoked.
11468 (queue_middle_gc_tasks): New function.
11469 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11470 processed early before laying out sections during garbage collection.
11471 * gold.h (queue_middle_gc_tasks): New function.
11472 (is_prefix_of): Move from "layout.cc".
11473 * i386.cc (Target_i386::gc_process_relocs): New function.
11474 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11475 * main.cc (main): Create object of class "Garbage_collection".
11476 * object.cc (Relobj::copy_symbols_data): New function.
11477 (Relobj::is_section_name_included): New function.
11478 (Sized_relobj::do_layout): Allow this function to be called twice
11479 during garbage collection and defer layout of section during the
11481 * object.h (Relobj::get_symbols_data): New function.
11482 (Relobj::is_section_name_included): New function.
11483 (Relobj::copy_symbols_data): New function.
11484 (Relobj::set_symbols_data): New function.
11485 (Relobj::get_relocs_data): New function.
11486 (Relobj::set_relocs_data): New function.
11487 (Relobj::is_output_section_offset_invalid): New pure virtual function.
11488 (Relobj::gc_process_relocs): New function.
11489 (Relobj::do_gc_process_relocs): New pure virtual function.
11490 (Relobj::sd_): New data member.
11491 (Sized_relobj::is_output_section_offset_invalid): New function.
11492 (Sized_relobj::do_gc_process_relocs): New function.
11493 * options.h (General_options::gc_sections): Modify to not be a no-op.
11494 (General_options::print_gc_sections): New option.
11495 * plugin.cc (Plugin_finish::run): Remove function call to
11496 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
11497 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11498 * reloc.cc (Read_relocs::run): Add task to process relocs and
11499 determine unreferenced sections when doing garbage collection.
11500 (Gc_process_relocs): New class.
11501 (Sized_relobj::do_gc_process_relocs): New function.
11502 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11503 sections that are garbage collected.
11504 * reloc.h (Gc_process_relocs): New class.
11505 * sparc.cc (Target_sparc::gc_process_relocs): New function.
11506 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11507 symbols whose corresponding sections are garbage collected.
11508 (Symbol_table::Symbol_table): Add new parameter for the garbage
11510 (Symbol_table::gc_mark_undef_symbols): New function.
11511 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11512 (Symbol_table::gc_mark_dyn_syms): New function.
11513 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11515 (Symbol_table::add_from_object): Likewise.
11516 (Symbol_table::add_from_relobj): When building shared objects, do not
11517 treat externally visible symbols as garbage.
11518 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11519 table information for static and relocatable links.
11520 * symtab.h (Symbol_table::set_gc): New function.
11521 (Symbol_table::gc): New function.
11522 (Symbol_table::gc_mark_undef_symbols): New function.
11523 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11524 (Symbol_table::gc_mark_dyn_syms): New function.
11525 (Symbol_table::gc_): New data member.
11526 * target.h (Sized_target::gc_process_relocs): New pure virtual
11528 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11529 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11531 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
11533 * options.h (General_options::gc_sections): Define as a no-op for now.
11534 (General_options::no_keep_memory): Ditto.
11535 (General_options::Bshareable): Define.
11536 * options.cc (General_options::finalize): Honor -Bshareable.
11538 2009-01-20 Andreas Schwab <schwab@suse.de>
11540 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11541 read the value in the contents, since we don't use it. Use the
11542 template endianness when writing.
11543 (Relocate::relocate): Use it for R_PPC_REL16_HA.
11545 2009-01-19 Andreas Schwab <schwab@suse.de>
11547 * configure.tgt (powerpc64-*): Fix targ_obj.
11549 2009-01-15 Ian Lance Taylor <iant@google.com>
11551 * object.cc (Sized_relobj::write_local_symbols): Don't write out
11552 local symbols when stripping all symbols.
11554 2009-01-14 Cary Coutant <ccoutant@google.com>
11556 * output.cc (Output_reloc): Add explicit instantiations.
11558 2009-01-14 Cary Coutant <ccoutant@google.com>
11560 * archive.cc (Archive::get_elf_object_for_member): Remove call
11561 to File_read::claim_for_plugin.
11562 * descriptors.cc (Descriptors::open): Remove reference to
11564 (Descriptors::claim_for_plugin): Remove.
11565 * descriptors.h (Descriptors::claim_for_plugin): Remove.
11566 (Descriptors::is_claimed): Remove.
11567 (claim_descriptor_for_plugin): Remove.
11568 * fileread.cc (File_read::claim_for_plugin): Remove.
11569 * fileread.h (File_read::claim_for_plugin): Remove.
11570 (File_read::descriptor): Reopen descriptor if necessary.
11571 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
11572 (Plugin_manager::all_symbols_read): Add task parameter. Change
11574 (Plugin_manager::get_input_file): New function.
11575 (Plugin_manager::release_input_file): New function.
11576 (Pluginobj::Pluginobj): Add filesize parameter and initialize
11577 corresponding data member.
11578 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11579 and pass to base constructor. Change all callers.
11580 (get_input_file, release_input_file): New functions.
11581 (make_sized_plugin_object): Add filesize parameter. Change all callers.
11582 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11583 (Plugin_manager::all_symbols_read): Add task parameter.
11584 (Plugin_manager::get_input_file): New function.
11585 (Plugin_manager::release_input_file): New function.
11586 (Plugin_manager::task_): New data member.
11587 (Pluginobj::Pluginobj): Add filesize parameter.
11588 (Pluginobj::filename): New function.
11589 (Pluginobj::descriptor): New function.
11590 (Pluginobj::filesize): New function.
11591 (Pluginobj::filesize_): New data member.
11592 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11593 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11594 File_read::claim_for_plugin; use Object::unlock to unlock the file.
11596 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11597 with archive libraries.
11598 * testsuite/Makefile.in: Regenerate.
11599 * testsuite/plugin_test.c (struct sym_info): New type.
11600 (get_input_file, release_input_file): New static variables.
11601 (onload): Capture new transfer vector entries.
11602 (claim_file_hook): Stop reading at end of file according to filesize.
11603 Factor out parsing of readelf output into separate function.
11604 (all_symbols_read_hook): Exercise get_input_file and release_input_file
11605 APIs and get the source file name from the symbol table. Convert
11606 source file name to corresponding object file name. Print info
11607 message when adding new input files.
11608 (parse_readelf_line): New function.
11609 * testsuite/plugin_test_1.sh: Add checks for new info messages.
11610 * testsuite/plugin_test_2.sh: Likewise.
11611 * testsuite/plugin_test_3.sh: Likewise.
11612 * testsuite/plugin_test_4.sh: New test case.
11614 2009-01-07 Ian Lance Taylor <iant@google.com>
11616 * version.cc (version_string): Bump to 1.8.
11618 2008-12-23 Cary Coutant <ccoutant@google.com>
11620 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11621 * plugin.cc (Plugin_manager::finish): Rename as
11622 layout_deferred_objects. Move cleanup to separate function.
11623 (Plugin_manager::cleanup): New function.
11624 (Plugin_finish::run): Call layout_deferred_objects and cleanup
11626 * plugin.h (Plugin_manager::finish): Rename as
11627 layout_deferred_objects.
11628 (Plugin_manager::cleanup): New function.
11629 (Plugin_manager::cleanup_done): New field.
11631 2008-12-23 Cary Coutant <ccoutant@google.com>
11633 * plugin.cc (is_visible_from_outside): New function.
11634 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11635 so we don't return "IR only" status for exported symbols or -r links.
11637 * testsuite/Makefile.am (plugin_test_3): New test case.
11638 * testsuite/Makefile.in: Regenerate.
11639 * testsuite/plugin_test_3.sh: New file.
11641 2008-12-22 Cary Coutant <ccoutant@google.com>
11643 * object.cc (Sized_relobj::layout_section): New function.
11644 (Sized_relobj::do_layout): Defer layout of input sections until after
11645 plugin has provided replacement files.
11646 (Sized_relobj::do_layout_deferred_sections): New function.
11647 * object.h (Relobj::set_section_offset): Remove virtual keyword.
11648 (Relobj::layout_deferred_sections): New function.
11649 (Relobj::do_layout_deferred_sections): New function.
11650 (Sized_relobj::do_layout_deferred_sections): New function.
11651 (Sized_relobj::layout_section): New function.
11652 (Sized_relobj::Deferred_layout): New structure.
11653 (Sized_relobj::deferred_layout_): New field.
11654 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11655 Change all callers. Layout deferred sections.
11656 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
11658 (Plugin_hook::run): Move code from do_plugin_hook inline.
11659 (Plugin_hook::do_plugin_hook): Remove.
11660 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11661 (Plugin_manager::finish): Renamed, was cleanup.
11662 (Plugin_manager::should_defer_layout): New function.
11663 (Plugin_manager::add_deferred_layout_object): New function.
11664 (Plugin_manager::Deferred_layout_list): New type.
11665 (Plugin_manager::deferred_layout_objects_): New field.
11666 (Plugin_hook::do_plugin_hook): Remove.
11668 2008-12-17 Ian Lance Taylor <iant@google.com>
11670 * options.h (class General_options): Add --no case for
11673 2008-12-16 Cary Coutant <ccoutant@google.com>
11675 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11677 (Plugin_manager::claim_file): Create plugin object even if
11678 plugin did not call the add_symbols callback.
11679 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11680 asking for more symbols than were added.
11681 * testsuite/Makefile.am (plugin_test_1): Add test case with
11683 (empty.syms): New target.
11684 * testsuite/Makefile.in: Regenerate.
11685 * testsuite/plugin_test.c (claim_file_hook): Add new debug
11686 message. Don't call add_symbols if no globals.
11687 (all_symbols_read_hook): Don't provide replacement for empty
11690 2008-12-12 Ian Lance Taylor <iant@google.com>
11692 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11693 r_type == 0 for a local symbol with r_sym == 0.
11694 (scan_relocatable_relocs): Pass r_sym to
11695 local_non_section_strategy.
11696 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11699 * configure.ac: Update test for TLS descriptors: they are
11700 supported as of glibc 2.9.
11701 * configure: Rebuild.
11703 2008-12-11 Ian Lance Taylor <iant@google.com>
11706 * target-reloc.h (Default_scan_relocatable_relocs): For each
11707 function, map r_type == 0 to RELOC_DISCARD.
11709 2008-12-10 Cary Coutant <ccoutant@google.com>
11711 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11712 object to override a kept COMDAT group from a plugin object.
11714 2008-12-09 Ian Lance Taylor <iant@google.com>
11717 * yyscript.y (file_cmd): Handle INPUT.
11719 * testsuite/initpri1.c: Change all declarations to be full
11720 prototypes by adding void, to avoid compiler warnings.
11722 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
11724 * options.cc (General_options::parse_plugin_opt): New.
11725 (General_options::add_plugin): The argument now is just the filename.
11726 (General_options::add_plugin_option): New.
11727 * options.h (plugin_opt): New.
11728 (add_plugin): Change argument name.
11729 (add_plugin_option): New.
11730 * plugin.cc (Plugin::load): Don't parse the plugin option.
11731 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11732 (Plugin::add_option): New.
11733 (Plugin::args_): Change type.
11734 (Plugin::filename_): New.
11735 (Plugin_manager::add_plugin_option): New.
11736 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11737 * testsuite/Makefile.in: Regenerate.
11739 2008-12-05 Cary Coutant <ccoutant@google.com>
11741 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11742 Handle --strip-lto-sections option.
11743 * options.h (strip_lto_sections): New option.
11745 2008-12-01 Cary Coutant <ccoutant@google.com>
11747 * plugin.cc (ld_plugin_message): Change format parameter to const.
11748 Fix mismatch between new[] and delete.
11750 2008-11-14 Cary Coutant <ccoutant@google.com>
11752 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11755 2008-11-05 Craig Silverstein <csilvers@google.com>
11757 * options.cc (General_options::parse_dynamic_list): New function.
11758 * options.h (General_options): New flags dynamic_list,
11759 dynamic_list_data, dynamic_list_cpp_new, and
11760 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
11761 (General_options::in_dynamic_list): New function.
11762 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11763 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11764 (Lex::can_continue_name): Likewise.
11766 (read_script_file): New parameter script_options.
11767 (read_dynamic_list): New function.
11768 (Script_options::define_dynamic_list): New function.
11769 (dynamic_list_keyword_parsecodes): New variable.
11770 (dynamic_list_keywords): New variable.
11771 * script.h (Script_options::define_dynamic_list): New function
11773 (read_dynamic_list): New function prototype.
11774 * symtab.cc (strprefix): New macro.
11775 (Symbol::should_add_dynsym_entry): Support dynamic_list,
11776 dynamic_list_data, dynamic_list_cpp_new, and
11777 dynamic_list_cpp_typeinfo.
11778 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11779 (dynamic_list_expr): New rule.
11780 (dynamic_list_nodes): Likewise.
11781 (dynamic_list_node): Likewise.
11782 * testsuite/Makefile.am (dynamic_list): New test.
11783 * testsuite/Makefile.in: Regenerated.
11784 * testsuite/dynamic_list.t: New file.
11785 * testsuite/dynamic_list.sh: New file.
11787 2008-11-05 Craig Silverstein <csilvers@google.com>
11789 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11790 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11791 (t11_last): Likewise.
11792 * testsuite/ver_test_6.c (main): Likewise.
11794 2008-10-07 Cary Coutant <ccoutant@google.com>
11796 * options.c (General_options::finalize): Add check for -static and
11798 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11801 2008-10-02 Cary Coutant <ccoutant@google.com>
11803 * plugin.cc (make_sized_plugin_object): Fix conditional
11804 compilation to work when not all targets are enabled.
11806 2008-09-29 Cary Coutant <ccoutant@google.com>
11808 * archive.cc (Archive::get_file_and_offset): Use filename instead
11809 of name to get library path.
11810 (Archive::include_member): Unlock external member of a thin archive.
11812 * testsuite/Makefile.am (TEST_AR): New variable.
11813 (thin_archive_test_1): New test.
11814 (thin_archive_test_2): New test.
11815 * testsuite/Makefile.in: Regenerate.
11816 * testsuite/thin_archive_main.cc: New file.
11817 * testsuite/thin_archive_test_1.cc: New file.
11818 * testsuite/thin_archive_test_2.cc: New file.
11819 * testsuite/thin_archive_test_3.cc: New file.
11820 * testsuite/thin_archive_test_4.cc: New file.
11822 2008-09-29 Cary Coutant <ccoutant@google.com>
11824 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11825 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11827 (Sized_relobj::do_finalize_local_symbols): Likewise.
11828 (Sized_relobj::map_to_kept_section): Likewise.
11829 * object.h (Sized_relobj::invalid_address): New constant.
11830 (Sized_relobj::do_output_section_offset): Check for invalid_address
11832 * output.cc (Output_reloc::local_section_offset): Use constant
11833 invalid_address instead of -1U.
11834 (Output_reloc::get_address): Likewise.
11835 (Output_section::output_address): Change -1U to -1ULL.
11836 * output.h (Output_reloc::invalid_address): New constant.
11837 * reloc.cc (Sized_relobj::write_sections): Use constant
11838 invalid_address instead of -1U.
11839 (Sized_relobj::relocate_sections): Likewise.
11840 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11841 values for merge sections.
11842 * target-reloc.h (relocate_for_relocatable): Use constant
11843 invalid_address instead of -1U.
11845 2008-09-19 Cary Coutant <ccoutant@google.com>
11847 Add plugin functionality for link-time optimization (LTO).
11848 * configure.ac (plugins): Add --enable-plugins option.
11849 * configure: Regenerate.
11850 * config.in: Regenerate.
11851 * Makefile.am (LIBDL): New variable.
11852 (CCFILES): Add plugin.cc.
11853 (HFILES): Add plugin.h.
11854 (ldadd_var): Add LIBDL.
11855 * Makefile.in: Regenerate.
11857 * archive.cc: Include "plugin.h".
11858 (Archive::setup): Don't preread archive symbols when using a plugin.
11859 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11860 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11862 (Archive::include_member): Add symbols from plugin objects.
11863 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11864 * descriptors.cc (Descriptors::open): Check for file descriptors
11865 abandoned by plugins.
11866 (Descriptors::claim_for_plugin): New function.
11867 * descriptors.h (Descriptors::claim_for_plugin): New function.
11868 (Open_descriptor::is_claimed): New field.
11869 (claim_descriptor_for_plugin): New function.
11870 * fileread.cc (File_read::claim_for_plugin): New function.
11871 * fileread.h (File_read::claim_for_plugin): New function.
11872 (File_read::descriptor): New function.
11873 * gold.cc: Include "plugin.h".
11874 (queue_initial_tasks): Add task to call plugin hooks for generating
11876 * main.cc: Include "plugin.h".
11877 (main): Load plugin libraries.
11878 * object.h (Pluginobj): Declare.
11879 (Object::pluginobj): New function.
11880 (Object::do_pluginobj): New function.
11881 (Object::set_target): New function.
11882 * options.cc: Include "plugin.h".
11883 (General_options::parse_plugin): New function.
11884 (General_options::General_options): Initialize plugins_ field.
11885 (General_options::add_plugin): New function.
11886 * options.h (Plugin_manager): Declare.
11887 (General_options): Add --plugin option.
11888 (General_options::has_plugins): New function.
11889 (General_options::plugins): New function.
11890 (General_options::add_plugin): New function.
11891 (General_options::plugins_): New field.
11892 * plugin.cc: New file.
11893 * plugin.h: New file.
11894 * readsyms.cc: Include "plugin.h".
11895 (Read_symbols::do_read_symbols): Check for archive before checking
11896 for ELF file. Call plugin hooks to claim files.
11897 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11898 from a real object file; force override when processing replacement
11900 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11901 (Symbol::init_base_object): Likewise.
11902 (Symbol::init_base_output_data): Likewise.
11903 (Symbol::init_base_output_segment): Likewise.
11904 (Symbol::init_base_constant): Likewise.
11905 (Symbol::init_base_undefined): Likewise.
11906 (Symbol::output_section): Assert that object is not a plugin.
11907 (Symbol_table::add_from_pluginobj): New function.
11908 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11910 (Symbol_table::sized_write_globals): Likewise.
11911 (Symbol_table::add_from_pluginobj): Instantiate template.
11912 * symtab.h (Sized_pluginobj): Declare.
11913 (Symbol::in_real_elf): New function.
11914 (Symbol::set_in_real_elf): New function.
11915 (Symbol::in_real_elf_): New field.
11916 (Symbol_table::add_from_pluginobj): New function.
11918 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11919 (LIBDL): New variable.
11920 (LDADD): Add LIBDL.
11921 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11922 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11923 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11924 (MOSTLYCLEANFILES): Likewise.
11925 * testsuite/Makefile.in: Regenerate.
11926 * testsuite/plugin_test.c: New file.
11927 * testsuite/plugin_test_1.sh: New file.
11928 * testsuite/plugin_test_2.sh: New file.
11930 2008-09-16 Ian Lance Taylor <iant@google.com>
11932 * target-reloc.h (relocate_section): Check whether a symbol is
11933 defined by the ABI before reporting an undefined symbol error.
11934 * target.h (Target::is_defined_by_abi): Make parameter const.
11935 (Target::do_is_defined_by_abi): Likewise.
11936 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11937 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11938 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11939 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11940 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11941 * testsuite/Makefile.in: Rebuild.
11943 * fileread.cc (make_view): Add casts to avoid warning.
11945 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11947 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11948 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11950 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11952 * options.h (General_options::output_is_executable): New.
11953 (General_options::output_is_pie): New.
11954 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11955 for shared libraries.
11956 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11958 2008-09-11 Chris Demetriou <cgd@google.com>
11960 * options.h (origin): New -z option.
11961 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11962 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11965 2008-09-05 Cary Coutant <ccoutant@google.com>
11967 * fileread.cc (File_read::make_view): Add check for attempt to map
11968 beyond end of file.
11970 2008-09-05 Cary Coutant <ccoutant@google.com>
11972 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11973 explicit instantiations.
11975 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11978 * options.cc (General_options::finalize): Allow undefined symbols
11979 in shlibs if linking -shared.
11982 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11983 symbols as not needing a dynsym entry.
11985 2008-08-20 Craig Silverstein <csilvers@google.com>
11987 * fileread.cc (File_read::open): Do not lock the file unless it
11988 was successfully opened.
11990 2008-08-14 Cary Coutant <ccoutant@google.com>
11992 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11993 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11994 * testsuite/tls_test.cc (struct int128): 128-bit struct
11995 for testing TLS relocs with non-zero addend.
11996 (v12): New TLS variable.
11998 (t_last): Add check for v12.
11999 * testsuite/tls_test.h (t12): New function.
12000 * testsuite/tls_test_main.cc (thread_routine): Call new test.
12002 2008-08-13 Ian Lance Taylor <iant@google.com>
12004 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12005 set tls_segment_ or relro_segment_.
12006 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12008 * output.h (Output_section::clear_is_relro): New function.
12009 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12010 sections specially even when output_data_ is empty.
12011 (Output_segment::maximum_alignment): When first section is relro,
12012 only force alignment for PT_LOAD segments.
12013 * script.cc (script_data_segment_align): New function.
12014 (script_data_segment_relro_end): New function.
12015 * script-c.h (script_data_segment_align): Declare.
12016 (script_data_segment_relro_end): Declare.
12017 * script-sections.h (class Script_sections): Declare
12018 data_segment_align and data_segment_relro_end. Add fields
12019 segment_align_index_ and saw_relro_end_.
12020 * script-sections.cc (class Sections_element): Add set_is_relro
12021 virtual function. Add new bool* parameter to place_orphan_here.
12022 Add get_output_section virtual function.
12023 (class Output_section_definition): Add set_is_relro. Add new
12024 bool* parameter to place_orphan_here. Add get_output_section.
12025 Add is_relro_ field.
12026 (Output_section_definition::Output_section_definition): Initialize
12027 evaluated_address_, evaluated_load_address, evaluated_addralign_,
12028 and is_relro_ fields.
12029 (Output_section_definition::place_orphan_here): Add is_relro
12031 (Output_section_definition::set_section_addresses): Set relro for
12033 (Output_section_definition::alternate_constraint): Likewise.
12034 (class Orphan_output_section): Add new bool* parameter to
12035 place_orphan_here. Add get_output_section.
12036 (Orphan_output_section::place_orphan_here): Add is_relro
12038 (Script_sections::Script_sections): Initialize
12039 data_segment_align_index_ and saw_relro_end_.
12040 (Script_sections::data_segment_align): New function.
12041 (Script_sections::data_segment_relro_end): New function.
12042 (Script_sections::place_orphan): Set or clear is_relro.
12043 (Script_sections::set_section_addresses): Force alignment of first
12045 * yyscript.y (exp): Call script_data_segment_align and
12046 script_data_segment_relro_end.
12047 * testsuite/relro_script_test.t: New file.
12048 * testsuite/relro_test.cc (using_script): Declare.
12049 (t1, t2): Test using_script.
12050 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12051 (relro_script_test_SOURCES): Define.
12052 (relro_script_test_DEPENDENCIES): Define.
12053 (relro_script_test_LDFLAGS): Define.
12054 (relro_script_test_LDADD): Define.
12055 (relro_script_test.so): New target.
12056 * testsuite/Makefile.in: Rebuild.
12058 2008-08-06 Cary Coutant <ccoutant@google.com>
12060 * archive.cc (Archive::total_archives, Archive::total_members)
12061 (Archive::total_members_loaded): New variables.
12062 (Archive::setup): Add parameter. Add option to preread
12064 (Archive::read_armap): Add counter.
12065 (Archive::get_file_and_offset): New function.
12066 (Archive::get_elf_object_for_member): New function.
12067 (Archive::read_all_symbols): New function.
12068 (Archive::read_symbols): New function.
12069 (Archive::add_symbols): Add counters.
12070 (Archive::include_all_members): Use armap to find members if it's
12072 (Archive::include_member): Skip reading symbols if already read.
12073 Factored code into Archive::get_file_and_offset and
12074 Archive::get_elf_object_for_member. Changed call to
12075 Mapfile::report_include_archive_member.
12076 (Archive::print_stats): New function.
12077 * archive.h: Declare Object and Read_symbols_data classes.
12078 (Archive::Archive): Add initializers for new members.
12079 (Archive::setup): Add parameter.
12080 (Archive::print_stats): New function.
12081 (Archive::total_archives, Archive::total_members)
12082 (Archive::total_members_loaded): New variables.
12083 (Archive::get_file_and_offset): New function.
12084 (Archive::get_elf_object_for_member): New function.
12085 (Archive::read_all_symbols): New function.
12086 (Archive::read_symbols): New function.
12087 (Archive::Archive_member): New class.
12088 (Archive::members_): New member.
12089 (Archive::num_members_): New member.
12090 * main.cc: Include archive.h.
12091 (main): Call Archive::print_stats.
12092 * mapfile.cc (Mapfile::report_include_archive_member): Delete
12093 archive parameter; member_name is now the fully-decorated name.
12094 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12095 * options.h: (General_options): Add --preread-archive-symbols option.
12096 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12099 2008-08-04 Ian Lance Taylor <iant@google.com>
12101 * symtab.h (Symbol::use_plt_offset): New function.
12102 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12103 * powerpc.cc (Relocate::relocate): Likewise.
12104 * sparc.cc (Relocate::relocate): Likewise.
12105 * x86_64.cc (Relocate::relocate): Likewise.
12106 * testsuite/weak_plt.sh: New test.
12107 * testsuite/weak_plt_main.cc: New test.
12108 * testsuite/weak_plt_shared.cc: New test.
12109 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12110 (check_PROGRAMS): Add weak_plt.
12111 (check_DATA): Add weak_plt_shared.so.
12112 (weak_plt_main_pic.o, weak_plt): New targets.
12113 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12114 * testsuite/Makefile.in: Rebuild.
12116 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12118 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12119 * testsuite/Makefile.in: Rebuild.
12121 2008-08-04 Alan Modra <amodra@bigpond.net.au>
12123 * Makefile.am (POTFILES.in): Set LC_ALL=C.
12124 * Makefile.in: Regenerate.
12125 * po/POTFILES.in: Regenerate.
12127 2008-07-29 Ian Lance Taylor <iant@google.com>
12129 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12130 symbols before other symbols.
12131 * testsuite/script_test_2.cc (test_addr): Declare.
12132 (test_addr_alias): Declare.
12133 (main): Check that test_addr and test_addr_alias have the right
12135 * testsuite/script_test_2.t: Define test_addr_alias and
12138 2008-07-24 Ian Lance Taylor <iant@google.com>
12141 * descriptors.cc: New file.
12142 * descriptors.h: New file.
12143 * gold-threads.h (class Hold_optional_lock): New class.
12144 * fileread.cc: Include "descriptors.h".
12145 (File_read::~File_read): Release descriptor rather than closing
12147 (File_read::open) [file]: Call open_descriptor rather than open.
12148 Set is_descriptor_opened_.
12149 (File_read::open) [memory]: Assert that descriptor is not open.
12150 (File_read::reopen_descriptor): New function.
12151 (File_read::release): Release descriptor.
12152 (File_read::do_read): Make non-const. Reopen descriptor.
12153 (File_read::read): Make non-const.
12154 (File_read::make_view): Reopen descriptor.
12155 (File_read::do_readv): Likewise.
12156 * fileread.h (class File_read): Add is_descriptor_opened_ field.
12157 Update declarations.
12158 * layout.cc: Include "descriptors.h".
12159 (Layout::create_build_id): Use open_descriptor rather than open.
12160 * output.cc: Include "descriptors.h".
12161 (Output_file::open): Use open_descriptor rather than open.
12162 * archive.cc (Archive::const_iterator): Change Archive to be
12164 (Archive::begin, Archive::end): Make non-const.
12165 (Archive::count_members): Likewise.
12166 * archive.h (class Archive): Update declarations.
12167 * object.h (Object::read): Make non-const.
12168 * Makefile.am (CCFILES): Add descriptors.cc.
12169 (HFILES): Add descriptors.h.
12170 * Makefile.in: Rebuild.
12173 * gold.h: Always include <clocale>. Add Solaris workarounds
12174 following code in binutils/sysdep.h.
12177 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12178 this->eh_frame_hdr_ is NULL before using it.
12180 * dynobj.cc (Versions::Versions): Update comment.
12182 * dynobj.cc (Versions::Versions): If there is an soname, use it as
12183 the base version name.
12185 * stringpool.cc (Stringpool_template::add_with_length): Set key to
12186 array size plus one.
12187 (Stringpool_template::set_string_offsets): Subtract one from key
12188 before using it as an array index.
12189 (Stringpool_template::get_offset_with_length): Likewise.
12190 (Stringpool_template::write_to_buffer): Likewise.
12191 * stringpool.h (Stringpool_template::get_offset_from_key):
12194 2008-07-23 Ian Lance Taylor <iant@google.com>
12197 * object.h (Merged_symbol_value::value): Do our best to handle a
12201 * script.cc (Version_script_info::get_versions): Don't add empty
12202 version tag to return value.
12203 (Version_script_info::get_symbol_version_helper): Change return
12204 type to bool. Add pversion parameter. Change all callers.
12205 (script_register_vers_node): Don't require a non-NULL tag.
12206 * script.h (class Version_script_info): Update declarations.
12207 (Version_script_info::get_symbol_version): Change return type to
12208 bool. Add version parameter. Change all callers.
12209 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12210 handling. Handle an empty version from a version script.
12211 (Symbol_table::define_special_symbol): Likewise.
12212 * testsuite/ver_test_10.script: New file.
12213 * testsuite/ver_test_10.sh: New file.
12214 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12215 (check_DATA): Add ver_test_10.syms.
12216 (ver_test_10.syms, ver_test_10.so): New target.
12217 * testsuite/Makefile.in: Rebuild.
12219 2008-07-23 Simon Baldwin <simonb@google.com>
12221 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12222 to zero for undefined symbols from dynamic libraries.
12224 2008-07-23 Ian Lance Taylor <iant@google.com>
12226 * symtab.cc (Symbol_table::resolve): Remove version parameter.
12227 Change all callers.
12228 * symtab.h (class Symbol_table): Update declaration.
12229 * testsuite/ver_test_9.cc: New file.
12230 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12231 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12232 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12233 (ver_test_9.so, ver_test_9.o): New targets.
12234 * testsuite/Makefile.in: Rebuild.
12236 2008-07-22 Ian Lance Taylor <iant@google.com>
12238 * options.h (class General_options): Define --check-sections.
12239 * layout.cc (Layout::set_segment_offsets): Handle
12242 * options.h (class General_options): Define -n/--nmagic and
12244 * options.cc (General_options::finalize): For -n/--nmagic or
12245 -N/--omagic, set -static.
12246 * layout.cc (Layout::attach_allocated_section_to_segment): If
12247 -N/--omagic, don't put read-only and read-write sections in
12248 different segments.
12249 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12250 finding a read-only segment.
12251 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12252 don't set the minimum segment alignment to the common page size,
12253 and don't set the file offset to the address modulo the page size.
12254 * script-sections.cc (Script_sections::create_segments): If
12255 -n/--omagic, don't put read-only and read-write sections in
12256 different segments.
12258 * cref.cc: New file.
12259 * cref.h: New file.
12260 * options.h (class General_options): Add --print-symbol-counts.
12261 * main.cc (main): Issue defined symbol report if requested.
12262 * archive.cc (Archive::interpret_header): Make into a const member
12264 (Archive::add_symbols): Call Input_objects::archive_start and
12266 (Archive::const_iterator): Define new class.
12267 (Archive::begin, Archive::end): New functions.
12268 (Archive::include_all_members): Rewrite to use iterator.
12269 (Archive::count_members): New function.
12270 * archive.h (class Archive): Update declarations.
12271 (Archive::filename): New function.
12272 * object.cc: Include "cref.h".
12273 (Sized_relobj::Sized_relobj): Initialize defined_count_.
12274 (Sized_relobj::do_get_global_symbol_counts): New function.
12275 (Input_objects::add_object): Add object to cross-referencer.
12276 (Input_objects::archive_start): New function.
12277 (Input_objects::archive_stop): New function.
12278 (Input_objects::print_symbol_counts): New function.
12279 * object.h: Declare Cref and Archive.
12280 (Object::get_global_symbol_counts): New function.
12281 (Object::do_get_global_symbol_counts): New pure virtual function.
12282 (class Sized_relobj): Add defined_count_ field. Update
12284 (class Input_objects): Add cref_ field. Update constructor.
12285 Update declarations.
12286 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12288 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12290 (Sized_dynobj::do_get_global_symbol_counts): New function.
12291 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12292 defined_count_. Update declarations. Define Symbols typedef.
12293 * symtab.cc (Symbol_table::add_from_relobj): Add defined
12294 parameter. Change all callers.
12295 (Symbol_table::add_from_dynobj): Add sympointers and defined
12296 parameters. Change all callers.
12297 * symtab.h (class Symbol_table): Update declarations.
12298 * Makefile.am (CCFILES): Add cref.cc.
12299 (HFILES): Add cref.h.
12300 * Makefile.in: Rebuild.
12302 2008-07-22 Simon Baldwin <simonb@google.com>
12304 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12305 to zero when writing undefined symbols.
12307 2008-07-22 Ian Lance Taylor <iant@google.com>
12309 * output.cc (Output_section::add_input_section): Don't try to
12310 merge empty merge sections.
12312 2008-07-21 Craig Silverstein <csilvers@google.com>
12314 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12315 Include symbol version in error message.
12317 2008-07-20 Chris Demetriou <cgd@google.com>
12319 * configure.ac (gold_cv_c_random_seed): New configured variable.
12320 (RANDOM_SEED_CFLAGS): New substituted variable.
12321 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12322 * configure: Rebuild.
12323 * Makefile.in: Likewise.
12324 * testsuite/Makefile.in: Likewise.
12326 2008-07-18 Ian Lance Taylor <iant@google.com>
12328 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12329 where we see NAME/NULL and NAME/VERSION as separate symbols.
12330 * testsuite/ver_test_main.cc (main): Call t4.
12331 (t4, t4_2a): Define.
12332 * testsuite/ver_test_2.cc (t4_2): Define.
12333 * testsuite/ver_test_2.script: Put t4_2a in VER2.
12334 * testsuite/ver_test_4.cc (t4_2a): Define.
12335 * testsuite/ver_test_4.script: Put t4_2a in VER2.
12336 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12338 2008-07-17 Ian Lance Taylor <iant@google.com>
12340 * dynobj.cc (Versions::add_def): If we give an error about a
12341 missing version, go ahead and create the version anyhow.
12343 2008-07-10 Ian Lance Taylor <iant@google.com>
12345 Handle output sections with more than 0x7fffffff bytes.
12346 * object.h (class Relobj): Change map_to_output_ to
12347 output_sections_, and just keep a section pointer. Change all
12348 uses. Move comdat group support to Sized_relobj.
12349 (Relobj::is_section_specially_mapped): Remove.
12350 (Relobj::output_section): Remove poff parameter. Change all
12352 (Relobj::output_section_offset): New function.
12353 (Relobj::set_section_offset): Rewrite.
12354 (Relobj::map_to_output): Remove.
12355 (Relobj::output_sections): New function.
12356 (Relobj::do_output_section_offset): New pure virtual function.
12357 (Relobj::do_set_section_offset): Likewise.
12358 (class Sized_relobj): Add section_offsets_ field. Add comdat
12359 group support from Relobj. Update declarations.
12360 (Sized_relobj::get_output_section_offset): New function.
12361 (Sized_relobj::do_output_section_offset): New function.
12362 (Sized_relobj::do_set_section_offset): New function.
12363 * object.cc (Relobj::output_section_address): Remove.
12364 (Sized_relobj::Sized_relobj): Initialize new fields.
12365 (Sized_relobj::include_section_group): Cast find_kept_object to
12367 (Sized_relobj::include_linkonce_section): Likewise.
12368 (Sized_relobj::do_layout): Use separate arrays for output section
12370 (Sized_relobj::do_count_local_symbols): Change map_to_output to
12372 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12373 output_sections and section_offsets.
12374 (Sized_relobj::write_local_symbols): Likewise.
12375 (map_to_kept_section): Compute output address directly.
12376 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12377 output_sections and section_offsets.
12378 (Sized_relobj::write_sections): Likewise.
12379 (Sized_relobj::relocate_sections): Likewise.
12380 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12381 * output.h (class Output_reloc): Update declarations. Change
12382 u2_.relobj to Sized_relobj*.
12383 (class Output_data_reloc): Change add functions to use
12385 * output.cc (Output_reloc::Output_reloc): Change relobj to
12387 (Output_reloc::local_section_offset): Change return type to
12388 Elf_Addr. Use get_output_section_offset.
12389 (Output_reloc::get_address): Likewise.
12390 (Output_section::is_input_address_mapped): Don't call
12391 is_section_specially_mapped.
12392 (Output_section::output_offset): Likewise.
12393 (Output_section::output_address): Likewise.
12394 (Output_section::starting_output_address): Likewise.
12395 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12396 parameter to Sized_relobj*.
12397 (Copy_relocs::need_copy_reloc): Likewise.
12398 (Copy_relocs::save): Likewise.
12399 * copy-relocs.h (class Copy_relocs): Update declarations.
12400 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12401 Sized_relobj*. Change relobj_ field to Sized_relobj*.
12402 * target-reloc.h (relocate_for_relocatable): Change
12403 offset_in_output_section type to Elf_Addr. Change code that uses
12405 * layout.cc (Layout::layout): Always set *off.
12406 * mapfile.cc (Mapfile::print_input_section): Use
12407 output_section_offset.
12408 * i386.cc (Target_i386::copy_reloc): Change object parameter to
12410 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12411 * sparc.cc (Target_sparc::copy_reloc): Likewise.
12412 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12414 2008-07-03 Ian Lance Taylor <iant@google.com>
12416 * layout.cc (Layout::include_section): Do not discard unrecognized
12417 SHT_STRTAB sections.
12419 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
12421 * script.cc (Lex::can_continue_name): Make '?' allowable in
12422 version-script names.
12423 * testsuite/version_script.map: Change glob pattern to use '?'
12425 2008-06-30 Manish Singh <yosh@gimp.org>
12428 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12431 2008-06-30 Ian Lance Taylor <iant@google.com>
12435 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12436 versions]: Don't try to read the value in the contents, since we
12437 don't use it. Use the template endianness when writing.
12439 2008-06-25 Cary Coutant <ccoutant@google.com>
12441 * fileread.cc (File_read::make_view): Assert on zero-length view.
12442 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12443 symbol table when there are no symbols to read.
12445 2008-06-23 Craig Silverstein <csilvers@google.com>
12447 * version.cc (version_string): Bump to 1.7
12449 2008-06-18 Craig Silverstein <csilvers@google.com>
12451 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12452 constant 0xFFFF to type Valtype.
12453 (Powerpc_relocate_functions::rel16_ha): Likewise.
12455 2008-06-17 Ian Lance Taylor <iant@google.com>
12457 * output.h (Output_section::Input_section): Initialize p2align_ to
12458 zero for Output_section_data constructors.
12459 (Output_section::Input_section::addralign): If not an input
12460 section, return the alignment of the Output_section_data.
12461 * testsuite/copy_test.cc: New file.
12462 * testsuite/copy_test_1.cc: New file.
12463 * testsuite/copy_test_2.cc: New file.
12464 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12465 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12466 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12467 (copy_test_1_pic.o, copy_test_1.so): New targets.
12468 (copy_test_2_pic.o, copy_test_2.so): New targets.
12469 * testsuite/Makefile.in: Rebuild.
12471 * script-sections.cc (Script_sections::place_orphan): Initialize
12472 local variable exact.
12474 2008-06-13 David Edelsohn <edelsohn@gnu.org>
12476 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12478 2008-06-12 David Edelsohn <edelsohn@gnu.org>
12479 David S. Miller <davem@davemloft.net>
12481 * powerpc.cc: New file.
12482 * Makefile.am (TARGETSOURCES): Add powerpc.cc
12483 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12484 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12485 * Makefile.in: Rebuild.
12487 2008-06-09 Ian Lance Taylor <iant@google.com>
12489 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12491 (throwing, orig_terminate): New static variables.
12492 (terminate_handler): New static function.
12493 (t2): Set terminate handler.
12495 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
12498 * binary.cc (Binary_to_elf::sized_convert): Fix .data
12501 2008-05-30 Cary Coutant <ccoutant@google.com>
12503 * archive.cc (Archive::include_all_members) Correct to step
12504 over symbol table and extended name table in thin archives.
12506 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
12509 * target-reloc.h (relocate_for_relocatable): Fix new_offset
12512 2008-05-28 Caleb Howe <cshowe@google.com>
12514 * reduced_debug_output.cc: New file.
12515 * reduced_debug_output.h: New file.
12516 * options.h (class General_options): Add --strip-debug-non-line.
12517 * options.cc (General_options::finalize): Add strip_debug_non_line
12518 to the strip heirarchy.
12519 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12521 * layout.cc: Include "reduced_debug_output.h".
12522 (Layout::Layout): Initialize new fields.
12523 (line_only_debug_sections): New static array.
12524 (is_lines_only_debug_sections): New static inline function.
12525 (Layout::include_section): Handle --strip-debug-non-line.
12526 (Layout::make_output_section): If --strip-debug-non-line, build
12527 new output sections for .debug_abbrev and .debug_info.
12528 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12529 gold. Warn about possible overflow.
12530 (read_signed_LEB_128): Likewise.
12531 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12532 (read_signed_LEB_128): Declare.
12533 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12534 (HFILES): Add reduced_debug_output.h.
12535 * Makefile.in: Rebuild.
12537 2008-05-21 Ian Lance Taylor <iant@google.com>
12539 * mapfile.cc: New file.
12540 * mapfile.h: New file.
12541 * options.h (class General_options): Add -M/--print-map and -Map.
12542 * options.cc (General_options::finalize): Make -M equivalent to
12544 * main.cc: Include <cstdio> and "mapfile.h".
12545 (main): Open mapfile if requested.
12546 * gold.cc (class Middle_runner): Add mapfile_ field. Update
12547 constructor. Change caller.
12548 (queue_initial_tasks): Add mapfile parameter. Change caller.
12549 (queue_middle_tasks): Likewise.
12550 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12552 * archive.cc: Include "mapfile.h".
12553 (Archive::add_symbols): Add mapfile parameter. Change all
12554 callers. Pass mapfile, symbol, and reason to include_member.
12555 (Archive::include_all_members): Add mapfile parameter. Change all
12557 (Archive::include_member): Add mapfile, sym, and why parameters.
12558 Change all callers. Report inclusion to map file.
12559 * archive.h: Include "fileread.h".
12560 (class Archive): Update declarations.
12561 (Archive::file): New const method.
12562 (class Add_archive_symbols): Add mapfile_ field. Update
12563 constructor. Change all callers.
12564 * readsyms.h (class Read_symbols): Likewise.
12565 (class Finish_group): Likewise.
12566 (class Read_script): Likewise.
12567 * common.cc: Include "mapfile.h".
12568 (Symbol_table::allocate_commons): Add mapfile parameter. Change
12570 (Symbol_table::do_allocate_commons): Likewise.
12571 (Symbol_table::do_allocate_commons_list): Likewise. Report common
12572 symbol allocation to mapfile.
12573 * common.h (class Allocate_commons_task): Add mapfile_ field.
12574 Update constructor. Change all callers.
12575 * symtab.h (class Symbol_table): Update declarations.
12576 * layout.cc: Include "mapfile.h".
12577 (Layout_task_runner::run): Print information to mapfile.
12578 (Layout::create_gold_note): Change Output_data_fixed_space to
12579 Output_data_zero_fill.
12580 (Layout::create_build_id): Likewise.
12581 (Layout::print_to_mapfile): New function.
12582 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
12583 constructor. Change caller.
12584 (class Layout): Declare print_to_mapfile.
12585 * output.cc (Output_section::Input_section::print_to_mapfile): New
12587 (Output_section::add_input_section): If producing a map, always
12588 add to input_sections_ list.
12589 (Output_section::do_print_to_mapfile): New function.
12590 (Output_segment::print_sections_to_mapfile): New function.
12591 (Output_segment::print_section_list_to_mapfile): New function.
12592 * output.h: Include "mapfile.h".
12593 (Output_data::print_to_mapfile): New function.
12594 (Output_data::do_print_to_mapfile): New virtual function.
12595 (Output_segment_headers::do_print_to_mapfile): New function.
12596 (Output_file_header::do_print_to_mapfile): New function.
12597 (Output_data_const::do_print_to_mapfile): New function.
12598 (class Output_data_const_buffer): Add map_name_ field. Update
12599 constructor. Change all callers. Add do_print_to_mapfile
12601 (class Output_data_fixed_space): Likewise.
12602 (class Output_data_space): Likewise.
12603 (class Output_data_zero_fill): New class.
12604 (Output_data_strtab::do_print_to_mapfile): New function.
12605 (Output_data_reloc_base::do_print_to_mapfile): New function.
12606 (Output_relocatable_relocs::do_print_to_mapfile): New function.
12607 (Output_data_group::do_print_to_mapfile): New function.
12608 (Output_data_got::do_print_to_mapfile): New function.
12609 (Output_data_dynamic::do_print_to_mapfile): New function.
12610 (Output_symtab_xindex::do_print_to_mapfile): New function.
12611 (class Output_section): Declare do_print_to_mapflie. Declare
12612 print_to_mapfile in Input_section.
12613 (class Output_segment): Declare new functions.
12614 * object.h (Sized_relobj::symbol_count): New function.
12615 * script-sections.cc
12616 (Output_section_element_dot_assignment::set_section_addresses):
12617 Change Output_data_fixed_space to Output_data_zero_fill.
12618 (Output_data_expression::do_print_to_mapfile): New function.
12619 * script.cc (read_input_script): Add mapfile parameter. Change
12621 * script.h (read_input_script): Update declaration.
12622 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12623 (Eh_frame::do_print_to_mapfile): New function.
12624 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12625 (Output_merge_string::do_print_to_mapfile): New function.
12626 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12628 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12630 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12632 * Makefile.am (CCFILES): Add mapfile.cc.
12633 (HFILES): Add mapfile.h.
12634 * Makefile.in: Rebuild.
12636 2008-05-19 Ian Lance Taylor <iant@google.com>
12638 * options.h (class General_options): Add -z relro.
12639 * layout.cc (Layout::Layout): Initialize relro_segment_.
12640 (Layout::add_output_section_data): Return the output section.
12641 (Layout::make_output_section): Rcognize relro sections and mark
12642 them appropriately.
12643 (Layout::attach_allocated_section_to_segment): Put relro sections
12644 in a PT_GNU_RELRO segment.
12645 (Layout::create_initial_dynamic_sections): Mark the .dynamic
12647 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12649 (Layout::linkonce_mapping): Map d.rel.ro.local to
12650 .data.rel.ro.local.
12651 (Layout::output_section_name): Us .data.rel.ro.local for any
12652 section which begins with that.
12653 * layout.h (class Layout): Update add_output_section_data
12654 declaration. Add relro_segment_ field.
12655 * output.cc (Output_section::Output_section): Initialize is_relro_
12656 and is_relro_local_ fields.
12657 (Output_segment::add_output_section): Group relro sections.
12658 (Output_segment::is_first_section_relro): New function.
12659 (Output_segment::maximum_alignment): If there is a relro section,
12660 align the segment to the common page size.
12661 (Output_segment::set_section_addresses): Track whether we are
12662 looking at relro sections. If the last section is a relro
12663 section, align to the common page size.
12664 (Output_segment::set_section_list_addresses): Add in_relro
12665 parameter. Change all callers. Align to the page size when
12666 moving from relro to non-relro section.
12667 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12669 * output.h (class Output_section): Add is_relro_ and
12670 is_relro_local_ fields.
12671 (Output_section::is_relro): New function.
12672 (Output_section::set_is_relro): New function.
12673 (Output_section::is_relro_local): New function.
12674 (Output_section::set_is_relro_local): New function.
12675 (class Output_segment): Update declarations.
12676 * i386.cc (Target_i386::got_section): Mark .got section as relro.
12677 * sparc.cc (Target_sparc::got_section): Likewise.
12678 * x86_64.cc (Target_x86_64::got_section): Likewise.
12679 * testsuite/relro_test_main.cc: New file.
12680 * testsuite/relro_test.cc: New file.
12681 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12682 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12683 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12684 (relro_test.so, relro_test_pic.o): New targets.
12685 * testsuite/Makefile.in: Rebuild.
12687 2008-05-16 Ian Lance Taylor <iant@google.com>
12689 * output.cc (Output_segment::add_output_section): Remove front
12691 * output.h (class Output_segment): Remove
12692 add_initial_output_section and overloaded add_output_section.
12693 Update declaration of remaining add_output_section.
12694 * layout.cc (Layout::create_interp): Call add_output_section
12695 rather than add_initial_output_section.
12696 (Layout::finish_dynamic_section): Likewise.
12698 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12699 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
12700 know the dynamic type.
12701 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12702 field. Initialize it in constructor.
12703 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12704 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12705 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12708 * output.cc (Output_reloc::get_address): Change return type to
12710 * output.h (class Output_reloc): Update get_address declaration.
12711 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12712 for section addresses.
12714 2008-05-09 Ian Lance Taylor <iant@google.com>
12717 * gold.cc (gold_nomem): Use return value of write.
12719 2008-05-08 Ian Lance Taylor <iant@google.com>
12721 * symtab.c (Symbol::init_base_output_data): Add version
12722 parameter. Change all callers.
12723 (Symbol::init_base_output_segment): Likewise.
12724 (Symbol::init_base_constant): Likewise.
12725 (Symbol::init_base_undefined): Likewise.
12726 (Sized_symbol::init_output_data): Likewise.
12727 (Sized_symbol::init_output_segment): Likewise.
12728 (Sized_symbol::init_constant): Likewise.
12729 (Sized_symbol::init_undefined): Likewise.
12730 (Symbol_table::do_define_in_output_data): If the new symbol has a
12731 version, mark it as the default.
12732 (Symbol_table::do_define_in_output_segment): Likewise.
12733 (Symbol_table::do_define_as_constant): Likewise.
12734 * symtab.h (class Symbol): Update declarations.
12735 (class Sized_symbol): Likewise.
12736 * resolve.cc (Symbol::override_version): New function.
12737 (Symbol::override_base): Call override_version.
12738 (Symbol::override_base_with_special): Likewise.
12739 * testsuite/ver_script_8.script: New file.
12740 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12741 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12742 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12743 (ver_test_8_1.so, ver_test_8_2.so): New targets.
12745 2008-05-06 Ian Lance Taylor <iant@google.com>
12748 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12750 (class General_options): Remove existing --undefined, and add
12751 --no-undefined instead. Add new --undefined as synonym for -u.
12752 * archive.cc (Archive::add_symbols): Check whether symbol was
12754 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12755 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12756 all uses. Add IS_UNDEFINED. Update declarations to split
12757 different versions of init_base. Declare init_base_undefined.
12758 (Symbol::is_defined): Handle IS_UNDEFINED.
12759 (Symbol::is_undefined): Likewise.
12760 (Symbol::is_weak_undefined): Call is_undefined.
12761 (Symbol::is_absolute): Handle IS_CONSTANT.
12762 (class Sized_symbol): Update declarations to split different
12763 versions of init. Declare init_undefined.
12764 (class Symbol_table): Declare new functions.
12765 * symtab.cc (Symbol::init_base_object): Rename from init_base.
12766 Change all callers.
12767 (Symbol::init_base_output_data): Likewise.
12768 (Symbol::init_base_output_segment): Likewise.
12769 (Symbol::init_base_constant): Likewise.
12770 (Symbol::init_base_undefined): New function.
12771 (Sized_symbol::init_object): Rename from init. Change all
12773 (Sized_symbol::init_output_data): Likewise.
12774 (Sized_symbol::init_output_segment): Likewise.
12775 (Sized_symbol::init_constant): Likewise.
12776 (Sized_symbol::init_undefined): New function.
12777 (Symbol_table::add_undefined_symbols_from_command_line): New
12779 (Symbol_table::do_add_undefined_symbols_from_command_line): New
12781 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12782 (Symbol::output_section): Likewise.
12783 (Symbol::set_output_section): Likewise.
12784 (Symbol_table::sized_finalize_symbol): Likewise.
12785 (Symbol_table::sized_write_globals): Likewise.
12786 * resolve.cc (Symbol_table::should_override): Likewise.
12787 (Symbol::override_base_with_special): Likewise.
12789 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12790 symbol, change it to have default visibility.
12791 * testsuite/protected_1.cc: New file.
12792 * testsuite/protected_2.cc: New file.
12793 * testsuite/protected_3.cc: New file.
12794 * testsuite/protected_main_1.cc: New file.
12795 * testsuite/protected_main_2.cc: New file.
12796 * testsuite/protected_main_3.cc: New file.
12797 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12798 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12799 (protected_1_LDFLAGS, protected_1_LDADD): Define.
12800 (protected_1.so): New target.
12801 (protected_1_pic.o, protected_2_pic.o): New targets.
12802 (protected_3_pic.o): New target.
12803 (check_PROGRAMS): Add protected_2.
12804 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12805 (protected_2_LDFLAGS, protected_2_LDADD): Define.
12806 * testsuite/Makefile.in: Rebuild.
12808 * options.h (DEFINE_var): Add set_user_set_##varname__.
12809 (DEFINE_bool_alias): New macro.
12810 (class General_options): Define -Bstatic using DEFINE_bool_alias
12811 rather than DEFINE_special. Add --undefined as an alias for -z
12813 * options.cc (General_options::parse_Bstatic): Remove.
12815 * options.h (class General_options): Add --fatal-warnings.
12816 * main.cc (main): Implement --fatal-warnings.
12817 * errors.h (Errors::warning_count): New function.
12819 * options.h (class General_options): Add -Bsymbolic-functions.
12820 * symtab.h (Symbol::is_preemptible): Check for
12821 -Bsymbolic-functions.
12823 2008-05-05 Ian Lance Taylor <iant@google.com>
12825 * options.h (DEFINE_bool): For DASH_Z, create the negative option
12826 as noVARNAME rather than no-VARNAME.
12827 (class General_options): Add option -z combreloc.
12828 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12830 (Output_reloc::sort_before) [SHT_REL]: New function.
12831 (Output_reloc::sort_before) [SHT_RELA]: New function.
12832 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12833 Sort_relocs_comparison.
12834 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12835 parameter. Change all callers.
12836 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12837 sort_relocs parameter. Change all callers.
12838 * output.cc (Output_reloc::get_address): New function, broken out
12840 (Output_reloc::write_rel): Call it.
12841 (Output_reloc::compare): New function.
12842 (Output_data_reloc_base::do_write): Optionally sort relocs.
12844 * configure.ac: If targ_extra_obj is set, link it in.
12845 * configure.tgt: Initialize all variables.
12846 (x86_64*): Set targ_extra_obj and targ_extra_size.
12847 * configure: Rebuild.
12849 * object.cc (Sized_relobj::include_section_group): Adjust section
12850 indexes read from group data. Build vector to pass to
12852 * layout.cc (Layout::layout_group): Add flags and shndxes
12853 parameters. Remove contents parameter. Change caller. Update
12854 explicit instantiations.
12855 * layout.h (class Layout): Update layout_group declaration.
12856 * output.cc (Output_data_group::Output_data_group): Add flags and
12857 input_shndxes parameters. Remove contents parameter. Change
12859 (Output_data_group::do_write): Change input_sections_ to
12861 * output.h (class Output_data_group): Update constructor
12862 declaration. Rename input_sections_ to input_shndxes_.
12863 * testsuite/many_sections_test.cc: Add template.
12865 2008-04-30 Cary Coutant <ccoutant@google.com>
12867 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12869 * layout.cc (Layout::include_section): Refactored check for debug
12871 (Layout::add_comdat): Add new parameters. Change type
12872 of signature parameter. Add object and shndx to signatures table.
12873 (Layout::find_kept_object): New function.
12874 * layout.h: Include <cstring>.
12875 (Layout::is_debug_info_section): New function.
12876 (Layout::add_comdat): Add new parameters.
12877 (Layout::find_kept_object): New function.
12878 (Layout::Kept_section): New struct.
12879 (Layout::Signatures): Change type of map range.
12880 * object.cc (Relobj::output_section_address): New function.
12881 (Sized_relobj::include_section_group): Add new parameters. Change
12882 calls to Layout::add_comdat. Change to build table of kept comdat
12883 groups and table mapping discarded sections to kept sections.
12884 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12885 (Sized_relobj::do_layout): Change calls to include_section_group and
12886 include_linkonce_section.
12887 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12888 value to zero when section is discarded.
12889 (Sized_relobj::map_to_kept_section): New function.
12890 * object.h (Relobj::output_section_address): New function.
12891 (Relobj::Comdat_group): New type.
12892 (Relobj::find_comdat_group): New function.
12893 (Relobj::Comdat_group_table): New type.
12894 (Relobj::Kept_comdat_section): New type.
12895 (Relobj::Kept_comdat_section_table): New type.
12896 (Relobj::add_comdat_group): New function.
12897 (Relobj::set_kept_comdat_section): New function.
12898 (Relobj::get_kept_comdat_section): New function.
12899 (Relobj::comdat_groups_): New field.
12900 (Relobj::kept_comdat_sections_): New field.
12901 (Symbol_value::input_value): Update comment.
12902 (Sized_relobj::map_to_kept_section) New function.
12903 (Sized_relobj::include_linkonce_section): Add new parameter.
12904 * target-reloc.h (Comdat_behavior): New type.
12905 (get_comdat_behavior): New function.
12906 (relocate_section): Add code to map a discarded section to the
12907 corresponding kept section when applying a relocation.
12909 2008-04-30 Craig Silverstein <csilvers@google.com>
12911 * dwarf_reader.cc (next_generation_count): New static var.
12912 (Addr2line_cache_entry): New struct.
12913 (addr2line_cache): New static var.
12914 (Dwarf_line_info::one_addr2line): Added caching.
12915 (Dwarf_line_info::clear_addr2line_cache): New function.
12916 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12917 cache-size parameter.
12918 (Dwarf_line_info::one_addr2line_cache): New function.
12919 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12920 new cache-size argument to one_addr2line(), and clear cache.
12922 2008-04-28 Cary Coutant <ccoutant@google.com>
12924 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12925 R_386_PC8 relocations.
12927 2008-04-23 Ian Lance Taylor <iant@google.com>
12929 * object.cc (Sized_relobj::include_section_group): Check for
12930 invalid section group.
12932 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12935 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12936 than read for file header.
12937 * archive.cc (Archive::include_member): Likewise.
12939 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
12941 * aclocal.m4: Regenerate.
12942 * configure: Regenerate.
12944 2008-04-19 Ian Lance Taylor <iant@google.com>
12946 * version.cc (version_string): Bump to 1.6.
12948 * testsuite/Makefile.am (many_sections_r_test): New target.
12949 (many_sections_r_test_SOURCES): Remove.
12950 (many_sections_r_test_DEPENDENCIES): Remove.
12951 (many_sections_r_test_LDFLAGS): Remove.
12952 (many_sections_r_test_LDADD): Remove.
12954 * object.cc (Sized_relobj::do_add_symbols): Always pass
12955 local_symbol_count_ to add_from_relobj.
12957 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12958 every thousand variables.
12959 * testsuite/Makefile.in: Rebuild.
12961 * object.cc (Xindex::initialize_symtab_xindex): New function.
12962 (Xindex::read_symtab_xindex): New function.
12963 (Xindex::sym_xindex_to_shndx): New function.
12964 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12966 (Sized_relobj::do_initialize_xindex): New function.
12967 (Sized_relobj::do_read_symbols): Adjust section links.
12968 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12969 parameter. Change all callers.
12970 (Sized_relobj::include_section_group): Adjust section links and
12971 symbol section indexes.
12972 (Sized_relobj::do_layout): Adjust section links.
12973 (Sized_relobj::do_count_local_symbols): Adjust section links and
12974 symbol section indexes.
12975 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12976 ordinary and special symbols.
12977 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12978 dynsym_xindex parameters. Change all callers. Adjust section
12979 links. Use SHN_XINDEX when needed.
12980 (Sized_relobj::get_symbol_location_info): Adjust section links.
12981 Don't get fooled by special symbols.
12982 * object.h (class Xindex): Define.
12983 (class Object): Add xindex_ parameter. Declare virtual functoin
12984 do_initialize_xindex.
12985 (Object::adjust_sym_shndx): New function.
12986 (Object::set_xindex): New protected function.
12987 (class Symbol_value): Add is_ordinary_shndx_ field.
12988 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12989 (Symbol_value::value): Assert ordinary section.
12990 (Symbol_value::initialize_input_to_output_map): Likewise.
12991 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12992 Change all callers.
12993 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12995 (class Sized_relobj): Update declarations.
12996 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12997 parameter. Change all callers.
12998 (Sized_relobj::adjust_shndx): New function.
12999 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13001 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13002 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
13003 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
13004 (Sized_dynobj::read_dynsym_section): Adjust section links.
13005 (Sized_dynobj::read_dynamic): Likewise.
13006 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
13008 (Sized_dynobj::do_initialize_xindex): New function.
13009 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
13010 do_initialize_xindex.
13011 (Sized_dynobj::adjust_shndx): New function.
13012 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13013 dynsym_xindex_ fields.
13014 (Layout::finalize): Add a call to set_section_indexes before
13015 creating the symtab sections.
13016 (Layout::set_section_indexes): Don't do anything if the section
13017 already has a section index.
13018 (Layout::create_symtab_sections): Add shnum parameter. Change
13019 caller. Create .symtab_shndx section if needed.
13020 (Layout::create_shdrs): Add shstrtab_section parameter. Change
13022 (Layout::allocated_output_section_count): New function.
13023 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13025 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13026 fields. Update declarations.
13027 (Layout::symtab_xindex): New function.
13028 (Layout::dynsym_xindex): New function.
13029 (class Write_symbols_task): Add layout_ field.
13030 (Write_symbols_task::Write_symbols_task): Add layout parameter.
13032 * output.cc (Output_section_headers::Output_section_headers): Add
13033 shstrtab_section parameter. Change all callers.
13034 (Output_section_headers::do_sized_write): Store overflow values
13035 for section count and section string table section index in
13036 section header zero.
13037 (Output_file_header::do_sized_write): Check for overflow of
13038 section count and section string table section index.
13039 (Output_symtab_xindex::do_write): New function.
13040 (Output_symtab_xindex::endian_do_write): New function.
13041 * output.h (class Output_section_headers): Add shstrtab_section_.
13042 Update declarations.
13043 (class Output_symtab_xindex): Define.
13044 (Output_section::has_out_shndx): New function.
13045 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13047 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13048 Change all callers.
13049 (Sized_symbol::init): Likewise.
13050 (Symbol::output_section): Check for ordinary symbol.
13051 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
13052 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
13054 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13055 Change all callers. Simplify handling of symbols from sections
13056 not included in the link.
13057 (Symbol_table::add_from_dynobj): Handle ordinary symbol
13059 (Weak_alias_sorter::operator()): Assert that symbols are
13061 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13063 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13064 parameters. Change all callers.
13065 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
13066 symbol distinction. Use SHN_XINDEX when needed.
13067 (Symbol_table::write_section_symbol): Add symtab_xindex
13068 parameter. Change all callers.
13069 (Symbol_table::sized_write_section_symbol): Likewise. Use
13070 SHN_XINDEX when needed.
13071 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
13073 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
13074 (Symbol::is_defined): Check is_ordinary.
13075 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13076 (Symbol::is_absolute, Symbol::is_common): Likewise.
13077 (class Sized_symbol): Update declarations.
13078 (class Symbol_table): Update declarations.
13079 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13080 parameters. Change all callers.
13081 (Sized_symbol::override): Likewise.
13082 (Symbol_table::override): Likewise.
13083 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
13084 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
13085 is_ordinary, and orig_st_shndx parameters. Change all callers.
13086 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13087 to be in an ordinary section.
13088 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13089 object and is_ordinary parameters. Change all callers.
13090 (Sized_dwarf_line_info::read_relocs): Add object parameter.
13091 Change all callers. Don't add undefined or non-ordinary symbols
13093 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13094 Change all callers.
13095 * dwarf_reader.h (class Sized_dwarf_line_info): Update
13097 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13098 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13099 (Sized_relobj::relocate_sections): Likewise.
13100 * target-reloc.h (scan_relocs): Adjust section symbol index.
13101 (scan_relocatable_relocs): Likewise.
13102 * i386.cc (Scan::local): Check for ordinary symbols.
13103 * sparc.cc (Scan::local): Likewise.
13104 * x86_64.cc (Scan::local): Likewise.
13105 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13106 to symbol_section_and_value.
13107 * testsuite/many_sections_test.cc: New file.
13108 * testsuite/Makefile.am (BUILT_SOURCES): Define.
13109 (check_PROGRAMS): Add many_sections_test.
13110 (many_sections_test_SOURCES): Define.
13111 (many_sections_test_DEPENDENCIES): Define.
13112 (many_sections_test_LDFLAGS): Define.
13113 (BUILT_SOURCES): Add many_sections_define.h.
13114 (many_sections_define.h): New target.
13115 (BUILT_SOURCES): Add many_sections_check.h.
13116 (many_sections_check.h): New target.
13117 (check_PROGRAMS): Add many_sections_r_test.
13118 (many_sections_r_test_SOURCES): Define.
13119 (many_sections_r_test_DEPENDENCIES): Define.
13120 (many_sections_r_test_LDFLAGS): Define.
13121 (many_sections_r_test_LDADD): Define.
13122 (many_sections_r_test.o): New target.
13123 * testsuite/Makefile.in: Rebuild.
13125 2008-04-17 Cary Coutant <ccoutant@google.com>
13127 * errors.cc (Errors::info): New function.
13128 (gold_info): New function.
13129 * errors.h (Errors::info): New function.
13130 * gold.h (gold_info): New function.
13131 * object.cc (Input_objects::add_object): Print trace output.
13132 * options.cc (options::parse_set): New function.
13133 (General_options::parse_wrap): Deleted.
13134 (General_options::General_options): Deleted initializer.
13135 * options.h (options::String_set): New typedef.
13136 (options::parse_set): New function.
13137 (DEFINE_set): New macro.
13138 (General_options::wrap): Changed to use DEFINE_set. Changed
13139 callers of any_wrap_symbols and is_wrap_symbol.
13140 (General_options::trace, General_options::trace_symbol):
13142 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13143 (General_options::wrap_symbols_): Deleted.
13144 * symtab.cc (Symbol_table::add_from_object): Print trace output.
13146 2008-04-17 David S. Miller <davem@davemloft.net>
13148 * options.cc (General_options::parse_V): New function.
13149 * options.h: Add entries for -V and -Qy.
13151 2008-04-17 Ian Lance Taylor <iant@google.com>
13153 * common.cc (Symbol_table::allocate_commons): Remove options
13154 parameter. Change caller.
13155 (Symbol_table::do_allocate_commons): Remove options parameter.
13156 Change caller. Just call do_allocate_commons_list twice.
13157 (Symbol_table::do_allocate_commons_list): New function, broken out
13158 of do_allocate_commons.
13159 * common.h (class Allocate_commons_task): Remove options_ field.
13160 Update constructor.
13161 * symtab.cc (Symbol_table::Symbol_table): Initialize
13163 (Symbol_table::add_from_object): Put TLS common symbols on
13165 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13166 which are IN_OUTPUT_DATA.
13167 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
13168 allocate_commons and do_allocate_commons declarations. Declare
13169 do_allocate_commons_list.
13170 * gold.cc (queue_middle_tasks): Update creation of
13171 Allocate_commons_task to not pass options.
13172 * testsuite/Makefile.am (INCLUDES): Add -I.. .
13173 (TLS_TEST_C_FLAGS): New variable.
13174 (tls_test_c_pic.o): New target.
13175 (tls_test_shared.so): Link in tls_test_c_pic.o.
13176 (tls_test_c_pic_ie.o): New target.
13177 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13178 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13179 (tls_test_c.o): New target.
13180 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13181 (tls_pic_test_LDADD): Likewise.
13182 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13183 (tls_shared_gd_to_ie_test_LDADD): Likewise.
13184 (tls_test_c_gnu2.o): New target.
13185 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13187 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13188 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13189 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13190 * testsuite/tls_test.cc: Include "config.h".
13191 (t_last): Call t11_last.
13192 * testsuite/tls_test.h (t11, t11_last): Declare.
13193 * testsuite/tls_test_c.c: New file.
13194 * testsuite/tls_test_main.cc (thread_routine): Call t11.
13195 * configure.ac: Check for OpenMP support.
13196 * configure, config.in, Makefile.in: Rebuild.
13197 * testsuite/Makefile.in: Rebuild.
13199 2008-04-16 Cary Coutant <ccoutant@google.com>
13201 * i386.cc (Target_i386::define_tls_base_symbol): New function.
13202 (Target_i386::tls_base_symbol_defined_): New field.
13203 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13204 (Target_i386::Scan::global): Likewise.
13205 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13206 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13207 (Target_x86_64::tls_base_symbol_defined_): New field.
13208 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13209 (Target_x86_64::Scan::global): Likewise.
13211 2008-04-16 Cary Coutant <ccoutant@google.com>
13213 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13214 (Symbol::needs_plt_entry): Allow weak undefined symbols.
13215 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13216 building shared libraries.
13217 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13218 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13219 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13220 * testsuite/Makefile.in: Rebuild.
13221 * testsuite/weak_undef.h: New file.
13222 * testsuite/weak_undef_file1.cc: Add extra test cases.
13223 * testsuite/weak_undef_file2.cc: Likewise.
13224 * testsuite/weak_undef_test.cc: Likewise.
13226 2008-04-16 David S. Miller <davem@davemloft.net>
13228 * sparc.cc (Target_sparc::Scan): Change from struct to class.
13229 Add issued_non_pic_error_ field. Declare check_non_pic.
13230 (Target_sparc::Scan::check_non_pic): New function.
13231 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13232 (Target_sparc::Scan::global): Likewise.
13234 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13235 * configure: Rebuild.
13237 * options.h (DEFINE_enable): New macro.
13238 (new_dtags): New enable option.
13239 (initfirst, interpose, loadfltr, nodefaultlib,
13240 nodelete, nodlopen, nodump): New -z options.
13241 * layout.cc (Layout:finish_dynamic_section): If new
13242 dtags enabled, emit DT_RUNPATH. Also, emit a
13243 DT_FLAGS_1 containing any specified -z flags.
13245 2008-04-16 Ian Lance Taylor <iant@google.com>
13247 * copy-relocs.cc: New file.
13248 * copy-relocs.h: New file.
13249 * reloc.cc: Remove Copy_relocs code.
13250 * reloc.h: Likewise.
13251 * reloc-types.h (struct Reloc_types) [both versions]: Add
13252 get_reloc_addend_noerror.
13253 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13254 variants of add_global which take an addend which must be zero.
13255 * i386.cc: Include "copy-relocs.h".
13256 (class Target_i386): Change type of copy_relocs_ to variable,
13257 update initializer.
13258 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13259 Change all callers.
13260 (Target_i386::do_finalize_sections): Change handling of
13262 * sparc.cc: Include "copy-relocs.h".
13263 (class Target_sparc): Change type of copy_relocs_ to variable,
13264 update initializer.
13265 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13266 Change all callers.
13267 (Target_sparc::do_finalize_sections): Change handling of
13269 * x86_64.cc: Include "copy-relocs.h".
13270 (class Target_x86_64): Change type of copy_relocs_ to variable,
13271 update initializer.
13272 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13273 class. Change all callers.
13274 (Target_x86_64::do_finalize_sections): Change handling of
13276 * Makefile.am (CCFILES): Add copy-relocs.cc.
13277 (HFILES): Add copy-relocs.h.
13279 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13281 * testsuite/script_test_4.sh: Permit leading zeroes.
13283 2008-04-15 Ian Lance Taylor <iant@google.com>
13285 * script-sections.cc (Script_sections::create_segments): Use
13286 header_size_adjustment even when there is enough room for the
13288 * testsuite/script_test_4.sh: New file.
13289 * testsuite/script_test_4.t: New file.
13290 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13291 (check_DATA): Add script_test_4.stdout.
13292 (MOSTLYCLEANFILES): Likewise.
13293 (script_test_4): New target.
13294 (script_test_4.stdout): New target.
13295 * testsuite/Makefile.in: Rebuild.
13297 * sparc.cc: Add definitions for Output_data_plt_sparc class
13300 2008-04-14 David S. Miller <davem@davemloft.net>
13302 * sparc.cc: New file.
13303 * Makefile.am (TARGETSOURCES): Add sparc.cc
13304 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13305 * configure.tgt: Document targ_extra_size and
13306 targ_extra_big_endian. Add entries for sparc-* and
13308 * configure.ac: Handle targ_extra_size and
13309 targ_extra_big_endian.
13310 * Makefile.in: Rebuild.
13311 * configure: Likewise.
13312 * po/POTFILES.in: Likewise.
13313 * po/gold.pot: Likewise.
13315 2008-04-14 Ian Lance Taylor <iant@google.com>
13317 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13318 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13319 in the name/type/flags to section mapping. Don't call
13320 allocate_output_section.
13321 (Layout::choose_output_section): Change parameter from adjust_name
13322 to is_input_section. Don't permit input sections after sections
13323 are attached to segments. Don't call allocate_output_section.
13324 (Layout::layout_eh_frame): Call update_flags_for_input_section,
13325 not write_enable_output_section.
13326 (Layout::make_output_section): Don't push to
13327 unattached_section_list_ nor call attach_to_segment. Call
13328 attach_section_to_segment if sections are attached.
13329 (Layout::attach_sections_to_segments): New function.
13330 (Layout::attach_section_to_segment): New function.
13331 (Layout::attach_allocated_section_to_segment): Rename from
13332 attach_to_segment. Remove flags parameter.
13333 (Layout::allocate_output_section): Remove function.
13334 (Layout::write_enable_output_section): Remove function.
13335 * layout.h (class Layout): Update for above changes. Add new
13336 field sections_are_attached_.
13337 * output.h (Output_section::update_flags_for_input_section): New
13339 * output.cc (Output_section::add_input_section): Call
13340 update_flags_for_input_section.
13341 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13343 2008-04-11 Cary Coutant <ccoutant@google.com>
13345 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13346 thought unnecessary.
13347 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13349 2008-04-11 Ian Lance Taylor <iant@google.com>
13351 * output.h (class Output_section_data): Remove inline definition
13353 * output.cc (Output_section_data::set_addralign): New function.
13355 2008-04-11 Cary Coutant <ccoutant@google.com>
13357 Add support for TLS descriptors for i386 and x86_64.
13358 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13359 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13360 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13362 (Target_i386::got_mod_index_entry): Remove unnecessary code.
13363 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13364 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
13366 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13367 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13368 Fix problem with initial-exec relocations.
13369 (Target_i386::Relocate::relocate_tls): Likewise.
13370 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13372 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13373 support for section-plus-offset dynamic table entries.
13374 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13375 (Output_data_dynamic::Dynamic_entry): Add support for
13376 section-plus-offset dynamic table entries.
13377 (Output_data_dynamic::Classification): Likewise.
13378 (Output_data_dynamic::classification_): Renamed offset_.
13379 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13380 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13381 (Target_x86_64::make_plt_section): New function.
13382 (Target_x86_64::reserve_tlsdesc_entries): New function.
13383 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13384 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13385 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13386 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13387 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13388 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13389 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13390 add extra PLT entry for TLS descriptors.
13391 (Output_data_plt_x86_64::got_): New field.
13392 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13393 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13395 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13397 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13398 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13399 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13400 R_386_TLS_DESC_CALL relocations.
13401 (Target_x86_64::Scan::global): Likewise.
13402 (Target_x86_64::do_finalize_sections): Add dynamic table entries
13403 for TLS descriptors.
13404 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13405 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13406 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13407 GD-to-IE relaxation.
13408 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13409 and TLS_DESCRIPTORS.
13410 * Makefile.in: Rebuild.
13411 * configure: Rebuild.
13412 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13413 (tls_test_shared2.so): New target.
13414 (tls_shared_gd_to_ie_test_SOURCES): New variable.
13415 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13416 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13417 (tls_shared_gd_to_ie_test_LDADD): New variable.
13418 (tls_shared_gnu2_gd_to_ie_test): New target.
13419 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13421 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13422 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13423 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13424 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13425 (tls_shared_gnu2_test): New target.
13426 (tls_test_gnu2_shared.so): New target.
13427 (tls_shared_gnu2_test_SOURCES): New variable.
13428 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13429 (tls_shared_gnu2_test_LDFLAGS): New variable.
13430 (tls_shared_gnu2_test_LDADD): New variable.
13431 * testsuite/Makefile.in: Rebuild.
13432 * testsuite/Makefile.
13434 2008-04-11 Ian Lance Taylor <iant@google.com>
13436 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13438 * testsuite/Makefile.in: Rebuild.
13440 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13442 * testsuite/script_test_2.cc (main): Adjust test.
13444 2008-04-11 David S. Miller <davem@davemloft.net>
13445 Ian Lance Taylor <iant@google.com>
13447 * options.h (General_options): Add entries for '-Y' and
13449 * options.cc (General_options:finalize): If -Y was used, add those
13450 entries to the library path instead of the default "/lib" and
13453 2008-04-11 David S. Miller <davem@davemloft.net>
13455 * testsuite/justsyms.t: Start at 0x100.
13456 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13457 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13459 * testsuite/script_test_2.cc: Adjust string and section length
13462 2008-04-09 Ian Lance Taylor <iant@google.com>
13465 * script-sections.cc (Sections_element::allocate_to_segment): Add
13467 (Output_section_definition::allocate_to_segment): Likewise.
13468 (Orphan_output_section::allocate_to_segment): Likewise.
13469 (Script_sections::attach_sections_using_phdrs_clause): Don't
13470 propagate non-PT_LOAD segments to orphan sections.
13471 * testsuite/Makefile.am (script_test_3.stdout): Generate using
13472 readelf rather than objdump.
13473 * testsuite/script_test_3.sh: Adjust accordingly. Test that
13474 .interp section and PT_INTERP segment are the same size.
13475 * testsuite/Makefile.in: Rebuild.
13477 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13478 aliases for symbols defined in the same object.
13479 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13480 (weak_alias_test_SOURCES): New variable.
13481 (weak_alias_test_DEPENDENCIES): New variable.
13482 (weak_alias_test_LDFLAGS): New variable.
13483 (weak_alias_test_LDADD): New variable.
13484 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13485 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13486 (weak_alias_test_3.o): New target.
13487 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13488 * testsuite/weak_alias_test_main.cc: New file.
13489 * testsuite/weak_alias_test_1.cc: New file.
13490 * testsuite/weak_alias_test_2.cc: New file.
13491 * testsuite/weak_alias_test_3.cc: New file.
13493 2008-04-08 Ian Lance Taylor <iant@google.com>
13495 * options.h (class General_options): Add --noinhibit-exec option.
13496 * main.cc (main): Check --noinhibit-exec.
13498 * options.h (class General_options): Define --wrap as a special
13499 option. Add wrap_symbols_ field.
13500 (General_options::any_wrap_symbols): New function.
13501 (General_options::is_wrap_symbol): New function.
13502 * options.cc (General_options::parse_wrap): New function.
13503 (General_options::General_options): Initialize wrap_symbols_.
13504 * symtab.cc (Symbol_table::wrap_symbol): New function.
13505 (Symbol_table::add_from_object): Handle --wrap.
13506 * symtab.h (class Symbol_table): Declare wrap_symbol.
13507 * target.h (Target::wrap_char): New function.
13508 (Target::Target_info): Add wrap_char field.
13509 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13510 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13511 * testsuite/testfile.cc (Target_test::test_target_info):
13514 * errors.cc (Errors::undefined_symbol): Mention symbol version if
13517 * layout.h (class Layout): Add added_eh_frame_data_ field.
13518 * layout.cc (Layout::Layout): Initialize new field.
13519 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13520 output section until we find a section we merged successfully.
13521 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13522 that the size be non-zero.
13524 * merge.cc (Object_merge_map::get_output_offset): Remove inline
13527 2008-04-08 Craig Silverstein <csilvers@google.com>
13529 * configure.ac: Export new conditional variable HAVE_ZLIB.
13530 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13532 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13533 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13535 2008-04-07 Ian Lance Taylor <iant@google.com>
13537 * version.cc (version_string): Set to "1.5".
13539 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13540 Add issued_non_pic_error_ field. Declare check_non_pic.
13541 (Target_x86_64::Scan::check_non_pic): New function.
13542 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13543 (Target_x86_64::Scan::global): Likewise.
13545 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13546 addend parameter. Change caller. Handle merge sections.
13547 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13548 Address to Addend. Don't add in the result of
13549 local_section_offset, pass down the addend and use the returned
13551 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13552 Update declarations of local_section_offset and symbol_value.
13553 * testsuite/two_file_test_1.cc (t18): New function.
13554 * testsuite/two_file_test_2.cc (f18): New function.
13555 * testsuite/two_file_test_main.cc (main): Call t18.
13556 * testsuite/two_file_test.h (t18, f18): Declare.
13558 * configure.ac: Don't test for objdump, c++filt, or readelf.
13559 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13561 (TEST_READELF): New variable.
13562 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13563 (check_PROGRAMS): Add two_file_strip_test.
13564 (two_file_strip_test): New target.
13565 (check_PROGRAMS): Add two_file_same_shared_strip_test.
13566 (two_file_same_shared_strip_test_SOURCES): New variable.
13567 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13568 (two_file_same_shared_strip_test_LDFLAGS): New variable.
13569 (two_file_same_shared_strip_test_LDADD): New variable.
13570 (two_file_shared_strip.so): New target.
13571 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13572 (ver_test_5.syms, ver_test_7.syms): Likewise.
13573 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13574 (strip_test_3.stdout): Use TEST_OBJDUMP.
13575 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13577 2008-04-04 Cary Coutant <ccoutant@google.com>
13579 * symtab.h (Symbol::is_weak_undefined): New function.
13580 (Symbol::is_strong_undefined): New function.
13581 (Symbol::is_absolute): New function.
13582 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13583 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13585 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13586 (weak_undef_test): New target.
13587 * testsuite/Makefile.in: Rebuild.
13588 * testsuite/weak_undef_file1.cc: New file.
13589 * testsuite/weak_undef_file2.cc: New file.
13590 * testsuite/weak_undef_test.cc: New file.
13592 2008-04-03 Craig Silverstein <csilvers@google.com>
13594 * compressed_output.h (class Output_compressed_section): Use
13596 * compressed_output.cc (zlib_compress): Use unsigned buffers,
13598 (zlib_compressed_suffix): Removed.
13599 (Output_compressed_section::set_final_data_size): Use unsigned
13601 * testsuite/Makefile.am (flagstest_compress_debug_sections):
13602 Fix linker invocation.
13603 (flagstest_o_specialfile_and_compress_debug_sections):
13605 * testsuite/Makefile.in: Regenerated.
13607 2008-04-02 David S. Miller <davem@davemloft.net>
13609 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13610 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13612 2008-04-02 Craig Silverstein <csilvers@google.com>
13616 2008-04-02 Ian Lance Taylor <iant@google.com>
13618 * fileread.cc (File_read::find_view): Add byteshift and vshifted
13619 parameters. Update for new key type to views_. Change all
13621 (File_read::read): Adjust for byteshift in returned view.
13622 (File_read::add_view): New function, broken out of
13623 find_and_make_view.
13624 (File_read::make_view): New function, broken out of
13625 find_and_make_view.
13626 (File_read::find_or_make_view): Add offset and aligned
13627 parameters. Rewrite accordingly. Change all callers.
13628 (File_read::get_view): Add offset and aligned parameters. Adjust
13629 for byteshift in return value.
13630 (File_read::get_lasting_view): Likewise.
13631 * fileread.h (class File_read): Update declarations.
13632 (class File_read::View): Add byteshift_ field. Add byteshift to
13633 constructor. Add byteshift method.
13634 * archive.h (Archive::clear_uncached_views): New function.
13635 (Archive::get_view): Add aligned parameter. Change all callers.
13636 * object.h (Object::get_view): Add aligned parameter. Change all
13638 (Object::get_lasting_view): Likewise.
13640 * fileread.cc (File_read::release): Don't call clear_views if
13641 there are multiple objects.
13642 * fileread.h (File_read::clear_uncached_views): New function.
13643 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13646 2008-03-31 Cary Coutant <ccoutant@google.com>
13648 Add thin archive support.
13649 * archive.cc (Archive::armagt): New const.
13650 (Archive::setup): Remove task parameter and calls to unlock.
13651 (Archive::unlock_nested_archives): New function.
13652 (Archive::read_header): Add nested_off parameter. Change
13654 (Archive::interpret_header): Likewise.
13655 (Archive::include_all_members): Change to handle thin
13657 (Archive::include_member): Likewise.
13658 * archive.h (Archive::Archive): Add new parameters and
13660 (Archive::armagt): New const.
13661 (Archive::setup): Remove task parameter.
13662 (Archive::unlock_nested_archives): New function.
13663 (Archive::read_header): Add nested_off parameter.
13664 (Archive::interpret_header): Likewise.
13665 (Archive::Nested_archive_table): New typedef.
13666 (Archive::is_thin_archive_): New field.
13667 (Archive::nested_archives_): New field.
13668 (Archive::options_): New field.
13669 (Archive::dirpath_): New field.
13670 (Archive::task_): New field.
13671 * readsyms.cc (Read_symbols::do_read_symbols): Add check
13672 for thin archives. Pass additional parameters to
13673 Archive::Archive. Unlock the archive file after calling
13676 2008-03-29 Ian Lance Taylor <iant@google.com>
13678 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13679 version symbol to be local.
13680 * testsuite/ver_test_4.sh: New file.
13681 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13682 (check_DATA): Add ver_test_4.syms.
13683 (ver_test_4.syms): New target.
13684 * testsuite/Makefile.in: Rebuild.
13687 (Output_section::Input_section_sort_entry::has_priority): New
13689 (Output_section::Input_section_sort_entry::match_file_name): New
13691 (Output_section::Input_section_sort_entry::match_section_name):
13693 (Output_section::Input_section_sort_entry::match_section_name_prefix):
13695 (Output_section::Input_section_sort_entry::match_section_file):
13697 (Output_section::Input_section_sort_compare::operator()): Rewrite
13698 using new Input_section_sort_entry functions. Sort crtbegin and
13699 crtend first. Sort sections with no priority before sections with
13701 * testsuite/initpri1.c (d3): Check j != 4.
13702 (cd5): New constructor/destructor function.
13703 (main): Check j != 2.
13705 * symtab.cc (Symbol_table::add_from_object): If we don't use the
13706 new symbol when resolving, don't call set_is_default.
13707 * testsuite/ver_test_7.cc: New file.
13708 * testsuite/ver_test_7.sh: New file.
13709 * testsuite/Makefile.am (ver_test_7.so): New target.
13710 (ver_test_7.o): New target.
13711 (check_SCRIPTS): Add ver_test_7.sh.
13712 (check_DATA): Add ver_test_7.syms.
13713 (ver_test_7.syms): New target.
13715 2008-03-28 Ian Lance Taylor <iant@google.com>
13717 * layout.cc (Layout::layout): If we see an input section with a
13718 name that needs sorting, set the must_sort flag for the output
13720 (Layout::make_output_section): If the name of the output section
13721 indicates that it might require sorting, set the may_sort flag.
13722 * output.h (Output_section::may_sort_attached_input_sections): New
13724 (Output_section::set_may_sort_attached_input_sections): New
13726 (Output_section::must_sort_attached_input_sections): New
13728 (Output_section::set_must_sort_attached_input_sections): New
13730 (class Output_section): Declare Input_section_sort_entry. Define
13731 Input_section_sort_compare. Declare
13732 sort_attached_input_sections. Add new fields:
13733 may_sort_attached_input_sections_,
13734 must_sort_attached_input_sections_,
13735 attached_input_sections_are_sorted_.
13736 * output.cc (Output_section::Output_section): Initialize new
13738 (Output_section::add_input_section): Add an entry to
13739 input_sections_ if may_sort or must_sort are true.
13740 (Output_section::set_final_data_size): Call
13741 sort_attached_input_sections if necessary.
13742 (Output_section::Input_section_sort_entry): Define new class.
13743 (Output_section::Input_section_sort_compare::operator()): New
13745 (Output_section::sort_attached_input_sections): New function.
13746 * configure.ac: Check whether the compiler supports constructor
13747 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
13748 * testsuite/initpri1.c: New file.
13749 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13750 CONSTRUCTOR_PRIORITY.
13751 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13752 (initpri1_LDFLAGS): New variable.
13753 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13755 2008-03-27 Ian Lance Taylor <iant@google.com>
13757 * common.cc (Sort_commons::operator): Correct sorting algorithm.
13758 * testsuite/common_test_1.c: New file.
13759 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13760 (common_test_1_SOURCES): New variable.
13761 (common_test_1_DEPENDENCIES): New variable.
13762 (common_test_1_LDFLAGS): New variable.
13764 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13765 and commons_ correctly when NAME/VERSION does not override
13767 * testsuite/ver_test_6.c: New file.
13768 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13769 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13770 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13772 2008-03-26 Ian Lance Taylor <iant@google.com>
13774 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13775 of an undefined symbol from a version script.
13776 * testsuite/Makefile.am (ver_test_5.so): New target.
13777 (ver_test_5.o): New target.
13778 (check_SCRIPTS): Add ver_test_5.sh.
13779 (check_DATA): Add ver_test_5.syms.
13780 (ver_test_5.syms): New target.
13781 * testsuite/ver_test_5.cc: New file.
13782 * testsuite/ver_test_5.script: New file.
13783 * testsuite/ver_test_5.sh: New file.
13784 * Makefile.in, testsuite/Makefile.in: Rebuild.
13787 Fix problems building gold with gcc 4.3.0.
13788 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13789 (gold_error_at_location, gold_warning_at_location): Use it.
13790 * configure.ac: Check whether we can compile and use a template
13791 function with a printf attribute.
13792 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13793 when jumping over bytes.
13794 * object.cc: Instantiate Object::read_section_data.
13795 * debug.h: Include <cstring>
13796 * dwarf_reader.cc: Include <algorithm>
13797 * main.cc: Include <cstring>.
13798 * options.cc: Include <cstring>.
13799 * output.cc: Include <cstring>.
13800 * script.cc: Include <cstring>.
13801 * script.h: Include <string>.
13802 * symtab.cc: Include <cstring> and <algorithm>.
13803 * target-select.cc: Include <cstring>.
13804 * version.cc: Include <string>.
13805 * testsuite/testmain.cc: Include <cstdlib>.
13806 * configure, config.in: Rebuild.
13808 2008-03-25 Ian Lance Taylor <iant@google.com>
13810 * options.cc: Include "../bfd/bfdver.h".
13811 (options::help): Print bug reporting address.
13813 * version.cc (print_version): Adjust output for current value of
13814 BFD_VERSION_STRING.
13818 * options.cc (options::help): Print list of supported targets.
13819 * target-select.h: Include <vector>.
13820 (class Target_selector): Make machine_, size_, and is_big_endian_
13821 fields const. Add bfd_name_ and instantiated_target_ fields.
13822 (Target_selector::Target_selector): Add bfd_name parameter.
13823 (Target_selector::recognize): Make non-virtual, call
13825 (Target_selector::recognize_by_name): Make non-virtual, call
13826 do_recognize_by_name.
13827 (Target_selector::supported_names): New function.
13828 (Target_selector::bfd_name): New function.
13829 (Target_selector::do_instantiate_target): New pure virtual
13831 (Target_selector::do_recognize): New virtual function.
13832 (Target_selector::do_recognize_by_name): New virtual function.
13833 (Target_selector::instantiate_target): New private function.
13834 (supported_target_names): Declare.
13835 * target-select.cc (Target_selector::Target_selector): Update for
13836 new parameter and fields.
13837 (select_target_by_name): Check that the name matches before
13838 calling recognize_by_name.
13839 (supported_target_names): New function.
13840 * i386.cc (class Target_selector_i386): Update Target_selector
13841 constructor call. Remove recognize and recognize_by_name. Add
13842 do_instantiate_target.
13843 * x86_64.cc (class Target_selector_x86_64): Likewise.
13844 * testsuite/testfile.cc (class Target_selector_test): Update for
13845 changes to Target_selector.
13847 * README: Rewrite, with some notes on unsupported features.
13849 2008-03-24 Cary Coutant <ccoutant@google.com>
13851 * i386.cc (Target_i386::Got_type): New enum declaration.
13852 (Target_i386::Scan::local): Updated callers of Output_data_got
13854 (Target_i386::Scan::global): Likewise.
13855 (Target_i386::Relocate::relocate): Likewise.
13856 (Target_i386::Relocate::relocate_tls): Likewise.
13857 * object.h (Got_offset_list): New class.
13858 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13859 (Sized_relobj::local_got_offset): Likewise.
13860 (Sized_relobj::set_local_got_offset): Likewise.
13861 (Sized_relobj::local_has_tls_got_offset): Removed.
13862 (Sized_relobj::local_tls_got_offset): Removed.
13863 (Sized_relobj::set_local_tls_got_offset): Removed.
13864 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13865 * output.cc (Output_data_got::add_global): Added got_type parameter.
13866 (Output_data_got::add_global_with_rel): Likewise.
13867 (Output_data_got::add_global_with_rela): Likewise.
13868 (Output_data_got::add_global_pair_with_rel): New function.
13869 (Output_data_got::add_global_pair_with_rela): New function.
13870 (Output_data_got::add_local): Added got_type parameter.
13871 (Output_data_got::add_local_with_rel): Likewise.
13872 (Output_data_got::add_local_with_rela): Likewise.
13873 (Output_data_got::add_local_pair_with_rel): New function.
13874 (Output_data_got::add_local_pair_with_rela): New function.
13875 (Output_data_got::add_global_tls): Removed.
13876 (Output_data_got::add_global_tls_with_rel): Removed.
13877 (Output_data_got::add_global_tls_with_rela): Removed.
13878 (Output_data_got::add_local_tls): Removed.
13879 (Output_data_got::add_local_tls_with_rel): Removed.
13880 (Output_data_got::add_local_tls_with_rela): Removed.
13881 * output.h (Output_data_got::add_global): Added got_type parameter.
13882 (Output_data_got::add_global_with_rel): Likewise.
13883 (Output_data_got::add_global_with_rela): Likewise.
13884 (Output_data_got::add_global_pair_with_rel): New function.
13885 (Output_data_got::add_global_pair_with_rela): New function.
13886 (Output_data_got::add_local): Added got_type parameter.
13887 (Output_data_got::add_local_with_rel): Likewise.
13888 (Output_data_got::add_local_with_rela): Likewise.
13889 (Output_data_got::add_local_pair_with_rel): New function.
13890 (Output_data_got::add_local_pair_with_rela): New function.
13891 (Output_data_got::add_global_tls): Removed.
13892 (Output_data_got::add_global_tls_with_rel): Removed.
13893 (Output_data_got::add_global_tls_with_rela): Removed.
13894 (Output_data_got::add_local_tls): Removed.
13895 (Output_data_got::add_local_tls_with_rel): Removed.
13896 (Output_data_got::add_local_tls_with_rela): Removed.
13897 * resolve.cc (Symbol::override_base_with_special): Removed
13898 reference to has_got_offset_ field.
13899 * symtab.cc (Symbol::init_fields): Replaced initialization
13900 of got_offset_ with got_offsets_. Removed initialization
13902 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13903 (Symbol::got_offset): Likewise.
13904 (Symbol::set_got_offset): Likewise.
13905 (Symbol::has_tls_got_offset): Removed.
13906 (Symbol::tls_got_offset): Removed.
13907 (Symbol::set_tls_got_offset): Removed.
13908 (Symbol::got_offset_): Removed.
13909 (Symbol::tls_mod_got_offset_): Removed.
13910 (Symbol::tls_pair_got_offset_): Removed.
13911 (Symbol::got_offsets_): New field.
13912 (Symbol::has_got_offset): Removed.
13913 (Symbol::has_tls_mod_got_offset): Removed.
13914 (Symbol::has_tls_pair_got_offset): Removed.
13915 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13916 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13918 (Target_x86_64::Scan::global): Likewise.
13919 (Target_x86_64::Relocate::relocate): Likewise.
13920 (Target_x86_64::Relocate::relocate_tls): Likewise.
13922 2008-03-25 Ben Elliston <bje@au.ibm.com>
13924 * yyscript.y: Fix spelling error in comment.
13926 2008-03-24 Ian Lance Taylor <iant@google.com>
13928 * options.h (class General_options): Define build_id option.
13929 * layout.h (class Layout): Declare write_build_id, create_note,
13930 create_build_id. Add build_id_note_ member.
13931 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13932 "libiberty.h", "md5.h", "sha1.h".
13933 (Layout::Layout): Initialize eh_frame_data_,
13934 eh_frame_hdr_section_, and build_id_note_.
13935 (Layout::finalize): Call create_build_id.
13936 (Layout::create_note): New function, broken out of
13937 Layout::create_gold_note.
13938 (Layout::create_gold_note): Call create_note.
13939 (Layout::create_build_id): New function.
13940 (Layout::write_build_id): New function.
13941 (Close_task_runner::run): Call write_build_id.
13943 * x86_64.cc: Correct license to GPLv3.
13945 2008-03-23 Ian Lance Taylor <iant@google.com>
13947 * options.cc: Include "demangle.h".
13948 (parse_optional_string): New function.
13949 (parse_long_option): Handle takes_optional_argument.
13950 (parse_short_option): Update dash_z initializer. Handle
13951 takes_optional_argument.
13952 (General_options::General_options): Initialize do_demangle_.
13953 (General_options::finalize): Set do_demangle_. Handle demangling
13955 * options.h (parse_optional_string): Declare.
13956 (struct One_option): Add optional_arg field. Update constructor.
13957 Update call constructor calls. Add takes_optional_argument
13959 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13960 (DEFINE_optional_string): Define.
13961 (General_options::demangle): Change from DEFINE_bool to
13962 DEFINE_optional_string.
13963 (General_options::no_demangle): New function.
13964 (General_options::do_demangle): New function.
13965 (General_options::set_do_demangle): New function.
13966 (General_options::execstack_status_): Move definition to end of
13968 (General_options::static_): Likewise.
13969 (General_options::do_demangle_): New field.
13970 * object.cc (big_endian>::get_symbol_location_info): Call
13971 Options::do_demangle, not Options::demangle.
13972 * symtab.cc (demangle): Likewise.
13974 2008-03-22 Ian Lance Taylor <iant@google.com>
13976 * gold.h: Include <cstddef> and <sys/types.h>
13977 * options.h: Include <cstring>.
13979 2008-03-21 Ian Lance Taylor <iant@google.com>
13981 * Added source code to GNU binutils.