1 2013-01-16 Sriraman Tallam <tmsriram@google.com>
3 * testsuite/plugin_final_layout.cc: Fix comment.
5 2013-01-16 Sriraman Tallam <tmsriram@google.com>
7 * layout.cc (Layout::layout): Do not do default sorting for
8 text sections when section ordering is specified.
9 (make_output_section): Ditto.
10 * testsuite/plugin_final_layout.cc: Name the function sections
11 to catch reordering issues.
13 2013-01-15 Alan Modra <amodra@gmail.com>
15 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
18 2013-01-15 Alan Modra <amodra@gmail.com>
20 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
21 * testsuite/Makefile.in: Regenerate.
23 2013-01-14 Alan Modra <amodra@gmail.com>
25 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
26 * testsuite/Makefile.in: Regenerate.
28 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
30 Fix mingw gold build with plugins enabled
31 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
32 * configure.ac: Export DLOPEN_LIBS and add headers check.
33 * plugin.cc: Handle non-dlfcn case.
34 * Makefile.in: Regenerate.
35 * config.in: Regenerate.
36 * configure: Regenerate.
37 * testsuite/Makefile.in: Regenerate.
39 2013-01-09 Sriraman Tallam <tmsriram@google.com>
41 * output.h (sort_attached_input_sections): Change to be public.
43 (Output_section_definition::set_section_addresses): Sort
44 attached input sections according to section order before linker
45 script assigns section addresses.
46 (Orphan_output_section::set_section_addresses): Sort
47 attached input sections according to section order before linker
48 script assigns section addresses.
49 * Makefile.am (final_layout.sh): Use a simple linker script to
50 check if section ordering still works.
51 * Makefile.in: Regenerate.
53 2013-01-09 Ben Cheng <bccheng@google.com>
55 * arm.cc (Target_arm::attributes_accept_div): New function.
56 (Target_arm::attributes_forbid_div): New function.
57 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
58 attribute using the same new functions as what bfd/elf32_arm.c
61 2013-01-07 Cary Coutant <ccoutant@google.com>
64 * output.cc (Output_section::add_input_section): For incremental
65 updates, don't track input sections that are allocated from patch
68 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
69 Ian Lance Taylor <iant@google.com>
72 * configure.ac (--enable-ld): Removed.
73 (install_as_default): Set to yes only for --enable-gold=default
75 * configure: Regenerated.
77 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
79 * options.h (General_options): Add -fuse-ld= for GCC linker
82 2013-01-04 Cary Coutant <ccoutant@google.com>
84 * configure.ac: Fix typo restoring CXXFLAGS.
85 * configure: Regenerate.
87 2013-01-04 Cary Coutant <ccoutant@google.com>
89 * testsuite/Makefile.am (CXXLINK_S): New macro.
90 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
91 * testsuite/Makefile.in: Regenerate.
93 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
95 * version.cc (print_version): Update copyright year to 2013.
97 2012-12-20 Ian Lance Taylor <iant@google.com>
99 * layout.cc (Layout::special_ordering_of_input_section): New
101 (Layout::layout): If input section requires special ordering, must
103 (Layout::make_output_section): May sort .text input sections.
104 (Layout::is_section_name_prefix_grouped): Remove.
105 * layout.h (class Layout): Declare
106 special_ordering_of_input_section. Don't declare
107 is_section_name_prefix_grouped.
108 * output.cc (Output_section::add_input_section): Revert last
110 (Output_section::Input_section_sort::match_file_name): Don't crash
111 if called on output section data.
112 (Output_section::Input_section_sort_compare): Sort based on
114 (Output_section::Input_section_sort_section_order_index_compare):
116 (Output_section::sort_attached_input_sections): Likewise.
118 2012-12-18 Sriraman Tallam <tmsriram@google.com>
120 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
121 * layout.h (Layout::is_section_name_prefix_grouped): New function.
122 * output.cc (Output_section::add_input_section): Check if section
123 name contains special prefix. Keep input sections to sort such
125 (Output_section::Input_section_sort_section_order_index_compare
126 ::operator()): Group sections according to prefixes.
127 (Output_section::sort_attached_input_sections): Add condition to
128 Input_section_entry constructor call.
129 * testsuite/Makefile.am (text_section_grouping): New test.
130 * testsuite/Makefile.in: Regenerate.
131 * testsuite/text_section_grouping.cc: New file.
132 * testsuite/text_section_grouping.sh: New file.
134 2012-12-17 Nick Clifton <nickc@redhat.com>
136 * Makefile.am: Add copyright notice.
139 * configure.ac: Likewise.
140 * ftruncate.c: Likewise.
141 * Makefile.in: Regenerate.
143 2012-12-14 Cary Coutant <ccoutant@google.com>
145 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
147 (exception_separate_shared_12_test): Likewise.
148 (incremental_copy_test): Likewise.
149 * testsuite/Makefile.in: Regenerate.
151 2012-12-14 Cary Coutant <ccoutant@google.com>
153 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
154 (Dwp_output_file::Dwp_index::enter_set): Add assert.
156 2012-12-12 Alan Modra <amodra@gmail.com>
158 * powerpc.cc (class Track_tls): New.
159 (class Relocate, class Scan): Inherit Track_tls.
160 (Target_powerpc::Scan::local, global): Track tls optimization
161 and avoid creating plt entry for __tls_get_addr if all uses
163 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
165 2012-12-12 Alan Modra <amodra@gmail.com>
167 * options.h (General_options): Add --toc-sort/--no-toc-sort.
168 Replace no_toc_optimize with toc_optimize.
169 * output.h (Output_section::input_sections): Provide non-const variant.
170 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
171 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
173 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
174 (class Sort_toc_sections): New.
175 (Target_powerpc::do_finalize_sections): Sort toc sections.
176 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
178 2012-12-10 Roland McGrath <mcgrathr@google.com>
180 * testsuite/binary_unittest.cc (read_all): New function.
181 (Sized_binary_test): Use it instead of ::read.
182 * fileread.cc (do_read): Don't assume pread always reads the whole
183 amount in a single call.
185 2012-12-10 Alan Modra <amodra@gmail.com>
187 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
188 Set EM_PPC64 or EM_PPC here.
189 (Target_selector_powerpc::do_recognize): Delete.
191 2012-12-10 Alan Modra <amodra@gmail.com>
193 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
195 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
197 2012-12-07 Roland McGrath <mcgrathr@google.com>
199 * testsuite/binary_unittest.cc (Sized_binary_test):
200 Use open_descriptor rather than ::open.
202 2012-12-07 Alan Modra <amodra@gmail.com>
204 * powerpc.cc (Stub_table::do_write): Delete redundant Address
205 typedef and invalid_address constant.
206 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
207 instantiate constants.
209 2012-12-06 Roland McGrath <mcgrathr@google.com>
211 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
212 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
213 * aclocal.m4: Regenerate.
214 * configure: Regenerate.
215 * Makefile.in: Regenerate.
216 * testsuite/Makefile.in: Regenerate.
218 2012-12-07 Alan Modra <amodra@gmail.com>
220 * options.h (General_options): Add no_toc_optimize.
221 * powerpc.cc (ok_lo_toc_insn): New function.
222 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
224 2012-12-06 Alan Modra <amodra@gmail.com>
226 * options.h (General_options): Add plt_align, plt_static_chain,
227 plt_thread_safe. Update stub_group_size help text.
228 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
229 for new plt_thread_safe_ var.
230 (use_plt_offset): Correct comments.
231 (Target_powerpc::do_relax): Look for thread creation symbols to
232 determine default plt_thread_safe value. Clear plt call stubs
233 as well as branch stubs each iteration.
234 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
236 (l, hi, ha, write_insn): Move earlier.
237 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
238 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
240 (Stub_table::update_size): Adjust.
241 (Stub_table::prev_size, set_prev_size): Delete.
242 (Stub_table::stub_align): Let --plt-align affect result.
243 (Stub_table::plt_call_size): Calculate sizes for various stubs.
244 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
245 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
246 (Stub_table::do_write): Support more stub variants.
248 2012-12-04 Alan Modra <amodra@gmail.com>
250 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
251 (Target_powerpc::do_define_standard_symbols): New function.
253 2012-12-03 Alan Modra <amodra@gmail.com>
255 * output.h: Formatting, whitespace.
257 2012-12-03 Alan Modra <amodra@gmail.com>
259 * layout.h (Layout::get_executable_sections): Declare.
260 * layout.cc (Layout::get_executable_sections): New function.
261 * arm.cc (Target_arm::group_sections): Use it.
262 (Arm_output_section::group_sections): Delete now redundant test.
263 * output.cc (Output_reloc::Output_reloc): Add is_relative.
264 param to handle relative relocs.
265 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
266 (Output_data_reloc::add_absolute): Adjust.
267 (Output_data_reloc::add_relative): New function.
268 (Output_data::reset_data_size): New function.
269 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
270 (Output_section::set_addralign): New function.
271 (Output_section::checkpoint_set_addralign): New function.
272 (Output_section::clear_section_offsets_need_adjustment): New function.
273 (Output_section::input_sections): Make public.
274 * powerpc.cc (class Output_data_brlt_powerpc): New.
275 (class Stub_table, class Stub_control): New.
276 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
277 stub_table_, set_stub_table, stub_table): New vectors and accessor
279 (Target_powerpc::do_may_relax, do_relax, push_branch,
280 new_stub_table, stub_tables, brlt_section, group_sections,
281 add_branch_lookup_table, find_branch_lookup_table,
282 write_branch_lookup_table, make_brlt_section): New functions.
283 (Target_powerpc::struct Sort_sections, class Branch_info): New.
284 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
285 branch_info_): New vars.
286 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
287 make call stubs here.
288 (Output_data_glink): Remove all call stub handling from this class.
289 (Target_powerpc::Scan::local, global): Save interesting branch
290 relocs and relocs for ifunc. Adjust calls to plt entry functions.
291 (Target_powerpc::do_finalize_sections): Only make reg save/restore
292 functions on final link.
293 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
294 Handle long branch destinations too.
295 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
296 do_plt_address_for_local): Adjust lookup of plt call stubs.
298 2012-11-30 Alan Modra <amodra@gmail.com>
300 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
301 relocs against protected symbols when building 32-bit shared libs.
303 2012-11-30 Alan Modra <amodra@gmail.com>
305 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
306 param. Call got_section() to make .got. Update all callers
307 and their callers and so on.
309 2012-11-30 Alan Modra <amodra@gmail.com>
311 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
312 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
313 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
314 value if it already exists.
316 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
319 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
321 2012-11-14 Roland McGrath <mcgrathr@google.com>
323 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
324 than bfc instruction for data sandboxing.
326 2012-11-08 Alan Modra <amodra@gmail.com>
328 * po/POTFILES.in: Regenerate.
330 2012-11-05 Alan Modra <amodra@gmail.com>
332 * configure.ac: Apply 2012-09-10 change to config.in here.
333 * configure: Regenerate.
335 2012-11-05 Alan Modra <amodra@gmail.com>
337 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
338 (struct Opd_ent): Use "Address" rather than "Offset".
339 (Output_data_got_powerpc::got_base_offset): Return Valtype.
340 (Target_powerpc::got_section): Make public.
341 (Target_powerpc::scan_relocs): Move code setting symbols..
342 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
343 Create _SDA_BASE_ only when referenced.
345 2012-11-02 Roland McGrath <mcgrathr@google.com>
347 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
350 2012-11-01 Roland McGrath <mcgrathr@google.com>
352 * target.h (Sized_target::relocate_relocs): Use Elf_Off
353 for offset_in_output_section parameter.
354 (Sized_target::relocate_special_relocatable): Likewise.
355 * arm.cc (Target_arm::relocate_relocs): Likewise.
356 (Target_arm::relocate_special_relocatable): Likewise.
357 * i386.cc (Target_i386::relocate_relocs): Likewise.
358 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
359 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
360 * target-reloc.h (relocate_relocs): Likewise.
361 * testsuite/testfile.cc (Target_test): Likewise.
362 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
363 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
365 * system.h: Move inclusion of <clocale> to after <libintl.h> in
366 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
368 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
369 parameter, which is unused in the [!F_SETFD] case.
371 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
372 SYMNDX to off_t before comparing it to this->data_size().
373 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
374 * incremental.cc (Output_section_incremental_inputs::do_write):
375 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
377 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
379 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
381 * gold.cc (Target_arm::do_adjust_elf_header): Add the
382 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
385 2012-10-29 Cary Coutant <ccoutant@google.com>
387 * dwp.cc (usage): Add file and exit status parameters;
388 add --help and --version options.
389 (print_version): New function.
390 (main): Add --help and --version options.
392 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
394 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
395 final_layout_sequence.txt.
396 * testsuite/Makefile.in: Regenerated.
398 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
400 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
401 COMPILE generated by automake.
403 (CXXCOMPILE1): Likewise.
404 (CXXLINK1): Likewise.
405 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
407 (CXXCOMPILE): Likewise.
409 * testsuite/Makefile.in: Regenerated.
411 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
413 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
414 on bad fwrite return.
416 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
418 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
421 2012-10-23 Cary Coutant <ccoutant@google.com>
423 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
424 * testsuite/Makefile.in: Regenerate.
425 * testsuite/dwp_test.h: New source file.
426 * testsuite/dwp_test_1.cc: New source file.
427 * testsuite/dwp_test_1.s: New source file.
428 * testsuite/dwp_test_1.sh: New source file.
429 * testsuite/dwp_test_1b.cc: New source file.
430 * testsuite/dwp_test_1b.s: New source file.
431 * testsuite/dwp_test_2.cc: New source file.
432 * testsuite/dwp_test_2.s: New source file.
433 * testsuite/dwp_test_2.sh: New source file.
434 * testsuite/dwp_test_main.cc: New source file.
435 * testsuite/dwp_test_main.s: New source file.
437 2012-10-23 Cary Coutant <ccoutant@google.com>
439 * dwp.h: New header file.
440 * dwp.cc: New source file.
441 * gold.h: Move shared declarations to system.h.
442 * system.h: New header file.
443 * Makefile.am: Add dwp.
444 * Makefile.in: Regenerate.
446 2012-10-23 Cary Coutant <ccoutant@google.com>
448 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
449 Dwarf_info_reader::read_from_pointer.
450 (Dwarf_pubnames_table::read_header): Likewise.
451 (Dwarf_pubnames_table::next_name): Likewise.
452 (Dwarf_die::read_attributes): Likewise.
453 (Dwarf_die::skip_attributes): Likewise.
454 (Dwarf_info_reader::read_from_pointer): New function template.
455 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
456 (Dwarf_pubnames_table): Likewise.
457 (Dwarf_info_reader::read_from_pointer): New function template.
458 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
459 Dwarf_pubnames_table ctor.
461 2012-10-23 Cary Coutant <ccoutant@google.com>
463 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
465 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
467 (Dwarf_info_reader::set_abbrev_shndx): New method.
468 (Dwarf_info_reader::abbrev_shndx_): New data member.
470 2012-10-23 Cary Coutant <ccoutant@google.com>
472 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
473 from object, not parameters.
474 (Dwarf_info_reader::parse): Likewise.
475 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
476 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
477 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
480 2012-10-23 Cary Coutant <ccoutant@google.com>
482 * fileread.cc (Input_file::Input_file): New constructor.
483 * fileread.h (class Input_file): Add new constructor.
485 2012-10-18 Alan Modra <amodra@gmail.com>
488 * object.cc (Relobj::is_section_name_included): Also match
489 .sdata personality section.
491 2012-10-18 Alan Modra <amodra@gmail.com>
493 * target-reloc.h (class Default_comdat_behavior): New, package up..
494 (get_comdat_behaviour): ..this.
495 (relocate_section): Add Relocate_comdat_behavior template arg,
497 * arm.cc (Target_arm::relocate_section): Adjust to suit.
498 (Target_arm::scan_reloc_section): Likewise.
499 * i386.cc (Target_i386::relocate_section): Likewise.
500 * sparc.cc (Target_sparc::relocate_section): Likewise.
501 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
502 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
503 * powerpc.cc (class Relocate_comdat_behavior): New.
504 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
505 gold::relocate_section with new template arg.
507 2012-10-18 Alan Modra <amodra@gmail.com>
509 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
510 dynamic relocs for GOT_TPREL got entries, without symbol if
512 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
513 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
514 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
516 2012-10-17 Alan Modra <amodra@gmail.com>
519 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
521 2012-10-16 Sriraman Tallam <tmsriram@google.com>
523 * layout.cc (Layout::include_section): Keep sections marked
524 SHF_EXCLUDE when doing relocatable links.
526 2012-10-16 Alan Modra <amodra@gmail.com>
528 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
529 (Target_powerpc::do_finalize_sections): Call it.
530 (Output_data_save_res): New class and supporting functions.
531 (Target_powerpc::symval_for_branch): Only look up .opd entry for
532 normal symbols defined in object files.
534 2012-10-12 Alan Modra <amodra@gmail.com>
536 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
537 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
538 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
539 section if scan_opd_relocs not yet called.
540 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
542 2012-10-12 Alan Modra <amodra@gmail.com>
544 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
545 add_local_ifunc_entry): Revert last change.
546 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
548 2012-10-05 Alan Modra <amodra@gmail.com>
550 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
551 do_plt_address_for_global): New functions.
552 (Output_data_got_powerpc::do_write): Don't segfault when linking
554 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
555 add_local_ifunc_entry): Return true on adding entry..
556 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
557 glink->add_entry call. Remove unused symtab param. Adjust calls.
558 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
559 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
561 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
562 syms here. Do so even when no .iplt. Don't segfault when linking
564 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
565 new variants without reloc param.
566 (Glink_sym_ent::Glink_sym_ent): Likewise.
567 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
568 reloc when refs will resolve to plt call stub.
569 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
570 R_PPC_PLTREL24 to resolve locally.
571 (Target_powerpc::Scan::global): Correct ifunc handling.
572 (Target_powerpc::Relocate::relocate): Correct local sym glink
573 lookup. Don't destroy "value" when we have a plt call stub,
574 and when checking plt call validity.
575 (Target_powerpc::do_dynsym_value): Simplify.
577 2012-10-05 Alan Modra <amodra@gmail.com>
579 * i386.cc (Output_data_plt_i386::address_for_global,
580 address_for_local): Add plt offset to returned value. Adjust uses.
581 * sparc.cc (Output_data_plt_sparc::address_for_global,
582 address_for_local): Likewise.
583 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
584 address_for_local): Likewise.
585 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
586 address_for_local): Likewise.
587 * target.h (Target::plt_address_for_global, plt_address_for_local):
589 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
590 (Output_data_got::Got_entry::write): Nor here.
591 * output.h: Comment fix.
593 2012-10-02 Jiong Wang <jiwang@tilera.com>
595 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
596 global_offset_table_ value for larget got.
597 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
599 2012-09-29 Alan Modra <amodra@gmail.com>
601 * powerpc.cc (Target_powerpc::iplt_): New output section.
602 (Target_powerpc::iplt_section, make_iplt_section,
603 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
604 (Target_powerpc::make_plt_entry): Handle ifunc syms.
605 Target_powerpc::plt_entry_count): Count iplt entries too.
606 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
607 reloc section in constructor. New params.
608 (Target_powerpc::make_plt_section): Create reloc section here instead.
609 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
611 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
612 (Output_data_glink::add_entry, find_entry): New functions to
613 deal with local syms.
614 (Glink_sym_ent): Add support for local syms.
615 (Output_data_glink::do_write): Handle ifunc plt entries.
616 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
617 (Target_powerpc::Scan::local, global): Handle ifunc syms.
618 (Target_powerpc::Relocate::relocate): Likewise.
619 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
621 2012-09-25 Alan Modra <amodra@gmail.com>
623 * object.h (Sized_relobj_file::adjust_local_symbol,
624 do_adjust_local_symbol): New functions.
625 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
626 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
627 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
628 and irregular opd entry spacing.
629 (Powerpc_relobj::do_read_relocs): Add opd size checks.
630 (Global_symbol_visitor_opd): New functor.
631 (Target_powerpc::do_finalize_sections): Omit global symbols defined
632 on deleted opd entries.
634 2012-09-15 Jiong Wang <jiwang@tilera.com>
636 * tilegx.cc: New file.
637 * Makefile.am (TARGETSOURCES): Add tilegx.cc
638 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
639 * configure.tgt: Add entries for tilegx*.
640 * configure.ac: Likewise.
641 * Makefile.in: Rebuild.
642 * configure: Likewise.
643 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
646 2012-09-13 Alan Modra <amodra@gmail.com>
648 * target-reloc.h (scan_relocs): Call scan.local for relocs
649 against symbols in discarded sections. Pass is_discarded
651 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
652 Add is_discarded param.
653 * powerpc (Target_powerpc::Scan::local): Likewise. Use
654 is_discarded to flag opd entry as discarded. Don't emit dyn
655 relocs on such entries.
656 (Target_powerpc::Scan::global): Similarly detect and handle
658 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
659 opd_ent_. Update all uses.
660 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
661 (Target_powerpc::relocate_section): Zero out discarded opd
664 2012-09-12 Ian Lance Taylor <iant@google.com>
667 * output.cc: Rename Output_data_got template parameter from size
668 to got_size for all functions. Compile all variants of
670 (Output_data_got::Got_entry::write): Correct use of size for
671 symbol value. Use local_is_tls rather than casting to
673 * object.h (class Object): Add local_is_tls and do_local_is_tls.
674 (class Sized_relobj_file): Add do_local_is_tls.
675 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
677 2012-09-11 Alan Modra <amodra@gmail.com>
680 * layout.cc (Layout::set_segment_offsets): When using
681 common-page-size alignment, ensure we are on a new max-page-size
683 * output.cc (Output_segment::set_section_addresses): Use
684 abi_pagesize, not common_pagesize for relro boundary.
685 (Output_segment::set_offset): Likewise.
687 2012-09-11 Alan Modra <amodra@gmail.com>
689 * output.h (Output_data_got::add_global_tls, add_local_tls,
690 add_local_tls_pair): New functions.
691 (Output_data_got::add_local_pair_with_rel): Remove second
692 reloc param. Expand comment.
693 (Output_data_got::Got_entry): Rename use_plt_offset_ to
694 use_plt_or_tls_offset_, similarly for constructor param.
695 (Output_data_got::Got_entry::write): Add got_index param.
696 * output.cc (Output_data_got::add_global_tls, add_local_tls,
697 add_local_tls_pair): New functions.
698 (Output_data_got::Got_entry::write): Handle tls symbols
699 with use_plt_or_tls_offset_ set specially.
700 (Output_data_got::add_local_pair_with_rel): Only one reloc.
701 (Output_data_got::do_write): Replace iterator with index, pass
702 index to entry write function.
703 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
704 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
705 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
707 * i386.cc (Target_i386::Scan::local): Likewise.
708 * sparc.cc (Target_sparc::Scan::local): Likewise.
709 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
710 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
711 do_tls_offset_for_global): New functions.
712 (Target_powerpc::Scan::local): Correct TLS relocations and got
714 (Target_powerpc::Scan::global): Don't emit unnecessary
715 dynamic relocations on TLS GOT entries.
717 2012-09-10 Matthias Klose <doko@ubuntu.com>
719 * config.in: Disable sanity check for kfreebsd.
721 2012-09-10 Sterling Augustine <saugustine@google.com>
723 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
724 (Gdb_index::pubtypes_read): New parameter.
725 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
727 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
730 2012-09-09 Alan Modra <amodra@gmail.com>
732 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
733 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
734 * gc.h (gc_process_relocs): Call target gc_add_reference.
735 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
736 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
737 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
739 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
740 to cater for when we don't need code offset. Update use.
741 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
742 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
743 set_opd_valid): New functions.
744 (Target_powerpc::do_gc_add_reference): New function.
745 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
747 (Target_powerpc::do_gc_mark_symbol): New function.
749 2012-09-06 Cary Coutant <ccoutant@google.com>
751 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
752 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
753 (Dwarf_die::skip_attributes): Likewise.
754 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
755 * testsuite/gdb_index_test.cc (inline_func_1): New function.
757 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
759 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
761 * testsuite/script_test_3.t: Add .got.plt output section
763 * testsuite/script_test_4.t: Likewise.
765 2012-09-05 Alan Modra <amodra@gmail.com>
767 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
768 update all uses and lose "enum" when using type.
770 2012-09-05 Alan Modra <amodra@gmail.com>
772 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
773 * configure: Regenerate.
774 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
775 (plugin_final_layout.stdout): Likewise.
776 (memory_test): Set page sizes to 0x1000.
777 * testsuite/Makefile.in: Regenerate.
778 * testsuite/discard_locals_test.sh: Add FIXME comment.
779 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
780 * testsuite/pr14265.t: Add .got output section statement.
781 * testsuite/script_test_2.t: Likewise.
782 * testsuite/script_test_3.t: Likewise.
783 * testsuite/script_test_4.t: Likewise.
784 * testsuite/script_test_5.t: Likewise.
785 * testsuite/script_test_6.t: Likewise.
786 * testsuite/script_test_7.t: Likewise.
787 * testsuite/script_test_9.t: Likewise.
789 2012-09-05 Alan Modra <amodra@gmail.com>
791 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
792 (Powerpc_relocate_functions::Status): New typedef.
793 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
794 (Target_powerpc::Scan::local): Handle REL64.
795 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
797 (Target_powerpc::symval_for_branch): New function, extracted from..
798 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
799 checks. Report overflow errors.
801 2012-09-05 Alan Modra <amodra@gmail.com>
803 * object.h (Sized_relobj_file::emit_relocs): Delete.
804 (Sized_relobj_file::emit_relocs_reltype): Delete.
805 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
806 relocate_relocs for --emit-relocs.
807 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
808 * output.h: Update comment.
809 (Output_segment::first_section): New function.
810 (Output_segment::first_section_load_address): Use first_section.
811 * output.cc (Output_segment::first_section): New function extracted..
812 (Output_segment::first_section_load_address): ..from here. Delete.
813 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
814 * target.h (Sized_target::relocate_for_relocatable): Likewise.
815 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
816 adjust call to target.h function.
817 * i386.cc (Target_i386): Likewise.
818 * sparc.cc (Target_sparc): Likewise.
819 * x86_64.cc (Target_x86_64): Likewise.
820 * powerpc.cc (Target_powerpc): Likewise.
821 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
822 first tls section has section symbol for optimised local dynamic
824 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
825 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
827 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
828 Rename to relocate_relocs. Update error message.
830 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
832 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
835 2012-08-31 Alan Modra <amodra@gmail.com>
837 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
838 (Powerpc_relobj::toc_base_offset): New stub function.
839 (Target_powerpc): Add tp_offset, dtp_offset. Rename
840 got_mod_index_offset to tlsld_got_offset. Update all refs.
841 (Target_powerpc::Relocate::enum skip_tls): New.
842 (Target_powerpc::call_tls_get_addr_): New var.
843 (Target_powerpc::is_branch_reloc): Move to file scope.
844 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
845 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
847 (Target_powerpc::enum Got_type): Delete old values, add new ones.
848 (powerpc_info): Correct common_pagesize for ppc64.
849 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
850 (Powerpc_relocate_functions): Add overflow check enums and functions.
851 Add non-shift version of rela, rela_ua. Delete all rel public
852 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
853 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
854 addr16_ha3, addr14 functions.
855 (Output_data_got_powerpc::add_constant_pair): New function.
856 (Output_data_got_powerpc::got_base_offset): Likewise.
857 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
858 (instruction constants): Sort, add some more.
859 (Output_data_glink::do_write): Add and use Address typedef. Use
860 object->toc_base_offset() stub for 64-bit.
861 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
862 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
863 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
864 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
865 Always treat .opd relocs as against locally defined symbol.
866 Correct condition for RELATIVE relocs.
867 (Target_powerpc::do_finalize_sections): Test for NULL sections.
868 (Target_powerpc::Relocate::relocate): Use plt call stub as value
869 for 32-bit syms with a plt entry. Correct ppc64 toc base
870 calculations. Handle TLS relocs, and more. Add overflow
871 checking and adjust for Powerpc_relocate_functions changes.
872 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
873 Reinstate --emit-relocs code with FIXME.
875 2012-08-30 Alan Modra <amodra@gmail.com>
877 * layout.cc (Layout::set_segment_offsets): Set p_align to
878 abi_pagesize, not common_pagesize.
879 (Layout::relaxation_loop_body): Similarly use abi_pagesize
880 to determine whether file header can go in segment.
882 2012-08-30 Alan Modra <amodra@gmail.com>
884 * output.h (Output_reloc::Output_reloc <output section>): Add
885 is_relative param. Adjust calls.
886 (Output_reloc::add_output_section_relative): New functions.
887 * output.cc (Output_reloc::Output_reloc <output section>): Handle
889 (Output_reloc::symbol_value): Handle SECTION_CODE.
891 2012-08-24 Sriraman Tallam <tmsriram@google.com>
893 * gold.cc (queue_middle_tasks): Call layout again when unique
894 segments for sections is desired.
895 * layout.cc (Layout::Layout): Initialize new members.
896 (Layout::get_output_section_flags): New function.
897 (Layout::choose_output_section): Call get_output_section_flags.
898 (Layout::layout): Make output section for mapping to a unique segment.
899 (Layout::insert_section_segment_map): New function.
900 (Layout::attach_allocated_section_to_segment): Make unique segment for
901 output sections marked so.
902 (Layout::segment_precedes): Check for unique segments when sorting.
903 * layout.h (Layout::Unique_segment_info): New struct.
904 (Layout::Section_segment_map): New typedef.
905 (Layout::insert_section_segment_map): New function.
906 (Layout::get_output_section_flags): New function.
907 (Layout::is_unique_segment_for_sections_specified): New function.
908 (Layout::set_unique_segment_for_sections_specified): New function.
909 (Layout::unique_segment_for_sections_specified_): New member.
910 (Layout::section_segment_map_): New member.
911 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
912 Rename is_gc_pass_one to is_pass_one.
913 Rename is_gc_pass_two to is_pass_two.
914 Rename is_gc_or_icf to is_two_pass.
915 Check for which pass based on whether symbols data is present.
916 Make it two pass when unique segments for sections is desired.
917 * output.cc (Output_section::Output_section): Initialize new
919 * output.h (Output_section::is_unique_segment): New function.
920 (Output_section::set_is_unique_segment): New function.
921 (Output_section::is_unique_segment_): New member.
922 (Output_section::extra_segment_flags): New function.
923 (Output_section::set_extra_segment_flags): New function.
924 (Output_section::extra_segment_flags_): New member.
925 (Output_section::segment_alignment): New function.
926 (Output_section::set_segment_alignment): New function.
927 (Output_section::segment_alignment_): New member.
928 (Output_segment::Output_segment): Initialize is_unique_segment_.
929 (Output_segment::is_unique_segment): New function.
930 (Output_segment::set_is_unique_segment): New function.
931 (Output_segment::is_unique_segment_): New member.
932 * plugin.cc (allow_unique_segment_for_sections): New function.
933 (unique_segment_for_sections): New function.
934 (Plugin::load): Add new functions to transfer vector.
935 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
936 * Makefile.in: Regenerate.
937 * testsuite/plugin_final_layout.sh: Check if unique segment
939 * testsuite/plugin_section_order.c (onload): Check if new interfaces
941 (allow_unique_segment_for_sections): New global.
942 (unique_segment_for_sections): New global.
943 (claim_file_hook): Call allow_unique_segment_for_sections.
944 (all_symbols_read_hook): Call unique_segment_for_sections.
946 2012-08-22 Cary Coutant <ccoutant@google.com>
948 * layout.cc (Layout::include_section): Don't assert on GROUP
949 sections with --emit-relocs.
951 2012-08-21 Cary Coutant <ccoutant@google.com>
953 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
954 if --export-dynamic-symbol names an undef symbol.
956 2012-08-18 Alan Modra <amodra@gmail.com>
958 * powerpc.cc: Formatting and white space.
959 (Powerpc_relobj): Rename got2_section_ to special_.
960 Add opd_ent_shndx_ and opd_ent_off_ vectors.
961 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
962 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
963 (Target_powerpc): Add Address typedef and invalid_address. Use
965 (Target_powerpc::is_branch_reloc): New function.
966 (Powerpc_relocate_functions): Add Address typedef, use throughout.
967 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
968 for dst_mask, value and addend.
969 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
970 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
971 (Output_data_glink::do_write): Correct toc base. Don't try to use
972 uint16_t for 24-bit offset. Use get_output_section_offset and
974 (Target_powerpc::Scan::local): Handle more relocs.
975 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
976 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
977 Plug in toc restoring insn after plt calls. Translate branches
978 to function descriptor symbols to corresponding entry point.
979 (Target_powerpc::relocate_for_relocatable): Check return from
980 get_output_section_offset.
981 * symtab.h: Comment typo.
983 2012-08-14 Ian Lance Taylor <iant@google.com>
985 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
986 unsupported_relocal_local to call unsupported_reloc_global.
988 2012-08-14 Nick Clifton <nickc@redhat.com>
991 * script-sections.cc (Sections_element::output_section_name): Add
992 keep return parameter.
993 (Output_section_element::match_name): Add keep return parameter.
994 Return the value of the keep_ member.
995 * script-sections.h (class Output_section): Update
996 output_section_name prototype.
997 * layout.cc (Layout::keep_input_section): New public member
999 (Layout::choose_output_section): Pass keep parameter to
1000 output_section_name.
1001 * layout.h (class Layout): Add keep_input_section.
1002 * object.cc (Sized_relobj_file::do_layout): Check for kept input
1004 * testsuite/Makefile.am: Add a test.
1005 * testsuite/Makefile.in: Regenerate.
1006 * testsuite/pr14265.c: Source file for the test.
1007 * testsuite/pr14265.t: Linker script for the test.
1008 * testsuite/pr14265.sh: Shell script for the test.
1010 2012-08-14 Alan Modra <amodra@gmail.com>
1012 * target.h (Target::output_section_name): New function.
1013 (Target::do_output_section_name): New function.
1014 * layout.cc (Layout::choose_output_section): Call the above.
1015 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1017 2012-08-14 Alan Modra <amodra@gmail.com>
1019 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1020 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1021 for replace_constant call.
1022 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1023 (Output_data_glink::do_print_to_mapfile): New function.
1024 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1025 (Target_powerpc::Relocate::relocate): Likewise.
1027 2012-08-14 Alan Modra <amodra@gmail.com>
1029 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1030 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1031 (Output_data_glink::add_entry,find_entry): Remove shndx param.
1032 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
1033 all references to shndx_. Handle special case for R_PPC_PLTREL24
1035 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1036 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1037 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1039 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1040 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1042 2012-08-12 Alan Modra <amodra@gmail.com>
1044 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
1045 (glink insn constants): Use uint32_t.
1046 (Output_data_glink::add_entry): Use insert, not [] operator.
1048 2012-08-11 Alan Modra <amodra@gmail.com>
1050 * object.h (Sized_relobj_file::find_shdr): New function.
1051 (Sized_relobj_file::find_special_sections): New function.
1052 * object.cc (Sized_relobj_file::find_shdr): New function.
1053 (Sized_relobj_file::find_eh_frame): Use find_shdr.
1054 (Sized_relobj_file::find_special_sections): New function, split out..
1055 (Sized_relobj_file::do_read_symbols): ..from here.
1056 * output.h (Output_data_got::replace_constant): New function.
1057 (Output_data_got::num_entries): New function.
1058 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1059 (Output_data_got::got_offset): Protected rather than private.
1060 (Output_data_got::replace_got_entry): New function.
1061 * output.cc (Output_data_got::replace_got_entry): New function.
1062 * powerpc.cc (class Powerpc_relobj): New.
1063 (class Powerpc_relocate_functions): Delete all psymval variants or
1064 convert to value,addend type. Delete pcrela, pcrela_unaligned.
1065 Implement _ha functions using corresponding _hi function.
1066 (Powerpc_relobj::find_special_sections): New function.
1067 (Target_powerpc::do_make_elf_object): New function.
1068 (class Output_data_got_powerpc): New.
1069 (class Output_data_glink): New.
1070 (class Powerpc_scan_relocatable_reloc): New.
1071 Many more changes througout file.
1073 2012-08-09 Nick Clifton <nickc@redhat.com>
1075 * po/vi.po: Updated Vietnamese translation.
1077 2012-08-07 Ian Lance Taylor <iant@google.com>
1079 * layout.cc (Layout::add_target_dynamic_tags): If
1080 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1083 2012-07-30 Nick Clifton <nickc@redhat.com>
1085 * po/gold.pot: Updated template.
1086 * po/es.po: Updated Spanish translation.
1088 2012-07-18 Cary Coutant <ccoutant@google.com>
1091 * configure.ac: Add check for -gpubnames support.
1092 * configure: Regenerate.
1093 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1094 support; force -gno-pubnames.
1095 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1097 (gdb_index_test_4): New test.
1098 * testsuite/Makefile.in: Regenerate.
1099 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1100 * testsuite/gdb_index_test_2.sh: Likewise.
1101 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1102 * testsuite/gdb_index_test_4.sh: New script.
1103 * testsuite/gdb_index_test_comm.sh: New script with common code;
1104 don't look for space after colon.
1106 2012-07-16 Sriraman Tallam <tmsriram@google.com>
1108 * gold.cc (queue_middle_tasks): Update function order only after
1109 deferred objects due to plugins are processed.
1111 2012-07-11 Ian Lance Taylor <iant@google.com>
1113 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1114 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1115 (Target_arm::scan_reloc_for_stub): Likewise.
1116 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1117 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1118 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1119 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1120 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1122 2012-07-10 Dodji Seketeli <dodji@redhat.com>
1123 Ian Lance Taylor <iant@google.com>
1126 * configure.ac: Test whether std::tr1::hash<off_t> works.
1127 * gold.h: Add a specialization for std::tr1::hash<off_t> if
1129 * output.h (class Output_fill): Add virtual destructor.
1130 * configure, config.in: Rebuild.
1132 2012-06-22 Roland McGrath <mcgrathr@google.com>
1134 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1136 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
1138 * plugin.cc (Plugin::load): Handle position independent executables.
1140 2012-06-06 Cary Coutant <ccoutant@google.com>
1142 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1144 (lines_only_debug_sections): Likewise.
1145 (gdb_fast_lookup_sections): New static array.
1146 (is_gdb_debug_section): Rename formal parameter.
1147 (is_lines_only_debug_section): Likewise.
1148 (is_gdb_fast_lookup_section): New function.
1149 (Layout::include_section): Check for ".zdebug_" prefix; pass
1150 section name suffix to is_gdb_debug_section, et al.; check for
1151 fast-lookup sections when building .gdb_index.
1152 * options.h (--strip-debug-gdb): Update GDB version number.
1154 2012-06-06 Cary Coutant <ccoutant@google.com>
1156 * configure.ac: Add check for fallocate.
1157 * configure: Regenerate.
1158 * config.in: Regenerate.
1160 * options.h (class General_options): Add --mmap-output-file and
1161 --posix-fallocate options.
1162 * output.cc: (posix_fallocate): Remove; replace with...
1163 (gold_fallocate): New function.
1164 (Output_file::map_no_anonymous): Call gold_fallocate.
1165 (Output_file::map): Check --mmap-output-file option.
1167 2012-06-05 Jing Yu <jingyu@google.com>
1169 * gold.h (textdomain): Add do {} to empty while(0).
1170 (bindtextdomain): Likewise.
1172 2012-06-04 Cary Coutant <ccoutant@google.com>
1174 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1177 2012-05-25 Sriraman Tallam <tmsriram@google.com>
1179 * symtab.cc (Symbol_table::define_special_symbol):
1180 Initialize *poldsym to prevent uninitialized variable errors.
1182 2012-05-23 Cary Coutant <ccoutant@google.com>
1184 * layout.cc (Layout::section_name_mapping): Add rules to handle
1185 exact match on .data.rel.ro.local or .data.rel.ro.
1186 (Layout::output_section_name): Check for exact matches.
1188 2012-05-23 Cary Coutant <ccoutant@google.com>
1190 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1193 2012-05-22 Cary Coutant <ccoutant@google.com>
1195 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1196 object before exporting symbol.
1198 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
1200 * testsuite/tls_test.cc: Include "config.h" first.
1201 * testsuite/tls_test_c.c: Likewise.
1203 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
1204 Nick Clifton <nickc@redhat.com>
1207 * configure.in: Add check that sysdep.h has been included before
1208 any system header files.
1209 * configure: Regenerate.
1210 * config.in: Regenerate.
1212 2012-05-14 Cary Coutant <ccoutant@google.com>
1214 * layout.cc (Layout::make_output_section): Mark .tdata section
1216 * testsuite/relro_test.cc: Add a TLS variable.
1218 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
1221 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1222 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1225 2012-05-08 Cary Coutant <ccoutant@google.com>
1227 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1228 (lines_only_debug_sections): Likewise.
1230 2012-05-02 Roland McGrath <mcgrathr@google.com>
1232 * nacl.cc: New file.
1234 * Makefile.am (CCFILES, HFILES): Add them.
1235 * Makefile.in: Regenerate.
1236 * i386.cc (Output_data_plt_i386_nacl): New class.
1237 (Output_data_plt_i386_nacl_exec): New class.
1238 (Output_data_plt_i386_nacl_dyn): New class.
1239 (Target_i386_nacl): New class.
1240 (Target_selector_i386_nacl): New class.
1241 (target_selector_i386): Use it instead of Target_selector_i386.
1242 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1243 (Target_x86_64_nacl): New class.
1244 (Target_selector_x86_64_nacl): New class.
1245 (target_selector_x86_64, target_selector_x32): Use it instead of
1246 Target_selector_x86_64.
1247 * arm.cc (Output_data_plt_arm_nacl): New class.
1248 (Target_arm_nacl): New class.
1249 (Target_selector_arm_nacl): New class.
1250 (target_selector_arm, target_selector_armbe): Use it instead of
1251 Target_selector_arm.
1253 * target-select.cc (select_target): Take new Input_file* and off_t
1254 arguments, pass them on to recognize method of selector.
1255 * object.cc (make_elf_sized_object): Update caller.
1256 * parameters.cc (parameters_force_valid_target): Likewise.
1257 * incremental.cc (make_sized_incremental_binary): Likewise.
1258 * target-select.h: Update decl.
1259 (Target_selector::recognize): Take new Input_file* argument,
1260 pass it on to do_recognize.
1261 (Target_selector::do_recognize): Take new Input_file* argument.
1262 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1263 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1264 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1265 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1267 * target.h (Target::Target_info): New members isolate_execinstr
1269 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1270 * arm.cc (Target_arm::arm_info): Update initializer.
1271 * i386.cc (Target_i386::i386_info): Likewise.
1272 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1273 * sparc.cc (Target_sparc::sparc_info): Likewise.
1274 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1275 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1276 * layout.cc (Layout::attach_allocated_section_to_segment):
1277 Take new const Target* argument. If target->isolate_execinstr(), act
1279 (Layout::find_first_load_seg): Take new const Target* argument;
1280 if target->isolate_execinstr(), reject PF_X segments.
1281 (Layout::relaxation_loop_body): Update caller.
1282 (Layout::set_segment_offsets): If target->isolate_execinstr(),
1283 reset file offset to zero when we hit LOAD_SEG, and then do a second
1284 loop over the segments before LOAD_SEG to reassign offsets after
1285 addresses have been determined. Handle target->rosegment_gap().
1286 (Layout::attach_section_to_segment): Take new const Target* argument;
1287 pass it to attach_allocated_section_to_segment.
1288 (Layout::make_output_section): Update caller.
1289 (Layout::attach_sections_to_segments): Take new const Target* argument;
1290 pass it to attach_section_to_segment.
1291 * gold.cc (queue_middle_tasks): Update caller.
1292 * layout.h (Layout): Update method decls with new arguments.
1294 * arm.cc (Target_arm::Target_arm): Take optional argument for the
1295 Target_info pointer to use.
1296 (Target_arm::do_make_data_plt): New virtual method.
1297 (Target_arm::make_data_plt): New method that calls it.
1298 (Target_arm::make_plt_entry): Use it.
1299 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1300 for the section alignment.
1301 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1303 (Output_data_plt_arm::first_plt_entry_offset): Call it.
1304 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1306 (Output_data_plt_arm::get_plt_entry_size): Call it.
1307 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1308 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1309 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1311 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1312 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1313 method instead of sizeof(plt_entry).
1314 (Output_data_plt_arm::add_entry): Likewise.
1315 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1316 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1318 (Target_arm::plt_entry_size): Likewise.
1319 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1321 (Output_data_plt_arm_standard): ... here, new class.
1322 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1323 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1324 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1326 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1327 Take additional argument for the PLT entry size.
1328 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1329 Use get_plt_entry_size method rather than plt_entry_size variable.
1330 (Output_data_plt_x86_64::reserve_slot): Likewise.
1331 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1332 (Output_data_plt_x86_64::add_entry): Likewise.
1333 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1334 (Output_data_plt_x86_64::address_for_global): Likewise.
1335 (Output_data_plt_x86_64::address_for_local): Likewise.
1336 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1337 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1338 Make method non-static.
1339 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1341 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1342 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1343 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1344 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1346 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1347 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1349 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1350 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1352 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1353 (Output_data_plt_x86_64::plt_entry_size)
1354 (Output_data_plt_x86_64::first_plt_entry)
1355 (Output_data_plt_x86_64::plt_entry)
1356 (Output_data_plt_x86_64::tlsdesc_plt_entry)
1357 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1358 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1359 (Output_data_plt_x86_64_standard): ... here, new class.
1360 (Target_x86_64::Target_x86_64): Take optional argument for the
1361 Target_info pointer to use.
1362 (Target_x86_64::do_make_data_plt): New virtual method.
1363 (Target_x86_64::make_data_plt): New method to call it.
1364 (Target_x86_64::init_got_plt_for_update): Use that.
1365 Call this->plt_->add_eh_frame method here.
1366 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1367 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1368 rather than static method.
1369 (Target_x86_64::plt_entry_size): Likewise.
1370 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1371 rather than plt_entry_size variable. Move guts of PLT filling to...
1372 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1373 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1374 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1376 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1377 additional argument for the section alignment.
1378 Don't do add_eh_frame_for_plt here.
1379 (Output_data_plt_i386::first_plt_entry_offset): Make the method
1380 non-static. Use get_plt_entry_size method rather than plt_entry_size
1382 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1384 (Output_data_plt_i386::get_plt_entry_size): Call it.
1385 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1386 (Output_data_plt_i386::add_eh_frame): New method to call it.
1387 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1389 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1390 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1392 (Output_data_plt_i386::fill_plt_entry): New method to call it.
1393 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1394 method instead of plt_entry_size.
1395 (Output_data_plt_i386::plt_entry_size)
1396 (Output_data_plt_i386::plt_eh_frame_fde_size)
1397 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1398 (Output_data_plt_i386_standard): ... here, new class.
1399 (Output_data_plt_i386_exec): New class.
1400 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1401 (Output_data_plt_i386_exec::first_plt_entry): ... here.
1402 (Output_data_plt_i386::exec_plt_entry): Move to ...
1403 (Output_data_plt_i386_exec::plt_entry): ... here.
1404 (Output_data_plt_i386_dyn): New class.
1405 (Output_data_plt_i386::first_plt_entry): Move to ...
1406 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1407 (Output_data_plt_i386::dyn_plt_entry): Move to ...
1408 (Output_data_plt_i386_dyn::plt_entry): ... here.
1409 (Target_i386::Target_i386): Take optional argument for the Target_info
1411 (Target_i386::do_make_data_plt): New virtual method.
1412 (Target_i386::make_data_plt): New method to call it.
1413 (Target_i386::make_plt_section): Use that.
1414 Call this->plt_->add_eh_frame method here.
1415 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1416 rather than plt_entry_size variable.
1417 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1418 (Output_data_plt_i386::address_for_local): Likewise.
1419 (Output_data_plt_i386::do_write): Likewise.
1420 Move guts of PLT filling to...
1421 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1422 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1423 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1424 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1426 2012-05-01 Cary Coutant <ccoutant@google.com>
1428 * dwarf_reader.cc (Dwarf_die::read_attributes)
1429 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1430 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1431 * reduced_debug_output.cc
1432 (Output_reduced_debug_info_section::get_die_end): Remove
1433 DW_FORM_GNU_ref_index. Add default case.
1435 2012-04-26 Mark Wielaard <mjw@redhat.com>
1437 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1438 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1439 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1440 DW_AT_high_pc as offset from DW_AT_low_pc.
1442 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1443 * testsuite/Makefile.in: Regenerate.
1444 * testsuite/gdb_index_test_3.c: New test source file.
1445 * testsuite/gdb_index_test_3.sh: New test source file.
1447 2012-04-25 Ian Lance Taylor <iant@google.com>
1449 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1451 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1452 as a class, not a struct.
1453 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1454 (Target_arm::apply_cortex_a8_workaround): Likewise.
1455 * gc.h: Declare Reloc_types as a struct, not a class.
1456 * object.h: Declare Symbols_data as a struct.
1457 * reloc.h: Declare Read_relocs_data as a struct.
1458 * target.h: Declare Relocate_info as a struct.
1460 2012-04-24 David S. Miller <davem@davemloft.net>
1462 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1463 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1466 2012-04-24 Cary Coutant <ccoutant@google.com>
1468 * incremental-dump.cc (find_input_containing_global): Replace
1469 magic number with symbolic constant.
1470 (dump_incremental_inputs): Update version number.
1471 * incremental.cc (Output_section_incremental_inputs): Update version
1472 number; import symbolic constants from Incremental_inputs_reader.
1473 (Incremental_inputs::create_data_sections): Align relocations
1474 section correctly for 64-bit targets.
1475 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1476 constants; add padding.
1477 (Output_section_incremental_inputs::write_header): Add assert for
1479 (Output_section_incremental_inputs::write_input_files): Add assert
1480 for input_entry_size.
1481 (Output_section_incremental_inputs::write_info_blocks): Add padding;
1482 add assert for object_info_size, input_section_entry_size,
1483 global_sym_entry_size.
1484 * incremental.h (Incremental_inputs_reader): Add symbolic constants
1485 for data structure sizes; use them.
1486 (Incremental_input_entry_reader): Import symbolic constants from
1487 Incremental_inputs_reader; use them.
1489 2012-04-23 David S. Miller <davem@davemloft.net>
1491 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1493 (Target_sparc::Target_sparc): Initialize new fields.
1494 (Target_sparc::do_make_elf_object): New function.
1495 (Target_sparc::do_adjust_elf_header): New function.
1497 2012-04-23 Cary Coutant <ccoutant@google.com>
1499 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1500 CU range table of gdb index.
1502 2012-04-20 David S. Miller <davem@davemloft.net>
1504 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1507 2012-04-16 David S. Miller <davem@davemloft.net>
1509 * sparc.cc (Target_sparc::got_address): New function.
1510 (Sparc_relocate_functions::gdop_hix22): New function.
1511 (Sparc_relocate_functions::gdop_lox10): New function.
1512 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1514 (Target_sparc::Scan::local): Likewise if the global symbol is not
1515 preemptible and is not IFUNC.
1516 (Target_sparc::Relocate::relocate): Perform GOTDATA code
1517 transformations for local and non-preemptible non-IFUNC global
1520 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1521 writing out 64-bit part of ranges.
1523 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1524 -fpic and -fpie respectively.
1525 * Makefile.in: Regenerate.
1527 * sparc.cc (class Target_sparc): Add rela_ifunc_.
1528 (Target_sparc::Target_sparc): Initialize new field.
1529 (Target_sparc::do_plt_section_for_global): New function.
1530 (Target_sparc::do_plt_section_for_local): New function.
1531 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1532 (Target_sparc::make_plt_section): New function, broken out of
1533 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
1534 (Target_sparc::make_plt_entry): Call make_plt_section.
1535 (Target_sparc::make_local_ifunc_plt_entry): New function.
1536 (Target_sparc::rela_ifunc_section): New function.
1537 (Target_sparc::plt_section): Remove const.
1538 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
1539 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1540 and ifunc_count_ fields.
1541 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1542 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1543 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1544 (Output_data_plt_sparc::rela_ifunc): New function.
1545 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1546 (Output_data_plt_sparc::has_ifunc_section): New function.
1547 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1548 (Output_data_plt_sparc::address_for_global): New function.
1549 (Output_data_plt_sparc::address_for_local): New function.
1550 (Output_data_plt_sparc::plt_index_to_offset): New function.
1551 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1553 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1555 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1556 R_SPARC_JMP_IREL to switch.
1557 (Target_sparc::Scan::check_non_pic): Likewise.
1558 (Target_sparc::Scan::local): Handle IFUNC symbols.
1559 (Target_sparc::Scan::local): Likewise.
1560 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1561 and plt_address_for_local.
1562 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1563 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1565 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1566 (class Output_data_reloc): Adjust calls to Output_reloc_type.
1567 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1568 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1570 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1571 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1573 * sparc.cc (Target_sparc::Scan::global): Likewise.
1574 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1576 2012-04-16 Cary Coutant <ccoutant@google.com>
1578 * archive.cc (Library_base::should_include_member): Check for
1579 --export-dynamic-symbol.
1580 * options.h (class General_options): Add --export-dynamic-symbol.
1581 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1582 --export-dynamic-symbol.
1583 (Symbol_table::gc_mark_undef_symbols): Likewise.
1584 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1586 2012-04-12 David S. Miller <davem@davemloft.net>
1588 * sparc.cc (Reloc::wdisp10): New relocation method.
1589 (Reloc::h34): Likewise.
1590 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1591 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1593 (Target_sparc::Scan::local): Likewise.
1594 (Target_sparc::Scan::global): Likewise.
1595 (Target_sparc::Relocate::relocate): Likewise.
1597 2012-04-09 Cary Coutant <ccoutant@google.com>
1599 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1602 2012-04-06 Ian Lance Taylor <iant@google.com>
1604 * timer.cc: #include <unistd.h>.
1606 2012-04-06 Roland McGrath <mcgrathr@google.com>
1608 * configure.in (AC_CHECK_HEADERS): Add locale.h.
1609 * config.in: Regenerate.
1610 * configure: Regenerate.
1612 2012-04-05 Nick Clifton <nickc@redhat.com>
1614 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1615 (AM_LC_MESSAGES): Add.
1616 * aclocal.m4: Regenerate.
1617 * config.in: Regenerate.
1618 * configure: Regenerate.
1620 2012-03-21 Cary Coutant <ccoutant@google.com>
1622 * Makefile.am: Add gdb-index.cc, gdb-index.h.
1623 * Makefile.in: Regenerate.
1624 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1625 (Sized_elf_reloc_mapper::symbol_section): New function.
1626 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1627 (make_elf_reloc_mapper): New function.
1628 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1629 (Dwarf_abbrev_table::do_read_abbrevs): New function.
1630 (Dwarf_abbrev_table::do_get_abbrev): New function.
1631 (Dwarf_ranges_table::read_ranges_table): New function.
1632 (Dwarf_ranges_table::read_range_list): New function.
1633 (Dwarf_pubnames_table::read_section): New function.
1634 (Dwarf_pubnames_table::read_header): New function.
1635 (Dwarf_pubnames_table::next_name): New function.
1636 (Dwarf_die::Dwarf_die): New function.
1637 (Dwarf_die::read_attributes): New function.
1638 (Dwarf_die::skip_attributes): New function.
1639 (Dwarf_die::set_name): New function.
1640 (Dwarf_die::set_linkage_name): New function.
1641 (Dwarf_die::attribute): New function.
1642 (Dwarf_die::string_attribute): New function.
1643 (Dwarf_die::int_attribute): New function.
1644 (Dwarf_die::uint_attribute): New function.
1645 (Dwarf_die::ref_attribute): New function.
1646 (Dwarf_die::child_offset): New function.
1647 (Dwarf_die::sibling_offset): New function.
1648 (Dwarf_info_reader::check_buffer): New function.
1649 (Dwarf_info_reader::parse): New function.
1650 (Dwarf_info_reader::do_parse): New function.
1651 (Dwarf_info_reader::do_read_string_table): New function.
1652 (Dwarf_info_reader::lookup_reloc): New function.
1653 (Dwarf_info_reader::get_string): New function.
1654 (Dwarf_info_reader::visit_compilation_unit): New function.
1655 (Dwarf_info_reader::visit_type_unit): New function.
1656 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1657 Sized_elf_reloc_mapper.
1658 (Sized_dwarf_line_info::symbol_section): Remove function.
1659 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1660 (Sized_dwarf_line_info::read_line_mappings): Remove object
1661 parameter, adjust callers.
1662 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1663 * dwarf_reader.h: Include <sys/types.h>.
1664 (class Track_relocs): Remove forward declaration.
1665 (class Elf_reloc_mapper): New class.
1666 (class Sized_elf_reloc_mapper): New class.
1667 (class Dwarf_abbrev_table): New class.
1668 (class Dwarf_range_list): New class.
1669 (class Dwarf_ranges_table): New class.
1670 (class Dwarf_pubnames_table): New class.
1671 (class Dwarf_die): New class.
1672 (class Dwarf_info_reader): New class.
1673 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1674 (Sized_dwarf_line_info::symbol_section): Remove member function.
1675 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1677 * gdb-index.cc: New source file.
1678 * gdb-index.h: New source file.
1679 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1680 and .debug_types sections, call Layout::add_to_gdb_index.
1681 (Sized_relobj_incr::do_section_name): Implement.
1682 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1683 return type; Implement.
1684 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1686 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1687 parameter list and return type.
1688 (Sized_incr_dynobj::do_section_contents): Likewise.
1689 * layout.cc: Include gdb-index.h.
1690 (Layout::Layout): Initialize gdb_index_data_.
1691 (Layout::init_fixed_output_section): Check for .gdb_index section.
1692 (Layout::add_to_gdb_index): New function. Instantiate.
1693 * layout.h: Add forward declaration for class Gdb_index.
1694 (Layout::add_to_gdb_index): New member function.
1695 (Layout::gdb_index_data_): New data member.
1696 * main.cc: Include gdb-index.h.
1697 (main): Print statistics for gdb index.
1698 * object.cc (Object::section_contents): Move code into
1699 do_section_contents.
1700 (need_decompressed_section): Check for sections needed when building
1702 (build_compressed_section_map): Likewise.
1703 (Sized_relobj_file::do_read_symbols): Need local symbols when building
1705 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1706 sections; call Layout::add_to_gdb_index.
1707 (Sized_relobj_file::do_decompressed_section_contents): Call
1708 do_section_contents directly.
1709 * object.h (Object::do_section_contents): Adjust parameter list and
1711 (Object::do_decompressed_section_contents): Call do_section_contents
1713 (Sized_relobj_file::do_section_contents): Adjust parameter list and
1715 * options.h (class General_options): Add --gdb-index option.
1716 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1717 list and return type.
1718 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1719 * reloc.h (Track_relocs::checkpoint): New function.
1720 (Track_relocs::reset): New function.
1722 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1724 * testsuite/Makefile.in: Regenerate.
1725 * testsuite/gdb_index_test.cc: New test source file.
1726 * testsuite/gdb_index_test_1.sh: New test source file.
1727 * testsuite/gdb_index_test_2.sh: New test source file.
1729 2012-03-19 Doug Kwan <dougkwan@google.com>
1731 * arm.cc (Target_arm::do_define_standard_symbols): New method.
1732 (Target_arm::do_finalize_sections): Remove code which defines
1733 __exidx_start and __exidx_end. Make symbol table parameter
1734 anonymous as it is not used.
1735 * gold.cc (queue_middle_tasks): Call target hook to define any
1736 target-specific symbols.
1737 * target.h (Target::define_standard_symbols): New method.
1738 (Target::do_define_standard_symbols): Same.
1739 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1740 * testsuite/Makefile.in: Regenerate.
1741 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1743 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1744 relocations are generated for __exidx_start and __exidx_end.
1746 2012-03-16 Doug Kwan <dougkwan@google.com>
1748 * testsuite/Makefile.am: Disable test initpri3b.
1749 * testsuite/Makefile.in: Regenerate.
1751 2012-03-15 Doug Kwan <dougkwan@google.com>
1753 * arm.cc (Target_arm::got_section): Make .got section read-only
1756 2012-03-15 Ian Lance Taylor <iant@google.com>
1759 * layout.cc (Layout::make_output_section): Correctly mark
1760 SHT_INIT_ARRAY, et. al., as relro.
1762 2012-03-14 Doug Kwan <dougkwan@google.com>
1764 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1765 dynamic relocations for protected symbols in shared objects.
1767 2012-03-13 Ian Lance Taylor <iant@google.com>
1769 * resolve.cc (Symbol_table::resolve): When merging common symbols,
1770 keep the larger alignment.
1772 2012-03-12 Cary Coutant <ccoutant@google.com>
1774 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1775 handling of DW_LNE_define_file.
1777 2012-03-12 Cary Coutant <ccoutant@google.com>
1779 * reduced_debug_output.cc
1780 (Output_reduced_debug_info_section::get_die_end): Add new FORM
1783 2012-02-29 Cary Coutant <ccoutant@google.com>
1785 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1787 2012-02-29 Cary Coutant <ccoutant@google.com>
1789 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1790 Call Object::decompressed_section_contents.
1791 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1793 (Sized_dwarf_line_info::buffer_start_): New data member.
1794 * merge.cc (Output_merge_data::do_add_input_section): Call
1795 Object::decompressed_section_contents.
1796 (Output_merge_string::do_add_input_section): Likewise.
1797 * object.cc (need_decompressed_section): New function.
1798 (build_compressed_section_map): Decompress sections needed later.
1799 (Sized_relobj_file::do_decompressed_section_contents): New function.
1800 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1801 * object.h (Object::decompressed_section_contents): New function.
1802 (Object::discard_decompressed_sections): New function.
1803 (Object::do_decompressed_section_contents): New function.
1804 (Object::do_discard_decompressed_sections): New function.
1805 (Compressed_section_info): New type.
1806 (Compressed_section_map): Include decompressed section contents.
1807 (Sized_relobj_file::do_decompressed_section_contents): New function.
1808 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1810 2012-02-16 Cary Coutant <ccoutant@google.com>
1812 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1813 * testsuite/Makefile.in: Regenerate.
1815 2012-02-14 Cary Coutant <ccoutant@google.com>
1817 * options.cc (General_options::finalize): Disallow -pie and -static.
1819 2012-02-03 Doug Kwan <dougkwan@google.com>
1821 * arm.cc (Arm_relocate_functions::abs8,
1822 Arm_relocate_functions::abs16): Use
1823 Bits::has_signed_unsigned_overflow32.
1824 (Arm_relocate_functions::thm_abs8): Correct range of
1826 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1829 2012-02-02 Doug Kwan <dougkwan@google.com>
1831 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1832 position independent outputs, not just shared objects.
1834 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
1836 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1837 * configure: Regenerated.
1839 2012-01-27 Ian Lance Taylor <iant@google.com>
1841 * reloc.h (Bits): New class with static functions, copied from
1842 namespace utils in arm.cc.
1843 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
1846 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1848 * incremental.cc (write_info_blocks): Correct relocation offset.
1850 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1852 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1853 (Relocate::tls_gd_to_le): Likewise.
1855 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1857 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1859 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1861 * configure.ac: Check if -mcmodel=medium works.
1862 * configure: Regenerated.
1864 2012-01-24 Cary Coutant <ccoutant@google.com>
1866 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1868 (read_unsigned_LEB_128_x): ... this new function.
1869 (read_signed_LEB_128): Replaced with inline definition and ...
1870 (read_signed_LEB_128_x): ... this new function.
1871 * int_encoding.h (read_unsigned_LEB_128_x): New function.
1872 (read_unsigned_LEB_128): Add inline definition.
1873 (read_signed_LEB_128_x): New function.
1874 (read_signed_LEB_128): Add inline definition.
1875 * testsuite/Makefile.am (leb128_unittest): New unit test.
1876 * testsuite/Makefile.in: Regenerate.
1877 * testsuite/leb128_unittest.cc: New unit test.
1879 2012-01-23 Ian Lance Taylor <iant@google.com>
1882 * i386.cc (Target_i386::do_code_fill): When using a jmp
1883 instruction, pad with nop instructions.
1884 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1886 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
1888 * x86_64.cc (gc_process_relocs): Add typename on types used in
1890 (scan_relocs): Likewise.
1891 (relocate_section): Likewise.
1892 (apply_relocation): Likewise.
1894 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
1896 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1897 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1900 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
1902 * x86_64.cc: Initial support for x32.
1904 2012-01-03 Cary Coutant <ccoutant@google.com>
1906 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1907 Use abstract base class for GOT.
1908 * gold/output.h (class Output_data_got_base): New abstract base class.
1909 (class Output_data_got): Derive from new base class, adjust ctors.
1910 (Output_data_got::reserve_slot): Make virtual; rename to
1911 do_reserve_slot; Adjust callers.
1912 * gold/target.h (Sized_target::init_got_plt_for_update): Return
1913 pointer to abstract base class.
1914 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1916 2011-12-18 Ian Lance Taylor <iant@google.com>
1918 * object.h (Relobj::local_symbol_value): New function.
1919 (Relobj::local_plt_offset): New function.
1920 (Relobj::local_has_got_offset): New function.
1921 (Relobj::local_got_offset): New function.
1922 (Relobj::set_local_got_offset): New function.
1923 (Relobj::do_local_symbol_value): New pure virtual function.
1924 (Relobj::do_local_plt_offset): Likewise.
1925 (Relobj::do_local_has_got_offset): Likewise.
1926 (Relobj::do_local_got_offset): Likewise.
1927 (Relobj::do_set_local_got_offset): Likewise.
1928 (Sized_relobj::do_local_has_got_offset): Rename from
1929 local_has_got_offset.
1930 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1931 (Sized_relobj::do_set_local_got_offset): Rename from
1932 set_local_got_offset.
1933 (Sized_relobj_file::do_local_plt_offset): Rename from
1935 (Sized_relobj_file::do_local_symbol_value): New function.
1936 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1938 * output.cc (Output_data_got::Got_entry::write): Change object to
1939 Relobj. Use local_symbol_value.
1940 (Output_data_got::add_global_with_rel): Change rel_dyn to
1941 Output_data_reloc_generic*. Use add_global_generic.
1942 (Output_data_got::add_global_with_rela): Remove. Change all
1943 callers to use add_global_with_rel.
1944 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1945 Output_data_reloc_generic*. Use add_global_generic.
1946 (Output_data_got::add_global_pair_with_rela): Remove. Change all
1947 callers to use add_global_pair_with_rel.
1948 (Output_data_got::add_local): Change object to Relobj*.
1949 (Output_data_got::add_local_plt): Likewise.
1950 (Output_data_got::add_local_with_rel): Change object to Relobj*,
1951 change rel_dyn to Output_data_reloc_generic*. Use
1953 (Output_data_got::add_local_with_rela): Remove. Change all
1954 callers to use all_local_with_rel.
1955 (Output_data_got::add_local_pair_with_rel): Change object to
1956 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
1957 add_output_section_generic.
1958 (Output_data_got::add_local_pair_with_rela): Remove. Change all
1959 callers to use add_local_pair_with_rel.
1960 (Output_data_got::reserve_local): Change object to Relobj*.
1961 * output.h: (class Output_data_reloc_generic): Add pure virtual
1962 declarations for add_global_generic, add_local_generic,
1963 add_output_section_generic.
1964 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1965 functions for Output_data_reloc_generic. Update declarations for
1966 changes listed in output.cc.
1967 (class Output_data_got): Change template parameter to got_size.
1968 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
1969 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1971 (Sized_relobj_incr::do_local_plt_offset): New function.
1972 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1975 2011-12-17 Cary Coutant <ccoutant@google.com>
1977 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1978 * resolve.cc (Symbol_table::resolve): Likewise.
1979 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1981 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1983 2011-12-16 Ian Lance Taylor <iant@google.com>
1985 * output.h (Output_data_reloc_generic::add): Only call
1986 add_dynamic_reloc if this is a dynamic reloc section.
1988 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
1991 * target-reloc.h (apply_relocation): Replace <64, false> with
1994 2011-11-25 Nick Clifton <nickc@redhat.com>
1996 * po/it.po: New Italian translation.
1998 2011-11-17 Sterling Augustine <saugustine@google.com>
2000 * script.cc (script_include_directive): Implement.
2001 (read_script_file): New local variables name and search_path. Update
2002 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2003 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2004 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2006 2011-11-11 Sterling Augustine <saugustine@google.com>
2008 * yyscript.y (section_cmd): Add support for INCLUDE directive.
2009 (file_or_sections_cmd): Likewise.
2011 2011-11-11 Doug Kwan <dougkwan@google.com>
2013 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2014 if --just-symbols is given.
2016 2011-11-10 Doug Kwan <dougkwan@google.com>
2019 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2020 when processing data relocs.
2021 * reloc.h (Relocate_functions::rel_unaligned): New method.
2022 (Relocate_functions::pcrel_unaligned): Ditto.
2023 (Relocate_functions::rel32_unaligned): Ditto.
2024 (Relocate_functions::pcrel32_unaligned): Ditto.
2026 2011-11-09 Doug Kwan <dougkwan@google.com>
2029 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2030 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2031 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2032 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2033 (Relocate_functions::rel_unaligned): New.
2034 (Relocate_functions::rel32_unaligned): New.
2035 * target-reloc.h (relocate_for_relocatable): Add code to handle
2036 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2037 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2038 arm_unaligned_reloc_r): New targets.
2039 * testsuite/Makefile.in: Regenerate.
2040 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2043 2011-11-02 Ian Lance Taylor <iant@google.com>
2045 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
2047 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2048 * options.cc (General_options::finalize): Use library search path
2049 from configure script if specified. If not native and no sysroot,
2050 only search TOOLLIBDIR.
2051 * options.h (Search_directory::Search_directory): Change name to
2053 (General_options::add_to_library_path_with_sysroot): Change arg to
2055 * configure, Makefile.in, config.in: Rebuild.
2057 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2059 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2060 we are working around the ARM1176 Erratum.
2061 * options.h (General_options::fix_arm1176): Add option.
2062 * testsuite/Makefile.am: Add testcases, and keep current ones
2064 * testsuite/Makefile.in: Regenerate.
2065 * testsuite/arm_fix_1176.s: New file.
2066 * testsuite/arm_fix_1176.sh: Likewise.
2068 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2070 * arm.cc (Target_arm::Target_arm): Remove initialisation of
2072 (Target_arm::may_use_blx): Remove method.
2073 (Target_arm::set_may_use_blx): Likewise.
2074 (Target_arm::may_use_v4t_interworking): New method.
2075 (Target_arm::may_use_v5t_interworking): Likewise.
2076 (Target_arm::may_use_blx_): Remove member variable.
2077 (Arm_relocate_functions::arm_branch_common): Check for v5T
2079 (Arm_relocate_functions::thumb_branch_common): Likewise.
2080 (Reloc_stub::stub_type_for_reloc): Likewise.
2081 (Target_arm::do_finalize_sections): Correct interworking checks.
2082 * testsuite/Makefile.am: Add new tests.
2083 * testsuite/Makefile.in: Regenerate.
2084 * testsuite/arm_farcall_arm_arm.s: New test.
2085 * testsuite/arm_farcall_arm_arm.sh: Likewise.
2086 * testsuite/arm_farcall_arm_thumb.s: Likewise.
2087 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2088 * testsuite/arm_farcall_thumb_arm.s: Likewise.
2089 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2090 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2091 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2093 2011-10-31 Cary Coutant <ccoutant@google.com>
2096 * expression.cc (Expression::eval_with_dot): Add
2097 is_section_dot_assignment parameter.
2098 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
2099 absolute and assigning to dot within a section.
2100 * script-sections.cc
2101 (Output_section_element_assignment::set_section_addresses): Pass
2102 dot_section to set_if_absolute.
2103 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2104 as is_section_dot_assignment flag to eval_with_dot.
2105 (Output_section_element_dot_assignment::set_section_addresses):
2107 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2108 parameter. Also set value if relative to dot_section; set the
2109 symbol's output_section.
2110 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2111 parameter. Adjust all callers.
2112 (Expression::eval_maybe_dot): Likewise.
2113 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2115 * testsuite/script_test_2.t: Test assignment of an absolute value
2116 to dot within an output section element.
2118 2011-10-31 Cary Coutant <ccoutant@google.com>
2120 * options.h (class General_options): Add --[no-]gnu-unique options.
2121 * symtab.cc (Symbol_table::sized_write_globals): Convert
2122 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2124 2011-10-31 Cary Coutant <ccoutant@google.com>
2127 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2128 unnecessary assertion.
2129 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2131 2011-10-31 Sriraman Tallam <tmsriram@google.com>
2133 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2135 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2137 Change to just keep the section associated with symbol.
2138 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2139 they are externally visible and --export-dynamic is turned on.
2140 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2142 2011-10-19 Ian Lance Taylor <iant@google.com>
2145 * script-sections.cc
2146 (Output_section_element_dot_assignment::needs_output_section): New
2149 2011-10-19 Ian Lance Taylor <iant@google.com>
2152 * layout.cc (Layout::segment_precedes): Don't assert failure if a
2153 --section-start option was seen.
2154 * options.h (General_options::any_section_start): New function.
2156 2011-10-18 David S. Miller <davem@davemloft.net>
2159 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2160 member to track relocation locations that have moved during TLS
2161 reloc optimizations.
2162 (Target_sparc::Relocate::Relocate): Initialize to NULL.
2163 (Target_sparc::Relocate::relocate): Adjust view down by 4
2164 bytes if it matches reloc_adjust_addr_.
2165 (Target_sparc::Relocate::relocate_tls): Always move the
2166 __tls_get_addr call delay slot instruction forward 4 bytes when
2167 performing relaxation.
2169 2011-10-18 Cary Coutant <ccoutant@google.com>
2171 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2172 (Output_file::map_no_anonymous): Check for non-zero
2173 return code from posix_fallocate.
2175 2011-10-17 Cary Coutant <ccoutant@google.com>
2178 * plugin.cc (is_visible_from_outside): Check for symbols
2179 referenced from dynamic objects.
2180 * resolve.cc (Symbol_table::resolve): Don't count references
2181 from dynamic objects as references from real ELF files.
2182 * testsuite/plugin_test_2.sh: Adjust expected result.
2184 2011-10-17 Cary Coutant <ccoutant@google.com>
2186 * gold.cc: Include timer.h.
2187 (queue_middle_tasks): Stamp time.
2188 (queue_final_tasks): Likewise.
2189 * main.cc (main): Store timer in parameters. Print timers
2191 * parameters.cc (Parameters::Parameters): Initialize timer_.
2192 (Parameters::set_timer): New function.
2193 (set_parameters_timer): New function.
2194 * parameters.h (Parameters::set_timer): New function.
2195 (Parameters::timer): New function.
2196 (Parameters::timer_): New data member.
2197 (set_parameters_timer): New function.
2198 * timer.cc (Timer::stamp): New function.
2199 (Timer::get_pass_time): New function.
2200 * timer.h (Timer::stamp): New function.
2201 (Timer::get_pass_time): New function.
2202 (Timer::pass_times_): New data member.
2204 2011-10-17 Cary Coutant <ccoutant@google.com>
2206 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2207 task for members of lib groups.
2209 2011-10-17 Cary Coutant <ccoutant@google.com>
2212 * fileread.cc (File_read::find_view): Add assert.
2213 (File_read::make_view): Move bounds check (replace with assert)...
2214 (File_read::find_or_make_view): ... to here.
2216 2011-10-12 Cary Coutant <ccoutant@google.com>
2218 * output.cc (Output_file::open_base_file): Handle case where
2219 ::read returns less than requested size.
2221 2011-10-10 Cary Coutant <ccoutant@google.com>
2223 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2224 Initialize defined_count_.
2225 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2226 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2227 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2228 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2229 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2230 * incremental.h (Sized_relobj_incr::defined_count_): New data
2232 (Sized_incr_dynobj::defined_count_): New data member.
2233 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2234 Return zeroes instead of internal error.
2236 2011-10-10 Cary Coutant <ccoutant@google.com>
2239 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2240 (Output_reloc::symbol_value): Return PLT offset if flag is set.
2241 * output.h (class Output_reloc): Add use_plt_offset flag.
2242 (Output_reloc::type_): Adjust size of bit field.
2243 (Output_reloc::use_plt_offset_): New bit field.
2244 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2245 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2246 flag. Adjust all callers.
2247 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2248 creating RELATIVE relocations.
2250 2011-10-10 Nick Clifton <nickc@redhat.com>
2252 * po/es.po: Updated Spanish translation.
2253 * po/fi.po: Updated Finnish translation.
2255 2011-10-03 Diego Novillo <dnovillo@google.com>
2257 * options.cc (parse_uint): Fix dereference of RETVAL.
2259 2011-09-29 Sriraman Tallam <tmsriram@google.com>
2261 * layout.h (section_order_map_): New member.
2262 (get_section_order_map): New member function.
2263 * output.cc (Output_section::add_input_section): Check for patterns
2264 only when --section-ordering-file is specified.
2265 * gold.cc (queue_middle_tasks): Delay updating order of sections till
2266 output_sections have been formed.
2267 * layout.cc (Layout_Layout): Initialize section_order_map_.
2268 * plugin.cc (update_section_order): Store order in order_map. Do not
2270 * testsuite/Makefile.am: Add test case for plugin_final_layout.
2271 * testsuite/Makefile.in: Regenerate.
2272 * testsuite/plugin_section_order.c: New file.
2273 * testsuite/plugin_final_layout.cc: New file.
2274 * testsuite/plugin_final_layout.sh: New file.
2276 2011-09-29 Cary Coutant <ccoutant@google.com>
2278 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2280 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2281 symbols during incremental update.
2282 (Symbol_table::add_from_dynobj): Likewise.
2284 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2285 Ian Lance Taylor <iant@google.com>
2287 * symtab.cc (Symbol_table::define_special_symbol): Always
2288 canonicalize version string.
2290 2011-09-26 Cary Coutant <ccoutant@google.com>
2292 * gold.cc (queue_initial_tasks): Move option checks ...
2293 * options.cc (General_options::finalize): ... to here. Disable
2294 some options; make others fatal.
2296 2011-09-26 Cary Coutant <ccoutant@google.com>
2299 * plugin.cc (get_symbols_v2): New function.
2300 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2301 (is_referenced_from_outside): New function.
2302 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2303 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2304 (get_symbols): Pass version parameter.
2305 (get_symbols_v2): New function.
2306 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2308 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2309 (onload): Add LDPT_GET_SYMBOLS_V2.
2310 (all_symbols_read_hook): Use get_symbols_v2; check for
2311 LDPR_PREVAILING_DEF_IRONLY_EXP.
2312 * testsuite/plugin_test_3.sh: Update expected results.
2314 2011-09-23 Simon Baldwin <simonb@google.com>
2316 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2317 configuration options.
2318 * configure: Regenerate.
2319 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2320 * Makefile.in: Regenerate.
2321 * testsuite/Makefile.in: Regenerate.
2323 2011-09-19 Sriraman Tallam <tmsriram@google.com>
2325 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2327 2011-09-19 Cary Coutant <ccoutant@google.com>
2329 * incremental.cc (can_incremental_update): Fix typo in comment.
2330 * incremental.h (can_incremental_update): Likewise.
2332 2011-09-18 Cary Coutant <ccoutant@google.com>
2334 * incremental.cc (can_incremental_update): New function.
2335 * incremental.h (can_incremental_update): New function.
2336 * layout.cc (Layout::init_fixed_output_section): Call it.
2337 (Layout::make_output_section): Don't allow patch space in .eh_frame.
2338 * object.cc (Sized_relobj_file::do_layout): Call
2339 can_incremental_update.
2341 2011-09-13 Cary Coutant <ccoutant@google.com>
2343 * configure.ac: Check for glibc support for gnu_indirect_function
2344 support with static linking, setting automake conditional
2346 * Makefile.in: Regenerate.
2347 * configure: Regenerate.
2349 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2350 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2352 * testsuite/Makefile.in: Regenerate.
2354 2011-09-13 Cary Coutant <ccoutant@google.com>
2356 * incremental.cc (Sized_relobj_incr::do_layout): Call
2357 report_comdat_group for kept comdat sections.
2358 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2359 * testsuite/Makefile.in: Regenerate.
2360 * testsuite/incr_comdat_test_1.cc: New source file.
2361 * testsuite/incr_comdat_test_2_v1.cc: New source file.
2362 * testsuite/incr_comdat_test_2_v2.cc: New source file.
2363 * testsuite/incr_comdat_test_2_v3.cc: New source file.
2365 2011-09-13 Ian Lance Taylor <iant@google.com>
2367 * object.cc (Sized_relobj_file::do_layout): Remove unused local
2368 variable external_symbols_offset.
2370 2011-09-12 Ian Lance Taylor <iant@google.com>
2372 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2373 triggered if object has no symbols.
2375 2011-09-09 David S. Miller <davem@davemloft.net>
2377 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2378 (Output_fill_debug_line::do_write): Likewise.
2380 2011-08-29 Cary Coutant <ccoutant@google.com>
2382 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2383 casts to match formatting specs.
2384 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2386 2011-08-26 Cary Coutant <ccoutant@google.com>
2388 * layout.cc (Free_list::allocate): Provide guarantee of minimum
2389 remaining hole size when allocating.
2390 (Layout::make_output_section): Set fill methods for debug sections.
2391 * layout.h (Free_list::Free_list_node): Move from private to
2393 (Free_list::set_min_hole_size): New function.
2394 (Free_list::begin, Free_list::end): New functions.
2395 (Free_list::min_hole_): New data member.
2396 * output.cc: Include dwarf.h.
2397 (Output_fill_debug_info::do_minimum_hole_size): New function.
2398 (Output_fill_debug_info::do_write): New function.
2399 (Output_fill_debug_line::do_minimum_hole_size): New function.
2400 (Output_fill_debug_line::do_write): New function.
2401 (Output_section::Output_section): Initialize new data member.
2402 (Output_section::set_final_data_size): Ensure patch space is larger
2403 than minimum hole size.
2404 (Output_section::do_write): Fill holes in debug sections.
2405 * output.h (Output_fill): New class.
2406 (Output_fill_debug_info): New class.
2407 (Output_fill_debug_line): New class.
2408 (Output_section::set_free_space_fill): New function.
2409 (Output_section::free_space_fill_): New data member.
2410 * testsuite/Makefile.am (incremental_test_3): Add
2411 --incremental-patch option.
2412 (incremental_test_4): Likewise.
2413 (incremental_test_5): Likewise.
2414 (incremental_test_6): Likewise.
2415 (incremental_copy_test): Likewise.
2416 (incremental_common_test_1): Likewise.
2417 * testsuite/Makefile.in: Regenerate.
2419 2011-08-26 Nick Clifton <nickc@redhat.com>
2421 * po/es.po: Updated Spanish translation.
2423 2011-08-01 Cary Coutant <ccoutant@google.com>
2425 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2426 * gold/testsuite/Makefile.in: Regenerate.
2427 * gold/testsuite/justsyms_exec.c: New source file.
2428 * gold/testsuite/justsyms_lib.c: New source file.
2430 2011-08-01 Cary Coutant <ccoutant@google.com>
2432 * layout.cc (Layout::set_segment_offsets): Don't realign text
2433 segment if -Ttext was specified.
2434 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2436 * object.h (Sized_relobj_file::e_type): New function.
2437 (Sized_relobj_file::e_type_): New data member.
2438 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2439 base address for ET_EXEC files.
2440 * target.cc (Target::do_make_elf_object_implementation): Allow
2441 ET_EXEC files with --just-symbols option.
2443 2011-07-28 Cary Coutant <ccoutant@google.com>
2445 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2446 Add thread_number parameter.
2447 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2448 * workqueue-threads.cc
2449 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2450 current thread if its thread number is greater than desired thread
2452 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2453 Add thread_number parameter.
2454 (Workqueue::should_cancel_thread): Likewise.
2455 (Workqueue::find_runnable_or_wait): Pass thread_number to
2456 should_cancel_thread.
2457 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2460 2011-07-22 Sriraman Tallam <tmsriram@google.com>
2462 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2463 only after checking if it cannot be forced local.
2464 * symtab.h (is_externally_visible): Check if the symbol is not forced
2467 2011-07-15 Ian Lance Taylor <iant@google.com>
2469 * options.h (class General_options): Add --print-output-format.
2470 Move -EL next to -EB, for better --help output.
2471 * target-select.cc: Include <cstdio>, "options.h", and
2473 (Target_selector::do_target_bfd_name): New function.
2474 (print_output_format): New function.
2475 * target-select.h (class Target_selector): Update declarations.
2476 (Target_selector::target_bfd_name): New function.
2477 (print_output_format): Declare.
2478 * main.cc: Include "target-select.h".
2479 (main): Handle --print-output-format.
2480 * gold.cc: Include "target-select.h".
2481 (queue_initial_tasks): Handle --print-output-format when there are
2483 * parameters.cc (parameters_force_valid_target): Give a better
2484 error message if -EB/-EL does not match target.
2485 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2488 2011-07-15 Ian Lance Taylor <iant@google.com>
2490 * i386.cc (class Output_data_plt_i386): Add layout_ field.
2491 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2492 (Output_data_plt_i386::do_write): Write address of .dynamic
2493 section to first entry in .got.plt section.
2494 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2495 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2497 (Output_data_plt_x86_64::do_write): Write address of .dynamic
2498 section to first entry in .got.plt section.
2499 * layout.h (Layout::dynamic_section): New function.
2501 2011-07-13 Sriraman Tallam <tmsriram@google.com>
2503 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2505 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2506 input_section_position_, and input_section_glob_.
2507 (read_layout_from_file): Call function section_ordering_specified.
2508 * layout.h (is_section_ordering_specified): New function.
2509 (section_ordering_specified): New function.
2510 (section_ordering_specified_): New boolean member.
2511 * main.cc(main): Call load_plugins after layout object is defined.
2512 * output.cc (Output_section::add_input_section): Use
2513 function section_ordering_specified to check if section ordering is
2515 * output.cc (Output_section::add_relaxed_input_section): Use
2516 function section_ordering_specified to check if section ordering is
2518 (Output_section::update_section_layout): New function.
2519 (Output_section::sort_attached_input_sections): Check if input section
2521 * output.h (Output_section::update_section_layout): New function.
2522 * plugin.cc (get_section_count): New function.
2523 (get_section_type): New function.
2524 (get_section_name): New function.
2525 (get_section_contents): New function.
2526 (update_section_order): New function.
2527 (allow_section_ordering): New function.
2528 (Plugin::load): Add the new interfaces to the transfer vector.
2529 (Plugin_manager::load_plugins): New parameter.
2530 (Plugin_manager::all_symbols_read): New parameter.
2531 (Plugin_manager::claim_file): New parameter. Save the elf object for
2533 (Plugin_manager::get_elf_object): New function.
2534 (Plugin_manager::get_view): Change to directly use the bool to check
2535 if get_view is called from claim_file_hook.
2536 * plugin.h (input_objects): New function
2537 (Plugin__manager::load_plugins): New parameter.
2538 (Plugin_manager::claim_file): New parameter.
2539 (Plugin_manager::get_elf_object): New function.
2540 (Plugin_manager::in_claim_file_handler): New function.
2541 (Plugin_manager::in_claim_file_handler_): New member.
2542 (layout): New function.
2543 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2544 handler with an extra parameter. Make the elf object before calling
2546 * testsuite/plugin_test.c (get_section_count): New function pointer.
2547 (get_section_type): New function pointer.
2548 (get_section_name): New function pointer.
2549 (get_section_contents): New function pointer.
2550 (update_section_order): New function pointer.
2551 (allow_section_ordering): New function pointer.
2552 (onload): Check if the new interfaces exist.
2554 2011-07-13 Ian Lance Taylor <iant@google.com>
2556 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2558 * x86_64.cc (Target_x86_64::got_section): Likewise.
2559 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2560 (relro_now_test_SOURCES): New variable.
2561 (relro_now_test_DEPENDENCIES): New variable.
2562 (relro_now_test_LDFLAGS): New variable.
2563 (relro_now_test_LDADD): New variable.
2564 (relro_now_test.so): New target.
2565 * testsuite/Makefile.in: Rebuild.
2567 2011-07-12 Ian Lance Taylor <iant@google.com>
2570 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2571 GLOB_DAT relocation rather than a RELATIVE relocation for a
2572 protected symbol when creating a shared library.
2573 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2574 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2575 * testsuite/protected_main_1.cc (main): Test that protected
2576 function has same address.
2578 2011-07-11 Ian Lance Taylor <iant@google.com>
2581 * options.h (class General_options): Add -Bgroup.
2582 * options.cc (General_options::finalize): If -Bgroup is set,
2583 default to --unresolved-symbols=report-all.
2584 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2585 * target-reloc.h (issue_undefined_symbol_error): Handle
2586 --unresolved-symbols=report-all.
2588 2011-07-08 Ian Lance Taylor <iant@google.com>
2591 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2592 if linker script discards key sections.
2593 (Layout::create_dynamic_symtab): Likewise.
2594 (Layout::assign_local_dynsym_offsets): Likewise.
2595 (Layout::sized_create_version_sections): Likewise.
2596 (Layout::create_interp): Likewise.
2597 (Layout::finish_dynamic_section): Likewise.
2598 (Layout::set_dynamic_symbol_size): Likewise.
2600 2011-07-08 Ian Lance Taylor <iant@google.com>
2603 * options.h (class General_options): Add --unresolved-symbols.
2604 * target-reloc.h (issue_undefined_symbol_error): Check
2605 --unresolved-symbols. Add comments.
2607 2011-07-08 Ian Lance Taylor <iant@google.com>
2609 * testsuite/odr_violation2.cc (Ordering::operator()): Make
2610 expression more complex.
2612 2011-07-08 Ian Lance Taylor <iant@google.com>
2615 * target-reloc.h (issue_undefined_symbol_error): New inline
2616 function, broken out of relocate_section.
2617 (relocate_section): Call issue_undefined_symbol_error.
2618 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2619 there is no TLS segment if we are about to issue an undefined
2621 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2623 2011-07-08 Ian Lance Taylor <iant@google.com>
2626 * resolve.cc (Symbol_table::should_override): Add fromtype
2627 parameter. Change all callers. Give error when linking together
2628 TLS and non-TLS symbol.
2629 (Symbol_table::should_override_with_special): Add fromtype
2630 parameter. Change all callers.
2631 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2632 there is no TLS segment if we have reported some errors.
2633 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2635 2011-07-08 Ian Lance Taylor <iant@google.com>
2638 * target.h (Target::plt_address_for_global): New function.
2639 (Target::plt_address_for_local): New function.
2640 (Target::plt_section_for_global): Remove.
2641 (Target::plt_section_for_local): Remove.
2642 (Target::do_plt_address_for_global): New virtual function.
2643 (Target::do_plt_address_for_local): New virtual function.
2644 (Target::do_plt_section_for_global): Remove.
2645 (Target::do_plt_section_for_local): Remove.
2646 (Target::register_global_plt_entry): Add Symbol_table and Layout
2648 * output.cc (Output_data_got::Got_entry::write): Use
2649 plt_address_for_global and plt_address_for_local.
2650 * layout.cc (Layout::add_target_dynamic_tags): Use size and
2651 address of output section.
2652 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2653 got_irelative_, and irelative_count_ fields. Update
2655 (Output_data_plt_i386::has_irelative_section): New function.
2656 (Output_data_plt_i386::entry_count): Add irelative_count_.
2657 (Output_data_plt_i386::set_final_data_size): Likewise.
2658 (class Target_i386): Add got_irelative_ and rel_irelative_
2659 fields. Update declarations.
2660 (Target_i386::Target_i386): Initialize new fields.
2661 (Target_i386::do_plt_address_for_global): New function replacing
2662 do_plt_section_for_global.
2663 (Target_i386::do_plt_address_for_local): New function replacing
2664 do_plt_section_for_local.
2665 (Target_i386::got_section): Create got_irelative_.
2666 (Target_i386::rel_irelative_section): New function.
2667 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2668 fields. Don't define __rel_iplt_{start,end}.
2669 (Output_data_plt_i386::add_entry): Add symtab and layout
2670 parameters. Change all callers. Use different PLT and GOT for
2672 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2673 layout parameters. Change all callers. Use different PLT and
2675 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2676 (Output_data_plt_i386::rel_irelative): New function.
2677 (Output_data_plt_i386::address_for_global): New function.
2678 (Output_data_plt_i386::address_for_local): New function.
2679 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
2680 IRELATIVE GOT when changing IFUNC GOT entries.
2681 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2683 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2684 if we didn't create an IRELATIVE GOT.
2685 (Target_i386::Relocate::relocate): Use plt_address_for_global and
2686 plt_address_for_local.
2687 (Target_i386::do_dynsym_value): Use plt_address_for_global.
2688 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2689 got_irelative_, and irelative_count_ fields. Update
2691 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2692 Initialize new fields. Remove symtab parameter. Change all
2694 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2696 (Output_data_plt_x86_64::has_irelative_section): New function.
2697 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2698 (class Target_x86_64): Add got_irelative_ and rel_irelative_
2699 fields. Update declarations.
2700 (Target_x86_64::Target_x86_64): Initialize new fields.
2701 (Target_x86_64::do_plt_address_for_global): New function replacing
2702 do_plt_section_for_global.
2703 (Target_x86_64::do_plt_address_for_local): New function replacing
2704 do_plt_section_for_local.
2705 (Target_x86_64::got_section): Create got_irelative_.
2706 (Target_x86_64::rela_irelative_section): New function.
2707 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
2708 all callers. Don't create __rel_iplt_{start,end}.
2709 (Output_data_plt_x86_64::add_entry): Add symtab and layout
2710 parameters. Change all callers. Use different PLT and GOT for
2712 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2713 layout parameters. Change all callers. Use different PLT and
2715 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2716 parameters. Change all callers. Use different PLT and GOT for
2718 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2719 (Output_data_plt_x86_64::rela_irelative): New function.
2720 (Output_data_plt_x86_64::address_for_global): New function.
2721 (Output_data_plt_x86_64::address_for_local): New function.
2722 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2723 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2724 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2725 (Target_x86_64::register_global_plt_entry): Add symtab and layout
2727 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2729 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2730 symbols if we didn't create an IRELATIVE GOT.
2731 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2732 plt_address_for_local.
2733 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2734 * testsuite/ifuncvar1.c: New test file.
2735 * testsuite/ifuncvar2.c: New test file.
2736 * testsuite/ifuncvar3.c: New test file.
2737 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2738 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2739 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2740 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2741 * testsuite/Makefile.in: Rebuild.
2743 2011-07-07 Cary Coutant <ccoutant@google.com>
2745 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2746 (two_file_test_1_ndebug.o): Likewise.
2747 (two_file_test_1b_ndebug.o): Likewise.
2748 (two_file_test_2_ndebug.o): Likewise.
2749 (two_file_test_main_ndebug.o): Likewise.
2750 (incremental_test_2): Link with no-debug versions.
2752 2011-07-06 Cary Coutant <ccoutant@google.com>
2754 * gold/incremental.cc
2755 (Output_section_incremental_inputs::write_info_blocks): Check for
2756 hidden and internal symbols.
2758 2011-07-06 Cary Coutant <ccoutant@google.com>
2760 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2761 Check disposition for startup file.
2762 (Incremental_inputs::report_command_line): Ignore
2763 --incremental-startup-unchanged option.
2764 * options.cc (General_options::parse_incremental_startup_unchanged):
2766 (General_options::General_options): Initialize new data member.
2767 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2768 (General_options): Add --incremental-startup-unchanged option.
2769 (General_options::incremental_startup_disposition): New function.
2770 (General_options::incremental_startup_disposition_): New data member.
2772 2011-07-06 Cary Coutant <ccoutant@google.com>
2774 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2775 input file index to Script_info ctor.
2776 (Sized_incremental_binary::do_file_has_changed): Find the
2777 command-line argument for files named in scripts.
2778 * incremental.h (Script_info::Script_info): New ctor
2779 with input file index.
2780 (Script_info::input_file_index): New function.
2781 (Script_info::input_file_index_): New data member.
2782 (Incremental_binary::get_library): Add const.
2783 (Incremental_binary::get_script_info): Add const.
2784 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2785 * testsuite/Makefile.am (incremental_test_5): New test case.
2786 (incremental_test_6): New test case.
2787 * testsuite/Makefile.in: Regenerate.
2789 2011-07-06 Cary Coutant <ccoutant@google.com>
2791 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2792 debug output when command lines differ.
2794 2011-07-06 Cary Coutant <ccoutant@google.com>
2796 * incremental.cc (Incremental_inputs::report_command_line): Ignore
2797 --incremental-patch option.
2798 * layout.cc (Free_list::allocate): Extend allocation beyond original
2800 (Layout::make_output_section): Mark sections that should get
2802 * options.cc (parse_percent): New function.
2803 * options.h (parse_percent): New function.
2804 (DEFINE_percent): New macro.
2805 (General_options): Add --incremental-patch option.
2806 * output.cc (Output_section::Output_section): Initialize new data
2808 (Output_section::add_input_section): Print section name when out
2810 (Output_section::add_output_section_data): Likewise.
2811 (Output_section::set_final_data_size): Add patch space when
2812 doing --incremental-full.
2813 (Output_section::do_reset_address_and_file_offset): Remove patch
2815 (Output_segment::set_section_list_addresses): Print debug output
2816 only if --incremental-update.
2817 * output.h (Output_section::set_is_patch_space_allowed): New function.
2818 (Output_section::is_patch_space_allowed_): New data member.
2819 (Output_section::patch_space_): New data member.
2820 * parameters.cc (Parameters::incremental_full): New function.
2821 * parameters.h (Parameters::incremental_full): New function
2822 * testsuite/Makefile.am (incremental_test_2): Add test for
2823 --incremental-patch option.
2824 * testsuite/Makefile.in: Regenerate.
2825 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2826 (t18): Remove function body.
2828 2011-07-05 Doug Kwan <dougkwan@google.com>
2831 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2832 Arm_Address type for relocation result.
2833 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
2835 (Arm_relocate_functions::abs32): Use unaligned access.
2836 (Arm_relocate_functions::rel32): Ditto.
2837 (Arm_relocate_functions::prel31): Ditto.
2838 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2839 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2840 static data relocations.
2841 * testsuite/Makefile.in: Regnerate.
2842 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2844 2011-07-05 Ian Lance Taylor <iant@google.com>
2847 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2848 symbols if necessary.
2849 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2851 2011-07-05 Ian Lance Taylor <iant@google.com>
2854 * resolve.cc (Symbol::override_base_with_special): Simply override
2855 version with special symbol version, ignoring previous version.
2857 2011-07-05 Ian Lance Taylor <iant@google.com>
2859 * object.cc (Sized_relobj_file::include_section_group): Add
2860 information to comment about signature location.
2862 2011-07-02 Ian Lance Taylor <iant@google.com>
2865 * options.h (class General_options): Add -f and -F.
2866 * options.cc (General_options::finalize): Fatal error if -f/-F
2867 are used without -shared.
2868 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2870 2011-07-02 Ian Lance Taylor <iant@google.com>
2872 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2874 2011-07-01 Ian Lance Taylor <iant@google.com>
2878 * resolve.cc (Symbol::override_base_with_special): Don't override
2879 the version if the overriding symbol has a different name.
2880 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
2881 all callers. If we give an error about an undefined version,
2882 define the base version if necessary.
2883 * dynobj.h (class Versions): Update declaration.
2884 * testsuite/weak_alias_test_5.cc: New file.
2885 * testsuite/weak_alias_test.script: New file.
2886 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2887 and versioned_alias have the right value, and call t2.
2888 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2889 weak_alias_test_5.so.
2890 (weak_alias_test_LDADD): Likewise.
2891 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2892 * testsuite/Makefile.in: Rebuild.
2894 2011-07-01 Ian Lance Taylor <iant@google.com>
2897 * options.h (class General_options): Support -z notext.
2898 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2900 (two_file_shared_nonpic.so): Likewise.
2901 (two_file_shared_mixed.so): Likewise.
2902 (two_file_shared_mixed_1.so): Likewise.
2903 (weak_undef_lib_nonpic.so): Likewise.
2904 (alt/weak_undef_lib_nonpic.so): Likewise.
2905 (tls_test_shared_nonpic.so): Likewise.
2906 * testsuite/Makefile.in: Rebuild.
2908 2011-07-01 Ian Lance Taylor <iant@google.com>
2911 * configure.ac: Test whether static linking works, setting
2912 the automake conditional HAVE_STATIC.
2913 * testsuite/Makefile.am: Disable tests using -static if
2914 HAVE_STATIC is not true.
2915 * configure, testsuite/Makefile.in: Rebuild.
2917 2011-07-01 Ian Lance Taylor <iant@google.com>
2920 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2921 Assert if we see DW_EH_PE_indirect.
2922 * target.h (Target::ehframe_datarel_base): New function.
2923 (Target::do_ehframe_datarel_base): New target function.
2924 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2925 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2928 2011-07-01 Ian Lance Taylor <iant@google.com>
2931 * options.h (class General_options): Add
2932 --ld-generated-unwind-info.
2933 * ehframe.cc (Fde::write): Add address parameter. Change all
2934 callers. If associated with PLT, fill in address and size.
2935 (Cie::set_output_offset): Only add merge mapping if there is an
2937 (Cie::write): Add address parameter. Change all callers.
2938 (Eh_frame::add_ehframe_for_plt): New function.
2939 * ehframe.h (class Fde): Update declarations. Move shndx_ and
2940 input_offset_ fields into union u_, with new plt field.
2941 (Fde::Fde): Adjust for new union field.
2942 (Fde::Fde) [Output_data version]: New constructor.
2943 (Fde::add_mapping): Only add merge mapping if there is an object.
2944 (class Cie): Update declarations.
2945 (class Eh_frame): Declare add_ehframe_for_plt.
2946 * layout.cc (Layout::layout_eh_frame): Break out code into
2947 make_eh_frame_section, and call it.
2948 (Layout::make_eh_frame_section): New function.
2949 (Layout::add_eh_frame_for_plt): New function.
2950 * layout.h (class Layout): Update declarations.
2951 * merge.cc (Merge_map::add_mapping): Add assertion.
2952 * i386.cc: Include "dwarf.h".
2953 (class Output_data_plt_i386): Make first_plt_entry,
2954 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
2955 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2956 and plt_eh_frame_fde.
2957 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2958 boundary. Call add_eh_frame_for_plt if appropriate.
2959 * x86_64.cc: Include "dwarf.h".
2960 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
2961 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
2962 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2963 and plt_eh_frame_fde.
2964 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2967 2011-06-29 Ian Lance Taylor <iant@google.com>
2970 * object.cc (Sized_relobj_file::layout_section): Change shdr
2971 parameter to be const.
2972 (Sized_relobj_file::layout_eh_frame_section): New function, broken
2974 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2975 appropriate. Call layout_eh_frame_section.
2976 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2978 * object.h (class Sized_relobj_file): Update declarations.
2980 2011-06-29 Ian Lance Taylor <iant@google.com>
2983 * script.cc (Token::integer_value): Accept trailing M/m/K/k
2985 (Lex::gather_token): Accept trailing M/m/K/k for integers.
2987 2011-06-29 Ian Lance Taylor <iant@google.com>
2990 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2992 * layout.cc (Layout::layout_eh_frame): Likewise.
2994 2011-06-29 Ian Lance Taylor <iant@google.com>
2997 * layout.cc (Layout::symtab_section_shndx): New function.
2998 * layout.h (class Layout): Declare symtab_section_shndx.
2999 * output.cc (Output_section::write_header): Call it.
3001 2011-06-29 Ian Lance Taylor <iant@google.com>
3004 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3005 symbols which are not used in a relocation.
3007 2011-06-28 Ian Lance Taylor <iant@google.com>
3010 * layout.cc (Layout::segment_precedes): Don't crash if a linker
3011 script create indistinguishable segments.
3012 (Layout::set_segment_offsets): Use stable_sort when sorting
3013 segments. Pass this to Compare_segments constructor.
3014 * layout.h (class Layout): Make segment_precedes non-static.
3015 (class Compare_segments): Change from struct to class. Add
3016 layout_ field. Add constructor.
3017 * script-sections.cc
3018 (Script_sections::attach_sections_using_phdrs_clause): Rename
3019 local orphan to is_orphan. Don't report failure to put empty
3020 section in segment. On attachment failure, report name of
3021 section, and attach to first PT_LOAD segment.
3023 2011-06-28 Ian Lance Taylor <iant@google.com>
3026 * target-select.cc (Target_selector::Target_selector): Add
3027 emulation parameter. Change all callers.
3028 (select_target_by_bfd_name): Rename from select_target_by_name.
3030 (select_target_by_emulation): New function.
3031 (supported_emulation_names): New function.
3032 * target-select.h (class Target_selector): Add emulation_ field.
3033 Update declarations.
3034 (Target_selector::recognize_by_bfd_name): Rename from
3035 recognize_by_name. Change all callers.
3036 (Target_selector::supported_bfd_names): Rename from
3037 supported_names. Change all callers.
3038 (Target_selector::recognize_by_emulation): New function.
3039 (Target_selector::supported_emulations): New function.
3040 (Target_selector::emulation): New function.
3041 (Target_selector::do_recognize_by_bfd_name): Rename from
3042 do_recognize_by_name. Change all callers.
3043 (Target_selector::do_supported_bfd_names): Rename from
3044 do_supported_names. Change all callers.
3045 (Target_selector::do_recognize_by_emulation): New function.
3046 (Target_selector::do_supported_emulations): New function.
3047 (select_target_by_bfd_name): Change name in declaration.
3048 (select_target_by_emulation): Declare.
3049 (supported_emulation_names): Declare.
3050 * parameters.cc (parameters_force_valid_target): Try to find
3051 target based on emulation from -m option.
3052 * options.h (class General_options): Change doc string for -m.
3053 * options.cc (help): Print emulations.
3054 (General_options::parse_V): Likewise.
3055 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3056 Add emulation parameter. Change all callers.
3058 2011-06-28 Ian Lance Taylor <iant@google.com>
3060 * target.h (class Target): Add osabi_ field.
3061 (Target::osabi): New function.
3062 (Target::set_osabi): New function.
3063 (Target::Target): Initialize osabi_.
3064 (Target::do_adjust_elf_header): Make pure virtual.
3065 (Sized_target::do_adjust_elf_header): Declare.
3066 * target.cc (Sized_target::do_adjust_elf_header): New function.
3067 (class Sized_target): Instantiate all versions.
3068 * freebsd.h (class Target_freebsd): Remove.
3069 (Target_selector_freebsd::do_recognize): Call set_osabi on
3071 (Target_selector_freebsd::do_recognize_by_name): Likewise.
3072 (Target_selector_freebsd::set_osabi): Remove.
3073 * i386.cc (class Target_i386): Inherit from Sized_target rather
3074 than Target_freebsd.
3075 * x86_64.cc (class Target_x86_64): Likewise.
3077 2011-06-28 Ian Lance Taylor <iant@google.com>
3079 * target.h (Target::can_check_for_function_pointers): Rewrite.
3081 (Target::can_icf_inline_merge_sections): Likewise.
3082 (Target::section_may_have_icf_unsafe_poineters): Likewise.
3083 (Target::Target_info): Add can_icf_inline_merge_sections field.
3084 (Target::do_can_check_for_function_pointers): New virtual
3086 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3087 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3088 from can_check_for_function_pointers, move in file.
3089 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3090 section_may_have_icf_unsafe_poineters, move in file.
3091 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3092 * i386.cc (Target_i386::do_can_check_for_function_pointers):
3093 Rename from can_check_for_function_pointers, move in file.
3094 (Target_i386::can_icf_inline_merge_sections): Remove.
3095 (Target_i386::i386_info): Initialize
3096 can_icf_inline_merge_sections.
3097 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3098 Initialize can_icf_inline_merge_sections.
3099 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3100 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3101 Rename from can_check_for_function_pointers, move in file.
3102 (Target_x86_64::can_icf_inline_merge_sections): Remove.
3103 (Target_x86_64::x86_64_info): Initialize
3104 can_icf_inline_merge_sections.
3105 * testsuite/testfile.cc (Target_test::test_target_info):
3107 * icf.cc (get_section_contents): Correct formatting.
3109 2011-06-27 Ian Lance Taylor <iant@google.com>
3111 * symtab.cc (Symbol::versioned_name): New function.
3112 (Symbol_table::add_to_final_symtab): Use versioned_name when
3114 (Symbol_table::sized_write_symbol): Likewise.
3115 * symtab.h (class Symbol): Declare versioned_name.
3116 * stringpool.h (class Stringpool_template): Add variant of add
3117 which takes a std::basic_string.
3118 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3119 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3120 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3121 (ver_test_12.o): New target.
3122 * testsuite/Makefile.in: Rebuild.
3124 2011-06-27 Doug Kwan <dougkwan@google.com>
3126 * arm.cc (Arm_relocate_functions::thm_jump8,
3127 Arm_relocate_functions::thm_jump11): Use a wider signed
3128 type to compute offset.
3129 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3131 * testsuite/Makefile.in: Regenerate.
3132 * testsuite/arm_branch_in_range.sh: Check test results of
3133 arm_thm_jump11 and arm_thm_jump8.
3134 * testsuite/arm_thm_jump11.s: New test source file.
3135 * testsuite/arm_thm_jump11.t: New linker script.
3136 * testsuite/arm_thm_jump8.s: New test source file.
3137 * testsuite/arm_thm_jump8.t: New linker script.
3139 2011-06-24 Ian Lance Taylor <iant@google.com>
3141 * layout.cc: Include "object.h".
3142 (ctors_sections_in_init_array): New static variable.
3143 (Layout::is_ctors_in_init_array): New function.
3144 (Layout::layout): Add entry to ctors_sections_in_init_array if
3146 * layout.h (class Layout): Declare is_ctors_in_init_array.
3147 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3148 is_ctors_reverse_view is set.
3149 (Sized_relobj_file::write_sections): Add layout parameter. Change
3150 all callers. Set is_ctors_reverse_view field of View_size.
3151 (Sized_relobj_file::reverse_words): New function.
3152 * object.h (Sized_relobj_file::View_size): Add
3153 is_ctors_reverse_view field.
3154 (class Sized_relobj_file): Update declarations.
3155 * testsuite/initpri3.c: New test.
3156 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3158 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3159 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3160 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3161 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3162 * testsuite/Makefile.in: Rebuild.
3164 2011-06-24 Cary Coutant <ccoutant@google.com>
3166 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3167 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3168 (debug_msg_cdebug.err): New targets.
3169 * testsuite/Makefile.in: Regenerate.
3170 * testsuite/debug_msg.sh: Check output of link with compressed debug.
3171 Fix checks for link with shared library.
3173 2011-06-24 Doug Kwan <dougkwan@google.com>
3175 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3176 skip empty text sections.
3177 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3179 2011-06-22 Ian Lance Taylor <iant@google.com>
3182 * options.h (class General_options): Add --ctors-in-init-array.
3183 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3184 friends as SHT_PROGBITS for merging sections.
3185 (Layout::layout): Remove special handling of .init_array and
3186 friends. Don't sort if doing relocatable link. Sort for .ctors
3187 and .dtors if ctors_in_init_array.
3188 (Layout::make_output_section): Force correct section types for
3189 .init_array and friends. Don't sort if doing relocatable link,
3190 Don't sort .ctors and .dtors if ctors_in_init_array.
3191 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3192 (Layout::output_section_name): Add relobj parameter. Change all
3193 callers. Handle .ctors. and .dtors. in code rather than table.
3194 Handle .ctors and .dtors if ctors_in_init_array.
3195 (Layout::match_file_name): New function, moved from output.cc.
3196 * layout.h (class Layout): Update declarations.
3197 * output.cc: Include "layout.h".
3198 (Input_section_sort_entry::get_priority): New function.
3199 (Input_section_sort_entry::match_file_name): Just call
3200 Layout::match_file_name.
3201 (Output_section::Input_section_sort_init_fini_compare::operator()):
3202 Handle .ctors and .dtors. Sort by explicit priority rather than
3204 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3205 * testsuite/initpri2.c: New test.
3206 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3207 (check_PROGRAMS): Add initpri2.
3208 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3209 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3210 * configure, testsuite/Makefile.in: Rebuild.
3212 2011-06-19 Ian Lance Taylor <iant@google.com>
3215 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3216 .interp section to a PT_INTERP segment even if we have seen a
3217 --dynamic-linker option. Don't do it if we have seen a PHDRS
3218 clause in a linker script.
3219 (Layout::finalize): Don't create a .interp section if we've
3220 already create a PT_INTERP segment.
3221 (Layout::create_interp): Always call choose_output_section (revert
3222 patch of 2011-06-17). Don't create PT_INTERP segment.
3223 * script-sections.cc
3224 (Script_sections::create_note_and_tls_segments): Add a .interp
3225 section to a PT_INTERP segment even if we have seen a
3226 --dynamic-linker option.
3228 2011-06-18 Ian Lance Taylor <iant@google.com>
3230 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3231 merely because a non-PT_LOAD segment has a dynamic reloc.
3233 2011-06-18 Ian Lance Taylor <iant@google.com>
3235 * layout.cc (Layout::finish_dynamic_section): Don't create
3236 DT_FLAGS entry if not needed.
3238 2011-06-18 Ian Lance Taylor <iant@google.com>
3241 * layout.cc (Layout::layout_eh_frame): Correct handling of
3242 writable .eh_frame section.
3244 2011-06-17 Ian Lance Taylor <iant@google.com>
3247 * resolve.cc (Symbol_table::resolve): Don't give an error if a
3248 symbol is redefined with the exact same object and value.
3250 2011-06-17 Ian Lance Taylor <iant@google.com>
3253 * layout.h (class Layout): Add interp_segment_ field.
3254 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3255 (Layout::attach_allocated_section_to_segment): If making shared
3256 library, put .interp section in PT_INTERP segment.
3257 (Layout::finalize): Also call create_interp if -dynamic-linker
3259 (Layout::create_interp): Assert that there is no PT_INTERP
3260 segment. If not using a SECTIONS clause, use make_output_section.
3261 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3262 * script-sections.cc
3263 (Script_sections::create_note_and_tls_segments): If making shared
3264 library, put .interp section in PT_INTERP segment.
3266 2011-06-17 Ian Lance Taylor <iant@google.com>
3268 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3269 when making a shared library.
3271 2011-06-17 Ian Lance Taylor <iant@google.com>
3273 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3274 parameter. Change all callers. Don't issue warning about PC32
3275 against locally defined symbol.
3277 2011-06-16 Ian Lance Taylor <iant@google.com>
3279 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3280 occurs in same object.
3282 2011-06-14 Alan Modra <amodra@gmail.com>
3284 * po/POTFILES.in: Regenerate.
3286 2011-06-09 Ian Lance Taylor <iant@google.com>
3288 * script-sections.cc
3289 (Orphan_output_section::set_section_addresses): For a relocatable
3290 link set address to 0.
3292 2011-06-09 Cary Coutant <ccoutant@google.com>
3295 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3296 used with --compress-debug-sections.
3297 * gold/object.cc (Sized_relobj_file::do_layout): Report
3298 uncompressed size of compressed input sections.
3300 2011-06-08 Cary Coutant <ccoutant@google.com>
3303 * testsuite/two_file_test_2_v1.cc: Change initialization of
3304 v2 to keep it in .data.
3306 2011-06-07 Cary Coutant <ccoutant@google.com>
3308 * common.cc (Symbol_table::do_allocate_commons_list): Call
3310 * errors.cc (Errors::fatal): Adjust call to gold_exit.
3311 (Errors::fallback): New function.
3312 (gold_fallback): New function.
3313 * errors.h (Errors::fallback): New function.
3314 * gold.cc (gold_exit): Change status parameter to enum; adjust
3316 (queue_initial_tasks): Call gold_fallback.
3317 * gold.h: Include cstdlib.
3318 (Exit_status): New enum type.
3319 (gold_exit): Change status parameter to enum.
3320 (gold_fallback): New function.
3321 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3322 (Layout::create_symtab_sections): Likewise.
3323 (Layout::create_shdrs): Likewise.
3324 * main.cc (main): Adjust call to gold_exit.
3325 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3326 (Output_data_got::add_got_entry_pair): Likewise.
3327 (Output_section::add_input_section): Likewise.
3328 (Output_section::add_output_section_data): Likewise.
3329 (Output_segment::set_section_list_addresses): Likewise.
3330 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3332 2011-06-07 Cary Coutant <ccoutant@google.com>
3334 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3335 for incremental links.
3336 * output.cc (Output_segment::set_section_list_addresses): Remove
3337 FIXME and test for TLS or BSS.
3339 2011-06-07 Cary Coutant <ccoutant@google.com>
3341 * testsuite/Makefile.am: Add incremental_copy_test,
3342 incremental_common_test_1.
3343 * testsuite/Makefile.in: Regenerate.
3344 * testsuite/common_test_1_v1.c: New source file.
3345 * testsuite/common_test_1_v2.c: New source file.
3346 * testsuite/copy_test_v1.cc: New source file.
3348 2011-06-07 Cary Coutant <ccoutant@google.com>
3350 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3351 update, allocate common from bss section's free list.
3352 * incremental-dump.cc (dump_incremental_inputs): Print flag for
3353 linker-defined symbols.
3354 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3355 Skip GOT and PLT entries that are no longer referenced.
3356 (Output_section_incremental_inputs::write_info_blocks): Mark
3357 linker-defined symbols.
3358 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3359 * output.cc (Output_section::allocate): New function.
3360 * output.h (Output_section::allocate): New function.
3361 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3362 linker-defined symbols.
3363 (Symbol::override_base_with_special): Copy is_predefined_ flag.
3364 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3365 (Symbol::init_base_output_data): Likewise.
3366 (Symbol::init_base_output_segment): Likewise.
3367 (Symbol::init_base_constant): Likewise.
3368 (Sized_symbol::init_output_data): Likewise.
3369 (Sized_symbol::init_output_segment): Likewise.
3370 (Sized_symbol::init_constant): Likewise.
3371 (Symbol_table::do_define_in_output_data): Likewise.
3372 (Symbol_table::do_define_in_output_segment): Likewise.
3373 (Symbol_table::do_define_as_constant): Likewise.
3374 * symtab.h (Symbol::is_predefined): New function.
3375 (Symbol::init_base_output_data): Add is_predefined parameter.
3376 (Symbol::init_base_output_segment): Likewise.
3377 (Symbol::init_base_constant): Likewise.
3378 (Symbol::is_predefined_): New data member.
3379 (Sized_symbol::init_output_data): Add is_predefined parameter.
3380 (Sized_symbol::init_output_segment): Likewise.
3381 (Sized_symbol::init_constant): Likewise.
3382 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3384 2011-06-07 Cary Coutant <ccoutant@google.com>
3386 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3387 instead of emit_copy_reloc.
3388 (Copy_relocs::emit_copy_reloc): Refactor.
3389 (Copy_relocs::make_copy_reloc): New function.
3390 (Copy_relocs::add_copy_reloc): Remove.
3391 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3393 (Copy_relocs::make_copy_reloc): New function.
3394 (Copy_relocs::add_copy_reloc): Remove.
3395 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3396 unchanged input files.
3397 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3398 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3399 Reserve BSS space for COPY relocations.
3400 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3401 (Output_section_incremental_inputs::write_info_blocks): Record
3402 whether a symbol is copied from a shared object.
3403 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3404 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3405 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3406 (Incremental_input_entry_reader::get_output_symbol_index): Add
3408 (Incremental_binary::emit_copy_relocs): New function.
3409 (Incremental_binary::do_emit_copy_relocs): New function.
3410 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3412 (Sized_incremental_binary::add_copy_reloc): New function.
3413 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3414 (Sized_incremental_binary::Copy_reloc): New struct.
3415 (Sized_incremental_binary::Copy_relocs): New typedef.
3416 (Sized_incremental_binary::copy_relocs_): New data member.
3417 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3418 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3419 * target.h (Sized_target::emit_copy_reloc): New function.
3420 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3422 2011-06-02 Cary Coutant <ccoutant@google.com>
3425 * gold/archive.cc (Archive::Archive): Initialize new data member.
3426 (Archive::include_all_members): Return if archive has already been
3428 * gold/archive.h (Archive::include_all_members_): New data member.
3430 2011-06-02 Nick Clifton <nickc@redhat.com>
3432 * dynobj.h: Fix spelling mistake in comment.
3433 * output.cc: Likewise.
3435 2011-05-31 Doug Kwan <dougkwan@google.com>
3439 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3440 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3441 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
3442 redundant arm_exidx_test.so.
3443 * testsuite/Makefile.in: Regenerate.
3444 (check_SCRIPTS): Add pr12826.sh
3445 (check_DATA): Add pr12826.stdout
3446 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3447 * testsuite/pr12826.sh: New file.
3448 * testsuite/pr12826_1.s: Ditto.
3449 * testsuite/pr12826_1.s: Ditto.
3451 2011-05-30 Ian Lance Taylor <iant@google.com>
3453 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3456 2011-05-29 Ian Lance Taylor <iant@google.com>
3459 * testsuite/Makefile.am: Use different file name for two_file_test
3460 temporary file for each incremental test.
3461 * testsuite/Makefile.in: Rebuild.
3463 2011-05-29 Ian Lance Taylor <iant@google.com>
3465 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3466 binary input file is empty.
3468 2011-05-27 Ian Lance Taylor <iant@google.com>
3470 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3471 (ver_test_9.so): Likewise.
3472 * testsuite/Makefile.in: Rebuild.
3474 2011-05-26 Cary Coutant <ccoutant@google.com>
3476 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3477 * incremental.cc (Incremental_inputs::report_input_section): Fix
3478 comment, indentation.
3479 (Incremental_inputs::report_comdat_group): New function.
3480 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3481 of data for incremental input file entry.
3482 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3483 group count, COMDAT group signatures.
3484 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3485 an unchanged input file.
3486 * incremental.h (Incremental_object_entry::Incremental_object_entry):
3487 Initialize new data member.
3488 (Incremental_object_entry::add_comdat_group): New function.
3489 (Incremental_object_entry::get_comdat_group_count): New function.
3490 (Incremental_object_entry::get_comdat_signature_key): New function.
3491 (Incremental_object_entry::groups_): New data member.
3492 (Incremental_inputs::report_comdat_group): New function.
3493 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3494 data for incremental input file entry.
3495 (Incremental_input_entry_reader::get_comdat_group_count): New function.
3496 (Incremental_input_entry_reader::get_input_section): Adjust size of
3497 data for incremental input file entry.
3498 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3499 (Incremental_input_entry_reader::get_comdat_group_signature): New
3501 * object.cc (Sized_relobj::include_section_group): Report kept
3502 COMDAT groups for incremental links.
3504 2011-05-24 David Meyer <pdox@google.com>
3506 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3507 with name parameter. Add found_name parameter.
3508 * fileread.cc (Input_file::find_file): Adjust code accordingly.
3509 * dirsearch.h (class Dirsearch): Update declaration.
3511 2011-05-24 Ian Lance Taylor <iant@google.com>
3513 * archive.cc (Library_base::should_include_member): Pull in object
3514 from archive if it defines the entry symbol.
3515 * parameters.cc (Parameters::entry): New function.
3516 * parameters.h (class Parameters): Declare entry.
3517 * output.h (class Output_file_header): Remove entry_ field.
3518 * output.cc (Output_file_header::Output_file_header): Remove entry
3519 parameter. Change all callers.
3520 (Output_file_header::entry): Use parameters->entry.
3521 * gold.cc (queue_middle_tasks): Likewise.
3522 * plugin.cc (Plugin_hook::run): Likewise.
3524 2011-05-24 Cary Coutant <ccoutant@google.com>
3526 * gold.cc (queue_initial_tasks): Pass incremental base filename
3527 to Output_file::open_base_file; don't print error message.
3528 * incremental-dump.cc (main): Adjust call to
3529 Output_file::open_for_modification.
3530 * incremental-dump.cc (main): Likewise.
3531 * incremental.cc (Incremental_inputs::report_command_line):
3532 Ignore --incremental-base option when comparing command lines.
3533 Ignore parameter when given as separate argument.
3534 * options.h (class General_options): Add --incremental-base.
3535 * output.cc (Output_file::Output_file):
3536 (Output_file::open_base_file): Add base_name and writable parameters;
3537 read base file into new file; print error message here.
3538 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3540 * output.h (Output_file::open_for_modification): Rename to...
3541 (Output_file::open_base_file): ...this; add base_name and
3542 writable parameters; adjust all callers.
3543 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3545 * testsuite/Makefile.am (incremental_test_4): Test
3547 * testsuite/Makefile.in: Regenerate.
3549 2011-05-24 Cary Coutant <ccoutant@google.com>
3551 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3553 * testsuite/Makefile.in: Regenerate.
3554 * testsuite/two_file_test_1_v1.cc: New test source file.
3555 * testsuite/two_file_test_1b_v1.cc: New test source file.
3556 * testsuite/two_file_test_2_v1.cc: New test source file.
3558 2011-05-24 Cary Coutant <ccoutant@google.com>
3560 * dynobj.h (Dynobj::do_dynobj): New function.
3561 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3562 flag and soname for shared objects.
3563 * incremental.cc (Incremental_inputs::report_object): Make
3564 either Incremental_object_entry or Incremental_dynobj_entry; add
3565 soname to string table.
3566 (Incremental_inputs::report_input_section): Add assertion.
3567 (Output_section_incremental_inputs::set_final_data_size): Adjust
3568 type of input file entry for shared libraries; adjust size of
3569 shared library info entry.
3570 (Output_section_incremental_inputs::write_input_files): Write
3571 as_needed flag for shared libraries.
3572 (Output_section_incremental_inputs::write_info_blocks): Adjust type
3573 of input file entry for shared libraries; write soname.
3574 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3575 soname from incremental info.
3576 * incremental.h (enum Incremental_input_flags): Add
3577 INCREMENTAL_INPUT_AS_NEEDED.
3578 (Incremental_input_entry::Incremental_input_entry): Initialize new
3580 (Incremental_input_entry::set_as_needed): New function.
3581 (Incremental_input_entry::as_needed): New function.
3582 (Incremental_input_entry::do_dynobj_entry): New function.
3583 (Incremental_input_entry::as_needed_): New data member.
3584 (Incremental_object_entry::Incremental_object_entry): Don't check
3586 (Incremental_object_entry::do_type): Likewise.
3587 (class Incremental_dynobj_entry): New class.
3588 (Incremental_input_entry_reader::as_needed): New function.
3589 (Incremental_input_entry_reader::get_soname): New function.
3590 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3591 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3592 size of shared library info entry.
3593 * layout.cc (Layout::finish_dynamic_section): Don't test for
3594 incremental link when adding DT_NEEDED entries.
3595 * object.h (Object::Object): Initialize new data member.
3596 (Object::dynobj): New function.
3597 (Object::set_as_needed): New function.
3598 (Object::as_needed): New function.
3599 (Object::do_dynobj): New function.
3600 (Object::as_needed_): New data member.
3602 2011-05-24 Cary Coutant <ccoutant@google.com>
3604 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3605 info; adjust display of GOT entries.
3606 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3607 vector of input objects; remove file_status_.
3608 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3609 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3610 got_plt reader; call target hooks to reserve GOT entries.
3611 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3612 of input file info header and GOT info entry.
3613 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3615 (Got_plt_view_info::got_descriptor): Remove.
3616 (Got_plt_view_info::sym_index): New data member.
3617 (Got_plt_view_info::input_index): New data member.
3618 (Local_got_offset_visitor::visit): Write input file index.
3619 (Global_got_offset_visitor::visit): Write 0 for input file index.
3620 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3621 with sym_index and input_index.
3622 (Output_section_incremental_inputs::write_got_plt): Adjust size of
3623 incremental info GOT entry; replace got_descriptor with input_index.
3624 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3625 map from input file index to object.
3626 (Sized_relobj_incr::do_layout): Replace direct data member reference
3627 with accessor function.
3628 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3629 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3630 Adjust size of input file info header.
3631 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3632 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3633 (Incremental_input_entry_reader::get_input_section): Adjust size of
3634 input file info header.
3635 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3636 of incremental info GOT entry.
3637 (Incremental_got_plt_reader::get_got_desc): Remove.
3638 (Incremental_got_plt_reader::get_got_symndx): New function.
3639 (Incremental_got_plt_reader::get_got_input_index): New function.
3640 (Sized_incremental_binary::Sized_incremental_binary): Remove
3641 file_status_; add input_objects_.
3642 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3643 (Sized_incremental_binary::set_file_is_unchanged): Remove.
3644 (Sized_incremental_binary::file_is_unchanged): Remove.
3645 (Sized_incremental_binary::set_input_object): New function.
3646 (Sized_incremental_binary::input_object): New function.
3647 (Sized_incremental_binary::file_status_): Remove.
3648 (Sized_incremental_binary::input_objects_): New data member.
3649 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3651 (Sized_relobj_incr::invalid_address): Move to base class.
3652 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3654 (Sized_relobj_incr::do_output_section_offset): Likewise.
3655 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3656 (Sized_relobj_incr::section_offsets_): Likewise.
3657 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3659 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3660 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3661 with accessor function.
3662 (Sized_relobj_file::do_layout): Likewise.
3663 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3664 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3665 (Sized_relobj_file::compute_final_local_value): Replace refs to
3666 section_offsets_ with accessor function.
3667 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3668 * object.h (Relobj::Relobj): Initialize new data members.
3669 (Relobj::add_dyn_reloc): New function.
3670 (Relobj::first_dyn_reloc): New function.
3671 (Relobj::dyn_reloc_count): New function.
3672 (Relobj::first_dyn_reloc_): New data member.
3673 (Relobj::dyn_reloc_count_): New data member.
3674 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3676 (Sized_relobj::Address): New typedef.
3677 (Sized_relobj::invalid_address): Move here from child class.
3678 (Sized_relobj::Sized_relobj): Initialize new data members.
3679 (Sized_relobj::sized_relobj): New function.
3680 (Sized_relobj::is_output_section_offset_invalid): Move here from
3682 (Sized_relobj::get_output_section_offset): Likewise.
3683 (Sized_relobj::local_has_got_offset): Likewise.
3684 (Sized_relobj::local_got_offset): Likewise.
3685 (Sized_relobj::set_local_got_offset): Likewise.
3686 (Sized_relobj::do_for_all_local_got_entries): Likewise.
3687 (Sized_relobj::clear_got_offsets): New function.
3688 (Sized_relobj::section_offsets): Move here from child class.
3689 (Sized_relobj::do_output_section_offset): Likewise.
3690 (Sized_relobj::do_set_section_offset): Likewise.
3691 (Sized_relobj::Local_got_offsets): Likewise.
3692 (Sized_relobj::local_got_offsets_): Likewise.
3693 (Sized_relobj::section_offsets_): Likewise.
3694 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3696 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3698 (Sized_relobj_file::sized_relobj): New function
3699 (Sized_relobj_file::local_has_got_offset): Move to base class.
3700 (Sized_relobj_file::local_got_offset): Likewise.
3701 (Sized_relobj_file::set_local_got_offset): Likewise.
3702 (Sized_relobj_file::get_output_section_offset): Likewise.
3703 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3704 (Sized_relobj_file::do_output_section_offset): Likewise.
3705 (Sized_relobj_file::do_set_section_offset): Likewise.
3706 (Sized_relobj_file::Local_got_offsets): Likewise.
3707 (Sized_relobj_file::local_got_offsets_): Likewise.
3708 (Sized_relobj_file::section_offsets_): Likewise.
3709 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3711 (set_needs_dynsym_index): Convert relobj to derived class pointer.
3712 (Output_reloc::get_symbol_index): Likewise.
3713 (Output_reloc::local_section_offset): Likewise.
3714 (Output_reloc::get_address): Likewise.
3715 (Output_reloc::symbol_value): Likewise.
3716 (Output_data_got::reserve_slot): Move to class definition.
3717 (Output_data_got::reserve_local): New function.
3718 (Output_data_got::reserve_slot_for_global): Remove.
3719 (Output_data_got::reserve_global): New function.
3720 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3721 (all constructors, two instantiations).
3722 (Output_reloc::get_relobj): New function (two instantiations).
3723 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3724 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3725 (Output_data_reloc::add_global): Adjust type of relobj.
3726 (Output_data_reloc::add_global_relative): Likewise.
3727 (Output_data_reloc::add_symbolless_global_addend): Likewise.
3728 (Output_data_reloc::add_local): Likewise.
3729 (Output_data_reloc::add_local_relative): Likewise.
3730 (Output_data_reloc::add_symbolless_local_addend): Likewise.
3731 (Output_data_reloc::add_local_section): Likewise.
3732 (Output_data_reloc::add_output_section): Likewise.
3733 (Output_data_reloc::add_absolute): Likewise.
3734 (Output_data_reloc::add_target_specific): Likewise.
3735 (Output_data_got::reserve_slot): Move definition here.
3736 (Output_data_got::reserve_local): New function.
3737 (Output_data_got::reserve_global): New function.
3738 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3739 section_offsets_ with accessor function.
3740 (Sized_relobj_file::write_sections): Likewise.
3741 (Sized_relobj_file::do_relocate_sections): Likewise.
3742 * target.h (Sized_target::reserve_local_got_entry): New function.
3743 (Sized_target::reserve_global_got_entry): New function.
3744 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3745 (Target_x86_64::reserve_global_got_entry): New function.
3746 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3748 2011-05-23 Cary Coutant <ccoutant@google.com>
3750 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3751 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3752 bit when checking got_type.
3753 * incremental.cc (Sized_incremental_binary::setup_readers):
3754 Store symbol table and string table locations; initialize bit vector
3755 of file status flags.
3756 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3758 (Sized_incremental_binary::do_process_got_plt): New function.
3759 (Sized_incremental_binary::get_symtab_view): Use stored locations.
3760 (Output_section_incremental_inputs::set_final_data_size): Record
3761 file index for each input file.
3762 (Output_section_incremental_inputs::write_got_plt): Store file index
3763 instead of input entry offset for each GOT entry.
3765 (Incremental_input_entry::Incremental_input_entry): Initialize new
3767 (Incremental_input_entry::set_offset): Store file index.
3768 (Incremental_input_entry::get_file_index): New function.
3769 (Incremental_input_entry::file_index_): New data member.
3770 (Incremental_binary::process_got_plt): New function.
3771 (Incremental_binary::do_process_got_plt): New function.
3772 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3774 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3775 (Sized_incremental_binary::set_file_is_unchanged): New function.
3776 (Sized_incremental_binary::file_is_unchanged): New function.
3777 (Sized_incremental_binary::do_process_got_plt): New function.
3778 (Sized_incremental_binary::file_status_): New data member.
3779 (Sized_incremental_binary::main_symtab_loc_): New data member.
3780 (Sized_incremental_binary::main_strtab_loc_): New data member.
3781 * output.cc (Output_data_got::Got_entry::write): Add case
3783 (Output_data_got::add_global): Call add_got_entry.
3784 (Output_data_got::add_global_plt): Likewise.
3785 (Output_data_got::add_global_with_rel): Likewise.
3786 (Output_data_got::add_global_with_rela): Likewise.
3787 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3788 (Output_data_got::add_global_pair_with_rela): Likewise.
3789 (Output_data_got::add_local): Call add_got_entry.
3790 (Output_data_got::add_local_plt): Likewise.
3791 (Output_data_got::add_local_with_rel): Likewise.
3792 (Output_data_got::add_local_with_rela): Likewise.
3793 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3794 (Output_data_got::add_local_pair_with_rela): Likewise.
3795 (Output_data_got::reserve_slot): New function.
3796 (Output_data_got::reserve_slot_for_global): New function.
3797 (Output_data_got::add_got_entry): New function.
3798 (Output_data_got::add_got_entry_pair): New function.
3799 (Output_section::add_output_section_data): Edit FIXME.
3801 (Output_section_data_build::Output_section_data_build): New
3802 constructor with size parameter.
3803 (Output_data_space::Output_data_space): Likewise.
3804 (Output_data_got::Output_data_got): Initialize new data member; new
3805 constructor with size parameter.
3806 (Output_data_got::add_constant): Call add_got_entry.
3807 (Output_data_got::reserve_slot): New function.
3808 (Output_data_got::reserve_slot_for_global): New function.
3809 (class Output_data_got::Got_entry): Add RESERVED_CODE.
3810 (Output_data_got::add_got_entry): New function.
3811 (Output_data_got::add_got_entry_pair): New function.
3812 (Output_data_got::free_list_): New data member.
3813 * target.h (Sized_target::init_got_plt_for_update): New function.
3814 (Sized_target::register_global_plt_entry): New function.
3815 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3816 Initialize new data member; call init; add constructor with PLT count.
3817 (Output_data_plt_x86_64::init): New function.
3818 (Output_data_plt_x86_64::add_relocation): New function.
3819 (Output_data_plt_x86_64::reserve_slot): New function.
3820 (Output_data_plt_x86_64::free_list_): New data member.
3821 (Target_x86_64::init_got_plt_for_update): New function.
3822 (Target_x86_64::register_global_plt_entry): New function.
3823 (Output_data_plt_x86_64::add_entry): Allocate from free list for
3824 incremental updates.
3825 (Output_data_plt_x86_64::add_relocation): New function.
3826 * testsuite/object_unittest.cc (Object_test): Set default options.
3828 2011-05-16 Ian Lance Taylor <iant@google.com>
3830 * options.h (class General_options): Make -i a synonym for -r.
3832 2011-05-16 Ian Lance Taylor <iant@google.com>
3834 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3836 2011-05-10 Cary Coutant <ccoutant@google.com>
3838 * object.cc (Sized_relobj::do_count_local_symbols): Check for
3841 2011-05-06 Ian Lance Taylor <iant@google.com>
3843 * layout.cc (Layout::layout): If the output section flags change,
3844 update the ordering.
3846 2011-04-25 Cary Coutant <ccoutant@google.com>
3848 * incremental-dump.cc (dump_incremental_inputs): Print local
3849 symbol info for each input file.
3851 (Output_section_incremental_inputs::set_final_data_size): Add local
3852 symbol info to input file entries in incremental info.
3853 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3854 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3855 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3856 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3858 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3859 (Sized_incr_relobj::do_relocate): Write the local symbols.
3860 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3861 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3862 Adjust size of input file header.
3863 (Incremental_inputs_reader::get_local_symbol_offset): New function.
3864 (Incremental_inputs_reader::get_local_symbol_count): New function.
3865 (Incremental_inputs_reader::get_input_section): Adjust size of input
3867 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3868 (Sized_incr_relobj::This): New typedef.
3869 (Sized_incr_relobj::sym_size): New const data member.
3870 (Sized_incr_relobj::Local_symbol): New struct.
3871 (Sized_incr_relobj::do_output_local_symbol_count): New function.
3872 (Sized_incr_relobj::do_local_symbol_offset): New function.
3873 (Sized_incr_relobj::local_symbol_count_): New data member.
3874 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3875 (Sized_incr_relobj::local_symbol_index_): New data member.
3876 (Sized_incr_relobj::local_symbol_offset_): New data member.
3877 (Sized_incr_relobj::local_dynsym_offset_): New data member.
3878 (Sized_incr_relobj::local_symbols_): New data member.
3879 * object.h (Relobj::output_local_symbol_count): New function.
3880 (Relobj::local_symbol_offset): New function.
3881 (Relobj::do_output_local_symbol_count): New function.
3882 (Relobj::do_local_symbol_offset): New function.
3883 (Sized_relobj::do_output_local_symbol_count): New function.
3884 (Sized_relobj::do_local_symbol_offset): New function.
3886 2011-04-22 Vladimir Simonov <sv@sw.ru>
3888 * descriptors.cc (set_close_on_exec): New function.
3889 (Descriptors::open): Use set_close_on_exec.
3890 * output.cc (S_ISLNK): Define if not defined.
3892 2011-04-22 Cary Coutant <ccoutant@google.com>
3894 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3896 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3897 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3898 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3900 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3901 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3902 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3904 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3906 (Incremental_binary::apply_incremental_relocs): New function.
3907 (Incremental_binary::do_apply_incremental_relocs): New function.
3908 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3910 (Sized_incremental_binary::add_global_symbol): New function.
3911 (Sized_incremental_binary::global_symbol): New function.
3912 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3913 (Sized_incremental_binary::symbol_map_): New data member.
3914 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3915 * target.h (Sized_target::apply_relocation): New function.
3916 * target-reloc.h (apply_relocation): New function.
3917 * x86_64.cc (Target_x86_64::apply_relocation): New function.
3919 2011-04-22 Doug Kwan <dougkwan@google.com>
3921 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3922 flag of a SHT_ARM_EXIDX section.
3923 * testsuite/Makefile.am (arm_exidx_test): New test rules.
3924 * testsuite/Makefile.in: Regenerate.
3925 * testsuite/arm_exidx_test.s: New file.
3926 * testsuite/arm_exidx_test.sh: Same.
3928 2011-04-20 Cary Coutant <ccoutant@google.com>
3931 * archive.h (Incremental_archive_entry::Archive_member):
3932 Initialize arg_serial_ (second constructor).
3934 2011-04-17 Ian Lance Taylor <iant@google.com>
3936 * object.cc (Relocate_info::location): Simplify location string.
3937 * errors.cc (Errors::error_at_location): Don't print program
3939 (Errors::warning_at_location): Likewise.
3940 (Errors::undefined_symbol): Likewise.
3941 * testsuite/debug_msg.sh: Update accordingly.
3943 2011-04-14 Cary Coutant <ccoutant@google.com>
3945 * gold/layout.cc (Layout::symtab_section_offset): New function.
3946 * gold/layout.h (Layout::symtab_section_offset): New function.
3947 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3949 2011-04-12 Ian Lance Taylor <iant@google.com>
3951 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
3952 with MREMAP_MAYMOVE.
3953 * output.h (class Output_file): Add map_is_allocated_ field.
3954 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
3955 not available, provide stubs. If mremap is not available, #define
3957 (MREMAP_MAYMOVE): Define if not defined.
3958 (Output_file::Output_file): Initialize map_is_allocated_.
3959 (Output_file::resize): Check map_is_allocated_.
3960 (Output_file::map_anonymous): If mmap fails, use malloc.
3961 (Output_file::unmap): Don't do anything for an anonymous map.
3962 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
3963 is not available, provide stubs.
3964 (File_read::View::~View): Use free rather than delete[].
3965 (File_read::make_view): Use malloc rather than new[]. If mmap
3967 (File_read::find_or_make_view): Use malloc rather than new[].
3968 * gold.h: Remove HAVE_REMAP code.
3969 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
3970 exists. Rename mremap to gold_mremap. If mmap is not available
3972 * configure, config.in: Rebuild.
3974 2011-04-11 Ian Lance Taylor <iant@google.com>
3976 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3977 initialize local variable v.
3979 2011-04-11 Cary Coutant <ccoutant@google.com>
3981 * archive.cc (Archive::include_member): Adjust call to
3983 (Add_archive_symbols::run): Track argument serial numbers.
3984 (Lib_group::include_member): Likewise.
3985 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3986 * archive.h (Incremental_archive_entry::Archive_member):
3987 Initialize arg_serial_.
3988 (Archive_member::arg_serial_): New data member.
3989 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3990 (Sized_dynobj::do_add_symbols): Track symbols when doing an
3992 (Sized_dynobj::do_for_all_local_got_entries): New function.
3993 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3995 * fileread.cc (get_mtime): New function.
3996 * fileread.h (get_mtime): New function.
3997 * gold.cc (queue_initial_tasks): Check for incremental update.
3998 (process_incremental_input): New function.
3999 (queue_middle_tasks): Don't force valid target for incremental
4001 * incremental-dump.cc (find_input_containing_global): Adjust
4002 size of symbol info entry.
4003 (dump_incremental_inputs): Dump argument serial number and
4004 in_system_directory flag; bias shndx by 1; print symbol names
4005 when dumping per-file symbol lists; use new symbol info readers.
4007 (Output_section_incremental_inputs:update_data_size): New function.
4008 (Sized_incremental_binary::setup_readers): Setup input readers
4009 for each input file; build maps for files added from libraries
4011 (Sized_incremental_binary::check_input_args): New function.
4012 (Sized_incremental_binary::do_check_inputs): Build map of argument
4013 serial numbers to input arguments.
4014 (Sized_incremental_binary::do_file_has_changed): Rename
4015 do_file_is_unchanged to this; compare file modification times.
4016 (Sized_incremental_binary::do_init_layout): New function.
4017 (Sized_incremental_binary::do_reserve_layout): New function.
4018 (Sized_incremental_binary::do_get_input_reader): Remove.
4019 (Sized_incremental_binary::get_symtab_view): New function.
4020 (Incremental_checker::can_incrementally_link_output_file): Remove.
4021 (Incremental_inputs::report_command_line): Exclude --debug options.
4022 (Incremental_inputs::report_archive_begin): Add parameter; track
4023 argument serial numbers; don't put input file entry for archive
4024 before archive members.
4025 (Incremental_inputs::report_archive_end): Put input file entry
4026 for archive after archive members.
4027 (Incremental_inputs::report_object): Add parameter; track argument
4028 serial numbers and in_system_directory flag.
4029 (Incremental_inputs::report_script): Add parameter; track argument
4031 (Output_section_incremental_inputs::set_final_data_size): Adjust
4032 size of symbol info entry; check for forwarding symbols.
4033 (Output_section_incremental_inputs::write_input_files): Write
4034 in_system_directory flag and argument serial number.
4035 (Output_section_incremental_inputs::write_info_blocks): Map section
4036 indices between incremental info and original input file; store
4037 input section index for each symbol.
4038 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4039 change operator() to visit().
4040 (class Global_got_offset_visitor): Likewise.
4041 (class Global_symbol_visitor_got_plt):
4042 (Output_section_incremental_inputs::write_got_plt): Use new visitor
4044 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4045 (Sized_incr_relobj::do_read_symbols): New function.
4046 (Sized_incr_relobj::do_layout): New function.
4047 (Sized_incr_relobj::do_layout_deferred_sections): New function.
4048 (Sized_incr_relobj::do_add_symbols): New function.
4049 (Sized_incr_relobj::do_should_include_member): New function.
4050 (Sized_incr_relobj::do_for_all_global_symbols): New function.
4051 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4052 (Sized_incr_relobj::do_section_size): New function.
4053 (Sized_incr_relobj::do_section_name): New function.
4054 (Sized_incr_relobj::do_section_contents): New function.
4055 (Sized_incr_relobj::do_section_flags): New function.
4056 (Sized_incr_relobj::do_section_entsize): New function.
4057 (Sized_incr_relobj::do_section_address): New function.
4058 (Sized_incr_relobj::do_section_type): New function.
4059 (Sized_incr_relobj::do_section_link): New function.
4060 (Sized_incr_relobj::do_section_info): New function.
4061 (Sized_incr_relobj::do_section_addralign): New function.
4062 (Sized_incr_relobj::do_initialize_xindex): New function.
4063 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4064 (Sized_incr_relobj::do_read_relocs): New function.
4065 (Sized_incr_relobj::do_gc_process_relocs): New function.
4066 (Sized_incr_relobj::do_scan_relocs): New function.
4067 (Sized_incr_relobj::do_count_local_symbols): New function.
4068 (Sized_incr_relobj::do_finalize_local_symbols): New function.
4069 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4070 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4071 (Sized_incr_relobj::do_relocate): New function.
4072 (Sized_incr_relobj::do_set_section_offset): New function.
4073 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4074 (Sized_incr_dynobj::do_read_symbols): New function.
4075 (Sized_incr_dynobj::do_layout): New function.
4076 (Sized_incr_dynobj::do_add_symbols): New function.
4077 (Sized_incr_dynobj::do_should_include_member): New function.
4078 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4079 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4080 (Sized_incr_dynobj::do_section_size): New function.
4081 (Sized_incr_dynobj::do_section_name): New function.
4082 (Sized_incr_dynobj::do_section_contents): New function.
4083 (Sized_incr_dynobj::do_section_flags): New function.
4084 (Sized_incr_dynobj::do_section_entsize): New function.
4085 (Sized_incr_dynobj::do_section_address): New function.
4086 (Sized_incr_dynobj::do_section_type): New function.
4087 (Sized_incr_dynobj::do_section_link): New function.
4088 (Sized_incr_dynobj::do_section_info): New function.
4089 (Sized_incr_dynobj::do_section_addralign): New function.
4090 (Sized_incr_dynobj::do_initialize_xindex): New function.
4091 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4092 (make_sized_incremental_object): New function.
4093 (Incremental_library::copy_unused_symbols): New function.
4094 (Incremental_library::do_for_all_unused_symbols): New function.
4095 * incremental.h (enum Incremental_input_flags): New type.
4096 (class Incremental_checker): Remove.
4097 (Incremental_input_entry::Incremental_input_entry): Add argument
4099 (Incremental_input_entry::arg_serial): New function.
4100 (Incremental_input_entry::set_is_in_system_directory): New function.
4101 (Incremental_input_entry::is_in_system_directory): New function.
4102 (Incremental_input_entry::arg_serial_): New data member.
4103 (Incremental_input_entry::is_in_system_directory_): New data member.
4104 (class Script_info): Move here from script.h.
4105 (Script_info::Script_info): Add filename parameter.
4106 (Script_info::filename): New function.
4107 (Script_info::filename_): New data member.
4108 (Incremental_script_entry::Incremental_script_entry): Add argument
4110 (Incremental_object_entry::Incremental_object_entry): Likewise.
4111 (Incremental_object_entry::add_input_section): Build list of input
4112 sections with map to original shndx.
4113 (Incremental_object_entry::get_input_section_index): New function.
4114 (Incremental_object_entry::shndx_): New data member.
4115 (Incremental_object_entry::name_key_): Rename; adjust all refs.
4116 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4117 (Incremental_archive_entry::Incremental_archive_entry): Add argument
4119 (Incremental_inputs::report_archive_begin): Likewise.
4120 (Incremental_inputs::report_object): Likewise.
4121 (Incremental_inputs::report_script): Likewise.
4122 (class Incremental_global_symbol_reader): New class.
4123 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4124 and store flags and input file type.
4125 (Incremental_input_entry_reader::arg_serial): New function.
4126 (Incremental_input_entry_reader::type): Extract type from flags.
4127 (Incremental_input_entry_reader::is_in_system_directory): New function.
4128 (Incremental_input_entry_reader::get_input_section_count): Call
4129 accessor function for type.
4130 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4131 function for type; adjust size of global symbol entry.
4132 (Incremental_input_entry_reader::get_global_symbol_count): Call
4133 accessor function for type.
4134 (Incremental_input_entry_reader::get_object_count): Likewise.
4135 (Incremental_input_entry_reader::get_object_offset): Likewise.
4136 (Incremental_input_entry_reader::get_member_count): Likewise.
4137 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4138 (Incremental_input_entry_reader::get_member_offset): Likewise.
4139 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4140 (Incremental_input_entry_reader::Global_symbol_info): Remove.
4141 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4142 (Incremental_input_entry_reader::get_global_symbol_reader): New
4144 (Incremental_input_entry_reader::get_output_symbol_index): New
4146 (Incremental_input_entry_reader::type_): Remove.
4147 (Incremental_input_entry_reader::flags_): New data member.
4148 (Incremental_inputs_reader::input_file_offset): New function.
4149 (Incremental_inputs_reader::input_file_index): New function.
4150 (Incremental_inputs_reader::input_file): Call input_file_offset.
4151 (Incremental_inputs_reader::input_file_at_offset): New function.
4152 (Incremental_relocs_reader::get_r_type): Reformat.
4153 (Incremental_relocs_reader::get_r_shndx): Reformat.
4154 (Incremental_relocs_reader::get_r_offset): Reformat.
4155 (Incremental_relocs_reader::data): New function.
4156 (Incremental_binary::Incremental_binary): Initialize new data members.
4157 (Incremental_binary::check_inputs): Add cmdline parameter.
4158 (Incremental_binary::file_is_unchanged): Remove.
4159 (Input_reader::arg_serial): New function.
4160 (Input_reader::get_unused_symbol_count): New function.
4161 (Input_reader::get_unused_symbol): New function.
4162 (Input_reader::do_arg_serial): New function.
4163 (Input_reader::do_get_unused_symbol_count): New function.
4164 (Input_reader::do_get_unused_symbol): New function.
4165 (Incremental_binary::input_file_count): New function.
4166 (Incremental_binary::get_input_reader): Change signature to use
4167 index instead of filename.
4168 (Incremental_binary::file_has_changed): New function.
4169 (Incremental_binary::get_input_argument): New function.
4170 (Incremental_binary::get_library): New function.
4171 (Incremental_binary::get_script_info): New function.
4172 (Incremental_binary::init_layout): New function.
4173 (Incremental_binary::reserve_layout): New function.
4174 (Incremental_binary::output_file): New function.
4175 (Incremental_binary::do_check_inputs): New function.
4176 (Incremental_binary::do_file_is_unchanged): Remove.
4177 (Incremental_binary::do_file_has_changed): New function.
4178 (Incremental_binary::do_init_layout): New function.
4179 (Incremental_binary::do_reserve_layout): New function.
4180 (Incremental_binary::do_input_file_count): New function.
4181 (Incremental_binary::do_get_input_reader): Change signature.
4182 (Incremental_binary::input_args_map_): New data member.
4183 (Incremental_binary::library_map_): New data member.
4184 (Incremental_binary::script_map_): New data member.
4185 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4187 (Sized_incremental_binary::output_section): New function.
4188 (Sized_incremental_binary::inputs_reader): Add const.
4189 (Sized_incremental_binary::symtab_reader): Add const.
4190 (Sized_incremental_binary::relocs_reader): Add const.
4191 (Sized_incremental_binary::got_plt_reader): Add const.
4192 (Sized_incremental_binary::get_symtab_view): New function.
4193 (Sized_incremental_binary::Inputs_reader): New typedef.
4194 (Sized_incremental_binary::Input_entry_reader): New typedef.
4195 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4196 (Sized_incremental_binary::do_file_is_unchanged): Remove.
4197 (Sized_incremental_binary::do_file_has_changed): New function.
4198 (Sized_incremental_binary::do_init_layout): New function.
4199 (Sized_incremental_binary::do_reserve_layout): New function.
4200 (Sized_input_reader::Inputs_reader): Remove.
4201 (Sized_input_reader::Input_entry_reader): Remove.
4202 (Sized_input_reader::do_arg_serial): New function.
4203 (Sized_input_reader::do_get_unused_symbol_count): New function.
4204 (Sized_input_reader::do_get_unused_symbol): New function.
4205 (Sized_incremental_binary::do_input_file_count): New function.
4206 (Sized_incremental_binary::do_get_input_reader): Change signature;
4207 use index instead of filename.
4208 (Sized_incremental_binary::section_map_): New data member.
4209 (Sized_incremental_binary::input_entry_readers_): New data member.
4210 (class Sized_incr_relobj): New class.
4211 (class Sized_incr_dynobj): New class.
4212 (make_sized_incremental_object): New function.
4213 (class Incremental_library): New class.
4214 * layout.cc (Free_list::num_lists): New static data member.
4215 (Free_list::num_nodes): New static data member.
4216 (Free_list::num_removes): New static data member.
4217 (Free_list::num_remove_visits): New static data member.
4218 (Free_list::num_allocates): New static data member.
4219 (Free_list::num_allocate_visits): New static data member.
4220 (Free_list::init): New function.
4221 (Free_list::remove): New function.
4222 (Free_list::allocate): New function.
4223 (Free_list::dump): New function.
4224 (Free_list::print_stats): New function.
4225 (Layout_task_runner::run): Resize output file for incremental updates.
4226 (Layout::Layout): Initialize new data members.
4227 (Layout::set_incremental_base): New function.
4228 (Layout::init_fixed_output_section): New function.
4229 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4230 incremental updates.
4231 (Layout::create_gold_note): Do not create gold note section for
4232 incremental updates.
4233 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4234 for incremental updates.
4235 (Layout::set_section_offsets): For incremental updates, allocate space
4237 (Layout::create_symtab_sections): Layout with offsets relative to
4238 start of section; for incremental updates, allocate space from free
4240 (Layout::create_shdrs): For incremental updates, allocate space from
4242 (Layout::finish_dynamic_section): For incremental updates, do not
4243 check --as-needed (fixed in subsequent patch).
4244 * layout.h (class Free_list): New class.
4245 (Layout::set_incremental_base): New function.
4246 (Layout::incremental_base): New function.
4247 (Layout::init_fixed_output_section): New function.
4248 (Layout::allocate): New function.
4249 (Layout::incremental_base_): New data member.
4250 (Layout::free_list_): New data member.
4251 * main.cc (main): Print Free_list statistics.
4252 * object.cc (Relobj::finalize_incremental_relocs): Add
4253 clear_counts parameter; clear counts only when clear_counts is set.
4254 (Sized_relobj::Sized_relobj): Initialize new base class.
4255 (Sized_relobj::do_layout): Don't report special sections.
4256 (Sized_relobj::do_for_all_local_got_entries): New function.
4257 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4258 symtab_off to all symbol table offsets.
4259 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4260 * object.h (class Got_offset_list): Move to top of file.
4261 (Object::Object): Allow case where input_file == NULL.
4262 (Object::~Object): Likewise.
4263 (Object::input_file): Assert that input_file != NULL.
4264 (Object::lock): Allow case where input_file == NULL.
4265 (Object::unlock): Likewise.
4266 (Object::is_locked): Likewise.
4267 (Object::token): Likewise.
4268 (Object::release): Likewise.
4269 (Object::is_incremental): New function.
4270 (Object::get_mtime): New function.
4271 (Object::for_all_local_got_entries): New function.
4272 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4273 (Object::set_is_in_system_directory): New function.
4274 (Object::is_in_system_directory): New function.
4275 (Object::do_is_incremental): New function.
4276 (Object::do_get_mtime): New function.
4277 (Object::do_for_all_local_got_entries): New function.
4278 (Object::is_in_system_directory_): New data member.
4279 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4280 (class Sized_relobj_base): New class.
4281 (class Sized_relobj): Derive from Sized_relobj_base.
4282 (class Sized_relobj::Symbols): Redeclare from base class.
4283 (class Sized_relobj::local_got_offset_list): Remove.
4284 (class Sized_relobj::Output_sections): Redeclare from base class.
4285 (class Sized_relobj::do_for_all_local_got_entries): New function.
4286 (class Sized_relobj::write_local_symbols): Add offset parameter.
4287 (class Sized_relobj::local_symbol_offset_): Update comment.
4288 (class Sized_relobj::local_dynsym_offset_): Update comment.
4289 * options.cc (Input_arguments::add_file): Remove const.
4290 * options.h (Input_file_argument::Input_file_argument):
4291 Initialize arg_serial_ (all constructors).
4292 (Input_file_argument::set_arg_serial): New function.
4293 (Input_file_argument::arg_serial): New function.
4294 (Input_file_argument::arg_serial_): New data member.
4295 (Input_arguments::Input_arguments): Initialize file_count_.
4296 (Input_arguments::add_file): Remove const.
4297 (Input_arguments::number_of_input_files): New function.
4298 (Input_arguments::file_count_): New data member.
4299 (Command_line::number_of_input_files): Call
4300 Input_arguments::number_of_input_files.
4301 * output.cc (Output_segment_headers::Output_segment_headers):
4303 (Output_section::Input_section::current_data_size): New function.
4304 (Output_section::Output_section): Initialize new data members.
4305 (Output_section::add_input_section): Don't do merge sections for
4306 an incremental link; allocate space from free list for an
4308 (Output_section::add_output_section_data): Allocate space from
4309 free list for an incremental update.
4310 (Output_section::update_data_size): New function.
4311 (Output_section::set_fixed_layout): New function.
4312 (Output_section::reserve): New function.
4313 (Output_segment::set_section_addresses): Remove const.
4314 (Output_segment::set_section_list_addresses): Remove const; allocate
4315 space from free list for an incremental update.
4316 (Output_segment::set_offset): Adjust size of RELRO segment for an
4318 * output.h (Output_data::current_data_size): Move here from
4320 (Output_data::pre_finalize_data_size): New function.
4321 (Output_data::update_data_size): New function.
4322 (Output_section_headers::update_data_size): new function.
4323 (Output_section_data_build::current_data_size): Move to Output_data.
4324 (Output_data_strtab::update_data_size): New function.
4325 (Output_section::current_data_size): Move to Output_data.
4326 (Output_section::set_fixed_layout): New function.
4327 (Output_section::has_fixed_layout): New function.
4328 (Output_section::reserve): New function.
4329 (Output_section::update_data_size): New function.
4330 (Output_section::has_fixed_layout_): New data member.
4331 (Output_section::free_list_): New data member.
4332 (Output_segment::set_section_addresses): Remove const.
4333 (Output_segment::set_section_list_addresses): Remove const.
4334 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4336 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4338 * readsyms.cc (Read_symbols::do_read_symbols): Add library
4339 parameter when calling Add_symbols constructor; store argument
4340 serial number for members of a lib group.
4341 (Add_symbols::locks): Allow case where token == NULL.
4342 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4343 (Read_member::~Read_member): New function.
4344 (Read_member::is_runnable): New function.
4345 (Read_member::locks): New function.
4346 (Read_member::run): New function.
4347 (Check_script::~Check_script): New function.
4348 (Check_script::is_runnable): New function.
4349 (Check_script::locks): New function.
4350 (Check_script::run): New function.
4351 (Check_library::~Check_library): New function.
4352 (Check_library::is_runnable): New function.
4353 (Check_library::locks): New function.
4354 (Check_library::run): New function.
4355 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4356 (Add_symbols::library_): New data member.
4357 (class Read_member): New class.
4358 (class Check_script): New class.
4359 (class Check_library): New class.
4360 * reloc.cc (Read_relocs::is_runnable): Allow case where
4362 (Read_relocs::locks): Likewise.
4363 (Scan_relocs::locks): Likewise.
4364 (Relocate_task::locks): Likewise.
4365 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4367 (Sized_relobj::incremental_relocs_scan): Fix comment.
4368 (Sized_relobj::do_relocate): Pass output file offset to
4369 write_local_symbols.
4370 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4371 from class declaration.
4372 * script.cc (read_input_script): Allocate Script_info; pass
4373 argument serial number to report_script.
4374 * script.h (class Script_info): Move to incremental.h.
4375 * symtab.cc (Symbol_table::add_from_incrobj): New function.
4376 * symtab.h (Symbol_table::add_from_incrobj): New function.
4377 (Symbol_table::set_file_offset): New function.
4379 2011-04-05 Cary Coutant <ccoutant@google.com>
4381 * incremental-dump.cc (dump_incremental_inputs): Change signature
4382 to take a Sized_incremental_binary; change caller. Use readers
4383 in Sized_incremental_binary.
4385 (Sized_incremental_binary::find_incremental_inputs_sections):
4386 Rename do_find_incremental_inputs_sections to this.
4387 (Sized_incremental_binary::setup_readers): New function.
4388 (Sized_incremental_binary::do_check_inputs): Check
4389 has_incremental_info_ flag; move setup code to setup_readers;
4391 (Sized_incremental_binary::do_file_is_unchanged): New function.
4392 (Sized_incremental_binary::do_get_input_reader): New function.
4393 * incremental.h (class Incremental_binary): Move to end of file.
4394 (Incremental_binary::file_is_unchanged): New function.
4395 (Incremental_binary::do_file_is_unchanged): New function.
4396 (Incremental_binary::Input_reader): New class.
4397 (Incremental_binary::get_input_reader): New function.
4398 (class Sized_incremental_binary): Move to end of file.
4399 (Sized_incremental_binary::Sized_incremental_binary): Setup the
4400 input section reader classes.
4401 (Sized_incremental_binary::has_incremental_info): New function.
4402 (Sized_incremental_binary::inputs_reader): New function.
4403 (Sized_incremental_binary::symtab_reader): New function.
4404 (Sized_incremental_binary::relocs_reader): New function.
4405 (Sized_incremental_binary::got_plt_reader): New function.
4406 (Sized_incremental_binary::do_file_is_unchanged): New function.
4407 (Sized_incremental_binary::Sized_input_reader): New class.
4408 (Sized_incremental_binary::get_input_reader): New function.
4409 (Sized_incremental_binary::find_incremental_inputs_sections):
4410 Rename do_find_incremental_inputs_sections to this.
4411 (Sized_incremental_binary::setup_readers): New function.
4412 (Sized_incremental_binary::has_incremental_info_): New data member.
4413 (Sized_incremental_binary::inputs_reader_): New data member.
4414 (Sized_incremental_binary::symtab_reader_): New data member.
4415 (Sized_incremental_binary::relocs_reader_): New data member.
4416 (Sized_incremental_binary::got_plt_reader_): New data member.
4417 (Sized_incremental_binary::current_input_file_): New data member.
4419 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
4422 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4425 2011-03-30 Cary Coutant <ccoutant@google.com>
4427 * archive.cc (Archive::include_member): Adjust call to report_object.
4428 (Add_archive_symbols::run): Add script_info to call to
4429 report_archive_begin.
4430 (Lib_group::include_member): Adjust call to report_object.
4431 (Add_lib_group_symbols::run): Adjust call to report_object.
4432 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4433 blocks. Add object count for script input files.
4434 * incremental.cc (Incremental_inputs::report_archive_begin): Add
4435 script_info parameter; change all callers.
4436 (Incremental_inputs::report_object): Add script_info parameter;
4438 (Incremental_inputs::report_script): Store backpointer to
4439 incremental info entry.
4440 (Output_section_incremental_inputs::set_final_data_size): Record
4441 additional information for scripts.
4442 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4443 * incremental.h (Incremental_script_entry::add_object): New function.
4444 (Incremental_script_entry::get_object_count): New function.
4445 (Incremental_script_entry::get_object): New function.
4446 (Incremental_script_entry::objects_): New data member; adjust
4448 (Incremental_inputs::report_archive_begin): Add script_info parameter.
4449 (Incremental_inputs::report_object): Add script_info parameter.
4450 (Incremental_inputs_reader::get_object_count): New function.
4451 (Incremental_inputs_reader::get_object_offset): New function.
4452 * options.cc (Input_arguments::add_file): Return reference to
4454 * options.h (Input_argument::set_script_info): New function.
4455 (Input_argument::script_info): New function.
4456 (Input_argument::script_info_): New data member; adjust all
4458 (Input_file_group::add_file): Return reference to new input argument.
4459 (Input_file_lib::add_file): Likewise.
4460 (Input_arguments::add_file): Likewise.
4461 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4462 * script.cc (Parser_closure::Parser_closure): Add script_info
4463 parameter; adjust all callers.
4464 (Parser_closure::script_info): New function.
4465 (Parser_closure::script_info_): New data member.
4466 (read_input_script): Report scripts earlier to incremental info.
4467 (script_add_file): Set script_info in Input_argument.
4468 (script_add_library): Likewise.
4469 * script.h (Script_options::Script_info): Rewrite class.
4471 2011-03-29 Cary Coutant <ccoutant@google.com>
4473 * archive.cc (Library_base::should_include_member): Move
4474 method here from class Archive.
4475 (Archive::Archive): Initialize base class.
4476 (Archive::should_include_member): Move to base class.
4477 (Archive::do_for_all_unused_symbols): New function.
4478 (Add_archive_symbols::run): Remove redundant access to
4480 (Lib_group::Lib_group): Initialize base class.
4481 (Lib_group::do_filename): New function.
4482 (Lib_group::include_member): Pass pointer to Lib_group to
4484 (Lib_group::do_for_all_unused_symbols): New function.
4485 (Add_lib_group_symbols::run): Report archive information for
4487 * archive.h (class Library_base): New base class.
4488 (class Archive): Derive from Library_base.
4489 (Archive::filename): Move to base class.
4490 (Archive::set_incremental_info): Likewise.
4491 (Archive::incremental_info): Likewise.
4492 (Archive::Should_include): Likewise.
4493 (Archive::should_include_member): Likewise.
4494 (Archive::Armap_entry): Remove.
4495 (Archive::Unused_symbol_iterator): Remove.
4496 (Archive::unused_symbols_begin): Remove.
4497 (Archive::unused_symbols_end): Remove.
4498 (Archive::do_filename): New function.
4499 (Archive::do_get_mtime): New function.
4500 (Archive::do_for_all_unused_symbols): New function.
4501 (Archive::task_): Move to base class.
4502 (Archive::incremental_info_): Likewise.
4503 (class Lib_group): Derive from Library_base.
4504 (Lib_group::do_filename): New function.
4505 (Lib_group::do_get_mtime): New function.
4506 (Lib_group::do_for_all_unused_symbols): New function.
4507 (Lib_group::task_): Move to base class.
4508 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4510 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4512 * incremental.cc (Incremental_inputs::report_archive_begin):
4513 Use Library_base; call library's get_mtime; add incremental inputs
4514 entry before members.
4515 (class Unused_symbol_visitor): New class.
4516 (Incremental_inputs::report_archive_end): Use Library_base; use
4517 visitor class to record unused symbols; don't add incremental inputs
4518 entry after members.
4519 (Incremental_inputs::report_object): Use Library_base.
4521 (Incremental_archive_entry::Incremental_archive_entry): Remove
4522 unused Archive parameter.
4523 (Incremental_inputs::report_archive_begin): Use Library_base.
4524 (Incremental_inputs::report_archive_end): Likewise.
4525 (Incremental_inputs::report_object): Likewise.
4526 * object.cc (Sized_relobj::do_for_all_global_symbols): New
4528 * object.h (Object::for_all_global_symbols): New function.
4529 (Object::do_for_all_global_symbols): New function.
4530 (Sized_relobj::do_for_all_global_symbols): New function.
4531 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
4533 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
4536 2011-03-27 Ian Lance Taylor <iant@google.com>
4538 * archive.cc (Archive::interpret_header): Return -1 if something
4539 goes wrong. Change callers accordingly.
4541 2011-03-25 Cary Coutant <ccoutant@google.com>
4543 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4544 * testsuite/Makefile.in: Regenerate.
4546 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
4548 * plugin.cc (get_view): New.
4549 (Plugin::load): Pass get_view to the plugin.
4550 (Plugin_manager::get_view): New.
4552 2011-03-21 Ian Lance Taylor <iant@google.com>
4554 * testsuite/final_layout.sh: Rewrite to not use dc.
4555 * testsuite/relro_test.sh: Fail if dc is not present.
4557 2011-03-21 Sriraman Tallam <tmsriram@google.com>
4559 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4561 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4562 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4564 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4565 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4567 2011-03-14 Ian Lance Taylor <iant@google.com>
4569 * script-sections.cc (Sort_output_sections::script_compare):
4570 Rename from is_before, change return type.
4571 (Sort_output_sections::operator()): Adjust accordingly.
4573 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
4576 * testsuite/odr_violation2.cc: Add comment to make all error line
4577 numbers double digits.
4578 * testsuite/debug_msg.sh: Adjust expected errors.
4580 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
4582 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4583 but mark earlier ones as non-canonical
4584 (offset_to_iterator): Update search target and example
4585 (do_addr2line): Return extra lines in a vector*
4586 (format_file_lineno): Extract from do_addr2line
4587 (one_addr2line): Add vector* out-param
4588 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4589 when a lineno entry appeared last for its instruction
4590 (Dwarf_line_info): Add vector* out-param
4591 * object.cc (Relocate_info): Pass NULL for the vector* out-param
4592 * symtab.cc (Odr_violation_compare): Include the lineno in the
4594 (linenos_from_loc): New. Combine the canonical line for an
4595 address with its other lines.
4596 (True_if_intersect): New. Helper functor to make
4597 std::set_intersection a query.
4598 (detect_odr_violations): Compare sets of lines instead of just
4599 one line for each function. This became less deterministic, but
4600 has fewer false positives.
4601 * symtab.h: Declarations.
4602 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4603 mix an optimized and non-optimized object in the same binary
4604 (odr_violation2.so): Same.
4605 * testsuite/Makefile.in: Regenerate from Makefile.am.
4606 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4607 * testsuite/debug_msg.sh: Update line numbers and add
4609 * testsuite/odr_violation1.cc: Use OdrDerived, in a
4610 non-optimized context.
4611 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4612 isn't inlined, and use OdrDerived in an optimized context.
4613 * testsuite/odr_header1.h: Defines OdrDerived, where
4614 optimization will change the
4615 first-instruction-in-the-destructor's file and line number.
4616 * testsuite/odr_header2.h: Defines OdrBase.
4618 2011-03-09 Ian Lance Taylor <iant@google.com>
4620 * fileread.cc (File_read::clear_views): Don't delete the whole
4623 2011-03-08 Ian Lance Taylor <iant@google.com>
4626 * fileread.cc: #include <climits>.
4627 (GOLD_IOV_MAX): Define.
4628 (File_read::read_multiple): Limit number of entries by iov_max.
4629 * fileread.h (class File_read): Always set max_readv_entries to
4632 2011-03-07 Ian Lance Taylor <iant@google.com>
4635 * options.h (class General_options): Add -dy and -dn.
4637 2011-03-02 Cary Coutant <ccoutant@google.com>
4639 * testsuite/script_test_9.t: Add TLS segment.
4641 2011-03-02 Simon Baldwin <simonb@google.com>
4643 * configure.ac: Add check for gnu_indirect_function support in
4644 the toolchain building binutils.
4645 * configure: Rebuild.
4647 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
4649 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4650 plugin only symbols.
4651 (Symbol_table::sized_finalize_symbol) Mark symbol only present
4652 in plugin files as not needed in the symbol table.
4654 2011-02-11 Sriraman Tallam <tmsriram@google.com>
4656 * output.cc (Output_section::add_input_section): Delay fill
4657 generation for section ordering.
4659 2011-02-09 Ian Lance Taylor <iant@google.com>
4662 * object.h (class Sized_relobj): Remove clear_local_symbols.
4663 * reloc.cc (Sized_relobj::do_relocate): Don't call
4664 clear_local_symbols.
4666 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
4668 * plugin.cc (is_visible_from_outside): Return true for symbols
4671 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
4673 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4676 2011-02-02 Sriraman Tallam <tmsriram@google.com>
4678 * icf.h (is_section_foldable_candidate): Change type of parameter
4680 * icf.cc (Icf::find_identical_sections): Change type of local variable
4681 section_name to be std::string.
4682 (is_function_ctor_or_dtor): Change type of parameter to std::string.
4684 2011-01-25 Ian Lance Taylor <iant@google.com>
4686 * script.cc (script_add_extern): Rewrite to use
4687 add_symbol_reference.
4689 2011-01-25 Doug Kwan <dougkwan@google.com>
4691 * icf.cc (get_section_contents): Always lock section's object.
4693 2011-01-24 Ian Lance Taylor <iant@google.com>
4695 * options.h (class General_options): Accept
4696 --no-detect-odr-violations.
4698 2011-01-24 Ian Lance Taylor <iant@google.com>
4700 * version.cc (version_string): Bump to 1.11.
4702 2011-01-24 Ian Lance Taylor <iant@google.com>
4704 * plugin.cc (class Plugin_rescan): Define new class.
4705 (Plugin_manager::claim_file): Set any_claimed_.
4706 (Plugin_manager::save_archive): New function.
4707 (Plugin_manager::save_input_group): New function.
4708 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4710 (Plugin_manager::new_undefined_symbol): New function.
4711 (Plugin_manager::rescan): New function.
4712 (Plugin_manager::rescannable_defines): New function.
4713 (Plugin_manager::add_input_file): Set any_added_.
4714 * plugin.h (class Plugin_manager): define new fields rescannable_,
4715 undefined_symbols_, any_claimed_, and any_added_. Declare
4716 Plugin_rescan as friend. Declare new functions.
4717 (Plugin_manager::Rescannable): Define type.
4718 (Plugin_manager::Rescannable_list): Define type.
4719 (Plugin_manager::Undefined_symbol_list): Define type.
4720 (Plugin_manager::Plugin_manager): Initialize new fields.
4721 * archive.cc (Archive::defines_symbol): New function.
4722 (Add_archive_symbols::run): Pass archive to plugins if any.
4723 * archive.h (class Archive): Declare defines_symbol.
4724 * readsyms.cc (Input_group::~Input_group): New function.
4725 (Finish_group::run): Pass input_group to plugins if any.
4726 * readsyms.h (class Input_group): Declare destructor.
4727 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4730 2011-01-10 Ian Lance Taylor <iant@google.com>
4732 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4734 (Layout::set_segment_offsets): Reset increase_relro before calling
4735 set_section_addresses a second time.
4737 2011-01-04 Cary Coutant <ccoutant@google.com>
4739 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4740 sections before NOBITS sections.
4742 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
4744 * version.cc (print_version): Update copyright to 2011.
4746 2010-12-23 Cary Coutant <ccoutant@google.com>
4748 * output.h (Output_data_reloc::add_output_section): Pass OD instead
4749 of OS to this->add. Add OD parameter to second form of the function.
4751 2010-12-20 Ian Lance Taylor <iant@google.com>
4753 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4754 second of two consecutive entries with same offset.
4756 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4758 * testsuite/Makefile.am (ifuncmain2static_LDADD)
4759 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4760 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4761 to avoid unneeded links against $(LDADD).
4762 * testsuite/Makefile.in: Regenerate.
4764 2010-12-15 Ian Lance Taylor <iant@google.com>
4767 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4768 for R_X86_64_32 and R_X86_64_PC32.
4769 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4770 ver_matching_def_pic.o.
4771 (ver_matching_def_pic.o): New target.
4773 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4775 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4776 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4777 Move definition before File_read::View member definitions.
4778 (File_read::View::~View): Initialize and hold lock before
4779 updating current_mapped_bytes.
4781 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4783 * dwarf_reader.cc: Remove outdated comment.
4784 * gold-threads.cc: Fix typo in error message.
4785 * archive.cc: Fix typos in comments.
4786 * archive.h: Likewise.
4787 * arm-reloc-property.cc: Likewise.
4788 * arm-reloc-property.h: Likewise.
4789 * arm-reloc.def: Likewise.
4791 * attributes.h: Likewise.
4792 * cref.cc: Likewise.
4793 * ehframe.cc: Likewise.
4794 * fileread.h: Likewise.
4796 * i386.cc: Likewise.
4798 * incremental.h: Likewise.
4799 * int_encoding.cc: Likewise.
4800 * layout.h: Likewise.
4801 * main.cc: Likewise.
4802 * merge.h: Likewise.
4803 * object.cc: Likewise.
4804 * object.h: Likewise.
4805 * options.cc: Likewise.
4806 * readsyms.cc: Likewise.
4807 * reduced_debug_output.cc: Likewise.
4808 * reloc.cc: Likewise.
4809 * script-sections.cc: Likewise.
4810 * sparc.cc: Likewise.
4811 * symtab.h: Likewise.
4812 * target-reloc.h: Likewise.
4813 * target.cc: Likewise.
4814 * target.h: Likewise.
4815 * timer.cc: Likewise.
4816 * timer.h: Likewise.
4817 * x86_64.cc: Likewise.
4819 2010-12-09 Cary Coutant <ccoutant@google.com>
4821 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4823 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4824 parameter; change all callers.
4825 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4826 * options.h (warn_execstack): New option.
4828 2010-12-07 Doug Kwan <dougkwan@google.com>
4830 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4831 like function call relocations.
4833 2010-12-07 Ian Lance Taylor <iant@google.com>
4835 * archive.cc (Archive::get_elf_object_for_member): Permit
4836 punconfigured to be NULL.
4837 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4838 (Archive::include_member): Pass NULL to get_elf_object_for_member
4839 if we searched for the archive and this is the first included
4842 2010-12-01 Ian Lance Taylor <iant@google.com>
4844 * dwarf_reader.h (class Sized_dwarf_line_info): Add
4845 track_relocs_type_ field.
4846 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4847 Set track_relocs_type_.
4848 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4849 contents when using RELA relocs.
4850 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4852 * reloc.cc (Track_relocs::next_addend): New function.
4853 * reloc.h (class Track_relocs): Declare next_addend.
4855 2010-12-01 Ian Lance Taylor <iant@google.com>
4857 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4860 2010-12-01 Ian Lance Taylor <iant@google.com>
4862 * README: Update compilers known to work and fail.
4864 2010-11-23 Matthias Klose <doko@ubuntu.com>
4866 * configure.in: For --enable-gold, handle value `default' instead of
4867 `both*'. Always install ld as ld.bfd, install as ld if gold is
4869 * configure: Regenerate.
4871 2010-11-18 Doug Kwan <dougkwan@google.com>
4873 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4874 and right_alignment to be zero. Store result alignment only if it is
4875 greater than existing alignment.
4877 2010-11-16 Cary Coutant <ccoutant@google.com>
4880 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4881 Check for ".zdebug_line".
4883 2010-11-16 Doug Kwan <dougkwan@google.com>
4884 Cary Coutant <ccoutant@google.com>
4886 * output.h (Output_segment::set_section_addresses): Pass increase_relro
4887 by reference; adjust all callers.
4888 * output.cc (Output_segment::set_section_addresses): Adjust references
4889 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4891 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4892 end at page boundary.
4894 2010-11-16 Cary Coutant <ccoutant@google.com>
4897 * layout.cc (Layout::choose_output_section): Transform names of
4898 compressed sections even when using a script with a SECTIONS clause.
4899 (Layout::output_section_name): Remove code to transform
4900 compressed debug section names.
4901 * output.cc (Output_section::add_input_section): Use uncompressed
4902 section size when tracking input sections.
4904 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
4906 * symtab.h (Symbol::NON_PIC_REF): Remove.
4907 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4908 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
4909 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4910 (Symbol::use_plt_offset): Take a flags argument and pass it
4911 directly to needs_dynamic_reloc. Restrict check for undefined
4912 weak symbols to function calls.
4913 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4914 (Target_arm::Scan::global): Use it.
4915 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4916 (Target_arm::Relocate::relocate): Likewise.
4917 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4918 parameter with an r_type parameter. Use get_reference_flags
4920 (Target_arm::Relocate::relocate): Update accordingly.
4921 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4922 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4923 (Target_i386::Scan::global): Likewise.
4924 (Target_i386::Relocate::relocate): Likewise.
4925 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4926 parameter with an r_type parameter. Use get_reference_flags
4928 (Target_i386::Relocate::relocate): Update accordingly.
4929 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4930 (Target_powerpc::Scan::global): Use it.
4931 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4932 (Target_powerpc::Relocate::relocate): Likewise.
4933 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4934 (Target_sparc::Scan::global): Use it.
4935 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4936 (Target_sparc::Relocate::relocate): Likewise.
4937 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4938 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4939 (Target_x86_64::Scan::global): Likewise.
4940 (Target_x86_64::Relocate::relocate): Likewise.
4942 2010-11-08 Doug Kwan <dougkwan@google.com>
4943 Cary Coutant <ccoutant@google.com>
4945 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4946 (Arm_exidx_merge_section::section_contents_): New data member.
4947 (Arm_input_section::Arm_input_section): Initialize original_contents_.
4948 (Arm_input_section::~Arm_input_section): De-allocate memory.
4949 (Arm_input_section::original_contents_): New data member.
4950 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4951 in parameters instead of calling Object::section_contents without
4953 (Arm_output_section::group_section): New parameter TASK. Pass it
4954 to callees that need locking objects.
4955 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
4956 to lock EXIDX input sections. Fix a formatting issue. Call
4957 Arm_exidx_merged_section::build_contents to create merged section
4959 (Arm_output_section::create_stub_group): New parameter TASK. Use it
4960 to lock object of stub table owner.
4961 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4962 TEXT_SIZE to initialize data member TEXT_SIZE_.
4963 (Arm_exidx_input_section::addralign): Fix typo in comment.
4964 (Arm_exidx_input_section::text_size): New method.
4965 (Target_arm::do_relax): New parameter TASK. Pass it to callees
4966 that require locking objects. Lock objects before scanning for stubs
4967 and updating local symbols.
4968 (Arm_input_section<big_endian>::init): Copy contents of original
4970 (Arm_input_section<big_endian>::do_write): Use saved contents of
4971 original input section instead of calling Object::section_contents
4973 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4974 size without calling Object::section_size().
4975 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4976 for size. Allocate a buffer for merged EXIDX entries.
4977 (Arm_exidx_merged_section::build_contents): New method.
4978 (Arm_exidx_merged_section::do_write): Move merge section contents
4979 building code to Arm_exidx_merged_section::build_contetns. Write
4980 out contetns in buffer instead of building it on the fly.
4981 (Arm_relobj::make_exidx_input_section): Also pass text section size
4982 to Arm_exidx_input_section constructor.
4983 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
4984 (Arm_dynobj::do_read_symbols): Fix memory leak.
4985 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4986 * target.h: (class Task): Add forward declaration.
4987 (Target::relax): Add new parameter TASK and pass it to
4989 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
4991 2010-11-05 Cary Coutant <ccoutant@google.com>
4994 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4995 object when reading from the file.
4996 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4998 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4999 when reading section contents.
5000 (get_section_contents): Likewise.
5001 (icf::find_identical_sections): Likewise.
5002 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5003 object when reading from the file.
5004 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5005 the object when doing deferred section layout.
5007 2010-11-03 Nick Clifton <nickc@redhat.com>
5010 * script.h (class Symbol_assignment: name): New member. Returns
5011 the name of the symbol.
5012 * scrfipt.cc (Script_options::is_pending_assignment): New member.
5013 Returns true if the given symbol name is on the list of
5014 assignments wating to be processed.
5015 * archive.cc (should_incldue_member): If the symbol is undefined,
5016 check to see if it is on the list of symbols pending assignment.
5018 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
5020 * script-sections.cc (Script_sections::find_memory_region): Check
5021 for a NULL output section pointer.
5023 2010-10-29 Doug Kwan <dougkwan@google.com>
5025 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5026 Output_section::add_relaxed_input_section.
5027 * output.cc (Output_section::add_relaxed_input_section): Add new
5028 arguments LAYOUT and NAME. Set section order index.
5029 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5030 Copy section order index.
5031 * output.h (Output_section::add_relaxed_input_section): Add new
5032 arguments LAYOUT and NAME.
5034 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5036 * testsuite/Makefile.am: Move gcctestdir/ld rule to
5037 NATIVE_OR_CROSS_LINKER.
5038 * testsuite/Makefile.in: Regenerate.
5040 2010-10-20 Doug Kwan <dougkwan@google.com>
5042 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5043 without SHF_LINK_ORDER flags.
5044 * layout.cc (Layout::choose_output_section): Do not filter
5045 SHF_LINK_ORDER flag in a relocatable link.
5047 2010-10-17 Cary Coutant <ccoutant@google.com>
5049 * output.h (Output_segment::set_section_addresses): Change function
5050 signature. Update all callers.
5051 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5053 (Output_segment::set_section_addresses): Align after last TLS
5054 section. Add padding before last relro section instead of after.
5056 2010-10-17 Doug Kwan <dougkwan@google.com>
5058 * gold/arm.cc (Target_arm::got_section): Use correct order and set
5059 GOT output section to be writable.
5061 2010-10-14 Cary Coutant <ccoutant@google.com>
5063 * debug.h (DEBUG_INCREMENTAL): New flag.
5064 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5065 * gold.cc (queue_initial_tasks): Check parameters for incremental link
5067 * incremental.cc (report_command_line): Ignore all forms of
5069 * layout.cc (Layout::Layout): Check parameters for incremental link
5071 * options.cc (General_options::parse_incremental): New function.
5072 (General_options::parse_no_incremental): New function.
5073 (General_options::parse_incremental_full): New function.
5074 (General_options::parse_incremental_update): New function.
5075 (General_options::incremental_mode_): New data member.
5076 (General_options::finalize): Check incremental_mode_.
5077 * options.h (General_options): Update help text for --incremental.
5078 Add --no-incremental, --incremental-full, --incremental-update.
5079 (General_options::Incremental_mode): New enum type.
5080 (General_options::incremental_mode): New function.
5081 (General_options::incremental_mode_): New data member.
5082 * parameters.cc (Parameters::incremental_mode_): New data member.
5083 (Parameters::set_options): Set incremental_mode_.
5084 (Parameters::set_incremental_full): New function.
5085 (Parameters::incremental): New function.
5086 (Parameters::incremental_update): New function.
5087 (set_parameters_incremental_full): New function.
5088 * parameters.h (Parameters::set_incremental_full): New function.
5089 (Parameters::incremental): New function.
5090 (Parameters::incremental_update): New function.
5091 (Parameters::incremental_mode_): New data member.
5092 (set_parameters_incremental_full): New function.
5093 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5094 incremental link mode.
5095 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5096 (Sized_relobj::do_relocate_sections): Likewise.
5097 * testsuite/Makefile.am (incremental_test): Use --incremental-full
5099 * testsuite/Makefile.in: Regenerate.
5100 * testsuite/incremental_test.sh: Filter all forms of --incremental.
5102 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5104 * script-sections.h (class Script_sections): Make
5105 Sections_elements typedef public.
5106 * script-sections.cc (class Sort_output_sections): Add elements_
5107 field. Add constructor which sets it; change all callers.
5108 (Sort_output_sections::is_before): New function.
5109 (Sort_output_sections::operator()): Call is_before.
5110 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5112 * testsuite/script_test_10.sh: New test. Test script section
5114 * testsuite/script_test_10.t: Likewise.
5115 * testsuite/script_test_10.s: Likewise.
5116 * testsuite/Makefile.am: Wrap the cross linker tests and the
5117 common tests into NATIVE_OR_CROSS_LINKER.
5118 (check_SCRIPTS): Add script_test_10.sh.
5119 (check_DATA): Add script_test_10.stdout.
5120 (script_test_10.o, script_test_10): New targets.
5121 (script_test_10.stdout): New target.
5122 * configure, testsuite/Makefile.in: Regenerate.
5124 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5126 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5127 error for the deprecated relocations.
5128 (Target_arm::Scan::global): Likewise.
5129 (Target_arm::Relocate::relocate): Likewise.
5131 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
5133 * fileread.cc (Input_file::find_file): Initialize *found_name
5134 and *namep when using the fallback search for case 4.
5136 2010-10-11 Cary Coutant <ccoutant@google.com>
5138 * options.h (class General_options): Redefine -z lazy as an alias for
5139 the negation of -z now.
5141 2010-10-11 Ian Lance Taylor <iant@google.com>
5143 * resolve.cc (symbol_to_bits): Report the value of the unsupported
5146 2010-10-06 Nick Clifton <nickc@redhat.com>
5148 * script-sections.cc(class Memory_region): Remove
5149 current_lma_offset_ field. Rename current_vma_offset_ to
5150 current_offset_. Add last_section_ field.
5151 (Memory_region::get_current_vma_address): Rename to
5152 get_current_address.
5153 (Memory_region::get_current_lma_address): Delete.
5154 (Memory_region::increment_vma_offset): Rename to
5156 (Memory_region::increment_lma_offset): Delete.
5157 (Memory_region::attributes_compatible): New method. Returns
5158 true if the provided section is compatible with the region.
5159 (Memory_region::get_last_section): New method. Returns the last
5160 section to use the region.
5161 (Memory_region::set_last_section): New method. Stores the last
5162 section to use the region.
5163 (Script_sections::block_in_region): New method. Returns true if
5164 a block of memory is contained within a region.
5165 (Script_sections::find_memory_region): New method. Locates a
5166 memory region to be used to set a VMA or LMA address.
5167 (Output_section_definition::set_section_addresses): Add code to
5168 check for addresses set by memory regions.
5169 (Output_segment::set_section_addresses): Remove memory region
5171 (Script_sections::create_segment): Add a warning if a header
5172 segment is created outside of any region.
5173 * script-sections.h (class Script_sections): Add prototypes for
5174 find_memory_region and block_in_region methods.
5175 * testsuite/memory_test.s: Use .long instead of .word.
5176 * testsuite/memory_test.t: Add some more output sections.
5177 * testsuite/memory_test.sh: Update expected output.
5179 2010-10-02 Doug Kwan <dougkwan@google.com>
5181 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5182 defintion to symtab.h
5183 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5184 declaration to defintion.
5186 2010-10-01 Nick Clifton <nickc@redhat.com>
5188 * expression.cc (eval): Replace dummy argument with NULL.
5189 (eval_maybe_dot): Check for a NULL result section pointer.
5190 (Symbol_expression::value): Likewise.
5191 (Dot_expression::value): Likewise.
5192 (BINARY_EXPRESSION): Likewise.
5193 (Max_expression::value): Likewise.
5194 (Min_expression::value): Likewise.
5195 (Absolute_expression::value): Likewise.
5196 (Addr_expression::value_from_output_section): Likewise.
5197 (Loaddddr_expression::value_from_output_section): Likewise.
5198 (Segment_start_expression::value): Likewise.
5199 * script-sections.cc
5200 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5202 (Sections_elememt_dot_assignment::set_section_addresses):
5204 (Output_data_expression::do_write_to_buffer): Likewise.
5205 (Output_section_definition::finalize_symbols): Likewise.
5206 (Output_section_definition::set_section_addresses): Likewise.
5208 2010-09-30 Doug Kwan <dougkwan@google.com>
5210 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5212 2010-09-28 Sriraman Tallam <tmsriram@google.com>
5214 * target.h (Target::can_icf_inline_merge_sections): New virtual
5216 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5218 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5220 * icf.cc (get_section_contents): Inline merge sections only when
5223 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5225 * configure: Regenerate.
5227 2010-09-17 Ian Lance Taylor <iant@google.com>
5229 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5230 * testsuite/Makefile.am (memory_test.o): New target.
5231 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5233 * testsuite/Makefile.in: Rebuild.
5235 2010-09-17 Doug Kwan <dougkwan@google.com>
5237 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5238 defintion if relocation uses GOT entries of the symbol.
5239 * testsuite/icf_safe_test.sh: Fix test.
5240 * testsuite/icf_safe_so_test.sh: Fix test.
5242 2010-09-16 Cary Coutant <ccoutant@google.com>
5244 * script_sections.cc (class Memory_region): Remove "NULL" from
5245 vector initializations.
5247 2010-09-15 Cary Coutant <ccoutant@google.com>
5249 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5250 Resolve forwarding symbols.
5252 2010-09-15 Doug Kwan <dougkwan@google.com>
5254 * gold/testsuite/script_test_3.t: Add ARM special sections.
5255 * gold/testsuite/script_test_4.t: Same.
5256 * gold/testsuite/script_test_5.t: Same.
5257 * gold/testsuite/script_test_6.t: Same.
5258 * gold/testsuite/script_test_7.t: Same.
5259 * gold/testsuite/script_test_7.t: Same.
5260 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5262 2010-09-14 Cary Coutant <ccoutant@google.com>
5264 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5265 (Target_x86_64::Relocate::relocate_tls): Replace check for
5266 saw_tls_block_reloc_ with test for executable section.
5268 2010-09-12 Cary Coutant <ccoutant@google.com>
5270 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5271 position-independent executables to shared libraries need dynamic
5273 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5274 position-independent executables.
5275 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5276 * testsuite/Makefile.in: Regenerate.
5278 2010-09-10 Nick Clifton <nickc@redhat.com>
5281 * testsuite/memory_test.t: Discard any sections that are not
5284 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
5287 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5288 "This::" to work around a bug in gcc 4.2.
5290 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5292 2010-09-09 Rafael Espindola <espindola@google.com>
5294 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5295 sections with different PF_X flags in the same segment.
5296 (Layout::find_first_load_seg): Search all segments to find the first
5298 * options.h (rosegment): New.
5300 2010-09-08 Rafael Espindola <espindola@google.com>
5302 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5304 2010-09-08 Doug Kwan <dougkwan@google.com>
5306 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5307 (Arm_relobj::do_relocate_sections): Add new parameter for output
5308 file to match the parent.
5309 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5310 of local symbols instead of input values. Update code to track
5311 changes in gold::relocate_section.
5312 * object.cc (Sized_relobj::compute_final_local_value): New methods.
5313 (Sized_relobj::compute_final_local_value_internal): New methods.
5314 (Sized_relobj::do_finalize_local_symbols): Move code from loop
5315 body into private version of Sized_relobj::compute_final_local_value.
5316 Call the inline method.
5317 * object.h (Symbol_value::Symbol_value): Define destructor. Free
5318 merged symbol value if there is one.
5319 (Symbol_value::has_output_value): New method defintiion.
5320 (Sized_relobj::Compute_final_local_value_status): New enum type.
5321 (Sized_relobj::compute_final_local_value): New methods.
5322 (Sized_relobj::compute_final_local_value_internal): New methods.
5323 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5324 and arm_cortex_a8.sh.
5325 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5326 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5328 * Makefile.in: Regenerate.
5329 * testsuite/arm_bl_out_of_range.s: Update test.
5330 * testsuite/thumb_bl_out_of_range.s: Ditto.
5331 * testsuite/thumb_blx_out_of_range.s: Ditto.
5332 * testsuite/arm_branch_out_of_range.sh: New file.
5333 * testsuite/arm_cortex_a8.sh: Ditto.
5334 * testsuite/arm_cortex_a8_b.s: Ditto.
5335 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5336 * testsuite/arm_cortex_a8_b_local.s: Ditto.
5337 * testsuite/arm_cortex_a8_bl.s: Ditto.
5338 * testsuite/arm_cortex_a8_blx.s: Ditto.
5339 * testsuite/arm_cortex_a8_local.s: Ditto.
5340 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5341 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5343 2010-09-08 Rafael Espindola <espindola@google.com>
5345 * Makefile.am (memory_test.stdout): Run readelf with -W.
5346 * Makefile.in: Regenerate.
5347 * testsuite/memory_test.sh: Make the regexps accept both 32 and
5350 2010-09-08 Rafael Espindola <espindola@google.com>
5352 * script-sections.cc (Script_sections::add_memory_region): Convert
5353 field precision to int.
5354 * script.cc (script_set_section_region, script_set_section_region):
5355 Convert field precision to int.
5357 2010-09-08 Rafael Espindola <espindola@google.com>
5359 * arm.cc (do_finalize_sections): Create the __exidx_start and
5360 __exdix_end symbols even when the section is missing.
5362 2010-09-08 Nick Clifton <nickc@redhat.com>
5364 * README: Remove claim that MEMORY is not supported.
5365 * expression.cc (script_exp_function_origin)
5366 (script_exp_function_length): Move from here to ...
5367 * script.cc: ... here.
5368 (script_set_section_region, script_add_memory)
5369 (script_parse_memory_attr, script_include_directive): New
5371 * script-sections.cc
5372 (class Memory_region): New class.
5373 (class Output_section_definition): Add set_memory_region,
5374 set_section_vma, set_section_lma and get_section_name methods.
5375 (class Script_Sections): Add add_memory_region,
5376 find_memory_region, find_memory_region_origin,
5377 find_memory_region_length and set_memory_region methods.
5378 Have set_section_addresses method walk the list of set memory
5380 Extend the print methos to display memory regions.
5381 * script-sections.h: Add prototypes for new methods.
5382 Add enum for MEMORY region attributes.
5383 * yyscript.y: Add support for parsing MEMORY regions.
5384 * script-c.h: Add prototypes for new functions.
5385 * testsuite/Makefile.am: Add test of MEMORY region functionality.
5386 * testsuite/Makefile.in: Regenerate.
5387 * testsuite/memory_test.sh: New script.
5388 * testsuite/memory_test.s: New assembler source file.
5389 * testsuite/memory_test.t: New linker script.
5391 2010-08-27 Doug Kwan <dougkwan@google.com>
5393 * gold/resolve.cc (Symbol_table::should_override): Let a weak
5394 reference override an existing dynamic weak reference.
5395 * testsuite/Makefile.am: Add new test dyn_weak_ref.
5396 * testsuite/Makefile.in: Regenerate.
5397 * testsuite/dyn_weak_ref.sh: New file.
5398 * testsuite/dyn_weak_ref_1.c: Ditto.
5399 * testsuite/dyn_weak_ref_2.c: Ditto.
5401 2010-08-27 Ian Lance Taylor <iant@google.com>
5403 * incremental.h (class Incremental_input_entry): Add virtual
5406 2010-08-27 Ian Lance Taylor <iant@google.com>
5408 * testsuite/start_lib_test_3.c: Mark t3 as used.
5410 2010-08-27 Nick Clifton <nickc@redhat.com>
5412 * options.cc (version_script): Fix small typo in previous
5415 2010-08-25 Nick Clifton <nickc@redhat.com>
5417 * archive.cc: Formatting fixes: Remove whitespace between
5418 typename and following asterisk. Remove whitespace between
5419 function name and opening parenthesis.
5420 * archive.h: Likewise.
5422 * attributes.cc: Likewise.
5423 * attributes.h: Likewise.
5424 * common.cc: Likewise.
5425 * copy-relocs.cc: Likewise.
5426 * dirsearch.h: Likewise.
5427 * dynobj.cc: Likewise.
5428 * ehframe.cc: Likewise.
5429 * ehframe.h: Likewise.
5430 * expression.cc: Likewise.
5431 * fileread.cc: Likewise.
5432 * fileread.h: Likewise.
5434 * gold-threads.cc: Likewise.
5435 * gold.cc: Likewise.
5436 * i386.cc: Likewise.
5438 * incremental-dump.cc: Likewise.
5439 * incremental.cc: Likewise.
5440 * layout.cc: Likewise.
5441 * layout.h: Likewise.
5442 * main.cc: Likewise.
5443 * merge.cc: Likewise.
5444 * merge.h: Likewise.
5445 * object.cc: Likewise.
5446 * object.h: Likewise.
5447 * options.cc: Likewise.
5448 * options.h: Likewise.
5449 * output.cc: Likewise.
5450 * output.h: Likewise.
5451 * plugin.cc: Likewise.
5452 * plugin.h: Likewise.
5453 * powerpc.cc: Likewise.
5454 * reloc.cc: Likewise.
5455 * script-c.h: Likewise.
5456 * script-sections.cc: Likewise.
5457 * script.cc: Likewise.
5458 * stringpool.cc: Likewise.
5459 * symtab.cc: Likewise.
5460 * symtab.h: Likewise.
5461 * target.cc: Likewise.
5462 * timer.cc: Likewise.
5463 * timer.h: Likewise.
5464 * version.cc: Likewise.
5465 * x86_64.cc: Likewise.
5467 2010-08-24 Nick Clifton <nickc@redhat.com>
5470 * layout.cc (segment_precedes): Sort segments by their physical
5471 addresses, if they have been set.
5473 2010-08-23 Cary Coutant <ccoutant@google.com>
5475 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5477 (Lib_group::include_member): Unlock object after deleting its
5479 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5482 2010-08-19 Neil Vachharajani <nvachhar@google.com>
5483 Cary Coutant <ccoutant@google.com>
5485 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5486 constructor, and set_blocker.
5487 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5489 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5490 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5491 * testsuite/Makefile.am (start_lib_test): New test case.
5492 * testsuite/Makefile.in: Regenerate.
5493 * testsuite/start_lib_test_main.c: New file.
5494 * testsuite/start_lib_test_1.c: New file.
5495 * testsuite/start_lib_test_2.c: New file.
5496 * testsuite/start_lib_test_3.c: New file.
5498 2010-08-19 Ian Lance Taylor <iant@google.com>
5500 * Makefile.in: Rebuild with automake 1.11.1.
5501 * aclocal.m4: Likewise.
5502 * testsuite/Makefile.in: Likewise.
5504 2010-08-19 Ian Lance Taylor <iant@google.com>
5507 * i386.cc (class Output_data_plt_i386): Update declarations.
5508 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
5509 local_ifuncs_ fields.
5510 (Target_i386::do_plt_section_for_global): New function.
5511 (Target_i386::do_plt_section_for_local): New function.
5512 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5513 parameter; change all callers. Initialize global_ifuncs_ and
5514 local_ifuncs_. If doing a static link define __rel_iplt_start and
5516 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5517 (Output_data_plt_i386::add_local_ifunc_entry): New function.
5518 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5520 (Target_i386::make_plt_section): New function, broken out of
5521 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
5522 (Target_i386::make_plt_entry): Call make_plt_section.
5523 (Target_i386::make_local_ifunc_plt_entry): New function.
5524 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5525 (Target_i386::Scan::local): Handle IFUNC symbols. Add
5526 R_386_IRELATIVE to switch.
5527 (Target_i386::Scan::global): Likewise.
5528 (Target_i386::Relocate::relocate): Likewise.
5529 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5531 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5532 (Target_x86_64::do_plt_section_for_global): New function.
5533 (Target_x86_64::do_plt_section_for_local): New function.
5534 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5535 parameter; change all callers. If doing a static link define
5536 __rela_iplt_start and __rela_iplt_end.
5537 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5538 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5539 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5541 (Target_x86_64::make_local_ifunc_plt_entry): New function.
5542 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5544 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5545 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
5546 R_X86_64_IRELATIVE to switch.
5547 (Target_x86_64::Scan::global): Likewise.
5548 (Target_x86_64::Relocate::relocate): Likewise.
5549 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5551 * target.h (class Target): Add plt_section_for_global and
5552 plt_section_for_local functions. Add do_plt_section_for_global
5553 and do_plt_section_for_local virtual functions.
5554 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
5555 clarifying comments.
5556 (Symbol::use_plt_offset): Handle IFUNC symbol.
5557 * object.cc (Sized_relobj::Sized_relobj): Initialize
5559 (Sized_relobj::local_has_plt_offset): New function.
5560 (Sized_relobj::local_plt_offset): New function.
5561 (Sized_relobj::set_local_plt_offset): New function.
5562 (Sized_relobj::do_count): Handle IFUNC symbol.
5563 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
5564 a bit away from input_shndx_ field. Add set_is_func_symbol and
5565 is_ifunc_symbol functions.
5566 (class Sized_relobj): Update declarations. Remove Tls_got_entry
5567 and Local_tls_got_offsets. Define Local_plt_offsets. Add
5568 local_plt_offsets_ field.
5569 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5570 * output.h (class Output_section_data): Add non-const
5571 output_section function.
5572 (class Output_data_got): Update declarations.
5573 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5574 Add use_plt_offset parameter to global and local constructors.
5575 Change all callers. Change local_sym_index_ field to 31 bits.
5576 Change GSYM_CODE and CONSTANT_CODE accordingly.
5577 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5578 doing a static link don't set sh_link field.
5579 (Output_data_got::Got_entry::write): Use PLT offset if
5581 (Output_data_got::add_global_plt): New function.
5582 (Output_data_got::add_local_plt): New function.
5583 * target-reloc.h (relocate_section): Handle IFUNC symbol.
5584 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5585 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5586 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5587 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5589 * testsuite/ifunc-sel.h: New file.
5590 * testsuite/ifuncmain1.c: New file.
5591 * testsuite/ifuncmain1vis.c: New file.
5592 * testsuite/ifuncmod1.c: New file.
5593 * testsuite/ifuncdep2.c: New file.
5594 * testsuite/ifuncmain2.c: New file.
5595 * testsuite/ifuncmain3.c: New file.
5596 * testsuite/ifuncmod3.c: New file.
5597 * testsuite/ifuncmain4.c: New file.
5598 * testsuite/ifuncmain5.c: New file.
5599 * testsuite/ifuncmod5.c: New file.
5600 * testsuite/ifuncmain6pie.c: New file.
5601 * testsuite/ifuncmod6.c: New file.
5602 * testsuite/ifuncmain7.c: New file.
5603 * configure, testsuite/Makefile.in: Rebuild.
5605 2010-08-18 Ian Lance Taylor <iant@google.com>
5608 (Output_section_incremental_inputs::write_input_files): Add cast
5609 to avoid signed/unsigned comparison warning.
5610 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5612 2010-08-12 Cary Coutant <ccoutant@google.com>
5614 * common.cc (Sort_commons::operator()): Remove unnecessary code.
5616 2010-08-13 Ian Lance Taylor <iant@google.com>
5618 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5620 2010-08-12 Cary Coutant <ccoutant@google.com>
5621 Doug Kwan <dougkwan@google.com>
5623 * resolve.cc (Symbol_table::should_override): When a weak dynamic
5624 defintion overrides non-weak undef, remember that the original undef
5626 * symtab.cc (Symbol_table::sized_write_global): For undef without
5627 an original weak binding, set binding to global in output.
5628 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5629 * testsuite/Makefile.in: Regenerate.
5630 * testsuite/strong_ref_weak_def.sh: New file.
5631 * testsuite/strong_ref_weak_def_1.c: Ditto.
5632 * testsuite/strong_ref_weak_def_2.c: Ditto.
5634 2010-08-12 Cary Coutant <ccoutant@google.com>
5636 * testsuite/incremental_test.sh: Rewrite.
5637 * testsuite/incremental_test_1.c: Rewrite.
5638 * testsuite/incremental_test_2.c: Rewrite.
5640 2010-08-12 Cary Coutant <ccoutant@google.com>
5642 * arm.cc (Target_arm::got_size): Add const.
5643 (Target_arm::got_entry_count): New function.
5644 (Target_arm::plt_entry_count): New function.
5645 (Target_arm::first_plt_entry_offset): New function.
5646 (Target_arm::plt_entry_size): New function.
5647 (Output_data_plt_arm::entry_count): New function.
5648 (Output_data_plt_arm::first_plt_entry_offset): New function.
5649 (Output_data_plt_arm::get_plt_entry_size): New function.
5650 * i386.cc (Target_i386::got_size): Add const.
5651 (Target_i386::got_entry_count): New function.
5652 (Target_i386::plt_entry_count): New function.
5653 (Target_i386::first_plt_entry_offset): New function.
5654 (Target_i386::plt_entry_size): New function.
5655 (Output_data_plt_i386::entry_count): New function.
5656 (Output_data_plt_i386::first_plt_entry_offset): New function.
5657 (Output_data_plt_i386::get_plt_entry_size): New function.
5658 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5659 find_incremental_inputs_sections. Dump incremental_got_plt section.
5660 * incremental.cc: Include target.h.
5661 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5662 parameter. Adjust all callers. Find incremental_got_plt section.
5663 (Incremental_inputs::create_data_sections): Create incremental_got_plt
5665 (Output_section_incremental_inputs::set_final_data_size): Calculate
5666 size of incremental_got_plt section.
5667 (Output_section_incremental_inputs::do_write): Write the
5668 incremental_got_plt section.
5669 (Got_plt_view_info): New struct.
5670 (Local_got_offset_visitor): New class.
5671 (Global_got_offset_visitor): New class.
5672 (Global_symbol_visitor_got_plt): New class.
5673 (Output_section_incremental_inputs::write_got_plt): New function.
5674 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5675 Add parameter. Adjust all callers.
5676 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5677 (Incremental_inputs::got_plt_section): New function.
5678 (Incremental_inputs::got_plt_section_): New data member.
5679 (Incremental_got_plt_reader): New class.
5680 * layout.cc (Layout::create_incremental_info_sections): Add the
5681 incremental_got_plt section.
5682 * object.h (Got_offset_list::get_list): New function.
5683 (Got offset_list::for_all_got_offsets): New function.
5684 (Sized_relobj::local_got_offset_list): New function.
5685 * powerpc.cc (Target_powerpc::got_size): Add const.
5686 (Target_powerpc::got_entry_count): New function.
5687 (Target_powerpc::plt_entry_count): New function.
5688 (Target_powerpc::first_plt_entry_offset): New function.
5689 (Target_powerpc::plt_entry_size): New function.
5690 (Output_data_plt_powerpc::entry_count): New function.
5691 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5692 (Output_data_plt_powerpc::get_plt_entry_size): New function.
5693 * sparc.cc (Target_sparc::got_size): Add const.
5694 (Target_sparc::got_entry_count): New function.
5695 (Target_sparc::plt_entry_count): New function.
5696 (Target_sparc::first_plt_entry_offset): New function.
5697 (Target_sparc::plt_entry_size): New function.
5698 (Output_data_plt_sparc::entry_count): New function.
5699 (Output_data_plt_sparc::first_plt_entry_offset): New function.
5700 (Output_data_plt_sparc::get_plt_entry_size): New function.
5701 * symtab.h (Symbol::got_offset_list): New function.
5702 (Symbol_table::for_all_symbols): New function.
5703 * target.h (Sized_target::got_entry_count): New function.
5704 (Sized_target::plt_entry_count): New function.
5705 (Sized_target::plt_entry_size): New function.
5706 * x86_64.cc (Target_x86_64::got_size): Add const.
5707 (Target_x86_64::got_entry_count): New function.
5708 (Target_x86_64::plt_entry_count): New function.
5709 (Target_x86_64::first_plt_entry_offset): New function.
5710 (Target_x86_64::plt_entry_size): New function.
5711 (Output_data_plt_x86_64::entry_count): New function.
5712 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5713 (Output_data_plt_x86_64::get_plt_entry_size): New function.
5715 2010-08-12 Cary Coutant <ccoutant@google.com>
5717 * archive.cc: Include incremental.h.
5718 (Archive::Archive): Initialize incremental_info_.
5719 (Archive::include_member): Record archive members in incremental info.
5720 (Add_archive_symbols::run): Record begin and end of an archive in
5722 (Lib_group::include_member): Record objects in incremental info.
5723 * archive.h (Incremental_archive_entry): Forward declaration.
5724 (Archive::set_incremental_info): New member function.
5725 (Archive::incremental_info): New member function.
5726 (Archive::Unused_symbol_iterator): New class.
5727 (Archive::unused_symbols_begin): New member function.
5728 (Archive::unused_symbols_end): New member function.
5729 (Archive::incremental_info_): New data member.
5730 * incremental-dump.cc (find_input_containing_global): New function.
5731 (dump_incremental_inputs): Dump new incremental info sections.
5732 * incremental.cc: Include symtab.h.
5733 (Output_section_incremental_inputs): New class.
5734 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5735 new incremental info sections.
5736 (Sized_incremental_binary::do_check_inputs): Likewise.
5737 (Incremental_inputs::report_archive): Remove.
5738 (Incremental_inputs::report_archive_begin): New function.
5739 (Incremental_inputs::report_archive_end): New function.
5740 (Incremental_inputs::report_object): New function.
5741 (Incremental_inputs::finalize_inputs): Remove.
5742 (Incremental_inputs::report_input_section): New function.
5743 (Incremental_inputs::report_script): Rewrite.
5744 (Incremental_inputs::finalize): Do nothing but finalize string table.
5745 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5746 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5747 (Incremental_inputs::create_data_sections): New function.
5748 (Incremental_inputs::relocs_entsize): New function.
5749 (Output_section_incremental_inputs::set_final_data_size): New function.
5750 (Output_section_incremental_inputs::do_write): New function.
5751 (Output_section_incremental_inputs::write_header): New function.
5752 (Output_section_incremental_inputs::write_input_files): New function.
5753 (Output_section_incremental_inputs::write_info_blocks): New function.
5754 (Output_section_incremental_inputs::write_symtab): New function.
5755 * incremental.h (Incremental_script_entry): Forward declaration.
5756 (Incremental_object_entry): Forward declaration.
5757 (Incremental_archive_entry): Forward declaration.
5758 (Incremental_inputs): Forward declaration.
5759 (Incremental_inputs_header_data): Remove.
5760 (Incremental_inputs_header): Remove.
5761 (Incremental_inputs_header_write): Remove.
5762 (Incremental_inputs_entry_data): Remove.
5763 (Incremental_inputs_entry): Remove.
5764 (Incremental_inputs_entry_write): Remove.
5765 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5766 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5767 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5768 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5770 (Incremental_input_entry): New class.
5771 (Incremental_script_entry): New class.
5772 (Incremental_object_entry): New class.
5773 (Incremental_archive_entry): New class.
5774 (Incremental_inputs::Incremental_inputs): Initialize new data members.
5775 (Incremental_inputs::report_inputs): Remove.
5776 (Incremental_inputs::report_archive): Remove.
5777 (Incremental_inputs::report_archive_begin): New function.
5778 (Incremental_inputs::report_archive_end): New function.
5779 (Incremental_inputs::report_object): Change prototype.
5780 (Incremental_inputs::report_input_section): New function.
5781 (Incremental_inputs::report_script): Change prototype.
5782 (Incremental_inputs::get_reloc_count): New function.
5783 (Incremental_inputs::set_reloc_count): New function.
5784 (Incremental_inputs::create_data_sections): New function.
5785 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5786 (Incremental_inputs::inputs_section): New function.
5787 (Incremental_inputs::symtab_section): New function.
5788 (Incremental_inputs::relocs_section): New function.
5789 (Incremental_inputs::get_stringpool): Add const.
5790 (Incremental_inputs::command_line): Add const.
5791 (Incremental_inputs::inputs): Remove.
5792 (Incremental_inputs::command_line_key): New function.
5793 (Incremental_inputs::input_file_count): New function.
5794 (Incremental_inputs::input_files): New function.
5795 (Incremental_inputs::relocs_entsize): New function.
5796 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5797 (Incremental_inputs::finalize_inputs): Remove.
5798 (Incremental_inputs::Input_info): Remove.
5799 (Incremental_inputs::lock_): Remove.
5800 (Incremental_inputs::inputs_): Change type.
5801 (Incremental_inputs::inputs_map_): Remove.
5802 (Incremental_inputs::current_object_entry_): New data member.
5803 (Incremental_inputs::inputs_section_): New data member.
5804 (Incremental_inputs::symtab_section_): New data member.
5805 (Incremental_inputs::relocs_section_): New data member.
5806 (Incremental_inputs::reloc_count_): New data member.
5807 (Incremental_inputs_reader): New class.
5808 (Incremental_symtab_reader): New class.
5809 (Incremental_relocs_reader): New class.
5810 * layout.cc (Layout::finalize): Move finalization of incremental info
5811 and creation of incremental info sections to follow finalization of
5812 symbol table. Set offsets for postprocessing sections.
5813 (Layout::create_incremental_info_sections): Call
5814 Incremental_inputs::create_data_sections. Add incremental symtab
5815 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
5816 sections to layout after input sections.
5817 * layout.h (struct Timespec): Forward declaration.
5818 (Layout::incremental_inputs): Add const.
5819 (Layout::create_incremental_info_sections): Add parameter.
5820 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5821 * object.cc: Include incremental.h.
5822 (Relobj::finalize_incremental_relocs): New function.
5823 (Sized_relobj::do_layout): Record input sections in incremental info.
5824 * object.h (Object::output_section): New function.
5825 (Object::output_section_offset): Moved from Relobj.
5826 (Object::get_incremental_reloc_base): New function.
5827 (Object::get_incremental_reloc_count): New function.
5828 (Object::do_output_section): New function.
5829 (Object::do_output_section_offset): Moved from Relobj.
5830 (Object::do_get_incremental_reloc_base): New function.
5831 (Object::do_get_incremental_reloc_count): New function.
5832 (Object::Object): Initialize new data members.
5833 (Relobj::output_section): Renamed do_output_section and moved to
5835 (Relobj::output_section_offset): Moved to Object.
5836 (Relobj::do_get_incremental_reloc_base): New function.
5837 (Relobj::do_get_incremental_reloc_count): New function.
5838 (Relobj::allocate_incremental_reloc_counts): New function.
5839 (Relobj::count_incremental_reloc): New function.
5840 (Relobj::finalize_incremental_relocs): New function.
5841 (Relobj::next_incremental_reloc_index): New function.
5842 (Relobj::reloc_counts_): New data member.
5843 (Relobj::reloc_bases_): New data member.
5844 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
5845 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
5846 (Sized_relobj::incremental_relocs_scan): New function.
5847 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5848 (Sized_relobj::incremental_relocs_write): New function.
5849 (Sized_relobj::incremental_relocs_write_reltype): New function.
5850 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5852 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5853 archives and object files elsewhere.
5854 (Add_symbols::run): Report object files here.
5855 (Finish_group::run): Report end of archive at end of group.
5856 * reloc.cc: Include layout.h, incremental.h.
5857 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5858 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5859 (Sized_relobj::incremental_relocs_scan): New function.
5860 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5861 (Sized_relobj::do_relocate_sections): Write incremental relocations.
5862 (Sized_relobj::incremental_relocs_write): New function.
5863 (Sized_relobj::incremental_relocs_write_reltype): New function.
5864 * script.cc (read_input_script): Rewrite test for incremental link.
5865 Change call to Incremental_inputs::report_script.
5866 * symtab.h (Symbol_table::first_global_index): New function.
5867 (Symbol_table::output_count): New function.
5869 2010-08-12 Doug Kwan <dougkwan@google.com>
5871 * arm.cc (Target_arm::merge_object_attributes): Check command line
5872 options --no-wchar-size-warning and --no-enum-size-warning.
5873 * options.h (General_options): Add ld-compatible options
5874 --no-enum-size-warning and --no-wchar-size-warning.
5876 2010-08-04 Ian Lance Taylor <iant@google.com>
5878 * x86_64.cc (Target_x86_64::Scan::local): Use
5879 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5880 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5881 (Target_x86_64::Scan::global): Likewise.
5882 (Target_x86_64::Relocate::relocate): Likewise.
5883 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5886 2010-08-03 Cary Coutant <ccoutant@google.com>
5888 * merge.cc (Output_merge_string::do_add_input_section): Count strings
5889 to reserve space in merged_strings vector. Keep total input size
5891 (Output_merge_string::do_print_merge_stats): Print total input size.
5892 * merge.h (Output_merge_string): Add input_size_ field.
5893 * stringpool.cc (Stringpool_template::string_length): Move
5894 implementations out of Stringpool_template class and place in
5896 * stringpool.h (string_length): Move out of Stringpool_template.
5898 2010-08-03 Ian Lance Taylor <iant@google.com>
5901 * layout.cc (relaxation_loop_body): If address of load segment is
5902 set, adjust address to include headers if possible.
5904 2010-08-03 Ian Lance Taylor <iant@google.com>
5906 * version.cc (version_string): Bump to 1.10.
5908 2010-08-03 Ian Lance Taylor <iant@google.com>
5911 * layout.h (enum Output_section_order): Define.
5912 (class Layout): Update declarations.
5913 * layout.cc (Layout::get_output_section): Add order parameter.
5914 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5915 is_first_non_relro parameters. Change all callers.
5916 (Layout::choose_output_section): Likewise.
5917 (Layout::add_output_section_data): Likewise.
5918 (Layout::make_output_section): Likewise. Set order.
5919 (Layout::default_section_order): New function.
5920 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5921 * output.cc (Output_section::Output_section): Initialize order_.
5922 Don't initialize deleted fields.
5923 (Output_segment::Output_segment): Don't initialize deleted
5925 (Output_segment::add_output_section_to_load): New function
5926 replacing add_output_section. Change all callers to call this or
5927 add_output_section_to_nonload.
5928 (Output_segment::add_output_section_to_nonload): New function.
5929 (Output_segment::remove_output_section): Rewrite.
5930 (Output_segment::add_initial_output_data): Likewise.
5931 (Output_segment::has_any_data_sections): Likewise.
5932 (Output_segment::is_first_section_relro): Likewise.
5933 (Output_segment::maximum_alignment): Likewise.
5934 (Output_segment::has_dynamic_reloc): New function replacing
5935 dynamic_reloc_count. Change all callers.
5936 (Output_segment::has_dynamic_reloc_list): New function replacing
5937 dynamic_reloc_count_list. Change all callers.
5938 (Output_segment::set_section_addresses): Rewrite.
5939 (Output_segment::set_offset): Rewrite.
5940 (Output_segment::find_first_and_last_list): Remove.
5941 (Output_segment::set_tls_offsets): Rewrite.
5942 (Output_segment::first_section_load_address): Likewise.
5943 (Output_segment::output_section_count): Likewise.
5944 (Output_segment::section_with_lowest_load_address): Likewise.
5945 (Output_segment::write_section_headers): Likewise.
5946 (Output_segment::print_sections_to_map): Likewise.
5947 * output.h (class Output_data): Remove dynamic_reloc_count_
5948 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
5949 (Output_data::add_dynamic_reloc): Rewrite.
5950 (Output_data::has_dynamic_reloc): New function.
5951 (Output_data::dynamic_reloc_count): Remove.
5952 (class Output_section): Add order_ field. Remvoe is_relro_local_,
5953 is_last_relro_, is_first_non_relro_, is_interp_,
5954 is_dynamic_linker_section_ fields. Add order and set_order
5955 functions. Remove is_relro_local, set_is_relro_local,
5956 is_last_relro, set_is_last_relro, is_first_non_relro,
5957 set_is_first_non_relro functions, is_interp, set_is_interp,
5958 is_dynamic_linker_section, and set_is_dynamic_linker_section
5960 (class Output_segment): Change Output_data_list from std::list to
5961 std:;vector. Add output_lists_ field. Remove output_data_ and
5962 output_bss_ fields. Update declarations.
5964 2010-08-02 Ian Lance Taylor <iant@google.com>
5966 * arm.cc (Target_arm::gc_process_relocs): Use typename.
5967 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5968 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5970 2010-08-02 Ian Lance Taylor <iant@google.com>
5973 * script.cc (Script_options::Script_options): Initialize
5974 symbol_definitions_ and symbol_references_.
5975 (Script_options::add_symbol_assignment): Update
5976 symbol_definitions_ and symbol_references_.
5977 (Script_options::add_symbol_reference): New function.
5978 (script_symbol): New function.
5979 * script.h (class Script_options): Add symbol_definitions_ and
5980 symbol_references_ fields.
5981 (Script_options::referenced_const_iterator): New type.
5982 (Script_options::referenced_begin): New function.
5983 (Script_options::referenced_end): New function.
5984 (Script_options::is_referenced): New function.
5985 (Script_options::any_unreferenced): New function.
5986 * script-c.h (script_symbol): Declare.
5987 * yyscript.y (exp): Call script_symbol.
5988 * symtab.cc: Include "script.h".
5989 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5990 Change all callers. Check symbols referenced by scripts.
5991 (Symbol_table::add_undefined_symbols_from_command_line): Add
5992 layout parameter. Change all callers.
5993 (Symbol_table::do_add_undefined_symbols_from_command_line):
5994 Likewise. Break out loop body. Check symbols referenced by
5996 (Symbol_table::add_undefined_symbol_from_command_line): New
5997 function broken out of
5998 do_add_undefined_symbols_from_command_line.
5999 * symtab.h (class Symbol_table): Update declarations.
6000 * archive.cc: Include "layout.h".
6001 (Archive::should_include_member): Add layout parameter. Change
6002 all callers. Check for symbol mentioned in expression.
6003 * archive.h (class Archive): Update declaration.
6004 * object.cc (Sized_relobj::do_should_include_member): Add layout
6006 * object.h (Object::should_include_member): Add layout parameter.
6008 (Object::do_should_include_member): Add layout parameter.
6009 (class Sized_relobj): Update declaration.
6010 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6012 * dynobj.h (class Sized_dynobj): Update declaration.
6013 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6015 * plugin.h (class Sized_pluginobj): Update declaration.
6017 2010-08-02 Ian Lance Taylor <iant@google.com>
6020 * output.cc (Output_segment::set_offset): Search for the first and
6021 last sections rather than assuming that the list is in order.
6022 (Output_segment::find_first_and_last_list): New function.
6023 * output.h (class Output_segment): Update declarations.
6024 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6025 (relro_strip_test_SOURCES): New variable.
6026 (relro_strip_test_DEPENDENCIES): New variable.
6027 (relro_strip_test_LDFLAGS): New variable.
6028 (relro_strip_test_LDADD): New variable.
6029 (relro_strip_test.so): New target.
6031 2010-08-02 Ian Lance Taylor <iant@google.com>
6033 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6034 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6035 (Target_i386::got_tlsdesc_section): New function.
6036 (Target_i386::got_section): Create space for GOT entries for
6037 TLSDESC relocations.
6038 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6040 (Target_i386::Scan::global): Likewise.
6041 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6043 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6044 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6045 (Target_x86_64::got_tlsdesc_section): New function.
6046 (Target_x86_64::got_section): Create space for GOT entries for
6047 TLSDESC relocations.
6048 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6050 (Target_x86_64::Scan::global): Likewise.
6051 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6054 2010-08-02 Ian Lance Taylor <iant@google.com>
6056 * testsuite/final_layout.sh: Use dc to convert from hex to
6059 2010-07-29 Sriraman Tallam <tmsriram@google.com>
6061 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6062 paramter to the call to gold::gc_process_relocs.
6063 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6064 paramter to the call to gold::gc_process_relocs.
6065 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6066 parameter to the call to gold::gc_process_relocs.
6067 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6068 template parameter to the call to gold::gc_process_relocs.
6069 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6070 paramter to the call to gold::gc_process_relocs.
6071 * gc.h (get_embedded_addend_size): New function.
6072 (gc_process_relocs): Save the size of the reloc for use by ICF.
6073 * icf.cc (get_section_contents): Get the addend from the text section
6074 for SHT_REL relocation sections.
6075 * icf.h (Icf::Reloc_addend_size_info): New typedef.
6076 (Icf::Reloc_info): Add new member reloc_addend_size_info.
6077 * int_encoding.h (read_from_pointer): New overloaded function.
6078 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6079 * testsuite/icf_sht_rel_addend_test.sh: New file.
6080 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6081 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6083 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6085 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6086 * Makefile.in: Regenerate.
6087 * testsuite/Makefile.in: Regenerate.
6089 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
6091 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6092 * gold/testsuite/debug_msg.cc: Likewise.
6093 * gold/testsuite/odr_violation1.cc
6094 * gold/testsuite/odr_violation2.cc
6096 2010-07-21 Cary Coutant <ccoutant@google.com>
6098 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6099 string, and length fields.
6100 (Output_merge_string::Merged_strings_list): New type.
6101 (Output_merge_string::Merged_strings_lists): New typedef.
6102 (Output_merge_string): Replace merged_strings_ with
6103 merged_strings_lists_.
6104 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6105 Merged_strings_list per input object and section. Don't store pointer
6106 to the string. Don't store length with each merged string entry.
6107 (Output_merge_string::finalize_merged_data): Loop over list of merged
6108 strings lists. Recompute length of each merged string.
6110 2010-07-15 Cary Coutant <ccoutant@google.com>
6112 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6115 2010-07-14 Ian Lance Taylor <iant@google.com>
6117 * descriptors.cc (Descriptors::open): Report correct name in error
6120 2010-07-13 Doug Kwan <dougkwan@google.com>
6122 * arm.cc (Arm_input_section::Arm_input_section): For a
6123 SHT_ARM_EXIDX section, always keeps the input sections.
6124 (Arm_input_section::set_exidx_section_link): New method.
6125 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6126 has_errors_ to false.
6127 (Arm_exidx_input_section::has_errors,
6128 Arm_exidx_input_section::set_has_errors): New methods.
6129 (Arm_exidx_input_section::has_errors_): New data member.
6130 (Arm_relobj::get_exidx_shndx_list): New method.
6131 (Arm_output_section::append_text_sections_to_list): Do not skip
6132 section without SHF_EXECINSTR.
6133 (Arm_output_section::fix_exidx_coverage): Skip input sections with
6135 (Arm_relobj::make_exidx_input_section): Add new parameter for text
6136 section header. Make error messages more verbose. Check for
6137 a non-executable section linked to an EXIDX section.
6138 (Arm_relobj::do_read_symbols): Remove error checking, which has been
6139 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
6140 check that there is no deferred EXIDX section if we exit early.
6141 Instead of not making an EXIDX section in case of an error, make one
6142 and set the has_errors flag of it.
6143 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6144 in a relocatable link.
6145 (Target_arm::do_relax): Look for the EXIDX output section instead of
6146 assuming that it is called .ARM.exidx.
6147 (Target_arm::fix_exidx_coverage): Add a new parameter for input
6148 section list. Do not check for SHF_EXECINSTR section flags but
6149 skip any input section with errors.
6150 * output.cc (Output_section::Output_section): Initialize
6151 always_keeps_input_sections_ to false.
6152 (Output_section::add_input_section): Check for
6153 always_keeps_input_sections_.
6154 * output.h (Output_section::always_keeps_input_sections,
6155 Output_section::set_always_keeps_input_sections): New methods.
6156 (Output_section::always_keeps_input_sections): New data member.
6158 2010-07-13 Rafael Espindola <espindola@google.com>
6160 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6161 * fileread.h (Input_file): Add try_extra_search_path and find_file.
6163 2010-07-13 Philip Herron <herron.philip@googlemail.com>
6164 Ian Lance Taylor <iant@google.com>
6166 * output.h (Output_section_lookup_maps::add_merge_section):
6167 Correct check of whether value was inserted.
6168 (Output_section_lookup_maps::add_merge_input_section): Likewise.
6169 (Output_section_lookup_maps::add_relaxed_input_section):
6171 * arm.cc (Target_arm::got_section): Remove used local os.
6172 * i386.cc (Target_i386::got_section): Likewise.
6173 * x86_64.cc (Target_x86_64::got_section): Likewise.
6174 * sparc.cc (Target_sparc::got_section): Likewise.
6175 (Target_sparc::relocate): Remove unused local have_got_offset.
6176 * powerpc.cc (Target_powerpc::relocate): Likewise.
6178 2010-07-13 Ian Lance Taylor <iant@google.com>
6180 * compressed_output.cc (zlib_decompress): Fix signature in
6183 * archive.cc (Archive::include_member): Unlock an external member
6184 of a thin archive. Don't bother to delete an object we know is
6187 2010-07-12 Cary Coutant <ccoutant@google.com>
6189 * compressed_output.cc (zlib_decompress): New function.
6190 (get_uncompressed_size): New function.
6191 (decompress_input_section): New function.
6192 * compressed_output.h (get_uncompressed_size): New function.
6193 (decompress_input_section): New function.
6194 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6195 Handle compressed debug sections.
6196 * layout.cc (is_compressed_debug_section): New function.
6197 (Layout::output_section_name): Map compressed section names to
6199 * layout.h (is_compressed_debug_section): New function.
6200 (is_debug_info_section): Recognize compressed debug sections.
6201 * merge.cc: Include compressed_output.h.
6202 (Output_merge_data::do_add_input_section): Handle compressed
6204 (Output_merge_string::do_add_input_section): Handle compressed
6206 * object.cc: Include compressed_output.h.
6207 (Sized_relobj::Sized_relobj): Initialize new data members.
6208 (build_compressed_section_map): New function.
6209 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6210 * object.h (Object::section_is_compressed): New method.
6211 (Object::do_section_is_compressed): New method.
6212 (Sized_relobj::Compressed_section_map): New type.
6213 (Sized_relobj::do_section_is_compressed): New method.
6214 (Sized_relobj::compressed_sections_): New data member.
6215 * output.cc (Output_section::add_input_section): Handle compressed
6217 * reloc.cc: Include compressed_output.h.
6218 (Sized_relobj::write_sections): Handle compressed debug sections.
6220 2010-07-08 Cary Coutant <ccoutant@google.com>
6222 * resolve.cc (Symbol_table::resolve): Remember whether undef was
6223 weak when resolving to a dynamic def.
6224 (Symbol_table::should_override): Add adjust_dyndef flag; set it
6225 for weak undef/dynamic def cases. Adjust callers.
6226 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6227 undef_binding_weak_.
6228 (Symbol_table::sized_write_globals): Adjust symbol binding.
6229 (Symbol_table::sized_write_symbol): Add binding parameter.
6230 * symtab.h (Symbol::set_undef_binding): New method.
6231 (Symbol::is_undef_binding_weak): New method.
6232 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6233 (Symbol_table::should_override): Add new parameter.
6234 (Symbol_table::sized_write_symbol): Add new parameter.
6236 * testsuite/weak_undef_file1.cc: Add new test case.
6237 * testsuite/weak_undef_file2.cc: Fix header comment.
6238 * testsuite/weak_undef_test.cc: Add new test case.
6240 2010-06-29 Doug Kwan <dougkwan@google.com>
6242 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6243 Initialize USE_SYMBOL_.
6244 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6246 (Arm_reloc_property::uses_symbol_): New data member declaration.
6247 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6248 uses symbol value and symbol is undefined but not weakly undefined.
6250 2010-06-28 Rafael Espindola <espindola@google.com>
6252 * plugin.cc (Plugin::load): Use dlerror.
6254 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
6256 * symtab.cc (detect_odr_violations): When reporting an ODR
6257 violation, report an object where the symbol is defined.
6259 2010-06-25 Doug Kwan <dougkwan@google.com>
6261 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6262 (Target_arm::section_may_have_icf_unsafe_pointers): New method
6264 (Target_arm::Scan::local_reloc_may_be_function_pointer,
6265 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6266 target hook to detect function points.
6267 (Target_arm::Scan::possible_function_pointer_reloc): New method.
6268 * icf.h (Icf::check_section_for_function_pointers): Change type of
6269 parameter SECTION_NAME to const reference to std::string. Use
6270 target hook to determine if section may have unsafe pointers.
6271 * target.h (Target::section_may_have_icf_unsafe_pointers): New
6274 2010-06-21 Rafael Espindola <espindola@google.com>
6276 * fileread.cc (Input_file::find_fie): New
6277 (Input_file::open): Use Input_file::find_fie.
6278 * fileread.h (Input_file::find_fie): New
6279 * plugin.cc (set_extra_library_path): New.
6280 (Plugin::load): Add set_extra_library_path to the transfer vector.
6281 (Plugin_manager::set_extra_library_path): New.
6282 (Plugin_manager::add_input_file): Use the extra search path if set.
6283 (set_extra_library_path(): New.
6284 * plugin.h (Plugin_manager): Add set_extra_library_path and
6287 2010-06-19 Cary Coutant <ccoutant@google.com>
6289 * layout.cc (gdb_sections): Add .debug_types.
6290 (lines_only_debug_sections): Likewise.
6292 2010-06-18 Rafael Espindola <espindola@google.com>
6294 * plugin.cc (add_input_file,add_input_library)
6295 (Plugin_manager::add_input_file): Make filename arguments const.
6296 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6299 2010-06-16 Doug Kwan <dougkwan@google.com>
6301 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6302 .ARM.attributes section if we have not merged any input
6303 attributes sections.
6305 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6307 * arm.cc: Allow combining objects with no EABI version
6310 2010-06-15 Rafael Espindola <espindola@google.com>
6312 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6314 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6316 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6317 (struct iovec): Correct !HAVE_READV definition.
6319 2010-06-10 Cary Coutant <ccoutant@google.com>
6321 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6322 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6324 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6327 * symtab.h (Symbol::is_placeholder): New member function.
6328 * target-reloc.h (relocate_section): Check for placeholder symbols.
6330 * testsuite/Makefile.am (plugin_test_8): New test.
6331 (plugin_test_9): New test.
6332 * testsuite/Makefile.in: Regenerate.
6334 2010-06-09 Nick Clifton <nickc@redhat.com>
6336 * yyscript.y (input_list_element): Allow strings prefixed with
6337 the '-' character. Treat these as libraries.
6338 * script.cc (script_add_library): New function. Adds a library
6339 specified by "-l<name>" found in an input script.
6340 * script-c.h: Add prototype for script_add_library.
6342 2010-06-07 Doug Kwan <dougkwan@google.com>
6344 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6345 Restrict stub-group size to be within long conditional branch
6346 range when working around cortex-A8 erratum.
6348 2010-06-07 Damien Diederen <dd@crosstwine.com>
6350 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6353 2010-06-03 Sriraman Tallam <tmsriram@google.com>
6357 (Output_section::Input_section_sort_entry::compare_section_ordering):
6358 Change to return non-zero correctly.
6359 (Output_section::Input_section_sort_section_order_index_compare
6360 ::operator()): Change to fix ambiguity in comparisons.
6362 2010-06-01 Sriraman Tallam <tmsriram@google.com>
6364 * gold.h (is_wildcard_string): New function.
6365 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6366 (Layout::layout_eh_frame): Ditto.
6367 (Layout::find_section_order_index): New method.
6368 (Layout::read_layout_from_file): New method.
6369 * layout.h (Layout::find_section_order_index): New method.
6370 (Layout::read_layout_from_file): New method.
6371 (Layout::input_section_position_): New private member.
6372 (Layout::input_section_glob_): New private member.
6373 * main.cc (main): Call read_layout_from_file here.
6374 * options.h (--section-ordering-file): New option.
6375 * output.cc (Output_section::input_section_order_specified_): New
6377 (Output_section::Output_section): Initialize new member.
6378 (Output_section::add_input_section): Add new parameter.
6379 Keep input sections when --section-ordering-file is used.
6380 (Output_section::set_final_data_size): Sort input sections when
6381 section ordering file is specified.
6382 (Output_section::Input_section_sort_entry): Add new parameter.
6384 (Output_section::Input_section_sort_entry::compare_section_ordering):
6386 (Output_section::Input_section_sort_compare::operator()): Change to
6387 consider section_order_index.
6388 (Output_section::Input_section_sort_init_fini_compare::operator()):
6389 Change to consider section_order_index.
6390 (Output_section::Input_section_sort_section_order_index_compare
6391 ::operator()): New method.
6392 (Output_section::sort_attached_input_sections): Change to sort
6393 according to section order when specified.
6394 (Output_section::add_input_section<32, true>): Add new parameter.
6395 (Output_section::add_input_section<64, true>): Add new parameter.
6396 (Output_section::add_input_section<32, false>): Add new parameter.
6397 (Output_section::add_input_section<64, false>): Add new parameter.
6398 * output.h (Output_section::add_input_section): Add new parameter.
6399 (Output_section::input_section_order_specified): New
6401 (Output_section::set_input_section_order_specified): New method.
6402 (Input_section::Input_section): Initialize section_order_index_.
6403 (Input_section::section_order_index): New method.
6404 (Input_section::set_section_order_index): New method.
6405 (Input_section::section_order_index_): New member.
6406 (Input_section::Input_section_sort_section_order_index_compare): New
6408 (Output_section::input_section_order_specified_): New member.
6409 * script-sections.cc (is_wildcard_string): Delete and move modified
6411 (Output_section_element_input::Output_section_element_input): Modify
6412 call to is_wildcard_string.
6413 (Output_section_element_input::Input_section_pattern
6414 ::Input_section_pattern): Ditto.
6415 (Output_section_element_input::Output_section_element_input): Ditto.
6416 * testsuite/Makefile.am (final_layout): New test case.
6417 * testsuite/Makefile.in: Regenerate.
6418 * testsuite/final_layout.cc: New file.
6419 * testsuite/final_layout.sh: New file.
6421 2010-06-01 Rafael Espindola <espindola@google.com>
6423 * plugin.cc (Plugin::load): Pass the output name to the plugin.
6425 2010-06-01 Rafael Espindola <espindola@google.com>
6427 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6428 visibility of symbols.
6430 2010-05-27 Doug Kwan <dougkwan@google.com>
6432 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6433 from start of output section instead of address for a local symbol
6434 in a merged or relaxed section when doing a relocatable link.
6436 2010-05-26 Rafael Espindola <espindola@google.com>
6439 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6440 adding sections the garbage collector removed.
6441 * gold/testsuite/Makefile.am: Add test.
6442 * gold/testsuite/Makefile.in: Regenerate.
6443 * gold/testsuite/plugin_test_7.sh: New.
6444 * gold/testsuite/plugin_test_7_1.c: New.
6445 * gold/testsuite/plugin_test_7_2.c: New.
6447 2010-05-26 Rafael Espindola <espindola@google.com>
6449 * script-sections.cc (Output_section_definition::set_section_addresses):
6450 Check for --section-start.
6452 2010-05-26 Doug Kwan <dougkwan@google.com>
6454 * arm.cc (Arm_scan_relocatable_relocs): New class.
6455 (Target_arm::relocate_special_relocatable): New method.
6456 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6457 (Arm_relocate_functions::thumb_branch_common): Same.
6458 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6459 instead of Default_scan_relocatable_relocs.
6460 * target-reloc.h (relocate_for_relocatable): Let target handle
6461 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6462 * target.h (Sized_target::relocate_special_relocatable): New method.
6464 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6466 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6468 2010-05-23 Doug Kwan <dougkwan@google.com>
6470 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6472 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6473 with a direct branch, not a conditional branch, to a stub.
6474 * merge.cc (Output_merge_base::record_input_section): New method
6476 (Output_merge_data::do_add_input_section): Record input section if
6477 keeps-input-sections flag is set.
6478 (Output_merge_string::do_add_input_section): Ditto.
6479 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6480 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6482 (Output_merge_base::keeps_input_sections,
6483 Output_merge_base::set_keeps_input_sections,
6484 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6486 (Output_merge_base::Input_sections): New type declaration.
6487 (Output_merge_base::input_sections_begin,
6488 Output_merge_base::input_sections_end,
6489 Output_merge_base::do_set_keeps_input_sections): New method definitions.
6490 (Output_merge_base::bool keeps_input_sections_,
6491 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6492 Output_merge_base::input_sections_): New data members.
6493 (Output_merge_data::do_set_keeps_input_sections): New method
6495 (Output_merge_string::do_set_keeps_input_sections): Ditto.
6496 * output.cc (Output_section::Input_section::relobj): Move method
6497 defintion from class declaration to here and handle merge sections.
6498 (Output_section::Input_section::shndx): Ditto.
6499 (Output_section::Output_section): Remove initializations of removed
6500 data members and initialize new data member LOOKUP_MAPS_.
6501 (Output_section::add_input_section): Set keeps-input-sections flag
6502 for a newly created merge output section as appropriate. Adjust code
6503 to use Output_section_lookup_maps class.
6504 (Output_section::add_relaxed_input_section): Adjst code for lookup
6505 maps code refactoring.
6506 (Output_section::add_merge_input_section): Add a new parameter
6507 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
6508 class. If adding input section to a newly created merge output
6509 section fails, remove the new merge section.
6510 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6511 Adjust code for use of the Output_section_lookup_maps class.
6512 (Output_section::find_merge_section): Ditto.
6513 (Output_section::build_lookup_maps): New method defintion.
6514 (Output_section::find_relaxed_input_section): Adjust code to use
6515 Output_section_lookup_maps class.
6516 (Output_section::get_input_sections): Export merge sections. Adjust
6517 code to use Output_section_lookup_maps class.
6518 (Output_section:::add_script_input_section): Adjust code to use
6519 Output_section_lookup_maps class. Update lookup maps for merge
6521 (Output_section::discard_states): Use Output_section_lookup_maps.
6522 (Output_section::restore_states): Same.
6523 * output.h (Merge_section_properties): Move class defintion out of
6525 (Output_section_lookup_maps): New class.
6526 (Output_section::Input_section::is_merge_section): New method
6528 (Output_section::Input_section::relobj): Move defintion out of class
6529 defintion. Declare method only.
6530 (Output_section::Input_section::shndx): Ditto.
6531 (Output_section::Input_section::output_merge_base): New method defintion.
6532 (Output_section::Input_section::u2_.pomb): New union field.
6533 (Output_section::Merge_section_by_properties_map,
6534 Output_section::Output_section_data_by_input_section_map,
6535 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6537 (Output_section::add_merge_input_section): Add new parameter
6538 KEEPS_INPUT_SECTIONS.
6539 (Output_section::build_lookup_maps): New method declaration.
6540 (Output_section::merge_section_map_,
6541 Output_section::merge_section_by_properties_map_,
6542 Output_section::relaxed_input_section_map_,
6543 Output_section::is_relaxed_input_section_map_valid_): Remove data
6545 (Output_section::lookup_maps_): New data member.
6547 2010-05-21 Doug Kwan <dougkwan@google.com>
6550 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6551 avoid a compilation error.
6553 2010-05-19 Rafael Espindola <espindola@google.com>
6555 * script-sections.cc (Output_section_definition::allocate_to_segment):
6556 Update the phdrs_list even when the output section is NULL.
6557 * testsuite/Makefile.am: Add test.
6558 * testsuite/Makefile.in: Regenerate.
6559 * testsuite/script_test_9.cc: New.
6560 * testsuite/script_test_9.sh: New.
6561 * testsuite/script_test_9.t: New.
6563 2010-05-19 Doug Kwan <dougkwan@google.com>
6565 * arm.cc (Arm_input_section::original_size): New method.
6566 (Arm_input_section::do_addralign): Add a cast.
6567 (Arm_input_section::do_output_offset): Remove static cast.
6568 (Arm_input_section::original_addralign,
6569 Arm_input_section::original_size_): Change type to uint32_t.
6570 (Arm_input_section::init): Add safe casts for section alignment
6572 (Arm_input_section::set_final_data_size): Do not set address and
6573 offset of stub table.
6574 (Arm_output_section::fix_exidx_coverage): Change use of of
6575 Output_section::Simple_input_section to that of
6576 Output_section::Input_section.
6577 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6578 except for the first pass.
6579 * output.cc (Output_section::get_input_sections): Change type of
6580 input_sections to std::list<Input_section>.
6581 (Output_section::add_script_input_section): Rename from
6582 Output_section::add_simple_input_section. Change type of SIS
6583 parameter from Simple_input_section to Input_section.
6584 * output.h (Output_section::Simple_input_section): Remove class.
6585 (Output_section::Input_section): Change class visibility to public.
6586 (Output_section::Input_section::addralign): Use stored alignments
6587 for special input sections if set.
6588 (Output_section::Input_section::set_addralign): New method.
6589 (Output_section::get_input_sections): Change parameter type from
6590 list of Simple_input_section to list of Input_section.
6591 (Output_section::add_script_input_section): Rename from
6592 Output_section::add_simple_input_section. Change first parameter's
6593 type from Simple_input_section to Input_section and remove the
6594 second and third parameters.
6595 * script-sections.cc (Input_section::Input_section_list): Change
6596 type to list of Output_section::Input_section/
6597 (Input_section_info::Input_section_info): Change parameter type of
6598 INPUT_SECTION to Output_section::Input_section.
6599 (Input_section_info::input_section): Change return type.
6600 (Input_section_info::input_section_): Change type to
6601 Output_section::Input_section.
6602 (Output_section_element_input::set_section_addresses): Adjust code
6603 to use Output_section::Input_section instead of
6604 Output_section::Simple_input_section. Adjust code for renaming
6605 of Output_section::add_simple_input_section.
6606 (Orphan_output_section::set_section_addresses): Ditto.
6608 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6610 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6611 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6613 2010-05-18 Rafael Espindola <espindola@google.com>
6615 * options.cc (General_options::finalize): Handle -nostdlib.
6616 * options.h (nostdlib): New option.
6617 * script.cc (script_add_search_dir): Handle -nostdlib.
6619 2010-05-12 Doug Kwan <dougkwan@google.com>
6621 * arm.cc (Target_arm::do_finalize_sections): Create an empty
6622 attributes section only if there no attributes section after merging.
6623 (Target_arm::merge_object_attributes): Move value of
6624 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6625 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6626 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6627 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6628 and arm_attr_merge_7.stdout.
6629 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6630 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6631 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6632 arm_attr_merge_7b.o): New rules.
6633 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6635 * testsuite/Makefile.in: Regenerate.
6636 * testsuite/arm_attr_merge.sh: New file.
6637 * testsuite/arm_attr_merge_[67][ab].s: Same.
6639 2010-05-05 Nick Clifton <nickc@redhat.com>
6641 * po/es.po: Updated Spanish translation.
6643 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6645 * Makefile.am (install-exec-local): Properly install gold as
6646 default cross linker.
6647 * Makefile.in: Regenerated.
6649 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6650 Nick Clifton <nickc@redhat.com>
6652 * configure.ac (install_as_default): Define and set to false
6653 unless --enable-gold or --enable-gold=both/gold has been
6655 * configure: Regenerate.
6657 * Makefile.am (install-exec-local): Install the executable as
6658 'ld.gold'. If install_as_default is true then also install it as
6660 * Makefile.in: Regenerated.
6662 2010-04-24 Ian Lance Taylor <iant@google.com>
6664 * layout.cc (Layout::layout_reloc): In relocatable link don't
6665 combine reloc sections for grouped sections.
6667 2010-04-23 Sriraman Tallam <tmsriram@google.com>
6669 * gc.h (gc_process_relocs): Pass information on relocs pointing to
6670 sections that are not ordinary to icf.
6671 * icf.cc (get_section_contents): Handle relocation pointing to section
6672 with no object or shndx information.
6673 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6674 * testsuite/Makefile.in: Regenerate.
6675 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6676 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6678 2010-04-22 Ian Lance Taylor <iant@google.com>
6680 * expression.cc (Expression::Expression_eval_info): Add
6681 result_alignment_pointer field.
6682 (Expression::eval_with_dot): Add result_alignment_pointer
6683 parameter. Change all callers.
6684 (Expression::eval_maybe_dot): Likewise.
6685 (class Binary_expression): Add alignment_pointer parameter to
6686 left_value and right_value. Change all callers.
6687 (BINARY_EXPRESSION): Set result alignment.
6688 (class Trinary_expression): Add alignment_pointer parameter to
6689 arg2_value and arg3_value. Change all callers.
6690 (Trinary_cond::value): Set result alignment.
6691 (Max_expression::value, Min_expression::value): Likewise.
6692 (Align_expression::value): Likewise.
6693 * script-sections.cc (class Sections_element): Add dot_alignment
6694 parameter to set_section_addresses virtual function. Update
6696 (class Output_section_element): Likewise.
6697 (Script_sections::create_segments): Add dot_alignment parameter.
6699 (Script_sections::create_segments_from_phdrs_clause): Likewise.
6700 (Script_sections::set_phdrs_clause_addresses): Likewise.
6701 * script-sections.h: Update declarations.
6702 * script.h: Update declarations.
6703 * output.h (Output_segment::set_minimum_p_align): Don't decrease
6705 * testsuite/script_test_3.t: Set large alignment.
6706 * testsuite/script_test_3.sh: Make sure that at least one LOAD
6707 segment has expected alignment.
6709 2010-04-22 Nick Clifton <nickc@redhat.com>
6711 * po/gold.pot: Updated by the Translation project.
6712 * po/vi.po: Updated Vietnamese translation.
6714 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
6716 * testsuite/Makefile.am (check_PROGRAMS): Add
6717 icf_virtual_function_folding_test.
6718 * testsuite/Makefile.in: Regenerated.
6720 2010-04-15 Andrew Haley <aph@redhat.com>
6722 * options.h (merge_exidx_entries): New option.
6723 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6724 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6725 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6726 (Target_arm::merge_exidx_entries): New function.
6727 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6728 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6729 to Arm_exidx_fixup constructor.
6730 Add new arg, merge_exidx_entries.
6731 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6732 Arm_output_section::fix_exidx_coverage.
6734 2010-04-18 Sriraman Tallam <tmsriram@google.com>
6736 * icf.cc (get_section_contents): Check for preemptible functions.
6737 Ignore addend when appropriate.
6738 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
6740 (add_from_relobj): Check for section folded.
6741 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6742 * symtab.h (should_add_dynsym_entry): Add new parameter.
6743 * target-reloc.h (scan_relocs): Check for section folded.
6744 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6745 Check reloc types for function pointers in shared objects.
6746 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6748 (icf_preemptible_functions_test): New test case.
6749 (icf_string_merge_test): New test case.
6750 * testsuite.Makefile.in: Regenerate.
6751 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6752 bar_glob. Refactor code.
6753 * testsuite/icf_preemptible_functions_test.cc: New file.
6754 * testsuite/icf_preemptible_functions_test.sh: New file.
6755 * testsuite/icf_string_merge_test.cc: New file.
6756 * testsuite/icf_string_merge_test.sh: New file.
6757 * testsuite/icf_virtual_function_folding_test.cc: New file.
6758 * testsuite/icf_virtual_function_folding_test.sh: New file.
6760 2010-04-14 Doug Kwan <dougkwan@google.com>
6762 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6763 for local symbol recounting if we remove a section due to ICF.
6764 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6765 there are no regular objects in input.
6767 2010-04-13 Doug Kwan <dougkwan@google.com>
6769 * arm.cc (Arm_input_section::set_final_data_size): Compute
6770 accurate final data size instead of using current data size.
6772 2010-04-09 Doug Kwan <dougkwan@google.com>
6774 * layout.cc (Layout::choose_output_section): Handle script section
6776 (Layout::make_output_section_for_script): Add section type parameter.
6777 Handle script section types.
6778 * layout.h (Layout::make_output_section_for_script): Add section
6780 * output.cc (Output_section::Output_section): Initialize data member
6782 (Output_section::do_reset_address_and_file_offset): Do not set address
6783 to 0 if section is a NOLOAD section.
6784 * output.h (Output_section::is_noload): New method.
6785 (Output_section::set_is_noload): Ditto.
6786 (Output_section::is_noload_): New data member.
6787 * script-c.h (Script_section_type): New enum type.
6788 (struct Parser_output_section_header): Add new file section_type.
6789 * script-sections.cc (Sections_element::output_section_name): Add
6790 parameter for returning script section type.
6791 (Output_section_definition::output_section_name): Ditto.
6792 (Output_section_definition::section_type)P; New method.
6793 (Output_section_definiton::script_section_type_name): Ditto.
6794 (Output_section_definition::script_section_type_): New data member.
6795 (Output_section_definition::Output_section_definition): Initialize
6796 data member Output_section_definition::script_section_type_.
6797 (Output_section_definition::create_sections): Pass script section type
6798 to Layout::make_output_section_for_script.
6799 (Output_section_definition::output_section_name): Return script
6800 section type to caller.
6801 (Output_section_definition::set_section_address): Do not advance
6802 dot value and load address if section type is NOLOAD. Set address
6803 of NOLOAD sections regardless of section flags.
6804 (Output_section_definition::print): Print section type if it is
6805 not SCRIPT_SECTION_TYPE_NONE.
6806 (Output_section_definition::section_type): New method.
6807 (Output_section_definition::script_section_type_name): Ditto.
6808 (Script_sections::output_section_name): Add new parameter
6809 PSECTION_TYPE for returning script section type. Pass it to
6810 section elements. Handle discard sections.
6811 (Sort_output_sections::operator()): Handle NOLOAD sections.
6812 * script-sections.h (Script_sections::Section_type): New enum type.
6813 (Script_sections::output_section_name): Add a new parameter for
6814 returning script section type.
6815 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6817 * yyscript.y (union): Add new field SECTION_TYPE.
6818 (COPY, DSECT, INFO, NOLOAD): New tokens.
6819 (opt_address_and_section_type): Change type to output_section_header.
6820 (section_type): New non-terminal
6821 (section_header): Handle section type.
6822 (opt_address_and_section_type): Return section type value.
6824 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
6826 * testsuite/plugin_common_test_1.c (foo): Add prototype.
6827 * testsuite/plugin_common_test_2.c (foo): Likewise.
6829 2010-04-08 Doug Kwan <dougkwan@google.com>
6831 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6833 * output.cc (Output_section::add_merge_input_section): Simplify
6834 code and return status of Output_merge_base::add_input_section.
6835 Update merge section map only if Output_merge_base::add_input_section
6838 2010-04-07 Doug Kwan <dougkwan@google.com>
6840 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6841 if section is marked as containing instructions but has no mapping
6843 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6844 correct section index.
6845 (Arm_relobj::find_linked_text_section): Ditto.
6847 2010-04-07 Cary Coutant <ccoutant@google.com>
6849 * archive.cc (include_member): Destroy Read_symbols_data object before
6851 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6852 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6853 (Read_symbols_data::~Read_symbols_data) New destructor.
6854 (Section_relocs::Section_relocs) New constructor.
6855 (Section_relocs::~Section_relocs) New destructor.
6856 (Read_relocs_data::Read_relocs_data) New constructor.
6857 (Read_relocs_data::~Read_relocs_data) New destructor.
6858 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6859 pointers to NULL after deleting.
6861 2010-04-07 Doug Kwan <dougkwan@google.com>
6863 * arm.cc: Replace "endianity" with "endianness" in comments.
6864 (Arm_exidx_cantunwind): Ditto.
6865 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6866 (Arm_relobj::merge_flags_and_attributes): New method.
6867 (Arm_relobj::merge_flags_and_attributes_): New data member.
6868 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6869 (Arm_relobj::scan_sections_for_stubs): Ditto.
6870 (Arm_relobj::do_read_symbols): Check to see if we really want to
6871 merge processor-specific flags and attributes. Exit early if
6872 an object is empty except for section names and the undefined symbol.
6873 (Target_arm::do_finalize_sections): Move check for ELF format to
6874 Arm_relobj::do_read_symbols. Merge processor specific flags and
6875 attributes from a regular object only when we have determined that
6876 it is aapropriate. Do not create an .ARM.attributes section in
6877 output if there is no regular input object.
6878 (Target_arm::merge_processor_specific_flags): Check
6879 --warn-mismatch before printing any error.
6880 (Target_arm::merge_object_attributes): Ditto.
6881 * gold.cc (queue_middle_tasks): Handle the case in which there is
6882 no regular object in input.
6883 * options.cc (General_options::parse_EB): New method.
6884 (General_options::parse_EL): Same.
6885 (General_options::General_options): Initialize endianness_.
6886 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6888 (General_options::Endianness): New enum.
6889 (General_options::endianness): New method.
6890 (General_options::endianness_): New data member.
6891 * parameters.cc (Parameters::set_options): Check target endianness.
6892 (Parameters::set_target_once): Ditto.
6893 (Parameters::check_target_endianness): New method.
6894 (parameters_force_valid_target): If either -EL or -EB is specified,
6895 use it to define endianness of default target.
6896 * parameters.h (Parameters::check_target_endianness): New method
6898 * target.h (class Target): Change "endianity" to "endianness"
6901 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6903 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6904 * configure: Regenerate.
6905 * Makefile.in: Regenerate.
6906 * testsuite/Makefile.in: Regenerate.
6908 2010-04-06 Cary Coutant <ccoutant@google.com>
6911 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6912 prevailing definitions of common symbols.
6913 * testsuite/plugin_test_6.sh: New test case.
6914 * testsuite/plugin_common_test_1.c: New test case.
6915 * testsuite/plugin_common_test_2.c: New test case.
6916 * testsuite/Makefile.am (plugin_test_6): New test case.
6917 * testsuite/Makefile.in: Regenerate.
6919 2010-04-06 Nick Clifton <nickc@redhat.com>
6921 * po/vi.po: New Vietnamese translation.
6923 2010-03-30 Doug Kwan <dougkwan@google.com>
6925 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6927 2010-03-25 Doug Kwan <dougkwan@google.com>
6929 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6930 to avoid a conversion warning on a 32-bit host.
6932 2010-03-24 Ian Lance Taylor <iant@google.com>
6934 * testsuite/script_test_3.t: Add a TLS segment.
6935 * testsuite/Makefile.am (check_PROGRAMS): Add
6936 tls_phdrs_script_test.
6937 (tls_phdrs_script_test_SOURCES): Define.
6938 (tls_phdrs_script_test_DEPENDENCIES): Define.
6939 (tls_phdrs_script_test_LDFLAGS): Define.
6940 (tls_phdrs_script_test_LDADD): Define.
6941 * testsuite/Makefile.in: Rebuild.
6943 2010-03-23 Cary Coutant <ccoutant@google.com>
6945 * fileread.cc (find_or_make_view): Fix comment.
6947 2010-03-23 Ian Lance Taylor <iant@google.com>
6949 * script-sections.cc (class Orphan_section_placement): Define
6950 PLACE_TLS and PLACE_TLS_BSS.
6951 (Orphan_section_placement::Orphan_section_placement): Initialize
6953 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6954 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6955 (tls_script_test_SOURCES): Define.
6956 (tls_script_test_DEPENDENCIES): Define.
6957 (tls_script_test_LDFLAGS): Define.
6958 (tls_script_test_LDADD): Define.
6959 * testsuite/Makefile.in: Rebuild.
6961 2010-03-22 Doug Kwan <dougkwan@google.com>
6963 * arm.cc (Arm_relocate_functions::abs8,
6964 Arm_relocate_functions::abs16): Use correct check for overflow
6965 specified in the ARM ELF specs.
6966 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
6967 target of a BLX instruction specially.
6968 (Reloc_stub::stub_type_for_reloc): Ditto.
6969 (Relocate::relocate): Use symbolic names instead of numeric relocation
6970 codes to report error.
6971 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6973 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6974 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6975 thumb2_blx_out_of_range.stdout
6976 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6977 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6978 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6979 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6980 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6981 thumb2_blx_in_range, thumb2_blx_in_range.o,
6982 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6983 thumb2_blx_out_of_range.o): New rules.
6984 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6985 thumb2_blx_in_range and thumb2_blx_out_of_range.
6986 * testsuite/Makefile.in: Regenerate.
6987 * arm_branch_in_range.sh: Add tests for THUMB BLX.
6988 * testsuite/thumb_blx_in_range.s: New file.
6989 * testsuite/thumb_blx_out_of_range.s: New file.
6991 2010-03-22 Rafael Espindola <espindola@google.com>
6993 * archive.cc (Should_include): Move to archive.h.
6994 (should_include_member): Make it a member of Archive.
6996 (Add_lib_group_symbols): New.
6997 * archive.h: Include options.h.
6998 (Archive_member): Moved from Archive.
6999 (Should_include): Moved from archive.cc.
7001 (Add_lib_group_symbols): New.
7002 * dynobj.cc (do_should_include_member): New.
7003 * dynobj.h (do_should_include_member): New.
7004 * gold.cc (queue_initial_tasks): Update call to queue.
7005 * main.cc (main): Print lib group stats.
7006 * object.cc (do_should_include_member): New.
7007 * object.h: Include archive.h.
7008 (Object::should_include_member): New.
7009 (Object::do_should_include_member): New.
7010 (Sized_relobj::do_should_include_member): New.
7011 * options.cc (General_options::parse_start_lib): New.
7012 (General_options::parse_end_lib): New.
7013 (Input_arguments::add_file): Handle lib groups.
7014 (Input_arguments::start_group): Check we are not in a lib.
7015 (Input_arguments::start_lib): New.
7016 (Input_arguments::end_lib): New.
7017 * options.h (General_options): Add start_lib and end_lib.
7018 (Input_argument::lib_): New.
7019 (Input_argument::lib): New.
7020 (Input_argument::is_lib): New.
7021 (Input_file_lib): New.
7022 (Input_arguments::in_lib_): New.
7023 (Input_arguments::in_lib): New.
7024 (Input_arguments::start_lib): New.
7025 (Input_arguments::end_lib_): New.
7026 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7027 in unused members as preempted.
7028 (Sized_pluginobj::do_should_include_member): New.
7029 * plugin.h (Sized_pluginobj::do_should_include_member): New.
7030 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7032 (Read_symbols::do_whole_lib_group): New.
7033 (Read_symbols::do_lib_group): New.
7034 (Read_symbols::do_read_symbols): Handle lib groups.
7035 (Read_symbols::get_name): Handle lib groups.
7036 * readsyms.h (Read_symbols): Add an archive member pointer.
7037 (Read_symbols::do_whole_lib_group): New.
7038 (Read_symbols::do_lib_group): New.
7039 (Read_symbols::member_): New.
7040 * script.cc (read_input_script): Update call to queue_soon.
7042 2010-03-19 Doug Kwan <dougkwan@google.com>
7044 * arm.cc (Stub_table::Stub_table): Initialize new data members
7045 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7046 (Stub_table::add_reloc_stub): Assign stub offset and update
7047 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7048 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7050 (Stub_table::update_data_size_and_addralign): Use
7051 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7052 instead of going over all reloc stubs.
7053 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7054 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7055 Stringpool_template::offset_ to size of Stringpool_char.
7056 (Stringpool_template::new_key_offset): Remove code to initialize
7057 Stringpool_template::offset_.
7058 * stringpool.h (Stringpool_template::set_no_zero_null): Set
7059 Stringpool_template::offset_ to zero.
7061 2010-03-15 Doug Kwan <dougkwan@google.com>
7063 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7065 (Stringpool_template::new_key_offset): New method.
7066 (Stringpool_template::add_string): Assign offsets when adding new
7068 (Stringpool_template::set_string_offsets): Do not set string offsets
7069 when not optimizing.
7070 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7072 (Chunked_vector::clear): Clear size_.
7073 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7074 (Chunked_vector::size): Return size_.
7075 (Chunked_vector::push_back): Use size_ to find insert position.
7076 (Chunked_vector::size_): New data member.
7077 (Stringpool_template::set_no_zero_null): Assert string set is empty.
7078 (Stringpool_template::new_key_offset): New method declaration.
7079 (Stringpool_template::offset_): New data member.
7081 2010-03-15 Rafael Espindola <espindola@google.com>
7083 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7084 Add_symbols' constructor.
7085 * readsyms.h (Add_symbols): Remove the input_group member.
7087 2010-03-10 Ian Lance Taylor <iant@google.com>
7089 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7090 target to ask whether a reference to a symbol requires a stack
7092 * target.h (Target::is_call_to_non_split): New function.
7093 (Target::do_is_call_to_non_split): Declare virtual function.
7094 * target.cc: Include "symtab.h".
7095 (Target::do_is_call_to_non_split): New function.
7096 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7098 2010-03-10 Cary Coutant <ccoutant@google.com>
7100 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7101 (File_read::open[1]): Remove initial mapping of whole_file_view_.
7102 (File_read::open[2]): Add whole_file_view_ to list of views.
7103 (File_read::make_view): Remove test of whole_file_view_.
7104 (File_read::find_or_make_view): Create whole_file_view_ if
7106 (File_read::clear_views): Replace bool parameter with enum;
7107 adjust all callers. Don't delete views with permanent data;
7108 do delete cached views and views from archives if
7109 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
7110 if clearing the corresponding view.
7111 * fileread.h (File_read::Clear_views_mode): New enum.
7112 (File_read::View::is_permanent_view): New method.
7113 (File_read::clear_views): Replace bool parameter
7114 with enum; adjust all callers.
7115 * options.h (General_options): Change keep_files_mapped option;
7116 add map_whole_files.
7117 * readsyms.cc (Add_symbols::run): Delete sd_ object before
7119 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7122 2010-03-10 David S. Miller <davem@davemloft.net>
7124 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7126 2010-03-09 Sriraman Tallam <tmsriram@google.com>
7128 * icf.cc (get_section_contents): Add '@' marker after processing the
7131 2010-03-08 Doug Kwan <dougkwan@google.com>
7133 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7134 due to a conversion warning.
7135 (Arm_relobj::update_output_local_symbol_count): Check for local
7136 symbol with unset output index.
7138 2010-03-05 Ian Lance Taylor <iant@google.com>
7140 * options.h (class General_options): Add --spare-dynamic-tags.
7141 * output.cc (Output_data_dynamic::set_final_data_size): Implement
7142 --spare-dynamic-tags.
7144 2010-03-05 Ian Lance Taylor <iant@google.com>
7146 * incremental.cc: Include "libiberty.h".
7148 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
7150 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7151 function, is_info_ member.
7152 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7153 (Versions::Versions): Update caller.
7154 (Versions::define_base_version): Likewise.
7155 (Versions::add_def): Likewise.
7157 2010-03-03 Sriraman Tallam <tmsriram@google.com>
7159 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7160 (Scan::possible_function_pointer_reloc): New function.
7161 (Scan::local_reloc_may_be_function_pointer): Change to call
7162 possible_function_pointer_reloc.
7163 (Scan::global_reloc_may_be_function_pointer): Ditto.
7164 * icf.h (Icf::check_section_for_function_pointers): Change to reject
7165 relocations in ".data.rel.ro._ZTV" section.
7166 * testsuite/icf_safe_so_test.sh: Change to pass i386.
7167 * testsuite/icf_safe_so_test.cc: Ditto.
7168 * testsuite/icf_safe_test.cc: Ditto.
7169 * testsuite/icf_safe_test.sh: Ditto.
7171 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7172 Ian Lance Taylor <iant@google.com>
7174 * target-reloc.h (relocate_section): Check the symbol table index
7175 for -1U before setting the local symbol index.
7176 (scan_relocatable_relocs): If copying the relocation, record that
7177 the local symbol is required.
7178 * object.h (Symbol_value::is_output_symtab_index_set): New
7180 (Symbol_value::may_be_discarded_from_output_symtab): New
7182 (Symbol_value::has_output_symtab_entry): New function.
7183 (Symbol_value::needs_output_symtab_entry): Remove.
7184 (Symbol_value::output_symtab_index): Make sure the symbol index is
7186 (Symbol_value::set_output_symtab_index): Make sure the symbol
7187 index is not set. Make sure the new index is valid.
7188 (Symbol_value::set_must_have_output_symtab_entry): New function.
7189 (Symbol_value::has_output_dynsym_entry): New function.
7190 (Symbol_value::set_output_dynsym_index): Make sure the new index
7192 (Sized_relobj::set_must_have_output_symtab_entry): New function.
7193 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7194 local symbol if permitted.
7195 (Sized_relobj::do_finalize_local_symbols): Call
7196 is_output_symtab_index_set rather than needs_output_symtab_entry.
7197 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7198 rather than needs_output_symtab_entry. Call
7199 has_output_dynsym_entry rather than needs_output_dynsym_entry.
7200 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7201 is_output_symtab_index_set rather than needs_output_symtab_entry.
7202 * testsuite/discard_locals_relocatable_test.c: New file.
7203 * testsuite/discard_locals_test.sh: Test -r.
7204 * testsuite/Makefile.am (check_DATA): Add
7205 discard_locals_relocatable_test1.syms,
7206 discard_local_relocatable_test2.syms.
7207 (MOSTLYCLEANFILES): Likewise. Also add
7208 discard_locals_relocatable_test1.lout and
7209 discard_locals_relocatable_test2.out.
7210 (discard_locals_relocatable_test1.syms): New target.
7211 (discard_locals_relocatable_test.o): New target.
7212 (discard_locals_relocatable_test1.out): New target.
7213 (discard_locals_relocatable_test2.syms): New target.
7214 (discard_locals_relocatable_test2.out): New target.
7215 (various): Add missing ../ld-new dependencies.
7216 * testsuite/Makefile.in: Rebuild.
7218 2010-03-03 Nick Clifton <nickc@redhat.com>
7220 * po/fi.po: New Finnish translation.
7222 2010-03-01 Doug Kwan <dougkwan@google.com>
7224 * layout.cc (Layout::Layout): Force section types of .init_array*,
7225 .preinit_array* and .fini_array* sections.
7226 * output.cc (Output_section::Input_section_sort_entry::has_priority):
7227 Fix check of return value of std::string::find.().
7228 (Output_section::Input_section_sort_compare::operator()): Remove
7229 comment about .init_array.
7230 (Output_section::Input_section_sort_init_fini_compare::operator()):
7232 (Output_section::sort_attached_input_sections): Handle .init_array
7233 and .fini_array specially.
7234 * output.h (Output_section::Inut_section_sort_compare): Update
7236 (Output_section::Input_section_sort_init_fini_compare): New struct.
7238 2010-02-26 Doug Kwan <dougkwan@google.com>
7240 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7241 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7242 * testsuite/debug_msg.sh: Avoid matching source line number for
7243 use of global variable undef_int.
7245 2010-02-26 Doug Kwan <dougkwan@google.com>
7247 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7248 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7249 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7250 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7251 * options.cc (General_options::General_options): Initialize member
7253 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7254 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7255 and rm_no_fix_v4bx.stdout
7256 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7257 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7258 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7259 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7260 and arm_no_fix_v4bx.
7261 * Makefile.in: Regenerate.
7262 * testsuite/arm_fix_v4bx.s: New file.
7263 * testsuite/arm_fix_v4bx.sh: Ditto.
7265 2010-02-24 Doug Kwan <dougkwan@google.com>
7267 * arm.cc (Target_arm::got_section): Make the .got section the first
7268 non RELRO section in the data segment.
7269 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7270 suffixes of section names.
7272 2010-02-24 Doug Kwan <dougkwan@google.com>
7274 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7275 flags and attributes merging if an input file is a binary file.
7276 * fileread.cc (Input_file::open): Record format of original file.
7277 * fileread.h (Input_file::Format): New enum type.
7278 (Input_file::Input_file): Initialize data member format_.
7279 (Input_file::format): New method definition.
7280 (Input_file::format_):: New data member.
7282 2010-02-24 Doug Kwan <dougkwan@google.com>
7284 * arm.cc (Arm_output_data_got): New class.
7285 (ARM_TCB_SIZE): New constant
7286 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7287 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7288 If user uses a script with a SECTIONS clause, issue only a warning
7289 for a misplaced EXIDX input section. Otherwise, issue an error.
7290 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7292 (Target_arm::got_mode_index_entry): Handle static linking.
7293 (Target_arm::Scan::local): Ditto.
7294 (Target_arm::Scan::global): Ditto.
7295 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
7296 all incorrectly implemented relocations.
7297 (Target_arm::fix_exidx_coverage): Pass layout to
7298 Arm_output_section::fix_exidx_coverage.
7299 * layout.cc (Layout::section_name_mapping): Remove trailing dots
7300 from ".ARM.exidx." and ".ARM.extab.".
7302 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7304 * arm.cc (Target_arm::do_finalize_sections): Create attribute
7305 section if it does not already exist.
7306 * attributes.cc (Attributes_section_data::Attributes_section_data):
7307 Don't crash if size is zero.
7309 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7310 Ian Lance Taylor <iant@google.com>
7312 * gold.cc (queue_middle_tasks): If no input files were opened,
7314 * workqueue.h (Task_function::Task_function): Assert that there is
7317 2010-02-22 Doug Kwan <dougkwan@google.com>
7319 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7320 * icf.cc (get_section_contents): Cast snprintf arguments to long long
7321 types to avoid warnings due to different uint64_t implementations
7324 2010-02-21 Doug Kwan <dougkwan@google.com>
7326 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7327 handling of the maximum backward branch offset.
7328 (Arm_relocate_functions::thumb_branch_common): Ditto.
7329 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7330 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7331 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7332 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7333 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7334 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7335 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7336 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7337 thumb_bl_out_of_range thumb_bl_out_of_range.o,
7338 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7339 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7340 thumb2_bl_out_of_range.o): New rules.
7341 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7342 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7343 thumb2_bl_out_of_range
7344 * testsuite/Makefile.in: Regenerate.
7345 * testsuite/arm_bl_in_range.s: New file.
7346 * testsuite/arm_bl_out_of_range.s: Ditto.
7347 * testsuite/arm_branch_in_range.sh: Ditto.
7348 * testsuite/arm_branch_range.t: Ditto.
7349 * testsuite/thumb2_branch_range.t: Ditto.
7350 * testsuite/thumb_bl_in_range.s: Ditto.
7351 * testsuite/thumb_bl_out_of_range.s: Ditto.
7352 * testsuite/thumb_branch_range.t: Ditto.
7354 2010-02-20 Sriraman Tallam <tmsriram@google.com>
7356 * gc.h (gc_process_relocs): Change vectors to point to the new list.
7357 Add reloc offset information.
7358 * icf.cc (get_section_contents): Change iterators to point to the new
7359 vectors. Add reloc offset information to the contents.
7360 * icf.h (Icf::Sections_reachable_info): New typedef.
7361 (Icf::Sections_reachable_list): New typedef.
7362 (Icf::Offset_info): New typedef.
7363 (Icf::Reloc_info): New struct typedef.
7364 (Icf::Reloc_info_list): New typedef.
7365 (Icf::symbol_reloc_list): Delete method.
7366 (Icf::addend_reloc_list): Delete method.
7367 (Icf::section_reloc_list): Delete method.
7368 (Icf::reloc_info_list): New method.
7369 (Icf::reloc_info_list_): New member.
7371 2010-02-19 Doug Kwan <dougkwan@google.com>
7373 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7374 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7375 * arm.cc (Arm_relocation_functions): New forward declaration.
7376 (Target_arm::Target_arm): Initialize new data members
7377 got_mod_index_offset_ and tls_base_symbol_defined_.
7378 (Target_arm::Relocate::relocate_tls): New method.
7379 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7380 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7382 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7383 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7384 (Target_arm::got_mod_index_offset_,
7385 Target_arm::tls_base_symbol_defined_): New data members.
7386 (Target_arm::Scan::local, Target::Scan::global,
7387 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7390 2010-02-18 Doug Kwan <dougkwan@google.com>
7392 * arm.cc (Arm_relobj::find_linked_text_section): New method.
7393 (Arm_relobj::make_exidx_input_section): Pass section index of linked
7394 text section as a parameter becuase some broken tools may not set
7395 the link in section header.
7396 (Target_arm::has_got_section): New method.
7397 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7398 without any mapping symbol as data only. Remove warning.
7399 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7400 link in its section header, try to discover the link by inspecting the
7401 REL31 relocation at the beginning of the section.
7402 (Target_arm::Scan::check_non_pic): Report name of offending relocation
7404 (Target_arm::Scan::global): Treat any reference to the symbol
7405 _GLOBAL_OFFSET_TABLE_ as a GOT access.
7407 2010-02-12 Sriraman Tallam <tmsriram@google.com>
7409 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7410 (Scan::global_reloc_may_be_function_pointer): New function.
7411 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7412 (Scan::global_reloc_may_be_function_pointer): New function.
7413 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7414 (Scan::global_reloc_may_be_function_pointer): New function.
7415 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7416 (Scan::global_reloc_may_be_function_pointer): New function.
7417 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7418 (Scan::global_reloc_may_be_function_pointer): New function.
7419 (Scan::possible_function_pointer_reloc): New function.
7420 (Target_x86_64::can_check_for_function_pointers): New function.
7421 * gc.h (gc_process_relocs): Scan relocation types to determine if
7422 function pointers were taken for targets that support it.
7423 * icf.cc (Icf::find_identical_sections): Include functions for
7424 folding in safe ICF whose pointer is not taken.
7425 * icf.h (Secn_fptr_taken_set): New typedef.
7426 (fptr_section_id_): New member.
7427 (section_has_function_pointers): New function.
7428 (set_section_has_function_pointers): New function.
7429 (check_section_for_function_pointers): New function.
7430 * options.h: Fix comment for safe ICF option.
7431 * target.h (can_check_for_function_pointers): New function.
7432 * testsuite/Makefile.am: Add icf_safe_so_test test case.
7433 Modify icf_safe_test for X86-64.
7434 * testsuite/Makefile.in: Regenerate.
7435 * testsuite/icf_safe_so_test.cc: New file.
7436 * testsuite/icf_safe_so_test.sh: New file.
7437 * testsuite/icf_safe_test.cc (kept_func_3): New function.
7438 (main): Change to take pointer to function kept_func_3.
7439 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7440 folding is done correctly for X86-64.
7442 2010-02-12 David S. Miller <davem@davemloft.net>
7444 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7445 is_symbolless parameter.
7446 (Output_reloc<SHT_REL>::is_symbolless): New.
7447 (Output_reloc<SHT_REL>::is_symbolless_): New.
7448 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7449 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7450 (Output_reloc<SHT_RELA>::is_symbolless): New.
7451 (Output_data_reloc::add_global): Handle is_symbolless.
7452 (Output_data_reloc::add_global_relative): Likewise.
7453 (Output_data_reloc::add_local): Likewise.
7454 (Output_data_reloc::add_local_relative): Likewise.
7455 (Output_data_reloc::add_symbolless_global_addend): New.
7456 (Output_data_reloc::add_symbolless_local_addend): New.
7457 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7459 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7460 instead of ->is_relative_
7461 (Output_reloc::write): Likewise.
7462 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7463 (Output_reloc::write_rel): Simplify.
7465 * sparc.cc (Target_sparc::Scan::local): Use
7466 ->add_symbolless_local_addend as needed.
7467 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7468 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
7469 based upon relocation offset.
7471 2010-02-11 Doug Kwan <dougkwan@google.com>
7473 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7474 (Target_arm::Scan::global): Ditto. Also remove a comment before the
7475 beginning of function.
7476 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7477 and MOVT_ABS relocations. Those are non issued in scanning. Fix
7478 parameter is_32bit in calls to should_apply_static_reloc.
7479 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7480 (check_DATA): Add arm_abs_global.stdout.
7481 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7482 arm_abs_global.stdout): New rules.
7483 (MOSTLLYCLEANFILES): Add arm_abs_global
7484 * Makefile.in: Regenerate.
7485 * testsuite/arm_abs_global.s: New file.
7486 * testsuite/arm_abs_global.sh: Ditto.
7487 * testsuite/arm_abs_lib.s: Ditto.
7489 2010-02-11 Ian Lance Taylor <iant@google.com>
7491 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7493 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
7494 Allocate_commons_task first.
7495 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7496 task, rather than symtab_lock_.
7497 (Gc_process_relocs::~Gc_process_relocs): New function.
7498 (Gc_process_relocs::is_runnable): Check this_blocker_.
7499 (Gc_process_relocs::locks): Use next_blocker_ rather than
7501 (Scan_relocs::~Scan_relocs): New function.
7502 (Scan_relocs::is_runnable): Check this_blocker_ rather than
7504 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
7506 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7507 fields. Add this_blocker_ and next_blocker_ fields. Adjust
7508 constructor accordingly.
7509 (class Gc_process_relocs): Likewise.
7510 (class Scan_relocs): Likewise.
7511 * common.h (class Allocate_commons_task): Remove symtab_lock_
7512 field, and corresponding constructor parameter.
7513 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7515 (Allocate_commons_task::locks): Likewise.
7517 2010-02-11 Ian Lance Taylor <iant@google.com>
7519 * gold-threads.h (class Once): Define.
7520 (class Initialize_lock): Rewrite as child of Once.
7521 * gold-threads.cc (class Once_initialize): Define.
7522 (once_pointer_control): New static variable.
7523 (once_pointer, once_arg): New static variables.
7524 (c_run_once): New static function.
7525 (Once::Once, Once::run_once, Once::internal_run): New functions.
7526 (class Initialize_lock_once): Remove.
7527 (initialize_lock_control): Remove.
7528 (initialize_lock_pointer): Remove.
7529 (initialize_lock_once): Remove.
7530 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7531 (Initialize_lock::initialize): Rewrite.
7532 (Initialize_lock::do_run_once): New function.
7533 * archive.cc (Archive::interpret_header): Only clear name if it is
7535 * fileread.cc: Include "gold-threads.h"
7536 (file_counts_lock): New static variable.
7537 (file_counts_initialize_lock): Likewise.
7538 (File_read::release): Only increment counts when using --stats.
7539 Use a lock around the increment.
7540 * parameters.cc (class Set_parameters_target_once): Define.
7541 (set_parameters_target_once): New static variable.
7542 (Parameters::Parameters): Move here from parameters.h.
7543 (Parameters::set_target): Rewrite.
7544 (Parameters::set_target_once): New function.
7545 (Parameters::clear_target): Move here and rewrite.
7546 * parameters.h (class Parameters): Update declarations. Add
7547 set_parameters_target_once_ field.
7548 (Parameters::Parameters): Move to parameters.cc.
7549 (Parameters::clear_target): Likewise.
7550 * readsyms.cc (Read_symbols::do_group): Create a Start_group
7552 (Start_group::~Start_group): New function.
7553 (Start_group::is_runnable): New function.
7554 (Start_group::locks, Start_group::run): New functions.
7555 (Finish_group::run): Change saw_undefined to size_t.
7556 * readsyms.h (class Start_group): Define.
7557 (class Finish_group): Change saw_undefined_ field to size_t.
7558 (Finish_group::Finish_group): Remove saw_undefined and
7559 this_blocker parameters. Change all callers.
7560 (Finish_group::set_saw_undefined): New function.
7561 (Finish_group::set_blocker): New function.
7562 * symtab.h (class Symbol_table): Change saw_undefined to return
7563 size_t. Change saw_undefined_ field to size_t.
7564 * target-select.cc (Set_target_once::do_run_once): New function.
7565 (Target_selector::Target_selector): Initialize set_target_once_
7566 field. Don't initialize lock_ and initialize_lock_ fields.
7567 (Target_selector::instantiate_target): Rewrite.
7568 (Target_selector::set_target): New function.
7569 * target-select.h (class Set_target_once): Define.
7570 (class Target_selector): Update declarations. Make
7571 Set_target_once a friend. Remove lock_ and initialize_lock_
7572 fields. Add set_target_once_ field.
7574 2010-02-10 Ian Lance Taylor <iant@google.com>
7576 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7578 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
7579 (queue_middle_tasks): Add all blockers before queueing any tasks.
7580 (queue_final_tasks): Likewise.
7581 * token.h (Task_token::add_blockers): New function.
7582 * object.h (Input_objects::number_of_relobjs): New function.
7584 2010-02-10 Ian Lance Taylor <iant@google.com>
7586 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7587 shared, not if not position independent.
7588 * x86_64.cc (Relocate::relocate_tls): Likewise.
7589 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7590 (tls_pie_pic_test): New target.
7591 * testsuite/Makefile.in: Rebuild.
7593 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7594 (tls_test_main_pie.o, tls_test_pie.o): New targets.
7595 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7596 * testsuite/Makefile.in: Rebuild.
7598 2010-02-09 David S. Miller <davem@davemloft.net>
7600 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7601 R_SPARC_RELATIVE using ->add_local_relative().
7602 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7604 * output.h (Output_data_dynamic::add_section_size): New method
7605 that takes two Output_data objects.
7606 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7607 entry param. Handle it in initializers.
7608 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7609 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7610 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7612 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7613 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7614 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7615 for dynrel_includes_plt.
7616 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7617 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7618 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7620 (Target_sparc::do_finalize_sections): Update to pass true for
7621 dynrel_includes_plt.
7622 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7623 output before .rela.plt
7624 (Target_powerpc::do_finalize_sections): Update to pass true for
7625 dynrel_includes_plt when 32-bit.
7627 2010-02-08 Doug Kwan <dougkwan@google.com>
7629 * arm.cc (Arm_relobj::simple_input_section_output_address): New
7631 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7632 Arm_relobj::scan_section_for_cortex_a8_stubs,
7633 Arm_relobj::do_relocation_section): Instead of calling
7634 Output_section::output_address, use faster
7635 Arm_relobj::simple_input_section_output_address.
7637 2010-02-08 David S. Miller <davem@davemloft.net>
7639 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7640 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7641 relocation helper function.
7643 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7644 just like R_SPARC_GOT{10,13,22}.
7645 (Target_sparc::Scan::local): Likewise.
7646 (Target_sparc::Relocate:relocate): Likewise.
7648 2010-02-06 Ian Lance Taylor <iant@google.com>
7650 * configure.ac: Rewrite targetobjs duplicate removal code to use
7651 only shell constructs.
7652 * configure: Rebuild.
7654 2010-02-05 Doug Kwan <dougkwan@google.com>
7657 * arm.cc (Arm_relobj::section_is_scannable): New method.
7658 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7659 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7661 2010-02-04 Doug Kwan <dougkwan@google.com>
7664 * arm-reloc-property.cc (cstdio): Include.
7665 * configure.ac (targetobjs): Remove duplicates.
7666 * configure: Regenerate.
7667 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7668 big and little endian version for a given address size.
7670 2010-02-03 Doug Kwan <dougkwan@google.com>
7672 * arm-reloc-property.cc
7673 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7675 * arm-reloc-property.h
7676 (Arm_reloc_property_table::get_implemented_static_reloc_property):
7677 New method definition.
7678 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7680 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7682 (GOT_PREL): Change implemented to Y.
7683 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7684 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7685 (Arm_relocate_functions::movw_abs_nc): Remove method.
7686 (Arm_relocate_functions::movt_abs): Ditto.
7687 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7688 (Arm_relocate_functions::thm_movt_abs): Ditto.
7689 (Arm_relocate_functions::movw_rel_nc): Ditto.
7690 (Arm_relocate_functions::movw_rel): Ditto.
7691 (Arm_relocate_functions::movt_rel): Ditto.
7692 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7693 (Arm_relocate_functions:thm_movw_rel): Ditto.
7694 (Arm_relocate_functions:thm_movt_rel): Ditto.
7695 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7696 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7697 New method definitions.
7698 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7699 (Arm_relocation_functions::arm_grp_ldr): Ditto.
7700 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7701 (Arm_relocation_functions::arm_grp_ldc): Ditto.
7702 (Target_arm::Relocate::relocate): Check for non-static or
7703 unimplemented relocation code and exit early. Change calls to
7704 Target_arm::reloc_uses_thumb_bit and
7705 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7706 instead. Refactor code to handle similar relocations to increase
7707 code sharing. Remove check for unsupported relocation code in switch
7709 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7710 relocation property table to find out size. Change error message to
7711 print out the name of a relocation code instead of the numeric value.
7712 (Target_arm::scan_reloc_for_stub): Use relocation property table
7713 instead of calling Target_arm::reloc_uses_thumb_bit().
7715 2010-02-02 Doug Kwan <dougkwan@google.com>
7717 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7718 types of relaxed input section.
7720 2010-02-02 Doug Kwan <dougkwan@google.com>
7722 * Makefile.am (HFILES): Add arm-reloc-property.h.
7724 (TARGETSOURCES): Add arm-reloc-property.cc
7725 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7726 (libgold_a_SOURCES): $(DEFFILES)
7727 * Makefile.in: Regenerate.
7728 * arm-reloc-property.cc: New file.
7729 * arm-reloc-property.h: New file.
7730 * arm-reloc.def: New file.
7731 * arm.cc: Update comments.
7732 (arm-reloc-property.h): New included header.
7733 (arm_reloc_property_table): New global variable.
7734 (Target_arm::do_select_as_default_target): New method definition.
7735 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7736 arm-reloc-property to targ_extra_obj.
7737 * parameters.cc (set_parameters_target): Call
7738 Target::select_as_default_target().
7739 * target.h (Target::select_as_default_target): New method definition.
7740 (Target::do_select_as_default_target): Same.
7742 2010-02-01 Doug Kwan <dougkwan@google.com>
7744 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7745 first_output_text_section_.
7746 (Arm_exidx_fixup::first_output_text_section): New method definition.
7747 (Arm_exidx_fixup::first_output_text_section_): New data member.
7748 (Arm_exidx_fixup::process_exidx_section): Record the first text
7749 output section seen.
7750 (Arm_output_section::fix_exidx_coverage): Set correct linked section
7751 and entsize in output section header.
7753 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7755 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7756 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7757 (Arm_relocate_functions::thm_alu11): New Method.
7758 (Arm_relocate_functions::thm_pc8): New Method.
7759 (Arm_relocate_functions::thm_pc12): New Method.
7760 (Target_arm::Scan::local): Handle the relocations.
7761 (Target_arm::Scan::global): Likewise.
7762 (Target_arm::Relocate::relocate): Likewise.
7763 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7765 2010-01-29 Doug Kwan <dougkwan@google.com>
7767 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7768 of relocation types as ld.
7770 2010-01-29 Doug Kwan <dougkwan@google.com>
7772 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7774 (Arm_relocate_functions::thumb_branch_common): Ditto.
7775 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7776 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7777 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7778 Arm_relocate_functions::jump24): Remove.
7779 (Target_arm::Relocate::relocate): Adjust code to call
7780 Arm_relocation_functions::arm_branch_common and
7781 Arm_relocation_functions::thumb_branch_common instead of their removed
7782 wrappers. Merge switch-cases together to reduce source code size.
7784 2010-01-29 Doug Kwan <dougkwan@google.com>
7786 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7787 output_local_symbol_count_needs_update_.
7788 (Arm_relobj::output_local_symbol_count_needs_update,
7789 Arm_relobj::set_output_local_symbol_count_needs_update,
7790 Arm_relobj::update_output_local_symbol_count): New methods.
7791 (Arm_relobj::output_local_symbol_count_needs_update_): New data
7793 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7794 of pointed function as in a R_ARM_PREL31 relocation.
7795 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7796 for output local symbol count updating.
7797 (Target_arm::do_relax): Update output local symbol counts in objects
7799 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7801 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7803 * arm.cc: Added support for the ARM relocations:
7804 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7805 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7806 (Arm_relocate_functions::movw_rel_nc): Renamed (was
7808 (Arm_relocate_functions::movw_rel): New method.
7809 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7810 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7812 (Arm_relocate_functions::thm_movw_rel): New method.
7813 (Arm_relocate_functions::thm_movt_rel): Renamed (was
7815 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7817 (Target_arm::Scan::global): Likewise.
7818 (Target_arm::Relocate::relocate): Likewise.
7819 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7822 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7824 * arm.cc: Added support for ARM group relocations.
7825 (Target_arm::reloc_needs_sym_origin): New method.
7826 (Arm_relocate_functions::calc_grp_kn): New method.
7827 (Arm_relocate_functions::calc_grp_residual): New method.
7828 (Arm_relocate_functions::calc_grp_gn): New method.
7829 (Arm_relocate_functions::arm_grp_alu): New Method.
7830 (Arm_relocate_functions::arm_grp_ldr): New Method.
7831 (Arm_relocate_functions::arm_grp_ldrs): New Method.
7832 (Arm_relocate_functions::arm_grp_ldc): New Method.
7833 (Target_arm::Scan::local): Handle the ARM group relocations.
7834 (Target_arm::Scan::global): Likewise.
7835 (Target_arm::Relocate::relocate): Likewise.
7836 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7839 2010-01-26 Doug Kwan <dougkwan@google.com>
7841 * arm.cc (set): Include.
7842 (class Arm_exidx_fixup): Change type of last_input_section_ to const
7844 (Arm_output_section::Text_section_list): New type.
7845 (Arm_output_section::append_text_sections_to_list): New method.
7846 (Arm_output_section::fix_exidx_coverage): Ditto.
7847 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7848 (Arm_relobj::convert_input_section_to_relaxed_section): Use
7849 Relobj::set_section_offset() instead of
7850 Sized_relobj::invalidate_section_offset().
7851 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7852 parameter for section headers. Ignore relocation sections for
7853 unallocated sections and EXIDX sections.
7854 (Target_arm::fix_exidx_coverage): New method.
7855 (Target_arm::output_section_address_less_than): New type.
7856 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7857 linked text section instead of the EXIDX section.
7858 (Arm_output_section::create_stub_group): Add an assertion to check
7859 that this is not an EXIDX output section.
7860 (Arm_output_section::append_text_sections_to_list): New method.
7861 (Arm_output_section::fix_exidx_coverage): Ditto.
7862 (Arm_relobj::scan_sections_for_stubs): Adjust call to
7863 Arm_relobj::section_needs_reloc_stub_scanning.
7864 (Target_arm::do_relax): Fix EXIDX output section coverage in the
7866 (Target_arm::fix_exidx_coverage): New method.
7867 * object.h (Relobj::set_output_section): New method.
7868 (Sized_relobj::invalidate_section_offset): Remove method.
7869 (Sized_relobj::do_invalidate_section_offset): Remove method.
7870 (Sized_relobj::do_set_section_offset): Handle offset value -1.
7872 2010-01-25 Doug Kwan <dougkwan@google.com>
7874 * arm.cc (Arm_exidx_merged_section::do_output_offset):
7875 Fix warning due to signed and unsigned comparison on a 32-bit host.
7877 2010-01-22 Doug Kwan <dougkwan@google.com>
7879 * arm.cc (Target_arm::do_relax): Record an output section for section
7880 offset adjustment it contains any stub table that has changed.
7881 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7882 offsets in an output section if necessary.
7883 * output.cc (Output_section::Output_section): Initialize
7884 section_offsets_need_adjustments_.
7885 (Output_section::add_input_section_for_script): Renamed to
7886 Output_section::add_simple_input_section.
7887 (Output_section::save_states): Add a comment.
7888 (Output_section::discard_states): New method defintion.
7889 (Output_section::adjust_section_offsets): Same.
7890 * output.h (Output_section::add_input_section_for_script): Renamed to
7891 Output_section::add_simple_input_section.
7892 (Output_section::discard_states): New method declaration.
7893 (Output_section::adjust_section_offsets): Same.
7894 (Output_section::section_offsets_need_adjustment,
7895 Output_section::set_section_offsets_need_adjustment): New method
7897 (Output_section::section_offsets_need_adjustment_): New data member.
7898 * script-sections.cc
7899 (Output_section_element_input::set_section_address): Adjust code for
7900 renaming of Output_section::add_input_section_for_script.
7901 (Orphan_output_section::set_section_address): Same.
7903 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7905 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7906 Fix_v4bx enum values .
7907 * gold/options.h (General_options): New option definitions.
7908 (General_options::fix_v4bx): New method.
7909 (General_options::Fix_v4bx): New enum.
7910 * gold/options.cc (General_options::parse_fix_v4bx): New method.
7911 (General_options::parse_fix_v4bx_interworking): New method.
7913 2010-01-22 Doug Kwan <dougkwan@google.com>
7915 * arm.cc (Arm_exidx_fixup): New class.
7917 2010-01-21 Doug Kwan <dougkwan@google.com>
7919 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7921 (Arm_exidx_section_offset_map): New type.
7923 2010-01-21 Doug Kwan <dougkwan@google.com>
7925 * arm.cc (Arm_exidx_input_section): New class.
7926 (Arm_relobj::exidx_input_section_by_link,
7927 Arm_relobj::exidx_input_section_by_shndx,
7928 Arm_relobj::make_exidx_input_section): New methods.
7929 (read_arm_attributes_section): Remove.
7930 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7931 information about them.
7932 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7935 2010-01-20 Doug Kwan <dougkwan@google.com>
7937 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7938 Input_section_specifier to Section_id.
7939 (Target_arm::new_arm_input_section: Adjust code for change of key
7941 (Target_arm::find_arm_input_section): Ditto.
7942 * gc.h (object.h): Include for Section_id nand Section_id_hash.
7943 (Section_id): Remove.
7944 (Garbage_collection::Section_id_hash): Remove.
7945 * icf.h (object.h): Include for Section_id nand Section_id_hash.
7946 (Section_id): Remove.
7947 (Icf::Section_id_hash): Remove.
7948 * object.h (Section_id, Const_section_id, Section_id_hash,
7949 Const_section_id_hash): New type definitions.
7950 * output.cc (Output_section::add_relaxed_input_section): Change to
7951 use Const_section_id instead of Input_section_specifier as key type.
7952 (Output_section::add_merge_input_section): Ditto.
7953 (Output_section::build_relaxation_map): Change to use Section_id
7954 instead of Input_section_specifier as key type.
7955 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7957 (Output_section::convert_input_sections_to_relaxed_sections): Change
7958 to use Const_section_id instead of Input_section_specifier as key type.
7959 (Output_section::find_merge_section): Ditto.
7960 (Output_section::find_relaxed_input_section): Ditto.
7961 * output.h (Input_section_specifier): Remove class.
7962 (Output_section::Output_section_data_by_input_section_map): Change
7963 key type to Const_section_id.
7964 (Output_section::Output_relaxed_input_section_by_input_section_map):
7966 (Output_section::Relaxation_map): Change key type to Section_id.
7968 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7970 * gold/arm.cc: Added support for R_ARM_V4BX relocation
7971 (class Arm_v4bx_stub): New class.
7972 (DEF_STUBS): Updated definition to support v4_veneer_bx.
7973 (Stub_factory::make_arm_v4bx_stub): New method.
7974 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7975 (Stub_table::empty): Handle v4bx stubs.
7976 (Stub_table::add_arm_v4bx_stub): New method.
7977 (Stub_table::find_arm_v4bx_stub): New method.
7978 (Arm_relocate_functions::v4bx): New method.
7979 (Target_arm::fix_v4bx): New method.
7980 (Target_arm::Target_arm): Handle R_ARM_V4BX.
7981 (Stub_table::relocate_stubs): Likewise.
7982 (Stub_table::do_write): Likewise.
7983 (Stub_table::update_data_size_and_addralign): Likewise.
7984 (Stub_table::finalize_stubs): Likewise.
7985 (Target_arm::Scan::local): Likewise.
7986 (Target_arm::Scan::global): Likewise.
7987 (Target_arm::do_finalize_sections): Likewise.
7988 (Target_arm::Relocate::relocate): Likewise.
7989 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7991 (Target_arm::scan_reloc_for_stub): Likewise.
7992 (Target_arm::scan_reloc_section_for_stubs): Likewise.
7994 2010-01-19 Ian Lance Taylor <iant@google.com>
7996 * output.cc (Output_section_headers::do_sized_write): Write large
7997 segment count to sh_info field.
7998 (Output_file_header::do_sized_write): For large segment count,
7999 write PN_XNUM to e_phnum field.
8001 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8003 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8004 (Arm_relocate_functions::thm_jump8): New function.
8005 (Arm_relocate_functions::thm_jump11): New function.
8006 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8008 (Target_arm::Scan::global): Likewise.
8009 (Target_arm::Relocate::relocate): Likewise.
8010 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8013 2010-01-14 Doug Kwan <dougkwan@google.com>
8015 * arm.cc (map, utility): Include headers.
8016 (Target_arm::apply_cortex_a8_workaround): New method.
8017 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8018 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8019 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8020 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8021 the --[no-]fix-cortex-a8 command line options.
8022 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8023 (Target_arm::relocate_stub): Use addend in instruction template.
8024 * options.h (DEFINE_bool): Set the user-set flag.
8025 (General_options): Add --[no-]-fix-cortex options.
8026 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8027 : Update fast look-up map after conversion.
8029 2010-01-14 Sriraman Tallam <tmsriram@google.com>
8031 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8032 in the first pass of do_layout.
8034 2010-01-13 Doug Kwan <dougkwan@google.com>
8036 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8037 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8038 apparent compiler problem of not folding static constant integral
8039 data members of elfcpp::Elf_sizes<32>.
8041 2010-01-13 Doug Kwan <dougkwan@google.com>
8043 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8044 Arm_relobj::section_needs_cortex_a8_stub_scanning,
8045 Arm_relobj::scan_section_for_cortex_a8_erratum,
8046 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8047 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8048 sections to scan for relocation stubs into a new method
8049 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
8050 relocation and Cortex-A8 stub scanning.
8051 (Target_arm::do_relax): Force stubs to be after stubbed sections
8052 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
8053 the beginning of a new relaxation pass. Update a comment.
8054 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8056 2010-01-12 Ian Lance Taylor <iant@google.com>
8058 * target-reloc.h (visibility_error): New inline function.
8059 (relocate_section): Call visibility_error.
8060 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8061 (MOSTLYCLEANFILES): Likewise.
8062 (protected_4_pic.o, protected_3.err): New targets.
8063 * testsuite/protected_4.cc: New file.
8065 2010-01-12 Doug Kwan <dougkwan@google.com>
8067 * arm.cc (Cortex_a8_reloc): New class.
8068 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8069 and cortex_a8_relocs_info_.
8070 (Target_arm::fix_cortex_a8): New method definition.
8071 (Target_arm::Cortex_a8_relocs_info): New type.
8072 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8073 New data member declarations.
8074 (Target_arm::scan_reloc_for_stub): Record information about
8075 relocations for THUMB branches that might be exempted from the
8076 Cortex-A8 workaround.
8077 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8078 at the beginning of a relaxation pass.
8080 2010-01-12 Doug Kwan <dougkwan@google.com>
8082 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8083 (Arm_relobj::Mapping_symbol_position,
8084 Arm_reloj::Mapping_symbol_position_less,
8085 Arm_relobj::Mapping_symbols_info): New types.
8086 (Target_arm::is_mapping_symbol_name): New method definition.
8087 (Arm_relobj::do_count_local_symbols): Save information about mapping
8090 2010-01-11 Doug Kwan <dougkwan@google.com>
8092 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8093 Arm_relocate_functions::thumb32_branch_upper,
8094 Arm_relocate_functions::thumb32_branch_lower,
8095 Arm_relocate_functions::thumb32_cond_branch_offset,
8096 Arm_relocate_functions::thumb32_cond_branch_upper,
8097 Arm_relocate_functions::thumb32_cond_branch_lower,
8098 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8099 branch offset encoding.
8100 (Arm_relocate_functions::thumb_branch_common): Use new branch
8101 offset encoding methods to avoid code duplication.
8102 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8103 (Stub_addend_reader::operator()): Use new branch encoding method
8104 to avoid code duplication.
8106 2010-01-11 Doug Kwan <dougkwan@google.com>
8108 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8109 (Target_arm::do_finalize_sections): Define special EXIDX section
8110 symbols only if referenced.
8111 * gc.h (Garbage_collection::add_reference): New method.
8112 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8115 2010-01-11 Ian Lance Taylor <iant@google.com>
8117 * script.cc (Version_script_info::build_expression_list_lookup):
8118 Change complaing about duplicate wildcard match from error to
8121 * script.cc (class Lazy_demangler): Recreate--revert part of patch
8123 (Version_script_info::Version_script_info): Initialize globs_,
8124 default_version_, default_is_global_, and exact_. Don't
8125 initialize globals_ or locals_.
8126 (Version_script_info::build_lookup_tables): Build local symbols
8128 (Version_script_info::unquote): New function.
8129 (Version_script_info::add_exact_match): New function.
8130 (Version_script_info::build_expression_list_lookup): Remove lookup
8131 parameter. Add is_global parameter. Change all callers. Handle
8132 wildcard pattern specially. Unquote pattern. Call
8134 (Version_script_info::get_name_to_match): New function.
8135 (Version_script_info::get_symbol_version): New function.
8136 (Version_script_info::get_symbol_version_helper): Remove.
8137 (Version_script_info::check_unmatched_names): Call unquote.
8138 * script.h (class Version_script_info): Change get_symbol_version
8139 to be non-inline and add is_global parameter; change all callers.
8140 Rewrite symbol_is_local. Update declarations. Define struct
8141 Version_tree_match, Exact, Globs. Don't define struct Lookup.
8142 Remove globals_ and locals_ members. Add exact_, globs_,
8143 default_version_, is_global_.
8144 (Version_script_info::Glob): Remove pattern, add expression and
8145 is_global. Update constructor. Change all callers.
8146 * dynobj.cc (Versions::finalize): Mark the version symbol as the
8148 (Versions::symbol_section_contents): If a symbol is undefined, or
8149 defined in a dynamic object, set the version index to
8151 * symtab.cc (Symbol_table::add_from_relobj): Don't call
8153 (Symbol_table::add_from_pluginobj): Likewise.
8154 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8156 2010-01-11 Doug Kwan <dougkwan@google.com>
8158 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8159 (incremental_dump_LDADD): Add linking option for libintl.
8160 * Makefile.in: Regenerate.
8162 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
8165 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8167 * testsuite/Makefile.in: Regenerated.
8169 2010-01-10 Doug Kwan <dougkwan@google.com>
8171 * options.h (DEFINE_var): Use parentheses around argument varname__
8172 in macro body to avoid any unintended subsequent substitutions.
8174 2010-01-10 Ian Lance Taylor <iant@google.com>
8176 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8177 candidates before doing symbol resolution.
8179 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8180 ODR candidates if only one is weak.
8182 2010-01-08 Ian Lance Taylor <iant@google.com>
8184 * script.cc (Version_script_info::build_expression_list_lookup):
8185 Don't warn about ambiguous version, just record the ambiguity.
8186 (Version_script_info::get_symbol_version_helper): Give error if
8187 version is ambiguous.
8189 2010-01-08 Doug Kwan <dougkwan@google.com>
8191 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8192 prev_data_size_ and prev_addralign_. Remove initializer for
8193 deleted data member has_been_changed_.
8194 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8195 to determine if the table is empty.
8196 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8198 (Stub_table::add_reloc_stub): Define method in class definition
8199 instead of just declaring it there.
8200 (Stub_table::add_cortex_a8_stub): New method definition.
8201 (Stub_table::update_data_size_and_addralign): Ditto.
8202 (Stub_table::finalize_stubs): Ditto.
8203 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8204 (Stub_table::do_addralign_): Return address alignment in the
8205 (Stub_table::do_reset_address_and_file_offset): Define method in
8206 class definition instead of declaring it there. Set current data
8207 size to be the data size of the previous pass.
8208 (Stub_table::set_final_data_size): Use current data size as the
8210 (Stub_table::relocate_stub): Change parameter type of stub from
8211 Reloc_stub pointer to Stub pointer.
8212 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8213 (Stub_table::Cortex_a8_stub_list): New typedef.
8214 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8215 Stub_table::prev_addralign_): New data member.
8216 (Arm_relobj::Arm_relobj): Initialize data member
8217 section_has_cortex_a8_workaround_.
8218 (Arm_relobj::section_has_cortex_a8_workaround,
8219 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8221 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8223 (Target_arm::relocate_stub): Change parameter type of stub from
8224 Reloc_stub pointer to Stub pointer.
8225 (Insn_template::size, Insn_template::alignment): Handle
8226 THUMB16_SPECIAL_TYPE.
8227 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8228 Stub_table::update_data_size_and_addralign,
8229 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8231 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8232 (Stub_table::do_write): Ditto.
8233 (Target_arm::do_relax): Adjust code for changes in Stub_table.
8235 2010-01-08 Ian Lance Taylor <iant@google.com>
8238 * symtab.h (class Symbol): Remove fields is_target_special_ and
8239 has_plt_offset_. Add field is_defined_in_discarded_section_.
8240 (Symbol::is_defined_in_discarded_section): New function.
8241 (Symbol::set_is_defined_in_discarded_section): New function.
8242 (Symbol::has_plt_offset): Rewrite.
8243 (Symbol::set_plt_offset): Verify that new offset is not -1U.
8244 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8245 Don't initialize is_target_special_ or has_plt_offset_.
8246 Initialize is_defined_in_discarded_section_.
8247 (Symbol_table::add_from_relobj): If appropriate, set
8248 is_defined_in_discarded_section.
8249 * resolve.cc (Symbol::override_base_with_special): Don't test
8250 is_target_special_. Change has_plt_offset_ to has_plt_offset().
8251 * target-reloc.h (relocate_section): Do special handling for
8252 symbols defined in discarded sections for global symbols as well
8255 2010-01-08 Ian Lance Taylor <iant@google.com>
8257 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8258 the SHT_SYMTAB case.
8260 2010-01-08 Ian Lance Taylor <iant@google.com>
8262 * object.cc (Sized_relobj::do_layout): Don't get confused if
8263 layout_eh_frame returns NULL.
8265 2010-01-08 Ian Lance Taylor <iant@google.com>
8268 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8269 dynamic symbol table, use the normal symbol table.
8270 (Sized_dynobj::do_read_symbols): Remove assertion about type of
8273 2010-01-08 Ian Lance Taylor <iant@google.com>
8276 * layout.cc (Layout::include_section): Remove .gnu_debuglink
8279 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
8281 * version.cc (print_version): Change to "Copyright 2010".
8283 2010-01-08 Ian Lance Taylor <iant@google.com>
8287 * i386.cc (class Target_i386): Change return type of plt_section
8289 (class Output_data_plt_i386): Add tls_desc_rel_ field.
8290 (Output_data_plt_i386::Output_data_plt_i386): Initialize
8291 tls_desc_rel_ field.
8292 (Output_data_plt_i386::rel_tls_desc): New function.
8293 (Target_i386::rel_tls_desc_section): New function.
8294 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8295 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8296 R_386_TLS_DESC reloc in rel_tls_desc_section.
8297 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8298 Define struct Tlsdesc_info.
8299 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8300 (Target_x86_64::do_reloc_symbol_index): New function.
8301 (Target_x86_64::add_tlsdesc_info): New function.
8302 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8303 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8305 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
8307 (Output_data_plt_x86_64::rela_tlsdesc): New function.
8308 (Target_x86_64::rela_tlsdesc_section): New function.
8309 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8311 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8312 (Target_x86_64::do_reloc_addend): New function.
8313 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8314 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8315 declarations. Define TARGET_CODE. Add arg field to u1_ union.
8316 (Output_reloc::type): New function.
8317 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8318 (Output_reloc::is_target_specific): New function.
8319 (Output_reloc::target_arg): New function.
8320 (class Output_reloc) [SHT_RELA]: Add four new constructors for
8321 absolute relocs and target specific relocs.
8322 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8323 add_target_specific.
8324 (class Output_data_reloc) [SHT_RELA]: Likewise.
8325 * output.cc (Output_reloc::Output_reloc): Add four new versions
8326 for absolute relocs and target specific relocs.
8327 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8328 (Output_reloc::get_symbol_index): Likewise.
8329 (Output_reloc::local_section_offset): Check that local_sym_index_
8330 is not TARGET_CODE or 0.
8331 (Output_reloc::symbol_value): Likewise.
8332 (Output_reloc::write) [SHT_RELA]: Call target for target specific
8334 * target.h (class Target): Add reloc_symbol_index and reloc_addend
8335 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
8337 * layout.cc (add_target_dynamic_tags): Use output section for
8338 DT_PLTRELSZ and DT_JMPREL.
8340 2010-01-07 Ian Lance Taylor <iant@google.com>
8343 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8345 (class Output_data_reloc_generic): Define.
8346 (class Output_data_reloc_base): Change base class to
8347 Output_data_reloc_generic. Change add() method to call
8348 bump_relative_reloc_count for a relative reloc. Remove
8350 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8352 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8353 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
8355 * layout.h (class Layout): Update declaration.
8357 2010-01-07 Ian Lance Taylor <iant@google.com>
8359 * output.h (class Output_data): Add const version of
8360 output_section and do_output_section.
8361 (class Output_section_data): Add const version of
8363 (class Output_section): Likewise.
8364 * layout.cc (Layout::add_target_dynamic_tags): New function.
8365 * layout.h (class Layout): Update declarations.
8366 * arm.cc (Target_arm::do_finalize_sections): Use
8367 add_target_dynamic_tags.
8368 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8369 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8370 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8371 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8373 2010-01-07 Ian Lance Taylor <iant@google.com>
8376 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8379 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
8380 Ian Lance Taylor <iant@google.com>
8383 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8384 Xindex::read_symtab_xindex.
8386 2010-01-07 Doug Kwan <dougkwan@google.com>
8388 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8389 (Insn_template::thumb16_bcond_insn): New method declaration.
8390 (Insn_template): Fix spelling.
8391 (Stub::thumb16_special): New method declaration.
8392 (Stub::do_write): Define virtual method which was previously pure
8394 (Stub::do_thumb16_special): New method declaration.
8395 (Stub::do_fixed_endian_write): New template member.
8396 (Reloc_stub::do_write): Remove.
8397 (Reloc_stub::do_fixed_endian_write): Remove.
8398 (Cortex_a8_stub): New class definition.
8399 (Stub_factory::make_cortex_a8_stub): New method definition.
8400 (Stub_factory::Stub_factory): Add missing static storage class
8401 qualifier for elf32_arm_stub_a8_veneer_blx.
8403 2010-01-07 Ian Lance Taylor <iant@google.com>
8406 * options.h (class General_options): Add --warn-unresolved-symbols
8407 and --error-unresolved-symbols.
8408 * errors.cc (Errors::undefined_symbol): Implement
8409 --warn-unresolved-symbols.
8411 * options.h (class General_options): Add -z text and -z textoff.
8412 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8414 2010-01-06 Sriraman Tallam <tmsriram@google.com>
8416 * gc.h (Garbage_collection::Cident_section_map): New typedef.
8417 (Garbage_collection::cident_sections): New function.
8418 (Garbage_collection::add_cident_section): New function.
8419 (Garbage_collection::cident_sections_): New member.
8420 (gc_process_relocs): Add references to sections whose names are C
8422 * gold.h (cident_section_start_prefix): New constant.
8423 (cident_section_stop_prefix): New constant.
8424 (is_cident): New function.
8425 * layout.cc (Layout::define_section_symbols): Replace string constants
8426 with the newly defined constants.
8427 * object.cc (Sized_relobj::do_layout): Track sections whose names are
8429 * testsuite/Makefile.am: Add gc_orphan_section_test.
8430 * testsuite/Makefile.in: Regenerate.
8431 * testsuite/gc_orphan_section_test.cc: New file.
8432 * testsuite/gc_orphan_section_test.sh: New file.
8434 2010-01-06 Ian Lance Taylor <iant@google.com>
8437 * options.h (class General_options): Add --warn-shared-textrel.
8438 * layout.cc (Layout::finish_dynamic_section): Implement
8439 --warn-shared-textrel.
8442 * options.h (class General_options): Add --warn-multiple-gp.
8444 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8446 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8447 $(THREADSLIB) and $(LIBDL).
8448 * Makefile.in: Rebuild.
8450 2010-01-06 Ian Lance Taylor <iant@google.com>
8453 * options.cc (General_options::parse_section_start): New function.
8454 (General_options::section_start): New function.
8455 (General_options::General_options): Initialize all members.
8456 * options.h: Include <map>
8457 (class General_options): Add --section-start. Add section_starts_
8459 * layout.cc (Layout::attach_allocated_section_to_segment): If
8460 --section-start was used, set the address of the segment. Remove
8461 local sort_sections.
8462 (Layout::relaxation_loop_body): If the address of the load segment
8463 has been set by --section-start, don't use it.
8464 * output.h (Output_segment::update_flags_for_output_section): New
8466 * output.cc (Output_segment::add_output_section): Call
8467 update_flags_for_output_section.
8469 2010-01-05 Ian Lance Taylor <iant@google.com>
8472 * options.h (class General_options): Add --undefined-version.
8473 * script.cc (struct Version_expression): Add was_matched_by_symbol
8475 (Version_script_info::matched_symbol): New function.
8476 (Version_script_info::get_symbol_version_helper): Call
8478 (Version_script_info::check_unmatched_names): New function.
8479 * script.h (class Version_script_info): Update declarations.
8480 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8482 * options.h (class General_options): Use DEFINE_bool_alias for
8483 allow_multiple_definition.
8484 * resolve.cc (Symbol_table::should_override): Don't test
8485 allow_multiple_definition.
8488 * options.h (class General_options): Add --cref.
8489 * main.cc (main): Print cref table if --cref. Don't close mapfile
8490 until after printing cref table.
8491 * cref.cc: Include "symtab.h".
8492 (class Cref_inputs): Define Cref_table_compare and Cref_table.
8493 (Cref_table_compare::operator()): New function.
8494 (Cref_inputs::gather_cref): New function.
8495 (filecol): New static const.
8496 (Cref_inputs::print_cref): New function.
8497 (Cref::print_cref): New function.
8498 * cref.h: Include <cstdio>.
8499 (class Cref): Update declarations.
8500 * mapfile.h (Mapfile::file): New function.
8501 * object.h (class Object): Define Symbols. Declare virtual
8502 do_get_global_symbols.
8503 (Object::get_global_symbols): New function.
8504 * object.cc (Input_objects::add_object): Pass object to cref_ if
8506 (Input_objects::archive_start): Likewise.
8507 (Input_objects::archive_stop): Likewise.
8508 (Input_objects::print_cref): New function.
8509 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8510 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8512 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8514 * plugin.h (class Sized_pluginobj): Update declarations.
8516 2010-01-05 Ian Lance Taylor <iant@google.com>
8518 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8519 to is_default_version. Rename insdef to insdefault.
8520 (Symbol_table::add_from_relobj): Rename def to is_default_version
8521 and local to is_forced_local.
8522 (Symbol_table::add_from_pluginobj): Likewise.
8523 (Symbol_table::add_from_dynobj): Likewise.
8524 (Symbol_table::define_special_symbol): Rename insdef to
8527 2010-01-04 Ian Lance Taylor <iant@google.com>
8530 * options.h (class General_options): Add
8531 --allow-multiple-definition and -z muldefs.
8532 * resolve.cc (Symbol_table::should_override): Don't warn about a
8533 multiple symbol definition if --allow-multiple-definition or -z
8537 * options.h (class General_options): Add --add-needed and
8538 --copy-dt-needed-entries. Tweak --as-needed help entry.
8539 * object.cc (Input_objects::check_dynamic_dependencies): Give an
8540 error if --copy-dt-needed-entries aka --add-needed is used and
8541 would cause a change in behaviour.
8544 * options.h (class General_options): Add -G as a short version of
8545 --shared. Add no-op options -assert, -g, and -i.
8547 2010-01-04 Sriraman Tallam <tmsriram@google.com>
8549 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8550 check for .text or .gnu.linkonce.t sections.
8551 * icf.cc (Icf::find_identical_sections): Ditto.
8552 Change the detection for mangled function name within the section
8554 * icf.h (is_section_foldable_candidate): New function.
8556 2009-12-30 Ian Lance Taylor <iant@google.com>
8559 * options.h (class General_options): Permit two dashes with
8560 --retain-symbols-file.
8562 2009-12-30 Ian Lance Taylor <iant@google.com>
8565 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8566 don't put the file header and segment headers in the text
8570 * common.cc (Sort_commons::operator()): Stabilize sort when both
8572 (Symbol_table::do_allocate_commons_list): When allocating common
8573 symbols, skip a symbol which is no longer common.
8574 * symtab.h (Symbol::is_common): Test whether the symbol comes from
8575 an object before checking its type.
8576 * testsuite/common_test_2.c: New file.
8577 * testsuite/common_test_3.c: New file.
8578 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8579 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8580 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8581 (common_test_2_pic.o, common_test_2.so): New targets.
8582 (common_test_3_pic.o, common_test_3.so): New targets.
8583 * testsuite/Makefile.in: Rebuild.
8586 * script.cc (read_input_script): If we see a new SECTIONS clause,
8587 and we have added an input section, give an error.
8588 * layout.h (class Layout): Add have_added_input_section function.
8589 Add have_added_input_section_ field.
8590 * layout.cc (Layout::Layout): Initialize
8591 have_added_input_section_.
8592 (Layout::layout): Set have_added_input_section_.
8593 (Layout::layout_eh_frame): Likewise.
8595 2009-12-30 Ian Lance Taylor <iant@google.com>
8598 * options.h (class General_options): Add --sort-common option.
8599 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8600 * common.cc (Sort_common): Add sort_order parameter to
8601 constructor. Add sort_order_ field.
8602 (Sort_commons::operator): Check sort_order_.
8603 (Symbol_table::allocate_commons): Determine the sort order.
8604 (Symbol_table::do_allocate_commons): Add sort_order parameter.
8606 (Symbol_table::do_allocate_commons_list): Likewise.
8608 2009-12-30 Ian Lance Taylor <iant@google.com>
8611 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8612 symbols from this object, don't change the visibility of an
8614 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8616 2009-12-30 Ian Lance Taylor <iant@google.com>
8619 * script.h (class Version_script_info): Define Language enum.
8620 Update declarations. Define Glob, Exact, and Lookup types. Add
8621 new fields globals_, locals_, and is_finalized_.
8622 * script.cc: Various formatting fixes.
8623 (class Parser_closure): Change language_stack_ from a vector of
8624 std::string to one of Version_script_info::Language. Adjust all
8626 (class Lazy_demangler): Remove.
8627 (struct Version_expression): Change language from std::string to
8628 Version_script_info::Language.
8629 (Version_script_info::Version_script_info): New function.
8630 (Version_script_info::~Version_script_info): Don't call clear.
8631 (Version_script_info::finalize): New function.
8632 (Version_script_info::build_lookup_tables): New function.
8633 (Version_script_info::build_expression_list_lookup): New
8635 (Version_script_info::get_symbol_version_helper): Rewrite to use
8637 (Version_script_info::print_expression_list): Adjust to use
8638 Version_script_info::Language.
8639 (script_push_lex_into_version_mode): Check that the version script
8640 has not been finalized.
8641 (version_script_push_lang): Change language string to
8642 Version_script_info::Language.
8643 * options.cc (Command_line::version_script): New function.
8644 * options.h (class General_options): Add finalize_dynamic_list
8645 function. Change version_script from declaration to definition.
8646 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8647 * testsuite/version_script.map: Remove duplicate def of foo.
8648 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8650 * testsuite/Makefile.in: Rebuild.
8652 2009-12-30 Ian Lance Taylor <iant@google.com>
8655 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8656 if the input symbol index is 0, make the output symbol index 0.
8658 2009-12-30 Ian Lance Taylor <iant@google.com>
8661 * options.h (class General_options): Add -x/--discard-all.
8662 * object.cc (Sized_relobj::do_count_local_symbols): Handle
8663 --discard-all. If the local symbol needs a dynamic entry, check
8664 that before handling --discard-locals.
8666 2009-12-30 Ian Lance Taylor <iant@google.com>
8669 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8671 (Output_segment::add_output_section): Don't change the flags if
8675 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8676 GNU hash table if they need a dynamic value. Otherwise, don't add
8677 them if they are defined in a dynamic object or are forced local.
8679 2009-12-29 Ian Lance Taylor <iant@google.com>
8682 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8683 .gnu.hash table for a 32-bit target.
8686 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8687 regular and a dynamic object only needs a dynamic symbol table
8688 entry if it is externally visible.
8691 * i386.cc (class Target_i386): Initialize global_offset_table_ in
8692 constructor. Add global_offset_table_ field.
8693 (Target_i386::got_section): Set global_offset_table_.
8694 (Target_i386::do_finalize_sections): Set global_offset_table_
8696 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8697 in constructor. Add global_offset_table_ field.
8698 (Target_x86_64::got_section): Set global_offset_table_.
8699 (Target_x86_64::do_finalize_sections): Set global_offset_table_
8702 * layout.cc (Layout::Layout): Initialize increase_relro_.
8703 (Layout::get_output_section): Add is_relro, is_last_relro, and
8704 is_first_non_relro parameters. Change all callers.
8705 (Layout::choose_output_section): Likewise.
8706 (Layout::add_output_section_data): Likewise.
8707 (Layout::make_output_section): Likewise.
8708 (Layout::set_segment_offsets): Clear increase_relro when using a
8710 * layout.h (class Layout): Add increase_relro method. Add
8711 increase_relro_ field. Update declarations.
8712 * output.cc (Output_section::Output_section): Initialize
8713 is_last_relro_ and is_first_non_relro_.
8714 (Output_segment::add_output_section): Group relro sections is
8715 do_sort is true. Handle is_last_relro and is_first_non_relro.
8716 (Output_segment::maximum_alignment): Remove relro handling.
8717 (Output_segment::set_section_addresses): Add increase_relro
8718 parameter. Change all callers. Add initial alignment to align
8719 relro sections on separate page. Remove old relro handling.
8720 (Output_segment::set_section_list_addresses): Remove in_relro
8721 parameter. Change all callers.
8722 (Output_segment::set_offset): Add increase parameter. Change all
8723 callers. Remove old relro handling.
8724 * output.h (class Output_section): Add new methods: is_last_relro,
8725 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8726 Add is_last_relro_ and is_first_non_relro_ fields.
8727 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8728 Create separate .got.plt section. Call increase_relro.
8729 * x86_64.cc (Target_x86_64::got_section): Likewise.
8730 * testsuite/relro_script_test.t: Add .got.plt.
8733 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8734 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8735 (Layout::finalize): Call set_dynamic_symbol_size.
8736 (Layout::set_dynamic_symbol_size): New function.
8737 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
8738 set_dynamic_symbol_size.
8741 * output.h (class Output_section): Add is_entsize_zero_ field.
8742 * output.cc (Output_section::Output_section): Initialize
8744 (Output_section::set_entsize): If two different entsizes are
8745 requested, force it to zero.
8746 (Output_section::add_input_section): Set flags for .debug_str
8747 before updating section flags. Set entsize.
8748 (Output_section::update_flags_for_input_section): Set SHF_MERGE
8749 and SHF_STRING if all input sections have those flags.
8751 2009-12-29 Rafael Espindola <espindola@google.com>
8753 * main.cc (main): Fix the sys time reporting.
8754 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8757 2009-12-29 Sriraman Tallam <tmsriram@google.com>
8759 * options.cc (General_options::parse_version): Allow -v to exit
8760 without an error if there is nothing to link.
8762 2009-12-29 Ian Lance Taylor <iant@google.com>
8764 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8765 using a version of gcc before 4.1.
8766 * configure: Rebuild.
8768 2009-12-28 Chris Demetriou <cgd@google.com>
8770 * attributes.cc (Output_attributes_section_data::do_write): Use
8771 std::vector::front rather than std::vector::data.
8773 2009-12-28 Ian Lance Taylor <iant@google.com>
8775 * symtab.h (class Symbol_table): Add enum Defined.
8776 * resolve.cc (Symbol_table::should_override): Add defined
8777 parameter. Change all callers. Test whether object is NULL
8778 before calling a method on it.
8779 (Symbol_table::report_resolve_problem): Add defined parameter.
8781 (Symbol_table::should_override_with_special): Likewise.
8782 * symtab.cc (Symbol_table::define_in_output_data): Add defined
8783 parameter. Change all callers.
8784 (Symbol_table::do_define_in_output_data): Likewise.
8785 (Symbol_table::define_in_output_segment): Likewise.
8786 (Symbol_table::do_define_in_output_segment): Likewise.
8787 (Symbol_table::define_as_constant): Likewise.
8788 (Symbol_table::do_define_as_constant): Likewise.
8789 * script.h (class Symbol_assignment): Add is_defsym parameter to
8790 constructor; change all callers.
8791 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8792 parameter. Change all callers. Add is_defsym_ field.
8793 (class Parser_closure): Add parsing_defsym parameter to
8794 constructor; change all callers. Add parsing_defsym accessor
8795 function. Add parsing_defsym_ field.
8797 2009-12-28 Ian Lance Taylor <iant@google.com>
8799 * gold.cc (queue_middle_tasks): Fix formatting.
8800 * object.cc (Relobj::is_section_name_included): Likewise.
8802 2009-12-23 Ian Lance Taylor <iant@google.com>
8804 * i386.cc (Target_i386::do_calls_non_split): Recognize
8805 -fsplit-stack prologue for a function with a static chain.
8806 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8807 -fsplit-stack prologue when using %r11.
8809 2009-12-21 Sriraman Tallam <tmsriram@google.com>
8811 * options.cc (General_options::parse_version): Make -v continue and do
8812 the link like GNU ld does.
8814 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
8816 * Makefile.am (CCFILES): Add timer.cc.
8817 (HFILES): Add timer.h.
8818 * configure.ac: Check for sysconf and times.
8819 * main.cc: include timer.h.
8820 (main): Use Timer instead of get_run_time.
8823 * workqueue.cc: include timer.h.
8824 (Workqueue::find_and_run_task):
8825 Report user, sys and wall time.
8826 * Makefile.in: Regenerate.
8827 * config.in: Regenerate.
8828 * configure: Regenerate.
8830 2009-12-16 Doug Kwan <dougkwan@google.com>
8832 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8834 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8835 relaxed input sections.
8836 * output.cc (Output_section::find_relaxed_input_section): Change
8837 return type to Output_relaxed_input_section pointer. Adjust code
8838 for new type of relaxed_input_section_map_.
8839 * output.h (Output_section::find_relaxed_input_section): Change
8840 return type to Output_relaxed_input_section pointer.
8841 (Output_section::Output_relaxed_input_section_by_input_section_map):
8843 (Output_section::relaxed_input_section_map_): Change type to
8844 Output_section::Output_relaxed_input_section_by_input_section_map.
8845 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8848 2009-12-15 Ian Lance Taylor <iant@google.com>
8850 * layout.cc (Layout::create_shstrtab): Only write out after input
8851 sections if we are compressing debug sections.
8853 2009-12-15 Ian Lance Taylor <iant@google.com>
8855 * archive.cc (Archive::add_symbols): Only look up a symbol without
8856 a version if there is, in fact, a version.
8858 2009-12-14 Ian Lance Taylor <iant@google.com>
8860 Revert -Wshadow changes, all changes from:
8861 2009-12-11 Doug Kwan <dougkwan@google.com>
8862 2009-12-11 Nick Clifton <nickc@redhat.com>
8863 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8865 2009-12-11 Doug Kwan <dougkwan@google.com>
8867 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8869 * attributes.cc (Object_attribute::size): Ditto.
8870 (Attributes_section_data::size): Ditto.
8871 (Attributes_section_data::Attributes_section_data): Ditto.
8872 (Output_attributes_section_data::do_write): Ditto.
8873 * attributes.h (Object_attribute::set_type): Ditto.
8874 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8876 2009-12-11 Nick Clifton <nickc@redhat.com>
8878 * archive.cc: Fix shadowed variable warnings.
8880 * compressed_output.cc: Likewise.
8881 * compressed_output.h: Likewise.
8882 * configure: Likewise.
8883 * dwarf_reader.cc: Likewise.
8884 * dynobj.cc: Likewise.
8885 * dynobj.h: Likewise.
8886 * ehframe.cc: Likewise.
8887 * ehframe.h: Likewise.
8888 * errors.cc: Likewise.
8889 * expression.cc: Likewise.
8890 * fileread.cc: Likewise.
8891 * fileread.h: Likewise.
8892 * freebsd.h: Likewise.
8893 * i386.cc: Likewise.
8895 * incremental.h: Likewise.
8896 * layout.cc: Likewise.
8897 * layout.h: Likewise.
8898 * mapfile.cc: Likewise.
8899 * merge.cc: Likewise.
8900 * merge.h: Likewise.
8901 * object.cc: Likewise.
8902 * object.h: Likewise.
8903 * options.h: Likewise.
8904 * output.cc: Likewise.
8905 * output.h: Likewise.
8906 * parameters.cc: Likewise.
8907 * plugin.cc: Likewise.
8908 * powerpc.cc: Likewise.
8909 * reduced_debug_output.cc: Likewise.
8910 * reduced_debug_output.h: Likewise.
8911 * reloc.cc: Likewise.
8912 * reloc.h: Likewise.
8913 * resolve.cc: Likewise.
8914 * script-sections.cc: Likewise.
8915 * script.cc: Likewise.
8916 * script.h: Likewise.
8917 * sparc.cc: Likewise.
8918 * symtab.cc: Likewise.
8919 * symtab.h: Likewise.
8920 * target-select.cc: Likewise.
8921 * target-select.h: Likewise.
8922 * token.h: Likewise.
8923 * workqueue.cc: Likewise.
8924 * workqueue.h: Likewise.
8925 * x86_64.cc: Likewise.
8927 2009-12-10 Doug Kwan <dougkwan@google.com>
8929 * arm.cc (attributes.h): New include.
8930 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8931 (Arm_relobj::~Arm_relobj): Delete object pointed by
8932 attributes_section_data_.
8933 (Arm_relobj::attributes_section_data): New method definition.
8934 (Arm_relobj::attributes_section_data_): New data member declaration.
8935 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8936 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8937 attributes_section_data_.
8938 (Arm_dynobj::attributes_section_data): New method definition.
8939 (Arm_dynobj::attributes_section_data_): New data member declaration.
8940 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
8941 initialization value of may_use_blx_ to false.
8942 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8943 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8944 object attributes to compute results instead of hard-coding.
8945 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8946 Target_arm::get_secondary_compatible_arch,
8947 Target_arm::set_secondary_compatible_arch
8948 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8949 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8950 New method declarations.
8951 (Target_arm::get_aeabi_object_attribute): New method definition.
8952 (Target_arm::attributes_section_data_): New data member declaration.
8953 (read_arm_attributes_section): New template definition.
8954 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8955 (Arm_dynobj::do_read_symbols): Ditto.
8956 (Target_arm::do_finalize_sections): Merge attributes sections from
8957 input. Check for BLX use after attributes section merging.
8958 Fix __exidx_start and __exidx_end visibility. Create an
8959 .ARM.attributes section if necessary.
8960 (Target_arm::get_secondary_compatible_arch,
8961 Target_arm::set_secondary_compatible_arch,
8962 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8963 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8964 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8965 New method definitions.
8967 2009-12-09 Ian Lance Taylor <iant@google.com>
8969 * plugin.cc (Plugin::load): Don't cast from void* to a function
8972 2009-12-09 Ian Lance Taylor <iant@google.com>
8974 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8977 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
8979 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8980 Replace two_file_shared_1.so with two_file_shared_2.so.
8981 * testsuite/Makefile.in: Regenerated.
8983 2009-12-08 Doug Kwan <dougkwan@google.com>
8985 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8986 (HFILES): Add attributes.h and int_encoding.h.
8987 * Makefile.in: Regenerate.
8988 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8989 function definitions to int_encoding.cc
8990 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8991 prototypes to int_encoding.h
8992 * reduced_debug_output.cc (int_encoding.h): New include.
8993 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8994 function definitions to int_encoding.cc
8995 (insert_into_vector, read_from_pointer): Move template definitions to
8997 * attributes.cc: New file.
8998 * attributes.h: New file.
8999 * int_encoding.cc: New file.
9000 * int_encoding.h: New file.
9002 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
9005 * incremental-dump.cc (dump_incremental_inputs): New.
9006 (main): Use dump_incremental_inputs.
9008 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
9011 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9012 checking elfcpp::STT_FUNC.
9013 (Target_i386::Relocate::relocate): Likewise.
9014 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9016 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9017 symbols from shared libraries into normal FUNC symbols.
9019 * symtab.h (Symbol): Add is_func and use it.
9021 2009-12-05 Doug Kwan <dougkwan@google.com>
9023 * arm.cc (Target_arm::arm_info): Initialize new fields
9024 attributes_section and attributes_vendor.
9025 * i386.cc (Target_i386::i386_info): Same.
9026 * object.cc (Sized_relobj::do_layout): Skip attribute section.
9027 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9028 fields attributes_section and attributes_vendor.
9029 * sparc.cc (Target_sparc::sparc_info): Same.
9030 * target.h (Target::attributes_section, Target::attributes_vendor,
9031 Target::is_attributes_section, Target::attribute_arg_type,
9032 Target::attributes_order): New method definitions.
9033 (Target::Target_info::attributes_section,
9034 Target::Target_info::attributes_vendor): New fields.
9035 (Target::do_attribute_arg_type, Target::do_attributes_order): New
9036 virtual method definitions.
9037 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9038 attributes_section and attributes_vendor.
9039 * testsuite/testfile.cc (Target_test::test_target_info): Same.
9041 2009-12-05 Doug Kwan <dougkwan@google.com>
9043 * arm.cc: Update comments about interworking and stub generation.
9044 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9045 considered as non-PIC.
9046 (Arm_relocate_functions::base_abs): Fix formatting.
9047 (Arm_relocate_functions::got_prel): Fix comment. Change interface
9048 of function to use GOT entry address instead of offset.
9049 (Target_arm::Scan::global): Issue an error if a symbol would need a
9050 PLT does not get one because it is untyped. Remove code to create
9051 dynamic symbols for relative branches.
9052 (Target_arm::Relocate::relocate: Use 0 instead of false since function
9053 takes unsigned integer instead of boolean.
9055 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
9057 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9058 (two_file_test_LDADD): Likewise.
9059 (common_test_1_LDADD): Likewise.
9060 (exception_test_LDADD) Likewise.
9061 (weak_test_LDADD): Likewise.
9062 (many_sections_test_LDADD): Likewise.
9063 (initpri1_LDADD): Likewise.
9064 (script_test_1_LDADD): Likewise.
9065 (script_test_2_LDADD): Likewise.
9066 (justsyms_LDADD): Likewise.
9067 (binary_test_LDADD): Likewise.
9068 (large_LDADD): Likewise.
9069 * testsuite/Makefile.in: Regenerated.
9071 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
9073 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9074 (Symbol_table::override_with_special): Likewise.
9075 (Symbol_table::add_from_object): Likewise.
9077 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9079 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9080 Don't set the data_offset twice.
9082 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9084 * testsuite/Makefile.in: Regenerate.
9086 2009-12-03 Doug Kwan <dougkwan@google.com>
9088 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9089 (Target_arm::do_finalize_sections): Add parameter for symbol table
9090 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
9091 * i386.cc (Target_i386::do_finalize_sections): Add an additional
9092 parameter for symbol table pointer.
9093 * layout.cc (Layout::finalize): Call Target::finalize_sections with
9094 an additional parameter for a pointer to symbol table.
9095 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9096 parameter for a symbol table pointer.
9097 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9098 * target.h (Target::finalize_sections, Target::do_finalize_sections):
9100 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9101 parameter for a symbol table pointer.
9103 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
9105 * incremental.cc (Incremental_inputs_header)
9106 (Incremental_inputs_header_write, Incremental_inputs_entry)
9107 (Incremental_inputs_entry_write): Move ...
9108 * incremental.h (Incremental_inputs_header)
9109 (Incremental_inputs_header_write, Incremental_inputs_entry)
9110 (Incremental_inputs_entry_write): here.
9112 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9114 * incremental.cc (make_sized_incremental_binary): Set the target.
9115 Error if it is incompatible.
9116 * output.h (Output_file): Add filename method.
9118 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9120 * incremental.cc (Incremental_inputs_entry): Remove unused argument
9121 from the get_* methods.
9123 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9125 * incremental-dump.cc (main): Check that the offeset of a script is 0.
9126 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9127 Write 0 for the data_offset of scripts.
9129 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9131 * testsuite/Makefile.am: Add the incremental_test.sh test.
9132 * testsuite/incremental_test.sh: New.
9133 * testsuite/incremental_test_1.c: New.
9134 * testsuite/incremental_test_2.c: New.
9136 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
9138 * incremental-dump.cc (main): Fix typos.
9140 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
9143 * incremental-dump.cc (main): Use llu to print 64 bit values.
9145 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
9146 H.J. Lu <hongjiu.lu@intel.com>
9148 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9150 (incremental_dump_LDADD): Likewise.
9151 * Makefile.in: Regenerated.
9153 2009-11-25 Doug Kwan <dougkwan@google.com>
9157 2009-11-25 Doug Kwan <dougkwan@google.com>
9159 * arm.cc (Target_arm::Target_arm): Move method definition
9160 outside of class definition. Add code to handle
9161 --target1-rel, --target1-abs and --target2= options.
9162 (Target_arm::get_reloc_reloc_type): Change method to be
9163 non-static and const.
9164 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9165 New data member declaration.
9166 (Target_arm::Scan::local, Target_arm::Scan::global,
9167 Target_arm::Relocate::relocate,
9168 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9169 Adjust call to Target_arm::get_real_reloc_type.
9170 (Target_arm::get_real_reloc_type): Use command line options
9171 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9172 * options.h (--target1-rel, --target1-abs, --target2): New
9175 2009-11-25 Doug Kwan <dougkwan@google.com>
9177 * arm.cc (Target_arm::Target_arm): Move method definition outside of
9178 class definition. Add code to handle --target1-rel, --target1-abs
9179 and --target2= options.
9180 (Target_arm::get_reloc_reloc_type): Change method to be non-static
9182 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9184 (Target_arm::Scan::local, Target_arm::Scan::global,
9185 Target_arm::Relocate::relocate,
9186 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9187 call to Target_arm::get_real_reloc_type.
9188 (Target_arm::get_real_reloc_type): Use command line options to
9189 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9190 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9193 2009-11-25 Doug Kwan <dougkwan@google.com>
9195 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9196 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9197 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9199 (Arm_relocate_functions::thm_call): Replace body with a call to
9200 Arm_relocate_functions::thumb_branch_common.
9201 (Arm_relocate_functions::thm_jump24,
9202 Arm_relocate_functions::thm_xpc22): New method definitions.
9203 (Arm_relocate_functions::thumb_branch_common): New method definition.
9204 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9206 (Target_arm::Relocate::relocate): Adjust call to thm_call.
9207 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9209 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9211 * Makefile.am: Build incremental-dump
9212 * Makefile.in: Regenerate.
9213 * incremental-dump.cc: New.
9214 * incremental.cc (Incremental_inputs_header_data,
9215 Incremental_inputs_entry_data): Move to incremental.h
9216 * incremental.h: (Incremental_inputs_header_data,
9217 Incremental_inputs_entry_data): Move from incremental.cc
9219 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9221 * incremental.cc (Incremental_inputs_header,
9222 Incremental_inputs_header_write, Incremental_inputs_entry,
9223 Incremental_inputs_entry_write): Add a typedef with the data type.
9225 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9227 * incremental.cc (Incremental_inputs_header,
9228 Incremental_inputs_header_write, Incremental_inputs_entry,
9229 Incremental_inputs_entry_write): Update comment about which
9230 type has the filed descriptions.
9232 2009-11-15 Doug Kwan <dougkwan@google.com>
9234 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9235 (Arm_relocate_functions::arm_branch_common): Change method defintion
9236 in class definition to a method declaration and update list of formal
9238 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9239 Arm_relocation_functions::jump24): Adjust call to
9240 Arm_relocate_functions::arm_branch_common. Update list of formal
9242 (Arm_relocate_functions::xpc25): New method definition.
9243 (Arm_relocate_functions::arm_branch_common): Move method defintion
9244 out from class definition. Use stubs for mode-switching and extending
9246 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9247 specially. Change code to enable use of stubs in ARM branches.
9249 2009-11-10 Doug Kwan <dougkwan@google.com>
9251 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9252 in method declaration.
9253 (Target_arm::relocate_stub): New method declaration.
9254 (Target_arm::default_target): Change to return a pointer instead of
9256 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9257 Target_arm::default_target.
9258 (Arm_Relobj::do_relocate_sections): Remove options paramater in
9260 (Target_arm::relocate_section): Adjust view.
9261 (Target_arm::relocate_stub): New method definition.
9263 2009-11-10 Doug Kwan <dougkwan@google.com>
9265 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9267 * incremental.cc (open_incremental_binary): Initialized local
9268 variables to avoid warnings.
9269 * object.cc (make_elf_object): Ditto.
9270 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9273 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
9276 * testsuite/plugin_test.c: Include "config.h".
9278 2009-11-09 Doug Kwan <dougkwan@google.com>
9280 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9281 (arm_symbol_value): Remove.
9282 (Arm_relocate_functions::arm_branch_common,
9283 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9284 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9285 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9286 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9287 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9288 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9289 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9290 Arm_relocate_functions::thm_mobw_abs_nc,
9291 Arm_relocate_functions::thm_mov_abs,
9292 Arm_relocate_functions::movw_prel_nc,
9293 Arm_relocate_functions::thm_movt_abs,
9294 Arm_relocate_functions::movt_prel,
9295 Arm_relocate_functions::thm_movw_prel_nc,
9296 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9297 (Target_arm::Relocate::relocate): Only decompose address into two
9298 parts if relocation type uses the thumb-bit and pass the actual
9299 bit instead of a flag indicating that the thumb-bit is used. Adjust
9300 calls to methods in Arm_relocate_functions for this change.
9302 2009-11-08 Ian Lance Taylor <iant@google.com>
9305 * reloc.cc: Instantiate
9306 Sized_relobj::initialize_input_to_output_maps and
9307 Sized_relobj:free_input_to_output_maps.
9309 2009-11-06 Ian Lance Taylor <iant@google.com>
9312 * defstd.cc (in_segment): Set only_if_ref true for "end".
9314 2009-11-06 Doug Kwan <dougkwan@google.com>
9316 * arm.cc (class Reloc_stub): Correct a comment.
9317 (Target_arm::Target_arm): Initialize arm_input_section_map_.
9318 (Target_arm::scan_section_for_stubs): New method declaration.
9319 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9320 Change methods from private to protected.
9321 (Target_arm::do_may_relax): New method definition.
9322 (Target_arm::do_relax, Target_arm::group_sections,
9323 Target_arm::scan_reloc_for_stub,
9324 Target_arm::scan_reloc_section_for_stubs): New method declarations.
9325 (Target_arm::arm_input_section_map_): New data member declaration.
9326 (Target_arm::scan_reloc_for_stub,
9327 Target_arm::scan_reloc_section_for_stubs,
9328 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9329 Target_arm::do_relax): New method definitions.
9331 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
9333 * configure.ac: Check for (struct stat)::st_mtim
9334 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9335 * config.in: Regenerate.
9336 * configure: Regenerate.
9338 2009-11-05 Ian Lance Taylor <iant@google.com>
9341 * output.cc (Output_segment::add_output_section): Add missing
9344 2009-11-04 Ian Lance Taylor <iant@google.com>
9347 * object.h (class Object): Add is_needed and set_is_needed
9348 methods. Add is_needed_ field. Make bool fields into bitfields.
9349 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9350 defined in a dynamic object and referenced by a regular object,
9351 set is_needed for the dynamic object.
9352 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9353 if the file is marked with as_needed and it is not needed.
9355 2009-11-04 Ian Lance Taylor <iant@google.com>
9358 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9359 tags if data is discarded by linker script.
9360 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9361 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9362 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9363 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9365 2009-11-04 Ian Lance Taylor <iant@google.com>
9367 * layout.cc (Layout::get_output_section): Add is_interp and
9368 is_dynamic_linker_section parameters. Change all callers.
9369 (Layout::choose_output_section): Likewise.
9370 (Layout::make_output_section): Likewise.
9371 (Layout::add_output_section_data): Add is_dynamic_linker_section
9372 parameter. Change all callers.
9373 * layout.h (class Layout): Update declarations.
9374 * output.h (class Output_section): Add is_interp, set_is_interp,
9375 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9376 Add is_interp_, is_dynamic_linker_section_ fields. Change
9377 generate_code_fills_at_write_ to a bitfield.
9378 * output.cc (Output_section::Output_sections): Initialize new
9380 (Output_segment::add_output_section): Add do_sort parameter.
9383 2009-11-03 Ian Lance Taylor <iant@google.com>
9386 * options.h (class General_options): Add --warn-common.
9387 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9388 merging two common symbols.
9389 (Symbol_table::should_override): Handle --warn-common when merging
9390 a common symbol with a defined symbol. Use report_resolve_problem
9391 for multiple definitions.
9392 (Symbol_table::report_resolve_problem): New function.
9393 * symtab.h (class Symbol_table): Declare report_resolve_problem.
9395 2009-11-03 Doug Kwan <dougkwan@google.com>
9397 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9399 (Target_arm::stub_factory): New method definition.
9400 (Target_arm::new_arm_input_section,
9401 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9402 Target_arm::reloc_uses_thumb_bit): New method declarations.
9403 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9404 New type definitions.
9405 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9406 member declarations.
9407 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9408 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9409 New method definitions.
9411 2009-11-03 Ian Lance Taylor <iant@google.com>
9413 * options.h (class General_options): Add --warn_constructors.
9415 2009-11-03 Ian Lance Taylor <iant@google.com>
9418 * defstd.cc (in_section): Add entries for __rel_iplt_start,
9419 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9421 2009-11-03 Ian Lance Taylor <iant@google.com>
9424 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9425 --msgid-bugs-address.
9426 (install-pdf): New target.
9427 (install-data_yes): Look up one directory to find mkinstalldirs.
9429 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
9431 * po/Make-in (.po.gmo): Don't generate .gmo files in source
9434 2009-10-30 Doug Kwan <dougkwan@google.com>
9436 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9438 2009-10-30 Doug Kwan <dougkwan@google.com>
9440 * arm.cc (Stub_addend_reader): New struct template definition
9441 and partial specializations.
9442 (Stub_addend_reader::operator()): New method definition for a
9443 partially specialized template.
9445 2009-10-30 Doug Kwan <dougkwan@google.com>
9447 * arm.cc (Arm_relobj::processor_specific_flags): New method
9449 (Arm_relobj::do_read_symbols): New method declaration.
9450 (Arm_relobj::processor_specific_flags_): New data member declaration.
9451 (Arm_dynobj): New class definition.
9452 (Target_arm::do_finalize_sections): Add input_objects parameter.
9453 (Target_arm::do_adjust_elf_header): New method declaration.
9454 (Target_arm::are_eabi_versions_compatible,
9455 (Target_arm::merge_processor_specific_flags): New method declaration.
9456 (Target_arm::do_make_elf_object): New overloaded method definitions
9458 (Arm_relobj::do_read_symbols): New method definition.
9459 (Arm_dynobj::do_read_symbols): Ditto.
9460 (Target_arm::do_finalize_sections): Add input_objects parameters.
9461 Merge processor-specific flags from all input objects.
9462 (Target_arm::are_eabi_versions_compatible,
9463 Target_arm::merge_processor_specific_flags,
9464 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9465 New method definitions.
9466 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9467 Input_objects pointer type parameter.
9468 * layout.cc (Layout::finalize): Pass input objects to target's.
9469 finalize_sections function.
9470 * output.cc (Output_file_header::do_sized_write): Set ELF file
9471 header's processor-specific flags.
9472 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9473 Input_objects pointer type parameter.
9474 * sparc.cc (Target_sparc::do_finalize_sections): Same.
9475 * target.h (Input_objects): New forward class declaration.
9476 (Target::processor_specific_flags,
9477 Target::are_processor_specific_flags_sect): New method definitions.
9478 (Target::finalize_sections): Add input_objects parameter.
9479 (Target::Target): Initialize processor_specific_flags_ and
9480 are_processor_specific_flags_set_.
9481 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9483 (Target::set_processor_specific_flags): New method definition.
9484 (Target::processor_specific_flags_,
9485 Target::are_processor_specific_flags_set_): New data member
9487 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9488 Input_objects pointer type parameter.
9490 2009-10-30 Doug Kwan <dougkwan@google.com>
9492 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9494 2009-10-28 Ian Lance Taylor <iant@google.com>
9496 * object.h (class Relobj): Drop options parameter from
9497 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9498 do_scan_relocs, do_relocate. Change all callers.
9499 (class Sized_relobj): Drop options parameters from
9500 do_gc_process_relocs, do_scan_relocs, do_relocate,
9501 do_relocate_sections, relocate_sections, emit_relocs_scan,
9502 emit_relocs_scan_reltype. Change all callers.
9503 (struct Relocate_info): Remove options field and all references to
9505 * reloc.h (class Read_relocs): Remove options constructor
9506 parameter and options_ field. Change all callers.
9507 (class Gc_process_relocs, class Scan_relocs): Likewise.
9508 (class Relocate_task): Likewise.
9509 * target-reloc.h (scan_relocs): Remove options parameter. Change
9511 (scan_relocatable_relocs): Likewise.
9512 * target.h (class Sized_target): Remove options parameter from
9513 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
9515 * gc.h (gc_process_relocs): Remove options parameter. Change all
9517 * arm.cc: Update functions to remove options parameters.
9518 * i386.cc: Likewise.
9519 * powerpc.cc: Likewise.
9520 * sparc.cc: Likewise.
9521 * x86_64.cc: Likewise.
9522 * testsuite/testfile.cc: Likewise.
9524 2009-10-28 Doug Kwan <dougkwan@google.com>
9526 * arm.cc (Arm_relobj): New class definition.
9527 (Arm_relobj::scan_sections_for_stubs,
9528 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9529 New method definitions.
9531 2009-10-28 Cary Coutant <ccoutant@google.com>
9533 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9534 (Plugin::cleanup_done_): New member.
9535 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9536 (Plugin_manager::cleanup_done_): Remove.
9537 (Plugin_manager::add_input_file): Edit error message.
9538 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9539 (Plugin_manager::cleanup): Remove use of cleanup_done_.
9541 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
9543 * fileread.cc: (File_read::View::~View): Use the new
9544 data_ownership_ filed.
9545 (File_read::~File_read): Dispose the new whole_file_view_.
9546 (File_read::open): Mmap the whole file if needed.
9547 (File_read::open): Use whole_file_view_ instead of contents_.
9548 (File_read::find_view): Use whole_file_view_ if applicable.
9549 (File_read::do_read): Use whole_file_view_ instead of contents_.
9550 (File_read::make_view): Use whole_file_view_ instead of contents_,
9551 update File_read::View::View call.
9552 (File_read::find_or_make_view): Update File_read::View::View
9554 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9556 (File_read::View::Data_ownership): New enum.
9557 (File_read::View::View): Replace bool mapped_ with Data_ownership
9559 (File_read::View::mapped_): Remove (replaced by data_ownership_).
9560 (File_read::View::data_ownership_): New field.
9561 (File_read::contents_): Remove (replaced by whole_file_view_).
9562 (File_read::whole_file_view_): New field.
9563 * options.h (class General_options): Add --keep-files-mapped.
9565 2009-10-27 Cary Coutant <ccoutant@google.com>
9567 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9568 * testsuite/Makefile.am (plugin_test_5): New test case.
9569 * testsuite/Makefile.in: Regenerate.
9571 2009-10-25 Doug Kwan <dougkwan@google.com>
9573 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9574 from private to protected to allow access by child class.
9575 (Sized_relobj::do_relocate_sections): New method declaration.
9576 (Sized_relobj::relocate_sections): Virtualize.
9577 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9578 Sized_relobj::relocate_sections. Instantiate template explicitly
9579 for different target sizes and endianity.
9581 2009-10-24 Doug Kwan <dougkwan@google.com>
9583 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9584 (Arm_input_section::as_arm_input_section): New method.
9585 (Arm_output_section): New class definition.
9586 (Arm_output_section::create_stub_group,
9587 Arm_output_section::group_sections): New method definitions.
9589 2009-10-22 Doug Kwan <dougkwan@google.com>
9591 * arm.cc (Arm_input_section): New class definition.
9592 (Arm_input_section::init, Arm_input_section:do_write,
9593 Arm_input_section::set_final_data_size,
9594 Arm_input_section::do_reset_address_and_file_offset): New method
9597 2009-10-21 Doug Kwan <dougkwan@google.com>
9599 * arm.cc (Stub_table, Arm_input_section): New forward class
9601 (Stub_table): New class defintion.
9602 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9603 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9604 New method definition.
9606 2009-10-21 Doug Kwan <dougkwan@google.com>
9608 * arm.cc: Update copyright comments.
9609 (Target_arm): New forward class template declaration.
9610 (Arm_address): New type.
9611 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9612 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9613 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9615 (Insn_template): Same.
9616 (DEF_STUBS): New macro.
9617 (Stub_type): New enum type.
9618 (Stub_template): New class definition.
9621 (Stub_factory): Same.
9622 (Target_arm::Target_arm): Initialize may_use_blx_ and
9623 should_force_pic_veneer_.
9624 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9625 Target_arm::should_force_pic_veneer,
9626 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9627 Target_arm::using_thumb_only, Target_arm:;default_target): New
9629 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9630 New data member declarations.
9631 (Insn_template::size, Insn_template::alignment): New method defintions.
9632 (Stub_template::Stub_template): New method definition.
9633 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9634 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9635 (Stub_factory::Stub_factory): New method definition.
9636 * gold.h (string_hash): New template.
9637 * output.h (Input_section_specifier::hash_value): Use
9639 (Input_section_specifier::string_hash): Remove.
9640 * stringpool.cc (Stringpool_template::string_hash): Use
9643 2009-10-20 Doug Kwan <dougkwan@google.com>
9645 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9646 symbols of relaxed input sections.
9647 * output.h (Output_section::find_relaxed_input_section): Make
9650 2009-10-16 Doug Kwan <dougkwan@google.com>
9652 * dynobj.cc (Versions::Versions): Initialize version_script_.
9653 Only insert base version symbol definition for a shared object
9654 if version script defines any version versions.
9655 (Versions::define_base_version): New method definition.
9656 (Versions::add_def): Check that base version is not needed.
9657 (Versions::add_need): Define base version lazily.
9658 * dynobj.h (Versions::define_base_version): New method declaration.
9659 (Versions::needs_base_version_): New data member declaration.
9660 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9661 (check_DATA): Add no_version_test.stdout.
9662 (libno_version_test.so, no_version_test.o no_version_test.stdout):
9664 * testsuite/Makefile.in: Regenerate.
9665 * testsuite/no_version_test.c: New file.
9666 * testsuite/no_version_test.sh: Ditto.
9668 2009-10-16 Doug Kwan <dougkwan@google.com>
9670 * expression.cc (class Segment_start_expression): New class definition.
9671 (Segment_start_expression::value): New method definition.
9672 (script_exp_function_segment_start): Return a new
9673 Segment_start_expression.
9674 * gold/script-c.h (script_saw_segment_start_expression): New function
9676 * script-sections.cc (Script_sections::Script_sections): Initialize
9677 SAW_SEGMENT_START_EXPRESSION_ to false.
9678 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9679 and -Tbbs options to specify section addresses if given in
9680 command line and no SEGMENT_START expression is seen in a script.
9681 * script-sections.h (Script_sections::saw_segment_start_expression,
9682 Script_sections::set_saw_segment_start_expression): New method
9684 (Script_sections::saw_segment_start_expression_): New data member
9686 * script.cc (script_saw_segment_start_expression): New function.
9687 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9688 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9689 script_test_7.sh and script_test_8.sh.
9690 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9691 script_test_8.stdout.
9692 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9693 (script_test_6, script_test_6.stdout, script_test_7,
9694 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9695 * Makefile.in: Regenerate.
9696 * testsuite/script_test_6.sh: New file.
9697 * testsuite/script_test_6.t: Same.
9698 * testsuite/script_test_7.sh: Same.
9699 * testsuite/script_test_7.t: Same.
9700 * testsuite/script_test_8.sh: Same.
9702 2009-10-16 Doug Kwan <dougkwan@google.com>
9704 * output.cc (Output_segment::set_section_list_address): Cast
9705 expressions to unsigned long long type to avoid format warnings.
9707 2009-10-15 Ian Lance Taylor <iant@google.com>
9709 * script.cc (Script_options::add_symbol_assignment): Always add a
9710 dot assignment to script_sections_.
9711 * script-sections.cc (Script_sections::add_dot_assignment):
9712 Initialize if necessary.
9714 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9715 program headers with no load segment if there is a linker script.
9717 * layout.cc (Layout::set_segment_offsets): Align the file offset
9718 to the segment aligment for -N or -n with no load segment.
9719 * output.cc (Output_segment::add_output_section): Don't crash if
9720 the first section is a TLS section.
9721 (Output_segment::set_section_list_addresses): Print an error
9722 message if the address moves backward in a linker script.
9723 * script-sections.cc
9724 (Output_section_element_input::set_section_addresses): Don't
9725 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9726 (Orphan_output_section::set_section_addresses): Likewise.
9728 2009-10-15 Doug Kwan <dougkwan@google.com>
9730 * layout.cc (Layout::finish_dynamic_section): Generate tags
9731 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9732 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9733 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9735 2009-10-14 Ian Lance Taylor <iant@google.com>
9737 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9739 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9740 data_shdr fields of relinfo.
9741 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9742 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
9743 R_386_TLS_LDO_32, adjust based on section flags.
9744 (Target_i386::Relocate::fix_up_ldo): Remove.
9746 2009-10-13 Ian Lance Taylor <iant@google.com>
9748 Add support for -pie.
9749 * options.h (class General_options): Add -pie and
9751 (General_options::output_is_position_independent): Test -pie.
9752 (General_options::output_is_executable): Return true if not shared
9753 and not relocatable.
9754 (General_options::output_is_pie): Remove.
9755 * options.cc (General_options::finalize): Reject incompatible uses
9757 * gold.cc (queue_middle_tasks): A -pie link is not static.
9758 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9759 * symtab.cc (Symbol::final_value_is_known): Return false if
9760 output_is_position_independent.
9761 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9762 output_is_position_independent.
9763 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9764 output_is_position_independent.
9765 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9766 output_is_position_independent.
9767 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9769 (basic_pie_test.o, basic_pie_test): New targets.
9770 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9771 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9772 (two_file_pie_test): New target.
9773 * testsuite/Makefile.in: Rebuild.
9774 * README: Remove note saying that -pie is not supported.
9776 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
9778 * options.h (class General_options): Add -init and -fini.
9779 * layout.cc (Layout::finish_dynamic_section): Emit
9780 given init and fini functions.
9782 2009-10-13 Sriraman Tallam <tmsriram@google.com>
9784 * gc.h (gc_process_relocs): Check if icf is enabled using new
9786 * gold.cc (queue_initial_tasks): Likewise.
9787 (queue_middle_tasks): Likewise.
9788 * object.cc (do_layout): Likewise.
9789 * symtab.cc (is_section_folded): Likewise.
9790 * main.cc (main): Likewise.
9791 * reloc.cc (Read_relocs::run): Likewise.
9792 (Sized_relobj::do_scan_relocs): Likewise.
9793 * icf.cc (is_function_ctor_or_dtor): New function.
9794 (Icf::find_identical_sections): Check if function is ctor or dtor when
9796 * options.h (General_options::icf): Change option to be an enum.
9797 (Icf_status): New enum.
9798 (icf_enabled): New method.
9799 (icf_safe_folding): New method.
9800 (set_icf_status): New method.
9801 (icf_status_): New variable.
9802 * (options.cc) (General_options::finalize): Set icf_status_.
9803 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9804 icf_test and icf_keep_unique_test to use the --icf enum flag.
9805 * testsuite/icf_safe_test.sh: New file.
9806 * testsuite/icf_safe_test.cc: New file.
9808 2009-10-12 Sriraman Tallam <tmsriram@google.com>
9810 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9811 includes to gc.h and icf.h.
9812 * arm.cc: Include gc.h.
9813 * gold.cc: Likewise.
9814 * i386.cc: Likewise.
9815 * powerpc.cc: Likewise.
9816 * sparc.cc: Likewise.
9817 * x86_64.cc: Likewise.
9818 * gc.h: Include icf.h.
9820 2009-10-11 Ian Lance Taylor <iant@google.com>
9822 * plugin.cc: Include "gold.h" before other header files.
9824 2009-10-10 Chris Demetriou <cgd@google.com>
9826 * options.h (Input_file_argument::Input_file_type): New enum.
9827 (Input_file_argument::is_lib_): Replace with...
9828 (Input_file_argument::type_): New member.
9829 (Input_file_argument::Input_file_argument): Take Input_file_type
9830 'type' rather than boolean 'is_lib' as second argument.
9831 (Input_file_argument::is_lib): Use type_.
9832 (Input_file_argument::is_searched_file): New function.
9833 (Input_file_argument::may_need_search): Handle is_searched_file.
9834 * options.cc (General_options::parse_library): Support -l:filename.
9835 (General_options::parse_just_symbols): Update for Input_file_argument
9837 (Command_line::process): Likewise.
9838 * archive.cc (Archive::get_file_and_offset): Likewise.
9839 * plugin.cc (Plugin_manager::release_input_file): Likewise.
9840 * script.cc (read_script_file, script_add_file): Likewise.
9841 * fileread.cc (Input_file::Input_file): Likewise.
9842 (Input_file::will_search_for): Handle is_searched_file.
9843 (Input_file::open): Likewise.
9844 * readsyms.cc (Read_symbols::get_name): Likewise.
9845 * testsuite/Makefile.am (searched_file_test): New test.
9846 * testsuite/Makefile.in: Regenerate.
9847 * testsuite/searched_file_test.cc: New file.
9848 * testsuite/searched_file_test_lib.cc: New file.
9850 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9851 Ian Lance Taylor <iant@google.com>
9853 * descriptor.cc: Include <cstdio> and "binary-io.h".
9854 (Descriptors::open): Open the files in binary mode always.
9855 * script.cc (Lex::get_token): Treat \r as whitespace.
9857 2009-10-09 Ian Lance Taylor <iant@google.com>
9859 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9861 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9862 Ian Lance Taylor <iant@google.com>
9864 * configure.ac: Check for readv function also.
9865 * fileread.cc (readv): Define if not HAVE_READV.
9866 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9868 * config.in: Regenerate.
9869 * configure: Regenerate.
9871 2009-10-09 Doug Kwan <dougkwan@google.com>
9873 * layout.cc (Layout::make_output_section): Call target hook to make
9874 ordinary output section.
9875 (Layout::finalize): Adjust parameter list of call the
9876 Target::may_relax().
9877 * layout.h (class Layout::section_list): New method.
9878 * merge.h (Output_merge_base::entsize): Change visibility to public.
9879 (Output_merge_base::is_string, Output_merge_base::do_is_string):
9881 (Output_merge_string::do_is_string): New method.
9882 * object.cc (Sized_relobj::do_setup): renamed from
9883 Sized_relobj::set_up.
9884 * object.h (Sized_relobj::adjust_shndx,
9885 Sized_relobj::initializ_input_to_output_maps,
9886 Sized_relobj::free_input_to_output_maps): Change visibilities to
9888 (Sized_relobj::setup): Virtualize.
9889 (Sized_relobj::do_setup): New method declaration.
9890 (Sized_relobj::invalidate_section_offset,
9891 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9892 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9893 * options.cc (parse_int): New function.
9894 * options.h (parse_int): New declaration.
9895 (DEFINE_int): New macro.
9896 (stub_group_size): New option.
9897 * output.cc (Output_section::Output_section): Initialize memebers
9898 merge_section_map_, merge_section_by_properties_map_,
9899 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9900 (Output_section::add_input_section): Handled deferred code-fill
9901 generation and remove an old comment.
9902 (Output_section::add_relaxed_input_section): New method definition.
9903 (Output_section::add_merge_input_section): Use merge section by
9904 properties map to speed to search. Update merge section maps
9906 (Output_section::build_relaxation_map): New method definition.
9907 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9909 (Output_section::relax_input_section): Renamed to
9910 Output_section::convert_input_sections_to_relaxed_sections and change
9911 interface to take a vector of pointers to relaxed sections.
9912 (Output_section::find_merge_section,
9913 Output_section::find_relaxed_input_section): New method definitions.
9914 (Output_section::is_input_address_mapped,
9915 Output_section::output_offset, Output_section::output_address):
9916 Use output section data maps to speed up searching.
9917 (Output_section::find_starting_output_address): Add comments.
9918 (Output_section::do_write,
9919 Output_section::write_to_postprocessing_buffer): Do code-fill
9920 generation as appropriate.
9921 (Output_section::get_input_sections): Invalidate relaxed input section
9923 (Output_section::restore_states): Adjust type of checkpoint .
9924 Invalidate relaxed input section map.
9925 * output.h (Output_merge_base): New class declaration.
9926 (Input_section_specifier): New class defintion.
9927 (class Output_relaxed_input_section) Change base class to
9928 Output_section_data_build.
9929 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9930 base class initializer.
9931 (Output_section::add_relaxed_input_section): New method declaration.
9932 (Output_section::Input_section): Change visibility to protected.
9933 (Output_section::Input_section::relobj,
9934 Output_section::Input_section::shndx): Handle relaxed input sections.
9935 Output_section::input_sections) Change visibility to protected. Also
9936 define overload to return a non-const pointer.
9937 (Output_section::Merge_section_properties): New class defintion.
9938 (Output_section::Merge_section_by_properties_map,
9939 Output_section::Output_section_data_by_input_section_map,
9940 Output_section::Relaxation_map): New types.
9941 (Output_section::relax_input_section): Rename method to
9942 Output_section::convert_input_sections_to_relaxed_sections and change
9943 interface to take a vector of relaxed section pointers.
9944 (Output_section::find_merge_section,
9945 Output_section::find_relaxed_input_section,
9946 Output_section::build_relaxation_map,
9947 Output_section::convert_input_sections_in_list_to_relaxed_sections):
9948 New method declarations.
9949 (Output_section::merge_section_map_
9950 Output_section::merge_section_by_properties_map_,
9951 Output_section::relaxed_input_section_map_,
9952 Output_section::is_relaxed_input_section_map_valid_,
9953 Output_section::generate_code_fills_at_write_): New data members.
9954 * script-sections.cc
9955 (Output_section_element_input::set_section_addresses): Call
9956 current_data_size and addralign methods of relaxed input sections.
9957 (Orphan_output_section::set_section_addresses): Call current_data_size
9958 and addralign methods of relaxed input sections.
9959 * symtab.cc (Symbol_table::compute_final_value): Extract template
9960 from the body of Symbol_table::sized_finalize_symbol.
9961 (Symbol_table::sized_finalized_symbol): Call
9962 Symbol_table::compute_final_value.
9963 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9964 (Symbol_table::compute_final_value): New templated method declaration.
9965 * target.cc (Target::do_make_output_section): New method defintion.
9966 * target.h (Target::make_output_section): New method declaration.
9967 (Target::relax): Add more parameters for input objects, symbol table
9968 and layout. Adjust call to do_relax.
9969 (Target::do_make_output_section): New method declaration.
9970 (Target::do_relax): Add parameters for input objects, symbol table
9973 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9975 * pread.c: Include stdio.h.
9977 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9979 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9982 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9984 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9985 Change read_shndx type to unsigned int.
9986 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9988 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9989 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9990 Change read_shndx type to unsigned int.
9991 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9993 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9994 * layout.cc (Layout::create_symtab_sections): Cast the result of
9995 local_symcount * symsize to off_t in the gold_assert.
9997 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9999 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10000 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10002 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10003 (Arm_relocate_functions::thm_abs5): New function.
10004 (Arm_relocate_functions::abs12): New function.
10005 (Arm_relocate_functions::abs16): New function.
10006 (Arm_relocate_functions::base_abs): New function.
10007 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10008 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
10009 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10011 (Scan::global): Likewise.
10012 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10013 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10014 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10015 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10018 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10020 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10021 (Arm_relocate_functions::movt_prel): New function.
10022 (Arm_relocate_functions::thm_movw_prel_nc): New function.
10023 (Arm_relocate_functions::thm_movt_prel): New function.
10024 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10025 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10026 (Scan::global, Relocate::relocate): Likewise.
10027 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10029 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10031 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10032 Incremental_checker.
10033 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10035 (class Incremental_inputs_header): New class.
10036 (Incremental_inputs_header_writer): Edit comment.
10037 (Incremental_inputs_entry): New class.
10038 (Incremental_inputs_entry_writer): Edit comment.
10039 (Sized_incremental_binary::do_find_incremental_inputs_section):
10040 Add *strtab_shndx parameter, fill it.
10041 (Sized_incremental_binary::do_check_inputs): New method.
10042 (Incremental_checker::can_incrementally_link_output_file): Use
10043 Sized_incremental_binary::check_inputs.
10044 (Incremental_inputs::report_command_line): Save command line in
10047 (Incremental_binary::find_incremental_inputs_section): New
10049 (Incremental_binary::do_find_incremental_inputs_section): Add
10050 strtab_shndx parameter.
10051 (Incremental_binary::do_check_inputs): New pure virtual method.
10052 (Sized_incremental_binary::do_check_inputs): Declare.
10053 (Incremental_checker::Incremental_checker): Add incremental_inputs
10054 parameter, use it to initialize incremental_inputs_.
10055 (Incremental_checker::incremental_inputs_): New field.
10056 (Incremental_checker::command_line): New method.
10057 (Incremental_checker::inputs): New method.
10058 (Incremental_checker::command_line_): New field.
10060 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10062 * incremental.cc: Include <cstdarg> and "target-select.h".
10063 (vexplain_no_incremental): New function.
10064 (explain_no_incremental): New function.
10065 (Incremental_binary::error): New method.
10066 (Sized_incremental_binary::do_find_incremental_inputs_section): New
10068 (make_sized_incremental_binary): New function.
10069 (open_incremental_binary): New function.
10070 (can_incrementally_link_file): Add checks if output is ELF and has
10072 * incremental.h: Include "elfcpp_file.h" and "output.h".
10073 (Incremental_binary): New class.
10074 (Sized_incremental_binary): New class.
10075 (open_incremental_binary): Declare.
10076 * object.cc (is_elf_object): Use
10077 elfcpp::Elf_recognizer::is_elf_file.
10078 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10079 * output.h (Output_file::filesize): New method.
10081 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10083 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10085 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10086 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10088 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10090 (Arm_relocate_functions::movw_abs_nc): New function.
10091 (Arm_relocate_functions::movt_abs): New function.
10092 (Arm_relocate_functions::thm_movw_abs_nc): New function.
10093 (Arm_relocate_functions::thm_movt_abs): New function.
10094 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10095 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10096 (Scan::global): Likewise.
10097 (Relocate::relocate): Likewise.
10098 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10100 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10102 * arm.cc (Arm_relocate_functions::got_prel) New function.
10103 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10104 (Relocate::relocate): Likewise.
10105 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10107 2009-10-06 Ian Lance Taylor <iant@google.com>
10109 * options.h (class General_options): Define
10110 split_stack_adjust_size parameter.
10111 * object.h (class Object): Add uses_split_stack_ and
10112 has_no_split_stack_ fields. Add uses_split_stack and
10113 has_no_split_stack accessor functions. Declare
10114 handle_split_stack_section.
10115 (class Reloc_symbol_changes): Define.
10116 (class Sized_relobj): Define Function_offsets. Declare
10117 split_stack_adjust, split_stack_adjust_reltype, and
10119 * object.cc (Object::handle_split_stack_section): New function.
10120 (Sized_relobj::do_layout): Call handle_split_stack_section.
10121 * dynobj.cc (Sized_dynobj::do_layout): Call
10122 handle_split_stack_section.
10123 * reloc.cc (Sized_relobj::relocate_sections): Call
10124 split_stack_adjust for executable sections in split_stack
10125 objects. Pass reloc_map to relocate_section.
10126 (Sized_relobj::split_stack_adjust): New function.
10127 (Sized_relobj::split_stack_adjust_reltype): New function.
10128 (Sized_relobj::find_functions): New function.
10129 * target-reloc.h: Include "object.h".
10130 (relocate_section): Add reloc_symbol_changes parameter. Change
10132 * target.h (class Target): Add calls_non_split method. Declare
10133 do_calls_non_split virtual method. Declare match_view and
10135 * target.cc: Include "elfcpp.h".
10136 (Target::do_calls_non_split): New function.
10137 (Target::match_view): New function.
10138 (Target::set_view_to_nop): New function.
10139 * gold.cc (queue_middle_tasks): Give an error if mixing
10140 split-stack and non-split-stack objects with -r.
10141 * i386.cc (Target_i386::relocate_section): Add
10142 reloc_symbol_changes parameter.
10143 (Target_i386::do_calls_non_split): New function.
10144 * x86_64.cc (Target_x86_64::relocate_section): Add
10145 reloc_symbol_changes parameter.
10146 (Target_x86_64::do_calls_non_split): New function.
10147 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10149 * powerpc.cc (Target_powerpc::relocate_section): Add
10150 reloc_symbol_changes parameter.
10151 * sparc.cc (Target_sparc::relocate_section): Add
10152 reloc_symbol_changes parameter.
10153 * configure.ac: Call AM_CONDITIONAL for the default target.
10154 * configure: Rebuild.
10155 * testsuite/Makefile.am (TEST_AS): New variable.
10156 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10157 (check_DATA): Add split_i386 and split_x86_64 files.
10158 (SPLIT_DEFSYMS): Define.
10159 (split_i386_[1234n].o): New targets.
10160 (split_i386_[124]): New targets.
10161 (split_i386_[1234r].stdout): New targets.
10162 (split_x86_64_[1234n].o): New targets.
10163 (split_x86_64_[124]): New targets.
10164 (split_x86_64_[1234r].stdout): New targets.
10165 (MOSTLYCLEANFILES): Add new executables.
10166 * testsuite/split_i386.sh: New file.
10167 * testsuite/split_x86_64.sh: New file.
10168 * testsuite/split_i386_1.s: New file.
10169 * testsuite/split_i386_2.s: New file.
10170 * testsuite/split_i386_3.s: New file.
10171 * testsuite/split_i386_4.s: New file.
10172 * testsuite/split_i386_n.s: New file.
10173 * testsuite/split_x86_64_1.s: New file.
10174 * testsuite/split_x86_64_2.s: New file.
10175 * testsuite/split_x86_64_3.s: New file.
10176 * testsuite/split_x86_64_4.s: New file.
10177 * testsuite/split_x86_64_n.s: New file.
10178 * testsuite/testfile.cc (Target_test): Update relocation_section
10180 * testsuite/Makefile.in: Rebuild.
10182 2009-10-06 Ian Lance Taylor <iant@google.com>
10184 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10185 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10186 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
10187 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10188 the address on ldo_addrs_.
10189 (Target_i386::Relocate::fix_up_ldo): New function.
10191 2009-10-06 Rafael Espindola <espindola@google.com>
10193 * plugin.cc (add_input_library): New.
10194 (Plugin::load): Add add_input_library to tv.
10195 (Plugin_manager::add_input_file): Add the is_lib argument.
10196 (add_input_file): Update call to Plugin_manager::add_input_file.
10197 (add_input_library): New.
10198 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10200 2009-09-30 Doug Kwan <dougkwan@google.com>
10202 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10203 symbol and call Symbol::may_need_copy_reloc to determine if
10204 a copy reloc is needed.
10205 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10206 nocopyreloc is given in command line.
10207 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10208 given in command line.
10209 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10210 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10211 of the removed Target_i386::may_need_copy_reloc.
10212 * options.h (copyreloc): New option with default value false.
10213 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10214 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10215 instead of the removed Target_powerpc::may_need_copy_reloc.
10216 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10217 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10218 instead of the removed Target_sparc::may_need_copy_reloc.
10219 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10220 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10221 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10222 instead of the removed Target_x86_64::may_need_copy_reloc.
10224 2009-09-30 Ian Lance Taylor <iant@google.com>
10226 * object.h (class Object): Remove target_ field, and target,
10227 sized_target, and set_target methods.
10228 (Object::sized_target): Remove.
10229 (class Sized_relobj): Update declarations. Remove sized_target.
10230 * object.cc (Sized_relobj::setup): Remove target parameter.
10231 Change all callers.
10232 (Input_objects::add_object): Don't do anything with the target.
10233 (make_elf_sized_object): Add punconfigured parameter. Change all
10234 callers. Set or test parameter target.
10235 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10236 Change all callers.
10237 * parameters.cc (Parameters::set_target): Change parameter type to
10239 (Parameters::default_target): Remove.
10240 (set_parameters_target): Change parameter type to be non-const.
10241 (parameters_force_valid_target): New function.
10242 (parameters_clear_target): New function.
10243 * parameters.h (class Parameters): Update declarations. Remove
10244 default_target method. Add sized_target and clear_target
10245 methods. Change target_ to be non-const.
10246 (set_parameters_target): Update declaration.
10247 (parameters_force_valid_target): Declare.
10248 (parameters_clear_target): Declare.
10249 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10250 as NULL if we aren't searching.
10251 (Add_symbols::run): Don't check for compatible target.
10252 * fileread.cc (Input_file::open_binary): Call
10253 parameters_force_valid_target.
10254 * gold.cc (queue_middle_tasks): Likewise.
10255 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
10256 set_target on object.
10257 * dynobj.h (class Sized_dynobj): Update declarations.
10258 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10259 make_elf_object returns NULL.
10260 (Archive::include_member): Don't check whether object target is
10262 * output.cc (Output_section::add_input_section): Get target from
10264 (Output_section::relax_input_section): Likewise.
10265 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10267 (Sized_relobj::do_scan_relocs): Likewise.
10268 (Sized_relobj::relocate_sections): Likewise.
10269 * resolve.cc (Symbol_table::resolve): Likewise.
10270 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
10271 parameter. Change all callers.
10272 (Symbol_table::add_from_object): Get target from parameters.
10273 (Symbol_table::add_from_relobj): Don't check object target.
10274 (Symbol_table::add_from_dynobj): Likewise.
10275 (Symbol_table::define_special_symbol): Get target from
10277 * symtab.h (class Symbol_table): Update declaration.
10278 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10279 parameter. Change all callers. Clear parameter target.
10280 (Binary_test): Test target here.
10281 * testsuite/object_unittest.cc (gold_testsuite): Remove
10282 target_test_pointer parameter. Change all callers.
10283 (Object_test): Test target here.
10285 2009-09-26 Ian Lance Taylor <iant@google.com>
10287 * testsuite/initpri1.c: Don't try to use constructor priorities if
10288 compiling with gcc before 4.3.
10290 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
10292 * testsuite/retain_symbols_file_test.sh (check_present): Change
10293 output file name to retain_symbols_file_test.stdout.
10294 (check_absent): Likewise.
10296 2009-09-18 Craig Silverstein <csilvers@google.com>
10298 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10299 * options.cc: Include <cerrno> and <fstream>.
10300 (General_options::finalize): Parse -retain-symbols-file tag.
10301 * options.h: New flag.
10302 (General_options): New method should_retain_symbol, new
10303 variable symbols_to_retain.
10304 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10305 should_retain_symbol map.
10306 * testsuite/Makefile.am (retain_symbols_file_test): New test.
10307 * testsuite/Makefile.in: Regenerate.
10308 * testsuite/retain_symbols_file_test.sh: New file.
10310 2009-09-18 Nick Clifton <nickc@redhat.com>
10312 * po/es.po: Updated Spanish translation.
10314 2009-09-17 Doug Kwan <dougkwan@google.com>
10316 * debug.h (DEBUG_RELAXATION): New constant.
10317 (DEBUG_ALL): Add DEBUG_RELAXATION.
10318 (debug_string_to_enum): Add relaxation debug option.
10320 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10321 Layout::Relaxation_debug_check::read_sections,
10322 Layout::Relaxation_debug_check::read_sections): New method definitions.
10323 (Layout::Layout): Initialize data members
10324 record_output_section_data_from_scrips_,
10325 script_output_section_data_list_ and relaxation_debug_check_.
10326 (Layout::save_segments, Layout::restore_segments,
10327 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10328 Layout::relaxation_loop_body): New method definitions.
10329 (Layout::finalize): Support relaxation. Move section layout code to
10330 Layout::relaxation_loop_body.
10331 (Layout::set_asection_address_from_script): Move code for orphan
10332 section placement out.
10333 (Layout::place_orphan_sections_in_script): New method definition.
10334 * layout.h (Output_segment_headers, Output_file_header):
10335 New forward class declarations.
10336 (Layout::~Layout): Define.
10337 (Layout::new_output_section_data_from_script): New method definition.
10338 (Layout::place_orphan_sections_in_script): New method declaration.
10339 (Layout::Segment_states): New type declaration.
10340 (Layout::save_segments, Layout::restore_segments,
10341 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10342 Layout::relaxation_loop_body): New method declarations.
10343 (Layout::Output_section_data_list): New type declaration.
10344 (Layout::Relaxation_debug_check): New class definition.
10345 (Layout::record_output_section_data_from_script_,
10346 Layout::script_output_section_data_list_, Layout::segment_states_,
10347 Layout::relaxation_debug_check_): New data members.
10348 * output.cc: (Output_section_headers::do_size): New method definition.
10349 (Output_section_headers::Output_section_headers): Move size
10350 computation to Output_section_headers::do_size.
10351 (Output_segment_headers::do_size): New method definition.
10352 (Output_file_header::Output_file_header): Move size computation to
10353 Output_file_header::do_size and call it.
10354 (Output_file_header::do_size): New method definition.
10355 (Output_data_group::Output_data_group): Adjust call to
10356 Output_section_data.
10357 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10358 (Output_symtab_xindex::do_write): Add array bound check.
10359 (Output_section::Input_section::print_to_mapfile): Handle
10360 RELAXED_INPUT_SECTION_CODE.
10361 (Output_section::Output_section): Initialize data member checkpoint_.
10362 (Output_section::~Output_section): Delete checkpoint object pointed
10364 (Output_section::add_input_section): Always add an Input_section if
10366 (Output_section::add_merge_input_section): Add assert.
10367 (Output_section::relax_input_section): New method definition.
10368 (Output_section::set_final_data_size): Set load address to zero for
10369 an unallocated section.
10370 (Output_section::do_address_and_file_offset_have_reset_values):
10371 New method definition.
10372 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10373 Handle relaxed input section.
10374 (Output_section::sort_attached_input_sections): Checkpoint input
10375 section list lazily.
10376 (Output_section::get_input_sections): Change type of input_sections to
10377 list of Simple_input_section pointers. Checkpoint input section list
10378 lazily. Also handle relaxed input sections.
10379 (Output_section::add_input_section_for_script): Take a reference to
10380 a Simple_input_section object instead of Relobj pointer and section
10381 index as parameter. Handle relaxed input sections.
10382 (Output_section::save_states, Output_section::restore_states): New
10383 method definitions.
10384 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10385 (Output_data::is_data_size_fixed): New method definition.
10386 (Output_data::reset_addresss_and_file_offset): Do not reset data size
10388 (Output_data::address_and_file_offset_have_reset_values): New method
10390 (Output_data::do_address_and_file_offset_have_reset_values): New method
10392 (Output_data::set_data_size): Check that data size is not fixed.
10393 (Output_data::fix_data_size): New method definition.
10394 (Output_data::is_data_size_fixed_): New data member.
10395 (Output_section_headers::set_final_data_size): New method definition.
10396 (Output_section_headers::do_size): New method declaration.
10397 (Output_segment_headers::set_final_data_size): New method definition.
10398 (Output_segment_headers::do_size): New method declaration.
10399 (Output_file_header::set_final_data_size)::New method definition.
10400 (Output_file_header::do_size)::New method declaration.
10401 (Output_section_data::Output_section_data): Add new parameter
10402 is_data_size_fixed and use it to fix data size.
10403 (Output_data_const::Output_data_const): Adjust call to base class
10404 constructor and fix data size.
10405 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10406 base class constructor and fix data size.
10407 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10408 base class constructor and fix data size.
10409 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10410 class constructor and fix data size.
10411 (Output_data_group::set_final_data_size): New method definition.
10412 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10413 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10414 class constructor and fix data size.
10415 (Output_relaxed_input_section): New class definition.
10416 (Output_section::Simple_input_section): New class definition.
10417 (Output_section::get_input_sections): Adjust parameter list.
10418 (Output_section::add_input_section_for_script): Same.
10419 (Output_section::save_states, Output_section::restore_states,
10420 Output_section::do_address_and_file_offset_have_reset_values,
10421 (Output_section::Input_section::Input_section): Handle
10422 RELAXED_INPUT_SECTION_CODE. Add new overload for
10423 Output_relaxed_input_section.
10424 (Output_section::Input_section::is_input_section,
10425 Output_section::Input_section::set_output_section): Handle relaxed
10427 (Output_section::Input_section::is_relaxed_input_section,
10428 Output_section::Input_section::output_section_data,
10429 Output_section::Input_section::relaxed_input_section): New method
10431 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10433 (Output_section::Input_section::u1_): Update comments.
10434 (Output_section::Input_section::u2_): Add new union member poris.
10435 (Output_section::Checkpoint_output_section): New classs definition.
10436 (Output_section::relax_input_section): New method declaration.
10437 (Output_section::checkpoint_): New data member.
10438 (Output_segment): Update comments.
10439 (Output_segment::Output_segment): Un-privatize copy constructor.
10440 (Output_segment::operator=): Un-privatize.
10441 * script-sections.cc (Output_section_element::Input_section_list):
10442 Change element type to Output_section::Simple_input_section.
10443 (Output_section_element_dot_assignment::set_section_addresses):
10444 Register output section data for relaxation clean up.
10445 (Output_data_exression::Output_data_expression): Adjust call to base
10446 constructor to fix data size.
10447 (Output_section_element_data::set_section_addresses): Register
10448 Output_data_expression object for relaxation clean up.
10449 (struct Input_section_info): Replace Relobj pointer and section index
10450 pair with Output_section::Simple_input_section and Convert struct to a
10452 (Input_section_sorter::operator()): Adjust access to
10453 Input_section_info data member to use accessors.
10454 (Output_section_element_input::set_section_addresses): Use layout
10455 parameter. Adjust code to use Output_section::Simple_input_section
10456 and Input_secction_info classes. Register filler for relaxation
10458 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10459 and section index pair with Output_section::Simple_input_section
10460 class. Adjust code accordingly.
10461 (Phdrs_element::release_segment): New method definition.
10462 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10464 (Script_sections::release_segments): New method definition.
10465 * gold/script-sections.h (Script_sections::release_segments): New
10466 method declaration.
10467 * gold/target.h (Target::may_relax, Target::relax,
10468 Target::do_may_relax, Target::do_relax): New method definitions.
10470 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10472 * arm.cc (has_signed_unsigned_overflow): New function.
10473 (Arm_relocate_functions::abs8): New function.
10474 (Target_arm::Scan::local): Handle R_ARM_ABS8.
10475 (Target_arm::Scan::global): Likewise.
10476 (Target_arm::relocate::relocate): Likewise.
10477 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10480 2009-09-16 Cary Coutant <ccoutant@google.com>
10482 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10483 * testsuite/Makefile.in: Regenerate.
10485 2009-09-11 Nick Clifton <nickc@redhat.com>
10487 * po/gold.pot: Updated by the Translation project.
10489 2009-09-08 Cary Coutant <ccoutant@google.com>
10491 * output.cc (Output_file::open): Add execute permission to empty file.
10492 * testsuite/Makefile.am (permission_test): New test.
10493 * testsuite/Makefile.in: Regenerate.
10495 2009-09-02 Ian Lance Taylor <iant@google.com>
10497 * output.cc (Output_file::resize): Call map_no_anonymous rather
10500 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
10502 * gold.cc: Include "incremental.h".
10503 (queue_initial_tasks): Call Incremental_checker methods.
10504 * incremental.cc: Include "output.h".
10505 (Incremental_checker::can_incrementally_link_output_file): New
10507 * incremental.h (Incremental_checker): New class.
10509 * output.cc (Output_file::open_for_modification): New method.
10510 (Output_file::map_anonymous): Changed return type to bool. Record
10511 map in base_ field.
10512 (Output_file::map_no_anonymous): New method, broken out of map.
10513 (Output_file::map): Use map_no_anonymous and map_anonymous.
10514 * output.h (class Output_file): Update declarations.
10516 2009-08-24 Cary Coutant <ccoutant@google.com>
10518 * options.h (Command_line::Pre_options): New class.
10519 (Command_line::pre_options): New member.
10520 * options.cc (gold::options::ready_to_register): New variable.
10521 (One_option::register_option): Do nothing if not registering options.
10522 Assert if same short option registered twice.
10523 (General_options::General_options): Turn off option registration when
10525 (Command_line::Pre_options::Pre_options): New constructor.
10527 2009-08-24 Cary Coutant <ccoutant@google.com>
10529 * options.h (General_options::no_keep_memory): Remove incorrect
10532 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10534 * Makefile.am (am__skiplex, am__skipyacc): New.
10535 * Makefile.in: Regenerate.
10537 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10539 * Makefile.am (AM_CPPFLAGS): Renamed from ...
10540 (INCLUDES): ... this.
10541 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10542 (AM_CPPFLAGS): Renamed from ...
10543 (INCLUDE): ... this.
10544 * Makefile.in, testsuite/Makefile.in: Regenerate.
10546 * Makefile.in: Regenerate.
10547 * aclocal.m4: Likewise.
10548 * config.in: Likewise.
10549 * configure: Likewise.
10550 * testsuite/Makefile.in: Likewise.
10552 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10553 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10554 * Makefile.in: Regenerate.
10555 * testsuite/Makefile.in: Regenerate.
10557 2009-08-19 Cary Coutant <ccoutant@google.com>
10559 * resolve.cc (Symbol_table::resolve): Don't complain about defined
10560 symbols in shared libraries overridden by hidden or internal symbols
10561 in the main program.
10563 2009-08-19 Chris Demetriou <cgd@google.com>
10565 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10566 checking source file names in error messages.
10568 2009-08-18 Doug Kwan <dougkwan@google.com>
10570 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10571 an elcpp::Ehdr as parameter. Adjust call to set_target.
10572 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10573 an elfcpp::Ehdr as parameter.
10574 * object.cc (Object::set_target): Remove the version that looks up
10575 a target and sets it.
10576 (Sized_relobj::setup): Take a Target object instead of
10577 an elfcpp::Ehdr as parameter. Adjust call to set_target.
10578 (make_elf_sized_object): Find target and ask target to
10579 make an ELF object.
10580 * object.h: (Object::set_target): Remove the version that looks up
10581 a target and sets it.
10582 (Sized_relobj::setup): Take a Target object instead of
10583 an elfcpp:Ehdr as parameter.
10584 * target.cc: Include dynobj.h.
10585 (Target::do_make_elf_object_implementation): New.
10586 (Target::do_make_elf_object): New.
10587 * target.h (Target::make_elf_object): New template declaration.
10588 (Target::do_make_elf_object): New method declarations.
10589 (Target::do_make_elf_object_implementation): New template declaration.
10591 2009-08-14 Ian Lance Taylor <iant@google.com>
10593 * gold.h (FUNCTION_NAME): Define.
10594 (gold_unreachable): Use FUNCTION_NAME.
10596 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10598 * icf.cc (Icf::find_identical_sections): Issue a warning when a
10599 symbol in the --keep-unique list is not found.
10601 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10603 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10604 been maked as --keep-unique.
10605 (Icf::unfold_section): New function.
10606 * icf.h (Icf::unfold_section): New function.
10607 * options.h (General_options::keep_unique): New option.
10608 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10609 * testsuite/Makefile.in: Regenerate.
10610 * testsuite/icf_keep_unique_test.sh: New file.
10611 * testsuite/icf_keep_unique_test.cc: New file.
10613 2009-08-12 Cary Coutant <ccoutant@google.com>
10616 * resolve.cc (Symbol_table::resolve): Check for references from
10617 dynamic objects to hidden and internal symbols.
10618 * testsuite/Makefile.am (hidden_test.sh): New test.
10619 * testsuite/Makefile.in: Regenerate.
10620 * testsuite/hidden_test.sh: New script.
10621 * testsuite/hidden_test_1.c: New test source.
10622 * testsuite/hidden_test_main.c: New test source.
10624 2009-08-11 Doug Kwan <dougkwan@google.com>
10626 * arm.cc: Update comments.
10627 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10628 segment to locate the .ARM.exidx section if present.
10630 2009-08-09 Doug Kwan <dougkwan@google.com>
10632 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10635 2009-08-07 Sriraman Tallam <tmsriram@google.com>
10636 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10639 2009-08-06 Sriraman Tallam <tmsriram@google.com>
10641 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10642 valid tls_segment only for non-debug-section relocations.
10643 * testsuite/Makefile.am: Add gc_tls_test.
10644 * testsuite/Makefile.in: Regenerate.
10645 * testsuite/gc_tls_test.cc: New file.
10646 * testsuite/gc_tls_test.sh: New file.
10648 2009-08-05 Sriraman Tallam <tmsriram@google.com>
10650 * icf.cc: New file.
10652 * Makefile.am (CCFILES): Add icf.cc.
10653 (HFILES): Add icf.h
10654 * Makefile.in: Regenerate.
10655 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10656 * gc.h (gc_process_relocs): Populate lists used by icf to contain
10657 section, symbol and addend information for the relocs.
10658 * gold.cc (queue_middle_tasks): Call identical code folding.
10659 * gold.h: Add defines for multimap.
10660 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10661 to the call of finalize_local_symbols.
10662 * main.cc (main): Create object of class Icf.
10663 * object.cc (Sized_relobj::do_layout): Allow this function to be
10664 called twice during icf.
10665 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10666 to sections marked as identical by icf.
10667 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10669 (Sized_relobj::do_section_entsize): New function.
10670 * object.h (Object::section_entsize): New function.
10671 (Object::do_section_entsize): New pure virtual function.
10672 (Relobj::finalize_local_symbols): Add new parameter.
10673 (Relobj::do_section_entsize): New function.
10674 * options.h (General_options::icf): New option.
10675 (General_options::icf_iterations): New option.
10676 (General_options::print_icf_sections): New option.
10677 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10678 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10679 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10681 * symtab.cc (Symbol_table::is_section_folded): New function.
10682 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
10683 to sections marked as identical by icf.
10684 * symtab.h (Symbol_table::set_icf): New function.
10685 (Symbol_table::icf): New function.
10686 (Symbol_table::is_section_folded): New function.
10687 (Symbol_table::icf_): New data member.
10688 * target-reloc.h (relocate_section): Ignore sections folded by icf.
10689 * testsuite/Makefile.am: Add commands to build icf_test.
10690 * testsuite/Makefile.in: Regenerate.
10691 * testsuite/icf_test.sh: New file.
10692 * testsuite/icf_test.cc: New file.
10694 2009-07-24 Chris Demetriou <cgd@google.com>
10696 * layout.cc (is_compressible_debug_section): Fix incorrect
10697 comment about compressed section names.
10699 2009-07-20 Ian Lance Taylor <ian@airs.com>
10702 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10704 2009-07-16 Ian Lance Taylor <iant@google.com>
10707 * layout.h: #include <map>.
10708 (class Kept_section): Change from struct to class. Add accessors
10709 and setters. Add section size to Comdat_group mapping. Change
10710 Comdat_group to std::map. Add is_comdat_ field. Add
10711 linkonce_size field in union.
10712 (class Layout): Update declaration of find_or_add_kept_section.
10713 Don't declare find_kept_object.
10714 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10715 parameter. Add object, shndx, is_comdat, and is_group_name
10716 parameters. Change all callers. Adjust for new Kept_section.
10717 (Layout::find_kept_object): Remove.
10718 * object.cc (Sized_relobj::include_section_group): Update use of
10719 Kept_section. Rename secnum to shndx. Only record
10720 Kept_comdat_section if sections are the same size.
10721 (Sized_relobj::include_linkonce_section): Update use of
10722 Kept_section. Only record Kept_comdat_section if sections are the
10723 same size. Set size of linkonce section.
10724 (Sized_relobj::map_to_kept_section): Update call to
10725 get_kept_comdat_section.
10726 * object.h (class Sized_relobj): Rename fields in
10727 Kept_comdat_section to drop trailing underscores; change object
10728 field to Relobj*. Change Kept_comdat_section_table to store
10729 struct rather than pointer.
10730 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10731 Add kept_object and kept_shndx parameters. Change all callers.
10732 (Sized_relobj::get_kept_comdat_section): Change return type to
10733 bool. Add kept_object and kept_shndx parameters. Change all
10735 * plugin.cc (Pluginobj::include_comdat_group): Update call to
10736 Layout::find_or_add_kept_section.
10738 2009-07-09 Ian Lance Taylor <iant@google.com>
10740 * merge.cc (Object_merge_map::initialize_input_to_output_map):
10741 Reserve space in the hash table.
10743 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
10745 * fileread.cc (File_read::get_mtime): New method.
10746 * fileread.h (Timespec): New structure.
10747 (File_read::get_mtime): New method.
10748 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10749 Renamed from timestamp_nsec.
10750 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10752 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10754 (Incremental_inputs::report_archive): Save mtime; style fix.
10755 (Incremental_inputs::report_obejct): Save mtime; style fix.
10756 (Incremental_inputs::report_script): Save mtime; style fix.
10757 (Incremental_inputs::finalize_inputs): Style fix.
10758 (Incremental_inputs::finalize): Style fix.
10759 (Incremental_inputs::create_input_section_data): Store inputs
10761 * incremental.h (Incremental_inputs::report_script): Add mtime
10763 (Incremental_inputs::Input_info::Input_info): Intialize only one
10765 (Incremental_inputs::Input_info::archive): Move to nameless
10767 (Incremental_inputs::Input_info::obejct): Move to nameless union.
10768 (Incremental_inputs::Input_info::script): Move to nameless union.
10769 (Incremental_inputs::mtime): New field.
10770 * script.cc (read_input_script): Pass file mtime to
10772 * script.h (Script_info::inputs): Style fix.
10774 2009-07-01 Ian Lance Taylor <ian@airs.com>
10776 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10779 2009-06-24 Ian Lance Taylor <iant@google.com>
10782 * layout.cc (Layout::choose_output_section): If we find an
10783 existing section, update the flags.
10784 (Layout::create_notes): New function, broken out of
10786 (Layout::finalize): Don't create note sections.
10787 (Layout::create_note): Don't crash if linker script discards
10789 (Layout::create_gold_note): Likewise.
10790 (Layout::create_build_id): Likewise. Don't set
10791 after_input_sections on the section.
10792 (Layout::create_executable_stack_info): Remove target parameter.
10794 * layout.h (class Layout): Declare create_notes. Update
10795 declaration of create_executable_stack_info.
10796 * gold.cc (queue_middle_tasks): Call create_notes.
10797 * output.cc (Output_section::update_flags_for_input_section): Move
10798 here from output.h. If SHF_ALLOC flag is newly set, mark address
10800 * output.h (Output_data::mark_address_invalid): New function.
10801 (class Output_section): Only declare, not define,
10802 update_flags_for_input_section. Remove set_flags.
10804 2009-06-24 Ian Lance Taylor <iant@google.com>
10806 * script-sections.cc (Output_section_definition::
10807 set_section_addresses): Rename shadowing local load_address to
10810 2009-06-24 Ian Lance Taylor <iant@google.com>
10813 * reloc.cc (relocate_sections): Skip empty relocation sections.
10815 2009-06-23 Ian Lance Taylor <iant@google.com>
10818 * layout.cc (Layout::create_note): Use choose_output_section
10819 rather than make_output_section.
10821 2009-06-23 Ian Lance Taylor <iant@google.com>
10824 * options.cc (General_options::parse_V): Set printed_version_.
10825 (General_options::General_options): Initialize printed_version_.
10826 * options.h (class General_options): Add printed_version_ field.
10827 * gold.cc (queue_initial_tasks): If there are no input files,
10828 don't give a fatal error if we printed the version information.
10829 (queue_middle_tasks): If using -r with a shared object, give a
10830 fatal error rather than an ordinary error.
10832 2009-06-23 Ian Lance Taylor <iant@google.com>
10835 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10836 (Layout::make_output_section): Set have_stabstr_section_ if we see
10837 a .stab*str section.
10838 (Layout::finalize): Call link_stabs_sections.
10839 (Layout::link_stabs_sections): New file.
10840 * layout.h (class Layout): Add have_stabstr_section_ field.
10841 Declare link_stabs_sections.
10843 2009-06-23 Doug Kwan <dougkwan@google.com>
10845 * Makefile.am (libgold_a_LIBADD): New.
10846 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10847 * Makefile.in: Regenerate.
10848 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10849 * configure: Regenerate.
10850 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10851 * fileread.cc: Include sys/state.h
10852 * gold.h: Declare memmem and strndup if found missing.
10853 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10855 2009-06-23 Ian Lance Taylor <iant@google.com>
10857 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10858 * configure: Rebuild.
10860 2009-06-23 Ian Lance Taylor <iant@google.com>
10863 * object.cc (Object::section_contents): Don't try to get a view if
10864 the section has length zero.
10865 (Object::handle_gnu_warning_section): If the section is empty, use
10866 the name of the section as the warning.
10868 2009-06-23 Ian Lance Taylor <iant@google.com>
10871 * stringpool.h (class Stringpool_template): Add optimize_ field.
10872 (Stringpool_template::set_optimize): New function.
10873 * stringpool.cc (Stringpool_template::Stringpool_template):
10874 Initialize optimize_ field.
10875 (Stringpool_template::set_string_offsets): Test local optimize
10876 fild rather than parameter.
10877 * layout.cc (Layout::Layout): Call set_optimize on the section
10880 2009-06-22 Ian Lance Taylor <iant@google.com>
10883 * yyscript.y: Parse TARGET.
10884 * script.cc (script_set_target): New function.
10885 * script-c.h (script_set_target): Declare.
10886 * options.cc (General_options::string_to_object_format): Rename
10887 from string_to_object_format in anonymous namespace. Change
10889 * options.h (class General_options): Declare
10890 string_to_object_format.
10892 2009-06-22 Ian Lance Taylor <iant@google.com>
10894 * script-sections.cc (Script_sections::create_segments): Don't put
10895 program headers in a PT_LOAD segment if -n or -N.
10897 2009-06-22 Ian Lance Taylor <iant@google.com>
10900 * options.h (class General_options): Add -z lazy and -z now. Sort
10901 -z options into alphabetical order.
10902 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10904 2009-06-21 Ian Lance Taylor <iant@google.com>
10906 * layout.cc (Layout::make_output_section): Call
10907 Target::new_output_section.
10908 (Layout::attach_allocated_section_to_segment): Put large section
10909 sections in a separate load segment with the large segment flag
10911 (Layout::segment_precedes): Sort large data segments after other
10913 (align_file_offset): New static function.
10914 (Layout::set_segment_offsets): Use align_file_offset.
10915 * output.h (class Output_section): Add is_small_section_ and
10916 is_large_section_ fields.
10917 (Output_section::is_small_section): New function.
10918 (Output_section::set_is_small_section): New function.
10919 (Output_section::is_large_section): New function.
10920 (Output_section::set_is_large_section): New function.
10921 (Output_section::is_large_data_section): New function.
10922 (class Output_segment): Add is_large_data_segment_ field.
10923 (Output_segment::is_large_data_segment): New function.
10924 (Output_segment::set_is_large_data_segment): New function.
10925 * output.cc (Output_section::Output_section): Initialize new
10927 (Output_segment::Output_segment): Likewise.
10928 (Output_segment::add_output_section): Add assertion that large
10929 data sections always go in large data segments. Force small data
10930 sections to the end of the list of data sections. Force small BSS
10931 sections to the start of the list of BSS sections. For large BSS
10932 sections to the end of the list of BSS sections.
10933 * symtab.h (class Symbol): Declare is_common_shndx.
10934 (Symbol::is_defined): Check Symbol::is_common_shndx.
10935 (Symbol::is_common): Likewise.
10936 (class Symbol_table): Define enum Commons_section_type. Update
10937 declarations. Add small_commons_ and large_commons_ fields.
10938 * symtab.cc (Symbol::is_common_shndx): New function.
10939 (Symbol_table::Symbol_table): Initialize new fields.
10940 (Symbol_table::add_from_object): Put small and large common
10941 symbols in the right list.
10942 (Symbol_table::sized_finalized_symbol): Check
10943 Symbol::is_common_shndx.
10944 (Symbol_table::sized_write_globals): Likewise.
10945 * common.cc (Symbol_table::do_allocate_commons): Allocate new
10946 common symbol lists. Don't call do_allocate_commons_list if the
10948 (Symbol_table::do_allocate_commons_list): Remove is_tls
10949 parameter. Add comons_section_type parameter. Change all
10950 callers. Handle small and large common symbols.
10951 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10952 Symbol::is_common_shndx.
10953 * resolve.cc (symbol_to_bits): Likewise.
10954 * target.h (Target::small_common_shndx): New function.
10955 (Target::small_common_section_flags): New function.
10956 (Target::large_common_shndx): New function.
10957 (Target::large_common_section_flags): New function.
10958 (Target::new_output_section): New function.
10959 (Target::Target_info): Add small_common_shndx, large_common_shndx,
10960 small_common_section_flags, and large_common_section_flags
10962 (Target::do_new_output_section): New virtual function.
10963 * arm.cc (Target_arm::arm_info): Initialize new fields.
10964 * i386.cc (Target_i386::i386_info): Likewise.
10965 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10967 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10968 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10969 (Target_x86_64::do_new_output_section): New function.
10970 * configure.ac: Define conditional MCMODEL_MEDIUM.
10971 * testsuite/Makefile.am (check_PROGRAMS): Add large.
10972 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10973 (large_LDFLAGS): Define.
10974 * testsuite/large.c: New file.
10975 * testsuite/testfile.cc (Target_test::test_target_info):
10976 Initialize new fields.
10977 * configure, testsuite/Makefile.in: Rebuild.
10979 2009-06-05 Doug Kwan <dougkwan@google.com>
10981 * Makefile.am (CCFILES): Add target.cc.
10982 * Makefile.in: Regenerate.
10983 * i386.cc (class Target_i386): Define new virtual method to
10984 override do_is_local_label_name in parent.
10985 * object.cc (Sized_relobj::do_count_local_symbols): Discard
10986 local symbols if --discard-locals or -X is given.
10987 * options.h (class General_options): Declare new options
10988 '--discard-locals' and '-X' for discarding locals.
10989 * target.h (class Target): Define new methods is_local_label_name.
10990 Declare new virtual method do_is_local_label_name.
10991 * target.cc: New file.
10992 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10993 (check_SCRIPTS): Add discard_locals_test.sh.
10994 (check_DATA): Add discard_local_tests.syms.
10995 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10996 (discard_local_tests.syms, discard_locals_test.o): New make rules.
10997 * testsuite/Makefile.in: Regenerate.
10998 * testsuite/discard_locals_test.c: New file.
10999 * testsuite/discard_locals_test.sh: Same.
11001 2009-06-05 Doug Kwan <dougkwan@google.com>
11003 * object.cc (Sized_relobj::Sized_relobj): Initialize
11004 discarded_eh_frame_shndx_ to -1U.
11005 (Sized_relobj::do_layout): Record index of a discard .eh_frame
11007 (Sized_relobj::do_count_local_symbols): Skip local symbols in
11008 a discarded .eh_frame section.
11009 (Sized_relobj::do_finalize_local_symbols): Ditto.
11010 * object.h (class Sized_relobj): Declare new member
11011 discarded_eh_frame_shndx_.
11012 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11013 (local_labels_test.o, local_labels_test): New rules.
11014 * testsuite/Makefile.in: Regenerate.
11016 2009-06-04 Doug Kwan <dougkwan@google.com>
11018 * layout.cc (Layout::section_name_mapping): Add mapping for
11019 special ARM sections.
11021 2009-06-03 Doug Kwan <dougkwan@google.com>
11023 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11024 (utils::has_overflow): Same.
11026 2009-06-03 Ian Lance Taylor <iant@google.com>
11028 * layout.cc (Layout::section_name_mapping): New array, replacing
11029 Layout::linkonce_mapping.
11030 (Layout::section_name_mapping_count): New variable, replacing
11031 Layout::linkonce_mapping_count.
11032 (Layout::linkonce_output_name): Remove.
11033 (Layout::output_section_name): Rewrite.
11034 * layout.h (class Layout): Rename Linkonce_mapping to
11035 Section_name_mapping, linkonce_mapping to section_name_mapping,
11036 linkonce_mapping_count to section_name_mapping_count. Don't
11037 declare linkonce_output_name.
11039 2009-06-03 Doug Kwan <dougkwan@google.com>
11041 * gold/arm.cc (namespace utils): New.
11042 (Target_arm::reloc_is_non_pic): Define new method.
11043 (class Arm_relocate_functions): New.
11044 (Target_arm::Relocate::relocate): Handle relocation types used by
11047 2009-06-03 Ian Lance Taylor <iant@google.com>
11049 * arm.cc (Target_arm::scan::global): Use || instead of |.
11051 2009-06-02 Doug Kwan <dougkwan@google.com>
11053 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
11054 issued_non_pic_error_.
11055 (class Target_arm::Scan): Declare new method check_non_pic.
11056 Define new method symbol_needs_plt_entry.
11057 Declare new data member issued_non_pic_error_.
11058 (class Target_arm::Relocate): Declare new method
11059 should_apply_static_reloc.
11060 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11061 (Target_arm::Scan::check_non_pic): Define new method.
11062 (Target_arm::Scan::local): Handle a small subset of reloc types used
11064 (Target_arm::Scan::local): Same.
11065 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11067 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
11069 * incremental.cc (Incremental_inputs::report_command_line): Filter
11070 out --incremental-* options.
11072 2009-05-29 Doug Kwan <dougkwan@google.com>
11074 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11076 (class Target_arm): Update comment.
11077 (Target_arm::Target_arm): Initialize new data members GOT_,
11078 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11079 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11080 and Target_arm::rel_dyn_section.
11081 Declare new_enum Target_arm::Got_type.
11082 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11084 Update commments for member do_dynsym_value.
11085 (Target_arm::got_size, Target_arm::plt_section,
11086 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11087 new methods inside class defintion.
11088 (Target_arm::got_section): Define new method.
11089 (Target_arm::rel_dyn_section): Same.
11090 (Output_data_plt_arm): New template class.
11091 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11092 (Output_data_plt_arm:do_adjust_output_section): Define new method.
11093 (Output_data_plt_arm::add_entry): Same.
11094 (Output_data_plt_arm::first_plt_entry): Define new
11095 static data member for PLT instruction template.
11096 (Output_data_plt_arm::plt_entry): Same.
11097 (Output_data_plt_arm::do_write): Define new method.
11098 (Target_arm::make_plt_entry): Same.
11099 (Target_arm::do_finalize_sections): Same.
11100 (Target_arm::do_dynsym_value): Same.
11102 2009-05-28 Doug Kwan <dougkwan@google.com>
11104 * Makefile.am (TARGETSOURCES): Add arm.cc.
11105 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11106 * Makefile.in: Regenerate.
11107 * arm.cc: New file.
11108 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11110 2009-05-26 Doug Kwan <dougkwan@google.com>
11112 * options.cc (General_options::parse_exclude_libs). Fix a comment.
11113 (General_options::check_excluded_libs): Strip off directories in
11114 archive name before matching like GNU ld does.
11115 * testsuite/Makefile.am (MOSTLYCLEANFILES,
11116 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11117 (exclude_libs_test_LDFLAGS): Add linker option
11118 -Wl,--exclude-libs,libexclude_libs_test_3
11119 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11120 an explicit archive without using -l.
11121 (alt/libexclude_libs_test_3.a): New make rule.
11122 * testsuite/Makefile.in: Regenerate.
11123 * testsuite/exclude_libs_test.c : Declare lib3_default().
11125 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11126 * exclude_libs_test_3.c: New file.
11128 2009-05-26 Nick Clifton <nickc@redhat.com>
11130 * po/id.po: New Indonesian translation.
11131 * po/gold.pot: Updated template file.
11133 2009-05-22 Sriraman Tallam <tmsriram@google.com>
11135 * testsuite/Makefile.am: Add -ffunction-sections to compile
11136 gc_comdat_test files. Add -Wl,--gc-sections to build
11138 * testsuite/Makefile.in: Regenerate.
11139 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11141 2009-05-21 Sriraman Tallam <tmsriram@google.com>
11143 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11144 kept comdat section was garbage collected.
11145 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11146 * testsuite/Makefile.in: Regenerate.
11147 * testsuite/gc_comdat_test.sh: New file.
11148 * testsuite/gc_comdat_test_1.cc: New file.
11149 * testsuite/gc_comdat_test_2.cc: New file.
11151 2009-05-19 Doug Kwan <dougkwan@google.com>
11153 * archive.cc (Archive::Archive): Move constructor from archive.h
11154 to here. Initialize no_export_.
11155 (Archive::get_elf_object_for_member): Set no_export flag of object.
11156 * archive.h (Archive::Archive): Move constructor body to
11158 (Archive::no_export): New method.
11159 (Archive::no_export_): New field.
11160 * object.h (Object::Object): Initialize no_export_ to false.
11161 (Object::no_export, Object::set_no_export): New methods.
11162 (Object::no_export_): New field.
11163 * options.cc (General_options::parse_exclude_libs): New method.
11164 (General_options::check_excluded_libs) Same.
11165 * options.h (exclude_libs): New option.
11166 (General_options::check_excluded_libs): New method declaration.
11167 (General_options::excluded_libs_): New field.
11168 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11169 default or protected visibility if an object has no-export flag set.
11170 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11171 (check_SCRIPTS): Add exclude_libs_test.sh.
11172 (check_DATA): Add exclude_libs_test.syms.
11173 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11174 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11175 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11176 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11177 (exclude_libs_test.syms, libexclude_libs_test_1.a,
11178 libexclude_libs_test_2.a): New rules.
11179 * testsuite/Makefile.in: Regenerate.
11180 * testsuite/exclude_libs_test.c: New file.
11181 * testsuite/exclude_libs_test.sh: Ditto.
11182 * testsuite/exclude_libs_test_1.c: Ditto.
11183 * testsuite/exclude_libs_test_2.c: Ditto.
11185 2009-05-15 Ian Lance Taylor <iant@google.com>
11187 * configure.ac: Check for declarations for cases where libiberty.h
11188 checks HAVE_DECL_xxx.
11189 * configure, config.in: Rebuild.
11191 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
11193 * gold.h (Incremental_argument_list): Remove (invalid) forward
11195 * incremental.cc (Incremental_inputs::report_achive): New method.
11196 (Incremental_inputs::report_object): New method.
11197 (Incremental_inputs::report_script): New method.
11198 (Incremental_inputs::finalize_inputs): New method.
11199 (Incremental_inputs::finalize): Call finalize_inputs().
11200 (Incremental_inputs::sized_create_incremental_inputs_section_data):
11201 Create inputs entries.
11202 * incremental.h (Incremental_input_type): New enum.
11203 (Incremental_inputs::Incremental_input): Initialize new fields.
11204 (Incremental_inputs::report_inputs): New method.
11205 (Incremental_inputs::report_achive): New method.
11206 (Incremental_inputs::report_object): New method.
11207 (Incremental_inputs::report_script): New method.
11208 (Incremental_inputs::finalize_inputs): New method.
11209 (Incremental_inputs::Input_info): New struct.
11210 (Incremental_inputs::Input_info_map): New typedef.
11211 (Incremental_inputs::lock_): New field.
11212 (Incremental_inputs::Inputs_): New field.
11213 (Incremental_inputs::Inputs_map): New field.
11214 * main.cc (main): Call Incremental_input::report_inputs.
11215 * options.h (Input_argument_list): Typedef moved from
11217 (Input_file_group::Files): Remove, use ::Input_argument_list.
11218 (Input_file_group::Input_argument_list): Remove, use
11219 ::Input_argument_list.
11220 * plugin.cc (Plugin_manager::add_input_file): Add error in
11222 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11224 * script.cc (read_input_script): Call
11225 Incremental_input::report_script.
11226 * script.h (Script_info): New class.
11228 2009-04-27 Ian Lance Taylor <iant@google.com>
11230 * x86_64.cc (do_adjust_output_section): Set entsize to
11233 2009-04-23 Elliott Hughes <enh@google.com>
11235 * output.cc (Output_file::close): After short writes, continue
11236 writing from the correct offset in the buffer being written.
11238 2009-04-23 Chris Demetriou <cgd@google.com>
11240 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11241 * configure: Regenerate.
11242 * config.in: Regenerate.
11243 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11244 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11246 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
11248 * incremental.cc (Incremental_inputs_header_data): Renamed from
11249 Incremental_input_header_data.
11250 (Incremental_inputs_header_data::data_size): New field.
11251 (Incremental_inputs_header_data::put_input_file_count): Renamed
11252 from input_file_count.
11253 (Incremental_inputs_header_data::put_command_line_offset): Renamed
11254 from command_line_offset.
11255 (Incremental_inputs_header_data::put_reserved): Renamed from
11257 (Incremental_inputs_entry_data): Renamed from
11258 Incremental_input_entry_data.
11259 (Incremental_inputs_entry_data::data_size): New field.
11260 (Incremental_inputs::report_command_line): New method.
11261 (Incremental_inputs::finalize): New method.
11262 (Incremental_inputs::create_incremental_inputs_data): New method.
11263 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11264 * incremental.h: New file.
11265 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11266 (Layout::finalize): Create incremental inputs section in
11267 incremental builds.
11268 (Layout::create_incremental_info_sections): New method.
11269 * layout.h (Layout::incremental_inputs): New method.
11270 (Layout::create_incremental_info_sections): New method.
11271 (Layout::incremental_inputs_): New field.
11272 * main.cc (main): Notify Incremental_input of the command line.
11274 2009-04-01 Ian Lance Taylor <iant@google.com>
11275 Mikolaj Zalewski <mikolajz@google.com>
11277 * gold.h (reserve_unordered_map): Define, three versions, one for
11278 each version of Unordered_map.
11279 * layout.cc (Layout::Layout): Remove options parameter. Add
11280 number_of_input_files parameter. Don't initialize options_.
11281 Initialize number_of_input_files_ and resized_signatures_. Move
11282 sections_are_attached_.
11283 (Layout::layout_group): Reserve space for group_signatures_.
11284 (Layout::find_or_add_kept_section): Change name parameter to be a
11285 reference. Resize signatures_ map when it gets large enough.
11286 (Layout::layout_eh_frame): Use parameters->options() instead of
11288 (Layout::make_output_section): Likewise.
11289 (Layout::attach_allocated_section_to_segment): Likewise.
11290 (Layout::finalize, Layout::create_executable_stack): Likewise.
11291 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11292 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11293 * layout.h (class Layout): Update declarations. Remove options_
11294 field. Add number_of_input_files_ and resized_signatures_
11295 fields. Move sections_are_attached_ field.
11296 * main.cc (main): Pass number of input files to Layout
11297 constructor. Don't pass options.
11299 2009-03-30 Ian Lance Taylor <iant@google.com>
11301 * ffsll.c (ffsll): Correct implementation.
11303 2009-03-27 Ian Lance Taylor <iant@google.com>
11305 * ffsll.c: New file.
11306 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11307 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11308 * ftruncate.c (ftruncate): Declare before definition.
11309 * mremap.c (mremap): Likewise.
11310 * pread.c (pread): Likewise.
11311 * configure, Makefile.in, config.in: Rebuild.
11313 * mremap.c: New file.
11314 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11315 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11316 (mremap): Declare if HAVE_MREMAP is not defined.
11317 * configure, Makefile.in, config.in: Rebuild.
11319 2009-03-27 Cary Coutant <ccoutant@google.com>
11321 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11322 position independent.
11323 * sparc.cc (Target_sparc::check_non_pic): Likewise.
11324 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11326 2009-03-24 Cary Coutant <ccoutant@google.com>
11328 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11330 (needs_dynamic_reloc): Likewise.
11332 2009-03-24 Ian Lance Taylor <iant@google.com>
11334 * yyscript.y (file_cmd): Recognize EXTERN.
11335 (extern_name_list, extern_name_list_body): New nonterminals.
11336 * script.cc (script_add_extern): Define.
11337 * script-c.h (script_add_extern): Declare.
11339 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
11341 * object.cc (is_elf_object): Define.
11342 * object.h (is_elf_object): Declare.
11343 * archive.cc (Archive::get_elf_object_for_member): Call
11345 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11347 2009-03-24 Elliott Hughes <enh@google.com>
11349 * output.cc (Output_file::map_anonymous): Define.
11350 (Output_file::map): Use map_anonymous. If the regular mmap fails,
11351 try an anonymous one. Report the size if the mmap fails.
11352 * output.h (class Output_file): Declare map_anonymous.
11354 2009-03-24 Ian Lance Taylor <iant@google.com>
11356 * target-select.cc (instantiate_target): Don't acquire the lock if
11357 the instantiated_target_ field has already been set.
11359 2009-03-23 Ian Lance Taylor <iant@google.com>
11361 * gold-threads.h (class Initialize_lock): Define.
11362 * gold-threads.cc (class Initialize_lock_once): Define.
11363 (initialize_lock_control): New static variable.
11364 (initialize_lock_pointer): New static variable.
11365 (initialize_lock_once): New static function.
11366 (Initialize_lock::Initialize_lock): Define.
11367 (Initialize_lock::initialize): Define.
11368 * target-select.h: Include "gold-threads.h".
11369 (class Target_selector): Add lock_ and initialize_lock_ fields.
11370 Don't define instantiate_target, just declare it.
11371 * target-select.cc (Target_selector::Target_selector): Initialize
11373 (Target_selector::instantiate_target): Define.
11374 * descriptors.h: Include "gold-threads.h".
11375 (class Descriptors): Add initialize_lock_ field.
11376 * descriptors.cc (Descriptors::Descriptors): Initialize new
11378 (Descriptors::open): Use initialize_lock_ field
11379 * errors.h (class Errors): Add initialize_lock_ field.
11380 * errors.cc (Errors::Errors): Initialize new field.
11381 (Errors::initialize_lock): Use initialize_lock_ field.
11382 * powerpc.cc (class Target_selector_powerpc): Remove
11383 instantiated_target_ field. In do_recognize call
11384 instantiate_target rather than do_instantiate_target. In
11385 do_instantiate_target just allocate a new target.
11386 * sparc.cc (class Target_selector_sparc): Likewise.
11388 * freebsd.h: New file.
11389 * i386.cc: Include "freebsd.h".
11390 (Target_i386): Derive from Target_freebsd rather than
11392 (Target_selector_i386): Derive from Target_selector_freebsd rather
11393 than Target_selector.
11394 * x86_64.cc: Include "freebsd.h".
11395 (Target_x86_64): Derive from Target_freebsd rather than
11397 (Target_selector_x86_64): Derive from Target_selector_freebsd
11398 rather than Target_selector.
11399 * target.h (class Target): Add adjust_elf_header and
11400 do_adjust_elf_header.
11401 * output.cc (Output_file_header:: do_sized_write): Call target
11402 adjust_elf_header routine.
11403 * configure.tgt: Set targ_osabi.
11404 * configure.ac: Define GOLD_DEFAULT_OSABI.
11405 * parameters.cc (Parameters::default_target): Pass
11406 GOLD_DEFAULT_OSABI to select_target.
11407 * target-select.h (class Target_selector): Make instantiate_target
11408 protected rather than private.
11409 * Makefile.am (HFILES): Add freebsd.h.
11410 * configure, Makefile.in, config.in: Rebuild.
11412 * merge.cc (do_add_input_section): Correct pend value. Change
11413 message about last entry not being null terminated from error to
11416 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
11418 * incremental.cc: New file.
11419 * Makefile.am (CCFILES): Add incremental.cc.
11420 * Makefile.in: Rebuild.
11422 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
11424 * layout.cc (Layout::output_section_name): Preserve names
11425 of '.note.' sections.
11427 2009-03-19 Ian Lance Taylor <iant@google.com>
11429 * descriptors.cc (Descriptors::open): Check that the options are
11430 valid before using them.
11432 2009-03-18 Ian Lance Taylor <iant@google.com>
11434 * script-sections.h: Include <list>.
11435 (class Script_sections): Change Sections_elements from std::vector
11436 to std::list. Typedef public Elements_iterator. Add
11437 orphan_section_placement_, data_segment_align_start_, and
11438 saw_data_segment_align_ fields. Remove data_segment_align_index_
11440 * script-sections.cc (class Orphan_section_placement): New class.
11441 (class Sections_element): Add virtual functions is_relro and
11442 orphan_section_init. Remove virtual function place_orphan_here.
11443 (class Output_section_definition): Add is_relro and
11444 orphan_section_init. Remove place_orphan_here.
11445 (class Orphan_output_section): Likewise.
11446 (Script_sections::Script_sections): Update for field changes.
11447 (Script_sections::data_segment_align): Set saw_data_segment_align_
11448 and data_segment_align_start_, not data_segment_align_index.
11449 (Script_sections::data_segment_relro_end): Check
11450 saw_data_segment_align_. Use data_segment_align_start_ rather
11451 than data_segment_align_index_.
11452 (Script_sections::place_orphan): Rewrite to use
11453 Orphan_section_placement.
11455 2009-03-17 Ian Lance Taylor <iant@google.com>
11457 * archive.cc (Archive::add_symbols): Check for a version attached
11458 to the symbol name in the archive map.
11459 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11460 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11461 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11462 (ver_test_11.a): New target.
11463 * testsuite/Makefile.in: Rebuild.
11465 * configure.ac: Check for chsize and posix_fallocate. Replace
11467 * ftruncate.c: New file, from gnulib.
11468 * output.cc (posix_fallocate): Define dummy version if not
11469 HAVE_POSIX_FALLOCATE.
11470 (Output_file::map): Call posix_fallocate rather than lseek and
11472 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11473 * configure, Makefile.in, config.in: Rebuild.
11475 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
11477 * layout.h (Layout::create_note): Add section_name parameter.
11478 * layout.cc (Layout::create_note): Likewise.
11479 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11481 2009-03-17 Ian Lance Taylor <iant@google.com>
11483 * descriptors.cc: Include "options.h".
11484 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11485 (Descriptors::open): Always use O_CLOEXEC when opening a new
11486 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
11487 then set FD_CLOEXEC.
11489 * sparc.cc (class Target_sparc): Add has_got_section.
11490 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11491 make sure we have a GOT section.
11493 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11494 (Target_sparc::Scan::local): Likewise.
11495 (Target_sparc::Scan::global): Likewise.
11496 (Target_sparc::Relocate::relocate): Likewise.
11497 (Target_sparc::Relocate::relocate_tls): Likewise.
11499 * symtab.cc (Symbol_table::define_default_version): New function,
11500 broken out of add_from_object.
11501 (Symbol_table::add_from_object): Call define_default_version.
11502 (Symbol_table::define_special_symbol): Add resolve_oldsym
11503 parameter. Change all callers. If the version for a symbol comes
11504 from a version script, resolve it with the symbol with the same
11505 name with no version. Also add the symbol without a version if
11507 (do_define_in_output_data): If resolving with oldsym, don't delete
11509 (do_define_in_output_segment): Likewise.
11510 (do_define_as_constant): Likewise.
11511 * symtab.h (class Symbol_table): Update declarations.
11513 2009-03-13 Ian Lance Taylor <iant@google.com>
11515 * readsyms.cc (Read_symbols::incompatible_warning): New function.
11516 (Read_symbols::requeue): New function.
11517 (Read_symbols::do_read_symbols): If make_elf_object fails because
11518 the target type is not configured, and the file was searched for,
11519 issue a warning and retry with the next directory.
11520 (Add_symbols::run): If the file has an incompatible format, and
11521 it was searched for, requeue the Read_symbols task. On error,
11522 release the object.
11523 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
11524 dirindex parameter to constructor. Change all callers. Declare
11525 incompatible_warning and requeue.
11526 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11527 input_argument_ and input_group_ fields. Add them to
11528 constructor. Change all callers.
11529 (class Read_script): Add dirindex_ field. Add it to constructor.
11530 Change all callers.
11531 * archive.cc (Archive::setup): Remove input_objects parameter.
11532 Change all callers.
11533 (Archive::get_file_and_offset): Likewise.
11534 (Archive::read_all_symbols): Likewise.
11535 (Archive::read_symbols): Likewise.
11536 (Archive::get_elf_object_for_member): Remove input_objects
11537 parameter. Add punconfigured parameter. Change all callers.
11538 (Archive::add_symbols): Change return type to bool. Check return
11539 value of include_member.
11540 (Archive::include_all_members): Likewise.
11541 (Archive::include_member): Change return type to bool. Return
11542 false if first included object has incompatible target. Set
11543 included_member_ field.
11544 (Add_archive_symbols::run): If add_symbols returns false, requeue
11546 * archive.h (class Archive): Add included_member_ field.
11547 Initialize it in constructor. Add input_file and searched_for
11548 methods. Update declarations.
11549 (class Add_archive_symbols): Add dirpath_, dirindex_, and
11550 input_argument_ fields. Add them to constructor. Change all
11552 * script.cc: Include "target-select.h".
11553 (class Parser_closure): Add skip_on_incompatible_target_ and
11554 found_incompatible_target_ fields. Add
11555 skip_on_incompatible_target parameter to constructor. Change all
11556 callers. Add methods skip_on_incompatible_target,
11557 clear_skip_on_incompatible_target, found_incompatible_target, and
11558 set_found_incompatible_target.
11559 (read_input_script): Add dirindex parameter. Change all callers.
11560 If parser finds an incompatible target, requeue Read_symbols
11562 (script_set_symbol): Clear skip_on_incompatible_target in
11564 (script_add_assertion, script_parse_option): Likewise.
11565 (script_start_sections, script_add_phdr): Likewise.
11566 (script_check_output_format): New function.
11567 * script.h (read_input_script): Update declaration.
11568 * script-c.h (script_check_output_format): Declare.
11569 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11570 (ignore_cmd): Remove OUTPUT_FORMAT.
11571 * fileread.cc (Input_file::Input_file): Add explicit this.
11572 (Input_file::will_search_for): New function.
11573 (Input_file::open): Add pindex parameter. Change all callers.
11574 * fileread.h (class Input_file): Add input_file_argument method.
11575 Declare will_search_for. Update declarations.
11576 * object.cc (make_elf_object): Add punconfigured parameter.
11577 Change all callers.
11578 * object.h (class Object): Make input_file public. Add
11579 searched_for method.
11580 (make_elf_object): Update declaration.
11581 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
11583 * dirsearch.h (class Dirsearch): Update declaration.
11584 * options.h (class General_options): Add --warn-search-mismatch.
11585 * parameters.cc (Parameters::is_compatible_target): New function.
11586 * parameters.h (class Parameters): Declare is_compatible_target.
11587 * workqueue.cc (Workqueue::add_blocker): New function.
11588 * workqueue.h (class Workqueue): Declare add_blocker.
11590 * fileread.cc (Input_file::open): Remove options parameter.
11591 Change all callers.
11592 (Input_file::open_binary): Likewise.
11593 * script.cc (read_input_script): Likewise.
11594 * readsyms.h (class Read_symbols): Remove options_ field. Remove
11595 options parameter from constructor. Change all callers.
11596 (class Read_script): Likewise.
11597 * fileread.h (class Input_file): Update declarations.
11598 * script.h (read_input_script): Update declaration.
11600 2009-03-10 Nick Clifton <nickc@redhat.com>
11602 * po/es.po: New Spanish translation.
11604 2009-03-06 Cary Coutant <ccoutant@google.com>
11606 * options.cc (parse_short_option): Keep dash_z from registering itself.
11608 2009-03-03 Ian Lance Taylor <iant@google.com>
11611 * target-reloc.h (relocate_section): Pass output_section to
11613 * i386.cc (Target_i386::should_apply_static_reloc): Add
11614 output_section parameter. Change all callers.
11615 (Target_i386::Relocate::relocate): Add output_section parameter.
11616 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11617 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11618 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11619 * testsuite/two_file_shared.sh: New script.
11620 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11621 (check_DATA): Add two_file_shared.dbg.
11622 (two_file_shared.dbg): New target.
11623 * testsuite/Makefile.in: Rebuild.
11625 2009-03-01 Ian Lance Taylor <iant@google.com>
11627 * configure.ac: Check for byteswap.h.
11628 * configure: Rebuild.
11629 * config.in: Rebuild.
11631 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
11633 * layout.cc (Layout::find_or_add_kept_section): New function.
11634 (Layout::add_comdat): Removed.
11635 * layout.h (struct Kept_section): Move out of class Layout.
11636 Remove trailing underscores from field names. Add group_sections
11637 field. Rename group_ field to is_group. Change all uses.
11638 (class Layout): Declare find_or_add_kept_section, not add_comdat.
11639 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11640 comdat_groups_ field.
11641 (Sized_relobj::include_section_group): Use
11642 find_or_add_kept_section and Kept_section::group_sections.
11643 (Sized_relobj::include_linkonce_section): Likewise.
11644 * object.cc (class Sized_relobj): Don't define Comdat_group or
11645 Comdat_group_table. Remove find_comdat_group and
11646 add_comdat_group. Remove comdat_groups_ field.
11647 * plugin.cc (include_comdat_group): Use
11648 Layout::find_or_add_kept_section.
11650 2009-02-28 Ian Lance Taylor <iant@google.com>
11652 * README: --gc-sections and map files are now supported. Document
11653 some build requirements.
11656 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11657 relocatable link set the value of the section symbol to zero.
11658 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11659 relocatable link don't include the section address in the local
11662 2009-02-27 Ian Lance Taylor <iant@google.com>
11665 * options.h (class Search_directory): Add is_system_directory.
11666 (class General_options): Declare is_in_system_directory.
11667 * options.cc (get_relative_sysroot): Make static.
11668 (get_default_sysroot): Make static.
11669 (General_optoins::is_in_system_directory): New function.
11670 * fileread.cc (Input_file::is_in_system_directory): New function.
11671 * fileread.h (class Input_file): Declare is_in_system_directory.
11672 * object.h (class Object): Add is_in_system_directory.
11673 (class Input_objects): Remove system_library_directory_ field.
11674 * object.cc (Input_objects::add_object): Don't set
11675 system_library_directory_.
11676 (input_objects::found_in_system_library_directory): Remove.
11677 * symtab.cc (Symbol_table::write_globals): Remove input_objects
11678 parameter. Change all callers.
11679 (Symbol_table::sized_write_globals): Likewise.
11680 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11681 Call Object::is_in_system_directory.
11682 * symtab.h (class Symbol_table): Update declarations.
11685 * descriptors.h (Open_descriptor): Add is_on_stack field.
11686 * descriptors.cc (Descriptors::open): If the descriptor is on the
11687 top of the stack, remove it. Initialize is_on_stack field.
11688 (Descriptors::release): Only add pod to stack if it is not on the
11690 (Descriptors::close_some_descriptor): Clear stack_next and
11691 is_on_stack fields.
11694 * output.cc (Output_section::find_starting_output_address): Rename
11695 from starting_output_address; add PADDR parameter; change return
11697 * output.h (class Output_section): Declare
11698 find_starting_output_address instead of starting_output_address.
11699 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11700 section symbol for which we can't find a merge section.
11703 * symtab.cc (Symbol_table::add_from_object): If the visibility is
11704 hidden or internal, force the symbol to be local.
11705 * resolve.cc (Symbol::override_visibility): Define.
11706 (Symbol::override_base): Use override_visibility.
11707 (Symbol_table::resolve): Likewise.
11708 (Symbol::override_base_with_special): Likewise.
11709 (Symbol_table::override_with_special): If the visibility is hidden
11710 or internal, force the symbol to be local.
11711 * symtab.h (class Symbol): Add set_visibility and
11712 override_visibility.
11713 * testsuite/ver_test_1.sh: New file.
11714 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11715 (check_DATA): Add ver_test_1.syms.
11716 (ver_test_1.syms): New target.
11717 * testsuite/Makefile.in: Rebuild.
11719 2009-02-25 Cary Coutant <ccoutant@google.com>
11721 * layout.cc (Layout::choose_output_section): Don't rename sections
11722 when using a linker script that has a SECTIONS clause.
11723 * Makefile.in: Regenerate.
11725 * testsuite/Makefile.am (script_test_5.sh): New test case.
11726 * testsuite/Makefile.in: Regenerate.
11727 * testsuite/script_test_5.cc: New file.
11728 * testsuite/script_test_5.sh: New file.
11729 * testsuite/script_test_5.t: New file.
11731 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
11733 * archive.cc (Archive::include_member): Update calls to add_symbols.
11734 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11735 the Layout argument.
11736 * dynobj.h (do_add_symbols): Add the Layout argument.
11737 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11739 * object.h (Object::add_symbols): Add the Layout argument.
11740 (Object::do_add_symbols): Add the Layout argument.
11741 (Sized_relobj::do_add_symbols): Add the Layout argument.
11742 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11743 Unify the two versions.
11744 (Add_plugin_symbols): Remove.
11745 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11746 (Sized_pluginobj::do_add_symbols): Unify the two versions.
11747 (Add_plugin_symbols): Remove.
11748 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11749 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11750 (Add_symbols::run): Make it work with Pulginobj.
11752 2009-02-06 Ian Lance Taylor <iant@google.com>
11754 * object.cc (Sized_relobj::do_layout): Make info message start
11755 with lower case letter.
11757 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
11759 * binary.cc: Fix file comment.
11761 * options.h (enum Incremental_disposition): Define.
11762 (class General_options): Add new options: --incremental,
11763 --incremental_changed, --incremental_unchanged,
11764 --incremental_unknown. Add incremental_disposition_ and
11765 implicit_incremental_ fields.
11766 (General_options::incremental_disposition): New function.
11767 (class Position_dependent_options): Add incremental_disposition
11769 (Position_dependent_options::copy_from_options): Set incremental
11771 * options.cc (General_options::parse_incremental_changed): New
11773 (General_options::parse_incremental_unchanged): New function.
11774 (General_options::parse_incremental_unknown): New function.
11775 (General_options::General_options): Initialize new fields
11776 incremental_disposition_ and implicit_incremental_.
11777 (General_options::finalize): Check for uasge of --incremental-*
11778 without --incremental.
11780 2009-02-06 Chris Demetriou <cgd@google.com>
11782 * gold.h (gold_undefined_symbol): Change to take only a Symbol
11783 pointer and to report location as the file name associated with
11785 (gold_undefined_symbol_at_location): New function to replace the
11786 old gold_undefined_symbol functionality.
11787 * target-reloc.h (relocate_section): Update to use
11788 gold_undefined_symbol_at_location.
11789 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11790 Call gold_undefined_symbol function rather than gold_error.
11791 * errors.h (Errors::undefined_symbol): Take location as a
11792 string, rather than calculating it from a relocation.
11793 * errors.cc (Errors::fatal): Print "fatal error:" before the
11795 (Errors::error, Errors::error_at_location): Print "error: "
11796 before the formatted message.
11797 (Errors::undefined_symbol): Take location as a string, rather
11798 than calculating it from a relocation.
11799 (gold_undefined_symbol_at_location): New function akin to
11800 old gold_undefined_symbol, calculates location from relocation.
11801 (gold_undefined_symbol): Change to take only a Symbol pointer
11802 and to report location as the file name associated with the symbol.
11803 * testsuite/debug_msg.sh: Update for changed error messages.
11804 * testsuite/undef_symbol.sh: Likewise.
11806 2009-02-04 Duncan Sands <baldrick@free.fr>
11809 * reduced_debug_output.h
11810 (Output_reduced_debug_abbrev_section::failed): Use format for
11812 (Output_reduced_debug_info_section::faild): Likewise.
11814 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
11816 * script.cc (Lazy_demangler): New class.
11817 (Version_script_info::get_symbol_version_helper): Demangle a
11820 2009-01-29 Cary Coutant <ccoutant@google.com>
11822 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11824 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11826 2009-01-28 Ian Lance Taylor <iant@google.com>
11828 * version.cc (version_string): Bump to 1.9.
11830 * gold.h: Include <cstring> and <stdint.h>.
11831 * version.cc: Include <cstdio>.
11832 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11834 * reduced_debug_output.cc (insert_into_vector): Rename from
11835 Insert_into_vector; change all callers. Use Swap_unaligned to
11836 avoid aliasing issue; remove union since it is unnecessary.
11838 2009-01-27 Sriraman Tallam <tmsriram@google.com>
11840 * Makefile.am (CCFILES): Add gc.cc.
11841 (HFILES): Add gc.h.
11842 * Makefile.in: Regenerate.
11843 * gold.cc (Gc_runner): New class.
11844 (queue_initial_tasks): Call garbage collection related tasks
11845 when corresponding options are invoked.
11846 (queue_middle_gc_tasks): New function.
11847 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11848 processed early before laying out sections during garbage collection.
11849 * gold.h (queue_middle_gc_tasks): New function.
11850 (is_prefix_of): Move from "layout.cc".
11851 * i386.cc (Target_i386::gc_process_relocs): New function.
11852 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11853 * main.cc (main): Create object of class "Garbage_collection".
11854 * object.cc (Relobj::copy_symbols_data): New function.
11855 (Relobj::is_section_name_included): New function.
11856 (Sized_relobj::do_layout): Allow this function to be called twice
11857 during garbage collection and defer layout of section during the
11859 * object.h (Relobj::get_symbols_data): New function.
11860 (Relobj::is_section_name_included): New function.
11861 (Relobj::copy_symbols_data): New function.
11862 (Relobj::set_symbols_data): New function.
11863 (Relobj::get_relocs_data): New function.
11864 (Relobj::set_relocs_data): New function.
11865 (Relobj::is_output_section_offset_invalid): New pure virtual function.
11866 (Relobj::gc_process_relocs): New function.
11867 (Relobj::do_gc_process_relocs): New pure virtual function.
11868 (Relobj::sd_): New data member.
11869 (Sized_relobj::is_output_section_offset_invalid): New function.
11870 (Sized_relobj::do_gc_process_relocs): New function.
11871 * options.h (General_options::gc_sections): Modify to not be a no-op.
11872 (General_options::print_gc_sections): New option.
11873 * plugin.cc (Plugin_finish::run): Remove function call to
11874 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
11875 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11876 * reloc.cc (Read_relocs::run): Add task to process relocs and
11877 determine unreferenced sections when doing garbage collection.
11878 (Gc_process_relocs): New class.
11879 (Sized_relobj::do_gc_process_relocs): New function.
11880 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11881 sections that are garbage collected.
11882 * reloc.h (Gc_process_relocs): New class.
11883 * sparc.cc (Target_sparc::gc_process_relocs): New function.
11884 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11885 symbols whose corresponding sections are garbage collected.
11886 (Symbol_table::Symbol_table): Add new parameter for the garbage
11888 (Symbol_table::gc_mark_undef_symbols): New function.
11889 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11890 (Symbol_table::gc_mark_dyn_syms): New function.
11891 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11893 (Symbol_table::add_from_object): Likewise.
11894 (Symbol_table::add_from_relobj): When building shared objects, do not
11895 treat externally visible symbols as garbage.
11896 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11897 table information for static and relocatable links.
11898 * symtab.h (Symbol_table::set_gc): New function.
11899 (Symbol_table::gc): New function.
11900 (Symbol_table::gc_mark_undef_symbols): New function.
11901 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11902 (Symbol_table::gc_mark_dyn_syms): New function.
11903 (Symbol_table::gc_): New data member.
11904 * target.h (Sized_target::gc_process_relocs): New pure virtual
11906 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11907 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11909 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
11911 * options.h (General_options::gc_sections): Define as a no-op for now.
11912 (General_options::no_keep_memory): Ditto.
11913 (General_options::Bshareable): Define.
11914 * options.cc (General_options::finalize): Honor -Bshareable.
11916 2009-01-20 Andreas Schwab <schwab@suse.de>
11918 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11919 read the value in the contents, since we don't use it. Use the
11920 template endianness when writing.
11921 (Relocate::relocate): Use it for R_PPC_REL16_HA.
11923 2009-01-19 Andreas Schwab <schwab@suse.de>
11925 * configure.tgt (powerpc64-*): Fix targ_obj.
11927 2009-01-15 Ian Lance Taylor <iant@google.com>
11929 * object.cc (Sized_relobj::write_local_symbols): Don't write out
11930 local symbols when stripping all symbols.
11932 2009-01-14 Cary Coutant <ccoutant@google.com>
11934 * output.cc (Output_reloc): Add explicit instantiations.
11936 2009-01-14 Cary Coutant <ccoutant@google.com>
11938 * archive.cc (Archive::get_elf_object_for_member): Remove call
11939 to File_read::claim_for_plugin.
11940 * descriptors.cc (Descriptors::open): Remove reference to
11942 (Descriptors::claim_for_plugin): Remove.
11943 * descriptors.h (Descriptors::claim_for_plugin): Remove.
11944 (Descriptors::is_claimed): Remove.
11945 (claim_descriptor_for_plugin): Remove.
11946 * fileread.cc (File_read::claim_for_plugin): Remove.
11947 * fileread.h (File_read::claim_for_plugin): Remove.
11948 (File_read::descriptor): Reopen descriptor if necessary.
11949 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
11950 (Plugin_manager::all_symbols_read): Add task parameter. Change
11952 (Plugin_manager::get_input_file): New function.
11953 (Plugin_manager::release_input_file): New function.
11954 (Pluginobj::Pluginobj): Add filesize parameter and initialize
11955 corresponding data member.
11956 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11957 and pass to base constructor. Change all callers.
11958 (get_input_file, release_input_file): New functions.
11959 (make_sized_plugin_object): Add filesize parameter. Change all callers.
11960 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11961 (Plugin_manager::all_symbols_read): Add task parameter.
11962 (Plugin_manager::get_input_file): New function.
11963 (Plugin_manager::release_input_file): New function.
11964 (Plugin_manager::task_): New data member.
11965 (Pluginobj::Pluginobj): Add filesize parameter.
11966 (Pluginobj::filename): New function.
11967 (Pluginobj::descriptor): New function.
11968 (Pluginobj::filesize): New function.
11969 (Pluginobj::filesize_): New data member.
11970 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11971 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11972 File_read::claim_for_plugin; use Object::unlock to unlock the file.
11974 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11975 with archive libraries.
11976 * testsuite/Makefile.in: Regenerate.
11977 * testsuite/plugin_test.c (struct sym_info): New type.
11978 (get_input_file, release_input_file): New static variables.
11979 (onload): Capture new transfer vector entries.
11980 (claim_file_hook): Stop reading at end of file according to filesize.
11981 Factor out parsing of readelf output into separate function.
11982 (all_symbols_read_hook): Exercise get_input_file and release_input_file
11983 APIs and get the source file name from the symbol table. Convert
11984 source file name to corresponding object file name. Print info
11985 message when adding new input files.
11986 (parse_readelf_line): New function.
11987 * testsuite/plugin_test_1.sh: Add checks for new info messages.
11988 * testsuite/plugin_test_2.sh: Likewise.
11989 * testsuite/plugin_test_3.sh: Likewise.
11990 * testsuite/plugin_test_4.sh: New test case.
11992 2009-01-07 Ian Lance Taylor <iant@google.com>
11994 * version.cc (version_string): Bump to 1.8.
11996 2008-12-23 Cary Coutant <ccoutant@google.com>
11998 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11999 * plugin.cc (Plugin_manager::finish): Rename as
12000 layout_deferred_objects. Move cleanup to separate function.
12001 (Plugin_manager::cleanup): New function.
12002 (Plugin_finish::run): Call layout_deferred_objects and cleanup
12004 * plugin.h (Plugin_manager::finish): Rename as
12005 layout_deferred_objects.
12006 (Plugin_manager::cleanup): New function.
12007 (Plugin_manager::cleanup_done): New field.
12009 2008-12-23 Cary Coutant <ccoutant@google.com>
12011 * plugin.cc (is_visible_from_outside): New function.
12012 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12013 so we don't return "IR only" status for exported symbols or -r links.
12015 * testsuite/Makefile.am (plugin_test_3): New test case.
12016 * testsuite/Makefile.in: Regenerate.
12017 * testsuite/plugin_test_3.sh: New file.
12019 2008-12-22 Cary Coutant <ccoutant@google.com>
12021 * object.cc (Sized_relobj::layout_section): New function.
12022 (Sized_relobj::do_layout): Defer layout of input sections until after
12023 plugin has provided replacement files.
12024 (Sized_relobj::do_layout_deferred_sections): New function.
12025 * object.h (Relobj::set_section_offset): Remove virtual keyword.
12026 (Relobj::layout_deferred_sections): New function.
12027 (Relobj::do_layout_deferred_sections): New function.
12028 (Sized_relobj::do_layout_deferred_sections): New function.
12029 (Sized_relobj::layout_section): New function.
12030 (Sized_relobj::Deferred_layout): New structure.
12031 (Sized_relobj::deferred_layout_): New field.
12032 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12033 Change all callers. Layout deferred sections.
12034 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
12036 (Plugin_hook::run): Move code from do_plugin_hook inline.
12037 (Plugin_hook::do_plugin_hook): Remove.
12038 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12039 (Plugin_manager::finish): Renamed, was cleanup.
12040 (Plugin_manager::should_defer_layout): New function.
12041 (Plugin_manager::add_deferred_layout_object): New function.
12042 (Plugin_manager::Deferred_layout_list): New type.
12043 (Plugin_manager::deferred_layout_objects_): New field.
12044 (Plugin_hook::do_plugin_hook): Remove.
12046 2008-12-17 Ian Lance Taylor <iant@google.com>
12048 * options.h (class General_options): Add --no case for
12051 2008-12-16 Cary Coutant <ccoutant@google.com>
12053 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12055 (Plugin_manager::claim_file): Create plugin object even if
12056 plugin did not call the add_symbols callback.
12057 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12058 asking for more symbols than were added.
12059 * testsuite/Makefile.am (plugin_test_1): Add test case with
12061 (empty.syms): New target.
12062 * testsuite/Makefile.in: Regenerate.
12063 * testsuite/plugin_test.c (claim_file_hook): Add new debug
12064 message. Don't call add_symbols if no globals.
12065 (all_symbols_read_hook): Don't provide replacement for empty
12068 2008-12-12 Ian Lance Taylor <iant@google.com>
12070 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12071 r_type == 0 for a local symbol with r_sym == 0.
12072 (scan_relocatable_relocs): Pass r_sym to
12073 local_non_section_strategy.
12074 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12077 * configure.ac: Update test for TLS descriptors: they are
12078 supported as of glibc 2.9.
12079 * configure: Rebuild.
12081 2008-12-11 Ian Lance Taylor <iant@google.com>
12084 * target-reloc.h (Default_scan_relocatable_relocs): For each
12085 function, map r_type == 0 to RELOC_DISCARD.
12087 2008-12-10 Cary Coutant <ccoutant@google.com>
12089 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12090 object to override a kept COMDAT group from a plugin object.
12092 2008-12-09 Ian Lance Taylor <iant@google.com>
12095 * yyscript.y (file_cmd): Handle INPUT.
12097 * testsuite/initpri1.c: Change all declarations to be full
12098 prototypes by adding void, to avoid compiler warnings.
12100 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
12102 * options.cc (General_options::parse_plugin_opt): New.
12103 (General_options::add_plugin): The argument now is just the filename.
12104 (General_options::add_plugin_option): New.
12105 * options.h (plugin_opt): New.
12106 (add_plugin): Change argument name.
12107 (add_plugin_option): New.
12108 * plugin.cc (Plugin::load): Don't parse the plugin option.
12109 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12110 (Plugin::add_option): New.
12111 (Plugin::args_): Change type.
12112 (Plugin::filename_): New.
12113 (Plugin_manager::add_plugin_option): New.
12114 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12115 * testsuite/Makefile.in: Regenerate.
12117 2008-12-05 Cary Coutant <ccoutant@google.com>
12119 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12120 Handle --strip-lto-sections option.
12121 * options.h (strip_lto_sections): New option.
12123 2008-12-01 Cary Coutant <ccoutant@google.com>
12125 * plugin.cc (ld_plugin_message): Change format parameter to const.
12126 Fix mismatch between new[] and delete.
12128 2008-11-14 Cary Coutant <ccoutant@google.com>
12130 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12133 2008-11-05 Craig Silverstein <csilvers@google.com>
12135 * options.cc (General_options::parse_dynamic_list): New function.
12136 * options.h (General_options): New flags dynamic_list,
12137 dynamic_list_data, dynamic_list_cpp_new, and
12138 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
12139 (General_options::in_dynamic_list): New function.
12140 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12141 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12142 (Lex::can_continue_name): Likewise.
12144 (read_script_file): New parameter script_options.
12145 (read_dynamic_list): New function.
12146 (Script_options::define_dynamic_list): New function.
12147 (dynamic_list_keyword_parsecodes): New variable.
12148 (dynamic_list_keywords): New variable.
12149 * script.h (Script_options::define_dynamic_list): New function
12151 (read_dynamic_list): New function prototype.
12152 * symtab.cc (strprefix): New macro.
12153 (Symbol::should_add_dynsym_entry): Support dynamic_list,
12154 dynamic_list_data, dynamic_list_cpp_new, and
12155 dynamic_list_cpp_typeinfo.
12156 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12157 (dynamic_list_expr): New rule.
12158 (dynamic_list_nodes): Likewise.
12159 (dynamic_list_node): Likewise.
12160 * testsuite/Makefile.am (dynamic_list): New test.
12161 * testsuite/Makefile.in: Regenerated.
12162 * testsuite/dynamic_list.t: New file.
12163 * testsuite/dynamic_list.sh: New file.
12165 2008-11-05 Craig Silverstein <csilvers@google.com>
12167 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12168 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12169 (t11_last): Likewise.
12170 * testsuite/ver_test_6.c (main): Likewise.
12172 2008-10-07 Cary Coutant <ccoutant@google.com>
12174 * options.c (General_options::finalize): Add check for -static and
12176 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12179 2008-10-02 Cary Coutant <ccoutant@google.com>
12181 * plugin.cc (make_sized_plugin_object): Fix conditional
12182 compilation to work when not all targets are enabled.
12184 2008-09-29 Cary Coutant <ccoutant@google.com>
12186 * archive.cc (Archive::get_file_and_offset): Use filename instead
12187 of name to get library path.
12188 (Archive::include_member): Unlock external member of a thin archive.
12190 * testsuite/Makefile.am (TEST_AR): New variable.
12191 (thin_archive_test_1): New test.
12192 (thin_archive_test_2): New test.
12193 * testsuite/Makefile.in: Regenerate.
12194 * testsuite/thin_archive_main.cc: New file.
12195 * testsuite/thin_archive_test_1.cc: New file.
12196 * testsuite/thin_archive_test_2.cc: New file.
12197 * testsuite/thin_archive_test_3.cc: New file.
12198 * testsuite/thin_archive_test_4.cc: New file.
12200 2008-09-29 Cary Coutant <ccoutant@google.com>
12202 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12203 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12205 (Sized_relobj::do_finalize_local_symbols): Likewise.
12206 (Sized_relobj::map_to_kept_section): Likewise.
12207 * object.h (Sized_relobj::invalid_address): New constant.
12208 (Sized_relobj::do_output_section_offset): Check for invalid_address
12210 * output.cc (Output_reloc::local_section_offset): Use constant
12211 invalid_address instead of -1U.
12212 (Output_reloc::get_address): Likewise.
12213 (Output_section::output_address): Change -1U to -1ULL.
12214 * output.h (Output_reloc::invalid_address): New constant.
12215 * reloc.cc (Sized_relobj::write_sections): Use constant
12216 invalid_address instead of -1U.
12217 (Sized_relobj::relocate_sections): Likewise.
12218 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12219 values for merge sections.
12220 * target-reloc.h (relocate_for_relocatable): Use constant
12221 invalid_address instead of -1U.
12223 2008-09-19 Cary Coutant <ccoutant@google.com>
12225 Add plugin functionality for link-time optimization (LTO).
12226 * configure.ac (plugins): Add --enable-plugins option.
12227 * configure: Regenerate.
12228 * config.in: Regenerate.
12229 * Makefile.am (LIBDL): New variable.
12230 (CCFILES): Add plugin.cc.
12231 (HFILES): Add plugin.h.
12232 (ldadd_var): Add LIBDL.
12233 * Makefile.in: Regenerate.
12235 * archive.cc: Include "plugin.h".
12236 (Archive::setup): Don't preread archive symbols when using a plugin.
12237 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
12238 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12240 (Archive::include_member): Add symbols from plugin objects.
12241 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12242 * descriptors.cc (Descriptors::open): Check for file descriptors
12243 abandoned by plugins.
12244 (Descriptors::claim_for_plugin): New function.
12245 * descriptors.h (Descriptors::claim_for_plugin): New function.
12246 (Open_descriptor::is_claimed): New field.
12247 (claim_descriptor_for_plugin): New function.
12248 * fileread.cc (File_read::claim_for_plugin): New function.
12249 * fileread.h (File_read::claim_for_plugin): New function.
12250 (File_read::descriptor): New function.
12251 * gold.cc: Include "plugin.h".
12252 (queue_initial_tasks): Add task to call plugin hooks for generating
12254 * main.cc: Include "plugin.h".
12255 (main): Load plugin libraries.
12256 * object.h (Pluginobj): Declare.
12257 (Object::pluginobj): New function.
12258 (Object::do_pluginobj): New function.
12259 (Object::set_target): New function.
12260 * options.cc: Include "plugin.h".
12261 (General_options::parse_plugin): New function.
12262 (General_options::General_options): Initialize plugins_ field.
12263 (General_options::add_plugin): New function.
12264 * options.h (Plugin_manager): Declare.
12265 (General_options): Add --plugin option.
12266 (General_options::has_plugins): New function.
12267 (General_options::plugins): New function.
12268 (General_options::add_plugin): New function.
12269 (General_options::plugins_): New field.
12270 * plugin.cc: New file.
12271 * plugin.h: New file.
12272 * readsyms.cc: Include "plugin.h".
12273 (Read_symbols::do_read_symbols): Check for archive before checking
12274 for ELF file. Call plugin hooks to claim files.
12275 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12276 from a real object file; force override when processing replacement
12278 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12279 (Symbol::init_base_object): Likewise.
12280 (Symbol::init_base_output_data): Likewise.
12281 (Symbol::init_base_output_segment): Likewise.
12282 (Symbol::init_base_constant): Likewise.
12283 (Symbol::init_base_undefined): Likewise.
12284 (Symbol::output_section): Assert that object is not a plugin.
12285 (Symbol_table::add_from_pluginobj): New function.
12286 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12288 (Symbol_table::sized_write_globals): Likewise.
12289 (Symbol_table::add_from_pluginobj): Instantiate template.
12290 * symtab.h (Sized_pluginobj): Declare.
12291 (Symbol::in_real_elf): New function.
12292 (Symbol::set_in_real_elf): New function.
12293 (Symbol::in_real_elf_): New field.
12294 (Symbol_table::add_from_pluginobj): New function.
12296 * testsuite/Makefile.am (AM_CFLAGS): New variable.
12297 (LIBDL): New variable.
12298 (LDADD): Add LIBDL.
12299 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12300 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12301 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12302 (MOSTLYCLEANFILES): Likewise.
12303 * testsuite/Makefile.in: Regenerate.
12304 * testsuite/plugin_test.c: New file.
12305 * testsuite/plugin_test_1.sh: New file.
12306 * testsuite/plugin_test_2.sh: New file.
12308 2008-09-16 Ian Lance Taylor <iant@google.com>
12310 * target-reloc.h (relocate_section): Check whether a symbol is
12311 defined by the ABI before reporting an undefined symbol error.
12312 * target.h (Target::is_defined_by_abi): Make parameter const.
12313 (Target::do_is_defined_by_abi): Likewise.
12314 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12315 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12316 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12317 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12318 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12319 * testsuite/Makefile.in: Rebuild.
12321 * fileread.cc (make_view): Add casts to avoid warning.
12323 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
12325 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12326 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12328 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
12330 * options.h (General_options::output_is_executable): New.
12331 (General_options::output_is_pie): New.
12332 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12333 for shared libraries.
12334 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12336 2008-09-11 Chris Demetriou <cgd@google.com>
12338 * options.h (origin): New -z option.
12339 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12340 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12343 2008-09-05 Cary Coutant <ccoutant@google.com>
12345 * fileread.cc (File_read::make_view): Add check for attempt to map
12346 beyond end of file.
12348 2008-09-05 Cary Coutant <ccoutant@google.com>
12350 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12351 explicit instantiations.
12353 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
12356 * options.cc (General_options::finalize): Allow undefined symbols
12357 in shlibs if linking -shared.
12360 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12361 symbols as not needing a dynsym entry.
12363 2008-08-20 Craig Silverstein <csilvers@google.com>
12365 * fileread.cc (File_read::open): Do not lock the file unless it
12366 was successfully opened.
12368 2008-08-14 Cary Coutant <ccoutant@google.com>
12370 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12371 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12372 * testsuite/tls_test.cc (struct int128): 128-bit struct
12373 for testing TLS relocs with non-zero addend.
12374 (v12): New TLS variable.
12376 (t_last): Add check for v12.
12377 * testsuite/tls_test.h (t12): New function.
12378 * testsuite/tls_test_main.cc (thread_routine): Call new test.
12380 2008-08-13 Ian Lance Taylor <iant@google.com>
12382 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12383 set tls_segment_ or relro_segment_.
12384 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12386 * output.h (Output_section::clear_is_relro): New function.
12387 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12388 sections specially even when output_data_ is empty.
12389 (Output_segment::maximum_alignment): When first section is relro,
12390 only force alignment for PT_LOAD segments.
12391 * script.cc (script_data_segment_align): New function.
12392 (script_data_segment_relro_end): New function.
12393 * script-c.h (script_data_segment_align): Declare.
12394 (script_data_segment_relro_end): Declare.
12395 * script-sections.h (class Script_sections): Declare
12396 data_segment_align and data_segment_relro_end. Add fields
12397 segment_align_index_ and saw_relro_end_.
12398 * script-sections.cc (class Sections_element): Add set_is_relro
12399 virtual function. Add new bool* parameter to place_orphan_here.
12400 Add get_output_section virtual function.
12401 (class Output_section_definition): Add set_is_relro. Add new
12402 bool* parameter to place_orphan_here. Add get_output_section.
12403 Add is_relro_ field.
12404 (Output_section_definition::Output_section_definition): Initialize
12405 evaluated_address_, evaluated_load_address, evaluated_addralign_,
12406 and is_relro_ fields.
12407 (Output_section_definition::place_orphan_here): Add is_relro
12409 (Output_section_definition::set_section_addresses): Set relro for
12411 (Output_section_definition::alternate_constraint): Likewise.
12412 (class Orphan_output_section): Add new bool* parameter to
12413 place_orphan_here. Add get_output_section.
12414 (Orphan_output_section::place_orphan_here): Add is_relro
12416 (Script_sections::Script_sections): Initialize
12417 data_segment_align_index_ and saw_relro_end_.
12418 (Script_sections::data_segment_align): New function.
12419 (Script_sections::data_segment_relro_end): New function.
12420 (Script_sections::place_orphan): Set or clear is_relro.
12421 (Script_sections::set_section_addresses): Force alignment of first
12423 * yyscript.y (exp): Call script_data_segment_align and
12424 script_data_segment_relro_end.
12425 * testsuite/relro_script_test.t: New file.
12426 * testsuite/relro_test.cc (using_script): Declare.
12427 (t1, t2): Test using_script.
12428 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12429 (relro_script_test_SOURCES): Define.
12430 (relro_script_test_DEPENDENCIES): Define.
12431 (relro_script_test_LDFLAGS): Define.
12432 (relro_script_test_LDADD): Define.
12433 (relro_script_test.so): New target.
12434 * testsuite/Makefile.in: Rebuild.
12436 2008-08-06 Cary Coutant <ccoutant@google.com>
12438 * archive.cc (Archive::total_archives, Archive::total_members)
12439 (Archive::total_members_loaded): New variables.
12440 (Archive::setup): Add parameter. Add option to preread
12442 (Archive::read_armap): Add counter.
12443 (Archive::get_file_and_offset): New function.
12444 (Archive::get_elf_object_for_member): New function.
12445 (Archive::read_all_symbols): New function.
12446 (Archive::read_symbols): New function.
12447 (Archive::add_symbols): Add counters.
12448 (Archive::include_all_members): Use armap to find members if it's
12450 (Archive::include_member): Skip reading symbols if already read.
12451 Factored code into Archive::get_file_and_offset and
12452 Archive::get_elf_object_for_member. Changed call to
12453 Mapfile::report_include_archive_member.
12454 (Archive::print_stats): New function.
12455 * archive.h: Declare Object and Read_symbols_data classes.
12456 (Archive::Archive): Add initializers for new members.
12457 (Archive::setup): Add parameter.
12458 (Archive::print_stats): New function.
12459 (Archive::total_archives, Archive::total_members)
12460 (Archive::total_members_loaded): New variables.
12461 (Archive::get_file_and_offset): New function.
12462 (Archive::get_elf_object_for_member): New function.
12463 (Archive::read_all_symbols): New function.
12464 (Archive::read_symbols): New function.
12465 (Archive::Archive_member): New class.
12466 (Archive::members_): New member.
12467 (Archive::num_members_): New member.
12468 * main.cc: Include archive.h.
12469 (main): Call Archive::print_stats.
12470 * mapfile.cc (Mapfile::report_include_archive_member): Delete
12471 archive parameter; member_name is now the fully-decorated name.
12472 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12473 * options.h: (General_options): Add --preread-archive-symbols option.
12474 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12477 2008-08-04 Ian Lance Taylor <iant@google.com>
12479 * symtab.h (Symbol::use_plt_offset): New function.
12480 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12481 * powerpc.cc (Relocate::relocate): Likewise.
12482 * sparc.cc (Relocate::relocate): Likewise.
12483 * x86_64.cc (Relocate::relocate): Likewise.
12484 * testsuite/weak_plt.sh: New test.
12485 * testsuite/weak_plt_main.cc: New test.
12486 * testsuite/weak_plt_shared.cc: New test.
12487 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12488 (check_PROGRAMS): Add weak_plt.
12489 (check_DATA): Add weak_plt_shared.so.
12490 (weak_plt_main_pic.o, weak_plt): New targets.
12491 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12492 * testsuite/Makefile.in: Rebuild.
12494 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12496 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12497 * testsuite/Makefile.in: Rebuild.
12499 2008-08-04 Alan Modra <amodra@bigpond.net.au>
12501 * Makefile.am (POTFILES.in): Set LC_ALL=C.
12502 * Makefile.in: Regenerate.
12503 * po/POTFILES.in: Regenerate.
12505 2008-07-29 Ian Lance Taylor <iant@google.com>
12507 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12508 symbols before other symbols.
12509 * testsuite/script_test_2.cc (test_addr): Declare.
12510 (test_addr_alias): Declare.
12511 (main): Check that test_addr and test_addr_alias have the right
12513 * testsuite/script_test_2.t: Define test_addr_alias and
12516 2008-07-24 Ian Lance Taylor <iant@google.com>
12519 * descriptors.cc: New file.
12520 * descriptors.h: New file.
12521 * gold-threads.h (class Hold_optional_lock): New class.
12522 * fileread.cc: Include "descriptors.h".
12523 (File_read::~File_read): Release descriptor rather than closing
12525 (File_read::open) [file]: Call open_descriptor rather than open.
12526 Set is_descriptor_opened_.
12527 (File_read::open) [memory]: Assert that descriptor is not open.
12528 (File_read::reopen_descriptor): New function.
12529 (File_read::release): Release descriptor.
12530 (File_read::do_read): Make non-const. Reopen descriptor.
12531 (File_read::read): Make non-const.
12532 (File_read::make_view): Reopen descriptor.
12533 (File_read::do_readv): Likewise.
12534 * fileread.h (class File_read): Add is_descriptor_opened_ field.
12535 Update declarations.
12536 * layout.cc: Include "descriptors.h".
12537 (Layout::create_build_id): Use open_descriptor rather than open.
12538 * output.cc: Include "descriptors.h".
12539 (Output_file::open): Use open_descriptor rather than open.
12540 * archive.cc (Archive::const_iterator): Change Archive to be
12542 (Archive::begin, Archive::end): Make non-const.
12543 (Archive::count_members): Likewise.
12544 * archive.h (class Archive): Update declarations.
12545 * object.h (Object::read): Make non-const.
12546 * Makefile.am (CCFILES): Add descriptors.cc.
12547 (HFILES): Add descriptors.h.
12548 * Makefile.in: Rebuild.
12551 * gold.h: Always include <clocale>. Add Solaris workarounds
12552 following code in binutils/sysdep.h.
12555 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12556 this->eh_frame_hdr_ is NULL before using it.
12558 * dynobj.cc (Versions::Versions): Update comment.
12560 * dynobj.cc (Versions::Versions): If there is an soname, use it as
12561 the base version name.
12563 * stringpool.cc (Stringpool_template::add_with_length): Set key to
12564 array size plus one.
12565 (Stringpool_template::set_string_offsets): Subtract one from key
12566 before using it as an array index.
12567 (Stringpool_template::get_offset_with_length): Likewise.
12568 (Stringpool_template::write_to_buffer): Likewise.
12569 * stringpool.h (Stringpool_template::get_offset_from_key):
12572 2008-07-23 Ian Lance Taylor <iant@google.com>
12575 * object.h (Merged_symbol_value::value): Do our best to handle a
12579 * script.cc (Version_script_info::get_versions): Don't add empty
12580 version tag to return value.
12581 (Version_script_info::get_symbol_version_helper): Change return
12582 type to bool. Add pversion parameter. Change all callers.
12583 (script_register_vers_node): Don't require a non-NULL tag.
12584 * script.h (class Version_script_info): Update declarations.
12585 (Version_script_info::get_symbol_version): Change return type to
12586 bool. Add version parameter. Change all callers.
12587 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12588 handling. Handle an empty version from a version script.
12589 (Symbol_table::define_special_symbol): Likewise.
12590 * testsuite/ver_test_10.script: New file.
12591 * testsuite/ver_test_10.sh: New file.
12592 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12593 (check_DATA): Add ver_test_10.syms.
12594 (ver_test_10.syms, ver_test_10.so): New target.
12595 * testsuite/Makefile.in: Rebuild.
12597 2008-07-23 Simon Baldwin <simonb@google.com>
12599 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12600 to zero for undefined symbols from dynamic libraries.
12602 2008-07-23 Ian Lance Taylor <iant@google.com>
12604 * symtab.cc (Symbol_table::resolve): Remove version parameter.
12605 Change all callers.
12606 * symtab.h (class Symbol_table): Update declaration.
12607 * testsuite/ver_test_9.cc: New file.
12608 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12609 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12610 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12611 (ver_test_9.so, ver_test_9.o): New targets.
12612 * testsuite/Makefile.in: Rebuild.
12614 2008-07-22 Ian Lance Taylor <iant@google.com>
12616 * options.h (class General_options): Define --check-sections.
12617 * layout.cc (Layout::set_segment_offsets): Handle
12620 * options.h (class General_options): Define -n/--nmagic and
12622 * options.cc (General_options::finalize): For -n/--nmagic or
12623 -N/--omagic, set -static.
12624 * layout.cc (Layout::attach_allocated_section_to_segment): If
12625 -N/--omagic, don't put read-only and read-write sections in
12626 different segments.
12627 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12628 finding a read-only segment.
12629 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12630 don't set the minimum segment alignment to the common page size,
12631 and don't set the file offset to the address modulo the page size.
12632 * script-sections.cc (Script_sections::create_segments): If
12633 -n/--omagic, don't put read-only and read-write sections in
12634 different segments.
12636 * cref.cc: New file.
12637 * cref.h: New file.
12638 * options.h (class General_options): Add --print-symbol-counts.
12639 * main.cc (main): Issue defined symbol report if requested.
12640 * archive.cc (Archive::interpret_header): Make into a const member
12642 (Archive::add_symbols): Call Input_objects::archive_start and
12644 (Archive::const_iterator): Define new class.
12645 (Archive::begin, Archive::end): New functions.
12646 (Archive::include_all_members): Rewrite to use iterator.
12647 (Archive::count_members): New function.
12648 * archive.h (class Archive): Update declarations.
12649 (Archive::filename): New function.
12650 * object.cc: Include "cref.h".
12651 (Sized_relobj::Sized_relobj): Initialize defined_count_.
12652 (Sized_relobj::do_get_global_symbol_counts): New function.
12653 (Input_objects::add_object): Add object to cross-referencer.
12654 (Input_objects::archive_start): New function.
12655 (Input_objects::archive_stop): New function.
12656 (Input_objects::print_symbol_counts): New function.
12657 * object.h: Declare Cref and Archive.
12658 (Object::get_global_symbol_counts): New function.
12659 (Object::do_get_global_symbol_counts): New pure virtual function.
12660 (class Sized_relobj): Add defined_count_ field. Update
12662 (class Input_objects): Add cref_ field. Update constructor.
12663 Update declarations.
12664 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12666 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12668 (Sized_dynobj::do_get_global_symbol_counts): New function.
12669 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12670 defined_count_. Update declarations. Define Symbols typedef.
12671 * symtab.cc (Symbol_table::add_from_relobj): Add defined
12672 parameter. Change all callers.
12673 (Symbol_table::add_from_dynobj): Add sympointers and defined
12674 parameters. Change all callers.
12675 * symtab.h (class Symbol_table): Update declarations.
12676 * Makefile.am (CCFILES): Add cref.cc.
12677 (HFILES): Add cref.h.
12678 * Makefile.in: Rebuild.
12680 2008-07-22 Simon Baldwin <simonb@google.com>
12682 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12683 to zero when writing undefined symbols.
12685 2008-07-22 Ian Lance Taylor <iant@google.com>
12687 * output.cc (Output_section::add_input_section): Don't try to
12688 merge empty merge sections.
12690 2008-07-21 Craig Silverstein <csilvers@google.com>
12692 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12693 Include symbol version in error message.
12695 2008-07-20 Chris Demetriou <cgd@google.com>
12697 * configure.ac (gold_cv_c_random_seed): New configured variable.
12698 (RANDOM_SEED_CFLAGS): New substituted variable.
12699 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12700 * configure: Rebuild.
12701 * Makefile.in: Likewise.
12702 * testsuite/Makefile.in: Likewise.
12704 2008-07-18 Ian Lance Taylor <iant@google.com>
12706 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12707 where we see NAME/NULL and NAME/VERSION as separate symbols.
12708 * testsuite/ver_test_main.cc (main): Call t4.
12709 (t4, t4_2a): Define.
12710 * testsuite/ver_test_2.cc (t4_2): Define.
12711 * testsuite/ver_test_2.script: Put t4_2a in VER2.
12712 * testsuite/ver_test_4.cc (t4_2a): Define.
12713 * testsuite/ver_test_4.script: Put t4_2a in VER2.
12714 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12716 2008-07-17 Ian Lance Taylor <iant@google.com>
12718 * dynobj.cc (Versions::add_def): If we give an error about a
12719 missing version, go ahead and create the version anyhow.
12721 2008-07-10 Ian Lance Taylor <iant@google.com>
12723 Handle output sections with more than 0x7fffffff bytes.
12724 * object.h (class Relobj): Change map_to_output_ to
12725 output_sections_, and just keep a section pointer. Change all
12726 uses. Move comdat group support to Sized_relobj.
12727 (Relobj::is_section_specially_mapped): Remove.
12728 (Relobj::output_section): Remove poff parameter. Change all
12730 (Relobj::output_section_offset): New function.
12731 (Relobj::set_section_offset): Rewrite.
12732 (Relobj::map_to_output): Remove.
12733 (Relobj::output_sections): New function.
12734 (Relobj::do_output_section_offset): New pure virtual function.
12735 (Relobj::do_set_section_offset): Likewise.
12736 (class Sized_relobj): Add section_offsets_ field. Add comdat
12737 group support from Relobj. Update declarations.
12738 (Sized_relobj::get_output_section_offset): New function.
12739 (Sized_relobj::do_output_section_offset): New function.
12740 (Sized_relobj::do_set_section_offset): New function.
12741 * object.cc (Relobj::output_section_address): Remove.
12742 (Sized_relobj::Sized_relobj): Initialize new fields.
12743 (Sized_relobj::include_section_group): Cast find_kept_object to
12745 (Sized_relobj::include_linkonce_section): Likewise.
12746 (Sized_relobj::do_layout): Use separate arrays for output section
12748 (Sized_relobj::do_count_local_symbols): Change map_to_output to
12750 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12751 output_sections and section_offsets.
12752 (Sized_relobj::write_local_symbols): Likewise.
12753 (map_to_kept_section): Compute output address directly.
12754 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12755 output_sections and section_offsets.
12756 (Sized_relobj::write_sections): Likewise.
12757 (Sized_relobj::relocate_sections): Likewise.
12758 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12759 * output.h (class Output_reloc): Update declarations. Change
12760 u2_.relobj to Sized_relobj*.
12761 (class Output_data_reloc): Change add functions to use
12763 * output.cc (Output_reloc::Output_reloc): Change relobj to
12765 (Output_reloc::local_section_offset): Change return type to
12766 Elf_Addr. Use get_output_section_offset.
12767 (Output_reloc::get_address): Likewise.
12768 (Output_section::is_input_address_mapped): Don't call
12769 is_section_specially_mapped.
12770 (Output_section::output_offset): Likewise.
12771 (Output_section::output_address): Likewise.
12772 (Output_section::starting_output_address): Likewise.
12773 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12774 parameter to Sized_relobj*.
12775 (Copy_relocs::need_copy_reloc): Likewise.
12776 (Copy_relocs::save): Likewise.
12777 * copy-relocs.h (class Copy_relocs): Update declarations.
12778 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12779 Sized_relobj*. Change relobj_ field to Sized_relobj*.
12780 * target-reloc.h (relocate_for_relocatable): Change
12781 offset_in_output_section type to Elf_Addr. Change code that uses
12783 * layout.cc (Layout::layout): Always set *off.
12784 * mapfile.cc (Mapfile::print_input_section): Use
12785 output_section_offset.
12786 * i386.cc (Target_i386::copy_reloc): Change object parameter to
12788 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12789 * sparc.cc (Target_sparc::copy_reloc): Likewise.
12790 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12792 2008-07-03 Ian Lance Taylor <iant@google.com>
12794 * layout.cc (Layout::include_section): Do not discard unrecognized
12795 SHT_STRTAB sections.
12797 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
12799 * script.cc (Lex::can_continue_name): Make '?' allowable in
12800 version-script names.
12801 * testsuite/version_script.map: Change glob pattern to use '?'
12803 2008-06-30 Manish Singh <yosh@gimp.org>
12806 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12809 2008-06-30 Ian Lance Taylor <iant@google.com>
12813 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12814 versions]: Don't try to read the value in the contents, since we
12815 don't use it. Use the template endianness when writing.
12817 2008-06-25 Cary Coutant <ccoutant@google.com>
12819 * fileread.cc (File_read::make_view): Assert on zero-length view.
12820 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12821 symbol table when there are no symbols to read.
12823 2008-06-23 Craig Silverstein <csilvers@google.com>
12825 * version.cc (version_string): Bump to 1.7
12827 2008-06-18 Craig Silverstein <csilvers@google.com>
12829 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12830 constant 0xFFFF to type Valtype.
12831 (Powerpc_relocate_functions::rel16_ha): Likewise.
12833 2008-06-17 Ian Lance Taylor <iant@google.com>
12835 * output.h (Output_section::Input_section): Initialize p2align_ to
12836 zero for Output_section_data constructors.
12837 (Output_section::Input_section::addralign): If not an input
12838 section, return the alignment of the Output_section_data.
12839 * testsuite/copy_test.cc: New file.
12840 * testsuite/copy_test_1.cc: New file.
12841 * testsuite/copy_test_2.cc: New file.
12842 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12843 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12844 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12845 (copy_test_1_pic.o, copy_test_1.so): New targets.
12846 (copy_test_2_pic.o, copy_test_2.so): New targets.
12847 * testsuite/Makefile.in: Rebuild.
12849 * script-sections.cc (Script_sections::place_orphan): Initialize
12850 local variable exact.
12852 2008-06-13 David Edelsohn <edelsohn@gnu.org>
12854 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12856 2008-06-12 David Edelsohn <edelsohn@gnu.org>
12857 David S. Miller <davem@davemloft.net>
12859 * powerpc.cc: New file.
12860 * Makefile.am (TARGETSOURCES): Add powerpc.cc
12861 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12862 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12863 * Makefile.in: Rebuild.
12865 2008-06-09 Ian Lance Taylor <iant@google.com>
12867 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12869 (throwing, orig_terminate): New static variables.
12870 (terminate_handler): New static function.
12871 (t2): Set terminate handler.
12873 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
12876 * binary.cc (Binary_to_elf::sized_convert): Fix .data
12879 2008-05-30 Cary Coutant <ccoutant@google.com>
12881 * archive.cc (Archive::include_all_members) Correct to step
12882 over symbol table and extended name table in thin archives.
12884 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
12887 * target-reloc.h (relocate_for_relocatable): Fix new_offset
12890 2008-05-28 Caleb Howe <cshowe@google.com>
12892 * reduced_debug_output.cc: New file.
12893 * reduced_debug_output.h: New file.
12894 * options.h (class General_options): Add --strip-debug-non-line.
12895 * options.cc (General_options::finalize): Add strip_debug_non_line
12896 to the strip heirarchy.
12897 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12899 * layout.cc: Include "reduced_debug_output.h".
12900 (Layout::Layout): Initialize new fields.
12901 (line_only_debug_sections): New static array.
12902 (is_lines_only_debug_sections): New static inline function.
12903 (Layout::include_section): Handle --strip-debug-non-line.
12904 (Layout::make_output_section): If --strip-debug-non-line, build
12905 new output sections for .debug_abbrev and .debug_info.
12906 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12907 gold. Warn about possible overflow.
12908 (read_signed_LEB_128): Likewise.
12909 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12910 (read_signed_LEB_128): Declare.
12911 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12912 (HFILES): Add reduced_debug_output.h.
12913 * Makefile.in: Rebuild.
12915 2008-05-21 Ian Lance Taylor <iant@google.com>
12917 * mapfile.cc: New file.
12918 * mapfile.h: New file.
12919 * options.h (class General_options): Add -M/--print-map and -Map.
12920 * options.cc (General_options::finalize): Make -M equivalent to
12922 * main.cc: Include <cstdio> and "mapfile.h".
12923 (main): Open mapfile if requested.
12924 * gold.cc (class Middle_runner): Add mapfile_ field. Update
12925 constructor. Change caller.
12926 (queue_initial_tasks): Add mapfile parameter. Change caller.
12927 (queue_middle_tasks): Likewise.
12928 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12930 * archive.cc: Include "mapfile.h".
12931 (Archive::add_symbols): Add mapfile parameter. Change all
12932 callers. Pass mapfile, symbol, and reason to include_member.
12933 (Archive::include_all_members): Add mapfile parameter. Change all
12935 (Archive::include_member): Add mapfile, sym, and why parameters.
12936 Change all callers. Report inclusion to map file.
12937 * archive.h: Include "fileread.h".
12938 (class Archive): Update declarations.
12939 (Archive::file): New const method.
12940 (class Add_archive_symbols): Add mapfile_ field. Update
12941 constructor. Change all callers.
12942 * readsyms.h (class Read_symbols): Likewise.
12943 (class Finish_group): Likewise.
12944 (class Read_script): Likewise.
12945 * common.cc: Include "mapfile.h".
12946 (Symbol_table::allocate_commons): Add mapfile parameter. Change
12948 (Symbol_table::do_allocate_commons): Likewise.
12949 (Symbol_table::do_allocate_commons_list): Likewise. Report common
12950 symbol allocation to mapfile.
12951 * common.h (class Allocate_commons_task): Add mapfile_ field.
12952 Update constructor. Change all callers.
12953 * symtab.h (class Symbol_table): Update declarations.
12954 * layout.cc: Include "mapfile.h".
12955 (Layout_task_runner::run): Print information to mapfile.
12956 (Layout::create_gold_note): Change Output_data_fixed_space to
12957 Output_data_zero_fill.
12958 (Layout::create_build_id): Likewise.
12959 (Layout::print_to_mapfile): New function.
12960 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
12961 constructor. Change caller.
12962 (class Layout): Declare print_to_mapfile.
12963 * output.cc (Output_section::Input_section::print_to_mapfile): New
12965 (Output_section::add_input_section): If producing a map, always
12966 add to input_sections_ list.
12967 (Output_section::do_print_to_mapfile): New function.
12968 (Output_segment::print_sections_to_mapfile): New function.
12969 (Output_segment::print_section_list_to_mapfile): New function.
12970 * output.h: Include "mapfile.h".
12971 (Output_data::print_to_mapfile): New function.
12972 (Output_data::do_print_to_mapfile): New virtual function.
12973 (Output_segment_headers::do_print_to_mapfile): New function.
12974 (Output_file_header::do_print_to_mapfile): New function.
12975 (Output_data_const::do_print_to_mapfile): New function.
12976 (class Output_data_const_buffer): Add map_name_ field. Update
12977 constructor. Change all callers. Add do_print_to_mapfile
12979 (class Output_data_fixed_space): Likewise.
12980 (class Output_data_space): Likewise.
12981 (class Output_data_zero_fill): New class.
12982 (Output_data_strtab::do_print_to_mapfile): New function.
12983 (Output_data_reloc_base::do_print_to_mapfile): New function.
12984 (Output_relocatable_relocs::do_print_to_mapfile): New function.
12985 (Output_data_group::do_print_to_mapfile): New function.
12986 (Output_data_got::do_print_to_mapfile): New function.
12987 (Output_data_dynamic::do_print_to_mapfile): New function.
12988 (Output_symtab_xindex::do_print_to_mapfile): New function.
12989 (class Output_section): Declare do_print_to_mapflie. Declare
12990 print_to_mapfile in Input_section.
12991 (class Output_segment): Declare new functions.
12992 * object.h (Sized_relobj::symbol_count): New function.
12993 * script-sections.cc
12994 (Output_section_element_dot_assignment::set_section_addresses):
12995 Change Output_data_fixed_space to Output_data_zero_fill.
12996 (Output_data_expression::do_print_to_mapfile): New function.
12997 * script.cc (read_input_script): Add mapfile parameter. Change
12999 * script.h (read_input_script): Update declaration.
13000 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13001 (Eh_frame::do_print_to_mapfile): New function.
13002 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13003 (Output_merge_string::do_print_to_mapfile): New function.
13004 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13006 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13008 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13010 * Makefile.am (CCFILES): Add mapfile.cc.
13011 (HFILES): Add mapfile.h.
13012 * Makefile.in: Rebuild.
13014 2008-05-19 Ian Lance Taylor <iant@google.com>
13016 * options.h (class General_options): Add -z relro.
13017 * layout.cc (Layout::Layout): Initialize relro_segment_.
13018 (Layout::add_output_section_data): Return the output section.
13019 (Layout::make_output_section): Rcognize relro sections and mark
13020 them appropriately.
13021 (Layout::attach_allocated_section_to_segment): Put relro sections
13022 in a PT_GNU_RELRO segment.
13023 (Layout::create_initial_dynamic_sections): Mark the .dynamic
13025 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13027 (Layout::linkonce_mapping): Map d.rel.ro.local to
13028 .data.rel.ro.local.
13029 (Layout::output_section_name): Us .data.rel.ro.local for any
13030 section which begins with that.
13031 * layout.h (class Layout): Update add_output_section_data
13032 declaration. Add relro_segment_ field.
13033 * output.cc (Output_section::Output_section): Initialize is_relro_
13034 and is_relro_local_ fields.
13035 (Output_segment::add_output_section): Group relro sections.
13036 (Output_segment::is_first_section_relro): New function.
13037 (Output_segment::maximum_alignment): If there is a relro section,
13038 align the segment to the common page size.
13039 (Output_segment::set_section_addresses): Track whether we are
13040 looking at relro sections. If the last section is a relro
13041 section, align to the common page size.
13042 (Output_segment::set_section_list_addresses): Add in_relro
13043 parameter. Change all callers. Align to the page size when
13044 moving from relro to non-relro section.
13045 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13047 * output.h (class Output_section): Add is_relro_ and
13048 is_relro_local_ fields.
13049 (Output_section::is_relro): New function.
13050 (Output_section::set_is_relro): New function.
13051 (Output_section::is_relro_local): New function.
13052 (Output_section::set_is_relro_local): New function.
13053 (class Output_segment): Update declarations.
13054 * i386.cc (Target_i386::got_section): Mark .got section as relro.
13055 * sparc.cc (Target_sparc::got_section): Likewise.
13056 * x86_64.cc (Target_x86_64::got_section): Likewise.
13057 * testsuite/relro_test_main.cc: New file.
13058 * testsuite/relro_test.cc: New file.
13059 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13060 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13061 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13062 (relro_test.so, relro_test_pic.o): New targets.
13063 * testsuite/Makefile.in: Rebuild.
13065 2008-05-16 Ian Lance Taylor <iant@google.com>
13067 * output.cc (Output_segment::add_output_section): Remove front
13069 * output.h (class Output_segment): Remove
13070 add_initial_output_section and overloaded add_output_section.
13071 Update declaration of remaining add_output_section.
13072 * layout.cc (Layout::create_interp): Call add_output_section
13073 rather than add_initial_output_section.
13074 (Layout::finish_dynamic_section): Likewise.
13076 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13077 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
13078 know the dynamic type.
13079 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13080 field. Initialize it in constructor.
13081 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13082 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13083 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13086 * output.cc (Output_reloc::get_address): Change return type to
13088 * output.h (class Output_reloc): Update get_address declaration.
13089 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13090 for section addresses.
13092 2008-05-09 Ian Lance Taylor <iant@google.com>
13095 * gold.cc (gold_nomem): Use return value of write.
13097 2008-05-08 Ian Lance Taylor <iant@google.com>
13099 * symtab.c (Symbol::init_base_output_data): Add version
13100 parameter. Change all callers.
13101 (Symbol::init_base_output_segment): Likewise.
13102 (Symbol::init_base_constant): Likewise.
13103 (Symbol::init_base_undefined): Likewise.
13104 (Sized_symbol::init_output_data): Likewise.
13105 (Sized_symbol::init_output_segment): Likewise.
13106 (Sized_symbol::init_constant): Likewise.
13107 (Sized_symbol::init_undefined): Likewise.
13108 (Symbol_table::do_define_in_output_data): If the new symbol has a
13109 version, mark it as the default.
13110 (Symbol_table::do_define_in_output_segment): Likewise.
13111 (Symbol_table::do_define_as_constant): Likewise.
13112 * symtab.h (class Symbol): Update declarations.
13113 (class Sized_symbol): Likewise.
13114 * resolve.cc (Symbol::override_version): New function.
13115 (Symbol::override_base): Call override_version.
13116 (Symbol::override_base_with_special): Likewise.
13117 * testsuite/ver_script_8.script: New file.
13118 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13119 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13120 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13121 (ver_test_8_1.so, ver_test_8_2.so): New targets.
13123 2008-05-06 Ian Lance Taylor <iant@google.com>
13126 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13128 (class General_options): Remove existing --undefined, and add
13129 --no-undefined instead. Add new --undefined as synonym for -u.
13130 * archive.cc (Archive::add_symbols): Check whether symbol was
13132 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13133 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13134 all uses. Add IS_UNDEFINED. Update declarations to split
13135 different versions of init_base. Declare init_base_undefined.
13136 (Symbol::is_defined): Handle IS_UNDEFINED.
13137 (Symbol::is_undefined): Likewise.
13138 (Symbol::is_weak_undefined): Call is_undefined.
13139 (Symbol::is_absolute): Handle IS_CONSTANT.
13140 (class Sized_symbol): Update declarations to split different
13141 versions of init. Declare init_undefined.
13142 (class Symbol_table): Declare new functions.
13143 * symtab.cc (Symbol::init_base_object): Rename from init_base.
13144 Change all callers.
13145 (Symbol::init_base_output_data): Likewise.
13146 (Symbol::init_base_output_segment): Likewise.
13147 (Symbol::init_base_constant): Likewise.
13148 (Symbol::init_base_undefined): New function.
13149 (Sized_symbol::init_object): Rename from init. Change all
13151 (Sized_symbol::init_output_data): Likewise.
13152 (Sized_symbol::init_output_segment): Likewise.
13153 (Sized_symbol::init_constant): Likewise.
13154 (Sized_symbol::init_undefined): New function.
13155 (Symbol_table::add_undefined_symbols_from_command_line): New
13157 (Symbol_table::do_add_undefined_symbols_from_command_line): New
13159 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13160 (Symbol::output_section): Likewise.
13161 (Symbol::set_output_section): Likewise.
13162 (Symbol_table::sized_finalize_symbol): Likewise.
13163 (Symbol_table::sized_write_globals): Likewise.
13164 * resolve.cc (Symbol_table::should_override): Likewise.
13165 (Symbol::override_base_with_special): Likewise.
13167 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13168 symbol, change it to have default visibility.
13169 * testsuite/protected_1.cc: New file.
13170 * testsuite/protected_2.cc: New file.
13171 * testsuite/protected_3.cc: New file.
13172 * testsuite/protected_main_1.cc: New file.
13173 * testsuite/protected_main_2.cc: New file.
13174 * testsuite/protected_main_3.cc: New file.
13175 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13176 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13177 (protected_1_LDFLAGS, protected_1_LDADD): Define.
13178 (protected_1.so): New target.
13179 (protected_1_pic.o, protected_2_pic.o): New targets.
13180 (protected_3_pic.o): New target.
13181 (check_PROGRAMS): Add protected_2.
13182 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13183 (protected_2_LDFLAGS, protected_2_LDADD): Define.
13184 * testsuite/Makefile.in: Rebuild.
13186 * options.h (DEFINE_var): Add set_user_set_##varname__.
13187 (DEFINE_bool_alias): New macro.
13188 (class General_options): Define -Bstatic using DEFINE_bool_alias
13189 rather than DEFINE_special. Add --undefined as an alias for -z
13191 * options.cc (General_options::parse_Bstatic): Remove.
13193 * options.h (class General_options): Add --fatal-warnings.
13194 * main.cc (main): Implement --fatal-warnings.
13195 * errors.h (Errors::warning_count): New function.
13197 * options.h (class General_options): Add -Bsymbolic-functions.
13198 * symtab.h (Symbol::is_preemptible): Check for
13199 -Bsymbolic-functions.
13201 2008-05-05 Ian Lance Taylor <iant@google.com>
13203 * options.h (DEFINE_bool): For DASH_Z, create the negative option
13204 as noVARNAME rather than no-VARNAME.
13205 (class General_options): Add option -z combreloc.
13206 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13208 (Output_reloc::sort_before) [SHT_REL]: New function.
13209 (Output_reloc::sort_before) [SHT_RELA]: New function.
13210 (class Output_data_reloc_base): Add sort_relocs_ field. Define
13211 Sort_relocs_comparison.
13212 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13213 parameter. Change all callers.
13214 (Output_data_reloc::Output_data_reloc) [both versions]: Add
13215 sort_relocs parameter. Change all callers.
13216 * output.cc (Output_reloc::get_address): New function, broken out
13218 (Output_reloc::write_rel): Call it.
13219 (Output_reloc::compare): New function.
13220 (Output_data_reloc_base::do_write): Optionally sort relocs.
13222 * configure.ac: If targ_extra_obj is set, link it in.
13223 * configure.tgt: Initialize all variables.
13224 (x86_64*): Set targ_extra_obj and targ_extra_size.
13225 * configure: Rebuild.
13227 * object.cc (Sized_relobj::include_section_group): Adjust section
13228 indexes read from group data. Build vector to pass to
13230 * layout.cc (Layout::layout_group): Add flags and shndxes
13231 parameters. Remove contents parameter. Change caller. Update
13232 explicit instantiations.
13233 * layout.h (class Layout): Update layout_group declaration.
13234 * output.cc (Output_data_group::Output_data_group): Add flags and
13235 input_shndxes parameters. Remove contents parameter. Change
13237 (Output_data_group::do_write): Change input_sections_ to
13239 * output.h (class Output_data_group): Update constructor
13240 declaration. Rename input_sections_ to input_shndxes_.
13241 * testsuite/many_sections_test.cc: Add template.
13243 2008-04-30 Cary Coutant <ccoutant@google.com>
13245 * target-reloc.h (relocate_section): Fix dead-pointer bug.
13247 * layout.cc (Layout::include_section): Refactored check for debug
13249 (Layout::add_comdat): Add new parameters. Change type
13250 of signature parameter. Add object and shndx to signatures table.
13251 (Layout::find_kept_object): New function.
13252 * layout.h: Include <cstring>.
13253 (Layout::is_debug_info_section): New function.
13254 (Layout::add_comdat): Add new parameters.
13255 (Layout::find_kept_object): New function.
13256 (Layout::Kept_section): New struct.
13257 (Layout::Signatures): Change type of map range.
13258 * object.cc (Relobj::output_section_address): New function.
13259 (Sized_relobj::include_section_group): Add new parameters. Change
13260 calls to Layout::add_comdat. Change to build table of kept comdat
13261 groups and table mapping discarded sections to kept sections.
13262 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
13263 (Sized_relobj::do_layout): Change calls to include_section_group and
13264 include_linkonce_section.
13265 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13266 value to zero when section is discarded.
13267 (Sized_relobj::map_to_kept_section): New function.
13268 * object.h (Relobj::output_section_address): New function.
13269 (Relobj::Comdat_group): New type.
13270 (Relobj::find_comdat_group): New function.
13271 (Relobj::Comdat_group_table): New type.
13272 (Relobj::Kept_comdat_section): New type.
13273 (Relobj::Kept_comdat_section_table): New type.
13274 (Relobj::add_comdat_group): New function.
13275 (Relobj::set_kept_comdat_section): New function.
13276 (Relobj::get_kept_comdat_section): New function.
13277 (Relobj::comdat_groups_): New field.
13278 (Relobj::kept_comdat_sections_): New field.
13279 (Symbol_value::input_value): Update comment.
13280 (Sized_relobj::map_to_kept_section) New function.
13281 (Sized_relobj::include_linkonce_section): Add new parameter.
13282 * target-reloc.h (Comdat_behavior): New type.
13283 (get_comdat_behavior): New function.
13284 (relocate_section): Add code to map a discarded section to the
13285 corresponding kept section when applying a relocation.
13287 2008-04-30 Craig Silverstein <csilvers@google.com>
13289 * dwarf_reader.cc (next_generation_count): New static var.
13290 (Addr2line_cache_entry): New struct.
13291 (addr2line_cache): New static var.
13292 (Dwarf_line_info::one_addr2line): Added caching.
13293 (Dwarf_line_info::clear_addr2line_cache): New function.
13294 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13295 cache-size parameter.
13296 (Dwarf_line_info::one_addr2line_cache): New function.
13297 * symtab.cc (Symbol_table::detect_odr_violations): Pass
13298 new cache-size argument to one_addr2line(), and clear cache.
13300 2008-04-28 Cary Coutant <ccoutant@google.com>
13302 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13303 R_386_PC8 relocations.
13305 2008-04-23 Ian Lance Taylor <iant@google.com>
13307 * object.cc (Sized_relobj::include_section_group): Check for
13308 invalid section group.
13310 * object.cc (make_elf_object): Correct test for 64-bit ELF file
13313 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13314 than read for file header.
13315 * archive.cc (Archive::include_member): Likewise.
13317 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
13319 * aclocal.m4: Regenerate.
13320 * configure: Regenerate.
13322 2008-04-19 Ian Lance Taylor <iant@google.com>
13324 * version.cc (version_string): Bump to 1.6.
13326 * testsuite/Makefile.am (many_sections_r_test): New target.
13327 (many_sections_r_test_SOURCES): Remove.
13328 (many_sections_r_test_DEPENDENCIES): Remove.
13329 (many_sections_r_test_LDFLAGS): Remove.
13330 (many_sections_r_test_LDADD): Remove.
13332 * object.cc (Sized_relobj::do_add_symbols): Always pass
13333 local_symbol_count_ to add_from_relobj.
13335 * testsuite/Makefile.am (many_sections_check.h): Only check one in
13336 every thousand variables.
13337 * testsuite/Makefile.in: Rebuild.
13339 * object.cc (Xindex::initialize_symtab_xindex): New function.
13340 (Xindex::read_symtab_xindex): New function.
13341 (Xindex::sym_xindex_to_shndx): New function.
13342 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13344 (Sized_relobj::do_initialize_xindex): New function.
13345 (Sized_relobj::do_read_symbols): Adjust section links.
13346 (Sized_relobj::symbol_section_and_value): Add is_ordinary
13347 parameter. Change all callers.
13348 (Sized_relobj::include_section_group): Adjust section links and
13349 symbol section indexes.
13350 (Sized_relobj::do_layout): Adjust section links.
13351 (Sized_relobj::do_count_local_symbols): Adjust section links and
13352 symbol section indexes.
13353 (Sized_relobj::do_finalize_local_symbols): Distinguish between
13354 ordinary and special symbols.
13355 (Sized_relobj::write_local_symbols): Add symtab_xindex and
13356 dynsym_xindex parameters. Change all callers. Adjust section
13357 links. Use SHN_XINDEX when needed.
13358 (Sized_relobj::get_symbol_location_info): Adjust section links.
13359 Don't get fooled by special symbols.
13360 * object.h (class Xindex): Define.
13361 (class Object): Add xindex_ parameter. Declare virtual functoin
13362 do_initialize_xindex.
13363 (Object::adjust_sym_shndx): New function.
13364 (Object::set_xindex): New protected function.
13365 (class Symbol_value): Add is_ordinary_shndx_ field.
13366 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13367 (Symbol_value::value): Assert ordinary section.
13368 (Symbol_value::initialize_input_to_output_map): Likewise.
13369 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13370 Change all callers.
13371 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
13373 (class Sized_relobj): Update declarations.
13374 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13375 parameter. Change all callers.
13376 (Sized_relobj::adjust_shndx): New function.
13377 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13379 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13380 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
13381 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
13382 (Sized_dynobj::read_dynsym_section): Adjust section links.
13383 (Sized_dynobj::read_dynamic): Likewise.
13384 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
13386 (Sized_dynobj::do_initialize_xindex): New function.
13387 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
13388 do_initialize_xindex.
13389 (Sized_dynobj::adjust_shndx): New function.
13390 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13391 dynsym_xindex_ fields.
13392 (Layout::finalize): Add a call to set_section_indexes before
13393 creating the symtab sections.
13394 (Layout::set_section_indexes): Don't do anything if the section
13395 already has a section index.
13396 (Layout::create_symtab_sections): Add shnum parameter. Change
13397 caller. Create .symtab_shndx section if needed.
13398 (Layout::create_shdrs): Add shstrtab_section parameter. Change
13400 (Layout::allocated_output_section_count): New function.
13401 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13403 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13404 fields. Update declarations.
13405 (Layout::symtab_xindex): New function.
13406 (Layout::dynsym_xindex): New function.
13407 (class Write_symbols_task): Add layout_ field.
13408 (Write_symbols_task::Write_symbols_task): Add layout parameter.
13410 * output.cc (Output_section_headers::Output_section_headers): Add
13411 shstrtab_section parameter. Change all callers.
13412 (Output_section_headers::do_sized_write): Store overflow values
13413 for section count and section string table section index in
13414 section header zero.
13415 (Output_file_header::do_sized_write): Check for overflow of
13416 section count and section string table section index.
13417 (Output_symtab_xindex::do_write): New function.
13418 (Output_symtab_xindex::endian_do_write): New function.
13419 * output.h (class Output_section_headers): Add shstrtab_section_.
13420 Update declarations.
13421 (class Output_symtab_xindex): Define.
13422 (Output_section::has_out_shndx): New function.
13423 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13425 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13426 Change all callers.
13427 (Sized_symbol::init): Likewise.
13428 (Symbol::output_section): Check for ordinary symbol.
13429 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
13430 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
13432 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13433 Change all callers. Simplify handling of symbols from sections
13434 not included in the link.
13435 (Symbol_table::add_from_dynobj): Handle ordinary symbol
13437 (Weak_alias_sorter::operator()): Assert that symbols are
13439 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13441 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13442 parameters. Change all callers.
13443 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
13444 symbol distinction. Use SHN_XINDEX when needed.
13445 (Symbol_table::write_section_symbol): Add symtab_xindex
13446 parameter. Change all callers.
13447 (Symbol_table::sized_write_section_symbol): Likewise. Use
13448 SHN_XINDEX when needed.
13449 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
13451 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
13452 (Symbol::is_defined): Check is_ordinary.
13453 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13454 (Symbol::is_absolute, Symbol::is_common): Likewise.
13455 (class Sized_symbol): Update declarations.
13456 (class Symbol_table): Update declarations.
13457 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13458 parameters. Change all callers.
13459 (Sized_symbol::override): Likewise.
13460 (Symbol_table::override): Likewise.
13461 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
13462 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
13463 is_ordinary, and orig_st_shndx parameters. Change all callers.
13464 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13465 to be in an ordinary section.
13466 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13467 object and is_ordinary parameters. Change all callers.
13468 (Sized_dwarf_line_info::read_relocs): Add object parameter.
13469 Change all callers. Don't add undefined or non-ordinary symbols
13471 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13472 Change all callers.
13473 * dwarf_reader.h (class Sized_dwarf_line_info): Update
13475 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13476 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13477 (Sized_relobj::relocate_sections): Likewise.
13478 * target-reloc.h (scan_relocs): Adjust section symbol index.
13479 (scan_relocatable_relocs): Likewise.
13480 * i386.cc (Scan::local): Check for ordinary symbols.
13481 * sparc.cc (Scan::local): Likewise.
13482 * x86_64.cc (Scan::local): Likewise.
13483 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13484 to symbol_section_and_value.
13485 * testsuite/many_sections_test.cc: New file.
13486 * testsuite/Makefile.am (BUILT_SOURCES): Define.
13487 (check_PROGRAMS): Add many_sections_test.
13488 (many_sections_test_SOURCES): Define.
13489 (many_sections_test_DEPENDENCIES): Define.
13490 (many_sections_test_LDFLAGS): Define.
13491 (BUILT_SOURCES): Add many_sections_define.h.
13492 (many_sections_define.h): New target.
13493 (BUILT_SOURCES): Add many_sections_check.h.
13494 (many_sections_check.h): New target.
13495 (check_PROGRAMS): Add many_sections_r_test.
13496 (many_sections_r_test_SOURCES): Define.
13497 (many_sections_r_test_DEPENDENCIES): Define.
13498 (many_sections_r_test_LDFLAGS): Define.
13499 (many_sections_r_test_LDADD): Define.
13500 (many_sections_r_test.o): New target.
13501 * testsuite/Makefile.in: Rebuild.
13503 2008-04-17 Cary Coutant <ccoutant@google.com>
13505 * errors.cc (Errors::info): New function.
13506 (gold_info): New function.
13507 * errors.h (Errors::info): New function.
13508 * gold.h (gold_info): New function.
13509 * object.cc (Input_objects::add_object): Print trace output.
13510 * options.cc (options::parse_set): New function.
13511 (General_options::parse_wrap): Deleted.
13512 (General_options::General_options): Deleted initializer.
13513 * options.h (options::String_set): New typedef.
13514 (options::parse_set): New function.
13515 (DEFINE_set): New macro.
13516 (General_options::wrap): Changed to use DEFINE_set. Changed
13517 callers of any_wrap_symbols and is_wrap_symbol.
13518 (General_options::trace, General_options::trace_symbol):
13520 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13521 (General_options::wrap_symbols_): Deleted.
13522 * symtab.cc (Symbol_table::add_from_object): Print trace output.
13524 2008-04-17 David S. Miller <davem@davemloft.net>
13526 * options.cc (General_options::parse_V): New function.
13527 * options.h: Add entries for -V and -Qy.
13529 2008-04-17 Ian Lance Taylor <iant@google.com>
13531 * common.cc (Symbol_table::allocate_commons): Remove options
13532 parameter. Change caller.
13533 (Symbol_table::do_allocate_commons): Remove options parameter.
13534 Change caller. Just call do_allocate_commons_list twice.
13535 (Symbol_table::do_allocate_commons_list): New function, broken out
13536 of do_allocate_commons.
13537 * common.h (class Allocate_commons_task): Remove options_ field.
13538 Update constructor.
13539 * symtab.cc (Symbol_table::Symbol_table): Initialize
13541 (Symbol_table::add_from_object): Put TLS common symbols on
13543 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13544 which are IN_OUTPUT_DATA.
13545 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
13546 allocate_commons and do_allocate_commons declarations. Declare
13547 do_allocate_commons_list.
13548 * gold.cc (queue_middle_tasks): Update creation of
13549 Allocate_commons_task to not pass options.
13550 * testsuite/Makefile.am (INCLUDES): Add -I.. .
13551 (TLS_TEST_C_FLAGS): New variable.
13552 (tls_test_c_pic.o): New target.
13553 (tls_test_shared.so): Link in tls_test_c_pic.o.
13554 (tls_test_c_pic_ie.o): New target.
13555 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13556 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13557 (tls_test_c.o): New target.
13558 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13559 (tls_pic_test_LDADD): Likewise.
13560 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13561 (tls_shared_gd_to_ie_test_LDADD): Likewise.
13562 (tls_test_c_gnu2.o): New target.
13563 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13565 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13566 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13567 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13568 * testsuite/tls_test.cc: Include "config.h".
13569 (t_last): Call t11_last.
13570 * testsuite/tls_test.h (t11, t11_last): Declare.
13571 * testsuite/tls_test_c.c: New file.
13572 * testsuite/tls_test_main.cc (thread_routine): Call t11.
13573 * configure.ac: Check for OpenMP support.
13574 * configure, config.in, Makefile.in: Rebuild.
13575 * testsuite/Makefile.in: Rebuild.
13577 2008-04-16 Cary Coutant <ccoutant@google.com>
13579 * i386.cc (Target_i386::define_tls_base_symbol): New function.
13580 (Target_i386::tls_base_symbol_defined_): New field.
13581 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13582 (Target_i386::Scan::global): Likewise.
13583 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13584 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13585 (Target_x86_64::tls_base_symbol_defined_): New field.
13586 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13587 (Target_x86_64::Scan::global): Likewise.
13589 2008-04-16 Cary Coutant <ccoutant@google.com>
13591 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13592 (Symbol::needs_plt_entry): Allow weak undefined symbols.
13593 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13594 building shared libraries.
13595 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13596 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13597 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13598 * testsuite/Makefile.in: Rebuild.
13599 * testsuite/weak_undef.h: New file.
13600 * testsuite/weak_undef_file1.cc: Add extra test cases.
13601 * testsuite/weak_undef_file2.cc: Likewise.
13602 * testsuite/weak_undef_test.cc: Likewise.
13604 2008-04-16 David S. Miller <davem@davemloft.net>
13606 * sparc.cc (Target_sparc::Scan): Change from struct to class.
13607 Add issued_non_pic_error_ field. Declare check_non_pic.
13608 (Target_sparc::Scan::check_non_pic): New function.
13609 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13610 (Target_sparc::Scan::global): Likewise.
13612 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13613 * configure: Rebuild.
13615 * options.h (DEFINE_enable): New macro.
13616 (new_dtags): New enable option.
13617 (initfirst, interpose, loadfltr, nodefaultlib,
13618 nodelete, nodlopen, nodump): New -z options.
13619 * layout.cc (Layout:finish_dynamic_section): If new
13620 dtags enabled, emit DT_RUNPATH. Also, emit a
13621 DT_FLAGS_1 containing any specified -z flags.
13623 2008-04-16 Ian Lance Taylor <iant@google.com>
13625 * copy-relocs.cc: New file.
13626 * copy-relocs.h: New file.
13627 * reloc.cc: Remove Copy_relocs code.
13628 * reloc.h: Likewise.
13629 * reloc-types.h (struct Reloc_types) [both versions]: Add
13630 get_reloc_addend_noerror.
13631 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13632 variants of add_global which take an addend which must be zero.
13633 * i386.cc: Include "copy-relocs.h".
13634 (class Target_i386): Change type of copy_relocs_ to variable,
13635 update initializer.
13636 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13637 Change all callers.
13638 (Target_i386::do_finalize_sections): Change handling of
13640 * sparc.cc: Include "copy-relocs.h".
13641 (class Target_sparc): Change type of copy_relocs_ to variable,
13642 update initializer.
13643 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13644 Change all callers.
13645 (Target_sparc::do_finalize_sections): Change handling of
13647 * x86_64.cc: Include "copy-relocs.h".
13648 (class Target_x86_64): Change type of copy_relocs_ to variable,
13649 update initializer.
13650 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13651 class. Change all callers.
13652 (Target_x86_64::do_finalize_sections): Change handling of
13654 * Makefile.am (CCFILES): Add copy-relocs.cc.
13655 (HFILES): Add copy-relocs.h.
13657 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13659 * testsuite/script_test_4.sh: Permit leading zeroes.
13661 2008-04-15 Ian Lance Taylor <iant@google.com>
13663 * script-sections.cc (Script_sections::create_segments): Use
13664 header_size_adjustment even when there is enough room for the
13666 * testsuite/script_test_4.sh: New file.
13667 * testsuite/script_test_4.t: New file.
13668 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13669 (check_DATA): Add script_test_4.stdout.
13670 (MOSTLYCLEANFILES): Likewise.
13671 (script_test_4): New target.
13672 (script_test_4.stdout): New target.
13673 * testsuite/Makefile.in: Rebuild.
13675 * sparc.cc: Add definitions for Output_data_plt_sparc class
13678 2008-04-14 David S. Miller <davem@davemloft.net>
13680 * sparc.cc: New file.
13681 * Makefile.am (TARGETSOURCES): Add sparc.cc
13682 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13683 * configure.tgt: Document targ_extra_size and
13684 targ_extra_big_endian. Add entries for sparc-* and
13686 * configure.ac: Handle targ_extra_size and
13687 targ_extra_big_endian.
13688 * Makefile.in: Rebuild.
13689 * configure: Likewise.
13690 * po/POTFILES.in: Likewise.
13691 * po/gold.pot: Likewise.
13693 2008-04-14 Ian Lance Taylor <iant@google.com>
13695 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13696 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13697 in the name/type/flags to section mapping. Don't call
13698 allocate_output_section.
13699 (Layout::choose_output_section): Change parameter from adjust_name
13700 to is_input_section. Don't permit input sections after sections
13701 are attached to segments. Don't call allocate_output_section.
13702 (Layout::layout_eh_frame): Call update_flags_for_input_section,
13703 not write_enable_output_section.
13704 (Layout::make_output_section): Don't push to
13705 unattached_section_list_ nor call attach_to_segment. Call
13706 attach_section_to_segment if sections are attached.
13707 (Layout::attach_sections_to_segments): New function.
13708 (Layout::attach_section_to_segment): New function.
13709 (Layout::attach_allocated_section_to_segment): Rename from
13710 attach_to_segment. Remove flags parameter.
13711 (Layout::allocate_output_section): Remove function.
13712 (Layout::write_enable_output_section): Remove function.
13713 * layout.h (class Layout): Update for above changes. Add new
13714 field sections_are_attached_.
13715 * output.h (Output_section::update_flags_for_input_section): New
13717 * output.cc (Output_section::add_input_section): Call
13718 update_flags_for_input_section.
13719 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13721 2008-04-11 Cary Coutant <ccoutant@google.com>
13723 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13724 thought unnecessary.
13725 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13727 2008-04-11 Ian Lance Taylor <iant@google.com>
13729 * output.h (class Output_section_data): Remove inline definition
13731 * output.cc (Output_section_data::set_addralign): New function.
13733 2008-04-11 Cary Coutant <ccoutant@google.com>
13735 Add support for TLS descriptors for i386 and x86_64.
13736 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13737 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13738 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13740 (Target_i386::got_mod_index_entry): Remove unnecessary code.
13741 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13742 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
13744 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13745 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13746 Fix problem with initial-exec relocations.
13747 (Target_i386::Relocate::relocate_tls): Likewise.
13748 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13750 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13751 support for section-plus-offset dynamic table entries.
13752 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13753 (Output_data_dynamic::Dynamic_entry): Add support for
13754 section-plus-offset dynamic table entries.
13755 (Output_data_dynamic::Classification): Likewise.
13756 (Output_data_dynamic::classification_): Renamed offset_.
13757 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13758 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13759 (Target_x86_64::make_plt_section): New function.
13760 (Target_x86_64::reserve_tlsdesc_entries): New function.
13761 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13762 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13763 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13764 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13765 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13766 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13767 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13768 add extra PLT entry for TLS descriptors.
13769 (Output_data_plt_x86_64::got_): New field.
13770 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13771 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13773 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13775 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13776 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13777 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13778 R_386_TLS_DESC_CALL relocations.
13779 (Target_x86_64::Scan::global): Likewise.
13780 (Target_x86_64::do_finalize_sections): Add dynamic table entries
13781 for TLS descriptors.
13782 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13783 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13784 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13785 GD-to-IE relaxation.
13786 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13787 and TLS_DESCRIPTORS.
13788 * Makefile.in: Rebuild.
13789 * configure: Rebuild.
13790 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13791 (tls_test_shared2.so): New target.
13792 (tls_shared_gd_to_ie_test_SOURCES): New variable.
13793 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13794 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13795 (tls_shared_gd_to_ie_test_LDADD): New variable.
13796 (tls_shared_gnu2_gd_to_ie_test): New target.
13797 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13799 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13800 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13801 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13802 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13803 (tls_shared_gnu2_test): New target.
13804 (tls_test_gnu2_shared.so): New target.
13805 (tls_shared_gnu2_test_SOURCES): New variable.
13806 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13807 (tls_shared_gnu2_test_LDFLAGS): New variable.
13808 (tls_shared_gnu2_test_LDADD): New variable.
13809 * testsuite/Makefile.in: Rebuild.
13810 * testsuite/Makefile.
13812 2008-04-11 Ian Lance Taylor <iant@google.com>
13814 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13816 * testsuite/Makefile.in: Rebuild.
13818 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13820 * testsuite/script_test_2.cc (main): Adjust test.
13822 2008-04-11 David S. Miller <davem@davemloft.net>
13823 Ian Lance Taylor <iant@google.com>
13825 * options.h (General_options): Add entries for '-Y' and
13827 * options.cc (General_options:finalize): If -Y was used, add those
13828 entries to the library path instead of the default "/lib" and
13831 2008-04-11 David S. Miller <davem@davemloft.net>
13833 * testsuite/justsyms.t: Start at 0x100.
13834 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13835 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13837 * testsuite/script_test_2.cc: Adjust string and section length
13840 2008-04-09 Ian Lance Taylor <iant@google.com>
13843 * script-sections.cc (Sections_element::allocate_to_segment): Add
13845 (Output_section_definition::allocate_to_segment): Likewise.
13846 (Orphan_output_section::allocate_to_segment): Likewise.
13847 (Script_sections::attach_sections_using_phdrs_clause): Don't
13848 propagate non-PT_LOAD segments to orphan sections.
13849 * testsuite/Makefile.am (script_test_3.stdout): Generate using
13850 readelf rather than objdump.
13851 * testsuite/script_test_3.sh: Adjust accordingly. Test that
13852 .interp section and PT_INTERP segment are the same size.
13853 * testsuite/Makefile.in: Rebuild.
13855 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13856 aliases for symbols defined in the same object.
13857 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13858 (weak_alias_test_SOURCES): New variable.
13859 (weak_alias_test_DEPENDENCIES): New variable.
13860 (weak_alias_test_LDFLAGS): New variable.
13861 (weak_alias_test_LDADD): New variable.
13862 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13863 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13864 (weak_alias_test_3.o): New target.
13865 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13866 * testsuite/weak_alias_test_main.cc: New file.
13867 * testsuite/weak_alias_test_1.cc: New file.
13868 * testsuite/weak_alias_test_2.cc: New file.
13869 * testsuite/weak_alias_test_3.cc: New file.
13871 2008-04-08 Ian Lance Taylor <iant@google.com>
13873 * options.h (class General_options): Add --noinhibit-exec option.
13874 * main.cc (main): Check --noinhibit-exec.
13876 * options.h (class General_options): Define --wrap as a special
13877 option. Add wrap_symbols_ field.
13878 (General_options::any_wrap_symbols): New function.
13879 (General_options::is_wrap_symbol): New function.
13880 * options.cc (General_options::parse_wrap): New function.
13881 (General_options::General_options): Initialize wrap_symbols_.
13882 * symtab.cc (Symbol_table::wrap_symbol): New function.
13883 (Symbol_table::add_from_object): Handle --wrap.
13884 * symtab.h (class Symbol_table): Declare wrap_symbol.
13885 * target.h (Target::wrap_char): New function.
13886 (Target::Target_info): Add wrap_char field.
13887 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13888 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13889 * testsuite/testfile.cc (Target_test::test_target_info):
13892 * errors.cc (Errors::undefined_symbol): Mention symbol version if
13895 * layout.h (class Layout): Add added_eh_frame_data_ field.
13896 * layout.cc (Layout::Layout): Initialize new field.
13897 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13898 output section until we find a section we merged successfully.
13899 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13900 that the size be non-zero.
13902 * merge.cc (Object_merge_map::get_output_offset): Remove inline
13905 2008-04-08 Craig Silverstein <csilvers@google.com>
13907 * configure.ac: Export new conditional variable HAVE_ZLIB.
13908 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13910 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13911 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13913 2008-04-07 Ian Lance Taylor <iant@google.com>
13915 * version.cc (version_string): Set to "1.5".
13917 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13918 Add issued_non_pic_error_ field. Declare check_non_pic.
13919 (Target_x86_64::Scan::check_non_pic): New function.
13920 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13921 (Target_x86_64::Scan::global): Likewise.
13923 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13924 addend parameter. Change caller. Handle merge sections.
13925 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13926 Address to Addend. Don't add in the result of
13927 local_section_offset, pass down the addend and use the returned
13929 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13930 Update declarations of local_section_offset and symbol_value.
13931 * testsuite/two_file_test_1.cc (t18): New function.
13932 * testsuite/two_file_test_2.cc (f18): New function.
13933 * testsuite/two_file_test_main.cc (main): Call t18.
13934 * testsuite/two_file_test.h (t18, f18): Declare.
13936 * configure.ac: Don't test for objdump, c++filt, or readelf.
13937 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13939 (TEST_READELF): New variable.
13940 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13941 (check_PROGRAMS): Add two_file_strip_test.
13942 (two_file_strip_test): New target.
13943 (check_PROGRAMS): Add two_file_same_shared_strip_test.
13944 (two_file_same_shared_strip_test_SOURCES): New variable.
13945 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13946 (two_file_same_shared_strip_test_LDFLAGS): New variable.
13947 (two_file_same_shared_strip_test_LDADD): New variable.
13948 (two_file_shared_strip.so): New target.
13949 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13950 (ver_test_5.syms, ver_test_7.syms): Likewise.
13951 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13952 (strip_test_3.stdout): Use TEST_OBJDUMP.
13953 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13955 2008-04-04 Cary Coutant <ccoutant@google.com>
13957 * symtab.h (Symbol::is_weak_undefined): New function.
13958 (Symbol::is_strong_undefined): New function.
13959 (Symbol::is_absolute): New function.
13960 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13961 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13963 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13964 (weak_undef_test): New target.
13965 * testsuite/Makefile.in: Rebuild.
13966 * testsuite/weak_undef_file1.cc: New file.
13967 * testsuite/weak_undef_file2.cc: New file.
13968 * testsuite/weak_undef_test.cc: New file.
13970 2008-04-03 Craig Silverstein <csilvers@google.com>
13972 * compressed_output.h (class Output_compressed_section): Use
13974 * compressed_output.cc (zlib_compress): Use unsigned buffers,
13976 (zlib_compressed_suffix): Removed.
13977 (Output_compressed_section::set_final_data_size): Use unsigned
13979 * testsuite/Makefile.am (flagstest_compress_debug_sections):
13980 Fix linker invocation.
13981 (flagstest_o_specialfile_and_compress_debug_sections):
13983 * testsuite/Makefile.in: Regenerated.
13985 2008-04-02 David S. Miller <davem@davemloft.net>
13987 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13988 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13990 2008-04-02 Craig Silverstein <csilvers@google.com>
13994 2008-04-02 Ian Lance Taylor <iant@google.com>
13996 * fileread.cc (File_read::find_view): Add byteshift and vshifted
13997 parameters. Update for new key type to views_. Change all
13999 (File_read::read): Adjust for byteshift in returned view.
14000 (File_read::add_view): New function, broken out of
14001 find_and_make_view.
14002 (File_read::make_view): New function, broken out of
14003 find_and_make_view.
14004 (File_read::find_or_make_view): Add offset and aligned
14005 parameters. Rewrite accordingly. Change all callers.
14006 (File_read::get_view): Add offset and aligned parameters. Adjust
14007 for byteshift in return value.
14008 (File_read::get_lasting_view): Likewise.
14009 * fileread.h (class File_read): Update declarations.
14010 (class File_read::View): Add byteshift_ field. Add byteshift to
14011 constructor. Add byteshift method.
14012 * archive.h (Archive::clear_uncached_views): New function.
14013 (Archive::get_view): Add aligned parameter. Change all callers.
14014 * object.h (Object::get_view): Add aligned parameter. Change all
14016 (Object::get_lasting_view): Likewise.
14018 * fileread.cc (File_read::release): Don't call clear_views if
14019 there are multiple objects.
14020 * fileread.h (File_read::clear_uncached_views): New function.
14021 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14024 2008-03-31 Cary Coutant <ccoutant@google.com>
14026 Add thin archive support.
14027 * archive.cc (Archive::armagt): New const.
14028 (Archive::setup): Remove task parameter and calls to unlock.
14029 (Archive::unlock_nested_archives): New function.
14030 (Archive::read_header): Add nested_off parameter. Change
14032 (Archive::interpret_header): Likewise.
14033 (Archive::include_all_members): Change to handle thin
14035 (Archive::include_member): Likewise.
14036 * archive.h (Archive::Archive): Add new parameters and
14038 (Archive::armagt): New const.
14039 (Archive::setup): Remove task parameter.
14040 (Archive::unlock_nested_archives): New function.
14041 (Archive::read_header): Add nested_off parameter.
14042 (Archive::interpret_header): Likewise.
14043 (Archive::Nested_archive_table): New typedef.
14044 (Archive::is_thin_archive_): New field.
14045 (Archive::nested_archives_): New field.
14046 (Archive::options_): New field.
14047 (Archive::dirpath_): New field.
14048 (Archive::task_): New field.
14049 * readsyms.cc (Read_symbols::do_read_symbols): Add check
14050 for thin archives. Pass additional parameters to
14051 Archive::Archive. Unlock the archive file after calling
14054 2008-03-29 Ian Lance Taylor <iant@google.com>
14056 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14057 version symbol to be local.
14058 * testsuite/ver_test_4.sh: New file.
14059 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14060 (check_DATA): Add ver_test_4.syms.
14061 (ver_test_4.syms): New target.
14062 * testsuite/Makefile.in: Rebuild.
14065 (Output_section::Input_section_sort_entry::has_priority): New
14067 (Output_section::Input_section_sort_entry::match_file_name): New
14069 (Output_section::Input_section_sort_entry::match_section_name):
14071 (Output_section::Input_section_sort_entry::match_section_name_prefix):
14073 (Output_section::Input_section_sort_entry::match_section_file):
14075 (Output_section::Input_section_sort_compare::operator()): Rewrite
14076 using new Input_section_sort_entry functions. Sort crtbegin and
14077 crtend first. Sort sections with no priority before sections with
14079 * testsuite/initpri1.c (d3): Check j != 4.
14080 (cd5): New constructor/destructor function.
14081 (main): Check j != 2.
14083 * symtab.cc (Symbol_table::add_from_object): If we don't use the
14084 new symbol when resolving, don't call set_is_default.
14085 * testsuite/ver_test_7.cc: New file.
14086 * testsuite/ver_test_7.sh: New file.
14087 * testsuite/Makefile.am (ver_test_7.so): New target.
14088 (ver_test_7.o): New target.
14089 (check_SCRIPTS): Add ver_test_7.sh.
14090 (check_DATA): Add ver_test_7.syms.
14091 (ver_test_7.syms): New target.
14093 2008-03-28 Ian Lance Taylor <iant@google.com>
14095 * layout.cc (Layout::layout): If we see an input section with a
14096 name that needs sorting, set the must_sort flag for the output
14098 (Layout::make_output_section): If the name of the output section
14099 indicates that it might require sorting, set the may_sort flag.
14100 * output.h (Output_section::may_sort_attached_input_sections): New
14102 (Output_section::set_may_sort_attached_input_sections): New
14104 (Output_section::must_sort_attached_input_sections): New
14106 (Output_section::set_must_sort_attached_input_sections): New
14108 (class Output_section): Declare Input_section_sort_entry. Define
14109 Input_section_sort_compare. Declare
14110 sort_attached_input_sections. Add new fields:
14111 may_sort_attached_input_sections_,
14112 must_sort_attached_input_sections_,
14113 attached_input_sections_are_sorted_.
14114 * output.cc (Output_section::Output_section): Initialize new
14116 (Output_section::add_input_section): Add an entry to
14117 input_sections_ if may_sort or must_sort are true.
14118 (Output_section::set_final_data_size): Call
14119 sort_attached_input_sections if necessary.
14120 (Output_section::Input_section_sort_entry): Define new class.
14121 (Output_section::Input_section_sort_compare::operator()): New
14123 (Output_section::sort_attached_input_sections): New function.
14124 * configure.ac: Check whether the compiler supports constructor
14125 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
14126 * testsuite/initpri1.c: New file.
14127 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14128 CONSTRUCTOR_PRIORITY.
14129 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14130 (initpri1_LDFLAGS): New variable.
14131 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14133 2008-03-27 Ian Lance Taylor <iant@google.com>
14135 * common.cc (Sort_commons::operator): Correct sorting algorithm.
14136 * testsuite/common_test_1.c: New file.
14137 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14138 (common_test_1_SOURCES): New variable.
14139 (common_test_1_DEPENDENCIES): New variable.
14140 (common_test_1_LDFLAGS): New variable.
14142 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14143 and commons_ correctly when NAME/VERSION does not override
14145 * testsuite/ver_test_6.c: New file.
14146 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14147 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14148 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14150 2008-03-26 Ian Lance Taylor <iant@google.com>
14152 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14153 of an undefined symbol from a version script.
14154 * testsuite/Makefile.am (ver_test_5.so): New target.
14155 (ver_test_5.o): New target.
14156 (check_SCRIPTS): Add ver_test_5.sh.
14157 (check_DATA): Add ver_test_5.syms.
14158 (ver_test_5.syms): New target.
14159 * testsuite/ver_test_5.cc: New file.
14160 * testsuite/ver_test_5.script: New file.
14161 * testsuite/ver_test_5.sh: New file.
14162 * Makefile.in, testsuite/Makefile.in: Rebuild.
14165 Fix problems building gold with gcc 4.3.0.
14166 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14167 (gold_error_at_location, gold_warning_at_location): Use it.
14168 * configure.ac: Check whether we can compile and use a template
14169 function with a printf attribute.
14170 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14171 when jumping over bytes.
14172 * object.cc: Instantiate Object::read_section_data.
14173 * debug.h: Include <cstring>
14174 * dwarf_reader.cc: Include <algorithm>
14175 * main.cc: Include <cstring>.
14176 * options.cc: Include <cstring>.
14177 * output.cc: Include <cstring>.
14178 * script.cc: Include <cstring>.
14179 * script.h: Include <string>.
14180 * symtab.cc: Include <cstring> and <algorithm>.
14181 * target-select.cc: Include <cstring>.
14182 * version.cc: Include <string>.
14183 * testsuite/testmain.cc: Include <cstdlib>.
14184 * configure, config.in: Rebuild.
14186 2008-03-25 Ian Lance Taylor <iant@google.com>
14188 * options.cc: Include "../bfd/bfdver.h".
14189 (options::help): Print bug reporting address.
14191 * version.cc (print_version): Adjust output for current value of
14192 BFD_VERSION_STRING.
14196 * options.cc (options::help): Print list of supported targets.
14197 * target-select.h: Include <vector>.
14198 (class Target_selector): Make machine_, size_, and is_big_endian_
14199 fields const. Add bfd_name_ and instantiated_target_ fields.
14200 (Target_selector::Target_selector): Add bfd_name parameter.
14201 (Target_selector::recognize): Make non-virtual, call
14203 (Target_selector::recognize_by_name): Make non-virtual, call
14204 do_recognize_by_name.
14205 (Target_selector::supported_names): New function.
14206 (Target_selector::bfd_name): New function.
14207 (Target_selector::do_instantiate_target): New pure virtual
14209 (Target_selector::do_recognize): New virtual function.
14210 (Target_selector::do_recognize_by_name): New virtual function.
14211 (Target_selector::instantiate_target): New private function.
14212 (supported_target_names): Declare.
14213 * target-select.cc (Target_selector::Target_selector): Update for
14214 new parameter and fields.
14215 (select_target_by_name): Check that the name matches before
14216 calling recognize_by_name.
14217 (supported_target_names): New function.
14218 * i386.cc (class Target_selector_i386): Update Target_selector
14219 constructor call. Remove recognize and recognize_by_name. Add
14220 do_instantiate_target.
14221 * x86_64.cc (class Target_selector_x86_64): Likewise.
14222 * testsuite/testfile.cc (class Target_selector_test): Update for
14223 changes to Target_selector.
14225 * README: Rewrite, with some notes on unsupported features.
14227 2008-03-24 Cary Coutant <ccoutant@google.com>
14229 * i386.cc (Target_i386::Got_type): New enum declaration.
14230 (Target_i386::Scan::local): Updated callers of Output_data_got
14232 (Target_i386::Scan::global): Likewise.
14233 (Target_i386::Relocate::relocate): Likewise.
14234 (Target_i386::Relocate::relocate_tls): Likewise.
14235 * object.h (Got_offset_list): New class.
14236 (Sized_relobj::local_has_got_offset): Added got_type parameter.
14237 (Sized_relobj::local_got_offset): Likewise.
14238 (Sized_relobj::set_local_got_offset): Likewise.
14239 (Sized_relobj::local_has_tls_got_offset): Removed.
14240 (Sized_relobj::local_tls_got_offset): Removed.
14241 (Sized_relobj::set_local_tls_got_offset): Removed.
14242 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14243 * output.cc (Output_data_got::add_global): Added got_type parameter.
14244 (Output_data_got::add_global_with_rel): Likewise.
14245 (Output_data_got::add_global_with_rela): Likewise.
14246 (Output_data_got::add_global_pair_with_rel): New function.
14247 (Output_data_got::add_global_pair_with_rela): New function.
14248 (Output_data_got::add_local): Added got_type parameter.
14249 (Output_data_got::add_local_with_rel): Likewise.
14250 (Output_data_got::add_local_with_rela): Likewise.
14251 (Output_data_got::add_local_pair_with_rel): New function.
14252 (Output_data_got::add_local_pair_with_rela): New function.
14253 (Output_data_got::add_global_tls): Removed.
14254 (Output_data_got::add_global_tls_with_rel): Removed.
14255 (Output_data_got::add_global_tls_with_rela): Removed.
14256 (Output_data_got::add_local_tls): Removed.
14257 (Output_data_got::add_local_tls_with_rel): Removed.
14258 (Output_data_got::add_local_tls_with_rela): Removed.
14259 * output.h (Output_data_got::add_global): Added got_type parameter.
14260 (Output_data_got::add_global_with_rel): Likewise.
14261 (Output_data_got::add_global_with_rela): Likewise.
14262 (Output_data_got::add_global_pair_with_rel): New function.
14263 (Output_data_got::add_global_pair_with_rela): New function.
14264 (Output_data_got::add_local): Added got_type parameter.
14265 (Output_data_got::add_local_with_rel): Likewise.
14266 (Output_data_got::add_local_with_rela): Likewise.
14267 (Output_data_got::add_local_pair_with_rel): New function.
14268 (Output_data_got::add_local_pair_with_rela): New function.
14269 (Output_data_got::add_global_tls): Removed.
14270 (Output_data_got::add_global_tls_with_rel): Removed.
14271 (Output_data_got::add_global_tls_with_rela): Removed.
14272 (Output_data_got::add_local_tls): Removed.
14273 (Output_data_got::add_local_tls_with_rel): Removed.
14274 (Output_data_got::add_local_tls_with_rela): Removed.
14275 * resolve.cc (Symbol::override_base_with_special): Removed
14276 reference to has_got_offset_ field.
14277 * symtab.cc (Symbol::init_fields): Replaced initialization
14278 of got_offset_ with got_offsets_. Removed initialization
14280 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14281 (Symbol::got_offset): Likewise.
14282 (Symbol::set_got_offset): Likewise.
14283 (Symbol::has_tls_got_offset): Removed.
14284 (Symbol::tls_got_offset): Removed.
14285 (Symbol::set_tls_got_offset): Removed.
14286 (Symbol::got_offset_): Removed.
14287 (Symbol::tls_mod_got_offset_): Removed.
14288 (Symbol::tls_pair_got_offset_): Removed.
14289 (Symbol::got_offsets_): New field.
14290 (Symbol::has_got_offset): Removed.
14291 (Symbol::has_tls_mod_got_offset): Removed.
14292 (Symbol::has_tls_pair_got_offset): Removed.
14293 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14294 (Target_x86_64::Scan::local): Updated callers of Output_data_got
14296 (Target_x86_64::Scan::global): Likewise.
14297 (Target_x86_64::Relocate::relocate): Likewise.
14298 (Target_x86_64::Relocate::relocate_tls): Likewise.
14300 2008-03-25 Ben Elliston <bje@au.ibm.com>
14302 * yyscript.y: Fix spelling error in comment.
14304 2008-03-24 Ian Lance Taylor <iant@google.com>
14306 * options.h (class General_options): Define build_id option.
14307 * layout.h (class Layout): Declare write_build_id, create_note,
14308 create_build_id. Add build_id_note_ member.
14309 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14310 "libiberty.h", "md5.h", "sha1.h".
14311 (Layout::Layout): Initialize eh_frame_data_,
14312 eh_frame_hdr_section_, and build_id_note_.
14313 (Layout::finalize): Call create_build_id.
14314 (Layout::create_note): New function, broken out of
14315 Layout::create_gold_note.
14316 (Layout::create_gold_note): Call create_note.
14317 (Layout::create_build_id): New function.
14318 (Layout::write_build_id): New function.
14319 (Close_task_runner::run): Call write_build_id.
14321 * x86_64.cc: Correct license to GPLv3.
14323 2008-03-23 Ian Lance Taylor <iant@google.com>
14325 * options.cc: Include "demangle.h".
14326 (parse_optional_string): New function.
14327 (parse_long_option): Handle takes_optional_argument.
14328 (parse_short_option): Update dash_z initializer. Handle
14329 takes_optional_argument.
14330 (General_options::General_options): Initialize do_demangle_.
14331 (General_options::finalize): Set do_demangle_. Handle demangling
14333 * options.h (parse_optional_string): Declare.
14334 (struct One_option): Add optional_arg field. Update constructor.
14335 Update call constructor calls. Add takes_optional_argument
14337 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
14338 (DEFINE_optional_string): Define.
14339 (General_options::demangle): Change from DEFINE_bool to
14340 DEFINE_optional_string.
14341 (General_options::no_demangle): New function.
14342 (General_options::do_demangle): New function.
14343 (General_options::set_do_demangle): New function.
14344 (General_options::execstack_status_): Move definition to end of
14346 (General_options::static_): Likewise.
14347 (General_options::do_demangle_): New field.
14348 * object.cc (big_endian>::get_symbol_location_info): Call
14349 Options::do_demangle, not Options::demangle.
14350 * symtab.cc (demangle): Likewise.
14352 2008-03-22 Ian Lance Taylor <iant@google.com>
14354 * gold.h: Include <cstddef> and <sys/types.h>
14355 * options.h: Include <cstring>.
14357 2008-03-21 Ian Lance Taylor <iant@google.com>
14359 * Added source code to GNU binutils.
14361 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14363 Copying and distribution of this file, with or without modification,
14364 are permitted in any medium without royalty provided the copyright
14365 notice and this notice are preserved.
14371 version-control: never