1 2013-03-04 Alan Modra <amodra@gmail.com>
3 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
4 * testsuite/Makefile.in: Regenerate.
6 2013-03-01 Cary Coutant <ccoutant@google.com>
8 Add dwp support for v2 DWARF package file format.
9 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
10 tu_length parameter. Adjust all callers.
11 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
12 * dwp.cc: Include dwarf.h.
13 (Section_bounds): New struct type.
14 (Unit_set): New struct type.
15 (Dwo_file::Dwo_file): Initialize new data member.
16 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
17 Combine and rename to...
18 (Dwo_file::read_unit_index): ...this.
19 (Dwo_file::sized_read_compunit_index)
20 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
21 (Dwo_file::sized_read_unit_index): ...this.
22 (Dwo_file::copy_section): Remove section_name, is_str_offsets
23 parameters; add section_id parameter.
24 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
25 (Dwo_file::add_unit_set): ...this.
26 (Dwo_file::shndx_map_): Remove.
27 (Dwo_file::sect_offsets_): New data member.
28 (Dwp_output_file::Dwp_output_file): Initialize new data members.
29 (Dwp_output_file::add_section): Rename to...
30 (Dwp_output_file::add_contribution): ...this.
31 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
32 (Dwp_output_file::add_tu_set): Likewise.
33 (Dwp_output_file::Contribution): New type.
34 (Dwp_output_file::Section::contributions): New data member.
35 (Dwp_output_file::Cu_or_tu_set): Remove.
36 (Dwp_output_file::Section::Section): New ctor.
37 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
38 (Dwp_output_file::Dwp_index::Section_table): New type.
39 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
40 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
42 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
43 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
44 (Dwp_output_file::Dwp_index::section_table): New member function.
45 (Dwp_output_file::Dwp_index::section_table_end): New member function.
46 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
47 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
48 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
49 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
50 (Dwp_output_file::Dwp_index::section_table_): New data member.
51 (Dwp_output_file::Dwp_index::section_mask_): New data member.
52 (Dwp_output_file::add_output_section): New member function.
53 (Dwp_output_file::write_new_section): New member function.
54 (Dwp_output_file::write_contributions): New member function.
55 (Dwp_output_file::section_id_map_): New data member.
56 (class Dwo_id_info_reader): Remove.
57 (class Unit_reader): New class.
58 (get_dwarf_section_name): New function.
59 (Dwo_file::read_executable): Adjust initializations of class data.
60 (Dwo_file::read): Add support for v2 package file format.
61 (Dwo_file::read_unit_index): Likewise.
62 (Dwo_file::sized_read_unit_index): Likewise.
63 (Dwo_file::copy_section): Likewise.
64 (Dwo_file::add_unit_set): Likewise.
65 (Dwp_output_file::add_output_section): Likewise.
66 (Dwp_output_file::add_contribution): Likewise.
67 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
69 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
71 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
73 (Dwp_output_file::initialize): Remove unused function.
74 (Dwp_output_file::finalize): Add support for v2 package file format.
75 (Dwp_output_file::write_index): Likewise.
76 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
79 2013-03-01 Cary Coutant <ccoutant@google.com>
81 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
82 function into class definition in header file.
83 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
84 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
86 (Dwarf_info_reader::check_buffer): Move here from .cc file.
88 2013-02-28 Alan Modra <amodra@gmail.com>
90 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
91 * target.cc (Target::do_plt_fde_location): New function.
92 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
93 accessor function, and constructor param.
94 (struct Post_fde, Post_fdes): Declare.
95 (Cie::write): Add post_fdes param.
96 * ehframe.cc (Fde::write): Use plt_fde_location.
97 (struct Post_fde): Define.
98 (Cie::write): Stash FDEs added post merge mapping.
99 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
100 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
101 (Eh_frame::do_sized_write): Arrange to write post map FDES after
103 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
104 (Target_powerpc::has_glink): New function.
105 (Target_powerpc::do_relax): Add eh_frame info for stubs.
106 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
107 glink_eh_frame_fde_32, default_fde): New data.
108 (Stub_table::eh_frame_added_): New var.
109 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
111 (Stub_table::add_eh_frame): New function.
112 (Output_data_glink::add_eh_frame): New function.
113 (Target_powerpc::make_glink_section): Call add_eh_frame.
115 2013-02-15 Ian Lance Taylor <iant@google.com>
117 * options.h (DEFINE_uint64_alias): Define.
118 (class General_options): Add -Ttext-segment as an alias for
121 2013-02-15 Alan Modra <amodra@gmail.com>
123 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
124 (Stub_table::do_write): ..here, two places.
125 (Stub_table::plt_call_size): Use it here too.
127 2013-02-11 Ian Lance Taylor <iant@google.com>
129 * descriptors.cc (Descriptors::close_all): New function.
130 * descriptors.h (class Descriptors): Declare close_all.
131 (close_all_descriptors): New inline function.
132 * plugin.cc: Include "descriptors.h".
133 (Plugin_manager::cleanup): Call close_all_descriptors.
135 2013-02-06 Alan Modra <amodra@gmail.com>
137 * README: Update coding style link.
139 2013-01-28 Cary Coutant <ccoutant@google.com>
141 * dwp.cc (File_list): New typedef.
142 (Dwo_name_info_reader): New class.
143 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
144 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
145 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
146 (Dwo_file::read_executable): New function.
147 (Dwo_file::read): Move common setup code to ...
148 (Dwo_file::make_object): ... here.
149 (dwp_options): Add --exec/-e.
153 2013-01-24 Sriraman Tallam <tmsriram@google.com>
155 * layout.cc (Layout::layout): Check for option text_reorder.
156 (Layout::make_output_section): Ditto.
157 * options.h (text_reorder): New option.
158 * output.cc (Input_section_sort_compare): Remove special ordering
161 Input_section_sort_section_name_special_ordering_compare::
162 operator()): New function.
163 (Output_section::sort_attached_input_sections): Use new sort function
165 * output.h (Input_section_sort_section_name_special_ordering_compare):
167 * testsuite/Makefile.am (text_section_grouping): Test option
169 * testsuite/Makefile.in: Regenerate.
170 * testsuite/text_section_grouping.sh: Check order of functions without
171 default text reordering.
173 2013-01-18 Mike Frysinger <vapier@gentoo.org>
175 * options.h (General_options): Change default to true for new_dtags.
177 2013-01-18 Mike Frysinger <vapier@gentoo.org>
179 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
180 when enable_new_dtags is false. Only add DT_RUNPATH when
181 enable_new_dtags is true.
183 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
185 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
186 used in declaration and definition consistent.
187 (Target_powerpc::symval_for_branch): Ditto.
189 2013-01-16 Sriraman Tallam <tmsriram@google.com>
191 * testsuite/plugin_final_layout.cc: Fix comment.
193 2013-01-16 Sriraman Tallam <tmsriram@google.com>
195 * layout.cc (Layout::layout): Do not do default sorting for
196 text sections when section ordering is specified.
197 (make_output_section): Ditto.
198 * testsuite/plugin_final_layout.cc: Name the function sections
199 to catch reordering issues.
201 2013-01-15 Alan Modra <amodra@gmail.com>
203 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
206 2013-01-15 Alan Modra <amodra@gmail.com>
208 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
209 * testsuite/Makefile.in: Regenerate.
211 2013-01-14 Alan Modra <amodra@gmail.com>
213 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
214 * testsuite/Makefile.in: Regenerate.
216 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
219 Fix mingw gold build with plugins enabled
220 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
221 * configure.ac: Export DLOPEN_LIBS and add headers check.
222 * plugin.cc: Handle non-dlfcn case.
223 * Makefile.in: Regenerate.
224 * config.in: Regenerate.
225 * configure: Regenerate.
226 * testsuite/Makefile.in: Regenerate.
228 2013-01-09 Sriraman Tallam <tmsriram@google.com>
230 * output.h (sort_attached_input_sections): Change to be public.
232 (Output_section_definition::set_section_addresses): Sort
233 attached input sections according to section order before linker
234 script assigns section addresses.
235 (Orphan_output_section::set_section_addresses): Sort
236 attached input sections according to section order before linker
237 script assigns section addresses.
238 * Makefile.am (final_layout.sh): Use a simple linker script to
239 check if section ordering still works.
240 * Makefile.in: Regenerate.
242 2013-01-09 Ben Cheng <bccheng@google.com>
244 * arm.cc (Target_arm::attributes_accept_div): New function.
245 (Target_arm::attributes_forbid_div): New function.
246 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
247 attribute using the same new functions as what bfd/elf32_arm.c
250 2013-01-07 Cary Coutant <ccoutant@google.com>
253 * output.cc (Output_section::add_input_section): For incremental
254 updates, don't track input sections that are allocated from patch
257 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
258 Ian Lance Taylor <iant@google.com>
261 * configure.ac (--enable-ld): Removed.
262 (install_as_default): Set to yes only for --enable-gold=default
264 * configure: Regenerated.
266 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
268 * options.h (General_options): Add -fuse-ld= for GCC linker
269 option compatibility.
271 2013-01-04 Cary Coutant <ccoutant@google.com>
273 * configure.ac: Fix typo restoring CXXFLAGS.
274 * configure: Regenerate.
276 2013-01-04 Cary Coutant <ccoutant@google.com>
278 * testsuite/Makefile.am (CXXLINK_S): New macro.
279 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
280 * testsuite/Makefile.in: Regenerate.
282 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
284 * version.cc (print_version): Update copyright year to 2013.
286 2012-12-20 Ian Lance Taylor <iant@google.com>
288 * layout.cc (Layout::special_ordering_of_input_section): New
290 (Layout::layout): If input section requires special ordering, must
292 (Layout::make_output_section): May sort .text input sections.
293 (Layout::is_section_name_prefix_grouped): Remove.
294 * layout.h (class Layout): Declare
295 special_ordering_of_input_section. Don't declare
296 is_section_name_prefix_grouped.
297 * output.cc (Output_section::add_input_section): Revert last
299 (Output_section::Input_section_sort::match_file_name): Don't crash
300 if called on output section data.
301 (Output_section::Input_section_sort_compare): Sort based on
303 (Output_section::Input_section_sort_section_order_index_compare):
305 (Output_section::sort_attached_input_sections): Likewise.
307 2012-12-18 Sriraman Tallam <tmsriram@google.com>
309 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
310 * layout.h (Layout::is_section_name_prefix_grouped): New function.
311 * output.cc (Output_section::add_input_section): Check if section
312 name contains special prefix. Keep input sections to sort such
314 (Output_section::Input_section_sort_section_order_index_compare
315 ::operator()): Group sections according to prefixes.
316 (Output_section::sort_attached_input_sections): Add condition to
317 Input_section_entry constructor call.
318 * testsuite/Makefile.am (text_section_grouping): New test.
319 * testsuite/Makefile.in: Regenerate.
320 * testsuite/text_section_grouping.cc: New file.
321 * testsuite/text_section_grouping.sh: New file.
323 2012-12-17 Nick Clifton <nickc@redhat.com>
325 * Makefile.am: Add copyright notice.
328 * configure.ac: Likewise.
329 * ftruncate.c: Likewise.
330 * Makefile.in: Regenerate.
332 2012-12-14 Cary Coutant <ccoutant@google.com>
334 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
336 (exception_separate_shared_12_test): Likewise.
337 (incremental_copy_test): Likewise.
338 * testsuite/Makefile.in: Regenerate.
340 2012-12-14 Cary Coutant <ccoutant@google.com>
342 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
343 (Dwp_output_file::Dwp_index::enter_set): Add assert.
345 2012-12-12 Alan Modra <amodra@gmail.com>
347 * powerpc.cc (class Track_tls): New.
348 (class Relocate, class Scan): Inherit Track_tls.
349 (Target_powerpc::Scan::local, global): Track tls optimization
350 and avoid creating plt entry for __tls_get_addr if all uses
352 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
354 2012-12-12 Alan Modra <amodra@gmail.com>
356 * options.h (General_options): Add --toc-sort/--no-toc-sort.
357 Replace no_toc_optimize with toc_optimize.
358 * output.h (Output_section::input_sections): Provide non-const variant.
359 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
360 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
362 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
363 (class Sort_toc_sections): New.
364 (Target_powerpc::do_finalize_sections): Sort toc sections.
365 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
367 2012-12-10 Roland McGrath <mcgrathr@google.com>
369 * testsuite/binary_unittest.cc (read_all): New function.
370 (Sized_binary_test): Use it instead of ::read.
371 * fileread.cc (do_read): Don't assume pread always reads the whole
372 amount in a single call.
374 2012-12-10 Alan Modra <amodra@gmail.com>
376 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
377 Set EM_PPC64 or EM_PPC here.
378 (Target_selector_powerpc::do_recognize): Delete.
380 2012-12-10 Alan Modra <amodra@gmail.com>
382 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
384 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
386 2012-12-07 Roland McGrath <mcgrathr@google.com>
388 * testsuite/binary_unittest.cc (Sized_binary_test):
389 Use open_descriptor rather than ::open.
391 2012-12-07 Alan Modra <amodra@gmail.com>
393 * powerpc.cc (Stub_table::do_write): Delete redundant Address
394 typedef and invalid_address constant.
395 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
396 instantiate constants.
398 2012-12-06 Roland McGrath <mcgrathr@google.com>
400 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
401 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
402 * aclocal.m4: Regenerate.
403 * configure: Regenerate.
404 * Makefile.in: Regenerate.
405 * testsuite/Makefile.in: Regenerate.
407 2012-12-07 Alan Modra <amodra@gmail.com>
409 * options.h (General_options): Add no_toc_optimize.
410 * powerpc.cc (ok_lo_toc_insn): New function.
411 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
413 2012-12-06 Alan Modra <amodra@gmail.com>
415 * options.h (General_options): Add plt_align, plt_static_chain,
416 plt_thread_safe. Update stub_group_size help text.
417 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
418 for new plt_thread_safe_ var.
419 (use_plt_offset): Correct comments.
420 (Target_powerpc::do_relax): Look for thread creation symbols to
421 determine default plt_thread_safe value. Clear plt call stubs
422 as well as branch stubs each iteration.
423 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
425 (l, hi, ha, write_insn): Move earlier.
426 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
427 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
429 (Stub_table::update_size): Adjust.
430 (Stub_table::prev_size, set_prev_size): Delete.
431 (Stub_table::stub_align): Let --plt-align affect result.
432 (Stub_table::plt_call_size): Calculate sizes for various stubs.
433 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
434 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
435 (Stub_table::do_write): Support more stub variants.
437 2012-12-04 Alan Modra <amodra@gmail.com>
439 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
440 (Target_powerpc::do_define_standard_symbols): New function.
442 2012-12-03 Alan Modra <amodra@gmail.com>
444 * output.h: Formatting, whitespace.
446 2012-12-03 Alan Modra <amodra@gmail.com>
448 * layout.h (Layout::get_executable_sections): Declare.
449 * layout.cc (Layout::get_executable_sections): New function.
450 * arm.cc (Target_arm::group_sections): Use it.
451 (Arm_output_section::group_sections): Delete now redundant test.
452 * output.cc (Output_reloc::Output_reloc): Add is_relative.
453 param to handle relative relocs.
454 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
455 (Output_data_reloc::add_absolute): Adjust.
456 (Output_data_reloc::add_relative): New function.
457 (Output_data::reset_data_size): New function.
458 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
459 (Output_section::set_addralign): New function.
460 (Output_section::checkpoint_set_addralign): New function.
461 (Output_section::clear_section_offsets_need_adjustment): New function.
462 (Output_section::input_sections): Make public.
463 * powerpc.cc (class Output_data_brlt_powerpc): New.
464 (class Stub_table, class Stub_control): New.
465 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
466 stub_table_, set_stub_table, stub_table): New vectors and accessor
468 (Target_powerpc::do_may_relax, do_relax, push_branch,
469 new_stub_table, stub_tables, brlt_section, group_sections,
470 add_branch_lookup_table, find_branch_lookup_table,
471 write_branch_lookup_table, make_brlt_section): New functions.
472 (Target_powerpc::struct Sort_sections, class Branch_info): New.
473 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
474 branch_info_): New vars.
475 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
476 make call stubs here.
477 (Output_data_glink): Remove all call stub handling from this class.
478 (Target_powerpc::Scan::local, global): Save interesting branch
479 relocs and relocs for ifunc. Adjust calls to plt entry functions.
480 (Target_powerpc::do_finalize_sections): Only make reg save/restore
481 functions on final link.
482 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
483 Handle long branch destinations too.
484 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
485 do_plt_address_for_local): Adjust lookup of plt call stubs.
487 2012-11-30 Alan Modra <amodra@gmail.com>
489 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
490 relocs against protected symbols when building 32-bit shared libs.
492 2012-11-30 Alan Modra <amodra@gmail.com>
494 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
495 param. Call got_section() to make .got. Update all callers
496 and their callers and so on.
498 2012-11-30 Alan Modra <amodra@gmail.com>
500 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
501 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
502 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
503 value if it already exists.
505 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
508 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
510 2012-11-14 Roland McGrath <mcgrathr@google.com>
512 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
513 than bfc instruction for data sandboxing.
515 2012-11-08 Alan Modra <amodra@gmail.com>
517 * po/POTFILES.in: Regenerate.
519 2012-11-05 Alan Modra <amodra@gmail.com>
521 * configure.ac: Apply 2012-09-10 change to config.in here.
522 * configure: Regenerate.
524 2012-11-05 Alan Modra <amodra@gmail.com>
526 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
527 (struct Opd_ent): Use "Address" rather than "Offset".
528 (Output_data_got_powerpc::got_base_offset): Return Valtype.
529 (Target_powerpc::got_section): Make public.
530 (Target_powerpc::scan_relocs): Move code setting symbols..
531 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
532 Create _SDA_BASE_ only when referenced.
534 2012-11-02 Roland McGrath <mcgrathr@google.com>
536 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
539 2012-11-01 Roland McGrath <mcgrathr@google.com>
541 * target.h (Sized_target::relocate_relocs): Use Elf_Off
542 for offset_in_output_section parameter.
543 (Sized_target::relocate_special_relocatable): Likewise.
544 * arm.cc (Target_arm::relocate_relocs): Likewise.
545 (Target_arm::relocate_special_relocatable): Likewise.
546 * i386.cc (Target_i386::relocate_relocs): Likewise.
547 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
548 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
549 * target-reloc.h (relocate_relocs): Likewise.
550 * testsuite/testfile.cc (Target_test): Likewise.
551 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
552 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
554 * system.h: Move inclusion of <clocale> to after <libintl.h> in
555 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
557 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
558 parameter, which is unused in the [!F_SETFD] case.
560 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
561 SYMNDX to off_t before comparing it to this->data_size().
562 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
563 * incremental.cc (Output_section_incremental_inputs::do_write):
564 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
566 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
568 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
570 * gold.cc (Target_arm::do_adjust_elf_header): Add the
571 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
574 2012-10-29 Cary Coutant <ccoutant@google.com>
576 * dwp.cc (usage): Add file and exit status parameters;
577 add --help and --version options.
578 (print_version): New function.
579 (main): Add --help and --version options.
581 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
583 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
584 final_layout_sequence.txt.
585 * testsuite/Makefile.in: Regenerated.
587 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
589 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
590 COMPILE generated by automake.
592 (CXXCOMPILE1): Likewise.
593 (CXXLINK1): Likewise.
594 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
596 (CXXCOMPILE): Likewise.
598 * testsuite/Makefile.in: Regenerated.
600 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
602 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
603 on bad fwrite return.
605 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
607 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
610 2012-10-23 Cary Coutant <ccoutant@google.com>
612 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
613 * testsuite/Makefile.in: Regenerate.
614 * testsuite/dwp_test.h: New source file.
615 * testsuite/dwp_test_1.cc: New source file.
616 * testsuite/dwp_test_1.s: New source file.
617 * testsuite/dwp_test_1.sh: New source file.
618 * testsuite/dwp_test_1b.cc: New source file.
619 * testsuite/dwp_test_1b.s: New source file.
620 * testsuite/dwp_test_2.cc: New source file.
621 * testsuite/dwp_test_2.s: New source file.
622 * testsuite/dwp_test_2.sh: New source file.
623 * testsuite/dwp_test_main.cc: New source file.
624 * testsuite/dwp_test_main.s: New source file.
626 2012-10-23 Cary Coutant <ccoutant@google.com>
628 * dwp.h: New header file.
629 * dwp.cc: New source file.
630 * gold.h: Move shared declarations to system.h.
631 * system.h: New header file.
632 * Makefile.am: Add dwp.
633 * Makefile.in: Regenerate.
635 2012-10-23 Cary Coutant <ccoutant@google.com>
637 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
638 Dwarf_info_reader::read_from_pointer.
639 (Dwarf_pubnames_table::read_header): Likewise.
640 (Dwarf_pubnames_table::next_name): Likewise.
641 (Dwarf_die::read_attributes): Likewise.
642 (Dwarf_die::skip_attributes): Likewise.
643 (Dwarf_info_reader::read_from_pointer): New function template.
644 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
645 (Dwarf_pubnames_table): Likewise.
646 (Dwarf_info_reader::read_from_pointer): New function template.
647 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
648 Dwarf_pubnames_table ctor.
650 2012-10-23 Cary Coutant <ccoutant@google.com>
652 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
654 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
656 (Dwarf_info_reader::set_abbrev_shndx): New method.
657 (Dwarf_info_reader::abbrev_shndx_): New data member.
659 2012-10-23 Cary Coutant <ccoutant@google.com>
661 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
662 from object, not parameters.
663 (Dwarf_info_reader::parse): Likewise.
664 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
665 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
666 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
669 2012-10-23 Cary Coutant <ccoutant@google.com>
671 * fileread.cc (Input_file::Input_file): New constructor.
672 * fileread.h (class Input_file): Add new constructor.
674 2012-10-18 Alan Modra <amodra@gmail.com>
677 * object.cc (Relobj::is_section_name_included): Also match
678 .sdata personality section.
680 2012-10-18 Alan Modra <amodra@gmail.com>
682 * target-reloc.h (class Default_comdat_behavior): New, package up..
683 (get_comdat_behaviour): ..this.
684 (relocate_section): Add Relocate_comdat_behavior template arg,
686 * arm.cc (Target_arm::relocate_section): Adjust to suit.
687 (Target_arm::scan_reloc_section): Likewise.
688 * i386.cc (Target_i386::relocate_section): Likewise.
689 * sparc.cc (Target_sparc::relocate_section): Likewise.
690 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
691 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
692 * powerpc.cc (class Relocate_comdat_behavior): New.
693 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
694 gold::relocate_section with new template arg.
696 2012-10-18 Alan Modra <amodra@gmail.com>
698 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
699 dynamic relocs for GOT_TPREL got entries, without symbol if
701 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
702 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
703 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
705 2012-10-17 Alan Modra <amodra@gmail.com>
708 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
710 2012-10-16 Sriraman Tallam <tmsriram@google.com>
712 * layout.cc (Layout::include_section): Keep sections marked
713 SHF_EXCLUDE when doing relocatable links.
715 2012-10-16 Alan Modra <amodra@gmail.com>
717 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
718 (Target_powerpc::do_finalize_sections): Call it.
719 (Output_data_save_res): New class and supporting functions.
720 (Target_powerpc::symval_for_branch): Only look up .opd entry for
721 normal symbols defined in object files.
723 2012-10-12 Alan Modra <amodra@gmail.com>
725 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
726 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
727 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
728 section if scan_opd_relocs not yet called.
729 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
731 2012-10-12 Alan Modra <amodra@gmail.com>
733 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
734 add_local_ifunc_entry): Revert last change.
735 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
737 2012-10-05 Alan Modra <amodra@gmail.com>
739 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
740 do_plt_address_for_global): New functions.
741 (Output_data_got_powerpc::do_write): Don't segfault when linking
743 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
744 add_local_ifunc_entry): Return true on adding entry..
745 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
746 glink->add_entry call. Remove unused symtab param. Adjust calls.
747 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
748 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
750 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
751 syms here. Do so even when no .iplt. Don't segfault when linking
753 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
754 new variants without reloc param.
755 (Glink_sym_ent::Glink_sym_ent): Likewise.
756 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
757 reloc when refs will resolve to plt call stub.
758 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
759 R_PPC_PLTREL24 to resolve locally.
760 (Target_powerpc::Scan::global): Correct ifunc handling.
761 (Target_powerpc::Relocate::relocate): Correct local sym glink
762 lookup. Don't destroy "value" when we have a plt call stub,
763 and when checking plt call validity.
764 (Target_powerpc::do_dynsym_value): Simplify.
766 2012-10-05 Alan Modra <amodra@gmail.com>
768 * i386.cc (Output_data_plt_i386::address_for_global,
769 address_for_local): Add plt offset to returned value. Adjust uses.
770 * sparc.cc (Output_data_plt_sparc::address_for_global,
771 address_for_local): Likewise.
772 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
773 address_for_local): Likewise.
774 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
775 address_for_local): Likewise.
776 * target.h (Target::plt_address_for_global, plt_address_for_local):
778 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
779 (Output_data_got::Got_entry::write): Nor here.
780 * output.h: Comment fix.
782 2012-10-02 Jiong Wang <jiwang@tilera.com>
784 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
785 global_offset_table_ value for larget got.
786 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
788 2012-09-29 Alan Modra <amodra@gmail.com>
790 * powerpc.cc (Target_powerpc::iplt_): New output section.
791 (Target_powerpc::iplt_section, make_iplt_section,
792 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
793 (Target_powerpc::make_plt_entry): Handle ifunc syms.
794 Target_powerpc::plt_entry_count): Count iplt entries too.
795 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
796 reloc section in constructor. New params.
797 (Target_powerpc::make_plt_section): Create reloc section here instead.
798 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
800 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
801 (Output_data_glink::add_entry, find_entry): New functions to
802 deal with local syms.
803 (Glink_sym_ent): Add support for local syms.
804 (Output_data_glink::do_write): Handle ifunc plt entries.
805 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
806 (Target_powerpc::Scan::local, global): Handle ifunc syms.
807 (Target_powerpc::Relocate::relocate): Likewise.
808 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
810 2012-09-25 Alan Modra <amodra@gmail.com>
812 * object.h (Sized_relobj_file::adjust_local_symbol,
813 do_adjust_local_symbol): New functions.
814 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
815 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
816 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
817 and irregular opd entry spacing.
818 (Powerpc_relobj::do_read_relocs): Add opd size checks.
819 (Global_symbol_visitor_opd): New functor.
820 (Target_powerpc::do_finalize_sections): Omit global symbols defined
821 on deleted opd entries.
823 2012-09-15 Jiong Wang <jiwang@tilera.com>
825 * tilegx.cc: New file.
826 * Makefile.am (TARGETSOURCES): Add tilegx.cc
827 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
828 * configure.tgt: Add entries for tilegx*.
829 * configure.ac: Likewise.
830 * Makefile.in: Rebuild.
831 * configure: Likewise.
832 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
835 2012-09-13 Alan Modra <amodra@gmail.com>
837 * target-reloc.h (scan_relocs): Call scan.local for relocs
838 against symbols in discarded sections. Pass is_discarded
840 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
841 Add is_discarded param.
842 * powerpc (Target_powerpc::Scan::local): Likewise. Use
843 is_discarded to flag opd entry as discarded. Don't emit dyn
844 relocs on such entries.
845 (Target_powerpc::Scan::global): Similarly detect and handle
847 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
848 opd_ent_. Update all uses.
849 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
850 (Target_powerpc::relocate_section): Zero out discarded opd
853 2012-09-12 Ian Lance Taylor <iant@google.com>
856 * output.cc: Rename Output_data_got template parameter from size
857 to got_size for all functions. Compile all variants of
859 (Output_data_got::Got_entry::write): Correct use of size for
860 symbol value. Use local_is_tls rather than casting to
862 * object.h (class Object): Add local_is_tls and do_local_is_tls.
863 (class Sized_relobj_file): Add do_local_is_tls.
864 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
866 2012-09-11 Alan Modra <amodra@gmail.com>
869 * layout.cc (Layout::set_segment_offsets): When using
870 common-page-size alignment, ensure we are on a new max-page-size
872 * output.cc (Output_segment::set_section_addresses): Use
873 abi_pagesize, not common_pagesize for relro boundary.
874 (Output_segment::set_offset): Likewise.
876 2012-09-11 Alan Modra <amodra@gmail.com>
878 * output.h (Output_data_got::add_global_tls, add_local_tls,
879 add_local_tls_pair): New functions.
880 (Output_data_got::add_local_pair_with_rel): Remove second
881 reloc param. Expand comment.
882 (Output_data_got::Got_entry): Rename use_plt_offset_ to
883 use_plt_or_tls_offset_, similarly for constructor param.
884 (Output_data_got::Got_entry::write): Add got_index param.
885 * output.cc (Output_data_got::add_global_tls, add_local_tls,
886 add_local_tls_pair): New functions.
887 (Output_data_got::Got_entry::write): Handle tls symbols
888 with use_plt_or_tls_offset_ set specially.
889 (Output_data_got::add_local_pair_with_rel): Only one reloc.
890 (Output_data_got::do_write): Replace iterator with index, pass
891 index to entry write function.
892 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
893 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
894 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
896 * i386.cc (Target_i386::Scan::local): Likewise.
897 * sparc.cc (Target_sparc::Scan::local): Likewise.
898 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
899 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
900 do_tls_offset_for_global): New functions.
901 (Target_powerpc::Scan::local): Correct TLS relocations and got
903 (Target_powerpc::Scan::global): Don't emit unnecessary
904 dynamic relocations on TLS GOT entries.
906 2012-09-10 Matthias Klose <doko@ubuntu.com>
908 * config.in: Disable sanity check for kfreebsd.
910 2012-09-10 Sterling Augustine <saugustine@google.com>
912 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
913 (Gdb_index::pubtypes_read): New parameter.
914 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
916 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
919 2012-09-09 Alan Modra <amodra@gmail.com>
921 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
922 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
923 * gc.h (gc_process_relocs): Call target gc_add_reference.
924 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
925 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
926 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
928 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
929 to cater for when we don't need code offset. Update use.
930 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
931 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
932 set_opd_valid): New functions.
933 (Target_powerpc::do_gc_add_reference): New function.
934 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
936 (Target_powerpc::do_gc_mark_symbol): New function.
938 2012-09-06 Cary Coutant <ccoutant@google.com>
940 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
941 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
942 (Dwarf_die::skip_attributes): Likewise.
943 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
944 * testsuite/gdb_index_test.cc (inline_func_1): New function.
946 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
948 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
950 * testsuite/script_test_3.t: Add .got.plt output section
952 * testsuite/script_test_4.t: Likewise.
954 2012-09-05 Alan Modra <amodra@gmail.com>
956 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
957 update all uses and lose "enum" when using type.
959 2012-09-05 Alan Modra <amodra@gmail.com>
961 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
962 * configure: Regenerate.
963 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
964 (plugin_final_layout.stdout): Likewise.
965 (memory_test): Set page sizes to 0x1000.
966 * testsuite/Makefile.in: Regenerate.
967 * testsuite/discard_locals_test.sh: Add FIXME comment.
968 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
969 * testsuite/pr14265.t: Add .got output section statement.
970 * testsuite/script_test_2.t: Likewise.
971 * testsuite/script_test_3.t: Likewise.
972 * testsuite/script_test_4.t: Likewise.
973 * testsuite/script_test_5.t: Likewise.
974 * testsuite/script_test_6.t: Likewise.
975 * testsuite/script_test_7.t: Likewise.
976 * testsuite/script_test_9.t: Likewise.
978 2012-09-05 Alan Modra <amodra@gmail.com>
980 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
981 (Powerpc_relocate_functions::Status): New typedef.
982 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
983 (Target_powerpc::Scan::local): Handle REL64.
984 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
986 (Target_powerpc::symval_for_branch): New function, extracted from..
987 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
988 checks. Report overflow errors.
990 2012-09-05 Alan Modra <amodra@gmail.com>
992 * object.h (Sized_relobj_file::emit_relocs): Delete.
993 (Sized_relobj_file::emit_relocs_reltype): Delete.
994 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
995 relocate_relocs for --emit-relocs.
996 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
997 * output.h: Update comment.
998 (Output_segment::first_section): New function.
999 (Output_segment::first_section_load_address): Use first_section.
1000 * output.cc (Output_segment::first_section): New function extracted..
1001 (Output_segment::first_section_load_address): ..from here. Delete.
1002 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1003 * target.h (Sized_target::relocate_for_relocatable): Likewise.
1004 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1005 adjust call to target.h function.
1006 * i386.cc (Target_i386): Likewise.
1007 * sparc.cc (Target_sparc): Likewise.
1008 * x86_64.cc (Target_x86_64): Likewise.
1009 * powerpc.cc (Target_powerpc): Likewise.
1010 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
1011 first tls section has section symbol for optimised local dynamic
1013 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1014 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1016 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1017 Rename to relocate_relocs. Update error message.
1019 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
1021 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1024 2012-08-31 Alan Modra <amodra@gmail.com>
1026 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1027 (Powerpc_relobj::toc_base_offset): New stub function.
1028 (Target_powerpc): Add tp_offset, dtp_offset. Rename
1029 got_mod_index_offset to tlsld_got_offset. Update all refs.
1030 (Target_powerpc::Relocate::enum skip_tls): New.
1031 (Target_powerpc::call_tls_get_addr_): New var.
1032 (Target_powerpc::is_branch_reloc): Move to file scope.
1033 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1034 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1036 (Target_powerpc::enum Got_type): Delete old values, add new ones.
1037 (powerpc_info): Correct common_pagesize for ppc64.
1038 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1039 (Powerpc_relocate_functions): Add overflow check enums and functions.
1040 Add non-shift version of rela, rela_ua. Delete all rel public
1041 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
1042 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1043 addr16_ha3, addr14 functions.
1044 (Output_data_got_powerpc::add_constant_pair): New function.
1045 (Output_data_got_powerpc::got_base_offset): Likewise.
1046 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1047 (instruction constants): Sort, add some more.
1048 (Output_data_glink::do_write): Add and use Address typedef. Use
1049 object->toc_base_offset() stub for 64-bit.
1050 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1051 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1052 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1053 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
1054 Always treat .opd relocs as against locally defined symbol.
1055 Correct condition for RELATIVE relocs.
1056 (Target_powerpc::do_finalize_sections): Test for NULL sections.
1057 (Target_powerpc::Relocate::relocate): Use plt call stub as value
1058 for 32-bit syms with a plt entry. Correct ppc64 toc base
1059 calculations. Handle TLS relocs, and more. Add overflow
1060 checking and adjust for Powerpc_relocate_functions changes.
1061 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1062 Reinstate --emit-relocs code with FIXME.
1064 2012-08-30 Alan Modra <amodra@gmail.com>
1066 * layout.cc (Layout::set_segment_offsets): Set p_align to
1067 abi_pagesize, not common_pagesize.
1068 (Layout::relaxation_loop_body): Similarly use abi_pagesize
1069 to determine whether file header can go in segment.
1071 2012-08-30 Alan Modra <amodra@gmail.com>
1073 * output.h (Output_reloc::Output_reloc <output section>): Add
1074 is_relative param. Adjust calls.
1075 (Output_reloc::add_output_section_relative): New functions.
1076 * output.cc (Output_reloc::Output_reloc <output section>): Handle
1078 (Output_reloc::symbol_value): Handle SECTION_CODE.
1080 2012-08-24 Sriraman Tallam <tmsriram@google.com>
1082 * gold.cc (queue_middle_tasks): Call layout again when unique
1083 segments for sections is desired.
1084 * layout.cc (Layout::Layout): Initialize new members.
1085 (Layout::get_output_section_flags): New function.
1086 (Layout::choose_output_section): Call get_output_section_flags.
1087 (Layout::layout): Make output section for mapping to a unique segment.
1088 (Layout::insert_section_segment_map): New function.
1089 (Layout::attach_allocated_section_to_segment): Make unique segment for
1090 output sections marked so.
1091 (Layout::segment_precedes): Check for unique segments when sorting.
1092 * layout.h (Layout::Unique_segment_info): New struct.
1093 (Layout::Section_segment_map): New typedef.
1094 (Layout::insert_section_segment_map): New function.
1095 (Layout::get_output_section_flags): New function.
1096 (Layout::is_unique_segment_for_sections_specified): New function.
1097 (Layout::set_unique_segment_for_sections_specified): New function.
1098 (Layout::unique_segment_for_sections_specified_): New member.
1099 (Layout::section_segment_map_): New member.
1100 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1101 Rename is_gc_pass_one to is_pass_one.
1102 Rename is_gc_pass_two to is_pass_two.
1103 Rename is_gc_or_icf to is_two_pass.
1104 Check for which pass based on whether symbols data is present.
1105 Make it two pass when unique segments for sections is desired.
1106 * output.cc (Output_section::Output_section): Initialize new
1108 * output.h (Output_section::is_unique_segment): New function.
1109 (Output_section::set_is_unique_segment): New function.
1110 (Output_section::is_unique_segment_): New member.
1111 (Output_section::extra_segment_flags): New function.
1112 (Output_section::set_extra_segment_flags): New function.
1113 (Output_section::extra_segment_flags_): New member.
1114 (Output_section::segment_alignment): New function.
1115 (Output_section::set_segment_alignment): New function.
1116 (Output_section::segment_alignment_): New member.
1117 (Output_segment::Output_segment): Initialize is_unique_segment_.
1118 (Output_segment::is_unique_segment): New function.
1119 (Output_segment::set_is_unique_segment): New function.
1120 (Output_segment::is_unique_segment_): New member.
1121 * plugin.cc (allow_unique_segment_for_sections): New function.
1122 (unique_segment_for_sections): New function.
1123 (Plugin::load): Add new functions to transfer vector.
1124 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1125 * Makefile.in: Regenerate.
1126 * testsuite/plugin_final_layout.sh: Check if unique segment
1127 functionality works.
1128 * testsuite/plugin_section_order.c (onload): Check if new interfaces
1130 (allow_unique_segment_for_sections): New global.
1131 (unique_segment_for_sections): New global.
1132 (claim_file_hook): Call allow_unique_segment_for_sections.
1133 (all_symbols_read_hook): Call unique_segment_for_sections.
1135 2012-08-22 Cary Coutant <ccoutant@google.com>
1137 * layout.cc (Layout::include_section): Don't assert on GROUP
1138 sections with --emit-relocs.
1140 2012-08-21 Cary Coutant <ccoutant@google.com>
1142 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1143 if --export-dynamic-symbol names an undef symbol.
1145 2012-08-18 Alan Modra <amodra@gmail.com>
1147 * powerpc.cc: Formatting and white space.
1148 (Powerpc_relobj): Rename got2_section_ to special_.
1149 Add opd_ent_shndx_ and opd_ent_off_ vectors.
1150 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1151 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1152 (Target_powerpc): Add Address typedef and invalid_address. Use
1154 (Target_powerpc::is_branch_reloc): New function.
1155 (Powerpc_relocate_functions): Add Address typedef, use throughout.
1156 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1157 for dst_mask, value and addend.
1158 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1159 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1160 (Output_data_glink::do_write): Correct toc base. Don't try to use
1161 uint16_t for 24-bit offset. Use get_output_section_offset and
1163 (Target_powerpc::Scan::local): Handle more relocs.
1164 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1165 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1166 Plug in toc restoring insn after plt calls. Translate branches
1167 to function descriptor symbols to corresponding entry point.
1168 (Target_powerpc::relocate_for_relocatable): Check return from
1169 get_output_section_offset.
1170 * symtab.h: Comment typo.
1172 2012-08-14 Ian Lance Taylor <iant@google.com>
1174 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1175 unsupported_relocal_local to call unsupported_reloc_global.
1177 2012-08-14 Nick Clifton <nickc@redhat.com>
1180 * script-sections.cc (Sections_element::output_section_name): Add
1181 keep return parameter.
1182 (Output_section_element::match_name): Add keep return parameter.
1183 Return the value of the keep_ member.
1184 * script-sections.h (class Output_section): Update
1185 output_section_name prototype.
1186 * layout.cc (Layout::keep_input_section): New public member
1188 (Layout::choose_output_section): Pass keep parameter to
1189 output_section_name.
1190 * layout.h (class Layout): Add keep_input_section.
1191 * object.cc (Sized_relobj_file::do_layout): Check for kept input
1193 * testsuite/Makefile.am: Add a test.
1194 * testsuite/Makefile.in: Regenerate.
1195 * testsuite/pr14265.c: Source file for the test.
1196 * testsuite/pr14265.t: Linker script for the test.
1197 * testsuite/pr14265.sh: Shell script for the test.
1199 2012-08-14 Alan Modra <amodra@gmail.com>
1201 * target.h (Target::output_section_name): New function.
1202 (Target::do_output_section_name): New function.
1203 * layout.cc (Layout::choose_output_section): Call the above.
1204 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1206 2012-08-14 Alan Modra <amodra@gmail.com>
1208 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1209 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1210 for replace_constant call.
1211 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1212 (Output_data_glink::do_print_to_mapfile): New function.
1213 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1214 (Target_powerpc::Relocate::relocate): Likewise.
1216 2012-08-14 Alan Modra <amodra@gmail.com>
1218 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1219 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1220 (Output_data_glink::add_entry,find_entry): Remove shndx param.
1221 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
1222 all references to shndx_. Handle special case for R_PPC_PLTREL24
1224 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1225 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1226 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1228 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1229 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1231 2012-08-12 Alan Modra <amodra@gmail.com>
1233 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
1234 (glink insn constants): Use uint32_t.
1235 (Output_data_glink::add_entry): Use insert, not [] operator.
1237 2012-08-11 Alan Modra <amodra@gmail.com>
1239 * object.h (Sized_relobj_file::find_shdr): New function.
1240 (Sized_relobj_file::find_special_sections): New function.
1241 * object.cc (Sized_relobj_file::find_shdr): New function.
1242 (Sized_relobj_file::find_eh_frame): Use find_shdr.
1243 (Sized_relobj_file::find_special_sections): New function, split out..
1244 (Sized_relobj_file::do_read_symbols): ..from here.
1245 * output.h (Output_data_got::replace_constant): New function.
1246 (Output_data_got::num_entries): New function.
1247 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1248 (Output_data_got::got_offset): Protected rather than private.
1249 (Output_data_got::replace_got_entry): New function.
1250 * output.cc (Output_data_got::replace_got_entry): New function.
1251 * powerpc.cc (class Powerpc_relobj): New.
1252 (class Powerpc_relocate_functions): Delete all psymval variants or
1253 convert to value,addend type. Delete pcrela, pcrela_unaligned.
1254 Implement _ha functions using corresponding _hi function.
1255 (Powerpc_relobj::find_special_sections): New function.
1256 (Target_powerpc::do_make_elf_object): New function.
1257 (class Output_data_got_powerpc): New.
1258 (class Output_data_glink): New.
1259 (class Powerpc_scan_relocatable_reloc): New.
1260 Many more changes througout file.
1262 2012-08-09 Nick Clifton <nickc@redhat.com>
1264 * po/vi.po: Updated Vietnamese translation.
1266 2012-08-07 Ian Lance Taylor <iant@google.com>
1268 * layout.cc (Layout::add_target_dynamic_tags): If
1269 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1272 2012-07-30 Nick Clifton <nickc@redhat.com>
1274 * po/gold.pot: Updated template.
1275 * po/es.po: Updated Spanish translation.
1277 2012-07-18 Cary Coutant <ccoutant@google.com>
1280 * configure.ac: Add check for -gpubnames support.
1281 * configure: Regenerate.
1282 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1283 support; force -gno-pubnames.
1284 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1286 (gdb_index_test_4): New test.
1287 * testsuite/Makefile.in: Regenerate.
1288 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1289 * testsuite/gdb_index_test_2.sh: Likewise.
1290 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1291 * testsuite/gdb_index_test_4.sh: New script.
1292 * testsuite/gdb_index_test_comm.sh: New script with common code;
1293 don't look for space after colon.
1295 2012-07-16 Sriraman Tallam <tmsriram@google.com>
1297 * gold.cc (queue_middle_tasks): Update function order only after
1298 deferred objects due to plugins are processed.
1300 2012-07-11 Ian Lance Taylor <iant@google.com>
1302 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1303 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1304 (Target_arm::scan_reloc_for_stub): Likewise.
1305 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1306 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1307 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1308 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1309 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1311 2012-07-10 Dodji Seketeli <dodji@redhat.com>
1312 Ian Lance Taylor <iant@google.com>
1315 * configure.ac: Test whether std::tr1::hash<off_t> works.
1316 * gold.h: Add a specialization for std::tr1::hash<off_t> if
1318 * output.h (class Output_fill): Add virtual destructor.
1319 * configure, config.in: Rebuild.
1321 2012-06-22 Roland McGrath <mcgrathr@google.com>
1323 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1325 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
1327 * plugin.cc (Plugin::load): Handle position independent executables.
1329 2012-06-06 Cary Coutant <ccoutant@google.com>
1331 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1333 (lines_only_debug_sections): Likewise.
1334 (gdb_fast_lookup_sections): New static array.
1335 (is_gdb_debug_section): Rename formal parameter.
1336 (is_lines_only_debug_section): Likewise.
1337 (is_gdb_fast_lookup_section): New function.
1338 (Layout::include_section): Check for ".zdebug_" prefix; pass
1339 section name suffix to is_gdb_debug_section, et al.; check for
1340 fast-lookup sections when building .gdb_index.
1341 * options.h (--strip-debug-gdb): Update GDB version number.
1343 2012-06-06 Cary Coutant <ccoutant@google.com>
1345 * configure.ac: Add check for fallocate.
1346 * configure: Regenerate.
1347 * config.in: Regenerate.
1349 * options.h (class General_options): Add --mmap-output-file and
1350 --posix-fallocate options.
1351 * output.cc: (posix_fallocate): Remove; replace with...
1352 (gold_fallocate): New function.
1353 (Output_file::map_no_anonymous): Call gold_fallocate.
1354 (Output_file::map): Check --mmap-output-file option.
1356 2012-06-05 Jing Yu <jingyu@google.com>
1358 * gold.h (textdomain): Add do {} to empty while(0).
1359 (bindtextdomain): Likewise.
1361 2012-06-04 Cary Coutant <ccoutant@google.com>
1363 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1366 2012-05-25 Sriraman Tallam <tmsriram@google.com>
1368 * symtab.cc (Symbol_table::define_special_symbol):
1369 Initialize *poldsym to prevent uninitialized variable errors.
1371 2012-05-23 Cary Coutant <ccoutant@google.com>
1373 * layout.cc (Layout::section_name_mapping): Add rules to handle
1374 exact match on .data.rel.ro.local or .data.rel.ro.
1375 (Layout::output_section_name): Check for exact matches.
1377 2012-05-23 Cary Coutant <ccoutant@google.com>
1379 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1382 2012-05-22 Cary Coutant <ccoutant@google.com>
1384 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1385 object before exporting symbol.
1387 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
1389 * testsuite/tls_test.cc: Include "config.h" first.
1390 * testsuite/tls_test_c.c: Likewise.
1392 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
1393 Nick Clifton <nickc@redhat.com>
1396 * configure.in: Add check that sysdep.h has been included before
1397 any system header files.
1398 * configure: Regenerate.
1399 * config.in: Regenerate.
1401 2012-05-14 Cary Coutant <ccoutant@google.com>
1403 * layout.cc (Layout::make_output_section): Mark .tdata section
1405 * testsuite/relro_test.cc: Add a TLS variable.
1407 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
1410 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1411 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1414 2012-05-08 Cary Coutant <ccoutant@google.com>
1416 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1417 (lines_only_debug_sections): Likewise.
1419 2012-05-02 Roland McGrath <mcgrathr@google.com>
1421 * nacl.cc: New file.
1423 * Makefile.am (CCFILES, HFILES): Add them.
1424 * Makefile.in: Regenerate.
1425 * i386.cc (Output_data_plt_i386_nacl): New class.
1426 (Output_data_plt_i386_nacl_exec): New class.
1427 (Output_data_plt_i386_nacl_dyn): New class.
1428 (Target_i386_nacl): New class.
1429 (Target_selector_i386_nacl): New class.
1430 (target_selector_i386): Use it instead of Target_selector_i386.
1431 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1432 (Target_x86_64_nacl): New class.
1433 (Target_selector_x86_64_nacl): New class.
1434 (target_selector_x86_64, target_selector_x32): Use it instead of
1435 Target_selector_x86_64.
1436 * arm.cc (Output_data_plt_arm_nacl): New class.
1437 (Target_arm_nacl): New class.
1438 (Target_selector_arm_nacl): New class.
1439 (target_selector_arm, target_selector_armbe): Use it instead of
1440 Target_selector_arm.
1442 * target-select.cc (select_target): Take new Input_file* and off_t
1443 arguments, pass them on to recognize method of selector.
1444 * object.cc (make_elf_sized_object): Update caller.
1445 * parameters.cc (parameters_force_valid_target): Likewise.
1446 * incremental.cc (make_sized_incremental_binary): Likewise.
1447 * target-select.h: Update decl.
1448 (Target_selector::recognize): Take new Input_file* argument,
1449 pass it on to do_recognize.
1450 (Target_selector::do_recognize): Take new Input_file* argument.
1451 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1452 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1453 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1454 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1456 * target.h (Target::Target_info): New members isolate_execinstr
1458 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1459 * arm.cc (Target_arm::arm_info): Update initializer.
1460 * i386.cc (Target_i386::i386_info): Likewise.
1461 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1462 * sparc.cc (Target_sparc::sparc_info): Likewise.
1463 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1464 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1465 * layout.cc (Layout::attach_allocated_section_to_segment):
1466 Take new const Target* argument. If target->isolate_execinstr(), act
1468 (Layout::find_first_load_seg): Take new const Target* argument;
1469 if target->isolate_execinstr(), reject PF_X segments.
1470 (Layout::relaxation_loop_body): Update caller.
1471 (Layout::set_segment_offsets): If target->isolate_execinstr(),
1472 reset file offset to zero when we hit LOAD_SEG, and then do a second
1473 loop over the segments before LOAD_SEG to reassign offsets after
1474 addresses have been determined. Handle target->rosegment_gap().
1475 (Layout::attach_section_to_segment): Take new const Target* argument;
1476 pass it to attach_allocated_section_to_segment.
1477 (Layout::make_output_section): Update caller.
1478 (Layout::attach_sections_to_segments): Take new const Target* argument;
1479 pass it to attach_section_to_segment.
1480 * gold.cc (queue_middle_tasks): Update caller.
1481 * layout.h (Layout): Update method decls with new arguments.
1483 * arm.cc (Target_arm::Target_arm): Take optional argument for the
1484 Target_info pointer to use.
1485 (Target_arm::do_make_data_plt): New virtual method.
1486 (Target_arm::make_data_plt): New method that calls it.
1487 (Target_arm::make_plt_entry): Use it.
1488 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1489 for the section alignment.
1490 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1492 (Output_data_plt_arm::first_plt_entry_offset): Call it.
1493 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1495 (Output_data_plt_arm::get_plt_entry_size): Call it.
1496 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1497 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1498 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1500 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1501 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1502 method instead of sizeof(plt_entry).
1503 (Output_data_plt_arm::add_entry): Likewise.
1504 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1505 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1507 (Target_arm::plt_entry_size): Likewise.
1508 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1510 (Output_data_plt_arm_standard): ... here, new class.
1511 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1512 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1513 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1515 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1516 Take additional argument for the PLT entry size.
1517 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1518 Use get_plt_entry_size method rather than plt_entry_size variable.
1519 (Output_data_plt_x86_64::reserve_slot): Likewise.
1520 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1521 (Output_data_plt_x86_64::add_entry): Likewise.
1522 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1523 (Output_data_plt_x86_64::address_for_global): Likewise.
1524 (Output_data_plt_x86_64::address_for_local): Likewise.
1525 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1526 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1527 Make method non-static.
1528 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1530 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1531 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1532 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1533 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1535 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1536 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1538 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1539 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1541 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1542 (Output_data_plt_x86_64::plt_entry_size)
1543 (Output_data_plt_x86_64::first_plt_entry)
1544 (Output_data_plt_x86_64::plt_entry)
1545 (Output_data_plt_x86_64::tlsdesc_plt_entry)
1546 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1547 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1548 (Output_data_plt_x86_64_standard): ... here, new class.
1549 (Target_x86_64::Target_x86_64): Take optional argument for the
1550 Target_info pointer to use.
1551 (Target_x86_64::do_make_data_plt): New virtual method.
1552 (Target_x86_64::make_data_plt): New method to call it.
1553 (Target_x86_64::init_got_plt_for_update): Use that.
1554 Call this->plt_->add_eh_frame method here.
1555 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1556 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1557 rather than static method.
1558 (Target_x86_64::plt_entry_size): Likewise.
1559 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1560 rather than plt_entry_size variable. Move guts of PLT filling to...
1561 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1562 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1563 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1565 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1566 additional argument for the section alignment.
1567 Don't do add_eh_frame_for_plt here.
1568 (Output_data_plt_i386::first_plt_entry_offset): Make the method
1569 non-static. Use get_plt_entry_size method rather than plt_entry_size
1571 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1573 (Output_data_plt_i386::get_plt_entry_size): Call it.
1574 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1575 (Output_data_plt_i386::add_eh_frame): New method to call it.
1576 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1578 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1579 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1581 (Output_data_plt_i386::fill_plt_entry): New method to call it.
1582 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1583 method instead of plt_entry_size.
1584 (Output_data_plt_i386::plt_entry_size)
1585 (Output_data_plt_i386::plt_eh_frame_fde_size)
1586 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1587 (Output_data_plt_i386_standard): ... here, new class.
1588 (Output_data_plt_i386_exec): New class.
1589 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1590 (Output_data_plt_i386_exec::first_plt_entry): ... here.
1591 (Output_data_plt_i386::exec_plt_entry): Move to ...
1592 (Output_data_plt_i386_exec::plt_entry): ... here.
1593 (Output_data_plt_i386_dyn): New class.
1594 (Output_data_plt_i386::first_plt_entry): Move to ...
1595 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1596 (Output_data_plt_i386::dyn_plt_entry): Move to ...
1597 (Output_data_plt_i386_dyn::plt_entry): ... here.
1598 (Target_i386::Target_i386): Take optional argument for the Target_info
1600 (Target_i386::do_make_data_plt): New virtual method.
1601 (Target_i386::make_data_plt): New method to call it.
1602 (Target_i386::make_plt_section): Use that.
1603 Call this->plt_->add_eh_frame method here.
1604 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1605 rather than plt_entry_size variable.
1606 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1607 (Output_data_plt_i386::address_for_local): Likewise.
1608 (Output_data_plt_i386::do_write): Likewise.
1609 Move guts of PLT filling to...
1610 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1611 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1612 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1613 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1615 2012-05-01 Cary Coutant <ccoutant@google.com>
1617 * dwarf_reader.cc (Dwarf_die::read_attributes)
1618 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1619 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1620 * reduced_debug_output.cc
1621 (Output_reduced_debug_info_section::get_die_end): Remove
1622 DW_FORM_GNU_ref_index. Add default case.
1624 2012-04-26 Mark Wielaard <mjw@redhat.com>
1626 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1627 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1628 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1629 DW_AT_high_pc as offset from DW_AT_low_pc.
1631 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1632 * testsuite/Makefile.in: Regenerate.
1633 * testsuite/gdb_index_test_3.c: New test source file.
1634 * testsuite/gdb_index_test_3.sh: New test source file.
1636 2012-04-25 Ian Lance Taylor <iant@google.com>
1638 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1640 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1641 as a class, not a struct.
1642 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1643 (Target_arm::apply_cortex_a8_workaround): Likewise.
1644 * gc.h: Declare Reloc_types as a struct, not a class.
1645 * object.h: Declare Symbols_data as a struct.
1646 * reloc.h: Declare Read_relocs_data as a struct.
1647 * target.h: Declare Relocate_info as a struct.
1649 2012-04-24 David S. Miller <davem@davemloft.net>
1651 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1652 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1655 2012-04-24 Cary Coutant <ccoutant@google.com>
1657 * incremental-dump.cc (find_input_containing_global): Replace
1658 magic number with symbolic constant.
1659 (dump_incremental_inputs): Update version number.
1660 * incremental.cc (Output_section_incremental_inputs): Update version
1661 number; import symbolic constants from Incremental_inputs_reader.
1662 (Incremental_inputs::create_data_sections): Align relocations
1663 section correctly for 64-bit targets.
1664 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1665 constants; add padding.
1666 (Output_section_incremental_inputs::write_header): Add assert for
1668 (Output_section_incremental_inputs::write_input_files): Add assert
1669 for input_entry_size.
1670 (Output_section_incremental_inputs::write_info_blocks): Add padding;
1671 add assert for object_info_size, input_section_entry_size,
1672 global_sym_entry_size.
1673 * incremental.h (Incremental_inputs_reader): Add symbolic constants
1674 for data structure sizes; use them.
1675 (Incremental_input_entry_reader): Import symbolic constants from
1676 Incremental_inputs_reader; use them.
1678 2012-04-23 David S. Miller <davem@davemloft.net>
1680 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1682 (Target_sparc::Target_sparc): Initialize new fields.
1683 (Target_sparc::do_make_elf_object): New function.
1684 (Target_sparc::do_adjust_elf_header): New function.
1686 2012-04-23 Cary Coutant <ccoutant@google.com>
1688 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1689 CU range table of gdb index.
1691 2012-04-20 David S. Miller <davem@davemloft.net>
1693 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1696 2012-04-16 David S. Miller <davem@davemloft.net>
1698 * sparc.cc (Target_sparc::got_address): New function.
1699 (Sparc_relocate_functions::gdop_hix22): New function.
1700 (Sparc_relocate_functions::gdop_lox10): New function.
1701 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1703 (Target_sparc::Scan::local): Likewise if the global symbol is not
1704 preemptible and is not IFUNC.
1705 (Target_sparc::Relocate::relocate): Perform GOTDATA code
1706 transformations for local and non-preemptible non-IFUNC global
1709 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1710 writing out 64-bit part of ranges.
1712 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1713 -fpic and -fpie respectively.
1714 * Makefile.in: Regenerate.
1716 * sparc.cc (class Target_sparc): Add rela_ifunc_.
1717 (Target_sparc::Target_sparc): Initialize new field.
1718 (Target_sparc::do_plt_section_for_global): New function.
1719 (Target_sparc::do_plt_section_for_local): New function.
1720 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1721 (Target_sparc::make_plt_section): New function, broken out of
1722 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
1723 (Target_sparc::make_plt_entry): Call make_plt_section.
1724 (Target_sparc::make_local_ifunc_plt_entry): New function.
1725 (Target_sparc::rela_ifunc_section): New function.
1726 (Target_sparc::plt_section): Remove const.
1727 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
1728 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1729 and ifunc_count_ fields.
1730 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1731 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1732 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1733 (Output_data_plt_sparc::rela_ifunc): New function.
1734 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1735 (Output_data_plt_sparc::has_ifunc_section): New function.
1736 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1737 (Output_data_plt_sparc::address_for_global): New function.
1738 (Output_data_plt_sparc::address_for_local): New function.
1739 (Output_data_plt_sparc::plt_index_to_offset): New function.
1740 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1742 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1744 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1745 R_SPARC_JMP_IREL to switch.
1746 (Target_sparc::Scan::check_non_pic): Likewise.
1747 (Target_sparc::Scan::local): Handle IFUNC symbols.
1748 (Target_sparc::Scan::local): Likewise.
1749 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1750 and plt_address_for_local.
1751 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1752 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1754 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1755 (class Output_data_reloc): Adjust calls to Output_reloc_type.
1756 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1757 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1759 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1760 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1762 * sparc.cc (Target_sparc::Scan::global): Likewise.
1763 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1765 2012-04-16 Cary Coutant <ccoutant@google.com>
1767 * archive.cc (Library_base::should_include_member): Check for
1768 --export-dynamic-symbol.
1769 * options.h (class General_options): Add --export-dynamic-symbol.
1770 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1771 --export-dynamic-symbol.
1772 (Symbol_table::gc_mark_undef_symbols): Likewise.
1773 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1775 2012-04-12 David S. Miller <davem@davemloft.net>
1777 * sparc.cc (Reloc::wdisp10): New relocation method.
1778 (Reloc::h34): Likewise.
1779 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1780 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1782 (Target_sparc::Scan::local): Likewise.
1783 (Target_sparc::Scan::global): Likewise.
1784 (Target_sparc::Relocate::relocate): Likewise.
1786 2012-04-09 Cary Coutant <ccoutant@google.com>
1788 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1791 2012-04-06 Ian Lance Taylor <iant@google.com>
1793 * timer.cc: #include <unistd.h>.
1795 2012-04-06 Roland McGrath <mcgrathr@google.com>
1797 * configure.in (AC_CHECK_HEADERS): Add locale.h.
1798 * config.in: Regenerate.
1799 * configure: Regenerate.
1801 2012-04-05 Nick Clifton <nickc@redhat.com>
1803 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1804 (AM_LC_MESSAGES): Add.
1805 * aclocal.m4: Regenerate.
1806 * config.in: Regenerate.
1807 * configure: Regenerate.
1809 2012-03-21 Cary Coutant <ccoutant@google.com>
1811 * Makefile.am: Add gdb-index.cc, gdb-index.h.
1812 * Makefile.in: Regenerate.
1813 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1814 (Sized_elf_reloc_mapper::symbol_section): New function.
1815 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1816 (make_elf_reloc_mapper): New function.
1817 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1818 (Dwarf_abbrev_table::do_read_abbrevs): New function.
1819 (Dwarf_abbrev_table::do_get_abbrev): New function.
1820 (Dwarf_ranges_table::read_ranges_table): New function.
1821 (Dwarf_ranges_table::read_range_list): New function.
1822 (Dwarf_pubnames_table::read_section): New function.
1823 (Dwarf_pubnames_table::read_header): New function.
1824 (Dwarf_pubnames_table::next_name): New function.
1825 (Dwarf_die::Dwarf_die): New function.
1826 (Dwarf_die::read_attributes): New function.
1827 (Dwarf_die::skip_attributes): New function.
1828 (Dwarf_die::set_name): New function.
1829 (Dwarf_die::set_linkage_name): New function.
1830 (Dwarf_die::attribute): New function.
1831 (Dwarf_die::string_attribute): New function.
1832 (Dwarf_die::int_attribute): New function.
1833 (Dwarf_die::uint_attribute): New function.
1834 (Dwarf_die::ref_attribute): New function.
1835 (Dwarf_die::child_offset): New function.
1836 (Dwarf_die::sibling_offset): New function.
1837 (Dwarf_info_reader::check_buffer): New function.
1838 (Dwarf_info_reader::parse): New function.
1839 (Dwarf_info_reader::do_parse): New function.
1840 (Dwarf_info_reader::do_read_string_table): New function.
1841 (Dwarf_info_reader::lookup_reloc): New function.
1842 (Dwarf_info_reader::get_string): New function.
1843 (Dwarf_info_reader::visit_compilation_unit): New function.
1844 (Dwarf_info_reader::visit_type_unit): New function.
1845 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1846 Sized_elf_reloc_mapper.
1847 (Sized_dwarf_line_info::symbol_section): Remove function.
1848 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1849 (Sized_dwarf_line_info::read_line_mappings): Remove object
1850 parameter, adjust callers.
1851 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1852 * dwarf_reader.h: Include <sys/types.h>.
1853 (class Track_relocs): Remove forward declaration.
1854 (class Elf_reloc_mapper): New class.
1855 (class Sized_elf_reloc_mapper): New class.
1856 (class Dwarf_abbrev_table): New class.
1857 (class Dwarf_range_list): New class.
1858 (class Dwarf_ranges_table): New class.
1859 (class Dwarf_pubnames_table): New class.
1860 (class Dwarf_die): New class.
1861 (class Dwarf_info_reader): New class.
1862 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1863 (Sized_dwarf_line_info::symbol_section): Remove member function.
1864 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1866 * gdb-index.cc: New source file.
1867 * gdb-index.h: New source file.
1868 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1869 and .debug_types sections, call Layout::add_to_gdb_index.
1870 (Sized_relobj_incr::do_section_name): Implement.
1871 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1872 return type; Implement.
1873 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1875 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1876 parameter list and return type.
1877 (Sized_incr_dynobj::do_section_contents): Likewise.
1878 * layout.cc: Include gdb-index.h.
1879 (Layout::Layout): Initialize gdb_index_data_.
1880 (Layout::init_fixed_output_section): Check for .gdb_index section.
1881 (Layout::add_to_gdb_index): New function. Instantiate.
1882 * layout.h: Add forward declaration for class Gdb_index.
1883 (Layout::add_to_gdb_index): New member function.
1884 (Layout::gdb_index_data_): New data member.
1885 * main.cc: Include gdb-index.h.
1886 (main): Print statistics for gdb index.
1887 * object.cc (Object::section_contents): Move code into
1888 do_section_contents.
1889 (need_decompressed_section): Check for sections needed when building
1891 (build_compressed_section_map): Likewise.
1892 (Sized_relobj_file::do_read_symbols): Need local symbols when building
1894 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1895 sections; call Layout::add_to_gdb_index.
1896 (Sized_relobj_file::do_decompressed_section_contents): Call
1897 do_section_contents directly.
1898 * object.h (Object::do_section_contents): Adjust parameter list and
1900 (Object::do_decompressed_section_contents): Call do_section_contents
1902 (Sized_relobj_file::do_section_contents): Adjust parameter list and
1904 * options.h (class General_options): Add --gdb-index option.
1905 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1906 list and return type.
1907 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1908 * reloc.h (Track_relocs::checkpoint): New function.
1909 (Track_relocs::reset): New function.
1911 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1913 * testsuite/Makefile.in: Regenerate.
1914 * testsuite/gdb_index_test.cc: New test source file.
1915 * testsuite/gdb_index_test_1.sh: New test source file.
1916 * testsuite/gdb_index_test_2.sh: New test source file.
1918 2012-03-19 Doug Kwan <dougkwan@google.com>
1920 * arm.cc (Target_arm::do_define_standard_symbols): New method.
1921 (Target_arm::do_finalize_sections): Remove code which defines
1922 __exidx_start and __exidx_end. Make symbol table parameter
1923 anonymous as it is not used.
1924 * gold.cc (queue_middle_tasks): Call target hook to define any
1925 target-specific symbols.
1926 * target.h (Target::define_standard_symbols): New method.
1927 (Target::do_define_standard_symbols): Same.
1928 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1929 * testsuite/Makefile.in: Regenerate.
1930 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1932 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1933 relocations are generated for __exidx_start and __exidx_end.
1935 2012-03-16 Doug Kwan <dougkwan@google.com>
1937 * testsuite/Makefile.am: Disable test initpri3b.
1938 * testsuite/Makefile.in: Regenerate.
1940 2012-03-15 Doug Kwan <dougkwan@google.com>
1942 * arm.cc (Target_arm::got_section): Make .got section read-only
1945 2012-03-15 Ian Lance Taylor <iant@google.com>
1948 * layout.cc (Layout::make_output_section): Correctly mark
1949 SHT_INIT_ARRAY, et. al., as relro.
1951 2012-03-14 Doug Kwan <dougkwan@google.com>
1953 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1954 dynamic relocations for protected symbols in shared objects.
1956 2012-03-13 Ian Lance Taylor <iant@google.com>
1958 * resolve.cc (Symbol_table::resolve): When merging common symbols,
1959 keep the larger alignment.
1961 2012-03-12 Cary Coutant <ccoutant@google.com>
1963 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1964 handling of DW_LNE_define_file.
1966 2012-03-12 Cary Coutant <ccoutant@google.com>
1968 * reduced_debug_output.cc
1969 (Output_reduced_debug_info_section::get_die_end): Add new FORM
1972 2012-02-29 Cary Coutant <ccoutant@google.com>
1974 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1976 2012-02-29 Cary Coutant <ccoutant@google.com>
1978 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1979 Call Object::decompressed_section_contents.
1980 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1982 (Sized_dwarf_line_info::buffer_start_): New data member.
1983 * merge.cc (Output_merge_data::do_add_input_section): Call
1984 Object::decompressed_section_contents.
1985 (Output_merge_string::do_add_input_section): Likewise.
1986 * object.cc (need_decompressed_section): New function.
1987 (build_compressed_section_map): Decompress sections needed later.
1988 (Sized_relobj_file::do_decompressed_section_contents): New function.
1989 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1990 * object.h (Object::decompressed_section_contents): New function.
1991 (Object::discard_decompressed_sections): New function.
1992 (Object::do_decompressed_section_contents): New function.
1993 (Object::do_discard_decompressed_sections): New function.
1994 (Compressed_section_info): New type.
1995 (Compressed_section_map): Include decompressed section contents.
1996 (Sized_relobj_file::do_decompressed_section_contents): New function.
1997 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1999 2012-02-16 Cary Coutant <ccoutant@google.com>
2001 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2002 * testsuite/Makefile.in: Regenerate.
2004 2012-02-14 Cary Coutant <ccoutant@google.com>
2006 * options.cc (General_options::finalize): Disallow -pie and -static.
2008 2012-02-03 Doug Kwan <dougkwan@google.com>
2010 * arm.cc (Arm_relocate_functions::abs8,
2011 Arm_relocate_functions::abs16): Use
2012 Bits::has_signed_unsigned_overflow32.
2013 (Arm_relocate_functions::thm_abs8): Correct range of
2015 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2018 2012-02-02 Doug Kwan <dougkwan@google.com>
2020 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2021 position independent outputs, not just shared objects.
2023 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
2025 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2026 * configure: Regenerated.
2028 2012-01-27 Ian Lance Taylor <iant@google.com>
2030 * reloc.h (Bits): New class with static functions, copied from
2031 namespace utils in arm.cc.
2032 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
2035 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2037 * incremental.cc (write_info_blocks): Correct relocation offset.
2039 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2041 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2042 (Relocate::tls_gd_to_le): Likewise.
2044 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2046 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2048 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2050 * configure.ac: Check if -mcmodel=medium works.
2051 * configure: Regenerated.
2053 2012-01-24 Cary Coutant <ccoutant@google.com>
2055 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2057 (read_unsigned_LEB_128_x): ... this new function.
2058 (read_signed_LEB_128): Replaced with inline definition and ...
2059 (read_signed_LEB_128_x): ... this new function.
2060 * int_encoding.h (read_unsigned_LEB_128_x): New function.
2061 (read_unsigned_LEB_128): Add inline definition.
2062 (read_signed_LEB_128_x): New function.
2063 (read_signed_LEB_128): Add inline definition.
2064 * testsuite/Makefile.am (leb128_unittest): New unit test.
2065 * testsuite/Makefile.in: Regenerate.
2066 * testsuite/leb128_unittest.cc: New unit test.
2068 2012-01-23 Ian Lance Taylor <iant@google.com>
2071 * i386.cc (Target_i386::do_code_fill): When using a jmp
2072 instruction, pad with nop instructions.
2073 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2075 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
2077 * x86_64.cc (gc_process_relocs): Add typename on types used in
2079 (scan_relocs): Likewise.
2080 (relocate_section): Likewise.
2081 (apply_relocation): Likewise.
2083 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
2085 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2086 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2089 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
2091 * x86_64.cc: Initial support for x32.
2093 2012-01-03 Cary Coutant <ccoutant@google.com>
2095 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2096 Use abstract base class for GOT.
2097 * gold/output.h (class Output_data_got_base): New abstract base class.
2098 (class Output_data_got): Derive from new base class, adjust ctors.
2099 (Output_data_got::reserve_slot): Make virtual; rename to
2100 do_reserve_slot; Adjust callers.
2101 * gold/target.h (Sized_target::init_got_plt_for_update): Return
2102 pointer to abstract base class.
2103 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2105 2011-12-18 Ian Lance Taylor <iant@google.com>
2107 * object.h (Relobj::local_symbol_value): New function.
2108 (Relobj::local_plt_offset): New function.
2109 (Relobj::local_has_got_offset): New function.
2110 (Relobj::local_got_offset): New function.
2111 (Relobj::set_local_got_offset): New function.
2112 (Relobj::do_local_symbol_value): New pure virtual function.
2113 (Relobj::do_local_plt_offset): Likewise.
2114 (Relobj::do_local_has_got_offset): Likewise.
2115 (Relobj::do_local_got_offset): Likewise.
2116 (Relobj::do_set_local_got_offset): Likewise.
2117 (Sized_relobj::do_local_has_got_offset): Rename from
2118 local_has_got_offset.
2119 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2120 (Sized_relobj::do_set_local_got_offset): Rename from
2121 set_local_got_offset.
2122 (Sized_relobj_file::do_local_plt_offset): Rename from
2124 (Sized_relobj_file::do_local_symbol_value): New function.
2125 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2127 * output.cc (Output_data_got::Got_entry::write): Change object to
2128 Relobj. Use local_symbol_value.
2129 (Output_data_got::add_global_with_rel): Change rel_dyn to
2130 Output_data_reloc_generic*. Use add_global_generic.
2131 (Output_data_got::add_global_with_rela): Remove. Change all
2132 callers to use add_global_with_rel.
2133 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2134 Output_data_reloc_generic*. Use add_global_generic.
2135 (Output_data_got::add_global_pair_with_rela): Remove. Change all
2136 callers to use add_global_pair_with_rel.
2137 (Output_data_got::add_local): Change object to Relobj*.
2138 (Output_data_got::add_local_plt): Likewise.
2139 (Output_data_got::add_local_with_rel): Change object to Relobj*,
2140 change rel_dyn to Output_data_reloc_generic*. Use
2142 (Output_data_got::add_local_with_rela): Remove. Change all
2143 callers to use all_local_with_rel.
2144 (Output_data_got::add_local_pair_with_rel): Change object to
2145 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
2146 add_output_section_generic.
2147 (Output_data_got::add_local_pair_with_rela): Remove. Change all
2148 callers to use add_local_pair_with_rel.
2149 (Output_data_got::reserve_local): Change object to Relobj*.
2150 * output.h: (class Output_data_reloc_generic): Add pure virtual
2151 declarations for add_global_generic, add_local_generic,
2152 add_output_section_generic.
2153 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2154 functions for Output_data_reloc_generic. Update declarations for
2155 changes listed in output.cc.
2156 (class Output_data_got): Change template parameter to got_size.
2157 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
2158 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2160 (Sized_relobj_incr::do_local_plt_offset): New function.
2161 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2164 2011-12-17 Cary Coutant <ccoutant@google.com>
2166 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2167 * resolve.cc (Symbol_table::resolve): Likewise.
2168 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2170 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2172 2011-12-16 Ian Lance Taylor <iant@google.com>
2174 * output.h (Output_data_reloc_generic::add): Only call
2175 add_dynamic_reloc if this is a dynamic reloc section.
2177 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
2180 * target-reloc.h (apply_relocation): Replace <64, false> with
2183 2011-11-25 Nick Clifton <nickc@redhat.com>
2185 * po/it.po: New Italian translation.
2187 2011-11-17 Sterling Augustine <saugustine@google.com>
2189 * script.cc (script_include_directive): Implement.
2190 (read_script_file): New local variables name and search_path. Update
2191 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2192 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2193 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2195 2011-11-11 Sterling Augustine <saugustine@google.com>
2197 * yyscript.y (section_cmd): Add support for INCLUDE directive.
2198 (file_or_sections_cmd): Likewise.
2200 2011-11-11 Doug Kwan <dougkwan@google.com>
2202 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2203 if --just-symbols is given.
2205 2011-11-10 Doug Kwan <dougkwan@google.com>
2208 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2209 when processing data relocs.
2210 * reloc.h (Relocate_functions::rel_unaligned): New method.
2211 (Relocate_functions::pcrel_unaligned): Ditto.
2212 (Relocate_functions::rel32_unaligned): Ditto.
2213 (Relocate_functions::pcrel32_unaligned): Ditto.
2215 2011-11-09 Doug Kwan <dougkwan@google.com>
2218 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2219 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2220 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2221 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2222 (Relocate_functions::rel_unaligned): New.
2223 (Relocate_functions::rel32_unaligned): New.
2224 * target-reloc.h (relocate_for_relocatable): Add code to handle
2225 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2226 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2227 arm_unaligned_reloc_r): New targets.
2228 * testsuite/Makefile.in: Regenerate.
2229 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2232 2011-11-02 Ian Lance Taylor <iant@google.com>
2234 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
2236 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2237 * options.cc (General_options::finalize): Use library search path
2238 from configure script if specified. If not native and no sysroot,
2239 only search TOOLLIBDIR.
2240 * options.h (Search_directory::Search_directory): Change name to
2242 (General_options::add_to_library_path_with_sysroot): Change arg to
2244 * configure, Makefile.in, config.in: Rebuild.
2246 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2248 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2249 we are working around the ARM1176 Erratum.
2250 * options.h (General_options::fix_arm1176): Add option.
2251 * testsuite/Makefile.am: Add testcases, and keep current ones
2253 * testsuite/Makefile.in: Regenerate.
2254 * testsuite/arm_fix_1176.s: New file.
2255 * testsuite/arm_fix_1176.sh: Likewise.
2257 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2259 * arm.cc (Target_arm::Target_arm): Remove initialisation of
2261 (Target_arm::may_use_blx): Remove method.
2262 (Target_arm::set_may_use_blx): Likewise.
2263 (Target_arm::may_use_v4t_interworking): New method.
2264 (Target_arm::may_use_v5t_interworking): Likewise.
2265 (Target_arm::may_use_blx_): Remove member variable.
2266 (Arm_relocate_functions::arm_branch_common): Check for v5T
2268 (Arm_relocate_functions::thumb_branch_common): Likewise.
2269 (Reloc_stub::stub_type_for_reloc): Likewise.
2270 (Target_arm::do_finalize_sections): Correct interworking checks.
2271 * testsuite/Makefile.am: Add new tests.
2272 * testsuite/Makefile.in: Regenerate.
2273 * testsuite/arm_farcall_arm_arm.s: New test.
2274 * testsuite/arm_farcall_arm_arm.sh: Likewise.
2275 * testsuite/arm_farcall_arm_thumb.s: Likewise.
2276 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2277 * testsuite/arm_farcall_thumb_arm.s: Likewise.
2278 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2279 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2280 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2282 2011-10-31 Cary Coutant <ccoutant@google.com>
2285 * expression.cc (Expression::eval_with_dot): Add
2286 is_section_dot_assignment parameter.
2287 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
2288 absolute and assigning to dot within a section.
2289 * script-sections.cc
2290 (Output_section_element_assignment::set_section_addresses): Pass
2291 dot_section to set_if_absolute.
2292 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2293 as is_section_dot_assignment flag to eval_with_dot.
2294 (Output_section_element_dot_assignment::set_section_addresses):
2296 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2297 parameter. Also set value if relative to dot_section; set the
2298 symbol's output_section.
2299 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2300 parameter. Adjust all callers.
2301 (Expression::eval_maybe_dot): Likewise.
2302 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2304 * testsuite/script_test_2.t: Test assignment of an absolute value
2305 to dot within an output section element.
2307 2011-10-31 Cary Coutant <ccoutant@google.com>
2309 * options.h (class General_options): Add --[no-]gnu-unique options.
2310 * symtab.cc (Symbol_table::sized_write_globals): Convert
2311 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2313 2011-10-31 Cary Coutant <ccoutant@google.com>
2316 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2317 unnecessary assertion.
2318 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2320 2011-10-31 Sriraman Tallam <tmsriram@google.com>
2322 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2324 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2326 Change to just keep the section associated with symbol.
2327 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2328 they are externally visible and --export-dynamic is turned on.
2329 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2331 2011-10-19 Ian Lance Taylor <iant@google.com>
2334 * script-sections.cc
2335 (Output_section_element_dot_assignment::needs_output_section): New
2338 2011-10-19 Ian Lance Taylor <iant@google.com>
2341 * layout.cc (Layout::segment_precedes): Don't assert failure if a
2342 --section-start option was seen.
2343 * options.h (General_options::any_section_start): New function.
2345 2011-10-18 David S. Miller <davem@davemloft.net>
2348 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2349 member to track relocation locations that have moved during TLS
2350 reloc optimizations.
2351 (Target_sparc::Relocate::Relocate): Initialize to NULL.
2352 (Target_sparc::Relocate::relocate): Adjust view down by 4
2353 bytes if it matches reloc_adjust_addr_.
2354 (Target_sparc::Relocate::relocate_tls): Always move the
2355 __tls_get_addr call delay slot instruction forward 4 bytes when
2356 performing relaxation.
2358 2011-10-18 Cary Coutant <ccoutant@google.com>
2360 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2361 (Output_file::map_no_anonymous): Check for non-zero
2362 return code from posix_fallocate.
2364 2011-10-17 Cary Coutant <ccoutant@google.com>
2367 * plugin.cc (is_visible_from_outside): Check for symbols
2368 referenced from dynamic objects.
2369 * resolve.cc (Symbol_table::resolve): Don't count references
2370 from dynamic objects as references from real ELF files.
2371 * testsuite/plugin_test_2.sh: Adjust expected result.
2373 2011-10-17 Cary Coutant <ccoutant@google.com>
2375 * gold.cc: Include timer.h.
2376 (queue_middle_tasks): Stamp time.
2377 (queue_final_tasks): Likewise.
2378 * main.cc (main): Store timer in parameters. Print timers
2380 * parameters.cc (Parameters::Parameters): Initialize timer_.
2381 (Parameters::set_timer): New function.
2382 (set_parameters_timer): New function.
2383 * parameters.h (Parameters::set_timer): New function.
2384 (Parameters::timer): New function.
2385 (Parameters::timer_): New data member.
2386 (set_parameters_timer): New function.
2387 * timer.cc (Timer::stamp): New function.
2388 (Timer::get_pass_time): New function.
2389 * timer.h (Timer::stamp): New function.
2390 (Timer::get_pass_time): New function.
2391 (Timer::pass_times_): New data member.
2393 2011-10-17 Cary Coutant <ccoutant@google.com>
2395 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2396 task for members of lib groups.
2398 2011-10-17 Cary Coutant <ccoutant@google.com>
2401 * fileread.cc (File_read::find_view): Add assert.
2402 (File_read::make_view): Move bounds check (replace with assert)...
2403 (File_read::find_or_make_view): ... to here.
2405 2011-10-12 Cary Coutant <ccoutant@google.com>
2407 * output.cc (Output_file::open_base_file): Handle case where
2408 ::read returns less than requested size.
2410 2011-10-10 Cary Coutant <ccoutant@google.com>
2412 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2413 Initialize defined_count_.
2414 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2415 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2416 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2417 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2418 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2419 * incremental.h (Sized_relobj_incr::defined_count_): New data
2421 (Sized_incr_dynobj::defined_count_): New data member.
2422 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2423 Return zeroes instead of internal error.
2425 2011-10-10 Cary Coutant <ccoutant@google.com>
2428 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2429 (Output_reloc::symbol_value): Return PLT offset if flag is set.
2430 * output.h (class Output_reloc): Add use_plt_offset flag.
2431 (Output_reloc::type_): Adjust size of bit field.
2432 (Output_reloc::use_plt_offset_): New bit field.
2433 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2434 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2435 flag. Adjust all callers.
2436 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2437 creating RELATIVE relocations.
2439 2011-10-10 Nick Clifton <nickc@redhat.com>
2441 * po/es.po: Updated Spanish translation.
2442 * po/fi.po: Updated Finnish translation.
2444 2011-10-03 Diego Novillo <dnovillo@google.com>
2446 * options.cc (parse_uint): Fix dereference of RETVAL.
2448 2011-09-29 Sriraman Tallam <tmsriram@google.com>
2450 * layout.h (section_order_map_): New member.
2451 (get_section_order_map): New member function.
2452 * output.cc (Output_section::add_input_section): Check for patterns
2453 only when --section-ordering-file is specified.
2454 * gold.cc (queue_middle_tasks): Delay updating order of sections till
2455 output_sections have been formed.
2456 * layout.cc (Layout_Layout): Initialize section_order_map_.
2457 * plugin.cc (update_section_order): Store order in order_map. Do not
2459 * testsuite/Makefile.am: Add test case for plugin_final_layout.
2460 * testsuite/Makefile.in: Regenerate.
2461 * testsuite/plugin_section_order.c: New file.
2462 * testsuite/plugin_final_layout.cc: New file.
2463 * testsuite/plugin_final_layout.sh: New file.
2465 2011-09-29 Cary Coutant <ccoutant@google.com>
2467 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2469 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2470 symbols during incremental update.
2471 (Symbol_table::add_from_dynobj): Likewise.
2473 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2474 Ian Lance Taylor <iant@google.com>
2476 * symtab.cc (Symbol_table::define_special_symbol): Always
2477 canonicalize version string.
2479 2011-09-26 Cary Coutant <ccoutant@google.com>
2481 * gold.cc (queue_initial_tasks): Move option checks ...
2482 * options.cc (General_options::finalize): ... to here. Disable
2483 some options; make others fatal.
2485 2011-09-26 Cary Coutant <ccoutant@google.com>
2488 * plugin.cc (get_symbols_v2): New function.
2489 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2490 (is_referenced_from_outside): New function.
2491 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2492 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2493 (get_symbols): Pass version parameter.
2494 (get_symbols_v2): New function.
2495 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2497 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2498 (onload): Add LDPT_GET_SYMBOLS_V2.
2499 (all_symbols_read_hook): Use get_symbols_v2; check for
2500 LDPR_PREVAILING_DEF_IRONLY_EXP.
2501 * testsuite/plugin_test_3.sh: Update expected results.
2503 2011-09-23 Simon Baldwin <simonb@google.com>
2505 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2506 configuration options.
2507 * configure: Regenerate.
2508 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2509 * Makefile.in: Regenerate.
2510 * testsuite/Makefile.in: Regenerate.
2512 2011-09-19 Sriraman Tallam <tmsriram@google.com>
2514 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2516 2011-09-19 Cary Coutant <ccoutant@google.com>
2518 * incremental.cc (can_incremental_update): Fix typo in comment.
2519 * incremental.h (can_incremental_update): Likewise.
2521 2011-09-18 Cary Coutant <ccoutant@google.com>
2523 * incremental.cc (can_incremental_update): New function.
2524 * incremental.h (can_incremental_update): New function.
2525 * layout.cc (Layout::init_fixed_output_section): Call it.
2526 (Layout::make_output_section): Don't allow patch space in .eh_frame.
2527 * object.cc (Sized_relobj_file::do_layout): Call
2528 can_incremental_update.
2530 2011-09-13 Cary Coutant <ccoutant@google.com>
2532 * configure.ac: Check for glibc support for gnu_indirect_function
2533 support with static linking, setting automake conditional
2535 * Makefile.in: Regenerate.
2536 * configure: Regenerate.
2538 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2539 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2541 * testsuite/Makefile.in: Regenerate.
2543 2011-09-13 Cary Coutant <ccoutant@google.com>
2545 * incremental.cc (Sized_relobj_incr::do_layout): Call
2546 report_comdat_group for kept comdat sections.
2547 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2548 * testsuite/Makefile.in: Regenerate.
2549 * testsuite/incr_comdat_test_1.cc: New source file.
2550 * testsuite/incr_comdat_test_2_v1.cc: New source file.
2551 * testsuite/incr_comdat_test_2_v2.cc: New source file.
2552 * testsuite/incr_comdat_test_2_v3.cc: New source file.
2554 2011-09-13 Ian Lance Taylor <iant@google.com>
2556 * object.cc (Sized_relobj_file::do_layout): Remove unused local
2557 variable external_symbols_offset.
2559 2011-09-12 Ian Lance Taylor <iant@google.com>
2561 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2562 triggered if object has no symbols.
2564 2011-09-09 David S. Miller <davem@davemloft.net>
2566 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2567 (Output_fill_debug_line::do_write): Likewise.
2569 2011-08-29 Cary Coutant <ccoutant@google.com>
2571 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2572 casts to match formatting specs.
2573 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2575 2011-08-26 Cary Coutant <ccoutant@google.com>
2577 * layout.cc (Free_list::allocate): Provide guarantee of minimum
2578 remaining hole size when allocating.
2579 (Layout::make_output_section): Set fill methods for debug sections.
2580 * layout.h (Free_list::Free_list_node): Move from private to
2582 (Free_list::set_min_hole_size): New function.
2583 (Free_list::begin, Free_list::end): New functions.
2584 (Free_list::min_hole_): New data member.
2585 * output.cc: Include dwarf.h.
2586 (Output_fill_debug_info::do_minimum_hole_size): New function.
2587 (Output_fill_debug_info::do_write): New function.
2588 (Output_fill_debug_line::do_minimum_hole_size): New function.
2589 (Output_fill_debug_line::do_write): New function.
2590 (Output_section::Output_section): Initialize new data member.
2591 (Output_section::set_final_data_size): Ensure patch space is larger
2592 than minimum hole size.
2593 (Output_section::do_write): Fill holes in debug sections.
2594 * output.h (Output_fill): New class.
2595 (Output_fill_debug_info): New class.
2596 (Output_fill_debug_line): New class.
2597 (Output_section::set_free_space_fill): New function.
2598 (Output_section::free_space_fill_): New data member.
2599 * testsuite/Makefile.am (incremental_test_3): Add
2600 --incremental-patch option.
2601 (incremental_test_4): Likewise.
2602 (incremental_test_5): Likewise.
2603 (incremental_test_6): Likewise.
2604 (incremental_copy_test): Likewise.
2605 (incremental_common_test_1): Likewise.
2606 * testsuite/Makefile.in: Regenerate.
2608 2011-08-26 Nick Clifton <nickc@redhat.com>
2610 * po/es.po: Updated Spanish translation.
2612 2011-08-01 Cary Coutant <ccoutant@google.com>
2614 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2615 * gold/testsuite/Makefile.in: Regenerate.
2616 * gold/testsuite/justsyms_exec.c: New source file.
2617 * gold/testsuite/justsyms_lib.c: New source file.
2619 2011-08-01 Cary Coutant <ccoutant@google.com>
2621 * layout.cc (Layout::set_segment_offsets): Don't realign text
2622 segment if -Ttext was specified.
2623 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2625 * object.h (Sized_relobj_file::e_type): New function.
2626 (Sized_relobj_file::e_type_): New data member.
2627 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2628 base address for ET_EXEC files.
2629 * target.cc (Target::do_make_elf_object_implementation): Allow
2630 ET_EXEC files with --just-symbols option.
2632 2011-07-28 Cary Coutant <ccoutant@google.com>
2634 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2635 Add thread_number parameter.
2636 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2637 * workqueue-threads.cc
2638 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2639 current thread if its thread number is greater than desired thread
2641 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2642 Add thread_number parameter.
2643 (Workqueue::should_cancel_thread): Likewise.
2644 (Workqueue::find_runnable_or_wait): Pass thread_number to
2645 should_cancel_thread.
2646 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2649 2011-07-22 Sriraman Tallam <tmsriram@google.com>
2651 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2652 only after checking if it cannot be forced local.
2653 * symtab.h (is_externally_visible): Check if the symbol is not forced
2656 2011-07-15 Ian Lance Taylor <iant@google.com>
2658 * options.h (class General_options): Add --print-output-format.
2659 Move -EL next to -EB, for better --help output.
2660 * target-select.cc: Include <cstdio>, "options.h", and
2662 (Target_selector::do_target_bfd_name): New function.
2663 (print_output_format): New function.
2664 * target-select.h (class Target_selector): Update declarations.
2665 (Target_selector::target_bfd_name): New function.
2666 (print_output_format): Declare.
2667 * main.cc: Include "target-select.h".
2668 (main): Handle --print-output-format.
2669 * gold.cc: Include "target-select.h".
2670 (queue_initial_tasks): Handle --print-output-format when there are
2672 * parameters.cc (parameters_force_valid_target): Give a better
2673 error message if -EB/-EL does not match target.
2674 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2677 2011-07-15 Ian Lance Taylor <iant@google.com>
2679 * i386.cc (class Output_data_plt_i386): Add layout_ field.
2680 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2681 (Output_data_plt_i386::do_write): Write address of .dynamic
2682 section to first entry in .got.plt section.
2683 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2684 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2686 (Output_data_plt_x86_64::do_write): Write address of .dynamic
2687 section to first entry in .got.plt section.
2688 * layout.h (Layout::dynamic_section): New function.
2690 2011-07-13 Sriraman Tallam <tmsriram@google.com>
2692 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2694 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2695 input_section_position_, and input_section_glob_.
2696 (read_layout_from_file): Call function section_ordering_specified.
2697 * layout.h (is_section_ordering_specified): New function.
2698 (section_ordering_specified): New function.
2699 (section_ordering_specified_): New boolean member.
2700 * main.cc(main): Call load_plugins after layout object is defined.
2701 * output.cc (Output_section::add_input_section): Use
2702 function section_ordering_specified to check if section ordering is
2704 * output.cc (Output_section::add_relaxed_input_section): Use
2705 function section_ordering_specified to check if section ordering is
2707 (Output_section::update_section_layout): New function.
2708 (Output_section::sort_attached_input_sections): Check if input section
2710 * output.h (Output_section::update_section_layout): New function.
2711 * plugin.cc (get_section_count): New function.
2712 (get_section_type): New function.
2713 (get_section_name): New function.
2714 (get_section_contents): New function.
2715 (update_section_order): New function.
2716 (allow_section_ordering): New function.
2717 (Plugin::load): Add the new interfaces to the transfer vector.
2718 (Plugin_manager::load_plugins): New parameter.
2719 (Plugin_manager::all_symbols_read): New parameter.
2720 (Plugin_manager::claim_file): New parameter. Save the elf object for
2722 (Plugin_manager::get_elf_object): New function.
2723 (Plugin_manager::get_view): Change to directly use the bool to check
2724 if get_view is called from claim_file_hook.
2725 * plugin.h (input_objects): New function
2726 (Plugin__manager::load_plugins): New parameter.
2727 (Plugin_manager::claim_file): New parameter.
2728 (Plugin_manager::get_elf_object): New function.
2729 (Plugin_manager::in_claim_file_handler): New function.
2730 (Plugin_manager::in_claim_file_handler_): New member.
2731 (layout): New function.
2732 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2733 handler with an extra parameter. Make the elf object before calling
2735 * testsuite/plugin_test.c (get_section_count): New function pointer.
2736 (get_section_type): New function pointer.
2737 (get_section_name): New function pointer.
2738 (get_section_contents): New function pointer.
2739 (update_section_order): New function pointer.
2740 (allow_section_ordering): New function pointer.
2741 (onload): Check if the new interfaces exist.
2743 2011-07-13 Ian Lance Taylor <iant@google.com>
2745 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2747 * x86_64.cc (Target_x86_64::got_section): Likewise.
2748 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2749 (relro_now_test_SOURCES): New variable.
2750 (relro_now_test_DEPENDENCIES): New variable.
2751 (relro_now_test_LDFLAGS): New variable.
2752 (relro_now_test_LDADD): New variable.
2753 (relro_now_test.so): New target.
2754 * testsuite/Makefile.in: Rebuild.
2756 2011-07-12 Ian Lance Taylor <iant@google.com>
2759 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2760 GLOB_DAT relocation rather than a RELATIVE relocation for a
2761 protected symbol when creating a shared library.
2762 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2763 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2764 * testsuite/protected_main_1.cc (main): Test that protected
2765 function has same address.
2767 2011-07-11 Ian Lance Taylor <iant@google.com>
2770 * options.h (class General_options): Add -Bgroup.
2771 * options.cc (General_options::finalize): If -Bgroup is set,
2772 default to --unresolved-symbols=report-all.
2773 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2774 * target-reloc.h (issue_undefined_symbol_error): Handle
2775 --unresolved-symbols=report-all.
2777 2011-07-08 Ian Lance Taylor <iant@google.com>
2780 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2781 if linker script discards key sections.
2782 (Layout::create_dynamic_symtab): Likewise.
2783 (Layout::assign_local_dynsym_offsets): Likewise.
2784 (Layout::sized_create_version_sections): Likewise.
2785 (Layout::create_interp): Likewise.
2786 (Layout::finish_dynamic_section): Likewise.
2787 (Layout::set_dynamic_symbol_size): Likewise.
2789 2011-07-08 Ian Lance Taylor <iant@google.com>
2792 * options.h (class General_options): Add --unresolved-symbols.
2793 * target-reloc.h (issue_undefined_symbol_error): Check
2794 --unresolved-symbols. Add comments.
2796 2011-07-08 Ian Lance Taylor <iant@google.com>
2798 * testsuite/odr_violation2.cc (Ordering::operator()): Make
2799 expression more complex.
2801 2011-07-08 Ian Lance Taylor <iant@google.com>
2804 * target-reloc.h (issue_undefined_symbol_error): New inline
2805 function, broken out of relocate_section.
2806 (relocate_section): Call issue_undefined_symbol_error.
2807 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2808 there is no TLS segment if we are about to issue an undefined
2810 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2812 2011-07-08 Ian Lance Taylor <iant@google.com>
2815 * resolve.cc (Symbol_table::should_override): Add fromtype
2816 parameter. Change all callers. Give error when linking together
2817 TLS and non-TLS symbol.
2818 (Symbol_table::should_override_with_special): Add fromtype
2819 parameter. Change all callers.
2820 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2821 there is no TLS segment if we have reported some errors.
2822 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2824 2011-07-08 Ian Lance Taylor <iant@google.com>
2827 * target.h (Target::plt_address_for_global): New function.
2828 (Target::plt_address_for_local): New function.
2829 (Target::plt_section_for_global): Remove.
2830 (Target::plt_section_for_local): Remove.
2831 (Target::do_plt_address_for_global): New virtual function.
2832 (Target::do_plt_address_for_local): New virtual function.
2833 (Target::do_plt_section_for_global): Remove.
2834 (Target::do_plt_section_for_local): Remove.
2835 (Target::register_global_plt_entry): Add Symbol_table and Layout
2837 * output.cc (Output_data_got::Got_entry::write): Use
2838 plt_address_for_global and plt_address_for_local.
2839 * layout.cc (Layout::add_target_dynamic_tags): Use size and
2840 address of output section.
2841 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2842 got_irelative_, and irelative_count_ fields. Update
2844 (Output_data_plt_i386::has_irelative_section): New function.
2845 (Output_data_plt_i386::entry_count): Add irelative_count_.
2846 (Output_data_plt_i386::set_final_data_size): Likewise.
2847 (class Target_i386): Add got_irelative_ and rel_irelative_
2848 fields. Update declarations.
2849 (Target_i386::Target_i386): Initialize new fields.
2850 (Target_i386::do_plt_address_for_global): New function replacing
2851 do_plt_section_for_global.
2852 (Target_i386::do_plt_address_for_local): New function replacing
2853 do_plt_section_for_local.
2854 (Target_i386::got_section): Create got_irelative_.
2855 (Target_i386::rel_irelative_section): New function.
2856 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2857 fields. Don't define __rel_iplt_{start,end}.
2858 (Output_data_plt_i386::add_entry): Add symtab and layout
2859 parameters. Change all callers. Use different PLT and GOT for
2861 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2862 layout parameters. Change all callers. Use different PLT and
2864 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2865 (Output_data_plt_i386::rel_irelative): New function.
2866 (Output_data_plt_i386::address_for_global): New function.
2867 (Output_data_plt_i386::address_for_local): New function.
2868 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
2869 IRELATIVE GOT when changing IFUNC GOT entries.
2870 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2872 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2873 if we didn't create an IRELATIVE GOT.
2874 (Target_i386::Relocate::relocate): Use plt_address_for_global and
2875 plt_address_for_local.
2876 (Target_i386::do_dynsym_value): Use plt_address_for_global.
2877 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2878 got_irelative_, and irelative_count_ fields. Update
2880 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2881 Initialize new fields. Remove symtab parameter. Change all
2883 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2885 (Output_data_plt_x86_64::has_irelative_section): New function.
2886 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2887 (class Target_x86_64): Add got_irelative_ and rel_irelative_
2888 fields. Update declarations.
2889 (Target_x86_64::Target_x86_64): Initialize new fields.
2890 (Target_x86_64::do_plt_address_for_global): New function replacing
2891 do_plt_section_for_global.
2892 (Target_x86_64::do_plt_address_for_local): New function replacing
2893 do_plt_section_for_local.
2894 (Target_x86_64::got_section): Create got_irelative_.
2895 (Target_x86_64::rela_irelative_section): New function.
2896 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
2897 all callers. Don't create __rel_iplt_{start,end}.
2898 (Output_data_plt_x86_64::add_entry): Add symtab and layout
2899 parameters. Change all callers. Use different PLT and GOT for
2901 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2902 layout parameters. Change all callers. Use different PLT and
2904 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2905 parameters. Change all callers. Use different PLT and GOT for
2907 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2908 (Output_data_plt_x86_64::rela_irelative): New function.
2909 (Output_data_plt_x86_64::address_for_global): New function.
2910 (Output_data_plt_x86_64::address_for_local): New function.
2911 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2912 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2913 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2914 (Target_x86_64::register_global_plt_entry): Add symtab and layout
2916 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2918 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2919 symbols if we didn't create an IRELATIVE GOT.
2920 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2921 plt_address_for_local.
2922 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2923 * testsuite/ifuncvar1.c: New test file.
2924 * testsuite/ifuncvar2.c: New test file.
2925 * testsuite/ifuncvar3.c: New test file.
2926 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2927 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2928 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2929 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2930 * testsuite/Makefile.in: Rebuild.
2932 2011-07-07 Cary Coutant <ccoutant@google.com>
2934 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2935 (two_file_test_1_ndebug.o): Likewise.
2936 (two_file_test_1b_ndebug.o): Likewise.
2937 (two_file_test_2_ndebug.o): Likewise.
2938 (two_file_test_main_ndebug.o): Likewise.
2939 (incremental_test_2): Link with no-debug versions.
2941 2011-07-06 Cary Coutant <ccoutant@google.com>
2943 * gold/incremental.cc
2944 (Output_section_incremental_inputs::write_info_blocks): Check for
2945 hidden and internal symbols.
2947 2011-07-06 Cary Coutant <ccoutant@google.com>
2949 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2950 Check disposition for startup file.
2951 (Incremental_inputs::report_command_line): Ignore
2952 --incremental-startup-unchanged option.
2953 * options.cc (General_options::parse_incremental_startup_unchanged):
2955 (General_options::General_options): Initialize new data member.
2956 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2957 (General_options): Add --incremental-startup-unchanged option.
2958 (General_options::incremental_startup_disposition): New function.
2959 (General_options::incremental_startup_disposition_): New data member.
2961 2011-07-06 Cary Coutant <ccoutant@google.com>
2963 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2964 input file index to Script_info ctor.
2965 (Sized_incremental_binary::do_file_has_changed): Find the
2966 command-line argument for files named in scripts.
2967 * incremental.h (Script_info::Script_info): New ctor
2968 with input file index.
2969 (Script_info::input_file_index): New function.
2970 (Script_info::input_file_index_): New data member.
2971 (Incremental_binary::get_library): Add const.
2972 (Incremental_binary::get_script_info): Add const.
2973 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2974 * testsuite/Makefile.am (incremental_test_5): New test case.
2975 (incremental_test_6): New test case.
2976 * testsuite/Makefile.in: Regenerate.
2978 2011-07-06 Cary Coutant <ccoutant@google.com>
2980 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2981 debug output when command lines differ.
2983 2011-07-06 Cary Coutant <ccoutant@google.com>
2985 * incremental.cc (Incremental_inputs::report_command_line): Ignore
2986 --incremental-patch option.
2987 * layout.cc (Free_list::allocate): Extend allocation beyond original
2989 (Layout::make_output_section): Mark sections that should get
2991 * options.cc (parse_percent): New function.
2992 * options.h (parse_percent): New function.
2993 (DEFINE_percent): New macro.
2994 (General_options): Add --incremental-patch option.
2995 * output.cc (Output_section::Output_section): Initialize new data
2997 (Output_section::add_input_section): Print section name when out
2999 (Output_section::add_output_section_data): Likewise.
3000 (Output_section::set_final_data_size): Add patch space when
3001 doing --incremental-full.
3002 (Output_section::do_reset_address_and_file_offset): Remove patch
3004 (Output_segment::set_section_list_addresses): Print debug output
3005 only if --incremental-update.
3006 * output.h (Output_section::set_is_patch_space_allowed): New function.
3007 (Output_section::is_patch_space_allowed_): New data member.
3008 (Output_section::patch_space_): New data member.
3009 * parameters.cc (Parameters::incremental_full): New function.
3010 * parameters.h (Parameters::incremental_full): New function
3011 * testsuite/Makefile.am (incremental_test_2): Add test for
3012 --incremental-patch option.
3013 * testsuite/Makefile.in: Regenerate.
3014 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3015 (t18): Remove function body.
3017 2011-07-05 Doug Kwan <dougkwan@google.com>
3020 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3021 Arm_Address type for relocation result.
3022 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
3024 (Arm_relocate_functions::abs32): Use unaligned access.
3025 (Arm_relocate_functions::rel32): Ditto.
3026 (Arm_relocate_functions::prel31): Ditto.
3027 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3028 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3029 static data relocations.
3030 * testsuite/Makefile.in: Regnerate.
3031 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3033 2011-07-05 Ian Lance Taylor <iant@google.com>
3036 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3037 symbols if necessary.
3038 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3040 2011-07-05 Ian Lance Taylor <iant@google.com>
3043 * resolve.cc (Symbol::override_base_with_special): Simply override
3044 version with special symbol version, ignoring previous version.
3046 2011-07-05 Ian Lance Taylor <iant@google.com>
3048 * object.cc (Sized_relobj_file::include_section_group): Add
3049 information to comment about signature location.
3051 2011-07-02 Ian Lance Taylor <iant@google.com>
3054 * options.h (class General_options): Add -f and -F.
3055 * options.cc (General_options::finalize): Fatal error if -f/-F
3056 are used without -shared.
3057 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3059 2011-07-02 Ian Lance Taylor <iant@google.com>
3061 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3063 2011-07-01 Ian Lance Taylor <iant@google.com>
3067 * resolve.cc (Symbol::override_base_with_special): Don't override
3068 the version if the overriding symbol has a different name.
3069 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
3070 all callers. If we give an error about an undefined version,
3071 define the base version if necessary.
3072 * dynobj.h (class Versions): Update declaration.
3073 * testsuite/weak_alias_test_5.cc: New file.
3074 * testsuite/weak_alias_test.script: New file.
3075 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3076 and versioned_alias have the right value, and call t2.
3077 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3078 weak_alias_test_5.so.
3079 (weak_alias_test_LDADD): Likewise.
3080 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3081 * testsuite/Makefile.in: Rebuild.
3083 2011-07-01 Ian Lance Taylor <iant@google.com>
3086 * options.h (class General_options): Support -z notext.
3087 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3089 (two_file_shared_nonpic.so): Likewise.
3090 (two_file_shared_mixed.so): Likewise.
3091 (two_file_shared_mixed_1.so): Likewise.
3092 (weak_undef_lib_nonpic.so): Likewise.
3093 (alt/weak_undef_lib_nonpic.so): Likewise.
3094 (tls_test_shared_nonpic.so): Likewise.
3095 * testsuite/Makefile.in: Rebuild.
3097 2011-07-01 Ian Lance Taylor <iant@google.com>
3100 * configure.ac: Test whether static linking works, setting
3101 the automake conditional HAVE_STATIC.
3102 * testsuite/Makefile.am: Disable tests using -static if
3103 HAVE_STATIC is not true.
3104 * configure, testsuite/Makefile.in: Rebuild.
3106 2011-07-01 Ian Lance Taylor <iant@google.com>
3109 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3110 Assert if we see DW_EH_PE_indirect.
3111 * target.h (Target::ehframe_datarel_base): New function.
3112 (Target::do_ehframe_datarel_base): New target function.
3113 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3114 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3117 2011-07-01 Ian Lance Taylor <iant@google.com>
3120 * options.h (class General_options): Add
3121 --ld-generated-unwind-info.
3122 * ehframe.cc (Fde::write): Add address parameter. Change all
3123 callers. If associated with PLT, fill in address and size.
3124 (Cie::set_output_offset): Only add merge mapping if there is an
3126 (Cie::write): Add address parameter. Change all callers.
3127 (Eh_frame::add_ehframe_for_plt): New function.
3128 * ehframe.h (class Fde): Update declarations. Move shndx_ and
3129 input_offset_ fields into union u_, with new plt field.
3130 (Fde::Fde): Adjust for new union field.
3131 (Fde::Fde) [Output_data version]: New constructor.
3132 (Fde::add_mapping): Only add merge mapping if there is an object.
3133 (class Cie): Update declarations.
3134 (class Eh_frame): Declare add_ehframe_for_plt.
3135 * layout.cc (Layout::layout_eh_frame): Break out code into
3136 make_eh_frame_section, and call it.
3137 (Layout::make_eh_frame_section): New function.
3138 (Layout::add_eh_frame_for_plt): New function.
3139 * layout.h (class Layout): Update declarations.
3140 * merge.cc (Merge_map::add_mapping): Add assertion.
3141 * i386.cc: Include "dwarf.h".
3142 (class Output_data_plt_i386): Make first_plt_entry,
3143 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
3144 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3145 and plt_eh_frame_fde.
3146 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3147 boundary. Call add_eh_frame_for_plt if appropriate.
3148 * x86_64.cc: Include "dwarf.h".
3149 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
3150 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
3151 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3152 and plt_eh_frame_fde.
3153 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3156 2011-06-29 Ian Lance Taylor <iant@google.com>
3159 * object.cc (Sized_relobj_file::layout_section): Change shdr
3160 parameter to be const.
3161 (Sized_relobj_file::layout_eh_frame_section): New function, broken
3163 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3164 appropriate. Call layout_eh_frame_section.
3165 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3167 * object.h (class Sized_relobj_file): Update declarations.
3169 2011-06-29 Ian Lance Taylor <iant@google.com>
3172 * script.cc (Token::integer_value): Accept trailing M/m/K/k
3174 (Lex::gather_token): Accept trailing M/m/K/k for integers.
3176 2011-06-29 Ian Lance Taylor <iant@google.com>
3179 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3181 * layout.cc (Layout::layout_eh_frame): Likewise.
3183 2011-06-29 Ian Lance Taylor <iant@google.com>
3186 * layout.cc (Layout::symtab_section_shndx): New function.
3187 * layout.h (class Layout): Declare symtab_section_shndx.
3188 * output.cc (Output_section::write_header): Call it.
3190 2011-06-29 Ian Lance Taylor <iant@google.com>
3193 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3194 symbols which are not used in a relocation.
3196 2011-06-28 Ian Lance Taylor <iant@google.com>
3199 * layout.cc (Layout::segment_precedes): Don't crash if a linker
3200 script create indistinguishable segments.
3201 (Layout::set_segment_offsets): Use stable_sort when sorting
3202 segments. Pass this to Compare_segments constructor.
3203 * layout.h (class Layout): Make segment_precedes non-static.
3204 (class Compare_segments): Change from struct to class. Add
3205 layout_ field. Add constructor.
3206 * script-sections.cc
3207 (Script_sections::attach_sections_using_phdrs_clause): Rename
3208 local orphan to is_orphan. Don't report failure to put empty
3209 section in segment. On attachment failure, report name of
3210 section, and attach to first PT_LOAD segment.
3212 2011-06-28 Ian Lance Taylor <iant@google.com>
3215 * target-select.cc (Target_selector::Target_selector): Add
3216 emulation parameter. Change all callers.
3217 (select_target_by_bfd_name): Rename from select_target_by_name.
3219 (select_target_by_emulation): New function.
3220 (supported_emulation_names): New function.
3221 * target-select.h (class Target_selector): Add emulation_ field.
3222 Update declarations.
3223 (Target_selector::recognize_by_bfd_name): Rename from
3224 recognize_by_name. Change all callers.
3225 (Target_selector::supported_bfd_names): Rename from
3226 supported_names. Change all callers.
3227 (Target_selector::recognize_by_emulation): New function.
3228 (Target_selector::supported_emulations): New function.
3229 (Target_selector::emulation): New function.
3230 (Target_selector::do_recognize_by_bfd_name): Rename from
3231 do_recognize_by_name. Change all callers.
3232 (Target_selector::do_supported_bfd_names): Rename from
3233 do_supported_names. Change all callers.
3234 (Target_selector::do_recognize_by_emulation): New function.
3235 (Target_selector::do_supported_emulations): New function.
3236 (select_target_by_bfd_name): Change name in declaration.
3237 (select_target_by_emulation): Declare.
3238 (supported_emulation_names): Declare.
3239 * parameters.cc (parameters_force_valid_target): Try to find
3240 target based on emulation from -m option.
3241 * options.h (class General_options): Change doc string for -m.
3242 * options.cc (help): Print emulations.
3243 (General_options::parse_V): Likewise.
3244 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3245 Add emulation parameter. Change all callers.
3247 2011-06-28 Ian Lance Taylor <iant@google.com>
3249 * target.h (class Target): Add osabi_ field.
3250 (Target::osabi): New function.
3251 (Target::set_osabi): New function.
3252 (Target::Target): Initialize osabi_.
3253 (Target::do_adjust_elf_header): Make pure virtual.
3254 (Sized_target::do_adjust_elf_header): Declare.
3255 * target.cc (Sized_target::do_adjust_elf_header): New function.
3256 (class Sized_target): Instantiate all versions.
3257 * freebsd.h (class Target_freebsd): Remove.
3258 (Target_selector_freebsd::do_recognize): Call set_osabi on
3260 (Target_selector_freebsd::do_recognize_by_name): Likewise.
3261 (Target_selector_freebsd::set_osabi): Remove.
3262 * i386.cc (class Target_i386): Inherit from Sized_target rather
3263 than Target_freebsd.
3264 * x86_64.cc (class Target_x86_64): Likewise.
3266 2011-06-28 Ian Lance Taylor <iant@google.com>
3268 * target.h (Target::can_check_for_function_pointers): Rewrite.
3270 (Target::can_icf_inline_merge_sections): Likewise.
3271 (Target::section_may_have_icf_unsafe_poineters): Likewise.
3272 (Target::Target_info): Add can_icf_inline_merge_sections field.
3273 (Target::do_can_check_for_function_pointers): New virtual
3275 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3276 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3277 from can_check_for_function_pointers, move in file.
3278 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3279 section_may_have_icf_unsafe_poineters, move in file.
3280 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3281 * i386.cc (Target_i386::do_can_check_for_function_pointers):
3282 Rename from can_check_for_function_pointers, move in file.
3283 (Target_i386::can_icf_inline_merge_sections): Remove.
3284 (Target_i386::i386_info): Initialize
3285 can_icf_inline_merge_sections.
3286 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3287 Initialize can_icf_inline_merge_sections.
3288 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3289 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3290 Rename from can_check_for_function_pointers, move in file.
3291 (Target_x86_64::can_icf_inline_merge_sections): Remove.
3292 (Target_x86_64::x86_64_info): Initialize
3293 can_icf_inline_merge_sections.
3294 * testsuite/testfile.cc (Target_test::test_target_info):
3296 * icf.cc (get_section_contents): Correct formatting.
3298 2011-06-27 Ian Lance Taylor <iant@google.com>
3300 * symtab.cc (Symbol::versioned_name): New function.
3301 (Symbol_table::add_to_final_symtab): Use versioned_name when
3303 (Symbol_table::sized_write_symbol): Likewise.
3304 * symtab.h (class Symbol): Declare versioned_name.
3305 * stringpool.h (class Stringpool_template): Add variant of add
3306 which takes a std::basic_string.
3307 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3308 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3309 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3310 (ver_test_12.o): New target.
3311 * testsuite/Makefile.in: Rebuild.
3313 2011-06-27 Doug Kwan <dougkwan@google.com>
3315 * arm.cc (Arm_relocate_functions::thm_jump8,
3316 Arm_relocate_functions::thm_jump11): Use a wider signed
3317 type to compute offset.
3318 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3320 * testsuite/Makefile.in: Regenerate.
3321 * testsuite/arm_branch_in_range.sh: Check test results of
3322 arm_thm_jump11 and arm_thm_jump8.
3323 * testsuite/arm_thm_jump11.s: New test source file.
3324 * testsuite/arm_thm_jump11.t: New linker script.
3325 * testsuite/arm_thm_jump8.s: New test source file.
3326 * testsuite/arm_thm_jump8.t: New linker script.
3328 2011-06-24 Ian Lance Taylor <iant@google.com>
3330 * layout.cc: Include "object.h".
3331 (ctors_sections_in_init_array): New static variable.
3332 (Layout::is_ctors_in_init_array): New function.
3333 (Layout::layout): Add entry to ctors_sections_in_init_array if
3335 * layout.h (class Layout): Declare is_ctors_in_init_array.
3336 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3337 is_ctors_reverse_view is set.
3338 (Sized_relobj_file::write_sections): Add layout parameter. Change
3339 all callers. Set is_ctors_reverse_view field of View_size.
3340 (Sized_relobj_file::reverse_words): New function.
3341 * object.h (Sized_relobj_file::View_size): Add
3342 is_ctors_reverse_view field.
3343 (class Sized_relobj_file): Update declarations.
3344 * testsuite/initpri3.c: New test.
3345 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3347 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3348 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3349 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3350 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3351 * testsuite/Makefile.in: Rebuild.
3353 2011-06-24 Cary Coutant <ccoutant@google.com>
3355 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3356 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3357 (debug_msg_cdebug.err): New targets.
3358 * testsuite/Makefile.in: Regenerate.
3359 * testsuite/debug_msg.sh: Check output of link with compressed debug.
3360 Fix checks for link with shared library.
3362 2011-06-24 Doug Kwan <dougkwan@google.com>
3364 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3365 skip empty text sections.
3366 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3368 2011-06-22 Ian Lance Taylor <iant@google.com>
3371 * options.h (class General_options): Add --ctors-in-init-array.
3372 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3373 friends as SHT_PROGBITS for merging sections.
3374 (Layout::layout): Remove special handling of .init_array and
3375 friends. Don't sort if doing relocatable link. Sort for .ctors
3376 and .dtors if ctors_in_init_array.
3377 (Layout::make_output_section): Force correct section types for
3378 .init_array and friends. Don't sort if doing relocatable link,
3379 Don't sort .ctors and .dtors if ctors_in_init_array.
3380 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3381 (Layout::output_section_name): Add relobj parameter. Change all
3382 callers. Handle .ctors. and .dtors. in code rather than table.
3383 Handle .ctors and .dtors if ctors_in_init_array.
3384 (Layout::match_file_name): New function, moved from output.cc.
3385 * layout.h (class Layout): Update declarations.
3386 * output.cc: Include "layout.h".
3387 (Input_section_sort_entry::get_priority): New function.
3388 (Input_section_sort_entry::match_file_name): Just call
3389 Layout::match_file_name.
3390 (Output_section::Input_section_sort_init_fini_compare::operator()):
3391 Handle .ctors and .dtors. Sort by explicit priority rather than
3393 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3394 * testsuite/initpri2.c: New test.
3395 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3396 (check_PROGRAMS): Add initpri2.
3397 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3398 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3399 * configure, testsuite/Makefile.in: Rebuild.
3401 2011-06-19 Ian Lance Taylor <iant@google.com>
3404 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3405 .interp section to a PT_INTERP segment even if we have seen a
3406 --dynamic-linker option. Don't do it if we have seen a PHDRS
3407 clause in a linker script.
3408 (Layout::finalize): Don't create a .interp section if we've
3409 already create a PT_INTERP segment.
3410 (Layout::create_interp): Always call choose_output_section (revert
3411 patch of 2011-06-17). Don't create PT_INTERP segment.
3412 * script-sections.cc
3413 (Script_sections::create_note_and_tls_segments): Add a .interp
3414 section to a PT_INTERP segment even if we have seen a
3415 --dynamic-linker option.
3417 2011-06-18 Ian Lance Taylor <iant@google.com>
3419 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3420 merely because a non-PT_LOAD segment has a dynamic reloc.
3422 2011-06-18 Ian Lance Taylor <iant@google.com>
3424 * layout.cc (Layout::finish_dynamic_section): Don't create
3425 DT_FLAGS entry if not needed.
3427 2011-06-18 Ian Lance Taylor <iant@google.com>
3430 * layout.cc (Layout::layout_eh_frame): Correct handling of
3431 writable .eh_frame section.
3433 2011-06-17 Ian Lance Taylor <iant@google.com>
3436 * resolve.cc (Symbol_table::resolve): Don't give an error if a
3437 symbol is redefined with the exact same object and value.
3439 2011-06-17 Ian Lance Taylor <iant@google.com>
3442 * layout.h (class Layout): Add interp_segment_ field.
3443 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3444 (Layout::attach_allocated_section_to_segment): If making shared
3445 library, put .interp section in PT_INTERP segment.
3446 (Layout::finalize): Also call create_interp if -dynamic-linker
3448 (Layout::create_interp): Assert that there is no PT_INTERP
3449 segment. If not using a SECTIONS clause, use make_output_section.
3450 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3451 * script-sections.cc
3452 (Script_sections::create_note_and_tls_segments): If making shared
3453 library, put .interp section in PT_INTERP segment.
3455 2011-06-17 Ian Lance Taylor <iant@google.com>
3457 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3458 when making a shared library.
3460 2011-06-17 Ian Lance Taylor <iant@google.com>
3462 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3463 parameter. Change all callers. Don't issue warning about PC32
3464 against locally defined symbol.
3466 2011-06-16 Ian Lance Taylor <iant@google.com>
3468 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3469 occurs in same object.
3471 2011-06-14 Alan Modra <amodra@gmail.com>
3473 * po/POTFILES.in: Regenerate.
3475 2011-06-09 Ian Lance Taylor <iant@google.com>
3477 * script-sections.cc
3478 (Orphan_output_section::set_section_addresses): For a relocatable
3479 link set address to 0.
3481 2011-06-09 Cary Coutant <ccoutant@google.com>
3484 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3485 used with --compress-debug-sections.
3486 * gold/object.cc (Sized_relobj_file::do_layout): Report
3487 uncompressed size of compressed input sections.
3489 2011-06-08 Cary Coutant <ccoutant@google.com>
3492 * testsuite/two_file_test_2_v1.cc: Change initialization of
3493 v2 to keep it in .data.
3495 2011-06-07 Cary Coutant <ccoutant@google.com>
3497 * common.cc (Symbol_table::do_allocate_commons_list): Call
3499 * errors.cc (Errors::fatal): Adjust call to gold_exit.
3500 (Errors::fallback): New function.
3501 (gold_fallback): New function.
3502 * errors.h (Errors::fallback): New function.
3503 * gold.cc (gold_exit): Change status parameter to enum; adjust
3505 (queue_initial_tasks): Call gold_fallback.
3506 * gold.h: Include cstdlib.
3507 (Exit_status): New enum type.
3508 (gold_exit): Change status parameter to enum.
3509 (gold_fallback): New function.
3510 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3511 (Layout::create_symtab_sections): Likewise.
3512 (Layout::create_shdrs): Likewise.
3513 * main.cc (main): Adjust call to gold_exit.
3514 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3515 (Output_data_got::add_got_entry_pair): Likewise.
3516 (Output_section::add_input_section): Likewise.
3517 (Output_section::add_output_section_data): Likewise.
3518 (Output_segment::set_section_list_addresses): Likewise.
3519 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3521 2011-06-07 Cary Coutant <ccoutant@google.com>
3523 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3524 for incremental links.
3525 * output.cc (Output_segment::set_section_list_addresses): Remove
3526 FIXME and test for TLS or BSS.
3528 2011-06-07 Cary Coutant <ccoutant@google.com>
3530 * testsuite/Makefile.am: Add incremental_copy_test,
3531 incremental_common_test_1.
3532 * testsuite/Makefile.in: Regenerate.
3533 * testsuite/common_test_1_v1.c: New source file.
3534 * testsuite/common_test_1_v2.c: New source file.
3535 * testsuite/copy_test_v1.cc: New source file.
3537 2011-06-07 Cary Coutant <ccoutant@google.com>
3539 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3540 update, allocate common from bss section's free list.
3541 * incremental-dump.cc (dump_incremental_inputs): Print flag for
3542 linker-defined symbols.
3543 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3544 Skip GOT and PLT entries that are no longer referenced.
3545 (Output_section_incremental_inputs::write_info_blocks): Mark
3546 linker-defined symbols.
3547 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3548 * output.cc (Output_section::allocate): New function.
3549 * output.h (Output_section::allocate): New function.
3550 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3551 linker-defined symbols.
3552 (Symbol::override_base_with_special): Copy is_predefined_ flag.
3553 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3554 (Symbol::init_base_output_data): Likewise.
3555 (Symbol::init_base_output_segment): Likewise.
3556 (Symbol::init_base_constant): Likewise.
3557 (Sized_symbol::init_output_data): Likewise.
3558 (Sized_symbol::init_output_segment): Likewise.
3559 (Sized_symbol::init_constant): Likewise.
3560 (Symbol_table::do_define_in_output_data): Likewise.
3561 (Symbol_table::do_define_in_output_segment): Likewise.
3562 (Symbol_table::do_define_as_constant): Likewise.
3563 * symtab.h (Symbol::is_predefined): New function.
3564 (Symbol::init_base_output_data): Add is_predefined parameter.
3565 (Symbol::init_base_output_segment): Likewise.
3566 (Symbol::init_base_constant): Likewise.
3567 (Symbol::is_predefined_): New data member.
3568 (Sized_symbol::init_output_data): Add is_predefined parameter.
3569 (Sized_symbol::init_output_segment): Likewise.
3570 (Sized_symbol::init_constant): Likewise.
3571 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3573 2011-06-07 Cary Coutant <ccoutant@google.com>
3575 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3576 instead of emit_copy_reloc.
3577 (Copy_relocs::emit_copy_reloc): Refactor.
3578 (Copy_relocs::make_copy_reloc): New function.
3579 (Copy_relocs::add_copy_reloc): Remove.
3580 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3582 (Copy_relocs::make_copy_reloc): New function.
3583 (Copy_relocs::add_copy_reloc): Remove.
3584 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3585 unchanged input files.
3586 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3587 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3588 Reserve BSS space for COPY relocations.
3589 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3590 (Output_section_incremental_inputs::write_info_blocks): Record
3591 whether a symbol is copied from a shared object.
3592 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3593 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3594 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3595 (Incremental_input_entry_reader::get_output_symbol_index): Add
3597 (Incremental_binary::emit_copy_relocs): New function.
3598 (Incremental_binary::do_emit_copy_relocs): New function.
3599 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3601 (Sized_incremental_binary::add_copy_reloc): New function.
3602 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3603 (Sized_incremental_binary::Copy_reloc): New struct.
3604 (Sized_incremental_binary::Copy_relocs): New typedef.
3605 (Sized_incremental_binary::copy_relocs_): New data member.
3606 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3607 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3608 * target.h (Sized_target::emit_copy_reloc): New function.
3609 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3611 2011-06-02 Cary Coutant <ccoutant@google.com>
3614 * gold/archive.cc (Archive::Archive): Initialize new data member.
3615 (Archive::include_all_members): Return if archive has already been
3617 * gold/archive.h (Archive::include_all_members_): New data member.
3619 2011-06-02 Nick Clifton <nickc@redhat.com>
3621 * dynobj.h: Fix spelling mistake in comment.
3622 * output.cc: Likewise.
3624 2011-05-31 Doug Kwan <dougkwan@google.com>
3628 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3629 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3630 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
3631 redundant arm_exidx_test.so.
3632 * testsuite/Makefile.in: Regenerate.
3633 (check_SCRIPTS): Add pr12826.sh
3634 (check_DATA): Add pr12826.stdout
3635 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3636 * testsuite/pr12826.sh: New file.
3637 * testsuite/pr12826_1.s: Ditto.
3638 * testsuite/pr12826_1.s: Ditto.
3640 2011-05-30 Ian Lance Taylor <iant@google.com>
3642 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3645 2011-05-29 Ian Lance Taylor <iant@google.com>
3648 * testsuite/Makefile.am: Use different file name for two_file_test
3649 temporary file for each incremental test.
3650 * testsuite/Makefile.in: Rebuild.
3652 2011-05-29 Ian Lance Taylor <iant@google.com>
3654 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3655 binary input file is empty.
3657 2011-05-27 Ian Lance Taylor <iant@google.com>
3659 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3660 (ver_test_9.so): Likewise.
3661 * testsuite/Makefile.in: Rebuild.
3663 2011-05-26 Cary Coutant <ccoutant@google.com>
3665 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3666 * incremental.cc (Incremental_inputs::report_input_section): Fix
3667 comment, indentation.
3668 (Incremental_inputs::report_comdat_group): New function.
3669 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3670 of data for incremental input file entry.
3671 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3672 group count, COMDAT group signatures.
3673 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3674 an unchanged input file.
3675 * incremental.h (Incremental_object_entry::Incremental_object_entry):
3676 Initialize new data member.
3677 (Incremental_object_entry::add_comdat_group): New function.
3678 (Incremental_object_entry::get_comdat_group_count): New function.
3679 (Incremental_object_entry::get_comdat_signature_key): New function.
3680 (Incremental_object_entry::groups_): New data member.
3681 (Incremental_inputs::report_comdat_group): New function.
3682 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3683 data for incremental input file entry.
3684 (Incremental_input_entry_reader::get_comdat_group_count): New function.
3685 (Incremental_input_entry_reader::get_input_section): Adjust size of
3686 data for incremental input file entry.
3687 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3688 (Incremental_input_entry_reader::get_comdat_group_signature): New
3690 * object.cc (Sized_relobj::include_section_group): Report kept
3691 COMDAT groups for incremental links.
3693 2011-05-24 David Meyer <pdox@google.com>
3695 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3696 with name parameter. Add found_name parameter.
3697 * fileread.cc (Input_file::find_file): Adjust code accordingly.
3698 * dirsearch.h (class Dirsearch): Update declaration.
3700 2011-05-24 Ian Lance Taylor <iant@google.com>
3702 * archive.cc (Library_base::should_include_member): Pull in object
3703 from archive if it defines the entry symbol.
3704 * parameters.cc (Parameters::entry): New function.
3705 * parameters.h (class Parameters): Declare entry.
3706 * output.h (class Output_file_header): Remove entry_ field.
3707 * output.cc (Output_file_header::Output_file_header): Remove entry
3708 parameter. Change all callers.
3709 (Output_file_header::entry): Use parameters->entry.
3710 * gold.cc (queue_middle_tasks): Likewise.
3711 * plugin.cc (Plugin_hook::run): Likewise.
3713 2011-05-24 Cary Coutant <ccoutant@google.com>
3715 * gold.cc (queue_initial_tasks): Pass incremental base filename
3716 to Output_file::open_base_file; don't print error message.
3717 * incremental-dump.cc (main): Adjust call to
3718 Output_file::open_for_modification.
3719 * incremental-dump.cc (main): Likewise.
3720 * incremental.cc (Incremental_inputs::report_command_line):
3721 Ignore --incremental-base option when comparing command lines.
3722 Ignore parameter when given as separate argument.
3723 * options.h (class General_options): Add --incremental-base.
3724 * output.cc (Output_file::Output_file):
3725 (Output_file::open_base_file): Add base_name and writable parameters;
3726 read base file into new file; print error message here.
3727 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3729 * output.h (Output_file::open_for_modification): Rename to...
3730 (Output_file::open_base_file): ...this; add base_name and
3731 writable parameters; adjust all callers.
3732 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3734 * testsuite/Makefile.am (incremental_test_4): Test
3736 * testsuite/Makefile.in: Regenerate.
3738 2011-05-24 Cary Coutant <ccoutant@google.com>
3740 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3742 * testsuite/Makefile.in: Regenerate.
3743 * testsuite/two_file_test_1_v1.cc: New test source file.
3744 * testsuite/two_file_test_1b_v1.cc: New test source file.
3745 * testsuite/two_file_test_2_v1.cc: New test source file.
3747 2011-05-24 Cary Coutant <ccoutant@google.com>
3749 * dynobj.h (Dynobj::do_dynobj): New function.
3750 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3751 flag and soname for shared objects.
3752 * incremental.cc (Incremental_inputs::report_object): Make
3753 either Incremental_object_entry or Incremental_dynobj_entry; add
3754 soname to string table.
3755 (Incremental_inputs::report_input_section): Add assertion.
3756 (Output_section_incremental_inputs::set_final_data_size): Adjust
3757 type of input file entry for shared libraries; adjust size of
3758 shared library info entry.
3759 (Output_section_incremental_inputs::write_input_files): Write
3760 as_needed flag for shared libraries.
3761 (Output_section_incremental_inputs::write_info_blocks): Adjust type
3762 of input file entry for shared libraries; write soname.
3763 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3764 soname from incremental info.
3765 * incremental.h (enum Incremental_input_flags): Add
3766 INCREMENTAL_INPUT_AS_NEEDED.
3767 (Incremental_input_entry::Incremental_input_entry): Initialize new
3769 (Incremental_input_entry::set_as_needed): New function.
3770 (Incremental_input_entry::as_needed): New function.
3771 (Incremental_input_entry::do_dynobj_entry): New function.
3772 (Incremental_input_entry::as_needed_): New data member.
3773 (Incremental_object_entry::Incremental_object_entry): Don't check
3775 (Incremental_object_entry::do_type): Likewise.
3776 (class Incremental_dynobj_entry): New class.
3777 (Incremental_input_entry_reader::as_needed): New function.
3778 (Incremental_input_entry_reader::get_soname): New function.
3779 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3780 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3781 size of shared library info entry.
3782 * layout.cc (Layout::finish_dynamic_section): Don't test for
3783 incremental link when adding DT_NEEDED entries.
3784 * object.h (Object::Object): Initialize new data member.
3785 (Object::dynobj): New function.
3786 (Object::set_as_needed): New function.
3787 (Object::as_needed): New function.
3788 (Object::do_dynobj): New function.
3789 (Object::as_needed_): New data member.
3791 2011-05-24 Cary Coutant <ccoutant@google.com>
3793 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3794 info; adjust display of GOT entries.
3795 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3796 vector of input objects; remove file_status_.
3797 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3798 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3799 got_plt reader; call target hooks to reserve GOT entries.
3800 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3801 of input file info header and GOT info entry.
3802 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3804 (Got_plt_view_info::got_descriptor): Remove.
3805 (Got_plt_view_info::sym_index): New data member.
3806 (Got_plt_view_info::input_index): New data member.
3807 (Local_got_offset_visitor::visit): Write input file index.
3808 (Global_got_offset_visitor::visit): Write 0 for input file index.
3809 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3810 with sym_index and input_index.
3811 (Output_section_incremental_inputs::write_got_plt): Adjust size of
3812 incremental info GOT entry; replace got_descriptor with input_index.
3813 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3814 map from input file index to object.
3815 (Sized_relobj_incr::do_layout): Replace direct data member reference
3816 with accessor function.
3817 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3818 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3819 Adjust size of input file info header.
3820 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3821 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3822 (Incremental_input_entry_reader::get_input_section): Adjust size of
3823 input file info header.
3824 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3825 of incremental info GOT entry.
3826 (Incremental_got_plt_reader::get_got_desc): Remove.
3827 (Incremental_got_plt_reader::get_got_symndx): New function.
3828 (Incremental_got_plt_reader::get_got_input_index): New function.
3829 (Sized_incremental_binary::Sized_incremental_binary): Remove
3830 file_status_; add input_objects_.
3831 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3832 (Sized_incremental_binary::set_file_is_unchanged): Remove.
3833 (Sized_incremental_binary::file_is_unchanged): Remove.
3834 (Sized_incremental_binary::set_input_object): New function.
3835 (Sized_incremental_binary::input_object): New function.
3836 (Sized_incremental_binary::file_status_): Remove.
3837 (Sized_incremental_binary::input_objects_): New data member.
3838 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3840 (Sized_relobj_incr::invalid_address): Move to base class.
3841 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3843 (Sized_relobj_incr::do_output_section_offset): Likewise.
3844 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3845 (Sized_relobj_incr::section_offsets_): Likewise.
3846 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3848 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3849 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3850 with accessor function.
3851 (Sized_relobj_file::do_layout): Likewise.
3852 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3853 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3854 (Sized_relobj_file::compute_final_local_value): Replace refs to
3855 section_offsets_ with accessor function.
3856 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3857 * object.h (Relobj::Relobj): Initialize new data members.
3858 (Relobj::add_dyn_reloc): New function.
3859 (Relobj::first_dyn_reloc): New function.
3860 (Relobj::dyn_reloc_count): New function.
3861 (Relobj::first_dyn_reloc_): New data member.
3862 (Relobj::dyn_reloc_count_): New data member.
3863 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3865 (Sized_relobj::Address): New typedef.
3866 (Sized_relobj::invalid_address): Move here from child class.
3867 (Sized_relobj::Sized_relobj): Initialize new data members.
3868 (Sized_relobj::sized_relobj): New function.
3869 (Sized_relobj::is_output_section_offset_invalid): Move here from
3871 (Sized_relobj::get_output_section_offset): Likewise.
3872 (Sized_relobj::local_has_got_offset): Likewise.
3873 (Sized_relobj::local_got_offset): Likewise.
3874 (Sized_relobj::set_local_got_offset): Likewise.
3875 (Sized_relobj::do_for_all_local_got_entries): Likewise.
3876 (Sized_relobj::clear_got_offsets): New function.
3877 (Sized_relobj::section_offsets): Move here from child class.
3878 (Sized_relobj::do_output_section_offset): Likewise.
3879 (Sized_relobj::do_set_section_offset): Likewise.
3880 (Sized_relobj::Local_got_offsets): Likewise.
3881 (Sized_relobj::local_got_offsets_): Likewise.
3882 (Sized_relobj::section_offsets_): Likewise.
3883 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3885 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3887 (Sized_relobj_file::sized_relobj): New function
3888 (Sized_relobj_file::local_has_got_offset): Move to base class.
3889 (Sized_relobj_file::local_got_offset): Likewise.
3890 (Sized_relobj_file::set_local_got_offset): Likewise.
3891 (Sized_relobj_file::get_output_section_offset): Likewise.
3892 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3893 (Sized_relobj_file::do_output_section_offset): Likewise.
3894 (Sized_relobj_file::do_set_section_offset): Likewise.
3895 (Sized_relobj_file::Local_got_offsets): Likewise.
3896 (Sized_relobj_file::local_got_offsets_): Likewise.
3897 (Sized_relobj_file::section_offsets_): Likewise.
3898 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3900 (set_needs_dynsym_index): Convert relobj to derived class pointer.
3901 (Output_reloc::get_symbol_index): Likewise.
3902 (Output_reloc::local_section_offset): Likewise.
3903 (Output_reloc::get_address): Likewise.
3904 (Output_reloc::symbol_value): Likewise.
3905 (Output_data_got::reserve_slot): Move to class definition.
3906 (Output_data_got::reserve_local): New function.
3907 (Output_data_got::reserve_slot_for_global): Remove.
3908 (Output_data_got::reserve_global): New function.
3909 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3910 (all constructors, two instantiations).
3911 (Output_reloc::get_relobj): New function (two instantiations).
3912 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3913 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3914 (Output_data_reloc::add_global): Adjust type of relobj.
3915 (Output_data_reloc::add_global_relative): Likewise.
3916 (Output_data_reloc::add_symbolless_global_addend): Likewise.
3917 (Output_data_reloc::add_local): Likewise.
3918 (Output_data_reloc::add_local_relative): Likewise.
3919 (Output_data_reloc::add_symbolless_local_addend): Likewise.
3920 (Output_data_reloc::add_local_section): Likewise.
3921 (Output_data_reloc::add_output_section): Likewise.
3922 (Output_data_reloc::add_absolute): Likewise.
3923 (Output_data_reloc::add_target_specific): Likewise.
3924 (Output_data_got::reserve_slot): Move definition here.
3925 (Output_data_got::reserve_local): New function.
3926 (Output_data_got::reserve_global): New function.
3927 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3928 section_offsets_ with accessor function.
3929 (Sized_relobj_file::write_sections): Likewise.
3930 (Sized_relobj_file::do_relocate_sections): Likewise.
3931 * target.h (Sized_target::reserve_local_got_entry): New function.
3932 (Sized_target::reserve_global_got_entry): New function.
3933 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3934 (Target_x86_64::reserve_global_got_entry): New function.
3935 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3937 2011-05-23 Cary Coutant <ccoutant@google.com>
3939 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3940 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3941 bit when checking got_type.
3942 * incremental.cc (Sized_incremental_binary::setup_readers):
3943 Store symbol table and string table locations; initialize bit vector
3944 of file status flags.
3945 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3947 (Sized_incremental_binary::do_process_got_plt): New function.
3948 (Sized_incremental_binary::get_symtab_view): Use stored locations.
3949 (Output_section_incremental_inputs::set_final_data_size): Record
3950 file index for each input file.
3951 (Output_section_incremental_inputs::write_got_plt): Store file index
3952 instead of input entry offset for each GOT entry.
3954 (Incremental_input_entry::Incremental_input_entry): Initialize new
3956 (Incremental_input_entry::set_offset): Store file index.
3957 (Incremental_input_entry::get_file_index): New function.
3958 (Incremental_input_entry::file_index_): New data member.
3959 (Incremental_binary::process_got_plt): New function.
3960 (Incremental_binary::do_process_got_plt): New function.
3961 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3963 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3964 (Sized_incremental_binary::set_file_is_unchanged): New function.
3965 (Sized_incremental_binary::file_is_unchanged): New function.
3966 (Sized_incremental_binary::do_process_got_plt): New function.
3967 (Sized_incremental_binary::file_status_): New data member.
3968 (Sized_incremental_binary::main_symtab_loc_): New data member.
3969 (Sized_incremental_binary::main_strtab_loc_): New data member.
3970 * output.cc (Output_data_got::Got_entry::write): Add case
3972 (Output_data_got::add_global): Call add_got_entry.
3973 (Output_data_got::add_global_plt): Likewise.
3974 (Output_data_got::add_global_with_rel): Likewise.
3975 (Output_data_got::add_global_with_rela): Likewise.
3976 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3977 (Output_data_got::add_global_pair_with_rela): Likewise.
3978 (Output_data_got::add_local): Call add_got_entry.
3979 (Output_data_got::add_local_plt): Likewise.
3980 (Output_data_got::add_local_with_rel): Likewise.
3981 (Output_data_got::add_local_with_rela): Likewise.
3982 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3983 (Output_data_got::add_local_pair_with_rela): Likewise.
3984 (Output_data_got::reserve_slot): New function.
3985 (Output_data_got::reserve_slot_for_global): New function.
3986 (Output_data_got::add_got_entry): New function.
3987 (Output_data_got::add_got_entry_pair): New function.
3988 (Output_section::add_output_section_data): Edit FIXME.
3990 (Output_section_data_build::Output_section_data_build): New
3991 constructor with size parameter.
3992 (Output_data_space::Output_data_space): Likewise.
3993 (Output_data_got::Output_data_got): Initialize new data member; new
3994 constructor with size parameter.
3995 (Output_data_got::add_constant): Call add_got_entry.
3996 (Output_data_got::reserve_slot): New function.
3997 (Output_data_got::reserve_slot_for_global): New function.
3998 (class Output_data_got::Got_entry): Add RESERVED_CODE.
3999 (Output_data_got::add_got_entry): New function.
4000 (Output_data_got::add_got_entry_pair): New function.
4001 (Output_data_got::free_list_): New data member.
4002 * target.h (Sized_target::init_got_plt_for_update): New function.
4003 (Sized_target::register_global_plt_entry): New function.
4004 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4005 Initialize new data member; call init; add constructor with PLT count.
4006 (Output_data_plt_x86_64::init): New function.
4007 (Output_data_plt_x86_64::add_relocation): New function.
4008 (Output_data_plt_x86_64::reserve_slot): New function.
4009 (Output_data_plt_x86_64::free_list_): New data member.
4010 (Target_x86_64::init_got_plt_for_update): New function.
4011 (Target_x86_64::register_global_plt_entry): New function.
4012 (Output_data_plt_x86_64::add_entry): Allocate from free list for
4013 incremental updates.
4014 (Output_data_plt_x86_64::add_relocation): New function.
4015 * testsuite/object_unittest.cc (Object_test): Set default options.
4017 2011-05-16 Ian Lance Taylor <iant@google.com>
4019 * options.h (class General_options): Make -i a synonym for -r.
4021 2011-05-16 Ian Lance Taylor <iant@google.com>
4023 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4025 2011-05-10 Cary Coutant <ccoutant@google.com>
4027 * object.cc (Sized_relobj::do_count_local_symbols): Check for
4030 2011-05-06 Ian Lance Taylor <iant@google.com>
4032 * layout.cc (Layout::layout): If the output section flags change,
4033 update the ordering.
4035 2011-04-25 Cary Coutant <ccoutant@google.com>
4037 * incremental-dump.cc (dump_incremental_inputs): Print local
4038 symbol info for each input file.
4040 (Output_section_incremental_inputs::set_final_data_size): Add local
4041 symbol info to input file entries in incremental info.
4042 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4043 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4044 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4045 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4047 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4048 (Sized_incr_relobj::do_relocate): Write the local symbols.
4049 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4050 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4051 Adjust size of input file header.
4052 (Incremental_inputs_reader::get_local_symbol_offset): New function.
4053 (Incremental_inputs_reader::get_local_symbol_count): New function.
4054 (Incremental_inputs_reader::get_input_section): Adjust size of input
4056 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4057 (Sized_incr_relobj::This): New typedef.
4058 (Sized_incr_relobj::sym_size): New const data member.
4059 (Sized_incr_relobj::Local_symbol): New struct.
4060 (Sized_incr_relobj::do_output_local_symbol_count): New function.
4061 (Sized_incr_relobj::do_local_symbol_offset): New function.
4062 (Sized_incr_relobj::local_symbol_count_): New data member.
4063 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4064 (Sized_incr_relobj::local_symbol_index_): New data member.
4065 (Sized_incr_relobj::local_symbol_offset_): New data member.
4066 (Sized_incr_relobj::local_dynsym_offset_): New data member.
4067 (Sized_incr_relobj::local_symbols_): New data member.
4068 * object.h (Relobj::output_local_symbol_count): New function.
4069 (Relobj::local_symbol_offset): New function.
4070 (Relobj::do_output_local_symbol_count): New function.
4071 (Relobj::do_local_symbol_offset): New function.
4072 (Sized_relobj::do_output_local_symbol_count): New function.
4073 (Sized_relobj::do_local_symbol_offset): New function.
4075 2011-04-22 Vladimir Simonov <sv@sw.ru>
4077 * descriptors.cc (set_close_on_exec): New function.
4078 (Descriptors::open): Use set_close_on_exec.
4079 * output.cc (S_ISLNK): Define if not defined.
4081 2011-04-22 Cary Coutant <ccoutant@google.com>
4083 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4085 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4086 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4087 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4089 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4090 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4091 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4093 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4095 (Incremental_binary::apply_incremental_relocs): New function.
4096 (Incremental_binary::do_apply_incremental_relocs): New function.
4097 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4099 (Sized_incremental_binary::add_global_symbol): New function.
4100 (Sized_incremental_binary::global_symbol): New function.
4101 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4102 (Sized_incremental_binary::symbol_map_): New data member.
4103 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4104 * target.h (Sized_target::apply_relocation): New function.
4105 * target-reloc.h (apply_relocation): New function.
4106 * x86_64.cc (Target_x86_64::apply_relocation): New function.
4108 2011-04-22 Doug Kwan <dougkwan@google.com>
4110 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4111 flag of a SHT_ARM_EXIDX section.
4112 * testsuite/Makefile.am (arm_exidx_test): New test rules.
4113 * testsuite/Makefile.in: Regenerate.
4114 * testsuite/arm_exidx_test.s: New file.
4115 * testsuite/arm_exidx_test.sh: Same.
4117 2011-04-20 Cary Coutant <ccoutant@google.com>
4120 * archive.h (Incremental_archive_entry::Archive_member):
4121 Initialize arg_serial_ (second constructor).
4123 2011-04-17 Ian Lance Taylor <iant@google.com>
4125 * object.cc (Relocate_info::location): Simplify location string.
4126 * errors.cc (Errors::error_at_location): Don't print program
4128 (Errors::warning_at_location): Likewise.
4129 (Errors::undefined_symbol): Likewise.
4130 * testsuite/debug_msg.sh: Update accordingly.
4132 2011-04-14 Cary Coutant <ccoutant@google.com>
4134 * gold/layout.cc (Layout::symtab_section_offset): New function.
4135 * gold/layout.h (Layout::symtab_section_offset): New function.
4136 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4138 2011-04-12 Ian Lance Taylor <iant@google.com>
4140 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
4141 with MREMAP_MAYMOVE.
4142 * output.h (class Output_file): Add map_is_allocated_ field.
4143 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
4144 not available, provide stubs. If mremap is not available, #define
4146 (MREMAP_MAYMOVE): Define if not defined.
4147 (Output_file::Output_file): Initialize map_is_allocated_.
4148 (Output_file::resize): Check map_is_allocated_.
4149 (Output_file::map_anonymous): If mmap fails, use malloc.
4150 (Output_file::unmap): Don't do anything for an anonymous map.
4151 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
4152 is not available, provide stubs.
4153 (File_read::View::~View): Use free rather than delete[].
4154 (File_read::make_view): Use malloc rather than new[]. If mmap
4156 (File_read::find_or_make_view): Use malloc rather than new[].
4157 * gold.h: Remove HAVE_REMAP code.
4158 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
4159 exists. Rename mremap to gold_mremap. If mmap is not available
4161 * configure, config.in: Rebuild.
4163 2011-04-11 Ian Lance Taylor <iant@google.com>
4165 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4166 initialize local variable v.
4168 2011-04-11 Cary Coutant <ccoutant@google.com>
4170 * archive.cc (Archive::include_member): Adjust call to
4172 (Add_archive_symbols::run): Track argument serial numbers.
4173 (Lib_group::include_member): Likewise.
4174 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4175 * archive.h (Incremental_archive_entry::Archive_member):
4176 Initialize arg_serial_.
4177 (Archive_member::arg_serial_): New data member.
4178 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4179 (Sized_dynobj::do_add_symbols): Track symbols when doing an
4181 (Sized_dynobj::do_for_all_local_got_entries): New function.
4182 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4184 * fileread.cc (get_mtime): New function.
4185 * fileread.h (get_mtime): New function.
4186 * gold.cc (queue_initial_tasks): Check for incremental update.
4187 (process_incremental_input): New function.
4188 (queue_middle_tasks): Don't force valid target for incremental
4190 * incremental-dump.cc (find_input_containing_global): Adjust
4191 size of symbol info entry.
4192 (dump_incremental_inputs): Dump argument serial number and
4193 in_system_directory flag; bias shndx by 1; print symbol names
4194 when dumping per-file symbol lists; use new symbol info readers.
4196 (Output_section_incremental_inputs:update_data_size): New function.
4197 (Sized_incremental_binary::setup_readers): Setup input readers
4198 for each input file; build maps for files added from libraries
4200 (Sized_incremental_binary::check_input_args): New function.
4201 (Sized_incremental_binary::do_check_inputs): Build map of argument
4202 serial numbers to input arguments.
4203 (Sized_incremental_binary::do_file_has_changed): Rename
4204 do_file_is_unchanged to this; compare file modification times.
4205 (Sized_incremental_binary::do_init_layout): New function.
4206 (Sized_incremental_binary::do_reserve_layout): New function.
4207 (Sized_incremental_binary::do_get_input_reader): Remove.
4208 (Sized_incremental_binary::get_symtab_view): New function.
4209 (Incremental_checker::can_incrementally_link_output_file): Remove.
4210 (Incremental_inputs::report_command_line): Exclude --debug options.
4211 (Incremental_inputs::report_archive_begin): Add parameter; track
4212 argument serial numbers; don't put input file entry for archive
4213 before archive members.
4214 (Incremental_inputs::report_archive_end): Put input file entry
4215 for archive after archive members.
4216 (Incremental_inputs::report_object): Add parameter; track argument
4217 serial numbers and in_system_directory flag.
4218 (Incremental_inputs::report_script): Add parameter; track argument
4220 (Output_section_incremental_inputs::set_final_data_size): Adjust
4221 size of symbol info entry; check for forwarding symbols.
4222 (Output_section_incremental_inputs::write_input_files): Write
4223 in_system_directory flag and argument serial number.
4224 (Output_section_incremental_inputs::write_info_blocks): Map section
4225 indices between incremental info and original input file; store
4226 input section index for each symbol.
4227 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4228 change operator() to visit().
4229 (class Global_got_offset_visitor): Likewise.
4230 (class Global_symbol_visitor_got_plt):
4231 (Output_section_incremental_inputs::write_got_plt): Use new visitor
4233 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4234 (Sized_incr_relobj::do_read_symbols): New function.
4235 (Sized_incr_relobj::do_layout): New function.
4236 (Sized_incr_relobj::do_layout_deferred_sections): New function.
4237 (Sized_incr_relobj::do_add_symbols): New function.
4238 (Sized_incr_relobj::do_should_include_member): New function.
4239 (Sized_incr_relobj::do_for_all_global_symbols): New function.
4240 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4241 (Sized_incr_relobj::do_section_size): New function.
4242 (Sized_incr_relobj::do_section_name): New function.
4243 (Sized_incr_relobj::do_section_contents): New function.
4244 (Sized_incr_relobj::do_section_flags): New function.
4245 (Sized_incr_relobj::do_section_entsize): New function.
4246 (Sized_incr_relobj::do_section_address): New function.
4247 (Sized_incr_relobj::do_section_type): New function.
4248 (Sized_incr_relobj::do_section_link): New function.
4249 (Sized_incr_relobj::do_section_info): New function.
4250 (Sized_incr_relobj::do_section_addralign): New function.
4251 (Sized_incr_relobj::do_initialize_xindex): New function.
4252 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4253 (Sized_incr_relobj::do_read_relocs): New function.
4254 (Sized_incr_relobj::do_gc_process_relocs): New function.
4255 (Sized_incr_relobj::do_scan_relocs): New function.
4256 (Sized_incr_relobj::do_count_local_symbols): New function.
4257 (Sized_incr_relobj::do_finalize_local_symbols): New function.
4258 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4259 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4260 (Sized_incr_relobj::do_relocate): New function.
4261 (Sized_incr_relobj::do_set_section_offset): New function.
4262 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4263 (Sized_incr_dynobj::do_read_symbols): New function.
4264 (Sized_incr_dynobj::do_layout): New function.
4265 (Sized_incr_dynobj::do_add_symbols): New function.
4266 (Sized_incr_dynobj::do_should_include_member): New function.
4267 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4268 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4269 (Sized_incr_dynobj::do_section_size): New function.
4270 (Sized_incr_dynobj::do_section_name): New function.
4271 (Sized_incr_dynobj::do_section_contents): New function.
4272 (Sized_incr_dynobj::do_section_flags): New function.
4273 (Sized_incr_dynobj::do_section_entsize): New function.
4274 (Sized_incr_dynobj::do_section_address): New function.
4275 (Sized_incr_dynobj::do_section_type): New function.
4276 (Sized_incr_dynobj::do_section_link): New function.
4277 (Sized_incr_dynobj::do_section_info): New function.
4278 (Sized_incr_dynobj::do_section_addralign): New function.
4279 (Sized_incr_dynobj::do_initialize_xindex): New function.
4280 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4281 (make_sized_incremental_object): New function.
4282 (Incremental_library::copy_unused_symbols): New function.
4283 (Incremental_library::do_for_all_unused_symbols): New function.
4284 * incremental.h (enum Incremental_input_flags): New type.
4285 (class Incremental_checker): Remove.
4286 (Incremental_input_entry::Incremental_input_entry): Add argument
4288 (Incremental_input_entry::arg_serial): New function.
4289 (Incremental_input_entry::set_is_in_system_directory): New function.
4290 (Incremental_input_entry::is_in_system_directory): New function.
4291 (Incremental_input_entry::arg_serial_): New data member.
4292 (Incremental_input_entry::is_in_system_directory_): New data member.
4293 (class Script_info): Move here from script.h.
4294 (Script_info::Script_info): Add filename parameter.
4295 (Script_info::filename): New function.
4296 (Script_info::filename_): New data member.
4297 (Incremental_script_entry::Incremental_script_entry): Add argument
4299 (Incremental_object_entry::Incremental_object_entry): Likewise.
4300 (Incremental_object_entry::add_input_section): Build list of input
4301 sections with map to original shndx.
4302 (Incremental_object_entry::get_input_section_index): New function.
4303 (Incremental_object_entry::shndx_): New data member.
4304 (Incremental_object_entry::name_key_): Rename; adjust all refs.
4305 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4306 (Incremental_archive_entry::Incremental_archive_entry): Add argument
4308 (Incremental_inputs::report_archive_begin): Likewise.
4309 (Incremental_inputs::report_object): Likewise.
4310 (Incremental_inputs::report_script): Likewise.
4311 (class Incremental_global_symbol_reader): New class.
4312 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4313 and store flags and input file type.
4314 (Incremental_input_entry_reader::arg_serial): New function.
4315 (Incremental_input_entry_reader::type): Extract type from flags.
4316 (Incremental_input_entry_reader::is_in_system_directory): New function.
4317 (Incremental_input_entry_reader::get_input_section_count): Call
4318 accessor function for type.
4319 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4320 function for type; adjust size of global symbol entry.
4321 (Incremental_input_entry_reader::get_global_symbol_count): Call
4322 accessor function for type.
4323 (Incremental_input_entry_reader::get_object_count): Likewise.
4324 (Incremental_input_entry_reader::get_object_offset): Likewise.
4325 (Incremental_input_entry_reader::get_member_count): Likewise.
4326 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4327 (Incremental_input_entry_reader::get_member_offset): Likewise.
4328 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4329 (Incremental_input_entry_reader::Global_symbol_info): Remove.
4330 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4331 (Incremental_input_entry_reader::get_global_symbol_reader): New
4333 (Incremental_input_entry_reader::get_output_symbol_index): New
4335 (Incremental_input_entry_reader::type_): Remove.
4336 (Incremental_input_entry_reader::flags_): New data member.
4337 (Incremental_inputs_reader::input_file_offset): New function.
4338 (Incremental_inputs_reader::input_file_index): New function.
4339 (Incremental_inputs_reader::input_file): Call input_file_offset.
4340 (Incremental_inputs_reader::input_file_at_offset): New function.
4341 (Incremental_relocs_reader::get_r_type): Reformat.
4342 (Incremental_relocs_reader::get_r_shndx): Reformat.
4343 (Incremental_relocs_reader::get_r_offset): Reformat.
4344 (Incremental_relocs_reader::data): New function.
4345 (Incremental_binary::Incremental_binary): Initialize new data members.
4346 (Incremental_binary::check_inputs): Add cmdline parameter.
4347 (Incremental_binary::file_is_unchanged): Remove.
4348 (Input_reader::arg_serial): New function.
4349 (Input_reader::get_unused_symbol_count): New function.
4350 (Input_reader::get_unused_symbol): New function.
4351 (Input_reader::do_arg_serial): New function.
4352 (Input_reader::do_get_unused_symbol_count): New function.
4353 (Input_reader::do_get_unused_symbol): New function.
4354 (Incremental_binary::input_file_count): New function.
4355 (Incremental_binary::get_input_reader): Change signature to use
4356 index instead of filename.
4357 (Incremental_binary::file_has_changed): New function.
4358 (Incremental_binary::get_input_argument): New function.
4359 (Incremental_binary::get_library): New function.
4360 (Incremental_binary::get_script_info): New function.
4361 (Incremental_binary::init_layout): New function.
4362 (Incremental_binary::reserve_layout): New function.
4363 (Incremental_binary::output_file): New function.
4364 (Incremental_binary::do_check_inputs): New function.
4365 (Incremental_binary::do_file_is_unchanged): Remove.
4366 (Incremental_binary::do_file_has_changed): New function.
4367 (Incremental_binary::do_init_layout): New function.
4368 (Incremental_binary::do_reserve_layout): New function.
4369 (Incremental_binary::do_input_file_count): New function.
4370 (Incremental_binary::do_get_input_reader): Change signature.
4371 (Incremental_binary::input_args_map_): New data member.
4372 (Incremental_binary::library_map_): New data member.
4373 (Incremental_binary::script_map_): New data member.
4374 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4376 (Sized_incremental_binary::output_section): New function.
4377 (Sized_incremental_binary::inputs_reader): Add const.
4378 (Sized_incremental_binary::symtab_reader): Add const.
4379 (Sized_incremental_binary::relocs_reader): Add const.
4380 (Sized_incremental_binary::got_plt_reader): Add const.
4381 (Sized_incremental_binary::get_symtab_view): New function.
4382 (Sized_incremental_binary::Inputs_reader): New typedef.
4383 (Sized_incremental_binary::Input_entry_reader): New typedef.
4384 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4385 (Sized_incremental_binary::do_file_is_unchanged): Remove.
4386 (Sized_incremental_binary::do_file_has_changed): New function.
4387 (Sized_incremental_binary::do_init_layout): New function.
4388 (Sized_incremental_binary::do_reserve_layout): New function.
4389 (Sized_input_reader::Inputs_reader): Remove.
4390 (Sized_input_reader::Input_entry_reader): Remove.
4391 (Sized_input_reader::do_arg_serial): New function.
4392 (Sized_input_reader::do_get_unused_symbol_count): New function.
4393 (Sized_input_reader::do_get_unused_symbol): New function.
4394 (Sized_incremental_binary::do_input_file_count): New function.
4395 (Sized_incremental_binary::do_get_input_reader): Change signature;
4396 use index instead of filename.
4397 (Sized_incremental_binary::section_map_): New data member.
4398 (Sized_incremental_binary::input_entry_readers_): New data member.
4399 (class Sized_incr_relobj): New class.
4400 (class Sized_incr_dynobj): New class.
4401 (make_sized_incremental_object): New function.
4402 (class Incremental_library): New class.
4403 * layout.cc (Free_list::num_lists): New static data member.
4404 (Free_list::num_nodes): New static data member.
4405 (Free_list::num_removes): New static data member.
4406 (Free_list::num_remove_visits): New static data member.
4407 (Free_list::num_allocates): New static data member.
4408 (Free_list::num_allocate_visits): New static data member.
4409 (Free_list::init): New function.
4410 (Free_list::remove): New function.
4411 (Free_list::allocate): New function.
4412 (Free_list::dump): New function.
4413 (Free_list::print_stats): New function.
4414 (Layout_task_runner::run): Resize output file for incremental updates.
4415 (Layout::Layout): Initialize new data members.
4416 (Layout::set_incremental_base): New function.
4417 (Layout::init_fixed_output_section): New function.
4418 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4419 incremental updates.
4420 (Layout::create_gold_note): Do not create gold note section for
4421 incremental updates.
4422 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4423 for incremental updates.
4424 (Layout::set_section_offsets): For incremental updates, allocate space
4426 (Layout::create_symtab_sections): Layout with offsets relative to
4427 start of section; for incremental updates, allocate space from free
4429 (Layout::create_shdrs): For incremental updates, allocate space from
4431 (Layout::finish_dynamic_section): For incremental updates, do not
4432 check --as-needed (fixed in subsequent patch).
4433 * layout.h (class Free_list): New class.
4434 (Layout::set_incremental_base): New function.
4435 (Layout::incremental_base): New function.
4436 (Layout::init_fixed_output_section): New function.
4437 (Layout::allocate): New function.
4438 (Layout::incremental_base_): New data member.
4439 (Layout::free_list_): New data member.
4440 * main.cc (main): Print Free_list statistics.
4441 * object.cc (Relobj::finalize_incremental_relocs): Add
4442 clear_counts parameter; clear counts only when clear_counts is set.
4443 (Sized_relobj::Sized_relobj): Initialize new base class.
4444 (Sized_relobj::do_layout): Don't report special sections.
4445 (Sized_relobj::do_for_all_local_got_entries): New function.
4446 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4447 symtab_off to all symbol table offsets.
4448 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4449 * object.h (class Got_offset_list): Move to top of file.
4450 (Object::Object): Allow case where input_file == NULL.
4451 (Object::~Object): Likewise.
4452 (Object::input_file): Assert that input_file != NULL.
4453 (Object::lock): Allow case where input_file == NULL.
4454 (Object::unlock): Likewise.
4455 (Object::is_locked): Likewise.
4456 (Object::token): Likewise.
4457 (Object::release): Likewise.
4458 (Object::is_incremental): New function.
4459 (Object::get_mtime): New function.
4460 (Object::for_all_local_got_entries): New function.
4461 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4462 (Object::set_is_in_system_directory): New function.
4463 (Object::is_in_system_directory): New function.
4464 (Object::do_is_incremental): New function.
4465 (Object::do_get_mtime): New function.
4466 (Object::do_for_all_local_got_entries): New function.
4467 (Object::is_in_system_directory_): New data member.
4468 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4469 (class Sized_relobj_base): New class.
4470 (class Sized_relobj): Derive from Sized_relobj_base.
4471 (class Sized_relobj::Symbols): Redeclare from base class.
4472 (class Sized_relobj::local_got_offset_list): Remove.
4473 (class Sized_relobj::Output_sections): Redeclare from base class.
4474 (class Sized_relobj::do_for_all_local_got_entries): New function.
4475 (class Sized_relobj::write_local_symbols): Add offset parameter.
4476 (class Sized_relobj::local_symbol_offset_): Update comment.
4477 (class Sized_relobj::local_dynsym_offset_): Update comment.
4478 * options.cc (Input_arguments::add_file): Remove const.
4479 * options.h (Input_file_argument::Input_file_argument):
4480 Initialize arg_serial_ (all constructors).
4481 (Input_file_argument::set_arg_serial): New function.
4482 (Input_file_argument::arg_serial): New function.
4483 (Input_file_argument::arg_serial_): New data member.
4484 (Input_arguments::Input_arguments): Initialize file_count_.
4485 (Input_arguments::add_file): Remove const.
4486 (Input_arguments::number_of_input_files): New function.
4487 (Input_arguments::file_count_): New data member.
4488 (Command_line::number_of_input_files): Call
4489 Input_arguments::number_of_input_files.
4490 * output.cc (Output_segment_headers::Output_segment_headers):
4492 (Output_section::Input_section::current_data_size): New function.
4493 (Output_section::Output_section): Initialize new data members.
4494 (Output_section::add_input_section): Don't do merge sections for
4495 an incremental link; allocate space from free list for an
4497 (Output_section::add_output_section_data): Allocate space from
4498 free list for an incremental update.
4499 (Output_section::update_data_size): New function.
4500 (Output_section::set_fixed_layout): New function.
4501 (Output_section::reserve): New function.
4502 (Output_segment::set_section_addresses): Remove const.
4503 (Output_segment::set_section_list_addresses): Remove const; allocate
4504 space from free list for an incremental update.
4505 (Output_segment::set_offset): Adjust size of RELRO segment for an
4507 * output.h (Output_data::current_data_size): Move here from
4509 (Output_data::pre_finalize_data_size): New function.
4510 (Output_data::update_data_size): New function.
4511 (Output_section_headers::update_data_size): new function.
4512 (Output_section_data_build::current_data_size): Move to Output_data.
4513 (Output_data_strtab::update_data_size): New function.
4514 (Output_section::current_data_size): Move to Output_data.
4515 (Output_section::set_fixed_layout): New function.
4516 (Output_section::has_fixed_layout): New function.
4517 (Output_section::reserve): New function.
4518 (Output_section::update_data_size): New function.
4519 (Output_section::has_fixed_layout_): New data member.
4520 (Output_section::free_list_): New data member.
4521 (Output_segment::set_section_addresses): Remove const.
4522 (Output_segment::set_section_list_addresses): Remove const.
4523 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4525 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4527 * readsyms.cc (Read_symbols::do_read_symbols): Add library
4528 parameter when calling Add_symbols constructor; store argument
4529 serial number for members of a lib group.
4530 (Add_symbols::locks): Allow case where token == NULL.
4531 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4532 (Read_member::~Read_member): New function.
4533 (Read_member::is_runnable): New function.
4534 (Read_member::locks): New function.
4535 (Read_member::run): New function.
4536 (Check_script::~Check_script): New function.
4537 (Check_script::is_runnable): New function.
4538 (Check_script::locks): New function.
4539 (Check_script::run): New function.
4540 (Check_library::~Check_library): New function.
4541 (Check_library::is_runnable): New function.
4542 (Check_library::locks): New function.
4543 (Check_library::run): New function.
4544 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4545 (Add_symbols::library_): New data member.
4546 (class Read_member): New class.
4547 (class Check_script): New class.
4548 (class Check_library): New class.
4549 * reloc.cc (Read_relocs::is_runnable): Allow case where
4551 (Read_relocs::locks): Likewise.
4552 (Scan_relocs::locks): Likewise.
4553 (Relocate_task::locks): Likewise.
4554 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4556 (Sized_relobj::incremental_relocs_scan): Fix comment.
4557 (Sized_relobj::do_relocate): Pass output file offset to
4558 write_local_symbols.
4559 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4560 from class declaration.
4561 * script.cc (read_input_script): Allocate Script_info; pass
4562 argument serial number to report_script.
4563 * script.h (class Script_info): Move to incremental.h.
4564 * symtab.cc (Symbol_table::add_from_incrobj): New function.
4565 * symtab.h (Symbol_table::add_from_incrobj): New function.
4566 (Symbol_table::set_file_offset): New function.
4568 2011-04-05 Cary Coutant <ccoutant@google.com>
4570 * incremental-dump.cc (dump_incremental_inputs): Change signature
4571 to take a Sized_incremental_binary; change caller. Use readers
4572 in Sized_incremental_binary.
4574 (Sized_incremental_binary::find_incremental_inputs_sections):
4575 Rename do_find_incremental_inputs_sections to this.
4576 (Sized_incremental_binary::setup_readers): New function.
4577 (Sized_incremental_binary::do_check_inputs): Check
4578 has_incremental_info_ flag; move setup code to setup_readers;
4580 (Sized_incremental_binary::do_file_is_unchanged): New function.
4581 (Sized_incremental_binary::do_get_input_reader): New function.
4582 * incremental.h (class Incremental_binary): Move to end of file.
4583 (Incremental_binary::file_is_unchanged): New function.
4584 (Incremental_binary::do_file_is_unchanged): New function.
4585 (Incremental_binary::Input_reader): New class.
4586 (Incremental_binary::get_input_reader): New function.
4587 (class Sized_incremental_binary): Move to end of file.
4588 (Sized_incremental_binary::Sized_incremental_binary): Setup the
4589 input section reader classes.
4590 (Sized_incremental_binary::has_incremental_info): New function.
4591 (Sized_incremental_binary::inputs_reader): New function.
4592 (Sized_incremental_binary::symtab_reader): New function.
4593 (Sized_incremental_binary::relocs_reader): New function.
4594 (Sized_incremental_binary::got_plt_reader): New function.
4595 (Sized_incremental_binary::do_file_is_unchanged): New function.
4596 (Sized_incremental_binary::Sized_input_reader): New class.
4597 (Sized_incremental_binary::get_input_reader): New function.
4598 (Sized_incremental_binary::find_incremental_inputs_sections):
4599 Rename do_find_incremental_inputs_sections to this.
4600 (Sized_incremental_binary::setup_readers): New function.
4601 (Sized_incremental_binary::has_incremental_info_): New data member.
4602 (Sized_incremental_binary::inputs_reader_): New data member.
4603 (Sized_incremental_binary::symtab_reader_): New data member.
4604 (Sized_incremental_binary::relocs_reader_): New data member.
4605 (Sized_incremental_binary::got_plt_reader_): New data member.
4606 (Sized_incremental_binary::current_input_file_): New data member.
4608 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
4611 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4614 2011-03-30 Cary Coutant <ccoutant@google.com>
4616 * archive.cc (Archive::include_member): Adjust call to report_object.
4617 (Add_archive_symbols::run): Add script_info to call to
4618 report_archive_begin.
4619 (Lib_group::include_member): Adjust call to report_object.
4620 (Add_lib_group_symbols::run): Adjust call to report_object.
4621 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4622 blocks. Add object count for script input files.
4623 * incremental.cc (Incremental_inputs::report_archive_begin): Add
4624 script_info parameter; change all callers.
4625 (Incremental_inputs::report_object): Add script_info parameter;
4627 (Incremental_inputs::report_script): Store backpointer to
4628 incremental info entry.
4629 (Output_section_incremental_inputs::set_final_data_size): Record
4630 additional information for scripts.
4631 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4632 * incremental.h (Incremental_script_entry::add_object): New function.
4633 (Incremental_script_entry::get_object_count): New function.
4634 (Incremental_script_entry::get_object): New function.
4635 (Incremental_script_entry::objects_): New data member; adjust
4637 (Incremental_inputs::report_archive_begin): Add script_info parameter.
4638 (Incremental_inputs::report_object): Add script_info parameter.
4639 (Incremental_inputs_reader::get_object_count): New function.
4640 (Incremental_inputs_reader::get_object_offset): New function.
4641 * options.cc (Input_arguments::add_file): Return reference to
4643 * options.h (Input_argument::set_script_info): New function.
4644 (Input_argument::script_info): New function.
4645 (Input_argument::script_info_): New data member; adjust all
4647 (Input_file_group::add_file): Return reference to new input argument.
4648 (Input_file_lib::add_file): Likewise.
4649 (Input_arguments::add_file): Likewise.
4650 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4651 * script.cc (Parser_closure::Parser_closure): Add script_info
4652 parameter; adjust all callers.
4653 (Parser_closure::script_info): New function.
4654 (Parser_closure::script_info_): New data member.
4655 (read_input_script): Report scripts earlier to incremental info.
4656 (script_add_file): Set script_info in Input_argument.
4657 (script_add_library): Likewise.
4658 * script.h (Script_options::Script_info): Rewrite class.
4660 2011-03-29 Cary Coutant <ccoutant@google.com>
4662 * archive.cc (Library_base::should_include_member): Move
4663 method here from class Archive.
4664 (Archive::Archive): Initialize base class.
4665 (Archive::should_include_member): Move to base class.
4666 (Archive::do_for_all_unused_symbols): New function.
4667 (Add_archive_symbols::run): Remove redundant access to
4669 (Lib_group::Lib_group): Initialize base class.
4670 (Lib_group::do_filename): New function.
4671 (Lib_group::include_member): Pass pointer to Lib_group to
4673 (Lib_group::do_for_all_unused_symbols): New function.
4674 (Add_lib_group_symbols::run): Report archive information for
4676 * archive.h (class Library_base): New base class.
4677 (class Archive): Derive from Library_base.
4678 (Archive::filename): Move to base class.
4679 (Archive::set_incremental_info): Likewise.
4680 (Archive::incremental_info): Likewise.
4681 (Archive::Should_include): Likewise.
4682 (Archive::should_include_member): Likewise.
4683 (Archive::Armap_entry): Remove.
4684 (Archive::Unused_symbol_iterator): Remove.
4685 (Archive::unused_symbols_begin): Remove.
4686 (Archive::unused_symbols_end): Remove.
4687 (Archive::do_filename): New function.
4688 (Archive::do_get_mtime): New function.
4689 (Archive::do_for_all_unused_symbols): New function.
4690 (Archive::task_): Move to base class.
4691 (Archive::incremental_info_): Likewise.
4692 (class Lib_group): Derive from Library_base.
4693 (Lib_group::do_filename): New function.
4694 (Lib_group::do_get_mtime): New function.
4695 (Lib_group::do_for_all_unused_symbols): New function.
4696 (Lib_group::task_): Move to base class.
4697 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4699 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4701 * incremental.cc (Incremental_inputs::report_archive_begin):
4702 Use Library_base; call library's get_mtime; add incremental inputs
4703 entry before members.
4704 (class Unused_symbol_visitor): New class.
4705 (Incremental_inputs::report_archive_end): Use Library_base; use
4706 visitor class to record unused symbols; don't add incremental inputs
4707 entry after members.
4708 (Incremental_inputs::report_object): Use Library_base.
4710 (Incremental_archive_entry::Incremental_archive_entry): Remove
4711 unused Archive parameter.
4712 (Incremental_inputs::report_archive_begin): Use Library_base.
4713 (Incremental_inputs::report_archive_end): Likewise.
4714 (Incremental_inputs::report_object): Likewise.
4715 * object.cc (Sized_relobj::do_for_all_global_symbols): New
4717 * object.h (Object::for_all_global_symbols): New function.
4718 (Object::do_for_all_global_symbols): New function.
4719 (Sized_relobj::do_for_all_global_symbols): New function.
4720 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
4722 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
4725 2011-03-27 Ian Lance Taylor <iant@google.com>
4727 * archive.cc (Archive::interpret_header): Return -1 if something
4728 goes wrong. Change callers accordingly.
4730 2011-03-25 Cary Coutant <ccoutant@google.com>
4732 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4733 * testsuite/Makefile.in: Regenerate.
4735 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
4737 * plugin.cc (get_view): New.
4738 (Plugin::load): Pass get_view to the plugin.
4739 (Plugin_manager::get_view): New.
4741 2011-03-21 Ian Lance Taylor <iant@google.com>
4743 * testsuite/final_layout.sh: Rewrite to not use dc.
4744 * testsuite/relro_test.sh: Fail if dc is not present.
4746 2011-03-21 Sriraman Tallam <tmsriram@google.com>
4748 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4750 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4751 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4753 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4754 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4756 2011-03-14 Ian Lance Taylor <iant@google.com>
4758 * script-sections.cc (Sort_output_sections::script_compare):
4759 Rename from is_before, change return type.
4760 (Sort_output_sections::operator()): Adjust accordingly.
4762 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
4765 * testsuite/odr_violation2.cc: Add comment to make all error line
4766 numbers double digits.
4767 * testsuite/debug_msg.sh: Adjust expected errors.
4769 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
4771 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4772 but mark earlier ones as non-canonical
4773 (offset_to_iterator): Update search target and example
4774 (do_addr2line): Return extra lines in a vector*
4775 (format_file_lineno): Extract from do_addr2line
4776 (one_addr2line): Add vector* out-param
4777 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4778 when a lineno entry appeared last for its instruction
4779 (Dwarf_line_info): Add vector* out-param
4780 * object.cc (Relocate_info): Pass NULL for the vector* out-param
4781 * symtab.cc (Odr_violation_compare): Include the lineno in the
4783 (linenos_from_loc): New. Combine the canonical line for an
4784 address with its other lines.
4785 (True_if_intersect): New. Helper functor to make
4786 std::set_intersection a query.
4787 (detect_odr_violations): Compare sets of lines instead of just
4788 one line for each function. This became less deterministic, but
4789 has fewer false positives.
4790 * symtab.h: Declarations.
4791 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4792 mix an optimized and non-optimized object in the same binary
4793 (odr_violation2.so): Same.
4794 * testsuite/Makefile.in: Regenerate from Makefile.am.
4795 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4796 * testsuite/debug_msg.sh: Update line numbers and add
4798 * testsuite/odr_violation1.cc: Use OdrDerived, in a
4799 non-optimized context.
4800 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4801 isn't inlined, and use OdrDerived in an optimized context.
4802 * testsuite/odr_header1.h: Defines OdrDerived, where
4803 optimization will change the
4804 first-instruction-in-the-destructor's file and line number.
4805 * testsuite/odr_header2.h: Defines OdrBase.
4807 2011-03-09 Ian Lance Taylor <iant@google.com>
4809 * fileread.cc (File_read::clear_views): Don't delete the whole
4812 2011-03-08 Ian Lance Taylor <iant@google.com>
4815 * fileread.cc: #include <climits>.
4816 (GOLD_IOV_MAX): Define.
4817 (File_read::read_multiple): Limit number of entries by iov_max.
4818 * fileread.h (class File_read): Always set max_readv_entries to
4821 2011-03-07 Ian Lance Taylor <iant@google.com>
4824 * options.h (class General_options): Add -dy and -dn.
4826 2011-03-02 Cary Coutant <ccoutant@google.com>
4828 * testsuite/script_test_9.t: Add TLS segment.
4830 2011-03-02 Simon Baldwin <simonb@google.com>
4832 * configure.ac: Add check for gnu_indirect_function support in
4833 the toolchain building binutils.
4834 * configure: Rebuild.
4836 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
4838 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4839 plugin only symbols.
4840 (Symbol_table::sized_finalize_symbol) Mark symbol only present
4841 in plugin files as not needed in the symbol table.
4843 2011-02-11 Sriraman Tallam <tmsriram@google.com>
4845 * output.cc (Output_section::add_input_section): Delay fill
4846 generation for section ordering.
4848 2011-02-09 Ian Lance Taylor <iant@google.com>
4851 * object.h (class Sized_relobj): Remove clear_local_symbols.
4852 * reloc.cc (Sized_relobj::do_relocate): Don't call
4853 clear_local_symbols.
4855 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
4857 * plugin.cc (is_visible_from_outside): Return true for symbols
4860 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
4862 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4865 2011-02-02 Sriraman Tallam <tmsriram@google.com>
4867 * icf.h (is_section_foldable_candidate): Change type of parameter
4869 * icf.cc (Icf::find_identical_sections): Change type of local variable
4870 section_name to be std::string.
4871 (is_function_ctor_or_dtor): Change type of parameter to std::string.
4873 2011-01-25 Ian Lance Taylor <iant@google.com>
4875 * script.cc (script_add_extern): Rewrite to use
4876 add_symbol_reference.
4878 2011-01-25 Doug Kwan <dougkwan@google.com>
4880 * icf.cc (get_section_contents): Always lock section's object.
4882 2011-01-24 Ian Lance Taylor <iant@google.com>
4884 * options.h (class General_options): Accept
4885 --no-detect-odr-violations.
4887 2011-01-24 Ian Lance Taylor <iant@google.com>
4889 * version.cc (version_string): Bump to 1.11.
4891 2011-01-24 Ian Lance Taylor <iant@google.com>
4893 * plugin.cc (class Plugin_rescan): Define new class.
4894 (Plugin_manager::claim_file): Set any_claimed_.
4895 (Plugin_manager::save_archive): New function.
4896 (Plugin_manager::save_input_group): New function.
4897 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4899 (Plugin_manager::new_undefined_symbol): New function.
4900 (Plugin_manager::rescan): New function.
4901 (Plugin_manager::rescannable_defines): New function.
4902 (Plugin_manager::add_input_file): Set any_added_.
4903 * plugin.h (class Plugin_manager): define new fields rescannable_,
4904 undefined_symbols_, any_claimed_, and any_added_. Declare
4905 Plugin_rescan as friend. Declare new functions.
4906 (Plugin_manager::Rescannable): Define type.
4907 (Plugin_manager::Rescannable_list): Define type.
4908 (Plugin_manager::Undefined_symbol_list): Define type.
4909 (Plugin_manager::Plugin_manager): Initialize new fields.
4910 * archive.cc (Archive::defines_symbol): New function.
4911 (Add_archive_symbols::run): Pass archive to plugins if any.
4912 * archive.h (class Archive): Declare defines_symbol.
4913 * readsyms.cc (Input_group::~Input_group): New function.
4914 (Finish_group::run): Pass input_group to plugins if any.
4915 * readsyms.h (class Input_group): Declare destructor.
4916 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4919 2011-01-10 Ian Lance Taylor <iant@google.com>
4921 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4923 (Layout::set_segment_offsets): Reset increase_relro before calling
4924 set_section_addresses a second time.
4926 2011-01-04 Cary Coutant <ccoutant@google.com>
4928 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4929 sections before NOBITS sections.
4931 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
4933 * version.cc (print_version): Update copyright to 2011.
4935 2010-12-23 Cary Coutant <ccoutant@google.com>
4937 * output.h (Output_data_reloc::add_output_section): Pass OD instead
4938 of OS to this->add. Add OD parameter to second form of the function.
4940 2010-12-20 Ian Lance Taylor <iant@google.com>
4942 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4943 second of two consecutive entries with same offset.
4945 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4947 * testsuite/Makefile.am (ifuncmain2static_LDADD)
4948 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4949 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4950 to avoid unneeded links against $(LDADD).
4951 * testsuite/Makefile.in: Regenerate.
4953 2010-12-15 Ian Lance Taylor <iant@google.com>
4956 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4957 for R_X86_64_32 and R_X86_64_PC32.
4958 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4959 ver_matching_def_pic.o.
4960 (ver_matching_def_pic.o): New target.
4962 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4964 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4965 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4966 Move definition before File_read::View member definitions.
4967 (File_read::View::~View): Initialize and hold lock before
4968 updating current_mapped_bytes.
4970 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4972 * dwarf_reader.cc: Remove outdated comment.
4973 * gold-threads.cc: Fix typo in error message.
4974 * archive.cc: Fix typos in comments.
4975 * archive.h: Likewise.
4976 * arm-reloc-property.cc: Likewise.
4977 * arm-reloc-property.h: Likewise.
4978 * arm-reloc.def: Likewise.
4980 * attributes.h: Likewise.
4981 * cref.cc: Likewise.
4982 * ehframe.cc: Likewise.
4983 * fileread.h: Likewise.
4985 * i386.cc: Likewise.
4987 * incremental.h: Likewise.
4988 * int_encoding.cc: Likewise.
4989 * layout.h: Likewise.
4990 * main.cc: Likewise.
4991 * merge.h: Likewise.
4992 * object.cc: Likewise.
4993 * object.h: Likewise.
4994 * options.cc: Likewise.
4995 * readsyms.cc: Likewise.
4996 * reduced_debug_output.cc: Likewise.
4997 * reloc.cc: Likewise.
4998 * script-sections.cc: Likewise.
4999 * sparc.cc: Likewise.
5000 * symtab.h: Likewise.
5001 * target-reloc.h: Likewise.
5002 * target.cc: Likewise.
5003 * target.h: Likewise.
5004 * timer.cc: Likewise.
5005 * timer.h: Likewise.
5006 * x86_64.cc: Likewise.
5008 2010-12-09 Cary Coutant <ccoutant@google.com>
5010 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5012 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5013 parameter; change all callers.
5014 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5015 * options.h (warn_execstack): New option.
5017 2010-12-07 Doug Kwan <dougkwan@google.com>
5019 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5020 like function call relocations.
5022 2010-12-07 Ian Lance Taylor <iant@google.com>
5024 * archive.cc (Archive::get_elf_object_for_member): Permit
5025 punconfigured to be NULL.
5026 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5027 (Archive::include_member): Pass NULL to get_elf_object_for_member
5028 if we searched for the archive and this is the first included
5031 2010-12-01 Ian Lance Taylor <iant@google.com>
5033 * dwarf_reader.h (class Sized_dwarf_line_info): Add
5034 track_relocs_type_ field.
5035 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5036 Set track_relocs_type_.
5037 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5038 contents when using RELA relocs.
5039 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5041 * reloc.cc (Track_relocs::next_addend): New function.
5042 * reloc.h (class Track_relocs): Declare next_addend.
5044 2010-12-01 Ian Lance Taylor <iant@google.com>
5046 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5049 2010-12-01 Ian Lance Taylor <iant@google.com>
5051 * README: Update compilers known to work and fail.
5053 2010-11-23 Matthias Klose <doko@ubuntu.com>
5055 * configure.in: For --enable-gold, handle value `default' instead of
5056 `both*'. Always install ld as ld.bfd, install as ld if gold is
5058 * configure: Regenerate.
5060 2010-11-18 Doug Kwan <dougkwan@google.com>
5062 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5063 and right_alignment to be zero. Store result alignment only if it is
5064 greater than existing alignment.
5066 2010-11-16 Cary Coutant <ccoutant@google.com>
5069 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5070 Check for ".zdebug_line".
5072 2010-11-16 Doug Kwan <dougkwan@google.com>
5073 Cary Coutant <ccoutant@google.com>
5075 * output.h (Output_segment::set_section_addresses): Pass increase_relro
5076 by reference; adjust all callers.
5077 * output.cc (Output_segment::set_section_addresses): Adjust references
5078 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5080 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5081 end at page boundary.
5083 2010-11-16 Cary Coutant <ccoutant@google.com>
5086 * layout.cc (Layout::choose_output_section): Transform names of
5087 compressed sections even when using a script with a SECTIONS clause.
5088 (Layout::output_section_name): Remove code to transform
5089 compressed debug section names.
5090 * output.cc (Output_section::add_input_section): Use uncompressed
5091 section size when tracking input sections.
5093 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
5095 * symtab.h (Symbol::NON_PIC_REF): Remove.
5096 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5097 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
5098 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5099 (Symbol::use_plt_offset): Take a flags argument and pass it
5100 directly to needs_dynamic_reloc. Restrict check for undefined
5101 weak symbols to function calls.
5102 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5103 (Target_arm::Scan::global): Use it.
5104 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5105 (Target_arm::Relocate::relocate): Likewise.
5106 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5107 parameter with an r_type parameter. Use get_reference_flags
5109 (Target_arm::Relocate::relocate): Update accordingly.
5110 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5111 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5112 (Target_i386::Scan::global): Likewise.
5113 (Target_i386::Relocate::relocate): Likewise.
5114 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5115 parameter with an r_type parameter. Use get_reference_flags
5117 (Target_i386::Relocate::relocate): Update accordingly.
5118 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5119 (Target_powerpc::Scan::global): Use it.
5120 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5121 (Target_powerpc::Relocate::relocate): Likewise.
5122 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5123 (Target_sparc::Scan::global): Use it.
5124 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5125 (Target_sparc::Relocate::relocate): Likewise.
5126 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5127 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5128 (Target_x86_64::Scan::global): Likewise.
5129 (Target_x86_64::Relocate::relocate): Likewise.
5131 2010-11-08 Doug Kwan <dougkwan@google.com>
5132 Cary Coutant <ccoutant@google.com>
5134 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5135 (Arm_exidx_merge_section::section_contents_): New data member.
5136 (Arm_input_section::Arm_input_section): Initialize original_contents_.
5137 (Arm_input_section::~Arm_input_section): De-allocate memory.
5138 (Arm_input_section::original_contents_): New data member.
5139 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5140 in parameters instead of calling Object::section_contents without
5142 (Arm_output_section::group_section): New parameter TASK. Pass it
5143 to callees that need locking objects.
5144 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
5145 to lock EXIDX input sections. Fix a formatting issue. Call
5146 Arm_exidx_merged_section::build_contents to create merged section
5148 (Arm_output_section::create_stub_group): New parameter TASK. Use it
5149 to lock object of stub table owner.
5150 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5151 TEXT_SIZE to initialize data member TEXT_SIZE_.
5152 (Arm_exidx_input_section::addralign): Fix typo in comment.
5153 (Arm_exidx_input_section::text_size): New method.
5154 (Target_arm::do_relax): New parameter TASK. Pass it to callees
5155 that require locking objects. Lock objects before scanning for stubs
5156 and updating local symbols.
5157 (Arm_input_section<big_endian>::init): Copy contents of original
5159 (Arm_input_section<big_endian>::do_write): Use saved contents of
5160 original input section instead of calling Object::section_contents
5162 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5163 size without calling Object::section_size().
5164 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5165 for size. Allocate a buffer for merged EXIDX entries.
5166 (Arm_exidx_merged_section::build_contents): New method.
5167 (Arm_exidx_merged_section::do_write): Move merge section contents
5168 building code to Arm_exidx_merged_section::build_contetns. Write
5169 out contetns in buffer instead of building it on the fly.
5170 (Arm_relobj::make_exidx_input_section): Also pass text section size
5171 to Arm_exidx_input_section constructor.
5172 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
5173 (Arm_dynobj::do_read_symbols): Fix memory leak.
5174 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5175 * target.h: (class Task): Add forward declaration.
5176 (Target::relax): Add new parameter TASK and pass it to
5178 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
5180 2010-11-05 Cary Coutant <ccoutant@google.com>
5183 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5184 object when reading from the file.
5185 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5187 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5188 when reading section contents.
5189 (get_section_contents): Likewise.
5190 (icf::find_identical_sections): Likewise.
5191 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5192 object when reading from the file.
5193 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5194 the object when doing deferred section layout.
5196 2010-11-03 Nick Clifton <nickc@redhat.com>
5199 * script.h (class Symbol_assignment: name): New member. Returns
5200 the name of the symbol.
5201 * scrfipt.cc (Script_options::is_pending_assignment): New member.
5202 Returns true if the given symbol name is on the list of
5203 assignments wating to be processed.
5204 * archive.cc (should_incldue_member): If the symbol is undefined,
5205 check to see if it is on the list of symbols pending assignment.
5207 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
5209 * script-sections.cc (Script_sections::find_memory_region): Check
5210 for a NULL output section pointer.
5212 2010-10-29 Doug Kwan <dougkwan@google.com>
5214 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5215 Output_section::add_relaxed_input_section.
5216 * output.cc (Output_section::add_relaxed_input_section): Add new
5217 arguments LAYOUT and NAME. Set section order index.
5218 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5219 Copy section order index.
5220 * output.h (Output_section::add_relaxed_input_section): Add new
5221 arguments LAYOUT and NAME.
5223 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5225 * testsuite/Makefile.am: Move gcctestdir/ld rule to
5226 NATIVE_OR_CROSS_LINKER.
5227 * testsuite/Makefile.in: Regenerate.
5229 2010-10-20 Doug Kwan <dougkwan@google.com>
5231 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5232 without SHF_LINK_ORDER flags.
5233 * layout.cc (Layout::choose_output_section): Do not filter
5234 SHF_LINK_ORDER flag in a relocatable link.
5236 2010-10-17 Cary Coutant <ccoutant@google.com>
5238 * output.h (Output_segment::set_section_addresses): Change function
5239 signature. Update all callers.
5240 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5242 (Output_segment::set_section_addresses): Align after last TLS
5243 section. Add padding before last relro section instead of after.
5245 2010-10-17 Doug Kwan <dougkwan@google.com>
5247 * gold/arm.cc (Target_arm::got_section): Use correct order and set
5248 GOT output section to be writable.
5250 2010-10-14 Cary Coutant <ccoutant@google.com>
5252 * debug.h (DEBUG_INCREMENTAL): New flag.
5253 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5254 * gold.cc (queue_initial_tasks): Check parameters for incremental link
5256 * incremental.cc (report_command_line): Ignore all forms of
5258 * layout.cc (Layout::Layout): Check parameters for incremental link
5260 * options.cc (General_options::parse_incremental): New function.
5261 (General_options::parse_no_incremental): New function.
5262 (General_options::parse_incremental_full): New function.
5263 (General_options::parse_incremental_update): New function.
5264 (General_options::incremental_mode_): New data member.
5265 (General_options::finalize): Check incremental_mode_.
5266 * options.h (General_options): Update help text for --incremental.
5267 Add --no-incremental, --incremental-full, --incremental-update.
5268 (General_options::Incremental_mode): New enum type.
5269 (General_options::incremental_mode): New function.
5270 (General_options::incremental_mode_): New data member.
5271 * parameters.cc (Parameters::incremental_mode_): New data member.
5272 (Parameters::set_options): Set incremental_mode_.
5273 (Parameters::set_incremental_full): New function.
5274 (Parameters::incremental): New function.
5275 (Parameters::incremental_update): New function.
5276 (set_parameters_incremental_full): New function.
5277 * parameters.h (Parameters::set_incremental_full): New function.
5278 (Parameters::incremental): New function.
5279 (Parameters::incremental_update): New function.
5280 (Parameters::incremental_mode_): New data member.
5281 (set_parameters_incremental_full): New function.
5282 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5283 incremental link mode.
5284 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5285 (Sized_relobj::do_relocate_sections): Likewise.
5286 * testsuite/Makefile.am (incremental_test): Use --incremental-full
5288 * testsuite/Makefile.in: Regenerate.
5289 * testsuite/incremental_test.sh: Filter all forms of --incremental.
5291 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5293 * script-sections.h (class Script_sections): Make
5294 Sections_elements typedef public.
5295 * script-sections.cc (class Sort_output_sections): Add elements_
5296 field. Add constructor which sets it; change all callers.
5297 (Sort_output_sections::is_before): New function.
5298 (Sort_output_sections::operator()): Call is_before.
5299 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5301 * testsuite/script_test_10.sh: New test. Test script section
5303 * testsuite/script_test_10.t: Likewise.
5304 * testsuite/script_test_10.s: Likewise.
5305 * testsuite/Makefile.am: Wrap the cross linker tests and the
5306 common tests into NATIVE_OR_CROSS_LINKER.
5307 (check_SCRIPTS): Add script_test_10.sh.
5308 (check_DATA): Add script_test_10.stdout.
5309 (script_test_10.o, script_test_10): New targets.
5310 (script_test_10.stdout): New target.
5311 * configure, testsuite/Makefile.in: Regenerate.
5313 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5315 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5316 error for the deprecated relocations.
5317 (Target_arm::Scan::global): Likewise.
5318 (Target_arm::Relocate::relocate): Likewise.
5320 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
5322 * fileread.cc (Input_file::find_file): Initialize *found_name
5323 and *namep when using the fallback search for case 4.
5325 2010-10-11 Cary Coutant <ccoutant@google.com>
5327 * options.h (class General_options): Redefine -z lazy as an alias for
5328 the negation of -z now.
5330 2010-10-11 Ian Lance Taylor <iant@google.com>
5332 * resolve.cc (symbol_to_bits): Report the value of the unsupported
5335 2010-10-06 Nick Clifton <nickc@redhat.com>
5337 * script-sections.cc(class Memory_region): Remove
5338 current_lma_offset_ field. Rename current_vma_offset_ to
5339 current_offset_. Add last_section_ field.
5340 (Memory_region::get_current_vma_address): Rename to
5341 get_current_address.
5342 (Memory_region::get_current_lma_address): Delete.
5343 (Memory_region::increment_vma_offset): Rename to
5345 (Memory_region::increment_lma_offset): Delete.
5346 (Memory_region::attributes_compatible): New method. Returns
5347 true if the provided section is compatible with the region.
5348 (Memory_region::get_last_section): New method. Returns the last
5349 section to use the region.
5350 (Memory_region::set_last_section): New method. Stores the last
5351 section to use the region.
5352 (Script_sections::block_in_region): New method. Returns true if
5353 a block of memory is contained within a region.
5354 (Script_sections::find_memory_region): New method. Locates a
5355 memory region to be used to set a VMA or LMA address.
5356 (Output_section_definition::set_section_addresses): Add code to
5357 check for addresses set by memory regions.
5358 (Output_segment::set_section_addresses): Remove memory region
5360 (Script_sections::create_segment): Add a warning if a header
5361 segment is created outside of any region.
5362 * script-sections.h (class Script_sections): Add prototypes for
5363 find_memory_region and block_in_region methods.
5364 * testsuite/memory_test.s: Use .long instead of .word.
5365 * testsuite/memory_test.t: Add some more output sections.
5366 * testsuite/memory_test.sh: Update expected output.
5368 2010-10-02 Doug Kwan <dougkwan@google.com>
5370 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5371 defintion to symtab.h
5372 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5373 declaration to defintion.
5375 2010-10-01 Nick Clifton <nickc@redhat.com>
5377 * expression.cc (eval): Replace dummy argument with NULL.
5378 (eval_maybe_dot): Check for a NULL result section pointer.
5379 (Symbol_expression::value): Likewise.
5380 (Dot_expression::value): Likewise.
5381 (BINARY_EXPRESSION): Likewise.
5382 (Max_expression::value): Likewise.
5383 (Min_expression::value): Likewise.
5384 (Absolute_expression::value): Likewise.
5385 (Addr_expression::value_from_output_section): Likewise.
5386 (Loaddddr_expression::value_from_output_section): Likewise.
5387 (Segment_start_expression::value): Likewise.
5388 * script-sections.cc
5389 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5391 (Sections_elememt_dot_assignment::set_section_addresses):
5393 (Output_data_expression::do_write_to_buffer): Likewise.
5394 (Output_section_definition::finalize_symbols): Likewise.
5395 (Output_section_definition::set_section_addresses): Likewise.
5397 2010-09-30 Doug Kwan <dougkwan@google.com>
5399 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5401 2010-09-28 Sriraman Tallam <tmsriram@google.com>
5403 * target.h (Target::can_icf_inline_merge_sections): New virtual
5405 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5407 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5409 * icf.cc (get_section_contents): Inline merge sections only when
5412 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5414 * configure: Regenerate.
5416 2010-09-17 Ian Lance Taylor <iant@google.com>
5418 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5419 * testsuite/Makefile.am (memory_test.o): New target.
5420 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5422 * testsuite/Makefile.in: Rebuild.
5424 2010-09-17 Doug Kwan <dougkwan@google.com>
5426 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5427 defintion if relocation uses GOT entries of the symbol.
5428 * testsuite/icf_safe_test.sh: Fix test.
5429 * testsuite/icf_safe_so_test.sh: Fix test.
5431 2010-09-16 Cary Coutant <ccoutant@google.com>
5433 * script_sections.cc (class Memory_region): Remove "NULL" from
5434 vector initializations.
5436 2010-09-15 Cary Coutant <ccoutant@google.com>
5438 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5439 Resolve forwarding symbols.
5441 2010-09-15 Doug Kwan <dougkwan@google.com>
5443 * gold/testsuite/script_test_3.t: Add ARM special sections.
5444 * gold/testsuite/script_test_4.t: Same.
5445 * gold/testsuite/script_test_5.t: Same.
5446 * gold/testsuite/script_test_6.t: Same.
5447 * gold/testsuite/script_test_7.t: Same.
5448 * gold/testsuite/script_test_7.t: Same.
5449 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5451 2010-09-14 Cary Coutant <ccoutant@google.com>
5453 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5454 (Target_x86_64::Relocate::relocate_tls): Replace check for
5455 saw_tls_block_reloc_ with test for executable section.
5457 2010-09-12 Cary Coutant <ccoutant@google.com>
5459 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5460 position-independent executables to shared libraries need dynamic
5462 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5463 position-independent executables.
5464 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5465 * testsuite/Makefile.in: Regenerate.
5467 2010-09-10 Nick Clifton <nickc@redhat.com>
5470 * testsuite/memory_test.t: Discard any sections that are not
5473 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
5476 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5477 "This::" to work around a bug in gcc 4.2.
5479 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5481 2010-09-09 Rafael Espindola <espindola@google.com>
5483 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5484 sections with different PF_X flags in the same segment.
5485 (Layout::find_first_load_seg): Search all segments to find the first
5487 * options.h (rosegment): New.
5489 2010-09-08 Rafael Espindola <espindola@google.com>
5491 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5493 2010-09-08 Doug Kwan <dougkwan@google.com>
5495 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5496 (Arm_relobj::do_relocate_sections): Add new parameter for output
5497 file to match the parent.
5498 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5499 of local symbols instead of input values. Update code to track
5500 changes in gold::relocate_section.
5501 * object.cc (Sized_relobj::compute_final_local_value): New methods.
5502 (Sized_relobj::compute_final_local_value_internal): New methods.
5503 (Sized_relobj::do_finalize_local_symbols): Move code from loop
5504 body into private version of Sized_relobj::compute_final_local_value.
5505 Call the inline method.
5506 * object.h (Symbol_value::Symbol_value): Define destructor. Free
5507 merged symbol value if there is one.
5508 (Symbol_value::has_output_value): New method defintiion.
5509 (Sized_relobj::Compute_final_local_value_status): New enum type.
5510 (Sized_relobj::compute_final_local_value): New methods.
5511 (Sized_relobj::compute_final_local_value_internal): New methods.
5512 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5513 and arm_cortex_a8.sh.
5514 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5515 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5517 * Makefile.in: Regenerate.
5518 * testsuite/arm_bl_out_of_range.s: Update test.
5519 * testsuite/thumb_bl_out_of_range.s: Ditto.
5520 * testsuite/thumb_blx_out_of_range.s: Ditto.
5521 * testsuite/arm_branch_out_of_range.sh: New file.
5522 * testsuite/arm_cortex_a8.sh: Ditto.
5523 * testsuite/arm_cortex_a8_b.s: Ditto.
5524 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5525 * testsuite/arm_cortex_a8_b_local.s: Ditto.
5526 * testsuite/arm_cortex_a8_bl.s: Ditto.
5527 * testsuite/arm_cortex_a8_blx.s: Ditto.
5528 * testsuite/arm_cortex_a8_local.s: Ditto.
5529 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5530 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5532 2010-09-08 Rafael Espindola <espindola@google.com>
5534 * Makefile.am (memory_test.stdout): Run readelf with -W.
5535 * Makefile.in: Regenerate.
5536 * testsuite/memory_test.sh: Make the regexps accept both 32 and
5539 2010-09-08 Rafael Espindola <espindola@google.com>
5541 * script-sections.cc (Script_sections::add_memory_region): Convert
5542 field precision to int.
5543 * script.cc (script_set_section_region, script_set_section_region):
5544 Convert field precision to int.
5546 2010-09-08 Rafael Espindola <espindola@google.com>
5548 * arm.cc (do_finalize_sections): Create the __exidx_start and
5549 __exdix_end symbols even when the section is missing.
5551 2010-09-08 Nick Clifton <nickc@redhat.com>
5553 * README: Remove claim that MEMORY is not supported.
5554 * expression.cc (script_exp_function_origin)
5555 (script_exp_function_length): Move from here to ...
5556 * script.cc: ... here.
5557 (script_set_section_region, script_add_memory)
5558 (script_parse_memory_attr, script_include_directive): New
5560 * script-sections.cc
5561 (class Memory_region): New class.
5562 (class Output_section_definition): Add set_memory_region,
5563 set_section_vma, set_section_lma and get_section_name methods.
5564 (class Script_Sections): Add add_memory_region,
5565 find_memory_region, find_memory_region_origin,
5566 find_memory_region_length and set_memory_region methods.
5567 Have set_section_addresses method walk the list of set memory
5569 Extend the print methos to display memory regions.
5570 * script-sections.h: Add prototypes for new methods.
5571 Add enum for MEMORY region attributes.
5572 * yyscript.y: Add support for parsing MEMORY regions.
5573 * script-c.h: Add prototypes for new functions.
5574 * testsuite/Makefile.am: Add test of MEMORY region functionality.
5575 * testsuite/Makefile.in: Regenerate.
5576 * testsuite/memory_test.sh: New script.
5577 * testsuite/memory_test.s: New assembler source file.
5578 * testsuite/memory_test.t: New linker script.
5580 2010-08-27 Doug Kwan <dougkwan@google.com>
5582 * gold/resolve.cc (Symbol_table::should_override): Let a weak
5583 reference override an existing dynamic weak reference.
5584 * testsuite/Makefile.am: Add new test dyn_weak_ref.
5585 * testsuite/Makefile.in: Regenerate.
5586 * testsuite/dyn_weak_ref.sh: New file.
5587 * testsuite/dyn_weak_ref_1.c: Ditto.
5588 * testsuite/dyn_weak_ref_2.c: Ditto.
5590 2010-08-27 Ian Lance Taylor <iant@google.com>
5592 * incremental.h (class Incremental_input_entry): Add virtual
5595 2010-08-27 Ian Lance Taylor <iant@google.com>
5597 * testsuite/start_lib_test_3.c: Mark t3 as used.
5599 2010-08-27 Nick Clifton <nickc@redhat.com>
5601 * options.cc (version_script): Fix small typo in previous
5604 2010-08-25 Nick Clifton <nickc@redhat.com>
5606 * archive.cc: Formatting fixes: Remove whitespace between
5607 typename and following asterisk. Remove whitespace between
5608 function name and opening parenthesis.
5609 * archive.h: Likewise.
5611 * attributes.cc: Likewise.
5612 * attributes.h: Likewise.
5613 * common.cc: Likewise.
5614 * copy-relocs.cc: Likewise.
5615 * dirsearch.h: Likewise.
5616 * dynobj.cc: Likewise.
5617 * ehframe.cc: Likewise.
5618 * ehframe.h: Likewise.
5619 * expression.cc: Likewise.
5620 * fileread.cc: Likewise.
5621 * fileread.h: Likewise.
5623 * gold-threads.cc: Likewise.
5624 * gold.cc: Likewise.
5625 * i386.cc: Likewise.
5627 * incremental-dump.cc: Likewise.
5628 * incremental.cc: Likewise.
5629 * layout.cc: Likewise.
5630 * layout.h: Likewise.
5631 * main.cc: Likewise.
5632 * merge.cc: Likewise.
5633 * merge.h: Likewise.
5634 * object.cc: Likewise.
5635 * object.h: Likewise.
5636 * options.cc: Likewise.
5637 * options.h: Likewise.
5638 * output.cc: Likewise.
5639 * output.h: Likewise.
5640 * plugin.cc: Likewise.
5641 * plugin.h: Likewise.
5642 * powerpc.cc: Likewise.
5643 * reloc.cc: Likewise.
5644 * script-c.h: Likewise.
5645 * script-sections.cc: Likewise.
5646 * script.cc: Likewise.
5647 * stringpool.cc: Likewise.
5648 * symtab.cc: Likewise.
5649 * symtab.h: Likewise.
5650 * target.cc: Likewise.
5651 * timer.cc: Likewise.
5652 * timer.h: Likewise.
5653 * version.cc: Likewise.
5654 * x86_64.cc: Likewise.
5656 2010-08-24 Nick Clifton <nickc@redhat.com>
5659 * layout.cc (segment_precedes): Sort segments by their physical
5660 addresses, if they have been set.
5662 2010-08-23 Cary Coutant <ccoutant@google.com>
5664 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5666 (Lib_group::include_member): Unlock object after deleting its
5668 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5671 2010-08-19 Neil Vachharajani <nvachhar@google.com>
5672 Cary Coutant <ccoutant@google.com>
5674 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5675 constructor, and set_blocker.
5676 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5678 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5679 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5680 * testsuite/Makefile.am (start_lib_test): New test case.
5681 * testsuite/Makefile.in: Regenerate.
5682 * testsuite/start_lib_test_main.c: New file.
5683 * testsuite/start_lib_test_1.c: New file.
5684 * testsuite/start_lib_test_2.c: New file.
5685 * testsuite/start_lib_test_3.c: New file.
5687 2010-08-19 Ian Lance Taylor <iant@google.com>
5689 * Makefile.in: Rebuild with automake 1.11.1.
5690 * aclocal.m4: Likewise.
5691 * testsuite/Makefile.in: Likewise.
5693 2010-08-19 Ian Lance Taylor <iant@google.com>
5696 * i386.cc (class Output_data_plt_i386): Update declarations.
5697 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
5698 local_ifuncs_ fields.
5699 (Target_i386::do_plt_section_for_global): New function.
5700 (Target_i386::do_plt_section_for_local): New function.
5701 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5702 parameter; change all callers. Initialize global_ifuncs_ and
5703 local_ifuncs_. If doing a static link define __rel_iplt_start and
5705 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5706 (Output_data_plt_i386::add_local_ifunc_entry): New function.
5707 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5709 (Target_i386::make_plt_section): New function, broken out of
5710 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
5711 (Target_i386::make_plt_entry): Call make_plt_section.
5712 (Target_i386::make_local_ifunc_plt_entry): New function.
5713 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5714 (Target_i386::Scan::local): Handle IFUNC symbols. Add
5715 R_386_IRELATIVE to switch.
5716 (Target_i386::Scan::global): Likewise.
5717 (Target_i386::Relocate::relocate): Likewise.
5718 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5720 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5721 (Target_x86_64::do_plt_section_for_global): New function.
5722 (Target_x86_64::do_plt_section_for_local): New function.
5723 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5724 parameter; change all callers. If doing a static link define
5725 __rela_iplt_start and __rela_iplt_end.
5726 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5727 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5728 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5730 (Target_x86_64::make_local_ifunc_plt_entry): New function.
5731 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5733 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5734 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
5735 R_X86_64_IRELATIVE to switch.
5736 (Target_x86_64::Scan::global): Likewise.
5737 (Target_x86_64::Relocate::relocate): Likewise.
5738 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5740 * target.h (class Target): Add plt_section_for_global and
5741 plt_section_for_local functions. Add do_plt_section_for_global
5742 and do_plt_section_for_local virtual functions.
5743 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
5744 clarifying comments.
5745 (Symbol::use_plt_offset): Handle IFUNC symbol.
5746 * object.cc (Sized_relobj::Sized_relobj): Initialize
5748 (Sized_relobj::local_has_plt_offset): New function.
5749 (Sized_relobj::local_plt_offset): New function.
5750 (Sized_relobj::set_local_plt_offset): New function.
5751 (Sized_relobj::do_count): Handle IFUNC symbol.
5752 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
5753 a bit away from input_shndx_ field. Add set_is_func_symbol and
5754 is_ifunc_symbol functions.
5755 (class Sized_relobj): Update declarations. Remove Tls_got_entry
5756 and Local_tls_got_offsets. Define Local_plt_offsets. Add
5757 local_plt_offsets_ field.
5758 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5759 * output.h (class Output_section_data): Add non-const
5760 output_section function.
5761 (class Output_data_got): Update declarations.
5762 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5763 Add use_plt_offset parameter to global and local constructors.
5764 Change all callers. Change local_sym_index_ field to 31 bits.
5765 Change GSYM_CODE and CONSTANT_CODE accordingly.
5766 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5767 doing a static link don't set sh_link field.
5768 (Output_data_got::Got_entry::write): Use PLT offset if
5770 (Output_data_got::add_global_plt): New function.
5771 (Output_data_got::add_local_plt): New function.
5772 * target-reloc.h (relocate_section): Handle IFUNC symbol.
5773 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5774 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5775 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5776 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5778 * testsuite/ifunc-sel.h: New file.
5779 * testsuite/ifuncmain1.c: New file.
5780 * testsuite/ifuncmain1vis.c: New file.
5781 * testsuite/ifuncmod1.c: New file.
5782 * testsuite/ifuncdep2.c: New file.
5783 * testsuite/ifuncmain2.c: New file.
5784 * testsuite/ifuncmain3.c: New file.
5785 * testsuite/ifuncmod3.c: New file.
5786 * testsuite/ifuncmain4.c: New file.
5787 * testsuite/ifuncmain5.c: New file.
5788 * testsuite/ifuncmod5.c: New file.
5789 * testsuite/ifuncmain6pie.c: New file.
5790 * testsuite/ifuncmod6.c: New file.
5791 * testsuite/ifuncmain7.c: New file.
5792 * configure, testsuite/Makefile.in: Rebuild.
5794 2010-08-18 Ian Lance Taylor <iant@google.com>
5797 (Output_section_incremental_inputs::write_input_files): Add cast
5798 to avoid signed/unsigned comparison warning.
5799 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5801 2010-08-12 Cary Coutant <ccoutant@google.com>
5803 * common.cc (Sort_commons::operator()): Remove unnecessary code.
5805 2010-08-13 Ian Lance Taylor <iant@google.com>
5807 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5809 2010-08-12 Cary Coutant <ccoutant@google.com>
5810 Doug Kwan <dougkwan@google.com>
5812 * resolve.cc (Symbol_table::should_override): When a weak dynamic
5813 defintion overrides non-weak undef, remember that the original undef
5815 * symtab.cc (Symbol_table::sized_write_global): For undef without
5816 an original weak binding, set binding to global in output.
5817 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5818 * testsuite/Makefile.in: Regenerate.
5819 * testsuite/strong_ref_weak_def.sh: New file.
5820 * testsuite/strong_ref_weak_def_1.c: Ditto.
5821 * testsuite/strong_ref_weak_def_2.c: Ditto.
5823 2010-08-12 Cary Coutant <ccoutant@google.com>
5825 * testsuite/incremental_test.sh: Rewrite.
5826 * testsuite/incremental_test_1.c: Rewrite.
5827 * testsuite/incremental_test_2.c: Rewrite.
5829 2010-08-12 Cary Coutant <ccoutant@google.com>
5831 * arm.cc (Target_arm::got_size): Add const.
5832 (Target_arm::got_entry_count): New function.
5833 (Target_arm::plt_entry_count): New function.
5834 (Target_arm::first_plt_entry_offset): New function.
5835 (Target_arm::plt_entry_size): New function.
5836 (Output_data_plt_arm::entry_count): New function.
5837 (Output_data_plt_arm::first_plt_entry_offset): New function.
5838 (Output_data_plt_arm::get_plt_entry_size): New function.
5839 * i386.cc (Target_i386::got_size): Add const.
5840 (Target_i386::got_entry_count): New function.
5841 (Target_i386::plt_entry_count): New function.
5842 (Target_i386::first_plt_entry_offset): New function.
5843 (Target_i386::plt_entry_size): New function.
5844 (Output_data_plt_i386::entry_count): New function.
5845 (Output_data_plt_i386::first_plt_entry_offset): New function.
5846 (Output_data_plt_i386::get_plt_entry_size): New function.
5847 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5848 find_incremental_inputs_sections. Dump incremental_got_plt section.
5849 * incremental.cc: Include target.h.
5850 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5851 parameter. Adjust all callers. Find incremental_got_plt section.
5852 (Incremental_inputs::create_data_sections): Create incremental_got_plt
5854 (Output_section_incremental_inputs::set_final_data_size): Calculate
5855 size of incremental_got_plt section.
5856 (Output_section_incremental_inputs::do_write): Write the
5857 incremental_got_plt section.
5858 (Got_plt_view_info): New struct.
5859 (Local_got_offset_visitor): New class.
5860 (Global_got_offset_visitor): New class.
5861 (Global_symbol_visitor_got_plt): New class.
5862 (Output_section_incremental_inputs::write_got_plt): New function.
5863 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5864 Add parameter. Adjust all callers.
5865 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5866 (Incremental_inputs::got_plt_section): New function.
5867 (Incremental_inputs::got_plt_section_): New data member.
5868 (Incremental_got_plt_reader): New class.
5869 * layout.cc (Layout::create_incremental_info_sections): Add the
5870 incremental_got_plt section.
5871 * object.h (Got_offset_list::get_list): New function.
5872 (Got offset_list::for_all_got_offsets): New function.
5873 (Sized_relobj::local_got_offset_list): New function.
5874 * powerpc.cc (Target_powerpc::got_size): Add const.
5875 (Target_powerpc::got_entry_count): New function.
5876 (Target_powerpc::plt_entry_count): New function.
5877 (Target_powerpc::first_plt_entry_offset): New function.
5878 (Target_powerpc::plt_entry_size): New function.
5879 (Output_data_plt_powerpc::entry_count): New function.
5880 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5881 (Output_data_plt_powerpc::get_plt_entry_size): New function.
5882 * sparc.cc (Target_sparc::got_size): Add const.
5883 (Target_sparc::got_entry_count): New function.
5884 (Target_sparc::plt_entry_count): New function.
5885 (Target_sparc::first_plt_entry_offset): New function.
5886 (Target_sparc::plt_entry_size): New function.
5887 (Output_data_plt_sparc::entry_count): New function.
5888 (Output_data_plt_sparc::first_plt_entry_offset): New function.
5889 (Output_data_plt_sparc::get_plt_entry_size): New function.
5890 * symtab.h (Symbol::got_offset_list): New function.
5891 (Symbol_table::for_all_symbols): New function.
5892 * target.h (Sized_target::got_entry_count): New function.
5893 (Sized_target::plt_entry_count): New function.
5894 (Sized_target::plt_entry_size): New function.
5895 * x86_64.cc (Target_x86_64::got_size): Add const.
5896 (Target_x86_64::got_entry_count): New function.
5897 (Target_x86_64::plt_entry_count): New function.
5898 (Target_x86_64::first_plt_entry_offset): New function.
5899 (Target_x86_64::plt_entry_size): New function.
5900 (Output_data_plt_x86_64::entry_count): New function.
5901 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5902 (Output_data_plt_x86_64::get_plt_entry_size): New function.
5904 2010-08-12 Cary Coutant <ccoutant@google.com>
5906 * archive.cc: Include incremental.h.
5907 (Archive::Archive): Initialize incremental_info_.
5908 (Archive::include_member): Record archive members in incremental info.
5909 (Add_archive_symbols::run): Record begin and end of an archive in
5911 (Lib_group::include_member): Record objects in incremental info.
5912 * archive.h (Incremental_archive_entry): Forward declaration.
5913 (Archive::set_incremental_info): New member function.
5914 (Archive::incremental_info): New member function.
5915 (Archive::Unused_symbol_iterator): New class.
5916 (Archive::unused_symbols_begin): New member function.
5917 (Archive::unused_symbols_end): New member function.
5918 (Archive::incremental_info_): New data member.
5919 * incremental-dump.cc (find_input_containing_global): New function.
5920 (dump_incremental_inputs): Dump new incremental info sections.
5921 * incremental.cc: Include symtab.h.
5922 (Output_section_incremental_inputs): New class.
5923 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5924 new incremental info sections.
5925 (Sized_incremental_binary::do_check_inputs): Likewise.
5926 (Incremental_inputs::report_archive): Remove.
5927 (Incremental_inputs::report_archive_begin): New function.
5928 (Incremental_inputs::report_archive_end): New function.
5929 (Incremental_inputs::report_object): New function.
5930 (Incremental_inputs::finalize_inputs): Remove.
5931 (Incremental_inputs::report_input_section): New function.
5932 (Incremental_inputs::report_script): Rewrite.
5933 (Incremental_inputs::finalize): Do nothing but finalize string table.
5934 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5935 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5936 (Incremental_inputs::create_data_sections): New function.
5937 (Incremental_inputs::relocs_entsize): New function.
5938 (Output_section_incremental_inputs::set_final_data_size): New function.
5939 (Output_section_incremental_inputs::do_write): New function.
5940 (Output_section_incremental_inputs::write_header): New function.
5941 (Output_section_incremental_inputs::write_input_files): New function.
5942 (Output_section_incremental_inputs::write_info_blocks): New function.
5943 (Output_section_incremental_inputs::write_symtab): New function.
5944 * incremental.h (Incremental_script_entry): Forward declaration.
5945 (Incremental_object_entry): Forward declaration.
5946 (Incremental_archive_entry): Forward declaration.
5947 (Incremental_inputs): Forward declaration.
5948 (Incremental_inputs_header_data): Remove.
5949 (Incremental_inputs_header): Remove.
5950 (Incremental_inputs_header_write): Remove.
5951 (Incremental_inputs_entry_data): Remove.
5952 (Incremental_inputs_entry): Remove.
5953 (Incremental_inputs_entry_write): Remove.
5954 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5955 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5956 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5957 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5959 (Incremental_input_entry): New class.
5960 (Incremental_script_entry): New class.
5961 (Incremental_object_entry): New class.
5962 (Incremental_archive_entry): New class.
5963 (Incremental_inputs::Incremental_inputs): Initialize new data members.
5964 (Incremental_inputs::report_inputs): Remove.
5965 (Incremental_inputs::report_archive): Remove.
5966 (Incremental_inputs::report_archive_begin): New function.
5967 (Incremental_inputs::report_archive_end): New function.
5968 (Incremental_inputs::report_object): Change prototype.
5969 (Incremental_inputs::report_input_section): New function.
5970 (Incremental_inputs::report_script): Change prototype.
5971 (Incremental_inputs::get_reloc_count): New function.
5972 (Incremental_inputs::set_reloc_count): New function.
5973 (Incremental_inputs::create_data_sections): New function.
5974 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5975 (Incremental_inputs::inputs_section): New function.
5976 (Incremental_inputs::symtab_section): New function.
5977 (Incremental_inputs::relocs_section): New function.
5978 (Incremental_inputs::get_stringpool): Add const.
5979 (Incremental_inputs::command_line): Add const.
5980 (Incremental_inputs::inputs): Remove.
5981 (Incremental_inputs::command_line_key): New function.
5982 (Incremental_inputs::input_file_count): New function.
5983 (Incremental_inputs::input_files): New function.
5984 (Incremental_inputs::relocs_entsize): New function.
5985 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5986 (Incremental_inputs::finalize_inputs): Remove.
5987 (Incremental_inputs::Input_info): Remove.
5988 (Incremental_inputs::lock_): Remove.
5989 (Incremental_inputs::inputs_): Change type.
5990 (Incremental_inputs::inputs_map_): Remove.
5991 (Incremental_inputs::current_object_entry_): New data member.
5992 (Incremental_inputs::inputs_section_): New data member.
5993 (Incremental_inputs::symtab_section_): New data member.
5994 (Incremental_inputs::relocs_section_): New data member.
5995 (Incremental_inputs::reloc_count_): New data member.
5996 (Incremental_inputs_reader): New class.
5997 (Incremental_symtab_reader): New class.
5998 (Incremental_relocs_reader): New class.
5999 * layout.cc (Layout::finalize): Move finalization of incremental info
6000 and creation of incremental info sections to follow finalization of
6001 symbol table. Set offsets for postprocessing sections.
6002 (Layout::create_incremental_info_sections): Call
6003 Incremental_inputs::create_data_sections. Add incremental symtab
6004 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
6005 sections to layout after input sections.
6006 * layout.h (struct Timespec): Forward declaration.
6007 (Layout::incremental_inputs): Add const.
6008 (Layout::create_incremental_info_sections): Add parameter.
6009 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6010 * object.cc: Include incremental.h.
6011 (Relobj::finalize_incremental_relocs): New function.
6012 (Sized_relobj::do_layout): Record input sections in incremental info.
6013 * object.h (Object::output_section): New function.
6014 (Object::output_section_offset): Moved from Relobj.
6015 (Object::get_incremental_reloc_base): New function.
6016 (Object::get_incremental_reloc_count): New function.
6017 (Object::do_output_section): New function.
6018 (Object::do_output_section_offset): Moved from Relobj.
6019 (Object::do_get_incremental_reloc_base): New function.
6020 (Object::do_get_incremental_reloc_count): New function.
6021 (Object::Object): Initialize new data members.
6022 (Relobj::output_section): Renamed do_output_section and moved to
6024 (Relobj::output_section_offset): Moved to Object.
6025 (Relobj::do_get_incremental_reloc_base): New function.
6026 (Relobj::do_get_incremental_reloc_count): New function.
6027 (Relobj::allocate_incremental_reloc_counts): New function.
6028 (Relobj::count_incremental_reloc): New function.
6029 (Relobj::finalize_incremental_relocs): New function.
6030 (Relobj::next_incremental_reloc_index): New function.
6031 (Relobj::reloc_counts_): New data member.
6032 (Relobj::reloc_bases_): New data member.
6033 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
6034 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
6035 (Sized_relobj::incremental_relocs_scan): New function.
6036 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6037 (Sized_relobj::incremental_relocs_write): New function.
6038 (Sized_relobj::incremental_relocs_write_reltype): New function.
6039 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6041 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6042 archives and object files elsewhere.
6043 (Add_symbols::run): Report object files here.
6044 (Finish_group::run): Report end of archive at end of group.
6045 * reloc.cc: Include layout.h, incremental.h.
6046 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6047 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6048 (Sized_relobj::incremental_relocs_scan): New function.
6049 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6050 (Sized_relobj::do_relocate_sections): Write incremental relocations.
6051 (Sized_relobj::incremental_relocs_write): New function.
6052 (Sized_relobj::incremental_relocs_write_reltype): New function.
6053 * script.cc (read_input_script): Rewrite test for incremental link.
6054 Change call to Incremental_inputs::report_script.
6055 * symtab.h (Symbol_table::first_global_index): New function.
6056 (Symbol_table::output_count): New function.
6058 2010-08-12 Doug Kwan <dougkwan@google.com>
6060 * arm.cc (Target_arm::merge_object_attributes): Check command line
6061 options --no-wchar-size-warning and --no-enum-size-warning.
6062 * options.h (General_options): Add ld-compatible options
6063 --no-enum-size-warning and --no-wchar-size-warning.
6065 2010-08-04 Ian Lance Taylor <iant@google.com>
6067 * x86_64.cc (Target_x86_64::Scan::local): Use
6068 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6069 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6070 (Target_x86_64::Scan::global): Likewise.
6071 (Target_x86_64::Relocate::relocate): Likewise.
6072 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6075 2010-08-03 Cary Coutant <ccoutant@google.com>
6077 * merge.cc (Output_merge_string::do_add_input_section): Count strings
6078 to reserve space in merged_strings vector. Keep total input size
6080 (Output_merge_string::do_print_merge_stats): Print total input size.
6081 * merge.h (Output_merge_string): Add input_size_ field.
6082 * stringpool.cc (Stringpool_template::string_length): Move
6083 implementations out of Stringpool_template class and place in
6085 * stringpool.h (string_length): Move out of Stringpool_template.
6087 2010-08-03 Ian Lance Taylor <iant@google.com>
6090 * layout.cc (relaxation_loop_body): If address of load segment is
6091 set, adjust address to include headers if possible.
6093 2010-08-03 Ian Lance Taylor <iant@google.com>
6095 * version.cc (version_string): Bump to 1.10.
6097 2010-08-03 Ian Lance Taylor <iant@google.com>
6100 * layout.h (enum Output_section_order): Define.
6101 (class Layout): Update declarations.
6102 * layout.cc (Layout::get_output_section): Add order parameter.
6103 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6104 is_first_non_relro parameters. Change all callers.
6105 (Layout::choose_output_section): Likewise.
6106 (Layout::add_output_section_data): Likewise.
6107 (Layout::make_output_section): Likewise. Set order.
6108 (Layout::default_section_order): New function.
6109 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6110 * output.cc (Output_section::Output_section): Initialize order_.
6111 Don't initialize deleted fields.
6112 (Output_segment::Output_segment): Don't initialize deleted
6114 (Output_segment::add_output_section_to_load): New function
6115 replacing add_output_section. Change all callers to call this or
6116 add_output_section_to_nonload.
6117 (Output_segment::add_output_section_to_nonload): New function.
6118 (Output_segment::remove_output_section): Rewrite.
6119 (Output_segment::add_initial_output_data): Likewise.
6120 (Output_segment::has_any_data_sections): Likewise.
6121 (Output_segment::is_first_section_relro): Likewise.
6122 (Output_segment::maximum_alignment): Likewise.
6123 (Output_segment::has_dynamic_reloc): New function replacing
6124 dynamic_reloc_count. Change all callers.
6125 (Output_segment::has_dynamic_reloc_list): New function replacing
6126 dynamic_reloc_count_list. Change all callers.
6127 (Output_segment::set_section_addresses): Rewrite.
6128 (Output_segment::set_offset): Rewrite.
6129 (Output_segment::find_first_and_last_list): Remove.
6130 (Output_segment::set_tls_offsets): Rewrite.
6131 (Output_segment::first_section_load_address): Likewise.
6132 (Output_segment::output_section_count): Likewise.
6133 (Output_segment::section_with_lowest_load_address): Likewise.
6134 (Output_segment::write_section_headers): Likewise.
6135 (Output_segment::print_sections_to_map): Likewise.
6136 * output.h (class Output_data): Remove dynamic_reloc_count_
6137 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
6138 (Output_data::add_dynamic_reloc): Rewrite.
6139 (Output_data::has_dynamic_reloc): New function.
6140 (Output_data::dynamic_reloc_count): Remove.
6141 (class Output_section): Add order_ field. Remvoe is_relro_local_,
6142 is_last_relro_, is_first_non_relro_, is_interp_,
6143 is_dynamic_linker_section_ fields. Add order and set_order
6144 functions. Remove is_relro_local, set_is_relro_local,
6145 is_last_relro, set_is_last_relro, is_first_non_relro,
6146 set_is_first_non_relro functions, is_interp, set_is_interp,
6147 is_dynamic_linker_section, and set_is_dynamic_linker_section
6149 (class Output_segment): Change Output_data_list from std::list to
6150 std:;vector. Add output_lists_ field. Remove output_data_ and
6151 output_bss_ fields. Update declarations.
6153 2010-08-02 Ian Lance Taylor <iant@google.com>
6155 * arm.cc (Target_arm::gc_process_relocs): Use typename.
6156 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6157 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6159 2010-08-02 Ian Lance Taylor <iant@google.com>
6162 * script.cc (Script_options::Script_options): Initialize
6163 symbol_definitions_ and symbol_references_.
6164 (Script_options::add_symbol_assignment): Update
6165 symbol_definitions_ and symbol_references_.
6166 (Script_options::add_symbol_reference): New function.
6167 (script_symbol): New function.
6168 * script.h (class Script_options): Add symbol_definitions_ and
6169 symbol_references_ fields.
6170 (Script_options::referenced_const_iterator): New type.
6171 (Script_options::referenced_begin): New function.
6172 (Script_options::referenced_end): New function.
6173 (Script_options::is_referenced): New function.
6174 (Script_options::any_unreferenced): New function.
6175 * script-c.h (script_symbol): Declare.
6176 * yyscript.y (exp): Call script_symbol.
6177 * symtab.cc: Include "script.h".
6178 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6179 Change all callers. Check symbols referenced by scripts.
6180 (Symbol_table::add_undefined_symbols_from_command_line): Add
6181 layout parameter. Change all callers.
6182 (Symbol_table::do_add_undefined_symbols_from_command_line):
6183 Likewise. Break out loop body. Check symbols referenced by
6185 (Symbol_table::add_undefined_symbol_from_command_line): New
6186 function broken out of
6187 do_add_undefined_symbols_from_command_line.
6188 * symtab.h (class Symbol_table): Update declarations.
6189 * archive.cc: Include "layout.h".
6190 (Archive::should_include_member): Add layout parameter. Change
6191 all callers. Check for symbol mentioned in expression.
6192 * archive.h (class Archive): Update declaration.
6193 * object.cc (Sized_relobj::do_should_include_member): Add layout
6195 * object.h (Object::should_include_member): Add layout parameter.
6197 (Object::do_should_include_member): Add layout parameter.
6198 (class Sized_relobj): Update declaration.
6199 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6201 * dynobj.h (class Sized_dynobj): Update declaration.
6202 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6204 * plugin.h (class Sized_pluginobj): Update declaration.
6206 2010-08-02 Ian Lance Taylor <iant@google.com>
6209 * output.cc (Output_segment::set_offset): Search for the first and
6210 last sections rather than assuming that the list is in order.
6211 (Output_segment::find_first_and_last_list): New function.
6212 * output.h (class Output_segment): Update declarations.
6213 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6214 (relro_strip_test_SOURCES): New variable.
6215 (relro_strip_test_DEPENDENCIES): New variable.
6216 (relro_strip_test_LDFLAGS): New variable.
6217 (relro_strip_test_LDADD): New variable.
6218 (relro_strip_test.so): New target.
6220 2010-08-02 Ian Lance Taylor <iant@google.com>
6222 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6223 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6224 (Target_i386::got_tlsdesc_section): New function.
6225 (Target_i386::got_section): Create space for GOT entries for
6226 TLSDESC relocations.
6227 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6229 (Target_i386::Scan::global): Likewise.
6230 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6232 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6233 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6234 (Target_x86_64::got_tlsdesc_section): New function.
6235 (Target_x86_64::got_section): Create space for GOT entries for
6236 TLSDESC relocations.
6237 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6239 (Target_x86_64::Scan::global): Likewise.
6240 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6243 2010-08-02 Ian Lance Taylor <iant@google.com>
6245 * testsuite/final_layout.sh: Use dc to convert from hex to
6248 2010-07-29 Sriraman Tallam <tmsriram@google.com>
6250 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6251 paramter to the call to gold::gc_process_relocs.
6252 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6253 paramter to the call to gold::gc_process_relocs.
6254 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6255 parameter to the call to gold::gc_process_relocs.
6256 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6257 template parameter to the call to gold::gc_process_relocs.
6258 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6259 paramter to the call to gold::gc_process_relocs.
6260 * gc.h (get_embedded_addend_size): New function.
6261 (gc_process_relocs): Save the size of the reloc for use by ICF.
6262 * icf.cc (get_section_contents): Get the addend from the text section
6263 for SHT_REL relocation sections.
6264 * icf.h (Icf::Reloc_addend_size_info): New typedef.
6265 (Icf::Reloc_info): Add new member reloc_addend_size_info.
6266 * int_encoding.h (read_from_pointer): New overloaded function.
6267 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6268 * testsuite/icf_sht_rel_addend_test.sh: New file.
6269 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6270 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6272 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6274 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6275 * Makefile.in: Regenerate.
6276 * testsuite/Makefile.in: Regenerate.
6278 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
6280 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6281 * gold/testsuite/debug_msg.cc: Likewise.
6282 * gold/testsuite/odr_violation1.cc
6283 * gold/testsuite/odr_violation2.cc
6285 2010-07-21 Cary Coutant <ccoutant@google.com>
6287 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6288 string, and length fields.
6289 (Output_merge_string::Merged_strings_list): New type.
6290 (Output_merge_string::Merged_strings_lists): New typedef.
6291 (Output_merge_string): Replace merged_strings_ with
6292 merged_strings_lists_.
6293 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6294 Merged_strings_list per input object and section. Don't store pointer
6295 to the string. Don't store length with each merged string entry.
6296 (Output_merge_string::finalize_merged_data): Loop over list of merged
6297 strings lists. Recompute length of each merged string.
6299 2010-07-15 Cary Coutant <ccoutant@google.com>
6301 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6304 2010-07-14 Ian Lance Taylor <iant@google.com>
6306 * descriptors.cc (Descriptors::open): Report correct name in error
6309 2010-07-13 Doug Kwan <dougkwan@google.com>
6311 * arm.cc (Arm_input_section::Arm_input_section): For a
6312 SHT_ARM_EXIDX section, always keeps the input sections.
6313 (Arm_input_section::set_exidx_section_link): New method.
6314 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6315 has_errors_ to false.
6316 (Arm_exidx_input_section::has_errors,
6317 Arm_exidx_input_section::set_has_errors): New methods.
6318 (Arm_exidx_input_section::has_errors_): New data member.
6319 (Arm_relobj::get_exidx_shndx_list): New method.
6320 (Arm_output_section::append_text_sections_to_list): Do not skip
6321 section without SHF_EXECINSTR.
6322 (Arm_output_section::fix_exidx_coverage): Skip input sections with
6324 (Arm_relobj::make_exidx_input_section): Add new parameter for text
6325 section header. Make error messages more verbose. Check for
6326 a non-executable section linked to an EXIDX section.
6327 (Arm_relobj::do_read_symbols): Remove error checking, which has been
6328 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
6329 check that there is no deferred EXIDX section if we exit early.
6330 Instead of not making an EXIDX section in case of an error, make one
6331 and set the has_errors flag of it.
6332 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6333 in a relocatable link.
6334 (Target_arm::do_relax): Look for the EXIDX output section instead of
6335 assuming that it is called .ARM.exidx.
6336 (Target_arm::fix_exidx_coverage): Add a new parameter for input
6337 section list. Do not check for SHF_EXECINSTR section flags but
6338 skip any input section with errors.
6339 * output.cc (Output_section::Output_section): Initialize
6340 always_keeps_input_sections_ to false.
6341 (Output_section::add_input_section): Check for
6342 always_keeps_input_sections_.
6343 * output.h (Output_section::always_keeps_input_sections,
6344 Output_section::set_always_keeps_input_sections): New methods.
6345 (Output_section::always_keeps_input_sections): New data member.
6347 2010-07-13 Rafael Espindola <espindola@google.com>
6349 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6350 * fileread.h (Input_file): Add try_extra_search_path and find_file.
6352 2010-07-13 Philip Herron <herron.philip@googlemail.com>
6353 Ian Lance Taylor <iant@google.com>
6355 * output.h (Output_section_lookup_maps::add_merge_section):
6356 Correct check of whether value was inserted.
6357 (Output_section_lookup_maps::add_merge_input_section): Likewise.
6358 (Output_section_lookup_maps::add_relaxed_input_section):
6360 * arm.cc (Target_arm::got_section): Remove used local os.
6361 * i386.cc (Target_i386::got_section): Likewise.
6362 * x86_64.cc (Target_x86_64::got_section): Likewise.
6363 * sparc.cc (Target_sparc::got_section): Likewise.
6364 (Target_sparc::relocate): Remove unused local have_got_offset.
6365 * powerpc.cc (Target_powerpc::relocate): Likewise.
6367 2010-07-13 Ian Lance Taylor <iant@google.com>
6369 * compressed_output.cc (zlib_decompress): Fix signature in
6372 * archive.cc (Archive::include_member): Unlock an external member
6373 of a thin archive. Don't bother to delete an object we know is
6376 2010-07-12 Cary Coutant <ccoutant@google.com>
6378 * compressed_output.cc (zlib_decompress): New function.
6379 (get_uncompressed_size): New function.
6380 (decompress_input_section): New function.
6381 * compressed_output.h (get_uncompressed_size): New function.
6382 (decompress_input_section): New function.
6383 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6384 Handle compressed debug sections.
6385 * layout.cc (is_compressed_debug_section): New function.
6386 (Layout::output_section_name): Map compressed section names to
6388 * layout.h (is_compressed_debug_section): New function.
6389 (is_debug_info_section): Recognize compressed debug sections.
6390 * merge.cc: Include compressed_output.h.
6391 (Output_merge_data::do_add_input_section): Handle compressed
6393 (Output_merge_string::do_add_input_section): Handle compressed
6395 * object.cc: Include compressed_output.h.
6396 (Sized_relobj::Sized_relobj): Initialize new data members.
6397 (build_compressed_section_map): New function.
6398 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6399 * object.h (Object::section_is_compressed): New method.
6400 (Object::do_section_is_compressed): New method.
6401 (Sized_relobj::Compressed_section_map): New type.
6402 (Sized_relobj::do_section_is_compressed): New method.
6403 (Sized_relobj::compressed_sections_): New data member.
6404 * output.cc (Output_section::add_input_section): Handle compressed
6406 * reloc.cc: Include compressed_output.h.
6407 (Sized_relobj::write_sections): Handle compressed debug sections.
6409 2010-07-08 Cary Coutant <ccoutant@google.com>
6411 * resolve.cc (Symbol_table::resolve): Remember whether undef was
6412 weak when resolving to a dynamic def.
6413 (Symbol_table::should_override): Add adjust_dyndef flag; set it
6414 for weak undef/dynamic def cases. Adjust callers.
6415 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6416 undef_binding_weak_.
6417 (Symbol_table::sized_write_globals): Adjust symbol binding.
6418 (Symbol_table::sized_write_symbol): Add binding parameter.
6419 * symtab.h (Symbol::set_undef_binding): New method.
6420 (Symbol::is_undef_binding_weak): New method.
6421 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6422 (Symbol_table::should_override): Add new parameter.
6423 (Symbol_table::sized_write_symbol): Add new parameter.
6425 * testsuite/weak_undef_file1.cc: Add new test case.
6426 * testsuite/weak_undef_file2.cc: Fix header comment.
6427 * testsuite/weak_undef_test.cc: Add new test case.
6429 2010-06-29 Doug Kwan <dougkwan@google.com>
6431 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6432 Initialize USE_SYMBOL_.
6433 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6435 (Arm_reloc_property::uses_symbol_): New data member declaration.
6436 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6437 uses symbol value and symbol is undefined but not weakly undefined.
6439 2010-06-28 Rafael Espindola <espindola@google.com>
6441 * plugin.cc (Plugin::load): Use dlerror.
6443 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
6445 * symtab.cc (detect_odr_violations): When reporting an ODR
6446 violation, report an object where the symbol is defined.
6448 2010-06-25 Doug Kwan <dougkwan@google.com>
6450 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6451 (Target_arm::section_may_have_icf_unsafe_pointers): New method
6453 (Target_arm::Scan::local_reloc_may_be_function_pointer,
6454 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6455 target hook to detect function points.
6456 (Target_arm::Scan::possible_function_pointer_reloc): New method.
6457 * icf.h (Icf::check_section_for_function_pointers): Change type of
6458 parameter SECTION_NAME to const reference to std::string. Use
6459 target hook to determine if section may have unsafe pointers.
6460 * target.h (Target::section_may_have_icf_unsafe_pointers): New
6463 2010-06-21 Rafael Espindola <espindola@google.com>
6465 * fileread.cc (Input_file::find_fie): New
6466 (Input_file::open): Use Input_file::find_fie.
6467 * fileread.h (Input_file::find_fie): New
6468 * plugin.cc (set_extra_library_path): New.
6469 (Plugin::load): Add set_extra_library_path to the transfer vector.
6470 (Plugin_manager::set_extra_library_path): New.
6471 (Plugin_manager::add_input_file): Use the extra search path if set.
6472 (set_extra_library_path(): New.
6473 * plugin.h (Plugin_manager): Add set_extra_library_path and
6476 2010-06-19 Cary Coutant <ccoutant@google.com>
6478 * layout.cc (gdb_sections): Add .debug_types.
6479 (lines_only_debug_sections): Likewise.
6481 2010-06-18 Rafael Espindola <espindola@google.com>
6483 * plugin.cc (add_input_file,add_input_library)
6484 (Plugin_manager::add_input_file): Make filename arguments const.
6485 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6488 2010-06-16 Doug Kwan <dougkwan@google.com>
6490 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6491 .ARM.attributes section if we have not merged any input
6492 attributes sections.
6494 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6496 * arm.cc: Allow combining objects with no EABI version
6499 2010-06-15 Rafael Espindola <espindola@google.com>
6501 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6503 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6505 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6506 (struct iovec): Correct !HAVE_READV definition.
6508 2010-06-10 Cary Coutant <ccoutant@google.com>
6510 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6511 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6513 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6516 * symtab.h (Symbol::is_placeholder): New member function.
6517 * target-reloc.h (relocate_section): Check for placeholder symbols.
6519 * testsuite/Makefile.am (plugin_test_8): New test.
6520 (plugin_test_9): New test.
6521 * testsuite/Makefile.in: Regenerate.
6523 2010-06-09 Nick Clifton <nickc@redhat.com>
6525 * yyscript.y (input_list_element): Allow strings prefixed with
6526 the '-' character. Treat these as libraries.
6527 * script.cc (script_add_library): New function. Adds a library
6528 specified by "-l<name>" found in an input script.
6529 * script-c.h: Add prototype for script_add_library.
6531 2010-06-07 Doug Kwan <dougkwan@google.com>
6533 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6534 Restrict stub-group size to be within long conditional branch
6535 range when working around cortex-A8 erratum.
6537 2010-06-07 Damien Diederen <dd@crosstwine.com>
6539 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6542 2010-06-03 Sriraman Tallam <tmsriram@google.com>
6546 (Output_section::Input_section_sort_entry::compare_section_ordering):
6547 Change to return non-zero correctly.
6548 (Output_section::Input_section_sort_section_order_index_compare
6549 ::operator()): Change to fix ambiguity in comparisons.
6551 2010-06-01 Sriraman Tallam <tmsriram@google.com>
6553 * gold.h (is_wildcard_string): New function.
6554 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6555 (Layout::layout_eh_frame): Ditto.
6556 (Layout::find_section_order_index): New method.
6557 (Layout::read_layout_from_file): New method.
6558 * layout.h (Layout::find_section_order_index): New method.
6559 (Layout::read_layout_from_file): New method.
6560 (Layout::input_section_position_): New private member.
6561 (Layout::input_section_glob_): New private member.
6562 * main.cc (main): Call read_layout_from_file here.
6563 * options.h (--section-ordering-file): New option.
6564 * output.cc (Output_section::input_section_order_specified_): New
6566 (Output_section::Output_section): Initialize new member.
6567 (Output_section::add_input_section): Add new parameter.
6568 Keep input sections when --section-ordering-file is used.
6569 (Output_section::set_final_data_size): Sort input sections when
6570 section ordering file is specified.
6571 (Output_section::Input_section_sort_entry): Add new parameter.
6573 (Output_section::Input_section_sort_entry::compare_section_ordering):
6575 (Output_section::Input_section_sort_compare::operator()): Change to
6576 consider section_order_index.
6577 (Output_section::Input_section_sort_init_fini_compare::operator()):
6578 Change to consider section_order_index.
6579 (Output_section::Input_section_sort_section_order_index_compare
6580 ::operator()): New method.
6581 (Output_section::sort_attached_input_sections): Change to sort
6582 according to section order when specified.
6583 (Output_section::add_input_section<32, true>): Add new parameter.
6584 (Output_section::add_input_section<64, true>): Add new parameter.
6585 (Output_section::add_input_section<32, false>): Add new parameter.
6586 (Output_section::add_input_section<64, false>): Add new parameter.
6587 * output.h (Output_section::add_input_section): Add new parameter.
6588 (Output_section::input_section_order_specified): New
6590 (Output_section::set_input_section_order_specified): New method.
6591 (Input_section::Input_section): Initialize section_order_index_.
6592 (Input_section::section_order_index): New method.
6593 (Input_section::set_section_order_index): New method.
6594 (Input_section::section_order_index_): New member.
6595 (Input_section::Input_section_sort_section_order_index_compare): New
6597 (Output_section::input_section_order_specified_): New member.
6598 * script-sections.cc (is_wildcard_string): Delete and move modified
6600 (Output_section_element_input::Output_section_element_input): Modify
6601 call to is_wildcard_string.
6602 (Output_section_element_input::Input_section_pattern
6603 ::Input_section_pattern): Ditto.
6604 (Output_section_element_input::Output_section_element_input): Ditto.
6605 * testsuite/Makefile.am (final_layout): New test case.
6606 * testsuite/Makefile.in: Regenerate.
6607 * testsuite/final_layout.cc: New file.
6608 * testsuite/final_layout.sh: New file.
6610 2010-06-01 Rafael Espindola <espindola@google.com>
6612 * plugin.cc (Plugin::load): Pass the output name to the plugin.
6614 2010-06-01 Rafael Espindola <espindola@google.com>
6616 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6617 visibility of symbols.
6619 2010-05-27 Doug Kwan <dougkwan@google.com>
6621 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6622 from start of output section instead of address for a local symbol
6623 in a merged or relaxed section when doing a relocatable link.
6625 2010-05-26 Rafael Espindola <espindola@google.com>
6628 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6629 adding sections the garbage collector removed.
6630 * gold/testsuite/Makefile.am: Add test.
6631 * gold/testsuite/Makefile.in: Regenerate.
6632 * gold/testsuite/plugin_test_7.sh: New.
6633 * gold/testsuite/plugin_test_7_1.c: New.
6634 * gold/testsuite/plugin_test_7_2.c: New.
6636 2010-05-26 Rafael Espindola <espindola@google.com>
6638 * script-sections.cc (Output_section_definition::set_section_addresses):
6639 Check for --section-start.
6641 2010-05-26 Doug Kwan <dougkwan@google.com>
6643 * arm.cc (Arm_scan_relocatable_relocs): New class.
6644 (Target_arm::relocate_special_relocatable): New method.
6645 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6646 (Arm_relocate_functions::thumb_branch_common): Same.
6647 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6648 instead of Default_scan_relocatable_relocs.
6649 * target-reloc.h (relocate_for_relocatable): Let target handle
6650 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6651 * target.h (Sized_target::relocate_special_relocatable): New method.
6653 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6655 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6657 2010-05-23 Doug Kwan <dougkwan@google.com>
6659 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6661 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6662 with a direct branch, not a conditional branch, to a stub.
6663 * merge.cc (Output_merge_base::record_input_section): New method
6665 (Output_merge_data::do_add_input_section): Record input section if
6666 keeps-input-sections flag is set.
6667 (Output_merge_string::do_add_input_section): Ditto.
6668 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6669 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6671 (Output_merge_base::keeps_input_sections,
6672 Output_merge_base::set_keeps_input_sections,
6673 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6675 (Output_merge_base::Input_sections): New type declaration.
6676 (Output_merge_base::input_sections_begin,
6677 Output_merge_base::input_sections_end,
6678 Output_merge_base::do_set_keeps_input_sections): New method definitions.
6679 (Output_merge_base::bool keeps_input_sections_,
6680 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6681 Output_merge_base::input_sections_): New data members.
6682 (Output_merge_data::do_set_keeps_input_sections): New method
6684 (Output_merge_string::do_set_keeps_input_sections): Ditto.
6685 * output.cc (Output_section::Input_section::relobj): Move method
6686 defintion from class declaration to here and handle merge sections.
6687 (Output_section::Input_section::shndx): Ditto.
6688 (Output_section::Output_section): Remove initializations of removed
6689 data members and initialize new data member LOOKUP_MAPS_.
6690 (Output_section::add_input_section): Set keeps-input-sections flag
6691 for a newly created merge output section as appropriate. Adjust code
6692 to use Output_section_lookup_maps class.
6693 (Output_section::add_relaxed_input_section): Adjst code for lookup
6694 maps code refactoring.
6695 (Output_section::add_merge_input_section): Add a new parameter
6696 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
6697 class. If adding input section to a newly created merge output
6698 section fails, remove the new merge section.
6699 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6700 Adjust code for use of the Output_section_lookup_maps class.
6701 (Output_section::find_merge_section): Ditto.
6702 (Output_section::build_lookup_maps): New method defintion.
6703 (Output_section::find_relaxed_input_section): Adjust code to use
6704 Output_section_lookup_maps class.
6705 (Output_section::get_input_sections): Export merge sections. Adjust
6706 code to use Output_section_lookup_maps class.
6707 (Output_section:::add_script_input_section): Adjust code to use
6708 Output_section_lookup_maps class. Update lookup maps for merge
6710 (Output_section::discard_states): Use Output_section_lookup_maps.
6711 (Output_section::restore_states): Same.
6712 * output.h (Merge_section_properties): Move class defintion out of
6714 (Output_section_lookup_maps): New class.
6715 (Output_section::Input_section::is_merge_section): New method
6717 (Output_section::Input_section::relobj): Move defintion out of class
6718 defintion. Declare method only.
6719 (Output_section::Input_section::shndx): Ditto.
6720 (Output_section::Input_section::output_merge_base): New method defintion.
6721 (Output_section::Input_section::u2_.pomb): New union field.
6722 (Output_section::Merge_section_by_properties_map,
6723 Output_section::Output_section_data_by_input_section_map,
6724 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6726 (Output_section::add_merge_input_section): Add new parameter
6727 KEEPS_INPUT_SECTIONS.
6728 (Output_section::build_lookup_maps): New method declaration.
6729 (Output_section::merge_section_map_,
6730 Output_section::merge_section_by_properties_map_,
6731 Output_section::relaxed_input_section_map_,
6732 Output_section::is_relaxed_input_section_map_valid_): Remove data
6734 (Output_section::lookup_maps_): New data member.
6736 2010-05-21 Doug Kwan <dougkwan@google.com>
6739 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6740 avoid a compilation error.
6742 2010-05-19 Rafael Espindola <espindola@google.com>
6744 * script-sections.cc (Output_section_definition::allocate_to_segment):
6745 Update the phdrs_list even when the output section is NULL.
6746 * testsuite/Makefile.am: Add test.
6747 * testsuite/Makefile.in: Regenerate.
6748 * testsuite/script_test_9.cc: New.
6749 * testsuite/script_test_9.sh: New.
6750 * testsuite/script_test_9.t: New.
6752 2010-05-19 Doug Kwan <dougkwan@google.com>
6754 * arm.cc (Arm_input_section::original_size): New method.
6755 (Arm_input_section::do_addralign): Add a cast.
6756 (Arm_input_section::do_output_offset): Remove static cast.
6757 (Arm_input_section::original_addralign,
6758 Arm_input_section::original_size_): Change type to uint32_t.
6759 (Arm_input_section::init): Add safe casts for section alignment
6761 (Arm_input_section::set_final_data_size): Do not set address and
6762 offset of stub table.
6763 (Arm_output_section::fix_exidx_coverage): Change use of of
6764 Output_section::Simple_input_section to that of
6765 Output_section::Input_section.
6766 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6767 except for the first pass.
6768 * output.cc (Output_section::get_input_sections): Change type of
6769 input_sections to std::list<Input_section>.
6770 (Output_section::add_script_input_section): Rename from
6771 Output_section::add_simple_input_section. Change type of SIS
6772 parameter from Simple_input_section to Input_section.
6773 * output.h (Output_section::Simple_input_section): Remove class.
6774 (Output_section::Input_section): Change class visibility to public.
6775 (Output_section::Input_section::addralign): Use stored alignments
6776 for special input sections if set.
6777 (Output_section::Input_section::set_addralign): New method.
6778 (Output_section::get_input_sections): Change parameter type from
6779 list of Simple_input_section to list of Input_section.
6780 (Output_section::add_script_input_section): Rename from
6781 Output_section::add_simple_input_section. Change first parameter's
6782 type from Simple_input_section to Input_section and remove the
6783 second and third parameters.
6784 * script-sections.cc (Input_section::Input_section_list): Change
6785 type to list of Output_section::Input_section/
6786 (Input_section_info::Input_section_info): Change parameter type of
6787 INPUT_SECTION to Output_section::Input_section.
6788 (Input_section_info::input_section): Change return type.
6789 (Input_section_info::input_section_): Change type to
6790 Output_section::Input_section.
6791 (Output_section_element_input::set_section_addresses): Adjust code
6792 to use Output_section::Input_section instead of
6793 Output_section::Simple_input_section. Adjust code for renaming
6794 of Output_section::add_simple_input_section.
6795 (Orphan_output_section::set_section_addresses): Ditto.
6797 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6799 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6800 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6802 2010-05-18 Rafael Espindola <espindola@google.com>
6804 * options.cc (General_options::finalize): Handle -nostdlib.
6805 * options.h (nostdlib): New option.
6806 * script.cc (script_add_search_dir): Handle -nostdlib.
6808 2010-05-12 Doug Kwan <dougkwan@google.com>
6810 * arm.cc (Target_arm::do_finalize_sections): Create an empty
6811 attributes section only if there no attributes section after merging.
6812 (Target_arm::merge_object_attributes): Move value of
6813 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6814 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6815 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6816 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6817 and arm_attr_merge_7.stdout.
6818 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6819 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6820 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6821 arm_attr_merge_7b.o): New rules.
6822 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6824 * testsuite/Makefile.in: Regenerate.
6825 * testsuite/arm_attr_merge.sh: New file.
6826 * testsuite/arm_attr_merge_[67][ab].s: Same.
6828 2010-05-05 Nick Clifton <nickc@redhat.com>
6830 * po/es.po: Updated Spanish translation.
6832 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6834 * Makefile.am (install-exec-local): Properly install gold as
6835 default cross linker.
6836 * Makefile.in: Regenerated.
6838 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6839 Nick Clifton <nickc@redhat.com>
6841 * configure.ac (install_as_default): Define and set to false
6842 unless --enable-gold or --enable-gold=both/gold has been
6844 * configure: Regenerate.
6846 * Makefile.am (install-exec-local): Install the executable as
6847 'ld.gold'. If install_as_default is true then also install it as
6849 * Makefile.in: Regenerated.
6851 2010-04-24 Ian Lance Taylor <iant@google.com>
6853 * layout.cc (Layout::layout_reloc): In relocatable link don't
6854 combine reloc sections for grouped sections.
6856 2010-04-23 Sriraman Tallam <tmsriram@google.com>
6858 * gc.h (gc_process_relocs): Pass information on relocs pointing to
6859 sections that are not ordinary to icf.
6860 * icf.cc (get_section_contents): Handle relocation pointing to section
6861 with no object or shndx information.
6862 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6863 * testsuite/Makefile.in: Regenerate.
6864 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6865 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6867 2010-04-22 Ian Lance Taylor <iant@google.com>
6869 * expression.cc (Expression::Expression_eval_info): Add
6870 result_alignment_pointer field.
6871 (Expression::eval_with_dot): Add result_alignment_pointer
6872 parameter. Change all callers.
6873 (Expression::eval_maybe_dot): Likewise.
6874 (class Binary_expression): Add alignment_pointer parameter to
6875 left_value and right_value. Change all callers.
6876 (BINARY_EXPRESSION): Set result alignment.
6877 (class Trinary_expression): Add alignment_pointer parameter to
6878 arg2_value and arg3_value. Change all callers.
6879 (Trinary_cond::value): Set result alignment.
6880 (Max_expression::value, Min_expression::value): Likewise.
6881 (Align_expression::value): Likewise.
6882 * script-sections.cc (class Sections_element): Add dot_alignment
6883 parameter to set_section_addresses virtual function. Update
6885 (class Output_section_element): Likewise.
6886 (Script_sections::create_segments): Add dot_alignment parameter.
6888 (Script_sections::create_segments_from_phdrs_clause): Likewise.
6889 (Script_sections::set_phdrs_clause_addresses): Likewise.
6890 * script-sections.h: Update declarations.
6891 * script.h: Update declarations.
6892 * output.h (Output_segment::set_minimum_p_align): Don't decrease
6894 * testsuite/script_test_3.t: Set large alignment.
6895 * testsuite/script_test_3.sh: Make sure that at least one LOAD
6896 segment has expected alignment.
6898 2010-04-22 Nick Clifton <nickc@redhat.com>
6900 * po/gold.pot: Updated by the Translation project.
6901 * po/vi.po: Updated Vietnamese translation.
6903 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
6905 * testsuite/Makefile.am (check_PROGRAMS): Add
6906 icf_virtual_function_folding_test.
6907 * testsuite/Makefile.in: Regenerated.
6909 2010-04-15 Andrew Haley <aph@redhat.com>
6911 * options.h (merge_exidx_entries): New option.
6912 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6913 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6914 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6915 (Target_arm::merge_exidx_entries): New function.
6916 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6917 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6918 to Arm_exidx_fixup constructor.
6919 Add new arg, merge_exidx_entries.
6920 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6921 Arm_output_section::fix_exidx_coverage.
6923 2010-04-18 Sriraman Tallam <tmsriram@google.com>
6925 * icf.cc (get_section_contents): Check for preemptible functions.
6926 Ignore addend when appropriate.
6927 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
6929 (add_from_relobj): Check for section folded.
6930 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6931 * symtab.h (should_add_dynsym_entry): Add new parameter.
6932 * target-reloc.h (scan_relocs): Check for section folded.
6933 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6934 Check reloc types for function pointers in shared objects.
6935 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6937 (icf_preemptible_functions_test): New test case.
6938 (icf_string_merge_test): New test case.
6939 * testsuite.Makefile.in: Regenerate.
6940 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6941 bar_glob. Refactor code.
6942 * testsuite/icf_preemptible_functions_test.cc: New file.
6943 * testsuite/icf_preemptible_functions_test.sh: New file.
6944 * testsuite/icf_string_merge_test.cc: New file.
6945 * testsuite/icf_string_merge_test.sh: New file.
6946 * testsuite/icf_virtual_function_folding_test.cc: New file.
6947 * testsuite/icf_virtual_function_folding_test.sh: New file.
6949 2010-04-14 Doug Kwan <dougkwan@google.com>
6951 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6952 for local symbol recounting if we remove a section due to ICF.
6953 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6954 there are no regular objects in input.
6956 2010-04-13 Doug Kwan <dougkwan@google.com>
6958 * arm.cc (Arm_input_section::set_final_data_size): Compute
6959 accurate final data size instead of using current data size.
6961 2010-04-09 Doug Kwan <dougkwan@google.com>
6963 * layout.cc (Layout::choose_output_section): Handle script section
6965 (Layout::make_output_section_for_script): Add section type parameter.
6966 Handle script section types.
6967 * layout.h (Layout::make_output_section_for_script): Add section
6969 * output.cc (Output_section::Output_section): Initialize data member
6971 (Output_section::do_reset_address_and_file_offset): Do not set address
6972 to 0 if section is a NOLOAD section.
6973 * output.h (Output_section::is_noload): New method.
6974 (Output_section::set_is_noload): Ditto.
6975 (Output_section::is_noload_): New data member.
6976 * script-c.h (Script_section_type): New enum type.
6977 (struct Parser_output_section_header): Add new file section_type.
6978 * script-sections.cc (Sections_element::output_section_name): Add
6979 parameter for returning script section type.
6980 (Output_section_definition::output_section_name): Ditto.
6981 (Output_section_definition::section_type)P; New method.
6982 (Output_section_definiton::script_section_type_name): Ditto.
6983 (Output_section_definition::script_section_type_): New data member.
6984 (Output_section_definition::Output_section_definition): Initialize
6985 data member Output_section_definition::script_section_type_.
6986 (Output_section_definition::create_sections): Pass script section type
6987 to Layout::make_output_section_for_script.
6988 (Output_section_definition::output_section_name): Return script
6989 section type to caller.
6990 (Output_section_definition::set_section_address): Do not advance
6991 dot value and load address if section type is NOLOAD. Set address
6992 of NOLOAD sections regardless of section flags.
6993 (Output_section_definition::print): Print section type if it is
6994 not SCRIPT_SECTION_TYPE_NONE.
6995 (Output_section_definition::section_type): New method.
6996 (Output_section_definition::script_section_type_name): Ditto.
6997 (Script_sections::output_section_name): Add new parameter
6998 PSECTION_TYPE for returning script section type. Pass it to
6999 section elements. Handle discard sections.
7000 (Sort_output_sections::operator()): Handle NOLOAD sections.
7001 * script-sections.h (Script_sections::Section_type): New enum type.
7002 (Script_sections::output_section_name): Add a new parameter for
7003 returning script section type.
7004 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7006 * yyscript.y (union): Add new field SECTION_TYPE.
7007 (COPY, DSECT, INFO, NOLOAD): New tokens.
7008 (opt_address_and_section_type): Change type to output_section_header.
7009 (section_type): New non-terminal
7010 (section_header): Handle section type.
7011 (opt_address_and_section_type): Return section type value.
7013 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
7015 * testsuite/plugin_common_test_1.c (foo): Add prototype.
7016 * testsuite/plugin_common_test_2.c (foo): Likewise.
7018 2010-04-08 Doug Kwan <dougkwan@google.com>
7020 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7022 * output.cc (Output_section::add_merge_input_section): Simplify
7023 code and return status of Output_merge_base::add_input_section.
7024 Update merge section map only if Output_merge_base::add_input_section
7027 2010-04-07 Doug Kwan <dougkwan@google.com>
7029 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7030 if section is marked as containing instructions but has no mapping
7032 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7033 correct section index.
7034 (Arm_relobj::find_linked_text_section): Ditto.
7036 2010-04-07 Cary Coutant <ccoutant@google.com>
7038 * archive.cc (include_member): Destroy Read_symbols_data object before
7040 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7041 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7042 (Read_symbols_data::~Read_symbols_data) New destructor.
7043 (Section_relocs::Section_relocs) New constructor.
7044 (Section_relocs::~Section_relocs) New destructor.
7045 (Read_relocs_data::Read_relocs_data) New constructor.
7046 (Read_relocs_data::~Read_relocs_data) New destructor.
7047 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7048 pointers to NULL after deleting.
7050 2010-04-07 Doug Kwan <dougkwan@google.com>
7052 * arm.cc: Replace "endianity" with "endianness" in comments.
7053 (Arm_exidx_cantunwind): Ditto.
7054 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7055 (Arm_relobj::merge_flags_and_attributes): New method.
7056 (Arm_relobj::merge_flags_and_attributes_): New data member.
7057 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7058 (Arm_relobj::scan_sections_for_stubs): Ditto.
7059 (Arm_relobj::do_read_symbols): Check to see if we really want to
7060 merge processor-specific flags and attributes. Exit early if
7061 an object is empty except for section names and the undefined symbol.
7062 (Target_arm::do_finalize_sections): Move check for ELF format to
7063 Arm_relobj::do_read_symbols. Merge processor specific flags and
7064 attributes from a regular object only when we have determined that
7065 it is aapropriate. Do not create an .ARM.attributes section in
7066 output if there is no regular input object.
7067 (Target_arm::merge_processor_specific_flags): Check
7068 --warn-mismatch before printing any error.
7069 (Target_arm::merge_object_attributes): Ditto.
7070 * gold.cc (queue_middle_tasks): Handle the case in which there is
7071 no regular object in input.
7072 * options.cc (General_options::parse_EB): New method.
7073 (General_options::parse_EL): Same.
7074 (General_options::General_options): Initialize endianness_.
7075 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7077 (General_options::Endianness): New enum.
7078 (General_options::endianness): New method.
7079 (General_options::endianness_): New data member.
7080 * parameters.cc (Parameters::set_options): Check target endianness.
7081 (Parameters::set_target_once): Ditto.
7082 (Parameters::check_target_endianness): New method.
7083 (parameters_force_valid_target): If either -EL or -EB is specified,
7084 use it to define endianness of default target.
7085 * parameters.h (Parameters::check_target_endianness): New method
7087 * target.h (class Target): Change "endianity" to "endianness"
7090 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7092 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7093 * configure: Regenerate.
7094 * Makefile.in: Regenerate.
7095 * testsuite/Makefile.in: Regenerate.
7097 2010-04-06 Cary Coutant <ccoutant@google.com>
7100 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7101 prevailing definitions of common symbols.
7102 * testsuite/plugin_test_6.sh: New test case.
7103 * testsuite/plugin_common_test_1.c: New test case.
7104 * testsuite/plugin_common_test_2.c: New test case.
7105 * testsuite/Makefile.am (plugin_test_6): New test case.
7106 * testsuite/Makefile.in: Regenerate.
7108 2010-04-06 Nick Clifton <nickc@redhat.com>
7110 * po/vi.po: New Vietnamese translation.
7112 2010-03-30 Doug Kwan <dougkwan@google.com>
7114 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7116 2010-03-25 Doug Kwan <dougkwan@google.com>
7118 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7119 to avoid a conversion warning on a 32-bit host.
7121 2010-03-24 Ian Lance Taylor <iant@google.com>
7123 * testsuite/script_test_3.t: Add a TLS segment.
7124 * testsuite/Makefile.am (check_PROGRAMS): Add
7125 tls_phdrs_script_test.
7126 (tls_phdrs_script_test_SOURCES): Define.
7127 (tls_phdrs_script_test_DEPENDENCIES): Define.
7128 (tls_phdrs_script_test_LDFLAGS): Define.
7129 (tls_phdrs_script_test_LDADD): Define.
7130 * testsuite/Makefile.in: Rebuild.
7132 2010-03-23 Cary Coutant <ccoutant@google.com>
7134 * fileread.cc (find_or_make_view): Fix comment.
7136 2010-03-23 Ian Lance Taylor <iant@google.com>
7138 * script-sections.cc (class Orphan_section_placement): Define
7139 PLACE_TLS and PLACE_TLS_BSS.
7140 (Orphan_section_placement::Orphan_section_placement): Initialize
7142 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7143 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7144 (tls_script_test_SOURCES): Define.
7145 (tls_script_test_DEPENDENCIES): Define.
7146 (tls_script_test_LDFLAGS): Define.
7147 (tls_script_test_LDADD): Define.
7148 * testsuite/Makefile.in: Rebuild.
7150 2010-03-22 Doug Kwan <dougkwan@google.com>
7152 * arm.cc (Arm_relocate_functions::abs8,
7153 Arm_relocate_functions::abs16): Use correct check for overflow
7154 specified in the ARM ELF specs.
7155 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
7156 target of a BLX instruction specially.
7157 (Reloc_stub::stub_type_for_reloc): Ditto.
7158 (Relocate::relocate): Use symbolic names instead of numeric relocation
7159 codes to report error.
7160 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7162 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7163 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7164 thumb2_blx_out_of_range.stdout
7165 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7166 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7167 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7168 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7169 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7170 thumb2_blx_in_range, thumb2_blx_in_range.o,
7171 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7172 thumb2_blx_out_of_range.o): New rules.
7173 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7174 thumb2_blx_in_range and thumb2_blx_out_of_range.
7175 * testsuite/Makefile.in: Regenerate.
7176 * arm_branch_in_range.sh: Add tests for THUMB BLX.
7177 * testsuite/thumb_blx_in_range.s: New file.
7178 * testsuite/thumb_blx_out_of_range.s: New file.
7180 2010-03-22 Rafael Espindola <espindola@google.com>
7182 * archive.cc (Should_include): Move to archive.h.
7183 (should_include_member): Make it a member of Archive.
7185 (Add_lib_group_symbols): New.
7186 * archive.h: Include options.h.
7187 (Archive_member): Moved from Archive.
7188 (Should_include): Moved from archive.cc.
7190 (Add_lib_group_symbols): New.
7191 * dynobj.cc (do_should_include_member): New.
7192 * dynobj.h (do_should_include_member): New.
7193 * gold.cc (queue_initial_tasks): Update call to queue.
7194 * main.cc (main): Print lib group stats.
7195 * object.cc (do_should_include_member): New.
7196 * object.h: Include archive.h.
7197 (Object::should_include_member): New.
7198 (Object::do_should_include_member): New.
7199 (Sized_relobj::do_should_include_member): New.
7200 * options.cc (General_options::parse_start_lib): New.
7201 (General_options::parse_end_lib): New.
7202 (Input_arguments::add_file): Handle lib groups.
7203 (Input_arguments::start_group): Check we are not in a lib.
7204 (Input_arguments::start_lib): New.
7205 (Input_arguments::end_lib): New.
7206 * options.h (General_options): Add start_lib and end_lib.
7207 (Input_argument::lib_): New.
7208 (Input_argument::lib): New.
7209 (Input_argument::is_lib): New.
7210 (Input_file_lib): New.
7211 (Input_arguments::in_lib_): New.
7212 (Input_arguments::in_lib): New.
7213 (Input_arguments::start_lib): New.
7214 (Input_arguments::end_lib_): New.
7215 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7216 in unused members as preempted.
7217 (Sized_pluginobj::do_should_include_member): New.
7218 * plugin.h (Sized_pluginobj::do_should_include_member): New.
7219 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7221 (Read_symbols::do_whole_lib_group): New.
7222 (Read_symbols::do_lib_group): New.
7223 (Read_symbols::do_read_symbols): Handle lib groups.
7224 (Read_symbols::get_name): Handle lib groups.
7225 * readsyms.h (Read_symbols): Add an archive member pointer.
7226 (Read_symbols::do_whole_lib_group): New.
7227 (Read_symbols::do_lib_group): New.
7228 (Read_symbols::member_): New.
7229 * script.cc (read_input_script): Update call to queue_soon.
7231 2010-03-19 Doug Kwan <dougkwan@google.com>
7233 * arm.cc (Stub_table::Stub_table): Initialize new data members
7234 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7235 (Stub_table::add_reloc_stub): Assign stub offset and update
7236 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7237 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7239 (Stub_table::update_data_size_and_addralign): Use
7240 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7241 instead of going over all reloc stubs.
7242 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7243 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7244 Stringpool_template::offset_ to size of Stringpool_char.
7245 (Stringpool_template::new_key_offset): Remove code to initialize
7246 Stringpool_template::offset_.
7247 * stringpool.h (Stringpool_template::set_no_zero_null): Set
7248 Stringpool_template::offset_ to zero.
7250 2010-03-15 Doug Kwan <dougkwan@google.com>
7252 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7254 (Stringpool_template::new_key_offset): New method.
7255 (Stringpool_template::add_string): Assign offsets when adding new
7257 (Stringpool_template::set_string_offsets): Do not set string offsets
7258 when not optimizing.
7259 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7261 (Chunked_vector::clear): Clear size_.
7262 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7263 (Chunked_vector::size): Return size_.
7264 (Chunked_vector::push_back): Use size_ to find insert position.
7265 (Chunked_vector::size_): New data member.
7266 (Stringpool_template::set_no_zero_null): Assert string set is empty.
7267 (Stringpool_template::new_key_offset): New method declaration.
7268 (Stringpool_template::offset_): New data member.
7270 2010-03-15 Rafael Espindola <espindola@google.com>
7272 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7273 Add_symbols' constructor.
7274 * readsyms.h (Add_symbols): Remove the input_group member.
7276 2010-03-10 Ian Lance Taylor <iant@google.com>
7278 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7279 target to ask whether a reference to a symbol requires a stack
7281 * target.h (Target::is_call_to_non_split): New function.
7282 (Target::do_is_call_to_non_split): Declare virtual function.
7283 * target.cc: Include "symtab.h".
7284 (Target::do_is_call_to_non_split): New function.
7285 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7287 2010-03-10 Cary Coutant <ccoutant@google.com>
7289 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7290 (File_read::open[1]): Remove initial mapping of whole_file_view_.
7291 (File_read::open[2]): Add whole_file_view_ to list of views.
7292 (File_read::make_view): Remove test of whole_file_view_.
7293 (File_read::find_or_make_view): Create whole_file_view_ if
7295 (File_read::clear_views): Replace bool parameter with enum;
7296 adjust all callers. Don't delete views with permanent data;
7297 do delete cached views and views from archives if
7298 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
7299 if clearing the corresponding view.
7300 * fileread.h (File_read::Clear_views_mode): New enum.
7301 (File_read::View::is_permanent_view): New method.
7302 (File_read::clear_views): Replace bool parameter
7303 with enum; adjust all callers.
7304 * options.h (General_options): Change keep_files_mapped option;
7305 add map_whole_files.
7306 * readsyms.cc (Add_symbols::run): Delete sd_ object before
7308 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7311 2010-03-10 David S. Miller <davem@davemloft.net>
7313 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7315 2010-03-09 Sriraman Tallam <tmsriram@google.com>
7317 * icf.cc (get_section_contents): Add '@' marker after processing the
7320 2010-03-08 Doug Kwan <dougkwan@google.com>
7322 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7323 due to a conversion warning.
7324 (Arm_relobj::update_output_local_symbol_count): Check for local
7325 symbol with unset output index.
7327 2010-03-05 Ian Lance Taylor <iant@google.com>
7329 * options.h (class General_options): Add --spare-dynamic-tags.
7330 * output.cc (Output_data_dynamic::set_final_data_size): Implement
7331 --spare-dynamic-tags.
7333 2010-03-05 Ian Lance Taylor <iant@google.com>
7335 * incremental.cc: Include "libiberty.h".
7337 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
7339 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7340 function, is_info_ member.
7341 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7342 (Versions::Versions): Update caller.
7343 (Versions::define_base_version): Likewise.
7344 (Versions::add_def): Likewise.
7346 2010-03-03 Sriraman Tallam <tmsriram@google.com>
7348 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7349 (Scan::possible_function_pointer_reloc): New function.
7350 (Scan::local_reloc_may_be_function_pointer): Change to call
7351 possible_function_pointer_reloc.
7352 (Scan::global_reloc_may_be_function_pointer): Ditto.
7353 * icf.h (Icf::check_section_for_function_pointers): Change to reject
7354 relocations in ".data.rel.ro._ZTV" section.
7355 * testsuite/icf_safe_so_test.sh: Change to pass i386.
7356 * testsuite/icf_safe_so_test.cc: Ditto.
7357 * testsuite/icf_safe_test.cc: Ditto.
7358 * testsuite/icf_safe_test.sh: Ditto.
7360 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7361 Ian Lance Taylor <iant@google.com>
7363 * target-reloc.h (relocate_section): Check the symbol table index
7364 for -1U before setting the local symbol index.
7365 (scan_relocatable_relocs): If copying the relocation, record that
7366 the local symbol is required.
7367 * object.h (Symbol_value::is_output_symtab_index_set): New
7369 (Symbol_value::may_be_discarded_from_output_symtab): New
7371 (Symbol_value::has_output_symtab_entry): New function.
7372 (Symbol_value::needs_output_symtab_entry): Remove.
7373 (Symbol_value::output_symtab_index): Make sure the symbol index is
7375 (Symbol_value::set_output_symtab_index): Make sure the symbol
7376 index is not set. Make sure the new index is valid.
7377 (Symbol_value::set_must_have_output_symtab_entry): New function.
7378 (Symbol_value::has_output_dynsym_entry): New function.
7379 (Symbol_value::set_output_dynsym_index): Make sure the new index
7381 (Sized_relobj::set_must_have_output_symtab_entry): New function.
7382 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7383 local symbol if permitted.
7384 (Sized_relobj::do_finalize_local_symbols): Call
7385 is_output_symtab_index_set rather than needs_output_symtab_entry.
7386 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7387 rather than needs_output_symtab_entry. Call
7388 has_output_dynsym_entry rather than needs_output_dynsym_entry.
7389 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7390 is_output_symtab_index_set rather than needs_output_symtab_entry.
7391 * testsuite/discard_locals_relocatable_test.c: New file.
7392 * testsuite/discard_locals_test.sh: Test -r.
7393 * testsuite/Makefile.am (check_DATA): Add
7394 discard_locals_relocatable_test1.syms,
7395 discard_local_relocatable_test2.syms.
7396 (MOSTLYCLEANFILES): Likewise. Also add
7397 discard_locals_relocatable_test1.lout and
7398 discard_locals_relocatable_test2.out.
7399 (discard_locals_relocatable_test1.syms): New target.
7400 (discard_locals_relocatable_test.o): New target.
7401 (discard_locals_relocatable_test1.out): New target.
7402 (discard_locals_relocatable_test2.syms): New target.
7403 (discard_locals_relocatable_test2.out): New target.
7404 (various): Add missing ../ld-new dependencies.
7405 * testsuite/Makefile.in: Rebuild.
7407 2010-03-03 Nick Clifton <nickc@redhat.com>
7409 * po/fi.po: New Finnish translation.
7411 2010-03-01 Doug Kwan <dougkwan@google.com>
7413 * layout.cc (Layout::Layout): Force section types of .init_array*,
7414 .preinit_array* and .fini_array* sections.
7415 * output.cc (Output_section::Input_section_sort_entry::has_priority):
7416 Fix check of return value of std::string::find.().
7417 (Output_section::Input_section_sort_compare::operator()): Remove
7418 comment about .init_array.
7419 (Output_section::Input_section_sort_init_fini_compare::operator()):
7421 (Output_section::sort_attached_input_sections): Handle .init_array
7422 and .fini_array specially.
7423 * output.h (Output_section::Inut_section_sort_compare): Update
7425 (Output_section::Input_section_sort_init_fini_compare): New struct.
7427 2010-02-26 Doug Kwan <dougkwan@google.com>
7429 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7430 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7431 * testsuite/debug_msg.sh: Avoid matching source line number for
7432 use of global variable undef_int.
7434 2010-02-26 Doug Kwan <dougkwan@google.com>
7436 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7437 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7438 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7439 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7440 * options.cc (General_options::General_options): Initialize member
7442 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7443 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7444 and rm_no_fix_v4bx.stdout
7445 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7446 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7447 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7448 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7449 and arm_no_fix_v4bx.
7450 * Makefile.in: Regenerate.
7451 * testsuite/arm_fix_v4bx.s: New file.
7452 * testsuite/arm_fix_v4bx.sh: Ditto.
7454 2010-02-24 Doug Kwan <dougkwan@google.com>
7456 * arm.cc (Target_arm::got_section): Make the .got section the first
7457 non RELRO section in the data segment.
7458 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7459 suffixes of section names.
7461 2010-02-24 Doug Kwan <dougkwan@google.com>
7463 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7464 flags and attributes merging if an input file is a binary file.
7465 * fileread.cc (Input_file::open): Record format of original file.
7466 * fileread.h (Input_file::Format): New enum type.
7467 (Input_file::Input_file): Initialize data member format_.
7468 (Input_file::format): New method definition.
7469 (Input_file::format_):: New data member.
7471 2010-02-24 Doug Kwan <dougkwan@google.com>
7473 * arm.cc (Arm_output_data_got): New class.
7474 (ARM_TCB_SIZE): New constant
7475 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7476 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7477 If user uses a script with a SECTIONS clause, issue only a warning
7478 for a misplaced EXIDX input section. Otherwise, issue an error.
7479 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7481 (Target_arm::got_mode_index_entry): Handle static linking.
7482 (Target_arm::Scan::local): Ditto.
7483 (Target_arm::Scan::global): Ditto.
7484 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
7485 all incorrectly implemented relocations.
7486 (Target_arm::fix_exidx_coverage): Pass layout to
7487 Arm_output_section::fix_exidx_coverage.
7488 * layout.cc (Layout::section_name_mapping): Remove trailing dots
7489 from ".ARM.exidx." and ".ARM.extab.".
7491 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7493 * arm.cc (Target_arm::do_finalize_sections): Create attribute
7494 section if it does not already exist.
7495 * attributes.cc (Attributes_section_data::Attributes_section_data):
7496 Don't crash if size is zero.
7498 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7499 Ian Lance Taylor <iant@google.com>
7501 * gold.cc (queue_middle_tasks): If no input files were opened,
7503 * workqueue.h (Task_function::Task_function): Assert that there is
7506 2010-02-22 Doug Kwan <dougkwan@google.com>
7508 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7509 * icf.cc (get_section_contents): Cast snprintf arguments to long long
7510 types to avoid warnings due to different uint64_t implementations
7513 2010-02-21 Doug Kwan <dougkwan@google.com>
7515 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7516 handling of the maximum backward branch offset.
7517 (Arm_relocate_functions::thumb_branch_common): Ditto.
7518 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7519 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7520 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7521 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7522 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7523 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7524 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7525 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7526 thumb_bl_out_of_range thumb_bl_out_of_range.o,
7527 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7528 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7529 thumb2_bl_out_of_range.o): New rules.
7530 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7531 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7532 thumb2_bl_out_of_range
7533 * testsuite/Makefile.in: Regenerate.
7534 * testsuite/arm_bl_in_range.s: New file.
7535 * testsuite/arm_bl_out_of_range.s: Ditto.
7536 * testsuite/arm_branch_in_range.sh: Ditto.
7537 * testsuite/arm_branch_range.t: Ditto.
7538 * testsuite/thumb2_branch_range.t: Ditto.
7539 * testsuite/thumb_bl_in_range.s: Ditto.
7540 * testsuite/thumb_bl_out_of_range.s: Ditto.
7541 * testsuite/thumb_branch_range.t: Ditto.
7543 2010-02-20 Sriraman Tallam <tmsriram@google.com>
7545 * gc.h (gc_process_relocs): Change vectors to point to the new list.
7546 Add reloc offset information.
7547 * icf.cc (get_section_contents): Change iterators to point to the new
7548 vectors. Add reloc offset information to the contents.
7549 * icf.h (Icf::Sections_reachable_info): New typedef.
7550 (Icf::Sections_reachable_list): New typedef.
7551 (Icf::Offset_info): New typedef.
7552 (Icf::Reloc_info): New struct typedef.
7553 (Icf::Reloc_info_list): New typedef.
7554 (Icf::symbol_reloc_list): Delete method.
7555 (Icf::addend_reloc_list): Delete method.
7556 (Icf::section_reloc_list): Delete method.
7557 (Icf::reloc_info_list): New method.
7558 (Icf::reloc_info_list_): New member.
7560 2010-02-19 Doug Kwan <dougkwan@google.com>
7562 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7563 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7564 * arm.cc (Arm_relocation_functions): New forward declaration.
7565 (Target_arm::Target_arm): Initialize new data members
7566 got_mod_index_offset_ and tls_base_symbol_defined_.
7567 (Target_arm::Relocate::relocate_tls): New method.
7568 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7569 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7571 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7572 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7573 (Target_arm::got_mod_index_offset_,
7574 Target_arm::tls_base_symbol_defined_): New data members.
7575 (Target_arm::Scan::local, Target::Scan::global,
7576 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7579 2010-02-18 Doug Kwan <dougkwan@google.com>
7581 * arm.cc (Arm_relobj::find_linked_text_section): New method.
7582 (Arm_relobj::make_exidx_input_section): Pass section index of linked
7583 text section as a parameter becuase some broken tools may not set
7584 the link in section header.
7585 (Target_arm::has_got_section): New method.
7586 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7587 without any mapping symbol as data only. Remove warning.
7588 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7589 link in its section header, try to discover the link by inspecting the
7590 REL31 relocation at the beginning of the section.
7591 (Target_arm::Scan::check_non_pic): Report name of offending relocation
7593 (Target_arm::Scan::global): Treat any reference to the symbol
7594 _GLOBAL_OFFSET_TABLE_ as a GOT access.
7596 2010-02-12 Sriraman Tallam <tmsriram@google.com>
7598 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7599 (Scan::global_reloc_may_be_function_pointer): New function.
7600 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7601 (Scan::global_reloc_may_be_function_pointer): New function.
7602 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7603 (Scan::global_reloc_may_be_function_pointer): New function.
7604 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7605 (Scan::global_reloc_may_be_function_pointer): New function.
7606 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7607 (Scan::global_reloc_may_be_function_pointer): New function.
7608 (Scan::possible_function_pointer_reloc): New function.
7609 (Target_x86_64::can_check_for_function_pointers): New function.
7610 * gc.h (gc_process_relocs): Scan relocation types to determine if
7611 function pointers were taken for targets that support it.
7612 * icf.cc (Icf::find_identical_sections): Include functions for
7613 folding in safe ICF whose pointer is not taken.
7614 * icf.h (Secn_fptr_taken_set): New typedef.
7615 (fptr_section_id_): New member.
7616 (section_has_function_pointers): New function.
7617 (set_section_has_function_pointers): New function.
7618 (check_section_for_function_pointers): New function.
7619 * options.h: Fix comment for safe ICF option.
7620 * target.h (can_check_for_function_pointers): New function.
7621 * testsuite/Makefile.am: Add icf_safe_so_test test case.
7622 Modify icf_safe_test for X86-64.
7623 * testsuite/Makefile.in: Regenerate.
7624 * testsuite/icf_safe_so_test.cc: New file.
7625 * testsuite/icf_safe_so_test.sh: New file.
7626 * testsuite/icf_safe_test.cc (kept_func_3): New function.
7627 (main): Change to take pointer to function kept_func_3.
7628 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7629 folding is done correctly for X86-64.
7631 2010-02-12 David S. Miller <davem@davemloft.net>
7633 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7634 is_symbolless parameter.
7635 (Output_reloc<SHT_REL>::is_symbolless): New.
7636 (Output_reloc<SHT_REL>::is_symbolless_): New.
7637 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7638 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7639 (Output_reloc<SHT_RELA>::is_symbolless): New.
7640 (Output_data_reloc::add_global): Handle is_symbolless.
7641 (Output_data_reloc::add_global_relative): Likewise.
7642 (Output_data_reloc::add_local): Likewise.
7643 (Output_data_reloc::add_local_relative): Likewise.
7644 (Output_data_reloc::add_symbolless_global_addend): New.
7645 (Output_data_reloc::add_symbolless_local_addend): New.
7646 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7648 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7649 instead of ->is_relative_
7650 (Output_reloc::write): Likewise.
7651 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7652 (Output_reloc::write_rel): Simplify.
7654 * sparc.cc (Target_sparc::Scan::local): Use
7655 ->add_symbolless_local_addend as needed.
7656 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7657 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
7658 based upon relocation offset.
7660 2010-02-11 Doug Kwan <dougkwan@google.com>
7662 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7663 (Target_arm::Scan::global): Ditto. Also remove a comment before the
7664 beginning of function.
7665 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7666 and MOVT_ABS relocations. Those are non issued in scanning. Fix
7667 parameter is_32bit in calls to should_apply_static_reloc.
7668 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7669 (check_DATA): Add arm_abs_global.stdout.
7670 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7671 arm_abs_global.stdout): New rules.
7672 (MOSTLLYCLEANFILES): Add arm_abs_global
7673 * Makefile.in: Regenerate.
7674 * testsuite/arm_abs_global.s: New file.
7675 * testsuite/arm_abs_global.sh: Ditto.
7676 * testsuite/arm_abs_lib.s: Ditto.
7678 2010-02-11 Ian Lance Taylor <iant@google.com>
7680 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7682 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
7683 Allocate_commons_task first.
7684 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7685 task, rather than symtab_lock_.
7686 (Gc_process_relocs::~Gc_process_relocs): New function.
7687 (Gc_process_relocs::is_runnable): Check this_blocker_.
7688 (Gc_process_relocs::locks): Use next_blocker_ rather than
7690 (Scan_relocs::~Scan_relocs): New function.
7691 (Scan_relocs::is_runnable): Check this_blocker_ rather than
7693 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
7695 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7696 fields. Add this_blocker_ and next_blocker_ fields. Adjust
7697 constructor accordingly.
7698 (class Gc_process_relocs): Likewise.
7699 (class Scan_relocs): Likewise.
7700 * common.h (class Allocate_commons_task): Remove symtab_lock_
7701 field, and corresponding constructor parameter.
7702 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7704 (Allocate_commons_task::locks): Likewise.
7706 2010-02-11 Ian Lance Taylor <iant@google.com>
7708 * gold-threads.h (class Once): Define.
7709 (class Initialize_lock): Rewrite as child of Once.
7710 * gold-threads.cc (class Once_initialize): Define.
7711 (once_pointer_control): New static variable.
7712 (once_pointer, once_arg): New static variables.
7713 (c_run_once): New static function.
7714 (Once::Once, Once::run_once, Once::internal_run): New functions.
7715 (class Initialize_lock_once): Remove.
7716 (initialize_lock_control): Remove.
7717 (initialize_lock_pointer): Remove.
7718 (initialize_lock_once): Remove.
7719 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7720 (Initialize_lock::initialize): Rewrite.
7721 (Initialize_lock::do_run_once): New function.
7722 * archive.cc (Archive::interpret_header): Only clear name if it is
7724 * fileread.cc: Include "gold-threads.h"
7725 (file_counts_lock): New static variable.
7726 (file_counts_initialize_lock): Likewise.
7727 (File_read::release): Only increment counts when using --stats.
7728 Use a lock around the increment.
7729 * parameters.cc (class Set_parameters_target_once): Define.
7730 (set_parameters_target_once): New static variable.
7731 (Parameters::Parameters): Move here from parameters.h.
7732 (Parameters::set_target): Rewrite.
7733 (Parameters::set_target_once): New function.
7734 (Parameters::clear_target): Move here and rewrite.
7735 * parameters.h (class Parameters): Update declarations. Add
7736 set_parameters_target_once_ field.
7737 (Parameters::Parameters): Move to parameters.cc.
7738 (Parameters::clear_target): Likewise.
7739 * readsyms.cc (Read_symbols::do_group): Create a Start_group
7741 (Start_group::~Start_group): New function.
7742 (Start_group::is_runnable): New function.
7743 (Start_group::locks, Start_group::run): New functions.
7744 (Finish_group::run): Change saw_undefined to size_t.
7745 * readsyms.h (class Start_group): Define.
7746 (class Finish_group): Change saw_undefined_ field to size_t.
7747 (Finish_group::Finish_group): Remove saw_undefined and
7748 this_blocker parameters. Change all callers.
7749 (Finish_group::set_saw_undefined): New function.
7750 (Finish_group::set_blocker): New function.
7751 * symtab.h (class Symbol_table): Change saw_undefined to return
7752 size_t. Change saw_undefined_ field to size_t.
7753 * target-select.cc (Set_target_once::do_run_once): New function.
7754 (Target_selector::Target_selector): Initialize set_target_once_
7755 field. Don't initialize lock_ and initialize_lock_ fields.
7756 (Target_selector::instantiate_target): Rewrite.
7757 (Target_selector::set_target): New function.
7758 * target-select.h (class Set_target_once): Define.
7759 (class Target_selector): Update declarations. Make
7760 Set_target_once a friend. Remove lock_ and initialize_lock_
7761 fields. Add set_target_once_ field.
7763 2010-02-10 Ian Lance Taylor <iant@google.com>
7765 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7767 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
7768 (queue_middle_tasks): Add all blockers before queueing any tasks.
7769 (queue_final_tasks): Likewise.
7770 * token.h (Task_token::add_blockers): New function.
7771 * object.h (Input_objects::number_of_relobjs): New function.
7773 2010-02-10 Ian Lance Taylor <iant@google.com>
7775 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7776 shared, not if not position independent.
7777 * x86_64.cc (Relocate::relocate_tls): Likewise.
7778 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7779 (tls_pie_pic_test): New target.
7780 * testsuite/Makefile.in: Rebuild.
7782 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7783 (tls_test_main_pie.o, tls_test_pie.o): New targets.
7784 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7785 * testsuite/Makefile.in: Rebuild.
7787 2010-02-09 David S. Miller <davem@davemloft.net>
7789 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7790 R_SPARC_RELATIVE using ->add_local_relative().
7791 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7793 * output.h (Output_data_dynamic::add_section_size): New method
7794 that takes two Output_data objects.
7795 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7796 entry param. Handle it in initializers.
7797 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7798 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7799 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7801 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7802 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7803 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7804 for dynrel_includes_plt.
7805 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7806 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7807 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7809 (Target_sparc::do_finalize_sections): Update to pass true for
7810 dynrel_includes_plt.
7811 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7812 output before .rela.plt
7813 (Target_powerpc::do_finalize_sections): Update to pass true for
7814 dynrel_includes_plt when 32-bit.
7816 2010-02-08 Doug Kwan <dougkwan@google.com>
7818 * arm.cc (Arm_relobj::simple_input_section_output_address): New
7820 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7821 Arm_relobj::scan_section_for_cortex_a8_stubs,
7822 Arm_relobj::do_relocation_section): Instead of calling
7823 Output_section::output_address, use faster
7824 Arm_relobj::simple_input_section_output_address.
7826 2010-02-08 David S. Miller <davem@davemloft.net>
7828 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7829 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7830 relocation helper function.
7832 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7833 just like R_SPARC_GOT{10,13,22}.
7834 (Target_sparc::Scan::local): Likewise.
7835 (Target_sparc::Relocate:relocate): Likewise.
7837 2010-02-06 Ian Lance Taylor <iant@google.com>
7839 * configure.ac: Rewrite targetobjs duplicate removal code to use
7840 only shell constructs.
7841 * configure: Rebuild.
7843 2010-02-05 Doug Kwan <dougkwan@google.com>
7846 * arm.cc (Arm_relobj::section_is_scannable): New method.
7847 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7848 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7850 2010-02-04 Doug Kwan <dougkwan@google.com>
7853 * arm-reloc-property.cc (cstdio): Include.
7854 * configure.ac (targetobjs): Remove duplicates.
7855 * configure: Regenerate.
7856 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7857 big and little endian version for a given address size.
7859 2010-02-03 Doug Kwan <dougkwan@google.com>
7861 * arm-reloc-property.cc
7862 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7864 * arm-reloc-property.h
7865 (Arm_reloc_property_table::get_implemented_static_reloc_property):
7866 New method definition.
7867 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7869 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7871 (GOT_PREL): Change implemented to Y.
7872 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7873 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7874 (Arm_relocate_functions::movw_abs_nc): Remove method.
7875 (Arm_relocate_functions::movt_abs): Ditto.
7876 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7877 (Arm_relocate_functions::thm_movt_abs): Ditto.
7878 (Arm_relocate_functions::movw_rel_nc): Ditto.
7879 (Arm_relocate_functions::movw_rel): Ditto.
7880 (Arm_relocate_functions::movt_rel): Ditto.
7881 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7882 (Arm_relocate_functions:thm_movw_rel): Ditto.
7883 (Arm_relocate_functions:thm_movt_rel): Ditto.
7884 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7885 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7886 New method definitions.
7887 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7888 (Arm_relocation_functions::arm_grp_ldr): Ditto.
7889 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7890 (Arm_relocation_functions::arm_grp_ldc): Ditto.
7891 (Target_arm::Relocate::relocate): Check for non-static or
7892 unimplemented relocation code and exit early. Change calls to
7893 Target_arm::reloc_uses_thumb_bit and
7894 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7895 instead. Refactor code to handle similar relocations to increase
7896 code sharing. Remove check for unsupported relocation code in switch
7898 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7899 relocation property table to find out size. Change error message to
7900 print out the name of a relocation code instead of the numeric value.
7901 (Target_arm::scan_reloc_for_stub): Use relocation property table
7902 instead of calling Target_arm::reloc_uses_thumb_bit().
7904 2010-02-02 Doug Kwan <dougkwan@google.com>
7906 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7907 types of relaxed input section.
7909 2010-02-02 Doug Kwan <dougkwan@google.com>
7911 * Makefile.am (HFILES): Add arm-reloc-property.h.
7913 (TARGETSOURCES): Add arm-reloc-property.cc
7914 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7915 (libgold_a_SOURCES): $(DEFFILES)
7916 * Makefile.in: Regenerate.
7917 * arm-reloc-property.cc: New file.
7918 * arm-reloc-property.h: New file.
7919 * arm-reloc.def: New file.
7920 * arm.cc: Update comments.
7921 (arm-reloc-property.h): New included header.
7922 (arm_reloc_property_table): New global variable.
7923 (Target_arm::do_select_as_default_target): New method definition.
7924 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7925 arm-reloc-property to targ_extra_obj.
7926 * parameters.cc (set_parameters_target): Call
7927 Target::select_as_default_target().
7928 * target.h (Target::select_as_default_target): New method definition.
7929 (Target::do_select_as_default_target): Same.
7931 2010-02-01 Doug Kwan <dougkwan@google.com>
7933 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7934 first_output_text_section_.
7935 (Arm_exidx_fixup::first_output_text_section): New method definition.
7936 (Arm_exidx_fixup::first_output_text_section_): New data member.
7937 (Arm_exidx_fixup::process_exidx_section): Record the first text
7938 output section seen.
7939 (Arm_output_section::fix_exidx_coverage): Set correct linked section
7940 and entsize in output section header.
7942 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7944 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7945 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7946 (Arm_relocate_functions::thm_alu11): New Method.
7947 (Arm_relocate_functions::thm_pc8): New Method.
7948 (Arm_relocate_functions::thm_pc12): New Method.
7949 (Target_arm::Scan::local): Handle the relocations.
7950 (Target_arm::Scan::global): Likewise.
7951 (Target_arm::Relocate::relocate): Likewise.
7952 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7954 2010-01-29 Doug Kwan <dougkwan@google.com>
7956 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7957 of relocation types as ld.
7959 2010-01-29 Doug Kwan <dougkwan@google.com>
7961 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7963 (Arm_relocate_functions::thumb_branch_common): Ditto.
7964 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7965 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7966 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7967 Arm_relocate_functions::jump24): Remove.
7968 (Target_arm::Relocate::relocate): Adjust code to call
7969 Arm_relocation_functions::arm_branch_common and
7970 Arm_relocation_functions::thumb_branch_common instead of their removed
7971 wrappers. Merge switch-cases together to reduce source code size.
7973 2010-01-29 Doug Kwan <dougkwan@google.com>
7975 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7976 output_local_symbol_count_needs_update_.
7977 (Arm_relobj::output_local_symbol_count_needs_update,
7978 Arm_relobj::set_output_local_symbol_count_needs_update,
7979 Arm_relobj::update_output_local_symbol_count): New methods.
7980 (Arm_relobj::output_local_symbol_count_needs_update_): New data
7982 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7983 of pointed function as in a R_ARM_PREL31 relocation.
7984 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7985 for output local symbol count updating.
7986 (Target_arm::do_relax): Update output local symbol counts in objects
7988 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7990 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7992 * arm.cc: Added support for the ARM relocations:
7993 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7994 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7995 (Arm_relocate_functions::movw_rel_nc): Renamed (was
7997 (Arm_relocate_functions::movw_rel): New method.
7998 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7999 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8001 (Arm_relocate_functions::thm_movw_rel): New method.
8002 (Arm_relocate_functions::thm_movt_rel): Renamed (was
8004 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8006 (Target_arm::Scan::global): Likewise.
8007 (Target_arm::Relocate::relocate): Likewise.
8008 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8011 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8013 * arm.cc: Added support for ARM group relocations.
8014 (Target_arm::reloc_needs_sym_origin): New method.
8015 (Arm_relocate_functions::calc_grp_kn): New method.
8016 (Arm_relocate_functions::calc_grp_residual): New method.
8017 (Arm_relocate_functions::calc_grp_gn): New method.
8018 (Arm_relocate_functions::arm_grp_alu): New Method.
8019 (Arm_relocate_functions::arm_grp_ldr): New Method.
8020 (Arm_relocate_functions::arm_grp_ldrs): New Method.
8021 (Arm_relocate_functions::arm_grp_ldc): New Method.
8022 (Target_arm::Scan::local): Handle the ARM group relocations.
8023 (Target_arm::Scan::global): Likewise.
8024 (Target_arm::Relocate::relocate): Likewise.
8025 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8028 2010-01-26 Doug Kwan <dougkwan@google.com>
8030 * arm.cc (set): Include.
8031 (class Arm_exidx_fixup): Change type of last_input_section_ to const
8033 (Arm_output_section::Text_section_list): New type.
8034 (Arm_output_section::append_text_sections_to_list): New method.
8035 (Arm_output_section::fix_exidx_coverage): Ditto.
8036 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8037 (Arm_relobj::convert_input_section_to_relaxed_section): Use
8038 Relobj::set_section_offset() instead of
8039 Sized_relobj::invalidate_section_offset().
8040 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8041 parameter for section headers. Ignore relocation sections for
8042 unallocated sections and EXIDX sections.
8043 (Target_arm::fix_exidx_coverage): New method.
8044 (Target_arm::output_section_address_less_than): New type.
8045 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8046 linked text section instead of the EXIDX section.
8047 (Arm_output_section::create_stub_group): Add an assertion to check
8048 that this is not an EXIDX output section.
8049 (Arm_output_section::append_text_sections_to_list): New method.
8050 (Arm_output_section::fix_exidx_coverage): Ditto.
8051 (Arm_relobj::scan_sections_for_stubs): Adjust call to
8052 Arm_relobj::section_needs_reloc_stub_scanning.
8053 (Target_arm::do_relax): Fix EXIDX output section coverage in the
8055 (Target_arm::fix_exidx_coverage): New method.
8056 * object.h (Relobj::set_output_section): New method.
8057 (Sized_relobj::invalidate_section_offset): Remove method.
8058 (Sized_relobj::do_invalidate_section_offset): Remove method.
8059 (Sized_relobj::do_set_section_offset): Handle offset value -1.
8061 2010-01-25 Doug Kwan <dougkwan@google.com>
8063 * arm.cc (Arm_exidx_merged_section::do_output_offset):
8064 Fix warning due to signed and unsigned comparison on a 32-bit host.
8066 2010-01-22 Doug Kwan <dougkwan@google.com>
8068 * arm.cc (Target_arm::do_relax): Record an output section for section
8069 offset adjustment it contains any stub table that has changed.
8070 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8071 offsets in an output section if necessary.
8072 * output.cc (Output_section::Output_section): Initialize
8073 section_offsets_need_adjustments_.
8074 (Output_section::add_input_section_for_script): Renamed to
8075 Output_section::add_simple_input_section.
8076 (Output_section::save_states): Add a comment.
8077 (Output_section::discard_states): New method defintion.
8078 (Output_section::adjust_section_offsets): Same.
8079 * output.h (Output_section::add_input_section_for_script): Renamed to
8080 Output_section::add_simple_input_section.
8081 (Output_section::discard_states): New method declaration.
8082 (Output_section::adjust_section_offsets): Same.
8083 (Output_section::section_offsets_need_adjustment,
8084 Output_section::set_section_offsets_need_adjustment): New method
8086 (Output_section::section_offsets_need_adjustment_): New data member.
8087 * script-sections.cc
8088 (Output_section_element_input::set_section_address): Adjust code for
8089 renaming of Output_section::add_input_section_for_script.
8090 (Orphan_output_section::set_section_address): Same.
8092 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8094 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8095 Fix_v4bx enum values .
8096 * gold/options.h (General_options): New option definitions.
8097 (General_options::fix_v4bx): New method.
8098 (General_options::Fix_v4bx): New enum.
8099 * gold/options.cc (General_options::parse_fix_v4bx): New method.
8100 (General_options::parse_fix_v4bx_interworking): New method.
8102 2010-01-22 Doug Kwan <dougkwan@google.com>
8104 * arm.cc (Arm_exidx_fixup): New class.
8106 2010-01-21 Doug Kwan <dougkwan@google.com>
8108 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8110 (Arm_exidx_section_offset_map): New type.
8112 2010-01-21 Doug Kwan <dougkwan@google.com>
8114 * arm.cc (Arm_exidx_input_section): New class.
8115 (Arm_relobj::exidx_input_section_by_link,
8116 Arm_relobj::exidx_input_section_by_shndx,
8117 Arm_relobj::make_exidx_input_section): New methods.
8118 (read_arm_attributes_section): Remove.
8119 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8120 information about them.
8121 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8124 2010-01-20 Doug Kwan <dougkwan@google.com>
8126 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8127 Input_section_specifier to Section_id.
8128 (Target_arm::new_arm_input_section: Adjust code for change of key
8130 (Target_arm::find_arm_input_section): Ditto.
8131 * gc.h (object.h): Include for Section_id nand Section_id_hash.
8132 (Section_id): Remove.
8133 (Garbage_collection::Section_id_hash): Remove.
8134 * icf.h (object.h): Include for Section_id nand Section_id_hash.
8135 (Section_id): Remove.
8136 (Icf::Section_id_hash): Remove.
8137 * object.h (Section_id, Const_section_id, Section_id_hash,
8138 Const_section_id_hash): New type definitions.
8139 * output.cc (Output_section::add_relaxed_input_section): Change to
8140 use Const_section_id instead of Input_section_specifier as key type.
8141 (Output_section::add_merge_input_section): Ditto.
8142 (Output_section::build_relaxation_map): Change to use Section_id
8143 instead of Input_section_specifier as key type.
8144 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8146 (Output_section::convert_input_sections_to_relaxed_sections): Change
8147 to use Const_section_id instead of Input_section_specifier as key type.
8148 (Output_section::find_merge_section): Ditto.
8149 (Output_section::find_relaxed_input_section): Ditto.
8150 * output.h (Input_section_specifier): Remove class.
8151 (Output_section::Output_section_data_by_input_section_map): Change
8152 key type to Const_section_id.
8153 (Output_section::Output_relaxed_input_section_by_input_section_map):
8155 (Output_section::Relaxation_map): Change key type to Section_id.
8157 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8159 * gold/arm.cc: Added support for R_ARM_V4BX relocation
8160 (class Arm_v4bx_stub): New class.
8161 (DEF_STUBS): Updated definition to support v4_veneer_bx.
8162 (Stub_factory::make_arm_v4bx_stub): New method.
8163 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8164 (Stub_table::empty): Handle v4bx stubs.
8165 (Stub_table::add_arm_v4bx_stub): New method.
8166 (Stub_table::find_arm_v4bx_stub): New method.
8167 (Arm_relocate_functions::v4bx): New method.
8168 (Target_arm::fix_v4bx): New method.
8169 (Target_arm::Target_arm): Handle R_ARM_V4BX.
8170 (Stub_table::relocate_stubs): Likewise.
8171 (Stub_table::do_write): Likewise.
8172 (Stub_table::update_data_size_and_addralign): Likewise.
8173 (Stub_table::finalize_stubs): Likewise.
8174 (Target_arm::Scan::local): Likewise.
8175 (Target_arm::Scan::global): Likewise.
8176 (Target_arm::do_finalize_sections): Likewise.
8177 (Target_arm::Relocate::relocate): Likewise.
8178 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8180 (Target_arm::scan_reloc_for_stub): Likewise.
8181 (Target_arm::scan_reloc_section_for_stubs): Likewise.
8183 2010-01-19 Ian Lance Taylor <iant@google.com>
8185 * output.cc (Output_section_headers::do_sized_write): Write large
8186 segment count to sh_info field.
8187 (Output_file_header::do_sized_write): For large segment count,
8188 write PN_XNUM to e_phnum field.
8190 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8192 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8193 (Arm_relocate_functions::thm_jump8): New function.
8194 (Arm_relocate_functions::thm_jump11): New function.
8195 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8197 (Target_arm::Scan::global): Likewise.
8198 (Target_arm::Relocate::relocate): Likewise.
8199 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8202 2010-01-14 Doug Kwan <dougkwan@google.com>
8204 * arm.cc (map, utility): Include headers.
8205 (Target_arm::apply_cortex_a8_workaround): New method.
8206 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8207 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8208 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8209 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8210 the --[no-]fix-cortex-a8 command line options.
8211 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8212 (Target_arm::relocate_stub): Use addend in instruction template.
8213 * options.h (DEFINE_bool): Set the user-set flag.
8214 (General_options): Add --[no-]-fix-cortex options.
8215 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8216 : Update fast look-up map after conversion.
8218 2010-01-14 Sriraman Tallam <tmsriram@google.com>
8220 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8221 in the first pass of do_layout.
8223 2010-01-13 Doug Kwan <dougkwan@google.com>
8225 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8226 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8227 apparent compiler problem of not folding static constant integral
8228 data members of elfcpp::Elf_sizes<32>.
8230 2010-01-13 Doug Kwan <dougkwan@google.com>
8232 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8233 Arm_relobj::section_needs_cortex_a8_stub_scanning,
8234 Arm_relobj::scan_section_for_cortex_a8_erratum,
8235 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8236 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8237 sections to scan for relocation stubs into a new method
8238 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
8239 relocation and Cortex-A8 stub scanning.
8240 (Target_arm::do_relax): Force stubs to be after stubbed sections
8241 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
8242 the beginning of a new relaxation pass. Update a comment.
8243 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8245 2010-01-12 Ian Lance Taylor <iant@google.com>
8247 * target-reloc.h (visibility_error): New inline function.
8248 (relocate_section): Call visibility_error.
8249 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8250 (MOSTLYCLEANFILES): Likewise.
8251 (protected_4_pic.o, protected_3.err): New targets.
8252 * testsuite/protected_4.cc: New file.
8254 2010-01-12 Doug Kwan <dougkwan@google.com>
8256 * arm.cc (Cortex_a8_reloc): New class.
8257 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8258 and cortex_a8_relocs_info_.
8259 (Target_arm::fix_cortex_a8): New method definition.
8260 (Target_arm::Cortex_a8_relocs_info): New type.
8261 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8262 New data member declarations.
8263 (Target_arm::scan_reloc_for_stub): Record information about
8264 relocations for THUMB branches that might be exempted from the
8265 Cortex-A8 workaround.
8266 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8267 at the beginning of a relaxation pass.
8269 2010-01-12 Doug Kwan <dougkwan@google.com>
8271 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8272 (Arm_relobj::Mapping_symbol_position,
8273 Arm_reloj::Mapping_symbol_position_less,
8274 Arm_relobj::Mapping_symbols_info): New types.
8275 (Target_arm::is_mapping_symbol_name): New method definition.
8276 (Arm_relobj::do_count_local_symbols): Save information about mapping
8279 2010-01-11 Doug Kwan <dougkwan@google.com>
8281 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8282 Arm_relocate_functions::thumb32_branch_upper,
8283 Arm_relocate_functions::thumb32_branch_lower,
8284 Arm_relocate_functions::thumb32_cond_branch_offset,
8285 Arm_relocate_functions::thumb32_cond_branch_upper,
8286 Arm_relocate_functions::thumb32_cond_branch_lower,
8287 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8288 branch offset encoding.
8289 (Arm_relocate_functions::thumb_branch_common): Use new branch
8290 offset encoding methods to avoid code duplication.
8291 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8292 (Stub_addend_reader::operator()): Use new branch encoding method
8293 to avoid code duplication.
8295 2010-01-11 Doug Kwan <dougkwan@google.com>
8297 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8298 (Target_arm::do_finalize_sections): Define special EXIDX section
8299 symbols only if referenced.
8300 * gc.h (Garbage_collection::add_reference): New method.
8301 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8304 2010-01-11 Ian Lance Taylor <iant@google.com>
8306 * script.cc (Version_script_info::build_expression_list_lookup):
8307 Change complaing about duplicate wildcard match from error to
8310 * script.cc (class Lazy_demangler): Recreate--revert part of patch
8312 (Version_script_info::Version_script_info): Initialize globs_,
8313 default_version_, default_is_global_, and exact_. Don't
8314 initialize globals_ or locals_.
8315 (Version_script_info::build_lookup_tables): Build local symbols
8317 (Version_script_info::unquote): New function.
8318 (Version_script_info::add_exact_match): New function.
8319 (Version_script_info::build_expression_list_lookup): Remove lookup
8320 parameter. Add is_global parameter. Change all callers. Handle
8321 wildcard pattern specially. Unquote pattern. Call
8323 (Version_script_info::get_name_to_match): New function.
8324 (Version_script_info::get_symbol_version): New function.
8325 (Version_script_info::get_symbol_version_helper): Remove.
8326 (Version_script_info::check_unmatched_names): Call unquote.
8327 * script.h (class Version_script_info): Change get_symbol_version
8328 to be non-inline and add is_global parameter; change all callers.
8329 Rewrite symbol_is_local. Update declarations. Define struct
8330 Version_tree_match, Exact, Globs. Don't define struct Lookup.
8331 Remove globals_ and locals_ members. Add exact_, globs_,
8332 default_version_, is_global_.
8333 (Version_script_info::Glob): Remove pattern, add expression and
8334 is_global. Update constructor. Change all callers.
8335 * dynobj.cc (Versions::finalize): Mark the version symbol as the
8337 (Versions::symbol_section_contents): If a symbol is undefined, or
8338 defined in a dynamic object, set the version index to
8340 * symtab.cc (Symbol_table::add_from_relobj): Don't call
8342 (Symbol_table::add_from_pluginobj): Likewise.
8343 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8345 2010-01-11 Doug Kwan <dougkwan@google.com>
8347 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8348 (incremental_dump_LDADD): Add linking option for libintl.
8349 * Makefile.in: Regenerate.
8351 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
8354 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8356 * testsuite/Makefile.in: Regenerated.
8358 2010-01-10 Doug Kwan <dougkwan@google.com>
8360 * options.h (DEFINE_var): Use parentheses around argument varname__
8361 in macro body to avoid any unintended subsequent substitutions.
8363 2010-01-10 Ian Lance Taylor <iant@google.com>
8365 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8366 candidates before doing symbol resolution.
8368 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8369 ODR candidates if only one is weak.
8371 2010-01-08 Ian Lance Taylor <iant@google.com>
8373 * script.cc (Version_script_info::build_expression_list_lookup):
8374 Don't warn about ambiguous version, just record the ambiguity.
8375 (Version_script_info::get_symbol_version_helper): Give error if
8376 version is ambiguous.
8378 2010-01-08 Doug Kwan <dougkwan@google.com>
8380 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8381 prev_data_size_ and prev_addralign_. Remove initializer for
8382 deleted data member has_been_changed_.
8383 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8384 to determine if the table is empty.
8385 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8387 (Stub_table::add_reloc_stub): Define method in class definition
8388 instead of just declaring it there.
8389 (Stub_table::add_cortex_a8_stub): New method definition.
8390 (Stub_table::update_data_size_and_addralign): Ditto.
8391 (Stub_table::finalize_stubs): Ditto.
8392 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8393 (Stub_table::do_addralign_): Return address alignment in the
8394 (Stub_table::do_reset_address_and_file_offset): Define method in
8395 class definition instead of declaring it there. Set current data
8396 size to be the data size of the previous pass.
8397 (Stub_table::set_final_data_size): Use current data size as the
8399 (Stub_table::relocate_stub): Change parameter type of stub from
8400 Reloc_stub pointer to Stub pointer.
8401 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8402 (Stub_table::Cortex_a8_stub_list): New typedef.
8403 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8404 Stub_table::prev_addralign_): New data member.
8405 (Arm_relobj::Arm_relobj): Initialize data member
8406 section_has_cortex_a8_workaround_.
8407 (Arm_relobj::section_has_cortex_a8_workaround,
8408 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8410 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8412 (Target_arm::relocate_stub): Change parameter type of stub from
8413 Reloc_stub pointer to Stub pointer.
8414 (Insn_template::size, Insn_template::alignment): Handle
8415 THUMB16_SPECIAL_TYPE.
8416 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8417 Stub_table::update_data_size_and_addralign,
8418 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8420 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8421 (Stub_table::do_write): Ditto.
8422 (Target_arm::do_relax): Adjust code for changes in Stub_table.
8424 2010-01-08 Ian Lance Taylor <iant@google.com>
8427 * symtab.h (class Symbol): Remove fields is_target_special_ and
8428 has_plt_offset_. Add field is_defined_in_discarded_section_.
8429 (Symbol::is_defined_in_discarded_section): New function.
8430 (Symbol::set_is_defined_in_discarded_section): New function.
8431 (Symbol::has_plt_offset): Rewrite.
8432 (Symbol::set_plt_offset): Verify that new offset is not -1U.
8433 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8434 Don't initialize is_target_special_ or has_plt_offset_.
8435 Initialize is_defined_in_discarded_section_.
8436 (Symbol_table::add_from_relobj): If appropriate, set
8437 is_defined_in_discarded_section.
8438 * resolve.cc (Symbol::override_base_with_special): Don't test
8439 is_target_special_. Change has_plt_offset_ to has_plt_offset().
8440 * target-reloc.h (relocate_section): Do special handling for
8441 symbols defined in discarded sections for global symbols as well
8444 2010-01-08 Ian Lance Taylor <iant@google.com>
8446 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8447 the SHT_SYMTAB case.
8449 2010-01-08 Ian Lance Taylor <iant@google.com>
8451 * object.cc (Sized_relobj::do_layout): Don't get confused if
8452 layout_eh_frame returns NULL.
8454 2010-01-08 Ian Lance Taylor <iant@google.com>
8457 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8458 dynamic symbol table, use the normal symbol table.
8459 (Sized_dynobj::do_read_symbols): Remove assertion about type of
8462 2010-01-08 Ian Lance Taylor <iant@google.com>
8465 * layout.cc (Layout::include_section): Remove .gnu_debuglink
8468 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
8470 * version.cc (print_version): Change to "Copyright 2010".
8472 2010-01-08 Ian Lance Taylor <iant@google.com>
8476 * i386.cc (class Target_i386): Change return type of plt_section
8478 (class Output_data_plt_i386): Add tls_desc_rel_ field.
8479 (Output_data_plt_i386::Output_data_plt_i386): Initialize
8480 tls_desc_rel_ field.
8481 (Output_data_plt_i386::rel_tls_desc): New function.
8482 (Target_i386::rel_tls_desc_section): New function.
8483 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8484 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8485 R_386_TLS_DESC reloc in rel_tls_desc_section.
8486 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8487 Define struct Tlsdesc_info.
8488 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8489 (Target_x86_64::do_reloc_symbol_index): New function.
8490 (Target_x86_64::add_tlsdesc_info): New function.
8491 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8492 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8494 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
8496 (Output_data_plt_x86_64::rela_tlsdesc): New function.
8497 (Target_x86_64::rela_tlsdesc_section): New function.
8498 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8500 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8501 (Target_x86_64::do_reloc_addend): New function.
8502 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8503 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8504 declarations. Define TARGET_CODE. Add arg field to u1_ union.
8505 (Output_reloc::type): New function.
8506 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8507 (Output_reloc::is_target_specific): New function.
8508 (Output_reloc::target_arg): New function.
8509 (class Output_reloc) [SHT_RELA]: Add four new constructors for
8510 absolute relocs and target specific relocs.
8511 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8512 add_target_specific.
8513 (class Output_data_reloc) [SHT_RELA]: Likewise.
8514 * output.cc (Output_reloc::Output_reloc): Add four new versions
8515 for absolute relocs and target specific relocs.
8516 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8517 (Output_reloc::get_symbol_index): Likewise.
8518 (Output_reloc::local_section_offset): Check that local_sym_index_
8519 is not TARGET_CODE or 0.
8520 (Output_reloc::symbol_value): Likewise.
8521 (Output_reloc::write) [SHT_RELA]: Call target for target specific
8523 * target.h (class Target): Add reloc_symbol_index and reloc_addend
8524 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
8526 * layout.cc (add_target_dynamic_tags): Use output section for
8527 DT_PLTRELSZ and DT_JMPREL.
8529 2010-01-07 Ian Lance Taylor <iant@google.com>
8532 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8534 (class Output_data_reloc_generic): Define.
8535 (class Output_data_reloc_base): Change base class to
8536 Output_data_reloc_generic. Change add() method to call
8537 bump_relative_reloc_count for a relative reloc. Remove
8539 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8541 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8542 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
8544 * layout.h (class Layout): Update declaration.
8546 2010-01-07 Ian Lance Taylor <iant@google.com>
8548 * output.h (class Output_data): Add const version of
8549 output_section and do_output_section.
8550 (class Output_section_data): Add const version of
8552 (class Output_section): Likewise.
8553 * layout.cc (Layout::add_target_dynamic_tags): New function.
8554 * layout.h (class Layout): Update declarations.
8555 * arm.cc (Target_arm::do_finalize_sections): Use
8556 add_target_dynamic_tags.
8557 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8558 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8559 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8560 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8562 2010-01-07 Ian Lance Taylor <iant@google.com>
8565 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8568 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
8569 Ian Lance Taylor <iant@google.com>
8572 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8573 Xindex::read_symtab_xindex.
8575 2010-01-07 Doug Kwan <dougkwan@google.com>
8577 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8578 (Insn_template::thumb16_bcond_insn): New method declaration.
8579 (Insn_template): Fix spelling.
8580 (Stub::thumb16_special): New method declaration.
8581 (Stub::do_write): Define virtual method which was previously pure
8583 (Stub::do_thumb16_special): New method declaration.
8584 (Stub::do_fixed_endian_write): New template member.
8585 (Reloc_stub::do_write): Remove.
8586 (Reloc_stub::do_fixed_endian_write): Remove.
8587 (Cortex_a8_stub): New class definition.
8588 (Stub_factory::make_cortex_a8_stub): New method definition.
8589 (Stub_factory::Stub_factory): Add missing static storage class
8590 qualifier for elf32_arm_stub_a8_veneer_blx.
8592 2010-01-07 Ian Lance Taylor <iant@google.com>
8595 * options.h (class General_options): Add --warn-unresolved-symbols
8596 and --error-unresolved-symbols.
8597 * errors.cc (Errors::undefined_symbol): Implement
8598 --warn-unresolved-symbols.
8600 * options.h (class General_options): Add -z text and -z textoff.
8601 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8603 2010-01-06 Sriraman Tallam <tmsriram@google.com>
8605 * gc.h (Garbage_collection::Cident_section_map): New typedef.
8606 (Garbage_collection::cident_sections): New function.
8607 (Garbage_collection::add_cident_section): New function.
8608 (Garbage_collection::cident_sections_): New member.
8609 (gc_process_relocs): Add references to sections whose names are C
8611 * gold.h (cident_section_start_prefix): New constant.
8612 (cident_section_stop_prefix): New constant.
8613 (is_cident): New function.
8614 * layout.cc (Layout::define_section_symbols): Replace string constants
8615 with the newly defined constants.
8616 * object.cc (Sized_relobj::do_layout): Track sections whose names are
8618 * testsuite/Makefile.am: Add gc_orphan_section_test.
8619 * testsuite/Makefile.in: Regenerate.
8620 * testsuite/gc_orphan_section_test.cc: New file.
8621 * testsuite/gc_orphan_section_test.sh: New file.
8623 2010-01-06 Ian Lance Taylor <iant@google.com>
8626 * options.h (class General_options): Add --warn-shared-textrel.
8627 * layout.cc (Layout::finish_dynamic_section): Implement
8628 --warn-shared-textrel.
8631 * options.h (class General_options): Add --warn-multiple-gp.
8633 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8635 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8636 $(THREADSLIB) and $(LIBDL).
8637 * Makefile.in: Rebuild.
8639 2010-01-06 Ian Lance Taylor <iant@google.com>
8642 * options.cc (General_options::parse_section_start): New function.
8643 (General_options::section_start): New function.
8644 (General_options::General_options): Initialize all members.
8645 * options.h: Include <map>
8646 (class General_options): Add --section-start. Add section_starts_
8648 * layout.cc (Layout::attach_allocated_section_to_segment): If
8649 --section-start was used, set the address of the segment. Remove
8650 local sort_sections.
8651 (Layout::relaxation_loop_body): If the address of the load segment
8652 has been set by --section-start, don't use it.
8653 * output.h (Output_segment::update_flags_for_output_section): New
8655 * output.cc (Output_segment::add_output_section): Call
8656 update_flags_for_output_section.
8658 2010-01-05 Ian Lance Taylor <iant@google.com>
8661 * options.h (class General_options): Add --undefined-version.
8662 * script.cc (struct Version_expression): Add was_matched_by_symbol
8664 (Version_script_info::matched_symbol): New function.
8665 (Version_script_info::get_symbol_version_helper): Call
8667 (Version_script_info::check_unmatched_names): New function.
8668 * script.h (class Version_script_info): Update declarations.
8669 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8671 * options.h (class General_options): Use DEFINE_bool_alias for
8672 allow_multiple_definition.
8673 * resolve.cc (Symbol_table::should_override): Don't test
8674 allow_multiple_definition.
8677 * options.h (class General_options): Add --cref.
8678 * main.cc (main): Print cref table if --cref. Don't close mapfile
8679 until after printing cref table.
8680 * cref.cc: Include "symtab.h".
8681 (class Cref_inputs): Define Cref_table_compare and Cref_table.
8682 (Cref_table_compare::operator()): New function.
8683 (Cref_inputs::gather_cref): New function.
8684 (filecol): New static const.
8685 (Cref_inputs::print_cref): New function.
8686 (Cref::print_cref): New function.
8687 * cref.h: Include <cstdio>.
8688 (class Cref): Update declarations.
8689 * mapfile.h (Mapfile::file): New function.
8690 * object.h (class Object): Define Symbols. Declare virtual
8691 do_get_global_symbols.
8692 (Object::get_global_symbols): New function.
8693 * object.cc (Input_objects::add_object): Pass object to cref_ if
8695 (Input_objects::archive_start): Likewise.
8696 (Input_objects::archive_stop): Likewise.
8697 (Input_objects::print_cref): New function.
8698 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8699 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8701 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8703 * plugin.h (class Sized_pluginobj): Update declarations.
8705 2010-01-05 Ian Lance Taylor <iant@google.com>
8707 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8708 to is_default_version. Rename insdef to insdefault.
8709 (Symbol_table::add_from_relobj): Rename def to is_default_version
8710 and local to is_forced_local.
8711 (Symbol_table::add_from_pluginobj): Likewise.
8712 (Symbol_table::add_from_dynobj): Likewise.
8713 (Symbol_table::define_special_symbol): Rename insdef to
8716 2010-01-04 Ian Lance Taylor <iant@google.com>
8719 * options.h (class General_options): Add
8720 --allow-multiple-definition and -z muldefs.
8721 * resolve.cc (Symbol_table::should_override): Don't warn about a
8722 multiple symbol definition if --allow-multiple-definition or -z
8726 * options.h (class General_options): Add --add-needed and
8727 --copy-dt-needed-entries. Tweak --as-needed help entry.
8728 * object.cc (Input_objects::check_dynamic_dependencies): Give an
8729 error if --copy-dt-needed-entries aka --add-needed is used and
8730 would cause a change in behaviour.
8733 * options.h (class General_options): Add -G as a short version of
8734 --shared. Add no-op options -assert, -g, and -i.
8736 2010-01-04 Sriraman Tallam <tmsriram@google.com>
8738 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8739 check for .text or .gnu.linkonce.t sections.
8740 * icf.cc (Icf::find_identical_sections): Ditto.
8741 Change the detection for mangled function name within the section
8743 * icf.h (is_section_foldable_candidate): New function.
8745 2009-12-30 Ian Lance Taylor <iant@google.com>
8748 * options.h (class General_options): Permit two dashes with
8749 --retain-symbols-file.
8751 2009-12-30 Ian Lance Taylor <iant@google.com>
8754 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8755 don't put the file header and segment headers in the text
8759 * common.cc (Sort_commons::operator()): Stabilize sort when both
8761 (Symbol_table::do_allocate_commons_list): When allocating common
8762 symbols, skip a symbol which is no longer common.
8763 * symtab.h (Symbol::is_common): Test whether the symbol comes from
8764 an object before checking its type.
8765 * testsuite/common_test_2.c: New file.
8766 * testsuite/common_test_3.c: New file.
8767 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8768 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8769 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8770 (common_test_2_pic.o, common_test_2.so): New targets.
8771 (common_test_3_pic.o, common_test_3.so): New targets.
8772 * testsuite/Makefile.in: Rebuild.
8775 * script.cc (read_input_script): If we see a new SECTIONS clause,
8776 and we have added an input section, give an error.
8777 * layout.h (class Layout): Add have_added_input_section function.
8778 Add have_added_input_section_ field.
8779 * layout.cc (Layout::Layout): Initialize
8780 have_added_input_section_.
8781 (Layout::layout): Set have_added_input_section_.
8782 (Layout::layout_eh_frame): Likewise.
8784 2009-12-30 Ian Lance Taylor <iant@google.com>
8787 * options.h (class General_options): Add --sort-common option.
8788 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8789 * common.cc (Sort_common): Add sort_order parameter to
8790 constructor. Add sort_order_ field.
8791 (Sort_commons::operator): Check sort_order_.
8792 (Symbol_table::allocate_commons): Determine the sort order.
8793 (Symbol_table::do_allocate_commons): Add sort_order parameter.
8795 (Symbol_table::do_allocate_commons_list): Likewise.
8797 2009-12-30 Ian Lance Taylor <iant@google.com>
8800 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8801 symbols from this object, don't change the visibility of an
8803 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8805 2009-12-30 Ian Lance Taylor <iant@google.com>
8808 * script.h (class Version_script_info): Define Language enum.
8809 Update declarations. Define Glob, Exact, and Lookup types. Add
8810 new fields globals_, locals_, and is_finalized_.
8811 * script.cc: Various formatting fixes.
8812 (class Parser_closure): Change language_stack_ from a vector of
8813 std::string to one of Version_script_info::Language. Adjust all
8815 (class Lazy_demangler): Remove.
8816 (struct Version_expression): Change language from std::string to
8817 Version_script_info::Language.
8818 (Version_script_info::Version_script_info): New function.
8819 (Version_script_info::~Version_script_info): Don't call clear.
8820 (Version_script_info::finalize): New function.
8821 (Version_script_info::build_lookup_tables): New function.
8822 (Version_script_info::build_expression_list_lookup): New
8824 (Version_script_info::get_symbol_version_helper): Rewrite to use
8826 (Version_script_info::print_expression_list): Adjust to use
8827 Version_script_info::Language.
8828 (script_push_lex_into_version_mode): Check that the version script
8829 has not been finalized.
8830 (version_script_push_lang): Change language string to
8831 Version_script_info::Language.
8832 * options.cc (Command_line::version_script): New function.
8833 * options.h (class General_options): Add finalize_dynamic_list
8834 function. Change version_script from declaration to definition.
8835 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8836 * testsuite/version_script.map: Remove duplicate def of foo.
8837 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8839 * testsuite/Makefile.in: Rebuild.
8841 2009-12-30 Ian Lance Taylor <iant@google.com>
8844 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8845 if the input symbol index is 0, make the output symbol index 0.
8847 2009-12-30 Ian Lance Taylor <iant@google.com>
8850 * options.h (class General_options): Add -x/--discard-all.
8851 * object.cc (Sized_relobj::do_count_local_symbols): Handle
8852 --discard-all. If the local symbol needs a dynamic entry, check
8853 that before handling --discard-locals.
8855 2009-12-30 Ian Lance Taylor <iant@google.com>
8858 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8860 (Output_segment::add_output_section): Don't change the flags if
8864 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8865 GNU hash table if they need a dynamic value. Otherwise, don't add
8866 them if they are defined in a dynamic object or are forced local.
8868 2009-12-29 Ian Lance Taylor <iant@google.com>
8871 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8872 .gnu.hash table for a 32-bit target.
8875 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8876 regular and a dynamic object only needs a dynamic symbol table
8877 entry if it is externally visible.
8880 * i386.cc (class Target_i386): Initialize global_offset_table_ in
8881 constructor. Add global_offset_table_ field.
8882 (Target_i386::got_section): Set global_offset_table_.
8883 (Target_i386::do_finalize_sections): Set global_offset_table_
8885 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8886 in constructor. Add global_offset_table_ field.
8887 (Target_x86_64::got_section): Set global_offset_table_.
8888 (Target_x86_64::do_finalize_sections): Set global_offset_table_
8891 * layout.cc (Layout::Layout): Initialize increase_relro_.
8892 (Layout::get_output_section): Add is_relro, is_last_relro, and
8893 is_first_non_relro parameters. Change all callers.
8894 (Layout::choose_output_section): Likewise.
8895 (Layout::add_output_section_data): Likewise.
8896 (Layout::make_output_section): Likewise.
8897 (Layout::set_segment_offsets): Clear increase_relro when using a
8899 * layout.h (class Layout): Add increase_relro method. Add
8900 increase_relro_ field. Update declarations.
8901 * output.cc (Output_section::Output_section): Initialize
8902 is_last_relro_ and is_first_non_relro_.
8903 (Output_segment::add_output_section): Group relro sections is
8904 do_sort is true. Handle is_last_relro and is_first_non_relro.
8905 (Output_segment::maximum_alignment): Remove relro handling.
8906 (Output_segment::set_section_addresses): Add increase_relro
8907 parameter. Change all callers. Add initial alignment to align
8908 relro sections on separate page. Remove old relro handling.
8909 (Output_segment::set_section_list_addresses): Remove in_relro
8910 parameter. Change all callers.
8911 (Output_segment::set_offset): Add increase parameter. Change all
8912 callers. Remove old relro handling.
8913 * output.h (class Output_section): Add new methods: is_last_relro,
8914 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8915 Add is_last_relro_ and is_first_non_relro_ fields.
8916 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8917 Create separate .got.plt section. Call increase_relro.
8918 * x86_64.cc (Target_x86_64::got_section): Likewise.
8919 * testsuite/relro_script_test.t: Add .got.plt.
8922 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8923 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8924 (Layout::finalize): Call set_dynamic_symbol_size.
8925 (Layout::set_dynamic_symbol_size): New function.
8926 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
8927 set_dynamic_symbol_size.
8930 * output.h (class Output_section): Add is_entsize_zero_ field.
8931 * output.cc (Output_section::Output_section): Initialize
8933 (Output_section::set_entsize): If two different entsizes are
8934 requested, force it to zero.
8935 (Output_section::add_input_section): Set flags for .debug_str
8936 before updating section flags. Set entsize.
8937 (Output_section::update_flags_for_input_section): Set SHF_MERGE
8938 and SHF_STRING if all input sections have those flags.
8940 2009-12-29 Rafael Espindola <espindola@google.com>
8942 * main.cc (main): Fix the sys time reporting.
8943 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8946 2009-12-29 Sriraman Tallam <tmsriram@google.com>
8948 * options.cc (General_options::parse_version): Allow -v to exit
8949 without an error if there is nothing to link.
8951 2009-12-29 Ian Lance Taylor <iant@google.com>
8953 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8954 using a version of gcc before 4.1.
8955 * configure: Rebuild.
8957 2009-12-28 Chris Demetriou <cgd@google.com>
8959 * attributes.cc (Output_attributes_section_data::do_write): Use
8960 std::vector::front rather than std::vector::data.
8962 2009-12-28 Ian Lance Taylor <iant@google.com>
8964 * symtab.h (class Symbol_table): Add enum Defined.
8965 * resolve.cc (Symbol_table::should_override): Add defined
8966 parameter. Change all callers. Test whether object is NULL
8967 before calling a method on it.
8968 (Symbol_table::report_resolve_problem): Add defined parameter.
8970 (Symbol_table::should_override_with_special): Likewise.
8971 * symtab.cc (Symbol_table::define_in_output_data): Add defined
8972 parameter. Change all callers.
8973 (Symbol_table::do_define_in_output_data): Likewise.
8974 (Symbol_table::define_in_output_segment): Likewise.
8975 (Symbol_table::do_define_in_output_segment): Likewise.
8976 (Symbol_table::define_as_constant): Likewise.
8977 (Symbol_table::do_define_as_constant): Likewise.
8978 * script.h (class Symbol_assignment): Add is_defsym parameter to
8979 constructor; change all callers.
8980 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8981 parameter. Change all callers. Add is_defsym_ field.
8982 (class Parser_closure): Add parsing_defsym parameter to
8983 constructor; change all callers. Add parsing_defsym accessor
8984 function. Add parsing_defsym_ field.
8986 2009-12-28 Ian Lance Taylor <iant@google.com>
8988 * gold.cc (queue_middle_tasks): Fix formatting.
8989 * object.cc (Relobj::is_section_name_included): Likewise.
8991 2009-12-23 Ian Lance Taylor <iant@google.com>
8993 * i386.cc (Target_i386::do_calls_non_split): Recognize
8994 -fsplit-stack prologue for a function with a static chain.
8995 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8996 -fsplit-stack prologue when using %r11.
8998 2009-12-21 Sriraman Tallam <tmsriram@google.com>
9000 * options.cc (General_options::parse_version): Make -v continue and do
9001 the link like GNU ld does.
9003 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
9005 * Makefile.am (CCFILES): Add timer.cc.
9006 (HFILES): Add timer.h.
9007 * configure.ac: Check for sysconf and times.
9008 * main.cc: include timer.h.
9009 (main): Use Timer instead of get_run_time.
9012 * workqueue.cc: include timer.h.
9013 (Workqueue::find_and_run_task):
9014 Report user, sys and wall time.
9015 * Makefile.in: Regenerate.
9016 * config.in: Regenerate.
9017 * configure: Regenerate.
9019 2009-12-16 Doug Kwan <dougkwan@google.com>
9021 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9023 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9024 relaxed input sections.
9025 * output.cc (Output_section::find_relaxed_input_section): Change
9026 return type to Output_relaxed_input_section pointer. Adjust code
9027 for new type of relaxed_input_section_map_.
9028 * output.h (Output_section::find_relaxed_input_section): Change
9029 return type to Output_relaxed_input_section pointer.
9030 (Output_section::Output_relaxed_input_section_by_input_section_map):
9032 (Output_section::relaxed_input_section_map_): Change type to
9033 Output_section::Output_relaxed_input_section_by_input_section_map.
9034 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9037 2009-12-15 Ian Lance Taylor <iant@google.com>
9039 * layout.cc (Layout::create_shstrtab): Only write out after input
9040 sections if we are compressing debug sections.
9042 2009-12-15 Ian Lance Taylor <iant@google.com>
9044 * archive.cc (Archive::add_symbols): Only look up a symbol without
9045 a version if there is, in fact, a version.
9047 2009-12-14 Ian Lance Taylor <iant@google.com>
9049 Revert -Wshadow changes, all changes from:
9050 2009-12-11 Doug Kwan <dougkwan@google.com>
9051 2009-12-11 Nick Clifton <nickc@redhat.com>
9052 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9054 2009-12-11 Doug Kwan <dougkwan@google.com>
9056 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9058 * attributes.cc (Object_attribute::size): Ditto.
9059 (Attributes_section_data::size): Ditto.
9060 (Attributes_section_data::Attributes_section_data): Ditto.
9061 (Output_attributes_section_data::do_write): Ditto.
9062 * attributes.h (Object_attribute::set_type): Ditto.
9063 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9065 2009-12-11 Nick Clifton <nickc@redhat.com>
9067 * archive.cc: Fix shadowed variable warnings.
9069 * compressed_output.cc: Likewise.
9070 * compressed_output.h: Likewise.
9071 * configure: Likewise.
9072 * dwarf_reader.cc: Likewise.
9073 * dynobj.cc: Likewise.
9074 * dynobj.h: Likewise.
9075 * ehframe.cc: Likewise.
9076 * ehframe.h: Likewise.
9077 * errors.cc: Likewise.
9078 * expression.cc: Likewise.
9079 * fileread.cc: Likewise.
9080 * fileread.h: Likewise.
9081 * freebsd.h: Likewise.
9082 * i386.cc: Likewise.
9084 * incremental.h: Likewise.
9085 * layout.cc: Likewise.
9086 * layout.h: Likewise.
9087 * mapfile.cc: Likewise.
9088 * merge.cc: Likewise.
9089 * merge.h: Likewise.
9090 * object.cc: Likewise.
9091 * object.h: Likewise.
9092 * options.h: Likewise.
9093 * output.cc: Likewise.
9094 * output.h: Likewise.
9095 * parameters.cc: Likewise.
9096 * plugin.cc: Likewise.
9097 * powerpc.cc: Likewise.
9098 * reduced_debug_output.cc: Likewise.
9099 * reduced_debug_output.h: Likewise.
9100 * reloc.cc: Likewise.
9101 * reloc.h: Likewise.
9102 * resolve.cc: Likewise.
9103 * script-sections.cc: Likewise.
9104 * script.cc: Likewise.
9105 * script.h: Likewise.
9106 * sparc.cc: Likewise.
9107 * symtab.cc: Likewise.
9108 * symtab.h: Likewise.
9109 * target-select.cc: Likewise.
9110 * target-select.h: Likewise.
9111 * token.h: Likewise.
9112 * workqueue.cc: Likewise.
9113 * workqueue.h: Likewise.
9114 * x86_64.cc: Likewise.
9116 2009-12-10 Doug Kwan <dougkwan@google.com>
9118 * arm.cc (attributes.h): New include.
9119 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9120 (Arm_relobj::~Arm_relobj): Delete object pointed by
9121 attributes_section_data_.
9122 (Arm_relobj::attributes_section_data): New method definition.
9123 (Arm_relobj::attributes_section_data_): New data member declaration.
9124 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9125 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9126 attributes_section_data_.
9127 (Arm_dynobj::attributes_section_data): New method definition.
9128 (Arm_dynobj::attributes_section_data_): New data member declaration.
9129 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
9130 initialization value of may_use_blx_ to false.
9131 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9132 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9133 object attributes to compute results instead of hard-coding.
9134 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9135 Target_arm::get_secondary_compatible_arch,
9136 Target_arm::set_secondary_compatible_arch
9137 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9138 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9139 New method declarations.
9140 (Target_arm::get_aeabi_object_attribute): New method definition.
9141 (Target_arm::attributes_section_data_): New data member declaration.
9142 (read_arm_attributes_section): New template definition.
9143 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9144 (Arm_dynobj::do_read_symbols): Ditto.
9145 (Target_arm::do_finalize_sections): Merge attributes sections from
9146 input. Check for BLX use after attributes section merging.
9147 Fix __exidx_start and __exidx_end visibility. Create an
9148 .ARM.attributes section if necessary.
9149 (Target_arm::get_secondary_compatible_arch,
9150 Target_arm::set_secondary_compatible_arch,
9151 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9152 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9153 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9154 New method definitions.
9156 2009-12-09 Ian Lance Taylor <iant@google.com>
9158 * plugin.cc (Plugin::load): Don't cast from void* to a function
9161 2009-12-09 Ian Lance Taylor <iant@google.com>
9163 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9166 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
9168 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9169 Replace two_file_shared_1.so with two_file_shared_2.so.
9170 * testsuite/Makefile.in: Regenerated.
9172 2009-12-08 Doug Kwan <dougkwan@google.com>
9174 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9175 (HFILES): Add attributes.h and int_encoding.h.
9176 * Makefile.in: Regenerate.
9177 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9178 function definitions to int_encoding.cc
9179 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9180 prototypes to int_encoding.h
9181 * reduced_debug_output.cc (int_encoding.h): New include.
9182 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9183 function definitions to int_encoding.cc
9184 (insert_into_vector, read_from_pointer): Move template definitions to
9186 * attributes.cc: New file.
9187 * attributes.h: New file.
9188 * int_encoding.cc: New file.
9189 * int_encoding.h: New file.
9191 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
9194 * incremental-dump.cc (dump_incremental_inputs): New.
9195 (main): Use dump_incremental_inputs.
9197 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
9200 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9201 checking elfcpp::STT_FUNC.
9202 (Target_i386::Relocate::relocate): Likewise.
9203 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9205 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9206 symbols from shared libraries into normal FUNC symbols.
9208 * symtab.h (Symbol): Add is_func and use it.
9210 2009-12-05 Doug Kwan <dougkwan@google.com>
9212 * arm.cc (Target_arm::arm_info): Initialize new fields
9213 attributes_section and attributes_vendor.
9214 * i386.cc (Target_i386::i386_info): Same.
9215 * object.cc (Sized_relobj::do_layout): Skip attribute section.
9216 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9217 fields attributes_section and attributes_vendor.
9218 * sparc.cc (Target_sparc::sparc_info): Same.
9219 * target.h (Target::attributes_section, Target::attributes_vendor,
9220 Target::is_attributes_section, Target::attribute_arg_type,
9221 Target::attributes_order): New method definitions.
9222 (Target::Target_info::attributes_section,
9223 Target::Target_info::attributes_vendor): New fields.
9224 (Target::do_attribute_arg_type, Target::do_attributes_order): New
9225 virtual method definitions.
9226 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9227 attributes_section and attributes_vendor.
9228 * testsuite/testfile.cc (Target_test::test_target_info): Same.
9230 2009-12-05 Doug Kwan <dougkwan@google.com>
9232 * arm.cc: Update comments about interworking and stub generation.
9233 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9234 considered as non-PIC.
9235 (Arm_relocate_functions::base_abs): Fix formatting.
9236 (Arm_relocate_functions::got_prel): Fix comment. Change interface
9237 of function to use GOT entry address instead of offset.
9238 (Target_arm::Scan::global): Issue an error if a symbol would need a
9239 PLT does not get one because it is untyped. Remove code to create
9240 dynamic symbols for relative branches.
9241 (Target_arm::Relocate::relocate: Use 0 instead of false since function
9242 takes unsigned integer instead of boolean.
9244 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
9246 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9247 (two_file_test_LDADD): Likewise.
9248 (common_test_1_LDADD): Likewise.
9249 (exception_test_LDADD) Likewise.
9250 (weak_test_LDADD): Likewise.
9251 (many_sections_test_LDADD): Likewise.
9252 (initpri1_LDADD): Likewise.
9253 (script_test_1_LDADD): Likewise.
9254 (script_test_2_LDADD): Likewise.
9255 (justsyms_LDADD): Likewise.
9256 (binary_test_LDADD): Likewise.
9257 (large_LDADD): Likewise.
9258 * testsuite/Makefile.in: Regenerated.
9260 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
9262 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9263 (Symbol_table::override_with_special): Likewise.
9264 (Symbol_table::add_from_object): Likewise.
9266 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9268 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9269 Don't set the data_offset twice.
9271 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9273 * testsuite/Makefile.in: Regenerate.
9275 2009-12-03 Doug Kwan <dougkwan@google.com>
9277 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9278 (Target_arm::do_finalize_sections): Add parameter for symbol table
9279 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
9280 * i386.cc (Target_i386::do_finalize_sections): Add an additional
9281 parameter for symbol table pointer.
9282 * layout.cc (Layout::finalize): Call Target::finalize_sections with
9283 an additional parameter for a pointer to symbol table.
9284 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9285 parameter for a symbol table pointer.
9286 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9287 * target.h (Target::finalize_sections, Target::do_finalize_sections):
9289 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9290 parameter for a symbol table pointer.
9292 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
9294 * incremental.cc (Incremental_inputs_header)
9295 (Incremental_inputs_header_write, Incremental_inputs_entry)
9296 (Incremental_inputs_entry_write): Move ...
9297 * incremental.h (Incremental_inputs_header)
9298 (Incremental_inputs_header_write, Incremental_inputs_entry)
9299 (Incremental_inputs_entry_write): here.
9301 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9303 * incremental.cc (make_sized_incremental_binary): Set the target.
9304 Error if it is incompatible.
9305 * output.h (Output_file): Add filename method.
9307 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9309 * incremental.cc (Incremental_inputs_entry): Remove unused argument
9310 from the get_* methods.
9312 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9314 * incremental-dump.cc (main): Check that the offeset of a script is 0.
9315 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9316 Write 0 for the data_offset of scripts.
9318 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9320 * testsuite/Makefile.am: Add the incremental_test.sh test.
9321 * testsuite/incremental_test.sh: New.
9322 * testsuite/incremental_test_1.c: New.
9323 * testsuite/incremental_test_2.c: New.
9325 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
9327 * incremental-dump.cc (main): Fix typos.
9329 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
9332 * incremental-dump.cc (main): Use llu to print 64 bit values.
9334 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
9335 H.J. Lu <hongjiu.lu@intel.com>
9337 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9339 (incremental_dump_LDADD): Likewise.
9340 * Makefile.in: Regenerated.
9342 2009-11-25 Doug Kwan <dougkwan@google.com>
9346 2009-11-25 Doug Kwan <dougkwan@google.com>
9348 * arm.cc (Target_arm::Target_arm): Move method definition
9349 outside of class definition. Add code to handle
9350 --target1-rel, --target1-abs and --target2= options.
9351 (Target_arm::get_reloc_reloc_type): Change method to be
9352 non-static and const.
9353 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9354 New data member declaration.
9355 (Target_arm::Scan::local, Target_arm::Scan::global,
9356 Target_arm::Relocate::relocate,
9357 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9358 Adjust call to Target_arm::get_real_reloc_type.
9359 (Target_arm::get_real_reloc_type): Use command line options
9360 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9361 * options.h (--target1-rel, --target1-abs, --target2): New
9364 2009-11-25 Doug Kwan <dougkwan@google.com>
9366 * arm.cc (Target_arm::Target_arm): Move method definition outside of
9367 class definition. Add code to handle --target1-rel, --target1-abs
9368 and --target2= options.
9369 (Target_arm::get_reloc_reloc_type): Change method to be non-static
9371 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9373 (Target_arm::Scan::local, Target_arm::Scan::global,
9374 Target_arm::Relocate::relocate,
9375 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9376 call to Target_arm::get_real_reloc_type.
9377 (Target_arm::get_real_reloc_type): Use command line options to
9378 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9379 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9382 2009-11-25 Doug Kwan <dougkwan@google.com>
9384 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9385 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9386 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9388 (Arm_relocate_functions::thm_call): Replace body with a call to
9389 Arm_relocate_functions::thumb_branch_common.
9390 (Arm_relocate_functions::thm_jump24,
9391 Arm_relocate_functions::thm_xpc22): New method definitions.
9392 (Arm_relocate_functions::thumb_branch_common): New method definition.
9393 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9395 (Target_arm::Relocate::relocate): Adjust call to thm_call.
9396 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9398 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9400 * Makefile.am: Build incremental-dump
9401 * Makefile.in: Regenerate.
9402 * incremental-dump.cc: New.
9403 * incremental.cc (Incremental_inputs_header_data,
9404 Incremental_inputs_entry_data): Move to incremental.h
9405 * incremental.h: (Incremental_inputs_header_data,
9406 Incremental_inputs_entry_data): Move from incremental.cc
9408 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9410 * incremental.cc (Incremental_inputs_header,
9411 Incremental_inputs_header_write, Incremental_inputs_entry,
9412 Incremental_inputs_entry_write): Add a typedef with the data type.
9414 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9416 * incremental.cc (Incremental_inputs_header,
9417 Incremental_inputs_header_write, Incremental_inputs_entry,
9418 Incremental_inputs_entry_write): Update comment about which
9419 type has the filed descriptions.
9421 2009-11-15 Doug Kwan <dougkwan@google.com>
9423 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9424 (Arm_relocate_functions::arm_branch_common): Change method defintion
9425 in class definition to a method declaration and update list of formal
9427 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9428 Arm_relocation_functions::jump24): Adjust call to
9429 Arm_relocate_functions::arm_branch_common. Update list of formal
9431 (Arm_relocate_functions::xpc25): New method definition.
9432 (Arm_relocate_functions::arm_branch_common): Move method defintion
9433 out from class definition. Use stubs for mode-switching and extending
9435 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9436 specially. Change code to enable use of stubs in ARM branches.
9438 2009-11-10 Doug Kwan <dougkwan@google.com>
9440 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9441 in method declaration.
9442 (Target_arm::relocate_stub): New method declaration.
9443 (Target_arm::default_target): Change to return a pointer instead of
9445 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9446 Target_arm::default_target.
9447 (Arm_Relobj::do_relocate_sections): Remove options paramater in
9449 (Target_arm::relocate_section): Adjust view.
9450 (Target_arm::relocate_stub): New method definition.
9452 2009-11-10 Doug Kwan <dougkwan@google.com>
9454 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9456 * incremental.cc (open_incremental_binary): Initialized local
9457 variables to avoid warnings.
9458 * object.cc (make_elf_object): Ditto.
9459 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9462 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
9465 * testsuite/plugin_test.c: Include "config.h".
9467 2009-11-09 Doug Kwan <dougkwan@google.com>
9469 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9470 (arm_symbol_value): Remove.
9471 (Arm_relocate_functions::arm_branch_common,
9472 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9473 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9474 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9475 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9476 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9477 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9478 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9479 Arm_relocate_functions::thm_mobw_abs_nc,
9480 Arm_relocate_functions::thm_mov_abs,
9481 Arm_relocate_functions::movw_prel_nc,
9482 Arm_relocate_functions::thm_movt_abs,
9483 Arm_relocate_functions::movt_prel,
9484 Arm_relocate_functions::thm_movw_prel_nc,
9485 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9486 (Target_arm::Relocate::relocate): Only decompose address into two
9487 parts if relocation type uses the thumb-bit and pass the actual
9488 bit instead of a flag indicating that the thumb-bit is used. Adjust
9489 calls to methods in Arm_relocate_functions for this change.
9491 2009-11-08 Ian Lance Taylor <iant@google.com>
9494 * reloc.cc: Instantiate
9495 Sized_relobj::initialize_input_to_output_maps and
9496 Sized_relobj:free_input_to_output_maps.
9498 2009-11-06 Ian Lance Taylor <iant@google.com>
9501 * defstd.cc (in_segment): Set only_if_ref true for "end".
9503 2009-11-06 Doug Kwan <dougkwan@google.com>
9505 * arm.cc (class Reloc_stub): Correct a comment.
9506 (Target_arm::Target_arm): Initialize arm_input_section_map_.
9507 (Target_arm::scan_section_for_stubs): New method declaration.
9508 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9509 Change methods from private to protected.
9510 (Target_arm::do_may_relax): New method definition.
9511 (Target_arm::do_relax, Target_arm::group_sections,
9512 Target_arm::scan_reloc_for_stub,
9513 Target_arm::scan_reloc_section_for_stubs): New method declarations.
9514 (Target_arm::arm_input_section_map_): New data member declaration.
9515 (Target_arm::scan_reloc_for_stub,
9516 Target_arm::scan_reloc_section_for_stubs,
9517 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9518 Target_arm::do_relax): New method definitions.
9520 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
9522 * configure.ac: Check for (struct stat)::st_mtim
9523 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9524 * config.in: Regenerate.
9525 * configure: Regenerate.
9527 2009-11-05 Ian Lance Taylor <iant@google.com>
9530 * output.cc (Output_segment::add_output_section): Add missing
9533 2009-11-04 Ian Lance Taylor <iant@google.com>
9536 * object.h (class Object): Add is_needed and set_is_needed
9537 methods. Add is_needed_ field. Make bool fields into bitfields.
9538 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9539 defined in a dynamic object and referenced by a regular object,
9540 set is_needed for the dynamic object.
9541 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9542 if the file is marked with as_needed and it is not needed.
9544 2009-11-04 Ian Lance Taylor <iant@google.com>
9547 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9548 tags if data is discarded by linker script.
9549 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9550 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9551 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9552 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9554 2009-11-04 Ian Lance Taylor <iant@google.com>
9556 * layout.cc (Layout::get_output_section): Add is_interp and
9557 is_dynamic_linker_section parameters. Change all callers.
9558 (Layout::choose_output_section): Likewise.
9559 (Layout::make_output_section): Likewise.
9560 (Layout::add_output_section_data): Add is_dynamic_linker_section
9561 parameter. Change all callers.
9562 * layout.h (class Layout): Update declarations.
9563 * output.h (class Output_section): Add is_interp, set_is_interp,
9564 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9565 Add is_interp_, is_dynamic_linker_section_ fields. Change
9566 generate_code_fills_at_write_ to a bitfield.
9567 * output.cc (Output_section::Output_sections): Initialize new
9569 (Output_segment::add_output_section): Add do_sort parameter.
9572 2009-11-03 Ian Lance Taylor <iant@google.com>
9575 * options.h (class General_options): Add --warn-common.
9576 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9577 merging two common symbols.
9578 (Symbol_table::should_override): Handle --warn-common when merging
9579 a common symbol with a defined symbol. Use report_resolve_problem
9580 for multiple definitions.
9581 (Symbol_table::report_resolve_problem): New function.
9582 * symtab.h (class Symbol_table): Declare report_resolve_problem.
9584 2009-11-03 Doug Kwan <dougkwan@google.com>
9586 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9588 (Target_arm::stub_factory): New method definition.
9589 (Target_arm::new_arm_input_section,
9590 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9591 Target_arm::reloc_uses_thumb_bit): New method declarations.
9592 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9593 New type definitions.
9594 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9595 member declarations.
9596 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9597 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9598 New method definitions.
9600 2009-11-03 Ian Lance Taylor <iant@google.com>
9602 * options.h (class General_options): Add --warn_constructors.
9604 2009-11-03 Ian Lance Taylor <iant@google.com>
9607 * defstd.cc (in_section): Add entries for __rel_iplt_start,
9608 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9610 2009-11-03 Ian Lance Taylor <iant@google.com>
9613 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9614 --msgid-bugs-address.
9615 (install-pdf): New target.
9616 (install-data_yes): Look up one directory to find mkinstalldirs.
9618 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
9620 * po/Make-in (.po.gmo): Don't generate .gmo files in source
9623 2009-10-30 Doug Kwan <dougkwan@google.com>
9625 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9627 2009-10-30 Doug Kwan <dougkwan@google.com>
9629 * arm.cc (Stub_addend_reader): New struct template definition
9630 and partial specializations.
9631 (Stub_addend_reader::operator()): New method definition for a
9632 partially specialized template.
9634 2009-10-30 Doug Kwan <dougkwan@google.com>
9636 * arm.cc (Arm_relobj::processor_specific_flags): New method
9638 (Arm_relobj::do_read_symbols): New method declaration.
9639 (Arm_relobj::processor_specific_flags_): New data member declaration.
9640 (Arm_dynobj): New class definition.
9641 (Target_arm::do_finalize_sections): Add input_objects parameter.
9642 (Target_arm::do_adjust_elf_header): New method declaration.
9643 (Target_arm::are_eabi_versions_compatible,
9644 (Target_arm::merge_processor_specific_flags): New method declaration.
9645 (Target_arm::do_make_elf_object): New overloaded method definitions
9647 (Arm_relobj::do_read_symbols): New method definition.
9648 (Arm_dynobj::do_read_symbols): Ditto.
9649 (Target_arm::do_finalize_sections): Add input_objects parameters.
9650 Merge processor-specific flags from all input objects.
9651 (Target_arm::are_eabi_versions_compatible,
9652 Target_arm::merge_processor_specific_flags,
9653 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9654 New method definitions.
9655 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9656 Input_objects pointer type parameter.
9657 * layout.cc (Layout::finalize): Pass input objects to target's.
9658 finalize_sections function.
9659 * output.cc (Output_file_header::do_sized_write): Set ELF file
9660 header's processor-specific flags.
9661 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9662 Input_objects pointer type parameter.
9663 * sparc.cc (Target_sparc::do_finalize_sections): Same.
9664 * target.h (Input_objects): New forward class declaration.
9665 (Target::processor_specific_flags,
9666 Target::are_processor_specific_flags_sect): New method definitions.
9667 (Target::finalize_sections): Add input_objects parameter.
9668 (Target::Target): Initialize processor_specific_flags_ and
9669 are_processor_specific_flags_set_.
9670 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9672 (Target::set_processor_specific_flags): New method definition.
9673 (Target::processor_specific_flags_,
9674 Target::are_processor_specific_flags_set_): New data member
9676 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9677 Input_objects pointer type parameter.
9679 2009-10-30 Doug Kwan <dougkwan@google.com>
9681 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9683 2009-10-28 Ian Lance Taylor <iant@google.com>
9685 * object.h (class Relobj): Drop options parameter from
9686 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9687 do_scan_relocs, do_relocate. Change all callers.
9688 (class Sized_relobj): Drop options parameters from
9689 do_gc_process_relocs, do_scan_relocs, do_relocate,
9690 do_relocate_sections, relocate_sections, emit_relocs_scan,
9691 emit_relocs_scan_reltype. Change all callers.
9692 (struct Relocate_info): Remove options field and all references to
9694 * reloc.h (class Read_relocs): Remove options constructor
9695 parameter and options_ field. Change all callers.
9696 (class Gc_process_relocs, class Scan_relocs): Likewise.
9697 (class Relocate_task): Likewise.
9698 * target-reloc.h (scan_relocs): Remove options parameter. Change
9700 (scan_relocatable_relocs): Likewise.
9701 * target.h (class Sized_target): Remove options parameter from
9702 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
9704 * gc.h (gc_process_relocs): Remove options parameter. Change all
9706 * arm.cc: Update functions to remove options parameters.
9707 * i386.cc: Likewise.
9708 * powerpc.cc: Likewise.
9709 * sparc.cc: Likewise.
9710 * x86_64.cc: Likewise.
9711 * testsuite/testfile.cc: Likewise.
9713 2009-10-28 Doug Kwan <dougkwan@google.com>
9715 * arm.cc (Arm_relobj): New class definition.
9716 (Arm_relobj::scan_sections_for_stubs,
9717 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9718 New method definitions.
9720 2009-10-28 Cary Coutant <ccoutant@google.com>
9722 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9723 (Plugin::cleanup_done_): New member.
9724 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9725 (Plugin_manager::cleanup_done_): Remove.
9726 (Plugin_manager::add_input_file): Edit error message.
9727 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9728 (Plugin_manager::cleanup): Remove use of cleanup_done_.
9730 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
9732 * fileread.cc: (File_read::View::~View): Use the new
9733 data_ownership_ filed.
9734 (File_read::~File_read): Dispose the new whole_file_view_.
9735 (File_read::open): Mmap the whole file if needed.
9736 (File_read::open): Use whole_file_view_ instead of contents_.
9737 (File_read::find_view): Use whole_file_view_ if applicable.
9738 (File_read::do_read): Use whole_file_view_ instead of contents_.
9739 (File_read::make_view): Use whole_file_view_ instead of contents_,
9740 update File_read::View::View call.
9741 (File_read::find_or_make_view): Update File_read::View::View
9743 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9745 (File_read::View::Data_ownership): New enum.
9746 (File_read::View::View): Replace bool mapped_ with Data_ownership
9748 (File_read::View::mapped_): Remove (replaced by data_ownership_).
9749 (File_read::View::data_ownership_): New field.
9750 (File_read::contents_): Remove (replaced by whole_file_view_).
9751 (File_read::whole_file_view_): New field.
9752 * options.h (class General_options): Add --keep-files-mapped.
9754 2009-10-27 Cary Coutant <ccoutant@google.com>
9756 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9757 * testsuite/Makefile.am (plugin_test_5): New test case.
9758 * testsuite/Makefile.in: Regenerate.
9760 2009-10-25 Doug Kwan <dougkwan@google.com>
9762 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9763 from private to protected to allow access by child class.
9764 (Sized_relobj::do_relocate_sections): New method declaration.
9765 (Sized_relobj::relocate_sections): Virtualize.
9766 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9767 Sized_relobj::relocate_sections. Instantiate template explicitly
9768 for different target sizes and endianity.
9770 2009-10-24 Doug Kwan <dougkwan@google.com>
9772 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9773 (Arm_input_section::as_arm_input_section): New method.
9774 (Arm_output_section): New class definition.
9775 (Arm_output_section::create_stub_group,
9776 Arm_output_section::group_sections): New method definitions.
9778 2009-10-22 Doug Kwan <dougkwan@google.com>
9780 * arm.cc (Arm_input_section): New class definition.
9781 (Arm_input_section::init, Arm_input_section:do_write,
9782 Arm_input_section::set_final_data_size,
9783 Arm_input_section::do_reset_address_and_file_offset): New method
9786 2009-10-21 Doug Kwan <dougkwan@google.com>
9788 * arm.cc (Stub_table, Arm_input_section): New forward class
9790 (Stub_table): New class defintion.
9791 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9792 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9793 New method definition.
9795 2009-10-21 Doug Kwan <dougkwan@google.com>
9797 * arm.cc: Update copyright comments.
9798 (Target_arm): New forward class template declaration.
9799 (Arm_address): New type.
9800 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9801 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9802 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9804 (Insn_template): Same.
9805 (DEF_STUBS): New macro.
9806 (Stub_type): New enum type.
9807 (Stub_template): New class definition.
9810 (Stub_factory): Same.
9811 (Target_arm::Target_arm): Initialize may_use_blx_ and
9812 should_force_pic_veneer_.
9813 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9814 Target_arm::should_force_pic_veneer,
9815 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9816 Target_arm::using_thumb_only, Target_arm:;default_target): New
9818 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9819 New data member declarations.
9820 (Insn_template::size, Insn_template::alignment): New method defintions.
9821 (Stub_template::Stub_template): New method definition.
9822 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9823 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9824 (Stub_factory::Stub_factory): New method definition.
9825 * gold.h (string_hash): New template.
9826 * output.h (Input_section_specifier::hash_value): Use
9828 (Input_section_specifier::string_hash): Remove.
9829 * stringpool.cc (Stringpool_template::string_hash): Use
9832 2009-10-20 Doug Kwan <dougkwan@google.com>
9834 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9835 symbols of relaxed input sections.
9836 * output.h (Output_section::find_relaxed_input_section): Make
9839 2009-10-16 Doug Kwan <dougkwan@google.com>
9841 * dynobj.cc (Versions::Versions): Initialize version_script_.
9842 Only insert base version symbol definition for a shared object
9843 if version script defines any version versions.
9844 (Versions::define_base_version): New method definition.
9845 (Versions::add_def): Check that base version is not needed.
9846 (Versions::add_need): Define base version lazily.
9847 * dynobj.h (Versions::define_base_version): New method declaration.
9848 (Versions::needs_base_version_): New data member declaration.
9849 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9850 (check_DATA): Add no_version_test.stdout.
9851 (libno_version_test.so, no_version_test.o no_version_test.stdout):
9853 * testsuite/Makefile.in: Regenerate.
9854 * testsuite/no_version_test.c: New file.
9855 * testsuite/no_version_test.sh: Ditto.
9857 2009-10-16 Doug Kwan <dougkwan@google.com>
9859 * expression.cc (class Segment_start_expression): New class definition.
9860 (Segment_start_expression::value): New method definition.
9861 (script_exp_function_segment_start): Return a new
9862 Segment_start_expression.
9863 * gold/script-c.h (script_saw_segment_start_expression): New function
9865 * script-sections.cc (Script_sections::Script_sections): Initialize
9866 SAW_SEGMENT_START_EXPRESSION_ to false.
9867 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9868 and -Tbbs options to specify section addresses if given in
9869 command line and no SEGMENT_START expression is seen in a script.
9870 * script-sections.h (Script_sections::saw_segment_start_expression,
9871 Script_sections::set_saw_segment_start_expression): New method
9873 (Script_sections::saw_segment_start_expression_): New data member
9875 * script.cc (script_saw_segment_start_expression): New function.
9876 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9877 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9878 script_test_7.sh and script_test_8.sh.
9879 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9880 script_test_8.stdout.
9881 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9882 (script_test_6, script_test_6.stdout, script_test_7,
9883 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9884 * Makefile.in: Regenerate.
9885 * testsuite/script_test_6.sh: New file.
9886 * testsuite/script_test_6.t: Same.
9887 * testsuite/script_test_7.sh: Same.
9888 * testsuite/script_test_7.t: Same.
9889 * testsuite/script_test_8.sh: Same.
9891 2009-10-16 Doug Kwan <dougkwan@google.com>
9893 * output.cc (Output_segment::set_section_list_address): Cast
9894 expressions to unsigned long long type to avoid format warnings.
9896 2009-10-15 Ian Lance Taylor <iant@google.com>
9898 * script.cc (Script_options::add_symbol_assignment): Always add a
9899 dot assignment to script_sections_.
9900 * script-sections.cc (Script_sections::add_dot_assignment):
9901 Initialize if necessary.
9903 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9904 program headers with no load segment if there is a linker script.
9906 * layout.cc (Layout::set_segment_offsets): Align the file offset
9907 to the segment aligment for -N or -n with no load segment.
9908 * output.cc (Output_segment::add_output_section): Don't crash if
9909 the first section is a TLS section.
9910 (Output_segment::set_section_list_addresses): Print an error
9911 message if the address moves backward in a linker script.
9912 * script-sections.cc
9913 (Output_section_element_input::set_section_addresses): Don't
9914 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9915 (Orphan_output_section::set_section_addresses): Likewise.
9917 2009-10-15 Doug Kwan <dougkwan@google.com>
9919 * layout.cc (Layout::finish_dynamic_section): Generate tags
9920 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9921 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9922 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9924 2009-10-14 Ian Lance Taylor <iant@google.com>
9926 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9928 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9929 data_shdr fields of relinfo.
9930 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9931 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
9932 R_386_TLS_LDO_32, adjust based on section flags.
9933 (Target_i386::Relocate::fix_up_ldo): Remove.
9935 2009-10-13 Ian Lance Taylor <iant@google.com>
9937 Add support for -pie.
9938 * options.h (class General_options): Add -pie and
9940 (General_options::output_is_position_independent): Test -pie.
9941 (General_options::output_is_executable): Return true if not shared
9942 and not relocatable.
9943 (General_options::output_is_pie): Remove.
9944 * options.cc (General_options::finalize): Reject incompatible uses
9946 * gold.cc (queue_middle_tasks): A -pie link is not static.
9947 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9948 * symtab.cc (Symbol::final_value_is_known): Return false if
9949 output_is_position_independent.
9950 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9951 output_is_position_independent.
9952 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9953 output_is_position_independent.
9954 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9955 output_is_position_independent.
9956 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9958 (basic_pie_test.o, basic_pie_test): New targets.
9959 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9960 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9961 (two_file_pie_test): New target.
9962 * testsuite/Makefile.in: Rebuild.
9963 * README: Remove note saying that -pie is not supported.
9965 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
9967 * options.h (class General_options): Add -init and -fini.
9968 * layout.cc (Layout::finish_dynamic_section): Emit
9969 given init and fini functions.
9971 2009-10-13 Sriraman Tallam <tmsriram@google.com>
9973 * gc.h (gc_process_relocs): Check if icf is enabled using new
9975 * gold.cc (queue_initial_tasks): Likewise.
9976 (queue_middle_tasks): Likewise.
9977 * object.cc (do_layout): Likewise.
9978 * symtab.cc (is_section_folded): Likewise.
9979 * main.cc (main): Likewise.
9980 * reloc.cc (Read_relocs::run): Likewise.
9981 (Sized_relobj::do_scan_relocs): Likewise.
9982 * icf.cc (is_function_ctor_or_dtor): New function.
9983 (Icf::find_identical_sections): Check if function is ctor or dtor when
9985 * options.h (General_options::icf): Change option to be an enum.
9986 (Icf_status): New enum.
9987 (icf_enabled): New method.
9988 (icf_safe_folding): New method.
9989 (set_icf_status): New method.
9990 (icf_status_): New variable.
9991 * (options.cc) (General_options::finalize): Set icf_status_.
9992 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9993 icf_test and icf_keep_unique_test to use the --icf enum flag.
9994 * testsuite/icf_safe_test.sh: New file.
9995 * testsuite/icf_safe_test.cc: New file.
9997 2009-10-12 Sriraman Tallam <tmsriram@google.com>
9999 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10000 includes to gc.h and icf.h.
10001 * arm.cc: Include gc.h.
10002 * gold.cc: Likewise.
10003 * i386.cc: Likewise.
10004 * powerpc.cc: Likewise.
10005 * sparc.cc: Likewise.
10006 * x86_64.cc: Likewise.
10007 * gc.h: Include icf.h.
10009 2009-10-11 Ian Lance Taylor <iant@google.com>
10011 * plugin.cc: Include "gold.h" before other header files.
10013 2009-10-10 Chris Demetriou <cgd@google.com>
10015 * options.h (Input_file_argument::Input_file_type): New enum.
10016 (Input_file_argument::is_lib_): Replace with...
10017 (Input_file_argument::type_): New member.
10018 (Input_file_argument::Input_file_argument): Take Input_file_type
10019 'type' rather than boolean 'is_lib' as second argument.
10020 (Input_file_argument::is_lib): Use type_.
10021 (Input_file_argument::is_searched_file): New function.
10022 (Input_file_argument::may_need_search): Handle is_searched_file.
10023 * options.cc (General_options::parse_library): Support -l:filename.
10024 (General_options::parse_just_symbols): Update for Input_file_argument
10026 (Command_line::process): Likewise.
10027 * archive.cc (Archive::get_file_and_offset): Likewise.
10028 * plugin.cc (Plugin_manager::release_input_file): Likewise.
10029 * script.cc (read_script_file, script_add_file): Likewise.
10030 * fileread.cc (Input_file::Input_file): Likewise.
10031 (Input_file::will_search_for): Handle is_searched_file.
10032 (Input_file::open): Likewise.
10033 * readsyms.cc (Read_symbols::get_name): Likewise.
10034 * testsuite/Makefile.am (searched_file_test): New test.
10035 * testsuite/Makefile.in: Regenerate.
10036 * testsuite/searched_file_test.cc: New file.
10037 * testsuite/searched_file_test_lib.cc: New file.
10039 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10040 Ian Lance Taylor <iant@google.com>
10042 * descriptor.cc: Include <cstdio> and "binary-io.h".
10043 (Descriptors::open): Open the files in binary mode always.
10044 * script.cc (Lex::get_token): Treat \r as whitespace.
10046 2009-10-09 Ian Lance Taylor <iant@google.com>
10048 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10050 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10051 Ian Lance Taylor <iant@google.com>
10053 * configure.ac: Check for readv function also.
10054 * fileread.cc (readv): Define if not HAVE_READV.
10055 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10057 * config.in: Regenerate.
10058 * configure: Regenerate.
10060 2009-10-09 Doug Kwan <dougkwan@google.com>
10062 * layout.cc (Layout::make_output_section): Call target hook to make
10063 ordinary output section.
10064 (Layout::finalize): Adjust parameter list of call the
10065 Target::may_relax().
10066 * layout.h (class Layout::section_list): New method.
10067 * merge.h (Output_merge_base::entsize): Change visibility to public.
10068 (Output_merge_base::is_string, Output_merge_base::do_is_string):
10070 (Output_merge_string::do_is_string): New method.
10071 * object.cc (Sized_relobj::do_setup): renamed from
10072 Sized_relobj::set_up.
10073 * object.h (Sized_relobj::adjust_shndx,
10074 Sized_relobj::initializ_input_to_output_maps,
10075 Sized_relobj::free_input_to_output_maps): Change visibilities to
10077 (Sized_relobj::setup): Virtualize.
10078 (Sized_relobj::do_setup): New method declaration.
10079 (Sized_relobj::invalidate_section_offset,
10080 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10081 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10082 * options.cc (parse_int): New function.
10083 * options.h (parse_int): New declaration.
10084 (DEFINE_int): New macro.
10085 (stub_group_size): New option.
10086 * output.cc (Output_section::Output_section): Initialize memebers
10087 merge_section_map_, merge_section_by_properties_map_,
10088 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10089 (Output_section::add_input_section): Handled deferred code-fill
10090 generation and remove an old comment.
10091 (Output_section::add_relaxed_input_section): New method definition.
10092 (Output_section::add_merge_input_section): Use merge section by
10093 properties map to speed to search. Update merge section maps
10095 (Output_section::build_relaxation_map): New method definition.
10096 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10098 (Output_section::relax_input_section): Renamed to
10099 Output_section::convert_input_sections_to_relaxed_sections and change
10100 interface to take a vector of pointers to relaxed sections.
10101 (Output_section::find_merge_section,
10102 Output_section::find_relaxed_input_section): New method definitions.
10103 (Output_section::is_input_address_mapped,
10104 Output_section::output_offset, Output_section::output_address):
10105 Use output section data maps to speed up searching.
10106 (Output_section::find_starting_output_address): Add comments.
10107 (Output_section::do_write,
10108 Output_section::write_to_postprocessing_buffer): Do code-fill
10109 generation as appropriate.
10110 (Output_section::get_input_sections): Invalidate relaxed input section
10112 (Output_section::restore_states): Adjust type of checkpoint .
10113 Invalidate relaxed input section map.
10114 * output.h (Output_merge_base): New class declaration.
10115 (Input_section_specifier): New class defintion.
10116 (class Output_relaxed_input_section) Change base class to
10117 Output_section_data_build.
10118 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10119 base class initializer.
10120 (Output_section::add_relaxed_input_section): New method declaration.
10121 (Output_section::Input_section): Change visibility to protected.
10122 (Output_section::Input_section::relobj,
10123 Output_section::Input_section::shndx): Handle relaxed input sections.
10124 Output_section::input_sections) Change visibility to protected. Also
10125 define overload to return a non-const pointer.
10126 (Output_section::Merge_section_properties): New class defintion.
10127 (Output_section::Merge_section_by_properties_map,
10128 Output_section::Output_section_data_by_input_section_map,
10129 Output_section::Relaxation_map): New types.
10130 (Output_section::relax_input_section): Rename method to
10131 Output_section::convert_input_sections_to_relaxed_sections and change
10132 interface to take a vector of relaxed section pointers.
10133 (Output_section::find_merge_section,
10134 Output_section::find_relaxed_input_section,
10135 Output_section::build_relaxation_map,
10136 Output_section::convert_input_sections_in_list_to_relaxed_sections):
10137 New method declarations.
10138 (Output_section::merge_section_map_
10139 Output_section::merge_section_by_properties_map_,
10140 Output_section::relaxed_input_section_map_,
10141 Output_section::is_relaxed_input_section_map_valid_,
10142 Output_section::generate_code_fills_at_write_): New data members.
10143 * script-sections.cc
10144 (Output_section_element_input::set_section_addresses): Call
10145 current_data_size and addralign methods of relaxed input sections.
10146 (Orphan_output_section::set_section_addresses): Call current_data_size
10147 and addralign methods of relaxed input sections.
10148 * symtab.cc (Symbol_table::compute_final_value): Extract template
10149 from the body of Symbol_table::sized_finalize_symbol.
10150 (Symbol_table::sized_finalized_symbol): Call
10151 Symbol_table::compute_final_value.
10152 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10153 (Symbol_table::compute_final_value): New templated method declaration.
10154 * target.cc (Target::do_make_output_section): New method defintion.
10155 * target.h (Target::make_output_section): New method declaration.
10156 (Target::relax): Add more parameters for input objects, symbol table
10157 and layout. Adjust call to do_relax.
10158 (Target::do_make_output_section): New method declaration.
10159 (Target::do_relax): Add parameters for input objects, symbol table
10162 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10164 * pread.c: Include stdio.h.
10166 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10168 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10171 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10173 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10174 Change read_shndx type to unsigned int.
10175 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10177 (Sized_dwarf_line_info::read_line_mappings): Likewise.
10178 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10179 Change read_shndx type to unsigned int.
10180 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10182 (Sized_dwarf_line_info::read_line_mappings): Likewise.
10183 * layout.cc (Layout::create_symtab_sections): Cast the result of
10184 local_symcount * symsize to off_t in the gold_assert.
10186 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10188 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10189 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10191 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10192 (Arm_relocate_functions::thm_abs5): New function.
10193 (Arm_relocate_functions::abs12): New function.
10194 (Arm_relocate_functions::abs16): New function.
10195 (Arm_relocate_functions::base_abs): New function.
10196 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10197 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
10198 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10200 (Scan::global): Likewise.
10201 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10202 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10203 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10204 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10207 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10209 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10210 (Arm_relocate_functions::movt_prel): New function.
10211 (Arm_relocate_functions::thm_movw_prel_nc): New function.
10212 (Arm_relocate_functions::thm_movt_prel): New function.
10213 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10214 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10215 (Scan::global, Relocate::relocate): Likewise.
10216 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10218 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10220 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10221 Incremental_checker.
10222 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10224 (class Incremental_inputs_header): New class.
10225 (Incremental_inputs_header_writer): Edit comment.
10226 (Incremental_inputs_entry): New class.
10227 (Incremental_inputs_entry_writer): Edit comment.
10228 (Sized_incremental_binary::do_find_incremental_inputs_section):
10229 Add *strtab_shndx parameter, fill it.
10230 (Sized_incremental_binary::do_check_inputs): New method.
10231 (Incremental_checker::can_incrementally_link_output_file): Use
10232 Sized_incremental_binary::check_inputs.
10233 (Incremental_inputs::report_command_line): Save command line in
10236 (Incremental_binary::find_incremental_inputs_section): New
10238 (Incremental_binary::do_find_incremental_inputs_section): Add
10239 strtab_shndx parameter.
10240 (Incremental_binary::do_check_inputs): New pure virtual method.
10241 (Sized_incremental_binary::do_check_inputs): Declare.
10242 (Incremental_checker::Incremental_checker): Add incremental_inputs
10243 parameter, use it to initialize incremental_inputs_.
10244 (Incremental_checker::incremental_inputs_): New field.
10245 (Incremental_checker::command_line): New method.
10246 (Incremental_checker::inputs): New method.
10247 (Incremental_checker::command_line_): New field.
10249 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10251 * incremental.cc: Include <cstdarg> and "target-select.h".
10252 (vexplain_no_incremental): New function.
10253 (explain_no_incremental): New function.
10254 (Incremental_binary::error): New method.
10255 (Sized_incremental_binary::do_find_incremental_inputs_section): New
10257 (make_sized_incremental_binary): New function.
10258 (open_incremental_binary): New function.
10259 (can_incrementally_link_file): Add checks if output is ELF and has
10261 * incremental.h: Include "elfcpp_file.h" and "output.h".
10262 (Incremental_binary): New class.
10263 (Sized_incremental_binary): New class.
10264 (open_incremental_binary): Declare.
10265 * object.cc (is_elf_object): Use
10266 elfcpp::Elf_recognizer::is_elf_file.
10267 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10268 * output.h (Output_file::filesize): New method.
10270 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10272 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10274 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10275 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10277 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10279 (Arm_relocate_functions::movw_abs_nc): New function.
10280 (Arm_relocate_functions::movt_abs): New function.
10281 (Arm_relocate_functions::thm_movw_abs_nc): New function.
10282 (Arm_relocate_functions::thm_movt_abs): New function.
10283 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10284 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10285 (Scan::global): Likewise.
10286 (Relocate::relocate): Likewise.
10287 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10289 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10291 * arm.cc (Arm_relocate_functions::got_prel) New function.
10292 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10293 (Relocate::relocate): Likewise.
10294 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10296 2009-10-06 Ian Lance Taylor <iant@google.com>
10298 * options.h (class General_options): Define
10299 split_stack_adjust_size parameter.
10300 * object.h (class Object): Add uses_split_stack_ and
10301 has_no_split_stack_ fields. Add uses_split_stack and
10302 has_no_split_stack accessor functions. Declare
10303 handle_split_stack_section.
10304 (class Reloc_symbol_changes): Define.
10305 (class Sized_relobj): Define Function_offsets. Declare
10306 split_stack_adjust, split_stack_adjust_reltype, and
10308 * object.cc (Object::handle_split_stack_section): New function.
10309 (Sized_relobj::do_layout): Call handle_split_stack_section.
10310 * dynobj.cc (Sized_dynobj::do_layout): Call
10311 handle_split_stack_section.
10312 * reloc.cc (Sized_relobj::relocate_sections): Call
10313 split_stack_adjust for executable sections in split_stack
10314 objects. Pass reloc_map to relocate_section.
10315 (Sized_relobj::split_stack_adjust): New function.
10316 (Sized_relobj::split_stack_adjust_reltype): New function.
10317 (Sized_relobj::find_functions): New function.
10318 * target-reloc.h: Include "object.h".
10319 (relocate_section): Add reloc_symbol_changes parameter. Change
10321 * target.h (class Target): Add calls_non_split method. Declare
10322 do_calls_non_split virtual method. Declare match_view and
10324 * target.cc: Include "elfcpp.h".
10325 (Target::do_calls_non_split): New function.
10326 (Target::match_view): New function.
10327 (Target::set_view_to_nop): New function.
10328 * gold.cc (queue_middle_tasks): Give an error if mixing
10329 split-stack and non-split-stack objects with -r.
10330 * i386.cc (Target_i386::relocate_section): Add
10331 reloc_symbol_changes parameter.
10332 (Target_i386::do_calls_non_split): New function.
10333 * x86_64.cc (Target_x86_64::relocate_section): Add
10334 reloc_symbol_changes parameter.
10335 (Target_x86_64::do_calls_non_split): New function.
10336 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10338 * powerpc.cc (Target_powerpc::relocate_section): Add
10339 reloc_symbol_changes parameter.
10340 * sparc.cc (Target_sparc::relocate_section): Add
10341 reloc_symbol_changes parameter.
10342 * configure.ac: Call AM_CONDITIONAL for the default target.
10343 * configure: Rebuild.
10344 * testsuite/Makefile.am (TEST_AS): New variable.
10345 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10346 (check_DATA): Add split_i386 and split_x86_64 files.
10347 (SPLIT_DEFSYMS): Define.
10348 (split_i386_[1234n].o): New targets.
10349 (split_i386_[124]): New targets.
10350 (split_i386_[1234r].stdout): New targets.
10351 (split_x86_64_[1234n].o): New targets.
10352 (split_x86_64_[124]): New targets.
10353 (split_x86_64_[1234r].stdout): New targets.
10354 (MOSTLYCLEANFILES): Add new executables.
10355 * testsuite/split_i386.sh: New file.
10356 * testsuite/split_x86_64.sh: New file.
10357 * testsuite/split_i386_1.s: New file.
10358 * testsuite/split_i386_2.s: New file.
10359 * testsuite/split_i386_3.s: New file.
10360 * testsuite/split_i386_4.s: New file.
10361 * testsuite/split_i386_n.s: New file.
10362 * testsuite/split_x86_64_1.s: New file.
10363 * testsuite/split_x86_64_2.s: New file.
10364 * testsuite/split_x86_64_3.s: New file.
10365 * testsuite/split_x86_64_4.s: New file.
10366 * testsuite/split_x86_64_n.s: New file.
10367 * testsuite/testfile.cc (Target_test): Update relocation_section
10369 * testsuite/Makefile.in: Rebuild.
10371 2009-10-06 Ian Lance Taylor <iant@google.com>
10373 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10374 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10375 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
10376 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10377 the address on ldo_addrs_.
10378 (Target_i386::Relocate::fix_up_ldo): New function.
10380 2009-10-06 Rafael Espindola <espindola@google.com>
10382 * plugin.cc (add_input_library): New.
10383 (Plugin::load): Add add_input_library to tv.
10384 (Plugin_manager::add_input_file): Add the is_lib argument.
10385 (add_input_file): Update call to Plugin_manager::add_input_file.
10386 (add_input_library): New.
10387 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10389 2009-09-30 Doug Kwan <dougkwan@google.com>
10391 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10392 symbol and call Symbol::may_need_copy_reloc to determine if
10393 a copy reloc is needed.
10394 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10395 nocopyreloc is given in command line.
10396 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10397 given in command line.
10398 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10399 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10400 of the removed Target_i386::may_need_copy_reloc.
10401 * options.h (copyreloc): New option with default value false.
10402 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10403 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10404 instead of the removed Target_powerpc::may_need_copy_reloc.
10405 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10406 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10407 instead of the removed Target_sparc::may_need_copy_reloc.
10408 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10409 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10410 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10411 instead of the removed Target_x86_64::may_need_copy_reloc.
10413 2009-09-30 Ian Lance Taylor <iant@google.com>
10415 * object.h (class Object): Remove target_ field, and target,
10416 sized_target, and set_target methods.
10417 (Object::sized_target): Remove.
10418 (class Sized_relobj): Update declarations. Remove sized_target.
10419 * object.cc (Sized_relobj::setup): Remove target parameter.
10420 Change all callers.
10421 (Input_objects::add_object): Don't do anything with the target.
10422 (make_elf_sized_object): Add punconfigured parameter. Change all
10423 callers. Set or test parameter target.
10424 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10425 Change all callers.
10426 * parameters.cc (Parameters::set_target): Change parameter type to
10428 (Parameters::default_target): Remove.
10429 (set_parameters_target): Change parameter type to be non-const.
10430 (parameters_force_valid_target): New function.
10431 (parameters_clear_target): New function.
10432 * parameters.h (class Parameters): Update declarations. Remove
10433 default_target method. Add sized_target and clear_target
10434 methods. Change target_ to be non-const.
10435 (set_parameters_target): Update declaration.
10436 (parameters_force_valid_target): Declare.
10437 (parameters_clear_target): Declare.
10438 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10439 as NULL if we aren't searching.
10440 (Add_symbols::run): Don't check for compatible target.
10441 * fileread.cc (Input_file::open_binary): Call
10442 parameters_force_valid_target.
10443 * gold.cc (queue_middle_tasks): Likewise.
10444 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
10445 set_target on object.
10446 * dynobj.h (class Sized_dynobj): Update declarations.
10447 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10448 make_elf_object returns NULL.
10449 (Archive::include_member): Don't check whether object target is
10451 * output.cc (Output_section::add_input_section): Get target from
10453 (Output_section::relax_input_section): Likewise.
10454 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10456 (Sized_relobj::do_scan_relocs): Likewise.
10457 (Sized_relobj::relocate_sections): Likewise.
10458 * resolve.cc (Symbol_table::resolve): Likewise.
10459 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
10460 parameter. Change all callers.
10461 (Symbol_table::add_from_object): Get target from parameters.
10462 (Symbol_table::add_from_relobj): Don't check object target.
10463 (Symbol_table::add_from_dynobj): Likewise.
10464 (Symbol_table::define_special_symbol): Get target from
10466 * symtab.h (class Symbol_table): Update declaration.
10467 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10468 parameter. Change all callers. Clear parameter target.
10469 (Binary_test): Test target here.
10470 * testsuite/object_unittest.cc (gold_testsuite): Remove
10471 target_test_pointer parameter. Change all callers.
10472 (Object_test): Test target here.
10474 2009-09-26 Ian Lance Taylor <iant@google.com>
10476 * testsuite/initpri1.c: Don't try to use constructor priorities if
10477 compiling with gcc before 4.3.
10479 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
10481 * testsuite/retain_symbols_file_test.sh (check_present): Change
10482 output file name to retain_symbols_file_test.stdout.
10483 (check_absent): Likewise.
10485 2009-09-18 Craig Silverstein <csilvers@google.com>
10487 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10488 * options.cc: Include <cerrno> and <fstream>.
10489 (General_options::finalize): Parse -retain-symbols-file tag.
10490 * options.h: New flag.
10491 (General_options): New method should_retain_symbol, new
10492 variable symbols_to_retain.
10493 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10494 should_retain_symbol map.
10495 * testsuite/Makefile.am (retain_symbols_file_test): New test.
10496 * testsuite/Makefile.in: Regenerate.
10497 * testsuite/retain_symbols_file_test.sh: New file.
10499 2009-09-18 Nick Clifton <nickc@redhat.com>
10501 * po/es.po: Updated Spanish translation.
10503 2009-09-17 Doug Kwan <dougkwan@google.com>
10505 * debug.h (DEBUG_RELAXATION): New constant.
10506 (DEBUG_ALL): Add DEBUG_RELAXATION.
10507 (debug_string_to_enum): Add relaxation debug option.
10509 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10510 Layout::Relaxation_debug_check::read_sections,
10511 Layout::Relaxation_debug_check::read_sections): New method definitions.
10512 (Layout::Layout): Initialize data members
10513 record_output_section_data_from_scrips_,
10514 script_output_section_data_list_ and relaxation_debug_check_.
10515 (Layout::save_segments, Layout::restore_segments,
10516 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10517 Layout::relaxation_loop_body): New method definitions.
10518 (Layout::finalize): Support relaxation. Move section layout code to
10519 Layout::relaxation_loop_body.
10520 (Layout::set_asection_address_from_script): Move code for orphan
10521 section placement out.
10522 (Layout::place_orphan_sections_in_script): New method definition.
10523 * layout.h (Output_segment_headers, Output_file_header):
10524 New forward class declarations.
10525 (Layout::~Layout): Define.
10526 (Layout::new_output_section_data_from_script): New method definition.
10527 (Layout::place_orphan_sections_in_script): New method declaration.
10528 (Layout::Segment_states): New type declaration.
10529 (Layout::save_segments, Layout::restore_segments,
10530 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10531 Layout::relaxation_loop_body): New method declarations.
10532 (Layout::Output_section_data_list): New type declaration.
10533 (Layout::Relaxation_debug_check): New class definition.
10534 (Layout::record_output_section_data_from_script_,
10535 Layout::script_output_section_data_list_, Layout::segment_states_,
10536 Layout::relaxation_debug_check_): New data members.
10537 * output.cc: (Output_section_headers::do_size): New method definition.
10538 (Output_section_headers::Output_section_headers): Move size
10539 computation to Output_section_headers::do_size.
10540 (Output_segment_headers::do_size): New method definition.
10541 (Output_file_header::Output_file_header): Move size computation to
10542 Output_file_header::do_size and call it.
10543 (Output_file_header::do_size): New method definition.
10544 (Output_data_group::Output_data_group): Adjust call to
10545 Output_section_data.
10546 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10547 (Output_symtab_xindex::do_write): Add array bound check.
10548 (Output_section::Input_section::print_to_mapfile): Handle
10549 RELAXED_INPUT_SECTION_CODE.
10550 (Output_section::Output_section): Initialize data member checkpoint_.
10551 (Output_section::~Output_section): Delete checkpoint object pointed
10553 (Output_section::add_input_section): Always add an Input_section if
10555 (Output_section::add_merge_input_section): Add assert.
10556 (Output_section::relax_input_section): New method definition.
10557 (Output_section::set_final_data_size): Set load address to zero for
10558 an unallocated section.
10559 (Output_section::do_address_and_file_offset_have_reset_values):
10560 New method definition.
10561 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10562 Handle relaxed input section.
10563 (Output_section::sort_attached_input_sections): Checkpoint input
10564 section list lazily.
10565 (Output_section::get_input_sections): Change type of input_sections to
10566 list of Simple_input_section pointers. Checkpoint input section list
10567 lazily. Also handle relaxed input sections.
10568 (Output_section::add_input_section_for_script): Take a reference to
10569 a Simple_input_section object instead of Relobj pointer and section
10570 index as parameter. Handle relaxed input sections.
10571 (Output_section::save_states, Output_section::restore_states): New
10572 method definitions.
10573 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10574 (Output_data::is_data_size_fixed): New method definition.
10575 (Output_data::reset_addresss_and_file_offset): Do not reset data size
10577 (Output_data::address_and_file_offset_have_reset_values): New method
10579 (Output_data::do_address_and_file_offset_have_reset_values): New method
10581 (Output_data::set_data_size): Check that data size is not fixed.
10582 (Output_data::fix_data_size): New method definition.
10583 (Output_data::is_data_size_fixed_): New data member.
10584 (Output_section_headers::set_final_data_size): New method definition.
10585 (Output_section_headers::do_size): New method declaration.
10586 (Output_segment_headers::set_final_data_size): New method definition.
10587 (Output_segment_headers::do_size): New method declaration.
10588 (Output_file_header::set_final_data_size)::New method definition.
10589 (Output_file_header::do_size)::New method declaration.
10590 (Output_section_data::Output_section_data): Add new parameter
10591 is_data_size_fixed and use it to fix data size.
10592 (Output_data_const::Output_data_const): Adjust call to base class
10593 constructor and fix data size.
10594 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10595 base class constructor and fix data size.
10596 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10597 base class constructor and fix data size.
10598 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10599 class constructor and fix data size.
10600 (Output_data_group::set_final_data_size): New method definition.
10601 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10602 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10603 class constructor and fix data size.
10604 (Output_relaxed_input_section): New class definition.
10605 (Output_section::Simple_input_section): New class definition.
10606 (Output_section::get_input_sections): Adjust parameter list.
10607 (Output_section::add_input_section_for_script): Same.
10608 (Output_section::save_states, Output_section::restore_states,
10609 Output_section::do_address_and_file_offset_have_reset_values,
10610 (Output_section::Input_section::Input_section): Handle
10611 RELAXED_INPUT_SECTION_CODE. Add new overload for
10612 Output_relaxed_input_section.
10613 (Output_section::Input_section::is_input_section,
10614 Output_section::Input_section::set_output_section): Handle relaxed
10616 (Output_section::Input_section::is_relaxed_input_section,
10617 Output_section::Input_section::output_section_data,
10618 Output_section::Input_section::relaxed_input_section): New method
10620 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10622 (Output_section::Input_section::u1_): Update comments.
10623 (Output_section::Input_section::u2_): Add new union member poris.
10624 (Output_section::Checkpoint_output_section): New classs definition.
10625 (Output_section::relax_input_section): New method declaration.
10626 (Output_section::checkpoint_): New data member.
10627 (Output_segment): Update comments.
10628 (Output_segment::Output_segment): Un-privatize copy constructor.
10629 (Output_segment::operator=): Un-privatize.
10630 * script-sections.cc (Output_section_element::Input_section_list):
10631 Change element type to Output_section::Simple_input_section.
10632 (Output_section_element_dot_assignment::set_section_addresses):
10633 Register output section data for relaxation clean up.
10634 (Output_data_exression::Output_data_expression): Adjust call to base
10635 constructor to fix data size.
10636 (Output_section_element_data::set_section_addresses): Register
10637 Output_data_expression object for relaxation clean up.
10638 (struct Input_section_info): Replace Relobj pointer and section index
10639 pair with Output_section::Simple_input_section and Convert struct to a
10641 (Input_section_sorter::operator()): Adjust access to
10642 Input_section_info data member to use accessors.
10643 (Output_section_element_input::set_section_addresses): Use layout
10644 parameter. Adjust code to use Output_section::Simple_input_section
10645 and Input_secction_info classes. Register filler for relaxation
10647 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10648 and section index pair with Output_section::Simple_input_section
10649 class. Adjust code accordingly.
10650 (Phdrs_element::release_segment): New method definition.
10651 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10653 (Script_sections::release_segments): New method definition.
10654 * gold/script-sections.h (Script_sections::release_segments): New
10655 method declaration.
10656 * gold/target.h (Target::may_relax, Target::relax,
10657 Target::do_may_relax, Target::do_relax): New method definitions.
10659 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10661 * arm.cc (has_signed_unsigned_overflow): New function.
10662 (Arm_relocate_functions::abs8): New function.
10663 (Target_arm::Scan::local): Handle R_ARM_ABS8.
10664 (Target_arm::Scan::global): Likewise.
10665 (Target_arm::relocate::relocate): Likewise.
10666 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10669 2009-09-16 Cary Coutant <ccoutant@google.com>
10671 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10672 * testsuite/Makefile.in: Regenerate.
10674 2009-09-11 Nick Clifton <nickc@redhat.com>
10676 * po/gold.pot: Updated by the Translation project.
10678 2009-09-08 Cary Coutant <ccoutant@google.com>
10680 * output.cc (Output_file::open): Add execute permission to empty file.
10681 * testsuite/Makefile.am (permission_test): New test.
10682 * testsuite/Makefile.in: Regenerate.
10684 2009-09-02 Ian Lance Taylor <iant@google.com>
10686 * output.cc (Output_file::resize): Call map_no_anonymous rather
10689 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
10691 * gold.cc: Include "incremental.h".
10692 (queue_initial_tasks): Call Incremental_checker methods.
10693 * incremental.cc: Include "output.h".
10694 (Incremental_checker::can_incrementally_link_output_file): New
10696 * incremental.h (Incremental_checker): New class.
10698 * output.cc (Output_file::open_for_modification): New method.
10699 (Output_file::map_anonymous): Changed return type to bool. Record
10700 map in base_ field.
10701 (Output_file::map_no_anonymous): New method, broken out of map.
10702 (Output_file::map): Use map_no_anonymous and map_anonymous.
10703 * output.h (class Output_file): Update declarations.
10705 2009-08-24 Cary Coutant <ccoutant@google.com>
10707 * options.h (Command_line::Pre_options): New class.
10708 (Command_line::pre_options): New member.
10709 * options.cc (gold::options::ready_to_register): New variable.
10710 (One_option::register_option): Do nothing if not registering options.
10711 Assert if same short option registered twice.
10712 (General_options::General_options): Turn off option registration when
10714 (Command_line::Pre_options::Pre_options): New constructor.
10716 2009-08-24 Cary Coutant <ccoutant@google.com>
10718 * options.h (General_options::no_keep_memory): Remove incorrect
10721 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10723 * Makefile.am (am__skiplex, am__skipyacc): New.
10724 * Makefile.in: Regenerate.
10726 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10728 * Makefile.am (AM_CPPFLAGS): Renamed from ...
10729 (INCLUDES): ... this.
10730 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10731 (AM_CPPFLAGS): Renamed from ...
10732 (INCLUDE): ... this.
10733 * Makefile.in, testsuite/Makefile.in: Regenerate.
10735 * Makefile.in: Regenerate.
10736 * aclocal.m4: Likewise.
10737 * config.in: Likewise.
10738 * configure: Likewise.
10739 * testsuite/Makefile.in: Likewise.
10741 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10742 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10743 * Makefile.in: Regenerate.
10744 * testsuite/Makefile.in: Regenerate.
10746 2009-08-19 Cary Coutant <ccoutant@google.com>
10748 * resolve.cc (Symbol_table::resolve): Don't complain about defined
10749 symbols in shared libraries overridden by hidden or internal symbols
10750 in the main program.
10752 2009-08-19 Chris Demetriou <cgd@google.com>
10754 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10755 checking source file names in error messages.
10757 2009-08-18 Doug Kwan <dougkwan@google.com>
10759 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10760 an elcpp::Ehdr as parameter. Adjust call to set_target.
10761 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10762 an elfcpp::Ehdr as parameter.
10763 * object.cc (Object::set_target): Remove the version that looks up
10764 a target and sets it.
10765 (Sized_relobj::setup): Take a Target object instead of
10766 an elfcpp::Ehdr as parameter. Adjust call to set_target.
10767 (make_elf_sized_object): Find target and ask target to
10768 make an ELF object.
10769 * object.h: (Object::set_target): Remove the version that looks up
10770 a target and sets it.
10771 (Sized_relobj::setup): Take a Target object instead of
10772 an elfcpp:Ehdr as parameter.
10773 * target.cc: Include dynobj.h.
10774 (Target::do_make_elf_object_implementation): New.
10775 (Target::do_make_elf_object): New.
10776 * target.h (Target::make_elf_object): New template declaration.
10777 (Target::do_make_elf_object): New method declarations.
10778 (Target::do_make_elf_object_implementation): New template declaration.
10780 2009-08-14 Ian Lance Taylor <iant@google.com>
10782 * gold.h (FUNCTION_NAME): Define.
10783 (gold_unreachable): Use FUNCTION_NAME.
10785 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10787 * icf.cc (Icf::find_identical_sections): Issue a warning when a
10788 symbol in the --keep-unique list is not found.
10790 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10792 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10793 been maked as --keep-unique.
10794 (Icf::unfold_section): New function.
10795 * icf.h (Icf::unfold_section): New function.
10796 * options.h (General_options::keep_unique): New option.
10797 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10798 * testsuite/Makefile.in: Regenerate.
10799 * testsuite/icf_keep_unique_test.sh: New file.
10800 * testsuite/icf_keep_unique_test.cc: New file.
10802 2009-08-12 Cary Coutant <ccoutant@google.com>
10805 * resolve.cc (Symbol_table::resolve): Check for references from
10806 dynamic objects to hidden and internal symbols.
10807 * testsuite/Makefile.am (hidden_test.sh): New test.
10808 * testsuite/Makefile.in: Regenerate.
10809 * testsuite/hidden_test.sh: New script.
10810 * testsuite/hidden_test_1.c: New test source.
10811 * testsuite/hidden_test_main.c: New test source.
10813 2009-08-11 Doug Kwan <dougkwan@google.com>
10815 * arm.cc: Update comments.
10816 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10817 segment to locate the .ARM.exidx section if present.
10819 2009-08-09 Doug Kwan <dougkwan@google.com>
10821 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10824 2009-08-07 Sriraman Tallam <tmsriram@google.com>
10825 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10828 2009-08-06 Sriraman Tallam <tmsriram@google.com>
10830 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10831 valid tls_segment only for non-debug-section relocations.
10832 * testsuite/Makefile.am: Add gc_tls_test.
10833 * testsuite/Makefile.in: Regenerate.
10834 * testsuite/gc_tls_test.cc: New file.
10835 * testsuite/gc_tls_test.sh: New file.
10837 2009-08-05 Sriraman Tallam <tmsriram@google.com>
10839 * icf.cc: New file.
10841 * Makefile.am (CCFILES): Add icf.cc.
10842 (HFILES): Add icf.h
10843 * Makefile.in: Regenerate.
10844 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10845 * gc.h (gc_process_relocs): Populate lists used by icf to contain
10846 section, symbol and addend information for the relocs.
10847 * gold.cc (queue_middle_tasks): Call identical code folding.
10848 * gold.h: Add defines for multimap.
10849 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10850 to the call of finalize_local_symbols.
10851 * main.cc (main): Create object of class Icf.
10852 * object.cc (Sized_relobj::do_layout): Allow this function to be
10853 called twice during icf.
10854 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10855 to sections marked as identical by icf.
10856 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10858 (Sized_relobj::do_section_entsize): New function.
10859 * object.h (Object::section_entsize): New function.
10860 (Object::do_section_entsize): New pure virtual function.
10861 (Relobj::finalize_local_symbols): Add new parameter.
10862 (Relobj::do_section_entsize): New function.
10863 * options.h (General_options::icf): New option.
10864 (General_options::icf_iterations): New option.
10865 (General_options::print_icf_sections): New option.
10866 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10867 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10868 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10870 * symtab.cc (Symbol_table::is_section_folded): New function.
10871 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
10872 to sections marked as identical by icf.
10873 * symtab.h (Symbol_table::set_icf): New function.
10874 (Symbol_table::icf): New function.
10875 (Symbol_table::is_section_folded): New function.
10876 (Symbol_table::icf_): New data member.
10877 * target-reloc.h (relocate_section): Ignore sections folded by icf.
10878 * testsuite/Makefile.am: Add commands to build icf_test.
10879 * testsuite/Makefile.in: Regenerate.
10880 * testsuite/icf_test.sh: New file.
10881 * testsuite/icf_test.cc: New file.
10883 2009-07-24 Chris Demetriou <cgd@google.com>
10885 * layout.cc (is_compressible_debug_section): Fix incorrect
10886 comment about compressed section names.
10888 2009-07-20 Ian Lance Taylor <ian@airs.com>
10891 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10893 2009-07-16 Ian Lance Taylor <iant@google.com>
10896 * layout.h: #include <map>.
10897 (class Kept_section): Change from struct to class. Add accessors
10898 and setters. Add section size to Comdat_group mapping. Change
10899 Comdat_group to std::map. Add is_comdat_ field. Add
10900 linkonce_size field in union.
10901 (class Layout): Update declaration of find_or_add_kept_section.
10902 Don't declare find_kept_object.
10903 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10904 parameter. Add object, shndx, is_comdat, and is_group_name
10905 parameters. Change all callers. Adjust for new Kept_section.
10906 (Layout::find_kept_object): Remove.
10907 * object.cc (Sized_relobj::include_section_group): Update use of
10908 Kept_section. Rename secnum to shndx. Only record
10909 Kept_comdat_section if sections are the same size.
10910 (Sized_relobj::include_linkonce_section): Update use of
10911 Kept_section. Only record Kept_comdat_section if sections are the
10912 same size. Set size of linkonce section.
10913 (Sized_relobj::map_to_kept_section): Update call to
10914 get_kept_comdat_section.
10915 * object.h (class Sized_relobj): Rename fields in
10916 Kept_comdat_section to drop trailing underscores; change object
10917 field to Relobj*. Change Kept_comdat_section_table to store
10918 struct rather than pointer.
10919 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10920 Add kept_object and kept_shndx parameters. Change all callers.
10921 (Sized_relobj::get_kept_comdat_section): Change return type to
10922 bool. Add kept_object and kept_shndx parameters. Change all
10924 * plugin.cc (Pluginobj::include_comdat_group): Update call to
10925 Layout::find_or_add_kept_section.
10927 2009-07-09 Ian Lance Taylor <iant@google.com>
10929 * merge.cc (Object_merge_map::initialize_input_to_output_map):
10930 Reserve space in the hash table.
10932 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
10934 * fileread.cc (File_read::get_mtime): New method.
10935 * fileread.h (Timespec): New structure.
10936 (File_read::get_mtime): New method.
10937 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10938 Renamed from timestamp_nsec.
10939 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10941 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10943 (Incremental_inputs::report_archive): Save mtime; style fix.
10944 (Incremental_inputs::report_obejct): Save mtime; style fix.
10945 (Incremental_inputs::report_script): Save mtime; style fix.
10946 (Incremental_inputs::finalize_inputs): Style fix.
10947 (Incremental_inputs::finalize): Style fix.
10948 (Incremental_inputs::create_input_section_data): Store inputs
10950 * incremental.h (Incremental_inputs::report_script): Add mtime
10952 (Incremental_inputs::Input_info::Input_info): Intialize only one
10954 (Incremental_inputs::Input_info::archive): Move to nameless
10956 (Incremental_inputs::Input_info::obejct): Move to nameless union.
10957 (Incremental_inputs::Input_info::script): Move to nameless union.
10958 (Incremental_inputs::mtime): New field.
10959 * script.cc (read_input_script): Pass file mtime to
10961 * script.h (Script_info::inputs): Style fix.
10963 2009-07-01 Ian Lance Taylor <ian@airs.com>
10965 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10968 2009-06-24 Ian Lance Taylor <iant@google.com>
10971 * layout.cc (Layout::choose_output_section): If we find an
10972 existing section, update the flags.
10973 (Layout::create_notes): New function, broken out of
10975 (Layout::finalize): Don't create note sections.
10976 (Layout::create_note): Don't crash if linker script discards
10978 (Layout::create_gold_note): Likewise.
10979 (Layout::create_build_id): Likewise. Don't set
10980 after_input_sections on the section.
10981 (Layout::create_executable_stack_info): Remove target parameter.
10983 * layout.h (class Layout): Declare create_notes. Update
10984 declaration of create_executable_stack_info.
10985 * gold.cc (queue_middle_tasks): Call create_notes.
10986 * output.cc (Output_section::update_flags_for_input_section): Move
10987 here from output.h. If SHF_ALLOC flag is newly set, mark address
10989 * output.h (Output_data::mark_address_invalid): New function.
10990 (class Output_section): Only declare, not define,
10991 update_flags_for_input_section. Remove set_flags.
10993 2009-06-24 Ian Lance Taylor <iant@google.com>
10995 * script-sections.cc (Output_section_definition::
10996 set_section_addresses): Rename shadowing local load_address to
10999 2009-06-24 Ian Lance Taylor <iant@google.com>
11002 * reloc.cc (relocate_sections): Skip empty relocation sections.
11004 2009-06-23 Ian Lance Taylor <iant@google.com>
11007 * layout.cc (Layout::create_note): Use choose_output_section
11008 rather than make_output_section.
11010 2009-06-23 Ian Lance Taylor <iant@google.com>
11013 * options.cc (General_options::parse_V): Set printed_version_.
11014 (General_options::General_options): Initialize printed_version_.
11015 * options.h (class General_options): Add printed_version_ field.
11016 * gold.cc (queue_initial_tasks): If there are no input files,
11017 don't give a fatal error if we printed the version information.
11018 (queue_middle_tasks): If using -r with a shared object, give a
11019 fatal error rather than an ordinary error.
11021 2009-06-23 Ian Lance Taylor <iant@google.com>
11024 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11025 (Layout::make_output_section): Set have_stabstr_section_ if we see
11026 a .stab*str section.
11027 (Layout::finalize): Call link_stabs_sections.
11028 (Layout::link_stabs_sections): New file.
11029 * layout.h (class Layout): Add have_stabstr_section_ field.
11030 Declare link_stabs_sections.
11032 2009-06-23 Doug Kwan <dougkwan@google.com>
11034 * Makefile.am (libgold_a_LIBADD): New.
11035 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11036 * Makefile.in: Regenerate.
11037 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11038 * configure: Regenerate.
11039 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11040 * fileread.cc: Include sys/state.h
11041 * gold.h: Declare memmem and strndup if found missing.
11042 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11044 2009-06-23 Ian Lance Taylor <iant@google.com>
11046 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11047 * configure: Rebuild.
11049 2009-06-23 Ian Lance Taylor <iant@google.com>
11052 * object.cc (Object::section_contents): Don't try to get a view if
11053 the section has length zero.
11054 (Object::handle_gnu_warning_section): If the section is empty, use
11055 the name of the section as the warning.
11057 2009-06-23 Ian Lance Taylor <iant@google.com>
11060 * stringpool.h (class Stringpool_template): Add optimize_ field.
11061 (Stringpool_template::set_optimize): New function.
11062 * stringpool.cc (Stringpool_template::Stringpool_template):
11063 Initialize optimize_ field.
11064 (Stringpool_template::set_string_offsets): Test local optimize
11065 fild rather than parameter.
11066 * layout.cc (Layout::Layout): Call set_optimize on the section
11069 2009-06-22 Ian Lance Taylor <iant@google.com>
11072 * yyscript.y: Parse TARGET.
11073 * script.cc (script_set_target): New function.
11074 * script-c.h (script_set_target): Declare.
11075 * options.cc (General_options::string_to_object_format): Rename
11076 from string_to_object_format in anonymous namespace. Change
11078 * options.h (class General_options): Declare
11079 string_to_object_format.
11081 2009-06-22 Ian Lance Taylor <iant@google.com>
11083 * script-sections.cc (Script_sections::create_segments): Don't put
11084 program headers in a PT_LOAD segment if -n or -N.
11086 2009-06-22 Ian Lance Taylor <iant@google.com>
11089 * options.h (class General_options): Add -z lazy and -z now. Sort
11090 -z options into alphabetical order.
11091 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11093 2009-06-21 Ian Lance Taylor <iant@google.com>
11095 * layout.cc (Layout::make_output_section): Call
11096 Target::new_output_section.
11097 (Layout::attach_allocated_section_to_segment): Put large section
11098 sections in a separate load segment with the large segment flag
11100 (Layout::segment_precedes): Sort large data segments after other
11102 (align_file_offset): New static function.
11103 (Layout::set_segment_offsets): Use align_file_offset.
11104 * output.h (class Output_section): Add is_small_section_ and
11105 is_large_section_ fields.
11106 (Output_section::is_small_section): New function.
11107 (Output_section::set_is_small_section): New function.
11108 (Output_section::is_large_section): New function.
11109 (Output_section::set_is_large_section): New function.
11110 (Output_section::is_large_data_section): New function.
11111 (class Output_segment): Add is_large_data_segment_ field.
11112 (Output_segment::is_large_data_segment): New function.
11113 (Output_segment::set_is_large_data_segment): New function.
11114 * output.cc (Output_section::Output_section): Initialize new
11116 (Output_segment::Output_segment): Likewise.
11117 (Output_segment::add_output_section): Add assertion that large
11118 data sections always go in large data segments. Force small data
11119 sections to the end of the list of data sections. Force small BSS
11120 sections to the start of the list of BSS sections. For large BSS
11121 sections to the end of the list of BSS sections.
11122 * symtab.h (class Symbol): Declare is_common_shndx.
11123 (Symbol::is_defined): Check Symbol::is_common_shndx.
11124 (Symbol::is_common): Likewise.
11125 (class Symbol_table): Define enum Commons_section_type. Update
11126 declarations. Add small_commons_ and large_commons_ fields.
11127 * symtab.cc (Symbol::is_common_shndx): New function.
11128 (Symbol_table::Symbol_table): Initialize new fields.
11129 (Symbol_table::add_from_object): Put small and large common
11130 symbols in the right list.
11131 (Symbol_table::sized_finalized_symbol): Check
11132 Symbol::is_common_shndx.
11133 (Symbol_table::sized_write_globals): Likewise.
11134 * common.cc (Symbol_table::do_allocate_commons): Allocate new
11135 common symbol lists. Don't call do_allocate_commons_list if the
11137 (Symbol_table::do_allocate_commons_list): Remove is_tls
11138 parameter. Add comons_section_type parameter. Change all
11139 callers. Handle small and large common symbols.
11140 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11141 Symbol::is_common_shndx.
11142 * resolve.cc (symbol_to_bits): Likewise.
11143 * target.h (Target::small_common_shndx): New function.
11144 (Target::small_common_section_flags): New function.
11145 (Target::large_common_shndx): New function.
11146 (Target::large_common_section_flags): New function.
11147 (Target::new_output_section): New function.
11148 (Target::Target_info): Add small_common_shndx, large_common_shndx,
11149 small_common_section_flags, and large_common_section_flags
11151 (Target::do_new_output_section): New virtual function.
11152 * arm.cc (Target_arm::arm_info): Initialize new fields.
11153 * i386.cc (Target_i386::i386_info): Likewise.
11154 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11156 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11157 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11158 (Target_x86_64::do_new_output_section): New function.
11159 * configure.ac: Define conditional MCMODEL_MEDIUM.
11160 * testsuite/Makefile.am (check_PROGRAMS): Add large.
11161 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11162 (large_LDFLAGS): Define.
11163 * testsuite/large.c: New file.
11164 * testsuite/testfile.cc (Target_test::test_target_info):
11165 Initialize new fields.
11166 * configure, testsuite/Makefile.in: Rebuild.
11168 2009-06-05 Doug Kwan <dougkwan@google.com>
11170 * Makefile.am (CCFILES): Add target.cc.
11171 * Makefile.in: Regenerate.
11172 * i386.cc (class Target_i386): Define new virtual method to
11173 override do_is_local_label_name in parent.
11174 * object.cc (Sized_relobj::do_count_local_symbols): Discard
11175 local symbols if --discard-locals or -X is given.
11176 * options.h (class General_options): Declare new options
11177 '--discard-locals' and '-X' for discarding locals.
11178 * target.h (class Target): Define new methods is_local_label_name.
11179 Declare new virtual method do_is_local_label_name.
11180 * target.cc: New file.
11181 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11182 (check_SCRIPTS): Add discard_locals_test.sh.
11183 (check_DATA): Add discard_local_tests.syms.
11184 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11185 (discard_local_tests.syms, discard_locals_test.o): New make rules.
11186 * testsuite/Makefile.in: Regenerate.
11187 * testsuite/discard_locals_test.c: New file.
11188 * testsuite/discard_locals_test.sh: Same.
11190 2009-06-05 Doug Kwan <dougkwan@google.com>
11192 * object.cc (Sized_relobj::Sized_relobj): Initialize
11193 discarded_eh_frame_shndx_ to -1U.
11194 (Sized_relobj::do_layout): Record index of a discard .eh_frame
11196 (Sized_relobj::do_count_local_symbols): Skip local symbols in
11197 a discarded .eh_frame section.
11198 (Sized_relobj::do_finalize_local_symbols): Ditto.
11199 * object.h (class Sized_relobj): Declare new member
11200 discarded_eh_frame_shndx_.
11201 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11202 (local_labels_test.o, local_labels_test): New rules.
11203 * testsuite/Makefile.in: Regenerate.
11205 2009-06-04 Doug Kwan <dougkwan@google.com>
11207 * layout.cc (Layout::section_name_mapping): Add mapping for
11208 special ARM sections.
11210 2009-06-03 Doug Kwan <dougkwan@google.com>
11212 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11213 (utils::has_overflow): Same.
11215 2009-06-03 Ian Lance Taylor <iant@google.com>
11217 * layout.cc (Layout::section_name_mapping): New array, replacing
11218 Layout::linkonce_mapping.
11219 (Layout::section_name_mapping_count): New variable, replacing
11220 Layout::linkonce_mapping_count.
11221 (Layout::linkonce_output_name): Remove.
11222 (Layout::output_section_name): Rewrite.
11223 * layout.h (class Layout): Rename Linkonce_mapping to
11224 Section_name_mapping, linkonce_mapping to section_name_mapping,
11225 linkonce_mapping_count to section_name_mapping_count. Don't
11226 declare linkonce_output_name.
11228 2009-06-03 Doug Kwan <dougkwan@google.com>
11230 * gold/arm.cc (namespace utils): New.
11231 (Target_arm::reloc_is_non_pic): Define new method.
11232 (class Arm_relocate_functions): New.
11233 (Target_arm::Relocate::relocate): Handle relocation types used by
11236 2009-06-03 Ian Lance Taylor <iant@google.com>
11238 * arm.cc (Target_arm::scan::global): Use || instead of |.
11240 2009-06-02 Doug Kwan <dougkwan@google.com>
11242 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
11243 issued_non_pic_error_.
11244 (class Target_arm::Scan): Declare new method check_non_pic.
11245 Define new method symbol_needs_plt_entry.
11246 Declare new data member issued_non_pic_error_.
11247 (class Target_arm::Relocate): Declare new method
11248 should_apply_static_reloc.
11249 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11250 (Target_arm::Scan::check_non_pic): Define new method.
11251 (Target_arm::Scan::local): Handle a small subset of reloc types used
11253 (Target_arm::Scan::local): Same.
11254 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11256 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
11258 * incremental.cc (Incremental_inputs::report_command_line): Filter
11259 out --incremental-* options.
11261 2009-05-29 Doug Kwan <dougkwan@google.com>
11263 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11265 (class Target_arm): Update comment.
11266 (Target_arm::Target_arm): Initialize new data members GOT_,
11267 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11268 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11269 and Target_arm::rel_dyn_section.
11270 Declare new_enum Target_arm::Got_type.
11271 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11273 Update commments for member do_dynsym_value.
11274 (Target_arm::got_size, Target_arm::plt_section,
11275 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11276 new methods inside class defintion.
11277 (Target_arm::got_section): Define new method.
11278 (Target_arm::rel_dyn_section): Same.
11279 (Output_data_plt_arm): New template class.
11280 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11281 (Output_data_plt_arm:do_adjust_output_section): Define new method.
11282 (Output_data_plt_arm::add_entry): Same.
11283 (Output_data_plt_arm::first_plt_entry): Define new
11284 static data member for PLT instruction template.
11285 (Output_data_plt_arm::plt_entry): Same.
11286 (Output_data_plt_arm::do_write): Define new method.
11287 (Target_arm::make_plt_entry): Same.
11288 (Target_arm::do_finalize_sections): Same.
11289 (Target_arm::do_dynsym_value): Same.
11291 2009-05-28 Doug Kwan <dougkwan@google.com>
11293 * Makefile.am (TARGETSOURCES): Add arm.cc.
11294 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11295 * Makefile.in: Regenerate.
11296 * arm.cc: New file.
11297 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11299 2009-05-26 Doug Kwan <dougkwan@google.com>
11301 * options.cc (General_options::parse_exclude_libs). Fix a comment.
11302 (General_options::check_excluded_libs): Strip off directories in
11303 archive name before matching like GNU ld does.
11304 * testsuite/Makefile.am (MOSTLYCLEANFILES,
11305 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11306 (exclude_libs_test_LDFLAGS): Add linker option
11307 -Wl,--exclude-libs,libexclude_libs_test_3
11308 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11309 an explicit archive without using -l.
11310 (alt/libexclude_libs_test_3.a): New make rule.
11311 * testsuite/Makefile.in: Regenerate.
11312 * testsuite/exclude_libs_test.c : Declare lib3_default().
11314 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11315 * exclude_libs_test_3.c: New file.
11317 2009-05-26 Nick Clifton <nickc@redhat.com>
11319 * po/id.po: New Indonesian translation.
11320 * po/gold.pot: Updated template file.
11322 2009-05-22 Sriraman Tallam <tmsriram@google.com>
11324 * testsuite/Makefile.am: Add -ffunction-sections to compile
11325 gc_comdat_test files. Add -Wl,--gc-sections to build
11327 * testsuite/Makefile.in: Regenerate.
11328 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11330 2009-05-21 Sriraman Tallam <tmsriram@google.com>
11332 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11333 kept comdat section was garbage collected.
11334 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11335 * testsuite/Makefile.in: Regenerate.
11336 * testsuite/gc_comdat_test.sh: New file.
11337 * testsuite/gc_comdat_test_1.cc: New file.
11338 * testsuite/gc_comdat_test_2.cc: New file.
11340 2009-05-19 Doug Kwan <dougkwan@google.com>
11342 * archive.cc (Archive::Archive): Move constructor from archive.h
11343 to here. Initialize no_export_.
11344 (Archive::get_elf_object_for_member): Set no_export flag of object.
11345 * archive.h (Archive::Archive): Move constructor body to
11347 (Archive::no_export): New method.
11348 (Archive::no_export_): New field.
11349 * object.h (Object::Object): Initialize no_export_ to false.
11350 (Object::no_export, Object::set_no_export): New methods.
11351 (Object::no_export_): New field.
11352 * options.cc (General_options::parse_exclude_libs): New method.
11353 (General_options::check_excluded_libs) Same.
11354 * options.h (exclude_libs): New option.
11355 (General_options::check_excluded_libs): New method declaration.
11356 (General_options::excluded_libs_): New field.
11357 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11358 default or protected visibility if an object has no-export flag set.
11359 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11360 (check_SCRIPTS): Add exclude_libs_test.sh.
11361 (check_DATA): Add exclude_libs_test.syms.
11362 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11363 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11364 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11365 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11366 (exclude_libs_test.syms, libexclude_libs_test_1.a,
11367 libexclude_libs_test_2.a): New rules.
11368 * testsuite/Makefile.in: Regenerate.
11369 * testsuite/exclude_libs_test.c: New file.
11370 * testsuite/exclude_libs_test.sh: Ditto.
11371 * testsuite/exclude_libs_test_1.c: Ditto.
11372 * testsuite/exclude_libs_test_2.c: Ditto.
11374 2009-05-15 Ian Lance Taylor <iant@google.com>
11376 * configure.ac: Check for declarations for cases where libiberty.h
11377 checks HAVE_DECL_xxx.
11378 * configure, config.in: Rebuild.
11380 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
11382 * gold.h (Incremental_argument_list): Remove (invalid) forward
11384 * incremental.cc (Incremental_inputs::report_achive): New method.
11385 (Incremental_inputs::report_object): New method.
11386 (Incremental_inputs::report_script): New method.
11387 (Incremental_inputs::finalize_inputs): New method.
11388 (Incremental_inputs::finalize): Call finalize_inputs().
11389 (Incremental_inputs::sized_create_incremental_inputs_section_data):
11390 Create inputs entries.
11391 * incremental.h (Incremental_input_type): New enum.
11392 (Incremental_inputs::Incremental_input): Initialize new fields.
11393 (Incremental_inputs::report_inputs): New method.
11394 (Incremental_inputs::report_achive): New method.
11395 (Incremental_inputs::report_object): New method.
11396 (Incremental_inputs::report_script): New method.
11397 (Incremental_inputs::finalize_inputs): New method.
11398 (Incremental_inputs::Input_info): New struct.
11399 (Incremental_inputs::Input_info_map): New typedef.
11400 (Incremental_inputs::lock_): New field.
11401 (Incremental_inputs::Inputs_): New field.
11402 (Incremental_inputs::Inputs_map): New field.
11403 * main.cc (main): Call Incremental_input::report_inputs.
11404 * options.h (Input_argument_list): Typedef moved from
11406 (Input_file_group::Files): Remove, use ::Input_argument_list.
11407 (Input_file_group::Input_argument_list): Remove, use
11408 ::Input_argument_list.
11409 * plugin.cc (Plugin_manager::add_input_file): Add error in
11411 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11413 * script.cc (read_input_script): Call
11414 Incremental_input::report_script.
11415 * script.h (Script_info): New class.
11417 2009-04-27 Ian Lance Taylor <iant@google.com>
11419 * x86_64.cc (do_adjust_output_section): Set entsize to
11422 2009-04-23 Elliott Hughes <enh@google.com>
11424 * output.cc (Output_file::close): After short writes, continue
11425 writing from the correct offset in the buffer being written.
11427 2009-04-23 Chris Demetriou <cgd@google.com>
11429 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11430 * configure: Regenerate.
11431 * config.in: Regenerate.
11432 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11433 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11435 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
11437 * incremental.cc (Incremental_inputs_header_data): Renamed from
11438 Incremental_input_header_data.
11439 (Incremental_inputs_header_data::data_size): New field.
11440 (Incremental_inputs_header_data::put_input_file_count): Renamed
11441 from input_file_count.
11442 (Incremental_inputs_header_data::put_command_line_offset): Renamed
11443 from command_line_offset.
11444 (Incremental_inputs_header_data::put_reserved): Renamed from
11446 (Incremental_inputs_entry_data): Renamed from
11447 Incremental_input_entry_data.
11448 (Incremental_inputs_entry_data::data_size): New field.
11449 (Incremental_inputs::report_command_line): New method.
11450 (Incremental_inputs::finalize): New method.
11451 (Incremental_inputs::create_incremental_inputs_data): New method.
11452 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11453 * incremental.h: New file.
11454 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11455 (Layout::finalize): Create incremental inputs section in
11456 incremental builds.
11457 (Layout::create_incremental_info_sections): New method.
11458 * layout.h (Layout::incremental_inputs): New method.
11459 (Layout::create_incremental_info_sections): New method.
11460 (Layout::incremental_inputs_): New field.
11461 * main.cc (main): Notify Incremental_input of the command line.
11463 2009-04-01 Ian Lance Taylor <iant@google.com>
11464 Mikolaj Zalewski <mikolajz@google.com>
11466 * gold.h (reserve_unordered_map): Define, three versions, one for
11467 each version of Unordered_map.
11468 * layout.cc (Layout::Layout): Remove options parameter. Add
11469 number_of_input_files parameter. Don't initialize options_.
11470 Initialize number_of_input_files_ and resized_signatures_. Move
11471 sections_are_attached_.
11472 (Layout::layout_group): Reserve space for group_signatures_.
11473 (Layout::find_or_add_kept_section): Change name parameter to be a
11474 reference. Resize signatures_ map when it gets large enough.
11475 (Layout::layout_eh_frame): Use parameters->options() instead of
11477 (Layout::make_output_section): Likewise.
11478 (Layout::attach_allocated_section_to_segment): Likewise.
11479 (Layout::finalize, Layout::create_executable_stack): Likewise.
11480 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11481 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11482 * layout.h (class Layout): Update declarations. Remove options_
11483 field. Add number_of_input_files_ and resized_signatures_
11484 fields. Move sections_are_attached_ field.
11485 * main.cc (main): Pass number of input files to Layout
11486 constructor. Don't pass options.
11488 2009-03-30 Ian Lance Taylor <iant@google.com>
11490 * ffsll.c (ffsll): Correct implementation.
11492 2009-03-27 Ian Lance Taylor <iant@google.com>
11494 * ffsll.c: New file.
11495 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11496 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11497 * ftruncate.c (ftruncate): Declare before definition.
11498 * mremap.c (mremap): Likewise.
11499 * pread.c (pread): Likewise.
11500 * configure, Makefile.in, config.in: Rebuild.
11502 * mremap.c: New file.
11503 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11504 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11505 (mremap): Declare if HAVE_MREMAP is not defined.
11506 * configure, Makefile.in, config.in: Rebuild.
11508 2009-03-27 Cary Coutant <ccoutant@google.com>
11510 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11511 position independent.
11512 * sparc.cc (Target_sparc::check_non_pic): Likewise.
11513 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11515 2009-03-24 Cary Coutant <ccoutant@google.com>
11517 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11519 (needs_dynamic_reloc): Likewise.
11521 2009-03-24 Ian Lance Taylor <iant@google.com>
11523 * yyscript.y (file_cmd): Recognize EXTERN.
11524 (extern_name_list, extern_name_list_body): New nonterminals.
11525 * script.cc (script_add_extern): Define.
11526 * script-c.h (script_add_extern): Declare.
11528 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
11530 * object.cc (is_elf_object): Define.
11531 * object.h (is_elf_object): Declare.
11532 * archive.cc (Archive::get_elf_object_for_member): Call
11534 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11536 2009-03-24 Elliott Hughes <enh@google.com>
11538 * output.cc (Output_file::map_anonymous): Define.
11539 (Output_file::map): Use map_anonymous. If the regular mmap fails,
11540 try an anonymous one. Report the size if the mmap fails.
11541 * output.h (class Output_file): Declare map_anonymous.
11543 2009-03-24 Ian Lance Taylor <iant@google.com>
11545 * target-select.cc (instantiate_target): Don't acquire the lock if
11546 the instantiated_target_ field has already been set.
11548 2009-03-23 Ian Lance Taylor <iant@google.com>
11550 * gold-threads.h (class Initialize_lock): Define.
11551 * gold-threads.cc (class Initialize_lock_once): Define.
11552 (initialize_lock_control): New static variable.
11553 (initialize_lock_pointer): New static variable.
11554 (initialize_lock_once): New static function.
11555 (Initialize_lock::Initialize_lock): Define.
11556 (Initialize_lock::initialize): Define.
11557 * target-select.h: Include "gold-threads.h".
11558 (class Target_selector): Add lock_ and initialize_lock_ fields.
11559 Don't define instantiate_target, just declare it.
11560 * target-select.cc (Target_selector::Target_selector): Initialize
11562 (Target_selector::instantiate_target): Define.
11563 * descriptors.h: Include "gold-threads.h".
11564 (class Descriptors): Add initialize_lock_ field.
11565 * descriptors.cc (Descriptors::Descriptors): Initialize new
11567 (Descriptors::open): Use initialize_lock_ field
11568 * errors.h (class Errors): Add initialize_lock_ field.
11569 * errors.cc (Errors::Errors): Initialize new field.
11570 (Errors::initialize_lock): Use initialize_lock_ field.
11571 * powerpc.cc (class Target_selector_powerpc): Remove
11572 instantiated_target_ field. In do_recognize call
11573 instantiate_target rather than do_instantiate_target. In
11574 do_instantiate_target just allocate a new target.
11575 * sparc.cc (class Target_selector_sparc): Likewise.
11577 * freebsd.h: New file.
11578 * i386.cc: Include "freebsd.h".
11579 (Target_i386): Derive from Target_freebsd rather than
11581 (Target_selector_i386): Derive from Target_selector_freebsd rather
11582 than Target_selector.
11583 * x86_64.cc: Include "freebsd.h".
11584 (Target_x86_64): Derive from Target_freebsd rather than
11586 (Target_selector_x86_64): Derive from Target_selector_freebsd
11587 rather than Target_selector.
11588 * target.h (class Target): Add adjust_elf_header and
11589 do_adjust_elf_header.
11590 * output.cc (Output_file_header:: do_sized_write): Call target
11591 adjust_elf_header routine.
11592 * configure.tgt: Set targ_osabi.
11593 * configure.ac: Define GOLD_DEFAULT_OSABI.
11594 * parameters.cc (Parameters::default_target): Pass
11595 GOLD_DEFAULT_OSABI to select_target.
11596 * target-select.h (class Target_selector): Make instantiate_target
11597 protected rather than private.
11598 * Makefile.am (HFILES): Add freebsd.h.
11599 * configure, Makefile.in, config.in: Rebuild.
11601 * merge.cc (do_add_input_section): Correct pend value. Change
11602 message about last entry not being null terminated from error to
11605 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
11607 * incremental.cc: New file.
11608 * Makefile.am (CCFILES): Add incremental.cc.
11609 * Makefile.in: Rebuild.
11611 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
11613 * layout.cc (Layout::output_section_name): Preserve names
11614 of '.note.' sections.
11616 2009-03-19 Ian Lance Taylor <iant@google.com>
11618 * descriptors.cc (Descriptors::open): Check that the options are
11619 valid before using them.
11621 2009-03-18 Ian Lance Taylor <iant@google.com>
11623 * script-sections.h: Include <list>.
11624 (class Script_sections): Change Sections_elements from std::vector
11625 to std::list. Typedef public Elements_iterator. Add
11626 orphan_section_placement_, data_segment_align_start_, and
11627 saw_data_segment_align_ fields. Remove data_segment_align_index_
11629 * script-sections.cc (class Orphan_section_placement): New class.
11630 (class Sections_element): Add virtual functions is_relro and
11631 orphan_section_init. Remove virtual function place_orphan_here.
11632 (class Output_section_definition): Add is_relro and
11633 orphan_section_init. Remove place_orphan_here.
11634 (class Orphan_output_section): Likewise.
11635 (Script_sections::Script_sections): Update for field changes.
11636 (Script_sections::data_segment_align): Set saw_data_segment_align_
11637 and data_segment_align_start_, not data_segment_align_index.
11638 (Script_sections::data_segment_relro_end): Check
11639 saw_data_segment_align_. Use data_segment_align_start_ rather
11640 than data_segment_align_index_.
11641 (Script_sections::place_orphan): Rewrite to use
11642 Orphan_section_placement.
11644 2009-03-17 Ian Lance Taylor <iant@google.com>
11646 * archive.cc (Archive::add_symbols): Check for a version attached
11647 to the symbol name in the archive map.
11648 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11649 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11650 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11651 (ver_test_11.a): New target.
11652 * testsuite/Makefile.in: Rebuild.
11654 * configure.ac: Check for chsize and posix_fallocate. Replace
11656 * ftruncate.c: New file, from gnulib.
11657 * output.cc (posix_fallocate): Define dummy version if not
11658 HAVE_POSIX_FALLOCATE.
11659 (Output_file::map): Call posix_fallocate rather than lseek and
11661 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11662 * configure, Makefile.in, config.in: Rebuild.
11664 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
11666 * layout.h (Layout::create_note): Add section_name parameter.
11667 * layout.cc (Layout::create_note): Likewise.
11668 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11670 2009-03-17 Ian Lance Taylor <iant@google.com>
11672 * descriptors.cc: Include "options.h".
11673 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11674 (Descriptors::open): Always use O_CLOEXEC when opening a new
11675 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
11676 then set FD_CLOEXEC.
11678 * sparc.cc (class Target_sparc): Add has_got_section.
11679 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11680 make sure we have a GOT section.
11682 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11683 (Target_sparc::Scan::local): Likewise.
11684 (Target_sparc::Scan::global): Likewise.
11685 (Target_sparc::Relocate::relocate): Likewise.
11686 (Target_sparc::Relocate::relocate_tls): Likewise.
11688 * symtab.cc (Symbol_table::define_default_version): New function,
11689 broken out of add_from_object.
11690 (Symbol_table::add_from_object): Call define_default_version.
11691 (Symbol_table::define_special_symbol): Add resolve_oldsym
11692 parameter. Change all callers. If the version for a symbol comes
11693 from a version script, resolve it with the symbol with the same
11694 name with no version. Also add the symbol without a version if
11696 (do_define_in_output_data): If resolving with oldsym, don't delete
11698 (do_define_in_output_segment): Likewise.
11699 (do_define_as_constant): Likewise.
11700 * symtab.h (class Symbol_table): Update declarations.
11702 2009-03-13 Ian Lance Taylor <iant@google.com>
11704 * readsyms.cc (Read_symbols::incompatible_warning): New function.
11705 (Read_symbols::requeue): New function.
11706 (Read_symbols::do_read_symbols): If make_elf_object fails because
11707 the target type is not configured, and the file was searched for,
11708 issue a warning and retry with the next directory.
11709 (Add_symbols::run): If the file has an incompatible format, and
11710 it was searched for, requeue the Read_symbols task. On error,
11711 release the object.
11712 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
11713 dirindex parameter to constructor. Change all callers. Declare
11714 incompatible_warning and requeue.
11715 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11716 input_argument_ and input_group_ fields. Add them to
11717 constructor. Change all callers.
11718 (class Read_script): Add dirindex_ field. Add it to constructor.
11719 Change all callers.
11720 * archive.cc (Archive::setup): Remove input_objects parameter.
11721 Change all callers.
11722 (Archive::get_file_and_offset): Likewise.
11723 (Archive::read_all_symbols): Likewise.
11724 (Archive::read_symbols): Likewise.
11725 (Archive::get_elf_object_for_member): Remove input_objects
11726 parameter. Add punconfigured parameter. Change all callers.
11727 (Archive::add_symbols): Change return type to bool. Check return
11728 value of include_member.
11729 (Archive::include_all_members): Likewise.
11730 (Archive::include_member): Change return type to bool. Return
11731 false if first included object has incompatible target. Set
11732 included_member_ field.
11733 (Add_archive_symbols::run): If add_symbols returns false, requeue
11735 * archive.h (class Archive): Add included_member_ field.
11736 Initialize it in constructor. Add input_file and searched_for
11737 methods. Update declarations.
11738 (class Add_archive_symbols): Add dirpath_, dirindex_, and
11739 input_argument_ fields. Add them to constructor. Change all
11741 * script.cc: Include "target-select.h".
11742 (class Parser_closure): Add skip_on_incompatible_target_ and
11743 found_incompatible_target_ fields. Add
11744 skip_on_incompatible_target parameter to constructor. Change all
11745 callers. Add methods skip_on_incompatible_target,
11746 clear_skip_on_incompatible_target, found_incompatible_target, and
11747 set_found_incompatible_target.
11748 (read_input_script): Add dirindex parameter. Change all callers.
11749 If parser finds an incompatible target, requeue Read_symbols
11751 (script_set_symbol): Clear skip_on_incompatible_target in
11753 (script_add_assertion, script_parse_option): Likewise.
11754 (script_start_sections, script_add_phdr): Likewise.
11755 (script_check_output_format): New function.
11756 * script.h (read_input_script): Update declaration.
11757 * script-c.h (script_check_output_format): Declare.
11758 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11759 (ignore_cmd): Remove OUTPUT_FORMAT.
11760 * fileread.cc (Input_file::Input_file): Add explicit this.
11761 (Input_file::will_search_for): New function.
11762 (Input_file::open): Add pindex parameter. Change all callers.
11763 * fileread.h (class Input_file): Add input_file_argument method.
11764 Declare will_search_for. Update declarations.
11765 * object.cc (make_elf_object): Add punconfigured parameter.
11766 Change all callers.
11767 * object.h (class Object): Make input_file public. Add
11768 searched_for method.
11769 (make_elf_object): Update declaration.
11770 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
11772 * dirsearch.h (class Dirsearch): Update declaration.
11773 * options.h (class General_options): Add --warn-search-mismatch.
11774 * parameters.cc (Parameters::is_compatible_target): New function.
11775 * parameters.h (class Parameters): Declare is_compatible_target.
11776 * workqueue.cc (Workqueue::add_blocker): New function.
11777 * workqueue.h (class Workqueue): Declare add_blocker.
11779 * fileread.cc (Input_file::open): Remove options parameter.
11780 Change all callers.
11781 (Input_file::open_binary): Likewise.
11782 * script.cc (read_input_script): Likewise.
11783 * readsyms.h (class Read_symbols): Remove options_ field. Remove
11784 options parameter from constructor. Change all callers.
11785 (class Read_script): Likewise.
11786 * fileread.h (class Input_file): Update declarations.
11787 * script.h (read_input_script): Update declaration.
11789 2009-03-10 Nick Clifton <nickc@redhat.com>
11791 * po/es.po: New Spanish translation.
11793 2009-03-06 Cary Coutant <ccoutant@google.com>
11795 * options.cc (parse_short_option): Keep dash_z from registering itself.
11797 2009-03-03 Ian Lance Taylor <iant@google.com>
11800 * target-reloc.h (relocate_section): Pass output_section to
11802 * i386.cc (Target_i386::should_apply_static_reloc): Add
11803 output_section parameter. Change all callers.
11804 (Target_i386::Relocate::relocate): Add output_section parameter.
11805 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11806 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11807 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11808 * testsuite/two_file_shared.sh: New script.
11809 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11810 (check_DATA): Add two_file_shared.dbg.
11811 (two_file_shared.dbg): New target.
11812 * testsuite/Makefile.in: Rebuild.
11814 2009-03-01 Ian Lance Taylor <iant@google.com>
11816 * configure.ac: Check for byteswap.h.
11817 * configure: Rebuild.
11818 * config.in: Rebuild.
11820 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
11822 * layout.cc (Layout::find_or_add_kept_section): New function.
11823 (Layout::add_comdat): Removed.
11824 * layout.h (struct Kept_section): Move out of class Layout.
11825 Remove trailing underscores from field names. Add group_sections
11826 field. Rename group_ field to is_group. Change all uses.
11827 (class Layout): Declare find_or_add_kept_section, not add_comdat.
11828 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11829 comdat_groups_ field.
11830 (Sized_relobj::include_section_group): Use
11831 find_or_add_kept_section and Kept_section::group_sections.
11832 (Sized_relobj::include_linkonce_section): Likewise.
11833 * object.cc (class Sized_relobj): Don't define Comdat_group or
11834 Comdat_group_table. Remove find_comdat_group and
11835 add_comdat_group. Remove comdat_groups_ field.
11836 * plugin.cc (include_comdat_group): Use
11837 Layout::find_or_add_kept_section.
11839 2009-02-28 Ian Lance Taylor <iant@google.com>
11841 * README: --gc-sections and map files are now supported. Document
11842 some build requirements.
11845 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11846 relocatable link set the value of the section symbol to zero.
11847 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11848 relocatable link don't include the section address in the local
11851 2009-02-27 Ian Lance Taylor <iant@google.com>
11854 * options.h (class Search_directory): Add is_system_directory.
11855 (class General_options): Declare is_in_system_directory.
11856 * options.cc (get_relative_sysroot): Make static.
11857 (get_default_sysroot): Make static.
11858 (General_optoins::is_in_system_directory): New function.
11859 * fileread.cc (Input_file::is_in_system_directory): New function.
11860 * fileread.h (class Input_file): Declare is_in_system_directory.
11861 * object.h (class Object): Add is_in_system_directory.
11862 (class Input_objects): Remove system_library_directory_ field.
11863 * object.cc (Input_objects::add_object): Don't set
11864 system_library_directory_.
11865 (input_objects::found_in_system_library_directory): Remove.
11866 * symtab.cc (Symbol_table::write_globals): Remove input_objects
11867 parameter. Change all callers.
11868 (Symbol_table::sized_write_globals): Likewise.
11869 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11870 Call Object::is_in_system_directory.
11871 * symtab.h (class Symbol_table): Update declarations.
11874 * descriptors.h (Open_descriptor): Add is_on_stack field.
11875 * descriptors.cc (Descriptors::open): If the descriptor is on the
11876 top of the stack, remove it. Initialize is_on_stack field.
11877 (Descriptors::release): Only add pod to stack if it is not on the
11879 (Descriptors::close_some_descriptor): Clear stack_next and
11880 is_on_stack fields.
11883 * output.cc (Output_section::find_starting_output_address): Rename
11884 from starting_output_address; add PADDR parameter; change return
11886 * output.h (class Output_section): Declare
11887 find_starting_output_address instead of starting_output_address.
11888 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11889 section symbol for which we can't find a merge section.
11892 * symtab.cc (Symbol_table::add_from_object): If the visibility is
11893 hidden or internal, force the symbol to be local.
11894 * resolve.cc (Symbol::override_visibility): Define.
11895 (Symbol::override_base): Use override_visibility.
11896 (Symbol_table::resolve): Likewise.
11897 (Symbol::override_base_with_special): Likewise.
11898 (Symbol_table::override_with_special): If the visibility is hidden
11899 or internal, force the symbol to be local.
11900 * symtab.h (class Symbol): Add set_visibility and
11901 override_visibility.
11902 * testsuite/ver_test_1.sh: New file.
11903 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11904 (check_DATA): Add ver_test_1.syms.
11905 (ver_test_1.syms): New target.
11906 * testsuite/Makefile.in: Rebuild.
11908 2009-02-25 Cary Coutant <ccoutant@google.com>
11910 * layout.cc (Layout::choose_output_section): Don't rename sections
11911 when using a linker script that has a SECTIONS clause.
11912 * Makefile.in: Regenerate.
11914 * testsuite/Makefile.am (script_test_5.sh): New test case.
11915 * testsuite/Makefile.in: Regenerate.
11916 * testsuite/script_test_5.cc: New file.
11917 * testsuite/script_test_5.sh: New file.
11918 * testsuite/script_test_5.t: New file.
11920 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
11922 * archive.cc (Archive::include_member): Update calls to add_symbols.
11923 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11924 the Layout argument.
11925 * dynobj.h (do_add_symbols): Add the Layout argument.
11926 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11928 * object.h (Object::add_symbols): Add the Layout argument.
11929 (Object::do_add_symbols): Add the Layout argument.
11930 (Sized_relobj::do_add_symbols): Add the Layout argument.
11931 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11932 Unify the two versions.
11933 (Add_plugin_symbols): Remove.
11934 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11935 (Sized_pluginobj::do_add_symbols): Unify the two versions.
11936 (Add_plugin_symbols): Remove.
11937 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11938 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11939 (Add_symbols::run): Make it work with Pulginobj.
11941 2009-02-06 Ian Lance Taylor <iant@google.com>
11943 * object.cc (Sized_relobj::do_layout): Make info message start
11944 with lower case letter.
11946 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
11948 * binary.cc: Fix file comment.
11950 * options.h (enum Incremental_disposition): Define.
11951 (class General_options): Add new options: --incremental,
11952 --incremental_changed, --incremental_unchanged,
11953 --incremental_unknown. Add incremental_disposition_ and
11954 implicit_incremental_ fields.
11955 (General_options::incremental_disposition): New function.
11956 (class Position_dependent_options): Add incremental_disposition
11958 (Position_dependent_options::copy_from_options): Set incremental
11960 * options.cc (General_options::parse_incremental_changed): New
11962 (General_options::parse_incremental_unchanged): New function.
11963 (General_options::parse_incremental_unknown): New function.
11964 (General_options::General_options): Initialize new fields
11965 incremental_disposition_ and implicit_incremental_.
11966 (General_options::finalize): Check for uasge of --incremental-*
11967 without --incremental.
11969 2009-02-06 Chris Demetriou <cgd@google.com>
11971 * gold.h (gold_undefined_symbol): Change to take only a Symbol
11972 pointer and to report location as the file name associated with
11974 (gold_undefined_symbol_at_location): New function to replace the
11975 old gold_undefined_symbol functionality.
11976 * target-reloc.h (relocate_section): Update to use
11977 gold_undefined_symbol_at_location.
11978 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11979 Call gold_undefined_symbol function rather than gold_error.
11980 * errors.h (Errors::undefined_symbol): Take location as a
11981 string, rather than calculating it from a relocation.
11982 * errors.cc (Errors::fatal): Print "fatal error:" before the
11984 (Errors::error, Errors::error_at_location): Print "error: "
11985 before the formatted message.
11986 (Errors::undefined_symbol): Take location as a string, rather
11987 than calculating it from a relocation.
11988 (gold_undefined_symbol_at_location): New function akin to
11989 old gold_undefined_symbol, calculates location from relocation.
11990 (gold_undefined_symbol): Change to take only a Symbol pointer
11991 and to report location as the file name associated with the symbol.
11992 * testsuite/debug_msg.sh: Update for changed error messages.
11993 * testsuite/undef_symbol.sh: Likewise.
11995 2009-02-04 Duncan Sands <baldrick@free.fr>
11998 * reduced_debug_output.h
11999 (Output_reduced_debug_abbrev_section::failed): Use format for
12001 (Output_reduced_debug_info_section::faild): Likewise.
12003 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
12005 * script.cc (Lazy_demangler): New class.
12006 (Version_script_info::get_symbol_version_helper): Demangle a
12009 2009-01-29 Cary Coutant <ccoutant@google.com>
12011 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12013 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12015 2009-01-28 Ian Lance Taylor <iant@google.com>
12017 * version.cc (version_string): Bump to 1.9.
12019 * gold.h: Include <cstring> and <stdint.h>.
12020 * version.cc: Include <cstdio>.
12021 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12023 * reduced_debug_output.cc (insert_into_vector): Rename from
12024 Insert_into_vector; change all callers. Use Swap_unaligned to
12025 avoid aliasing issue; remove union since it is unnecessary.
12027 2009-01-27 Sriraman Tallam <tmsriram@google.com>
12029 * Makefile.am (CCFILES): Add gc.cc.
12030 (HFILES): Add gc.h.
12031 * Makefile.in: Regenerate.
12032 * gold.cc (Gc_runner): New class.
12033 (queue_initial_tasks): Call garbage collection related tasks
12034 when corresponding options are invoked.
12035 (queue_middle_gc_tasks): New function.
12036 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12037 processed early before laying out sections during garbage collection.
12038 * gold.h (queue_middle_gc_tasks): New function.
12039 (is_prefix_of): Move from "layout.cc".
12040 * i386.cc (Target_i386::gc_process_relocs): New function.
12041 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12042 * main.cc (main): Create object of class "Garbage_collection".
12043 * object.cc (Relobj::copy_symbols_data): New function.
12044 (Relobj::is_section_name_included): New function.
12045 (Sized_relobj::do_layout): Allow this function to be called twice
12046 during garbage collection and defer layout of section during the
12048 * object.h (Relobj::get_symbols_data): New function.
12049 (Relobj::is_section_name_included): New function.
12050 (Relobj::copy_symbols_data): New function.
12051 (Relobj::set_symbols_data): New function.
12052 (Relobj::get_relocs_data): New function.
12053 (Relobj::set_relocs_data): New function.
12054 (Relobj::is_output_section_offset_invalid): New pure virtual function.
12055 (Relobj::gc_process_relocs): New function.
12056 (Relobj::do_gc_process_relocs): New pure virtual function.
12057 (Relobj::sd_): New data member.
12058 (Sized_relobj::is_output_section_offset_invalid): New function.
12059 (Sized_relobj::do_gc_process_relocs): New function.
12060 * options.h (General_options::gc_sections): Modify to not be a no-op.
12061 (General_options::print_gc_sections): New option.
12062 * plugin.cc (Plugin_finish::run): Remove function call to
12063 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
12064 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12065 * reloc.cc (Read_relocs::run): Add task to process relocs and
12066 determine unreferenced sections when doing garbage collection.
12067 (Gc_process_relocs): New class.
12068 (Sized_relobj::do_gc_process_relocs): New function.
12069 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12070 sections that are garbage collected.
12071 * reloc.h (Gc_process_relocs): New class.
12072 * sparc.cc (Target_sparc::gc_process_relocs): New function.
12073 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12074 symbols whose corresponding sections are garbage collected.
12075 (Symbol_table::Symbol_table): Add new parameter for the garbage
12077 (Symbol_table::gc_mark_undef_symbols): New function.
12078 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12079 (Symbol_table::gc_mark_dyn_syms): New function.
12080 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12082 (Symbol_table::add_from_object): Likewise.
12083 (Symbol_table::add_from_relobj): When building shared objects, do not
12084 treat externally visible symbols as garbage.
12085 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12086 table information for static and relocatable links.
12087 * symtab.h (Symbol_table::set_gc): New function.
12088 (Symbol_table::gc): New function.
12089 (Symbol_table::gc_mark_undef_symbols): New function.
12090 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12091 (Symbol_table::gc_mark_dyn_syms): New function.
12092 (Symbol_table::gc_): New data member.
12093 * target.h (Sized_target::gc_process_relocs): New pure virtual
12095 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12096 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12098 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
12100 * options.h (General_options::gc_sections): Define as a no-op for now.
12101 (General_options::no_keep_memory): Ditto.
12102 (General_options::Bshareable): Define.
12103 * options.cc (General_options::finalize): Honor -Bshareable.
12105 2009-01-20 Andreas Schwab <schwab@suse.de>
12107 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12108 read the value in the contents, since we don't use it. Use the
12109 template endianness when writing.
12110 (Relocate::relocate): Use it for R_PPC_REL16_HA.
12112 2009-01-19 Andreas Schwab <schwab@suse.de>
12114 * configure.tgt (powerpc64-*): Fix targ_obj.
12116 2009-01-15 Ian Lance Taylor <iant@google.com>
12118 * object.cc (Sized_relobj::write_local_symbols): Don't write out
12119 local symbols when stripping all symbols.
12121 2009-01-14 Cary Coutant <ccoutant@google.com>
12123 * output.cc (Output_reloc): Add explicit instantiations.
12125 2009-01-14 Cary Coutant <ccoutant@google.com>
12127 * archive.cc (Archive::get_elf_object_for_member): Remove call
12128 to File_read::claim_for_plugin.
12129 * descriptors.cc (Descriptors::open): Remove reference to
12131 (Descriptors::claim_for_plugin): Remove.
12132 * descriptors.h (Descriptors::claim_for_plugin): Remove.
12133 (Descriptors::is_claimed): Remove.
12134 (claim_descriptor_for_plugin): Remove.
12135 * fileread.cc (File_read::claim_for_plugin): Remove.
12136 * fileread.h (File_read::claim_for_plugin): Remove.
12137 (File_read::descriptor): Reopen descriptor if necessary.
12138 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
12139 (Plugin_manager::all_symbols_read): Add task parameter. Change
12141 (Plugin_manager::get_input_file): New function.
12142 (Plugin_manager::release_input_file): New function.
12143 (Pluginobj::Pluginobj): Add filesize parameter and initialize
12144 corresponding data member.
12145 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12146 and pass to base constructor. Change all callers.
12147 (get_input_file, release_input_file): New functions.
12148 (make_sized_plugin_object): Add filesize parameter. Change all callers.
12149 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12150 (Plugin_manager::all_symbols_read): Add task parameter.
12151 (Plugin_manager::get_input_file): New function.
12152 (Plugin_manager::release_input_file): New function.
12153 (Plugin_manager::task_): New data member.
12154 (Pluginobj::Pluginobj): Add filesize parameter.
12155 (Pluginobj::filename): New function.
12156 (Pluginobj::descriptor): New function.
12157 (Pluginobj::filesize): New function.
12158 (Pluginobj::filesize_): New data member.
12159 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12160 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12161 File_read::claim_for_plugin; use Object::unlock to unlock the file.
12163 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12164 with archive libraries.
12165 * testsuite/Makefile.in: Regenerate.
12166 * testsuite/plugin_test.c (struct sym_info): New type.
12167 (get_input_file, release_input_file): New static variables.
12168 (onload): Capture new transfer vector entries.
12169 (claim_file_hook): Stop reading at end of file according to filesize.
12170 Factor out parsing of readelf output into separate function.
12171 (all_symbols_read_hook): Exercise get_input_file and release_input_file
12172 APIs and get the source file name from the symbol table. Convert
12173 source file name to corresponding object file name. Print info
12174 message when adding new input files.
12175 (parse_readelf_line): New function.
12176 * testsuite/plugin_test_1.sh: Add checks for new info messages.
12177 * testsuite/plugin_test_2.sh: Likewise.
12178 * testsuite/plugin_test_3.sh: Likewise.
12179 * testsuite/plugin_test_4.sh: New test case.
12181 2009-01-07 Ian Lance Taylor <iant@google.com>
12183 * version.cc (version_string): Bump to 1.8.
12185 2008-12-23 Cary Coutant <ccoutant@google.com>
12187 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12188 * plugin.cc (Plugin_manager::finish): Rename as
12189 layout_deferred_objects. Move cleanup to separate function.
12190 (Plugin_manager::cleanup): New function.
12191 (Plugin_finish::run): Call layout_deferred_objects and cleanup
12193 * plugin.h (Plugin_manager::finish): Rename as
12194 layout_deferred_objects.
12195 (Plugin_manager::cleanup): New function.
12196 (Plugin_manager::cleanup_done): New field.
12198 2008-12-23 Cary Coutant <ccoutant@google.com>
12200 * plugin.cc (is_visible_from_outside): New function.
12201 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12202 so we don't return "IR only" status for exported symbols or -r links.
12204 * testsuite/Makefile.am (plugin_test_3): New test case.
12205 * testsuite/Makefile.in: Regenerate.
12206 * testsuite/plugin_test_3.sh: New file.
12208 2008-12-22 Cary Coutant <ccoutant@google.com>
12210 * object.cc (Sized_relobj::layout_section): New function.
12211 (Sized_relobj::do_layout): Defer layout of input sections until after
12212 plugin has provided replacement files.
12213 (Sized_relobj::do_layout_deferred_sections): New function.
12214 * object.h (Relobj::set_section_offset): Remove virtual keyword.
12215 (Relobj::layout_deferred_sections): New function.
12216 (Relobj::do_layout_deferred_sections): New function.
12217 (Sized_relobj::do_layout_deferred_sections): New function.
12218 (Sized_relobj::layout_section): New function.
12219 (Sized_relobj::Deferred_layout): New structure.
12220 (Sized_relobj::deferred_layout_): New field.
12221 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12222 Change all callers. Layout deferred sections.
12223 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
12225 (Plugin_hook::run): Move code from do_plugin_hook inline.
12226 (Plugin_hook::do_plugin_hook): Remove.
12227 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12228 (Plugin_manager::finish): Renamed, was cleanup.
12229 (Plugin_manager::should_defer_layout): New function.
12230 (Plugin_manager::add_deferred_layout_object): New function.
12231 (Plugin_manager::Deferred_layout_list): New type.
12232 (Plugin_manager::deferred_layout_objects_): New field.
12233 (Plugin_hook::do_plugin_hook): Remove.
12235 2008-12-17 Ian Lance Taylor <iant@google.com>
12237 * options.h (class General_options): Add --no case for
12240 2008-12-16 Cary Coutant <ccoutant@google.com>
12242 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12244 (Plugin_manager::claim_file): Create plugin object even if
12245 plugin did not call the add_symbols callback.
12246 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12247 asking for more symbols than were added.
12248 * testsuite/Makefile.am (plugin_test_1): Add test case with
12250 (empty.syms): New target.
12251 * testsuite/Makefile.in: Regenerate.
12252 * testsuite/plugin_test.c (claim_file_hook): Add new debug
12253 message. Don't call add_symbols if no globals.
12254 (all_symbols_read_hook): Don't provide replacement for empty
12257 2008-12-12 Ian Lance Taylor <iant@google.com>
12259 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12260 r_type == 0 for a local symbol with r_sym == 0.
12261 (scan_relocatable_relocs): Pass r_sym to
12262 local_non_section_strategy.
12263 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12266 * configure.ac: Update test for TLS descriptors: they are
12267 supported as of glibc 2.9.
12268 * configure: Rebuild.
12270 2008-12-11 Ian Lance Taylor <iant@google.com>
12273 * target-reloc.h (Default_scan_relocatable_relocs): For each
12274 function, map r_type == 0 to RELOC_DISCARD.
12276 2008-12-10 Cary Coutant <ccoutant@google.com>
12278 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12279 object to override a kept COMDAT group from a plugin object.
12281 2008-12-09 Ian Lance Taylor <iant@google.com>
12284 * yyscript.y (file_cmd): Handle INPUT.
12286 * testsuite/initpri1.c: Change all declarations to be full
12287 prototypes by adding void, to avoid compiler warnings.
12289 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
12291 * options.cc (General_options::parse_plugin_opt): New.
12292 (General_options::add_plugin): The argument now is just the filename.
12293 (General_options::add_plugin_option): New.
12294 * options.h (plugin_opt): New.
12295 (add_plugin): Change argument name.
12296 (add_plugin_option): New.
12297 * plugin.cc (Plugin::load): Don't parse the plugin option.
12298 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12299 (Plugin::add_option): New.
12300 (Plugin::args_): Change type.
12301 (Plugin::filename_): New.
12302 (Plugin_manager::add_plugin_option): New.
12303 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12304 * testsuite/Makefile.in: Regenerate.
12306 2008-12-05 Cary Coutant <ccoutant@google.com>
12308 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12309 Handle --strip-lto-sections option.
12310 * options.h (strip_lto_sections): New option.
12312 2008-12-01 Cary Coutant <ccoutant@google.com>
12314 * plugin.cc (ld_plugin_message): Change format parameter to const.
12315 Fix mismatch between new[] and delete.
12317 2008-11-14 Cary Coutant <ccoutant@google.com>
12319 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12322 2008-11-05 Craig Silverstein <csilvers@google.com>
12324 * options.cc (General_options::parse_dynamic_list): New function.
12325 * options.h (General_options): New flags dynamic_list,
12326 dynamic_list_data, dynamic_list_cpp_new, and
12327 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
12328 (General_options::in_dynamic_list): New function.
12329 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12330 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12331 (Lex::can_continue_name): Likewise.
12333 (read_script_file): New parameter script_options.
12334 (read_dynamic_list): New function.
12335 (Script_options::define_dynamic_list): New function.
12336 (dynamic_list_keyword_parsecodes): New variable.
12337 (dynamic_list_keywords): New variable.
12338 * script.h (Script_options::define_dynamic_list): New function
12340 (read_dynamic_list): New function prototype.
12341 * symtab.cc (strprefix): New macro.
12342 (Symbol::should_add_dynsym_entry): Support dynamic_list,
12343 dynamic_list_data, dynamic_list_cpp_new, and
12344 dynamic_list_cpp_typeinfo.
12345 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12346 (dynamic_list_expr): New rule.
12347 (dynamic_list_nodes): Likewise.
12348 (dynamic_list_node): Likewise.
12349 * testsuite/Makefile.am (dynamic_list): New test.
12350 * testsuite/Makefile.in: Regenerated.
12351 * testsuite/dynamic_list.t: New file.
12352 * testsuite/dynamic_list.sh: New file.
12354 2008-11-05 Craig Silverstein <csilvers@google.com>
12356 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12357 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12358 (t11_last): Likewise.
12359 * testsuite/ver_test_6.c (main): Likewise.
12361 2008-10-07 Cary Coutant <ccoutant@google.com>
12363 * options.c (General_options::finalize): Add check for -static and
12365 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12368 2008-10-02 Cary Coutant <ccoutant@google.com>
12370 * plugin.cc (make_sized_plugin_object): Fix conditional
12371 compilation to work when not all targets are enabled.
12373 2008-09-29 Cary Coutant <ccoutant@google.com>
12375 * archive.cc (Archive::get_file_and_offset): Use filename instead
12376 of name to get library path.
12377 (Archive::include_member): Unlock external member of a thin archive.
12379 * testsuite/Makefile.am (TEST_AR): New variable.
12380 (thin_archive_test_1): New test.
12381 (thin_archive_test_2): New test.
12382 * testsuite/Makefile.in: Regenerate.
12383 * testsuite/thin_archive_main.cc: New file.
12384 * testsuite/thin_archive_test_1.cc: New file.
12385 * testsuite/thin_archive_test_2.cc: New file.
12386 * testsuite/thin_archive_test_3.cc: New file.
12387 * testsuite/thin_archive_test_4.cc: New file.
12389 2008-09-29 Cary Coutant <ccoutant@google.com>
12391 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12392 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12394 (Sized_relobj::do_finalize_local_symbols): Likewise.
12395 (Sized_relobj::map_to_kept_section): Likewise.
12396 * object.h (Sized_relobj::invalid_address): New constant.
12397 (Sized_relobj::do_output_section_offset): Check for invalid_address
12399 * output.cc (Output_reloc::local_section_offset): Use constant
12400 invalid_address instead of -1U.
12401 (Output_reloc::get_address): Likewise.
12402 (Output_section::output_address): Change -1U to -1ULL.
12403 * output.h (Output_reloc::invalid_address): New constant.
12404 * reloc.cc (Sized_relobj::write_sections): Use constant
12405 invalid_address instead of -1U.
12406 (Sized_relobj::relocate_sections): Likewise.
12407 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12408 values for merge sections.
12409 * target-reloc.h (relocate_for_relocatable): Use constant
12410 invalid_address instead of -1U.
12412 2008-09-19 Cary Coutant <ccoutant@google.com>
12414 Add plugin functionality for link-time optimization (LTO).
12415 * configure.ac (plugins): Add --enable-plugins option.
12416 * configure: Regenerate.
12417 * config.in: Regenerate.
12418 * Makefile.am (LIBDL): New variable.
12419 (CCFILES): Add plugin.cc.
12420 (HFILES): Add plugin.h.
12421 (ldadd_var): Add LIBDL.
12422 * Makefile.in: Regenerate.
12424 * archive.cc: Include "plugin.h".
12425 (Archive::setup): Don't preread archive symbols when using a plugin.
12426 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
12427 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12429 (Archive::include_member): Add symbols from plugin objects.
12430 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12431 * descriptors.cc (Descriptors::open): Check for file descriptors
12432 abandoned by plugins.
12433 (Descriptors::claim_for_plugin): New function.
12434 * descriptors.h (Descriptors::claim_for_plugin): New function.
12435 (Open_descriptor::is_claimed): New field.
12436 (claim_descriptor_for_plugin): New function.
12437 * fileread.cc (File_read::claim_for_plugin): New function.
12438 * fileread.h (File_read::claim_for_plugin): New function.
12439 (File_read::descriptor): New function.
12440 * gold.cc: Include "plugin.h".
12441 (queue_initial_tasks): Add task to call plugin hooks for generating
12443 * main.cc: Include "plugin.h".
12444 (main): Load plugin libraries.
12445 * object.h (Pluginobj): Declare.
12446 (Object::pluginobj): New function.
12447 (Object::do_pluginobj): New function.
12448 (Object::set_target): New function.
12449 * options.cc: Include "plugin.h".
12450 (General_options::parse_plugin): New function.
12451 (General_options::General_options): Initialize plugins_ field.
12452 (General_options::add_plugin): New function.
12453 * options.h (Plugin_manager): Declare.
12454 (General_options): Add --plugin option.
12455 (General_options::has_plugins): New function.
12456 (General_options::plugins): New function.
12457 (General_options::add_plugin): New function.
12458 (General_options::plugins_): New field.
12459 * plugin.cc: New file.
12460 * plugin.h: New file.
12461 * readsyms.cc: Include "plugin.h".
12462 (Read_symbols::do_read_symbols): Check for archive before checking
12463 for ELF file. Call plugin hooks to claim files.
12464 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12465 from a real object file; force override when processing replacement
12467 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12468 (Symbol::init_base_object): Likewise.
12469 (Symbol::init_base_output_data): Likewise.
12470 (Symbol::init_base_output_segment): Likewise.
12471 (Symbol::init_base_constant): Likewise.
12472 (Symbol::init_base_undefined): Likewise.
12473 (Symbol::output_section): Assert that object is not a plugin.
12474 (Symbol_table::add_from_pluginobj): New function.
12475 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12477 (Symbol_table::sized_write_globals): Likewise.
12478 (Symbol_table::add_from_pluginobj): Instantiate template.
12479 * symtab.h (Sized_pluginobj): Declare.
12480 (Symbol::in_real_elf): New function.
12481 (Symbol::set_in_real_elf): New function.
12482 (Symbol::in_real_elf_): New field.
12483 (Symbol_table::add_from_pluginobj): New function.
12485 * testsuite/Makefile.am (AM_CFLAGS): New variable.
12486 (LIBDL): New variable.
12487 (LDADD): Add LIBDL.
12488 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12489 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12490 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12491 (MOSTLYCLEANFILES): Likewise.
12492 * testsuite/Makefile.in: Regenerate.
12493 * testsuite/plugin_test.c: New file.
12494 * testsuite/plugin_test_1.sh: New file.
12495 * testsuite/plugin_test_2.sh: New file.
12497 2008-09-16 Ian Lance Taylor <iant@google.com>
12499 * target-reloc.h (relocate_section): Check whether a symbol is
12500 defined by the ABI before reporting an undefined symbol error.
12501 * target.h (Target::is_defined_by_abi): Make parameter const.
12502 (Target::do_is_defined_by_abi): Likewise.
12503 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12504 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12505 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12506 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12507 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12508 * testsuite/Makefile.in: Rebuild.
12510 * fileread.cc (make_view): Add casts to avoid warning.
12512 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
12514 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12515 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12517 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
12519 * options.h (General_options::output_is_executable): New.
12520 (General_options::output_is_pie): New.
12521 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12522 for shared libraries.
12523 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12525 2008-09-11 Chris Demetriou <cgd@google.com>
12527 * options.h (origin): New -z option.
12528 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12529 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12532 2008-09-05 Cary Coutant <ccoutant@google.com>
12534 * fileread.cc (File_read::make_view): Add check for attempt to map
12535 beyond end of file.
12537 2008-09-05 Cary Coutant <ccoutant@google.com>
12539 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12540 explicit instantiations.
12542 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
12545 * options.cc (General_options::finalize): Allow undefined symbols
12546 in shlibs if linking -shared.
12549 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12550 symbols as not needing a dynsym entry.
12552 2008-08-20 Craig Silverstein <csilvers@google.com>
12554 * fileread.cc (File_read::open): Do not lock the file unless it
12555 was successfully opened.
12557 2008-08-14 Cary Coutant <ccoutant@google.com>
12559 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12560 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12561 * testsuite/tls_test.cc (struct int128): 128-bit struct
12562 for testing TLS relocs with non-zero addend.
12563 (v12): New TLS variable.
12565 (t_last): Add check for v12.
12566 * testsuite/tls_test.h (t12): New function.
12567 * testsuite/tls_test_main.cc (thread_routine): Call new test.
12569 2008-08-13 Ian Lance Taylor <iant@google.com>
12571 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12572 set tls_segment_ or relro_segment_.
12573 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12575 * output.h (Output_section::clear_is_relro): New function.
12576 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12577 sections specially even when output_data_ is empty.
12578 (Output_segment::maximum_alignment): When first section is relro,
12579 only force alignment for PT_LOAD segments.
12580 * script.cc (script_data_segment_align): New function.
12581 (script_data_segment_relro_end): New function.
12582 * script-c.h (script_data_segment_align): Declare.
12583 (script_data_segment_relro_end): Declare.
12584 * script-sections.h (class Script_sections): Declare
12585 data_segment_align and data_segment_relro_end. Add fields
12586 segment_align_index_ and saw_relro_end_.
12587 * script-sections.cc (class Sections_element): Add set_is_relro
12588 virtual function. Add new bool* parameter to place_orphan_here.
12589 Add get_output_section virtual function.
12590 (class Output_section_definition): Add set_is_relro. Add new
12591 bool* parameter to place_orphan_here. Add get_output_section.
12592 Add is_relro_ field.
12593 (Output_section_definition::Output_section_definition): Initialize
12594 evaluated_address_, evaluated_load_address, evaluated_addralign_,
12595 and is_relro_ fields.
12596 (Output_section_definition::place_orphan_here): Add is_relro
12598 (Output_section_definition::set_section_addresses): Set relro for
12600 (Output_section_definition::alternate_constraint): Likewise.
12601 (class Orphan_output_section): Add new bool* parameter to
12602 place_orphan_here. Add get_output_section.
12603 (Orphan_output_section::place_orphan_here): Add is_relro
12605 (Script_sections::Script_sections): Initialize
12606 data_segment_align_index_ and saw_relro_end_.
12607 (Script_sections::data_segment_align): New function.
12608 (Script_sections::data_segment_relro_end): New function.
12609 (Script_sections::place_orphan): Set or clear is_relro.
12610 (Script_sections::set_section_addresses): Force alignment of first
12612 * yyscript.y (exp): Call script_data_segment_align and
12613 script_data_segment_relro_end.
12614 * testsuite/relro_script_test.t: New file.
12615 * testsuite/relro_test.cc (using_script): Declare.
12616 (t1, t2): Test using_script.
12617 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12618 (relro_script_test_SOURCES): Define.
12619 (relro_script_test_DEPENDENCIES): Define.
12620 (relro_script_test_LDFLAGS): Define.
12621 (relro_script_test_LDADD): Define.
12622 (relro_script_test.so): New target.
12623 * testsuite/Makefile.in: Rebuild.
12625 2008-08-06 Cary Coutant <ccoutant@google.com>
12627 * archive.cc (Archive::total_archives, Archive::total_members)
12628 (Archive::total_members_loaded): New variables.
12629 (Archive::setup): Add parameter. Add option to preread
12631 (Archive::read_armap): Add counter.
12632 (Archive::get_file_and_offset): New function.
12633 (Archive::get_elf_object_for_member): New function.
12634 (Archive::read_all_symbols): New function.
12635 (Archive::read_symbols): New function.
12636 (Archive::add_symbols): Add counters.
12637 (Archive::include_all_members): Use armap to find members if it's
12639 (Archive::include_member): Skip reading symbols if already read.
12640 Factored code into Archive::get_file_and_offset and
12641 Archive::get_elf_object_for_member. Changed call to
12642 Mapfile::report_include_archive_member.
12643 (Archive::print_stats): New function.
12644 * archive.h: Declare Object and Read_symbols_data classes.
12645 (Archive::Archive): Add initializers for new members.
12646 (Archive::setup): Add parameter.
12647 (Archive::print_stats): New function.
12648 (Archive::total_archives, Archive::total_members)
12649 (Archive::total_members_loaded): New variables.
12650 (Archive::get_file_and_offset): New function.
12651 (Archive::get_elf_object_for_member): New function.
12652 (Archive::read_all_symbols): New function.
12653 (Archive::read_symbols): New function.
12654 (Archive::Archive_member): New class.
12655 (Archive::members_): New member.
12656 (Archive::num_members_): New member.
12657 * main.cc: Include archive.h.
12658 (main): Call Archive::print_stats.
12659 * mapfile.cc (Mapfile::report_include_archive_member): Delete
12660 archive parameter; member_name is now the fully-decorated name.
12661 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12662 * options.h: (General_options): Add --preread-archive-symbols option.
12663 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12666 2008-08-04 Ian Lance Taylor <iant@google.com>
12668 * symtab.h (Symbol::use_plt_offset): New function.
12669 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12670 * powerpc.cc (Relocate::relocate): Likewise.
12671 * sparc.cc (Relocate::relocate): Likewise.
12672 * x86_64.cc (Relocate::relocate): Likewise.
12673 * testsuite/weak_plt.sh: New test.
12674 * testsuite/weak_plt_main.cc: New test.
12675 * testsuite/weak_plt_shared.cc: New test.
12676 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12677 (check_PROGRAMS): Add weak_plt.
12678 (check_DATA): Add weak_plt_shared.so.
12679 (weak_plt_main_pic.o, weak_plt): New targets.
12680 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12681 * testsuite/Makefile.in: Rebuild.
12683 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12685 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12686 * testsuite/Makefile.in: Rebuild.
12688 2008-08-04 Alan Modra <amodra@bigpond.net.au>
12690 * Makefile.am (POTFILES.in): Set LC_ALL=C.
12691 * Makefile.in: Regenerate.
12692 * po/POTFILES.in: Regenerate.
12694 2008-07-29 Ian Lance Taylor <iant@google.com>
12696 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12697 symbols before other symbols.
12698 * testsuite/script_test_2.cc (test_addr): Declare.
12699 (test_addr_alias): Declare.
12700 (main): Check that test_addr and test_addr_alias have the right
12702 * testsuite/script_test_2.t: Define test_addr_alias and
12705 2008-07-24 Ian Lance Taylor <iant@google.com>
12708 * descriptors.cc: New file.
12709 * descriptors.h: New file.
12710 * gold-threads.h (class Hold_optional_lock): New class.
12711 * fileread.cc: Include "descriptors.h".
12712 (File_read::~File_read): Release descriptor rather than closing
12714 (File_read::open) [file]: Call open_descriptor rather than open.
12715 Set is_descriptor_opened_.
12716 (File_read::open) [memory]: Assert that descriptor is not open.
12717 (File_read::reopen_descriptor): New function.
12718 (File_read::release): Release descriptor.
12719 (File_read::do_read): Make non-const. Reopen descriptor.
12720 (File_read::read): Make non-const.
12721 (File_read::make_view): Reopen descriptor.
12722 (File_read::do_readv): Likewise.
12723 * fileread.h (class File_read): Add is_descriptor_opened_ field.
12724 Update declarations.
12725 * layout.cc: Include "descriptors.h".
12726 (Layout::create_build_id): Use open_descriptor rather than open.
12727 * output.cc: Include "descriptors.h".
12728 (Output_file::open): Use open_descriptor rather than open.
12729 * archive.cc (Archive::const_iterator): Change Archive to be
12731 (Archive::begin, Archive::end): Make non-const.
12732 (Archive::count_members): Likewise.
12733 * archive.h (class Archive): Update declarations.
12734 * object.h (Object::read): Make non-const.
12735 * Makefile.am (CCFILES): Add descriptors.cc.
12736 (HFILES): Add descriptors.h.
12737 * Makefile.in: Rebuild.
12740 * gold.h: Always include <clocale>. Add Solaris workarounds
12741 following code in binutils/sysdep.h.
12744 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12745 this->eh_frame_hdr_ is NULL before using it.
12747 * dynobj.cc (Versions::Versions): Update comment.
12749 * dynobj.cc (Versions::Versions): If there is an soname, use it as
12750 the base version name.
12752 * stringpool.cc (Stringpool_template::add_with_length): Set key to
12753 array size plus one.
12754 (Stringpool_template::set_string_offsets): Subtract one from key
12755 before using it as an array index.
12756 (Stringpool_template::get_offset_with_length): Likewise.
12757 (Stringpool_template::write_to_buffer): Likewise.
12758 * stringpool.h (Stringpool_template::get_offset_from_key):
12761 2008-07-23 Ian Lance Taylor <iant@google.com>
12764 * object.h (Merged_symbol_value::value): Do our best to handle a
12768 * script.cc (Version_script_info::get_versions): Don't add empty
12769 version tag to return value.
12770 (Version_script_info::get_symbol_version_helper): Change return
12771 type to bool. Add pversion parameter. Change all callers.
12772 (script_register_vers_node): Don't require a non-NULL tag.
12773 * script.h (class Version_script_info): Update declarations.
12774 (Version_script_info::get_symbol_version): Change return type to
12775 bool. Add version parameter. Change all callers.
12776 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12777 handling. Handle an empty version from a version script.
12778 (Symbol_table::define_special_symbol): Likewise.
12779 * testsuite/ver_test_10.script: New file.
12780 * testsuite/ver_test_10.sh: New file.
12781 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12782 (check_DATA): Add ver_test_10.syms.
12783 (ver_test_10.syms, ver_test_10.so): New target.
12784 * testsuite/Makefile.in: Rebuild.
12786 2008-07-23 Simon Baldwin <simonb@google.com>
12788 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12789 to zero for undefined symbols from dynamic libraries.
12791 2008-07-23 Ian Lance Taylor <iant@google.com>
12793 * symtab.cc (Symbol_table::resolve): Remove version parameter.
12794 Change all callers.
12795 * symtab.h (class Symbol_table): Update declaration.
12796 * testsuite/ver_test_9.cc: New file.
12797 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12798 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12799 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12800 (ver_test_9.so, ver_test_9.o): New targets.
12801 * testsuite/Makefile.in: Rebuild.
12803 2008-07-22 Ian Lance Taylor <iant@google.com>
12805 * options.h (class General_options): Define --check-sections.
12806 * layout.cc (Layout::set_segment_offsets): Handle
12809 * options.h (class General_options): Define -n/--nmagic and
12811 * options.cc (General_options::finalize): For -n/--nmagic or
12812 -N/--omagic, set -static.
12813 * layout.cc (Layout::attach_allocated_section_to_segment): If
12814 -N/--omagic, don't put read-only and read-write sections in
12815 different segments.
12816 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12817 finding a read-only segment.
12818 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12819 don't set the minimum segment alignment to the common page size,
12820 and don't set the file offset to the address modulo the page size.
12821 * script-sections.cc (Script_sections::create_segments): If
12822 -n/--omagic, don't put read-only and read-write sections in
12823 different segments.
12825 * cref.cc: New file.
12826 * cref.h: New file.
12827 * options.h (class General_options): Add --print-symbol-counts.
12828 * main.cc (main): Issue defined symbol report if requested.
12829 * archive.cc (Archive::interpret_header): Make into a const member
12831 (Archive::add_symbols): Call Input_objects::archive_start and
12833 (Archive::const_iterator): Define new class.
12834 (Archive::begin, Archive::end): New functions.
12835 (Archive::include_all_members): Rewrite to use iterator.
12836 (Archive::count_members): New function.
12837 * archive.h (class Archive): Update declarations.
12838 (Archive::filename): New function.
12839 * object.cc: Include "cref.h".
12840 (Sized_relobj::Sized_relobj): Initialize defined_count_.
12841 (Sized_relobj::do_get_global_symbol_counts): New function.
12842 (Input_objects::add_object): Add object to cross-referencer.
12843 (Input_objects::archive_start): New function.
12844 (Input_objects::archive_stop): New function.
12845 (Input_objects::print_symbol_counts): New function.
12846 * object.h: Declare Cref and Archive.
12847 (Object::get_global_symbol_counts): New function.
12848 (Object::do_get_global_symbol_counts): New pure virtual function.
12849 (class Sized_relobj): Add defined_count_ field. Update
12851 (class Input_objects): Add cref_ field. Update constructor.
12852 Update declarations.
12853 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12855 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12857 (Sized_dynobj::do_get_global_symbol_counts): New function.
12858 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12859 defined_count_. Update declarations. Define Symbols typedef.
12860 * symtab.cc (Symbol_table::add_from_relobj): Add defined
12861 parameter. Change all callers.
12862 (Symbol_table::add_from_dynobj): Add sympointers and defined
12863 parameters. Change all callers.
12864 * symtab.h (class Symbol_table): Update declarations.
12865 * Makefile.am (CCFILES): Add cref.cc.
12866 (HFILES): Add cref.h.
12867 * Makefile.in: Rebuild.
12869 2008-07-22 Simon Baldwin <simonb@google.com>
12871 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12872 to zero when writing undefined symbols.
12874 2008-07-22 Ian Lance Taylor <iant@google.com>
12876 * output.cc (Output_section::add_input_section): Don't try to
12877 merge empty merge sections.
12879 2008-07-21 Craig Silverstein <csilvers@google.com>
12881 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12882 Include symbol version in error message.
12884 2008-07-20 Chris Demetriou <cgd@google.com>
12886 * configure.ac (gold_cv_c_random_seed): New configured variable.
12887 (RANDOM_SEED_CFLAGS): New substituted variable.
12888 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12889 * configure: Rebuild.
12890 * Makefile.in: Likewise.
12891 * testsuite/Makefile.in: Likewise.
12893 2008-07-18 Ian Lance Taylor <iant@google.com>
12895 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12896 where we see NAME/NULL and NAME/VERSION as separate symbols.
12897 * testsuite/ver_test_main.cc (main): Call t4.
12898 (t4, t4_2a): Define.
12899 * testsuite/ver_test_2.cc (t4_2): Define.
12900 * testsuite/ver_test_2.script: Put t4_2a in VER2.
12901 * testsuite/ver_test_4.cc (t4_2a): Define.
12902 * testsuite/ver_test_4.script: Put t4_2a in VER2.
12903 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12905 2008-07-17 Ian Lance Taylor <iant@google.com>
12907 * dynobj.cc (Versions::add_def): If we give an error about a
12908 missing version, go ahead and create the version anyhow.
12910 2008-07-10 Ian Lance Taylor <iant@google.com>
12912 Handle output sections with more than 0x7fffffff bytes.
12913 * object.h (class Relobj): Change map_to_output_ to
12914 output_sections_, and just keep a section pointer. Change all
12915 uses. Move comdat group support to Sized_relobj.
12916 (Relobj::is_section_specially_mapped): Remove.
12917 (Relobj::output_section): Remove poff parameter. Change all
12919 (Relobj::output_section_offset): New function.
12920 (Relobj::set_section_offset): Rewrite.
12921 (Relobj::map_to_output): Remove.
12922 (Relobj::output_sections): New function.
12923 (Relobj::do_output_section_offset): New pure virtual function.
12924 (Relobj::do_set_section_offset): Likewise.
12925 (class Sized_relobj): Add section_offsets_ field. Add comdat
12926 group support from Relobj. Update declarations.
12927 (Sized_relobj::get_output_section_offset): New function.
12928 (Sized_relobj::do_output_section_offset): New function.
12929 (Sized_relobj::do_set_section_offset): New function.
12930 * object.cc (Relobj::output_section_address): Remove.
12931 (Sized_relobj::Sized_relobj): Initialize new fields.
12932 (Sized_relobj::include_section_group): Cast find_kept_object to
12934 (Sized_relobj::include_linkonce_section): Likewise.
12935 (Sized_relobj::do_layout): Use separate arrays for output section
12937 (Sized_relobj::do_count_local_symbols): Change map_to_output to
12939 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12940 output_sections and section_offsets.
12941 (Sized_relobj::write_local_symbols): Likewise.
12942 (map_to_kept_section): Compute output address directly.
12943 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12944 output_sections and section_offsets.
12945 (Sized_relobj::write_sections): Likewise.
12946 (Sized_relobj::relocate_sections): Likewise.
12947 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12948 * output.h (class Output_reloc): Update declarations. Change
12949 u2_.relobj to Sized_relobj*.
12950 (class Output_data_reloc): Change add functions to use
12952 * output.cc (Output_reloc::Output_reloc): Change relobj to
12954 (Output_reloc::local_section_offset): Change return type to
12955 Elf_Addr. Use get_output_section_offset.
12956 (Output_reloc::get_address): Likewise.
12957 (Output_section::is_input_address_mapped): Don't call
12958 is_section_specially_mapped.
12959 (Output_section::output_offset): Likewise.
12960 (Output_section::output_address): Likewise.
12961 (Output_section::starting_output_address): Likewise.
12962 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12963 parameter to Sized_relobj*.
12964 (Copy_relocs::need_copy_reloc): Likewise.
12965 (Copy_relocs::save): Likewise.
12966 * copy-relocs.h (class Copy_relocs): Update declarations.
12967 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12968 Sized_relobj*. Change relobj_ field to Sized_relobj*.
12969 * target-reloc.h (relocate_for_relocatable): Change
12970 offset_in_output_section type to Elf_Addr. Change code that uses
12972 * layout.cc (Layout::layout): Always set *off.
12973 * mapfile.cc (Mapfile::print_input_section): Use
12974 output_section_offset.
12975 * i386.cc (Target_i386::copy_reloc): Change object parameter to
12977 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12978 * sparc.cc (Target_sparc::copy_reloc): Likewise.
12979 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12981 2008-07-03 Ian Lance Taylor <iant@google.com>
12983 * layout.cc (Layout::include_section): Do not discard unrecognized
12984 SHT_STRTAB sections.
12986 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
12988 * script.cc (Lex::can_continue_name): Make '?' allowable in
12989 version-script names.
12990 * testsuite/version_script.map: Change glob pattern to use '?'
12992 2008-06-30 Manish Singh <yosh@gimp.org>
12995 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12998 2008-06-30 Ian Lance Taylor <iant@google.com>
13002 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13003 versions]: Don't try to read the value in the contents, since we
13004 don't use it. Use the template endianness when writing.
13006 2008-06-25 Cary Coutant <ccoutant@google.com>
13008 * fileread.cc (File_read::make_view): Assert on zero-length view.
13009 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13010 symbol table when there are no symbols to read.
13012 2008-06-23 Craig Silverstein <csilvers@google.com>
13014 * version.cc (version_string): Bump to 1.7
13016 2008-06-18 Craig Silverstein <csilvers@google.com>
13018 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13019 constant 0xFFFF to type Valtype.
13020 (Powerpc_relocate_functions::rel16_ha): Likewise.
13022 2008-06-17 Ian Lance Taylor <iant@google.com>
13024 * output.h (Output_section::Input_section): Initialize p2align_ to
13025 zero for Output_section_data constructors.
13026 (Output_section::Input_section::addralign): If not an input
13027 section, return the alignment of the Output_section_data.
13028 * testsuite/copy_test.cc: New file.
13029 * testsuite/copy_test_1.cc: New file.
13030 * testsuite/copy_test_2.cc: New file.
13031 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13032 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13033 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13034 (copy_test_1_pic.o, copy_test_1.so): New targets.
13035 (copy_test_2_pic.o, copy_test_2.so): New targets.
13036 * testsuite/Makefile.in: Rebuild.
13038 * script-sections.cc (Script_sections::place_orphan): Initialize
13039 local variable exact.
13041 2008-06-13 David Edelsohn <edelsohn@gnu.org>
13043 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13045 2008-06-12 David Edelsohn <edelsohn@gnu.org>
13046 David S. Miller <davem@davemloft.net>
13048 * powerpc.cc: New file.
13049 * Makefile.am (TARGETSOURCES): Add powerpc.cc
13050 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13051 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13052 * Makefile.in: Rebuild.
13054 2008-06-09 Ian Lance Taylor <iant@google.com>
13056 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13058 (throwing, orig_terminate): New static variables.
13059 (terminate_handler): New static function.
13060 (t2): Set terminate handler.
13062 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
13065 * binary.cc (Binary_to_elf::sized_convert): Fix .data
13068 2008-05-30 Cary Coutant <ccoutant@google.com>
13070 * archive.cc (Archive::include_all_members) Correct to step
13071 over symbol table and extended name table in thin archives.
13073 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
13076 * target-reloc.h (relocate_for_relocatable): Fix new_offset
13079 2008-05-28 Caleb Howe <cshowe@google.com>
13081 * reduced_debug_output.cc: New file.
13082 * reduced_debug_output.h: New file.
13083 * options.h (class General_options): Add --strip-debug-non-line.
13084 * options.cc (General_options::finalize): Add strip_debug_non_line
13085 to the strip heirarchy.
13086 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13088 * layout.cc: Include "reduced_debug_output.h".
13089 (Layout::Layout): Initialize new fields.
13090 (line_only_debug_sections): New static array.
13091 (is_lines_only_debug_sections): New static inline function.
13092 (Layout::include_section): Handle --strip-debug-non-line.
13093 (Layout::make_output_section): If --strip-debug-non-line, build
13094 new output sections for .debug_abbrev and .debug_info.
13095 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13096 gold. Warn about possible overflow.
13097 (read_signed_LEB_128): Likewise.
13098 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13099 (read_signed_LEB_128): Declare.
13100 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13101 (HFILES): Add reduced_debug_output.h.
13102 * Makefile.in: Rebuild.
13104 2008-05-21 Ian Lance Taylor <iant@google.com>
13106 * mapfile.cc: New file.
13107 * mapfile.h: New file.
13108 * options.h (class General_options): Add -M/--print-map and -Map.
13109 * options.cc (General_options::finalize): Make -M equivalent to
13111 * main.cc: Include <cstdio> and "mapfile.h".
13112 (main): Open mapfile if requested.
13113 * gold.cc (class Middle_runner): Add mapfile_ field. Update
13114 constructor. Change caller.
13115 (queue_initial_tasks): Add mapfile parameter. Change caller.
13116 (queue_middle_tasks): Likewise.
13117 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13119 * archive.cc: Include "mapfile.h".
13120 (Archive::add_symbols): Add mapfile parameter. Change all
13121 callers. Pass mapfile, symbol, and reason to include_member.
13122 (Archive::include_all_members): Add mapfile parameter. Change all
13124 (Archive::include_member): Add mapfile, sym, and why parameters.
13125 Change all callers. Report inclusion to map file.
13126 * archive.h: Include "fileread.h".
13127 (class Archive): Update declarations.
13128 (Archive::file): New const method.
13129 (class Add_archive_symbols): Add mapfile_ field. Update
13130 constructor. Change all callers.
13131 * readsyms.h (class Read_symbols): Likewise.
13132 (class Finish_group): Likewise.
13133 (class Read_script): Likewise.
13134 * common.cc: Include "mapfile.h".
13135 (Symbol_table::allocate_commons): Add mapfile parameter. Change
13137 (Symbol_table::do_allocate_commons): Likewise.
13138 (Symbol_table::do_allocate_commons_list): Likewise. Report common
13139 symbol allocation to mapfile.
13140 * common.h (class Allocate_commons_task): Add mapfile_ field.
13141 Update constructor. Change all callers.
13142 * symtab.h (class Symbol_table): Update declarations.
13143 * layout.cc: Include "mapfile.h".
13144 (Layout_task_runner::run): Print information to mapfile.
13145 (Layout::create_gold_note): Change Output_data_fixed_space to
13146 Output_data_zero_fill.
13147 (Layout::create_build_id): Likewise.
13148 (Layout::print_to_mapfile): New function.
13149 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
13150 constructor. Change caller.
13151 (class Layout): Declare print_to_mapfile.
13152 * output.cc (Output_section::Input_section::print_to_mapfile): New
13154 (Output_section::add_input_section): If producing a map, always
13155 add to input_sections_ list.
13156 (Output_section::do_print_to_mapfile): New function.
13157 (Output_segment::print_sections_to_mapfile): New function.
13158 (Output_segment::print_section_list_to_mapfile): New function.
13159 * output.h: Include "mapfile.h".
13160 (Output_data::print_to_mapfile): New function.
13161 (Output_data::do_print_to_mapfile): New virtual function.
13162 (Output_segment_headers::do_print_to_mapfile): New function.
13163 (Output_file_header::do_print_to_mapfile): New function.
13164 (Output_data_const::do_print_to_mapfile): New function.
13165 (class Output_data_const_buffer): Add map_name_ field. Update
13166 constructor. Change all callers. Add do_print_to_mapfile
13168 (class Output_data_fixed_space): Likewise.
13169 (class Output_data_space): Likewise.
13170 (class Output_data_zero_fill): New class.
13171 (Output_data_strtab::do_print_to_mapfile): New function.
13172 (Output_data_reloc_base::do_print_to_mapfile): New function.
13173 (Output_relocatable_relocs::do_print_to_mapfile): New function.
13174 (Output_data_group::do_print_to_mapfile): New function.
13175 (Output_data_got::do_print_to_mapfile): New function.
13176 (Output_data_dynamic::do_print_to_mapfile): New function.
13177 (Output_symtab_xindex::do_print_to_mapfile): New function.
13178 (class Output_section): Declare do_print_to_mapflie. Declare
13179 print_to_mapfile in Input_section.
13180 (class Output_segment): Declare new functions.
13181 * object.h (Sized_relobj::symbol_count): New function.
13182 * script-sections.cc
13183 (Output_section_element_dot_assignment::set_section_addresses):
13184 Change Output_data_fixed_space to Output_data_zero_fill.
13185 (Output_data_expression::do_print_to_mapfile): New function.
13186 * script.cc (read_input_script): Add mapfile parameter. Change
13188 * script.h (read_input_script): Update declaration.
13189 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13190 (Eh_frame::do_print_to_mapfile): New function.
13191 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13192 (Output_merge_string::do_print_to_mapfile): New function.
13193 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13195 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13197 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13199 * Makefile.am (CCFILES): Add mapfile.cc.
13200 (HFILES): Add mapfile.h.
13201 * Makefile.in: Rebuild.
13203 2008-05-19 Ian Lance Taylor <iant@google.com>
13205 * options.h (class General_options): Add -z relro.
13206 * layout.cc (Layout::Layout): Initialize relro_segment_.
13207 (Layout::add_output_section_data): Return the output section.
13208 (Layout::make_output_section): Rcognize relro sections and mark
13209 them appropriately.
13210 (Layout::attach_allocated_section_to_segment): Put relro sections
13211 in a PT_GNU_RELRO segment.
13212 (Layout::create_initial_dynamic_sections): Mark the .dynamic
13214 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13216 (Layout::linkonce_mapping): Map d.rel.ro.local to
13217 .data.rel.ro.local.
13218 (Layout::output_section_name): Us .data.rel.ro.local for any
13219 section which begins with that.
13220 * layout.h (class Layout): Update add_output_section_data
13221 declaration. Add relro_segment_ field.
13222 * output.cc (Output_section::Output_section): Initialize is_relro_
13223 and is_relro_local_ fields.
13224 (Output_segment::add_output_section): Group relro sections.
13225 (Output_segment::is_first_section_relro): New function.
13226 (Output_segment::maximum_alignment): If there is a relro section,
13227 align the segment to the common page size.
13228 (Output_segment::set_section_addresses): Track whether we are
13229 looking at relro sections. If the last section is a relro
13230 section, align to the common page size.
13231 (Output_segment::set_section_list_addresses): Add in_relro
13232 parameter. Change all callers. Align to the page size when
13233 moving from relro to non-relro section.
13234 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13236 * output.h (class Output_section): Add is_relro_ and
13237 is_relro_local_ fields.
13238 (Output_section::is_relro): New function.
13239 (Output_section::set_is_relro): New function.
13240 (Output_section::is_relro_local): New function.
13241 (Output_section::set_is_relro_local): New function.
13242 (class Output_segment): Update declarations.
13243 * i386.cc (Target_i386::got_section): Mark .got section as relro.
13244 * sparc.cc (Target_sparc::got_section): Likewise.
13245 * x86_64.cc (Target_x86_64::got_section): Likewise.
13246 * testsuite/relro_test_main.cc: New file.
13247 * testsuite/relro_test.cc: New file.
13248 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13249 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13250 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13251 (relro_test.so, relro_test_pic.o): New targets.
13252 * testsuite/Makefile.in: Rebuild.
13254 2008-05-16 Ian Lance Taylor <iant@google.com>
13256 * output.cc (Output_segment::add_output_section): Remove front
13258 * output.h (class Output_segment): Remove
13259 add_initial_output_section and overloaded add_output_section.
13260 Update declaration of remaining add_output_section.
13261 * layout.cc (Layout::create_interp): Call add_output_section
13262 rather than add_initial_output_section.
13263 (Layout::finish_dynamic_section): Likewise.
13265 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13266 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
13267 know the dynamic type.
13268 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13269 field. Initialize it in constructor.
13270 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13271 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13272 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13275 * output.cc (Output_reloc::get_address): Change return type to
13277 * output.h (class Output_reloc): Update get_address declaration.
13278 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13279 for section addresses.
13281 2008-05-09 Ian Lance Taylor <iant@google.com>
13284 * gold.cc (gold_nomem): Use return value of write.
13286 2008-05-08 Ian Lance Taylor <iant@google.com>
13288 * symtab.c (Symbol::init_base_output_data): Add version
13289 parameter. Change all callers.
13290 (Symbol::init_base_output_segment): Likewise.
13291 (Symbol::init_base_constant): Likewise.
13292 (Symbol::init_base_undefined): Likewise.
13293 (Sized_symbol::init_output_data): Likewise.
13294 (Sized_symbol::init_output_segment): Likewise.
13295 (Sized_symbol::init_constant): Likewise.
13296 (Sized_symbol::init_undefined): Likewise.
13297 (Symbol_table::do_define_in_output_data): If the new symbol has a
13298 version, mark it as the default.
13299 (Symbol_table::do_define_in_output_segment): Likewise.
13300 (Symbol_table::do_define_as_constant): Likewise.
13301 * symtab.h (class Symbol): Update declarations.
13302 (class Sized_symbol): Likewise.
13303 * resolve.cc (Symbol::override_version): New function.
13304 (Symbol::override_base): Call override_version.
13305 (Symbol::override_base_with_special): Likewise.
13306 * testsuite/ver_script_8.script: New file.
13307 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13308 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13309 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13310 (ver_test_8_1.so, ver_test_8_2.so): New targets.
13312 2008-05-06 Ian Lance Taylor <iant@google.com>
13315 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13317 (class General_options): Remove existing --undefined, and add
13318 --no-undefined instead. Add new --undefined as synonym for -u.
13319 * archive.cc (Archive::add_symbols): Check whether symbol was
13321 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13322 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13323 all uses. Add IS_UNDEFINED. Update declarations to split
13324 different versions of init_base. Declare init_base_undefined.
13325 (Symbol::is_defined): Handle IS_UNDEFINED.
13326 (Symbol::is_undefined): Likewise.
13327 (Symbol::is_weak_undefined): Call is_undefined.
13328 (Symbol::is_absolute): Handle IS_CONSTANT.
13329 (class Sized_symbol): Update declarations to split different
13330 versions of init. Declare init_undefined.
13331 (class Symbol_table): Declare new functions.
13332 * symtab.cc (Symbol::init_base_object): Rename from init_base.
13333 Change all callers.
13334 (Symbol::init_base_output_data): Likewise.
13335 (Symbol::init_base_output_segment): Likewise.
13336 (Symbol::init_base_constant): Likewise.
13337 (Symbol::init_base_undefined): New function.
13338 (Sized_symbol::init_object): Rename from init. Change all
13340 (Sized_symbol::init_output_data): Likewise.
13341 (Sized_symbol::init_output_segment): Likewise.
13342 (Sized_symbol::init_constant): Likewise.
13343 (Sized_symbol::init_undefined): New function.
13344 (Symbol_table::add_undefined_symbols_from_command_line): New
13346 (Symbol_table::do_add_undefined_symbols_from_command_line): New
13348 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13349 (Symbol::output_section): Likewise.
13350 (Symbol::set_output_section): Likewise.
13351 (Symbol_table::sized_finalize_symbol): Likewise.
13352 (Symbol_table::sized_write_globals): Likewise.
13353 * resolve.cc (Symbol_table::should_override): Likewise.
13354 (Symbol::override_base_with_special): Likewise.
13356 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13357 symbol, change it to have default visibility.
13358 * testsuite/protected_1.cc: New file.
13359 * testsuite/protected_2.cc: New file.
13360 * testsuite/protected_3.cc: New file.
13361 * testsuite/protected_main_1.cc: New file.
13362 * testsuite/protected_main_2.cc: New file.
13363 * testsuite/protected_main_3.cc: New file.
13364 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13365 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13366 (protected_1_LDFLAGS, protected_1_LDADD): Define.
13367 (protected_1.so): New target.
13368 (protected_1_pic.o, protected_2_pic.o): New targets.
13369 (protected_3_pic.o): New target.
13370 (check_PROGRAMS): Add protected_2.
13371 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13372 (protected_2_LDFLAGS, protected_2_LDADD): Define.
13373 * testsuite/Makefile.in: Rebuild.
13375 * options.h (DEFINE_var): Add set_user_set_##varname__.
13376 (DEFINE_bool_alias): New macro.
13377 (class General_options): Define -Bstatic using DEFINE_bool_alias
13378 rather than DEFINE_special. Add --undefined as an alias for -z
13380 * options.cc (General_options::parse_Bstatic): Remove.
13382 * options.h (class General_options): Add --fatal-warnings.
13383 * main.cc (main): Implement --fatal-warnings.
13384 * errors.h (Errors::warning_count): New function.
13386 * options.h (class General_options): Add -Bsymbolic-functions.
13387 * symtab.h (Symbol::is_preemptible): Check for
13388 -Bsymbolic-functions.
13390 2008-05-05 Ian Lance Taylor <iant@google.com>
13392 * options.h (DEFINE_bool): For DASH_Z, create the negative option
13393 as noVARNAME rather than no-VARNAME.
13394 (class General_options): Add option -z combreloc.
13395 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13397 (Output_reloc::sort_before) [SHT_REL]: New function.
13398 (Output_reloc::sort_before) [SHT_RELA]: New function.
13399 (class Output_data_reloc_base): Add sort_relocs_ field. Define
13400 Sort_relocs_comparison.
13401 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13402 parameter. Change all callers.
13403 (Output_data_reloc::Output_data_reloc) [both versions]: Add
13404 sort_relocs parameter. Change all callers.
13405 * output.cc (Output_reloc::get_address): New function, broken out
13407 (Output_reloc::write_rel): Call it.
13408 (Output_reloc::compare): New function.
13409 (Output_data_reloc_base::do_write): Optionally sort relocs.
13411 * configure.ac: If targ_extra_obj is set, link it in.
13412 * configure.tgt: Initialize all variables.
13413 (x86_64*): Set targ_extra_obj and targ_extra_size.
13414 * configure: Rebuild.
13416 * object.cc (Sized_relobj::include_section_group): Adjust section
13417 indexes read from group data. Build vector to pass to
13419 * layout.cc (Layout::layout_group): Add flags and shndxes
13420 parameters. Remove contents parameter. Change caller. Update
13421 explicit instantiations.
13422 * layout.h (class Layout): Update layout_group declaration.
13423 * output.cc (Output_data_group::Output_data_group): Add flags and
13424 input_shndxes parameters. Remove contents parameter. Change
13426 (Output_data_group::do_write): Change input_sections_ to
13428 * output.h (class Output_data_group): Update constructor
13429 declaration. Rename input_sections_ to input_shndxes_.
13430 * testsuite/many_sections_test.cc: Add template.
13432 2008-04-30 Cary Coutant <ccoutant@google.com>
13434 * target-reloc.h (relocate_section): Fix dead-pointer bug.
13436 * layout.cc (Layout::include_section): Refactored check for debug
13438 (Layout::add_comdat): Add new parameters. Change type
13439 of signature parameter. Add object and shndx to signatures table.
13440 (Layout::find_kept_object): New function.
13441 * layout.h: Include <cstring>.
13442 (Layout::is_debug_info_section): New function.
13443 (Layout::add_comdat): Add new parameters.
13444 (Layout::find_kept_object): New function.
13445 (Layout::Kept_section): New struct.
13446 (Layout::Signatures): Change type of map range.
13447 * object.cc (Relobj::output_section_address): New function.
13448 (Sized_relobj::include_section_group): Add new parameters. Change
13449 calls to Layout::add_comdat. Change to build table of kept comdat
13450 groups and table mapping discarded sections to kept sections.
13451 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
13452 (Sized_relobj::do_layout): Change calls to include_section_group and
13453 include_linkonce_section.
13454 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13455 value to zero when section is discarded.
13456 (Sized_relobj::map_to_kept_section): New function.
13457 * object.h (Relobj::output_section_address): New function.
13458 (Relobj::Comdat_group): New type.
13459 (Relobj::find_comdat_group): New function.
13460 (Relobj::Comdat_group_table): New type.
13461 (Relobj::Kept_comdat_section): New type.
13462 (Relobj::Kept_comdat_section_table): New type.
13463 (Relobj::add_comdat_group): New function.
13464 (Relobj::set_kept_comdat_section): New function.
13465 (Relobj::get_kept_comdat_section): New function.
13466 (Relobj::comdat_groups_): New field.
13467 (Relobj::kept_comdat_sections_): New field.
13468 (Symbol_value::input_value): Update comment.
13469 (Sized_relobj::map_to_kept_section) New function.
13470 (Sized_relobj::include_linkonce_section): Add new parameter.
13471 * target-reloc.h (Comdat_behavior): New type.
13472 (get_comdat_behavior): New function.
13473 (relocate_section): Add code to map a discarded section to the
13474 corresponding kept section when applying a relocation.
13476 2008-04-30 Craig Silverstein <csilvers@google.com>
13478 * dwarf_reader.cc (next_generation_count): New static var.
13479 (Addr2line_cache_entry): New struct.
13480 (addr2line_cache): New static var.
13481 (Dwarf_line_info::one_addr2line): Added caching.
13482 (Dwarf_line_info::clear_addr2line_cache): New function.
13483 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13484 cache-size parameter.
13485 (Dwarf_line_info::one_addr2line_cache): New function.
13486 * symtab.cc (Symbol_table::detect_odr_violations): Pass
13487 new cache-size argument to one_addr2line(), and clear cache.
13489 2008-04-28 Cary Coutant <ccoutant@google.com>
13491 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13492 R_386_PC8 relocations.
13494 2008-04-23 Ian Lance Taylor <iant@google.com>
13496 * object.cc (Sized_relobj::include_section_group): Check for
13497 invalid section group.
13499 * object.cc (make_elf_object): Correct test for 64-bit ELF file
13502 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13503 than read for file header.
13504 * archive.cc (Archive::include_member): Likewise.
13506 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
13508 * aclocal.m4: Regenerate.
13509 * configure: Regenerate.
13511 2008-04-19 Ian Lance Taylor <iant@google.com>
13513 * version.cc (version_string): Bump to 1.6.
13515 * testsuite/Makefile.am (many_sections_r_test): New target.
13516 (many_sections_r_test_SOURCES): Remove.
13517 (many_sections_r_test_DEPENDENCIES): Remove.
13518 (many_sections_r_test_LDFLAGS): Remove.
13519 (many_sections_r_test_LDADD): Remove.
13521 * object.cc (Sized_relobj::do_add_symbols): Always pass
13522 local_symbol_count_ to add_from_relobj.
13524 * testsuite/Makefile.am (many_sections_check.h): Only check one in
13525 every thousand variables.
13526 * testsuite/Makefile.in: Rebuild.
13528 * object.cc (Xindex::initialize_symtab_xindex): New function.
13529 (Xindex::read_symtab_xindex): New function.
13530 (Xindex::sym_xindex_to_shndx): New function.
13531 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13533 (Sized_relobj::do_initialize_xindex): New function.
13534 (Sized_relobj::do_read_symbols): Adjust section links.
13535 (Sized_relobj::symbol_section_and_value): Add is_ordinary
13536 parameter. Change all callers.
13537 (Sized_relobj::include_section_group): Adjust section links and
13538 symbol section indexes.
13539 (Sized_relobj::do_layout): Adjust section links.
13540 (Sized_relobj::do_count_local_symbols): Adjust section links and
13541 symbol section indexes.
13542 (Sized_relobj::do_finalize_local_symbols): Distinguish between
13543 ordinary and special symbols.
13544 (Sized_relobj::write_local_symbols): Add symtab_xindex and
13545 dynsym_xindex parameters. Change all callers. Adjust section
13546 links. Use SHN_XINDEX when needed.
13547 (Sized_relobj::get_symbol_location_info): Adjust section links.
13548 Don't get fooled by special symbols.
13549 * object.h (class Xindex): Define.
13550 (class Object): Add xindex_ parameter. Declare virtual functoin
13551 do_initialize_xindex.
13552 (Object::adjust_sym_shndx): New function.
13553 (Object::set_xindex): New protected function.
13554 (class Symbol_value): Add is_ordinary_shndx_ field.
13555 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13556 (Symbol_value::value): Assert ordinary section.
13557 (Symbol_value::initialize_input_to_output_map): Likewise.
13558 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13559 Change all callers.
13560 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
13562 (class Sized_relobj): Update declarations.
13563 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13564 parameter. Change all callers.
13565 (Sized_relobj::adjust_shndx): New function.
13566 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13568 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13569 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
13570 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
13571 (Sized_dynobj::read_dynsym_section): Adjust section links.
13572 (Sized_dynobj::read_dynamic): Likewise.
13573 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
13575 (Sized_dynobj::do_initialize_xindex): New function.
13576 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
13577 do_initialize_xindex.
13578 (Sized_dynobj::adjust_shndx): New function.
13579 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13580 dynsym_xindex_ fields.
13581 (Layout::finalize): Add a call to set_section_indexes before
13582 creating the symtab sections.
13583 (Layout::set_section_indexes): Don't do anything if the section
13584 already has a section index.
13585 (Layout::create_symtab_sections): Add shnum parameter. Change
13586 caller. Create .symtab_shndx section if needed.
13587 (Layout::create_shdrs): Add shstrtab_section parameter. Change
13589 (Layout::allocated_output_section_count): New function.
13590 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13592 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13593 fields. Update declarations.
13594 (Layout::symtab_xindex): New function.
13595 (Layout::dynsym_xindex): New function.
13596 (class Write_symbols_task): Add layout_ field.
13597 (Write_symbols_task::Write_symbols_task): Add layout parameter.
13599 * output.cc (Output_section_headers::Output_section_headers): Add
13600 shstrtab_section parameter. Change all callers.
13601 (Output_section_headers::do_sized_write): Store overflow values
13602 for section count and section string table section index in
13603 section header zero.
13604 (Output_file_header::do_sized_write): Check for overflow of
13605 section count and section string table section index.
13606 (Output_symtab_xindex::do_write): New function.
13607 (Output_symtab_xindex::endian_do_write): New function.
13608 * output.h (class Output_section_headers): Add shstrtab_section_.
13609 Update declarations.
13610 (class Output_symtab_xindex): Define.
13611 (Output_section::has_out_shndx): New function.
13612 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13614 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13615 Change all callers.
13616 (Sized_symbol::init): Likewise.
13617 (Symbol::output_section): Check for ordinary symbol.
13618 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
13619 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
13621 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13622 Change all callers. Simplify handling of symbols from sections
13623 not included in the link.
13624 (Symbol_table::add_from_dynobj): Handle ordinary symbol
13626 (Weak_alias_sorter::operator()): Assert that symbols are
13628 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13630 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13631 parameters. Change all callers.
13632 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
13633 symbol distinction. Use SHN_XINDEX when needed.
13634 (Symbol_table::write_section_symbol): Add symtab_xindex
13635 parameter. Change all callers.
13636 (Symbol_table::sized_write_section_symbol): Likewise. Use
13637 SHN_XINDEX when needed.
13638 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
13640 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
13641 (Symbol::is_defined): Check is_ordinary.
13642 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13643 (Symbol::is_absolute, Symbol::is_common): Likewise.
13644 (class Sized_symbol): Update declarations.
13645 (class Symbol_table): Update declarations.
13646 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13647 parameters. Change all callers.
13648 (Sized_symbol::override): Likewise.
13649 (Symbol_table::override): Likewise.
13650 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
13651 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
13652 is_ordinary, and orig_st_shndx parameters. Change all callers.
13653 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13654 to be in an ordinary section.
13655 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13656 object and is_ordinary parameters. Change all callers.
13657 (Sized_dwarf_line_info::read_relocs): Add object parameter.
13658 Change all callers. Don't add undefined or non-ordinary symbols
13660 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13661 Change all callers.
13662 * dwarf_reader.h (class Sized_dwarf_line_info): Update
13664 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13665 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13666 (Sized_relobj::relocate_sections): Likewise.
13667 * target-reloc.h (scan_relocs): Adjust section symbol index.
13668 (scan_relocatable_relocs): Likewise.
13669 * i386.cc (Scan::local): Check for ordinary symbols.
13670 * sparc.cc (Scan::local): Likewise.
13671 * x86_64.cc (Scan::local): Likewise.
13672 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13673 to symbol_section_and_value.
13674 * testsuite/many_sections_test.cc: New file.
13675 * testsuite/Makefile.am (BUILT_SOURCES): Define.
13676 (check_PROGRAMS): Add many_sections_test.
13677 (many_sections_test_SOURCES): Define.
13678 (many_sections_test_DEPENDENCIES): Define.
13679 (many_sections_test_LDFLAGS): Define.
13680 (BUILT_SOURCES): Add many_sections_define.h.
13681 (many_sections_define.h): New target.
13682 (BUILT_SOURCES): Add many_sections_check.h.
13683 (many_sections_check.h): New target.
13684 (check_PROGRAMS): Add many_sections_r_test.
13685 (many_sections_r_test_SOURCES): Define.
13686 (many_sections_r_test_DEPENDENCIES): Define.
13687 (many_sections_r_test_LDFLAGS): Define.
13688 (many_sections_r_test_LDADD): Define.
13689 (many_sections_r_test.o): New target.
13690 * testsuite/Makefile.in: Rebuild.
13692 2008-04-17 Cary Coutant <ccoutant@google.com>
13694 * errors.cc (Errors::info): New function.
13695 (gold_info): New function.
13696 * errors.h (Errors::info): New function.
13697 * gold.h (gold_info): New function.
13698 * object.cc (Input_objects::add_object): Print trace output.
13699 * options.cc (options::parse_set): New function.
13700 (General_options::parse_wrap): Deleted.
13701 (General_options::General_options): Deleted initializer.
13702 * options.h (options::String_set): New typedef.
13703 (options::parse_set): New function.
13704 (DEFINE_set): New macro.
13705 (General_options::wrap): Changed to use DEFINE_set. Changed
13706 callers of any_wrap_symbols and is_wrap_symbol.
13707 (General_options::trace, General_options::trace_symbol):
13709 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13710 (General_options::wrap_symbols_): Deleted.
13711 * symtab.cc (Symbol_table::add_from_object): Print trace output.
13713 2008-04-17 David S. Miller <davem@davemloft.net>
13715 * options.cc (General_options::parse_V): New function.
13716 * options.h: Add entries for -V and -Qy.
13718 2008-04-17 Ian Lance Taylor <iant@google.com>
13720 * common.cc (Symbol_table::allocate_commons): Remove options
13721 parameter. Change caller.
13722 (Symbol_table::do_allocate_commons): Remove options parameter.
13723 Change caller. Just call do_allocate_commons_list twice.
13724 (Symbol_table::do_allocate_commons_list): New function, broken out
13725 of do_allocate_commons.
13726 * common.h (class Allocate_commons_task): Remove options_ field.
13727 Update constructor.
13728 * symtab.cc (Symbol_table::Symbol_table): Initialize
13730 (Symbol_table::add_from_object): Put TLS common symbols on
13732 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13733 which are IN_OUTPUT_DATA.
13734 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
13735 allocate_commons and do_allocate_commons declarations. Declare
13736 do_allocate_commons_list.
13737 * gold.cc (queue_middle_tasks): Update creation of
13738 Allocate_commons_task to not pass options.
13739 * testsuite/Makefile.am (INCLUDES): Add -I.. .
13740 (TLS_TEST_C_FLAGS): New variable.
13741 (tls_test_c_pic.o): New target.
13742 (tls_test_shared.so): Link in tls_test_c_pic.o.
13743 (tls_test_c_pic_ie.o): New target.
13744 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13745 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13746 (tls_test_c.o): New target.
13747 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13748 (tls_pic_test_LDADD): Likewise.
13749 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13750 (tls_shared_gd_to_ie_test_LDADD): Likewise.
13751 (tls_test_c_gnu2.o): New target.
13752 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13754 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13755 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13756 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13757 * testsuite/tls_test.cc: Include "config.h".
13758 (t_last): Call t11_last.
13759 * testsuite/tls_test.h (t11, t11_last): Declare.
13760 * testsuite/tls_test_c.c: New file.
13761 * testsuite/tls_test_main.cc (thread_routine): Call t11.
13762 * configure.ac: Check for OpenMP support.
13763 * configure, config.in, Makefile.in: Rebuild.
13764 * testsuite/Makefile.in: Rebuild.
13766 2008-04-16 Cary Coutant <ccoutant@google.com>
13768 * i386.cc (Target_i386::define_tls_base_symbol): New function.
13769 (Target_i386::tls_base_symbol_defined_): New field.
13770 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13771 (Target_i386::Scan::global): Likewise.
13772 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13773 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13774 (Target_x86_64::tls_base_symbol_defined_): New field.
13775 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13776 (Target_x86_64::Scan::global): Likewise.
13778 2008-04-16 Cary Coutant <ccoutant@google.com>
13780 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13781 (Symbol::needs_plt_entry): Allow weak undefined symbols.
13782 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13783 building shared libraries.
13784 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13785 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13786 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13787 * testsuite/Makefile.in: Rebuild.
13788 * testsuite/weak_undef.h: New file.
13789 * testsuite/weak_undef_file1.cc: Add extra test cases.
13790 * testsuite/weak_undef_file2.cc: Likewise.
13791 * testsuite/weak_undef_test.cc: Likewise.
13793 2008-04-16 David S. Miller <davem@davemloft.net>
13795 * sparc.cc (Target_sparc::Scan): Change from struct to class.
13796 Add issued_non_pic_error_ field. Declare check_non_pic.
13797 (Target_sparc::Scan::check_non_pic): New function.
13798 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13799 (Target_sparc::Scan::global): Likewise.
13801 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13802 * configure: Rebuild.
13804 * options.h (DEFINE_enable): New macro.
13805 (new_dtags): New enable option.
13806 (initfirst, interpose, loadfltr, nodefaultlib,
13807 nodelete, nodlopen, nodump): New -z options.
13808 * layout.cc (Layout:finish_dynamic_section): If new
13809 dtags enabled, emit DT_RUNPATH. Also, emit a
13810 DT_FLAGS_1 containing any specified -z flags.
13812 2008-04-16 Ian Lance Taylor <iant@google.com>
13814 * copy-relocs.cc: New file.
13815 * copy-relocs.h: New file.
13816 * reloc.cc: Remove Copy_relocs code.
13817 * reloc.h: Likewise.
13818 * reloc-types.h (struct Reloc_types) [both versions]: Add
13819 get_reloc_addend_noerror.
13820 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13821 variants of add_global which take an addend which must be zero.
13822 * i386.cc: Include "copy-relocs.h".
13823 (class Target_i386): Change type of copy_relocs_ to variable,
13824 update initializer.
13825 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13826 Change all callers.
13827 (Target_i386::do_finalize_sections): Change handling of
13829 * sparc.cc: Include "copy-relocs.h".
13830 (class Target_sparc): Change type of copy_relocs_ to variable,
13831 update initializer.
13832 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13833 Change all callers.
13834 (Target_sparc::do_finalize_sections): Change handling of
13836 * x86_64.cc: Include "copy-relocs.h".
13837 (class Target_x86_64): Change type of copy_relocs_ to variable,
13838 update initializer.
13839 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13840 class. Change all callers.
13841 (Target_x86_64::do_finalize_sections): Change handling of
13843 * Makefile.am (CCFILES): Add copy-relocs.cc.
13844 (HFILES): Add copy-relocs.h.
13846 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13848 * testsuite/script_test_4.sh: Permit leading zeroes.
13850 2008-04-15 Ian Lance Taylor <iant@google.com>
13852 * script-sections.cc (Script_sections::create_segments): Use
13853 header_size_adjustment even when there is enough room for the
13855 * testsuite/script_test_4.sh: New file.
13856 * testsuite/script_test_4.t: New file.
13857 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13858 (check_DATA): Add script_test_4.stdout.
13859 (MOSTLYCLEANFILES): Likewise.
13860 (script_test_4): New target.
13861 (script_test_4.stdout): New target.
13862 * testsuite/Makefile.in: Rebuild.
13864 * sparc.cc: Add definitions for Output_data_plt_sparc class
13867 2008-04-14 David S. Miller <davem@davemloft.net>
13869 * sparc.cc: New file.
13870 * Makefile.am (TARGETSOURCES): Add sparc.cc
13871 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13872 * configure.tgt: Document targ_extra_size and
13873 targ_extra_big_endian. Add entries for sparc-* and
13875 * configure.ac: Handle targ_extra_size and
13876 targ_extra_big_endian.
13877 * Makefile.in: Rebuild.
13878 * configure: Likewise.
13879 * po/POTFILES.in: Likewise.
13880 * po/gold.pot: Likewise.
13882 2008-04-14 Ian Lance Taylor <iant@google.com>
13884 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13885 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13886 in the name/type/flags to section mapping. Don't call
13887 allocate_output_section.
13888 (Layout::choose_output_section): Change parameter from adjust_name
13889 to is_input_section. Don't permit input sections after sections
13890 are attached to segments. Don't call allocate_output_section.
13891 (Layout::layout_eh_frame): Call update_flags_for_input_section,
13892 not write_enable_output_section.
13893 (Layout::make_output_section): Don't push to
13894 unattached_section_list_ nor call attach_to_segment. Call
13895 attach_section_to_segment if sections are attached.
13896 (Layout::attach_sections_to_segments): New function.
13897 (Layout::attach_section_to_segment): New function.
13898 (Layout::attach_allocated_section_to_segment): Rename from
13899 attach_to_segment. Remove flags parameter.
13900 (Layout::allocate_output_section): Remove function.
13901 (Layout::write_enable_output_section): Remove function.
13902 * layout.h (class Layout): Update for above changes. Add new
13903 field sections_are_attached_.
13904 * output.h (Output_section::update_flags_for_input_section): New
13906 * output.cc (Output_section::add_input_section): Call
13907 update_flags_for_input_section.
13908 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13910 2008-04-11 Cary Coutant <ccoutant@google.com>
13912 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13913 thought unnecessary.
13914 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13916 2008-04-11 Ian Lance Taylor <iant@google.com>
13918 * output.h (class Output_section_data): Remove inline definition
13920 * output.cc (Output_section_data::set_addralign): New function.
13922 2008-04-11 Cary Coutant <ccoutant@google.com>
13924 Add support for TLS descriptors for i386 and x86_64.
13925 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13926 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13927 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13929 (Target_i386::got_mod_index_entry): Remove unnecessary code.
13930 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13931 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
13933 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13934 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13935 Fix problem with initial-exec relocations.
13936 (Target_i386::Relocate::relocate_tls): Likewise.
13937 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13939 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13940 support for section-plus-offset dynamic table entries.
13941 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13942 (Output_data_dynamic::Dynamic_entry): Add support for
13943 section-plus-offset dynamic table entries.
13944 (Output_data_dynamic::Classification): Likewise.
13945 (Output_data_dynamic::classification_): Renamed offset_.
13946 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13947 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13948 (Target_x86_64::make_plt_section): New function.
13949 (Target_x86_64::reserve_tlsdesc_entries): New function.
13950 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13951 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13952 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13953 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13954 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13955 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13956 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13957 add extra PLT entry for TLS descriptors.
13958 (Output_data_plt_x86_64::got_): New field.
13959 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13960 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13962 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13964 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13965 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13966 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13967 R_386_TLS_DESC_CALL relocations.
13968 (Target_x86_64::Scan::global): Likewise.
13969 (Target_x86_64::do_finalize_sections): Add dynamic table entries
13970 for TLS descriptors.
13971 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13972 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13973 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13974 GD-to-IE relaxation.
13975 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13976 and TLS_DESCRIPTORS.
13977 * Makefile.in: Rebuild.
13978 * configure: Rebuild.
13979 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13980 (tls_test_shared2.so): New target.
13981 (tls_shared_gd_to_ie_test_SOURCES): New variable.
13982 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13983 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13984 (tls_shared_gd_to_ie_test_LDADD): New variable.
13985 (tls_shared_gnu2_gd_to_ie_test): New target.
13986 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13988 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13989 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13990 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13991 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13992 (tls_shared_gnu2_test): New target.
13993 (tls_test_gnu2_shared.so): New target.
13994 (tls_shared_gnu2_test_SOURCES): New variable.
13995 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13996 (tls_shared_gnu2_test_LDFLAGS): New variable.
13997 (tls_shared_gnu2_test_LDADD): New variable.
13998 * testsuite/Makefile.in: Rebuild.
13999 * testsuite/Makefile.
14001 2008-04-11 Ian Lance Taylor <iant@google.com>
14003 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14005 * testsuite/Makefile.in: Rebuild.
14007 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14009 * testsuite/script_test_2.cc (main): Adjust test.
14011 2008-04-11 David S. Miller <davem@davemloft.net>
14012 Ian Lance Taylor <iant@google.com>
14014 * options.h (General_options): Add entries for '-Y' and
14016 * options.cc (General_options:finalize): If -Y was used, add those
14017 entries to the library path instead of the default "/lib" and
14020 2008-04-11 David S. Miller <davem@davemloft.net>
14022 * testsuite/justsyms.t: Start at 0x100.
14023 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14024 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14026 * testsuite/script_test_2.cc: Adjust string and section length
14029 2008-04-09 Ian Lance Taylor <iant@google.com>
14032 * script-sections.cc (Sections_element::allocate_to_segment): Add
14034 (Output_section_definition::allocate_to_segment): Likewise.
14035 (Orphan_output_section::allocate_to_segment): Likewise.
14036 (Script_sections::attach_sections_using_phdrs_clause): Don't
14037 propagate non-PT_LOAD segments to orphan sections.
14038 * testsuite/Makefile.am (script_test_3.stdout): Generate using
14039 readelf rather than objdump.
14040 * testsuite/script_test_3.sh: Adjust accordingly. Test that
14041 .interp section and PT_INTERP segment are the same size.
14042 * testsuite/Makefile.in: Rebuild.
14044 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14045 aliases for symbols defined in the same object.
14046 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14047 (weak_alias_test_SOURCES): New variable.
14048 (weak_alias_test_DEPENDENCIES): New variable.
14049 (weak_alias_test_LDFLAGS): New variable.
14050 (weak_alias_test_LDADD): New variable.
14051 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14052 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14053 (weak_alias_test_3.o): New target.
14054 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14055 * testsuite/weak_alias_test_main.cc: New file.
14056 * testsuite/weak_alias_test_1.cc: New file.
14057 * testsuite/weak_alias_test_2.cc: New file.
14058 * testsuite/weak_alias_test_3.cc: New file.
14060 2008-04-08 Ian Lance Taylor <iant@google.com>
14062 * options.h (class General_options): Add --noinhibit-exec option.
14063 * main.cc (main): Check --noinhibit-exec.
14065 * options.h (class General_options): Define --wrap as a special
14066 option. Add wrap_symbols_ field.
14067 (General_options::any_wrap_symbols): New function.
14068 (General_options::is_wrap_symbol): New function.
14069 * options.cc (General_options::parse_wrap): New function.
14070 (General_options::General_options): Initialize wrap_symbols_.
14071 * symtab.cc (Symbol_table::wrap_symbol): New function.
14072 (Symbol_table::add_from_object): Handle --wrap.
14073 * symtab.h (class Symbol_table): Declare wrap_symbol.
14074 * target.h (Target::wrap_char): New function.
14075 (Target::Target_info): Add wrap_char field.
14076 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14077 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14078 * testsuite/testfile.cc (Target_test::test_target_info):
14081 * errors.cc (Errors::undefined_symbol): Mention symbol version if
14084 * layout.h (class Layout): Add added_eh_frame_data_ field.
14085 * layout.cc (Layout::Layout): Initialize new field.
14086 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14087 output section until we find a section we merged successfully.
14088 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14089 that the size be non-zero.
14091 * merge.cc (Object_merge_map::get_output_offset): Remove inline
14094 2008-04-08 Craig Silverstein <csilvers@google.com>
14096 * configure.ac: Export new conditional variable HAVE_ZLIB.
14097 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14099 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14100 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14102 2008-04-07 Ian Lance Taylor <iant@google.com>
14104 * version.cc (version_string): Set to "1.5".
14106 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14107 Add issued_non_pic_error_ field. Declare check_non_pic.
14108 (Target_x86_64::Scan::check_non_pic): New function.
14109 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14110 (Target_x86_64::Scan::global): Likewise.
14112 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14113 addend parameter. Change caller. Handle merge sections.
14114 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14115 Address to Addend. Don't add in the result of
14116 local_section_offset, pass down the addend and use the returned
14118 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14119 Update declarations of local_section_offset and symbol_value.
14120 * testsuite/two_file_test_1.cc (t18): New function.
14121 * testsuite/two_file_test_2.cc (f18): New function.
14122 * testsuite/two_file_test_main.cc (main): Call t18.
14123 * testsuite/two_file_test.h (t18, f18): Declare.
14125 * configure.ac: Don't test for objdump, c++filt, or readelf.
14126 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14128 (TEST_READELF): New variable.
14129 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14130 (check_PROGRAMS): Add two_file_strip_test.
14131 (two_file_strip_test): New target.
14132 (check_PROGRAMS): Add two_file_same_shared_strip_test.
14133 (two_file_same_shared_strip_test_SOURCES): New variable.
14134 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14135 (two_file_same_shared_strip_test_LDFLAGS): New variable.
14136 (two_file_same_shared_strip_test_LDADD): New variable.
14137 (two_file_shared_strip.so): New target.
14138 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14139 (ver_test_5.syms, ver_test_7.syms): Likewise.
14140 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14141 (strip_test_3.stdout): Use TEST_OBJDUMP.
14142 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14144 2008-04-04 Cary Coutant <ccoutant@google.com>
14146 * symtab.h (Symbol::is_weak_undefined): New function.
14147 (Symbol::is_strong_undefined): New function.
14148 (Symbol::is_absolute): New function.
14149 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14150 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14152 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14153 (weak_undef_test): New target.
14154 * testsuite/Makefile.in: Rebuild.
14155 * testsuite/weak_undef_file1.cc: New file.
14156 * testsuite/weak_undef_file2.cc: New file.
14157 * testsuite/weak_undef_test.cc: New file.
14159 2008-04-03 Craig Silverstein <csilvers@google.com>
14161 * compressed_output.h (class Output_compressed_section): Use
14163 * compressed_output.cc (zlib_compress): Use unsigned buffers,
14165 (zlib_compressed_suffix): Removed.
14166 (Output_compressed_section::set_final_data_size): Use unsigned
14168 * testsuite/Makefile.am (flagstest_compress_debug_sections):
14169 Fix linker invocation.
14170 (flagstest_o_specialfile_and_compress_debug_sections):
14172 * testsuite/Makefile.in: Regenerated.
14174 2008-04-02 David S. Miller <davem@davemloft.net>
14176 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14177 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14179 2008-04-02 Craig Silverstein <csilvers@google.com>
14183 2008-04-02 Ian Lance Taylor <iant@google.com>
14185 * fileread.cc (File_read::find_view): Add byteshift and vshifted
14186 parameters. Update for new key type to views_. Change all
14188 (File_read::read): Adjust for byteshift in returned view.
14189 (File_read::add_view): New function, broken out of
14190 find_and_make_view.
14191 (File_read::make_view): New function, broken out of
14192 find_and_make_view.
14193 (File_read::find_or_make_view): Add offset and aligned
14194 parameters. Rewrite accordingly. Change all callers.
14195 (File_read::get_view): Add offset and aligned parameters. Adjust
14196 for byteshift in return value.
14197 (File_read::get_lasting_view): Likewise.
14198 * fileread.h (class File_read): Update declarations.
14199 (class File_read::View): Add byteshift_ field. Add byteshift to
14200 constructor. Add byteshift method.
14201 * archive.h (Archive::clear_uncached_views): New function.
14202 (Archive::get_view): Add aligned parameter. Change all callers.
14203 * object.h (Object::get_view): Add aligned parameter. Change all
14205 (Object::get_lasting_view): Likewise.
14207 * fileread.cc (File_read::release): Don't call clear_views if
14208 there are multiple objects.
14209 * fileread.h (File_read::clear_uncached_views): New function.
14210 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14213 2008-03-31 Cary Coutant <ccoutant@google.com>
14215 Add thin archive support.
14216 * archive.cc (Archive::armagt): New const.
14217 (Archive::setup): Remove task parameter and calls to unlock.
14218 (Archive::unlock_nested_archives): New function.
14219 (Archive::read_header): Add nested_off parameter. Change
14221 (Archive::interpret_header): Likewise.
14222 (Archive::include_all_members): Change to handle thin
14224 (Archive::include_member): Likewise.
14225 * archive.h (Archive::Archive): Add new parameters and
14227 (Archive::armagt): New const.
14228 (Archive::setup): Remove task parameter.
14229 (Archive::unlock_nested_archives): New function.
14230 (Archive::read_header): Add nested_off parameter.
14231 (Archive::interpret_header): Likewise.
14232 (Archive::Nested_archive_table): New typedef.
14233 (Archive::is_thin_archive_): New field.
14234 (Archive::nested_archives_): New field.
14235 (Archive::options_): New field.
14236 (Archive::dirpath_): New field.
14237 (Archive::task_): New field.
14238 * readsyms.cc (Read_symbols::do_read_symbols): Add check
14239 for thin archives. Pass additional parameters to
14240 Archive::Archive. Unlock the archive file after calling
14243 2008-03-29 Ian Lance Taylor <iant@google.com>
14245 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14246 version symbol to be local.
14247 * testsuite/ver_test_4.sh: New file.
14248 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14249 (check_DATA): Add ver_test_4.syms.
14250 (ver_test_4.syms): New target.
14251 * testsuite/Makefile.in: Rebuild.
14254 (Output_section::Input_section_sort_entry::has_priority): New
14256 (Output_section::Input_section_sort_entry::match_file_name): New
14258 (Output_section::Input_section_sort_entry::match_section_name):
14260 (Output_section::Input_section_sort_entry::match_section_name_prefix):
14262 (Output_section::Input_section_sort_entry::match_section_file):
14264 (Output_section::Input_section_sort_compare::operator()): Rewrite
14265 using new Input_section_sort_entry functions. Sort crtbegin and
14266 crtend first. Sort sections with no priority before sections with
14268 * testsuite/initpri1.c (d3): Check j != 4.
14269 (cd5): New constructor/destructor function.
14270 (main): Check j != 2.
14272 * symtab.cc (Symbol_table::add_from_object): If we don't use the
14273 new symbol when resolving, don't call set_is_default.
14274 * testsuite/ver_test_7.cc: New file.
14275 * testsuite/ver_test_7.sh: New file.
14276 * testsuite/Makefile.am (ver_test_7.so): New target.
14277 (ver_test_7.o): New target.
14278 (check_SCRIPTS): Add ver_test_7.sh.
14279 (check_DATA): Add ver_test_7.syms.
14280 (ver_test_7.syms): New target.
14282 2008-03-28 Ian Lance Taylor <iant@google.com>
14284 * layout.cc (Layout::layout): If we see an input section with a
14285 name that needs sorting, set the must_sort flag for the output
14287 (Layout::make_output_section): If the name of the output section
14288 indicates that it might require sorting, set the may_sort flag.
14289 * output.h (Output_section::may_sort_attached_input_sections): New
14291 (Output_section::set_may_sort_attached_input_sections): New
14293 (Output_section::must_sort_attached_input_sections): New
14295 (Output_section::set_must_sort_attached_input_sections): New
14297 (class Output_section): Declare Input_section_sort_entry. Define
14298 Input_section_sort_compare. Declare
14299 sort_attached_input_sections. Add new fields:
14300 may_sort_attached_input_sections_,
14301 must_sort_attached_input_sections_,
14302 attached_input_sections_are_sorted_.
14303 * output.cc (Output_section::Output_section): Initialize new
14305 (Output_section::add_input_section): Add an entry to
14306 input_sections_ if may_sort or must_sort are true.
14307 (Output_section::set_final_data_size): Call
14308 sort_attached_input_sections if necessary.
14309 (Output_section::Input_section_sort_entry): Define new class.
14310 (Output_section::Input_section_sort_compare::operator()): New
14312 (Output_section::sort_attached_input_sections): New function.
14313 * configure.ac: Check whether the compiler supports constructor
14314 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
14315 * testsuite/initpri1.c: New file.
14316 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14317 CONSTRUCTOR_PRIORITY.
14318 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14319 (initpri1_LDFLAGS): New variable.
14320 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14322 2008-03-27 Ian Lance Taylor <iant@google.com>
14324 * common.cc (Sort_commons::operator): Correct sorting algorithm.
14325 * testsuite/common_test_1.c: New file.
14326 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14327 (common_test_1_SOURCES): New variable.
14328 (common_test_1_DEPENDENCIES): New variable.
14329 (common_test_1_LDFLAGS): New variable.
14331 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14332 and commons_ correctly when NAME/VERSION does not override
14334 * testsuite/ver_test_6.c: New file.
14335 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14336 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14337 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14339 2008-03-26 Ian Lance Taylor <iant@google.com>
14341 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14342 of an undefined symbol from a version script.
14343 * testsuite/Makefile.am (ver_test_5.so): New target.
14344 (ver_test_5.o): New target.
14345 (check_SCRIPTS): Add ver_test_5.sh.
14346 (check_DATA): Add ver_test_5.syms.
14347 (ver_test_5.syms): New target.
14348 * testsuite/ver_test_5.cc: New file.
14349 * testsuite/ver_test_5.script: New file.
14350 * testsuite/ver_test_5.sh: New file.
14351 * Makefile.in, testsuite/Makefile.in: Rebuild.
14354 Fix problems building gold with gcc 4.3.0.
14355 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14356 (gold_error_at_location, gold_warning_at_location): Use it.
14357 * configure.ac: Check whether we can compile and use a template
14358 function with a printf attribute.
14359 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14360 when jumping over bytes.
14361 * object.cc: Instantiate Object::read_section_data.
14362 * debug.h: Include <cstring>
14363 * dwarf_reader.cc: Include <algorithm>
14364 * main.cc: Include <cstring>.
14365 * options.cc: Include <cstring>.
14366 * output.cc: Include <cstring>.
14367 * script.cc: Include <cstring>.
14368 * script.h: Include <string>.
14369 * symtab.cc: Include <cstring> and <algorithm>.
14370 * target-select.cc: Include <cstring>.
14371 * version.cc: Include <string>.
14372 * testsuite/testmain.cc: Include <cstdlib>.
14373 * configure, config.in: Rebuild.
14375 2008-03-25 Ian Lance Taylor <iant@google.com>
14377 * options.cc: Include "../bfd/bfdver.h".
14378 (options::help): Print bug reporting address.
14380 * version.cc (print_version): Adjust output for current value of
14381 BFD_VERSION_STRING.
14385 * options.cc (options::help): Print list of supported targets.
14386 * target-select.h: Include <vector>.
14387 (class Target_selector): Make machine_, size_, and is_big_endian_
14388 fields const. Add bfd_name_ and instantiated_target_ fields.
14389 (Target_selector::Target_selector): Add bfd_name parameter.
14390 (Target_selector::recognize): Make non-virtual, call
14392 (Target_selector::recognize_by_name): Make non-virtual, call
14393 do_recognize_by_name.
14394 (Target_selector::supported_names): New function.
14395 (Target_selector::bfd_name): New function.
14396 (Target_selector::do_instantiate_target): New pure virtual
14398 (Target_selector::do_recognize): New virtual function.
14399 (Target_selector::do_recognize_by_name): New virtual function.
14400 (Target_selector::instantiate_target): New private function.
14401 (supported_target_names): Declare.
14402 * target-select.cc (Target_selector::Target_selector): Update for
14403 new parameter and fields.
14404 (select_target_by_name): Check that the name matches before
14405 calling recognize_by_name.
14406 (supported_target_names): New function.
14407 * i386.cc (class Target_selector_i386): Update Target_selector
14408 constructor call. Remove recognize and recognize_by_name. Add
14409 do_instantiate_target.
14410 * x86_64.cc (class Target_selector_x86_64): Likewise.
14411 * testsuite/testfile.cc (class Target_selector_test): Update for
14412 changes to Target_selector.
14414 * README: Rewrite, with some notes on unsupported features.
14416 2008-03-24 Cary Coutant <ccoutant@google.com>
14418 * i386.cc (Target_i386::Got_type): New enum declaration.
14419 (Target_i386::Scan::local): Updated callers of Output_data_got
14421 (Target_i386::Scan::global): Likewise.
14422 (Target_i386::Relocate::relocate): Likewise.
14423 (Target_i386::Relocate::relocate_tls): Likewise.
14424 * object.h (Got_offset_list): New class.
14425 (Sized_relobj::local_has_got_offset): Added got_type parameter.
14426 (Sized_relobj::local_got_offset): Likewise.
14427 (Sized_relobj::set_local_got_offset): Likewise.
14428 (Sized_relobj::local_has_tls_got_offset): Removed.
14429 (Sized_relobj::local_tls_got_offset): Removed.
14430 (Sized_relobj::set_local_tls_got_offset): Removed.
14431 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14432 * output.cc (Output_data_got::add_global): Added got_type parameter.
14433 (Output_data_got::add_global_with_rel): Likewise.
14434 (Output_data_got::add_global_with_rela): Likewise.
14435 (Output_data_got::add_global_pair_with_rel): New function.
14436 (Output_data_got::add_global_pair_with_rela): New function.
14437 (Output_data_got::add_local): Added got_type parameter.
14438 (Output_data_got::add_local_with_rel): Likewise.
14439 (Output_data_got::add_local_with_rela): Likewise.
14440 (Output_data_got::add_local_pair_with_rel): New function.
14441 (Output_data_got::add_local_pair_with_rela): New function.
14442 (Output_data_got::add_global_tls): Removed.
14443 (Output_data_got::add_global_tls_with_rel): Removed.
14444 (Output_data_got::add_global_tls_with_rela): Removed.
14445 (Output_data_got::add_local_tls): Removed.
14446 (Output_data_got::add_local_tls_with_rel): Removed.
14447 (Output_data_got::add_local_tls_with_rela): Removed.
14448 * output.h (Output_data_got::add_global): Added got_type parameter.
14449 (Output_data_got::add_global_with_rel): Likewise.
14450 (Output_data_got::add_global_with_rela): Likewise.
14451 (Output_data_got::add_global_pair_with_rel): New function.
14452 (Output_data_got::add_global_pair_with_rela): New function.
14453 (Output_data_got::add_local): Added got_type parameter.
14454 (Output_data_got::add_local_with_rel): Likewise.
14455 (Output_data_got::add_local_with_rela): Likewise.
14456 (Output_data_got::add_local_pair_with_rel): New function.
14457 (Output_data_got::add_local_pair_with_rela): New function.
14458 (Output_data_got::add_global_tls): Removed.
14459 (Output_data_got::add_global_tls_with_rel): Removed.
14460 (Output_data_got::add_global_tls_with_rela): Removed.
14461 (Output_data_got::add_local_tls): Removed.
14462 (Output_data_got::add_local_tls_with_rel): Removed.
14463 (Output_data_got::add_local_tls_with_rela): Removed.
14464 * resolve.cc (Symbol::override_base_with_special): Removed
14465 reference to has_got_offset_ field.
14466 * symtab.cc (Symbol::init_fields): Replaced initialization
14467 of got_offset_ with got_offsets_. Removed initialization
14469 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14470 (Symbol::got_offset): Likewise.
14471 (Symbol::set_got_offset): Likewise.
14472 (Symbol::has_tls_got_offset): Removed.
14473 (Symbol::tls_got_offset): Removed.
14474 (Symbol::set_tls_got_offset): Removed.
14475 (Symbol::got_offset_): Removed.
14476 (Symbol::tls_mod_got_offset_): Removed.
14477 (Symbol::tls_pair_got_offset_): Removed.
14478 (Symbol::got_offsets_): New field.
14479 (Symbol::has_got_offset): Removed.
14480 (Symbol::has_tls_mod_got_offset): Removed.
14481 (Symbol::has_tls_pair_got_offset): Removed.
14482 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14483 (Target_x86_64::Scan::local): Updated callers of Output_data_got
14485 (Target_x86_64::Scan::global): Likewise.
14486 (Target_x86_64::Relocate::relocate): Likewise.
14487 (Target_x86_64::Relocate::relocate_tls): Likewise.
14489 2008-03-25 Ben Elliston <bje@au.ibm.com>
14491 * yyscript.y: Fix spelling error in comment.
14493 2008-03-24 Ian Lance Taylor <iant@google.com>
14495 * options.h (class General_options): Define build_id option.
14496 * layout.h (class Layout): Declare write_build_id, create_note,
14497 create_build_id. Add build_id_note_ member.
14498 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14499 "libiberty.h", "md5.h", "sha1.h".
14500 (Layout::Layout): Initialize eh_frame_data_,
14501 eh_frame_hdr_section_, and build_id_note_.
14502 (Layout::finalize): Call create_build_id.
14503 (Layout::create_note): New function, broken out of
14504 Layout::create_gold_note.
14505 (Layout::create_gold_note): Call create_note.
14506 (Layout::create_build_id): New function.
14507 (Layout::write_build_id): New function.
14508 (Close_task_runner::run): Call write_build_id.
14510 * x86_64.cc: Correct license to GPLv3.
14512 2008-03-23 Ian Lance Taylor <iant@google.com>
14514 * options.cc: Include "demangle.h".
14515 (parse_optional_string): New function.
14516 (parse_long_option): Handle takes_optional_argument.
14517 (parse_short_option): Update dash_z initializer. Handle
14518 takes_optional_argument.
14519 (General_options::General_options): Initialize do_demangle_.
14520 (General_options::finalize): Set do_demangle_. Handle demangling
14522 * options.h (parse_optional_string): Declare.
14523 (struct One_option): Add optional_arg field. Update constructor.
14524 Update call constructor calls. Add takes_optional_argument
14526 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
14527 (DEFINE_optional_string): Define.
14528 (General_options::demangle): Change from DEFINE_bool to
14529 DEFINE_optional_string.
14530 (General_options::no_demangle): New function.
14531 (General_options::do_demangle): New function.
14532 (General_options::set_do_demangle): New function.
14533 (General_options::execstack_status_): Move definition to end of
14535 (General_options::static_): Likewise.
14536 (General_options::do_demangle_): New field.
14537 * object.cc (big_endian>::get_symbol_location_info): Call
14538 Options::do_demangle, not Options::demangle.
14539 * symtab.cc (demangle): Likewise.
14541 2008-03-22 Ian Lance Taylor <iant@google.com>
14543 * gold.h: Include <cstddef> and <sys/types.h>
14544 * options.h: Include <cstring>.
14546 2008-03-21 Ian Lance Taylor <iant@google.com>
14548 * Added source code to GNU binutils.
14550 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14552 Copying and distribution of this file, with or without modification,
14553 are permitted in any medium without royalty provided the copyright
14554 notice and this notice are preserved.
14560 version-control: never