1 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
4 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
5 relocation for R_X86_64_32 on x32.
7 2013-08-27 Roland McGrath <mcgrathr@google.com>
9 * output.cc (Output_segment::set_section_addresses): Take new
10 Target* argument. If target->isolate_execinstr() and the segment
11 is executable and starts at a target->abi_pagesize() boundary,
12 pad its end out to a target->abi_pagesize() boundary with code fill.
13 * output.h (Output_segment::set_section_addresses): Update decl.
14 * layout.h (Layout::check_output_data_for_reset_values): Take new
15 argument RELAX_OUTPUTS.
16 (Layout): New member relax_output_list_.
17 (Layout::add_relax_output): New method.
18 * layout.cc (Layout::Layout): Update constructor.
19 (Layout::reset_relax_output): New method.
20 (Layout::clean_up_after_relaxation): Call it.
21 (Layout::prepare_for_relaxation): Update caller.
22 (Layout::set_segment_offsets): Update callers of set_section_addresses.
23 Call reset_relax_output before re-processing segments for
24 isolate_execinstr case.
25 (Layout::write_data): Handle relax_output_list_.
26 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
27 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
29 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
32 * object.h: Fix typos.
34 2013-08-16 Roland McGrath <mcgrathr@google.com>
36 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
37 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
39 2013-08-07 Cary Coutant <ccoutant@google.com>
41 Revert support for v2 DWP files:
43 2013-03-01 Cary Coutant <ccoutant@google.com>
45 Add dwp support for v2 DWARF package file format.
46 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
47 tu_length parameter. Adjust all callers.
48 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
49 * dwp.cc: Include dwarf.h.
50 (Section_bounds): New struct type.
51 (Unit_set): New struct type.
52 (Dwo_file::Dwo_file): Initialize new data member.
53 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
54 Combine and rename to...
55 (Dwo_file::read_unit_index): ...this.
56 (Dwo_file::sized_read_compunit_index)
57 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
58 (Dwo_file::sized_read_unit_index): ...this.
59 (Dwo_file::copy_section): Remove section_name, is_str_offsets
60 parameters; add section_id parameter.
61 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
62 (Dwo_file::add_unit_set): ...this.
63 (Dwo_file::shndx_map_): Remove.
64 (Dwo_file::sect_offsets_): New data member.
65 (Dwp_output_file::Dwp_output_file): Initialize new data members.
66 (Dwp_output_file::add_section): Rename to...
67 (Dwp_output_file::add_contribution): ...this.
68 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
69 (Dwp_output_file::add_tu_set): Likewise.
70 (Dwp_output_file::Contribution): New type.
71 (Dwp_output_file::Section::contributions): New data member.
72 (Dwp_output_file::Cu_or_tu_set): Remove.
73 (Dwp_output_file::Section::Section): New ctor.
74 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
75 (Dwp_output_file::Dwp_index::Section_table): New type.
76 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
77 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
79 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
80 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
81 (Dwp_output_file::Dwp_index::section_table): New member function.
82 (Dwp_output_file::Dwp_index::section_table_end): New member function.
83 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
84 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
85 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
86 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
87 (Dwp_output_file::Dwp_index::section_table_): New data member.
88 (Dwp_output_file::Dwp_index::section_mask_): New data member.
89 (Dwp_output_file::add_output_section): New member function.
90 (Dwp_output_file::write_new_section): New member function.
91 (Dwp_output_file::write_contributions): New member function.
92 (Dwp_output_file::section_id_map_): New data member.
93 (class Dwo_id_info_reader): Remove.
94 (class Unit_reader): New class.
95 (get_dwarf_section_name): New function.
96 (Dwo_file::read_executable): Adjust initializations of class data.
97 (Dwo_file::read): Add support for v2 package file format.
98 (Dwo_file::read_unit_index): Likewise.
99 (Dwo_file::sized_read_unit_index): Likewise.
100 (Dwo_file::copy_section): Likewise.
101 (Dwo_file::add_unit_set): Likewise.
102 (Dwp_output_file::add_output_section): Likewise.
103 (Dwp_output_file::add_contribution): Likewise.
104 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
106 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
108 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
110 (Dwp_output_file::initialize): Remove unused function.
111 (Dwp_output_file::finalize): Add support for v2 package file format.
112 (Dwp_output_file::write_index): Likewise.
113 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
116 2013-07-31 Cary Coutant <ccoutant@google.com>
118 * object.cc (Sized_relobj::do_output_section_address): New function.
119 (Sized_relobj): Instantiate explicitly.
120 * object.h (Object::output_section_address): New function.
121 (Object::do_output_section_address): New function.
122 (Sized_relobj::do_output_section_address): New function.
123 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
125 2013-07-30 Cary Coutant <ccoutant@google.com>
126 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
128 * parameters.cc (Parameters::entry): Return target-specific entry
130 * target.h (Target::entry_symbol_name): New function.
131 (Target_info::entry_symbol_name): New data member.
133 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
134 * i386.cc (Target_i386::i386_info): Likewise.
135 (Target_i386_nacl::i386_nacl_info): Likewise.
136 * sparc.cc (Target_sparc::sparc_info): Likewise.
137 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
138 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
139 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
140 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
142 2013-07-22 Sterling Augustine <saugustine@google.com>
144 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
145 Convert parameter shndx to local variable. Add parameters symtab
146 and symtab_size. Scan over section names. Find relocation
147 section corresponding to current section. Create and initialize
148 reloc_mapper_ and reloc_type_.
149 (Dwarf_pubnames_table::read_header): Add assertion. Change
150 unit_length to off_t. Initialize member unit_length_. Fill in field
152 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
153 Initialize new fields unit_length_ and cu_offset_.
154 (Dwarf_pubnames_table::read_section): Update prototype.
155 (Dwarf_pubnames_table::cu_offset): New member function.
156 (Dwarf_pubnames_table::subsection_size): Likewise.
157 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
159 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
160 member functions public.
161 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
162 Update comment. Rework logic. Move repeated parts to...
163 (Gdb_index_info_reader::read_pubtable): ...here. New function.
164 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
165 pubtypes_table_, and stmt_list_offset.
166 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
167 Gdb_index::find_pubtype_offset,
168 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
169 (Gdb_index::pubnames_read): Update prototype and rework logic.
170 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
172 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
173 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
174 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
175 Gdb_index::map_pubtable_to_dies):
177 (Gdb_index::pubnames_read): Update declaration.
178 (Gdb_index::Pubname_offset_map): New type.
179 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
180 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
181 Gdb_index::stmt_list_offset): Declare.
182 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
183 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
184 Gdb_index::pubtypes_offset_): Remove.
186 2013-07-19 Roland McGrath <mcgrathr@google.com>
188 * options.h (General_options): Add -Trodata-segment option.
189 * parameters.cc (Parameters::check_rodata_segment): New function.
190 (Parameters::set_target_once): Call it.
191 * parameters.h (Parameters): Declare it (private member function).
192 * layout.cc (load_seg_unusable_for_headers): New function, broken
193 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
194 then validate rodata segment rather than text segment.
195 (relaxation_loop_body): Call that.
196 (is_text_segment): New function. Don't admit a non-executable
197 segment if TARGET->isolate_execinstr().
198 (set_segment_offsets): Call it. Honor -Trodata-segment option.
200 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
203 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
204 * nacl.h (Sniff_file::View::View): Request aligned view.
206 2013-07-11 Cary Coutant <ccoutant@google.com>
208 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
209 correct BRLT entry size.
211 2013-07-03 Alan Modra <amodra@gmail.com>
213 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
216 2013-07-01 Cary Coutant <ccoutant@google.com>
218 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
220 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
221 (Dwarf_ranges_table::lookup_reloc): New function.
222 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
224 (Dwarf_ranges_table::lookup_reloc): New function.
225 (Dwarf_ranges_table::reloc_type_): New data member.
227 2013-06-27 Jing Yu <jingyu@google.com>
230 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
232 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
233 (Target_powerpc::do_relax): Call the above.
235 2013-06-27 Cary Coutant <ccoutant@google.com>
237 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
238 on garbage collected .opd section.
240 2013-06-27 Alan Modra <amodra@gmail.com>
242 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
244 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
245 (Target_powerpc::do_function_location): Likewise for loc->shndx.
247 2013-06-14 Cary Coutant <ccoutant@google.com>
249 * resolve.cc (Symbol::override_base): Don't override st_type
250 from plugin placeholder symbols.
251 (Symbol_table::resolve): Likewise.
252 (Symbol_table::should_override): Don't complain about TLS mismatch
253 if the TO symbol is a plugin placeholder.
254 * testsuite/Makefile.am (plugin_test_tls): New test.
255 * testsuite/Makefile.in: Regenerate.
256 * testsuite/plugin_test_tls.sh: New test script.
257 * testsuite/two_file_test_2_tls.cc: New test source.
258 * testsuite/two_file_test_tls.cc: New test source.
260 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
262 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
263 the maximum segment alignment is larger than the page size.
264 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
265 correctly aligns the symbols with large alignemnt.
266 * testsuite/Makefile.in: Regenerate.
267 * testsuite/large_symbol_alignment.cc: New file.
269 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
270 Sriraman Tallam <tmsriram@google.com>
272 * options.h (sort_section): New option.
273 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
274 Rename from Input_section_sort_section_name_special_ordering_compare.
275 (Input_section_sort_section_name_compare): New struct.
276 * output.cc (Output_section::Input_section_sort_section_name_compare::
277 operator()): New function.
278 (Output_section::sort_attached_input_sections): Use new sort function
279 for .text if --sort-section=name is specified.
280 * layout.cc (Layout::make_output_section):
281 Add sorting by name when --sort-section=name is specified.
282 * testsuite/Makefile.am (text_section_grouping): Test option
284 * testsuite/Makefile.in: Regenerate.
285 * testsuite/section_sorting_name.cc: New file.
286 * testsuite/section_sorting_name.sh: New file.
288 2013-05-21 Cary Coutant <ccoutant@google.com>
290 * symtab.h (Symbol::is_cxx_vtable): New function.
291 * target-reloc.h (relocate_section): Check for vtable symbol.
292 * testsuite/Makefile.am (missing_key_func.sh): New test case.
293 * testsuite/Makefile.in: Regenerate.
294 * testsuite/missing_key_func.cc: New test source.
295 * testsuite/missing_key_func.sh: New test script.
297 2013-05-21 Cary Coutant <ccoutant@google.com>
299 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
300 type of enclosing symbol.
301 (Relocate_info::location): Check symbol type when describing symbol.
302 * object.h (Symbol_location_info): Remove unused line_number;
303 add enclosing_symbol_type.
304 * testsuite/debug_msg.sh: Adjust expected output.
306 2013-05-13 Cary Coutant <ccoutant@google.com>
308 * configure.ac: Export DEFAULT_TARGET.
309 * configure: Regenerate.
310 * Makefile.in: Regenerate.
311 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
312 * testsuite/Makefile.in: Regenerate.
313 * testsuite/debug_msg.sh: Delete duplicate tests.
314 Don't check undef_int error message match for powerpc where the
315 source file and line number aren't available.
317 2013-05-10 Roland McGrath <mcgrathr@google.com>
319 * options.h (General_options): Add --rosegment-gap option.
320 * options.cc (finalize): --rosegment-gap implies --rosegment.
321 * layout.cc (set_segment_offsets): Let user option override
322 target->rosegment_gap().
324 2013-05-10 Roland McGrath <mcgrathr@google.com>
326 * options.h (General_options): Remove leading space from help
327 messages for -nostdlib and --rosegment.
329 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
332 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
334 2013-05-03 Alan Modra <amodra@gmail.com>
336 * merge.cc (Output_merge_string::do_add_input_section): Correct
337 scan for number of strings. Rename vars to avoid shadowing.
338 Include missing terminator in input_size_.
340 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
342 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
343 Restore empty string handling.
345 2013-05-01 Cary Coutant <ccoutant@google.com>
347 * stringpool.cc (Stringpool_template::new_key_offset): Fix
348 uninitialized warning.
350 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
352 * output.cc (Output_section::add_merge_input_section): Allow
353 to merge sections if the alignment is more than character size.
354 * merge.h (Output_merge_string::Output_merge_string): Remove
356 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
357 only not-null strings. Check the alignment of strings.
359 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
360 alignment as the argument.
361 (Stringpool_template<Stringpool_char>::addralign_): New class member.
362 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
363 Align non-zero length strings according to the addralign_.
364 (Stringpool_template<Stringpool_char>::set_string_offsets):
365 Updating offsets according to the given alignment.
366 * testsuite/Makefile.am (text_section_grouping): Test if string
367 literals are getting merged.
368 * testsuite/Makefile.in: Regenerate.
369 * testsuite/merge_string_literals_1.c: New file.
370 * testsuite/merge_string_literals_2.c: Ditto.
371 * testsuite/merge_string_literals.sh: Ditto.
373 2013-04-26 Ian Lance Taylor <iant@google.com>
375 * target-reloc.h (relocate_section): If the reloc offset is out of
376 range, pass VIEW as NULL to relocate.relocate.
377 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
378 * i386.cc (Target_i386::Relocate::relocate): Likewise.
379 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
380 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
381 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
382 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
384 2013-04-26 Geoff Pike <gpike@chromium.org>
386 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
387 * layout.cc (Hash_task): New class.
388 (Layout::queue_build_id_tasks): New function.
389 (Layout::write_build_id): Handle single-thread portion of build ID
390 computation. (In some cases, all of it is single-threaded.) Replace
391 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
392 functionality in fewer lines of code.
393 * layout.h (Layout::queue_build_id_tasks): New function declaration.
394 * options.h (General_options): make "--build-id" default to tree
395 rather than sha1. Add two new options related to --build-id=tree:
396 --build-id-chunk-size-for-treehash and
397 --build-id-min-file-size-for-treehash.
398 * Makefile.am: add testing of --build-id=tree and related new options
399 (these tests will be invoked by "make check").
400 * Makefile.in: Regenerate.
402 2013-04-25 Alan Modra <amodra@gmail.com>
404 * configure.tgt: Add powerpcle and powerpc64le.
406 2013-04-22 Alan Modra <amodra@gmail.com>
409 * layout.cc (Layout::segment_precedes): Allow more than one
410 segment with the same type and flags.
412 2013-04-15 Cary Coutant <ccoutant@google.com>
414 * layout.cc (Layout::set_relocatable_section_offsets): Don't
415 allocate space in file for BSS sections.
417 2013-04-15 Cary Coutant <ccoutant@google.com>
419 * script-sections.cc (Orphan_output_section): Reset address
420 to zero after each orphaned section for relocatable links.
422 2013-04-15 Cary Coutant <ccoutant@google.com>
424 * symtab.cc (Symbol_table::sized_write_globals): Subtract
425 section starting address for relocatable link.
426 * testsuite/Makefile.am (script_test_11): New test.
427 * testsuite/Makefile.in: Regenerate.
428 * testsuite/script_test_11.c: New source file.
429 * testsuite/script_test_11.t: New linker script.
431 2013-04-13 Alan Modra <amodra@gmail.com>
433 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
434 owner when sections are not adjacent and exceed group size.
435 (Target_powerpc::group_sections): Handle corner case.
436 (Target_powerpc::Branch_info::make_stub): Handle case where
437 stub table doesn't exist due to branches in non-exec sections.
438 (Target_powerpc::Relocate::relocate): Likewise.
440 2013-04-11 Alan Modra <amodra@gmail.com>
443 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
444 .branch_lt to match bfd ld. Adjust comments throughout file.
446 2013-04-04 Ian Lance Taylor <iant@google.com>
449 * object.cc (do_layout_deferred_sections): Handle .eh_frame
450 sections before checking whether they are included in the link.
452 2013-03-29 Sriraman Tallam <tmsriram@google.com>
454 * archive.cc (Archive::get_elf_object_for_member): Create the elf
455 object before calling the plugin claim_file handler. Pass the elf
456 object of the archive to the plugin. Delete the elf object if the
457 plugin claims the file.
459 2013-03-21 Alan Modra <amodra@gmail.com>
461 * layout.cc (Layout::set_segment_offsets): Accept writable .text
464 2013-03-21 Alan Modra <amodra@gmail.com>
466 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
468 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
469 uninitialized" warning.
471 2013-03-20 Alan Modra <amodra@gmail.com>
473 * symtab.h (Symbol::clear_version): New function.
474 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
475 is_needed by weak references. Clear version for symbols defined
476 in as-needed objects that are not needed.
478 2013-03-15 Alan Modra <amodra@gmail.com>
480 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
481 static and public. Add report_err param. Return false for data refs.
482 (Target_powerpc::rela_dyn_section): New overloaded function.
483 (Target_powerpc::plt_, iplt_): Elucidate.
484 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
485 (Output_data_plt_powerpc::do_write): Don't write .iplt.
486 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
487 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
488 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
489 push_branch and make_plt_entry for ifunc syms when
490 reloc_needs_plt_for_ifunc.
491 (Target_powerpc::Relocate::relocate): Don't use plt entry value
492 for ifunc unless reloc_needs_plt_for_ifunc.
494 2013-03-15 Alan Modra <amodra@gmail.com>
496 * gc.h (gc_process_relocs): Don't look through function descriptors.
497 * icf.cc (get_section_contents): Do so here instead.
499 2013-03-13 Alan Modra <amodra@gmail.com>
501 * powerpc.cc (is_branch_reloc): Forward declare.
502 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
503 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
504 false for 64-bit, true for 32-bit non-branch relocs.
505 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
506 * testsuite/Makefile.am (icf_test): Use linker map file instead of
508 (icf_safe_test): Generate linker map file as well as nm output.
509 (icf_safe_so_test): Likewise.
510 * testsuite/Makefile.in: Regenerate.
511 * testsuite/icf_test.sh: Parse linker map file to determine
513 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
514 * testsuite/icf_safe_so_test.sh: Likewise.
515 (X86_32_or_ARM_specific_safe_fold): Merge into..
516 (arch_specific_safe_fold): ..this.
517 (X86_64_specific_safe_fold): Delete unused function.
519 2013-03-12 Alan Modra <amodra@gmail.com>
521 * gc.h (gc_process_relocs): Look through function descriptors
522 to determine shndx, symvalue and addend used by ICF. Tidy
523 variable duplication.
525 2013-03-11 Alan Modra <amodra@gmail.com>
527 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
528 * layout.cc (Layout_task_runner::run): ..to here.
529 * symtab.h (struct Symbol_location): Extract from..
530 (class Symbol_table): ..here.
531 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
532 * target.h (class Target): Add function_location and
533 do_function_location functions.
534 (class Sized_target): Add do_function_location.
535 * object.h (class Sized_relobj_file): Move find_shdr..
536 (class Object): ..to here.
537 * object.cc: Likewise. Update to suit. Instantiate.
538 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
539 * powerpc.cc (class Powerpc_dynobj): New.
540 (Target_powerpc::do_function_location): New function.
541 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
542 (Powerpc_dynobj::do_read_symbols): New function.
543 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
545 2013-03-08 Ian Lance Taylor <iant@google.com>
547 * options.cc (General_options::string_to_object_format): Accept
550 2013-03-08 Alan Modra <amodra@gmail.com>
552 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
554 (struct Post_fde): Move definition to here..
555 * ehframe.cc (struct Post_fde): ..from here.
556 (Cie::write): Don't alloc Post_fde.
557 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
559 2013-03-07 Alan Modra <amodra@gmail.com>
561 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
562 relocation referencing .LC0.
563 * testsuite/discard_locals_test.sh: Remove FIXMEs.
565 2013-03-07 Alan Modra <amodra@gmail.com>
567 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
568 always_inline. Add assembly for powerpc to avoid GOT.
570 2013-03-07 Alan Modra <amodra@gmail.com>
572 * testsuite/script_test_10.sh: Don't test .bss section
575 2013-03-06 Alan Modra <amodra@gmail.com>
577 * powerpc.cc (class Powerpc_relobj): Move some member functions.
578 (Target_powerpc::symval_for_branch): Add symtab param. Update
579 all callers. Handle folded sections.
580 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
582 (Global_symbol_visitor_opd::operator()): Likewise.
584 2013-03-04 Alan Modra <amodra@gmail.com>
586 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
587 * testsuite/Makefile.in: Regenerate.
589 2013-03-01 Cary Coutant <ccoutant@google.com>
591 Add dwp support for v2 DWARF package file format.
592 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
593 tu_length parameter. Adjust all callers.
594 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
595 * dwp.cc: Include dwarf.h.
596 (Section_bounds): New struct type.
597 (Unit_set): New struct type.
598 (Dwo_file::Dwo_file): Initialize new data member.
599 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
600 Combine and rename to...
601 (Dwo_file::read_unit_index): ...this.
602 (Dwo_file::sized_read_compunit_index)
603 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
604 (Dwo_file::sized_read_unit_index): ...this.
605 (Dwo_file::copy_section): Remove section_name, is_str_offsets
606 parameters; add section_id parameter.
607 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
608 (Dwo_file::add_unit_set): ...this.
609 (Dwo_file::shndx_map_): Remove.
610 (Dwo_file::sect_offsets_): New data member.
611 (Dwp_output_file::Dwp_output_file): Initialize new data members.
612 (Dwp_output_file::add_section): Rename to...
613 (Dwp_output_file::add_contribution): ...this.
614 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
615 (Dwp_output_file::add_tu_set): Likewise.
616 (Dwp_output_file::Contribution): New type.
617 (Dwp_output_file::Section::contributions): New data member.
618 (Dwp_output_file::Cu_or_tu_set): Remove.
619 (Dwp_output_file::Section::Section): New ctor.
620 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
621 (Dwp_output_file::Dwp_index::Section_table): New type.
622 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
623 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
625 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
626 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
627 (Dwp_output_file::Dwp_index::section_table): New member function.
628 (Dwp_output_file::Dwp_index::section_table_end): New member function.
629 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
630 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
631 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
632 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
633 (Dwp_output_file::Dwp_index::section_table_): New data member.
634 (Dwp_output_file::Dwp_index::section_mask_): New data member.
635 (Dwp_output_file::add_output_section): New member function.
636 (Dwp_output_file::write_new_section): New member function.
637 (Dwp_output_file::write_contributions): New member function.
638 (Dwp_output_file::section_id_map_): New data member.
639 (class Dwo_id_info_reader): Remove.
640 (class Unit_reader): New class.
641 (get_dwarf_section_name): New function.
642 (Dwo_file::read_executable): Adjust initializations of class data.
643 (Dwo_file::read): Add support for v2 package file format.
644 (Dwo_file::read_unit_index): Likewise.
645 (Dwo_file::sized_read_unit_index): Likewise.
646 (Dwo_file::copy_section): Likewise.
647 (Dwo_file::add_unit_set): Likewise.
648 (Dwp_output_file::add_output_section): Likewise.
649 (Dwp_output_file::add_contribution): Likewise.
650 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
652 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
654 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
656 (Dwp_output_file::initialize): Remove unused function.
657 (Dwp_output_file::finalize): Add support for v2 package file format.
658 (Dwp_output_file::write_index): Likewise.
659 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
662 2013-03-01 Cary Coutant <ccoutant@google.com>
664 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
665 function into class definition in header file.
666 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
667 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
669 (Dwarf_info_reader::check_buffer): Move here from .cc file.
671 2013-02-28 Alan Modra <amodra@gmail.com>
673 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
674 * target.cc (Target::do_plt_fde_location): New function.
675 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
676 accessor function, and constructor param.
677 (struct Post_fde, Post_fdes): Declare.
678 (Cie::write): Add post_fdes param.
679 * ehframe.cc (Fde::write): Use plt_fde_location.
680 (struct Post_fde): Define.
681 (Cie::write): Stash FDEs added post merge mapping.
682 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
683 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
684 (Eh_frame::do_sized_write): Arrange to write post map FDES after
686 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
687 (Target_powerpc::has_glink): New function.
688 (Target_powerpc::do_relax): Add eh_frame info for stubs.
689 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
690 glink_eh_frame_fde_32, default_fde): New data.
691 (Stub_table::eh_frame_added_): New var.
692 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
694 (Stub_table::add_eh_frame): New function.
695 (Output_data_glink::add_eh_frame): New function.
696 (Target_powerpc::make_glink_section): Call add_eh_frame.
698 2013-02-15 Ian Lance Taylor <iant@google.com>
700 * options.h (DEFINE_uint64_alias): Define.
701 (class General_options): Add -Ttext-segment as an alias for
704 2013-02-15 Alan Modra <amodra@gmail.com>
706 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
707 (Stub_table::do_write): ..here, two places.
708 (Stub_table::plt_call_size): Use it here too.
710 2013-02-11 Ian Lance Taylor <iant@google.com>
712 * descriptors.cc (Descriptors::close_all): New function.
713 * descriptors.h (class Descriptors): Declare close_all.
714 (close_all_descriptors): New inline function.
715 * plugin.cc: Include "descriptors.h".
716 (Plugin_manager::cleanup): Call close_all_descriptors.
718 2013-02-06 Alan Modra <amodra@gmail.com>
720 * README: Update coding style link.
722 2013-01-28 Cary Coutant <ccoutant@google.com>
724 * dwp.cc (File_list): New typedef.
725 (Dwo_name_info_reader): New class.
726 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
727 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
728 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
729 (Dwo_file::read_executable): New function.
730 (Dwo_file::read): Move common setup code to ...
731 (Dwo_file::make_object): ... here.
732 (dwp_options): Add --exec/-e.
736 2013-01-24 Sriraman Tallam <tmsriram@google.com>
738 * layout.cc (Layout::layout): Check for option text_reorder.
739 (Layout::make_output_section): Ditto.
740 * options.h (text_reorder): New option.
741 * output.cc (Input_section_sort_compare): Remove special ordering
744 Input_section_sort_section_name_special_ordering_compare::
745 operator()): New function.
746 (Output_section::sort_attached_input_sections): Use new sort function
748 * output.h (Input_section_sort_section_name_special_ordering_compare):
750 * testsuite/Makefile.am (text_section_grouping): Test option
752 * testsuite/Makefile.in: Regenerate.
753 * testsuite/text_section_grouping.sh: Check order of functions without
754 default text reordering.
756 2013-01-18 Mike Frysinger <vapier@gentoo.org>
758 * options.h (General_options): Change default to true for new_dtags.
760 2013-01-18 Mike Frysinger <vapier@gentoo.org>
762 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
763 when enable_new_dtags is false. Only add DT_RUNPATH when
764 enable_new_dtags is true.
766 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
768 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
769 used in declaration and definition consistent.
770 (Target_powerpc::symval_for_branch): Ditto.
772 2013-01-16 Sriraman Tallam <tmsriram@google.com>
774 * testsuite/plugin_final_layout.cc: Fix comment.
776 2013-01-16 Sriraman Tallam <tmsriram@google.com>
778 * layout.cc (Layout::layout): Do not do default sorting for
779 text sections when section ordering is specified.
780 (make_output_section): Ditto.
781 * testsuite/plugin_final_layout.cc: Name the function sections
782 to catch reordering issues.
784 2013-01-15 Alan Modra <amodra@gmail.com>
786 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
789 2013-01-15 Alan Modra <amodra@gmail.com>
791 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
792 * testsuite/Makefile.in: Regenerate.
794 2013-01-14 Alan Modra <amodra@gmail.com>
796 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
797 * testsuite/Makefile.in: Regenerate.
799 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
802 Fix mingw gold build with plugins enabled
803 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
804 * configure.ac: Export DLOPEN_LIBS and add headers check.
805 * plugin.cc: Handle non-dlfcn case.
806 * Makefile.in: Regenerate.
807 * config.in: Regenerate.
808 * configure: Regenerate.
809 * testsuite/Makefile.in: Regenerate.
811 2013-01-09 Sriraman Tallam <tmsriram@google.com>
813 * output.h (sort_attached_input_sections): Change to be public.
815 (Output_section_definition::set_section_addresses): Sort
816 attached input sections according to section order before linker
817 script assigns section addresses.
818 (Orphan_output_section::set_section_addresses): Sort
819 attached input sections according to section order before linker
820 script assigns section addresses.
821 * Makefile.am (final_layout.sh): Use a simple linker script to
822 check if section ordering still works.
823 * Makefile.in: Regenerate.
825 2013-01-09 Ben Cheng <bccheng@google.com>
827 * arm.cc (Target_arm::attributes_accept_div): New function.
828 (Target_arm::attributes_forbid_div): New function.
829 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
830 attribute using the same new functions as what bfd/elf32_arm.c
833 2013-01-07 Cary Coutant <ccoutant@google.com>
836 * output.cc (Output_section::add_input_section): For incremental
837 updates, don't track input sections that are allocated from patch
840 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
841 Ian Lance Taylor <iant@google.com>
844 * configure.ac (--enable-ld): Removed.
845 (install_as_default): Set to yes only for --enable-gold=default
847 * configure: Regenerated.
849 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
851 * options.h (General_options): Add -fuse-ld= for GCC linker
852 option compatibility.
854 2013-01-04 Cary Coutant <ccoutant@google.com>
856 * configure.ac: Fix typo restoring CXXFLAGS.
857 * configure: Regenerate.
859 2013-01-04 Cary Coutant <ccoutant@google.com>
861 * testsuite/Makefile.am (CXXLINK_S): New macro.
862 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
863 * testsuite/Makefile.in: Regenerate.
865 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
867 * version.cc (print_version): Update copyright year to 2013.
869 2012-12-20 Ian Lance Taylor <iant@google.com>
871 * layout.cc (Layout::special_ordering_of_input_section): New
873 (Layout::layout): If input section requires special ordering, must
875 (Layout::make_output_section): May sort .text input sections.
876 (Layout::is_section_name_prefix_grouped): Remove.
877 * layout.h (class Layout): Declare
878 special_ordering_of_input_section. Don't declare
879 is_section_name_prefix_grouped.
880 * output.cc (Output_section::add_input_section): Revert last
882 (Output_section::Input_section_sort::match_file_name): Don't crash
883 if called on output section data.
884 (Output_section::Input_section_sort_compare): Sort based on
886 (Output_section::Input_section_sort_section_order_index_compare):
888 (Output_section::sort_attached_input_sections): Likewise.
890 2012-12-18 Sriraman Tallam <tmsriram@google.com>
892 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
893 * layout.h (Layout::is_section_name_prefix_grouped): New function.
894 * output.cc (Output_section::add_input_section): Check if section
895 name contains special prefix. Keep input sections to sort such
897 (Output_section::Input_section_sort_section_order_index_compare
898 ::operator()): Group sections according to prefixes.
899 (Output_section::sort_attached_input_sections): Add condition to
900 Input_section_entry constructor call.
901 * testsuite/Makefile.am (text_section_grouping): New test.
902 * testsuite/Makefile.in: Regenerate.
903 * testsuite/text_section_grouping.cc: New file.
904 * testsuite/text_section_grouping.sh: New file.
906 2012-12-17 Nick Clifton <nickc@redhat.com>
908 * Makefile.am: Add copyright notice.
911 * configure.ac: Likewise.
912 * ftruncate.c: Likewise.
913 * Makefile.in: Regenerate.
915 2012-12-14 Cary Coutant <ccoutant@google.com>
917 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
919 (exception_separate_shared_12_test): Likewise.
920 (incremental_copy_test): Likewise.
921 * testsuite/Makefile.in: Regenerate.
923 2012-12-14 Cary Coutant <ccoutant@google.com>
925 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
926 (Dwp_output_file::Dwp_index::enter_set): Add assert.
928 2012-12-12 Alan Modra <amodra@gmail.com>
930 * powerpc.cc (class Track_tls): New.
931 (class Relocate, class Scan): Inherit Track_tls.
932 (Target_powerpc::Scan::local, global): Track tls optimization
933 and avoid creating plt entry for __tls_get_addr if all uses
935 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
937 2012-12-12 Alan Modra <amodra@gmail.com>
939 * options.h (General_options): Add --toc-sort/--no-toc-sort.
940 Replace no_toc_optimize with toc_optimize.
941 * output.h (Output_section::input_sections): Provide non-const variant.
942 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
943 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
945 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
946 (class Sort_toc_sections): New.
947 (Target_powerpc::do_finalize_sections): Sort toc sections.
948 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
950 2012-12-10 Roland McGrath <mcgrathr@google.com>
952 * testsuite/binary_unittest.cc (read_all): New function.
953 (Sized_binary_test): Use it instead of ::read.
954 * fileread.cc (do_read): Don't assume pread always reads the whole
955 amount in a single call.
957 2012-12-10 Alan Modra <amodra@gmail.com>
959 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
960 Set EM_PPC64 or EM_PPC here.
961 (Target_selector_powerpc::do_recognize): Delete.
963 2012-12-10 Alan Modra <amodra@gmail.com>
965 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
967 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
969 2012-12-07 Roland McGrath <mcgrathr@google.com>
971 * testsuite/binary_unittest.cc (Sized_binary_test):
972 Use open_descriptor rather than ::open.
974 2012-12-07 Alan Modra <amodra@gmail.com>
976 * powerpc.cc (Stub_table::do_write): Delete redundant Address
977 typedef and invalid_address constant.
978 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
979 instantiate constants.
981 2012-12-06 Roland McGrath <mcgrathr@google.com>
983 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
984 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
985 * aclocal.m4: Regenerate.
986 * configure: Regenerate.
987 * Makefile.in: Regenerate.
988 * testsuite/Makefile.in: Regenerate.
990 2012-12-07 Alan Modra <amodra@gmail.com>
992 * options.h (General_options): Add no_toc_optimize.
993 * powerpc.cc (ok_lo_toc_insn): New function.
994 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
996 2012-12-06 Alan Modra <amodra@gmail.com>
998 * options.h (General_options): Add plt_align, plt_static_chain,
999 plt_thread_safe. Update stub_group_size help text.
1000 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1001 for new plt_thread_safe_ var.
1002 (use_plt_offset): Correct comments.
1003 (Target_powerpc::do_relax): Look for thread creation symbols to
1004 determine default plt_thread_safe value. Clear plt call stubs
1005 as well as branch stubs each iteration.
1006 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1008 (l, hi, ha, write_insn): Move earlier.
1009 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1010 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1012 (Stub_table::update_size): Adjust.
1013 (Stub_table::prev_size, set_prev_size): Delete.
1014 (Stub_table::stub_align): Let --plt-align affect result.
1015 (Stub_table::plt_call_size): Calculate sizes for various stubs.
1016 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1017 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1018 (Stub_table::do_write): Support more stub variants.
1020 2012-12-04 Alan Modra <amodra@gmail.com>
1022 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1023 (Target_powerpc::do_define_standard_symbols): New function.
1025 2012-12-03 Alan Modra <amodra@gmail.com>
1027 * output.h: Formatting, whitespace.
1029 2012-12-03 Alan Modra <amodra@gmail.com>
1031 * layout.h (Layout::get_executable_sections): Declare.
1032 * layout.cc (Layout::get_executable_sections): New function.
1033 * arm.cc (Target_arm::group_sections): Use it.
1034 (Arm_output_section::group_sections): Delete now redundant test.
1035 * output.cc (Output_reloc::Output_reloc): Add is_relative.
1036 param to handle relative relocs.
1037 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1038 (Output_data_reloc::add_absolute): Adjust.
1039 (Output_data_reloc::add_relative): New function.
1040 (Output_data::reset_data_size): New function.
1041 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1042 (Output_section::set_addralign): New function.
1043 (Output_section::checkpoint_set_addralign): New function.
1044 (Output_section::clear_section_offsets_need_adjustment): New function.
1045 (Output_section::input_sections): Make public.
1046 * powerpc.cc (class Output_data_brlt_powerpc): New.
1047 (class Stub_table, class Stub_control): New.
1048 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1049 stub_table_, set_stub_table, stub_table): New vectors and accessor
1051 (Target_powerpc::do_may_relax, do_relax, push_branch,
1052 new_stub_table, stub_tables, brlt_section, group_sections,
1053 add_branch_lookup_table, find_branch_lookup_table,
1054 write_branch_lookup_table, make_brlt_section): New functions.
1055 (Target_powerpc::struct Sort_sections, class Branch_info): New.
1056 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1057 branch_info_): New vars.
1058 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1059 make call stubs here.
1060 (Output_data_glink): Remove all call stub handling from this class.
1061 (Target_powerpc::Scan::local, global): Save interesting branch
1062 relocs and relocs for ifunc. Adjust calls to plt entry functions.
1063 (Target_powerpc::do_finalize_sections): Only make reg save/restore
1064 functions on final link.
1065 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1066 Handle long branch destinations too.
1067 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1068 do_plt_address_for_local): Adjust lookup of plt call stubs.
1070 2012-11-30 Alan Modra <amodra@gmail.com>
1072 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1073 relocs against protected symbols when building 32-bit shared libs.
1075 2012-11-30 Alan Modra <amodra@gmail.com>
1077 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1078 param. Call got_section() to make .got. Update all callers
1079 and their callers and so on.
1081 2012-11-30 Alan Modra <amodra@gmail.com>
1083 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1084 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1085 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1086 value if it already exists.
1088 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
1091 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1093 2012-11-14 Roland McGrath <mcgrathr@google.com>
1095 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1096 than bfc instruction for data sandboxing.
1098 2012-11-08 Alan Modra <amodra@gmail.com>
1100 * po/POTFILES.in: Regenerate.
1102 2012-11-05 Alan Modra <amodra@gmail.com>
1104 * configure.ac: Apply 2012-09-10 change to config.in here.
1105 * configure: Regenerate.
1107 2012-11-05 Alan Modra <amodra@gmail.com>
1109 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1110 (struct Opd_ent): Use "Address" rather than "Offset".
1111 (Output_data_got_powerpc::got_base_offset): Return Valtype.
1112 (Target_powerpc::got_section): Make public.
1113 (Target_powerpc::scan_relocs): Move code setting symbols..
1114 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1115 Create _SDA_BASE_ only when referenced.
1117 2012-11-02 Roland McGrath <mcgrathr@google.com>
1119 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1122 2012-11-01 Roland McGrath <mcgrathr@google.com>
1124 * target.h (Sized_target::relocate_relocs): Use Elf_Off
1125 for offset_in_output_section parameter.
1126 (Sized_target::relocate_special_relocatable): Likewise.
1127 * arm.cc (Target_arm::relocate_relocs): Likewise.
1128 (Target_arm::relocate_special_relocatable): Likewise.
1129 * i386.cc (Target_i386::relocate_relocs): Likewise.
1130 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1131 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1132 * target-reloc.h (relocate_relocs): Likewise.
1133 * testsuite/testfile.cc (Target_test): Likewise.
1134 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1135 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1137 * system.h: Move inclusion of <clocale> to after <libintl.h> in
1138 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1140 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1141 parameter, which is unused in the [!F_SETFD] case.
1143 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1144 SYMNDX to off_t before comparing it to this->data_size().
1145 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1146 * incremental.cc (Output_section_incremental_inputs::do_write):
1147 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1149 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1151 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
1153 * gold.cc (Target_arm::do_adjust_elf_header): Add the
1154 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1157 2012-10-29 Cary Coutant <ccoutant@google.com>
1159 * dwp.cc (usage): Add file and exit status parameters;
1160 add --help and --version options.
1161 (print_version): New function.
1162 (main): Add --help and --version options.
1164 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1166 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1167 final_layout_sequence.txt.
1168 * testsuite/Makefile.in: Regenerated.
1170 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1172 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1173 COMPILE generated by automake.
1175 (CXXCOMPILE1): Likewise.
1176 (CXXLINK1): Likewise.
1177 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1179 (CXXCOMPILE): Likewise.
1180 (CXXLINK): Likewise.
1181 * testsuite/Makefile.in: Regenerated.
1183 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1185 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1186 on bad fwrite return.
1188 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1190 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1193 2012-10-23 Cary Coutant <ccoutant@google.com>
1195 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1196 * testsuite/Makefile.in: Regenerate.
1197 * testsuite/dwp_test.h: New source file.
1198 * testsuite/dwp_test_1.cc: New source file.
1199 * testsuite/dwp_test_1.s: New source file.
1200 * testsuite/dwp_test_1.sh: New source file.
1201 * testsuite/dwp_test_1b.cc: New source file.
1202 * testsuite/dwp_test_1b.s: New source file.
1203 * testsuite/dwp_test_2.cc: New source file.
1204 * testsuite/dwp_test_2.s: New source file.
1205 * testsuite/dwp_test_2.sh: New source file.
1206 * testsuite/dwp_test_main.cc: New source file.
1207 * testsuite/dwp_test_main.s: New source file.
1209 2012-10-23 Cary Coutant <ccoutant@google.com>
1211 * dwp.h: New header file.
1212 * dwp.cc: New source file.
1213 * gold.h: Move shared declarations to system.h.
1214 * system.h: New header file.
1215 * Makefile.am: Add dwp.
1216 * Makefile.in: Regenerate.
1218 2012-10-23 Cary Coutant <ccoutant@google.com>
1220 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1221 Dwarf_info_reader::read_from_pointer.
1222 (Dwarf_pubnames_table::read_header): Likewise.
1223 (Dwarf_pubnames_table::next_name): Likewise.
1224 (Dwarf_die::read_attributes): Likewise.
1225 (Dwarf_die::skip_attributes): Likewise.
1226 (Dwarf_info_reader::read_from_pointer): New function template.
1227 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1228 (Dwarf_pubnames_table): Likewise.
1229 (Dwarf_info_reader::read_from_pointer): New function template.
1230 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1231 Dwarf_pubnames_table ctor.
1233 2012-10-23 Cary Coutant <ccoutant@google.com>
1235 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1237 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1239 (Dwarf_info_reader::set_abbrev_shndx): New method.
1240 (Dwarf_info_reader::abbrev_shndx_): New data member.
1242 2012-10-23 Cary Coutant <ccoutant@google.com>
1244 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1245 from object, not parameters.
1246 (Dwarf_info_reader::parse): Likewise.
1247 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1248 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1249 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1252 2012-10-23 Cary Coutant <ccoutant@google.com>
1254 * fileread.cc (Input_file::Input_file): New constructor.
1255 * fileread.h (class Input_file): Add new constructor.
1257 2012-10-18 Alan Modra <amodra@gmail.com>
1260 * object.cc (Relobj::is_section_name_included): Also match
1261 .sdata personality section.
1263 2012-10-18 Alan Modra <amodra@gmail.com>
1265 * target-reloc.h (class Default_comdat_behavior): New, package up..
1266 (get_comdat_behaviour): ..this.
1267 (relocate_section): Add Relocate_comdat_behavior template arg,
1268 adjust code to suit.
1269 * arm.cc (Target_arm::relocate_section): Adjust to suit.
1270 (Target_arm::scan_reloc_section): Likewise.
1271 * i386.cc (Target_i386::relocate_section): Likewise.
1272 * sparc.cc (Target_sparc::relocate_section): Likewise.
1273 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1274 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1275 * powerpc.cc (class Relocate_comdat_behavior): New.
1276 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
1277 gold::relocate_section with new template arg.
1279 2012-10-18 Alan Modra <amodra@gmail.com>
1281 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1282 dynamic relocs for GOT_TPREL got entries, without symbol if
1284 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1285 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1286 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1288 2012-10-17 Alan Modra <amodra@gmail.com>
1291 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1293 2012-10-16 Sriraman Tallam <tmsriram@google.com>
1295 * layout.cc (Layout::include_section): Keep sections marked
1296 SHF_EXCLUDE when doing relocatable links.
1298 2012-10-16 Alan Modra <amodra@gmail.com>
1300 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1301 (Target_powerpc::do_finalize_sections): Call it.
1302 (Output_data_save_res): New class and supporting functions.
1303 (Target_powerpc::symval_for_branch): Only look up .opd entry for
1304 normal symbols defined in object files.
1306 2012-10-12 Alan Modra <amodra@gmail.com>
1308 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1309 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
1310 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1311 section if scan_opd_relocs not yet called.
1312 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1314 2012-10-12 Alan Modra <amodra@gmail.com>
1316 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1317 add_local_ifunc_entry): Revert last change.
1318 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1320 2012-10-05 Alan Modra <amodra@gmail.com>
1322 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1323 do_plt_address_for_global): New functions.
1324 (Output_data_got_powerpc::do_write): Don't segfault when linking
1326 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1327 add_local_ifunc_entry): Return true on adding entry..
1328 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1329 glink->add_entry call. Remove unused symtab param. Adjust calls.
1330 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1331 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
1332 set up symbols here.
1333 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1334 syms here. Do so even when no .iplt. Don't segfault when linking
1336 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
1337 new variants without reloc param.
1338 (Glink_sym_ent::Glink_sym_ent): Likewise.
1339 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1340 reloc when refs will resolve to plt call stub.
1341 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
1342 R_PPC_PLTREL24 to resolve locally.
1343 (Target_powerpc::Scan::global): Correct ifunc handling.
1344 (Target_powerpc::Relocate::relocate): Correct local sym glink
1345 lookup. Don't destroy "value" when we have a plt call stub,
1346 and when checking plt call validity.
1347 (Target_powerpc::do_dynsym_value): Simplify.
1349 2012-10-05 Alan Modra <amodra@gmail.com>
1351 * i386.cc (Output_data_plt_i386::address_for_global,
1352 address_for_local): Add plt offset to returned value. Adjust uses.
1353 * sparc.cc (Output_data_plt_sparc::address_for_global,
1354 address_for_local): Likewise.
1355 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1356 address_for_local): Likewise.
1357 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1358 address_for_local): Likewise.
1359 * target.h (Target::plt_address_for_global, plt_address_for_local):
1361 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1362 (Output_data_got::Got_entry::write): Nor here.
1363 * output.h: Comment fix.
1365 2012-10-02 Jiong Wang <jiwang@tilera.com>
1367 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1368 global_offset_table_ value for larget got.
1369 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1371 2012-09-29 Alan Modra <amodra@gmail.com>
1373 * powerpc.cc (Target_powerpc::iplt_): New output section.
1374 (Target_powerpc::iplt_section, make_iplt_section,
1375 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1376 (Target_powerpc::make_plt_entry): Handle ifunc syms.
1377 Target_powerpc::plt_entry_count): Count iplt entries too.
1378 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1379 reloc section in constructor. New params.
1380 (Target_powerpc::make_plt_section): Create reloc section here instead.
1381 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1383 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1384 (Output_data_glink::add_entry, find_entry): New functions to
1385 deal with local syms.
1386 (Glink_sym_ent): Add support for local syms.
1387 (Output_data_glink::do_write): Handle ifunc plt entries.
1388 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1389 (Target_powerpc::Scan::local, global): Handle ifunc syms.
1390 (Target_powerpc::Relocate::relocate): Likewise.
1391 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1393 2012-09-25 Alan Modra <amodra@gmail.com>
1395 * object.h (Sized_relobj_file::adjust_local_symbol,
1396 do_adjust_local_symbol): New functions.
1397 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1398 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1399 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1400 and irregular opd entry spacing.
1401 (Powerpc_relobj::do_read_relocs): Add opd size checks.
1402 (Global_symbol_visitor_opd): New functor.
1403 (Target_powerpc::do_finalize_sections): Omit global symbols defined
1404 on deleted opd entries.
1406 2012-09-15 Jiong Wang <jiwang@tilera.com>
1408 * tilegx.cc: New file.
1409 * Makefile.am (TARGETSOURCES): Add tilegx.cc
1410 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1411 * configure.tgt: Add entries for tilegx*.
1412 * configure.ac: Likewise.
1413 * Makefile.in: Rebuild.
1414 * configure: Likewise.
1415 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1418 2012-09-13 Alan Modra <amodra@gmail.com>
1420 * target-reloc.h (scan_relocs): Call scan.local for relocs
1421 against symbols in discarded sections. Pass is_discarded
1423 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1424 Add is_discarded param.
1425 * powerpc (Target_powerpc::Scan::local): Likewise. Use
1426 is_discarded to flag opd entry as discarded. Don't emit dyn
1427 relocs on such entries.
1428 (Target_powerpc::Scan::global): Similarly detect and handle
1430 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1431 opd_ent_. Update all uses.
1432 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1433 (Target_powerpc::relocate_section): Zero out discarded opd
1436 2012-09-12 Ian Lance Taylor <iant@google.com>
1439 * output.cc: Rename Output_data_got template parameter from size
1440 to got_size for all functions. Compile all variants of
1442 (Output_data_got::Got_entry::write): Correct use of size for
1443 symbol value. Use local_is_tls rather than casting to
1445 * object.h (class Object): Add local_is_tls and do_local_is_tls.
1446 (class Sized_relobj_file): Add do_local_is_tls.
1447 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1449 2012-09-11 Alan Modra <amodra@gmail.com>
1452 * layout.cc (Layout::set_segment_offsets): When using
1453 common-page-size alignment, ensure we are on a new max-page-size
1455 * output.cc (Output_segment::set_section_addresses): Use
1456 abi_pagesize, not common_pagesize for relro boundary.
1457 (Output_segment::set_offset): Likewise.
1459 2012-09-11 Alan Modra <amodra@gmail.com>
1461 * output.h (Output_data_got::add_global_tls, add_local_tls,
1462 add_local_tls_pair): New functions.
1463 (Output_data_got::add_local_pair_with_rel): Remove second
1464 reloc param. Expand comment.
1465 (Output_data_got::Got_entry): Rename use_plt_offset_ to
1466 use_plt_or_tls_offset_, similarly for constructor param.
1467 (Output_data_got::Got_entry::write): Add got_index param.
1468 * output.cc (Output_data_got::add_global_tls, add_local_tls,
1469 add_local_tls_pair): New functions.
1470 (Output_data_got::Got_entry::write): Handle tls symbols
1471 with use_plt_or_tls_offset_ set specially.
1472 (Output_data_got::add_local_pair_with_rel): Only one reloc.
1473 (Output_data_got::do_write): Replace iterator with index, pass
1474 index to entry write function.
1475 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1476 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1477 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1479 * i386.cc (Target_i386::Scan::local): Likewise.
1480 * sparc.cc (Target_sparc::Scan::local): Likewise.
1481 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1482 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1483 do_tls_offset_for_global): New functions.
1484 (Target_powerpc::Scan::local): Correct TLS relocations and got
1486 (Target_powerpc::Scan::global): Don't emit unnecessary
1487 dynamic relocations on TLS GOT entries.
1489 2012-09-10 Matthias Klose <doko@ubuntu.com>
1491 * config.in: Disable sanity check for kfreebsd.
1493 2012-09-10 Sterling Augustine <saugustine@google.com>
1495 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1496 (Gdb_index::pubtypes_read): New parameter.
1497 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1499 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1502 2012-09-09 Alan Modra <amodra@gmail.com>
1504 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1505 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1506 * gc.h (gc_process_relocs): Call target gc_add_reference.
1507 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1508 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1509 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1511 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1512 to cater for when we don't need code offset. Update use.
1513 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1514 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1515 set_opd_valid): New functions.
1516 (Target_powerpc::do_gc_add_reference): New function.
1517 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1519 (Target_powerpc::do_gc_mark_symbol): New function.
1521 2012-09-06 Cary Coutant <ccoutant@google.com>
1523 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1524 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1525 (Dwarf_die::skip_attributes): Likewise.
1526 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1527 * testsuite/gdb_index_test.cc (inline_func_1): New function.
1529 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1531 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
1533 * testsuite/script_test_3.t: Add .got.plt output section
1535 * testsuite/script_test_4.t: Likewise.
1537 2012-09-05 Alan Modra <amodra@gmail.com>
1539 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1540 update all uses and lose "enum" when using type.
1542 2012-09-05 Alan Modra <amodra@gmail.com>
1544 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1545 * configure: Regenerate.
1546 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1547 (plugin_final_layout.stdout): Likewise.
1548 (memory_test): Set page sizes to 0x1000.
1549 * testsuite/Makefile.in: Regenerate.
1550 * testsuite/discard_locals_test.sh: Add FIXME comment.
1551 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1552 * testsuite/pr14265.t: Add .got output section statement.
1553 * testsuite/script_test_2.t: Likewise.
1554 * testsuite/script_test_3.t: Likewise.
1555 * testsuite/script_test_4.t: Likewise.
1556 * testsuite/script_test_5.t: Likewise.
1557 * testsuite/script_test_6.t: Likewise.
1558 * testsuite/script_test_7.t: Likewise.
1559 * testsuite/script_test_9.t: Likewise.
1561 2012-09-05 Alan Modra <amodra@gmail.com>
1563 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1564 (Powerpc_relocate_functions::Status): New typedef.
1565 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1566 (Target_powerpc::Scan::local): Handle REL64.
1567 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1568 for REL32 and REL64.
1569 (Target_powerpc::symval_for_branch): New function, extracted from..
1570 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
1571 checks. Report overflow errors.
1573 2012-09-05 Alan Modra <amodra@gmail.com>
1575 * object.h (Sized_relobj_file::emit_relocs): Delete.
1576 (Sized_relobj_file::emit_relocs_reltype): Delete.
1577 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1578 relocate_relocs for --emit-relocs.
1579 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1580 * output.h: Update comment.
1581 (Output_segment::first_section): New function.
1582 (Output_segment::first_section_load_address): Use first_section.
1583 * output.cc (Output_segment::first_section): New function extracted..
1584 (Output_segment::first_section_load_address): ..from here. Delete.
1585 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1586 * target.h (Sized_target::relocate_for_relocatable): Likewise.
1587 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1588 adjust call to target.h function.
1589 * i386.cc (Target_i386): Likewise.
1590 * sparc.cc (Target_sparc): Likewise.
1591 * x86_64.cc (Target_x86_64): Likewise.
1592 * powerpc.cc (Target_powerpc): Likewise.
1593 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
1594 first tls section has section symbol for optimised local dynamic
1596 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1597 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1599 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1600 Rename to relocate_relocs. Update error message.
1602 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
1604 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1607 2012-08-31 Alan Modra <amodra@gmail.com>
1609 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1610 (Powerpc_relobj::toc_base_offset): New stub function.
1611 (Target_powerpc): Add tp_offset, dtp_offset. Rename
1612 got_mod_index_offset to tlsld_got_offset. Update all refs.
1613 (Target_powerpc::Relocate::enum skip_tls): New.
1614 (Target_powerpc::call_tls_get_addr_): New var.
1615 (Target_powerpc::is_branch_reloc): Move to file scope.
1616 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1617 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1619 (Target_powerpc::enum Got_type): Delete old values, add new ones.
1620 (powerpc_info): Correct common_pagesize for ppc64.
1621 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1622 (Powerpc_relocate_functions): Add overflow check enums and functions.
1623 Add non-shift version of rela, rela_ua. Delete all rel public
1624 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
1625 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1626 addr16_ha3, addr14 functions.
1627 (Output_data_got_powerpc::add_constant_pair): New function.
1628 (Output_data_got_powerpc::got_base_offset): Likewise.
1629 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1630 (instruction constants): Sort, add some more.
1631 (Output_data_glink::do_write): Add and use Address typedef. Use
1632 object->toc_base_offset() stub for 64-bit.
1633 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1634 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1635 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1636 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
1637 Always treat .opd relocs as against locally defined symbol.
1638 Correct condition for RELATIVE relocs.
1639 (Target_powerpc::do_finalize_sections): Test for NULL sections.
1640 (Target_powerpc::Relocate::relocate): Use plt call stub as value
1641 for 32-bit syms with a plt entry. Correct ppc64 toc base
1642 calculations. Handle TLS relocs, and more. Add overflow
1643 checking and adjust for Powerpc_relocate_functions changes.
1644 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1645 Reinstate --emit-relocs code with FIXME.
1647 2012-08-30 Alan Modra <amodra@gmail.com>
1649 * layout.cc (Layout::set_segment_offsets): Set p_align to
1650 abi_pagesize, not common_pagesize.
1651 (Layout::relaxation_loop_body): Similarly use abi_pagesize
1652 to determine whether file header can go in segment.
1654 2012-08-30 Alan Modra <amodra@gmail.com>
1656 * output.h (Output_reloc::Output_reloc <output section>): Add
1657 is_relative param. Adjust calls.
1658 (Output_reloc::add_output_section_relative): New functions.
1659 * output.cc (Output_reloc::Output_reloc <output section>): Handle
1661 (Output_reloc::symbol_value): Handle SECTION_CODE.
1663 2012-08-24 Sriraman Tallam <tmsriram@google.com>
1665 * gold.cc (queue_middle_tasks): Call layout again when unique
1666 segments for sections is desired.
1667 * layout.cc (Layout::Layout): Initialize new members.
1668 (Layout::get_output_section_flags): New function.
1669 (Layout::choose_output_section): Call get_output_section_flags.
1670 (Layout::layout): Make output section for mapping to a unique segment.
1671 (Layout::insert_section_segment_map): New function.
1672 (Layout::attach_allocated_section_to_segment): Make unique segment for
1673 output sections marked so.
1674 (Layout::segment_precedes): Check for unique segments when sorting.
1675 * layout.h (Layout::Unique_segment_info): New struct.
1676 (Layout::Section_segment_map): New typedef.
1677 (Layout::insert_section_segment_map): New function.
1678 (Layout::get_output_section_flags): New function.
1679 (Layout::is_unique_segment_for_sections_specified): New function.
1680 (Layout::set_unique_segment_for_sections_specified): New function.
1681 (Layout::unique_segment_for_sections_specified_): New member.
1682 (Layout::section_segment_map_): New member.
1683 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1684 Rename is_gc_pass_one to is_pass_one.
1685 Rename is_gc_pass_two to is_pass_two.
1686 Rename is_gc_or_icf to is_two_pass.
1687 Check for which pass based on whether symbols data is present.
1688 Make it two pass when unique segments for sections is desired.
1689 * output.cc (Output_section::Output_section): Initialize new
1691 * output.h (Output_section::is_unique_segment): New function.
1692 (Output_section::set_is_unique_segment): New function.
1693 (Output_section::is_unique_segment_): New member.
1694 (Output_section::extra_segment_flags): New function.
1695 (Output_section::set_extra_segment_flags): New function.
1696 (Output_section::extra_segment_flags_): New member.
1697 (Output_section::segment_alignment): New function.
1698 (Output_section::set_segment_alignment): New function.
1699 (Output_section::segment_alignment_): New member.
1700 (Output_segment::Output_segment): Initialize is_unique_segment_.
1701 (Output_segment::is_unique_segment): New function.
1702 (Output_segment::set_is_unique_segment): New function.
1703 (Output_segment::is_unique_segment_): New member.
1704 * plugin.cc (allow_unique_segment_for_sections): New function.
1705 (unique_segment_for_sections): New function.
1706 (Plugin::load): Add new functions to transfer vector.
1707 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1708 * Makefile.in: Regenerate.
1709 * testsuite/plugin_final_layout.sh: Check if unique segment
1710 functionality works.
1711 * testsuite/plugin_section_order.c (onload): Check if new interfaces
1713 (allow_unique_segment_for_sections): New global.
1714 (unique_segment_for_sections): New global.
1715 (claim_file_hook): Call allow_unique_segment_for_sections.
1716 (all_symbols_read_hook): Call unique_segment_for_sections.
1718 2012-08-22 Cary Coutant <ccoutant@google.com>
1720 * layout.cc (Layout::include_section): Don't assert on GROUP
1721 sections with --emit-relocs.
1723 2012-08-21 Cary Coutant <ccoutant@google.com>
1725 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1726 if --export-dynamic-symbol names an undef symbol.
1728 2012-08-18 Alan Modra <amodra@gmail.com>
1730 * powerpc.cc: Formatting and white space.
1731 (Powerpc_relobj): Rename got2_section_ to special_.
1732 Add opd_ent_shndx_ and opd_ent_off_ vectors.
1733 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1734 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1735 (Target_powerpc): Add Address typedef and invalid_address. Use
1737 (Target_powerpc::is_branch_reloc): New function.
1738 (Powerpc_relocate_functions): Add Address typedef, use throughout.
1739 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1740 for dst_mask, value and addend.
1741 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1742 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1743 (Output_data_glink::do_write): Correct toc base. Don't try to use
1744 uint16_t for 24-bit offset. Use get_output_section_offset and
1746 (Target_powerpc::Scan::local): Handle more relocs.
1747 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1748 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1749 Plug in toc restoring insn after plt calls. Translate branches
1750 to function descriptor symbols to corresponding entry point.
1751 (Target_powerpc::relocate_for_relocatable): Check return from
1752 get_output_section_offset.
1753 * symtab.h: Comment typo.
1755 2012-08-14 Ian Lance Taylor <iant@google.com>
1757 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1758 unsupported_relocal_local to call unsupported_reloc_global.
1760 2012-08-14 Nick Clifton <nickc@redhat.com>
1763 * script-sections.cc (Sections_element::output_section_name): Add
1764 keep return parameter.
1765 (Output_section_element::match_name): Add keep return parameter.
1766 Return the value of the keep_ member.
1767 * script-sections.h (class Output_section): Update
1768 output_section_name prototype.
1769 * layout.cc (Layout::keep_input_section): New public member
1771 (Layout::choose_output_section): Pass keep parameter to
1772 output_section_name.
1773 * layout.h (class Layout): Add keep_input_section.
1774 * object.cc (Sized_relobj_file::do_layout): Check for kept input
1776 * testsuite/Makefile.am: Add a test.
1777 * testsuite/Makefile.in: Regenerate.
1778 * testsuite/pr14265.c: Source file for the test.
1779 * testsuite/pr14265.t: Linker script for the test.
1780 * testsuite/pr14265.sh: Shell script for the test.
1782 2012-08-14 Alan Modra <amodra@gmail.com>
1784 * target.h (Target::output_section_name): New function.
1785 (Target::do_output_section_name): New function.
1786 * layout.cc (Layout::choose_output_section): Call the above.
1787 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1789 2012-08-14 Alan Modra <amodra@gmail.com>
1791 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1792 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1793 for replace_constant call.
1794 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1795 (Output_data_glink::do_print_to_mapfile): New function.
1796 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1797 (Target_powerpc::Relocate::relocate): Likewise.
1799 2012-08-14 Alan Modra <amodra@gmail.com>
1801 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1802 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1803 (Output_data_glink::add_entry,find_entry): Remove shndx param.
1804 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
1805 all references to shndx_. Handle special case for R_PPC_PLTREL24
1807 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1808 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1809 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1811 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1812 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1814 2012-08-12 Alan Modra <amodra@gmail.com>
1816 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
1817 (glink insn constants): Use uint32_t.
1818 (Output_data_glink::add_entry): Use insert, not [] operator.
1820 2012-08-11 Alan Modra <amodra@gmail.com>
1822 * object.h (Sized_relobj_file::find_shdr): New function.
1823 (Sized_relobj_file::find_special_sections): New function.
1824 * object.cc (Sized_relobj_file::find_shdr): New function.
1825 (Sized_relobj_file::find_eh_frame): Use find_shdr.
1826 (Sized_relobj_file::find_special_sections): New function, split out..
1827 (Sized_relobj_file::do_read_symbols): ..from here.
1828 * output.h (Output_data_got::replace_constant): New function.
1829 (Output_data_got::num_entries): New function.
1830 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1831 (Output_data_got::got_offset): Protected rather than private.
1832 (Output_data_got::replace_got_entry): New function.
1833 * output.cc (Output_data_got::replace_got_entry): New function.
1834 * powerpc.cc (class Powerpc_relobj): New.
1835 (class Powerpc_relocate_functions): Delete all psymval variants or
1836 convert to value,addend type. Delete pcrela, pcrela_unaligned.
1837 Implement _ha functions using corresponding _hi function.
1838 (Powerpc_relobj::find_special_sections): New function.
1839 (Target_powerpc::do_make_elf_object): New function.
1840 (class Output_data_got_powerpc): New.
1841 (class Output_data_glink): New.
1842 (class Powerpc_scan_relocatable_reloc): New.
1843 Many more changes througout file.
1845 2012-08-09 Nick Clifton <nickc@redhat.com>
1847 * po/vi.po: Updated Vietnamese translation.
1849 2012-08-07 Ian Lance Taylor <iant@google.com>
1851 * layout.cc (Layout::add_target_dynamic_tags): If
1852 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1855 2012-07-30 Nick Clifton <nickc@redhat.com>
1857 * po/gold.pot: Updated template.
1858 * po/es.po: Updated Spanish translation.
1860 2012-07-18 Cary Coutant <ccoutant@google.com>
1863 * configure.ac: Add check for -gpubnames support.
1864 * configure: Regenerate.
1865 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1866 support; force -gno-pubnames.
1867 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1869 (gdb_index_test_4): New test.
1870 * testsuite/Makefile.in: Regenerate.
1871 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1872 * testsuite/gdb_index_test_2.sh: Likewise.
1873 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1874 * testsuite/gdb_index_test_4.sh: New script.
1875 * testsuite/gdb_index_test_comm.sh: New script with common code;
1876 don't look for space after colon.
1878 2012-07-16 Sriraman Tallam <tmsriram@google.com>
1880 * gold.cc (queue_middle_tasks): Update function order only after
1881 deferred objects due to plugins are processed.
1883 2012-07-11 Ian Lance Taylor <iant@google.com>
1885 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1886 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1887 (Target_arm::scan_reloc_for_stub): Likewise.
1888 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1889 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1890 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1891 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1892 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1894 2012-07-10 Dodji Seketeli <dodji@redhat.com>
1895 Ian Lance Taylor <iant@google.com>
1898 * configure.ac: Test whether std::tr1::hash<off_t> works.
1899 * gold.h: Add a specialization for std::tr1::hash<off_t> if
1901 * output.h (class Output_fill): Add virtual destructor.
1902 * configure, config.in: Rebuild.
1904 2012-06-22 Roland McGrath <mcgrathr@google.com>
1906 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1908 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
1910 * plugin.cc (Plugin::load): Handle position independent executables.
1912 2012-06-06 Cary Coutant <ccoutant@google.com>
1914 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1916 (lines_only_debug_sections): Likewise.
1917 (gdb_fast_lookup_sections): New static array.
1918 (is_gdb_debug_section): Rename formal parameter.
1919 (is_lines_only_debug_section): Likewise.
1920 (is_gdb_fast_lookup_section): New function.
1921 (Layout::include_section): Check for ".zdebug_" prefix; pass
1922 section name suffix to is_gdb_debug_section, et al.; check for
1923 fast-lookup sections when building .gdb_index.
1924 * options.h (--strip-debug-gdb): Update GDB version number.
1926 2012-06-06 Cary Coutant <ccoutant@google.com>
1928 * configure.ac: Add check for fallocate.
1929 * configure: Regenerate.
1930 * config.in: Regenerate.
1932 * options.h (class General_options): Add --mmap-output-file and
1933 --posix-fallocate options.
1934 * output.cc: (posix_fallocate): Remove; replace with...
1935 (gold_fallocate): New function.
1936 (Output_file::map_no_anonymous): Call gold_fallocate.
1937 (Output_file::map): Check --mmap-output-file option.
1939 2012-06-05 Jing Yu <jingyu@google.com>
1941 * gold.h (textdomain): Add do {} to empty while(0).
1942 (bindtextdomain): Likewise.
1944 2012-06-04 Cary Coutant <ccoutant@google.com>
1946 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1949 2012-05-25 Sriraman Tallam <tmsriram@google.com>
1951 * symtab.cc (Symbol_table::define_special_symbol):
1952 Initialize *poldsym to prevent uninitialized variable errors.
1954 2012-05-23 Cary Coutant <ccoutant@google.com>
1956 * layout.cc (Layout::section_name_mapping): Add rules to handle
1957 exact match on .data.rel.ro.local or .data.rel.ro.
1958 (Layout::output_section_name): Check for exact matches.
1960 2012-05-23 Cary Coutant <ccoutant@google.com>
1962 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1965 2012-05-22 Cary Coutant <ccoutant@google.com>
1967 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1968 object before exporting symbol.
1970 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
1972 * testsuite/tls_test.cc: Include "config.h" first.
1973 * testsuite/tls_test_c.c: Likewise.
1975 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
1976 Nick Clifton <nickc@redhat.com>
1979 * configure.in: Add check that sysdep.h has been included before
1980 any system header files.
1981 * configure: Regenerate.
1982 * config.in: Regenerate.
1984 2012-05-14 Cary Coutant <ccoutant@google.com>
1986 * layout.cc (Layout::make_output_section): Mark .tdata section
1988 * testsuite/relro_test.cc: Add a TLS variable.
1990 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
1993 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1994 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1997 2012-05-08 Cary Coutant <ccoutant@google.com>
1999 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2000 (lines_only_debug_sections): Likewise.
2002 2012-05-02 Roland McGrath <mcgrathr@google.com>
2004 * nacl.cc: New file.
2006 * Makefile.am (CCFILES, HFILES): Add them.
2007 * Makefile.in: Regenerate.
2008 * i386.cc (Output_data_plt_i386_nacl): New class.
2009 (Output_data_plt_i386_nacl_exec): New class.
2010 (Output_data_plt_i386_nacl_dyn): New class.
2011 (Target_i386_nacl): New class.
2012 (Target_selector_i386_nacl): New class.
2013 (target_selector_i386): Use it instead of Target_selector_i386.
2014 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2015 (Target_x86_64_nacl): New class.
2016 (Target_selector_x86_64_nacl): New class.
2017 (target_selector_x86_64, target_selector_x32): Use it instead of
2018 Target_selector_x86_64.
2019 * arm.cc (Output_data_plt_arm_nacl): New class.
2020 (Target_arm_nacl): New class.
2021 (Target_selector_arm_nacl): New class.
2022 (target_selector_arm, target_selector_armbe): Use it instead of
2023 Target_selector_arm.
2025 * target-select.cc (select_target): Take new Input_file* and off_t
2026 arguments, pass them on to recognize method of selector.
2027 * object.cc (make_elf_sized_object): Update caller.
2028 * parameters.cc (parameters_force_valid_target): Likewise.
2029 * incremental.cc (make_sized_incremental_binary): Likewise.
2030 * target-select.h: Update decl.
2031 (Target_selector::recognize): Take new Input_file* argument,
2032 pass it on to do_recognize.
2033 (Target_selector::do_recognize): Take new Input_file* argument.
2034 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2035 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2036 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2037 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2039 * target.h (Target::Target_info): New members isolate_execinstr
2041 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2042 * arm.cc (Target_arm::arm_info): Update initializer.
2043 * i386.cc (Target_i386::i386_info): Likewise.
2044 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2045 * sparc.cc (Target_sparc::sparc_info): Likewise.
2046 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2047 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2048 * layout.cc (Layout::attach_allocated_section_to_segment):
2049 Take new const Target* argument. If target->isolate_execinstr(), act
2051 (Layout::find_first_load_seg): Take new const Target* argument;
2052 if target->isolate_execinstr(), reject PF_X segments.
2053 (Layout::relaxation_loop_body): Update caller.
2054 (Layout::set_segment_offsets): If target->isolate_execinstr(),
2055 reset file offset to zero when we hit LOAD_SEG, and then do a second
2056 loop over the segments before LOAD_SEG to reassign offsets after
2057 addresses have been determined. Handle target->rosegment_gap().
2058 (Layout::attach_section_to_segment): Take new const Target* argument;
2059 pass it to attach_allocated_section_to_segment.
2060 (Layout::make_output_section): Update caller.
2061 (Layout::attach_sections_to_segments): Take new const Target* argument;
2062 pass it to attach_section_to_segment.
2063 * gold.cc (queue_middle_tasks): Update caller.
2064 * layout.h (Layout): Update method decls with new arguments.
2066 * arm.cc (Target_arm::Target_arm): Take optional argument for the
2067 Target_info pointer to use.
2068 (Target_arm::do_make_data_plt): New virtual method.
2069 (Target_arm::make_data_plt): New method that calls it.
2070 (Target_arm::make_plt_entry): Use it.
2071 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2072 for the section alignment.
2073 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2075 (Output_data_plt_arm::first_plt_entry_offset): Call it.
2076 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2078 (Output_data_plt_arm::get_plt_entry_size): Call it.
2079 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2080 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2081 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2083 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2084 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2085 method instead of sizeof(plt_entry).
2086 (Output_data_plt_arm::add_entry): Likewise.
2087 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2088 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2090 (Target_arm::plt_entry_size): Likewise.
2091 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2093 (Output_data_plt_arm_standard): ... here, new class.
2094 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2095 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2096 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2098 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2099 Take additional argument for the PLT entry size.
2100 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2101 Use get_plt_entry_size method rather than plt_entry_size variable.
2102 (Output_data_plt_x86_64::reserve_slot): Likewise.
2103 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2104 (Output_data_plt_x86_64::add_entry): Likewise.
2105 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2106 (Output_data_plt_x86_64::address_for_global): Likewise.
2107 (Output_data_plt_x86_64::address_for_local): Likewise.
2108 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2109 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2110 Make method non-static.
2111 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2113 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2114 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2115 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2116 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2118 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2119 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2121 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2122 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2124 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2125 (Output_data_plt_x86_64::plt_entry_size)
2126 (Output_data_plt_x86_64::first_plt_entry)
2127 (Output_data_plt_x86_64::plt_entry)
2128 (Output_data_plt_x86_64::tlsdesc_plt_entry)
2129 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2130 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2131 (Output_data_plt_x86_64_standard): ... here, new class.
2132 (Target_x86_64::Target_x86_64): Take optional argument for the
2133 Target_info pointer to use.
2134 (Target_x86_64::do_make_data_plt): New virtual method.
2135 (Target_x86_64::make_data_plt): New method to call it.
2136 (Target_x86_64::init_got_plt_for_update): Use that.
2137 Call this->plt_->add_eh_frame method here.
2138 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2139 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2140 rather than static method.
2141 (Target_x86_64::plt_entry_size): Likewise.
2142 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2143 rather than plt_entry_size variable. Move guts of PLT filling to...
2144 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2145 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2146 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2148 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2149 additional argument for the section alignment.
2150 Don't do add_eh_frame_for_plt here.
2151 (Output_data_plt_i386::first_plt_entry_offset): Make the method
2152 non-static. Use get_plt_entry_size method rather than plt_entry_size
2154 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2156 (Output_data_plt_i386::get_plt_entry_size): Call it.
2157 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2158 (Output_data_plt_i386::add_eh_frame): New method to call it.
2159 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2161 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2162 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2164 (Output_data_plt_i386::fill_plt_entry): New method to call it.
2165 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2166 method instead of plt_entry_size.
2167 (Output_data_plt_i386::plt_entry_size)
2168 (Output_data_plt_i386::plt_eh_frame_fde_size)
2169 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2170 (Output_data_plt_i386_standard): ... here, new class.
2171 (Output_data_plt_i386_exec): New class.
2172 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2173 (Output_data_plt_i386_exec::first_plt_entry): ... here.
2174 (Output_data_plt_i386::exec_plt_entry): Move to ...
2175 (Output_data_plt_i386_exec::plt_entry): ... here.
2176 (Output_data_plt_i386_dyn): New class.
2177 (Output_data_plt_i386::first_plt_entry): Move to ...
2178 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2179 (Output_data_plt_i386::dyn_plt_entry): Move to ...
2180 (Output_data_plt_i386_dyn::plt_entry): ... here.
2181 (Target_i386::Target_i386): Take optional argument for the Target_info
2183 (Target_i386::do_make_data_plt): New virtual method.
2184 (Target_i386::make_data_plt): New method to call it.
2185 (Target_i386::make_plt_section): Use that.
2186 Call this->plt_->add_eh_frame method here.
2187 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2188 rather than plt_entry_size variable.
2189 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2190 (Output_data_plt_i386::address_for_local): Likewise.
2191 (Output_data_plt_i386::do_write): Likewise.
2192 Move guts of PLT filling to...
2193 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2194 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2195 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2196 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2198 2012-05-01 Cary Coutant <ccoutant@google.com>
2200 * dwarf_reader.cc (Dwarf_die::read_attributes)
2201 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2202 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2203 * reduced_debug_output.cc
2204 (Output_reduced_debug_info_section::get_die_end): Remove
2205 DW_FORM_GNU_ref_index. Add default case.
2207 2012-04-26 Mark Wielaard <mjw@redhat.com>
2209 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2210 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2211 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2212 DW_AT_high_pc as offset from DW_AT_low_pc.
2214 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2215 * testsuite/Makefile.in: Regenerate.
2216 * testsuite/gdb_index_test_3.c: New test source file.
2217 * testsuite/gdb_index_test_3.sh: New test source file.
2219 2012-04-25 Ian Lance Taylor <iant@google.com>
2221 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2223 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2224 as a class, not a struct.
2225 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2226 (Target_arm::apply_cortex_a8_workaround): Likewise.
2227 * gc.h: Declare Reloc_types as a struct, not a class.
2228 * object.h: Declare Symbols_data as a struct.
2229 * reloc.h: Declare Read_relocs_data as a struct.
2230 * target.h: Declare Relocate_info as a struct.
2232 2012-04-24 David S. Miller <davem@davemloft.net>
2234 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2235 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2238 2012-04-24 Cary Coutant <ccoutant@google.com>
2240 * incremental-dump.cc (find_input_containing_global): Replace
2241 magic number with symbolic constant.
2242 (dump_incremental_inputs): Update version number.
2243 * incremental.cc (Output_section_incremental_inputs): Update version
2244 number; import symbolic constants from Incremental_inputs_reader.
2245 (Incremental_inputs::create_data_sections): Align relocations
2246 section correctly for 64-bit targets.
2247 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2248 constants; add padding.
2249 (Output_section_incremental_inputs::write_header): Add assert for
2251 (Output_section_incremental_inputs::write_input_files): Add assert
2252 for input_entry_size.
2253 (Output_section_incremental_inputs::write_info_blocks): Add padding;
2254 add assert for object_info_size, input_section_entry_size,
2255 global_sym_entry_size.
2256 * incremental.h (Incremental_inputs_reader): Add symbolic constants
2257 for data structure sizes; use them.
2258 (Incremental_input_entry_reader): Import symbolic constants from
2259 Incremental_inputs_reader; use them.
2261 2012-04-23 David S. Miller <davem@davemloft.net>
2263 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2265 (Target_sparc::Target_sparc): Initialize new fields.
2266 (Target_sparc::do_make_elf_object): New function.
2267 (Target_sparc::do_adjust_elf_header): New function.
2269 2012-04-23 Cary Coutant <ccoutant@google.com>
2271 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2272 CU range table of gdb index.
2274 2012-04-20 David S. Miller <davem@davemloft.net>
2276 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2279 2012-04-16 David S. Miller <davem@davemloft.net>
2281 * sparc.cc (Target_sparc::got_address): New function.
2282 (Sparc_relocate_functions::gdop_hix22): New function.
2283 (Sparc_relocate_functions::gdop_lox10): New function.
2284 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2286 (Target_sparc::Scan::local): Likewise if the global symbol is not
2287 preemptible and is not IFUNC.
2288 (Target_sparc::Relocate::relocate): Perform GOTDATA code
2289 transformations for local and non-preemptible non-IFUNC global
2292 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2293 writing out 64-bit part of ranges.
2295 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2296 -fpic and -fpie respectively.
2297 * Makefile.in: Regenerate.
2299 * sparc.cc (class Target_sparc): Add rela_ifunc_.
2300 (Target_sparc::Target_sparc): Initialize new field.
2301 (Target_sparc::do_plt_section_for_global): New function.
2302 (Target_sparc::do_plt_section_for_local): New function.
2303 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2304 (Target_sparc::make_plt_section): New function, broken out of
2305 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
2306 (Target_sparc::make_plt_entry): Call make_plt_section.
2307 (Target_sparc::make_local_ifunc_plt_entry): New function.
2308 (Target_sparc::rela_ifunc_section): New function.
2309 (Target_sparc::plt_section): Remove const.
2310 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
2311 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2312 and ifunc_count_ fields.
2313 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2314 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2315 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2316 (Output_data_plt_sparc::rela_ifunc): New function.
2317 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2318 (Output_data_plt_sparc::has_ifunc_section): New function.
2319 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2320 (Output_data_plt_sparc::address_for_global): New function.
2321 (Output_data_plt_sparc::address_for_local): New function.
2322 (Output_data_plt_sparc::plt_index_to_offset): New function.
2323 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2325 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2327 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2328 R_SPARC_JMP_IREL to switch.
2329 (Target_sparc::Scan::check_non_pic): Likewise.
2330 (Target_sparc::Scan::local): Handle IFUNC symbols.
2331 (Target_sparc::Scan::local): Likewise.
2332 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2333 and plt_address_for_local.
2334 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2335 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2337 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2338 (class Output_data_reloc): Adjust calls to Output_reloc_type.
2339 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2340 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2342 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2343 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2345 * sparc.cc (Target_sparc::Scan::global): Likewise.
2346 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2348 2012-04-16 Cary Coutant <ccoutant@google.com>
2350 * archive.cc (Library_base::should_include_member): Check for
2351 --export-dynamic-symbol.
2352 * options.h (class General_options): Add --export-dynamic-symbol.
2353 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2354 --export-dynamic-symbol.
2355 (Symbol_table::gc_mark_undef_symbols): Likewise.
2356 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2358 2012-04-12 David S. Miller <davem@davemloft.net>
2360 * sparc.cc (Reloc::wdisp10): New relocation method.
2361 (Reloc::h34): Likewise.
2362 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2363 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2365 (Target_sparc::Scan::local): Likewise.
2366 (Target_sparc::Scan::global): Likewise.
2367 (Target_sparc::Relocate::relocate): Likewise.
2369 2012-04-09 Cary Coutant <ccoutant@google.com>
2371 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2374 2012-04-06 Ian Lance Taylor <iant@google.com>
2376 * timer.cc: #include <unistd.h>.
2378 2012-04-06 Roland McGrath <mcgrathr@google.com>
2380 * configure.in (AC_CHECK_HEADERS): Add locale.h.
2381 * config.in: Regenerate.
2382 * configure: Regenerate.
2384 2012-04-05 Nick Clifton <nickc@redhat.com>
2386 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2387 (AM_LC_MESSAGES): Add.
2388 * aclocal.m4: Regenerate.
2389 * config.in: Regenerate.
2390 * configure: Regenerate.
2392 2012-03-21 Cary Coutant <ccoutant@google.com>
2394 * Makefile.am: Add gdb-index.cc, gdb-index.h.
2395 * Makefile.in: Regenerate.
2396 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2397 (Sized_elf_reloc_mapper::symbol_section): New function.
2398 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2399 (make_elf_reloc_mapper): New function.
2400 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2401 (Dwarf_abbrev_table::do_read_abbrevs): New function.
2402 (Dwarf_abbrev_table::do_get_abbrev): New function.
2403 (Dwarf_ranges_table::read_ranges_table): New function.
2404 (Dwarf_ranges_table::read_range_list): New function.
2405 (Dwarf_pubnames_table::read_section): New function.
2406 (Dwarf_pubnames_table::read_header): New function.
2407 (Dwarf_pubnames_table::next_name): New function.
2408 (Dwarf_die::Dwarf_die): New function.
2409 (Dwarf_die::read_attributes): New function.
2410 (Dwarf_die::skip_attributes): New function.
2411 (Dwarf_die::set_name): New function.
2412 (Dwarf_die::set_linkage_name): New function.
2413 (Dwarf_die::attribute): New function.
2414 (Dwarf_die::string_attribute): New function.
2415 (Dwarf_die::int_attribute): New function.
2416 (Dwarf_die::uint_attribute): New function.
2417 (Dwarf_die::ref_attribute): New function.
2418 (Dwarf_die::child_offset): New function.
2419 (Dwarf_die::sibling_offset): New function.
2420 (Dwarf_info_reader::check_buffer): New function.
2421 (Dwarf_info_reader::parse): New function.
2422 (Dwarf_info_reader::do_parse): New function.
2423 (Dwarf_info_reader::do_read_string_table): New function.
2424 (Dwarf_info_reader::lookup_reloc): New function.
2425 (Dwarf_info_reader::get_string): New function.
2426 (Dwarf_info_reader::visit_compilation_unit): New function.
2427 (Dwarf_info_reader::visit_type_unit): New function.
2428 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2429 Sized_elf_reloc_mapper.
2430 (Sized_dwarf_line_info::symbol_section): Remove function.
2431 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2432 (Sized_dwarf_line_info::read_line_mappings): Remove object
2433 parameter, adjust callers.
2434 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2435 * dwarf_reader.h: Include <sys/types.h>.
2436 (class Track_relocs): Remove forward declaration.
2437 (class Elf_reloc_mapper): New class.
2438 (class Sized_elf_reloc_mapper): New class.
2439 (class Dwarf_abbrev_table): New class.
2440 (class Dwarf_range_list): New class.
2441 (class Dwarf_ranges_table): New class.
2442 (class Dwarf_pubnames_table): New class.
2443 (class Dwarf_die): New class.
2444 (class Dwarf_info_reader): New class.
2445 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2446 (Sized_dwarf_line_info::symbol_section): Remove member function.
2447 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2449 * gdb-index.cc: New source file.
2450 * gdb-index.h: New source file.
2451 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2452 and .debug_types sections, call Layout::add_to_gdb_index.
2453 (Sized_relobj_incr::do_section_name): Implement.
2454 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2455 return type; Implement.
2456 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2458 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2459 parameter list and return type.
2460 (Sized_incr_dynobj::do_section_contents): Likewise.
2461 * layout.cc: Include gdb-index.h.
2462 (Layout::Layout): Initialize gdb_index_data_.
2463 (Layout::init_fixed_output_section): Check for .gdb_index section.
2464 (Layout::add_to_gdb_index): New function. Instantiate.
2465 * layout.h: Add forward declaration for class Gdb_index.
2466 (Layout::add_to_gdb_index): New member function.
2467 (Layout::gdb_index_data_): New data member.
2468 * main.cc: Include gdb-index.h.
2469 (main): Print statistics for gdb index.
2470 * object.cc (Object::section_contents): Move code into
2471 do_section_contents.
2472 (need_decompressed_section): Check for sections needed when building
2474 (build_compressed_section_map): Likewise.
2475 (Sized_relobj_file::do_read_symbols): Need local symbols when building
2477 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2478 sections; call Layout::add_to_gdb_index.
2479 (Sized_relobj_file::do_decompressed_section_contents): Call
2480 do_section_contents directly.
2481 * object.h (Object::do_section_contents): Adjust parameter list and
2483 (Object::do_decompressed_section_contents): Call do_section_contents
2485 (Sized_relobj_file::do_section_contents): Adjust parameter list and
2487 * options.h (class General_options): Add --gdb-index option.
2488 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2489 list and return type.
2490 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2491 * reloc.h (Track_relocs::checkpoint): New function.
2492 (Track_relocs::reset): New function.
2494 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2496 * testsuite/Makefile.in: Regenerate.
2497 * testsuite/gdb_index_test.cc: New test source file.
2498 * testsuite/gdb_index_test_1.sh: New test source file.
2499 * testsuite/gdb_index_test_2.sh: New test source file.
2501 2012-03-19 Doug Kwan <dougkwan@google.com>
2503 * arm.cc (Target_arm::do_define_standard_symbols): New method.
2504 (Target_arm::do_finalize_sections): Remove code which defines
2505 __exidx_start and __exidx_end. Make symbol table parameter
2506 anonymous as it is not used.
2507 * gold.cc (queue_middle_tasks): Call target hook to define any
2508 target-specific symbols.
2509 * target.h (Target::define_standard_symbols): New method.
2510 (Target::do_define_standard_symbols): Same.
2511 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2512 * testsuite/Makefile.in: Regenerate.
2513 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2515 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2516 relocations are generated for __exidx_start and __exidx_end.
2518 2012-03-16 Doug Kwan <dougkwan@google.com>
2520 * testsuite/Makefile.am: Disable test initpri3b.
2521 * testsuite/Makefile.in: Regenerate.
2523 2012-03-15 Doug Kwan <dougkwan@google.com>
2525 * arm.cc (Target_arm::got_section): Make .got section read-only
2528 2012-03-15 Ian Lance Taylor <iant@google.com>
2531 * layout.cc (Layout::make_output_section): Correctly mark
2532 SHT_INIT_ARRAY, et. al., as relro.
2534 2012-03-14 Doug Kwan <dougkwan@google.com>
2536 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2537 dynamic relocations for protected symbols in shared objects.
2539 2012-03-13 Ian Lance Taylor <iant@google.com>
2541 * resolve.cc (Symbol_table::resolve): When merging common symbols,
2542 keep the larger alignment.
2544 2012-03-12 Cary Coutant <ccoutant@google.com>
2546 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2547 handling of DW_LNE_define_file.
2549 2012-03-12 Cary Coutant <ccoutant@google.com>
2551 * reduced_debug_output.cc
2552 (Output_reduced_debug_info_section::get_die_end): Add new FORM
2555 2012-02-29 Cary Coutant <ccoutant@google.com>
2557 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2559 2012-02-29 Cary Coutant <ccoutant@google.com>
2561 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2562 Call Object::decompressed_section_contents.
2563 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2565 (Sized_dwarf_line_info::buffer_start_): New data member.
2566 * merge.cc (Output_merge_data::do_add_input_section): Call
2567 Object::decompressed_section_contents.
2568 (Output_merge_string::do_add_input_section): Likewise.
2569 * object.cc (need_decompressed_section): New function.
2570 (build_compressed_section_map): Decompress sections needed later.
2571 (Sized_relobj_file::do_decompressed_section_contents): New function.
2572 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2573 * object.h (Object::decompressed_section_contents): New function.
2574 (Object::discard_decompressed_sections): New function.
2575 (Object::do_decompressed_section_contents): New function.
2576 (Object::do_discard_decompressed_sections): New function.
2577 (Compressed_section_info): New type.
2578 (Compressed_section_map): Include decompressed section contents.
2579 (Sized_relobj_file::do_decompressed_section_contents): New function.
2580 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2582 2012-02-16 Cary Coutant <ccoutant@google.com>
2584 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2585 * testsuite/Makefile.in: Regenerate.
2587 2012-02-14 Cary Coutant <ccoutant@google.com>
2589 * options.cc (General_options::finalize): Disallow -pie and -static.
2591 2012-02-03 Doug Kwan <dougkwan@google.com>
2593 * arm.cc (Arm_relocate_functions::abs8,
2594 Arm_relocate_functions::abs16): Use
2595 Bits::has_signed_unsigned_overflow32.
2596 (Arm_relocate_functions::thm_abs8): Correct range of
2598 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2601 2012-02-02 Doug Kwan <dougkwan@google.com>
2603 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2604 position independent outputs, not just shared objects.
2606 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
2608 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2609 * configure: Regenerated.
2611 2012-01-27 Ian Lance Taylor <iant@google.com>
2613 * reloc.h (Bits): New class with static functions, copied from
2614 namespace utils in arm.cc.
2615 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
2618 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2620 * incremental.cc (write_info_blocks): Correct relocation offset.
2622 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2624 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2625 (Relocate::tls_gd_to_le): Likewise.
2627 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2629 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2631 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2633 * configure.ac: Check if -mcmodel=medium works.
2634 * configure: Regenerated.
2636 2012-01-24 Cary Coutant <ccoutant@google.com>
2638 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2640 (read_unsigned_LEB_128_x): ... this new function.
2641 (read_signed_LEB_128): Replaced with inline definition and ...
2642 (read_signed_LEB_128_x): ... this new function.
2643 * int_encoding.h (read_unsigned_LEB_128_x): New function.
2644 (read_unsigned_LEB_128): Add inline definition.
2645 (read_signed_LEB_128_x): New function.
2646 (read_signed_LEB_128): Add inline definition.
2647 * testsuite/Makefile.am (leb128_unittest): New unit test.
2648 * testsuite/Makefile.in: Regenerate.
2649 * testsuite/leb128_unittest.cc: New unit test.
2651 2012-01-23 Ian Lance Taylor <iant@google.com>
2654 * i386.cc (Target_i386::do_code_fill): When using a jmp
2655 instruction, pad with nop instructions.
2656 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2658 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
2660 * x86_64.cc (gc_process_relocs): Add typename on types used in
2662 (scan_relocs): Likewise.
2663 (relocate_section): Likewise.
2664 (apply_relocation): Likewise.
2666 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
2668 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2669 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2672 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
2674 * x86_64.cc: Initial support for x32.
2676 2012-01-03 Cary Coutant <ccoutant@google.com>
2678 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2679 Use abstract base class for GOT.
2680 * gold/output.h (class Output_data_got_base): New abstract base class.
2681 (class Output_data_got): Derive from new base class, adjust ctors.
2682 (Output_data_got::reserve_slot): Make virtual; rename to
2683 do_reserve_slot; Adjust callers.
2684 * gold/target.h (Sized_target::init_got_plt_for_update): Return
2685 pointer to abstract base class.
2686 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2688 2011-12-18 Ian Lance Taylor <iant@google.com>
2690 * object.h (Relobj::local_symbol_value): New function.
2691 (Relobj::local_plt_offset): New function.
2692 (Relobj::local_has_got_offset): New function.
2693 (Relobj::local_got_offset): New function.
2694 (Relobj::set_local_got_offset): New function.
2695 (Relobj::do_local_symbol_value): New pure virtual function.
2696 (Relobj::do_local_plt_offset): Likewise.
2697 (Relobj::do_local_has_got_offset): Likewise.
2698 (Relobj::do_local_got_offset): Likewise.
2699 (Relobj::do_set_local_got_offset): Likewise.
2700 (Sized_relobj::do_local_has_got_offset): Rename from
2701 local_has_got_offset.
2702 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2703 (Sized_relobj::do_set_local_got_offset): Rename from
2704 set_local_got_offset.
2705 (Sized_relobj_file::do_local_plt_offset): Rename from
2707 (Sized_relobj_file::do_local_symbol_value): New function.
2708 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2710 * output.cc (Output_data_got::Got_entry::write): Change object to
2711 Relobj. Use local_symbol_value.
2712 (Output_data_got::add_global_with_rel): Change rel_dyn to
2713 Output_data_reloc_generic*. Use add_global_generic.
2714 (Output_data_got::add_global_with_rela): Remove. Change all
2715 callers to use add_global_with_rel.
2716 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2717 Output_data_reloc_generic*. Use add_global_generic.
2718 (Output_data_got::add_global_pair_with_rela): Remove. Change all
2719 callers to use add_global_pair_with_rel.
2720 (Output_data_got::add_local): Change object to Relobj*.
2721 (Output_data_got::add_local_plt): Likewise.
2722 (Output_data_got::add_local_with_rel): Change object to Relobj*,
2723 change rel_dyn to Output_data_reloc_generic*. Use
2725 (Output_data_got::add_local_with_rela): Remove. Change all
2726 callers to use all_local_with_rel.
2727 (Output_data_got::add_local_pair_with_rel): Change object to
2728 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
2729 add_output_section_generic.
2730 (Output_data_got::add_local_pair_with_rela): Remove. Change all
2731 callers to use add_local_pair_with_rel.
2732 (Output_data_got::reserve_local): Change object to Relobj*.
2733 * output.h: (class Output_data_reloc_generic): Add pure virtual
2734 declarations for add_global_generic, add_local_generic,
2735 add_output_section_generic.
2736 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2737 functions for Output_data_reloc_generic. Update declarations for
2738 changes listed in output.cc.
2739 (class Output_data_got): Change template parameter to got_size.
2740 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
2741 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2743 (Sized_relobj_incr::do_local_plt_offset): New function.
2744 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2747 2011-12-17 Cary Coutant <ccoutant@google.com>
2749 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2750 * resolve.cc (Symbol_table::resolve): Likewise.
2751 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2753 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2755 2011-12-16 Ian Lance Taylor <iant@google.com>
2757 * output.h (Output_data_reloc_generic::add): Only call
2758 add_dynamic_reloc if this is a dynamic reloc section.
2760 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
2763 * target-reloc.h (apply_relocation): Replace <64, false> with
2766 2011-11-25 Nick Clifton <nickc@redhat.com>
2768 * po/it.po: New Italian translation.
2770 2011-11-17 Sterling Augustine <saugustine@google.com>
2772 * script.cc (script_include_directive): Implement.
2773 (read_script_file): New local variables name and search_path. Update
2774 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2775 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2776 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2778 2011-11-11 Sterling Augustine <saugustine@google.com>
2780 * yyscript.y (section_cmd): Add support for INCLUDE directive.
2781 (file_or_sections_cmd): Likewise.
2783 2011-11-11 Doug Kwan <dougkwan@google.com>
2785 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2786 if --just-symbols is given.
2788 2011-11-10 Doug Kwan <dougkwan@google.com>
2791 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2792 when processing data relocs.
2793 * reloc.h (Relocate_functions::rel_unaligned): New method.
2794 (Relocate_functions::pcrel_unaligned): Ditto.
2795 (Relocate_functions::rel32_unaligned): Ditto.
2796 (Relocate_functions::pcrel32_unaligned): Ditto.
2798 2011-11-09 Doug Kwan <dougkwan@google.com>
2801 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2802 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2803 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2804 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2805 (Relocate_functions::rel_unaligned): New.
2806 (Relocate_functions::rel32_unaligned): New.
2807 * target-reloc.h (relocate_for_relocatable): Add code to handle
2808 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2809 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2810 arm_unaligned_reloc_r): New targets.
2811 * testsuite/Makefile.in: Regenerate.
2812 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2815 2011-11-02 Ian Lance Taylor <iant@google.com>
2817 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
2819 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2820 * options.cc (General_options::finalize): Use library search path
2821 from configure script if specified. If not native and no sysroot,
2822 only search TOOLLIBDIR.
2823 * options.h (Search_directory::Search_directory): Change name to
2825 (General_options::add_to_library_path_with_sysroot): Change arg to
2827 * configure, Makefile.in, config.in: Rebuild.
2829 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2831 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2832 we are working around the ARM1176 Erratum.
2833 * options.h (General_options::fix_arm1176): Add option.
2834 * testsuite/Makefile.am: Add testcases, and keep current ones
2836 * testsuite/Makefile.in: Regenerate.
2837 * testsuite/arm_fix_1176.s: New file.
2838 * testsuite/arm_fix_1176.sh: Likewise.
2840 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2842 * arm.cc (Target_arm::Target_arm): Remove initialisation of
2844 (Target_arm::may_use_blx): Remove method.
2845 (Target_arm::set_may_use_blx): Likewise.
2846 (Target_arm::may_use_v4t_interworking): New method.
2847 (Target_arm::may_use_v5t_interworking): Likewise.
2848 (Target_arm::may_use_blx_): Remove member variable.
2849 (Arm_relocate_functions::arm_branch_common): Check for v5T
2851 (Arm_relocate_functions::thumb_branch_common): Likewise.
2852 (Reloc_stub::stub_type_for_reloc): Likewise.
2853 (Target_arm::do_finalize_sections): Correct interworking checks.
2854 * testsuite/Makefile.am: Add new tests.
2855 * testsuite/Makefile.in: Regenerate.
2856 * testsuite/arm_farcall_arm_arm.s: New test.
2857 * testsuite/arm_farcall_arm_arm.sh: Likewise.
2858 * testsuite/arm_farcall_arm_thumb.s: Likewise.
2859 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2860 * testsuite/arm_farcall_thumb_arm.s: Likewise.
2861 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2862 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2863 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2865 2011-10-31 Cary Coutant <ccoutant@google.com>
2868 * expression.cc (Expression::eval_with_dot): Add
2869 is_section_dot_assignment parameter.
2870 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
2871 absolute and assigning to dot within a section.
2872 * script-sections.cc
2873 (Output_section_element_assignment::set_section_addresses): Pass
2874 dot_section to set_if_absolute.
2875 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2876 as is_section_dot_assignment flag to eval_with_dot.
2877 (Output_section_element_dot_assignment::set_section_addresses):
2879 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2880 parameter. Also set value if relative to dot_section; set the
2881 symbol's output_section.
2882 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2883 parameter. Adjust all callers.
2884 (Expression::eval_maybe_dot): Likewise.
2885 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2887 * testsuite/script_test_2.t: Test assignment of an absolute value
2888 to dot within an output section element.
2890 2011-10-31 Cary Coutant <ccoutant@google.com>
2892 * options.h (class General_options): Add --[no-]gnu-unique options.
2893 * symtab.cc (Symbol_table::sized_write_globals): Convert
2894 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2896 2011-10-31 Cary Coutant <ccoutant@google.com>
2899 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2900 unnecessary assertion.
2901 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2903 2011-10-31 Sriraman Tallam <tmsriram@google.com>
2905 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2907 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2909 Change to just keep the section associated with symbol.
2910 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2911 they are externally visible and --export-dynamic is turned on.
2912 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2914 2011-10-19 Ian Lance Taylor <iant@google.com>
2917 * script-sections.cc
2918 (Output_section_element_dot_assignment::needs_output_section): New
2921 2011-10-19 Ian Lance Taylor <iant@google.com>
2924 * layout.cc (Layout::segment_precedes): Don't assert failure if a
2925 --section-start option was seen.
2926 * options.h (General_options::any_section_start): New function.
2928 2011-10-18 David S. Miller <davem@davemloft.net>
2931 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2932 member to track relocation locations that have moved during TLS
2933 reloc optimizations.
2934 (Target_sparc::Relocate::Relocate): Initialize to NULL.
2935 (Target_sparc::Relocate::relocate): Adjust view down by 4
2936 bytes if it matches reloc_adjust_addr_.
2937 (Target_sparc::Relocate::relocate_tls): Always move the
2938 __tls_get_addr call delay slot instruction forward 4 bytes when
2939 performing relaxation.
2941 2011-10-18 Cary Coutant <ccoutant@google.com>
2943 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2944 (Output_file::map_no_anonymous): Check for non-zero
2945 return code from posix_fallocate.
2947 2011-10-17 Cary Coutant <ccoutant@google.com>
2950 * plugin.cc (is_visible_from_outside): Check for symbols
2951 referenced from dynamic objects.
2952 * resolve.cc (Symbol_table::resolve): Don't count references
2953 from dynamic objects as references from real ELF files.
2954 * testsuite/plugin_test_2.sh: Adjust expected result.
2956 2011-10-17 Cary Coutant <ccoutant@google.com>
2958 * gold.cc: Include timer.h.
2959 (queue_middle_tasks): Stamp time.
2960 (queue_final_tasks): Likewise.
2961 * main.cc (main): Store timer in parameters. Print timers
2963 * parameters.cc (Parameters::Parameters): Initialize timer_.
2964 (Parameters::set_timer): New function.
2965 (set_parameters_timer): New function.
2966 * parameters.h (Parameters::set_timer): New function.
2967 (Parameters::timer): New function.
2968 (Parameters::timer_): New data member.
2969 (set_parameters_timer): New function.
2970 * timer.cc (Timer::stamp): New function.
2971 (Timer::get_pass_time): New function.
2972 * timer.h (Timer::stamp): New function.
2973 (Timer::get_pass_time): New function.
2974 (Timer::pass_times_): New data member.
2976 2011-10-17 Cary Coutant <ccoutant@google.com>
2978 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2979 task for members of lib groups.
2981 2011-10-17 Cary Coutant <ccoutant@google.com>
2984 * fileread.cc (File_read::find_view): Add assert.
2985 (File_read::make_view): Move bounds check (replace with assert)...
2986 (File_read::find_or_make_view): ... to here.
2988 2011-10-12 Cary Coutant <ccoutant@google.com>
2990 * output.cc (Output_file::open_base_file): Handle case where
2991 ::read returns less than requested size.
2993 2011-10-10 Cary Coutant <ccoutant@google.com>
2995 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2996 Initialize defined_count_.
2997 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2998 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2999 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3000 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3001 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3002 * incremental.h (Sized_relobj_incr::defined_count_): New data
3004 (Sized_incr_dynobj::defined_count_): New data member.
3005 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3006 Return zeroes instead of internal error.
3008 2011-10-10 Cary Coutant <ccoutant@google.com>
3011 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3012 (Output_reloc::symbol_value): Return PLT offset if flag is set.
3013 * output.h (class Output_reloc): Add use_plt_offset flag.
3014 (Output_reloc::type_): Adjust size of bit field.
3015 (Output_reloc::use_plt_offset_): New bit field.
3016 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3017 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3018 flag. Adjust all callers.
3019 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3020 creating RELATIVE relocations.
3022 2011-10-10 Nick Clifton <nickc@redhat.com>
3024 * po/es.po: Updated Spanish translation.
3025 * po/fi.po: Updated Finnish translation.
3027 2011-10-03 Diego Novillo <dnovillo@google.com>
3029 * options.cc (parse_uint): Fix dereference of RETVAL.
3031 2011-09-29 Sriraman Tallam <tmsriram@google.com>
3033 * layout.h (section_order_map_): New member.
3034 (get_section_order_map): New member function.
3035 * output.cc (Output_section::add_input_section): Check for patterns
3036 only when --section-ordering-file is specified.
3037 * gold.cc (queue_middle_tasks): Delay updating order of sections till
3038 output_sections have been formed.
3039 * layout.cc (Layout_Layout): Initialize section_order_map_.
3040 * plugin.cc (update_section_order): Store order in order_map. Do not
3042 * testsuite/Makefile.am: Add test case for plugin_final_layout.
3043 * testsuite/Makefile.in: Regenerate.
3044 * testsuite/plugin_section_order.c: New file.
3045 * testsuite/plugin_final_layout.cc: New file.
3046 * testsuite/plugin_final_layout.sh: New file.
3048 2011-09-29 Cary Coutant <ccoutant@google.com>
3050 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3052 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3053 symbols during incremental update.
3054 (Symbol_table::add_from_dynobj): Likewise.
3056 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3057 Ian Lance Taylor <iant@google.com>
3059 * symtab.cc (Symbol_table::define_special_symbol): Always
3060 canonicalize version string.
3062 2011-09-26 Cary Coutant <ccoutant@google.com>
3064 * gold.cc (queue_initial_tasks): Move option checks ...
3065 * options.cc (General_options::finalize): ... to here. Disable
3066 some options; make others fatal.
3068 2011-09-26 Cary Coutant <ccoutant@google.com>
3071 * plugin.cc (get_symbols_v2): New function.
3072 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3073 (is_referenced_from_outside): New function.
3074 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3075 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3076 (get_symbols): Pass version parameter.
3077 (get_symbols_v2): New function.
3078 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3080 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3081 (onload): Add LDPT_GET_SYMBOLS_V2.
3082 (all_symbols_read_hook): Use get_symbols_v2; check for
3083 LDPR_PREVAILING_DEF_IRONLY_EXP.
3084 * testsuite/plugin_test_3.sh: Update expected results.
3086 2011-09-23 Simon Baldwin <simonb@google.com>
3088 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3089 configuration options.
3090 * configure: Regenerate.
3091 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3092 * Makefile.in: Regenerate.
3093 * testsuite/Makefile.in: Regenerate.
3095 2011-09-19 Sriraman Tallam <tmsriram@google.com>
3097 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3099 2011-09-19 Cary Coutant <ccoutant@google.com>
3101 * incremental.cc (can_incremental_update): Fix typo in comment.
3102 * incremental.h (can_incremental_update): Likewise.
3104 2011-09-18 Cary Coutant <ccoutant@google.com>
3106 * incremental.cc (can_incremental_update): New function.
3107 * incremental.h (can_incremental_update): New function.
3108 * layout.cc (Layout::init_fixed_output_section): Call it.
3109 (Layout::make_output_section): Don't allow patch space in .eh_frame.
3110 * object.cc (Sized_relobj_file::do_layout): Call
3111 can_incremental_update.
3113 2011-09-13 Cary Coutant <ccoutant@google.com>
3115 * configure.ac: Check for glibc support for gnu_indirect_function
3116 support with static linking, setting automake conditional
3118 * Makefile.in: Regenerate.
3119 * configure: Regenerate.
3121 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3122 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3124 * testsuite/Makefile.in: Regenerate.
3126 2011-09-13 Cary Coutant <ccoutant@google.com>
3128 * incremental.cc (Sized_relobj_incr::do_layout): Call
3129 report_comdat_group for kept comdat sections.
3130 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3131 * testsuite/Makefile.in: Regenerate.
3132 * testsuite/incr_comdat_test_1.cc: New source file.
3133 * testsuite/incr_comdat_test_2_v1.cc: New source file.
3134 * testsuite/incr_comdat_test_2_v2.cc: New source file.
3135 * testsuite/incr_comdat_test_2_v3.cc: New source file.
3137 2011-09-13 Ian Lance Taylor <iant@google.com>
3139 * object.cc (Sized_relobj_file::do_layout): Remove unused local
3140 variable external_symbols_offset.
3142 2011-09-12 Ian Lance Taylor <iant@google.com>
3144 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3145 triggered if object has no symbols.
3147 2011-09-09 David S. Miller <davem@davemloft.net>
3149 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3150 (Output_fill_debug_line::do_write): Likewise.
3152 2011-08-29 Cary Coutant <ccoutant@google.com>
3154 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3155 casts to match formatting specs.
3156 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3158 2011-08-26 Cary Coutant <ccoutant@google.com>
3160 * layout.cc (Free_list::allocate): Provide guarantee of minimum
3161 remaining hole size when allocating.
3162 (Layout::make_output_section): Set fill methods for debug sections.
3163 * layout.h (Free_list::Free_list_node): Move from private to
3165 (Free_list::set_min_hole_size): New function.
3166 (Free_list::begin, Free_list::end): New functions.
3167 (Free_list::min_hole_): New data member.
3168 * output.cc: Include dwarf.h.
3169 (Output_fill_debug_info::do_minimum_hole_size): New function.
3170 (Output_fill_debug_info::do_write): New function.
3171 (Output_fill_debug_line::do_minimum_hole_size): New function.
3172 (Output_fill_debug_line::do_write): New function.
3173 (Output_section::Output_section): Initialize new data member.
3174 (Output_section::set_final_data_size): Ensure patch space is larger
3175 than minimum hole size.
3176 (Output_section::do_write): Fill holes in debug sections.
3177 * output.h (Output_fill): New class.
3178 (Output_fill_debug_info): New class.
3179 (Output_fill_debug_line): New class.
3180 (Output_section::set_free_space_fill): New function.
3181 (Output_section::free_space_fill_): New data member.
3182 * testsuite/Makefile.am (incremental_test_3): Add
3183 --incremental-patch option.
3184 (incremental_test_4): Likewise.
3185 (incremental_test_5): Likewise.
3186 (incremental_test_6): Likewise.
3187 (incremental_copy_test): Likewise.
3188 (incremental_common_test_1): Likewise.
3189 * testsuite/Makefile.in: Regenerate.
3191 2011-08-26 Nick Clifton <nickc@redhat.com>
3193 * po/es.po: Updated Spanish translation.
3195 2011-08-01 Cary Coutant <ccoutant@google.com>
3197 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3198 * gold/testsuite/Makefile.in: Regenerate.
3199 * gold/testsuite/justsyms_exec.c: New source file.
3200 * gold/testsuite/justsyms_lib.c: New source file.
3202 2011-08-01 Cary Coutant <ccoutant@google.com>
3204 * layout.cc (Layout::set_segment_offsets): Don't realign text
3205 segment if -Ttext was specified.
3206 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3208 * object.h (Sized_relobj_file::e_type): New function.
3209 (Sized_relobj_file::e_type_): New data member.
3210 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3211 base address for ET_EXEC files.
3212 * target.cc (Target::do_make_elf_object_implementation): Allow
3213 ET_EXEC files with --just-symbols option.
3215 2011-07-28 Cary Coutant <ccoutant@google.com>
3217 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3218 Add thread_number parameter.
3219 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3220 * workqueue-threads.cc
3221 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3222 current thread if its thread number is greater than desired thread
3224 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3225 Add thread_number parameter.
3226 (Workqueue::should_cancel_thread): Likewise.
3227 (Workqueue::find_runnable_or_wait): Pass thread_number to
3228 should_cancel_thread.
3229 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3232 2011-07-22 Sriraman Tallam <tmsriram@google.com>
3234 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3235 only after checking if it cannot be forced local.
3236 * symtab.h (is_externally_visible): Check if the symbol is not forced
3239 2011-07-15 Ian Lance Taylor <iant@google.com>
3241 * options.h (class General_options): Add --print-output-format.
3242 Move -EL next to -EB, for better --help output.
3243 * target-select.cc: Include <cstdio>, "options.h", and
3245 (Target_selector::do_target_bfd_name): New function.
3246 (print_output_format): New function.
3247 * target-select.h (class Target_selector): Update declarations.
3248 (Target_selector::target_bfd_name): New function.
3249 (print_output_format): Declare.
3250 * main.cc: Include "target-select.h".
3251 (main): Handle --print-output-format.
3252 * gold.cc: Include "target-select.h".
3253 (queue_initial_tasks): Handle --print-output-format when there are
3255 * parameters.cc (parameters_force_valid_target): Give a better
3256 error message if -EB/-EL does not match target.
3257 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3260 2011-07-15 Ian Lance Taylor <iant@google.com>
3262 * i386.cc (class Output_data_plt_i386): Add layout_ field.
3263 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3264 (Output_data_plt_i386::do_write): Write address of .dynamic
3265 section to first entry in .got.plt section.
3266 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3267 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3269 (Output_data_plt_x86_64::do_write): Write address of .dynamic
3270 section to first entry in .got.plt section.
3271 * layout.h (Layout::dynamic_section): New function.
3273 2011-07-13 Sriraman Tallam <tmsriram@google.com>
3275 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3277 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3278 input_section_position_, and input_section_glob_.
3279 (read_layout_from_file): Call function section_ordering_specified.
3280 * layout.h (is_section_ordering_specified): New function.
3281 (section_ordering_specified): New function.
3282 (section_ordering_specified_): New boolean member.
3283 * main.cc(main): Call load_plugins after layout object is defined.
3284 * output.cc (Output_section::add_input_section): Use
3285 function section_ordering_specified to check if section ordering is
3287 * output.cc (Output_section::add_relaxed_input_section): Use
3288 function section_ordering_specified to check if section ordering is
3290 (Output_section::update_section_layout): New function.
3291 (Output_section::sort_attached_input_sections): Check if input section
3293 * output.h (Output_section::update_section_layout): New function.
3294 * plugin.cc (get_section_count): New function.
3295 (get_section_type): New function.
3296 (get_section_name): New function.
3297 (get_section_contents): New function.
3298 (update_section_order): New function.
3299 (allow_section_ordering): New function.
3300 (Plugin::load): Add the new interfaces to the transfer vector.
3301 (Plugin_manager::load_plugins): New parameter.
3302 (Plugin_manager::all_symbols_read): New parameter.
3303 (Plugin_manager::claim_file): New parameter. Save the elf object for
3305 (Plugin_manager::get_elf_object): New function.
3306 (Plugin_manager::get_view): Change to directly use the bool to check
3307 if get_view is called from claim_file_hook.
3308 * plugin.h (input_objects): New function
3309 (Plugin__manager::load_plugins): New parameter.
3310 (Plugin_manager::claim_file): New parameter.
3311 (Plugin_manager::get_elf_object): New function.
3312 (Plugin_manager::in_claim_file_handler): New function.
3313 (Plugin_manager::in_claim_file_handler_): New member.
3314 (layout): New function.
3315 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3316 handler with an extra parameter. Make the elf object before calling
3318 * testsuite/plugin_test.c (get_section_count): New function pointer.
3319 (get_section_type): New function pointer.
3320 (get_section_name): New function pointer.
3321 (get_section_contents): New function pointer.
3322 (update_section_order): New function pointer.
3323 (allow_section_ordering): New function pointer.
3324 (onload): Check if the new interfaces exist.
3326 2011-07-13 Ian Lance Taylor <iant@google.com>
3328 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3330 * x86_64.cc (Target_x86_64::got_section): Likewise.
3331 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3332 (relro_now_test_SOURCES): New variable.
3333 (relro_now_test_DEPENDENCIES): New variable.
3334 (relro_now_test_LDFLAGS): New variable.
3335 (relro_now_test_LDADD): New variable.
3336 (relro_now_test.so): New target.
3337 * testsuite/Makefile.in: Rebuild.
3339 2011-07-12 Ian Lance Taylor <iant@google.com>
3342 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3343 GLOB_DAT relocation rather than a RELATIVE relocation for a
3344 protected symbol when creating a shared library.
3345 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3346 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3347 * testsuite/protected_main_1.cc (main): Test that protected
3348 function has same address.
3350 2011-07-11 Ian Lance Taylor <iant@google.com>
3353 * options.h (class General_options): Add -Bgroup.
3354 * options.cc (General_options::finalize): If -Bgroup is set,
3355 default to --unresolved-symbols=report-all.
3356 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3357 * target-reloc.h (issue_undefined_symbol_error): Handle
3358 --unresolved-symbols=report-all.
3360 2011-07-08 Ian Lance Taylor <iant@google.com>
3363 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3364 if linker script discards key sections.
3365 (Layout::create_dynamic_symtab): Likewise.
3366 (Layout::assign_local_dynsym_offsets): Likewise.
3367 (Layout::sized_create_version_sections): Likewise.
3368 (Layout::create_interp): Likewise.
3369 (Layout::finish_dynamic_section): Likewise.
3370 (Layout::set_dynamic_symbol_size): Likewise.
3372 2011-07-08 Ian Lance Taylor <iant@google.com>
3375 * options.h (class General_options): Add --unresolved-symbols.
3376 * target-reloc.h (issue_undefined_symbol_error): Check
3377 --unresolved-symbols. Add comments.
3379 2011-07-08 Ian Lance Taylor <iant@google.com>
3381 * testsuite/odr_violation2.cc (Ordering::operator()): Make
3382 expression more complex.
3384 2011-07-08 Ian Lance Taylor <iant@google.com>
3387 * target-reloc.h (issue_undefined_symbol_error): New inline
3388 function, broken out of relocate_section.
3389 (relocate_section): Call issue_undefined_symbol_error.
3390 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3391 there is no TLS segment if we are about to issue an undefined
3393 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3395 2011-07-08 Ian Lance Taylor <iant@google.com>
3398 * resolve.cc (Symbol_table::should_override): Add fromtype
3399 parameter. Change all callers. Give error when linking together
3400 TLS and non-TLS symbol.
3401 (Symbol_table::should_override_with_special): Add fromtype
3402 parameter. Change all callers.
3403 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3404 there is no TLS segment if we have reported some errors.
3405 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3407 2011-07-08 Ian Lance Taylor <iant@google.com>
3410 * target.h (Target::plt_address_for_global): New function.
3411 (Target::plt_address_for_local): New function.
3412 (Target::plt_section_for_global): Remove.
3413 (Target::plt_section_for_local): Remove.
3414 (Target::do_plt_address_for_global): New virtual function.
3415 (Target::do_plt_address_for_local): New virtual function.
3416 (Target::do_plt_section_for_global): Remove.
3417 (Target::do_plt_section_for_local): Remove.
3418 (Target::register_global_plt_entry): Add Symbol_table and Layout
3420 * output.cc (Output_data_got::Got_entry::write): Use
3421 plt_address_for_global and plt_address_for_local.
3422 * layout.cc (Layout::add_target_dynamic_tags): Use size and
3423 address of output section.
3424 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3425 got_irelative_, and irelative_count_ fields. Update
3427 (Output_data_plt_i386::has_irelative_section): New function.
3428 (Output_data_plt_i386::entry_count): Add irelative_count_.
3429 (Output_data_plt_i386::set_final_data_size): Likewise.
3430 (class Target_i386): Add got_irelative_ and rel_irelative_
3431 fields. Update declarations.
3432 (Target_i386::Target_i386): Initialize new fields.
3433 (Target_i386::do_plt_address_for_global): New function replacing
3434 do_plt_section_for_global.
3435 (Target_i386::do_plt_address_for_local): New function replacing
3436 do_plt_section_for_local.
3437 (Target_i386::got_section): Create got_irelative_.
3438 (Target_i386::rel_irelative_section): New function.
3439 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3440 fields. Don't define __rel_iplt_{start,end}.
3441 (Output_data_plt_i386::add_entry): Add symtab and layout
3442 parameters. Change all callers. Use different PLT and GOT for
3444 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3445 layout parameters. Change all callers. Use different PLT and
3447 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3448 (Output_data_plt_i386::rel_irelative): New function.
3449 (Output_data_plt_i386::address_for_global): New function.
3450 (Output_data_plt_i386::address_for_local): New function.
3451 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
3452 IRELATIVE GOT when changing IFUNC GOT entries.
3453 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3455 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3456 if we didn't create an IRELATIVE GOT.
3457 (Target_i386::Relocate::relocate): Use plt_address_for_global and
3458 plt_address_for_local.
3459 (Target_i386::do_dynsym_value): Use plt_address_for_global.
3460 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3461 got_irelative_, and irelative_count_ fields. Update
3463 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3464 Initialize new fields. Remove symtab parameter. Change all
3466 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3468 (Output_data_plt_x86_64::has_irelative_section): New function.
3469 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3470 (class Target_x86_64): Add got_irelative_ and rel_irelative_
3471 fields. Update declarations.
3472 (Target_x86_64::Target_x86_64): Initialize new fields.
3473 (Target_x86_64::do_plt_address_for_global): New function replacing
3474 do_plt_section_for_global.
3475 (Target_x86_64::do_plt_address_for_local): New function replacing
3476 do_plt_section_for_local.
3477 (Target_x86_64::got_section): Create got_irelative_.
3478 (Target_x86_64::rela_irelative_section): New function.
3479 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
3480 all callers. Don't create __rel_iplt_{start,end}.
3481 (Output_data_plt_x86_64::add_entry): Add symtab and layout
3482 parameters. Change all callers. Use different PLT and GOT for
3484 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3485 layout parameters. Change all callers. Use different PLT and
3487 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3488 parameters. Change all callers. Use different PLT and GOT for
3490 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3491 (Output_data_plt_x86_64::rela_irelative): New function.
3492 (Output_data_plt_x86_64::address_for_global): New function.
3493 (Output_data_plt_x86_64::address_for_local): New function.
3494 (Output_data_plt_x86_64::set_final_data_size): Likewise.
3495 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3496 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3497 (Target_x86_64::register_global_plt_entry): Add symtab and layout
3499 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3501 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3502 symbols if we didn't create an IRELATIVE GOT.
3503 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3504 plt_address_for_local.
3505 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3506 * testsuite/ifuncvar1.c: New test file.
3507 * testsuite/ifuncvar2.c: New test file.
3508 * testsuite/ifuncvar3.c: New test file.
3509 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3510 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3511 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3512 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3513 * testsuite/Makefile.in: Rebuild.
3515 2011-07-07 Cary Coutant <ccoutant@google.com>
3517 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3518 (two_file_test_1_ndebug.o): Likewise.
3519 (two_file_test_1b_ndebug.o): Likewise.
3520 (two_file_test_2_ndebug.o): Likewise.
3521 (two_file_test_main_ndebug.o): Likewise.
3522 (incremental_test_2): Link with no-debug versions.
3524 2011-07-06 Cary Coutant <ccoutant@google.com>
3526 * gold/incremental.cc
3527 (Output_section_incremental_inputs::write_info_blocks): Check for
3528 hidden and internal symbols.
3530 2011-07-06 Cary Coutant <ccoutant@google.com>
3532 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3533 Check disposition for startup file.
3534 (Incremental_inputs::report_command_line): Ignore
3535 --incremental-startup-unchanged option.
3536 * options.cc (General_options::parse_incremental_startup_unchanged):
3538 (General_options::General_options): Initialize new data member.
3539 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3540 (General_options): Add --incremental-startup-unchanged option.
3541 (General_options::incremental_startup_disposition): New function.
3542 (General_options::incremental_startup_disposition_): New data member.
3544 2011-07-06 Cary Coutant <ccoutant@google.com>
3546 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3547 input file index to Script_info ctor.
3548 (Sized_incremental_binary::do_file_has_changed): Find the
3549 command-line argument for files named in scripts.
3550 * incremental.h (Script_info::Script_info): New ctor
3551 with input file index.
3552 (Script_info::input_file_index): New function.
3553 (Script_info::input_file_index_): New data member.
3554 (Incremental_binary::get_library): Add const.
3555 (Incremental_binary::get_script_info): Add const.
3556 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3557 * testsuite/Makefile.am (incremental_test_5): New test case.
3558 (incremental_test_6): New test case.
3559 * testsuite/Makefile.in: Regenerate.
3561 2011-07-06 Cary Coutant <ccoutant@google.com>
3563 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3564 debug output when command lines differ.
3566 2011-07-06 Cary Coutant <ccoutant@google.com>
3568 * incremental.cc (Incremental_inputs::report_command_line): Ignore
3569 --incremental-patch option.
3570 * layout.cc (Free_list::allocate): Extend allocation beyond original
3572 (Layout::make_output_section): Mark sections that should get
3574 * options.cc (parse_percent): New function.
3575 * options.h (parse_percent): New function.
3576 (DEFINE_percent): New macro.
3577 (General_options): Add --incremental-patch option.
3578 * output.cc (Output_section::Output_section): Initialize new data
3580 (Output_section::add_input_section): Print section name when out
3582 (Output_section::add_output_section_data): Likewise.
3583 (Output_section::set_final_data_size): Add patch space when
3584 doing --incremental-full.
3585 (Output_section::do_reset_address_and_file_offset): Remove patch
3587 (Output_segment::set_section_list_addresses): Print debug output
3588 only if --incremental-update.
3589 * output.h (Output_section::set_is_patch_space_allowed): New function.
3590 (Output_section::is_patch_space_allowed_): New data member.
3591 (Output_section::patch_space_): New data member.
3592 * parameters.cc (Parameters::incremental_full): New function.
3593 * parameters.h (Parameters::incremental_full): New function
3594 * testsuite/Makefile.am (incremental_test_2): Add test for
3595 --incremental-patch option.
3596 * testsuite/Makefile.in: Regenerate.
3597 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3598 (t18): Remove function body.
3600 2011-07-05 Doug Kwan <dougkwan@google.com>
3603 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3604 Arm_Address type for relocation result.
3605 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
3607 (Arm_relocate_functions::abs32): Use unaligned access.
3608 (Arm_relocate_functions::rel32): Ditto.
3609 (Arm_relocate_functions::prel31): Ditto.
3610 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3611 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3612 static data relocations.
3613 * testsuite/Makefile.in: Regnerate.
3614 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3616 2011-07-05 Ian Lance Taylor <iant@google.com>
3619 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3620 symbols if necessary.
3621 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3623 2011-07-05 Ian Lance Taylor <iant@google.com>
3626 * resolve.cc (Symbol::override_base_with_special): Simply override
3627 version with special symbol version, ignoring previous version.
3629 2011-07-05 Ian Lance Taylor <iant@google.com>
3631 * object.cc (Sized_relobj_file::include_section_group): Add
3632 information to comment about signature location.
3634 2011-07-02 Ian Lance Taylor <iant@google.com>
3637 * options.h (class General_options): Add -f and -F.
3638 * options.cc (General_options::finalize): Fatal error if -f/-F
3639 are used without -shared.
3640 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3642 2011-07-02 Ian Lance Taylor <iant@google.com>
3644 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3646 2011-07-01 Ian Lance Taylor <iant@google.com>
3650 * resolve.cc (Symbol::override_base_with_special): Don't override
3651 the version if the overriding symbol has a different name.
3652 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
3653 all callers. If we give an error about an undefined version,
3654 define the base version if necessary.
3655 * dynobj.h (class Versions): Update declaration.
3656 * testsuite/weak_alias_test_5.cc: New file.
3657 * testsuite/weak_alias_test.script: New file.
3658 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3659 and versioned_alias have the right value, and call t2.
3660 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3661 weak_alias_test_5.so.
3662 (weak_alias_test_LDADD): Likewise.
3663 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3664 * testsuite/Makefile.in: Rebuild.
3666 2011-07-01 Ian Lance Taylor <iant@google.com>
3669 * options.h (class General_options): Support -z notext.
3670 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3672 (two_file_shared_nonpic.so): Likewise.
3673 (two_file_shared_mixed.so): Likewise.
3674 (two_file_shared_mixed_1.so): Likewise.
3675 (weak_undef_lib_nonpic.so): Likewise.
3676 (alt/weak_undef_lib_nonpic.so): Likewise.
3677 (tls_test_shared_nonpic.so): Likewise.
3678 * testsuite/Makefile.in: Rebuild.
3680 2011-07-01 Ian Lance Taylor <iant@google.com>
3683 * configure.ac: Test whether static linking works, setting
3684 the automake conditional HAVE_STATIC.
3685 * testsuite/Makefile.am: Disable tests using -static if
3686 HAVE_STATIC is not true.
3687 * configure, testsuite/Makefile.in: Rebuild.
3689 2011-07-01 Ian Lance Taylor <iant@google.com>
3692 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3693 Assert if we see DW_EH_PE_indirect.
3694 * target.h (Target::ehframe_datarel_base): New function.
3695 (Target::do_ehframe_datarel_base): New target function.
3696 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3697 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3700 2011-07-01 Ian Lance Taylor <iant@google.com>
3703 * options.h (class General_options): Add
3704 --ld-generated-unwind-info.
3705 * ehframe.cc (Fde::write): Add address parameter. Change all
3706 callers. If associated with PLT, fill in address and size.
3707 (Cie::set_output_offset): Only add merge mapping if there is an
3709 (Cie::write): Add address parameter. Change all callers.
3710 (Eh_frame::add_ehframe_for_plt): New function.
3711 * ehframe.h (class Fde): Update declarations. Move shndx_ and
3712 input_offset_ fields into union u_, with new plt field.
3713 (Fde::Fde): Adjust for new union field.
3714 (Fde::Fde) [Output_data version]: New constructor.
3715 (Fde::add_mapping): Only add merge mapping if there is an object.
3716 (class Cie): Update declarations.
3717 (class Eh_frame): Declare add_ehframe_for_plt.
3718 * layout.cc (Layout::layout_eh_frame): Break out code into
3719 make_eh_frame_section, and call it.
3720 (Layout::make_eh_frame_section): New function.
3721 (Layout::add_eh_frame_for_plt): New function.
3722 * layout.h (class Layout): Update declarations.
3723 * merge.cc (Merge_map::add_mapping): Add assertion.
3724 * i386.cc: Include "dwarf.h".
3725 (class Output_data_plt_i386): Make first_plt_entry,
3726 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
3727 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3728 and plt_eh_frame_fde.
3729 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3730 boundary. Call add_eh_frame_for_plt if appropriate.
3731 * x86_64.cc: Include "dwarf.h".
3732 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
3733 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
3734 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3735 and plt_eh_frame_fde.
3736 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3739 2011-06-29 Ian Lance Taylor <iant@google.com>
3742 * object.cc (Sized_relobj_file::layout_section): Change shdr
3743 parameter to be const.
3744 (Sized_relobj_file::layout_eh_frame_section): New function, broken
3746 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3747 appropriate. Call layout_eh_frame_section.
3748 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3750 * object.h (class Sized_relobj_file): Update declarations.
3752 2011-06-29 Ian Lance Taylor <iant@google.com>
3755 * script.cc (Token::integer_value): Accept trailing M/m/K/k
3757 (Lex::gather_token): Accept trailing M/m/K/k for integers.
3759 2011-06-29 Ian Lance Taylor <iant@google.com>
3762 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3764 * layout.cc (Layout::layout_eh_frame): Likewise.
3766 2011-06-29 Ian Lance Taylor <iant@google.com>
3769 * layout.cc (Layout::symtab_section_shndx): New function.
3770 * layout.h (class Layout): Declare symtab_section_shndx.
3771 * output.cc (Output_section::write_header): Call it.
3773 2011-06-29 Ian Lance Taylor <iant@google.com>
3776 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3777 symbols which are not used in a relocation.
3779 2011-06-28 Ian Lance Taylor <iant@google.com>
3782 * layout.cc (Layout::segment_precedes): Don't crash if a linker
3783 script create indistinguishable segments.
3784 (Layout::set_segment_offsets): Use stable_sort when sorting
3785 segments. Pass this to Compare_segments constructor.
3786 * layout.h (class Layout): Make segment_precedes non-static.
3787 (class Compare_segments): Change from struct to class. Add
3788 layout_ field. Add constructor.
3789 * script-sections.cc
3790 (Script_sections::attach_sections_using_phdrs_clause): Rename
3791 local orphan to is_orphan. Don't report failure to put empty
3792 section in segment. On attachment failure, report name of
3793 section, and attach to first PT_LOAD segment.
3795 2011-06-28 Ian Lance Taylor <iant@google.com>
3798 * target-select.cc (Target_selector::Target_selector): Add
3799 emulation parameter. Change all callers.
3800 (select_target_by_bfd_name): Rename from select_target_by_name.
3802 (select_target_by_emulation): New function.
3803 (supported_emulation_names): New function.
3804 * target-select.h (class Target_selector): Add emulation_ field.
3805 Update declarations.
3806 (Target_selector::recognize_by_bfd_name): Rename from
3807 recognize_by_name. Change all callers.
3808 (Target_selector::supported_bfd_names): Rename from
3809 supported_names. Change all callers.
3810 (Target_selector::recognize_by_emulation): New function.
3811 (Target_selector::supported_emulations): New function.
3812 (Target_selector::emulation): New function.
3813 (Target_selector::do_recognize_by_bfd_name): Rename from
3814 do_recognize_by_name. Change all callers.
3815 (Target_selector::do_supported_bfd_names): Rename from
3816 do_supported_names. Change all callers.
3817 (Target_selector::do_recognize_by_emulation): New function.
3818 (Target_selector::do_supported_emulations): New function.
3819 (select_target_by_bfd_name): Change name in declaration.
3820 (select_target_by_emulation): Declare.
3821 (supported_emulation_names): Declare.
3822 * parameters.cc (parameters_force_valid_target): Try to find
3823 target based on emulation from -m option.
3824 * options.h (class General_options): Change doc string for -m.
3825 * options.cc (help): Print emulations.
3826 (General_options::parse_V): Likewise.
3827 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3828 Add emulation parameter. Change all callers.
3830 2011-06-28 Ian Lance Taylor <iant@google.com>
3832 * target.h (class Target): Add osabi_ field.
3833 (Target::osabi): New function.
3834 (Target::set_osabi): New function.
3835 (Target::Target): Initialize osabi_.
3836 (Target::do_adjust_elf_header): Make pure virtual.
3837 (Sized_target::do_adjust_elf_header): Declare.
3838 * target.cc (Sized_target::do_adjust_elf_header): New function.
3839 (class Sized_target): Instantiate all versions.
3840 * freebsd.h (class Target_freebsd): Remove.
3841 (Target_selector_freebsd::do_recognize): Call set_osabi on
3843 (Target_selector_freebsd::do_recognize_by_name): Likewise.
3844 (Target_selector_freebsd::set_osabi): Remove.
3845 * i386.cc (class Target_i386): Inherit from Sized_target rather
3846 than Target_freebsd.
3847 * x86_64.cc (class Target_x86_64): Likewise.
3849 2011-06-28 Ian Lance Taylor <iant@google.com>
3851 * target.h (Target::can_check_for_function_pointers): Rewrite.
3853 (Target::can_icf_inline_merge_sections): Likewise.
3854 (Target::section_may_have_icf_unsafe_poineters): Likewise.
3855 (Target::Target_info): Add can_icf_inline_merge_sections field.
3856 (Target::do_can_check_for_function_pointers): New virtual
3858 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3859 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3860 from can_check_for_function_pointers, move in file.
3861 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3862 section_may_have_icf_unsafe_poineters, move in file.
3863 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3864 * i386.cc (Target_i386::do_can_check_for_function_pointers):
3865 Rename from can_check_for_function_pointers, move in file.
3866 (Target_i386::can_icf_inline_merge_sections): Remove.
3867 (Target_i386::i386_info): Initialize
3868 can_icf_inline_merge_sections.
3869 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3870 Initialize can_icf_inline_merge_sections.
3871 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3872 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3873 Rename from can_check_for_function_pointers, move in file.
3874 (Target_x86_64::can_icf_inline_merge_sections): Remove.
3875 (Target_x86_64::x86_64_info): Initialize
3876 can_icf_inline_merge_sections.
3877 * testsuite/testfile.cc (Target_test::test_target_info):
3879 * icf.cc (get_section_contents): Correct formatting.
3881 2011-06-27 Ian Lance Taylor <iant@google.com>
3883 * symtab.cc (Symbol::versioned_name): New function.
3884 (Symbol_table::add_to_final_symtab): Use versioned_name when
3886 (Symbol_table::sized_write_symbol): Likewise.
3887 * symtab.h (class Symbol): Declare versioned_name.
3888 * stringpool.h (class Stringpool_template): Add variant of add
3889 which takes a std::basic_string.
3890 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3891 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3892 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3893 (ver_test_12.o): New target.
3894 * testsuite/Makefile.in: Rebuild.
3896 2011-06-27 Doug Kwan <dougkwan@google.com>
3898 * arm.cc (Arm_relocate_functions::thm_jump8,
3899 Arm_relocate_functions::thm_jump11): Use a wider signed
3900 type to compute offset.
3901 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3903 * testsuite/Makefile.in: Regenerate.
3904 * testsuite/arm_branch_in_range.sh: Check test results of
3905 arm_thm_jump11 and arm_thm_jump8.
3906 * testsuite/arm_thm_jump11.s: New test source file.
3907 * testsuite/arm_thm_jump11.t: New linker script.
3908 * testsuite/arm_thm_jump8.s: New test source file.
3909 * testsuite/arm_thm_jump8.t: New linker script.
3911 2011-06-24 Ian Lance Taylor <iant@google.com>
3913 * layout.cc: Include "object.h".
3914 (ctors_sections_in_init_array): New static variable.
3915 (Layout::is_ctors_in_init_array): New function.
3916 (Layout::layout): Add entry to ctors_sections_in_init_array if
3918 * layout.h (class Layout): Declare is_ctors_in_init_array.
3919 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3920 is_ctors_reverse_view is set.
3921 (Sized_relobj_file::write_sections): Add layout parameter. Change
3922 all callers. Set is_ctors_reverse_view field of View_size.
3923 (Sized_relobj_file::reverse_words): New function.
3924 * object.h (Sized_relobj_file::View_size): Add
3925 is_ctors_reverse_view field.
3926 (class Sized_relobj_file): Update declarations.
3927 * testsuite/initpri3.c: New test.
3928 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3930 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3931 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3932 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3933 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3934 * testsuite/Makefile.in: Rebuild.
3936 2011-06-24 Cary Coutant <ccoutant@google.com>
3938 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3939 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3940 (debug_msg_cdebug.err): New targets.
3941 * testsuite/Makefile.in: Regenerate.
3942 * testsuite/debug_msg.sh: Check output of link with compressed debug.
3943 Fix checks for link with shared library.
3945 2011-06-24 Doug Kwan <dougkwan@google.com>
3947 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3948 skip empty text sections.
3949 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3951 2011-06-22 Ian Lance Taylor <iant@google.com>
3954 * options.h (class General_options): Add --ctors-in-init-array.
3955 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3956 friends as SHT_PROGBITS for merging sections.
3957 (Layout::layout): Remove special handling of .init_array and
3958 friends. Don't sort if doing relocatable link. Sort for .ctors
3959 and .dtors if ctors_in_init_array.
3960 (Layout::make_output_section): Force correct section types for
3961 .init_array and friends. Don't sort if doing relocatable link,
3962 Don't sort .ctors and .dtors if ctors_in_init_array.
3963 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3964 (Layout::output_section_name): Add relobj parameter. Change all
3965 callers. Handle .ctors. and .dtors. in code rather than table.
3966 Handle .ctors and .dtors if ctors_in_init_array.
3967 (Layout::match_file_name): New function, moved from output.cc.
3968 * layout.h (class Layout): Update declarations.
3969 * output.cc: Include "layout.h".
3970 (Input_section_sort_entry::get_priority): New function.
3971 (Input_section_sort_entry::match_file_name): Just call
3972 Layout::match_file_name.
3973 (Output_section::Input_section_sort_init_fini_compare::operator()):
3974 Handle .ctors and .dtors. Sort by explicit priority rather than
3976 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3977 * testsuite/initpri2.c: New test.
3978 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3979 (check_PROGRAMS): Add initpri2.
3980 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3981 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3982 * configure, testsuite/Makefile.in: Rebuild.
3984 2011-06-19 Ian Lance Taylor <iant@google.com>
3987 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3988 .interp section to a PT_INTERP segment even if we have seen a
3989 --dynamic-linker option. Don't do it if we have seen a PHDRS
3990 clause in a linker script.
3991 (Layout::finalize): Don't create a .interp section if we've
3992 already create a PT_INTERP segment.
3993 (Layout::create_interp): Always call choose_output_section (revert
3994 patch of 2011-06-17). Don't create PT_INTERP segment.
3995 * script-sections.cc
3996 (Script_sections::create_note_and_tls_segments): Add a .interp
3997 section to a PT_INTERP segment even if we have seen a
3998 --dynamic-linker option.
4000 2011-06-18 Ian Lance Taylor <iant@google.com>
4002 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4003 merely because a non-PT_LOAD segment has a dynamic reloc.
4005 2011-06-18 Ian Lance Taylor <iant@google.com>
4007 * layout.cc (Layout::finish_dynamic_section): Don't create
4008 DT_FLAGS entry if not needed.
4010 2011-06-18 Ian Lance Taylor <iant@google.com>
4013 * layout.cc (Layout::layout_eh_frame): Correct handling of
4014 writable .eh_frame section.
4016 2011-06-17 Ian Lance Taylor <iant@google.com>
4019 * resolve.cc (Symbol_table::resolve): Don't give an error if a
4020 symbol is redefined with the exact same object and value.
4022 2011-06-17 Ian Lance Taylor <iant@google.com>
4025 * layout.h (class Layout): Add interp_segment_ field.
4026 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4027 (Layout::attach_allocated_section_to_segment): If making shared
4028 library, put .interp section in PT_INTERP segment.
4029 (Layout::finalize): Also call create_interp if -dynamic-linker
4031 (Layout::create_interp): Assert that there is no PT_INTERP
4032 segment. If not using a SECTIONS clause, use make_output_section.
4033 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4034 * script-sections.cc
4035 (Script_sections::create_note_and_tls_segments): If making shared
4036 library, put .interp section in PT_INTERP segment.
4038 2011-06-17 Ian Lance Taylor <iant@google.com>
4040 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4041 when making a shared library.
4043 2011-06-17 Ian Lance Taylor <iant@google.com>
4045 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4046 parameter. Change all callers. Don't issue warning about PC32
4047 against locally defined symbol.
4049 2011-06-16 Ian Lance Taylor <iant@google.com>
4051 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4052 occurs in same object.
4054 2011-06-14 Alan Modra <amodra@gmail.com>
4056 * po/POTFILES.in: Regenerate.
4058 2011-06-09 Ian Lance Taylor <iant@google.com>
4060 * script-sections.cc
4061 (Orphan_output_section::set_section_addresses): For a relocatable
4062 link set address to 0.
4064 2011-06-09 Cary Coutant <ccoutant@google.com>
4067 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4068 used with --compress-debug-sections.
4069 * gold/object.cc (Sized_relobj_file::do_layout): Report
4070 uncompressed size of compressed input sections.
4072 2011-06-08 Cary Coutant <ccoutant@google.com>
4075 * testsuite/two_file_test_2_v1.cc: Change initialization of
4076 v2 to keep it in .data.
4078 2011-06-07 Cary Coutant <ccoutant@google.com>
4080 * common.cc (Symbol_table::do_allocate_commons_list): Call
4082 * errors.cc (Errors::fatal): Adjust call to gold_exit.
4083 (Errors::fallback): New function.
4084 (gold_fallback): New function.
4085 * errors.h (Errors::fallback): New function.
4086 * gold.cc (gold_exit): Change status parameter to enum; adjust
4088 (queue_initial_tasks): Call gold_fallback.
4089 * gold.h: Include cstdlib.
4090 (Exit_status): New enum type.
4091 (gold_exit): Change status parameter to enum.
4092 (gold_fallback): New function.
4093 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4094 (Layout::create_symtab_sections): Likewise.
4095 (Layout::create_shdrs): Likewise.
4096 * main.cc (main): Adjust call to gold_exit.
4097 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4098 (Output_data_got::add_got_entry_pair): Likewise.
4099 (Output_section::add_input_section): Likewise.
4100 (Output_section::add_output_section_data): Likewise.
4101 (Output_segment::set_section_list_addresses): Likewise.
4102 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4104 2011-06-07 Cary Coutant <ccoutant@google.com>
4106 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4107 for incremental links.
4108 * output.cc (Output_segment::set_section_list_addresses): Remove
4109 FIXME and test for TLS or BSS.
4111 2011-06-07 Cary Coutant <ccoutant@google.com>
4113 * testsuite/Makefile.am: Add incremental_copy_test,
4114 incremental_common_test_1.
4115 * testsuite/Makefile.in: Regenerate.
4116 * testsuite/common_test_1_v1.c: New source file.
4117 * testsuite/common_test_1_v2.c: New source file.
4118 * testsuite/copy_test_v1.cc: New source file.
4120 2011-06-07 Cary Coutant <ccoutant@google.com>
4122 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4123 update, allocate common from bss section's free list.
4124 * incremental-dump.cc (dump_incremental_inputs): Print flag for
4125 linker-defined symbols.
4126 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4127 Skip GOT and PLT entries that are no longer referenced.
4128 (Output_section_incremental_inputs::write_info_blocks): Mark
4129 linker-defined symbols.
4130 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4131 * output.cc (Output_section::allocate): New function.
4132 * output.h (Output_section::allocate): New function.
4133 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4134 linker-defined symbols.
4135 (Symbol::override_base_with_special): Copy is_predefined_ flag.
4136 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4137 (Symbol::init_base_output_data): Likewise.
4138 (Symbol::init_base_output_segment): Likewise.
4139 (Symbol::init_base_constant): Likewise.
4140 (Sized_symbol::init_output_data): Likewise.
4141 (Sized_symbol::init_output_segment): Likewise.
4142 (Sized_symbol::init_constant): Likewise.
4143 (Symbol_table::do_define_in_output_data): Likewise.
4144 (Symbol_table::do_define_in_output_segment): Likewise.
4145 (Symbol_table::do_define_as_constant): Likewise.
4146 * symtab.h (Symbol::is_predefined): New function.
4147 (Symbol::init_base_output_data): Add is_predefined parameter.
4148 (Symbol::init_base_output_segment): Likewise.
4149 (Symbol::init_base_constant): Likewise.
4150 (Symbol::is_predefined_): New data member.
4151 (Sized_symbol::init_output_data): Add is_predefined parameter.
4152 (Sized_symbol::init_output_segment): Likewise.
4153 (Sized_symbol::init_constant): Likewise.
4154 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4156 2011-06-07 Cary Coutant <ccoutant@google.com>
4158 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4159 instead of emit_copy_reloc.
4160 (Copy_relocs::emit_copy_reloc): Refactor.
4161 (Copy_relocs::make_copy_reloc): New function.
4162 (Copy_relocs::add_copy_reloc): Remove.
4163 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4165 (Copy_relocs::make_copy_reloc): New function.
4166 (Copy_relocs::add_copy_reloc): Remove.
4167 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4168 unchanged input files.
4169 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4170 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4171 Reserve BSS space for COPY relocations.
4172 (Sized_incremental_binary::do_emit_copy_relocs): New function.
4173 (Output_section_incremental_inputs::write_info_blocks): Record
4174 whether a symbol is copied from a shared object.
4175 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4176 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4177 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4178 (Incremental_input_entry_reader::get_output_symbol_index): Add
4180 (Incremental_binary::emit_copy_relocs): New function.
4181 (Incremental_binary::do_emit_copy_relocs): New function.
4182 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4184 (Sized_incremental_binary::add_copy_reloc): New function.
4185 (Sized_incremental_binary::do_emit_copy_relocs): New function.
4186 (Sized_incremental_binary::Copy_reloc): New struct.
4187 (Sized_incremental_binary::Copy_relocs): New typedef.
4188 (Sized_incremental_binary::copy_relocs_): New data member.
4189 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4190 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4191 * target.h (Sized_target::emit_copy_reloc): New function.
4192 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4194 2011-06-02 Cary Coutant <ccoutant@google.com>
4197 * gold/archive.cc (Archive::Archive): Initialize new data member.
4198 (Archive::include_all_members): Return if archive has already been
4200 * gold/archive.h (Archive::include_all_members_): New data member.
4202 2011-06-02 Nick Clifton <nickc@redhat.com>
4204 * dynobj.h: Fix spelling mistake in comment.
4205 * output.cc: Likewise.
4207 2011-05-31 Doug Kwan <dougkwan@google.com>
4211 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4212 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4213 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
4214 redundant arm_exidx_test.so.
4215 * testsuite/Makefile.in: Regenerate.
4216 (check_SCRIPTS): Add pr12826.sh
4217 (check_DATA): Add pr12826.stdout
4218 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4219 * testsuite/pr12826.sh: New file.
4220 * testsuite/pr12826_1.s: Ditto.
4221 * testsuite/pr12826_1.s: Ditto.
4223 2011-05-30 Ian Lance Taylor <iant@google.com>
4225 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4228 2011-05-29 Ian Lance Taylor <iant@google.com>
4231 * testsuite/Makefile.am: Use different file name for two_file_test
4232 temporary file for each incremental test.
4233 * testsuite/Makefile.in: Rebuild.
4235 2011-05-29 Ian Lance Taylor <iant@google.com>
4237 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4238 binary input file is empty.
4240 2011-05-27 Ian Lance Taylor <iant@google.com>
4242 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4243 (ver_test_9.so): Likewise.
4244 * testsuite/Makefile.in: Rebuild.
4246 2011-05-26 Cary Coutant <ccoutant@google.com>
4248 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4249 * incremental.cc (Incremental_inputs::report_input_section): Fix
4250 comment, indentation.
4251 (Incremental_inputs::report_comdat_group): New function.
4252 (Output_section_incremental_inputs::set_final_data_size): Adjust size
4253 of data for incremental input file entry.
4254 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4255 group count, COMDAT group signatures.
4256 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4257 an unchanged input file.
4258 * incremental.h (Incremental_object_entry::Incremental_object_entry):
4259 Initialize new data member.
4260 (Incremental_object_entry::add_comdat_group): New function.
4261 (Incremental_object_entry::get_comdat_group_count): New function.
4262 (Incremental_object_entry::get_comdat_signature_key): New function.
4263 (Incremental_object_entry::groups_): New data member.
4264 (Incremental_inputs::report_comdat_group): New function.
4265 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4266 data for incremental input file entry.
4267 (Incremental_input_entry_reader::get_comdat_group_count): New function.
4268 (Incremental_input_entry_reader::get_input_section): Adjust size of
4269 data for incremental input file entry.
4270 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4271 (Incremental_input_entry_reader::get_comdat_group_signature): New
4273 * object.cc (Sized_relobj::include_section_group): Report kept
4274 COMDAT groups for incremental links.
4276 2011-05-24 David Meyer <pdox@google.com>
4278 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4279 with name parameter. Add found_name parameter.
4280 * fileread.cc (Input_file::find_file): Adjust code accordingly.
4281 * dirsearch.h (class Dirsearch): Update declaration.
4283 2011-05-24 Ian Lance Taylor <iant@google.com>
4285 * archive.cc (Library_base::should_include_member): Pull in object
4286 from archive if it defines the entry symbol.
4287 * parameters.cc (Parameters::entry): New function.
4288 * parameters.h (class Parameters): Declare entry.
4289 * output.h (class Output_file_header): Remove entry_ field.
4290 * output.cc (Output_file_header::Output_file_header): Remove entry
4291 parameter. Change all callers.
4292 (Output_file_header::entry): Use parameters->entry.
4293 * gold.cc (queue_middle_tasks): Likewise.
4294 * plugin.cc (Plugin_hook::run): Likewise.
4296 2011-05-24 Cary Coutant <ccoutant@google.com>
4298 * gold.cc (queue_initial_tasks): Pass incremental base filename
4299 to Output_file::open_base_file; don't print error message.
4300 * incremental-dump.cc (main): Adjust call to
4301 Output_file::open_for_modification.
4302 * incremental-dump.cc (main): Likewise.
4303 * incremental.cc (Incremental_inputs::report_command_line):
4304 Ignore --incremental-base option when comparing command lines.
4305 Ignore parameter when given as separate argument.
4306 * options.h (class General_options): Add --incremental-base.
4307 * output.cc (Output_file::Output_file):
4308 (Output_file::open_base_file): Add base_name and writable parameters;
4309 read base file into new file; print error message here.
4310 (Output_file::map_no_anonymous): Add writable parameter; adjust all
4312 * output.h (Output_file::open_for_modification): Rename to...
4313 (Output_file::open_base_file): ...this; add base_name and
4314 writable parameters; adjust all callers.
4315 (Output_file::map_no_anonymous): Add writable parameter; adjust all
4317 * testsuite/Makefile.am (incremental_test_4): Test
4319 * testsuite/Makefile.in: Regenerate.
4321 2011-05-24 Cary Coutant <ccoutant@google.com>
4323 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4325 * testsuite/Makefile.in: Regenerate.
4326 * testsuite/two_file_test_1_v1.cc: New test source file.
4327 * testsuite/two_file_test_1b_v1.cc: New test source file.
4328 * testsuite/two_file_test_2_v1.cc: New test source file.
4330 2011-05-24 Cary Coutant <ccoutant@google.com>
4332 * dynobj.h (Dynobj::do_dynobj): New function.
4333 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4334 flag and soname for shared objects.
4335 * incremental.cc (Incremental_inputs::report_object): Make
4336 either Incremental_object_entry or Incremental_dynobj_entry; add
4337 soname to string table.
4338 (Incremental_inputs::report_input_section): Add assertion.
4339 (Output_section_incremental_inputs::set_final_data_size): Adjust
4340 type of input file entry for shared libraries; adjust size of
4341 shared library info entry.
4342 (Output_section_incremental_inputs::write_input_files): Write
4343 as_needed flag for shared libraries.
4344 (Output_section_incremental_inputs::write_info_blocks): Adjust type
4345 of input file entry for shared libraries; write soname.
4346 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4347 soname from incremental info.
4348 * incremental.h (enum Incremental_input_flags): Add
4349 INCREMENTAL_INPUT_AS_NEEDED.
4350 (Incremental_input_entry::Incremental_input_entry): Initialize new
4352 (Incremental_input_entry::set_as_needed): New function.
4353 (Incremental_input_entry::as_needed): New function.
4354 (Incremental_input_entry::do_dynobj_entry): New function.
4355 (Incremental_input_entry::as_needed_): New data member.
4356 (Incremental_object_entry::Incremental_object_entry): Don't check
4358 (Incremental_object_entry::do_type): Likewise.
4359 (class Incremental_dynobj_entry): New class.
4360 (Incremental_input_entry_reader::as_needed): New function.
4361 (Incremental_input_entry_reader::get_soname): New function.
4362 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4363 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4364 size of shared library info entry.
4365 * layout.cc (Layout::finish_dynamic_section): Don't test for
4366 incremental link when adding DT_NEEDED entries.
4367 * object.h (Object::Object): Initialize new data member.
4368 (Object::dynobj): New function.
4369 (Object::set_as_needed): New function.
4370 (Object::as_needed): New function.
4371 (Object::do_dynobj): New function.
4372 (Object::as_needed_): New data member.
4374 2011-05-24 Cary Coutant <ccoutant@google.com>
4376 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4377 info; adjust display of GOT entries.
4378 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4379 vector of input objects; remove file_status_.
4380 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4381 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4382 got_plt reader; call target hooks to reserve GOT entries.
4383 (Output_section_incremental_inputs::set_final_data_size): Adjust size
4384 of input file info header and GOT info entry.
4385 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4387 (Got_plt_view_info::got_descriptor): Remove.
4388 (Got_plt_view_info::sym_index): New data member.
4389 (Got_plt_view_info::input_index): New data member.
4390 (Local_got_offset_visitor::visit): Write input file index.
4391 (Global_got_offset_visitor::visit): Write 0 for input file index.
4392 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4393 with sym_index and input_index.
4394 (Output_section_incremental_inputs::write_got_plt): Adjust size of
4395 incremental info GOT entry; replace got_descriptor with input_index.
4396 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4397 map from input file index to object.
4398 (Sized_relobj_incr::do_layout): Replace direct data member reference
4399 with accessor function.
4400 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4401 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4402 Adjust size of input file info header.
4403 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4404 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4405 (Incremental_input_entry_reader::get_input_section): Adjust size of
4406 input file info header.
4407 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4408 of incremental info GOT entry.
4409 (Incremental_got_plt_reader::get_got_desc): Remove.
4410 (Incremental_got_plt_reader::get_got_symndx): New function.
4411 (Incremental_got_plt_reader::get_got_input_index): New function.
4412 (Sized_incremental_binary::Sized_incremental_binary): Remove
4413 file_status_; add input_objects_.
4414 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4415 (Sized_incremental_binary::set_file_is_unchanged): Remove.
4416 (Sized_incremental_binary::file_is_unchanged): Remove.
4417 (Sized_incremental_binary::set_input_object): New function.
4418 (Sized_incremental_binary::input_object): New function.
4419 (Sized_incremental_binary::file_status_): Remove.
4420 (Sized_incremental_binary::input_objects_): New data member.
4421 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4423 (Sized_relobj_incr::invalid_address): Move to base class.
4424 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4426 (Sized_relobj_incr::do_output_section_offset): Likewise.
4427 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4428 (Sized_relobj_incr::section_offsets_): Likewise.
4429 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4431 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4432 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4433 with accessor function.
4434 (Sized_relobj_file::do_layout): Likewise.
4435 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4436 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4437 (Sized_relobj_file::compute_final_local_value): Replace refs to
4438 section_offsets_ with accessor function.
4439 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4440 * object.h (Relobj::Relobj): Initialize new data members.
4441 (Relobj::add_dyn_reloc): New function.
4442 (Relobj::first_dyn_reloc): New function.
4443 (Relobj::dyn_reloc_count): New function.
4444 (Relobj::first_dyn_reloc_): New data member.
4445 (Relobj::dyn_reloc_count_): New data member.
4446 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4448 (Sized_relobj::Address): New typedef.
4449 (Sized_relobj::invalid_address): Move here from child class.
4450 (Sized_relobj::Sized_relobj): Initialize new data members.
4451 (Sized_relobj::sized_relobj): New function.
4452 (Sized_relobj::is_output_section_offset_invalid): Move here from
4454 (Sized_relobj::get_output_section_offset): Likewise.
4455 (Sized_relobj::local_has_got_offset): Likewise.
4456 (Sized_relobj::local_got_offset): Likewise.
4457 (Sized_relobj::set_local_got_offset): Likewise.
4458 (Sized_relobj::do_for_all_local_got_entries): Likewise.
4459 (Sized_relobj::clear_got_offsets): New function.
4460 (Sized_relobj::section_offsets): Move here from child class.
4461 (Sized_relobj::do_output_section_offset): Likewise.
4462 (Sized_relobj::do_set_section_offset): Likewise.
4463 (Sized_relobj::Local_got_offsets): Likewise.
4464 (Sized_relobj::local_got_offsets_): Likewise.
4465 (Sized_relobj::section_offsets_): Likewise.
4466 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4468 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4470 (Sized_relobj_file::sized_relobj): New function
4471 (Sized_relobj_file::local_has_got_offset): Move to base class.
4472 (Sized_relobj_file::local_got_offset): Likewise.
4473 (Sized_relobj_file::set_local_got_offset): Likewise.
4474 (Sized_relobj_file::get_output_section_offset): Likewise.
4475 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4476 (Sized_relobj_file::do_output_section_offset): Likewise.
4477 (Sized_relobj_file::do_set_section_offset): Likewise.
4478 (Sized_relobj_file::Local_got_offsets): Likewise.
4479 (Sized_relobj_file::local_got_offsets_): Likewise.
4480 (Sized_relobj_file::section_offsets_): Likewise.
4481 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4483 (set_needs_dynsym_index): Convert relobj to derived class pointer.
4484 (Output_reloc::get_symbol_index): Likewise.
4485 (Output_reloc::local_section_offset): Likewise.
4486 (Output_reloc::get_address): Likewise.
4487 (Output_reloc::symbol_value): Likewise.
4488 (Output_data_got::reserve_slot): Move to class definition.
4489 (Output_data_got::reserve_local): New function.
4490 (Output_data_got::reserve_slot_for_global): Remove.
4491 (Output_data_got::reserve_global): New function.
4492 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4493 (all constructors, two instantiations).
4494 (Output_reloc::get_relobj): New function (two instantiations).
4495 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4496 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4497 (Output_data_reloc::add_global): Adjust type of relobj.
4498 (Output_data_reloc::add_global_relative): Likewise.
4499 (Output_data_reloc::add_symbolless_global_addend): Likewise.
4500 (Output_data_reloc::add_local): Likewise.
4501 (Output_data_reloc::add_local_relative): Likewise.
4502 (Output_data_reloc::add_symbolless_local_addend): Likewise.
4503 (Output_data_reloc::add_local_section): Likewise.
4504 (Output_data_reloc::add_output_section): Likewise.
4505 (Output_data_reloc::add_absolute): Likewise.
4506 (Output_data_reloc::add_target_specific): Likewise.
4507 (Output_data_got::reserve_slot): Move definition here.
4508 (Output_data_got::reserve_local): New function.
4509 (Output_data_got::reserve_global): New function.
4510 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4511 section_offsets_ with accessor function.
4512 (Sized_relobj_file::write_sections): Likewise.
4513 (Sized_relobj_file::do_relocate_sections): Likewise.
4514 * target.h (Sized_target::reserve_local_got_entry): New function.
4515 (Sized_target::reserve_global_got_entry): New function.
4516 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4517 (Target_x86_64::reserve_global_got_entry): New function.
4518 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4520 2011-05-23 Cary Coutant <ccoutant@google.com>
4522 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4523 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4524 bit when checking got_type.
4525 * incremental.cc (Sized_incremental_binary::setup_readers):
4526 Store symbol table and string table locations; initialize bit vector
4527 of file status flags.
4528 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4530 (Sized_incremental_binary::do_process_got_plt): New function.
4531 (Sized_incremental_binary::get_symtab_view): Use stored locations.
4532 (Output_section_incremental_inputs::set_final_data_size): Record
4533 file index for each input file.
4534 (Output_section_incremental_inputs::write_got_plt): Store file index
4535 instead of input entry offset for each GOT entry.
4537 (Incremental_input_entry::Incremental_input_entry): Initialize new
4539 (Incremental_input_entry::set_offset): Store file index.
4540 (Incremental_input_entry::get_file_index): New function.
4541 (Incremental_input_entry::file_index_): New data member.
4542 (Incremental_binary::process_got_plt): New function.
4543 (Incremental_binary::do_process_got_plt): New function.
4544 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4546 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4547 (Sized_incremental_binary::set_file_is_unchanged): New function.
4548 (Sized_incremental_binary::file_is_unchanged): New function.
4549 (Sized_incremental_binary::do_process_got_plt): New function.
4550 (Sized_incremental_binary::file_status_): New data member.
4551 (Sized_incremental_binary::main_symtab_loc_): New data member.
4552 (Sized_incremental_binary::main_strtab_loc_): New data member.
4553 * output.cc (Output_data_got::Got_entry::write): Add case
4555 (Output_data_got::add_global): Call add_got_entry.
4556 (Output_data_got::add_global_plt): Likewise.
4557 (Output_data_got::add_global_with_rel): Likewise.
4558 (Output_data_got::add_global_with_rela): Likewise.
4559 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4560 (Output_data_got::add_global_pair_with_rela): Likewise.
4561 (Output_data_got::add_local): Call add_got_entry.
4562 (Output_data_got::add_local_plt): Likewise.
4563 (Output_data_got::add_local_with_rel): Likewise.
4564 (Output_data_got::add_local_with_rela): Likewise.
4565 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4566 (Output_data_got::add_local_pair_with_rela): Likewise.
4567 (Output_data_got::reserve_slot): New function.
4568 (Output_data_got::reserve_slot_for_global): New function.
4569 (Output_data_got::add_got_entry): New function.
4570 (Output_data_got::add_got_entry_pair): New function.
4571 (Output_section::add_output_section_data): Edit FIXME.
4573 (Output_section_data_build::Output_section_data_build): New
4574 constructor with size parameter.
4575 (Output_data_space::Output_data_space): Likewise.
4576 (Output_data_got::Output_data_got): Initialize new data member; new
4577 constructor with size parameter.
4578 (Output_data_got::add_constant): Call add_got_entry.
4579 (Output_data_got::reserve_slot): New function.
4580 (Output_data_got::reserve_slot_for_global): New function.
4581 (class Output_data_got::Got_entry): Add RESERVED_CODE.
4582 (Output_data_got::add_got_entry): New function.
4583 (Output_data_got::add_got_entry_pair): New function.
4584 (Output_data_got::free_list_): New data member.
4585 * target.h (Sized_target::init_got_plt_for_update): New function.
4586 (Sized_target::register_global_plt_entry): New function.
4587 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4588 Initialize new data member; call init; add constructor with PLT count.
4589 (Output_data_plt_x86_64::init): New function.
4590 (Output_data_plt_x86_64::add_relocation): New function.
4591 (Output_data_plt_x86_64::reserve_slot): New function.
4592 (Output_data_plt_x86_64::free_list_): New data member.
4593 (Target_x86_64::init_got_plt_for_update): New function.
4594 (Target_x86_64::register_global_plt_entry): New function.
4595 (Output_data_plt_x86_64::add_entry): Allocate from free list for
4596 incremental updates.
4597 (Output_data_plt_x86_64::add_relocation): New function.
4598 * testsuite/object_unittest.cc (Object_test): Set default options.
4600 2011-05-16 Ian Lance Taylor <iant@google.com>
4602 * options.h (class General_options): Make -i a synonym for -r.
4604 2011-05-16 Ian Lance Taylor <iant@google.com>
4606 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4608 2011-05-10 Cary Coutant <ccoutant@google.com>
4610 * object.cc (Sized_relobj::do_count_local_symbols): Check for
4613 2011-05-06 Ian Lance Taylor <iant@google.com>
4615 * layout.cc (Layout::layout): If the output section flags change,
4616 update the ordering.
4618 2011-04-25 Cary Coutant <ccoutant@google.com>
4620 * incremental-dump.cc (dump_incremental_inputs): Print local
4621 symbol info for each input file.
4623 (Output_section_incremental_inputs::set_final_data_size): Add local
4624 symbol info to input file entries in incremental info.
4625 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4626 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4627 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4628 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4630 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4631 (Sized_incr_relobj::do_relocate): Write the local symbols.
4632 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4633 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4634 Adjust size of input file header.
4635 (Incremental_inputs_reader::get_local_symbol_offset): New function.
4636 (Incremental_inputs_reader::get_local_symbol_count): New function.
4637 (Incremental_inputs_reader::get_input_section): Adjust size of input
4639 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4640 (Sized_incr_relobj::This): New typedef.
4641 (Sized_incr_relobj::sym_size): New const data member.
4642 (Sized_incr_relobj::Local_symbol): New struct.
4643 (Sized_incr_relobj::do_output_local_symbol_count): New function.
4644 (Sized_incr_relobj::do_local_symbol_offset): New function.
4645 (Sized_incr_relobj::local_symbol_count_): New data member.
4646 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4647 (Sized_incr_relobj::local_symbol_index_): New data member.
4648 (Sized_incr_relobj::local_symbol_offset_): New data member.
4649 (Sized_incr_relobj::local_dynsym_offset_): New data member.
4650 (Sized_incr_relobj::local_symbols_): New data member.
4651 * object.h (Relobj::output_local_symbol_count): New function.
4652 (Relobj::local_symbol_offset): New function.
4653 (Relobj::do_output_local_symbol_count): New function.
4654 (Relobj::do_local_symbol_offset): New function.
4655 (Sized_relobj::do_output_local_symbol_count): New function.
4656 (Sized_relobj::do_local_symbol_offset): New function.
4658 2011-04-22 Vladimir Simonov <sv@sw.ru>
4660 * descriptors.cc (set_close_on_exec): New function.
4661 (Descriptors::open): Use set_close_on_exec.
4662 * output.cc (S_ISLNK): Define if not defined.
4664 2011-04-22 Cary Coutant <ccoutant@google.com>
4666 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4668 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4669 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4670 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4672 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4673 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4674 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4676 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4678 (Incremental_binary::apply_incremental_relocs): New function.
4679 (Incremental_binary::do_apply_incremental_relocs): New function.
4680 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4682 (Sized_incremental_binary::add_global_symbol): New function.
4683 (Sized_incremental_binary::global_symbol): New function.
4684 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4685 (Sized_incremental_binary::symbol_map_): New data member.
4686 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4687 * target.h (Sized_target::apply_relocation): New function.
4688 * target-reloc.h (apply_relocation): New function.
4689 * x86_64.cc (Target_x86_64::apply_relocation): New function.
4691 2011-04-22 Doug Kwan <dougkwan@google.com>
4693 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4694 flag of a SHT_ARM_EXIDX section.
4695 * testsuite/Makefile.am (arm_exidx_test): New test rules.
4696 * testsuite/Makefile.in: Regenerate.
4697 * testsuite/arm_exidx_test.s: New file.
4698 * testsuite/arm_exidx_test.sh: Same.
4700 2011-04-20 Cary Coutant <ccoutant@google.com>
4703 * archive.h (Incremental_archive_entry::Archive_member):
4704 Initialize arg_serial_ (second constructor).
4706 2011-04-17 Ian Lance Taylor <iant@google.com>
4708 * object.cc (Relocate_info::location): Simplify location string.
4709 * errors.cc (Errors::error_at_location): Don't print program
4711 (Errors::warning_at_location): Likewise.
4712 (Errors::undefined_symbol): Likewise.
4713 * testsuite/debug_msg.sh: Update accordingly.
4715 2011-04-14 Cary Coutant <ccoutant@google.com>
4717 * gold/layout.cc (Layout::symtab_section_offset): New function.
4718 * gold/layout.h (Layout::symtab_section_offset): New function.
4719 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4721 2011-04-12 Ian Lance Taylor <iant@google.com>
4723 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
4724 with MREMAP_MAYMOVE.
4725 * output.h (class Output_file): Add map_is_allocated_ field.
4726 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
4727 not available, provide stubs. If mremap is not available, #define
4729 (MREMAP_MAYMOVE): Define if not defined.
4730 (Output_file::Output_file): Initialize map_is_allocated_.
4731 (Output_file::resize): Check map_is_allocated_.
4732 (Output_file::map_anonymous): If mmap fails, use malloc.
4733 (Output_file::unmap): Don't do anything for an anonymous map.
4734 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
4735 is not available, provide stubs.
4736 (File_read::View::~View): Use free rather than delete[].
4737 (File_read::make_view): Use malloc rather than new[]. If mmap
4739 (File_read::find_or_make_view): Use malloc rather than new[].
4740 * gold.h: Remove HAVE_REMAP code.
4741 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
4742 exists. Rename mremap to gold_mremap. If mmap is not available
4744 * configure, config.in: Rebuild.
4746 2011-04-11 Ian Lance Taylor <iant@google.com>
4748 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4749 initialize local variable v.
4751 2011-04-11 Cary Coutant <ccoutant@google.com>
4753 * archive.cc (Archive::include_member): Adjust call to
4755 (Add_archive_symbols::run): Track argument serial numbers.
4756 (Lib_group::include_member): Likewise.
4757 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4758 * archive.h (Incremental_archive_entry::Archive_member):
4759 Initialize arg_serial_.
4760 (Archive_member::arg_serial_): New data member.
4761 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4762 (Sized_dynobj::do_add_symbols): Track symbols when doing an
4764 (Sized_dynobj::do_for_all_local_got_entries): New function.
4765 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4767 * fileread.cc (get_mtime): New function.
4768 * fileread.h (get_mtime): New function.
4769 * gold.cc (queue_initial_tasks): Check for incremental update.
4770 (process_incremental_input): New function.
4771 (queue_middle_tasks): Don't force valid target for incremental
4773 * incremental-dump.cc (find_input_containing_global): Adjust
4774 size of symbol info entry.
4775 (dump_incremental_inputs): Dump argument serial number and
4776 in_system_directory flag; bias shndx by 1; print symbol names
4777 when dumping per-file symbol lists; use new symbol info readers.
4779 (Output_section_incremental_inputs:update_data_size): New function.
4780 (Sized_incremental_binary::setup_readers): Setup input readers
4781 for each input file; build maps for files added from libraries
4783 (Sized_incremental_binary::check_input_args): New function.
4784 (Sized_incremental_binary::do_check_inputs): Build map of argument
4785 serial numbers to input arguments.
4786 (Sized_incremental_binary::do_file_has_changed): Rename
4787 do_file_is_unchanged to this; compare file modification times.
4788 (Sized_incremental_binary::do_init_layout): New function.
4789 (Sized_incremental_binary::do_reserve_layout): New function.
4790 (Sized_incremental_binary::do_get_input_reader): Remove.
4791 (Sized_incremental_binary::get_symtab_view): New function.
4792 (Incremental_checker::can_incrementally_link_output_file): Remove.
4793 (Incremental_inputs::report_command_line): Exclude --debug options.
4794 (Incremental_inputs::report_archive_begin): Add parameter; track
4795 argument serial numbers; don't put input file entry for archive
4796 before archive members.
4797 (Incremental_inputs::report_archive_end): Put input file entry
4798 for archive after archive members.
4799 (Incremental_inputs::report_object): Add parameter; track argument
4800 serial numbers and in_system_directory flag.
4801 (Incremental_inputs::report_script): Add parameter; track argument
4803 (Output_section_incremental_inputs::set_final_data_size): Adjust
4804 size of symbol info entry; check for forwarding symbols.
4805 (Output_section_incremental_inputs::write_input_files): Write
4806 in_system_directory flag and argument serial number.
4807 (Output_section_incremental_inputs::write_info_blocks): Map section
4808 indices between incremental info and original input file; store
4809 input section index for each symbol.
4810 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4811 change operator() to visit().
4812 (class Global_got_offset_visitor): Likewise.
4813 (class Global_symbol_visitor_got_plt):
4814 (Output_section_incremental_inputs::write_got_plt): Use new visitor
4816 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4817 (Sized_incr_relobj::do_read_symbols): New function.
4818 (Sized_incr_relobj::do_layout): New function.
4819 (Sized_incr_relobj::do_layout_deferred_sections): New function.
4820 (Sized_incr_relobj::do_add_symbols): New function.
4821 (Sized_incr_relobj::do_should_include_member): New function.
4822 (Sized_incr_relobj::do_for_all_global_symbols): New function.
4823 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4824 (Sized_incr_relobj::do_section_size): New function.
4825 (Sized_incr_relobj::do_section_name): New function.
4826 (Sized_incr_relobj::do_section_contents): New function.
4827 (Sized_incr_relobj::do_section_flags): New function.
4828 (Sized_incr_relobj::do_section_entsize): New function.
4829 (Sized_incr_relobj::do_section_address): New function.
4830 (Sized_incr_relobj::do_section_type): New function.
4831 (Sized_incr_relobj::do_section_link): New function.
4832 (Sized_incr_relobj::do_section_info): New function.
4833 (Sized_incr_relobj::do_section_addralign): New function.
4834 (Sized_incr_relobj::do_initialize_xindex): New function.
4835 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4836 (Sized_incr_relobj::do_read_relocs): New function.
4837 (Sized_incr_relobj::do_gc_process_relocs): New function.
4838 (Sized_incr_relobj::do_scan_relocs): New function.
4839 (Sized_incr_relobj::do_count_local_symbols): New function.
4840 (Sized_incr_relobj::do_finalize_local_symbols): New function.
4841 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4842 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4843 (Sized_incr_relobj::do_relocate): New function.
4844 (Sized_incr_relobj::do_set_section_offset): New function.
4845 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4846 (Sized_incr_dynobj::do_read_symbols): New function.
4847 (Sized_incr_dynobj::do_layout): New function.
4848 (Sized_incr_dynobj::do_add_symbols): New function.
4849 (Sized_incr_dynobj::do_should_include_member): New function.
4850 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4851 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4852 (Sized_incr_dynobj::do_section_size): New function.
4853 (Sized_incr_dynobj::do_section_name): New function.
4854 (Sized_incr_dynobj::do_section_contents): New function.
4855 (Sized_incr_dynobj::do_section_flags): New function.
4856 (Sized_incr_dynobj::do_section_entsize): New function.
4857 (Sized_incr_dynobj::do_section_address): New function.
4858 (Sized_incr_dynobj::do_section_type): New function.
4859 (Sized_incr_dynobj::do_section_link): New function.
4860 (Sized_incr_dynobj::do_section_info): New function.
4861 (Sized_incr_dynobj::do_section_addralign): New function.
4862 (Sized_incr_dynobj::do_initialize_xindex): New function.
4863 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4864 (make_sized_incremental_object): New function.
4865 (Incremental_library::copy_unused_symbols): New function.
4866 (Incremental_library::do_for_all_unused_symbols): New function.
4867 * incremental.h (enum Incremental_input_flags): New type.
4868 (class Incremental_checker): Remove.
4869 (Incremental_input_entry::Incremental_input_entry): Add argument
4871 (Incremental_input_entry::arg_serial): New function.
4872 (Incremental_input_entry::set_is_in_system_directory): New function.
4873 (Incremental_input_entry::is_in_system_directory): New function.
4874 (Incremental_input_entry::arg_serial_): New data member.
4875 (Incremental_input_entry::is_in_system_directory_): New data member.
4876 (class Script_info): Move here from script.h.
4877 (Script_info::Script_info): Add filename parameter.
4878 (Script_info::filename): New function.
4879 (Script_info::filename_): New data member.
4880 (Incremental_script_entry::Incremental_script_entry): Add argument
4882 (Incremental_object_entry::Incremental_object_entry): Likewise.
4883 (Incremental_object_entry::add_input_section): Build list of input
4884 sections with map to original shndx.
4885 (Incremental_object_entry::get_input_section_index): New function.
4886 (Incremental_object_entry::shndx_): New data member.
4887 (Incremental_object_entry::name_key_): Rename; adjust all refs.
4888 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4889 (Incremental_archive_entry::Incremental_archive_entry): Add argument
4891 (Incremental_inputs::report_archive_begin): Likewise.
4892 (Incremental_inputs::report_object): Likewise.
4893 (Incremental_inputs::report_script): Likewise.
4894 (class Incremental_global_symbol_reader): New class.
4895 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4896 and store flags and input file type.
4897 (Incremental_input_entry_reader::arg_serial): New function.
4898 (Incremental_input_entry_reader::type): Extract type from flags.
4899 (Incremental_input_entry_reader::is_in_system_directory): New function.
4900 (Incremental_input_entry_reader::get_input_section_count): Call
4901 accessor function for type.
4902 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4903 function for type; adjust size of global symbol entry.
4904 (Incremental_input_entry_reader::get_global_symbol_count): Call
4905 accessor function for type.
4906 (Incremental_input_entry_reader::get_object_count): Likewise.
4907 (Incremental_input_entry_reader::get_object_offset): Likewise.
4908 (Incremental_input_entry_reader::get_member_count): Likewise.
4909 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4910 (Incremental_input_entry_reader::get_member_offset): Likewise.
4911 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4912 (Incremental_input_entry_reader::Global_symbol_info): Remove.
4913 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4914 (Incremental_input_entry_reader::get_global_symbol_reader): New
4916 (Incremental_input_entry_reader::get_output_symbol_index): New
4918 (Incremental_input_entry_reader::type_): Remove.
4919 (Incremental_input_entry_reader::flags_): New data member.
4920 (Incremental_inputs_reader::input_file_offset): New function.
4921 (Incremental_inputs_reader::input_file_index): New function.
4922 (Incremental_inputs_reader::input_file): Call input_file_offset.
4923 (Incremental_inputs_reader::input_file_at_offset): New function.
4924 (Incremental_relocs_reader::get_r_type): Reformat.
4925 (Incremental_relocs_reader::get_r_shndx): Reformat.
4926 (Incremental_relocs_reader::get_r_offset): Reformat.
4927 (Incremental_relocs_reader::data): New function.
4928 (Incremental_binary::Incremental_binary): Initialize new data members.
4929 (Incremental_binary::check_inputs): Add cmdline parameter.
4930 (Incremental_binary::file_is_unchanged): Remove.
4931 (Input_reader::arg_serial): New function.
4932 (Input_reader::get_unused_symbol_count): New function.
4933 (Input_reader::get_unused_symbol): New function.
4934 (Input_reader::do_arg_serial): New function.
4935 (Input_reader::do_get_unused_symbol_count): New function.
4936 (Input_reader::do_get_unused_symbol): New function.
4937 (Incremental_binary::input_file_count): New function.
4938 (Incremental_binary::get_input_reader): Change signature to use
4939 index instead of filename.
4940 (Incremental_binary::file_has_changed): New function.
4941 (Incremental_binary::get_input_argument): New function.
4942 (Incremental_binary::get_library): New function.
4943 (Incremental_binary::get_script_info): New function.
4944 (Incremental_binary::init_layout): New function.
4945 (Incremental_binary::reserve_layout): New function.
4946 (Incremental_binary::output_file): New function.
4947 (Incremental_binary::do_check_inputs): New function.
4948 (Incremental_binary::do_file_is_unchanged): Remove.
4949 (Incremental_binary::do_file_has_changed): New function.
4950 (Incremental_binary::do_init_layout): New function.
4951 (Incremental_binary::do_reserve_layout): New function.
4952 (Incremental_binary::do_input_file_count): New function.
4953 (Incremental_binary::do_get_input_reader): Change signature.
4954 (Incremental_binary::input_args_map_): New data member.
4955 (Incremental_binary::library_map_): New data member.
4956 (Incremental_binary::script_map_): New data member.
4957 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4959 (Sized_incremental_binary::output_section): New function.
4960 (Sized_incremental_binary::inputs_reader): Add const.
4961 (Sized_incremental_binary::symtab_reader): Add const.
4962 (Sized_incremental_binary::relocs_reader): Add const.
4963 (Sized_incremental_binary::got_plt_reader): Add const.
4964 (Sized_incremental_binary::get_symtab_view): New function.
4965 (Sized_incremental_binary::Inputs_reader): New typedef.
4966 (Sized_incremental_binary::Input_entry_reader): New typedef.
4967 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4968 (Sized_incremental_binary::do_file_is_unchanged): Remove.
4969 (Sized_incremental_binary::do_file_has_changed): New function.
4970 (Sized_incremental_binary::do_init_layout): New function.
4971 (Sized_incremental_binary::do_reserve_layout): New function.
4972 (Sized_input_reader::Inputs_reader): Remove.
4973 (Sized_input_reader::Input_entry_reader): Remove.
4974 (Sized_input_reader::do_arg_serial): New function.
4975 (Sized_input_reader::do_get_unused_symbol_count): New function.
4976 (Sized_input_reader::do_get_unused_symbol): New function.
4977 (Sized_incremental_binary::do_input_file_count): New function.
4978 (Sized_incremental_binary::do_get_input_reader): Change signature;
4979 use index instead of filename.
4980 (Sized_incremental_binary::section_map_): New data member.
4981 (Sized_incremental_binary::input_entry_readers_): New data member.
4982 (class Sized_incr_relobj): New class.
4983 (class Sized_incr_dynobj): New class.
4984 (make_sized_incremental_object): New function.
4985 (class Incremental_library): New class.
4986 * layout.cc (Free_list::num_lists): New static data member.
4987 (Free_list::num_nodes): New static data member.
4988 (Free_list::num_removes): New static data member.
4989 (Free_list::num_remove_visits): New static data member.
4990 (Free_list::num_allocates): New static data member.
4991 (Free_list::num_allocate_visits): New static data member.
4992 (Free_list::init): New function.
4993 (Free_list::remove): New function.
4994 (Free_list::allocate): New function.
4995 (Free_list::dump): New function.
4996 (Free_list::print_stats): New function.
4997 (Layout_task_runner::run): Resize output file for incremental updates.
4998 (Layout::Layout): Initialize new data members.
4999 (Layout::set_incremental_base): New function.
5000 (Layout::init_fixed_output_section): New function.
5001 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5002 incremental updates.
5003 (Layout::create_gold_note): Do not create gold note section for
5004 incremental updates.
5005 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5006 for incremental updates.
5007 (Layout::set_section_offsets): For incremental updates, allocate space
5009 (Layout::create_symtab_sections): Layout with offsets relative to
5010 start of section; for incremental updates, allocate space from free
5012 (Layout::create_shdrs): For incremental updates, allocate space from
5014 (Layout::finish_dynamic_section): For incremental updates, do not
5015 check --as-needed (fixed in subsequent patch).
5016 * layout.h (class Free_list): New class.
5017 (Layout::set_incremental_base): New function.
5018 (Layout::incremental_base): New function.
5019 (Layout::init_fixed_output_section): New function.
5020 (Layout::allocate): New function.
5021 (Layout::incremental_base_): New data member.
5022 (Layout::free_list_): New data member.
5023 * main.cc (main): Print Free_list statistics.
5024 * object.cc (Relobj::finalize_incremental_relocs): Add
5025 clear_counts parameter; clear counts only when clear_counts is set.
5026 (Sized_relobj::Sized_relobj): Initialize new base class.
5027 (Sized_relobj::do_layout): Don't report special sections.
5028 (Sized_relobj::do_for_all_local_got_entries): New function.
5029 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5030 symtab_off to all symbol table offsets.
5031 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5032 * object.h (class Got_offset_list): Move to top of file.
5033 (Object::Object): Allow case where input_file == NULL.
5034 (Object::~Object): Likewise.
5035 (Object::input_file): Assert that input_file != NULL.
5036 (Object::lock): Allow case where input_file == NULL.
5037 (Object::unlock): Likewise.
5038 (Object::is_locked): Likewise.
5039 (Object::token): Likewise.
5040 (Object::release): Likewise.
5041 (Object::is_incremental): New function.
5042 (Object::get_mtime): New function.
5043 (Object::for_all_local_got_entries): New function.
5044 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5045 (Object::set_is_in_system_directory): New function.
5046 (Object::is_in_system_directory): New function.
5047 (Object::do_is_incremental): New function.
5048 (Object::do_get_mtime): New function.
5049 (Object::do_for_all_local_got_entries): New function.
5050 (Object::is_in_system_directory_): New data member.
5051 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5052 (class Sized_relobj_base): New class.
5053 (class Sized_relobj): Derive from Sized_relobj_base.
5054 (class Sized_relobj::Symbols): Redeclare from base class.
5055 (class Sized_relobj::local_got_offset_list): Remove.
5056 (class Sized_relobj::Output_sections): Redeclare from base class.
5057 (class Sized_relobj::do_for_all_local_got_entries): New function.
5058 (class Sized_relobj::write_local_symbols): Add offset parameter.
5059 (class Sized_relobj::local_symbol_offset_): Update comment.
5060 (class Sized_relobj::local_dynsym_offset_): Update comment.
5061 * options.cc (Input_arguments::add_file): Remove const.
5062 * options.h (Input_file_argument::Input_file_argument):
5063 Initialize arg_serial_ (all constructors).
5064 (Input_file_argument::set_arg_serial): New function.
5065 (Input_file_argument::arg_serial): New function.
5066 (Input_file_argument::arg_serial_): New data member.
5067 (Input_arguments::Input_arguments): Initialize file_count_.
5068 (Input_arguments::add_file): Remove const.
5069 (Input_arguments::number_of_input_files): New function.
5070 (Input_arguments::file_count_): New data member.
5071 (Command_line::number_of_input_files): Call
5072 Input_arguments::number_of_input_files.
5073 * output.cc (Output_segment_headers::Output_segment_headers):
5075 (Output_section::Input_section::current_data_size): New function.
5076 (Output_section::Output_section): Initialize new data members.
5077 (Output_section::add_input_section): Don't do merge sections for
5078 an incremental link; allocate space from free list for an
5080 (Output_section::add_output_section_data): Allocate space from
5081 free list for an incremental update.
5082 (Output_section::update_data_size): New function.
5083 (Output_section::set_fixed_layout): New function.
5084 (Output_section::reserve): New function.
5085 (Output_segment::set_section_addresses): Remove const.
5086 (Output_segment::set_section_list_addresses): Remove const; allocate
5087 space from free list for an incremental update.
5088 (Output_segment::set_offset): Adjust size of RELRO segment for an
5090 * output.h (Output_data::current_data_size): Move here from
5092 (Output_data::pre_finalize_data_size): New function.
5093 (Output_data::update_data_size): New function.
5094 (Output_section_headers::update_data_size): new function.
5095 (Output_section_data_build::current_data_size): Move to Output_data.
5096 (Output_data_strtab::update_data_size): New function.
5097 (Output_section::current_data_size): Move to Output_data.
5098 (Output_section::set_fixed_layout): New function.
5099 (Output_section::has_fixed_layout): New function.
5100 (Output_section::reserve): New function.
5101 (Output_section::update_data_size): New function.
5102 (Output_section::has_fixed_layout_): New data member.
5103 (Output_section::free_list_): New data member.
5104 (Output_segment::set_section_addresses): Remove const.
5105 (Output_segment::set_section_list_addresses): Remove const.
5106 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5108 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5110 * readsyms.cc (Read_symbols::do_read_symbols): Add library
5111 parameter when calling Add_symbols constructor; store argument
5112 serial number for members of a lib group.
5113 (Add_symbols::locks): Allow case where token == NULL.
5114 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5115 (Read_member::~Read_member): New function.
5116 (Read_member::is_runnable): New function.
5117 (Read_member::locks): New function.
5118 (Read_member::run): New function.
5119 (Check_script::~Check_script): New function.
5120 (Check_script::is_runnable): New function.
5121 (Check_script::locks): New function.
5122 (Check_script::run): New function.
5123 (Check_library::~Check_library): New function.
5124 (Check_library::is_runnable): New function.
5125 (Check_library::locks): New function.
5126 (Check_library::run): New function.
5127 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5128 (Add_symbols::library_): New data member.
5129 (class Read_member): New class.
5130 (class Check_script): New class.
5131 (class Check_library): New class.
5132 * reloc.cc (Read_relocs::is_runnable): Allow case where
5134 (Read_relocs::locks): Likewise.
5135 (Scan_relocs::locks): Likewise.
5136 (Relocate_task::locks): Likewise.
5137 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5139 (Sized_relobj::incremental_relocs_scan): Fix comment.
5140 (Sized_relobj::do_relocate): Pass output file offset to
5141 write_local_symbols.
5142 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5143 from class declaration.
5144 * script.cc (read_input_script): Allocate Script_info; pass
5145 argument serial number to report_script.
5146 * script.h (class Script_info): Move to incremental.h.
5147 * symtab.cc (Symbol_table::add_from_incrobj): New function.
5148 * symtab.h (Symbol_table::add_from_incrobj): New function.
5149 (Symbol_table::set_file_offset): New function.
5151 2011-04-05 Cary Coutant <ccoutant@google.com>
5153 * incremental-dump.cc (dump_incremental_inputs): Change signature
5154 to take a Sized_incremental_binary; change caller. Use readers
5155 in Sized_incremental_binary.
5157 (Sized_incremental_binary::find_incremental_inputs_sections):
5158 Rename do_find_incremental_inputs_sections to this.
5159 (Sized_incremental_binary::setup_readers): New function.
5160 (Sized_incremental_binary::do_check_inputs): Check
5161 has_incremental_info_ flag; move setup code to setup_readers;
5163 (Sized_incremental_binary::do_file_is_unchanged): New function.
5164 (Sized_incremental_binary::do_get_input_reader): New function.
5165 * incremental.h (class Incremental_binary): Move to end of file.
5166 (Incremental_binary::file_is_unchanged): New function.
5167 (Incremental_binary::do_file_is_unchanged): New function.
5168 (Incremental_binary::Input_reader): New class.
5169 (Incremental_binary::get_input_reader): New function.
5170 (class Sized_incremental_binary): Move to end of file.
5171 (Sized_incremental_binary::Sized_incremental_binary): Setup the
5172 input section reader classes.
5173 (Sized_incremental_binary::has_incremental_info): New function.
5174 (Sized_incremental_binary::inputs_reader): New function.
5175 (Sized_incremental_binary::symtab_reader): New function.
5176 (Sized_incremental_binary::relocs_reader): New function.
5177 (Sized_incremental_binary::got_plt_reader): New function.
5178 (Sized_incremental_binary::do_file_is_unchanged): New function.
5179 (Sized_incremental_binary::Sized_input_reader): New class.
5180 (Sized_incremental_binary::get_input_reader): New function.
5181 (Sized_incremental_binary::find_incremental_inputs_sections):
5182 Rename do_find_incremental_inputs_sections to this.
5183 (Sized_incremental_binary::setup_readers): New function.
5184 (Sized_incremental_binary::has_incremental_info_): New data member.
5185 (Sized_incremental_binary::inputs_reader_): New data member.
5186 (Sized_incremental_binary::symtab_reader_): New data member.
5187 (Sized_incremental_binary::relocs_reader_): New data member.
5188 (Sized_incremental_binary::got_plt_reader_): New data member.
5189 (Sized_incremental_binary::current_input_file_): New data member.
5191 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
5194 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5197 2011-03-30 Cary Coutant <ccoutant@google.com>
5199 * archive.cc (Archive::include_member): Adjust call to report_object.
5200 (Add_archive_symbols::run): Add script_info to call to
5201 report_archive_begin.
5202 (Lib_group::include_member): Adjust call to report_object.
5203 (Add_lib_group_symbols::run): Adjust call to report_object.
5204 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5205 blocks. Add object count for script input files.
5206 * incremental.cc (Incremental_inputs::report_archive_begin): Add
5207 script_info parameter; change all callers.
5208 (Incremental_inputs::report_object): Add script_info parameter;
5210 (Incremental_inputs::report_script): Store backpointer to
5211 incremental info entry.
5212 (Output_section_incremental_inputs::set_final_data_size): Record
5213 additional information for scripts.
5214 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5215 * incremental.h (Incremental_script_entry::add_object): New function.
5216 (Incremental_script_entry::get_object_count): New function.
5217 (Incremental_script_entry::get_object): New function.
5218 (Incremental_script_entry::objects_): New data member; adjust
5220 (Incremental_inputs::report_archive_begin): Add script_info parameter.
5221 (Incremental_inputs::report_object): Add script_info parameter.
5222 (Incremental_inputs_reader::get_object_count): New function.
5223 (Incremental_inputs_reader::get_object_offset): New function.
5224 * options.cc (Input_arguments::add_file): Return reference to
5226 * options.h (Input_argument::set_script_info): New function.
5227 (Input_argument::script_info): New function.
5228 (Input_argument::script_info_): New data member; adjust all
5230 (Input_file_group::add_file): Return reference to new input argument.
5231 (Input_file_lib::add_file): Likewise.
5232 (Input_arguments::add_file): Likewise.
5233 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5234 * script.cc (Parser_closure::Parser_closure): Add script_info
5235 parameter; adjust all callers.
5236 (Parser_closure::script_info): New function.
5237 (Parser_closure::script_info_): New data member.
5238 (read_input_script): Report scripts earlier to incremental info.
5239 (script_add_file): Set script_info in Input_argument.
5240 (script_add_library): Likewise.
5241 * script.h (Script_options::Script_info): Rewrite class.
5243 2011-03-29 Cary Coutant <ccoutant@google.com>
5245 * archive.cc (Library_base::should_include_member): Move
5246 method here from class Archive.
5247 (Archive::Archive): Initialize base class.
5248 (Archive::should_include_member): Move to base class.
5249 (Archive::do_for_all_unused_symbols): New function.
5250 (Add_archive_symbols::run): Remove redundant access to
5252 (Lib_group::Lib_group): Initialize base class.
5253 (Lib_group::do_filename): New function.
5254 (Lib_group::include_member): Pass pointer to Lib_group to
5256 (Lib_group::do_for_all_unused_symbols): New function.
5257 (Add_lib_group_symbols::run): Report archive information for
5259 * archive.h (class Library_base): New base class.
5260 (class Archive): Derive from Library_base.
5261 (Archive::filename): Move to base class.
5262 (Archive::set_incremental_info): Likewise.
5263 (Archive::incremental_info): Likewise.
5264 (Archive::Should_include): Likewise.
5265 (Archive::should_include_member): Likewise.
5266 (Archive::Armap_entry): Remove.
5267 (Archive::Unused_symbol_iterator): Remove.
5268 (Archive::unused_symbols_begin): Remove.
5269 (Archive::unused_symbols_end): Remove.
5270 (Archive::do_filename): New function.
5271 (Archive::do_get_mtime): New function.
5272 (Archive::do_for_all_unused_symbols): New function.
5273 (Archive::task_): Move to base class.
5274 (Archive::incremental_info_): Likewise.
5275 (class Lib_group): Derive from Library_base.
5276 (Lib_group::do_filename): New function.
5277 (Lib_group::do_get_mtime): New function.
5278 (Lib_group::do_for_all_unused_symbols): New function.
5279 (Lib_group::task_): Move to base class.
5280 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5282 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5284 * incremental.cc (Incremental_inputs::report_archive_begin):
5285 Use Library_base; call library's get_mtime; add incremental inputs
5286 entry before members.
5287 (class Unused_symbol_visitor): New class.
5288 (Incremental_inputs::report_archive_end): Use Library_base; use
5289 visitor class to record unused symbols; don't add incremental inputs
5290 entry after members.
5291 (Incremental_inputs::report_object): Use Library_base.
5293 (Incremental_archive_entry::Incremental_archive_entry): Remove
5294 unused Archive parameter.
5295 (Incremental_inputs::report_archive_begin): Use Library_base.
5296 (Incremental_inputs::report_archive_end): Likewise.
5297 (Incremental_inputs::report_object): Likewise.
5298 * object.cc (Sized_relobj::do_for_all_global_symbols): New
5300 * object.h (Object::for_all_global_symbols): New function.
5301 (Object::do_for_all_global_symbols): New function.
5302 (Sized_relobj::do_for_all_global_symbols): New function.
5303 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
5305 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
5308 2011-03-27 Ian Lance Taylor <iant@google.com>
5310 * archive.cc (Archive::interpret_header): Return -1 if something
5311 goes wrong. Change callers accordingly.
5313 2011-03-25 Cary Coutant <ccoutant@google.com>
5315 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5316 * testsuite/Makefile.in: Regenerate.
5318 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
5320 * plugin.cc (get_view): New.
5321 (Plugin::load): Pass get_view to the plugin.
5322 (Plugin_manager::get_view): New.
5324 2011-03-21 Ian Lance Taylor <iant@google.com>
5326 * testsuite/final_layout.sh: Rewrite to not use dc.
5327 * testsuite/relro_test.sh: Fail if dc is not present.
5329 2011-03-21 Sriraman Tallam <tmsriram@google.com>
5331 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5333 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5334 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5336 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5337 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5339 2011-03-14 Ian Lance Taylor <iant@google.com>
5341 * script-sections.cc (Sort_output_sections::script_compare):
5342 Rename from is_before, change return type.
5343 (Sort_output_sections::operator()): Adjust accordingly.
5345 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
5348 * testsuite/odr_violation2.cc: Add comment to make all error line
5349 numbers double digits.
5350 * testsuite/debug_msg.sh: Adjust expected errors.
5352 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
5354 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5355 but mark earlier ones as non-canonical
5356 (offset_to_iterator): Update search target and example
5357 (do_addr2line): Return extra lines in a vector*
5358 (format_file_lineno): Extract from do_addr2line
5359 (one_addr2line): Add vector* out-param
5360 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5361 when a lineno entry appeared last for its instruction
5362 (Dwarf_line_info): Add vector* out-param
5363 * object.cc (Relocate_info): Pass NULL for the vector* out-param
5364 * symtab.cc (Odr_violation_compare): Include the lineno in the
5366 (linenos_from_loc): New. Combine the canonical line for an
5367 address with its other lines.
5368 (True_if_intersect): New. Helper functor to make
5369 std::set_intersection a query.
5370 (detect_odr_violations): Compare sets of lines instead of just
5371 one line for each function. This became less deterministic, but
5372 has fewer false positives.
5373 * symtab.h: Declarations.
5374 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5375 mix an optimized and non-optimized object in the same binary
5376 (odr_violation2.so): Same.
5377 * testsuite/Makefile.in: Regenerate from Makefile.am.
5378 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5379 * testsuite/debug_msg.sh: Update line numbers and add
5381 * testsuite/odr_violation1.cc: Use OdrDerived, in a
5382 non-optimized context.
5383 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5384 isn't inlined, and use OdrDerived in an optimized context.
5385 * testsuite/odr_header1.h: Defines OdrDerived, where
5386 optimization will change the
5387 first-instruction-in-the-destructor's file and line number.
5388 * testsuite/odr_header2.h: Defines OdrBase.
5390 2011-03-09 Ian Lance Taylor <iant@google.com>
5392 * fileread.cc (File_read::clear_views): Don't delete the whole
5395 2011-03-08 Ian Lance Taylor <iant@google.com>
5398 * fileread.cc: #include <climits>.
5399 (GOLD_IOV_MAX): Define.
5400 (File_read::read_multiple): Limit number of entries by iov_max.
5401 * fileread.h (class File_read): Always set max_readv_entries to
5404 2011-03-07 Ian Lance Taylor <iant@google.com>
5407 * options.h (class General_options): Add -dy and -dn.
5409 2011-03-02 Cary Coutant <ccoutant@google.com>
5411 * testsuite/script_test_9.t: Add TLS segment.
5413 2011-03-02 Simon Baldwin <simonb@google.com>
5415 * configure.ac: Add check for gnu_indirect_function support in
5416 the toolchain building binutils.
5417 * configure: Rebuild.
5419 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
5421 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5422 plugin only symbols.
5423 (Symbol_table::sized_finalize_symbol) Mark symbol only present
5424 in plugin files as not needed in the symbol table.
5426 2011-02-11 Sriraman Tallam <tmsriram@google.com>
5428 * output.cc (Output_section::add_input_section): Delay fill
5429 generation for section ordering.
5431 2011-02-09 Ian Lance Taylor <iant@google.com>
5434 * object.h (class Sized_relobj): Remove clear_local_symbols.
5435 * reloc.cc (Sized_relobj::do_relocate): Don't call
5436 clear_local_symbols.
5438 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
5440 * plugin.cc (is_visible_from_outside): Return true for symbols
5443 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
5445 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5448 2011-02-02 Sriraman Tallam <tmsriram@google.com>
5450 * icf.h (is_section_foldable_candidate): Change type of parameter
5452 * icf.cc (Icf::find_identical_sections): Change type of local variable
5453 section_name to be std::string.
5454 (is_function_ctor_or_dtor): Change type of parameter to std::string.
5456 2011-01-25 Ian Lance Taylor <iant@google.com>
5458 * script.cc (script_add_extern): Rewrite to use
5459 add_symbol_reference.
5461 2011-01-25 Doug Kwan <dougkwan@google.com>
5463 * icf.cc (get_section_contents): Always lock section's object.
5465 2011-01-24 Ian Lance Taylor <iant@google.com>
5467 * options.h (class General_options): Accept
5468 --no-detect-odr-violations.
5470 2011-01-24 Ian Lance Taylor <iant@google.com>
5472 * version.cc (version_string): Bump to 1.11.
5474 2011-01-24 Ian Lance Taylor <iant@google.com>
5476 * plugin.cc (class Plugin_rescan): Define new class.
5477 (Plugin_manager::claim_file): Set any_claimed_.
5478 (Plugin_manager::save_archive): New function.
5479 (Plugin_manager::save_input_group): New function.
5480 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5482 (Plugin_manager::new_undefined_symbol): New function.
5483 (Plugin_manager::rescan): New function.
5484 (Plugin_manager::rescannable_defines): New function.
5485 (Plugin_manager::add_input_file): Set any_added_.
5486 * plugin.h (class Plugin_manager): define new fields rescannable_,
5487 undefined_symbols_, any_claimed_, and any_added_. Declare
5488 Plugin_rescan as friend. Declare new functions.
5489 (Plugin_manager::Rescannable): Define type.
5490 (Plugin_manager::Rescannable_list): Define type.
5491 (Plugin_manager::Undefined_symbol_list): Define type.
5492 (Plugin_manager::Plugin_manager): Initialize new fields.
5493 * archive.cc (Archive::defines_symbol): New function.
5494 (Add_archive_symbols::run): Pass archive to plugins if any.
5495 * archive.h (class Archive): Declare defines_symbol.
5496 * readsyms.cc (Input_group::~Input_group): New function.
5497 (Finish_group::run): Pass input_group to plugins if any.
5498 * readsyms.h (class Input_group): Declare destructor.
5499 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5502 2011-01-10 Ian Lance Taylor <iant@google.com>
5504 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5506 (Layout::set_segment_offsets): Reset increase_relro before calling
5507 set_section_addresses a second time.
5509 2011-01-04 Cary Coutant <ccoutant@google.com>
5511 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5512 sections before NOBITS sections.
5514 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
5516 * version.cc (print_version): Update copyright to 2011.
5518 2010-12-23 Cary Coutant <ccoutant@google.com>
5520 * output.h (Output_data_reloc::add_output_section): Pass OD instead
5521 of OS to this->add. Add OD parameter to second form of the function.
5523 2010-12-20 Ian Lance Taylor <iant@google.com>
5525 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5526 second of two consecutive entries with same offset.
5528 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5530 * testsuite/Makefile.am (ifuncmain2static_LDADD)
5531 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5532 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5533 to avoid unneeded links against $(LDADD).
5534 * testsuite/Makefile.in: Regenerate.
5536 2010-12-15 Ian Lance Taylor <iant@google.com>
5539 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5540 for R_X86_64_32 and R_X86_64_PC32.
5541 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5542 ver_matching_def_pic.o.
5543 (ver_matching_def_pic.o): New target.
5545 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5547 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5548 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5549 Move definition before File_read::View member definitions.
5550 (File_read::View::~View): Initialize and hold lock before
5551 updating current_mapped_bytes.
5553 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5555 * dwarf_reader.cc: Remove outdated comment.
5556 * gold-threads.cc: Fix typo in error message.
5557 * archive.cc: Fix typos in comments.
5558 * archive.h: Likewise.
5559 * arm-reloc-property.cc: Likewise.
5560 * arm-reloc-property.h: Likewise.
5561 * arm-reloc.def: Likewise.
5563 * attributes.h: Likewise.
5564 * cref.cc: Likewise.
5565 * ehframe.cc: Likewise.
5566 * fileread.h: Likewise.
5568 * i386.cc: Likewise.
5570 * incremental.h: Likewise.
5571 * int_encoding.cc: Likewise.
5572 * layout.h: Likewise.
5573 * main.cc: Likewise.
5574 * merge.h: Likewise.
5575 * object.cc: Likewise.
5576 * object.h: Likewise.
5577 * options.cc: Likewise.
5578 * readsyms.cc: Likewise.
5579 * reduced_debug_output.cc: Likewise.
5580 * reloc.cc: Likewise.
5581 * script-sections.cc: Likewise.
5582 * sparc.cc: Likewise.
5583 * symtab.h: Likewise.
5584 * target-reloc.h: Likewise.
5585 * target.cc: Likewise.
5586 * target.h: Likewise.
5587 * timer.cc: Likewise.
5588 * timer.h: Likewise.
5589 * x86_64.cc: Likewise.
5591 2010-12-09 Cary Coutant <ccoutant@google.com>
5593 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5595 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5596 parameter; change all callers.
5597 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5598 * options.h (warn_execstack): New option.
5600 2010-12-07 Doug Kwan <dougkwan@google.com>
5602 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5603 like function call relocations.
5605 2010-12-07 Ian Lance Taylor <iant@google.com>
5607 * archive.cc (Archive::get_elf_object_for_member): Permit
5608 punconfigured to be NULL.
5609 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5610 (Archive::include_member): Pass NULL to get_elf_object_for_member
5611 if we searched for the archive and this is the first included
5614 2010-12-01 Ian Lance Taylor <iant@google.com>
5616 * dwarf_reader.h (class Sized_dwarf_line_info): Add
5617 track_relocs_type_ field.
5618 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5619 Set track_relocs_type_.
5620 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5621 contents when using RELA relocs.
5622 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5624 * reloc.cc (Track_relocs::next_addend): New function.
5625 * reloc.h (class Track_relocs): Declare next_addend.
5627 2010-12-01 Ian Lance Taylor <iant@google.com>
5629 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5632 2010-12-01 Ian Lance Taylor <iant@google.com>
5634 * README: Update compilers known to work and fail.
5636 2010-11-23 Matthias Klose <doko@ubuntu.com>
5638 * configure.in: For --enable-gold, handle value `default' instead of
5639 `both*'. Always install ld as ld.bfd, install as ld if gold is
5641 * configure: Regenerate.
5643 2010-11-18 Doug Kwan <dougkwan@google.com>
5645 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5646 and right_alignment to be zero. Store result alignment only if it is
5647 greater than existing alignment.
5649 2010-11-16 Cary Coutant <ccoutant@google.com>
5652 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5653 Check for ".zdebug_line".
5655 2010-11-16 Doug Kwan <dougkwan@google.com>
5656 Cary Coutant <ccoutant@google.com>
5658 * output.h (Output_segment::set_section_addresses): Pass increase_relro
5659 by reference; adjust all callers.
5660 * output.cc (Output_segment::set_section_addresses): Adjust references
5661 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5663 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5664 end at page boundary.
5666 2010-11-16 Cary Coutant <ccoutant@google.com>
5669 * layout.cc (Layout::choose_output_section): Transform names of
5670 compressed sections even when using a script with a SECTIONS clause.
5671 (Layout::output_section_name): Remove code to transform
5672 compressed debug section names.
5673 * output.cc (Output_section::add_input_section): Use uncompressed
5674 section size when tracking input sections.
5676 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
5678 * symtab.h (Symbol::NON_PIC_REF): Remove.
5679 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5680 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
5681 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5682 (Symbol::use_plt_offset): Take a flags argument and pass it
5683 directly to needs_dynamic_reloc. Restrict check for undefined
5684 weak symbols to function calls.
5685 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5686 (Target_arm::Scan::global): Use it.
5687 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5688 (Target_arm::Relocate::relocate): Likewise.
5689 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5690 parameter with an r_type parameter. Use get_reference_flags
5692 (Target_arm::Relocate::relocate): Update accordingly.
5693 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5694 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5695 (Target_i386::Scan::global): Likewise.
5696 (Target_i386::Relocate::relocate): Likewise.
5697 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5698 parameter with an r_type parameter. Use get_reference_flags
5700 (Target_i386::Relocate::relocate): Update accordingly.
5701 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5702 (Target_powerpc::Scan::global): Use it.
5703 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5704 (Target_powerpc::Relocate::relocate): Likewise.
5705 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5706 (Target_sparc::Scan::global): Use it.
5707 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5708 (Target_sparc::Relocate::relocate): Likewise.
5709 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5710 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5711 (Target_x86_64::Scan::global): Likewise.
5712 (Target_x86_64::Relocate::relocate): Likewise.
5714 2010-11-08 Doug Kwan <dougkwan@google.com>
5715 Cary Coutant <ccoutant@google.com>
5717 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5718 (Arm_exidx_merge_section::section_contents_): New data member.
5719 (Arm_input_section::Arm_input_section): Initialize original_contents_.
5720 (Arm_input_section::~Arm_input_section): De-allocate memory.
5721 (Arm_input_section::original_contents_): New data member.
5722 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5723 in parameters instead of calling Object::section_contents without
5725 (Arm_output_section::group_section): New parameter TASK. Pass it
5726 to callees that need locking objects.
5727 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
5728 to lock EXIDX input sections. Fix a formatting issue. Call
5729 Arm_exidx_merged_section::build_contents to create merged section
5731 (Arm_output_section::create_stub_group): New parameter TASK. Use it
5732 to lock object of stub table owner.
5733 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5734 TEXT_SIZE to initialize data member TEXT_SIZE_.
5735 (Arm_exidx_input_section::addralign): Fix typo in comment.
5736 (Arm_exidx_input_section::text_size): New method.
5737 (Target_arm::do_relax): New parameter TASK. Pass it to callees
5738 that require locking objects. Lock objects before scanning for stubs
5739 and updating local symbols.
5740 (Arm_input_section<big_endian>::init): Copy contents of original
5742 (Arm_input_section<big_endian>::do_write): Use saved contents of
5743 original input section instead of calling Object::section_contents
5745 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5746 size without calling Object::section_size().
5747 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5748 for size. Allocate a buffer for merged EXIDX entries.
5749 (Arm_exidx_merged_section::build_contents): New method.
5750 (Arm_exidx_merged_section::do_write): Move merge section contents
5751 building code to Arm_exidx_merged_section::build_contetns. Write
5752 out contetns in buffer instead of building it on the fly.
5753 (Arm_relobj::make_exidx_input_section): Also pass text section size
5754 to Arm_exidx_input_section constructor.
5755 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
5756 (Arm_dynobj::do_read_symbols): Fix memory leak.
5757 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5758 * target.h: (class Task): Add forward declaration.
5759 (Target::relax): Add new parameter TASK and pass it to
5761 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
5763 2010-11-05 Cary Coutant <ccoutant@google.com>
5766 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5767 object when reading from the file.
5768 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5770 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5771 when reading section contents.
5772 (get_section_contents): Likewise.
5773 (icf::find_identical_sections): Likewise.
5774 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5775 object when reading from the file.
5776 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5777 the object when doing deferred section layout.
5779 2010-11-03 Nick Clifton <nickc@redhat.com>
5782 * script.h (class Symbol_assignment: name): New member. Returns
5783 the name of the symbol.
5784 * scrfipt.cc (Script_options::is_pending_assignment): New member.
5785 Returns true if the given symbol name is on the list of
5786 assignments wating to be processed.
5787 * archive.cc (should_incldue_member): If the symbol is undefined,
5788 check to see if it is on the list of symbols pending assignment.
5790 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
5792 * script-sections.cc (Script_sections::find_memory_region): Check
5793 for a NULL output section pointer.
5795 2010-10-29 Doug Kwan <dougkwan@google.com>
5797 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5798 Output_section::add_relaxed_input_section.
5799 * output.cc (Output_section::add_relaxed_input_section): Add new
5800 arguments LAYOUT and NAME. Set section order index.
5801 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5802 Copy section order index.
5803 * output.h (Output_section::add_relaxed_input_section): Add new
5804 arguments LAYOUT and NAME.
5806 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5808 * testsuite/Makefile.am: Move gcctestdir/ld rule to
5809 NATIVE_OR_CROSS_LINKER.
5810 * testsuite/Makefile.in: Regenerate.
5812 2010-10-20 Doug Kwan <dougkwan@google.com>
5814 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5815 without SHF_LINK_ORDER flags.
5816 * layout.cc (Layout::choose_output_section): Do not filter
5817 SHF_LINK_ORDER flag in a relocatable link.
5819 2010-10-17 Cary Coutant <ccoutant@google.com>
5821 * output.h (Output_segment::set_section_addresses): Change function
5822 signature. Update all callers.
5823 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5825 (Output_segment::set_section_addresses): Align after last TLS
5826 section. Add padding before last relro section instead of after.
5828 2010-10-17 Doug Kwan <dougkwan@google.com>
5830 * gold/arm.cc (Target_arm::got_section): Use correct order and set
5831 GOT output section to be writable.
5833 2010-10-14 Cary Coutant <ccoutant@google.com>
5835 * debug.h (DEBUG_INCREMENTAL): New flag.
5836 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5837 * gold.cc (queue_initial_tasks): Check parameters for incremental link
5839 * incremental.cc (report_command_line): Ignore all forms of
5841 * layout.cc (Layout::Layout): Check parameters for incremental link
5843 * options.cc (General_options::parse_incremental): New function.
5844 (General_options::parse_no_incremental): New function.
5845 (General_options::parse_incremental_full): New function.
5846 (General_options::parse_incremental_update): New function.
5847 (General_options::incremental_mode_): New data member.
5848 (General_options::finalize): Check incremental_mode_.
5849 * options.h (General_options): Update help text for --incremental.
5850 Add --no-incremental, --incremental-full, --incremental-update.
5851 (General_options::Incremental_mode): New enum type.
5852 (General_options::incremental_mode): New function.
5853 (General_options::incremental_mode_): New data member.
5854 * parameters.cc (Parameters::incremental_mode_): New data member.
5855 (Parameters::set_options): Set incremental_mode_.
5856 (Parameters::set_incremental_full): New function.
5857 (Parameters::incremental): New function.
5858 (Parameters::incremental_update): New function.
5859 (set_parameters_incremental_full): New function.
5860 * parameters.h (Parameters::set_incremental_full): New function.
5861 (Parameters::incremental): New function.
5862 (Parameters::incremental_update): New function.
5863 (Parameters::incremental_mode_): New data member.
5864 (set_parameters_incremental_full): New function.
5865 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5866 incremental link mode.
5867 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5868 (Sized_relobj::do_relocate_sections): Likewise.
5869 * testsuite/Makefile.am (incremental_test): Use --incremental-full
5871 * testsuite/Makefile.in: Regenerate.
5872 * testsuite/incremental_test.sh: Filter all forms of --incremental.
5874 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5876 * script-sections.h (class Script_sections): Make
5877 Sections_elements typedef public.
5878 * script-sections.cc (class Sort_output_sections): Add elements_
5879 field. Add constructor which sets it; change all callers.
5880 (Sort_output_sections::is_before): New function.
5881 (Sort_output_sections::operator()): Call is_before.
5882 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5884 * testsuite/script_test_10.sh: New test. Test script section
5886 * testsuite/script_test_10.t: Likewise.
5887 * testsuite/script_test_10.s: Likewise.
5888 * testsuite/Makefile.am: Wrap the cross linker tests and the
5889 common tests into NATIVE_OR_CROSS_LINKER.
5890 (check_SCRIPTS): Add script_test_10.sh.
5891 (check_DATA): Add script_test_10.stdout.
5892 (script_test_10.o, script_test_10): New targets.
5893 (script_test_10.stdout): New target.
5894 * configure, testsuite/Makefile.in: Regenerate.
5896 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5898 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5899 error for the deprecated relocations.
5900 (Target_arm::Scan::global): Likewise.
5901 (Target_arm::Relocate::relocate): Likewise.
5903 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
5905 * fileread.cc (Input_file::find_file): Initialize *found_name
5906 and *namep when using the fallback search for case 4.
5908 2010-10-11 Cary Coutant <ccoutant@google.com>
5910 * options.h (class General_options): Redefine -z lazy as an alias for
5911 the negation of -z now.
5913 2010-10-11 Ian Lance Taylor <iant@google.com>
5915 * resolve.cc (symbol_to_bits): Report the value of the unsupported
5918 2010-10-06 Nick Clifton <nickc@redhat.com>
5920 * script-sections.cc(class Memory_region): Remove
5921 current_lma_offset_ field. Rename current_vma_offset_ to
5922 current_offset_. Add last_section_ field.
5923 (Memory_region::get_current_vma_address): Rename to
5924 get_current_address.
5925 (Memory_region::get_current_lma_address): Delete.
5926 (Memory_region::increment_vma_offset): Rename to
5928 (Memory_region::increment_lma_offset): Delete.
5929 (Memory_region::attributes_compatible): New method. Returns
5930 true if the provided section is compatible with the region.
5931 (Memory_region::get_last_section): New method. Returns the last
5932 section to use the region.
5933 (Memory_region::set_last_section): New method. Stores the last
5934 section to use the region.
5935 (Script_sections::block_in_region): New method. Returns true if
5936 a block of memory is contained within a region.
5937 (Script_sections::find_memory_region): New method. Locates a
5938 memory region to be used to set a VMA or LMA address.
5939 (Output_section_definition::set_section_addresses): Add code to
5940 check for addresses set by memory regions.
5941 (Output_segment::set_section_addresses): Remove memory region
5943 (Script_sections::create_segment): Add a warning if a header
5944 segment is created outside of any region.
5945 * script-sections.h (class Script_sections): Add prototypes for
5946 find_memory_region and block_in_region methods.
5947 * testsuite/memory_test.s: Use .long instead of .word.
5948 * testsuite/memory_test.t: Add some more output sections.
5949 * testsuite/memory_test.sh: Update expected output.
5951 2010-10-02 Doug Kwan <dougkwan@google.com>
5953 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5954 defintion to symtab.h
5955 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5956 declaration to defintion.
5958 2010-10-01 Nick Clifton <nickc@redhat.com>
5960 * expression.cc (eval): Replace dummy argument with NULL.
5961 (eval_maybe_dot): Check for a NULL result section pointer.
5962 (Symbol_expression::value): Likewise.
5963 (Dot_expression::value): Likewise.
5964 (BINARY_EXPRESSION): Likewise.
5965 (Max_expression::value): Likewise.
5966 (Min_expression::value): Likewise.
5967 (Absolute_expression::value): Likewise.
5968 (Addr_expression::value_from_output_section): Likewise.
5969 (Loaddddr_expression::value_from_output_section): Likewise.
5970 (Segment_start_expression::value): Likewise.
5971 * script-sections.cc
5972 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5974 (Sections_elememt_dot_assignment::set_section_addresses):
5976 (Output_data_expression::do_write_to_buffer): Likewise.
5977 (Output_section_definition::finalize_symbols): Likewise.
5978 (Output_section_definition::set_section_addresses): Likewise.
5980 2010-09-30 Doug Kwan <dougkwan@google.com>
5982 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5984 2010-09-28 Sriraman Tallam <tmsriram@google.com>
5986 * target.h (Target::can_icf_inline_merge_sections): New virtual
5988 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5990 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5992 * icf.cc (get_section_contents): Inline merge sections only when
5995 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5997 * configure: Regenerate.
5999 2010-09-17 Ian Lance Taylor <iant@google.com>
6001 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6002 * testsuite/Makefile.am (memory_test.o): New target.
6003 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6005 * testsuite/Makefile.in: Rebuild.
6007 2010-09-17 Doug Kwan <dougkwan@google.com>
6009 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6010 defintion if relocation uses GOT entries of the symbol.
6011 * testsuite/icf_safe_test.sh: Fix test.
6012 * testsuite/icf_safe_so_test.sh: Fix test.
6014 2010-09-16 Cary Coutant <ccoutant@google.com>
6016 * script_sections.cc (class Memory_region): Remove "NULL" from
6017 vector initializations.
6019 2010-09-15 Cary Coutant <ccoutant@google.com>
6021 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6022 Resolve forwarding symbols.
6024 2010-09-15 Doug Kwan <dougkwan@google.com>
6026 * gold/testsuite/script_test_3.t: Add ARM special sections.
6027 * gold/testsuite/script_test_4.t: Same.
6028 * gold/testsuite/script_test_5.t: Same.
6029 * gold/testsuite/script_test_6.t: Same.
6030 * gold/testsuite/script_test_7.t: Same.
6031 * gold/testsuite/script_test_7.t: Same.
6032 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6034 2010-09-14 Cary Coutant <ccoutant@google.com>
6036 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6037 (Target_x86_64::Relocate::relocate_tls): Replace check for
6038 saw_tls_block_reloc_ with test for executable section.
6040 2010-09-12 Cary Coutant <ccoutant@google.com>
6042 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6043 position-independent executables to shared libraries need dynamic
6045 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6046 position-independent executables.
6047 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6048 * testsuite/Makefile.in: Regenerate.
6050 2010-09-10 Nick Clifton <nickc@redhat.com>
6053 * testsuite/memory_test.t: Discard any sections that are not
6056 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
6059 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6060 "This::" to work around a bug in gcc 4.2.
6062 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6064 2010-09-09 Rafael Espindola <espindola@google.com>
6066 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6067 sections with different PF_X flags in the same segment.
6068 (Layout::find_first_load_seg): Search all segments to find the first
6070 * options.h (rosegment): New.
6072 2010-09-08 Rafael Espindola <espindola@google.com>
6074 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6076 2010-09-08 Doug Kwan <dougkwan@google.com>
6078 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6079 (Arm_relobj::do_relocate_sections): Add new parameter for output
6080 file to match the parent.
6081 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6082 of local symbols instead of input values. Update code to track
6083 changes in gold::relocate_section.
6084 * object.cc (Sized_relobj::compute_final_local_value): New methods.
6085 (Sized_relobj::compute_final_local_value_internal): New methods.
6086 (Sized_relobj::do_finalize_local_symbols): Move code from loop
6087 body into private version of Sized_relobj::compute_final_local_value.
6088 Call the inline method.
6089 * object.h (Symbol_value::Symbol_value): Define destructor. Free
6090 merged symbol value if there is one.
6091 (Symbol_value::has_output_value): New method defintiion.
6092 (Sized_relobj::Compute_final_local_value_status): New enum type.
6093 (Sized_relobj::compute_final_local_value): New methods.
6094 (Sized_relobj::compute_final_local_value_internal): New methods.
6095 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6096 and arm_cortex_a8.sh.
6097 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6098 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6100 * Makefile.in: Regenerate.
6101 * testsuite/arm_bl_out_of_range.s: Update test.
6102 * testsuite/thumb_bl_out_of_range.s: Ditto.
6103 * testsuite/thumb_blx_out_of_range.s: Ditto.
6104 * testsuite/arm_branch_out_of_range.sh: New file.
6105 * testsuite/arm_cortex_a8.sh: Ditto.
6106 * testsuite/arm_cortex_a8_b.s: Ditto.
6107 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6108 * testsuite/arm_cortex_a8_b_local.s: Ditto.
6109 * testsuite/arm_cortex_a8_bl.s: Ditto.
6110 * testsuite/arm_cortex_a8_blx.s: Ditto.
6111 * testsuite/arm_cortex_a8_local.s: Ditto.
6112 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6113 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6115 2010-09-08 Rafael Espindola <espindola@google.com>
6117 * Makefile.am (memory_test.stdout): Run readelf with -W.
6118 * Makefile.in: Regenerate.
6119 * testsuite/memory_test.sh: Make the regexps accept both 32 and
6122 2010-09-08 Rafael Espindola <espindola@google.com>
6124 * script-sections.cc (Script_sections::add_memory_region): Convert
6125 field precision to int.
6126 * script.cc (script_set_section_region, script_set_section_region):
6127 Convert field precision to int.
6129 2010-09-08 Rafael Espindola <espindola@google.com>
6131 * arm.cc (do_finalize_sections): Create the __exidx_start and
6132 __exdix_end symbols even when the section is missing.
6134 2010-09-08 Nick Clifton <nickc@redhat.com>
6136 * README: Remove claim that MEMORY is not supported.
6137 * expression.cc (script_exp_function_origin)
6138 (script_exp_function_length): Move from here to ...
6139 * script.cc: ... here.
6140 (script_set_section_region, script_add_memory)
6141 (script_parse_memory_attr, script_include_directive): New
6143 * script-sections.cc
6144 (class Memory_region): New class.
6145 (class Output_section_definition): Add set_memory_region,
6146 set_section_vma, set_section_lma and get_section_name methods.
6147 (class Script_Sections): Add add_memory_region,
6148 find_memory_region, find_memory_region_origin,
6149 find_memory_region_length and set_memory_region methods.
6150 Have set_section_addresses method walk the list of set memory
6152 Extend the print methos to display memory regions.
6153 * script-sections.h: Add prototypes for new methods.
6154 Add enum for MEMORY region attributes.
6155 * yyscript.y: Add support for parsing MEMORY regions.
6156 * script-c.h: Add prototypes for new functions.
6157 * testsuite/Makefile.am: Add test of MEMORY region functionality.
6158 * testsuite/Makefile.in: Regenerate.
6159 * testsuite/memory_test.sh: New script.
6160 * testsuite/memory_test.s: New assembler source file.
6161 * testsuite/memory_test.t: New linker script.
6163 2010-08-27 Doug Kwan <dougkwan@google.com>
6165 * gold/resolve.cc (Symbol_table::should_override): Let a weak
6166 reference override an existing dynamic weak reference.
6167 * testsuite/Makefile.am: Add new test dyn_weak_ref.
6168 * testsuite/Makefile.in: Regenerate.
6169 * testsuite/dyn_weak_ref.sh: New file.
6170 * testsuite/dyn_weak_ref_1.c: Ditto.
6171 * testsuite/dyn_weak_ref_2.c: Ditto.
6173 2010-08-27 Ian Lance Taylor <iant@google.com>
6175 * incremental.h (class Incremental_input_entry): Add virtual
6178 2010-08-27 Ian Lance Taylor <iant@google.com>
6180 * testsuite/start_lib_test_3.c: Mark t3 as used.
6182 2010-08-27 Nick Clifton <nickc@redhat.com>
6184 * options.cc (version_script): Fix small typo in previous
6187 2010-08-25 Nick Clifton <nickc@redhat.com>
6189 * archive.cc: Formatting fixes: Remove whitespace between
6190 typename and following asterisk. Remove whitespace between
6191 function name and opening parenthesis.
6192 * archive.h: Likewise.
6194 * attributes.cc: Likewise.
6195 * attributes.h: Likewise.
6196 * common.cc: Likewise.
6197 * copy-relocs.cc: Likewise.
6198 * dirsearch.h: Likewise.
6199 * dynobj.cc: Likewise.
6200 * ehframe.cc: Likewise.
6201 * ehframe.h: Likewise.
6202 * expression.cc: Likewise.
6203 * fileread.cc: Likewise.
6204 * fileread.h: Likewise.
6206 * gold-threads.cc: Likewise.
6207 * gold.cc: Likewise.
6208 * i386.cc: Likewise.
6210 * incremental-dump.cc: Likewise.
6211 * incremental.cc: Likewise.
6212 * layout.cc: Likewise.
6213 * layout.h: Likewise.
6214 * main.cc: Likewise.
6215 * merge.cc: Likewise.
6216 * merge.h: Likewise.
6217 * object.cc: Likewise.
6218 * object.h: Likewise.
6219 * options.cc: Likewise.
6220 * options.h: Likewise.
6221 * output.cc: Likewise.
6222 * output.h: Likewise.
6223 * plugin.cc: Likewise.
6224 * plugin.h: Likewise.
6225 * powerpc.cc: Likewise.
6226 * reloc.cc: Likewise.
6227 * script-c.h: Likewise.
6228 * script-sections.cc: Likewise.
6229 * script.cc: Likewise.
6230 * stringpool.cc: Likewise.
6231 * symtab.cc: Likewise.
6232 * symtab.h: Likewise.
6233 * target.cc: Likewise.
6234 * timer.cc: Likewise.
6235 * timer.h: Likewise.
6236 * version.cc: Likewise.
6237 * x86_64.cc: Likewise.
6239 2010-08-24 Nick Clifton <nickc@redhat.com>
6242 * layout.cc (segment_precedes): Sort segments by their physical
6243 addresses, if they have been set.
6245 2010-08-23 Cary Coutant <ccoutant@google.com>
6247 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6249 (Lib_group::include_member): Unlock object after deleting its
6251 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6254 2010-08-19 Neil Vachharajani <nvachhar@google.com>
6255 Cary Coutant <ccoutant@google.com>
6257 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6258 constructor, and set_blocker.
6259 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6261 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6262 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6263 * testsuite/Makefile.am (start_lib_test): New test case.
6264 * testsuite/Makefile.in: Regenerate.
6265 * testsuite/start_lib_test_main.c: New file.
6266 * testsuite/start_lib_test_1.c: New file.
6267 * testsuite/start_lib_test_2.c: New file.
6268 * testsuite/start_lib_test_3.c: New file.
6270 2010-08-19 Ian Lance Taylor <iant@google.com>
6272 * Makefile.in: Rebuild with automake 1.11.1.
6273 * aclocal.m4: Likewise.
6274 * testsuite/Makefile.in: Likewise.
6276 2010-08-19 Ian Lance Taylor <iant@google.com>
6279 * i386.cc (class Output_data_plt_i386): Update declarations.
6280 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
6281 local_ifuncs_ fields.
6282 (Target_i386::do_plt_section_for_global): New function.
6283 (Target_i386::do_plt_section_for_local): New function.
6284 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6285 parameter; change all callers. Initialize global_ifuncs_ and
6286 local_ifuncs_. If doing a static link define __rel_iplt_start and
6288 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6289 (Output_data_plt_i386::add_local_ifunc_entry): New function.
6290 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6292 (Target_i386::make_plt_section): New function, broken out of
6293 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
6294 (Target_i386::make_plt_entry): Call make_plt_section.
6295 (Target_i386::make_local_ifunc_plt_entry): New function.
6296 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6297 (Target_i386::Scan::local): Handle IFUNC symbols. Add
6298 R_386_IRELATIVE to switch.
6299 (Target_i386::Scan::global): Likewise.
6300 (Target_i386::Relocate::relocate): Likewise.
6301 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6303 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6304 (Target_x86_64::do_plt_section_for_global): New function.
6305 (Target_x86_64::do_plt_section_for_local): New function.
6306 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6307 parameter; change all callers. If doing a static link define
6308 __rela_iplt_start and __rela_iplt_end.
6309 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6310 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6311 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6313 (Target_x86_64::make_local_ifunc_plt_entry): New function.
6314 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6316 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6317 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
6318 R_X86_64_IRELATIVE to switch.
6319 (Target_x86_64::Scan::global): Likewise.
6320 (Target_x86_64::Relocate::relocate): Likewise.
6321 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6323 * target.h (class Target): Add plt_section_for_global and
6324 plt_section_for_local functions. Add do_plt_section_for_global
6325 and do_plt_section_for_local virtual functions.
6326 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
6327 clarifying comments.
6328 (Symbol::use_plt_offset): Handle IFUNC symbol.
6329 * object.cc (Sized_relobj::Sized_relobj): Initialize
6331 (Sized_relobj::local_has_plt_offset): New function.
6332 (Sized_relobj::local_plt_offset): New function.
6333 (Sized_relobj::set_local_plt_offset): New function.
6334 (Sized_relobj::do_count): Handle IFUNC symbol.
6335 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
6336 a bit away from input_shndx_ field. Add set_is_func_symbol and
6337 is_ifunc_symbol functions.
6338 (class Sized_relobj): Update declarations. Remove Tls_got_entry
6339 and Local_tls_got_offsets. Define Local_plt_offsets. Add
6340 local_plt_offsets_ field.
6341 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6342 * output.h (class Output_section_data): Add non-const
6343 output_section function.
6344 (class Output_data_got): Update declarations.
6345 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6346 Add use_plt_offset parameter to global and local constructors.
6347 Change all callers. Change local_sym_index_ field to 31 bits.
6348 Change GSYM_CODE and CONSTANT_CODE accordingly.
6349 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6350 doing a static link don't set sh_link field.
6351 (Output_data_got::Got_entry::write): Use PLT offset if
6353 (Output_data_got::add_global_plt): New function.
6354 (Output_data_got::add_local_plt): New function.
6355 * target-reloc.h (relocate_section): Handle IFUNC symbol.
6356 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6357 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6358 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6359 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6361 * testsuite/ifunc-sel.h: New file.
6362 * testsuite/ifuncmain1.c: New file.
6363 * testsuite/ifuncmain1vis.c: New file.
6364 * testsuite/ifuncmod1.c: New file.
6365 * testsuite/ifuncdep2.c: New file.
6366 * testsuite/ifuncmain2.c: New file.
6367 * testsuite/ifuncmain3.c: New file.
6368 * testsuite/ifuncmod3.c: New file.
6369 * testsuite/ifuncmain4.c: New file.
6370 * testsuite/ifuncmain5.c: New file.
6371 * testsuite/ifuncmod5.c: New file.
6372 * testsuite/ifuncmain6pie.c: New file.
6373 * testsuite/ifuncmod6.c: New file.
6374 * testsuite/ifuncmain7.c: New file.
6375 * configure, testsuite/Makefile.in: Rebuild.
6377 2010-08-18 Ian Lance Taylor <iant@google.com>
6380 (Output_section_incremental_inputs::write_input_files): Add cast
6381 to avoid signed/unsigned comparison warning.
6382 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6384 2010-08-12 Cary Coutant <ccoutant@google.com>
6386 * common.cc (Sort_commons::operator()): Remove unnecessary code.
6388 2010-08-13 Ian Lance Taylor <iant@google.com>
6390 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6392 2010-08-12 Cary Coutant <ccoutant@google.com>
6393 Doug Kwan <dougkwan@google.com>
6395 * resolve.cc (Symbol_table::should_override): When a weak dynamic
6396 defintion overrides non-weak undef, remember that the original undef
6398 * symtab.cc (Symbol_table::sized_write_global): For undef without
6399 an original weak binding, set binding to global in output.
6400 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6401 * testsuite/Makefile.in: Regenerate.
6402 * testsuite/strong_ref_weak_def.sh: New file.
6403 * testsuite/strong_ref_weak_def_1.c: Ditto.
6404 * testsuite/strong_ref_weak_def_2.c: Ditto.
6406 2010-08-12 Cary Coutant <ccoutant@google.com>
6408 * testsuite/incremental_test.sh: Rewrite.
6409 * testsuite/incremental_test_1.c: Rewrite.
6410 * testsuite/incremental_test_2.c: Rewrite.
6412 2010-08-12 Cary Coutant <ccoutant@google.com>
6414 * arm.cc (Target_arm::got_size): Add const.
6415 (Target_arm::got_entry_count): New function.
6416 (Target_arm::plt_entry_count): New function.
6417 (Target_arm::first_plt_entry_offset): New function.
6418 (Target_arm::plt_entry_size): New function.
6419 (Output_data_plt_arm::entry_count): New function.
6420 (Output_data_plt_arm::first_plt_entry_offset): New function.
6421 (Output_data_plt_arm::get_plt_entry_size): New function.
6422 * i386.cc (Target_i386::got_size): Add const.
6423 (Target_i386::got_entry_count): New function.
6424 (Target_i386::plt_entry_count): New function.
6425 (Target_i386::first_plt_entry_offset): New function.
6426 (Target_i386::plt_entry_size): New function.
6427 (Output_data_plt_i386::entry_count): New function.
6428 (Output_data_plt_i386::first_plt_entry_offset): New function.
6429 (Output_data_plt_i386::get_plt_entry_size): New function.
6430 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6431 find_incremental_inputs_sections. Dump incremental_got_plt section.
6432 * incremental.cc: Include target.h.
6433 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6434 parameter. Adjust all callers. Find incremental_got_plt section.
6435 (Incremental_inputs::create_data_sections): Create incremental_got_plt
6437 (Output_section_incremental_inputs::set_final_data_size): Calculate
6438 size of incremental_got_plt section.
6439 (Output_section_incremental_inputs::do_write): Write the
6440 incremental_got_plt section.
6441 (Got_plt_view_info): New struct.
6442 (Local_got_offset_visitor): New class.
6443 (Global_got_offset_visitor): New class.
6444 (Global_symbol_visitor_got_plt): New class.
6445 (Output_section_incremental_inputs::write_got_plt): New function.
6446 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6447 Add parameter. Adjust all callers.
6448 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6449 (Incremental_inputs::got_plt_section): New function.
6450 (Incremental_inputs::got_plt_section_): New data member.
6451 (Incremental_got_plt_reader): New class.
6452 * layout.cc (Layout::create_incremental_info_sections): Add the
6453 incremental_got_plt section.
6454 * object.h (Got_offset_list::get_list): New function.
6455 (Got offset_list::for_all_got_offsets): New function.
6456 (Sized_relobj::local_got_offset_list): New function.
6457 * powerpc.cc (Target_powerpc::got_size): Add const.
6458 (Target_powerpc::got_entry_count): New function.
6459 (Target_powerpc::plt_entry_count): New function.
6460 (Target_powerpc::first_plt_entry_offset): New function.
6461 (Target_powerpc::plt_entry_size): New function.
6462 (Output_data_plt_powerpc::entry_count): New function.
6463 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6464 (Output_data_plt_powerpc::get_plt_entry_size): New function.
6465 * sparc.cc (Target_sparc::got_size): Add const.
6466 (Target_sparc::got_entry_count): New function.
6467 (Target_sparc::plt_entry_count): New function.
6468 (Target_sparc::first_plt_entry_offset): New function.
6469 (Target_sparc::plt_entry_size): New function.
6470 (Output_data_plt_sparc::entry_count): New function.
6471 (Output_data_plt_sparc::first_plt_entry_offset): New function.
6472 (Output_data_plt_sparc::get_plt_entry_size): New function.
6473 * symtab.h (Symbol::got_offset_list): New function.
6474 (Symbol_table::for_all_symbols): New function.
6475 * target.h (Sized_target::got_entry_count): New function.
6476 (Sized_target::plt_entry_count): New function.
6477 (Sized_target::plt_entry_size): New function.
6478 * x86_64.cc (Target_x86_64::got_size): Add const.
6479 (Target_x86_64::got_entry_count): New function.
6480 (Target_x86_64::plt_entry_count): New function.
6481 (Target_x86_64::first_plt_entry_offset): New function.
6482 (Target_x86_64::plt_entry_size): New function.
6483 (Output_data_plt_x86_64::entry_count): New function.
6484 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6485 (Output_data_plt_x86_64::get_plt_entry_size): New function.
6487 2010-08-12 Cary Coutant <ccoutant@google.com>
6489 * archive.cc: Include incremental.h.
6490 (Archive::Archive): Initialize incremental_info_.
6491 (Archive::include_member): Record archive members in incremental info.
6492 (Add_archive_symbols::run): Record begin and end of an archive in
6494 (Lib_group::include_member): Record objects in incremental info.
6495 * archive.h (Incremental_archive_entry): Forward declaration.
6496 (Archive::set_incremental_info): New member function.
6497 (Archive::incremental_info): New member function.
6498 (Archive::Unused_symbol_iterator): New class.
6499 (Archive::unused_symbols_begin): New member function.
6500 (Archive::unused_symbols_end): New member function.
6501 (Archive::incremental_info_): New data member.
6502 * incremental-dump.cc (find_input_containing_global): New function.
6503 (dump_incremental_inputs): Dump new incremental info sections.
6504 * incremental.cc: Include symtab.h.
6505 (Output_section_incremental_inputs): New class.
6506 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6507 new incremental info sections.
6508 (Sized_incremental_binary::do_check_inputs): Likewise.
6509 (Incremental_inputs::report_archive): Remove.
6510 (Incremental_inputs::report_archive_begin): New function.
6511 (Incremental_inputs::report_archive_end): New function.
6512 (Incremental_inputs::report_object): New function.
6513 (Incremental_inputs::finalize_inputs): Remove.
6514 (Incremental_inputs::report_input_section): New function.
6515 (Incremental_inputs::report_script): Rewrite.
6516 (Incremental_inputs::finalize): Do nothing but finalize string table.
6517 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6518 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6519 (Incremental_inputs::create_data_sections): New function.
6520 (Incremental_inputs::relocs_entsize): New function.
6521 (Output_section_incremental_inputs::set_final_data_size): New function.
6522 (Output_section_incremental_inputs::do_write): New function.
6523 (Output_section_incremental_inputs::write_header): New function.
6524 (Output_section_incremental_inputs::write_input_files): New function.
6525 (Output_section_incremental_inputs::write_info_blocks): New function.
6526 (Output_section_incremental_inputs::write_symtab): New function.
6527 * incremental.h (Incremental_script_entry): Forward declaration.
6528 (Incremental_object_entry): Forward declaration.
6529 (Incremental_archive_entry): Forward declaration.
6530 (Incremental_inputs): Forward declaration.
6531 (Incremental_inputs_header_data): Remove.
6532 (Incremental_inputs_header): Remove.
6533 (Incremental_inputs_header_write): Remove.
6534 (Incremental_inputs_entry_data): Remove.
6535 (Incremental_inputs_entry): Remove.
6536 (Incremental_inputs_entry_write): Remove.
6537 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6538 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6539 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6540 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6542 (Incremental_input_entry): New class.
6543 (Incremental_script_entry): New class.
6544 (Incremental_object_entry): New class.
6545 (Incremental_archive_entry): New class.
6546 (Incremental_inputs::Incremental_inputs): Initialize new data members.
6547 (Incremental_inputs::report_inputs): Remove.
6548 (Incremental_inputs::report_archive): Remove.
6549 (Incremental_inputs::report_archive_begin): New function.
6550 (Incremental_inputs::report_archive_end): New function.
6551 (Incremental_inputs::report_object): Change prototype.
6552 (Incremental_inputs::report_input_section): New function.
6553 (Incremental_inputs::report_script): Change prototype.
6554 (Incremental_inputs::get_reloc_count): New function.
6555 (Incremental_inputs::set_reloc_count): New function.
6556 (Incremental_inputs::create_data_sections): New function.
6557 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6558 (Incremental_inputs::inputs_section): New function.
6559 (Incremental_inputs::symtab_section): New function.
6560 (Incremental_inputs::relocs_section): New function.
6561 (Incremental_inputs::get_stringpool): Add const.
6562 (Incremental_inputs::command_line): Add const.
6563 (Incremental_inputs::inputs): Remove.
6564 (Incremental_inputs::command_line_key): New function.
6565 (Incremental_inputs::input_file_count): New function.
6566 (Incremental_inputs::input_files): New function.
6567 (Incremental_inputs::relocs_entsize): New function.
6568 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6569 (Incremental_inputs::finalize_inputs): Remove.
6570 (Incremental_inputs::Input_info): Remove.
6571 (Incremental_inputs::lock_): Remove.
6572 (Incremental_inputs::inputs_): Change type.
6573 (Incremental_inputs::inputs_map_): Remove.
6574 (Incremental_inputs::current_object_entry_): New data member.
6575 (Incremental_inputs::inputs_section_): New data member.
6576 (Incremental_inputs::symtab_section_): New data member.
6577 (Incremental_inputs::relocs_section_): New data member.
6578 (Incremental_inputs::reloc_count_): New data member.
6579 (Incremental_inputs_reader): New class.
6580 (Incremental_symtab_reader): New class.
6581 (Incremental_relocs_reader): New class.
6582 * layout.cc (Layout::finalize): Move finalization of incremental info
6583 and creation of incremental info sections to follow finalization of
6584 symbol table. Set offsets for postprocessing sections.
6585 (Layout::create_incremental_info_sections): Call
6586 Incremental_inputs::create_data_sections. Add incremental symtab
6587 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
6588 sections to layout after input sections.
6589 * layout.h (struct Timespec): Forward declaration.
6590 (Layout::incremental_inputs): Add const.
6591 (Layout::create_incremental_info_sections): Add parameter.
6592 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6593 * object.cc: Include incremental.h.
6594 (Relobj::finalize_incremental_relocs): New function.
6595 (Sized_relobj::do_layout): Record input sections in incremental info.
6596 * object.h (Object::output_section): New function.
6597 (Object::output_section_offset): Moved from Relobj.
6598 (Object::get_incremental_reloc_base): New function.
6599 (Object::get_incremental_reloc_count): New function.
6600 (Object::do_output_section): New function.
6601 (Object::do_output_section_offset): Moved from Relobj.
6602 (Object::do_get_incremental_reloc_base): New function.
6603 (Object::do_get_incremental_reloc_count): New function.
6604 (Object::Object): Initialize new data members.
6605 (Relobj::output_section): Renamed do_output_section and moved to
6607 (Relobj::output_section_offset): Moved to Object.
6608 (Relobj::do_get_incremental_reloc_base): New function.
6609 (Relobj::do_get_incremental_reloc_count): New function.
6610 (Relobj::allocate_incremental_reloc_counts): New function.
6611 (Relobj::count_incremental_reloc): New function.
6612 (Relobj::finalize_incremental_relocs): New function.
6613 (Relobj::next_incremental_reloc_index): New function.
6614 (Relobj::reloc_counts_): New data member.
6615 (Relobj::reloc_bases_): New data member.
6616 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
6617 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
6618 (Sized_relobj::incremental_relocs_scan): New function.
6619 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6620 (Sized_relobj::incremental_relocs_write): New function.
6621 (Sized_relobj::incremental_relocs_write_reltype): New function.
6622 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6624 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6625 archives and object files elsewhere.
6626 (Add_symbols::run): Report object files here.
6627 (Finish_group::run): Report end of archive at end of group.
6628 * reloc.cc: Include layout.h, incremental.h.
6629 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6630 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6631 (Sized_relobj::incremental_relocs_scan): New function.
6632 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6633 (Sized_relobj::do_relocate_sections): Write incremental relocations.
6634 (Sized_relobj::incremental_relocs_write): New function.
6635 (Sized_relobj::incremental_relocs_write_reltype): New function.
6636 * script.cc (read_input_script): Rewrite test for incremental link.
6637 Change call to Incremental_inputs::report_script.
6638 * symtab.h (Symbol_table::first_global_index): New function.
6639 (Symbol_table::output_count): New function.
6641 2010-08-12 Doug Kwan <dougkwan@google.com>
6643 * arm.cc (Target_arm::merge_object_attributes): Check command line
6644 options --no-wchar-size-warning and --no-enum-size-warning.
6645 * options.h (General_options): Add ld-compatible options
6646 --no-enum-size-warning and --no-wchar-size-warning.
6648 2010-08-04 Ian Lance Taylor <iant@google.com>
6650 * x86_64.cc (Target_x86_64::Scan::local): Use
6651 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6652 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6653 (Target_x86_64::Scan::global): Likewise.
6654 (Target_x86_64::Relocate::relocate): Likewise.
6655 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6658 2010-08-03 Cary Coutant <ccoutant@google.com>
6660 * merge.cc (Output_merge_string::do_add_input_section): Count strings
6661 to reserve space in merged_strings vector. Keep total input size
6663 (Output_merge_string::do_print_merge_stats): Print total input size.
6664 * merge.h (Output_merge_string): Add input_size_ field.
6665 * stringpool.cc (Stringpool_template::string_length): Move
6666 implementations out of Stringpool_template class and place in
6668 * stringpool.h (string_length): Move out of Stringpool_template.
6670 2010-08-03 Ian Lance Taylor <iant@google.com>
6673 * layout.cc (relaxation_loop_body): If address of load segment is
6674 set, adjust address to include headers if possible.
6676 2010-08-03 Ian Lance Taylor <iant@google.com>
6678 * version.cc (version_string): Bump to 1.10.
6680 2010-08-03 Ian Lance Taylor <iant@google.com>
6683 * layout.h (enum Output_section_order): Define.
6684 (class Layout): Update declarations.
6685 * layout.cc (Layout::get_output_section): Add order parameter.
6686 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6687 is_first_non_relro parameters. Change all callers.
6688 (Layout::choose_output_section): Likewise.
6689 (Layout::add_output_section_data): Likewise.
6690 (Layout::make_output_section): Likewise. Set order.
6691 (Layout::default_section_order): New function.
6692 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6693 * output.cc (Output_section::Output_section): Initialize order_.
6694 Don't initialize deleted fields.
6695 (Output_segment::Output_segment): Don't initialize deleted
6697 (Output_segment::add_output_section_to_load): New function
6698 replacing add_output_section. Change all callers to call this or
6699 add_output_section_to_nonload.
6700 (Output_segment::add_output_section_to_nonload): New function.
6701 (Output_segment::remove_output_section): Rewrite.
6702 (Output_segment::add_initial_output_data): Likewise.
6703 (Output_segment::has_any_data_sections): Likewise.
6704 (Output_segment::is_first_section_relro): Likewise.
6705 (Output_segment::maximum_alignment): Likewise.
6706 (Output_segment::has_dynamic_reloc): New function replacing
6707 dynamic_reloc_count. Change all callers.
6708 (Output_segment::has_dynamic_reloc_list): New function replacing
6709 dynamic_reloc_count_list. Change all callers.
6710 (Output_segment::set_section_addresses): Rewrite.
6711 (Output_segment::set_offset): Rewrite.
6712 (Output_segment::find_first_and_last_list): Remove.
6713 (Output_segment::set_tls_offsets): Rewrite.
6714 (Output_segment::first_section_load_address): Likewise.
6715 (Output_segment::output_section_count): Likewise.
6716 (Output_segment::section_with_lowest_load_address): Likewise.
6717 (Output_segment::write_section_headers): Likewise.
6718 (Output_segment::print_sections_to_map): Likewise.
6719 * output.h (class Output_data): Remove dynamic_reloc_count_
6720 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
6721 (Output_data::add_dynamic_reloc): Rewrite.
6722 (Output_data::has_dynamic_reloc): New function.
6723 (Output_data::dynamic_reloc_count): Remove.
6724 (class Output_section): Add order_ field. Remvoe is_relro_local_,
6725 is_last_relro_, is_first_non_relro_, is_interp_,
6726 is_dynamic_linker_section_ fields. Add order and set_order
6727 functions. Remove is_relro_local, set_is_relro_local,
6728 is_last_relro, set_is_last_relro, is_first_non_relro,
6729 set_is_first_non_relro functions, is_interp, set_is_interp,
6730 is_dynamic_linker_section, and set_is_dynamic_linker_section
6732 (class Output_segment): Change Output_data_list from std::list to
6733 std:;vector. Add output_lists_ field. Remove output_data_ and
6734 output_bss_ fields. Update declarations.
6736 2010-08-02 Ian Lance Taylor <iant@google.com>
6738 * arm.cc (Target_arm::gc_process_relocs): Use typename.
6739 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6740 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6742 2010-08-02 Ian Lance Taylor <iant@google.com>
6745 * script.cc (Script_options::Script_options): Initialize
6746 symbol_definitions_ and symbol_references_.
6747 (Script_options::add_symbol_assignment): Update
6748 symbol_definitions_ and symbol_references_.
6749 (Script_options::add_symbol_reference): New function.
6750 (script_symbol): New function.
6751 * script.h (class Script_options): Add symbol_definitions_ and
6752 symbol_references_ fields.
6753 (Script_options::referenced_const_iterator): New type.
6754 (Script_options::referenced_begin): New function.
6755 (Script_options::referenced_end): New function.
6756 (Script_options::is_referenced): New function.
6757 (Script_options::any_unreferenced): New function.
6758 * script-c.h (script_symbol): Declare.
6759 * yyscript.y (exp): Call script_symbol.
6760 * symtab.cc: Include "script.h".
6761 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6762 Change all callers. Check symbols referenced by scripts.
6763 (Symbol_table::add_undefined_symbols_from_command_line): Add
6764 layout parameter. Change all callers.
6765 (Symbol_table::do_add_undefined_symbols_from_command_line):
6766 Likewise. Break out loop body. Check symbols referenced by
6768 (Symbol_table::add_undefined_symbol_from_command_line): New
6769 function broken out of
6770 do_add_undefined_symbols_from_command_line.
6771 * symtab.h (class Symbol_table): Update declarations.
6772 * archive.cc: Include "layout.h".
6773 (Archive::should_include_member): Add layout parameter. Change
6774 all callers. Check for symbol mentioned in expression.
6775 * archive.h (class Archive): Update declaration.
6776 * object.cc (Sized_relobj::do_should_include_member): Add layout
6778 * object.h (Object::should_include_member): Add layout parameter.
6780 (Object::do_should_include_member): Add layout parameter.
6781 (class Sized_relobj): Update declaration.
6782 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6784 * dynobj.h (class Sized_dynobj): Update declaration.
6785 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6787 * plugin.h (class Sized_pluginobj): Update declaration.
6789 2010-08-02 Ian Lance Taylor <iant@google.com>
6792 * output.cc (Output_segment::set_offset): Search for the first and
6793 last sections rather than assuming that the list is in order.
6794 (Output_segment::find_first_and_last_list): New function.
6795 * output.h (class Output_segment): Update declarations.
6796 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6797 (relro_strip_test_SOURCES): New variable.
6798 (relro_strip_test_DEPENDENCIES): New variable.
6799 (relro_strip_test_LDFLAGS): New variable.
6800 (relro_strip_test_LDADD): New variable.
6801 (relro_strip_test.so): New target.
6803 2010-08-02 Ian Lance Taylor <iant@google.com>
6805 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6806 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6807 (Target_i386::got_tlsdesc_section): New function.
6808 (Target_i386::got_section): Create space for GOT entries for
6809 TLSDESC relocations.
6810 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6812 (Target_i386::Scan::global): Likewise.
6813 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6815 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6816 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6817 (Target_x86_64::got_tlsdesc_section): New function.
6818 (Target_x86_64::got_section): Create space for GOT entries for
6819 TLSDESC relocations.
6820 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6822 (Target_x86_64::Scan::global): Likewise.
6823 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6826 2010-08-02 Ian Lance Taylor <iant@google.com>
6828 * testsuite/final_layout.sh: Use dc to convert from hex to
6831 2010-07-29 Sriraman Tallam <tmsriram@google.com>
6833 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6834 paramter to the call to gold::gc_process_relocs.
6835 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6836 paramter to the call to gold::gc_process_relocs.
6837 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6838 parameter to the call to gold::gc_process_relocs.
6839 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6840 template parameter to the call to gold::gc_process_relocs.
6841 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6842 paramter to the call to gold::gc_process_relocs.
6843 * gc.h (get_embedded_addend_size): New function.
6844 (gc_process_relocs): Save the size of the reloc for use by ICF.
6845 * icf.cc (get_section_contents): Get the addend from the text section
6846 for SHT_REL relocation sections.
6847 * icf.h (Icf::Reloc_addend_size_info): New typedef.
6848 (Icf::Reloc_info): Add new member reloc_addend_size_info.
6849 * int_encoding.h (read_from_pointer): New overloaded function.
6850 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6851 * testsuite/icf_sht_rel_addend_test.sh: New file.
6852 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6853 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6855 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6857 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6858 * Makefile.in: Regenerate.
6859 * testsuite/Makefile.in: Regenerate.
6861 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
6863 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6864 * gold/testsuite/debug_msg.cc: Likewise.
6865 * gold/testsuite/odr_violation1.cc
6866 * gold/testsuite/odr_violation2.cc
6868 2010-07-21 Cary Coutant <ccoutant@google.com>
6870 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6871 string, and length fields.
6872 (Output_merge_string::Merged_strings_list): New type.
6873 (Output_merge_string::Merged_strings_lists): New typedef.
6874 (Output_merge_string): Replace merged_strings_ with
6875 merged_strings_lists_.
6876 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6877 Merged_strings_list per input object and section. Don't store pointer
6878 to the string. Don't store length with each merged string entry.
6879 (Output_merge_string::finalize_merged_data): Loop over list of merged
6880 strings lists. Recompute length of each merged string.
6882 2010-07-15 Cary Coutant <ccoutant@google.com>
6884 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6887 2010-07-14 Ian Lance Taylor <iant@google.com>
6889 * descriptors.cc (Descriptors::open): Report correct name in error
6892 2010-07-13 Doug Kwan <dougkwan@google.com>
6894 * arm.cc (Arm_input_section::Arm_input_section): For a
6895 SHT_ARM_EXIDX section, always keeps the input sections.
6896 (Arm_input_section::set_exidx_section_link): New method.
6897 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6898 has_errors_ to false.
6899 (Arm_exidx_input_section::has_errors,
6900 Arm_exidx_input_section::set_has_errors): New methods.
6901 (Arm_exidx_input_section::has_errors_): New data member.
6902 (Arm_relobj::get_exidx_shndx_list): New method.
6903 (Arm_output_section::append_text_sections_to_list): Do not skip
6904 section without SHF_EXECINSTR.
6905 (Arm_output_section::fix_exidx_coverage): Skip input sections with
6907 (Arm_relobj::make_exidx_input_section): Add new parameter for text
6908 section header. Make error messages more verbose. Check for
6909 a non-executable section linked to an EXIDX section.
6910 (Arm_relobj::do_read_symbols): Remove error checking, which has been
6911 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
6912 check that there is no deferred EXIDX section if we exit early.
6913 Instead of not making an EXIDX section in case of an error, make one
6914 and set the has_errors flag of it.
6915 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6916 in a relocatable link.
6917 (Target_arm::do_relax): Look for the EXIDX output section instead of
6918 assuming that it is called .ARM.exidx.
6919 (Target_arm::fix_exidx_coverage): Add a new parameter for input
6920 section list. Do not check for SHF_EXECINSTR section flags but
6921 skip any input section with errors.
6922 * output.cc (Output_section::Output_section): Initialize
6923 always_keeps_input_sections_ to false.
6924 (Output_section::add_input_section): Check for
6925 always_keeps_input_sections_.
6926 * output.h (Output_section::always_keeps_input_sections,
6927 Output_section::set_always_keeps_input_sections): New methods.
6928 (Output_section::always_keeps_input_sections): New data member.
6930 2010-07-13 Rafael Espindola <espindola@google.com>
6932 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6933 * fileread.h (Input_file): Add try_extra_search_path and find_file.
6935 2010-07-13 Philip Herron <herron.philip@googlemail.com>
6936 Ian Lance Taylor <iant@google.com>
6938 * output.h (Output_section_lookup_maps::add_merge_section):
6939 Correct check of whether value was inserted.
6940 (Output_section_lookup_maps::add_merge_input_section): Likewise.
6941 (Output_section_lookup_maps::add_relaxed_input_section):
6943 * arm.cc (Target_arm::got_section): Remove used local os.
6944 * i386.cc (Target_i386::got_section): Likewise.
6945 * x86_64.cc (Target_x86_64::got_section): Likewise.
6946 * sparc.cc (Target_sparc::got_section): Likewise.
6947 (Target_sparc::relocate): Remove unused local have_got_offset.
6948 * powerpc.cc (Target_powerpc::relocate): Likewise.
6950 2010-07-13 Ian Lance Taylor <iant@google.com>
6952 * compressed_output.cc (zlib_decompress): Fix signature in
6955 * archive.cc (Archive::include_member): Unlock an external member
6956 of a thin archive. Don't bother to delete an object we know is
6959 2010-07-12 Cary Coutant <ccoutant@google.com>
6961 * compressed_output.cc (zlib_decompress): New function.
6962 (get_uncompressed_size): New function.
6963 (decompress_input_section): New function.
6964 * compressed_output.h (get_uncompressed_size): New function.
6965 (decompress_input_section): New function.
6966 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6967 Handle compressed debug sections.
6968 * layout.cc (is_compressed_debug_section): New function.
6969 (Layout::output_section_name): Map compressed section names to
6971 * layout.h (is_compressed_debug_section): New function.
6972 (is_debug_info_section): Recognize compressed debug sections.
6973 * merge.cc: Include compressed_output.h.
6974 (Output_merge_data::do_add_input_section): Handle compressed
6976 (Output_merge_string::do_add_input_section): Handle compressed
6978 * object.cc: Include compressed_output.h.
6979 (Sized_relobj::Sized_relobj): Initialize new data members.
6980 (build_compressed_section_map): New function.
6981 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6982 * object.h (Object::section_is_compressed): New method.
6983 (Object::do_section_is_compressed): New method.
6984 (Sized_relobj::Compressed_section_map): New type.
6985 (Sized_relobj::do_section_is_compressed): New method.
6986 (Sized_relobj::compressed_sections_): New data member.
6987 * output.cc (Output_section::add_input_section): Handle compressed
6989 * reloc.cc: Include compressed_output.h.
6990 (Sized_relobj::write_sections): Handle compressed debug sections.
6992 2010-07-08 Cary Coutant <ccoutant@google.com>
6994 * resolve.cc (Symbol_table::resolve): Remember whether undef was
6995 weak when resolving to a dynamic def.
6996 (Symbol_table::should_override): Add adjust_dyndef flag; set it
6997 for weak undef/dynamic def cases. Adjust callers.
6998 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6999 undef_binding_weak_.
7000 (Symbol_table::sized_write_globals): Adjust symbol binding.
7001 (Symbol_table::sized_write_symbol): Add binding parameter.
7002 * symtab.h (Symbol::set_undef_binding): New method.
7003 (Symbol::is_undef_binding_weak): New method.
7004 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7005 (Symbol_table::should_override): Add new parameter.
7006 (Symbol_table::sized_write_symbol): Add new parameter.
7008 * testsuite/weak_undef_file1.cc: Add new test case.
7009 * testsuite/weak_undef_file2.cc: Fix header comment.
7010 * testsuite/weak_undef_test.cc: Add new test case.
7012 2010-06-29 Doug Kwan <dougkwan@google.com>
7014 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7015 Initialize USE_SYMBOL_.
7016 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7018 (Arm_reloc_property::uses_symbol_): New data member declaration.
7019 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7020 uses symbol value and symbol is undefined but not weakly undefined.
7022 2010-06-28 Rafael Espindola <espindola@google.com>
7024 * plugin.cc (Plugin::load): Use dlerror.
7026 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
7028 * symtab.cc (detect_odr_violations): When reporting an ODR
7029 violation, report an object where the symbol is defined.
7031 2010-06-25 Doug Kwan <dougkwan@google.com>
7033 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7034 (Target_arm::section_may_have_icf_unsafe_pointers): New method
7036 (Target_arm::Scan::local_reloc_may_be_function_pointer,
7037 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7038 target hook to detect function points.
7039 (Target_arm::Scan::possible_function_pointer_reloc): New method.
7040 * icf.h (Icf::check_section_for_function_pointers): Change type of
7041 parameter SECTION_NAME to const reference to std::string. Use
7042 target hook to determine if section may have unsafe pointers.
7043 * target.h (Target::section_may_have_icf_unsafe_pointers): New
7046 2010-06-21 Rafael Espindola <espindola@google.com>
7048 * fileread.cc (Input_file::find_fie): New
7049 (Input_file::open): Use Input_file::find_fie.
7050 * fileread.h (Input_file::find_fie): New
7051 * plugin.cc (set_extra_library_path): New.
7052 (Plugin::load): Add set_extra_library_path to the transfer vector.
7053 (Plugin_manager::set_extra_library_path): New.
7054 (Plugin_manager::add_input_file): Use the extra search path if set.
7055 (set_extra_library_path(): New.
7056 * plugin.h (Plugin_manager): Add set_extra_library_path and
7059 2010-06-19 Cary Coutant <ccoutant@google.com>
7061 * layout.cc (gdb_sections): Add .debug_types.
7062 (lines_only_debug_sections): Likewise.
7064 2010-06-18 Rafael Espindola <espindola@google.com>
7066 * plugin.cc (add_input_file,add_input_library)
7067 (Plugin_manager::add_input_file): Make filename arguments const.
7068 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7071 2010-06-16 Doug Kwan <dougkwan@google.com>
7073 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7074 .ARM.attributes section if we have not merged any input
7075 attributes sections.
7077 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7079 * arm.cc: Allow combining objects with no EABI version
7082 2010-06-15 Rafael Espindola <espindola@google.com>
7084 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7086 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7088 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7089 (struct iovec): Correct !HAVE_READV definition.
7091 2010-06-10 Cary Coutant <ccoutant@google.com>
7093 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7094 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7096 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7099 * symtab.h (Symbol::is_placeholder): New member function.
7100 * target-reloc.h (relocate_section): Check for placeholder symbols.
7102 * testsuite/Makefile.am (plugin_test_8): New test.
7103 (plugin_test_9): New test.
7104 * testsuite/Makefile.in: Regenerate.
7106 2010-06-09 Nick Clifton <nickc@redhat.com>
7108 * yyscript.y (input_list_element): Allow strings prefixed with
7109 the '-' character. Treat these as libraries.
7110 * script.cc (script_add_library): New function. Adds a library
7111 specified by "-l<name>" found in an input script.
7112 * script-c.h: Add prototype for script_add_library.
7114 2010-06-07 Doug Kwan <dougkwan@google.com>
7116 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7117 Restrict stub-group size to be within long conditional branch
7118 range when working around cortex-A8 erratum.
7120 2010-06-07 Damien Diederen <dd@crosstwine.com>
7122 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7125 2010-06-03 Sriraman Tallam <tmsriram@google.com>
7129 (Output_section::Input_section_sort_entry::compare_section_ordering):
7130 Change to return non-zero correctly.
7131 (Output_section::Input_section_sort_section_order_index_compare
7132 ::operator()): Change to fix ambiguity in comparisons.
7134 2010-06-01 Sriraman Tallam <tmsriram@google.com>
7136 * gold.h (is_wildcard_string): New function.
7137 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7138 (Layout::layout_eh_frame): Ditto.
7139 (Layout::find_section_order_index): New method.
7140 (Layout::read_layout_from_file): New method.
7141 * layout.h (Layout::find_section_order_index): New method.
7142 (Layout::read_layout_from_file): New method.
7143 (Layout::input_section_position_): New private member.
7144 (Layout::input_section_glob_): New private member.
7145 * main.cc (main): Call read_layout_from_file here.
7146 * options.h (--section-ordering-file): New option.
7147 * output.cc (Output_section::input_section_order_specified_): New
7149 (Output_section::Output_section): Initialize new member.
7150 (Output_section::add_input_section): Add new parameter.
7151 Keep input sections when --section-ordering-file is used.
7152 (Output_section::set_final_data_size): Sort input sections when
7153 section ordering file is specified.
7154 (Output_section::Input_section_sort_entry): Add new parameter.
7156 (Output_section::Input_section_sort_entry::compare_section_ordering):
7158 (Output_section::Input_section_sort_compare::operator()): Change to
7159 consider section_order_index.
7160 (Output_section::Input_section_sort_init_fini_compare::operator()):
7161 Change to consider section_order_index.
7162 (Output_section::Input_section_sort_section_order_index_compare
7163 ::operator()): New method.
7164 (Output_section::sort_attached_input_sections): Change to sort
7165 according to section order when specified.
7166 (Output_section::add_input_section<32, true>): Add new parameter.
7167 (Output_section::add_input_section<64, true>): Add new parameter.
7168 (Output_section::add_input_section<32, false>): Add new parameter.
7169 (Output_section::add_input_section<64, false>): Add new parameter.
7170 * output.h (Output_section::add_input_section): Add new parameter.
7171 (Output_section::input_section_order_specified): New
7173 (Output_section::set_input_section_order_specified): New method.
7174 (Input_section::Input_section): Initialize section_order_index_.
7175 (Input_section::section_order_index): New method.
7176 (Input_section::set_section_order_index): New method.
7177 (Input_section::section_order_index_): New member.
7178 (Input_section::Input_section_sort_section_order_index_compare): New
7180 (Output_section::input_section_order_specified_): New member.
7181 * script-sections.cc (is_wildcard_string): Delete and move modified
7183 (Output_section_element_input::Output_section_element_input): Modify
7184 call to is_wildcard_string.
7185 (Output_section_element_input::Input_section_pattern
7186 ::Input_section_pattern): Ditto.
7187 (Output_section_element_input::Output_section_element_input): Ditto.
7188 * testsuite/Makefile.am (final_layout): New test case.
7189 * testsuite/Makefile.in: Regenerate.
7190 * testsuite/final_layout.cc: New file.
7191 * testsuite/final_layout.sh: New file.
7193 2010-06-01 Rafael Espindola <espindola@google.com>
7195 * plugin.cc (Plugin::load): Pass the output name to the plugin.
7197 2010-06-01 Rafael Espindola <espindola@google.com>
7199 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7200 visibility of symbols.
7202 2010-05-27 Doug Kwan <dougkwan@google.com>
7204 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7205 from start of output section instead of address for a local symbol
7206 in a merged or relaxed section when doing a relocatable link.
7208 2010-05-26 Rafael Espindola <espindola@google.com>
7211 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7212 adding sections the garbage collector removed.
7213 * gold/testsuite/Makefile.am: Add test.
7214 * gold/testsuite/Makefile.in: Regenerate.
7215 * gold/testsuite/plugin_test_7.sh: New.
7216 * gold/testsuite/plugin_test_7_1.c: New.
7217 * gold/testsuite/plugin_test_7_2.c: New.
7219 2010-05-26 Rafael Espindola <espindola@google.com>
7221 * script-sections.cc (Output_section_definition::set_section_addresses):
7222 Check for --section-start.
7224 2010-05-26 Doug Kwan <dougkwan@google.com>
7226 * arm.cc (Arm_scan_relocatable_relocs): New class.
7227 (Target_arm::relocate_special_relocatable): New method.
7228 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7229 (Arm_relocate_functions::thumb_branch_common): Same.
7230 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7231 instead of Default_scan_relocatable_relocs.
7232 * target-reloc.h (relocate_for_relocatable): Let target handle
7233 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7234 * target.h (Sized_target::relocate_special_relocatable): New method.
7236 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7238 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7240 2010-05-23 Doug Kwan <dougkwan@google.com>
7242 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7244 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7245 with a direct branch, not a conditional branch, to a stub.
7246 * merge.cc (Output_merge_base::record_input_section): New method
7248 (Output_merge_data::do_add_input_section): Record input section if
7249 keeps-input-sections flag is set.
7250 (Output_merge_string::do_add_input_section): Ditto.
7251 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7252 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7254 (Output_merge_base::keeps_input_sections,
7255 Output_merge_base::set_keeps_input_sections,
7256 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7258 (Output_merge_base::Input_sections): New type declaration.
7259 (Output_merge_base::input_sections_begin,
7260 Output_merge_base::input_sections_end,
7261 Output_merge_base::do_set_keeps_input_sections): New method definitions.
7262 (Output_merge_base::bool keeps_input_sections_,
7263 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7264 Output_merge_base::input_sections_): New data members.
7265 (Output_merge_data::do_set_keeps_input_sections): New method
7267 (Output_merge_string::do_set_keeps_input_sections): Ditto.
7268 * output.cc (Output_section::Input_section::relobj): Move method
7269 defintion from class declaration to here and handle merge sections.
7270 (Output_section::Input_section::shndx): Ditto.
7271 (Output_section::Output_section): Remove initializations of removed
7272 data members and initialize new data member LOOKUP_MAPS_.
7273 (Output_section::add_input_section): Set keeps-input-sections flag
7274 for a newly created merge output section as appropriate. Adjust code
7275 to use Output_section_lookup_maps class.
7276 (Output_section::add_relaxed_input_section): Adjst code for lookup
7277 maps code refactoring.
7278 (Output_section::add_merge_input_section): Add a new parameter
7279 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
7280 class. If adding input section to a newly created merge output
7281 section fails, remove the new merge section.
7282 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7283 Adjust code for use of the Output_section_lookup_maps class.
7284 (Output_section::find_merge_section): Ditto.
7285 (Output_section::build_lookup_maps): New method defintion.
7286 (Output_section::find_relaxed_input_section): Adjust code to use
7287 Output_section_lookup_maps class.
7288 (Output_section::get_input_sections): Export merge sections. Adjust
7289 code to use Output_section_lookup_maps class.
7290 (Output_section:::add_script_input_section): Adjust code to use
7291 Output_section_lookup_maps class. Update lookup maps for merge
7293 (Output_section::discard_states): Use Output_section_lookup_maps.
7294 (Output_section::restore_states): Same.
7295 * output.h (Merge_section_properties): Move class defintion out of
7297 (Output_section_lookup_maps): New class.
7298 (Output_section::Input_section::is_merge_section): New method
7300 (Output_section::Input_section::relobj): Move defintion out of class
7301 defintion. Declare method only.
7302 (Output_section::Input_section::shndx): Ditto.
7303 (Output_section::Input_section::output_merge_base): New method defintion.
7304 (Output_section::Input_section::u2_.pomb): New union field.
7305 (Output_section::Merge_section_by_properties_map,
7306 Output_section::Output_section_data_by_input_section_map,
7307 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7309 (Output_section::add_merge_input_section): Add new parameter
7310 KEEPS_INPUT_SECTIONS.
7311 (Output_section::build_lookup_maps): New method declaration.
7312 (Output_section::merge_section_map_,
7313 Output_section::merge_section_by_properties_map_,
7314 Output_section::relaxed_input_section_map_,
7315 Output_section::is_relaxed_input_section_map_valid_): Remove data
7317 (Output_section::lookup_maps_): New data member.
7319 2010-05-21 Doug Kwan <dougkwan@google.com>
7322 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7323 avoid a compilation error.
7325 2010-05-19 Rafael Espindola <espindola@google.com>
7327 * script-sections.cc (Output_section_definition::allocate_to_segment):
7328 Update the phdrs_list even when the output section is NULL.
7329 * testsuite/Makefile.am: Add test.
7330 * testsuite/Makefile.in: Regenerate.
7331 * testsuite/script_test_9.cc: New.
7332 * testsuite/script_test_9.sh: New.
7333 * testsuite/script_test_9.t: New.
7335 2010-05-19 Doug Kwan <dougkwan@google.com>
7337 * arm.cc (Arm_input_section::original_size): New method.
7338 (Arm_input_section::do_addralign): Add a cast.
7339 (Arm_input_section::do_output_offset): Remove static cast.
7340 (Arm_input_section::original_addralign,
7341 Arm_input_section::original_size_): Change type to uint32_t.
7342 (Arm_input_section::init): Add safe casts for section alignment
7344 (Arm_input_section::set_final_data_size): Do not set address and
7345 offset of stub table.
7346 (Arm_output_section::fix_exidx_coverage): Change use of of
7347 Output_section::Simple_input_section to that of
7348 Output_section::Input_section.
7349 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7350 except for the first pass.
7351 * output.cc (Output_section::get_input_sections): Change type of
7352 input_sections to std::list<Input_section>.
7353 (Output_section::add_script_input_section): Rename from
7354 Output_section::add_simple_input_section. Change type of SIS
7355 parameter from Simple_input_section to Input_section.
7356 * output.h (Output_section::Simple_input_section): Remove class.
7357 (Output_section::Input_section): Change class visibility to public.
7358 (Output_section::Input_section::addralign): Use stored alignments
7359 for special input sections if set.
7360 (Output_section::Input_section::set_addralign): New method.
7361 (Output_section::get_input_sections): Change parameter type from
7362 list of Simple_input_section to list of Input_section.
7363 (Output_section::add_script_input_section): Rename from
7364 Output_section::add_simple_input_section. Change first parameter's
7365 type from Simple_input_section to Input_section and remove the
7366 second and third parameters.
7367 * script-sections.cc (Input_section::Input_section_list): Change
7368 type to list of Output_section::Input_section/
7369 (Input_section_info::Input_section_info): Change parameter type of
7370 INPUT_SECTION to Output_section::Input_section.
7371 (Input_section_info::input_section): Change return type.
7372 (Input_section_info::input_section_): Change type to
7373 Output_section::Input_section.
7374 (Output_section_element_input::set_section_addresses): Adjust code
7375 to use Output_section::Input_section instead of
7376 Output_section::Simple_input_section. Adjust code for renaming
7377 of Output_section::add_simple_input_section.
7378 (Orphan_output_section::set_section_addresses): Ditto.
7380 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7382 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7383 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7385 2010-05-18 Rafael Espindola <espindola@google.com>
7387 * options.cc (General_options::finalize): Handle -nostdlib.
7388 * options.h (nostdlib): New option.
7389 * script.cc (script_add_search_dir): Handle -nostdlib.
7391 2010-05-12 Doug Kwan <dougkwan@google.com>
7393 * arm.cc (Target_arm::do_finalize_sections): Create an empty
7394 attributes section only if there no attributes section after merging.
7395 (Target_arm::merge_object_attributes): Move value of
7396 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7397 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7398 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7399 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7400 and arm_attr_merge_7.stdout.
7401 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7402 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7403 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7404 arm_attr_merge_7b.o): New rules.
7405 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7407 * testsuite/Makefile.in: Regenerate.
7408 * testsuite/arm_attr_merge.sh: New file.
7409 * testsuite/arm_attr_merge_[67][ab].s: Same.
7411 2010-05-05 Nick Clifton <nickc@redhat.com>
7413 * po/es.po: Updated Spanish translation.
7415 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
7417 * Makefile.am (install-exec-local): Properly install gold as
7418 default cross linker.
7419 * Makefile.in: Regenerated.
7421 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
7422 Nick Clifton <nickc@redhat.com>
7424 * configure.ac (install_as_default): Define and set to false
7425 unless --enable-gold or --enable-gold=both/gold has been
7427 * configure: Regenerate.
7429 * Makefile.am (install-exec-local): Install the executable as
7430 'ld.gold'. If install_as_default is true then also install it as
7432 * Makefile.in: Regenerated.
7434 2010-04-24 Ian Lance Taylor <iant@google.com>
7436 * layout.cc (Layout::layout_reloc): In relocatable link don't
7437 combine reloc sections for grouped sections.
7439 2010-04-23 Sriraman Tallam <tmsriram@google.com>
7441 * gc.h (gc_process_relocs): Pass information on relocs pointing to
7442 sections that are not ordinary to icf.
7443 * icf.cc (get_section_contents): Handle relocation pointing to section
7444 with no object or shndx information.
7445 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7446 * testsuite/Makefile.in: Regenerate.
7447 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7448 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7450 2010-04-22 Ian Lance Taylor <iant@google.com>
7452 * expression.cc (Expression::Expression_eval_info): Add
7453 result_alignment_pointer field.
7454 (Expression::eval_with_dot): Add result_alignment_pointer
7455 parameter. Change all callers.
7456 (Expression::eval_maybe_dot): Likewise.
7457 (class Binary_expression): Add alignment_pointer parameter to
7458 left_value and right_value. Change all callers.
7459 (BINARY_EXPRESSION): Set result alignment.
7460 (class Trinary_expression): Add alignment_pointer parameter to
7461 arg2_value and arg3_value. Change all callers.
7462 (Trinary_cond::value): Set result alignment.
7463 (Max_expression::value, Min_expression::value): Likewise.
7464 (Align_expression::value): Likewise.
7465 * script-sections.cc (class Sections_element): Add dot_alignment
7466 parameter to set_section_addresses virtual function. Update
7468 (class Output_section_element): Likewise.
7469 (Script_sections::create_segments): Add dot_alignment parameter.
7471 (Script_sections::create_segments_from_phdrs_clause): Likewise.
7472 (Script_sections::set_phdrs_clause_addresses): Likewise.
7473 * script-sections.h: Update declarations.
7474 * script.h: Update declarations.
7475 * output.h (Output_segment::set_minimum_p_align): Don't decrease
7477 * testsuite/script_test_3.t: Set large alignment.
7478 * testsuite/script_test_3.sh: Make sure that at least one LOAD
7479 segment has expected alignment.
7481 2010-04-22 Nick Clifton <nickc@redhat.com>
7483 * po/gold.pot: Updated by the Translation project.
7484 * po/vi.po: Updated Vietnamese translation.
7486 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
7488 * testsuite/Makefile.am (check_PROGRAMS): Add
7489 icf_virtual_function_folding_test.
7490 * testsuite/Makefile.in: Regenerated.
7492 2010-04-15 Andrew Haley <aph@redhat.com>
7494 * options.h (merge_exidx_entries): New option.
7495 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7496 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7497 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7498 (Target_arm::merge_exidx_entries): New function.
7499 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7500 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7501 to Arm_exidx_fixup constructor.
7502 Add new arg, merge_exidx_entries.
7503 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7504 Arm_output_section::fix_exidx_coverage.
7506 2010-04-18 Sriraman Tallam <tmsriram@google.com>
7508 * icf.cc (get_section_contents): Check for preemptible functions.
7509 Ignore addend when appropriate.
7510 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
7512 (add_from_relobj): Check for section folded.
7513 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7514 * symtab.h (should_add_dynsym_entry): Add new parameter.
7515 * target-reloc.h (scan_relocs): Check for section folded.
7516 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7517 Check reloc types for function pointers in shared objects.
7518 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7520 (icf_preemptible_functions_test): New test case.
7521 (icf_string_merge_test): New test case.
7522 * testsuite.Makefile.in: Regenerate.
7523 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7524 bar_glob. Refactor code.
7525 * testsuite/icf_preemptible_functions_test.cc: New file.
7526 * testsuite/icf_preemptible_functions_test.sh: New file.
7527 * testsuite/icf_string_merge_test.cc: New file.
7528 * testsuite/icf_string_merge_test.sh: New file.
7529 * testsuite/icf_virtual_function_folding_test.cc: New file.
7530 * testsuite/icf_virtual_function_folding_test.sh: New file.
7532 2010-04-14 Doug Kwan <dougkwan@google.com>
7534 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7535 for local symbol recounting if we remove a section due to ICF.
7536 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7537 there are no regular objects in input.
7539 2010-04-13 Doug Kwan <dougkwan@google.com>
7541 * arm.cc (Arm_input_section::set_final_data_size): Compute
7542 accurate final data size instead of using current data size.
7544 2010-04-09 Doug Kwan <dougkwan@google.com>
7546 * layout.cc (Layout::choose_output_section): Handle script section
7548 (Layout::make_output_section_for_script): Add section type parameter.
7549 Handle script section types.
7550 * layout.h (Layout::make_output_section_for_script): Add section
7552 * output.cc (Output_section::Output_section): Initialize data member
7554 (Output_section::do_reset_address_and_file_offset): Do not set address
7555 to 0 if section is a NOLOAD section.
7556 * output.h (Output_section::is_noload): New method.
7557 (Output_section::set_is_noload): Ditto.
7558 (Output_section::is_noload_): New data member.
7559 * script-c.h (Script_section_type): New enum type.
7560 (struct Parser_output_section_header): Add new file section_type.
7561 * script-sections.cc (Sections_element::output_section_name): Add
7562 parameter for returning script section type.
7563 (Output_section_definition::output_section_name): Ditto.
7564 (Output_section_definition::section_type)P; New method.
7565 (Output_section_definiton::script_section_type_name): Ditto.
7566 (Output_section_definition::script_section_type_): New data member.
7567 (Output_section_definition::Output_section_definition): Initialize
7568 data member Output_section_definition::script_section_type_.
7569 (Output_section_definition::create_sections): Pass script section type
7570 to Layout::make_output_section_for_script.
7571 (Output_section_definition::output_section_name): Return script
7572 section type to caller.
7573 (Output_section_definition::set_section_address): Do not advance
7574 dot value and load address if section type is NOLOAD. Set address
7575 of NOLOAD sections regardless of section flags.
7576 (Output_section_definition::print): Print section type if it is
7577 not SCRIPT_SECTION_TYPE_NONE.
7578 (Output_section_definition::section_type): New method.
7579 (Output_section_definition::script_section_type_name): Ditto.
7580 (Script_sections::output_section_name): Add new parameter
7581 PSECTION_TYPE for returning script section type. Pass it to
7582 section elements. Handle discard sections.
7583 (Sort_output_sections::operator()): Handle NOLOAD sections.
7584 * script-sections.h (Script_sections::Section_type): New enum type.
7585 (Script_sections::output_section_name): Add a new parameter for
7586 returning script section type.
7587 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7589 * yyscript.y (union): Add new field SECTION_TYPE.
7590 (COPY, DSECT, INFO, NOLOAD): New tokens.
7591 (opt_address_and_section_type): Change type to output_section_header.
7592 (section_type): New non-terminal
7593 (section_header): Handle section type.
7594 (opt_address_and_section_type): Return section type value.
7596 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
7598 * testsuite/plugin_common_test_1.c (foo): Add prototype.
7599 * testsuite/plugin_common_test_2.c (foo): Likewise.
7601 2010-04-08 Doug Kwan <dougkwan@google.com>
7603 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7605 * output.cc (Output_section::add_merge_input_section): Simplify
7606 code and return status of Output_merge_base::add_input_section.
7607 Update merge section map only if Output_merge_base::add_input_section
7610 2010-04-07 Doug Kwan <dougkwan@google.com>
7612 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7613 if section is marked as containing instructions but has no mapping
7615 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7616 correct section index.
7617 (Arm_relobj::find_linked_text_section): Ditto.
7619 2010-04-07 Cary Coutant <ccoutant@google.com>
7621 * archive.cc (include_member): Destroy Read_symbols_data object before
7623 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7624 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7625 (Read_symbols_data::~Read_symbols_data) New destructor.
7626 (Section_relocs::Section_relocs) New constructor.
7627 (Section_relocs::~Section_relocs) New destructor.
7628 (Read_relocs_data::Read_relocs_data) New constructor.
7629 (Read_relocs_data::~Read_relocs_data) New destructor.
7630 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7631 pointers to NULL after deleting.
7633 2010-04-07 Doug Kwan <dougkwan@google.com>
7635 * arm.cc: Replace "endianity" with "endianness" in comments.
7636 (Arm_exidx_cantunwind): Ditto.
7637 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7638 (Arm_relobj::merge_flags_and_attributes): New method.
7639 (Arm_relobj::merge_flags_and_attributes_): New data member.
7640 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7641 (Arm_relobj::scan_sections_for_stubs): Ditto.
7642 (Arm_relobj::do_read_symbols): Check to see if we really want to
7643 merge processor-specific flags and attributes. Exit early if
7644 an object is empty except for section names and the undefined symbol.
7645 (Target_arm::do_finalize_sections): Move check for ELF format to
7646 Arm_relobj::do_read_symbols. Merge processor specific flags and
7647 attributes from a regular object only when we have determined that
7648 it is aapropriate. Do not create an .ARM.attributes section in
7649 output if there is no regular input object.
7650 (Target_arm::merge_processor_specific_flags): Check
7651 --warn-mismatch before printing any error.
7652 (Target_arm::merge_object_attributes): Ditto.
7653 * gold.cc (queue_middle_tasks): Handle the case in which there is
7654 no regular object in input.
7655 * options.cc (General_options::parse_EB): New method.
7656 (General_options::parse_EL): Same.
7657 (General_options::General_options): Initialize endianness_.
7658 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7660 (General_options::Endianness): New enum.
7661 (General_options::endianness): New method.
7662 (General_options::endianness_): New data member.
7663 * parameters.cc (Parameters::set_options): Check target endianness.
7664 (Parameters::set_target_once): Ditto.
7665 (Parameters::check_target_endianness): New method.
7666 (parameters_force_valid_target): If either -EL or -EB is specified,
7667 use it to define endianness of default target.
7668 * parameters.h (Parameters::check_target_endianness): New method
7670 * target.h (class Target): Change "endianity" to "endianness"
7673 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7675 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7676 * configure: Regenerate.
7677 * Makefile.in: Regenerate.
7678 * testsuite/Makefile.in: Regenerate.
7680 2010-04-06 Cary Coutant <ccoutant@google.com>
7683 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7684 prevailing definitions of common symbols.
7685 * testsuite/plugin_test_6.sh: New test case.
7686 * testsuite/plugin_common_test_1.c: New test case.
7687 * testsuite/plugin_common_test_2.c: New test case.
7688 * testsuite/Makefile.am (plugin_test_6): New test case.
7689 * testsuite/Makefile.in: Regenerate.
7691 2010-04-06 Nick Clifton <nickc@redhat.com>
7693 * po/vi.po: New Vietnamese translation.
7695 2010-03-30 Doug Kwan <dougkwan@google.com>
7697 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7699 2010-03-25 Doug Kwan <dougkwan@google.com>
7701 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7702 to avoid a conversion warning on a 32-bit host.
7704 2010-03-24 Ian Lance Taylor <iant@google.com>
7706 * testsuite/script_test_3.t: Add a TLS segment.
7707 * testsuite/Makefile.am (check_PROGRAMS): Add
7708 tls_phdrs_script_test.
7709 (tls_phdrs_script_test_SOURCES): Define.
7710 (tls_phdrs_script_test_DEPENDENCIES): Define.
7711 (tls_phdrs_script_test_LDFLAGS): Define.
7712 (tls_phdrs_script_test_LDADD): Define.
7713 * testsuite/Makefile.in: Rebuild.
7715 2010-03-23 Cary Coutant <ccoutant@google.com>
7717 * fileread.cc (find_or_make_view): Fix comment.
7719 2010-03-23 Ian Lance Taylor <iant@google.com>
7721 * script-sections.cc (class Orphan_section_placement): Define
7722 PLACE_TLS and PLACE_TLS_BSS.
7723 (Orphan_section_placement::Orphan_section_placement): Initialize
7725 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7726 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7727 (tls_script_test_SOURCES): Define.
7728 (tls_script_test_DEPENDENCIES): Define.
7729 (tls_script_test_LDFLAGS): Define.
7730 (tls_script_test_LDADD): Define.
7731 * testsuite/Makefile.in: Rebuild.
7733 2010-03-22 Doug Kwan <dougkwan@google.com>
7735 * arm.cc (Arm_relocate_functions::abs8,
7736 Arm_relocate_functions::abs16): Use correct check for overflow
7737 specified in the ARM ELF specs.
7738 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
7739 target of a BLX instruction specially.
7740 (Reloc_stub::stub_type_for_reloc): Ditto.
7741 (Relocate::relocate): Use symbolic names instead of numeric relocation
7742 codes to report error.
7743 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7745 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7746 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7747 thumb2_blx_out_of_range.stdout
7748 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7749 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7750 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7751 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7752 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7753 thumb2_blx_in_range, thumb2_blx_in_range.o,
7754 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7755 thumb2_blx_out_of_range.o): New rules.
7756 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7757 thumb2_blx_in_range and thumb2_blx_out_of_range.
7758 * testsuite/Makefile.in: Regenerate.
7759 * arm_branch_in_range.sh: Add tests for THUMB BLX.
7760 * testsuite/thumb_blx_in_range.s: New file.
7761 * testsuite/thumb_blx_out_of_range.s: New file.
7763 2010-03-22 Rafael Espindola <espindola@google.com>
7765 * archive.cc (Should_include): Move to archive.h.
7766 (should_include_member): Make it a member of Archive.
7768 (Add_lib_group_symbols): New.
7769 * archive.h: Include options.h.
7770 (Archive_member): Moved from Archive.
7771 (Should_include): Moved from archive.cc.
7773 (Add_lib_group_symbols): New.
7774 * dynobj.cc (do_should_include_member): New.
7775 * dynobj.h (do_should_include_member): New.
7776 * gold.cc (queue_initial_tasks): Update call to queue.
7777 * main.cc (main): Print lib group stats.
7778 * object.cc (do_should_include_member): New.
7779 * object.h: Include archive.h.
7780 (Object::should_include_member): New.
7781 (Object::do_should_include_member): New.
7782 (Sized_relobj::do_should_include_member): New.
7783 * options.cc (General_options::parse_start_lib): New.
7784 (General_options::parse_end_lib): New.
7785 (Input_arguments::add_file): Handle lib groups.
7786 (Input_arguments::start_group): Check we are not in a lib.
7787 (Input_arguments::start_lib): New.
7788 (Input_arguments::end_lib): New.
7789 * options.h (General_options): Add start_lib and end_lib.
7790 (Input_argument::lib_): New.
7791 (Input_argument::lib): New.
7792 (Input_argument::is_lib): New.
7793 (Input_file_lib): New.
7794 (Input_arguments::in_lib_): New.
7795 (Input_arguments::in_lib): New.
7796 (Input_arguments::start_lib): New.
7797 (Input_arguments::end_lib_): New.
7798 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7799 in unused members as preempted.
7800 (Sized_pluginobj::do_should_include_member): New.
7801 * plugin.h (Sized_pluginobj::do_should_include_member): New.
7802 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7804 (Read_symbols::do_whole_lib_group): New.
7805 (Read_symbols::do_lib_group): New.
7806 (Read_symbols::do_read_symbols): Handle lib groups.
7807 (Read_symbols::get_name): Handle lib groups.
7808 * readsyms.h (Read_symbols): Add an archive member pointer.
7809 (Read_symbols::do_whole_lib_group): New.
7810 (Read_symbols::do_lib_group): New.
7811 (Read_symbols::member_): New.
7812 * script.cc (read_input_script): Update call to queue_soon.
7814 2010-03-19 Doug Kwan <dougkwan@google.com>
7816 * arm.cc (Stub_table::Stub_table): Initialize new data members
7817 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7818 (Stub_table::add_reloc_stub): Assign stub offset and update
7819 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7820 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7822 (Stub_table::update_data_size_and_addralign): Use
7823 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7824 instead of going over all reloc stubs.
7825 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7826 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7827 Stringpool_template::offset_ to size of Stringpool_char.
7828 (Stringpool_template::new_key_offset): Remove code to initialize
7829 Stringpool_template::offset_.
7830 * stringpool.h (Stringpool_template::set_no_zero_null): Set
7831 Stringpool_template::offset_ to zero.
7833 2010-03-15 Doug Kwan <dougkwan@google.com>
7835 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7837 (Stringpool_template::new_key_offset): New method.
7838 (Stringpool_template::add_string): Assign offsets when adding new
7840 (Stringpool_template::set_string_offsets): Do not set string offsets
7841 when not optimizing.
7842 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7844 (Chunked_vector::clear): Clear size_.
7845 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7846 (Chunked_vector::size): Return size_.
7847 (Chunked_vector::push_back): Use size_ to find insert position.
7848 (Chunked_vector::size_): New data member.
7849 (Stringpool_template::set_no_zero_null): Assert string set is empty.
7850 (Stringpool_template::new_key_offset): New method declaration.
7851 (Stringpool_template::offset_): New data member.
7853 2010-03-15 Rafael Espindola <espindola@google.com>
7855 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7856 Add_symbols' constructor.
7857 * readsyms.h (Add_symbols): Remove the input_group member.
7859 2010-03-10 Ian Lance Taylor <iant@google.com>
7861 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7862 target to ask whether a reference to a symbol requires a stack
7864 * target.h (Target::is_call_to_non_split): New function.
7865 (Target::do_is_call_to_non_split): Declare virtual function.
7866 * target.cc: Include "symtab.h".
7867 (Target::do_is_call_to_non_split): New function.
7868 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7870 2010-03-10 Cary Coutant <ccoutant@google.com>
7872 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7873 (File_read::open[1]): Remove initial mapping of whole_file_view_.
7874 (File_read::open[2]): Add whole_file_view_ to list of views.
7875 (File_read::make_view): Remove test of whole_file_view_.
7876 (File_read::find_or_make_view): Create whole_file_view_ if
7878 (File_read::clear_views): Replace bool parameter with enum;
7879 adjust all callers. Don't delete views with permanent data;
7880 do delete cached views and views from archives if
7881 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
7882 if clearing the corresponding view.
7883 * fileread.h (File_read::Clear_views_mode): New enum.
7884 (File_read::View::is_permanent_view): New method.
7885 (File_read::clear_views): Replace bool parameter
7886 with enum; adjust all callers.
7887 * options.h (General_options): Change keep_files_mapped option;
7888 add map_whole_files.
7889 * readsyms.cc (Add_symbols::run): Delete sd_ object before
7891 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7894 2010-03-10 David S. Miller <davem@davemloft.net>
7896 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7898 2010-03-09 Sriraman Tallam <tmsriram@google.com>
7900 * icf.cc (get_section_contents): Add '@' marker after processing the
7903 2010-03-08 Doug Kwan <dougkwan@google.com>
7905 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7906 due to a conversion warning.
7907 (Arm_relobj::update_output_local_symbol_count): Check for local
7908 symbol with unset output index.
7910 2010-03-05 Ian Lance Taylor <iant@google.com>
7912 * options.h (class General_options): Add --spare-dynamic-tags.
7913 * output.cc (Output_data_dynamic::set_final_data_size): Implement
7914 --spare-dynamic-tags.
7916 2010-03-05 Ian Lance Taylor <iant@google.com>
7918 * incremental.cc: Include "libiberty.h".
7920 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
7922 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7923 function, is_info_ member.
7924 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7925 (Versions::Versions): Update caller.
7926 (Versions::define_base_version): Likewise.
7927 (Versions::add_def): Likewise.
7929 2010-03-03 Sriraman Tallam <tmsriram@google.com>
7931 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7932 (Scan::possible_function_pointer_reloc): New function.
7933 (Scan::local_reloc_may_be_function_pointer): Change to call
7934 possible_function_pointer_reloc.
7935 (Scan::global_reloc_may_be_function_pointer): Ditto.
7936 * icf.h (Icf::check_section_for_function_pointers): Change to reject
7937 relocations in ".data.rel.ro._ZTV" section.
7938 * testsuite/icf_safe_so_test.sh: Change to pass i386.
7939 * testsuite/icf_safe_so_test.cc: Ditto.
7940 * testsuite/icf_safe_test.cc: Ditto.
7941 * testsuite/icf_safe_test.sh: Ditto.
7943 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7944 Ian Lance Taylor <iant@google.com>
7946 * target-reloc.h (relocate_section): Check the symbol table index
7947 for -1U before setting the local symbol index.
7948 (scan_relocatable_relocs): If copying the relocation, record that
7949 the local symbol is required.
7950 * object.h (Symbol_value::is_output_symtab_index_set): New
7952 (Symbol_value::may_be_discarded_from_output_symtab): New
7954 (Symbol_value::has_output_symtab_entry): New function.
7955 (Symbol_value::needs_output_symtab_entry): Remove.
7956 (Symbol_value::output_symtab_index): Make sure the symbol index is
7958 (Symbol_value::set_output_symtab_index): Make sure the symbol
7959 index is not set. Make sure the new index is valid.
7960 (Symbol_value::set_must_have_output_symtab_entry): New function.
7961 (Symbol_value::has_output_dynsym_entry): New function.
7962 (Symbol_value::set_output_dynsym_index): Make sure the new index
7964 (Sized_relobj::set_must_have_output_symtab_entry): New function.
7965 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7966 local symbol if permitted.
7967 (Sized_relobj::do_finalize_local_symbols): Call
7968 is_output_symtab_index_set rather than needs_output_symtab_entry.
7969 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7970 rather than needs_output_symtab_entry. Call
7971 has_output_dynsym_entry rather than needs_output_dynsym_entry.
7972 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7973 is_output_symtab_index_set rather than needs_output_symtab_entry.
7974 * testsuite/discard_locals_relocatable_test.c: New file.
7975 * testsuite/discard_locals_test.sh: Test -r.
7976 * testsuite/Makefile.am (check_DATA): Add
7977 discard_locals_relocatable_test1.syms,
7978 discard_local_relocatable_test2.syms.
7979 (MOSTLYCLEANFILES): Likewise. Also add
7980 discard_locals_relocatable_test1.lout and
7981 discard_locals_relocatable_test2.out.
7982 (discard_locals_relocatable_test1.syms): New target.
7983 (discard_locals_relocatable_test.o): New target.
7984 (discard_locals_relocatable_test1.out): New target.
7985 (discard_locals_relocatable_test2.syms): New target.
7986 (discard_locals_relocatable_test2.out): New target.
7987 (various): Add missing ../ld-new dependencies.
7988 * testsuite/Makefile.in: Rebuild.
7990 2010-03-03 Nick Clifton <nickc@redhat.com>
7992 * po/fi.po: New Finnish translation.
7994 2010-03-01 Doug Kwan <dougkwan@google.com>
7996 * layout.cc (Layout::Layout): Force section types of .init_array*,
7997 .preinit_array* and .fini_array* sections.
7998 * output.cc (Output_section::Input_section_sort_entry::has_priority):
7999 Fix check of return value of std::string::find.().
8000 (Output_section::Input_section_sort_compare::operator()): Remove
8001 comment about .init_array.
8002 (Output_section::Input_section_sort_init_fini_compare::operator()):
8004 (Output_section::sort_attached_input_sections): Handle .init_array
8005 and .fini_array specially.
8006 * output.h (Output_section::Inut_section_sort_compare): Update
8008 (Output_section::Input_section_sort_init_fini_compare): New struct.
8010 2010-02-26 Doug Kwan <dougkwan@google.com>
8012 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8013 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8014 * testsuite/debug_msg.sh: Avoid matching source line number for
8015 use of global variable undef_int.
8017 2010-02-26 Doug Kwan <dougkwan@google.com>
8019 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8020 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8021 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8022 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8023 * options.cc (General_options::General_options): Initialize member
8025 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8026 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8027 and rm_no_fix_v4bx.stdout
8028 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8029 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8030 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8031 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8032 and arm_no_fix_v4bx.
8033 * Makefile.in: Regenerate.
8034 * testsuite/arm_fix_v4bx.s: New file.
8035 * testsuite/arm_fix_v4bx.sh: Ditto.
8037 2010-02-24 Doug Kwan <dougkwan@google.com>
8039 * arm.cc (Target_arm::got_section): Make the .got section the first
8040 non RELRO section in the data segment.
8041 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8042 suffixes of section names.
8044 2010-02-24 Doug Kwan <dougkwan@google.com>
8046 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8047 flags and attributes merging if an input file is a binary file.
8048 * fileread.cc (Input_file::open): Record format of original file.
8049 * fileread.h (Input_file::Format): New enum type.
8050 (Input_file::Input_file): Initialize data member format_.
8051 (Input_file::format): New method definition.
8052 (Input_file::format_):: New data member.
8054 2010-02-24 Doug Kwan <dougkwan@google.com>
8056 * arm.cc (Arm_output_data_got): New class.
8057 (ARM_TCB_SIZE): New constant
8058 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8059 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8060 If user uses a script with a SECTIONS clause, issue only a warning
8061 for a misplaced EXIDX input section. Otherwise, issue an error.
8062 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8064 (Target_arm::got_mode_index_entry): Handle static linking.
8065 (Target_arm::Scan::local): Ditto.
8066 (Target_arm::Scan::global): Ditto.
8067 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
8068 all incorrectly implemented relocations.
8069 (Target_arm::fix_exidx_coverage): Pass layout to
8070 Arm_output_section::fix_exidx_coverage.
8071 * layout.cc (Layout::section_name_mapping): Remove trailing dots
8072 from ".ARM.exidx." and ".ARM.extab.".
8074 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8076 * arm.cc (Target_arm::do_finalize_sections): Create attribute
8077 section if it does not already exist.
8078 * attributes.cc (Attributes_section_data::Attributes_section_data):
8079 Don't crash if size is zero.
8081 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8082 Ian Lance Taylor <iant@google.com>
8084 * gold.cc (queue_middle_tasks): If no input files were opened,
8086 * workqueue.h (Task_function::Task_function): Assert that there is
8089 2010-02-22 Doug Kwan <dougkwan@google.com>
8091 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8092 * icf.cc (get_section_contents): Cast snprintf arguments to long long
8093 types to avoid warnings due to different uint64_t implementations
8096 2010-02-21 Doug Kwan <dougkwan@google.com>
8098 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8099 handling of the maximum backward branch offset.
8100 (Arm_relocate_functions::thumb_branch_common): Ditto.
8101 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8102 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8103 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8104 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8105 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8106 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8107 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8108 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8109 thumb_bl_out_of_range thumb_bl_out_of_range.o,
8110 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8111 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8112 thumb2_bl_out_of_range.o): New rules.
8113 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8114 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8115 thumb2_bl_out_of_range
8116 * testsuite/Makefile.in: Regenerate.
8117 * testsuite/arm_bl_in_range.s: New file.
8118 * testsuite/arm_bl_out_of_range.s: Ditto.
8119 * testsuite/arm_branch_in_range.sh: Ditto.
8120 * testsuite/arm_branch_range.t: Ditto.
8121 * testsuite/thumb2_branch_range.t: Ditto.
8122 * testsuite/thumb_bl_in_range.s: Ditto.
8123 * testsuite/thumb_bl_out_of_range.s: Ditto.
8124 * testsuite/thumb_branch_range.t: Ditto.
8126 2010-02-20 Sriraman Tallam <tmsriram@google.com>
8128 * gc.h (gc_process_relocs): Change vectors to point to the new list.
8129 Add reloc offset information.
8130 * icf.cc (get_section_contents): Change iterators to point to the new
8131 vectors. Add reloc offset information to the contents.
8132 * icf.h (Icf::Sections_reachable_info): New typedef.
8133 (Icf::Sections_reachable_list): New typedef.
8134 (Icf::Offset_info): New typedef.
8135 (Icf::Reloc_info): New struct typedef.
8136 (Icf::Reloc_info_list): New typedef.
8137 (Icf::symbol_reloc_list): Delete method.
8138 (Icf::addend_reloc_list): Delete method.
8139 (Icf::section_reloc_list): Delete method.
8140 (Icf::reloc_info_list): New method.
8141 (Icf::reloc_info_list_): New member.
8143 2010-02-19 Doug Kwan <dougkwan@google.com>
8145 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8146 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8147 * arm.cc (Arm_relocation_functions): New forward declaration.
8148 (Target_arm::Target_arm): Initialize new data members
8149 got_mod_index_offset_ and tls_base_symbol_defined_.
8150 (Target_arm::Relocate::relocate_tls): New method.
8151 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8152 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8154 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8155 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8156 (Target_arm::got_mod_index_offset_,
8157 Target_arm::tls_base_symbol_defined_): New data members.
8158 (Target_arm::Scan::local, Target::Scan::global,
8159 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8162 2010-02-18 Doug Kwan <dougkwan@google.com>
8164 * arm.cc (Arm_relobj::find_linked_text_section): New method.
8165 (Arm_relobj::make_exidx_input_section): Pass section index of linked
8166 text section as a parameter becuase some broken tools may not set
8167 the link in section header.
8168 (Target_arm::has_got_section): New method.
8169 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8170 without any mapping symbol as data only. Remove warning.
8171 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8172 link in its section header, try to discover the link by inspecting the
8173 REL31 relocation at the beginning of the section.
8174 (Target_arm::Scan::check_non_pic): Report name of offending relocation
8176 (Target_arm::Scan::global): Treat any reference to the symbol
8177 _GLOBAL_OFFSET_TABLE_ as a GOT access.
8179 2010-02-12 Sriraman Tallam <tmsriram@google.com>
8181 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8182 (Scan::global_reloc_may_be_function_pointer): New function.
8183 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8184 (Scan::global_reloc_may_be_function_pointer): New function.
8185 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8186 (Scan::global_reloc_may_be_function_pointer): New function.
8187 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8188 (Scan::global_reloc_may_be_function_pointer): New function.
8189 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8190 (Scan::global_reloc_may_be_function_pointer): New function.
8191 (Scan::possible_function_pointer_reloc): New function.
8192 (Target_x86_64::can_check_for_function_pointers): New function.
8193 * gc.h (gc_process_relocs): Scan relocation types to determine if
8194 function pointers were taken for targets that support it.
8195 * icf.cc (Icf::find_identical_sections): Include functions for
8196 folding in safe ICF whose pointer is not taken.
8197 * icf.h (Secn_fptr_taken_set): New typedef.
8198 (fptr_section_id_): New member.
8199 (section_has_function_pointers): New function.
8200 (set_section_has_function_pointers): New function.
8201 (check_section_for_function_pointers): New function.
8202 * options.h: Fix comment for safe ICF option.
8203 * target.h (can_check_for_function_pointers): New function.
8204 * testsuite/Makefile.am: Add icf_safe_so_test test case.
8205 Modify icf_safe_test for X86-64.
8206 * testsuite/Makefile.in: Regenerate.
8207 * testsuite/icf_safe_so_test.cc: New file.
8208 * testsuite/icf_safe_so_test.sh: New file.
8209 * testsuite/icf_safe_test.cc (kept_func_3): New function.
8210 (main): Change to take pointer to function kept_func_3.
8211 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8212 folding is done correctly for X86-64.
8214 2010-02-12 David S. Miller <davem@davemloft.net>
8216 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8217 is_symbolless parameter.
8218 (Output_reloc<SHT_REL>::is_symbolless): New.
8219 (Output_reloc<SHT_REL>::is_symbolless_): New.
8220 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8221 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8222 (Output_reloc<SHT_RELA>::is_symbolless): New.
8223 (Output_data_reloc::add_global): Handle is_symbolless.
8224 (Output_data_reloc::add_global_relative): Likewise.
8225 (Output_data_reloc::add_local): Likewise.
8226 (Output_data_reloc::add_local_relative): Likewise.
8227 (Output_data_reloc::add_symbolless_global_addend): New.
8228 (Output_data_reloc::add_symbolless_local_addend): New.
8229 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8231 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8232 instead of ->is_relative_
8233 (Output_reloc::write): Likewise.
8234 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8235 (Output_reloc::write_rel): Simplify.
8237 * sparc.cc (Target_sparc::Scan::local): Use
8238 ->add_symbolless_local_addend as needed.
8239 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8240 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
8241 based upon relocation offset.
8243 2010-02-11 Doug Kwan <dougkwan@google.com>
8245 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8246 (Target_arm::Scan::global): Ditto. Also remove a comment before the
8247 beginning of function.
8248 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8249 and MOVT_ABS relocations. Those are non issued in scanning. Fix
8250 parameter is_32bit in calls to should_apply_static_reloc.
8251 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8252 (check_DATA): Add arm_abs_global.stdout.
8253 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8254 arm_abs_global.stdout): New rules.
8255 (MOSTLLYCLEANFILES): Add arm_abs_global
8256 * Makefile.in: Regenerate.
8257 * testsuite/arm_abs_global.s: New file.
8258 * testsuite/arm_abs_global.sh: Ditto.
8259 * testsuite/arm_abs_lib.s: Ditto.
8261 2010-02-11 Ian Lance Taylor <iant@google.com>
8263 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8265 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
8266 Allocate_commons_task first.
8267 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8268 task, rather than symtab_lock_.
8269 (Gc_process_relocs::~Gc_process_relocs): New function.
8270 (Gc_process_relocs::is_runnable): Check this_blocker_.
8271 (Gc_process_relocs::locks): Use next_blocker_ rather than
8273 (Scan_relocs::~Scan_relocs): New function.
8274 (Scan_relocs::is_runnable): Check this_blocker_ rather than
8276 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
8278 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8279 fields. Add this_blocker_ and next_blocker_ fields. Adjust
8280 constructor accordingly.
8281 (class Gc_process_relocs): Likewise.
8282 (class Scan_relocs): Likewise.
8283 * common.h (class Allocate_commons_task): Remove symtab_lock_
8284 field, and corresponding constructor parameter.
8285 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8287 (Allocate_commons_task::locks): Likewise.
8289 2010-02-11 Ian Lance Taylor <iant@google.com>
8291 * gold-threads.h (class Once): Define.
8292 (class Initialize_lock): Rewrite as child of Once.
8293 * gold-threads.cc (class Once_initialize): Define.
8294 (once_pointer_control): New static variable.
8295 (once_pointer, once_arg): New static variables.
8296 (c_run_once): New static function.
8297 (Once::Once, Once::run_once, Once::internal_run): New functions.
8298 (class Initialize_lock_once): Remove.
8299 (initialize_lock_control): Remove.
8300 (initialize_lock_pointer): Remove.
8301 (initialize_lock_once): Remove.
8302 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8303 (Initialize_lock::initialize): Rewrite.
8304 (Initialize_lock::do_run_once): New function.
8305 * archive.cc (Archive::interpret_header): Only clear name if it is
8307 * fileread.cc: Include "gold-threads.h"
8308 (file_counts_lock): New static variable.
8309 (file_counts_initialize_lock): Likewise.
8310 (File_read::release): Only increment counts when using --stats.
8311 Use a lock around the increment.
8312 * parameters.cc (class Set_parameters_target_once): Define.
8313 (set_parameters_target_once): New static variable.
8314 (Parameters::Parameters): Move here from parameters.h.
8315 (Parameters::set_target): Rewrite.
8316 (Parameters::set_target_once): New function.
8317 (Parameters::clear_target): Move here and rewrite.
8318 * parameters.h (class Parameters): Update declarations. Add
8319 set_parameters_target_once_ field.
8320 (Parameters::Parameters): Move to parameters.cc.
8321 (Parameters::clear_target): Likewise.
8322 * readsyms.cc (Read_symbols::do_group): Create a Start_group
8324 (Start_group::~Start_group): New function.
8325 (Start_group::is_runnable): New function.
8326 (Start_group::locks, Start_group::run): New functions.
8327 (Finish_group::run): Change saw_undefined to size_t.
8328 * readsyms.h (class Start_group): Define.
8329 (class Finish_group): Change saw_undefined_ field to size_t.
8330 (Finish_group::Finish_group): Remove saw_undefined and
8331 this_blocker parameters. Change all callers.
8332 (Finish_group::set_saw_undefined): New function.
8333 (Finish_group::set_blocker): New function.
8334 * symtab.h (class Symbol_table): Change saw_undefined to return
8335 size_t. Change saw_undefined_ field to size_t.
8336 * target-select.cc (Set_target_once::do_run_once): New function.
8337 (Target_selector::Target_selector): Initialize set_target_once_
8338 field. Don't initialize lock_ and initialize_lock_ fields.
8339 (Target_selector::instantiate_target): Rewrite.
8340 (Target_selector::set_target): New function.
8341 * target-select.h (class Set_target_once): Define.
8342 (class Target_selector): Update declarations. Make
8343 Set_target_once a friend. Remove lock_ and initialize_lock_
8344 fields. Add set_target_once_ field.
8346 2010-02-10 Ian Lance Taylor <iant@google.com>
8348 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8350 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
8351 (queue_middle_tasks): Add all blockers before queueing any tasks.
8352 (queue_final_tasks): Likewise.
8353 * token.h (Task_token::add_blockers): New function.
8354 * object.h (Input_objects::number_of_relobjs): New function.
8356 2010-02-10 Ian Lance Taylor <iant@google.com>
8358 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8359 shared, not if not position independent.
8360 * x86_64.cc (Relocate::relocate_tls): Likewise.
8361 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8362 (tls_pie_pic_test): New target.
8363 * testsuite/Makefile.in: Rebuild.
8365 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8366 (tls_test_main_pie.o, tls_test_pie.o): New targets.
8367 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8368 * testsuite/Makefile.in: Rebuild.
8370 2010-02-09 David S. Miller <davem@davemloft.net>
8372 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8373 R_SPARC_RELATIVE using ->add_local_relative().
8374 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8376 * output.h (Output_data_dynamic::add_section_size): New method
8377 that takes two Output_data objects.
8378 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8379 entry param. Handle it in initializers.
8380 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8381 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8382 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8384 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8385 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8386 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8387 for dynrel_includes_plt.
8388 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8389 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8390 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8392 (Target_sparc::do_finalize_sections): Update to pass true for
8393 dynrel_includes_plt.
8394 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8395 output before .rela.plt
8396 (Target_powerpc::do_finalize_sections): Update to pass true for
8397 dynrel_includes_plt when 32-bit.
8399 2010-02-08 Doug Kwan <dougkwan@google.com>
8401 * arm.cc (Arm_relobj::simple_input_section_output_address): New
8403 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8404 Arm_relobj::scan_section_for_cortex_a8_stubs,
8405 Arm_relobj::do_relocation_section): Instead of calling
8406 Output_section::output_address, use faster
8407 Arm_relobj::simple_input_section_output_address.
8409 2010-02-08 David S. Miller <davem@davemloft.net>
8411 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8412 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8413 relocation helper function.
8415 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8416 just like R_SPARC_GOT{10,13,22}.
8417 (Target_sparc::Scan::local): Likewise.
8418 (Target_sparc::Relocate:relocate): Likewise.
8420 2010-02-06 Ian Lance Taylor <iant@google.com>
8422 * configure.ac: Rewrite targetobjs duplicate removal code to use
8423 only shell constructs.
8424 * configure: Rebuild.
8426 2010-02-05 Doug Kwan <dougkwan@google.com>
8429 * arm.cc (Arm_relobj::section_is_scannable): New method.
8430 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8431 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8433 2010-02-04 Doug Kwan <dougkwan@google.com>
8436 * arm-reloc-property.cc (cstdio): Include.
8437 * configure.ac (targetobjs): Remove duplicates.
8438 * configure: Regenerate.
8439 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8440 big and little endian version for a given address size.
8442 2010-02-03 Doug Kwan <dougkwan@google.com>
8444 * arm-reloc-property.cc
8445 (Arm_reloc_property_table::reloc_name_in_error_message): New method
8447 * arm-reloc-property.h
8448 (Arm_reloc_property_table::get_implemented_static_reloc_property):
8449 New method definition.
8450 (Arm_reloc_property_table::reloc_name_in_error_message): New method
8452 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8454 (GOT_PREL): Change implemented to Y.
8455 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8456 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8457 (Arm_relocate_functions::movw_abs_nc): Remove method.
8458 (Arm_relocate_functions::movt_abs): Ditto.
8459 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8460 (Arm_relocate_functions::thm_movt_abs): Ditto.
8461 (Arm_relocate_functions::movw_rel_nc): Ditto.
8462 (Arm_relocate_functions::movw_rel): Ditto.
8463 (Arm_relocate_functions::movt_rel): Ditto.
8464 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8465 (Arm_relocate_functions:thm_movw_rel): Ditto.
8466 (Arm_relocate_functions:thm_movt_rel): Ditto.
8467 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8468 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8469 New method definitions.
8470 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8471 (Arm_relocation_functions::arm_grp_ldr): Ditto.
8472 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8473 (Arm_relocation_functions::arm_grp_ldc): Ditto.
8474 (Target_arm::Relocate::relocate): Check for non-static or
8475 unimplemented relocation code and exit early. Change calls to
8476 Target_arm::reloc_uses_thumb_bit and
8477 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8478 instead. Refactor code to handle similar relocations to increase
8479 code sharing. Remove check for unsupported relocation code in switch
8481 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8482 relocation property table to find out size. Change error message to
8483 print out the name of a relocation code instead of the numeric value.
8484 (Target_arm::scan_reloc_for_stub): Use relocation property table
8485 instead of calling Target_arm::reloc_uses_thumb_bit().
8487 2010-02-02 Doug Kwan <dougkwan@google.com>
8489 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8490 types of relaxed input section.
8492 2010-02-02 Doug Kwan <dougkwan@google.com>
8494 * Makefile.am (HFILES): Add arm-reloc-property.h.
8496 (TARGETSOURCES): Add arm-reloc-property.cc
8497 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8498 (libgold_a_SOURCES): $(DEFFILES)
8499 * Makefile.in: Regenerate.
8500 * arm-reloc-property.cc: New file.
8501 * arm-reloc-property.h: New file.
8502 * arm-reloc.def: New file.
8503 * arm.cc: Update comments.
8504 (arm-reloc-property.h): New included header.
8505 (arm_reloc_property_table): New global variable.
8506 (Target_arm::do_select_as_default_target): New method definition.
8507 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8508 arm-reloc-property to targ_extra_obj.
8509 * parameters.cc (set_parameters_target): Call
8510 Target::select_as_default_target().
8511 * target.h (Target::select_as_default_target): New method definition.
8512 (Target::do_select_as_default_target): Same.
8514 2010-02-01 Doug Kwan <dougkwan@google.com>
8516 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8517 first_output_text_section_.
8518 (Arm_exidx_fixup::first_output_text_section): New method definition.
8519 (Arm_exidx_fixup::first_output_text_section_): New data member.
8520 (Arm_exidx_fixup::process_exidx_section): Record the first text
8521 output section seen.
8522 (Arm_output_section::fix_exidx_coverage): Set correct linked section
8523 and entsize in output section header.
8525 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8527 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8528 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8529 (Arm_relocate_functions::thm_alu11): New Method.
8530 (Arm_relocate_functions::thm_pc8): New Method.
8531 (Arm_relocate_functions::thm_pc12): New Method.
8532 (Target_arm::Scan::local): Handle the relocations.
8533 (Target_arm::Scan::global): Likewise.
8534 (Target_arm::Relocate::relocate): Likewise.
8535 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8537 2010-01-29 Doug Kwan <dougkwan@google.com>
8539 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8540 of relocation types as ld.
8542 2010-01-29 Doug Kwan <dougkwan@google.com>
8544 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8546 (Arm_relocate_functions::thumb_branch_common): Ditto.
8547 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8548 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8549 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8550 Arm_relocate_functions::jump24): Remove.
8551 (Target_arm::Relocate::relocate): Adjust code to call
8552 Arm_relocation_functions::arm_branch_common and
8553 Arm_relocation_functions::thumb_branch_common instead of their removed
8554 wrappers. Merge switch-cases together to reduce source code size.
8556 2010-01-29 Doug Kwan <dougkwan@google.com>
8558 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8559 output_local_symbol_count_needs_update_.
8560 (Arm_relobj::output_local_symbol_count_needs_update,
8561 Arm_relobj::set_output_local_symbol_count_needs_update,
8562 Arm_relobj::update_output_local_symbol_count): New methods.
8563 (Arm_relobj::output_local_symbol_count_needs_update_): New data
8565 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8566 of pointed function as in a R_ARM_PREL31 relocation.
8567 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8568 for output local symbol count updating.
8569 (Target_arm::do_relax): Update output local symbol counts in objects
8571 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8573 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8575 * arm.cc: Added support for the ARM relocations:
8576 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8577 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8578 (Arm_relocate_functions::movw_rel_nc): Renamed (was
8580 (Arm_relocate_functions::movw_rel): New method.
8581 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8582 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8584 (Arm_relocate_functions::thm_movw_rel): New method.
8585 (Arm_relocate_functions::thm_movt_rel): Renamed (was
8587 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8589 (Target_arm::Scan::global): Likewise.
8590 (Target_arm::Relocate::relocate): Likewise.
8591 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8594 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8596 * arm.cc: Added support for ARM group relocations.
8597 (Target_arm::reloc_needs_sym_origin): New method.
8598 (Arm_relocate_functions::calc_grp_kn): New method.
8599 (Arm_relocate_functions::calc_grp_residual): New method.
8600 (Arm_relocate_functions::calc_grp_gn): New method.
8601 (Arm_relocate_functions::arm_grp_alu): New Method.
8602 (Arm_relocate_functions::arm_grp_ldr): New Method.
8603 (Arm_relocate_functions::arm_grp_ldrs): New Method.
8604 (Arm_relocate_functions::arm_grp_ldc): New Method.
8605 (Target_arm::Scan::local): Handle the ARM group relocations.
8606 (Target_arm::Scan::global): Likewise.
8607 (Target_arm::Relocate::relocate): Likewise.
8608 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8611 2010-01-26 Doug Kwan <dougkwan@google.com>
8613 * arm.cc (set): Include.
8614 (class Arm_exidx_fixup): Change type of last_input_section_ to const
8616 (Arm_output_section::Text_section_list): New type.
8617 (Arm_output_section::append_text_sections_to_list): New method.
8618 (Arm_output_section::fix_exidx_coverage): Ditto.
8619 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8620 (Arm_relobj::convert_input_section_to_relaxed_section): Use
8621 Relobj::set_section_offset() instead of
8622 Sized_relobj::invalidate_section_offset().
8623 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8624 parameter for section headers. Ignore relocation sections for
8625 unallocated sections and EXIDX sections.
8626 (Target_arm::fix_exidx_coverage): New method.
8627 (Target_arm::output_section_address_less_than): New type.
8628 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8629 linked text section instead of the EXIDX section.
8630 (Arm_output_section::create_stub_group): Add an assertion to check
8631 that this is not an EXIDX output section.
8632 (Arm_output_section::append_text_sections_to_list): New method.
8633 (Arm_output_section::fix_exidx_coverage): Ditto.
8634 (Arm_relobj::scan_sections_for_stubs): Adjust call to
8635 Arm_relobj::section_needs_reloc_stub_scanning.
8636 (Target_arm::do_relax): Fix EXIDX output section coverage in the
8638 (Target_arm::fix_exidx_coverage): New method.
8639 * object.h (Relobj::set_output_section): New method.
8640 (Sized_relobj::invalidate_section_offset): Remove method.
8641 (Sized_relobj::do_invalidate_section_offset): Remove method.
8642 (Sized_relobj::do_set_section_offset): Handle offset value -1.
8644 2010-01-25 Doug Kwan <dougkwan@google.com>
8646 * arm.cc (Arm_exidx_merged_section::do_output_offset):
8647 Fix warning due to signed and unsigned comparison on a 32-bit host.
8649 2010-01-22 Doug Kwan <dougkwan@google.com>
8651 * arm.cc (Target_arm::do_relax): Record an output section for section
8652 offset adjustment it contains any stub table that has changed.
8653 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8654 offsets in an output section if necessary.
8655 * output.cc (Output_section::Output_section): Initialize
8656 section_offsets_need_adjustments_.
8657 (Output_section::add_input_section_for_script): Renamed to
8658 Output_section::add_simple_input_section.
8659 (Output_section::save_states): Add a comment.
8660 (Output_section::discard_states): New method defintion.
8661 (Output_section::adjust_section_offsets): Same.
8662 * output.h (Output_section::add_input_section_for_script): Renamed to
8663 Output_section::add_simple_input_section.
8664 (Output_section::discard_states): New method declaration.
8665 (Output_section::adjust_section_offsets): Same.
8666 (Output_section::section_offsets_need_adjustment,
8667 Output_section::set_section_offsets_need_adjustment): New method
8669 (Output_section::section_offsets_need_adjustment_): New data member.
8670 * script-sections.cc
8671 (Output_section_element_input::set_section_address): Adjust code for
8672 renaming of Output_section::add_input_section_for_script.
8673 (Orphan_output_section::set_section_address): Same.
8675 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8677 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8678 Fix_v4bx enum values .
8679 * gold/options.h (General_options): New option definitions.
8680 (General_options::fix_v4bx): New method.
8681 (General_options::Fix_v4bx): New enum.
8682 * gold/options.cc (General_options::parse_fix_v4bx): New method.
8683 (General_options::parse_fix_v4bx_interworking): New method.
8685 2010-01-22 Doug Kwan <dougkwan@google.com>
8687 * arm.cc (Arm_exidx_fixup): New class.
8689 2010-01-21 Doug Kwan <dougkwan@google.com>
8691 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8693 (Arm_exidx_section_offset_map): New type.
8695 2010-01-21 Doug Kwan <dougkwan@google.com>
8697 * arm.cc (Arm_exidx_input_section): New class.
8698 (Arm_relobj::exidx_input_section_by_link,
8699 Arm_relobj::exidx_input_section_by_shndx,
8700 Arm_relobj::make_exidx_input_section): New methods.
8701 (read_arm_attributes_section): Remove.
8702 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8703 information about them.
8704 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8707 2010-01-20 Doug Kwan <dougkwan@google.com>
8709 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8710 Input_section_specifier to Section_id.
8711 (Target_arm::new_arm_input_section: Adjust code for change of key
8713 (Target_arm::find_arm_input_section): Ditto.
8714 * gc.h (object.h): Include for Section_id nand Section_id_hash.
8715 (Section_id): Remove.
8716 (Garbage_collection::Section_id_hash): Remove.
8717 * icf.h (object.h): Include for Section_id nand Section_id_hash.
8718 (Section_id): Remove.
8719 (Icf::Section_id_hash): Remove.
8720 * object.h (Section_id, Const_section_id, Section_id_hash,
8721 Const_section_id_hash): New type definitions.
8722 * output.cc (Output_section::add_relaxed_input_section): Change to
8723 use Const_section_id instead of Input_section_specifier as key type.
8724 (Output_section::add_merge_input_section): Ditto.
8725 (Output_section::build_relaxation_map): Change to use Section_id
8726 instead of Input_section_specifier as key type.
8727 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8729 (Output_section::convert_input_sections_to_relaxed_sections): Change
8730 to use Const_section_id instead of Input_section_specifier as key type.
8731 (Output_section::find_merge_section): Ditto.
8732 (Output_section::find_relaxed_input_section): Ditto.
8733 * output.h (Input_section_specifier): Remove class.
8734 (Output_section::Output_section_data_by_input_section_map): Change
8735 key type to Const_section_id.
8736 (Output_section::Output_relaxed_input_section_by_input_section_map):
8738 (Output_section::Relaxation_map): Change key type to Section_id.
8740 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8742 * gold/arm.cc: Added support for R_ARM_V4BX relocation
8743 (class Arm_v4bx_stub): New class.
8744 (DEF_STUBS): Updated definition to support v4_veneer_bx.
8745 (Stub_factory::make_arm_v4bx_stub): New method.
8746 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8747 (Stub_table::empty): Handle v4bx stubs.
8748 (Stub_table::add_arm_v4bx_stub): New method.
8749 (Stub_table::find_arm_v4bx_stub): New method.
8750 (Arm_relocate_functions::v4bx): New method.
8751 (Target_arm::fix_v4bx): New method.
8752 (Target_arm::Target_arm): Handle R_ARM_V4BX.
8753 (Stub_table::relocate_stubs): Likewise.
8754 (Stub_table::do_write): Likewise.
8755 (Stub_table::update_data_size_and_addralign): Likewise.
8756 (Stub_table::finalize_stubs): Likewise.
8757 (Target_arm::Scan::local): Likewise.
8758 (Target_arm::Scan::global): Likewise.
8759 (Target_arm::do_finalize_sections): Likewise.
8760 (Target_arm::Relocate::relocate): Likewise.
8761 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8763 (Target_arm::scan_reloc_for_stub): Likewise.
8764 (Target_arm::scan_reloc_section_for_stubs): Likewise.
8766 2010-01-19 Ian Lance Taylor <iant@google.com>
8768 * output.cc (Output_section_headers::do_sized_write): Write large
8769 segment count to sh_info field.
8770 (Output_file_header::do_sized_write): For large segment count,
8771 write PN_XNUM to e_phnum field.
8773 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8775 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8776 (Arm_relocate_functions::thm_jump8): New function.
8777 (Arm_relocate_functions::thm_jump11): New function.
8778 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8780 (Target_arm::Scan::global): Likewise.
8781 (Target_arm::Relocate::relocate): Likewise.
8782 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8785 2010-01-14 Doug Kwan <dougkwan@google.com>
8787 * arm.cc (map, utility): Include headers.
8788 (Target_arm::apply_cortex_a8_workaround): New method.
8789 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8790 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8791 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8792 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8793 the --[no-]fix-cortex-a8 command line options.
8794 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8795 (Target_arm::relocate_stub): Use addend in instruction template.
8796 * options.h (DEFINE_bool): Set the user-set flag.
8797 (General_options): Add --[no-]-fix-cortex options.
8798 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8799 : Update fast look-up map after conversion.
8801 2010-01-14 Sriraman Tallam <tmsriram@google.com>
8803 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8804 in the first pass of do_layout.
8806 2010-01-13 Doug Kwan <dougkwan@google.com>
8808 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8809 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8810 apparent compiler problem of not folding static constant integral
8811 data members of elfcpp::Elf_sizes<32>.
8813 2010-01-13 Doug Kwan <dougkwan@google.com>
8815 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8816 Arm_relobj::section_needs_cortex_a8_stub_scanning,
8817 Arm_relobj::scan_section_for_cortex_a8_erratum,
8818 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8819 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8820 sections to scan for relocation stubs into a new method
8821 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
8822 relocation and Cortex-A8 stub scanning.
8823 (Target_arm::do_relax): Force stubs to be after stubbed sections
8824 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
8825 the beginning of a new relaxation pass. Update a comment.
8826 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8828 2010-01-12 Ian Lance Taylor <iant@google.com>
8830 * target-reloc.h (visibility_error): New inline function.
8831 (relocate_section): Call visibility_error.
8832 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8833 (MOSTLYCLEANFILES): Likewise.
8834 (protected_4_pic.o, protected_3.err): New targets.
8835 * testsuite/protected_4.cc: New file.
8837 2010-01-12 Doug Kwan <dougkwan@google.com>
8839 * arm.cc (Cortex_a8_reloc): New class.
8840 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8841 and cortex_a8_relocs_info_.
8842 (Target_arm::fix_cortex_a8): New method definition.
8843 (Target_arm::Cortex_a8_relocs_info): New type.
8844 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8845 New data member declarations.
8846 (Target_arm::scan_reloc_for_stub): Record information about
8847 relocations for THUMB branches that might be exempted from the
8848 Cortex-A8 workaround.
8849 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8850 at the beginning of a relaxation pass.
8852 2010-01-12 Doug Kwan <dougkwan@google.com>
8854 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8855 (Arm_relobj::Mapping_symbol_position,
8856 Arm_reloj::Mapping_symbol_position_less,
8857 Arm_relobj::Mapping_symbols_info): New types.
8858 (Target_arm::is_mapping_symbol_name): New method definition.
8859 (Arm_relobj::do_count_local_symbols): Save information about mapping
8862 2010-01-11 Doug Kwan <dougkwan@google.com>
8864 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8865 Arm_relocate_functions::thumb32_branch_upper,
8866 Arm_relocate_functions::thumb32_branch_lower,
8867 Arm_relocate_functions::thumb32_cond_branch_offset,
8868 Arm_relocate_functions::thumb32_cond_branch_upper,
8869 Arm_relocate_functions::thumb32_cond_branch_lower,
8870 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8871 branch offset encoding.
8872 (Arm_relocate_functions::thumb_branch_common): Use new branch
8873 offset encoding methods to avoid code duplication.
8874 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8875 (Stub_addend_reader::operator()): Use new branch encoding method
8876 to avoid code duplication.
8878 2010-01-11 Doug Kwan <dougkwan@google.com>
8880 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8881 (Target_arm::do_finalize_sections): Define special EXIDX section
8882 symbols only if referenced.
8883 * gc.h (Garbage_collection::add_reference): New method.
8884 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8887 2010-01-11 Ian Lance Taylor <iant@google.com>
8889 * script.cc (Version_script_info::build_expression_list_lookup):
8890 Change complaing about duplicate wildcard match from error to
8893 * script.cc (class Lazy_demangler): Recreate--revert part of patch
8895 (Version_script_info::Version_script_info): Initialize globs_,
8896 default_version_, default_is_global_, and exact_. Don't
8897 initialize globals_ or locals_.
8898 (Version_script_info::build_lookup_tables): Build local symbols
8900 (Version_script_info::unquote): New function.
8901 (Version_script_info::add_exact_match): New function.
8902 (Version_script_info::build_expression_list_lookup): Remove lookup
8903 parameter. Add is_global parameter. Change all callers. Handle
8904 wildcard pattern specially. Unquote pattern. Call
8906 (Version_script_info::get_name_to_match): New function.
8907 (Version_script_info::get_symbol_version): New function.
8908 (Version_script_info::get_symbol_version_helper): Remove.
8909 (Version_script_info::check_unmatched_names): Call unquote.
8910 * script.h (class Version_script_info): Change get_symbol_version
8911 to be non-inline and add is_global parameter; change all callers.
8912 Rewrite symbol_is_local. Update declarations. Define struct
8913 Version_tree_match, Exact, Globs. Don't define struct Lookup.
8914 Remove globals_ and locals_ members. Add exact_, globs_,
8915 default_version_, is_global_.
8916 (Version_script_info::Glob): Remove pattern, add expression and
8917 is_global. Update constructor. Change all callers.
8918 * dynobj.cc (Versions::finalize): Mark the version symbol as the
8920 (Versions::symbol_section_contents): If a symbol is undefined, or
8921 defined in a dynamic object, set the version index to
8923 * symtab.cc (Symbol_table::add_from_relobj): Don't call
8925 (Symbol_table::add_from_pluginobj): Likewise.
8926 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8928 2010-01-11 Doug Kwan <dougkwan@google.com>
8930 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8931 (incremental_dump_LDADD): Add linking option for libintl.
8932 * Makefile.in: Regenerate.
8934 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
8937 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8939 * testsuite/Makefile.in: Regenerated.
8941 2010-01-10 Doug Kwan <dougkwan@google.com>
8943 * options.h (DEFINE_var): Use parentheses around argument varname__
8944 in macro body to avoid any unintended subsequent substitutions.
8946 2010-01-10 Ian Lance Taylor <iant@google.com>
8948 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8949 candidates before doing symbol resolution.
8951 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8952 ODR candidates if only one is weak.
8954 2010-01-08 Ian Lance Taylor <iant@google.com>
8956 * script.cc (Version_script_info::build_expression_list_lookup):
8957 Don't warn about ambiguous version, just record the ambiguity.
8958 (Version_script_info::get_symbol_version_helper): Give error if
8959 version is ambiguous.
8961 2010-01-08 Doug Kwan <dougkwan@google.com>
8963 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8964 prev_data_size_ and prev_addralign_. Remove initializer for
8965 deleted data member has_been_changed_.
8966 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8967 to determine if the table is empty.
8968 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8970 (Stub_table::add_reloc_stub): Define method in class definition
8971 instead of just declaring it there.
8972 (Stub_table::add_cortex_a8_stub): New method definition.
8973 (Stub_table::update_data_size_and_addralign): Ditto.
8974 (Stub_table::finalize_stubs): Ditto.
8975 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8976 (Stub_table::do_addralign_): Return address alignment in the
8977 (Stub_table::do_reset_address_and_file_offset): Define method in
8978 class definition instead of declaring it there. Set current data
8979 size to be the data size of the previous pass.
8980 (Stub_table::set_final_data_size): Use current data size as the
8982 (Stub_table::relocate_stub): Change parameter type of stub from
8983 Reloc_stub pointer to Stub pointer.
8984 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8985 (Stub_table::Cortex_a8_stub_list): New typedef.
8986 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8987 Stub_table::prev_addralign_): New data member.
8988 (Arm_relobj::Arm_relobj): Initialize data member
8989 section_has_cortex_a8_workaround_.
8990 (Arm_relobj::section_has_cortex_a8_workaround,
8991 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8993 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8995 (Target_arm::relocate_stub): Change parameter type of stub from
8996 Reloc_stub pointer to Stub pointer.
8997 (Insn_template::size, Insn_template::alignment): Handle
8998 THUMB16_SPECIAL_TYPE.
8999 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9000 Stub_table::update_data_size_and_addralign,
9001 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9003 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9004 (Stub_table::do_write): Ditto.
9005 (Target_arm::do_relax): Adjust code for changes in Stub_table.
9007 2010-01-08 Ian Lance Taylor <iant@google.com>
9010 * symtab.h (class Symbol): Remove fields is_target_special_ and
9011 has_plt_offset_. Add field is_defined_in_discarded_section_.
9012 (Symbol::is_defined_in_discarded_section): New function.
9013 (Symbol::set_is_defined_in_discarded_section): New function.
9014 (Symbol::has_plt_offset): Rewrite.
9015 (Symbol::set_plt_offset): Verify that new offset is not -1U.
9016 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9017 Don't initialize is_target_special_ or has_plt_offset_.
9018 Initialize is_defined_in_discarded_section_.
9019 (Symbol_table::add_from_relobj): If appropriate, set
9020 is_defined_in_discarded_section.
9021 * resolve.cc (Symbol::override_base_with_special): Don't test
9022 is_target_special_. Change has_plt_offset_ to has_plt_offset().
9023 * target-reloc.h (relocate_section): Do special handling for
9024 symbols defined in discarded sections for global symbols as well
9027 2010-01-08 Ian Lance Taylor <iant@google.com>
9029 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9030 the SHT_SYMTAB case.
9032 2010-01-08 Ian Lance Taylor <iant@google.com>
9034 * object.cc (Sized_relobj::do_layout): Don't get confused if
9035 layout_eh_frame returns NULL.
9037 2010-01-08 Ian Lance Taylor <iant@google.com>
9040 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9041 dynamic symbol table, use the normal symbol table.
9042 (Sized_dynobj::do_read_symbols): Remove assertion about type of
9045 2010-01-08 Ian Lance Taylor <iant@google.com>
9048 * layout.cc (Layout::include_section): Remove .gnu_debuglink
9051 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
9053 * version.cc (print_version): Change to "Copyright 2010".
9055 2010-01-08 Ian Lance Taylor <iant@google.com>
9059 * i386.cc (class Target_i386): Change return type of plt_section
9061 (class Output_data_plt_i386): Add tls_desc_rel_ field.
9062 (Output_data_plt_i386::Output_data_plt_i386): Initialize
9063 tls_desc_rel_ field.
9064 (Output_data_plt_i386::rel_tls_desc): New function.
9065 (Target_i386::rel_tls_desc_section): New function.
9066 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9067 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9068 R_386_TLS_DESC reloc in rel_tls_desc_section.
9069 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9070 Define struct Tlsdesc_info.
9071 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9072 (Target_x86_64::do_reloc_symbol_index): New function.
9073 (Target_x86_64::add_tlsdesc_info): New function.
9074 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9075 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9077 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
9079 (Output_data_plt_x86_64::rela_tlsdesc): New function.
9080 (Target_x86_64::rela_tlsdesc_section): New function.
9081 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9083 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9084 (Target_x86_64::do_reloc_addend): New function.
9085 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9086 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9087 declarations. Define TARGET_CODE. Add arg field to u1_ union.
9088 (Output_reloc::type): New function.
9089 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9090 (Output_reloc::is_target_specific): New function.
9091 (Output_reloc::target_arg): New function.
9092 (class Output_reloc) [SHT_RELA]: Add four new constructors for
9093 absolute relocs and target specific relocs.
9094 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9095 add_target_specific.
9096 (class Output_data_reloc) [SHT_RELA]: Likewise.
9097 * output.cc (Output_reloc::Output_reloc): Add four new versions
9098 for absolute relocs and target specific relocs.
9099 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9100 (Output_reloc::get_symbol_index): Likewise.
9101 (Output_reloc::local_section_offset): Check that local_sym_index_
9102 is not TARGET_CODE or 0.
9103 (Output_reloc::symbol_value): Likewise.
9104 (Output_reloc::write) [SHT_RELA]: Call target for target specific
9106 * target.h (class Target): Add reloc_symbol_index and reloc_addend
9107 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
9109 * layout.cc (add_target_dynamic_tags): Use output section for
9110 DT_PLTRELSZ and DT_JMPREL.
9112 2010-01-07 Ian Lance Taylor <iant@google.com>
9115 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9117 (class Output_data_reloc_generic): Define.
9118 (class Output_data_reloc_base): Change base class to
9119 Output_data_reloc_generic. Change add() method to call
9120 bump_relative_reloc_count for a relative reloc. Remove
9122 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9124 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9125 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
9127 * layout.h (class Layout): Update declaration.
9129 2010-01-07 Ian Lance Taylor <iant@google.com>
9131 * output.h (class Output_data): Add const version of
9132 output_section and do_output_section.
9133 (class Output_section_data): Add const version of
9135 (class Output_section): Likewise.
9136 * layout.cc (Layout::add_target_dynamic_tags): New function.
9137 * layout.h (class Layout): Update declarations.
9138 * arm.cc (Target_arm::do_finalize_sections): Use
9139 add_target_dynamic_tags.
9140 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9141 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9142 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9143 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9145 2010-01-07 Ian Lance Taylor <iant@google.com>
9148 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9151 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
9152 Ian Lance Taylor <iant@google.com>
9155 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9156 Xindex::read_symtab_xindex.
9158 2010-01-07 Doug Kwan <dougkwan@google.com>
9160 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9161 (Insn_template::thumb16_bcond_insn): New method declaration.
9162 (Insn_template): Fix spelling.
9163 (Stub::thumb16_special): New method declaration.
9164 (Stub::do_write): Define virtual method which was previously pure
9166 (Stub::do_thumb16_special): New method declaration.
9167 (Stub::do_fixed_endian_write): New template member.
9168 (Reloc_stub::do_write): Remove.
9169 (Reloc_stub::do_fixed_endian_write): Remove.
9170 (Cortex_a8_stub): New class definition.
9171 (Stub_factory::make_cortex_a8_stub): New method definition.
9172 (Stub_factory::Stub_factory): Add missing static storage class
9173 qualifier for elf32_arm_stub_a8_veneer_blx.
9175 2010-01-07 Ian Lance Taylor <iant@google.com>
9178 * options.h (class General_options): Add --warn-unresolved-symbols
9179 and --error-unresolved-symbols.
9180 * errors.cc (Errors::undefined_symbol): Implement
9181 --warn-unresolved-symbols.
9183 * options.h (class General_options): Add -z text and -z textoff.
9184 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9186 2010-01-06 Sriraman Tallam <tmsriram@google.com>
9188 * gc.h (Garbage_collection::Cident_section_map): New typedef.
9189 (Garbage_collection::cident_sections): New function.
9190 (Garbage_collection::add_cident_section): New function.
9191 (Garbage_collection::cident_sections_): New member.
9192 (gc_process_relocs): Add references to sections whose names are C
9194 * gold.h (cident_section_start_prefix): New constant.
9195 (cident_section_stop_prefix): New constant.
9196 (is_cident): New function.
9197 * layout.cc (Layout::define_section_symbols): Replace string constants
9198 with the newly defined constants.
9199 * object.cc (Sized_relobj::do_layout): Track sections whose names are
9201 * testsuite/Makefile.am: Add gc_orphan_section_test.
9202 * testsuite/Makefile.in: Regenerate.
9203 * testsuite/gc_orphan_section_test.cc: New file.
9204 * testsuite/gc_orphan_section_test.sh: New file.
9206 2010-01-06 Ian Lance Taylor <iant@google.com>
9209 * options.h (class General_options): Add --warn-shared-textrel.
9210 * layout.cc (Layout::finish_dynamic_section): Implement
9211 --warn-shared-textrel.
9214 * options.h (class General_options): Add --warn-multiple-gp.
9216 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9218 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9219 $(THREADSLIB) and $(LIBDL).
9220 * Makefile.in: Rebuild.
9222 2010-01-06 Ian Lance Taylor <iant@google.com>
9225 * options.cc (General_options::parse_section_start): New function.
9226 (General_options::section_start): New function.
9227 (General_options::General_options): Initialize all members.
9228 * options.h: Include <map>
9229 (class General_options): Add --section-start. Add section_starts_
9231 * layout.cc (Layout::attach_allocated_section_to_segment): If
9232 --section-start was used, set the address of the segment. Remove
9233 local sort_sections.
9234 (Layout::relaxation_loop_body): If the address of the load segment
9235 has been set by --section-start, don't use it.
9236 * output.h (Output_segment::update_flags_for_output_section): New
9238 * output.cc (Output_segment::add_output_section): Call
9239 update_flags_for_output_section.
9241 2010-01-05 Ian Lance Taylor <iant@google.com>
9244 * options.h (class General_options): Add --undefined-version.
9245 * script.cc (struct Version_expression): Add was_matched_by_symbol
9247 (Version_script_info::matched_symbol): New function.
9248 (Version_script_info::get_symbol_version_helper): Call
9250 (Version_script_info::check_unmatched_names): New function.
9251 * script.h (class Version_script_info): Update declarations.
9252 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9254 * options.h (class General_options): Use DEFINE_bool_alias for
9255 allow_multiple_definition.
9256 * resolve.cc (Symbol_table::should_override): Don't test
9257 allow_multiple_definition.
9260 * options.h (class General_options): Add --cref.
9261 * main.cc (main): Print cref table if --cref. Don't close mapfile
9262 until after printing cref table.
9263 * cref.cc: Include "symtab.h".
9264 (class Cref_inputs): Define Cref_table_compare and Cref_table.
9265 (Cref_table_compare::operator()): New function.
9266 (Cref_inputs::gather_cref): New function.
9267 (filecol): New static const.
9268 (Cref_inputs::print_cref): New function.
9269 (Cref::print_cref): New function.
9270 * cref.h: Include <cstdio>.
9271 (class Cref): Update declarations.
9272 * mapfile.h (Mapfile::file): New function.
9273 * object.h (class Object): Define Symbols. Declare virtual
9274 do_get_global_symbols.
9275 (Object::get_global_symbols): New function.
9276 * object.cc (Input_objects::add_object): Pass object to cref_ if
9278 (Input_objects::archive_start): Likewise.
9279 (Input_objects::archive_stop): Likewise.
9280 (Input_objects::print_cref): New function.
9281 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9282 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9284 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9286 * plugin.h (class Sized_pluginobj): Update declarations.
9288 2010-01-05 Ian Lance Taylor <iant@google.com>
9290 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9291 to is_default_version. Rename insdef to insdefault.
9292 (Symbol_table::add_from_relobj): Rename def to is_default_version
9293 and local to is_forced_local.
9294 (Symbol_table::add_from_pluginobj): Likewise.
9295 (Symbol_table::add_from_dynobj): Likewise.
9296 (Symbol_table::define_special_symbol): Rename insdef to
9299 2010-01-04 Ian Lance Taylor <iant@google.com>
9302 * options.h (class General_options): Add
9303 --allow-multiple-definition and -z muldefs.
9304 * resolve.cc (Symbol_table::should_override): Don't warn about a
9305 multiple symbol definition if --allow-multiple-definition or -z
9309 * options.h (class General_options): Add --add-needed and
9310 --copy-dt-needed-entries. Tweak --as-needed help entry.
9311 * object.cc (Input_objects::check_dynamic_dependencies): Give an
9312 error if --copy-dt-needed-entries aka --add-needed is used and
9313 would cause a change in behaviour.
9316 * options.h (class General_options): Add -G as a short version of
9317 --shared. Add no-op options -assert, -g, and -i.
9319 2010-01-04 Sriraman Tallam <tmsriram@google.com>
9321 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9322 check for .text or .gnu.linkonce.t sections.
9323 * icf.cc (Icf::find_identical_sections): Ditto.
9324 Change the detection for mangled function name within the section
9326 * icf.h (is_section_foldable_candidate): New function.
9328 2009-12-30 Ian Lance Taylor <iant@google.com>
9331 * options.h (class General_options): Permit two dashes with
9332 --retain-symbols-file.
9334 2009-12-30 Ian Lance Taylor <iant@google.com>
9337 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9338 don't put the file header and segment headers in the text
9342 * common.cc (Sort_commons::operator()): Stabilize sort when both
9344 (Symbol_table::do_allocate_commons_list): When allocating common
9345 symbols, skip a symbol which is no longer common.
9346 * symtab.h (Symbol::is_common): Test whether the symbol comes from
9347 an object before checking its type.
9348 * testsuite/common_test_2.c: New file.
9349 * testsuite/common_test_3.c: New file.
9350 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9351 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9352 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9353 (common_test_2_pic.o, common_test_2.so): New targets.
9354 (common_test_3_pic.o, common_test_3.so): New targets.
9355 * testsuite/Makefile.in: Rebuild.
9358 * script.cc (read_input_script): If we see a new SECTIONS clause,
9359 and we have added an input section, give an error.
9360 * layout.h (class Layout): Add have_added_input_section function.
9361 Add have_added_input_section_ field.
9362 * layout.cc (Layout::Layout): Initialize
9363 have_added_input_section_.
9364 (Layout::layout): Set have_added_input_section_.
9365 (Layout::layout_eh_frame): Likewise.
9367 2009-12-30 Ian Lance Taylor <iant@google.com>
9370 * options.h (class General_options): Add --sort-common option.
9371 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9372 * common.cc (Sort_common): Add sort_order parameter to
9373 constructor. Add sort_order_ field.
9374 (Sort_commons::operator): Check sort_order_.
9375 (Symbol_table::allocate_commons): Determine the sort order.
9376 (Symbol_table::do_allocate_commons): Add sort_order parameter.
9378 (Symbol_table::do_allocate_commons_list): Likewise.
9380 2009-12-30 Ian Lance Taylor <iant@google.com>
9383 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9384 symbols from this object, don't change the visibility of an
9386 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9388 2009-12-30 Ian Lance Taylor <iant@google.com>
9391 * script.h (class Version_script_info): Define Language enum.
9392 Update declarations. Define Glob, Exact, and Lookup types. Add
9393 new fields globals_, locals_, and is_finalized_.
9394 * script.cc: Various formatting fixes.
9395 (class Parser_closure): Change language_stack_ from a vector of
9396 std::string to one of Version_script_info::Language. Adjust all
9398 (class Lazy_demangler): Remove.
9399 (struct Version_expression): Change language from std::string to
9400 Version_script_info::Language.
9401 (Version_script_info::Version_script_info): New function.
9402 (Version_script_info::~Version_script_info): Don't call clear.
9403 (Version_script_info::finalize): New function.
9404 (Version_script_info::build_lookup_tables): New function.
9405 (Version_script_info::build_expression_list_lookup): New
9407 (Version_script_info::get_symbol_version_helper): Rewrite to use
9409 (Version_script_info::print_expression_list): Adjust to use
9410 Version_script_info::Language.
9411 (script_push_lex_into_version_mode): Check that the version script
9412 has not been finalized.
9413 (version_script_push_lang): Change language string to
9414 Version_script_info::Language.
9415 * options.cc (Command_line::version_script): New function.
9416 * options.h (class General_options): Add finalize_dynamic_list
9417 function. Change version_script from declaration to definition.
9418 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9419 * testsuite/version_script.map: Remove duplicate def of foo.
9420 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9422 * testsuite/Makefile.in: Rebuild.
9424 2009-12-30 Ian Lance Taylor <iant@google.com>
9427 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9428 if the input symbol index is 0, make the output symbol index 0.
9430 2009-12-30 Ian Lance Taylor <iant@google.com>
9433 * options.h (class General_options): Add -x/--discard-all.
9434 * object.cc (Sized_relobj::do_count_local_symbols): Handle
9435 --discard-all. If the local symbol needs a dynamic entry, check
9436 that before handling --discard-locals.
9438 2009-12-30 Ian Lance Taylor <iant@google.com>
9441 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9443 (Output_segment::add_output_section): Don't change the flags if
9447 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9448 GNU hash table if they need a dynamic value. Otherwise, don't add
9449 them if they are defined in a dynamic object or are forced local.
9451 2009-12-29 Ian Lance Taylor <iant@google.com>
9454 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9455 .gnu.hash table for a 32-bit target.
9458 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9459 regular and a dynamic object only needs a dynamic symbol table
9460 entry if it is externally visible.
9463 * i386.cc (class Target_i386): Initialize global_offset_table_ in
9464 constructor. Add global_offset_table_ field.
9465 (Target_i386::got_section): Set global_offset_table_.
9466 (Target_i386::do_finalize_sections): Set global_offset_table_
9468 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9469 in constructor. Add global_offset_table_ field.
9470 (Target_x86_64::got_section): Set global_offset_table_.
9471 (Target_x86_64::do_finalize_sections): Set global_offset_table_
9474 * layout.cc (Layout::Layout): Initialize increase_relro_.
9475 (Layout::get_output_section): Add is_relro, is_last_relro, and
9476 is_first_non_relro parameters. Change all callers.
9477 (Layout::choose_output_section): Likewise.
9478 (Layout::add_output_section_data): Likewise.
9479 (Layout::make_output_section): Likewise.
9480 (Layout::set_segment_offsets): Clear increase_relro when using a
9482 * layout.h (class Layout): Add increase_relro method. Add
9483 increase_relro_ field. Update declarations.
9484 * output.cc (Output_section::Output_section): Initialize
9485 is_last_relro_ and is_first_non_relro_.
9486 (Output_segment::add_output_section): Group relro sections is
9487 do_sort is true. Handle is_last_relro and is_first_non_relro.
9488 (Output_segment::maximum_alignment): Remove relro handling.
9489 (Output_segment::set_section_addresses): Add increase_relro
9490 parameter. Change all callers. Add initial alignment to align
9491 relro sections on separate page. Remove old relro handling.
9492 (Output_segment::set_section_list_addresses): Remove in_relro
9493 parameter. Change all callers.
9494 (Output_segment::set_offset): Add increase parameter. Change all
9495 callers. Remove old relro handling.
9496 * output.h (class Output_section): Add new methods: is_last_relro,
9497 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9498 Add is_last_relro_ and is_first_non_relro_ fields.
9499 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9500 Create separate .got.plt section. Call increase_relro.
9501 * x86_64.cc (Target_x86_64::got_section): Likewise.
9502 * testsuite/relro_script_test.t: Add .got.plt.
9505 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9506 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9507 (Layout::finalize): Call set_dynamic_symbol_size.
9508 (Layout::set_dynamic_symbol_size): New function.
9509 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
9510 set_dynamic_symbol_size.
9513 * output.h (class Output_section): Add is_entsize_zero_ field.
9514 * output.cc (Output_section::Output_section): Initialize
9516 (Output_section::set_entsize): If two different entsizes are
9517 requested, force it to zero.
9518 (Output_section::add_input_section): Set flags for .debug_str
9519 before updating section flags. Set entsize.
9520 (Output_section::update_flags_for_input_section): Set SHF_MERGE
9521 and SHF_STRING if all input sections have those flags.
9523 2009-12-29 Rafael Espindola <espindola@google.com>
9525 * main.cc (main): Fix the sys time reporting.
9526 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9529 2009-12-29 Sriraman Tallam <tmsriram@google.com>
9531 * options.cc (General_options::parse_version): Allow -v to exit
9532 without an error if there is nothing to link.
9534 2009-12-29 Ian Lance Taylor <iant@google.com>
9536 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9537 using a version of gcc before 4.1.
9538 * configure: Rebuild.
9540 2009-12-28 Chris Demetriou <cgd@google.com>
9542 * attributes.cc (Output_attributes_section_data::do_write): Use
9543 std::vector::front rather than std::vector::data.
9545 2009-12-28 Ian Lance Taylor <iant@google.com>
9547 * symtab.h (class Symbol_table): Add enum Defined.
9548 * resolve.cc (Symbol_table::should_override): Add defined
9549 parameter. Change all callers. Test whether object is NULL
9550 before calling a method on it.
9551 (Symbol_table::report_resolve_problem): Add defined parameter.
9553 (Symbol_table::should_override_with_special): Likewise.
9554 * symtab.cc (Symbol_table::define_in_output_data): Add defined
9555 parameter. Change all callers.
9556 (Symbol_table::do_define_in_output_data): Likewise.
9557 (Symbol_table::define_in_output_segment): Likewise.
9558 (Symbol_table::do_define_in_output_segment): Likewise.
9559 (Symbol_table::define_as_constant): Likewise.
9560 (Symbol_table::do_define_as_constant): Likewise.
9561 * script.h (class Symbol_assignment): Add is_defsym parameter to
9562 constructor; change all callers.
9563 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9564 parameter. Change all callers. Add is_defsym_ field.
9565 (class Parser_closure): Add parsing_defsym parameter to
9566 constructor; change all callers. Add parsing_defsym accessor
9567 function. Add parsing_defsym_ field.
9569 2009-12-28 Ian Lance Taylor <iant@google.com>
9571 * gold.cc (queue_middle_tasks): Fix formatting.
9572 * object.cc (Relobj::is_section_name_included): Likewise.
9574 2009-12-23 Ian Lance Taylor <iant@google.com>
9576 * i386.cc (Target_i386::do_calls_non_split): Recognize
9577 -fsplit-stack prologue for a function with a static chain.
9578 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9579 -fsplit-stack prologue when using %r11.
9581 2009-12-21 Sriraman Tallam <tmsriram@google.com>
9583 * options.cc (General_options::parse_version): Make -v continue and do
9584 the link like GNU ld does.
9586 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
9588 * Makefile.am (CCFILES): Add timer.cc.
9589 (HFILES): Add timer.h.
9590 * configure.ac: Check for sysconf and times.
9591 * main.cc: include timer.h.
9592 (main): Use Timer instead of get_run_time.
9595 * workqueue.cc: include timer.h.
9596 (Workqueue::find_and_run_task):
9597 Report user, sys and wall time.
9598 * Makefile.in: Regenerate.
9599 * config.in: Regenerate.
9600 * configure: Regenerate.
9602 2009-12-16 Doug Kwan <dougkwan@google.com>
9604 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9606 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9607 relaxed input sections.
9608 * output.cc (Output_section::find_relaxed_input_section): Change
9609 return type to Output_relaxed_input_section pointer. Adjust code
9610 for new type of relaxed_input_section_map_.
9611 * output.h (Output_section::find_relaxed_input_section): Change
9612 return type to Output_relaxed_input_section pointer.
9613 (Output_section::Output_relaxed_input_section_by_input_section_map):
9615 (Output_section::relaxed_input_section_map_): Change type to
9616 Output_section::Output_relaxed_input_section_by_input_section_map.
9617 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9620 2009-12-15 Ian Lance Taylor <iant@google.com>
9622 * layout.cc (Layout::create_shstrtab): Only write out after input
9623 sections if we are compressing debug sections.
9625 2009-12-15 Ian Lance Taylor <iant@google.com>
9627 * archive.cc (Archive::add_symbols): Only look up a symbol without
9628 a version if there is, in fact, a version.
9630 2009-12-14 Ian Lance Taylor <iant@google.com>
9632 Revert -Wshadow changes, all changes from:
9633 2009-12-11 Doug Kwan <dougkwan@google.com>
9634 2009-12-11 Nick Clifton <nickc@redhat.com>
9635 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9637 2009-12-11 Doug Kwan <dougkwan@google.com>
9639 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9641 * attributes.cc (Object_attribute::size): Ditto.
9642 (Attributes_section_data::size): Ditto.
9643 (Attributes_section_data::Attributes_section_data): Ditto.
9644 (Output_attributes_section_data::do_write): Ditto.
9645 * attributes.h (Object_attribute::set_type): Ditto.
9646 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9648 2009-12-11 Nick Clifton <nickc@redhat.com>
9650 * archive.cc: Fix shadowed variable warnings.
9652 * compressed_output.cc: Likewise.
9653 * compressed_output.h: Likewise.
9654 * configure: Likewise.
9655 * dwarf_reader.cc: Likewise.
9656 * dynobj.cc: Likewise.
9657 * dynobj.h: Likewise.
9658 * ehframe.cc: Likewise.
9659 * ehframe.h: Likewise.
9660 * errors.cc: Likewise.
9661 * expression.cc: Likewise.
9662 * fileread.cc: Likewise.
9663 * fileread.h: Likewise.
9664 * freebsd.h: Likewise.
9665 * i386.cc: Likewise.
9667 * incremental.h: Likewise.
9668 * layout.cc: Likewise.
9669 * layout.h: Likewise.
9670 * mapfile.cc: Likewise.
9671 * merge.cc: Likewise.
9672 * merge.h: Likewise.
9673 * object.cc: Likewise.
9674 * object.h: Likewise.
9675 * options.h: Likewise.
9676 * output.cc: Likewise.
9677 * output.h: Likewise.
9678 * parameters.cc: Likewise.
9679 * plugin.cc: Likewise.
9680 * powerpc.cc: Likewise.
9681 * reduced_debug_output.cc: Likewise.
9682 * reduced_debug_output.h: Likewise.
9683 * reloc.cc: Likewise.
9684 * reloc.h: Likewise.
9685 * resolve.cc: Likewise.
9686 * script-sections.cc: Likewise.
9687 * script.cc: Likewise.
9688 * script.h: Likewise.
9689 * sparc.cc: Likewise.
9690 * symtab.cc: Likewise.
9691 * symtab.h: Likewise.
9692 * target-select.cc: Likewise.
9693 * target-select.h: Likewise.
9694 * token.h: Likewise.
9695 * workqueue.cc: Likewise.
9696 * workqueue.h: Likewise.
9697 * x86_64.cc: Likewise.
9699 2009-12-10 Doug Kwan <dougkwan@google.com>
9701 * arm.cc (attributes.h): New include.
9702 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9703 (Arm_relobj::~Arm_relobj): Delete object pointed by
9704 attributes_section_data_.
9705 (Arm_relobj::attributes_section_data): New method definition.
9706 (Arm_relobj::attributes_section_data_): New data member declaration.
9707 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9708 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9709 attributes_section_data_.
9710 (Arm_dynobj::attributes_section_data): New method definition.
9711 (Arm_dynobj::attributes_section_data_): New data member declaration.
9712 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
9713 initialization value of may_use_blx_ to false.
9714 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9715 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9716 object attributes to compute results instead of hard-coding.
9717 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9718 Target_arm::get_secondary_compatible_arch,
9719 Target_arm::set_secondary_compatible_arch
9720 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9721 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9722 New method declarations.
9723 (Target_arm::get_aeabi_object_attribute): New method definition.
9724 (Target_arm::attributes_section_data_): New data member declaration.
9725 (read_arm_attributes_section): New template definition.
9726 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9727 (Arm_dynobj::do_read_symbols): Ditto.
9728 (Target_arm::do_finalize_sections): Merge attributes sections from
9729 input. Check for BLX use after attributes section merging.
9730 Fix __exidx_start and __exidx_end visibility. Create an
9731 .ARM.attributes section if necessary.
9732 (Target_arm::get_secondary_compatible_arch,
9733 Target_arm::set_secondary_compatible_arch,
9734 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9735 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9736 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9737 New method definitions.
9739 2009-12-09 Ian Lance Taylor <iant@google.com>
9741 * plugin.cc (Plugin::load): Don't cast from void* to a function
9744 2009-12-09 Ian Lance Taylor <iant@google.com>
9746 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9749 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
9751 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9752 Replace two_file_shared_1.so with two_file_shared_2.so.
9753 * testsuite/Makefile.in: Regenerated.
9755 2009-12-08 Doug Kwan <dougkwan@google.com>
9757 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9758 (HFILES): Add attributes.h and int_encoding.h.
9759 * Makefile.in: Regenerate.
9760 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9761 function definitions to int_encoding.cc
9762 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9763 prototypes to int_encoding.h
9764 * reduced_debug_output.cc (int_encoding.h): New include.
9765 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9766 function definitions to int_encoding.cc
9767 (insert_into_vector, read_from_pointer): Move template definitions to
9769 * attributes.cc: New file.
9770 * attributes.h: New file.
9771 * int_encoding.cc: New file.
9772 * int_encoding.h: New file.
9774 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
9777 * incremental-dump.cc (dump_incremental_inputs): New.
9778 (main): Use dump_incremental_inputs.
9780 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
9783 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9784 checking elfcpp::STT_FUNC.
9785 (Target_i386::Relocate::relocate): Likewise.
9786 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9788 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9789 symbols from shared libraries into normal FUNC symbols.
9791 * symtab.h (Symbol): Add is_func and use it.
9793 2009-12-05 Doug Kwan <dougkwan@google.com>
9795 * arm.cc (Target_arm::arm_info): Initialize new fields
9796 attributes_section and attributes_vendor.
9797 * i386.cc (Target_i386::i386_info): Same.
9798 * object.cc (Sized_relobj::do_layout): Skip attribute section.
9799 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9800 fields attributes_section and attributes_vendor.
9801 * sparc.cc (Target_sparc::sparc_info): Same.
9802 * target.h (Target::attributes_section, Target::attributes_vendor,
9803 Target::is_attributes_section, Target::attribute_arg_type,
9804 Target::attributes_order): New method definitions.
9805 (Target::Target_info::attributes_section,
9806 Target::Target_info::attributes_vendor): New fields.
9807 (Target::do_attribute_arg_type, Target::do_attributes_order): New
9808 virtual method definitions.
9809 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9810 attributes_section and attributes_vendor.
9811 * testsuite/testfile.cc (Target_test::test_target_info): Same.
9813 2009-12-05 Doug Kwan <dougkwan@google.com>
9815 * arm.cc: Update comments about interworking and stub generation.
9816 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9817 considered as non-PIC.
9818 (Arm_relocate_functions::base_abs): Fix formatting.
9819 (Arm_relocate_functions::got_prel): Fix comment. Change interface
9820 of function to use GOT entry address instead of offset.
9821 (Target_arm::Scan::global): Issue an error if a symbol would need a
9822 PLT does not get one because it is untyped. Remove code to create
9823 dynamic symbols for relative branches.
9824 (Target_arm::Relocate::relocate: Use 0 instead of false since function
9825 takes unsigned integer instead of boolean.
9827 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
9829 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9830 (two_file_test_LDADD): Likewise.
9831 (common_test_1_LDADD): Likewise.
9832 (exception_test_LDADD) Likewise.
9833 (weak_test_LDADD): Likewise.
9834 (many_sections_test_LDADD): Likewise.
9835 (initpri1_LDADD): Likewise.
9836 (script_test_1_LDADD): Likewise.
9837 (script_test_2_LDADD): Likewise.
9838 (justsyms_LDADD): Likewise.
9839 (binary_test_LDADD): Likewise.
9840 (large_LDADD): Likewise.
9841 * testsuite/Makefile.in: Regenerated.
9843 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
9845 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9846 (Symbol_table::override_with_special): Likewise.
9847 (Symbol_table::add_from_object): Likewise.
9849 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9851 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9852 Don't set the data_offset twice.
9854 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9856 * testsuite/Makefile.in: Regenerate.
9858 2009-12-03 Doug Kwan <dougkwan@google.com>
9860 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9861 (Target_arm::do_finalize_sections): Add parameter for symbol table
9862 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
9863 * i386.cc (Target_i386::do_finalize_sections): Add an additional
9864 parameter for symbol table pointer.
9865 * layout.cc (Layout::finalize): Call Target::finalize_sections with
9866 an additional parameter for a pointer to symbol table.
9867 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9868 parameter for a symbol table pointer.
9869 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9870 * target.h (Target::finalize_sections, Target::do_finalize_sections):
9872 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9873 parameter for a symbol table pointer.
9875 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
9877 * incremental.cc (Incremental_inputs_header)
9878 (Incremental_inputs_header_write, Incremental_inputs_entry)
9879 (Incremental_inputs_entry_write): Move ...
9880 * incremental.h (Incremental_inputs_header)
9881 (Incremental_inputs_header_write, Incremental_inputs_entry)
9882 (Incremental_inputs_entry_write): here.
9884 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9886 * incremental.cc (make_sized_incremental_binary): Set the target.
9887 Error if it is incompatible.
9888 * output.h (Output_file): Add filename method.
9890 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9892 * incremental.cc (Incremental_inputs_entry): Remove unused argument
9893 from the get_* methods.
9895 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9897 * incremental-dump.cc (main): Check that the offeset of a script is 0.
9898 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9899 Write 0 for the data_offset of scripts.
9901 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9903 * testsuite/Makefile.am: Add the incremental_test.sh test.
9904 * testsuite/incremental_test.sh: New.
9905 * testsuite/incremental_test_1.c: New.
9906 * testsuite/incremental_test_2.c: New.
9908 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
9910 * incremental-dump.cc (main): Fix typos.
9912 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
9915 * incremental-dump.cc (main): Use llu to print 64 bit values.
9917 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
9918 H.J. Lu <hongjiu.lu@intel.com>
9920 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9922 (incremental_dump_LDADD): Likewise.
9923 * Makefile.in: Regenerated.
9925 2009-11-25 Doug Kwan <dougkwan@google.com>
9929 2009-11-25 Doug Kwan <dougkwan@google.com>
9931 * arm.cc (Target_arm::Target_arm): Move method definition
9932 outside of class definition. Add code to handle
9933 --target1-rel, --target1-abs and --target2= options.
9934 (Target_arm::get_reloc_reloc_type): Change method to be
9935 non-static and const.
9936 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9937 New data member declaration.
9938 (Target_arm::Scan::local, Target_arm::Scan::global,
9939 Target_arm::Relocate::relocate,
9940 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9941 Adjust call to Target_arm::get_real_reloc_type.
9942 (Target_arm::get_real_reloc_type): Use command line options
9943 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9944 * options.h (--target1-rel, --target1-abs, --target2): New
9947 2009-11-25 Doug Kwan <dougkwan@google.com>
9949 * arm.cc (Target_arm::Target_arm): Move method definition outside of
9950 class definition. Add code to handle --target1-rel, --target1-abs
9951 and --target2= options.
9952 (Target_arm::get_reloc_reloc_type): Change method to be non-static
9954 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9956 (Target_arm::Scan::local, Target_arm::Scan::global,
9957 Target_arm::Relocate::relocate,
9958 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9959 call to Target_arm::get_real_reloc_type.
9960 (Target_arm::get_real_reloc_type): Use command line options to
9961 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9962 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9965 2009-11-25 Doug Kwan <dougkwan@google.com>
9967 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9968 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9969 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9971 (Arm_relocate_functions::thm_call): Replace body with a call to
9972 Arm_relocate_functions::thumb_branch_common.
9973 (Arm_relocate_functions::thm_jump24,
9974 Arm_relocate_functions::thm_xpc22): New method definitions.
9975 (Arm_relocate_functions::thumb_branch_common): New method definition.
9976 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9978 (Target_arm::Relocate::relocate): Adjust call to thm_call.
9979 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9981 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9983 * Makefile.am: Build incremental-dump
9984 * Makefile.in: Regenerate.
9985 * incremental-dump.cc: New.
9986 * incremental.cc (Incremental_inputs_header_data,
9987 Incremental_inputs_entry_data): Move to incremental.h
9988 * incremental.h: (Incremental_inputs_header_data,
9989 Incremental_inputs_entry_data): Move from incremental.cc
9991 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9993 * incremental.cc (Incremental_inputs_header,
9994 Incremental_inputs_header_write, Incremental_inputs_entry,
9995 Incremental_inputs_entry_write): Add a typedef with the data type.
9997 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9999 * incremental.cc (Incremental_inputs_header,
10000 Incremental_inputs_header_write, Incremental_inputs_entry,
10001 Incremental_inputs_entry_write): Update comment about which
10002 type has the filed descriptions.
10004 2009-11-15 Doug Kwan <dougkwan@google.com>
10006 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10007 (Arm_relocate_functions::arm_branch_common): Change method defintion
10008 in class definition to a method declaration and update list of formal
10010 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10011 Arm_relocation_functions::jump24): Adjust call to
10012 Arm_relocate_functions::arm_branch_common. Update list of formal
10014 (Arm_relocate_functions::xpc25): New method definition.
10015 (Arm_relocate_functions::arm_branch_common): Move method defintion
10016 out from class definition. Use stubs for mode-switching and extending
10018 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10019 specially. Change code to enable use of stubs in ARM branches.
10021 2009-11-10 Doug Kwan <dougkwan@google.com>
10023 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10024 in method declaration.
10025 (Target_arm::relocate_stub): New method declaration.
10026 (Target_arm::default_target): Change to return a pointer instead of
10028 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10029 Target_arm::default_target.
10030 (Arm_Relobj::do_relocate_sections): Remove options paramater in
10032 (Target_arm::relocate_section): Adjust view.
10033 (Target_arm::relocate_stub): New method definition.
10035 2009-11-10 Doug Kwan <dougkwan@google.com>
10037 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10039 * incremental.cc (open_incremental_binary): Initialized local
10040 variables to avoid warnings.
10041 * object.cc (make_elf_object): Ditto.
10042 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10045 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
10048 * testsuite/plugin_test.c: Include "config.h".
10050 2009-11-09 Doug Kwan <dougkwan@google.com>
10052 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10053 (arm_symbol_value): Remove.
10054 (Arm_relocate_functions::arm_branch_common,
10055 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10056 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10057 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10058 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10059 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10060 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10061 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10062 Arm_relocate_functions::thm_mobw_abs_nc,
10063 Arm_relocate_functions::thm_mov_abs,
10064 Arm_relocate_functions::movw_prel_nc,
10065 Arm_relocate_functions::thm_movt_abs,
10066 Arm_relocate_functions::movt_prel,
10067 Arm_relocate_functions::thm_movw_prel_nc,
10068 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10069 (Target_arm::Relocate::relocate): Only decompose address into two
10070 parts if relocation type uses the thumb-bit and pass the actual
10071 bit instead of a flag indicating that the thumb-bit is used. Adjust
10072 calls to methods in Arm_relocate_functions for this change.
10074 2009-11-08 Ian Lance Taylor <iant@google.com>
10077 * reloc.cc: Instantiate
10078 Sized_relobj::initialize_input_to_output_maps and
10079 Sized_relobj:free_input_to_output_maps.
10081 2009-11-06 Ian Lance Taylor <iant@google.com>
10084 * defstd.cc (in_segment): Set only_if_ref true for "end".
10086 2009-11-06 Doug Kwan <dougkwan@google.com>
10088 * arm.cc (class Reloc_stub): Correct a comment.
10089 (Target_arm::Target_arm): Initialize arm_input_section_map_.
10090 (Target_arm::scan_section_for_stubs): New method declaration.
10091 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10092 Change methods from private to protected.
10093 (Target_arm::do_may_relax): New method definition.
10094 (Target_arm::do_relax, Target_arm::group_sections,
10095 Target_arm::scan_reloc_for_stub,
10096 Target_arm::scan_reloc_section_for_stubs): New method declarations.
10097 (Target_arm::arm_input_section_map_): New data member declaration.
10098 (Target_arm::scan_reloc_for_stub,
10099 Target_arm::scan_reloc_section_for_stubs,
10100 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10101 Target_arm::do_relax): New method definitions.
10103 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
10105 * configure.ac: Check for (struct stat)::st_mtim
10106 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10107 * config.in: Regenerate.
10108 * configure: Regenerate.
10110 2009-11-05 Ian Lance Taylor <iant@google.com>
10113 * output.cc (Output_segment::add_output_section): Add missing
10116 2009-11-04 Ian Lance Taylor <iant@google.com>
10119 * object.h (class Object): Add is_needed and set_is_needed
10120 methods. Add is_needed_ field. Make bool fields into bitfields.
10121 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10122 defined in a dynamic object and referenced by a regular object,
10123 set is_needed for the dynamic object.
10124 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10125 if the file is marked with as_needed and it is not needed.
10127 2009-11-04 Ian Lance Taylor <iant@google.com>
10130 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10131 tags if data is discarded by linker script.
10132 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10133 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10134 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10135 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10137 2009-11-04 Ian Lance Taylor <iant@google.com>
10139 * layout.cc (Layout::get_output_section): Add is_interp and
10140 is_dynamic_linker_section parameters. Change all callers.
10141 (Layout::choose_output_section): Likewise.
10142 (Layout::make_output_section): Likewise.
10143 (Layout::add_output_section_data): Add is_dynamic_linker_section
10144 parameter. Change all callers.
10145 * layout.h (class Layout): Update declarations.
10146 * output.h (class Output_section): Add is_interp, set_is_interp,
10147 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10148 Add is_interp_, is_dynamic_linker_section_ fields. Change
10149 generate_code_fills_at_write_ to a bitfield.
10150 * output.cc (Output_section::Output_sections): Initialize new
10152 (Output_segment::add_output_section): Add do_sort parameter.
10153 Change all callers.
10155 2009-11-03 Ian Lance Taylor <iant@google.com>
10158 * options.h (class General_options): Add --warn-common.
10159 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10160 merging two common symbols.
10161 (Symbol_table::should_override): Handle --warn-common when merging
10162 a common symbol with a defined symbol. Use report_resolve_problem
10163 for multiple definitions.
10164 (Symbol_table::report_resolve_problem): New function.
10165 * symtab.h (class Symbol_table): Declare report_resolve_problem.
10167 2009-11-03 Doug Kwan <dougkwan@google.com>
10169 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10171 (Target_arm::stub_factory): New method definition.
10172 (Target_arm::new_arm_input_section,
10173 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10174 Target_arm::reloc_uses_thumb_bit): New method declarations.
10175 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10176 New type definitions.
10177 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10178 member declarations.
10179 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10180 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10181 New method definitions.
10183 2009-11-03 Ian Lance Taylor <iant@google.com>
10185 * options.h (class General_options): Add --warn_constructors.
10187 2009-11-03 Ian Lance Taylor <iant@google.com>
10190 * defstd.cc (in_section): Add entries for __rel_iplt_start,
10191 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10193 2009-11-03 Ian Lance Taylor <iant@google.com>
10196 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10197 --msgid-bugs-address.
10198 (install-pdf): New target.
10199 (install-data_yes): Look up one directory to find mkinstalldirs.
10201 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
10203 * po/Make-in (.po.gmo): Don't generate .gmo files in source
10206 2009-10-30 Doug Kwan <dougkwan@google.com>
10208 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10210 2009-10-30 Doug Kwan <dougkwan@google.com>
10212 * arm.cc (Stub_addend_reader): New struct template definition
10213 and partial specializations.
10214 (Stub_addend_reader::operator()): New method definition for a
10215 partially specialized template.
10217 2009-10-30 Doug Kwan <dougkwan@google.com>
10219 * arm.cc (Arm_relobj::processor_specific_flags): New method
10221 (Arm_relobj::do_read_symbols): New method declaration.
10222 (Arm_relobj::processor_specific_flags_): New data member declaration.
10223 (Arm_dynobj): New class definition.
10224 (Target_arm::do_finalize_sections): Add input_objects parameter.
10225 (Target_arm::do_adjust_elf_header): New method declaration.
10226 (Target_arm::are_eabi_versions_compatible,
10227 (Target_arm::merge_processor_specific_flags): New method declaration.
10228 (Target_arm::do_make_elf_object): New overloaded method definitions
10230 (Arm_relobj::do_read_symbols): New method definition.
10231 (Arm_dynobj::do_read_symbols): Ditto.
10232 (Target_arm::do_finalize_sections): Add input_objects parameters.
10233 Merge processor-specific flags from all input objects.
10234 (Target_arm::are_eabi_versions_compatible,
10235 Target_arm::merge_processor_specific_flags,
10236 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10237 New method definitions.
10238 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10239 Input_objects pointer type parameter.
10240 * layout.cc (Layout::finalize): Pass input objects to target's.
10241 finalize_sections function.
10242 * output.cc (Output_file_header::do_sized_write): Set ELF file
10243 header's processor-specific flags.
10244 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10245 Input_objects pointer type parameter.
10246 * sparc.cc (Target_sparc::do_finalize_sections): Same.
10247 * target.h (Input_objects): New forward class declaration.
10248 (Target::processor_specific_flags,
10249 Target::are_processor_specific_flags_sect): New method definitions.
10250 (Target::finalize_sections): Add input_objects parameter.
10251 (Target::Target): Initialize processor_specific_flags_ and
10252 are_processor_specific_flags_set_.
10253 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10255 (Target::set_processor_specific_flags): New method definition.
10256 (Target::processor_specific_flags_,
10257 Target::are_processor_specific_flags_set_): New data member
10259 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10260 Input_objects pointer type parameter.
10262 2009-10-30 Doug Kwan <dougkwan@google.com>
10264 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10266 2009-10-28 Ian Lance Taylor <iant@google.com>
10268 * object.h (class Relobj): Drop options parameter from
10269 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10270 do_scan_relocs, do_relocate. Change all callers.
10271 (class Sized_relobj): Drop options parameters from
10272 do_gc_process_relocs, do_scan_relocs, do_relocate,
10273 do_relocate_sections, relocate_sections, emit_relocs_scan,
10274 emit_relocs_scan_reltype. Change all callers.
10275 (struct Relocate_info): Remove options field and all references to
10277 * reloc.h (class Read_relocs): Remove options constructor
10278 parameter and options_ field. Change all callers.
10279 (class Gc_process_relocs, class Scan_relocs): Likewise.
10280 (class Relocate_task): Likewise.
10281 * target-reloc.h (scan_relocs): Remove options parameter. Change
10283 (scan_relocatable_relocs): Likewise.
10284 * target.h (class Sized_target): Remove options parameter from
10285 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
10287 * gc.h (gc_process_relocs): Remove options parameter. Change all
10289 * arm.cc: Update functions to remove options parameters.
10290 * i386.cc: Likewise.
10291 * powerpc.cc: Likewise.
10292 * sparc.cc: Likewise.
10293 * x86_64.cc: Likewise.
10294 * testsuite/testfile.cc: Likewise.
10296 2009-10-28 Doug Kwan <dougkwan@google.com>
10298 * arm.cc (Arm_relobj): New class definition.
10299 (Arm_relobj::scan_sections_for_stubs,
10300 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10301 New method definitions.
10303 2009-10-28 Cary Coutant <ccoutant@google.com>
10305 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10306 (Plugin::cleanup_done_): New member.
10307 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10308 (Plugin_manager::cleanup_done_): Remove.
10309 (Plugin_manager::add_input_file): Edit error message.
10310 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10311 (Plugin_manager::cleanup): Remove use of cleanup_done_.
10313 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
10315 * fileread.cc: (File_read::View::~View): Use the new
10316 data_ownership_ filed.
10317 (File_read::~File_read): Dispose the new whole_file_view_.
10318 (File_read::open): Mmap the whole file if needed.
10319 (File_read::open): Use whole_file_view_ instead of contents_.
10320 (File_read::find_view): Use whole_file_view_ if applicable.
10321 (File_read::do_read): Use whole_file_view_ instead of contents_.
10322 (File_read::make_view): Use whole_file_view_ instead of contents_,
10323 update File_read::View::View call.
10324 (File_read::find_or_make_view): Update File_read::View::View
10326 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10328 (File_read::View::Data_ownership): New enum.
10329 (File_read::View::View): Replace bool mapped_ with Data_ownership
10331 (File_read::View::mapped_): Remove (replaced by data_ownership_).
10332 (File_read::View::data_ownership_): New field.
10333 (File_read::contents_): Remove (replaced by whole_file_view_).
10334 (File_read::whole_file_view_): New field.
10335 * options.h (class General_options): Add --keep-files-mapped.
10337 2009-10-27 Cary Coutant <ccoutant@google.com>
10339 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10340 * testsuite/Makefile.am (plugin_test_5): New test case.
10341 * testsuite/Makefile.in: Regenerate.
10343 2009-10-25 Doug Kwan <dougkwan@google.com>
10345 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10346 from private to protected to allow access by child class.
10347 (Sized_relobj::do_relocate_sections): New method declaration.
10348 (Sized_relobj::relocate_sections): Virtualize.
10349 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10350 Sized_relobj::relocate_sections. Instantiate template explicitly
10351 for different target sizes and endianity.
10353 2009-10-24 Doug Kwan <dougkwan@google.com>
10355 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10356 (Arm_input_section::as_arm_input_section): New method.
10357 (Arm_output_section): New class definition.
10358 (Arm_output_section::create_stub_group,
10359 Arm_output_section::group_sections): New method definitions.
10361 2009-10-22 Doug Kwan <dougkwan@google.com>
10363 * arm.cc (Arm_input_section): New class definition.
10364 (Arm_input_section::init, Arm_input_section:do_write,
10365 Arm_input_section::set_final_data_size,
10366 Arm_input_section::do_reset_address_and_file_offset): New method
10369 2009-10-21 Doug Kwan <dougkwan@google.com>
10371 * arm.cc (Stub_table, Arm_input_section): New forward class
10373 (Stub_table): New class defintion.
10374 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10375 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10376 New method definition.
10378 2009-10-21 Doug Kwan <dougkwan@google.com>
10380 * arm.cc: Update copyright comments.
10381 (Target_arm): New forward class template declaration.
10382 (Arm_address): New type.
10383 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10384 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10385 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10387 (Insn_template): Same.
10388 (DEF_STUBS): New macro.
10389 (Stub_type): New enum type.
10390 (Stub_template): New class definition.
10392 (Reloc_stub): Same.
10393 (Stub_factory): Same.
10394 (Target_arm::Target_arm): Initialize may_use_blx_ and
10395 should_force_pic_veneer_.
10396 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10397 Target_arm::should_force_pic_veneer,
10398 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10399 Target_arm::using_thumb_only, Target_arm:;default_target): New
10401 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10402 New data member declarations.
10403 (Insn_template::size, Insn_template::alignment): New method defintions.
10404 (Stub_template::Stub_template): New method definition.
10405 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10406 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10407 (Stub_factory::Stub_factory): New method definition.
10408 * gold.h (string_hash): New template.
10409 * output.h (Input_section_specifier::hash_value): Use
10411 (Input_section_specifier::string_hash): Remove.
10412 * stringpool.cc (Stringpool_template::string_hash): Use
10415 2009-10-20 Doug Kwan <dougkwan@google.com>
10417 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10418 symbols of relaxed input sections.
10419 * output.h (Output_section::find_relaxed_input_section): Make
10422 2009-10-16 Doug Kwan <dougkwan@google.com>
10424 * dynobj.cc (Versions::Versions): Initialize version_script_.
10425 Only insert base version symbol definition for a shared object
10426 if version script defines any version versions.
10427 (Versions::define_base_version): New method definition.
10428 (Versions::add_def): Check that base version is not needed.
10429 (Versions::add_need): Define base version lazily.
10430 * dynobj.h (Versions::define_base_version): New method declaration.
10431 (Versions::needs_base_version_): New data member declaration.
10432 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10433 (check_DATA): Add no_version_test.stdout.
10434 (libno_version_test.so, no_version_test.o no_version_test.stdout):
10436 * testsuite/Makefile.in: Regenerate.
10437 * testsuite/no_version_test.c: New file.
10438 * testsuite/no_version_test.sh: Ditto.
10440 2009-10-16 Doug Kwan <dougkwan@google.com>
10442 * expression.cc (class Segment_start_expression): New class definition.
10443 (Segment_start_expression::value): New method definition.
10444 (script_exp_function_segment_start): Return a new
10445 Segment_start_expression.
10446 * gold/script-c.h (script_saw_segment_start_expression): New function
10448 * script-sections.cc (Script_sections::Script_sections): Initialize
10449 SAW_SEGMENT_START_EXPRESSION_ to false.
10450 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10451 and -Tbbs options to specify section addresses if given in
10452 command line and no SEGMENT_START expression is seen in a script.
10453 * script-sections.h (Script_sections::saw_segment_start_expression,
10454 Script_sections::set_saw_segment_start_expression): New method
10456 (Script_sections::saw_segment_start_expression_): New data member
10458 * script.cc (script_saw_segment_start_expression): New function.
10459 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10460 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10461 script_test_7.sh and script_test_8.sh.
10462 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10463 script_test_8.stdout.
10464 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10465 (script_test_6, script_test_6.stdout, script_test_7,
10466 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10467 * Makefile.in: Regenerate.
10468 * testsuite/script_test_6.sh: New file.
10469 * testsuite/script_test_6.t: Same.
10470 * testsuite/script_test_7.sh: Same.
10471 * testsuite/script_test_7.t: Same.
10472 * testsuite/script_test_8.sh: Same.
10474 2009-10-16 Doug Kwan <dougkwan@google.com>
10476 * output.cc (Output_segment::set_section_list_address): Cast
10477 expressions to unsigned long long type to avoid format warnings.
10479 2009-10-15 Ian Lance Taylor <iant@google.com>
10481 * script.cc (Script_options::add_symbol_assignment): Always add a
10482 dot assignment to script_sections_.
10483 * script-sections.cc (Script_sections::add_dot_assignment):
10484 Initialize if necessary.
10486 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10487 program headers with no load segment if there is a linker script.
10489 * layout.cc (Layout::set_segment_offsets): Align the file offset
10490 to the segment aligment for -N or -n with no load segment.
10491 * output.cc (Output_segment::add_output_section): Don't crash if
10492 the first section is a TLS section.
10493 (Output_segment::set_section_list_addresses): Print an error
10494 message if the address moves backward in a linker script.
10495 * script-sections.cc
10496 (Output_section_element_input::set_section_addresses): Don't
10497 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10498 (Orphan_output_section::set_section_addresses): Likewise.
10500 2009-10-15 Doug Kwan <dougkwan@google.com>
10502 * layout.cc (Layout::finish_dynamic_section): Generate tags
10503 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10504 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10505 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10507 2009-10-14 Ian Lance Taylor <iant@google.com>
10509 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10511 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10512 data_shdr fields of relinfo.
10513 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10514 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
10515 R_386_TLS_LDO_32, adjust based on section flags.
10516 (Target_i386::Relocate::fix_up_ldo): Remove.
10518 2009-10-13 Ian Lance Taylor <iant@google.com>
10520 Add support for -pie.
10521 * options.h (class General_options): Add -pie and
10523 (General_options::output_is_position_independent): Test -pie.
10524 (General_options::output_is_executable): Return true if not shared
10525 and not relocatable.
10526 (General_options::output_is_pie): Remove.
10527 * options.cc (General_options::finalize): Reject incompatible uses
10529 * gold.cc (queue_middle_tasks): A -pie link is not static.
10530 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10531 * symtab.cc (Symbol::final_value_is_known): Return false if
10532 output_is_position_independent.
10533 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10534 output_is_position_independent.
10535 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10536 output_is_position_independent.
10537 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10538 output_is_position_independent.
10539 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10541 (basic_pie_test.o, basic_pie_test): New targets.
10542 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10543 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10544 (two_file_pie_test): New target.
10545 * testsuite/Makefile.in: Rebuild.
10546 * README: Remove note saying that -pie is not supported.
10548 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
10550 * options.h (class General_options): Add -init and -fini.
10551 * layout.cc (Layout::finish_dynamic_section): Emit
10552 given init and fini functions.
10554 2009-10-13 Sriraman Tallam <tmsriram@google.com>
10556 * gc.h (gc_process_relocs): Check if icf is enabled using new
10558 * gold.cc (queue_initial_tasks): Likewise.
10559 (queue_middle_tasks): Likewise.
10560 * object.cc (do_layout): Likewise.
10561 * symtab.cc (is_section_folded): Likewise.
10562 * main.cc (main): Likewise.
10563 * reloc.cc (Read_relocs::run): Likewise.
10564 (Sized_relobj::do_scan_relocs): Likewise.
10565 * icf.cc (is_function_ctor_or_dtor): New function.
10566 (Icf::find_identical_sections): Check if function is ctor or dtor when
10567 safe icf is chosen.
10568 * options.h (General_options::icf): Change option to be an enum.
10569 (Icf_status): New enum.
10570 (icf_enabled): New method.
10571 (icf_safe_folding): New method.
10572 (set_icf_status): New method.
10573 (icf_status_): New variable.
10574 * (options.cc) (General_options::finalize): Set icf_status_.
10575 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10576 icf_test and icf_keep_unique_test to use the --icf enum flag.
10577 * testsuite/icf_safe_test.sh: New file.
10578 * testsuite/icf_safe_test.cc: New file.
10580 2009-10-12 Sriraman Tallam <tmsriram@google.com>
10582 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10583 includes to gc.h and icf.h.
10584 * arm.cc: Include gc.h.
10585 * gold.cc: Likewise.
10586 * i386.cc: Likewise.
10587 * powerpc.cc: Likewise.
10588 * sparc.cc: Likewise.
10589 * x86_64.cc: Likewise.
10590 * gc.h: Include icf.h.
10592 2009-10-11 Ian Lance Taylor <iant@google.com>
10594 * plugin.cc: Include "gold.h" before other header files.
10596 2009-10-10 Chris Demetriou <cgd@google.com>
10598 * options.h (Input_file_argument::Input_file_type): New enum.
10599 (Input_file_argument::is_lib_): Replace with...
10600 (Input_file_argument::type_): New member.
10601 (Input_file_argument::Input_file_argument): Take Input_file_type
10602 'type' rather than boolean 'is_lib' as second argument.
10603 (Input_file_argument::is_lib): Use type_.
10604 (Input_file_argument::is_searched_file): New function.
10605 (Input_file_argument::may_need_search): Handle is_searched_file.
10606 * options.cc (General_options::parse_library): Support -l:filename.
10607 (General_options::parse_just_symbols): Update for Input_file_argument
10609 (Command_line::process): Likewise.
10610 * archive.cc (Archive::get_file_and_offset): Likewise.
10611 * plugin.cc (Plugin_manager::release_input_file): Likewise.
10612 * script.cc (read_script_file, script_add_file): Likewise.
10613 * fileread.cc (Input_file::Input_file): Likewise.
10614 (Input_file::will_search_for): Handle is_searched_file.
10615 (Input_file::open): Likewise.
10616 * readsyms.cc (Read_symbols::get_name): Likewise.
10617 * testsuite/Makefile.am (searched_file_test): New test.
10618 * testsuite/Makefile.in: Regenerate.
10619 * testsuite/searched_file_test.cc: New file.
10620 * testsuite/searched_file_test_lib.cc: New file.
10622 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10623 Ian Lance Taylor <iant@google.com>
10625 * descriptor.cc: Include <cstdio> and "binary-io.h".
10626 (Descriptors::open): Open the files in binary mode always.
10627 * script.cc (Lex::get_token): Treat \r as whitespace.
10629 2009-10-09 Ian Lance Taylor <iant@google.com>
10631 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10633 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10634 Ian Lance Taylor <iant@google.com>
10636 * configure.ac: Check for readv function also.
10637 * fileread.cc (readv): Define if not HAVE_READV.
10638 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10640 * config.in: Regenerate.
10641 * configure: Regenerate.
10643 2009-10-09 Doug Kwan <dougkwan@google.com>
10645 * layout.cc (Layout::make_output_section): Call target hook to make
10646 ordinary output section.
10647 (Layout::finalize): Adjust parameter list of call the
10648 Target::may_relax().
10649 * layout.h (class Layout::section_list): New method.
10650 * merge.h (Output_merge_base::entsize): Change visibility to public.
10651 (Output_merge_base::is_string, Output_merge_base::do_is_string):
10653 (Output_merge_string::do_is_string): New method.
10654 * object.cc (Sized_relobj::do_setup): renamed from
10655 Sized_relobj::set_up.
10656 * object.h (Sized_relobj::adjust_shndx,
10657 Sized_relobj::initializ_input_to_output_maps,
10658 Sized_relobj::free_input_to_output_maps): Change visibilities to
10660 (Sized_relobj::setup): Virtualize.
10661 (Sized_relobj::do_setup): New method declaration.
10662 (Sized_relobj::invalidate_section_offset,
10663 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10664 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10665 * options.cc (parse_int): New function.
10666 * options.h (parse_int): New declaration.
10667 (DEFINE_int): New macro.
10668 (stub_group_size): New option.
10669 * output.cc (Output_section::Output_section): Initialize memebers
10670 merge_section_map_, merge_section_by_properties_map_,
10671 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10672 (Output_section::add_input_section): Handled deferred code-fill
10673 generation and remove an old comment.
10674 (Output_section::add_relaxed_input_section): New method definition.
10675 (Output_section::add_merge_input_section): Use merge section by
10676 properties map to speed to search. Update merge section maps
10678 (Output_section::build_relaxation_map): New method definition.
10679 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10681 (Output_section::relax_input_section): Renamed to
10682 Output_section::convert_input_sections_to_relaxed_sections and change
10683 interface to take a vector of pointers to relaxed sections.
10684 (Output_section::find_merge_section,
10685 Output_section::find_relaxed_input_section): New method definitions.
10686 (Output_section::is_input_address_mapped,
10687 Output_section::output_offset, Output_section::output_address):
10688 Use output section data maps to speed up searching.
10689 (Output_section::find_starting_output_address): Add comments.
10690 (Output_section::do_write,
10691 Output_section::write_to_postprocessing_buffer): Do code-fill
10692 generation as appropriate.
10693 (Output_section::get_input_sections): Invalidate relaxed input section
10695 (Output_section::restore_states): Adjust type of checkpoint .
10696 Invalidate relaxed input section map.
10697 * output.h (Output_merge_base): New class declaration.
10698 (Input_section_specifier): New class defintion.
10699 (class Output_relaxed_input_section) Change base class to
10700 Output_section_data_build.
10701 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10702 base class initializer.
10703 (Output_section::add_relaxed_input_section): New method declaration.
10704 (Output_section::Input_section): Change visibility to protected.
10705 (Output_section::Input_section::relobj,
10706 Output_section::Input_section::shndx): Handle relaxed input sections.
10707 Output_section::input_sections) Change visibility to protected. Also
10708 define overload to return a non-const pointer.
10709 (Output_section::Merge_section_properties): New class defintion.
10710 (Output_section::Merge_section_by_properties_map,
10711 Output_section::Output_section_data_by_input_section_map,
10712 Output_section::Relaxation_map): New types.
10713 (Output_section::relax_input_section): Rename method to
10714 Output_section::convert_input_sections_to_relaxed_sections and change
10715 interface to take a vector of relaxed section pointers.
10716 (Output_section::find_merge_section,
10717 Output_section::find_relaxed_input_section,
10718 Output_section::build_relaxation_map,
10719 Output_section::convert_input_sections_in_list_to_relaxed_sections):
10720 New method declarations.
10721 (Output_section::merge_section_map_
10722 Output_section::merge_section_by_properties_map_,
10723 Output_section::relaxed_input_section_map_,
10724 Output_section::is_relaxed_input_section_map_valid_,
10725 Output_section::generate_code_fills_at_write_): New data members.
10726 * script-sections.cc
10727 (Output_section_element_input::set_section_addresses): Call
10728 current_data_size and addralign methods of relaxed input sections.
10729 (Orphan_output_section::set_section_addresses): Call current_data_size
10730 and addralign methods of relaxed input sections.
10731 * symtab.cc (Symbol_table::compute_final_value): Extract template
10732 from the body of Symbol_table::sized_finalize_symbol.
10733 (Symbol_table::sized_finalized_symbol): Call
10734 Symbol_table::compute_final_value.
10735 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10736 (Symbol_table::compute_final_value): New templated method declaration.
10737 * target.cc (Target::do_make_output_section): New method defintion.
10738 * target.h (Target::make_output_section): New method declaration.
10739 (Target::relax): Add more parameters for input objects, symbol table
10740 and layout. Adjust call to do_relax.
10741 (Target::do_make_output_section): New method declaration.
10742 (Target::do_relax): Add parameters for input objects, symbol table
10745 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10747 * pread.c: Include stdio.h.
10749 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10751 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10754 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10756 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10757 Change read_shndx type to unsigned int.
10758 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10760 (Sized_dwarf_line_info::read_line_mappings): Likewise.
10761 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10762 Change read_shndx type to unsigned int.
10763 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10765 (Sized_dwarf_line_info::read_line_mappings): Likewise.
10766 * layout.cc (Layout::create_symtab_sections): Cast the result of
10767 local_symcount * symsize to off_t in the gold_assert.
10769 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10771 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10772 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10774 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10775 (Arm_relocate_functions::thm_abs5): New function.
10776 (Arm_relocate_functions::abs12): New function.
10777 (Arm_relocate_functions::abs16): New function.
10778 (Arm_relocate_functions::base_abs): New function.
10779 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10780 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
10781 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10783 (Scan::global): Likewise.
10784 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10785 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10786 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10787 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10790 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10792 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10793 (Arm_relocate_functions::movt_prel): New function.
10794 (Arm_relocate_functions::thm_movw_prel_nc): New function.
10795 (Arm_relocate_functions::thm_movt_prel): New function.
10796 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10797 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10798 (Scan::global, Relocate::relocate): Likewise.
10799 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10801 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10803 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10804 Incremental_checker.
10805 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10807 (class Incremental_inputs_header): New class.
10808 (Incremental_inputs_header_writer): Edit comment.
10809 (Incremental_inputs_entry): New class.
10810 (Incremental_inputs_entry_writer): Edit comment.
10811 (Sized_incremental_binary::do_find_incremental_inputs_section):
10812 Add *strtab_shndx parameter, fill it.
10813 (Sized_incremental_binary::do_check_inputs): New method.
10814 (Incremental_checker::can_incrementally_link_output_file): Use
10815 Sized_incremental_binary::check_inputs.
10816 (Incremental_inputs::report_command_line): Save command line in
10819 (Incremental_binary::find_incremental_inputs_section): New
10821 (Incremental_binary::do_find_incremental_inputs_section): Add
10822 strtab_shndx parameter.
10823 (Incremental_binary::do_check_inputs): New pure virtual method.
10824 (Sized_incremental_binary::do_check_inputs): Declare.
10825 (Incremental_checker::Incremental_checker): Add incremental_inputs
10826 parameter, use it to initialize incremental_inputs_.
10827 (Incremental_checker::incremental_inputs_): New field.
10828 (Incremental_checker::command_line): New method.
10829 (Incremental_checker::inputs): New method.
10830 (Incremental_checker::command_line_): New field.
10832 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10834 * incremental.cc: Include <cstdarg> and "target-select.h".
10835 (vexplain_no_incremental): New function.
10836 (explain_no_incremental): New function.
10837 (Incremental_binary::error): New method.
10838 (Sized_incremental_binary::do_find_incremental_inputs_section): New
10840 (make_sized_incremental_binary): New function.
10841 (open_incremental_binary): New function.
10842 (can_incrementally_link_file): Add checks if output is ELF and has
10844 * incremental.h: Include "elfcpp_file.h" and "output.h".
10845 (Incremental_binary): New class.
10846 (Sized_incremental_binary): New class.
10847 (open_incremental_binary): Declare.
10848 * object.cc (is_elf_object): Use
10849 elfcpp::Elf_recognizer::is_elf_file.
10850 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10851 * output.h (Output_file::filesize): New method.
10853 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10855 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10857 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10858 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10860 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10862 (Arm_relocate_functions::movw_abs_nc): New function.
10863 (Arm_relocate_functions::movt_abs): New function.
10864 (Arm_relocate_functions::thm_movw_abs_nc): New function.
10865 (Arm_relocate_functions::thm_movt_abs): New function.
10866 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10867 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10868 (Scan::global): Likewise.
10869 (Relocate::relocate): Likewise.
10870 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10872 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10874 * arm.cc (Arm_relocate_functions::got_prel) New function.
10875 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10876 (Relocate::relocate): Likewise.
10877 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10879 2009-10-06 Ian Lance Taylor <iant@google.com>
10881 * options.h (class General_options): Define
10882 split_stack_adjust_size parameter.
10883 * object.h (class Object): Add uses_split_stack_ and
10884 has_no_split_stack_ fields. Add uses_split_stack and
10885 has_no_split_stack accessor functions. Declare
10886 handle_split_stack_section.
10887 (class Reloc_symbol_changes): Define.
10888 (class Sized_relobj): Define Function_offsets. Declare
10889 split_stack_adjust, split_stack_adjust_reltype, and
10891 * object.cc (Object::handle_split_stack_section): New function.
10892 (Sized_relobj::do_layout): Call handle_split_stack_section.
10893 * dynobj.cc (Sized_dynobj::do_layout): Call
10894 handle_split_stack_section.
10895 * reloc.cc (Sized_relobj::relocate_sections): Call
10896 split_stack_adjust for executable sections in split_stack
10897 objects. Pass reloc_map to relocate_section.
10898 (Sized_relobj::split_stack_adjust): New function.
10899 (Sized_relobj::split_stack_adjust_reltype): New function.
10900 (Sized_relobj::find_functions): New function.
10901 * target-reloc.h: Include "object.h".
10902 (relocate_section): Add reloc_symbol_changes parameter. Change
10904 * target.h (class Target): Add calls_non_split method. Declare
10905 do_calls_non_split virtual method. Declare match_view and
10907 * target.cc: Include "elfcpp.h".
10908 (Target::do_calls_non_split): New function.
10909 (Target::match_view): New function.
10910 (Target::set_view_to_nop): New function.
10911 * gold.cc (queue_middle_tasks): Give an error if mixing
10912 split-stack and non-split-stack objects with -r.
10913 * i386.cc (Target_i386::relocate_section): Add
10914 reloc_symbol_changes parameter.
10915 (Target_i386::do_calls_non_split): New function.
10916 * x86_64.cc (Target_x86_64::relocate_section): Add
10917 reloc_symbol_changes parameter.
10918 (Target_x86_64::do_calls_non_split): New function.
10919 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10921 * powerpc.cc (Target_powerpc::relocate_section): Add
10922 reloc_symbol_changes parameter.
10923 * sparc.cc (Target_sparc::relocate_section): Add
10924 reloc_symbol_changes parameter.
10925 * configure.ac: Call AM_CONDITIONAL for the default target.
10926 * configure: Rebuild.
10927 * testsuite/Makefile.am (TEST_AS): New variable.
10928 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10929 (check_DATA): Add split_i386 and split_x86_64 files.
10930 (SPLIT_DEFSYMS): Define.
10931 (split_i386_[1234n].o): New targets.
10932 (split_i386_[124]): New targets.
10933 (split_i386_[1234r].stdout): New targets.
10934 (split_x86_64_[1234n].o): New targets.
10935 (split_x86_64_[124]): New targets.
10936 (split_x86_64_[1234r].stdout): New targets.
10937 (MOSTLYCLEANFILES): Add new executables.
10938 * testsuite/split_i386.sh: New file.
10939 * testsuite/split_x86_64.sh: New file.
10940 * testsuite/split_i386_1.s: New file.
10941 * testsuite/split_i386_2.s: New file.
10942 * testsuite/split_i386_3.s: New file.
10943 * testsuite/split_i386_4.s: New file.
10944 * testsuite/split_i386_n.s: New file.
10945 * testsuite/split_x86_64_1.s: New file.
10946 * testsuite/split_x86_64_2.s: New file.
10947 * testsuite/split_x86_64_3.s: New file.
10948 * testsuite/split_x86_64_4.s: New file.
10949 * testsuite/split_x86_64_n.s: New file.
10950 * testsuite/testfile.cc (Target_test): Update relocation_section
10952 * testsuite/Makefile.in: Rebuild.
10954 2009-10-06 Ian Lance Taylor <iant@google.com>
10956 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10957 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10958 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
10959 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10960 the address on ldo_addrs_.
10961 (Target_i386::Relocate::fix_up_ldo): New function.
10963 2009-10-06 Rafael Espindola <espindola@google.com>
10965 * plugin.cc (add_input_library): New.
10966 (Plugin::load): Add add_input_library to tv.
10967 (Plugin_manager::add_input_file): Add the is_lib argument.
10968 (add_input_file): Update call to Plugin_manager::add_input_file.
10969 (add_input_library): New.
10970 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10972 2009-09-30 Doug Kwan <dougkwan@google.com>
10974 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10975 symbol and call Symbol::may_need_copy_reloc to determine if
10976 a copy reloc is needed.
10977 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10978 nocopyreloc is given in command line.
10979 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10980 given in command line.
10981 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10982 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10983 of the removed Target_i386::may_need_copy_reloc.
10984 * options.h (copyreloc): New option with default value false.
10985 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10986 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10987 instead of the removed Target_powerpc::may_need_copy_reloc.
10988 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10989 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10990 instead of the removed Target_sparc::may_need_copy_reloc.
10991 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10992 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10993 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10994 instead of the removed Target_x86_64::may_need_copy_reloc.
10996 2009-09-30 Ian Lance Taylor <iant@google.com>
10998 * object.h (class Object): Remove target_ field, and target,
10999 sized_target, and set_target methods.
11000 (Object::sized_target): Remove.
11001 (class Sized_relobj): Update declarations. Remove sized_target.
11002 * object.cc (Sized_relobj::setup): Remove target parameter.
11003 Change all callers.
11004 (Input_objects::add_object): Don't do anything with the target.
11005 (make_elf_sized_object): Add punconfigured parameter. Change all
11006 callers. Set or test parameter target.
11007 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11008 Change all callers.
11009 * parameters.cc (Parameters::set_target): Change parameter type to
11011 (Parameters::default_target): Remove.
11012 (set_parameters_target): Change parameter type to be non-const.
11013 (parameters_force_valid_target): New function.
11014 (parameters_clear_target): New function.
11015 * parameters.h (class Parameters): Update declarations. Remove
11016 default_target method. Add sized_target and clear_target
11017 methods. Change target_ to be non-const.
11018 (set_parameters_target): Update declaration.
11019 (parameters_force_valid_target): Declare.
11020 (parameters_clear_target): Declare.
11021 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11022 as NULL if we aren't searching.
11023 (Add_symbols::run): Don't check for compatible target.
11024 * fileread.cc (Input_file::open_binary): Call
11025 parameters_force_valid_target.
11026 * gold.cc (queue_middle_tasks): Likewise.
11027 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
11028 set_target on object.
11029 * dynobj.h (class Sized_dynobj): Update declarations.
11030 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11031 make_elf_object returns NULL.
11032 (Archive::include_member): Don't check whether object target is
11034 * output.cc (Output_section::add_input_section): Get target from
11036 (Output_section::relax_input_section): Likewise.
11037 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11039 (Sized_relobj::do_scan_relocs): Likewise.
11040 (Sized_relobj::relocate_sections): Likewise.
11041 * resolve.cc (Symbol_table::resolve): Likewise.
11042 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
11043 parameter. Change all callers.
11044 (Symbol_table::add_from_object): Get target from parameters.
11045 (Symbol_table::add_from_relobj): Don't check object target.
11046 (Symbol_table::add_from_dynobj): Likewise.
11047 (Symbol_table::define_special_symbol): Get target from
11049 * symtab.h (class Symbol_table): Update declaration.
11050 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11051 parameter. Change all callers. Clear parameter target.
11052 (Binary_test): Test target here.
11053 * testsuite/object_unittest.cc (gold_testsuite): Remove
11054 target_test_pointer parameter. Change all callers.
11055 (Object_test): Test target here.
11057 2009-09-26 Ian Lance Taylor <iant@google.com>
11059 * testsuite/initpri1.c: Don't try to use constructor priorities if
11060 compiling with gcc before 4.3.
11062 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
11064 * testsuite/retain_symbols_file_test.sh (check_present): Change
11065 output file name to retain_symbols_file_test.stdout.
11066 (check_absent): Likewise.
11068 2009-09-18 Craig Silverstein <csilvers@google.com>
11070 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11071 * options.cc: Include <cerrno> and <fstream>.
11072 (General_options::finalize): Parse -retain-symbols-file tag.
11073 * options.h: New flag.
11074 (General_options): New method should_retain_symbol, new
11075 variable symbols_to_retain.
11076 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11077 should_retain_symbol map.
11078 * testsuite/Makefile.am (retain_symbols_file_test): New test.
11079 * testsuite/Makefile.in: Regenerate.
11080 * testsuite/retain_symbols_file_test.sh: New file.
11082 2009-09-18 Nick Clifton <nickc@redhat.com>
11084 * po/es.po: Updated Spanish translation.
11086 2009-09-17 Doug Kwan <dougkwan@google.com>
11088 * debug.h (DEBUG_RELAXATION): New constant.
11089 (DEBUG_ALL): Add DEBUG_RELAXATION.
11090 (debug_string_to_enum): Add relaxation debug option.
11092 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11093 Layout::Relaxation_debug_check::read_sections,
11094 Layout::Relaxation_debug_check::read_sections): New method definitions.
11095 (Layout::Layout): Initialize data members
11096 record_output_section_data_from_scrips_,
11097 script_output_section_data_list_ and relaxation_debug_check_.
11098 (Layout::save_segments, Layout::restore_segments,
11099 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11100 Layout::relaxation_loop_body): New method definitions.
11101 (Layout::finalize): Support relaxation. Move section layout code to
11102 Layout::relaxation_loop_body.
11103 (Layout::set_asection_address_from_script): Move code for orphan
11104 section placement out.
11105 (Layout::place_orphan_sections_in_script): New method definition.
11106 * layout.h (Output_segment_headers, Output_file_header):
11107 New forward class declarations.
11108 (Layout::~Layout): Define.
11109 (Layout::new_output_section_data_from_script): New method definition.
11110 (Layout::place_orphan_sections_in_script): New method declaration.
11111 (Layout::Segment_states): New type declaration.
11112 (Layout::save_segments, Layout::restore_segments,
11113 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11114 Layout::relaxation_loop_body): New method declarations.
11115 (Layout::Output_section_data_list): New type declaration.
11116 (Layout::Relaxation_debug_check): New class definition.
11117 (Layout::record_output_section_data_from_script_,
11118 Layout::script_output_section_data_list_, Layout::segment_states_,
11119 Layout::relaxation_debug_check_): New data members.
11120 * output.cc: (Output_section_headers::do_size): New method definition.
11121 (Output_section_headers::Output_section_headers): Move size
11122 computation to Output_section_headers::do_size.
11123 (Output_segment_headers::do_size): New method definition.
11124 (Output_file_header::Output_file_header): Move size computation to
11125 Output_file_header::do_size and call it.
11126 (Output_file_header::do_size): New method definition.
11127 (Output_data_group::Output_data_group): Adjust call to
11128 Output_section_data.
11129 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11130 (Output_symtab_xindex::do_write): Add array bound check.
11131 (Output_section::Input_section::print_to_mapfile): Handle
11132 RELAXED_INPUT_SECTION_CODE.
11133 (Output_section::Output_section): Initialize data member checkpoint_.
11134 (Output_section::~Output_section): Delete checkpoint object pointed
11136 (Output_section::add_input_section): Always add an Input_section if
11138 (Output_section::add_merge_input_section): Add assert.
11139 (Output_section::relax_input_section): New method definition.
11140 (Output_section::set_final_data_size): Set load address to zero for
11141 an unallocated section.
11142 (Output_section::do_address_and_file_offset_have_reset_values):
11143 New method definition.
11144 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11145 Handle relaxed input section.
11146 (Output_section::sort_attached_input_sections): Checkpoint input
11147 section list lazily.
11148 (Output_section::get_input_sections): Change type of input_sections to
11149 list of Simple_input_section pointers. Checkpoint input section list
11150 lazily. Also handle relaxed input sections.
11151 (Output_section::add_input_section_for_script): Take a reference to
11152 a Simple_input_section object instead of Relobj pointer and section
11153 index as parameter. Handle relaxed input sections.
11154 (Output_section::save_states, Output_section::restore_states): New
11155 method definitions.
11156 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11157 (Output_data::is_data_size_fixed): New method definition.
11158 (Output_data::reset_addresss_and_file_offset): Do not reset data size
11160 (Output_data::address_and_file_offset_have_reset_values): New method
11162 (Output_data::do_address_and_file_offset_have_reset_values): New method
11164 (Output_data::set_data_size): Check that data size is not fixed.
11165 (Output_data::fix_data_size): New method definition.
11166 (Output_data::is_data_size_fixed_): New data member.
11167 (Output_section_headers::set_final_data_size): New method definition.
11168 (Output_section_headers::do_size): New method declaration.
11169 (Output_segment_headers::set_final_data_size): New method definition.
11170 (Output_segment_headers::do_size): New method declaration.
11171 (Output_file_header::set_final_data_size)::New method definition.
11172 (Output_file_header::do_size)::New method declaration.
11173 (Output_section_data::Output_section_data): Add new parameter
11174 is_data_size_fixed and use it to fix data size.
11175 (Output_data_const::Output_data_const): Adjust call to base class
11176 constructor and fix data size.
11177 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11178 base class constructor and fix data size.
11179 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11180 base class constructor and fix data size.
11181 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11182 class constructor and fix data size.
11183 (Output_data_group::set_final_data_size): New method definition.
11184 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11185 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11186 class constructor and fix data size.
11187 (Output_relaxed_input_section): New class definition.
11188 (Output_section::Simple_input_section): New class definition.
11189 (Output_section::get_input_sections): Adjust parameter list.
11190 (Output_section::add_input_section_for_script): Same.
11191 (Output_section::save_states, Output_section::restore_states,
11192 Output_section::do_address_and_file_offset_have_reset_values,
11193 (Output_section::Input_section::Input_section): Handle
11194 RELAXED_INPUT_SECTION_CODE. Add new overload for
11195 Output_relaxed_input_section.
11196 (Output_section::Input_section::is_input_section,
11197 Output_section::Input_section::set_output_section): Handle relaxed
11199 (Output_section::Input_section::is_relaxed_input_section,
11200 Output_section::Input_section::output_section_data,
11201 Output_section::Input_section::relaxed_input_section): New method
11203 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11205 (Output_section::Input_section::u1_): Update comments.
11206 (Output_section::Input_section::u2_): Add new union member poris.
11207 (Output_section::Checkpoint_output_section): New classs definition.
11208 (Output_section::relax_input_section): New method declaration.
11209 (Output_section::checkpoint_): New data member.
11210 (Output_segment): Update comments.
11211 (Output_segment::Output_segment): Un-privatize copy constructor.
11212 (Output_segment::operator=): Un-privatize.
11213 * script-sections.cc (Output_section_element::Input_section_list):
11214 Change element type to Output_section::Simple_input_section.
11215 (Output_section_element_dot_assignment::set_section_addresses):
11216 Register output section data for relaxation clean up.
11217 (Output_data_exression::Output_data_expression): Adjust call to base
11218 constructor to fix data size.
11219 (Output_section_element_data::set_section_addresses): Register
11220 Output_data_expression object for relaxation clean up.
11221 (struct Input_section_info): Replace Relobj pointer and section index
11222 pair with Output_section::Simple_input_section and Convert struct to a
11224 (Input_section_sorter::operator()): Adjust access to
11225 Input_section_info data member to use accessors.
11226 (Output_section_element_input::set_section_addresses): Use layout
11227 parameter. Adjust code to use Output_section::Simple_input_section
11228 and Input_secction_info classes. Register filler for relaxation
11230 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11231 and section index pair with Output_section::Simple_input_section
11232 class. Adjust code accordingly.
11233 (Phdrs_element::release_segment): New method definition.
11234 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11236 (Script_sections::release_segments): New method definition.
11237 * gold/script-sections.h (Script_sections::release_segments): New
11238 method declaration.
11239 * gold/target.h (Target::may_relax, Target::relax,
11240 Target::do_may_relax, Target::do_relax): New method definitions.
11242 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11244 * arm.cc (has_signed_unsigned_overflow): New function.
11245 (Arm_relocate_functions::abs8): New function.
11246 (Target_arm::Scan::local): Handle R_ARM_ABS8.
11247 (Target_arm::Scan::global): Likewise.
11248 (Target_arm::relocate::relocate): Likewise.
11249 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11252 2009-09-16 Cary Coutant <ccoutant@google.com>
11254 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11255 * testsuite/Makefile.in: Regenerate.
11257 2009-09-11 Nick Clifton <nickc@redhat.com>
11259 * po/gold.pot: Updated by the Translation project.
11261 2009-09-08 Cary Coutant <ccoutant@google.com>
11263 * output.cc (Output_file::open): Add execute permission to empty file.
11264 * testsuite/Makefile.am (permission_test): New test.
11265 * testsuite/Makefile.in: Regenerate.
11267 2009-09-02 Ian Lance Taylor <iant@google.com>
11269 * output.cc (Output_file::resize): Call map_no_anonymous rather
11272 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
11274 * gold.cc: Include "incremental.h".
11275 (queue_initial_tasks): Call Incremental_checker methods.
11276 * incremental.cc: Include "output.h".
11277 (Incremental_checker::can_incrementally_link_output_file): New
11279 * incremental.h (Incremental_checker): New class.
11281 * output.cc (Output_file::open_for_modification): New method.
11282 (Output_file::map_anonymous): Changed return type to bool. Record
11283 map in base_ field.
11284 (Output_file::map_no_anonymous): New method, broken out of map.
11285 (Output_file::map): Use map_no_anonymous and map_anonymous.
11286 * output.h (class Output_file): Update declarations.
11288 2009-08-24 Cary Coutant <ccoutant@google.com>
11290 * options.h (Command_line::Pre_options): New class.
11291 (Command_line::pre_options): New member.
11292 * options.cc (gold::options::ready_to_register): New variable.
11293 (One_option::register_option): Do nothing if not registering options.
11294 Assert if same short option registered twice.
11295 (General_options::General_options): Turn off option registration when
11297 (Command_line::Pre_options::Pre_options): New constructor.
11299 2009-08-24 Cary Coutant <ccoutant@google.com>
11301 * options.h (General_options::no_keep_memory): Remove incorrect
11304 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
11306 * Makefile.am (am__skiplex, am__skipyacc): New.
11307 * Makefile.in: Regenerate.
11309 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
11311 * Makefile.am (AM_CPPFLAGS): Renamed from ...
11312 (INCLUDES): ... this.
11313 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11314 (AM_CPPFLAGS): Renamed from ...
11315 (INCLUDE): ... this.
11316 * Makefile.in, testsuite/Makefile.in: Regenerate.
11318 * Makefile.in: Regenerate.
11319 * aclocal.m4: Likewise.
11320 * config.in: Likewise.
11321 * configure: Likewise.
11322 * testsuite/Makefile.in: Likewise.
11324 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11325 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11326 * Makefile.in: Regenerate.
11327 * testsuite/Makefile.in: Regenerate.
11329 2009-08-19 Cary Coutant <ccoutant@google.com>
11331 * resolve.cc (Symbol_table::resolve): Don't complain about defined
11332 symbols in shared libraries overridden by hidden or internal symbols
11333 in the main program.
11335 2009-08-19 Chris Demetriou <cgd@google.com>
11337 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11338 checking source file names in error messages.
11340 2009-08-18 Doug Kwan <dougkwan@google.com>
11342 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11343 an elcpp::Ehdr as parameter. Adjust call to set_target.
11344 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11345 an elfcpp::Ehdr as parameter.
11346 * object.cc (Object::set_target): Remove the version that looks up
11347 a target and sets it.
11348 (Sized_relobj::setup): Take a Target object instead of
11349 an elfcpp::Ehdr as parameter. Adjust call to set_target.
11350 (make_elf_sized_object): Find target and ask target to
11351 make an ELF object.
11352 * object.h: (Object::set_target): Remove the version that looks up
11353 a target and sets it.
11354 (Sized_relobj::setup): Take a Target object instead of
11355 an elfcpp:Ehdr as parameter.
11356 * target.cc: Include dynobj.h.
11357 (Target::do_make_elf_object_implementation): New.
11358 (Target::do_make_elf_object): New.
11359 * target.h (Target::make_elf_object): New template declaration.
11360 (Target::do_make_elf_object): New method declarations.
11361 (Target::do_make_elf_object_implementation): New template declaration.
11363 2009-08-14 Ian Lance Taylor <iant@google.com>
11365 * gold.h (FUNCTION_NAME): Define.
11366 (gold_unreachable): Use FUNCTION_NAME.
11368 2009-08-12 Sriraman Tallam <tmsriram@google.com>
11370 * icf.cc (Icf::find_identical_sections): Issue a warning when a
11371 symbol in the --keep-unique list is not found.
11373 2009-08-12 Sriraman Tallam <tmsriram@google.com>
11375 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11376 been maked as --keep-unique.
11377 (Icf::unfold_section): New function.
11378 * icf.h (Icf::unfold_section): New function.
11379 * options.h (General_options::keep_unique): New option.
11380 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11381 * testsuite/Makefile.in: Regenerate.
11382 * testsuite/icf_keep_unique_test.sh: New file.
11383 * testsuite/icf_keep_unique_test.cc: New file.
11385 2009-08-12 Cary Coutant <ccoutant@google.com>
11388 * resolve.cc (Symbol_table::resolve): Check for references from
11389 dynamic objects to hidden and internal symbols.
11390 * testsuite/Makefile.am (hidden_test.sh): New test.
11391 * testsuite/Makefile.in: Regenerate.
11392 * testsuite/hidden_test.sh: New script.
11393 * testsuite/hidden_test_1.c: New test source.
11394 * testsuite/hidden_test_main.c: New test source.
11396 2009-08-11 Doug Kwan <dougkwan@google.com>
11398 * arm.cc: Update comments.
11399 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11400 segment to locate the .ARM.exidx section if present.
11402 2009-08-09 Doug Kwan <dougkwan@google.com>
11404 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11407 2009-08-07 Sriraman Tallam <tmsriram@google.com>
11408 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11411 2009-08-06 Sriraman Tallam <tmsriram@google.com>
11413 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11414 valid tls_segment only for non-debug-section relocations.
11415 * testsuite/Makefile.am: Add gc_tls_test.
11416 * testsuite/Makefile.in: Regenerate.
11417 * testsuite/gc_tls_test.cc: New file.
11418 * testsuite/gc_tls_test.sh: New file.
11420 2009-08-05 Sriraman Tallam <tmsriram@google.com>
11422 * icf.cc: New file.
11424 * Makefile.am (CCFILES): Add icf.cc.
11425 (HFILES): Add icf.h
11426 * Makefile.in: Regenerate.
11427 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11428 * gc.h (gc_process_relocs): Populate lists used by icf to contain
11429 section, symbol and addend information for the relocs.
11430 * gold.cc (queue_middle_tasks): Call identical code folding.
11431 * gold.h: Add defines for multimap.
11432 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11433 to the call of finalize_local_symbols.
11434 * main.cc (main): Create object of class Icf.
11435 * object.cc (Sized_relobj::do_layout): Allow this function to be
11436 called twice during icf.
11437 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11438 to sections marked as identical by icf.
11439 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11441 (Sized_relobj::do_section_entsize): New function.
11442 * object.h (Object::section_entsize): New function.
11443 (Object::do_section_entsize): New pure virtual function.
11444 (Relobj::finalize_local_symbols): Add new parameter.
11445 (Relobj::do_section_entsize): New function.
11446 * options.h (General_options::icf): New option.
11447 (General_options::icf_iterations): New option.
11448 (General_options::print_icf_sections): New option.
11449 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11450 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11451 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11453 * symtab.cc (Symbol_table::is_section_folded): New function.
11454 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
11455 to sections marked as identical by icf.
11456 * symtab.h (Symbol_table::set_icf): New function.
11457 (Symbol_table::icf): New function.
11458 (Symbol_table::is_section_folded): New function.
11459 (Symbol_table::icf_): New data member.
11460 * target-reloc.h (relocate_section): Ignore sections folded by icf.
11461 * testsuite/Makefile.am: Add commands to build icf_test.
11462 * testsuite/Makefile.in: Regenerate.
11463 * testsuite/icf_test.sh: New file.
11464 * testsuite/icf_test.cc: New file.
11466 2009-07-24 Chris Demetriou <cgd@google.com>
11468 * layout.cc (is_compressible_debug_section): Fix incorrect
11469 comment about compressed section names.
11471 2009-07-20 Ian Lance Taylor <ian@airs.com>
11474 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11476 2009-07-16 Ian Lance Taylor <iant@google.com>
11479 * layout.h: #include <map>.
11480 (class Kept_section): Change from struct to class. Add accessors
11481 and setters. Add section size to Comdat_group mapping. Change
11482 Comdat_group to std::map. Add is_comdat_ field. Add
11483 linkonce_size field in union.
11484 (class Layout): Update declaration of find_or_add_kept_section.
11485 Don't declare find_kept_object.
11486 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11487 parameter. Add object, shndx, is_comdat, and is_group_name
11488 parameters. Change all callers. Adjust for new Kept_section.
11489 (Layout::find_kept_object): Remove.
11490 * object.cc (Sized_relobj::include_section_group): Update use of
11491 Kept_section. Rename secnum to shndx. Only record
11492 Kept_comdat_section if sections are the same size.
11493 (Sized_relobj::include_linkonce_section): Update use of
11494 Kept_section. Only record Kept_comdat_section if sections are the
11495 same size. Set size of linkonce section.
11496 (Sized_relobj::map_to_kept_section): Update call to
11497 get_kept_comdat_section.
11498 * object.h (class Sized_relobj): Rename fields in
11499 Kept_comdat_section to drop trailing underscores; change object
11500 field to Relobj*. Change Kept_comdat_section_table to store
11501 struct rather than pointer.
11502 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11503 Add kept_object and kept_shndx parameters. Change all callers.
11504 (Sized_relobj::get_kept_comdat_section): Change return type to
11505 bool. Add kept_object and kept_shndx parameters. Change all
11507 * plugin.cc (Pluginobj::include_comdat_group): Update call to
11508 Layout::find_or_add_kept_section.
11510 2009-07-09 Ian Lance Taylor <iant@google.com>
11512 * merge.cc (Object_merge_map::initialize_input_to_output_map):
11513 Reserve space in the hash table.
11515 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
11517 * fileread.cc (File_read::get_mtime): New method.
11518 * fileread.h (Timespec): New structure.
11519 (File_read::get_mtime): New method.
11520 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11521 Renamed from timestamp_nsec.
11522 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11524 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11526 (Incremental_inputs::report_archive): Save mtime; style fix.
11527 (Incremental_inputs::report_obejct): Save mtime; style fix.
11528 (Incremental_inputs::report_script): Save mtime; style fix.
11529 (Incremental_inputs::finalize_inputs): Style fix.
11530 (Incremental_inputs::finalize): Style fix.
11531 (Incremental_inputs::create_input_section_data): Store inputs
11533 * incremental.h (Incremental_inputs::report_script): Add mtime
11535 (Incremental_inputs::Input_info::Input_info): Intialize only one
11537 (Incremental_inputs::Input_info::archive): Move to nameless
11539 (Incremental_inputs::Input_info::obejct): Move to nameless union.
11540 (Incremental_inputs::Input_info::script): Move to nameless union.
11541 (Incremental_inputs::mtime): New field.
11542 * script.cc (read_input_script): Pass file mtime to
11544 * script.h (Script_info::inputs): Style fix.
11546 2009-07-01 Ian Lance Taylor <ian@airs.com>
11548 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11551 2009-06-24 Ian Lance Taylor <iant@google.com>
11554 * layout.cc (Layout::choose_output_section): If we find an
11555 existing section, update the flags.
11556 (Layout::create_notes): New function, broken out of
11558 (Layout::finalize): Don't create note sections.
11559 (Layout::create_note): Don't crash if linker script discards
11561 (Layout::create_gold_note): Likewise.
11562 (Layout::create_build_id): Likewise. Don't set
11563 after_input_sections on the section.
11564 (Layout::create_executable_stack_info): Remove target parameter.
11566 * layout.h (class Layout): Declare create_notes. Update
11567 declaration of create_executable_stack_info.
11568 * gold.cc (queue_middle_tasks): Call create_notes.
11569 * output.cc (Output_section::update_flags_for_input_section): Move
11570 here from output.h. If SHF_ALLOC flag is newly set, mark address
11572 * output.h (Output_data::mark_address_invalid): New function.
11573 (class Output_section): Only declare, not define,
11574 update_flags_for_input_section. Remove set_flags.
11576 2009-06-24 Ian Lance Taylor <iant@google.com>
11578 * script-sections.cc (Output_section_definition::
11579 set_section_addresses): Rename shadowing local load_address to
11582 2009-06-24 Ian Lance Taylor <iant@google.com>
11585 * reloc.cc (relocate_sections): Skip empty relocation sections.
11587 2009-06-23 Ian Lance Taylor <iant@google.com>
11590 * layout.cc (Layout::create_note): Use choose_output_section
11591 rather than make_output_section.
11593 2009-06-23 Ian Lance Taylor <iant@google.com>
11596 * options.cc (General_options::parse_V): Set printed_version_.
11597 (General_options::General_options): Initialize printed_version_.
11598 * options.h (class General_options): Add printed_version_ field.
11599 * gold.cc (queue_initial_tasks): If there are no input files,
11600 don't give a fatal error if we printed the version information.
11601 (queue_middle_tasks): If using -r with a shared object, give a
11602 fatal error rather than an ordinary error.
11604 2009-06-23 Ian Lance Taylor <iant@google.com>
11607 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11608 (Layout::make_output_section): Set have_stabstr_section_ if we see
11609 a .stab*str section.
11610 (Layout::finalize): Call link_stabs_sections.
11611 (Layout::link_stabs_sections): New file.
11612 * layout.h (class Layout): Add have_stabstr_section_ field.
11613 Declare link_stabs_sections.
11615 2009-06-23 Doug Kwan <dougkwan@google.com>
11617 * Makefile.am (libgold_a_LIBADD): New.
11618 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11619 * Makefile.in: Regenerate.
11620 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11621 * configure: Regenerate.
11622 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11623 * fileread.cc: Include sys/state.h
11624 * gold.h: Declare memmem and strndup if found missing.
11625 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11627 2009-06-23 Ian Lance Taylor <iant@google.com>
11629 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11630 * configure: Rebuild.
11632 2009-06-23 Ian Lance Taylor <iant@google.com>
11635 * object.cc (Object::section_contents): Don't try to get a view if
11636 the section has length zero.
11637 (Object::handle_gnu_warning_section): If the section is empty, use
11638 the name of the section as the warning.
11640 2009-06-23 Ian Lance Taylor <iant@google.com>
11643 * stringpool.h (class Stringpool_template): Add optimize_ field.
11644 (Stringpool_template::set_optimize): New function.
11645 * stringpool.cc (Stringpool_template::Stringpool_template):
11646 Initialize optimize_ field.
11647 (Stringpool_template::set_string_offsets): Test local optimize
11648 fild rather than parameter.
11649 * layout.cc (Layout::Layout): Call set_optimize on the section
11652 2009-06-22 Ian Lance Taylor <iant@google.com>
11655 * yyscript.y: Parse TARGET.
11656 * script.cc (script_set_target): New function.
11657 * script-c.h (script_set_target): Declare.
11658 * options.cc (General_options::string_to_object_format): Rename
11659 from string_to_object_format in anonymous namespace. Change
11661 * options.h (class General_options): Declare
11662 string_to_object_format.
11664 2009-06-22 Ian Lance Taylor <iant@google.com>
11666 * script-sections.cc (Script_sections::create_segments): Don't put
11667 program headers in a PT_LOAD segment if -n or -N.
11669 2009-06-22 Ian Lance Taylor <iant@google.com>
11672 * options.h (class General_options): Add -z lazy and -z now. Sort
11673 -z options into alphabetical order.
11674 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11676 2009-06-21 Ian Lance Taylor <iant@google.com>
11678 * layout.cc (Layout::make_output_section): Call
11679 Target::new_output_section.
11680 (Layout::attach_allocated_section_to_segment): Put large section
11681 sections in a separate load segment with the large segment flag
11683 (Layout::segment_precedes): Sort large data segments after other
11685 (align_file_offset): New static function.
11686 (Layout::set_segment_offsets): Use align_file_offset.
11687 * output.h (class Output_section): Add is_small_section_ and
11688 is_large_section_ fields.
11689 (Output_section::is_small_section): New function.
11690 (Output_section::set_is_small_section): New function.
11691 (Output_section::is_large_section): New function.
11692 (Output_section::set_is_large_section): New function.
11693 (Output_section::is_large_data_section): New function.
11694 (class Output_segment): Add is_large_data_segment_ field.
11695 (Output_segment::is_large_data_segment): New function.
11696 (Output_segment::set_is_large_data_segment): New function.
11697 * output.cc (Output_section::Output_section): Initialize new
11699 (Output_segment::Output_segment): Likewise.
11700 (Output_segment::add_output_section): Add assertion that large
11701 data sections always go in large data segments. Force small data
11702 sections to the end of the list of data sections. Force small BSS
11703 sections to the start of the list of BSS sections. For large BSS
11704 sections to the end of the list of BSS sections.
11705 * symtab.h (class Symbol): Declare is_common_shndx.
11706 (Symbol::is_defined): Check Symbol::is_common_shndx.
11707 (Symbol::is_common): Likewise.
11708 (class Symbol_table): Define enum Commons_section_type. Update
11709 declarations. Add small_commons_ and large_commons_ fields.
11710 * symtab.cc (Symbol::is_common_shndx): New function.
11711 (Symbol_table::Symbol_table): Initialize new fields.
11712 (Symbol_table::add_from_object): Put small and large common
11713 symbols in the right list.
11714 (Symbol_table::sized_finalized_symbol): Check
11715 Symbol::is_common_shndx.
11716 (Symbol_table::sized_write_globals): Likewise.
11717 * common.cc (Symbol_table::do_allocate_commons): Allocate new
11718 common symbol lists. Don't call do_allocate_commons_list if the
11720 (Symbol_table::do_allocate_commons_list): Remove is_tls
11721 parameter. Add comons_section_type parameter. Change all
11722 callers. Handle small and large common symbols.
11723 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11724 Symbol::is_common_shndx.
11725 * resolve.cc (symbol_to_bits): Likewise.
11726 * target.h (Target::small_common_shndx): New function.
11727 (Target::small_common_section_flags): New function.
11728 (Target::large_common_shndx): New function.
11729 (Target::large_common_section_flags): New function.
11730 (Target::new_output_section): New function.
11731 (Target::Target_info): Add small_common_shndx, large_common_shndx,
11732 small_common_section_flags, and large_common_section_flags
11734 (Target::do_new_output_section): New virtual function.
11735 * arm.cc (Target_arm::arm_info): Initialize new fields.
11736 * i386.cc (Target_i386::i386_info): Likewise.
11737 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11739 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11740 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11741 (Target_x86_64::do_new_output_section): New function.
11742 * configure.ac: Define conditional MCMODEL_MEDIUM.
11743 * testsuite/Makefile.am (check_PROGRAMS): Add large.
11744 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11745 (large_LDFLAGS): Define.
11746 * testsuite/large.c: New file.
11747 * testsuite/testfile.cc (Target_test::test_target_info):
11748 Initialize new fields.
11749 * configure, testsuite/Makefile.in: Rebuild.
11751 2009-06-05 Doug Kwan <dougkwan@google.com>
11753 * Makefile.am (CCFILES): Add target.cc.
11754 * Makefile.in: Regenerate.
11755 * i386.cc (class Target_i386): Define new virtual method to
11756 override do_is_local_label_name in parent.
11757 * object.cc (Sized_relobj::do_count_local_symbols): Discard
11758 local symbols if --discard-locals or -X is given.
11759 * options.h (class General_options): Declare new options
11760 '--discard-locals' and '-X' for discarding locals.
11761 * target.h (class Target): Define new methods is_local_label_name.
11762 Declare new virtual method do_is_local_label_name.
11763 * target.cc: New file.
11764 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11765 (check_SCRIPTS): Add discard_locals_test.sh.
11766 (check_DATA): Add discard_local_tests.syms.
11767 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11768 (discard_local_tests.syms, discard_locals_test.o): New make rules.
11769 * testsuite/Makefile.in: Regenerate.
11770 * testsuite/discard_locals_test.c: New file.
11771 * testsuite/discard_locals_test.sh: Same.
11773 2009-06-05 Doug Kwan <dougkwan@google.com>
11775 * object.cc (Sized_relobj::Sized_relobj): Initialize
11776 discarded_eh_frame_shndx_ to -1U.
11777 (Sized_relobj::do_layout): Record index of a discard .eh_frame
11779 (Sized_relobj::do_count_local_symbols): Skip local symbols in
11780 a discarded .eh_frame section.
11781 (Sized_relobj::do_finalize_local_symbols): Ditto.
11782 * object.h (class Sized_relobj): Declare new member
11783 discarded_eh_frame_shndx_.
11784 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11785 (local_labels_test.o, local_labels_test): New rules.
11786 * testsuite/Makefile.in: Regenerate.
11788 2009-06-04 Doug Kwan <dougkwan@google.com>
11790 * layout.cc (Layout::section_name_mapping): Add mapping for
11791 special ARM sections.
11793 2009-06-03 Doug Kwan <dougkwan@google.com>
11795 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11796 (utils::has_overflow): Same.
11798 2009-06-03 Ian Lance Taylor <iant@google.com>
11800 * layout.cc (Layout::section_name_mapping): New array, replacing
11801 Layout::linkonce_mapping.
11802 (Layout::section_name_mapping_count): New variable, replacing
11803 Layout::linkonce_mapping_count.
11804 (Layout::linkonce_output_name): Remove.
11805 (Layout::output_section_name): Rewrite.
11806 * layout.h (class Layout): Rename Linkonce_mapping to
11807 Section_name_mapping, linkonce_mapping to section_name_mapping,
11808 linkonce_mapping_count to section_name_mapping_count. Don't
11809 declare linkonce_output_name.
11811 2009-06-03 Doug Kwan <dougkwan@google.com>
11813 * gold/arm.cc (namespace utils): New.
11814 (Target_arm::reloc_is_non_pic): Define new method.
11815 (class Arm_relocate_functions): New.
11816 (Target_arm::Relocate::relocate): Handle relocation types used by
11819 2009-06-03 Ian Lance Taylor <iant@google.com>
11821 * arm.cc (Target_arm::scan::global): Use || instead of |.
11823 2009-06-02 Doug Kwan <dougkwan@google.com>
11825 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
11826 issued_non_pic_error_.
11827 (class Target_arm::Scan): Declare new method check_non_pic.
11828 Define new method symbol_needs_plt_entry.
11829 Declare new data member issued_non_pic_error_.
11830 (class Target_arm::Relocate): Declare new method
11831 should_apply_static_reloc.
11832 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11833 (Target_arm::Scan::check_non_pic): Define new method.
11834 (Target_arm::Scan::local): Handle a small subset of reloc types used
11836 (Target_arm::Scan::local): Same.
11837 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11839 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
11841 * incremental.cc (Incremental_inputs::report_command_line): Filter
11842 out --incremental-* options.
11844 2009-05-29 Doug Kwan <dougkwan@google.com>
11846 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11848 (class Target_arm): Update comment.
11849 (Target_arm::Target_arm): Initialize new data members GOT_,
11850 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11851 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11852 and Target_arm::rel_dyn_section.
11853 Declare new_enum Target_arm::Got_type.
11854 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11856 Update commments for member do_dynsym_value.
11857 (Target_arm::got_size, Target_arm::plt_section,
11858 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11859 new methods inside class defintion.
11860 (Target_arm::got_section): Define new method.
11861 (Target_arm::rel_dyn_section): Same.
11862 (Output_data_plt_arm): New template class.
11863 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11864 (Output_data_plt_arm:do_adjust_output_section): Define new method.
11865 (Output_data_plt_arm::add_entry): Same.
11866 (Output_data_plt_arm::first_plt_entry): Define new
11867 static data member for PLT instruction template.
11868 (Output_data_plt_arm::plt_entry): Same.
11869 (Output_data_plt_arm::do_write): Define new method.
11870 (Target_arm::make_plt_entry): Same.
11871 (Target_arm::do_finalize_sections): Same.
11872 (Target_arm::do_dynsym_value): Same.
11874 2009-05-28 Doug Kwan <dougkwan@google.com>
11876 * Makefile.am (TARGETSOURCES): Add arm.cc.
11877 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11878 * Makefile.in: Regenerate.
11879 * arm.cc: New file.
11880 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11882 2009-05-26 Doug Kwan <dougkwan@google.com>
11884 * options.cc (General_options::parse_exclude_libs). Fix a comment.
11885 (General_options::check_excluded_libs): Strip off directories in
11886 archive name before matching like GNU ld does.
11887 * testsuite/Makefile.am (MOSTLYCLEANFILES,
11888 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11889 (exclude_libs_test_LDFLAGS): Add linker option
11890 -Wl,--exclude-libs,libexclude_libs_test_3
11891 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11892 an explicit archive without using -l.
11893 (alt/libexclude_libs_test_3.a): New make rule.
11894 * testsuite/Makefile.in: Regenerate.
11895 * testsuite/exclude_libs_test.c : Declare lib3_default().
11897 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11898 * exclude_libs_test_3.c: New file.
11900 2009-05-26 Nick Clifton <nickc@redhat.com>
11902 * po/id.po: New Indonesian translation.
11903 * po/gold.pot: Updated template file.
11905 2009-05-22 Sriraman Tallam <tmsriram@google.com>
11907 * testsuite/Makefile.am: Add -ffunction-sections to compile
11908 gc_comdat_test files. Add -Wl,--gc-sections to build
11910 * testsuite/Makefile.in: Regenerate.
11911 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11913 2009-05-21 Sriraman Tallam <tmsriram@google.com>
11915 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11916 kept comdat section was garbage collected.
11917 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11918 * testsuite/Makefile.in: Regenerate.
11919 * testsuite/gc_comdat_test.sh: New file.
11920 * testsuite/gc_comdat_test_1.cc: New file.
11921 * testsuite/gc_comdat_test_2.cc: New file.
11923 2009-05-19 Doug Kwan <dougkwan@google.com>
11925 * archive.cc (Archive::Archive): Move constructor from archive.h
11926 to here. Initialize no_export_.
11927 (Archive::get_elf_object_for_member): Set no_export flag of object.
11928 * archive.h (Archive::Archive): Move constructor body to
11930 (Archive::no_export): New method.
11931 (Archive::no_export_): New field.
11932 * object.h (Object::Object): Initialize no_export_ to false.
11933 (Object::no_export, Object::set_no_export): New methods.
11934 (Object::no_export_): New field.
11935 * options.cc (General_options::parse_exclude_libs): New method.
11936 (General_options::check_excluded_libs) Same.
11937 * options.h (exclude_libs): New option.
11938 (General_options::check_excluded_libs): New method declaration.
11939 (General_options::excluded_libs_): New field.
11940 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11941 default or protected visibility if an object has no-export flag set.
11942 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11943 (check_SCRIPTS): Add exclude_libs_test.sh.
11944 (check_DATA): Add exclude_libs_test.syms.
11945 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11946 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11947 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11948 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11949 (exclude_libs_test.syms, libexclude_libs_test_1.a,
11950 libexclude_libs_test_2.a): New rules.
11951 * testsuite/Makefile.in: Regenerate.
11952 * testsuite/exclude_libs_test.c: New file.
11953 * testsuite/exclude_libs_test.sh: Ditto.
11954 * testsuite/exclude_libs_test_1.c: Ditto.
11955 * testsuite/exclude_libs_test_2.c: Ditto.
11957 2009-05-15 Ian Lance Taylor <iant@google.com>
11959 * configure.ac: Check for declarations for cases where libiberty.h
11960 checks HAVE_DECL_xxx.
11961 * configure, config.in: Rebuild.
11963 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
11965 * gold.h (Incremental_argument_list): Remove (invalid) forward
11967 * incremental.cc (Incremental_inputs::report_achive): New method.
11968 (Incremental_inputs::report_object): New method.
11969 (Incremental_inputs::report_script): New method.
11970 (Incremental_inputs::finalize_inputs): New method.
11971 (Incremental_inputs::finalize): Call finalize_inputs().
11972 (Incremental_inputs::sized_create_incremental_inputs_section_data):
11973 Create inputs entries.
11974 * incremental.h (Incremental_input_type): New enum.
11975 (Incremental_inputs::Incremental_input): Initialize new fields.
11976 (Incremental_inputs::report_inputs): New method.
11977 (Incremental_inputs::report_achive): New method.
11978 (Incremental_inputs::report_object): New method.
11979 (Incremental_inputs::report_script): New method.
11980 (Incremental_inputs::finalize_inputs): New method.
11981 (Incremental_inputs::Input_info): New struct.
11982 (Incremental_inputs::Input_info_map): New typedef.
11983 (Incremental_inputs::lock_): New field.
11984 (Incremental_inputs::Inputs_): New field.
11985 (Incremental_inputs::Inputs_map): New field.
11986 * main.cc (main): Call Incremental_input::report_inputs.
11987 * options.h (Input_argument_list): Typedef moved from
11989 (Input_file_group::Files): Remove, use ::Input_argument_list.
11990 (Input_file_group::Input_argument_list): Remove, use
11991 ::Input_argument_list.
11992 * plugin.cc (Plugin_manager::add_input_file): Add error in
11994 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11996 * script.cc (read_input_script): Call
11997 Incremental_input::report_script.
11998 * script.h (Script_info): New class.
12000 2009-04-27 Ian Lance Taylor <iant@google.com>
12002 * x86_64.cc (do_adjust_output_section): Set entsize to
12005 2009-04-23 Elliott Hughes <enh@google.com>
12007 * output.cc (Output_file::close): After short writes, continue
12008 writing from the correct offset in the buffer being written.
12010 2009-04-23 Chris Demetriou <cgd@google.com>
12012 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12013 * configure: Regenerate.
12014 * config.in: Regenerate.
12015 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12016 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12018 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
12020 * incremental.cc (Incremental_inputs_header_data): Renamed from
12021 Incremental_input_header_data.
12022 (Incremental_inputs_header_data::data_size): New field.
12023 (Incremental_inputs_header_data::put_input_file_count): Renamed
12024 from input_file_count.
12025 (Incremental_inputs_header_data::put_command_line_offset): Renamed
12026 from command_line_offset.
12027 (Incremental_inputs_header_data::put_reserved): Renamed from
12029 (Incremental_inputs_entry_data): Renamed from
12030 Incremental_input_entry_data.
12031 (Incremental_inputs_entry_data::data_size): New field.
12032 (Incremental_inputs::report_command_line): New method.
12033 (Incremental_inputs::finalize): New method.
12034 (Incremental_inputs::create_incremental_inputs_data): New method.
12035 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12036 * incremental.h: New file.
12037 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12038 (Layout::finalize): Create incremental inputs section in
12039 incremental builds.
12040 (Layout::create_incremental_info_sections): New method.
12041 * layout.h (Layout::incremental_inputs): New method.
12042 (Layout::create_incremental_info_sections): New method.
12043 (Layout::incremental_inputs_): New field.
12044 * main.cc (main): Notify Incremental_input of the command line.
12046 2009-04-01 Ian Lance Taylor <iant@google.com>
12047 Mikolaj Zalewski <mikolajz@google.com>
12049 * gold.h (reserve_unordered_map): Define, three versions, one for
12050 each version of Unordered_map.
12051 * layout.cc (Layout::Layout): Remove options parameter. Add
12052 number_of_input_files parameter. Don't initialize options_.
12053 Initialize number_of_input_files_ and resized_signatures_. Move
12054 sections_are_attached_.
12055 (Layout::layout_group): Reserve space for group_signatures_.
12056 (Layout::find_or_add_kept_section): Change name parameter to be a
12057 reference. Resize signatures_ map when it gets large enough.
12058 (Layout::layout_eh_frame): Use parameters->options() instead of
12060 (Layout::make_output_section): Likewise.
12061 (Layout::attach_allocated_section_to_segment): Likewise.
12062 (Layout::finalize, Layout::create_executable_stack): Likewise.
12063 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12064 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12065 * layout.h (class Layout): Update declarations. Remove options_
12066 field. Add number_of_input_files_ and resized_signatures_
12067 fields. Move sections_are_attached_ field.
12068 * main.cc (main): Pass number of input files to Layout
12069 constructor. Don't pass options.
12071 2009-03-30 Ian Lance Taylor <iant@google.com>
12073 * ffsll.c (ffsll): Correct implementation.
12075 2009-03-27 Ian Lance Taylor <iant@google.com>
12077 * ffsll.c: New file.
12078 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12079 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12080 * ftruncate.c (ftruncate): Declare before definition.
12081 * mremap.c (mremap): Likewise.
12082 * pread.c (pread): Likewise.
12083 * configure, Makefile.in, config.in: Rebuild.
12085 * mremap.c: New file.
12086 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12087 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12088 (mremap): Declare if HAVE_MREMAP is not defined.
12089 * configure, Makefile.in, config.in: Rebuild.
12091 2009-03-27 Cary Coutant <ccoutant@google.com>
12093 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12094 position independent.
12095 * sparc.cc (Target_sparc::check_non_pic): Likewise.
12096 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12098 2009-03-24 Cary Coutant <ccoutant@google.com>
12100 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12102 (needs_dynamic_reloc): Likewise.
12104 2009-03-24 Ian Lance Taylor <iant@google.com>
12106 * yyscript.y (file_cmd): Recognize EXTERN.
12107 (extern_name_list, extern_name_list_body): New nonterminals.
12108 * script.cc (script_add_extern): Define.
12109 * script-c.h (script_add_extern): Declare.
12111 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
12113 * object.cc (is_elf_object): Define.
12114 * object.h (is_elf_object): Declare.
12115 * archive.cc (Archive::get_elf_object_for_member): Call
12117 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12119 2009-03-24 Elliott Hughes <enh@google.com>
12121 * output.cc (Output_file::map_anonymous): Define.
12122 (Output_file::map): Use map_anonymous. If the regular mmap fails,
12123 try an anonymous one. Report the size if the mmap fails.
12124 * output.h (class Output_file): Declare map_anonymous.
12126 2009-03-24 Ian Lance Taylor <iant@google.com>
12128 * target-select.cc (instantiate_target): Don't acquire the lock if
12129 the instantiated_target_ field has already been set.
12131 2009-03-23 Ian Lance Taylor <iant@google.com>
12133 * gold-threads.h (class Initialize_lock): Define.
12134 * gold-threads.cc (class Initialize_lock_once): Define.
12135 (initialize_lock_control): New static variable.
12136 (initialize_lock_pointer): New static variable.
12137 (initialize_lock_once): New static function.
12138 (Initialize_lock::Initialize_lock): Define.
12139 (Initialize_lock::initialize): Define.
12140 * target-select.h: Include "gold-threads.h".
12141 (class Target_selector): Add lock_ and initialize_lock_ fields.
12142 Don't define instantiate_target, just declare it.
12143 * target-select.cc (Target_selector::Target_selector): Initialize
12145 (Target_selector::instantiate_target): Define.
12146 * descriptors.h: Include "gold-threads.h".
12147 (class Descriptors): Add initialize_lock_ field.
12148 * descriptors.cc (Descriptors::Descriptors): Initialize new
12150 (Descriptors::open): Use initialize_lock_ field
12151 * errors.h (class Errors): Add initialize_lock_ field.
12152 * errors.cc (Errors::Errors): Initialize new field.
12153 (Errors::initialize_lock): Use initialize_lock_ field.
12154 * powerpc.cc (class Target_selector_powerpc): Remove
12155 instantiated_target_ field. In do_recognize call
12156 instantiate_target rather than do_instantiate_target. In
12157 do_instantiate_target just allocate a new target.
12158 * sparc.cc (class Target_selector_sparc): Likewise.
12160 * freebsd.h: New file.
12161 * i386.cc: Include "freebsd.h".
12162 (Target_i386): Derive from Target_freebsd rather than
12164 (Target_selector_i386): Derive from Target_selector_freebsd rather
12165 than Target_selector.
12166 * x86_64.cc: Include "freebsd.h".
12167 (Target_x86_64): Derive from Target_freebsd rather than
12169 (Target_selector_x86_64): Derive from Target_selector_freebsd
12170 rather than Target_selector.
12171 * target.h (class Target): Add adjust_elf_header and
12172 do_adjust_elf_header.
12173 * output.cc (Output_file_header:: do_sized_write): Call target
12174 adjust_elf_header routine.
12175 * configure.tgt: Set targ_osabi.
12176 * configure.ac: Define GOLD_DEFAULT_OSABI.
12177 * parameters.cc (Parameters::default_target): Pass
12178 GOLD_DEFAULT_OSABI to select_target.
12179 * target-select.h (class Target_selector): Make instantiate_target
12180 protected rather than private.
12181 * Makefile.am (HFILES): Add freebsd.h.
12182 * configure, Makefile.in, config.in: Rebuild.
12184 * merge.cc (do_add_input_section): Correct pend value. Change
12185 message about last entry not being null terminated from error to
12188 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
12190 * incremental.cc: New file.
12191 * Makefile.am (CCFILES): Add incremental.cc.
12192 * Makefile.in: Rebuild.
12194 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
12196 * layout.cc (Layout::output_section_name): Preserve names
12197 of '.note.' sections.
12199 2009-03-19 Ian Lance Taylor <iant@google.com>
12201 * descriptors.cc (Descriptors::open): Check that the options are
12202 valid before using them.
12204 2009-03-18 Ian Lance Taylor <iant@google.com>
12206 * script-sections.h: Include <list>.
12207 (class Script_sections): Change Sections_elements from std::vector
12208 to std::list. Typedef public Elements_iterator. Add
12209 orphan_section_placement_, data_segment_align_start_, and
12210 saw_data_segment_align_ fields. Remove data_segment_align_index_
12212 * script-sections.cc (class Orphan_section_placement): New class.
12213 (class Sections_element): Add virtual functions is_relro and
12214 orphan_section_init. Remove virtual function place_orphan_here.
12215 (class Output_section_definition): Add is_relro and
12216 orphan_section_init. Remove place_orphan_here.
12217 (class Orphan_output_section): Likewise.
12218 (Script_sections::Script_sections): Update for field changes.
12219 (Script_sections::data_segment_align): Set saw_data_segment_align_
12220 and data_segment_align_start_, not data_segment_align_index.
12221 (Script_sections::data_segment_relro_end): Check
12222 saw_data_segment_align_. Use data_segment_align_start_ rather
12223 than data_segment_align_index_.
12224 (Script_sections::place_orphan): Rewrite to use
12225 Orphan_section_placement.
12227 2009-03-17 Ian Lance Taylor <iant@google.com>
12229 * archive.cc (Archive::add_symbols): Check for a version attached
12230 to the symbol name in the archive map.
12231 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12232 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12233 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12234 (ver_test_11.a): New target.
12235 * testsuite/Makefile.in: Rebuild.
12237 * configure.ac: Check for chsize and posix_fallocate. Replace
12239 * ftruncate.c: New file, from gnulib.
12240 * output.cc (posix_fallocate): Define dummy version if not
12241 HAVE_POSIX_FALLOCATE.
12242 (Output_file::map): Call posix_fallocate rather than lseek and
12244 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12245 * configure, Makefile.in, config.in: Rebuild.
12247 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
12249 * layout.h (Layout::create_note): Add section_name parameter.
12250 * layout.cc (Layout::create_note): Likewise.
12251 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12253 2009-03-17 Ian Lance Taylor <iant@google.com>
12255 * descriptors.cc: Include "options.h".
12256 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12257 (Descriptors::open): Always use O_CLOEXEC when opening a new
12258 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
12259 then set FD_CLOEXEC.
12261 * sparc.cc (class Target_sparc): Add has_got_section.
12262 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12263 make sure we have a GOT section.
12265 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12266 (Target_sparc::Scan::local): Likewise.
12267 (Target_sparc::Scan::global): Likewise.
12268 (Target_sparc::Relocate::relocate): Likewise.
12269 (Target_sparc::Relocate::relocate_tls): Likewise.
12271 * symtab.cc (Symbol_table::define_default_version): New function,
12272 broken out of add_from_object.
12273 (Symbol_table::add_from_object): Call define_default_version.
12274 (Symbol_table::define_special_symbol): Add resolve_oldsym
12275 parameter. Change all callers. If the version for a symbol comes
12276 from a version script, resolve it with the symbol with the same
12277 name with no version. Also add the symbol without a version if
12279 (do_define_in_output_data): If resolving with oldsym, don't delete
12281 (do_define_in_output_segment): Likewise.
12282 (do_define_as_constant): Likewise.
12283 * symtab.h (class Symbol_table): Update declarations.
12285 2009-03-13 Ian Lance Taylor <iant@google.com>
12287 * readsyms.cc (Read_symbols::incompatible_warning): New function.
12288 (Read_symbols::requeue): New function.
12289 (Read_symbols::do_read_symbols): If make_elf_object fails because
12290 the target type is not configured, and the file was searched for,
12291 issue a warning and retry with the next directory.
12292 (Add_symbols::run): If the file has an incompatible format, and
12293 it was searched for, requeue the Read_symbols task. On error,
12294 release the object.
12295 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
12296 dirindex parameter to constructor. Change all callers. Declare
12297 incompatible_warning and requeue.
12298 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12299 input_argument_ and input_group_ fields. Add them to
12300 constructor. Change all callers.
12301 (class Read_script): Add dirindex_ field. Add it to constructor.
12302 Change all callers.
12303 * archive.cc (Archive::setup): Remove input_objects parameter.
12304 Change all callers.
12305 (Archive::get_file_and_offset): Likewise.
12306 (Archive::read_all_symbols): Likewise.
12307 (Archive::read_symbols): Likewise.
12308 (Archive::get_elf_object_for_member): Remove input_objects
12309 parameter. Add punconfigured parameter. Change all callers.
12310 (Archive::add_symbols): Change return type to bool. Check return
12311 value of include_member.
12312 (Archive::include_all_members): Likewise.
12313 (Archive::include_member): Change return type to bool. Return
12314 false if first included object has incompatible target. Set
12315 included_member_ field.
12316 (Add_archive_symbols::run): If add_symbols returns false, requeue
12318 * archive.h (class Archive): Add included_member_ field.
12319 Initialize it in constructor. Add input_file and searched_for
12320 methods. Update declarations.
12321 (class Add_archive_symbols): Add dirpath_, dirindex_, and
12322 input_argument_ fields. Add them to constructor. Change all
12324 * script.cc: Include "target-select.h".
12325 (class Parser_closure): Add skip_on_incompatible_target_ and
12326 found_incompatible_target_ fields. Add
12327 skip_on_incompatible_target parameter to constructor. Change all
12328 callers. Add methods skip_on_incompatible_target,
12329 clear_skip_on_incompatible_target, found_incompatible_target, and
12330 set_found_incompatible_target.
12331 (read_input_script): Add dirindex parameter. Change all callers.
12332 If parser finds an incompatible target, requeue Read_symbols
12334 (script_set_symbol): Clear skip_on_incompatible_target in
12336 (script_add_assertion, script_parse_option): Likewise.
12337 (script_start_sections, script_add_phdr): Likewise.
12338 (script_check_output_format): New function.
12339 * script.h (read_input_script): Update declaration.
12340 * script-c.h (script_check_output_format): Declare.
12341 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12342 (ignore_cmd): Remove OUTPUT_FORMAT.
12343 * fileread.cc (Input_file::Input_file): Add explicit this.
12344 (Input_file::will_search_for): New function.
12345 (Input_file::open): Add pindex parameter. Change all callers.
12346 * fileread.h (class Input_file): Add input_file_argument method.
12347 Declare will_search_for. Update declarations.
12348 * object.cc (make_elf_object): Add punconfigured parameter.
12349 Change all callers.
12350 * object.h (class Object): Make input_file public. Add
12351 searched_for method.
12352 (make_elf_object): Update declaration.
12353 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
12355 * dirsearch.h (class Dirsearch): Update declaration.
12356 * options.h (class General_options): Add --warn-search-mismatch.
12357 * parameters.cc (Parameters::is_compatible_target): New function.
12358 * parameters.h (class Parameters): Declare is_compatible_target.
12359 * workqueue.cc (Workqueue::add_blocker): New function.
12360 * workqueue.h (class Workqueue): Declare add_blocker.
12362 * fileread.cc (Input_file::open): Remove options parameter.
12363 Change all callers.
12364 (Input_file::open_binary): Likewise.
12365 * script.cc (read_input_script): Likewise.
12366 * readsyms.h (class Read_symbols): Remove options_ field. Remove
12367 options parameter from constructor. Change all callers.
12368 (class Read_script): Likewise.
12369 * fileread.h (class Input_file): Update declarations.
12370 * script.h (read_input_script): Update declaration.
12372 2009-03-10 Nick Clifton <nickc@redhat.com>
12374 * po/es.po: New Spanish translation.
12376 2009-03-06 Cary Coutant <ccoutant@google.com>
12378 * options.cc (parse_short_option): Keep dash_z from registering itself.
12380 2009-03-03 Ian Lance Taylor <iant@google.com>
12383 * target-reloc.h (relocate_section): Pass output_section to
12385 * i386.cc (Target_i386::should_apply_static_reloc): Add
12386 output_section parameter. Change all callers.
12387 (Target_i386::Relocate::relocate): Add output_section parameter.
12388 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12389 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12390 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12391 * testsuite/two_file_shared.sh: New script.
12392 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12393 (check_DATA): Add two_file_shared.dbg.
12394 (two_file_shared.dbg): New target.
12395 * testsuite/Makefile.in: Rebuild.
12397 2009-03-01 Ian Lance Taylor <iant@google.com>
12399 * configure.ac: Check for byteswap.h.
12400 * configure: Rebuild.
12401 * config.in: Rebuild.
12403 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
12405 * layout.cc (Layout::find_or_add_kept_section): New function.
12406 (Layout::add_comdat): Removed.
12407 * layout.h (struct Kept_section): Move out of class Layout.
12408 Remove trailing underscores from field names. Add group_sections
12409 field. Rename group_ field to is_group. Change all uses.
12410 (class Layout): Declare find_or_add_kept_section, not add_comdat.
12411 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12412 comdat_groups_ field.
12413 (Sized_relobj::include_section_group): Use
12414 find_or_add_kept_section and Kept_section::group_sections.
12415 (Sized_relobj::include_linkonce_section): Likewise.
12416 * object.cc (class Sized_relobj): Don't define Comdat_group or
12417 Comdat_group_table. Remove find_comdat_group and
12418 add_comdat_group. Remove comdat_groups_ field.
12419 * plugin.cc (include_comdat_group): Use
12420 Layout::find_or_add_kept_section.
12422 2009-02-28 Ian Lance Taylor <iant@google.com>
12424 * README: --gc-sections and map files are now supported. Document
12425 some build requirements.
12428 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12429 relocatable link set the value of the section symbol to zero.
12430 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12431 relocatable link don't include the section address in the local
12434 2009-02-27 Ian Lance Taylor <iant@google.com>
12437 * options.h (class Search_directory): Add is_system_directory.
12438 (class General_options): Declare is_in_system_directory.
12439 * options.cc (get_relative_sysroot): Make static.
12440 (get_default_sysroot): Make static.
12441 (General_optoins::is_in_system_directory): New function.
12442 * fileread.cc (Input_file::is_in_system_directory): New function.
12443 * fileread.h (class Input_file): Declare is_in_system_directory.
12444 * object.h (class Object): Add is_in_system_directory.
12445 (class Input_objects): Remove system_library_directory_ field.
12446 * object.cc (Input_objects::add_object): Don't set
12447 system_library_directory_.
12448 (input_objects::found_in_system_library_directory): Remove.
12449 * symtab.cc (Symbol_table::write_globals): Remove input_objects
12450 parameter. Change all callers.
12451 (Symbol_table::sized_write_globals): Likewise.
12452 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12453 Call Object::is_in_system_directory.
12454 * symtab.h (class Symbol_table): Update declarations.
12457 * descriptors.h (Open_descriptor): Add is_on_stack field.
12458 * descriptors.cc (Descriptors::open): If the descriptor is on the
12459 top of the stack, remove it. Initialize is_on_stack field.
12460 (Descriptors::release): Only add pod to stack if it is not on the
12462 (Descriptors::close_some_descriptor): Clear stack_next and
12463 is_on_stack fields.
12466 * output.cc (Output_section::find_starting_output_address): Rename
12467 from starting_output_address; add PADDR parameter; change return
12469 * output.h (class Output_section): Declare
12470 find_starting_output_address instead of starting_output_address.
12471 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12472 section symbol for which we can't find a merge section.
12475 * symtab.cc (Symbol_table::add_from_object): If the visibility is
12476 hidden or internal, force the symbol to be local.
12477 * resolve.cc (Symbol::override_visibility): Define.
12478 (Symbol::override_base): Use override_visibility.
12479 (Symbol_table::resolve): Likewise.
12480 (Symbol::override_base_with_special): Likewise.
12481 (Symbol_table::override_with_special): If the visibility is hidden
12482 or internal, force the symbol to be local.
12483 * symtab.h (class Symbol): Add set_visibility and
12484 override_visibility.
12485 * testsuite/ver_test_1.sh: New file.
12486 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12487 (check_DATA): Add ver_test_1.syms.
12488 (ver_test_1.syms): New target.
12489 * testsuite/Makefile.in: Rebuild.
12491 2009-02-25 Cary Coutant <ccoutant@google.com>
12493 * layout.cc (Layout::choose_output_section): Don't rename sections
12494 when using a linker script that has a SECTIONS clause.
12495 * Makefile.in: Regenerate.
12497 * testsuite/Makefile.am (script_test_5.sh): New test case.
12498 * testsuite/Makefile.in: Regenerate.
12499 * testsuite/script_test_5.cc: New file.
12500 * testsuite/script_test_5.sh: New file.
12501 * testsuite/script_test_5.t: New file.
12503 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
12505 * archive.cc (Archive::include_member): Update calls to add_symbols.
12506 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12507 the Layout argument.
12508 * dynobj.h (do_add_symbols): Add the Layout argument.
12509 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12511 * object.h (Object::add_symbols): Add the Layout argument.
12512 (Object::do_add_symbols): Add the Layout argument.
12513 (Sized_relobj::do_add_symbols): Add the Layout argument.
12514 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12515 Unify the two versions.
12516 (Add_plugin_symbols): Remove.
12517 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12518 (Sized_pluginobj::do_add_symbols): Unify the two versions.
12519 (Add_plugin_symbols): Remove.
12520 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12521 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12522 (Add_symbols::run): Make it work with Pulginobj.
12524 2009-02-06 Ian Lance Taylor <iant@google.com>
12526 * object.cc (Sized_relobj::do_layout): Make info message start
12527 with lower case letter.
12529 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
12531 * binary.cc: Fix file comment.
12533 * options.h (enum Incremental_disposition): Define.
12534 (class General_options): Add new options: --incremental,
12535 --incremental_changed, --incremental_unchanged,
12536 --incremental_unknown. Add incremental_disposition_ and
12537 implicit_incremental_ fields.
12538 (General_options::incremental_disposition): New function.
12539 (class Position_dependent_options): Add incremental_disposition
12541 (Position_dependent_options::copy_from_options): Set incremental
12543 * options.cc (General_options::parse_incremental_changed): New
12545 (General_options::parse_incremental_unchanged): New function.
12546 (General_options::parse_incremental_unknown): New function.
12547 (General_options::General_options): Initialize new fields
12548 incremental_disposition_ and implicit_incremental_.
12549 (General_options::finalize): Check for uasge of --incremental-*
12550 without --incremental.
12552 2009-02-06 Chris Demetriou <cgd@google.com>
12554 * gold.h (gold_undefined_symbol): Change to take only a Symbol
12555 pointer and to report location as the file name associated with
12557 (gold_undefined_symbol_at_location): New function to replace the
12558 old gold_undefined_symbol functionality.
12559 * target-reloc.h (relocate_section): Update to use
12560 gold_undefined_symbol_at_location.
12561 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12562 Call gold_undefined_symbol function rather than gold_error.
12563 * errors.h (Errors::undefined_symbol): Take location as a
12564 string, rather than calculating it from a relocation.
12565 * errors.cc (Errors::fatal): Print "fatal error:" before the
12567 (Errors::error, Errors::error_at_location): Print "error: "
12568 before the formatted message.
12569 (Errors::undefined_symbol): Take location as a string, rather
12570 than calculating it from a relocation.
12571 (gold_undefined_symbol_at_location): New function akin to
12572 old gold_undefined_symbol, calculates location from relocation.
12573 (gold_undefined_symbol): Change to take only a Symbol pointer
12574 and to report location as the file name associated with the symbol.
12575 * testsuite/debug_msg.sh: Update for changed error messages.
12576 * testsuite/undef_symbol.sh: Likewise.
12578 2009-02-04 Duncan Sands <baldrick@free.fr>
12581 * reduced_debug_output.h
12582 (Output_reduced_debug_abbrev_section::failed): Use format for
12584 (Output_reduced_debug_info_section::faild): Likewise.
12586 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
12588 * script.cc (Lazy_demangler): New class.
12589 (Version_script_info::get_symbol_version_helper): Demangle a
12592 2009-01-29 Cary Coutant <ccoutant@google.com>
12594 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12596 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12598 2009-01-28 Ian Lance Taylor <iant@google.com>
12600 * version.cc (version_string): Bump to 1.9.
12602 * gold.h: Include <cstring> and <stdint.h>.
12603 * version.cc: Include <cstdio>.
12604 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12606 * reduced_debug_output.cc (insert_into_vector): Rename from
12607 Insert_into_vector; change all callers. Use Swap_unaligned to
12608 avoid aliasing issue; remove union since it is unnecessary.
12610 2009-01-27 Sriraman Tallam <tmsriram@google.com>
12612 * Makefile.am (CCFILES): Add gc.cc.
12613 (HFILES): Add gc.h.
12614 * Makefile.in: Regenerate.
12615 * gold.cc (Gc_runner): New class.
12616 (queue_initial_tasks): Call garbage collection related tasks
12617 when corresponding options are invoked.
12618 (queue_middle_gc_tasks): New function.
12619 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12620 processed early before laying out sections during garbage collection.
12621 * gold.h (queue_middle_gc_tasks): New function.
12622 (is_prefix_of): Move from "layout.cc".
12623 * i386.cc (Target_i386::gc_process_relocs): New function.
12624 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12625 * main.cc (main): Create object of class "Garbage_collection".
12626 * object.cc (Relobj::copy_symbols_data): New function.
12627 (Relobj::is_section_name_included): New function.
12628 (Sized_relobj::do_layout): Allow this function to be called twice
12629 during garbage collection and defer layout of section during the
12631 * object.h (Relobj::get_symbols_data): New function.
12632 (Relobj::is_section_name_included): New function.
12633 (Relobj::copy_symbols_data): New function.
12634 (Relobj::set_symbols_data): New function.
12635 (Relobj::get_relocs_data): New function.
12636 (Relobj::set_relocs_data): New function.
12637 (Relobj::is_output_section_offset_invalid): New pure virtual function.
12638 (Relobj::gc_process_relocs): New function.
12639 (Relobj::do_gc_process_relocs): New pure virtual function.
12640 (Relobj::sd_): New data member.
12641 (Sized_relobj::is_output_section_offset_invalid): New function.
12642 (Sized_relobj::do_gc_process_relocs): New function.
12643 * options.h (General_options::gc_sections): Modify to not be a no-op.
12644 (General_options::print_gc_sections): New option.
12645 * plugin.cc (Plugin_finish::run): Remove function call to
12646 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
12647 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12648 * reloc.cc (Read_relocs::run): Add task to process relocs and
12649 determine unreferenced sections when doing garbage collection.
12650 (Gc_process_relocs): New class.
12651 (Sized_relobj::do_gc_process_relocs): New function.
12652 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12653 sections that are garbage collected.
12654 * reloc.h (Gc_process_relocs): New class.
12655 * sparc.cc (Target_sparc::gc_process_relocs): New function.
12656 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12657 symbols whose corresponding sections are garbage collected.
12658 (Symbol_table::Symbol_table): Add new parameter for the garbage
12660 (Symbol_table::gc_mark_undef_symbols): New function.
12661 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12662 (Symbol_table::gc_mark_dyn_syms): New function.
12663 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12665 (Symbol_table::add_from_object): Likewise.
12666 (Symbol_table::add_from_relobj): When building shared objects, do not
12667 treat externally visible symbols as garbage.
12668 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12669 table information for static and relocatable links.
12670 * symtab.h (Symbol_table::set_gc): New function.
12671 (Symbol_table::gc): New function.
12672 (Symbol_table::gc_mark_undef_symbols): New function.
12673 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12674 (Symbol_table::gc_mark_dyn_syms): New function.
12675 (Symbol_table::gc_): New data member.
12676 * target.h (Sized_target::gc_process_relocs): New pure virtual
12678 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12679 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12681 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
12683 * options.h (General_options::gc_sections): Define as a no-op for now.
12684 (General_options::no_keep_memory): Ditto.
12685 (General_options::Bshareable): Define.
12686 * options.cc (General_options::finalize): Honor -Bshareable.
12688 2009-01-20 Andreas Schwab <schwab@suse.de>
12690 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12691 read the value in the contents, since we don't use it. Use the
12692 template endianness when writing.
12693 (Relocate::relocate): Use it for R_PPC_REL16_HA.
12695 2009-01-19 Andreas Schwab <schwab@suse.de>
12697 * configure.tgt (powerpc64-*): Fix targ_obj.
12699 2009-01-15 Ian Lance Taylor <iant@google.com>
12701 * object.cc (Sized_relobj::write_local_symbols): Don't write out
12702 local symbols when stripping all symbols.
12704 2009-01-14 Cary Coutant <ccoutant@google.com>
12706 * output.cc (Output_reloc): Add explicit instantiations.
12708 2009-01-14 Cary Coutant <ccoutant@google.com>
12710 * archive.cc (Archive::get_elf_object_for_member): Remove call
12711 to File_read::claim_for_plugin.
12712 * descriptors.cc (Descriptors::open): Remove reference to
12714 (Descriptors::claim_for_plugin): Remove.
12715 * descriptors.h (Descriptors::claim_for_plugin): Remove.
12716 (Descriptors::is_claimed): Remove.
12717 (claim_descriptor_for_plugin): Remove.
12718 * fileread.cc (File_read::claim_for_plugin): Remove.
12719 * fileread.h (File_read::claim_for_plugin): Remove.
12720 (File_read::descriptor): Reopen descriptor if necessary.
12721 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
12722 (Plugin_manager::all_symbols_read): Add task parameter. Change
12724 (Plugin_manager::get_input_file): New function.
12725 (Plugin_manager::release_input_file): New function.
12726 (Pluginobj::Pluginobj): Add filesize parameter and initialize
12727 corresponding data member.
12728 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12729 and pass to base constructor. Change all callers.
12730 (get_input_file, release_input_file): New functions.
12731 (make_sized_plugin_object): Add filesize parameter. Change all callers.
12732 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12733 (Plugin_manager::all_symbols_read): Add task parameter.
12734 (Plugin_manager::get_input_file): New function.
12735 (Plugin_manager::release_input_file): New function.
12736 (Plugin_manager::task_): New data member.
12737 (Pluginobj::Pluginobj): Add filesize parameter.
12738 (Pluginobj::filename): New function.
12739 (Pluginobj::descriptor): New function.
12740 (Pluginobj::filesize): New function.
12741 (Pluginobj::filesize_): New data member.
12742 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12743 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12744 File_read::claim_for_plugin; use Object::unlock to unlock the file.
12746 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12747 with archive libraries.
12748 * testsuite/Makefile.in: Regenerate.
12749 * testsuite/plugin_test.c (struct sym_info): New type.
12750 (get_input_file, release_input_file): New static variables.
12751 (onload): Capture new transfer vector entries.
12752 (claim_file_hook): Stop reading at end of file according to filesize.
12753 Factor out parsing of readelf output into separate function.
12754 (all_symbols_read_hook): Exercise get_input_file and release_input_file
12755 APIs and get the source file name from the symbol table. Convert
12756 source file name to corresponding object file name. Print info
12757 message when adding new input files.
12758 (parse_readelf_line): New function.
12759 * testsuite/plugin_test_1.sh: Add checks for new info messages.
12760 * testsuite/plugin_test_2.sh: Likewise.
12761 * testsuite/plugin_test_3.sh: Likewise.
12762 * testsuite/plugin_test_4.sh: New test case.
12764 2009-01-07 Ian Lance Taylor <iant@google.com>
12766 * version.cc (version_string): Bump to 1.8.
12768 2008-12-23 Cary Coutant <ccoutant@google.com>
12770 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12771 * plugin.cc (Plugin_manager::finish): Rename as
12772 layout_deferred_objects. Move cleanup to separate function.
12773 (Plugin_manager::cleanup): New function.
12774 (Plugin_finish::run): Call layout_deferred_objects and cleanup
12776 * plugin.h (Plugin_manager::finish): Rename as
12777 layout_deferred_objects.
12778 (Plugin_manager::cleanup): New function.
12779 (Plugin_manager::cleanup_done): New field.
12781 2008-12-23 Cary Coutant <ccoutant@google.com>
12783 * plugin.cc (is_visible_from_outside): New function.
12784 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12785 so we don't return "IR only" status for exported symbols or -r links.
12787 * testsuite/Makefile.am (plugin_test_3): New test case.
12788 * testsuite/Makefile.in: Regenerate.
12789 * testsuite/plugin_test_3.sh: New file.
12791 2008-12-22 Cary Coutant <ccoutant@google.com>
12793 * object.cc (Sized_relobj::layout_section): New function.
12794 (Sized_relobj::do_layout): Defer layout of input sections until after
12795 plugin has provided replacement files.
12796 (Sized_relobj::do_layout_deferred_sections): New function.
12797 * object.h (Relobj::set_section_offset): Remove virtual keyword.
12798 (Relobj::layout_deferred_sections): New function.
12799 (Relobj::do_layout_deferred_sections): New function.
12800 (Sized_relobj::do_layout_deferred_sections): New function.
12801 (Sized_relobj::layout_section): New function.
12802 (Sized_relobj::Deferred_layout): New structure.
12803 (Sized_relobj::deferred_layout_): New field.
12804 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12805 Change all callers. Layout deferred sections.
12806 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
12808 (Plugin_hook::run): Move code from do_plugin_hook inline.
12809 (Plugin_hook::do_plugin_hook): Remove.
12810 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12811 (Plugin_manager::finish): Renamed, was cleanup.
12812 (Plugin_manager::should_defer_layout): New function.
12813 (Plugin_manager::add_deferred_layout_object): New function.
12814 (Plugin_manager::Deferred_layout_list): New type.
12815 (Plugin_manager::deferred_layout_objects_): New field.
12816 (Plugin_hook::do_plugin_hook): Remove.
12818 2008-12-17 Ian Lance Taylor <iant@google.com>
12820 * options.h (class General_options): Add --no case for
12823 2008-12-16 Cary Coutant <ccoutant@google.com>
12825 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12827 (Plugin_manager::claim_file): Create plugin object even if
12828 plugin did not call the add_symbols callback.
12829 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12830 asking for more symbols than were added.
12831 * testsuite/Makefile.am (plugin_test_1): Add test case with
12833 (empty.syms): New target.
12834 * testsuite/Makefile.in: Regenerate.
12835 * testsuite/plugin_test.c (claim_file_hook): Add new debug
12836 message. Don't call add_symbols if no globals.
12837 (all_symbols_read_hook): Don't provide replacement for empty
12840 2008-12-12 Ian Lance Taylor <iant@google.com>
12842 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12843 r_type == 0 for a local symbol with r_sym == 0.
12844 (scan_relocatable_relocs): Pass r_sym to
12845 local_non_section_strategy.
12846 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12849 * configure.ac: Update test for TLS descriptors: they are
12850 supported as of glibc 2.9.
12851 * configure: Rebuild.
12853 2008-12-11 Ian Lance Taylor <iant@google.com>
12856 * target-reloc.h (Default_scan_relocatable_relocs): For each
12857 function, map r_type == 0 to RELOC_DISCARD.
12859 2008-12-10 Cary Coutant <ccoutant@google.com>
12861 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12862 object to override a kept COMDAT group from a plugin object.
12864 2008-12-09 Ian Lance Taylor <iant@google.com>
12867 * yyscript.y (file_cmd): Handle INPUT.
12869 * testsuite/initpri1.c: Change all declarations to be full
12870 prototypes by adding void, to avoid compiler warnings.
12872 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
12874 * options.cc (General_options::parse_plugin_opt): New.
12875 (General_options::add_plugin): The argument now is just the filename.
12876 (General_options::add_plugin_option): New.
12877 * options.h (plugin_opt): New.
12878 (add_plugin): Change argument name.
12879 (add_plugin_option): New.
12880 * plugin.cc (Plugin::load): Don't parse the plugin option.
12881 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12882 (Plugin::add_option): New.
12883 (Plugin::args_): Change type.
12884 (Plugin::filename_): New.
12885 (Plugin_manager::add_plugin_option): New.
12886 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12887 * testsuite/Makefile.in: Regenerate.
12889 2008-12-05 Cary Coutant <ccoutant@google.com>
12891 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12892 Handle --strip-lto-sections option.
12893 * options.h (strip_lto_sections): New option.
12895 2008-12-01 Cary Coutant <ccoutant@google.com>
12897 * plugin.cc (ld_plugin_message): Change format parameter to const.
12898 Fix mismatch between new[] and delete.
12900 2008-11-14 Cary Coutant <ccoutant@google.com>
12902 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12905 2008-11-05 Craig Silverstein <csilvers@google.com>
12907 * options.cc (General_options::parse_dynamic_list): New function.
12908 * options.h (General_options): New flags dynamic_list,
12909 dynamic_list_data, dynamic_list_cpp_new, and
12910 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
12911 (General_options::in_dynamic_list): New function.
12912 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12913 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12914 (Lex::can_continue_name): Likewise.
12916 (read_script_file): New parameter script_options.
12917 (read_dynamic_list): New function.
12918 (Script_options::define_dynamic_list): New function.
12919 (dynamic_list_keyword_parsecodes): New variable.
12920 (dynamic_list_keywords): New variable.
12921 * script.h (Script_options::define_dynamic_list): New function
12923 (read_dynamic_list): New function prototype.
12924 * symtab.cc (strprefix): New macro.
12925 (Symbol::should_add_dynsym_entry): Support dynamic_list,
12926 dynamic_list_data, dynamic_list_cpp_new, and
12927 dynamic_list_cpp_typeinfo.
12928 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12929 (dynamic_list_expr): New rule.
12930 (dynamic_list_nodes): Likewise.
12931 (dynamic_list_node): Likewise.
12932 * testsuite/Makefile.am (dynamic_list): New test.
12933 * testsuite/Makefile.in: Regenerated.
12934 * testsuite/dynamic_list.t: New file.
12935 * testsuite/dynamic_list.sh: New file.
12937 2008-11-05 Craig Silverstein <csilvers@google.com>
12939 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12940 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12941 (t11_last): Likewise.
12942 * testsuite/ver_test_6.c (main): Likewise.
12944 2008-10-07 Cary Coutant <ccoutant@google.com>
12946 * options.c (General_options::finalize): Add check for -static and
12948 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12951 2008-10-02 Cary Coutant <ccoutant@google.com>
12953 * plugin.cc (make_sized_plugin_object): Fix conditional
12954 compilation to work when not all targets are enabled.
12956 2008-09-29 Cary Coutant <ccoutant@google.com>
12958 * archive.cc (Archive::get_file_and_offset): Use filename instead
12959 of name to get library path.
12960 (Archive::include_member): Unlock external member of a thin archive.
12962 * testsuite/Makefile.am (TEST_AR): New variable.
12963 (thin_archive_test_1): New test.
12964 (thin_archive_test_2): New test.
12965 * testsuite/Makefile.in: Regenerate.
12966 * testsuite/thin_archive_main.cc: New file.
12967 * testsuite/thin_archive_test_1.cc: New file.
12968 * testsuite/thin_archive_test_2.cc: New file.
12969 * testsuite/thin_archive_test_3.cc: New file.
12970 * testsuite/thin_archive_test_4.cc: New file.
12972 2008-09-29 Cary Coutant <ccoutant@google.com>
12974 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12975 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12977 (Sized_relobj::do_finalize_local_symbols): Likewise.
12978 (Sized_relobj::map_to_kept_section): Likewise.
12979 * object.h (Sized_relobj::invalid_address): New constant.
12980 (Sized_relobj::do_output_section_offset): Check for invalid_address
12982 * output.cc (Output_reloc::local_section_offset): Use constant
12983 invalid_address instead of -1U.
12984 (Output_reloc::get_address): Likewise.
12985 (Output_section::output_address): Change -1U to -1ULL.
12986 * output.h (Output_reloc::invalid_address): New constant.
12987 * reloc.cc (Sized_relobj::write_sections): Use constant
12988 invalid_address instead of -1U.
12989 (Sized_relobj::relocate_sections): Likewise.
12990 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12991 values for merge sections.
12992 * target-reloc.h (relocate_for_relocatable): Use constant
12993 invalid_address instead of -1U.
12995 2008-09-19 Cary Coutant <ccoutant@google.com>
12997 Add plugin functionality for link-time optimization (LTO).
12998 * configure.ac (plugins): Add --enable-plugins option.
12999 * configure: Regenerate.
13000 * config.in: Regenerate.
13001 * Makefile.am (LIBDL): New variable.
13002 (CCFILES): Add plugin.cc.
13003 (HFILES): Add plugin.h.
13004 (ldadd_var): Add LIBDL.
13005 * Makefile.in: Regenerate.
13007 * archive.cc: Include "plugin.h".
13008 (Archive::setup): Don't preread archive symbols when using a plugin.
13009 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
13010 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13012 (Archive::include_member): Add symbols from plugin objects.
13013 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13014 * descriptors.cc (Descriptors::open): Check for file descriptors
13015 abandoned by plugins.
13016 (Descriptors::claim_for_plugin): New function.
13017 * descriptors.h (Descriptors::claim_for_plugin): New function.
13018 (Open_descriptor::is_claimed): New field.
13019 (claim_descriptor_for_plugin): New function.
13020 * fileread.cc (File_read::claim_for_plugin): New function.
13021 * fileread.h (File_read::claim_for_plugin): New function.
13022 (File_read::descriptor): New function.
13023 * gold.cc: Include "plugin.h".
13024 (queue_initial_tasks): Add task to call plugin hooks for generating
13026 * main.cc: Include "plugin.h".
13027 (main): Load plugin libraries.
13028 * object.h (Pluginobj): Declare.
13029 (Object::pluginobj): New function.
13030 (Object::do_pluginobj): New function.
13031 (Object::set_target): New function.
13032 * options.cc: Include "plugin.h".
13033 (General_options::parse_plugin): New function.
13034 (General_options::General_options): Initialize plugins_ field.
13035 (General_options::add_plugin): New function.
13036 * options.h (Plugin_manager): Declare.
13037 (General_options): Add --plugin option.
13038 (General_options::has_plugins): New function.
13039 (General_options::plugins): New function.
13040 (General_options::add_plugin): New function.
13041 (General_options::plugins_): New field.
13042 * plugin.cc: New file.
13043 * plugin.h: New file.
13044 * readsyms.cc: Include "plugin.h".
13045 (Read_symbols::do_read_symbols): Check for archive before checking
13046 for ELF file. Call plugin hooks to claim files.
13047 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13048 from a real object file; force override when processing replacement
13050 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13051 (Symbol::init_base_object): Likewise.
13052 (Symbol::init_base_output_data): Likewise.
13053 (Symbol::init_base_output_segment): Likewise.
13054 (Symbol::init_base_constant): Likewise.
13055 (Symbol::init_base_undefined): Likewise.
13056 (Symbol::output_section): Assert that object is not a plugin.
13057 (Symbol_table::add_from_pluginobj): New function.
13058 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13060 (Symbol_table::sized_write_globals): Likewise.
13061 (Symbol_table::add_from_pluginobj): Instantiate template.
13062 * symtab.h (Sized_pluginobj): Declare.
13063 (Symbol::in_real_elf): New function.
13064 (Symbol::set_in_real_elf): New function.
13065 (Symbol::in_real_elf_): New field.
13066 (Symbol_table::add_from_pluginobj): New function.
13068 * testsuite/Makefile.am (AM_CFLAGS): New variable.
13069 (LIBDL): New variable.
13070 (LDADD): Add LIBDL.
13071 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13072 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13073 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13074 (MOSTLYCLEANFILES): Likewise.
13075 * testsuite/Makefile.in: Regenerate.
13076 * testsuite/plugin_test.c: New file.
13077 * testsuite/plugin_test_1.sh: New file.
13078 * testsuite/plugin_test_2.sh: New file.
13080 2008-09-16 Ian Lance Taylor <iant@google.com>
13082 * target-reloc.h (relocate_section): Check whether a symbol is
13083 defined by the ABI before reporting an undefined symbol error.
13084 * target.h (Target::is_defined_by_abi): Make parameter const.
13085 (Target::do_is_defined_by_abi): Likewise.
13086 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13087 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13088 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13089 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13090 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13091 * testsuite/Makefile.in: Rebuild.
13093 * fileread.cc (make_view): Add casts to avoid warning.
13095 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13097 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13098 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13100 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13102 * options.h (General_options::output_is_executable): New.
13103 (General_options::output_is_pie): New.
13104 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13105 for shared libraries.
13106 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13108 2008-09-11 Chris Demetriou <cgd@google.com>
13110 * options.h (origin): New -z option.
13111 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13112 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13115 2008-09-05 Cary Coutant <ccoutant@google.com>
13117 * fileread.cc (File_read::make_view): Add check for attempt to map
13118 beyond end of file.
13120 2008-09-05 Cary Coutant <ccoutant@google.com>
13122 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13123 explicit instantiations.
13125 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
13128 * options.cc (General_options::finalize): Allow undefined symbols
13129 in shlibs if linking -shared.
13132 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13133 symbols as not needing a dynsym entry.
13135 2008-08-20 Craig Silverstein <csilvers@google.com>
13137 * fileread.cc (File_read::open): Do not lock the file unless it
13138 was successfully opened.
13140 2008-08-14 Cary Coutant <ccoutant@google.com>
13142 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13143 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13144 * testsuite/tls_test.cc (struct int128): 128-bit struct
13145 for testing TLS relocs with non-zero addend.
13146 (v12): New TLS variable.
13148 (t_last): Add check for v12.
13149 * testsuite/tls_test.h (t12): New function.
13150 * testsuite/tls_test_main.cc (thread_routine): Call new test.
13152 2008-08-13 Ian Lance Taylor <iant@google.com>
13154 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13155 set tls_segment_ or relro_segment_.
13156 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13158 * output.h (Output_section::clear_is_relro): New function.
13159 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13160 sections specially even when output_data_ is empty.
13161 (Output_segment::maximum_alignment): When first section is relro,
13162 only force alignment for PT_LOAD segments.
13163 * script.cc (script_data_segment_align): New function.
13164 (script_data_segment_relro_end): New function.
13165 * script-c.h (script_data_segment_align): Declare.
13166 (script_data_segment_relro_end): Declare.
13167 * script-sections.h (class Script_sections): Declare
13168 data_segment_align and data_segment_relro_end. Add fields
13169 segment_align_index_ and saw_relro_end_.
13170 * script-sections.cc (class Sections_element): Add set_is_relro
13171 virtual function. Add new bool* parameter to place_orphan_here.
13172 Add get_output_section virtual function.
13173 (class Output_section_definition): Add set_is_relro. Add new
13174 bool* parameter to place_orphan_here. Add get_output_section.
13175 Add is_relro_ field.
13176 (Output_section_definition::Output_section_definition): Initialize
13177 evaluated_address_, evaluated_load_address, evaluated_addralign_,
13178 and is_relro_ fields.
13179 (Output_section_definition::place_orphan_here): Add is_relro
13181 (Output_section_definition::set_section_addresses): Set relro for
13183 (Output_section_definition::alternate_constraint): Likewise.
13184 (class Orphan_output_section): Add new bool* parameter to
13185 place_orphan_here. Add get_output_section.
13186 (Orphan_output_section::place_orphan_here): Add is_relro
13188 (Script_sections::Script_sections): Initialize
13189 data_segment_align_index_ and saw_relro_end_.
13190 (Script_sections::data_segment_align): New function.
13191 (Script_sections::data_segment_relro_end): New function.
13192 (Script_sections::place_orphan): Set or clear is_relro.
13193 (Script_sections::set_section_addresses): Force alignment of first
13195 * yyscript.y (exp): Call script_data_segment_align and
13196 script_data_segment_relro_end.
13197 * testsuite/relro_script_test.t: New file.
13198 * testsuite/relro_test.cc (using_script): Declare.
13199 (t1, t2): Test using_script.
13200 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13201 (relro_script_test_SOURCES): Define.
13202 (relro_script_test_DEPENDENCIES): Define.
13203 (relro_script_test_LDFLAGS): Define.
13204 (relro_script_test_LDADD): Define.
13205 (relro_script_test.so): New target.
13206 * testsuite/Makefile.in: Rebuild.
13208 2008-08-06 Cary Coutant <ccoutant@google.com>
13210 * archive.cc (Archive::total_archives, Archive::total_members)
13211 (Archive::total_members_loaded): New variables.
13212 (Archive::setup): Add parameter. Add option to preread
13214 (Archive::read_armap): Add counter.
13215 (Archive::get_file_and_offset): New function.
13216 (Archive::get_elf_object_for_member): New function.
13217 (Archive::read_all_symbols): New function.
13218 (Archive::read_symbols): New function.
13219 (Archive::add_symbols): Add counters.
13220 (Archive::include_all_members): Use armap to find members if it's
13222 (Archive::include_member): Skip reading symbols if already read.
13223 Factored code into Archive::get_file_and_offset and
13224 Archive::get_elf_object_for_member. Changed call to
13225 Mapfile::report_include_archive_member.
13226 (Archive::print_stats): New function.
13227 * archive.h: Declare Object and Read_symbols_data classes.
13228 (Archive::Archive): Add initializers for new members.
13229 (Archive::setup): Add parameter.
13230 (Archive::print_stats): New function.
13231 (Archive::total_archives, Archive::total_members)
13232 (Archive::total_members_loaded): New variables.
13233 (Archive::get_file_and_offset): New function.
13234 (Archive::get_elf_object_for_member): New function.
13235 (Archive::read_all_symbols): New function.
13236 (Archive::read_symbols): New function.
13237 (Archive::Archive_member): New class.
13238 (Archive::members_): New member.
13239 (Archive::num_members_): New member.
13240 * main.cc: Include archive.h.
13241 (main): Call Archive::print_stats.
13242 * mapfile.cc (Mapfile::report_include_archive_member): Delete
13243 archive parameter; member_name is now the fully-decorated name.
13244 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13245 * options.h: (General_options): Add --preread-archive-symbols option.
13246 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13249 2008-08-04 Ian Lance Taylor <iant@google.com>
13251 * symtab.h (Symbol::use_plt_offset): New function.
13252 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13253 * powerpc.cc (Relocate::relocate): Likewise.
13254 * sparc.cc (Relocate::relocate): Likewise.
13255 * x86_64.cc (Relocate::relocate): Likewise.
13256 * testsuite/weak_plt.sh: New test.
13257 * testsuite/weak_plt_main.cc: New test.
13258 * testsuite/weak_plt_shared.cc: New test.
13259 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13260 (check_PROGRAMS): Add weak_plt.
13261 (check_DATA): Add weak_plt_shared.so.
13262 (weak_plt_main_pic.o, weak_plt): New targets.
13263 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13264 * testsuite/Makefile.in: Rebuild.
13266 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13268 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13269 * testsuite/Makefile.in: Rebuild.
13271 2008-08-04 Alan Modra <amodra@bigpond.net.au>
13273 * Makefile.am (POTFILES.in): Set LC_ALL=C.
13274 * Makefile.in: Regenerate.
13275 * po/POTFILES.in: Regenerate.
13277 2008-07-29 Ian Lance Taylor <iant@google.com>
13279 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13280 symbols before other symbols.
13281 * testsuite/script_test_2.cc (test_addr): Declare.
13282 (test_addr_alias): Declare.
13283 (main): Check that test_addr and test_addr_alias have the right
13285 * testsuite/script_test_2.t: Define test_addr_alias and
13288 2008-07-24 Ian Lance Taylor <iant@google.com>
13291 * descriptors.cc: New file.
13292 * descriptors.h: New file.
13293 * gold-threads.h (class Hold_optional_lock): New class.
13294 * fileread.cc: Include "descriptors.h".
13295 (File_read::~File_read): Release descriptor rather than closing
13297 (File_read::open) [file]: Call open_descriptor rather than open.
13298 Set is_descriptor_opened_.
13299 (File_read::open) [memory]: Assert that descriptor is not open.
13300 (File_read::reopen_descriptor): New function.
13301 (File_read::release): Release descriptor.
13302 (File_read::do_read): Make non-const. Reopen descriptor.
13303 (File_read::read): Make non-const.
13304 (File_read::make_view): Reopen descriptor.
13305 (File_read::do_readv): Likewise.
13306 * fileread.h (class File_read): Add is_descriptor_opened_ field.
13307 Update declarations.
13308 * layout.cc: Include "descriptors.h".
13309 (Layout::create_build_id): Use open_descriptor rather than open.
13310 * output.cc: Include "descriptors.h".
13311 (Output_file::open): Use open_descriptor rather than open.
13312 * archive.cc (Archive::const_iterator): Change Archive to be
13314 (Archive::begin, Archive::end): Make non-const.
13315 (Archive::count_members): Likewise.
13316 * archive.h (class Archive): Update declarations.
13317 * object.h (Object::read): Make non-const.
13318 * Makefile.am (CCFILES): Add descriptors.cc.
13319 (HFILES): Add descriptors.h.
13320 * Makefile.in: Rebuild.
13323 * gold.h: Always include <clocale>. Add Solaris workarounds
13324 following code in binutils/sysdep.h.
13327 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13328 this->eh_frame_hdr_ is NULL before using it.
13330 * dynobj.cc (Versions::Versions): Update comment.
13332 * dynobj.cc (Versions::Versions): If there is an soname, use it as
13333 the base version name.
13335 * stringpool.cc (Stringpool_template::add_with_length): Set key to
13336 array size plus one.
13337 (Stringpool_template::set_string_offsets): Subtract one from key
13338 before using it as an array index.
13339 (Stringpool_template::get_offset_with_length): Likewise.
13340 (Stringpool_template::write_to_buffer): Likewise.
13341 * stringpool.h (Stringpool_template::get_offset_from_key):
13344 2008-07-23 Ian Lance Taylor <iant@google.com>
13347 * object.h (Merged_symbol_value::value): Do our best to handle a
13351 * script.cc (Version_script_info::get_versions): Don't add empty
13352 version tag to return value.
13353 (Version_script_info::get_symbol_version_helper): Change return
13354 type to bool. Add pversion parameter. Change all callers.
13355 (script_register_vers_node): Don't require a non-NULL tag.
13356 * script.h (class Version_script_info): Update declarations.
13357 (Version_script_info::get_symbol_version): Change return type to
13358 bool. Add version parameter. Change all callers.
13359 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13360 handling. Handle an empty version from a version script.
13361 (Symbol_table::define_special_symbol): Likewise.
13362 * testsuite/ver_test_10.script: New file.
13363 * testsuite/ver_test_10.sh: New file.
13364 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13365 (check_DATA): Add ver_test_10.syms.
13366 (ver_test_10.syms, ver_test_10.so): New target.
13367 * testsuite/Makefile.in: Rebuild.
13369 2008-07-23 Simon Baldwin <simonb@google.com>
13371 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13372 to zero for undefined symbols from dynamic libraries.
13374 2008-07-23 Ian Lance Taylor <iant@google.com>
13376 * symtab.cc (Symbol_table::resolve): Remove version parameter.
13377 Change all callers.
13378 * symtab.h (class Symbol_table): Update declaration.
13379 * testsuite/ver_test_9.cc: New file.
13380 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13381 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13382 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13383 (ver_test_9.so, ver_test_9.o): New targets.
13384 * testsuite/Makefile.in: Rebuild.
13386 2008-07-22 Ian Lance Taylor <iant@google.com>
13388 * options.h (class General_options): Define --check-sections.
13389 * layout.cc (Layout::set_segment_offsets): Handle
13392 * options.h (class General_options): Define -n/--nmagic and
13394 * options.cc (General_options::finalize): For -n/--nmagic or
13395 -N/--omagic, set -static.
13396 * layout.cc (Layout::attach_allocated_section_to_segment): If
13397 -N/--omagic, don't put read-only and read-write sections in
13398 different segments.
13399 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13400 finding a read-only segment.
13401 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13402 don't set the minimum segment alignment to the common page size,
13403 and don't set the file offset to the address modulo the page size.
13404 * script-sections.cc (Script_sections::create_segments): If
13405 -n/--omagic, don't put read-only and read-write sections in
13406 different segments.
13408 * cref.cc: New file.
13409 * cref.h: New file.
13410 * options.h (class General_options): Add --print-symbol-counts.
13411 * main.cc (main): Issue defined symbol report if requested.
13412 * archive.cc (Archive::interpret_header): Make into a const member
13414 (Archive::add_symbols): Call Input_objects::archive_start and
13416 (Archive::const_iterator): Define new class.
13417 (Archive::begin, Archive::end): New functions.
13418 (Archive::include_all_members): Rewrite to use iterator.
13419 (Archive::count_members): New function.
13420 * archive.h (class Archive): Update declarations.
13421 (Archive::filename): New function.
13422 * object.cc: Include "cref.h".
13423 (Sized_relobj::Sized_relobj): Initialize defined_count_.
13424 (Sized_relobj::do_get_global_symbol_counts): New function.
13425 (Input_objects::add_object): Add object to cross-referencer.
13426 (Input_objects::archive_start): New function.
13427 (Input_objects::archive_stop): New function.
13428 (Input_objects::print_symbol_counts): New function.
13429 * object.h: Declare Cref and Archive.
13430 (Object::get_global_symbol_counts): New function.
13431 (Object::do_get_global_symbol_counts): New pure virtual function.
13432 (class Sized_relobj): Add defined_count_ field. Update
13434 (class Input_objects): Add cref_ field. Update constructor.
13435 Update declarations.
13436 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13438 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13440 (Sized_dynobj::do_get_global_symbol_counts): New function.
13441 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13442 defined_count_. Update declarations. Define Symbols typedef.
13443 * symtab.cc (Symbol_table::add_from_relobj): Add defined
13444 parameter. Change all callers.
13445 (Symbol_table::add_from_dynobj): Add sympointers and defined
13446 parameters. Change all callers.
13447 * symtab.h (class Symbol_table): Update declarations.
13448 * Makefile.am (CCFILES): Add cref.cc.
13449 (HFILES): Add cref.h.
13450 * Makefile.in: Rebuild.
13452 2008-07-22 Simon Baldwin <simonb@google.com>
13454 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13455 to zero when writing undefined symbols.
13457 2008-07-22 Ian Lance Taylor <iant@google.com>
13459 * output.cc (Output_section::add_input_section): Don't try to
13460 merge empty merge sections.
13462 2008-07-21 Craig Silverstein <csilvers@google.com>
13464 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13465 Include symbol version in error message.
13467 2008-07-20 Chris Demetriou <cgd@google.com>
13469 * configure.ac (gold_cv_c_random_seed): New configured variable.
13470 (RANDOM_SEED_CFLAGS): New substituted variable.
13471 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13472 * configure: Rebuild.
13473 * Makefile.in: Likewise.
13474 * testsuite/Makefile.in: Likewise.
13476 2008-07-18 Ian Lance Taylor <iant@google.com>
13478 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13479 where we see NAME/NULL and NAME/VERSION as separate symbols.
13480 * testsuite/ver_test_main.cc (main): Call t4.
13481 (t4, t4_2a): Define.
13482 * testsuite/ver_test_2.cc (t4_2): Define.
13483 * testsuite/ver_test_2.script: Put t4_2a in VER2.
13484 * testsuite/ver_test_4.cc (t4_2a): Define.
13485 * testsuite/ver_test_4.script: Put t4_2a in VER2.
13486 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13488 2008-07-17 Ian Lance Taylor <iant@google.com>
13490 * dynobj.cc (Versions::add_def): If we give an error about a
13491 missing version, go ahead and create the version anyhow.
13493 2008-07-10 Ian Lance Taylor <iant@google.com>
13495 Handle output sections with more than 0x7fffffff bytes.
13496 * object.h (class Relobj): Change map_to_output_ to
13497 output_sections_, and just keep a section pointer. Change all
13498 uses. Move comdat group support to Sized_relobj.
13499 (Relobj::is_section_specially_mapped): Remove.
13500 (Relobj::output_section): Remove poff parameter. Change all
13502 (Relobj::output_section_offset): New function.
13503 (Relobj::set_section_offset): Rewrite.
13504 (Relobj::map_to_output): Remove.
13505 (Relobj::output_sections): New function.
13506 (Relobj::do_output_section_offset): New pure virtual function.
13507 (Relobj::do_set_section_offset): Likewise.
13508 (class Sized_relobj): Add section_offsets_ field. Add comdat
13509 group support from Relobj. Update declarations.
13510 (Sized_relobj::get_output_section_offset): New function.
13511 (Sized_relobj::do_output_section_offset): New function.
13512 (Sized_relobj::do_set_section_offset): New function.
13513 * object.cc (Relobj::output_section_address): Remove.
13514 (Sized_relobj::Sized_relobj): Initialize new fields.
13515 (Sized_relobj::include_section_group): Cast find_kept_object to
13517 (Sized_relobj::include_linkonce_section): Likewise.
13518 (Sized_relobj::do_layout): Use separate arrays for output section
13520 (Sized_relobj::do_count_local_symbols): Change map_to_output to
13522 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13523 output_sections and section_offsets.
13524 (Sized_relobj::write_local_symbols): Likewise.
13525 (map_to_kept_section): Compute output address directly.
13526 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13527 output_sections and section_offsets.
13528 (Sized_relobj::write_sections): Likewise.
13529 (Sized_relobj::relocate_sections): Likewise.
13530 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13531 * output.h (class Output_reloc): Update declarations. Change
13532 u2_.relobj to Sized_relobj*.
13533 (class Output_data_reloc): Change add functions to use
13535 * output.cc (Output_reloc::Output_reloc): Change relobj to
13537 (Output_reloc::local_section_offset): Change return type to
13538 Elf_Addr. Use get_output_section_offset.
13539 (Output_reloc::get_address): Likewise.
13540 (Output_section::is_input_address_mapped): Don't call
13541 is_section_specially_mapped.
13542 (Output_section::output_offset): Likewise.
13543 (Output_section::output_address): Likewise.
13544 (Output_section::starting_output_address): Likewise.
13545 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13546 parameter to Sized_relobj*.
13547 (Copy_relocs::need_copy_reloc): Likewise.
13548 (Copy_relocs::save): Likewise.
13549 * copy-relocs.h (class Copy_relocs): Update declarations.
13550 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13551 Sized_relobj*. Change relobj_ field to Sized_relobj*.
13552 * target-reloc.h (relocate_for_relocatable): Change
13553 offset_in_output_section type to Elf_Addr. Change code that uses
13555 * layout.cc (Layout::layout): Always set *off.
13556 * mapfile.cc (Mapfile::print_input_section): Use
13557 output_section_offset.
13558 * i386.cc (Target_i386::copy_reloc): Change object parameter to
13560 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13561 * sparc.cc (Target_sparc::copy_reloc): Likewise.
13562 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13564 2008-07-03 Ian Lance Taylor <iant@google.com>
13566 * layout.cc (Layout::include_section): Do not discard unrecognized
13567 SHT_STRTAB sections.
13569 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
13571 * script.cc (Lex::can_continue_name): Make '?' allowable in
13572 version-script names.
13573 * testsuite/version_script.map: Change glob pattern to use '?'
13575 2008-06-30 Manish Singh <yosh@gimp.org>
13578 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13581 2008-06-30 Ian Lance Taylor <iant@google.com>
13585 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13586 versions]: Don't try to read the value in the contents, since we
13587 don't use it. Use the template endianness when writing.
13589 2008-06-25 Cary Coutant <ccoutant@google.com>
13591 * fileread.cc (File_read::make_view): Assert on zero-length view.
13592 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13593 symbol table when there are no symbols to read.
13595 2008-06-23 Craig Silverstein <csilvers@google.com>
13597 * version.cc (version_string): Bump to 1.7
13599 2008-06-18 Craig Silverstein <csilvers@google.com>
13601 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13602 constant 0xFFFF to type Valtype.
13603 (Powerpc_relocate_functions::rel16_ha): Likewise.
13605 2008-06-17 Ian Lance Taylor <iant@google.com>
13607 * output.h (Output_section::Input_section): Initialize p2align_ to
13608 zero for Output_section_data constructors.
13609 (Output_section::Input_section::addralign): If not an input
13610 section, return the alignment of the Output_section_data.
13611 * testsuite/copy_test.cc: New file.
13612 * testsuite/copy_test_1.cc: New file.
13613 * testsuite/copy_test_2.cc: New file.
13614 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13615 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13616 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13617 (copy_test_1_pic.o, copy_test_1.so): New targets.
13618 (copy_test_2_pic.o, copy_test_2.so): New targets.
13619 * testsuite/Makefile.in: Rebuild.
13621 * script-sections.cc (Script_sections::place_orphan): Initialize
13622 local variable exact.
13624 2008-06-13 David Edelsohn <edelsohn@gnu.org>
13626 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13628 2008-06-12 David Edelsohn <edelsohn@gnu.org>
13629 David S. Miller <davem@davemloft.net>
13631 * powerpc.cc: New file.
13632 * Makefile.am (TARGETSOURCES): Add powerpc.cc
13633 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13634 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13635 * Makefile.in: Rebuild.
13637 2008-06-09 Ian Lance Taylor <iant@google.com>
13639 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13641 (throwing, orig_terminate): New static variables.
13642 (terminate_handler): New static function.
13643 (t2): Set terminate handler.
13645 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
13648 * binary.cc (Binary_to_elf::sized_convert): Fix .data
13651 2008-05-30 Cary Coutant <ccoutant@google.com>
13653 * archive.cc (Archive::include_all_members) Correct to step
13654 over symbol table and extended name table in thin archives.
13656 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
13659 * target-reloc.h (relocate_for_relocatable): Fix new_offset
13662 2008-05-28 Caleb Howe <cshowe@google.com>
13664 * reduced_debug_output.cc: New file.
13665 * reduced_debug_output.h: New file.
13666 * options.h (class General_options): Add --strip-debug-non-line.
13667 * options.cc (General_options::finalize): Add strip_debug_non_line
13668 to the strip heirarchy.
13669 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13671 * layout.cc: Include "reduced_debug_output.h".
13672 (Layout::Layout): Initialize new fields.
13673 (line_only_debug_sections): New static array.
13674 (is_lines_only_debug_sections): New static inline function.
13675 (Layout::include_section): Handle --strip-debug-non-line.
13676 (Layout::make_output_section): If --strip-debug-non-line, build
13677 new output sections for .debug_abbrev and .debug_info.
13678 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13679 gold. Warn about possible overflow.
13680 (read_signed_LEB_128): Likewise.
13681 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13682 (read_signed_LEB_128): Declare.
13683 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13684 (HFILES): Add reduced_debug_output.h.
13685 * Makefile.in: Rebuild.
13687 2008-05-21 Ian Lance Taylor <iant@google.com>
13689 * mapfile.cc: New file.
13690 * mapfile.h: New file.
13691 * options.h (class General_options): Add -M/--print-map and -Map.
13692 * options.cc (General_options::finalize): Make -M equivalent to
13694 * main.cc: Include <cstdio> and "mapfile.h".
13695 (main): Open mapfile if requested.
13696 * gold.cc (class Middle_runner): Add mapfile_ field. Update
13697 constructor. Change caller.
13698 (queue_initial_tasks): Add mapfile parameter. Change caller.
13699 (queue_middle_tasks): Likewise.
13700 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13702 * archive.cc: Include "mapfile.h".
13703 (Archive::add_symbols): Add mapfile parameter. Change all
13704 callers. Pass mapfile, symbol, and reason to include_member.
13705 (Archive::include_all_members): Add mapfile parameter. Change all
13707 (Archive::include_member): Add mapfile, sym, and why parameters.
13708 Change all callers. Report inclusion to map file.
13709 * archive.h: Include "fileread.h".
13710 (class Archive): Update declarations.
13711 (Archive::file): New const method.
13712 (class Add_archive_symbols): Add mapfile_ field. Update
13713 constructor. Change all callers.
13714 * readsyms.h (class Read_symbols): Likewise.
13715 (class Finish_group): Likewise.
13716 (class Read_script): Likewise.
13717 * common.cc: Include "mapfile.h".
13718 (Symbol_table::allocate_commons): Add mapfile parameter. Change
13720 (Symbol_table::do_allocate_commons): Likewise.
13721 (Symbol_table::do_allocate_commons_list): Likewise. Report common
13722 symbol allocation to mapfile.
13723 * common.h (class Allocate_commons_task): Add mapfile_ field.
13724 Update constructor. Change all callers.
13725 * symtab.h (class Symbol_table): Update declarations.
13726 * layout.cc: Include "mapfile.h".
13727 (Layout_task_runner::run): Print information to mapfile.
13728 (Layout::create_gold_note): Change Output_data_fixed_space to
13729 Output_data_zero_fill.
13730 (Layout::create_build_id): Likewise.
13731 (Layout::print_to_mapfile): New function.
13732 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
13733 constructor. Change caller.
13734 (class Layout): Declare print_to_mapfile.
13735 * output.cc (Output_section::Input_section::print_to_mapfile): New
13737 (Output_section::add_input_section): If producing a map, always
13738 add to input_sections_ list.
13739 (Output_section::do_print_to_mapfile): New function.
13740 (Output_segment::print_sections_to_mapfile): New function.
13741 (Output_segment::print_section_list_to_mapfile): New function.
13742 * output.h: Include "mapfile.h".
13743 (Output_data::print_to_mapfile): New function.
13744 (Output_data::do_print_to_mapfile): New virtual function.
13745 (Output_segment_headers::do_print_to_mapfile): New function.
13746 (Output_file_header::do_print_to_mapfile): New function.
13747 (Output_data_const::do_print_to_mapfile): New function.
13748 (class Output_data_const_buffer): Add map_name_ field. Update
13749 constructor. Change all callers. Add do_print_to_mapfile
13751 (class Output_data_fixed_space): Likewise.
13752 (class Output_data_space): Likewise.
13753 (class Output_data_zero_fill): New class.
13754 (Output_data_strtab::do_print_to_mapfile): New function.
13755 (Output_data_reloc_base::do_print_to_mapfile): New function.
13756 (Output_relocatable_relocs::do_print_to_mapfile): New function.
13757 (Output_data_group::do_print_to_mapfile): New function.
13758 (Output_data_got::do_print_to_mapfile): New function.
13759 (Output_data_dynamic::do_print_to_mapfile): New function.
13760 (Output_symtab_xindex::do_print_to_mapfile): New function.
13761 (class Output_section): Declare do_print_to_mapflie. Declare
13762 print_to_mapfile in Input_section.
13763 (class Output_segment): Declare new functions.
13764 * object.h (Sized_relobj::symbol_count): New function.
13765 * script-sections.cc
13766 (Output_section_element_dot_assignment::set_section_addresses):
13767 Change Output_data_fixed_space to Output_data_zero_fill.
13768 (Output_data_expression::do_print_to_mapfile): New function.
13769 * script.cc (read_input_script): Add mapfile parameter. Change
13771 * script.h (read_input_script): Update declaration.
13772 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13773 (Eh_frame::do_print_to_mapfile): New function.
13774 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13775 (Output_merge_string::do_print_to_mapfile): New function.
13776 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13778 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13780 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13782 * Makefile.am (CCFILES): Add mapfile.cc.
13783 (HFILES): Add mapfile.h.
13784 * Makefile.in: Rebuild.
13786 2008-05-19 Ian Lance Taylor <iant@google.com>
13788 * options.h (class General_options): Add -z relro.
13789 * layout.cc (Layout::Layout): Initialize relro_segment_.
13790 (Layout::add_output_section_data): Return the output section.
13791 (Layout::make_output_section): Rcognize relro sections and mark
13792 them appropriately.
13793 (Layout::attach_allocated_section_to_segment): Put relro sections
13794 in a PT_GNU_RELRO segment.
13795 (Layout::create_initial_dynamic_sections): Mark the .dynamic
13797 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13799 (Layout::linkonce_mapping): Map d.rel.ro.local to
13800 .data.rel.ro.local.
13801 (Layout::output_section_name): Us .data.rel.ro.local for any
13802 section which begins with that.
13803 * layout.h (class Layout): Update add_output_section_data
13804 declaration. Add relro_segment_ field.
13805 * output.cc (Output_section::Output_section): Initialize is_relro_
13806 and is_relro_local_ fields.
13807 (Output_segment::add_output_section): Group relro sections.
13808 (Output_segment::is_first_section_relro): New function.
13809 (Output_segment::maximum_alignment): If there is a relro section,
13810 align the segment to the common page size.
13811 (Output_segment::set_section_addresses): Track whether we are
13812 looking at relro sections. If the last section is a relro
13813 section, align to the common page size.
13814 (Output_segment::set_section_list_addresses): Add in_relro
13815 parameter. Change all callers. Align to the page size when
13816 moving from relro to non-relro section.
13817 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13819 * output.h (class Output_section): Add is_relro_ and
13820 is_relro_local_ fields.
13821 (Output_section::is_relro): New function.
13822 (Output_section::set_is_relro): New function.
13823 (Output_section::is_relro_local): New function.
13824 (Output_section::set_is_relro_local): New function.
13825 (class Output_segment): Update declarations.
13826 * i386.cc (Target_i386::got_section): Mark .got section as relro.
13827 * sparc.cc (Target_sparc::got_section): Likewise.
13828 * x86_64.cc (Target_x86_64::got_section): Likewise.
13829 * testsuite/relro_test_main.cc: New file.
13830 * testsuite/relro_test.cc: New file.
13831 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13832 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13833 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13834 (relro_test.so, relro_test_pic.o): New targets.
13835 * testsuite/Makefile.in: Rebuild.
13837 2008-05-16 Ian Lance Taylor <iant@google.com>
13839 * output.cc (Output_segment::add_output_section): Remove front
13841 * output.h (class Output_segment): Remove
13842 add_initial_output_section and overloaded add_output_section.
13843 Update declaration of remaining add_output_section.
13844 * layout.cc (Layout::create_interp): Call add_output_section
13845 rather than add_initial_output_section.
13846 (Layout::finish_dynamic_section): Likewise.
13848 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13849 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
13850 know the dynamic type.
13851 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13852 field. Initialize it in constructor.
13853 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13854 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13855 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13858 * output.cc (Output_reloc::get_address): Change return type to
13860 * output.h (class Output_reloc): Update get_address declaration.
13861 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13862 for section addresses.
13864 2008-05-09 Ian Lance Taylor <iant@google.com>
13867 * gold.cc (gold_nomem): Use return value of write.
13869 2008-05-08 Ian Lance Taylor <iant@google.com>
13871 * symtab.c (Symbol::init_base_output_data): Add version
13872 parameter. Change all callers.
13873 (Symbol::init_base_output_segment): Likewise.
13874 (Symbol::init_base_constant): Likewise.
13875 (Symbol::init_base_undefined): Likewise.
13876 (Sized_symbol::init_output_data): Likewise.
13877 (Sized_symbol::init_output_segment): Likewise.
13878 (Sized_symbol::init_constant): Likewise.
13879 (Sized_symbol::init_undefined): Likewise.
13880 (Symbol_table::do_define_in_output_data): If the new symbol has a
13881 version, mark it as the default.
13882 (Symbol_table::do_define_in_output_segment): Likewise.
13883 (Symbol_table::do_define_as_constant): Likewise.
13884 * symtab.h (class Symbol): Update declarations.
13885 (class Sized_symbol): Likewise.
13886 * resolve.cc (Symbol::override_version): New function.
13887 (Symbol::override_base): Call override_version.
13888 (Symbol::override_base_with_special): Likewise.
13889 * testsuite/ver_script_8.script: New file.
13890 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13891 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13892 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13893 (ver_test_8_1.so, ver_test_8_2.so): New targets.
13895 2008-05-06 Ian Lance Taylor <iant@google.com>
13898 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13900 (class General_options): Remove existing --undefined, and add
13901 --no-undefined instead. Add new --undefined as synonym for -u.
13902 * archive.cc (Archive::add_symbols): Check whether symbol was
13904 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13905 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13906 all uses. Add IS_UNDEFINED. Update declarations to split
13907 different versions of init_base. Declare init_base_undefined.
13908 (Symbol::is_defined): Handle IS_UNDEFINED.
13909 (Symbol::is_undefined): Likewise.
13910 (Symbol::is_weak_undefined): Call is_undefined.
13911 (Symbol::is_absolute): Handle IS_CONSTANT.
13912 (class Sized_symbol): Update declarations to split different
13913 versions of init. Declare init_undefined.
13914 (class Symbol_table): Declare new functions.
13915 * symtab.cc (Symbol::init_base_object): Rename from init_base.
13916 Change all callers.
13917 (Symbol::init_base_output_data): Likewise.
13918 (Symbol::init_base_output_segment): Likewise.
13919 (Symbol::init_base_constant): Likewise.
13920 (Symbol::init_base_undefined): New function.
13921 (Sized_symbol::init_object): Rename from init. Change all
13923 (Sized_symbol::init_output_data): Likewise.
13924 (Sized_symbol::init_output_segment): Likewise.
13925 (Sized_symbol::init_constant): Likewise.
13926 (Sized_symbol::init_undefined): New function.
13927 (Symbol_table::add_undefined_symbols_from_command_line): New
13929 (Symbol_table::do_add_undefined_symbols_from_command_line): New
13931 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13932 (Symbol::output_section): Likewise.
13933 (Symbol::set_output_section): Likewise.
13934 (Symbol_table::sized_finalize_symbol): Likewise.
13935 (Symbol_table::sized_write_globals): Likewise.
13936 * resolve.cc (Symbol_table::should_override): Likewise.
13937 (Symbol::override_base_with_special): Likewise.
13939 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13940 symbol, change it to have default visibility.
13941 * testsuite/protected_1.cc: New file.
13942 * testsuite/protected_2.cc: New file.
13943 * testsuite/protected_3.cc: New file.
13944 * testsuite/protected_main_1.cc: New file.
13945 * testsuite/protected_main_2.cc: New file.
13946 * testsuite/protected_main_3.cc: New file.
13947 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13948 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13949 (protected_1_LDFLAGS, protected_1_LDADD): Define.
13950 (protected_1.so): New target.
13951 (protected_1_pic.o, protected_2_pic.o): New targets.
13952 (protected_3_pic.o): New target.
13953 (check_PROGRAMS): Add protected_2.
13954 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13955 (protected_2_LDFLAGS, protected_2_LDADD): Define.
13956 * testsuite/Makefile.in: Rebuild.
13958 * options.h (DEFINE_var): Add set_user_set_##varname__.
13959 (DEFINE_bool_alias): New macro.
13960 (class General_options): Define -Bstatic using DEFINE_bool_alias
13961 rather than DEFINE_special. Add --undefined as an alias for -z
13963 * options.cc (General_options::parse_Bstatic): Remove.
13965 * options.h (class General_options): Add --fatal-warnings.
13966 * main.cc (main): Implement --fatal-warnings.
13967 * errors.h (Errors::warning_count): New function.
13969 * options.h (class General_options): Add -Bsymbolic-functions.
13970 * symtab.h (Symbol::is_preemptible): Check for
13971 -Bsymbolic-functions.
13973 2008-05-05 Ian Lance Taylor <iant@google.com>
13975 * options.h (DEFINE_bool): For DASH_Z, create the negative option
13976 as noVARNAME rather than no-VARNAME.
13977 (class General_options): Add option -z combreloc.
13978 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13980 (Output_reloc::sort_before) [SHT_REL]: New function.
13981 (Output_reloc::sort_before) [SHT_RELA]: New function.
13982 (class Output_data_reloc_base): Add sort_relocs_ field. Define
13983 Sort_relocs_comparison.
13984 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13985 parameter. Change all callers.
13986 (Output_data_reloc::Output_data_reloc) [both versions]: Add
13987 sort_relocs parameter. Change all callers.
13988 * output.cc (Output_reloc::get_address): New function, broken out
13990 (Output_reloc::write_rel): Call it.
13991 (Output_reloc::compare): New function.
13992 (Output_data_reloc_base::do_write): Optionally sort relocs.
13994 * configure.ac: If targ_extra_obj is set, link it in.
13995 * configure.tgt: Initialize all variables.
13996 (x86_64*): Set targ_extra_obj and targ_extra_size.
13997 * configure: Rebuild.
13999 * object.cc (Sized_relobj::include_section_group): Adjust section
14000 indexes read from group data. Build vector to pass to
14002 * layout.cc (Layout::layout_group): Add flags and shndxes
14003 parameters. Remove contents parameter. Change caller. Update
14004 explicit instantiations.
14005 * layout.h (class Layout): Update layout_group declaration.
14006 * output.cc (Output_data_group::Output_data_group): Add flags and
14007 input_shndxes parameters. Remove contents parameter. Change
14009 (Output_data_group::do_write): Change input_sections_ to
14011 * output.h (class Output_data_group): Update constructor
14012 declaration. Rename input_sections_ to input_shndxes_.
14013 * testsuite/many_sections_test.cc: Add template.
14015 2008-04-30 Cary Coutant <ccoutant@google.com>
14017 * target-reloc.h (relocate_section): Fix dead-pointer bug.
14019 * layout.cc (Layout::include_section): Refactored check for debug
14021 (Layout::add_comdat): Add new parameters. Change type
14022 of signature parameter. Add object and shndx to signatures table.
14023 (Layout::find_kept_object): New function.
14024 * layout.h: Include <cstring>.
14025 (Layout::is_debug_info_section): New function.
14026 (Layout::add_comdat): Add new parameters.
14027 (Layout::find_kept_object): New function.
14028 (Layout::Kept_section): New struct.
14029 (Layout::Signatures): Change type of map range.
14030 * object.cc (Relobj::output_section_address): New function.
14031 (Sized_relobj::include_section_group): Add new parameters. Change
14032 calls to Layout::add_comdat. Change to build table of kept comdat
14033 groups and table mapping discarded sections to kept sections.
14034 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
14035 (Sized_relobj::do_layout): Change calls to include_section_group and
14036 include_linkonce_section.
14037 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14038 value to zero when section is discarded.
14039 (Sized_relobj::map_to_kept_section): New function.
14040 * object.h (Relobj::output_section_address): New function.
14041 (Relobj::Comdat_group): New type.
14042 (Relobj::find_comdat_group): New function.
14043 (Relobj::Comdat_group_table): New type.
14044 (Relobj::Kept_comdat_section): New type.
14045 (Relobj::Kept_comdat_section_table): New type.
14046 (Relobj::add_comdat_group): New function.
14047 (Relobj::set_kept_comdat_section): New function.
14048 (Relobj::get_kept_comdat_section): New function.
14049 (Relobj::comdat_groups_): New field.
14050 (Relobj::kept_comdat_sections_): New field.
14051 (Symbol_value::input_value): Update comment.
14052 (Sized_relobj::map_to_kept_section) New function.
14053 (Sized_relobj::include_linkonce_section): Add new parameter.
14054 * target-reloc.h (Comdat_behavior): New type.
14055 (get_comdat_behavior): New function.
14056 (relocate_section): Add code to map a discarded section to the
14057 corresponding kept section when applying a relocation.
14059 2008-04-30 Craig Silverstein <csilvers@google.com>
14061 * dwarf_reader.cc (next_generation_count): New static var.
14062 (Addr2line_cache_entry): New struct.
14063 (addr2line_cache): New static var.
14064 (Dwarf_line_info::one_addr2line): Added caching.
14065 (Dwarf_line_info::clear_addr2line_cache): New function.
14066 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14067 cache-size parameter.
14068 (Dwarf_line_info::one_addr2line_cache): New function.
14069 * symtab.cc (Symbol_table::detect_odr_violations): Pass
14070 new cache-size argument to one_addr2line(), and clear cache.
14072 2008-04-28 Cary Coutant <ccoutant@google.com>
14074 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14075 R_386_PC8 relocations.
14077 2008-04-23 Ian Lance Taylor <iant@google.com>
14079 * object.cc (Sized_relobj::include_section_group): Check for
14080 invalid section group.
14082 * object.cc (make_elf_object): Correct test for 64-bit ELF file
14085 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14086 than read for file header.
14087 * archive.cc (Archive::include_member): Likewise.
14089 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
14091 * aclocal.m4: Regenerate.
14092 * configure: Regenerate.
14094 2008-04-19 Ian Lance Taylor <iant@google.com>
14096 * version.cc (version_string): Bump to 1.6.
14098 * testsuite/Makefile.am (many_sections_r_test): New target.
14099 (many_sections_r_test_SOURCES): Remove.
14100 (many_sections_r_test_DEPENDENCIES): Remove.
14101 (many_sections_r_test_LDFLAGS): Remove.
14102 (many_sections_r_test_LDADD): Remove.
14104 * object.cc (Sized_relobj::do_add_symbols): Always pass
14105 local_symbol_count_ to add_from_relobj.
14107 * testsuite/Makefile.am (many_sections_check.h): Only check one in
14108 every thousand variables.
14109 * testsuite/Makefile.in: Rebuild.
14111 * object.cc (Xindex::initialize_symtab_xindex): New function.
14112 (Xindex::read_symtab_xindex): New function.
14113 (Xindex::sym_xindex_to_shndx): New function.
14114 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14116 (Sized_relobj::do_initialize_xindex): New function.
14117 (Sized_relobj::do_read_symbols): Adjust section links.
14118 (Sized_relobj::symbol_section_and_value): Add is_ordinary
14119 parameter. Change all callers.
14120 (Sized_relobj::include_section_group): Adjust section links and
14121 symbol section indexes.
14122 (Sized_relobj::do_layout): Adjust section links.
14123 (Sized_relobj::do_count_local_symbols): Adjust section links and
14124 symbol section indexes.
14125 (Sized_relobj::do_finalize_local_symbols): Distinguish between
14126 ordinary and special symbols.
14127 (Sized_relobj::write_local_symbols): Add symtab_xindex and
14128 dynsym_xindex parameters. Change all callers. Adjust section
14129 links. Use SHN_XINDEX when needed.
14130 (Sized_relobj::get_symbol_location_info): Adjust section links.
14131 Don't get fooled by special symbols.
14132 * object.h (class Xindex): Define.
14133 (class Object): Add xindex_ parameter. Declare virtual functoin
14134 do_initialize_xindex.
14135 (Object::adjust_sym_shndx): New function.
14136 (Object::set_xindex): New protected function.
14137 (class Symbol_value): Add is_ordinary_shndx_ field.
14138 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14139 (Symbol_value::value): Assert ordinary section.
14140 (Symbol_value::initialize_input_to_output_map): Likewise.
14141 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14142 Change all callers.
14143 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
14145 (class Sized_relobj): Update declarations.
14146 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14147 parameter. Change all callers.
14148 (Sized_relobj::adjust_shndx): New function.
14149 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14151 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14152 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
14153 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
14154 (Sized_dynobj::read_dynsym_section): Adjust section links.
14155 (Sized_dynobj::read_dynamic): Likewise.
14156 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
14158 (Sized_dynobj::do_initialize_xindex): New function.
14159 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
14160 do_initialize_xindex.
14161 (Sized_dynobj::adjust_shndx): New function.
14162 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14163 dynsym_xindex_ fields.
14164 (Layout::finalize): Add a call to set_section_indexes before
14165 creating the symtab sections.
14166 (Layout::set_section_indexes): Don't do anything if the section
14167 already has a section index.
14168 (Layout::create_symtab_sections): Add shnum parameter. Change
14169 caller. Create .symtab_shndx section if needed.
14170 (Layout::create_shdrs): Add shstrtab_section parameter. Change
14172 (Layout::allocated_output_section_count): New function.
14173 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14175 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14176 fields. Update declarations.
14177 (Layout::symtab_xindex): New function.
14178 (Layout::dynsym_xindex): New function.
14179 (class Write_symbols_task): Add layout_ field.
14180 (Write_symbols_task::Write_symbols_task): Add layout parameter.
14182 * output.cc (Output_section_headers::Output_section_headers): Add
14183 shstrtab_section parameter. Change all callers.
14184 (Output_section_headers::do_sized_write): Store overflow values
14185 for section count and section string table section index in
14186 section header zero.
14187 (Output_file_header::do_sized_write): Check for overflow of
14188 section count and section string table section index.
14189 (Output_symtab_xindex::do_write): New function.
14190 (Output_symtab_xindex::endian_do_write): New function.
14191 * output.h (class Output_section_headers): Add shstrtab_section_.
14192 Update declarations.
14193 (class Output_symtab_xindex): Define.
14194 (Output_section::has_out_shndx): New function.
14195 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14197 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14198 Change all callers.
14199 (Sized_symbol::init): Likewise.
14200 (Symbol::output_section): Check for ordinary symbol.
14201 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
14202 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
14204 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14205 Change all callers. Simplify handling of symbols from sections
14206 not included in the link.
14207 (Symbol_table::add_from_dynobj): Handle ordinary symbol
14209 (Weak_alias_sorter::operator()): Assert that symbols are
14211 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14213 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14214 parameters. Change all callers.
14215 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
14216 symbol distinction. Use SHN_XINDEX when needed.
14217 (Symbol_table::write_section_symbol): Add symtab_xindex
14218 parameter. Change all callers.
14219 (Symbol_table::sized_write_section_symbol): Likewise. Use
14220 SHN_XINDEX when needed.
14221 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
14223 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
14224 (Symbol::is_defined): Check is_ordinary.
14225 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14226 (Symbol::is_absolute, Symbol::is_common): Likewise.
14227 (class Sized_symbol): Update declarations.
14228 (class Symbol_table): Update declarations.
14229 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14230 parameters. Change all callers.
14231 (Sized_symbol::override): Likewise.
14232 (Symbol_table::override): Likewise.
14233 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
14234 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
14235 is_ordinary, and orig_st_shndx parameters. Change all callers.
14236 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14237 to be in an ordinary section.
14238 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14239 object and is_ordinary parameters. Change all callers.
14240 (Sized_dwarf_line_info::read_relocs): Add object parameter.
14241 Change all callers. Don't add undefined or non-ordinary symbols
14243 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14244 Change all callers.
14245 * dwarf_reader.h (class Sized_dwarf_line_info): Update
14247 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14248 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14249 (Sized_relobj::relocate_sections): Likewise.
14250 * target-reloc.h (scan_relocs): Adjust section symbol index.
14251 (scan_relocatable_relocs): Likewise.
14252 * i386.cc (Scan::local): Check for ordinary symbols.
14253 * sparc.cc (Scan::local): Likewise.
14254 * x86_64.cc (Scan::local): Likewise.
14255 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14256 to symbol_section_and_value.
14257 * testsuite/many_sections_test.cc: New file.
14258 * testsuite/Makefile.am (BUILT_SOURCES): Define.
14259 (check_PROGRAMS): Add many_sections_test.
14260 (many_sections_test_SOURCES): Define.
14261 (many_sections_test_DEPENDENCIES): Define.
14262 (many_sections_test_LDFLAGS): Define.
14263 (BUILT_SOURCES): Add many_sections_define.h.
14264 (many_sections_define.h): New target.
14265 (BUILT_SOURCES): Add many_sections_check.h.
14266 (many_sections_check.h): New target.
14267 (check_PROGRAMS): Add many_sections_r_test.
14268 (many_sections_r_test_SOURCES): Define.
14269 (many_sections_r_test_DEPENDENCIES): Define.
14270 (many_sections_r_test_LDFLAGS): Define.
14271 (many_sections_r_test_LDADD): Define.
14272 (many_sections_r_test.o): New target.
14273 * testsuite/Makefile.in: Rebuild.
14275 2008-04-17 Cary Coutant <ccoutant@google.com>
14277 * errors.cc (Errors::info): New function.
14278 (gold_info): New function.
14279 * errors.h (Errors::info): New function.
14280 * gold.h (gold_info): New function.
14281 * object.cc (Input_objects::add_object): Print trace output.
14282 * options.cc (options::parse_set): New function.
14283 (General_options::parse_wrap): Deleted.
14284 (General_options::General_options): Deleted initializer.
14285 * options.h (options::String_set): New typedef.
14286 (options::parse_set): New function.
14287 (DEFINE_set): New macro.
14288 (General_options::wrap): Changed to use DEFINE_set. Changed
14289 callers of any_wrap_symbols and is_wrap_symbol.
14290 (General_options::trace, General_options::trace_symbol):
14292 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14293 (General_options::wrap_symbols_): Deleted.
14294 * symtab.cc (Symbol_table::add_from_object): Print trace output.
14296 2008-04-17 David S. Miller <davem@davemloft.net>
14298 * options.cc (General_options::parse_V): New function.
14299 * options.h: Add entries for -V and -Qy.
14301 2008-04-17 Ian Lance Taylor <iant@google.com>
14303 * common.cc (Symbol_table::allocate_commons): Remove options
14304 parameter. Change caller.
14305 (Symbol_table::do_allocate_commons): Remove options parameter.
14306 Change caller. Just call do_allocate_commons_list twice.
14307 (Symbol_table::do_allocate_commons_list): New function, broken out
14308 of do_allocate_commons.
14309 * common.h (class Allocate_commons_task): Remove options_ field.
14310 Update constructor.
14311 * symtab.cc (Symbol_table::Symbol_table): Initialize
14313 (Symbol_table::add_from_object): Put TLS common symbols on
14315 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14316 which are IN_OUTPUT_DATA.
14317 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
14318 allocate_commons and do_allocate_commons declarations. Declare
14319 do_allocate_commons_list.
14320 * gold.cc (queue_middle_tasks): Update creation of
14321 Allocate_commons_task to not pass options.
14322 * testsuite/Makefile.am (INCLUDES): Add -I.. .
14323 (TLS_TEST_C_FLAGS): New variable.
14324 (tls_test_c_pic.o): New target.
14325 (tls_test_shared.so): Link in tls_test_c_pic.o.
14326 (tls_test_c_pic_ie.o): New target.
14327 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14328 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14329 (tls_test_c.o): New target.
14330 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14331 (tls_pic_test_LDADD): Likewise.
14332 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14333 (tls_shared_gd_to_ie_test_LDADD): Likewise.
14334 (tls_test_c_gnu2.o): New target.
14335 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14337 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14338 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14339 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14340 * testsuite/tls_test.cc: Include "config.h".
14341 (t_last): Call t11_last.
14342 * testsuite/tls_test.h (t11, t11_last): Declare.
14343 * testsuite/tls_test_c.c: New file.
14344 * testsuite/tls_test_main.cc (thread_routine): Call t11.
14345 * configure.ac: Check for OpenMP support.
14346 * configure, config.in, Makefile.in: Rebuild.
14347 * testsuite/Makefile.in: Rebuild.
14349 2008-04-16 Cary Coutant <ccoutant@google.com>
14351 * i386.cc (Target_i386::define_tls_base_symbol): New function.
14352 (Target_i386::tls_base_symbol_defined_): New field.
14353 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14354 (Target_i386::Scan::global): Likewise.
14355 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14356 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14357 (Target_x86_64::tls_base_symbol_defined_): New field.
14358 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14359 (Target_x86_64::Scan::global): Likewise.
14361 2008-04-16 Cary Coutant <ccoutant@google.com>
14363 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14364 (Symbol::needs_plt_entry): Allow weak undefined symbols.
14365 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14366 building shared libraries.
14367 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14368 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14369 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14370 * testsuite/Makefile.in: Rebuild.
14371 * testsuite/weak_undef.h: New file.
14372 * testsuite/weak_undef_file1.cc: Add extra test cases.
14373 * testsuite/weak_undef_file2.cc: Likewise.
14374 * testsuite/weak_undef_test.cc: Likewise.
14376 2008-04-16 David S. Miller <davem@davemloft.net>
14378 * sparc.cc (Target_sparc::Scan): Change from struct to class.
14379 Add issued_non_pic_error_ field. Declare check_non_pic.
14380 (Target_sparc::Scan::check_non_pic): New function.
14381 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14382 (Target_sparc::Scan::global): Likewise.
14384 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14385 * configure: Rebuild.
14387 * options.h (DEFINE_enable): New macro.
14388 (new_dtags): New enable option.
14389 (initfirst, interpose, loadfltr, nodefaultlib,
14390 nodelete, nodlopen, nodump): New -z options.
14391 * layout.cc (Layout:finish_dynamic_section): If new
14392 dtags enabled, emit DT_RUNPATH. Also, emit a
14393 DT_FLAGS_1 containing any specified -z flags.
14395 2008-04-16 Ian Lance Taylor <iant@google.com>
14397 * copy-relocs.cc: New file.
14398 * copy-relocs.h: New file.
14399 * reloc.cc: Remove Copy_relocs code.
14400 * reloc.h: Likewise.
14401 * reloc-types.h (struct Reloc_types) [both versions]: Add
14402 get_reloc_addend_noerror.
14403 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14404 variants of add_global which take an addend which must be zero.
14405 * i386.cc: Include "copy-relocs.h".
14406 (class Target_i386): Change type of copy_relocs_ to variable,
14407 update initializer.
14408 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14409 Change all callers.
14410 (Target_i386::do_finalize_sections): Change handling of
14412 * sparc.cc: Include "copy-relocs.h".
14413 (class Target_sparc): Change type of copy_relocs_ to variable,
14414 update initializer.
14415 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14416 Change all callers.
14417 (Target_sparc::do_finalize_sections): Change handling of
14419 * x86_64.cc: Include "copy-relocs.h".
14420 (class Target_x86_64): Change type of copy_relocs_ to variable,
14421 update initializer.
14422 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14423 class. Change all callers.
14424 (Target_x86_64::do_finalize_sections): Change handling of
14426 * Makefile.am (CCFILES): Add copy-relocs.cc.
14427 (HFILES): Add copy-relocs.h.
14429 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14431 * testsuite/script_test_4.sh: Permit leading zeroes.
14433 2008-04-15 Ian Lance Taylor <iant@google.com>
14435 * script-sections.cc (Script_sections::create_segments): Use
14436 header_size_adjustment even when there is enough room for the
14438 * testsuite/script_test_4.sh: New file.
14439 * testsuite/script_test_4.t: New file.
14440 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14441 (check_DATA): Add script_test_4.stdout.
14442 (MOSTLYCLEANFILES): Likewise.
14443 (script_test_4): New target.
14444 (script_test_4.stdout): New target.
14445 * testsuite/Makefile.in: Rebuild.
14447 * sparc.cc: Add definitions for Output_data_plt_sparc class
14450 2008-04-14 David S. Miller <davem@davemloft.net>
14452 * sparc.cc: New file.
14453 * Makefile.am (TARGETSOURCES): Add sparc.cc
14454 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14455 * configure.tgt: Document targ_extra_size and
14456 targ_extra_big_endian. Add entries for sparc-* and
14458 * configure.ac: Handle targ_extra_size and
14459 targ_extra_big_endian.
14460 * Makefile.in: Rebuild.
14461 * configure: Likewise.
14462 * po/POTFILES.in: Likewise.
14463 * po/gold.pot: Likewise.
14465 2008-04-14 Ian Lance Taylor <iant@google.com>
14467 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14468 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14469 in the name/type/flags to section mapping. Don't call
14470 allocate_output_section.
14471 (Layout::choose_output_section): Change parameter from adjust_name
14472 to is_input_section. Don't permit input sections after sections
14473 are attached to segments. Don't call allocate_output_section.
14474 (Layout::layout_eh_frame): Call update_flags_for_input_section,
14475 not write_enable_output_section.
14476 (Layout::make_output_section): Don't push to
14477 unattached_section_list_ nor call attach_to_segment. Call
14478 attach_section_to_segment if sections are attached.
14479 (Layout::attach_sections_to_segments): New function.
14480 (Layout::attach_section_to_segment): New function.
14481 (Layout::attach_allocated_section_to_segment): Rename from
14482 attach_to_segment. Remove flags parameter.
14483 (Layout::allocate_output_section): Remove function.
14484 (Layout::write_enable_output_section): Remove function.
14485 * layout.h (class Layout): Update for above changes. Add new
14486 field sections_are_attached_.
14487 * output.h (Output_section::update_flags_for_input_section): New
14489 * output.cc (Output_section::add_input_section): Call
14490 update_flags_for_input_section.
14491 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14493 2008-04-11 Cary Coutant <ccoutant@google.com>
14495 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14496 thought unnecessary.
14497 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14499 2008-04-11 Ian Lance Taylor <iant@google.com>
14501 * output.h (class Output_section_data): Remove inline definition
14503 * output.cc (Output_section_data::set_addralign): New function.
14505 2008-04-11 Cary Coutant <ccoutant@google.com>
14507 Add support for TLS descriptors for i386 and x86_64.
14508 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14509 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14510 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14512 (Target_i386::got_mod_index_entry): Remove unnecessary code.
14513 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14514 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
14516 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14517 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14518 Fix problem with initial-exec relocations.
14519 (Target_i386::Relocate::relocate_tls): Likewise.
14520 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14522 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14523 support for section-plus-offset dynamic table entries.
14524 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14525 (Output_data_dynamic::Dynamic_entry): Add support for
14526 section-plus-offset dynamic table entries.
14527 (Output_data_dynamic::Classification): Likewise.
14528 (Output_data_dynamic::classification_): Renamed offset_.
14529 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14530 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14531 (Target_x86_64::make_plt_section): New function.
14532 (Target_x86_64::reserve_tlsdesc_entries): New function.
14533 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14534 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14535 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14536 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14537 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14538 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14539 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14540 add extra PLT entry for TLS descriptors.
14541 (Output_data_plt_x86_64::got_): New field.
14542 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14543 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14545 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14547 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14548 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14549 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14550 R_386_TLS_DESC_CALL relocations.
14551 (Target_x86_64::Scan::global): Likewise.
14552 (Target_x86_64::do_finalize_sections): Add dynamic table entries
14553 for TLS descriptors.
14554 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14555 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14556 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14557 GD-to-IE relaxation.
14558 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14559 and TLS_DESCRIPTORS.
14560 * Makefile.in: Rebuild.
14561 * configure: Rebuild.
14562 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14563 (tls_test_shared2.so): New target.
14564 (tls_shared_gd_to_ie_test_SOURCES): New variable.
14565 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14566 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14567 (tls_shared_gd_to_ie_test_LDADD): New variable.
14568 (tls_shared_gnu2_gd_to_ie_test): New target.
14569 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14571 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14572 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14573 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14574 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14575 (tls_shared_gnu2_test): New target.
14576 (tls_test_gnu2_shared.so): New target.
14577 (tls_shared_gnu2_test_SOURCES): New variable.
14578 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14579 (tls_shared_gnu2_test_LDFLAGS): New variable.
14580 (tls_shared_gnu2_test_LDADD): New variable.
14581 * testsuite/Makefile.in: Rebuild.
14582 * testsuite/Makefile.
14584 2008-04-11 Ian Lance Taylor <iant@google.com>
14586 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14588 * testsuite/Makefile.in: Rebuild.
14590 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14592 * testsuite/script_test_2.cc (main): Adjust test.
14594 2008-04-11 David S. Miller <davem@davemloft.net>
14595 Ian Lance Taylor <iant@google.com>
14597 * options.h (General_options): Add entries for '-Y' and
14599 * options.cc (General_options:finalize): If -Y was used, add those
14600 entries to the library path instead of the default "/lib" and
14603 2008-04-11 David S. Miller <davem@davemloft.net>
14605 * testsuite/justsyms.t: Start at 0x100.
14606 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14607 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14609 * testsuite/script_test_2.cc: Adjust string and section length
14612 2008-04-09 Ian Lance Taylor <iant@google.com>
14615 * script-sections.cc (Sections_element::allocate_to_segment): Add
14617 (Output_section_definition::allocate_to_segment): Likewise.
14618 (Orphan_output_section::allocate_to_segment): Likewise.
14619 (Script_sections::attach_sections_using_phdrs_clause): Don't
14620 propagate non-PT_LOAD segments to orphan sections.
14621 * testsuite/Makefile.am (script_test_3.stdout): Generate using
14622 readelf rather than objdump.
14623 * testsuite/script_test_3.sh: Adjust accordingly. Test that
14624 .interp section and PT_INTERP segment are the same size.
14625 * testsuite/Makefile.in: Rebuild.
14627 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14628 aliases for symbols defined in the same object.
14629 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14630 (weak_alias_test_SOURCES): New variable.
14631 (weak_alias_test_DEPENDENCIES): New variable.
14632 (weak_alias_test_LDFLAGS): New variable.
14633 (weak_alias_test_LDADD): New variable.
14634 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14635 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14636 (weak_alias_test_3.o): New target.
14637 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14638 * testsuite/weak_alias_test_main.cc: New file.
14639 * testsuite/weak_alias_test_1.cc: New file.
14640 * testsuite/weak_alias_test_2.cc: New file.
14641 * testsuite/weak_alias_test_3.cc: New file.
14643 2008-04-08 Ian Lance Taylor <iant@google.com>
14645 * options.h (class General_options): Add --noinhibit-exec option.
14646 * main.cc (main): Check --noinhibit-exec.
14648 * options.h (class General_options): Define --wrap as a special
14649 option. Add wrap_symbols_ field.
14650 (General_options::any_wrap_symbols): New function.
14651 (General_options::is_wrap_symbol): New function.
14652 * options.cc (General_options::parse_wrap): New function.
14653 (General_options::General_options): Initialize wrap_symbols_.
14654 * symtab.cc (Symbol_table::wrap_symbol): New function.
14655 (Symbol_table::add_from_object): Handle --wrap.
14656 * symtab.h (class Symbol_table): Declare wrap_symbol.
14657 * target.h (Target::wrap_char): New function.
14658 (Target::Target_info): Add wrap_char field.
14659 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14660 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14661 * testsuite/testfile.cc (Target_test::test_target_info):
14664 * errors.cc (Errors::undefined_symbol): Mention symbol version if
14667 * layout.h (class Layout): Add added_eh_frame_data_ field.
14668 * layout.cc (Layout::Layout): Initialize new field.
14669 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14670 output section until we find a section we merged successfully.
14671 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14672 that the size be non-zero.
14674 * merge.cc (Object_merge_map::get_output_offset): Remove inline
14677 2008-04-08 Craig Silverstein <csilvers@google.com>
14679 * configure.ac: Export new conditional variable HAVE_ZLIB.
14680 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14682 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14683 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14685 2008-04-07 Ian Lance Taylor <iant@google.com>
14687 * version.cc (version_string): Set to "1.5".
14689 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14690 Add issued_non_pic_error_ field. Declare check_non_pic.
14691 (Target_x86_64::Scan::check_non_pic): New function.
14692 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14693 (Target_x86_64::Scan::global): Likewise.
14695 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14696 addend parameter. Change caller. Handle merge sections.
14697 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14698 Address to Addend. Don't add in the result of
14699 local_section_offset, pass down the addend and use the returned
14701 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14702 Update declarations of local_section_offset and symbol_value.
14703 * testsuite/two_file_test_1.cc (t18): New function.
14704 * testsuite/two_file_test_2.cc (f18): New function.
14705 * testsuite/two_file_test_main.cc (main): Call t18.
14706 * testsuite/two_file_test.h (t18, f18): Declare.
14708 * configure.ac: Don't test for objdump, c++filt, or readelf.
14709 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14711 (TEST_READELF): New variable.
14712 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14713 (check_PROGRAMS): Add two_file_strip_test.
14714 (two_file_strip_test): New target.
14715 (check_PROGRAMS): Add two_file_same_shared_strip_test.
14716 (two_file_same_shared_strip_test_SOURCES): New variable.
14717 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14718 (two_file_same_shared_strip_test_LDFLAGS): New variable.
14719 (two_file_same_shared_strip_test_LDADD): New variable.
14720 (two_file_shared_strip.so): New target.
14721 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14722 (ver_test_5.syms, ver_test_7.syms): Likewise.
14723 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14724 (strip_test_3.stdout): Use TEST_OBJDUMP.
14725 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14727 2008-04-04 Cary Coutant <ccoutant@google.com>
14729 * symtab.h (Symbol::is_weak_undefined): New function.
14730 (Symbol::is_strong_undefined): New function.
14731 (Symbol::is_absolute): New function.
14732 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14733 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14735 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14736 (weak_undef_test): New target.
14737 * testsuite/Makefile.in: Rebuild.
14738 * testsuite/weak_undef_file1.cc: New file.
14739 * testsuite/weak_undef_file2.cc: New file.
14740 * testsuite/weak_undef_test.cc: New file.
14742 2008-04-03 Craig Silverstein <csilvers@google.com>
14744 * compressed_output.h (class Output_compressed_section): Use
14746 * compressed_output.cc (zlib_compress): Use unsigned buffers,
14748 (zlib_compressed_suffix): Removed.
14749 (Output_compressed_section::set_final_data_size): Use unsigned
14751 * testsuite/Makefile.am (flagstest_compress_debug_sections):
14752 Fix linker invocation.
14753 (flagstest_o_specialfile_and_compress_debug_sections):
14755 * testsuite/Makefile.in: Regenerated.
14757 2008-04-02 David S. Miller <davem@davemloft.net>
14759 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14760 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14762 2008-04-02 Craig Silverstein <csilvers@google.com>
14766 2008-04-02 Ian Lance Taylor <iant@google.com>
14768 * fileread.cc (File_read::find_view): Add byteshift and vshifted
14769 parameters. Update for new key type to views_. Change all
14771 (File_read::read): Adjust for byteshift in returned view.
14772 (File_read::add_view): New function, broken out of
14773 find_and_make_view.
14774 (File_read::make_view): New function, broken out of
14775 find_and_make_view.
14776 (File_read::find_or_make_view): Add offset and aligned
14777 parameters. Rewrite accordingly. Change all callers.
14778 (File_read::get_view): Add offset and aligned parameters. Adjust
14779 for byteshift in return value.
14780 (File_read::get_lasting_view): Likewise.
14781 * fileread.h (class File_read): Update declarations.
14782 (class File_read::View): Add byteshift_ field. Add byteshift to
14783 constructor. Add byteshift method.
14784 * archive.h (Archive::clear_uncached_views): New function.
14785 (Archive::get_view): Add aligned parameter. Change all callers.
14786 * object.h (Object::get_view): Add aligned parameter. Change all
14788 (Object::get_lasting_view): Likewise.
14790 * fileread.cc (File_read::release): Don't call clear_views if
14791 there are multiple objects.
14792 * fileread.h (File_read::clear_uncached_views): New function.
14793 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14796 2008-03-31 Cary Coutant <ccoutant@google.com>
14798 Add thin archive support.
14799 * archive.cc (Archive::armagt): New const.
14800 (Archive::setup): Remove task parameter and calls to unlock.
14801 (Archive::unlock_nested_archives): New function.
14802 (Archive::read_header): Add nested_off parameter. Change
14804 (Archive::interpret_header): Likewise.
14805 (Archive::include_all_members): Change to handle thin
14807 (Archive::include_member): Likewise.
14808 * archive.h (Archive::Archive): Add new parameters and
14810 (Archive::armagt): New const.
14811 (Archive::setup): Remove task parameter.
14812 (Archive::unlock_nested_archives): New function.
14813 (Archive::read_header): Add nested_off parameter.
14814 (Archive::interpret_header): Likewise.
14815 (Archive::Nested_archive_table): New typedef.
14816 (Archive::is_thin_archive_): New field.
14817 (Archive::nested_archives_): New field.
14818 (Archive::options_): New field.
14819 (Archive::dirpath_): New field.
14820 (Archive::task_): New field.
14821 * readsyms.cc (Read_symbols::do_read_symbols): Add check
14822 for thin archives. Pass additional parameters to
14823 Archive::Archive. Unlock the archive file after calling
14826 2008-03-29 Ian Lance Taylor <iant@google.com>
14828 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14829 version symbol to be local.
14830 * testsuite/ver_test_4.sh: New file.
14831 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14832 (check_DATA): Add ver_test_4.syms.
14833 (ver_test_4.syms): New target.
14834 * testsuite/Makefile.in: Rebuild.
14837 (Output_section::Input_section_sort_entry::has_priority): New
14839 (Output_section::Input_section_sort_entry::match_file_name): New
14841 (Output_section::Input_section_sort_entry::match_section_name):
14843 (Output_section::Input_section_sort_entry::match_section_name_prefix):
14845 (Output_section::Input_section_sort_entry::match_section_file):
14847 (Output_section::Input_section_sort_compare::operator()): Rewrite
14848 using new Input_section_sort_entry functions. Sort crtbegin and
14849 crtend first. Sort sections with no priority before sections with
14851 * testsuite/initpri1.c (d3): Check j != 4.
14852 (cd5): New constructor/destructor function.
14853 (main): Check j != 2.
14855 * symtab.cc (Symbol_table::add_from_object): If we don't use the
14856 new symbol when resolving, don't call set_is_default.
14857 * testsuite/ver_test_7.cc: New file.
14858 * testsuite/ver_test_7.sh: New file.
14859 * testsuite/Makefile.am (ver_test_7.so): New target.
14860 (ver_test_7.o): New target.
14861 (check_SCRIPTS): Add ver_test_7.sh.
14862 (check_DATA): Add ver_test_7.syms.
14863 (ver_test_7.syms): New target.
14865 2008-03-28 Ian Lance Taylor <iant@google.com>
14867 * layout.cc (Layout::layout): If we see an input section with a
14868 name that needs sorting, set the must_sort flag for the output
14870 (Layout::make_output_section): If the name of the output section
14871 indicates that it might require sorting, set the may_sort flag.
14872 * output.h (Output_section::may_sort_attached_input_sections): New
14874 (Output_section::set_may_sort_attached_input_sections): New
14876 (Output_section::must_sort_attached_input_sections): New
14878 (Output_section::set_must_sort_attached_input_sections): New
14880 (class Output_section): Declare Input_section_sort_entry. Define
14881 Input_section_sort_compare. Declare
14882 sort_attached_input_sections. Add new fields:
14883 may_sort_attached_input_sections_,
14884 must_sort_attached_input_sections_,
14885 attached_input_sections_are_sorted_.
14886 * output.cc (Output_section::Output_section): Initialize new
14888 (Output_section::add_input_section): Add an entry to
14889 input_sections_ if may_sort or must_sort are true.
14890 (Output_section::set_final_data_size): Call
14891 sort_attached_input_sections if necessary.
14892 (Output_section::Input_section_sort_entry): Define new class.
14893 (Output_section::Input_section_sort_compare::operator()): New
14895 (Output_section::sort_attached_input_sections): New function.
14896 * configure.ac: Check whether the compiler supports constructor
14897 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
14898 * testsuite/initpri1.c: New file.
14899 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14900 CONSTRUCTOR_PRIORITY.
14901 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14902 (initpri1_LDFLAGS): New variable.
14903 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14905 2008-03-27 Ian Lance Taylor <iant@google.com>
14907 * common.cc (Sort_commons::operator): Correct sorting algorithm.
14908 * testsuite/common_test_1.c: New file.
14909 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14910 (common_test_1_SOURCES): New variable.
14911 (common_test_1_DEPENDENCIES): New variable.
14912 (common_test_1_LDFLAGS): New variable.
14914 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14915 and commons_ correctly when NAME/VERSION does not override
14917 * testsuite/ver_test_6.c: New file.
14918 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14919 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14920 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14922 2008-03-26 Ian Lance Taylor <iant@google.com>
14924 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14925 of an undefined symbol from a version script.
14926 * testsuite/Makefile.am (ver_test_5.so): New target.
14927 (ver_test_5.o): New target.
14928 (check_SCRIPTS): Add ver_test_5.sh.
14929 (check_DATA): Add ver_test_5.syms.
14930 (ver_test_5.syms): New target.
14931 * testsuite/ver_test_5.cc: New file.
14932 * testsuite/ver_test_5.script: New file.
14933 * testsuite/ver_test_5.sh: New file.
14934 * Makefile.in, testsuite/Makefile.in: Rebuild.
14937 Fix problems building gold with gcc 4.3.0.
14938 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14939 (gold_error_at_location, gold_warning_at_location): Use it.
14940 * configure.ac: Check whether we can compile and use a template
14941 function with a printf attribute.
14942 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14943 when jumping over bytes.
14944 * object.cc: Instantiate Object::read_section_data.
14945 * debug.h: Include <cstring>
14946 * dwarf_reader.cc: Include <algorithm>
14947 * main.cc: Include <cstring>.
14948 * options.cc: Include <cstring>.
14949 * output.cc: Include <cstring>.
14950 * script.cc: Include <cstring>.
14951 * script.h: Include <string>.
14952 * symtab.cc: Include <cstring> and <algorithm>.
14953 * target-select.cc: Include <cstring>.
14954 * version.cc: Include <string>.
14955 * testsuite/testmain.cc: Include <cstdlib>.
14956 * configure, config.in: Rebuild.
14958 2008-03-25 Ian Lance Taylor <iant@google.com>
14960 * options.cc: Include "../bfd/bfdver.h".
14961 (options::help): Print bug reporting address.
14963 * version.cc (print_version): Adjust output for current value of
14964 BFD_VERSION_STRING.
14968 * options.cc (options::help): Print list of supported targets.
14969 * target-select.h: Include <vector>.
14970 (class Target_selector): Make machine_, size_, and is_big_endian_
14971 fields const. Add bfd_name_ and instantiated_target_ fields.
14972 (Target_selector::Target_selector): Add bfd_name parameter.
14973 (Target_selector::recognize): Make non-virtual, call
14975 (Target_selector::recognize_by_name): Make non-virtual, call
14976 do_recognize_by_name.
14977 (Target_selector::supported_names): New function.
14978 (Target_selector::bfd_name): New function.
14979 (Target_selector::do_instantiate_target): New pure virtual
14981 (Target_selector::do_recognize): New virtual function.
14982 (Target_selector::do_recognize_by_name): New virtual function.
14983 (Target_selector::instantiate_target): New private function.
14984 (supported_target_names): Declare.
14985 * target-select.cc (Target_selector::Target_selector): Update for
14986 new parameter and fields.
14987 (select_target_by_name): Check that the name matches before
14988 calling recognize_by_name.
14989 (supported_target_names): New function.
14990 * i386.cc (class Target_selector_i386): Update Target_selector
14991 constructor call. Remove recognize and recognize_by_name. Add
14992 do_instantiate_target.
14993 * x86_64.cc (class Target_selector_x86_64): Likewise.
14994 * testsuite/testfile.cc (class Target_selector_test): Update for
14995 changes to Target_selector.
14997 * README: Rewrite, with some notes on unsupported features.
14999 2008-03-24 Cary Coutant <ccoutant@google.com>
15001 * i386.cc (Target_i386::Got_type): New enum declaration.
15002 (Target_i386::Scan::local): Updated callers of Output_data_got
15004 (Target_i386::Scan::global): Likewise.
15005 (Target_i386::Relocate::relocate): Likewise.
15006 (Target_i386::Relocate::relocate_tls): Likewise.
15007 * object.h (Got_offset_list): New class.
15008 (Sized_relobj::local_has_got_offset): Added got_type parameter.
15009 (Sized_relobj::local_got_offset): Likewise.
15010 (Sized_relobj::set_local_got_offset): Likewise.
15011 (Sized_relobj::local_has_tls_got_offset): Removed.
15012 (Sized_relobj::local_tls_got_offset): Removed.
15013 (Sized_relobj::set_local_tls_got_offset): Removed.
15014 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15015 * output.cc (Output_data_got::add_global): Added got_type parameter.
15016 (Output_data_got::add_global_with_rel): Likewise.
15017 (Output_data_got::add_global_with_rela): Likewise.
15018 (Output_data_got::add_global_pair_with_rel): New function.
15019 (Output_data_got::add_global_pair_with_rela): New function.
15020 (Output_data_got::add_local): Added got_type parameter.
15021 (Output_data_got::add_local_with_rel): Likewise.
15022 (Output_data_got::add_local_with_rela): Likewise.
15023 (Output_data_got::add_local_pair_with_rel): New function.
15024 (Output_data_got::add_local_pair_with_rela): New function.
15025 (Output_data_got::add_global_tls): Removed.
15026 (Output_data_got::add_global_tls_with_rel): Removed.
15027 (Output_data_got::add_global_tls_with_rela): Removed.
15028 (Output_data_got::add_local_tls): Removed.
15029 (Output_data_got::add_local_tls_with_rel): Removed.
15030 (Output_data_got::add_local_tls_with_rela): Removed.
15031 * output.h (Output_data_got::add_global): Added got_type parameter.
15032 (Output_data_got::add_global_with_rel): Likewise.
15033 (Output_data_got::add_global_with_rela): Likewise.
15034 (Output_data_got::add_global_pair_with_rel): New function.
15035 (Output_data_got::add_global_pair_with_rela): New function.
15036 (Output_data_got::add_local): Added got_type parameter.
15037 (Output_data_got::add_local_with_rel): Likewise.
15038 (Output_data_got::add_local_with_rela): Likewise.
15039 (Output_data_got::add_local_pair_with_rel): New function.
15040 (Output_data_got::add_local_pair_with_rela): New function.
15041 (Output_data_got::add_global_tls): Removed.
15042 (Output_data_got::add_global_tls_with_rel): Removed.
15043 (Output_data_got::add_global_tls_with_rela): Removed.
15044 (Output_data_got::add_local_tls): Removed.
15045 (Output_data_got::add_local_tls_with_rel): Removed.
15046 (Output_data_got::add_local_tls_with_rela): Removed.
15047 * resolve.cc (Symbol::override_base_with_special): Removed
15048 reference to has_got_offset_ field.
15049 * symtab.cc (Symbol::init_fields): Replaced initialization
15050 of got_offset_ with got_offsets_. Removed initialization
15052 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15053 (Symbol::got_offset): Likewise.
15054 (Symbol::set_got_offset): Likewise.
15055 (Symbol::has_tls_got_offset): Removed.
15056 (Symbol::tls_got_offset): Removed.
15057 (Symbol::set_tls_got_offset): Removed.
15058 (Symbol::got_offset_): Removed.
15059 (Symbol::tls_mod_got_offset_): Removed.
15060 (Symbol::tls_pair_got_offset_): Removed.
15061 (Symbol::got_offsets_): New field.
15062 (Symbol::has_got_offset): Removed.
15063 (Symbol::has_tls_mod_got_offset): Removed.
15064 (Symbol::has_tls_pair_got_offset): Removed.
15065 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15066 (Target_x86_64::Scan::local): Updated callers of Output_data_got
15068 (Target_x86_64::Scan::global): Likewise.
15069 (Target_x86_64::Relocate::relocate): Likewise.
15070 (Target_x86_64::Relocate::relocate_tls): Likewise.
15072 2008-03-25 Ben Elliston <bje@au.ibm.com>
15074 * yyscript.y: Fix spelling error in comment.
15076 2008-03-24 Ian Lance Taylor <iant@google.com>
15078 * options.h (class General_options): Define build_id option.
15079 * layout.h (class Layout): Declare write_build_id, create_note,
15080 create_build_id. Add build_id_note_ member.
15081 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15082 "libiberty.h", "md5.h", "sha1.h".
15083 (Layout::Layout): Initialize eh_frame_data_,
15084 eh_frame_hdr_section_, and build_id_note_.
15085 (Layout::finalize): Call create_build_id.
15086 (Layout::create_note): New function, broken out of
15087 Layout::create_gold_note.
15088 (Layout::create_gold_note): Call create_note.
15089 (Layout::create_build_id): New function.
15090 (Layout::write_build_id): New function.
15091 (Close_task_runner::run): Call write_build_id.
15093 * x86_64.cc: Correct license to GPLv3.
15095 2008-03-23 Ian Lance Taylor <iant@google.com>
15097 * options.cc: Include "demangle.h".
15098 (parse_optional_string): New function.
15099 (parse_long_option): Handle takes_optional_argument.
15100 (parse_short_option): Update dash_z initializer. Handle
15101 takes_optional_argument.
15102 (General_options::General_options): Initialize do_demangle_.
15103 (General_options::finalize): Set do_demangle_. Handle demangling
15105 * options.h (parse_optional_string): Declare.
15106 (struct One_option): Add optional_arg field. Update constructor.
15107 Update call constructor calls. Add takes_optional_argument
15109 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
15110 (DEFINE_optional_string): Define.
15111 (General_options::demangle): Change from DEFINE_bool to
15112 DEFINE_optional_string.
15113 (General_options::no_demangle): New function.
15114 (General_options::do_demangle): New function.
15115 (General_options::set_do_demangle): New function.
15116 (General_options::execstack_status_): Move definition to end of
15118 (General_options::static_): Likewise.
15119 (General_options::do_demangle_): New field.
15120 * object.cc (big_endian>::get_symbol_location_info): Call
15121 Options::do_demangle, not Options::demangle.
15122 * symtab.cc (demangle): Likewise.
15124 2008-03-22 Ian Lance Taylor <iant@google.com>
15126 * gold.h: Include <cstddef> and <sys/types.h>
15127 * options.h: Include <cstring>.
15129 2008-03-21 Ian Lance Taylor <iant@google.com>
15131 * Added source code to GNU binutils.
15133 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15135 Copying and distribution of this file, with or without modification,
15136 are permitted in any medium without royalty provided the copyright
15137 notice and this notice are preserved.
15143 version-control: never