gold/
[binutils-gdb.git] / gold / ChangeLog
1 2013-10-11 Roland McGrath <mcgrathr@google.com>
2
3 * testsuite/undef_symbol.cc (Foo::get_a): New method.
4
5 * configure.ac (MERGE_CONSTANTS_FLAG): New check.
6 * configure: Regenerate.
7 * Makefile.in: Regenerate.
8 * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
9 * testsuite/merge_string_literals_2.c: Likewise.
10 * testsuite/Makefile.am
11 (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
12 (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
13 literal -fmerge-constants.
14 * testsuite/Makefile.in: Regenerate.
15
16 * i386.cc (Target_i386): Remove unused member dynbss_.
17 * arm.cc (Target_arm): Likewise.
18 * powerpc.cc (Target_powerpc): Likewise.
19 * sparc.cc (Target_sparc): Likewise.
20 * tilegx.cc (Target_tilegx): Likewise.
21 * x86_64.cc (Target_x86_64): Likewise.
22 * dwarf_reader.h (Dwarf_info_reader): Remove unused members
23 type_signature_, type_offset_.
24 * plugin.h (Plugin_hook): Remove unused member layout_.
25 * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
26 mapfile_.
27 (Read_member): Remove unused members input_objects_, symtab_,
28 mapfile_, layout_.
29 (Check_library): Remove unused member symtab_.
30 * archive.h (Lib_group): Remove unused member lib_.
31 * archive.cc (Lib_group::Lib_group): Update initializer.
32 * incremental.h (Incremental_binary): Remove unused member target_.
33 (Incremental_script_entry): Removed unused member script_.
34 * layout.h (Write_symbols_task): Remove unused member input_objects_.
35 * icf.h (Icf): Remove unused member num_tracked_relocs.
36
37 * gold-threads.h (Once): Conditionalize member was_run_lock_ on
38 [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
39 its only use.
40 * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
41
42 * archive.h: Use struct rather than class for forward declaration
43 of Read_symbols_data.
44
45 2013-10-07 Cary Coutant <ccoutant@google.com>
46
47 PR gold/16010
48 * testsuite/Makefile.am (icf_test): Fix dependencies.
49 (icf_safe_test): Likewise.
50 (icf_safe_so_test): Likewise.
51 (large_symbol_alignment): Add empty _LDADD rule.
52 * testsuite/Makefile.in: Regenerate.
53
54 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
55
56 PR gold/15927
57 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
58 relocation for R_X86_64_32 on x32.
59
60 2013-08-27 Roland McGrath <mcgrathr@google.com>
61
62 * output.cc (Output_segment::set_section_addresses): Take new
63 Target* argument. If target->isolate_execinstr() and the segment
64 is executable and starts at a target->abi_pagesize() boundary,
65 pad its end out to a target->abi_pagesize() boundary with code fill.
66 * output.h (Output_segment::set_section_addresses): Update decl.
67 * layout.h (Layout::check_output_data_for_reset_values): Take new
68 argument RELAX_OUTPUTS.
69 (Layout): New member relax_output_list_.
70 (Layout::add_relax_output): New method.
71 * layout.cc (Layout::Layout): Update constructor.
72 (Layout::reset_relax_output): New method.
73 (Layout::clean_up_after_relaxation): Call it.
74 (Layout::prepare_for_relaxation): Update caller.
75 (Layout::set_segment_offsets): Update callers of set_section_addresses.
76 Call reset_relax_output before re-processing segments for
77 isolate_execinstr case.
78 (Layout::write_data): Handle relax_output_list_.
79 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
80 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
81
82 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
83
84 PR binutils/15834
85 * object.h: Fix typos.
86
87 2013-08-16 Roland McGrath <mcgrathr@google.com>
88
89 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
90 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
91
92 2013-08-07 Cary Coutant <ccoutant@google.com>
93
94 Revert support for v2 DWP files:
95
96 2013-03-01 Cary Coutant <ccoutant@google.com>
97
98 Add dwp support for v2 DWARF package file format.
99 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
100 tu_length parameter. Adjust all callers.
101 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
102 * dwp.cc: Include dwarf.h.
103 (Section_bounds): New struct type.
104 (Unit_set): New struct type.
105 (Dwo_file::Dwo_file): Initialize new data member.
106 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
107 Combine and rename to...
108 (Dwo_file::read_unit_index): ...this.
109 (Dwo_file::sized_read_compunit_index)
110 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
111 (Dwo_file::sized_read_unit_index): ...this.
112 (Dwo_file::copy_section): Remove section_name, is_str_offsets
113 parameters; add section_id parameter.
114 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
115 (Dwo_file::add_unit_set): ...this.
116 (Dwo_file::shndx_map_): Remove.
117 (Dwo_file::sect_offsets_): New data member.
118 (Dwp_output_file::Dwp_output_file): Initialize new data members.
119 (Dwp_output_file::add_section): Rename to...
120 (Dwp_output_file::add_contribution): ...this.
121 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
122 (Dwp_output_file::add_tu_set): Likewise.
123 (Dwp_output_file::Contribution): New type.
124 (Dwp_output_file::Section::contributions): New data member.
125 (Dwp_output_file::Cu_or_tu_set): Remove.
126 (Dwp_output_file::Section::Section): New ctor.
127 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
128 (Dwp_output_file::Dwp_index::Section_table): New type.
129 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
130 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
131 parameter.
132 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
133 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
134 (Dwp_output_file::Dwp_index::section_table): New member function.
135 (Dwp_output_file::Dwp_index::section_table_end): New member function.
136 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
137 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
138 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
139 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
140 (Dwp_output_file::Dwp_index::section_table_): New data member.
141 (Dwp_output_file::Dwp_index::section_mask_): New data member.
142 (Dwp_output_file::add_output_section): New member function.
143 (Dwp_output_file::write_new_section): New member function.
144 (Dwp_output_file::write_contributions): New member function.
145 (Dwp_output_file::section_id_map_): New data member.
146 (class Dwo_id_info_reader): Remove.
147 (class Unit_reader): New class.
148 (get_dwarf_section_name): New function.
149 (Dwo_file::read_executable): Adjust initializations of class data.
150 (Dwo_file::read): Add support for v2 package file format.
151 (Dwo_file::read_unit_index): Likewise.
152 (Dwo_file::sized_read_unit_index): Likewise.
153 (Dwo_file::copy_section): Likewise.
154 (Dwo_file::add_unit_set): Likewise.
155 (Dwp_output_file::add_output_section): Likewise.
156 (Dwp_output_file::add_contribution): Likewise.
157 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
158 for empty slot.
159 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
160 file format.
161 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
162 slot.
163 (Dwp_output_file::initialize): Remove unused function.
164 (Dwp_output_file::finalize): Add support for v2 package file format.
165 (Dwp_output_file::write_index): Likewise.
166 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
167 function prototype.
168
169 2013-07-31 Cary Coutant <ccoutant@google.com>
170
171 * object.cc (Sized_relobj::do_output_section_address): New function.
172 (Sized_relobj): Instantiate explicitly.
173 * object.h (Object::output_section_address): New function.
174 (Object::do_output_section_address): New function.
175 (Sized_relobj::do_output_section_address): New function.
176 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
177
178 2013-07-30 Cary Coutant <ccoutant@google.com>
179 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
180
181 * parameters.cc (Parameters::entry): Return target-specific entry
182 symbol name.
183 * target.h (Target::entry_symbol_name): New function.
184 (Target_info::entry_symbol_name): New data member.
185
186 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
187 * i386.cc (Target_i386::i386_info): Likewise.
188 (Target_i386_nacl::i386_nacl_info): Likewise.
189 * sparc.cc (Target_sparc::sparc_info): Likewise.
190 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
191 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
192 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
193 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
194
195 2013-07-22 Sterling Augustine <saugustine@google.com>
196
197 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
198 Convert parameter shndx to local variable. Add parameters symtab
199 and symtab_size. Scan over section names. Find relocation
200 section corresponding to current section. Create and initialize
201 reloc_mapper_ and reloc_type_.
202 (Dwarf_pubnames_table::read_header): Add assertion. Change
203 unit_length to off_t. Initialize member unit_length_. Fill in field
204 cu_offset_.
205 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
206 Initialize new fields unit_length_ and cu_offset_.
207 (Dwarf_pubnames_table::read_section): Update prototype.
208 (Dwarf_pubnames_table::cu_offset): New member function.
209 (Dwarf_pubnames_table::subsection_size): Likewise.
210 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
211 New fields.
212 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
213 member functions public.
214 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
215 Update comment. Rework logic. Move repeated parts to...
216 (Gdb_index_info_reader::read_pubtable): ...here. New function.
217 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
218 pubtypes_table_, and stmt_list_offset.
219 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
220 Gdb_index::find_pubtype_offset,
221 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
222 (Gdb_index::pubnames_read): Update prototype and rework logic.
223 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
224 Forward declare.
225 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
226 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
227 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
228 Gdb_index::map_pubtable_to_dies):
229 Declare functions.
230 (Gdb_index::pubnames_read): Update declaration.
231 (Gdb_index::Pubname_offset_map): New type.
232 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
233 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
234 Gdb_index::stmt_list_offset): Declare.
235 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
236 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
237 Gdb_index::pubtypes_offset_): Remove.
238
239 2013-07-19 Roland McGrath <mcgrathr@google.com>
240
241 * options.h (General_options): Add -Trodata-segment option.
242 * parameters.cc (Parameters::check_rodata_segment): New function.
243 (Parameters::set_target_once): Call it.
244 * parameters.h (Parameters): Declare it (private member function).
245 * layout.cc (load_seg_unusable_for_headers): New function, broken
246 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
247 then validate rodata segment rather than text segment.
248 (relaxation_loop_body): Call that.
249 (is_text_segment): New function. Don't admit a non-executable
250 segment if TARGET->isolate_execinstr().
251 (set_segment_offsets): Call it. Honor -Trodata-segment option.
252
253 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
254
255 PR gold/15070
256 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
257 * nacl.h (Sniff_file::View::View): Request aligned view.
258
259 2013-07-11 Cary Coutant <ccoutant@google.com>
260
261 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
262 correct BRLT entry size.
263
264 2013-07-03 Alan Modra <amodra@gmail.com>
265
266 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
267 comment.
268
269 2013-07-01 Cary Coutant <ccoutant@google.com>
270
271 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
272 reloc_type_.
273 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
274 (Dwarf_ranges_table::lookup_reloc): New function.
275 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
276 reloc_type_.
277 (Dwarf_ranges_table::lookup_reloc): New function.
278 (Dwarf_ranges_table::reloc_type_): New data member.
279
280 2013-06-27 Jing Yu <jingyu@google.com>
281
282 PR gold/15662
283 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
284 function.
285 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
286 (Target_powerpc::do_relax): Call the above.
287
288 2013-06-27 Cary Coutant <ccoutant@google.com>
289
290 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
291 on garbage collected .opd section.
292
293 2013-06-27 Alan Modra <amodra@gmail.com>
294
295 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
296 is non-zero.
297 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
298 (Target_powerpc::do_function_location): Likewise for loc->shndx.
299
300 2013-06-14 Cary Coutant <ccoutant@google.com>
301
302 * resolve.cc (Symbol::override_base): Don't override st_type
303 from plugin placeholder symbols.
304 (Symbol_table::resolve): Likewise.
305 (Symbol_table::should_override): Don't complain about TLS mismatch
306 if the TO symbol is a plugin placeholder.
307 * testsuite/Makefile.am (plugin_test_tls): New test.
308 * testsuite/Makefile.in: Regenerate.
309 * testsuite/plugin_test_tls.sh: New test script.
310 * testsuite/two_file_test_2_tls.cc: New test source.
311 * testsuite/two_file_test_tls.cc: New test source.
312
313 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
314
315 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
316 the maximum segment alignment is larger than the page size.
317 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
318 correctly aligns the symbols with large alignemnt.
319 * testsuite/Makefile.in: Regenerate.
320 * testsuite/large_symbol_alignment.cc: New file.
321
322 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
323 Sriraman Tallam <tmsriram@google.com>
324
325 * options.h (sort_section): New option.
326 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
327 Rename from Input_section_sort_section_name_special_ordering_compare.
328 (Input_section_sort_section_name_compare): New struct.
329 * output.cc (Output_section::Input_section_sort_section_name_compare::
330 operator()): New function.
331 (Output_section::sort_attached_input_sections): Use new sort function
332 for .text if --sort-section=name is specified.
333 * layout.cc (Layout::make_output_section):
334 Add sorting by name when --sort-section=name is specified.
335 * testsuite/Makefile.am (text_section_grouping): Test option
336 --sort-section=name.
337 * testsuite/Makefile.in: Regenerate.
338 * testsuite/section_sorting_name.cc: New file.
339 * testsuite/section_sorting_name.sh: New file.
340
341 2013-05-21 Cary Coutant <ccoutant@google.com>
342
343 * symtab.h (Symbol::is_cxx_vtable): New function.
344 * target-reloc.h (relocate_section): Check for vtable symbol.
345 * testsuite/Makefile.am (missing_key_func.sh): New test case.
346 * testsuite/Makefile.in: Regenerate.
347 * testsuite/missing_key_func.cc: New test source.
348 * testsuite/missing_key_func.sh: New test script.
349
350 2013-05-21 Cary Coutant <ccoutant@google.com>
351
352 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
353 type of enclosing symbol.
354 (Relocate_info::location): Check symbol type when describing symbol.
355 * object.h (Symbol_location_info): Remove unused line_number;
356 add enclosing_symbol_type.
357 * testsuite/debug_msg.sh: Adjust expected output.
358
359 2013-05-13 Cary Coutant <ccoutant@google.com>
360
361 * configure.ac: Export DEFAULT_TARGET.
362 * configure: Regenerate.
363 * Makefile.in: Regenerate.
364 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
365 * testsuite/Makefile.in: Regenerate.
366 * testsuite/debug_msg.sh: Delete duplicate tests.
367 Don't check undef_int error message match for powerpc where the
368 source file and line number aren't available.
369
370 2013-05-10 Roland McGrath <mcgrathr@google.com>
371
372 * options.h (General_options): Add --rosegment-gap option.
373 * options.cc (finalize): --rosegment-gap implies --rosegment.
374 * layout.cc (set_segment_offsets): Let user option override
375 target->rosegment_gap().
376
377 2013-05-10 Roland McGrath <mcgrathr@google.com>
378
379 * options.h (General_options): Remove leading space from help
380 messages for -nostdlib and --rosegment.
381
382 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
383
384 PR ld/15365
385 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
386
387 2013-05-03 Alan Modra <amodra@gmail.com>
388
389 * merge.cc (Output_merge_string::do_add_input_section): Correct
390 scan for number of strings. Rename vars to avoid shadowing.
391 Include missing terminator in input_size_.
392
393 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
394
395 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
396 Restore empty string handling.
397
398 2013-05-01 Cary Coutant <ccoutant@google.com>
399
400 * stringpool.cc (Stringpool_template::new_key_offset): Fix
401 uninitialized warning.
402
403 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
404
405 * output.cc (Output_section::add_merge_input_section): Allow
406 to merge sections if the alignment is more than character size.
407 * merge.h (Output_merge_string::Output_merge_string): Remove
408 assert.
409 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
410 only not-null strings. Check the alignment of strings.
411 * stringpool.h
412 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
413 alignment as the argument.
414 (Stringpool_template<Stringpool_char>::addralign_): New class member.
415 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
416 Align non-zero length strings according to the addralign_.
417 (Stringpool_template<Stringpool_char>::set_string_offsets):
418 Updating offsets according to the given alignment.
419 * testsuite/Makefile.am (text_section_grouping): Test if string
420 literals are getting merged.
421 * testsuite/Makefile.in: Regenerate.
422 * testsuite/merge_string_literals_1.c: New file.
423 * testsuite/merge_string_literals_2.c: Ditto.
424 * testsuite/merge_string_literals.sh: Ditto.
425
426 2013-04-26 Ian Lance Taylor <iant@google.com>
427
428 * target-reloc.h (relocate_section): If the reloc offset is out of
429 range, pass VIEW as NULL to relocate.relocate.
430 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
431 * i386.cc (Target_i386::Relocate::relocate): Likewise.
432 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
433 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
434 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
435 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
436
437 2013-04-26 Geoff Pike <gpike@chromium.org>
438
439 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
440 * layout.cc (Hash_task): New class.
441 (Layout::queue_build_id_tasks): New function.
442 (Layout::write_build_id): Handle single-thread portion of build ID
443 computation. (In some cases, all of it is single-threaded.) Replace
444 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
445 functionality in fewer lines of code.
446 * layout.h (Layout::queue_build_id_tasks): New function declaration.
447 * options.h (General_options): make "--build-id" default to tree
448 rather than sha1. Add two new options related to --build-id=tree:
449 --build-id-chunk-size-for-treehash and
450 --build-id-min-file-size-for-treehash.
451 * Makefile.am: add testing of --build-id=tree and related new options
452 (these tests will be invoked by "make check").
453 * Makefile.in: Regenerate.
454
455 2013-04-25 Alan Modra <amodra@gmail.com>
456
457 * configure.tgt: Add powerpcle and powerpc64le.
458
459 2013-04-22 Alan Modra <amodra@gmail.com>
460
461 PR gold/15355
462 * layout.cc (Layout::segment_precedes): Allow more than one
463 segment with the same type and flags.
464
465 2013-04-15 Cary Coutant <ccoutant@google.com>
466
467 * layout.cc (Layout::set_relocatable_section_offsets): Don't
468 allocate space in file for BSS sections.
469
470 2013-04-15 Cary Coutant <ccoutant@google.com>
471
472 * script-sections.cc (Orphan_output_section): Reset address
473 to zero after each orphaned section for relocatable links.
474
475 2013-04-15 Cary Coutant <ccoutant@google.com>
476
477 * symtab.cc (Symbol_table::sized_write_globals): Subtract
478 section starting address for relocatable link.
479 * testsuite/Makefile.am (script_test_11): New test.
480 * testsuite/Makefile.in: Regenerate.
481 * testsuite/script_test_11.c: New source file.
482 * testsuite/script_test_11.t: New linker script.
483
484 2013-04-13 Alan Modra <amodra@gmail.com>
485
486 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
487 owner when sections are not adjacent and exceed group size.
488 (Target_powerpc::group_sections): Handle corner case.
489 (Target_powerpc::Branch_info::make_stub): Handle case where
490 stub table doesn't exist due to branches in non-exec sections.
491 (Target_powerpc::Relocate::relocate): Likewise.
492
493 2013-04-11 Alan Modra <amodra@gmail.com>
494
495 PR gold/15354
496 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
497 .branch_lt to match bfd ld. Adjust comments throughout file.
498
499 2013-04-04 Ian Lance Taylor <iant@google.com>
500
501 GCC PR c++/56840
502 * object.cc (do_layout_deferred_sections): Handle .eh_frame
503 sections before checking whether they are included in the link.
504
505 2013-03-29 Sriraman Tallam <tmsriram@google.com>
506
507 * archive.cc (Archive::get_elf_object_for_member): Create the elf
508 object before calling the plugin claim_file handler. Pass the elf
509 object of the archive to the plugin. Delete the elf object if the
510 plugin claims the file.
511
512 2013-03-21 Alan Modra <amodra@gmail.com>
513
514 * layout.cc (Layout::set_segment_offsets): Accept writable .text
515 segment when omagic.
516
517 2013-03-21 Alan Modra <amodra@gmail.com>
518
519 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
520 comparison warning.
521 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
522 uninitialized" warning.
523
524 2013-03-20 Alan Modra <amodra@gmail.com>
525
526 * symtab.h (Symbol::clear_version): New function.
527 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
528 is_needed by weak references. Clear version for symbols defined
529 in as-needed objects that are not needed.
530
531 2013-03-15 Alan Modra <amodra@gmail.com>
532
533 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
534 static and public. Add report_err param. Return false for data refs.
535 (Target_powerpc::rela_dyn_section): New overloaded function.
536 (Target_powerpc::plt_, iplt_): Elucidate.
537 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
538 (Output_data_plt_powerpc::do_write): Don't write .iplt.
539 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
540 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
541 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
542 push_branch and make_plt_entry for ifunc syms when
543 reloc_needs_plt_for_ifunc.
544 (Target_powerpc::Relocate::relocate): Don't use plt entry value
545 for ifunc unless reloc_needs_plt_for_ifunc.
546
547 2013-03-15 Alan Modra <amodra@gmail.com>
548
549 * gc.h (gc_process_relocs): Don't look through function descriptors.
550 * icf.cc (get_section_contents): Do so here instead.
551
552 2013-03-13 Alan Modra <amodra@gmail.com>
553
554 * powerpc.cc (is_branch_reloc): Forward declare.
555 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
556 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
557 false for 64-bit, true for 32-bit non-branch relocs.
558 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
559 * testsuite/Makefile.am (icf_test): Use linker map file instead of
560 nm output.
561 (icf_safe_test): Generate linker map file as well as nm output.
562 (icf_safe_so_test): Likewise.
563 * testsuite/Makefile.in: Regenerate.
564 * testsuite/icf_test.sh: Parse linker map file to determine
565 section folding.
566 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
567 * testsuite/icf_safe_so_test.sh: Likewise.
568 (X86_32_or_ARM_specific_safe_fold): Merge into..
569 (arch_specific_safe_fold): ..this.
570 (X86_64_specific_safe_fold): Delete unused function.
571
572 2013-03-12 Alan Modra <amodra@gmail.com>
573
574 * gc.h (gc_process_relocs): Look through function descriptors
575 to determine shndx, symvalue and addend used by ICF. Tidy
576 variable duplication.
577
578 2013-03-11 Alan Modra <amodra@gmail.com>
579
580 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
581 * layout.cc (Layout_task_runner::run): ..to here.
582 * symtab.h (struct Symbol_location): Extract from..
583 (class Symbol_table): ..here.
584 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
585 * target.h (class Target): Add function_location and
586 do_function_location functions.
587 (class Sized_target): Add do_function_location.
588 * object.h (class Sized_relobj_file): Move find_shdr..
589 (class Object): ..to here.
590 * object.cc: Likewise. Update to suit. Instantiate.
591 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
592 * powerpc.cc (class Powerpc_dynobj): New.
593 (Target_powerpc::do_function_location): New function.
594 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
595 (Powerpc_dynobj::do_read_symbols): New function.
596 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
597
598 2013-03-08 Ian Lance Taylor <iant@google.com>
599
600 * options.cc (General_options::string_to_object_format): Accept
601 "default".
602
603 2013-03-08 Alan Modra <amodra@gmail.com>
604
605 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
606 pointer to Post_fde.
607 (struct Post_fde): Move definition to here..
608 * ehframe.cc (struct Post_fde): ..from here.
609 (Cie::write): Don't alloc Post_fde.
610 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
611
612 2013-03-07 Alan Modra <amodra@gmail.com>
613
614 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
615 relocation referencing .LC0.
616 * testsuite/discard_locals_test.sh: Remove FIXMEs.
617
618 2013-03-07 Alan Modra <amodra@gmail.com>
619
620 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
621 always_inline. Add assembly for powerpc to avoid GOT.
622
623 2013-03-07 Alan Modra <amodra@gmail.com>
624
625 * testsuite/script_test_10.sh: Don't test .bss section
626 header number.
627
628 2013-03-06 Alan Modra <amodra@gmail.com>
629
630 * powerpc.cc (class Powerpc_relobj): Move some member functions.
631 (Target_powerpc::symval_for_branch): Add symtab param. Update
632 all callers. Handle folded sections.
633 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
634 to Powerpc_relobj.
635 (Global_symbol_visitor_opd::operator()): Likewise.
636
637 2013-03-04 Alan Modra <amodra@gmail.com>
638
639 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
640 * testsuite/Makefile.in: Regenerate.
641
642 2013-03-01 Cary Coutant <ccoutant@google.com>
643
644 Add dwp support for v2 DWARF package file format.
645 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
646 tu_length parameter. Adjust all callers.
647 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
648 * dwp.cc: Include dwarf.h.
649 (Section_bounds): New struct type.
650 (Unit_set): New struct type.
651 (Dwo_file::Dwo_file): Initialize new data member.
652 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
653 Combine and rename to...
654 (Dwo_file::read_unit_index): ...this.
655 (Dwo_file::sized_read_compunit_index)
656 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
657 (Dwo_file::sized_read_unit_index): ...this.
658 (Dwo_file::copy_section): Remove section_name, is_str_offsets
659 parameters; add section_id parameter.
660 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
661 (Dwo_file::add_unit_set): ...this.
662 (Dwo_file::shndx_map_): Remove.
663 (Dwo_file::sect_offsets_): New data member.
664 (Dwp_output_file::Dwp_output_file): Initialize new data members.
665 (Dwp_output_file::add_section): Rename to...
666 (Dwp_output_file::add_contribution): ...this.
667 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
668 (Dwp_output_file::add_tu_set): Likewise.
669 (Dwp_output_file::Contribution): New type.
670 (Dwp_output_file::Section::contributions): New data member.
671 (Dwp_output_file::Cu_or_tu_set): Remove.
672 (Dwp_output_file::Section::Section): New ctor.
673 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
674 (Dwp_output_file::Dwp_index::Section_table): New type.
675 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
676 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
677 parameter.
678 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
679 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
680 (Dwp_output_file::Dwp_index::section_table): New member function.
681 (Dwp_output_file::Dwp_index::section_table_end): New member function.
682 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
683 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
684 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
685 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
686 (Dwp_output_file::Dwp_index::section_table_): New data member.
687 (Dwp_output_file::Dwp_index::section_mask_): New data member.
688 (Dwp_output_file::add_output_section): New member function.
689 (Dwp_output_file::write_new_section): New member function.
690 (Dwp_output_file::write_contributions): New member function.
691 (Dwp_output_file::section_id_map_): New data member.
692 (class Dwo_id_info_reader): Remove.
693 (class Unit_reader): New class.
694 (get_dwarf_section_name): New function.
695 (Dwo_file::read_executable): Adjust initializations of class data.
696 (Dwo_file::read): Add support for v2 package file format.
697 (Dwo_file::read_unit_index): Likewise.
698 (Dwo_file::sized_read_unit_index): Likewise.
699 (Dwo_file::copy_section): Likewise.
700 (Dwo_file::add_unit_set): Likewise.
701 (Dwp_output_file::add_output_section): Likewise.
702 (Dwp_output_file::add_contribution): Likewise.
703 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
704 for empty slot.
705 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
706 file format.
707 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
708 slot.
709 (Dwp_output_file::initialize): Remove unused function.
710 (Dwp_output_file::finalize): Add support for v2 package file format.
711 (Dwp_output_file::write_index): Likewise.
712 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
713 function prototype.
714
715 2013-03-01 Cary Coutant <ccoutant@google.com>
716
717 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
718 function into class definition in header file.
719 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
720 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
721 New function.
722 (Dwarf_info_reader::check_buffer): Move here from .cc file.
723
724 2013-02-28 Alan Modra <amodra@gmail.com>
725
726 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
727 * target.cc (Target::do_plt_fde_location): New function.
728 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
729 accessor function, and constructor param.
730 (struct Post_fde, Post_fdes): Declare.
731 (Cie::write): Add post_fdes param.
732 * ehframe.cc (Fde::write): Use plt_fde_location.
733 (struct Post_fde): Define.
734 (Cie::write): Stash FDEs added post merge mapping.
735 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
736 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
737 (Eh_frame::do_sized_write): Arrange to write post map FDES after
738 other FDEs.
739 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
740 (Target_powerpc::has_glink): New function.
741 (Target_powerpc::do_relax): Add eh_frame info for stubs.
742 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
743 glink_eh_frame_fde_32, default_fde): New data.
744 (Stub_table::eh_frame_added_): New var.
745 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
746 Make const.
747 (Stub_table::add_eh_frame): New function.
748 (Output_data_glink::add_eh_frame): New function.
749 (Target_powerpc::make_glink_section): Call add_eh_frame.
750
751 2013-02-15 Ian Lance Taylor <iant@google.com>
752
753 * options.h (DEFINE_uint64_alias): Define.
754 (class General_options): Add -Ttext-segment as an alias for
755 -Ttext.
756
757 2013-02-15 Alan Modra <amodra@gmail.com>
758
759 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
760 (Stub_table::do_write): ..here, two places.
761 (Stub_table::plt_call_size): Use it here too.
762
763 2013-02-11 Ian Lance Taylor <iant@google.com>
764
765 * descriptors.cc (Descriptors::close_all): New function.
766 * descriptors.h (class Descriptors): Declare close_all.
767 (close_all_descriptors): New inline function.
768 * plugin.cc: Include "descriptors.h".
769 (Plugin_manager::cleanup): Call close_all_descriptors.
770
771 2013-02-06 Alan Modra <amodra@gmail.com>
772
773 * README: Update coding style link.
774
775 2013-01-28 Cary Coutant <ccoutant@google.com>
776
777 * dwp.cc (File_list): New typedef.
778 (Dwo_name_info_reader): New class.
779 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
780 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
781 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
782 (Dwo_file::read_executable): New function.
783 (Dwo_file::read): Move common setup code to ...
784 (Dwo_file::make_object): ... here.
785 (dwp_options): Add --exec/-e.
786 (usage): Likewise.
787 (main): Likewise.
788
789 2013-01-24 Sriraman Tallam <tmsriram@google.com>
790
791 * layout.cc (Layout::layout): Check for option text_reorder.
792 (Layout::make_output_section): Ditto.
793 * options.h (text_reorder): New option.
794 * output.cc (Input_section_sort_compare): Remove special ordering
795 of section names.
796 (Output_section::
797 Input_section_sort_section_name_special_ordering_compare::
798 operator()): New function.
799 (Output_section::sort_attached_input_sections): Use new sort function
800 for .text.
801 * output.h (Input_section_sort_section_name_special_ordering_compare):
802 New struct.
803 * testsuite/Makefile.am (text_section_grouping): Test option
804 --no-text-reorder
805 * testsuite/Makefile.in: Regenerate.
806 * testsuite/text_section_grouping.sh: Check order of functions without
807 default text reordering.
808
809 2013-01-18 Mike Frysinger <vapier@gentoo.org>
810
811 * options.h (General_options): Change default to true for new_dtags.
812
813 2013-01-18 Mike Frysinger <vapier@gentoo.org>
814
815 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
816 when enable_new_dtags is false. Only add DT_RUNPATH when
817 enable_new_dtags is true.
818
819 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
820
821 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
822 used in declaration and definition consistent.
823 (Target_powerpc::symval_for_branch): Ditto.
824
825 2013-01-16 Sriraman Tallam <tmsriram@google.com>
826
827 * testsuite/plugin_final_layout.cc: Fix comment.
828
829 2013-01-16 Sriraman Tallam <tmsriram@google.com>
830
831 * layout.cc (Layout::layout): Do not do default sorting for
832 text sections when section ordering is specified.
833 (make_output_section): Ditto.
834 * testsuite/plugin_final_layout.cc: Name the function sections
835 to catch reordering issues.
836
837 2013-01-15 Alan Modra <amodra@gmail.com>
838
839 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
840 plt-thread-safe.
841
842 2013-01-15 Alan Modra <amodra@gmail.com>
843
844 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
845 * testsuite/Makefile.in: Regenerate.
846
847 2013-01-14 Alan Modra <amodra@gmail.com>
848
849 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
850 * testsuite/Makefile.in: Regenerate.
851
852 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
853
854 PR bfd/14430
855 Fix mingw gold build with plugins enabled
856 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
857 * configure.ac: Export DLOPEN_LIBS and add headers check.
858 * plugin.cc: Handle non-dlfcn case.
859 * Makefile.in: Regenerate.
860 * config.in: Regenerate.
861 * configure: Regenerate.
862 * testsuite/Makefile.in: Regenerate.
863
864 2013-01-09 Sriraman Tallam <tmsriram@google.com>
865
866 * output.h (sort_attached_input_sections): Change to be public.
867 * script-sections.cc
868 (Output_section_definition::set_section_addresses): Sort
869 attached input sections according to section order before linker
870 script assigns section addresses.
871 (Orphan_output_section::set_section_addresses): Sort
872 attached input sections according to section order before linker
873 script assigns section addresses.
874 * Makefile.am (final_layout.sh): Use a simple linker script to
875 check if section ordering still works.
876 * Makefile.in: Regenerate.
877
878 2013-01-09 Ben Cheng <bccheng@google.com>
879
880 * arm.cc (Target_arm::attributes_accept_div): New function.
881 (Target_arm::attributes_forbid_div): New function.
882 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
883 attribute using the same new functions as what bfd/elf32_arm.c
884 does.
885
886 2013-01-07 Cary Coutant <ccoutant@google.com>
887
888 PR gold/14993
889 * output.cc (Output_section::add_input_section): For incremental
890 updates, don't track input sections that are allocated from patch
891 space.
892
893 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
894 Ian Lance Taylor <iant@google.com>
895
896 PR gold/14897
897 * configure.ac (--enable-ld): Removed.
898 (install_as_default): Set to yes only for --enable-gold=default
899 or --disable-ld.
900 * configure: Regenerated.
901
902 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
903
904 * options.h (General_options): Add -fuse-ld= for GCC linker
905 option compatibility.
906
907 2013-01-04 Cary Coutant <ccoutant@google.com>
908
909 * configure.ac: Fix typo restoring CXXFLAGS.
910 * configure: Regenerate.
911
912 2013-01-04 Cary Coutant <ccoutant@google.com>
913
914 * testsuite/Makefile.am (CXXLINK_S): New macro.
915 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
916 * testsuite/Makefile.in: Regenerate.
917
918 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
919
920 * version.cc (print_version): Update copyright year to 2013.
921
922 2012-12-20 Ian Lance Taylor <iant@google.com>
923
924 * layout.cc (Layout::special_ordering_of_input_section): New
925 function.
926 (Layout::layout): If input section requires special ordering, must
927 sort input sections.
928 (Layout::make_output_section): May sort .text input sections.
929 (Layout::is_section_name_prefix_grouped): Remove.
930 * layout.h (class Layout): Declare
931 special_ordering_of_input_section. Don't declare
932 is_section_name_prefix_grouped.
933 * output.cc (Output_section::add_input_section): Revert last
934 change.
935 (Output_section::Input_section_sort::match_file_name): Don't crash
936 if called on output section data.
937 (Output_section::Input_section_sort_compare): Sort based on
938 special ordering.
939 (Output_section::Input_section_sort_section_order_index_compare):
940 Revert last patch.
941 (Output_section::sort_attached_input_sections): Likewise.
942
943 2012-12-18 Sriraman Tallam <tmsriram@google.com>
944
945 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
946 * layout.h (Layout::is_section_name_prefix_grouped): New function.
947 * output.cc (Output_section::add_input_section): Check if section
948 name contains special prefix. Keep input sections to sort such
949 sections.
950 (Output_section::Input_section_sort_section_order_index_compare
951 ::operator()): Group sections according to prefixes.
952 (Output_section::sort_attached_input_sections): Add condition to
953 Input_section_entry constructor call.
954 * testsuite/Makefile.am (text_section_grouping): New test.
955 * testsuite/Makefile.in: Regenerate.
956 * testsuite/text_section_grouping.cc: New file.
957 * testsuite/text_section_grouping.sh: New file.
958
959 2012-12-17 Nick Clifton <nickc@redhat.com>
960
961 * Makefile.am: Add copyright notice.
962 * NEWS: Likewise.
963 * README: Likewise.
964 * configure.ac: Likewise.
965 * ftruncate.c: Likewise.
966 * Makefile.in: Regenerate.
967
968 2012-12-14 Cary Coutant <ccoutant@google.com>
969
970 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
971 --no-as-needed flag.
972 (exception_separate_shared_12_test): Likewise.
973 (incremental_copy_test): Likewise.
974 * testsuite/Makefile.in: Regenerate.
975
976 2012-12-14 Cary Coutant <ccoutant@google.com>
977
978 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
979 (Dwp_output_file::Dwp_index::enter_set): Add assert.
980
981 2012-12-12 Alan Modra <amodra@gmail.com>
982
983 * powerpc.cc (class Track_tls): New.
984 (class Relocate, class Scan): Inherit Track_tls.
985 (Target_powerpc::Scan::local, global): Track tls optimization
986 and avoid creating plt entry for __tls_get_addr if all uses
987 are optimized away.
988 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
989
990 2012-12-12 Alan Modra <amodra@gmail.com>
991
992 * options.h (General_options): Add --toc-sort/--no-toc-sort.
993 Replace no_toc_optimize with toc_optimize.
994 * output.h (Output_section::input_sections): Provide non-const variant.
995 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
996 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
997 accessors.
998 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
999 (class Sort_toc_sections): New.
1000 (Target_powerpc::do_finalize_sections): Sort toc sections.
1001 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1002
1003 2012-12-10 Roland McGrath <mcgrathr@google.com>
1004
1005 * testsuite/binary_unittest.cc (read_all): New function.
1006 (Sized_binary_test): Use it instead of ::read.
1007 * fileread.cc (do_read): Don't assume pread always reads the whole
1008 amount in a single call.
1009
1010 2012-12-10 Alan Modra <amodra@gmail.com>
1011
1012 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1013 Set EM_PPC64 or EM_PPC here.
1014 (Target_selector_powerpc::do_recognize): Delete.
1015
1016 2012-12-10 Alan Modra <amodra@gmail.com>
1017
1018 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1019 stub_table_.
1020 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1021
1022 2012-12-07 Roland McGrath <mcgrathr@google.com>
1023
1024 * testsuite/binary_unittest.cc (Sized_binary_test):
1025 Use open_descriptor rather than ::open.
1026
1027 2012-12-07 Alan Modra <amodra@gmail.com>
1028
1029 * powerpc.cc (Stub_table::do_write): Delete redundant Address
1030 typedef and invalid_address constant.
1031 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1032 instantiate constants.
1033
1034 2012-12-06 Roland McGrath <mcgrathr@google.com>
1035
1036 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1037 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1038 * aclocal.m4: Regenerate.
1039 * configure: Regenerate.
1040 * Makefile.in: Regenerate.
1041 * testsuite/Makefile.in: Regenerate.
1042
1043 2012-12-07 Alan Modra <amodra@gmail.com>
1044
1045 * options.h (General_options): Add no_toc_optimize.
1046 * powerpc.cc (ok_lo_toc_insn): New function.
1047 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1048
1049 2012-12-06 Alan Modra <amodra@gmail.com>
1050
1051 * options.h (General_options): Add plt_align, plt_static_chain,
1052 plt_thread_safe. Update stub_group_size help text.
1053 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1054 for new plt_thread_safe_ var.
1055 (use_plt_offset): Correct comments.
1056 (Target_powerpc::do_relax): Look for thread creation symbols to
1057 determine default plt_thread_safe value. Clear plt call stubs
1058 as well as branch stubs each iteration.
1059 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1060 insn constants.
1061 (l, hi, ha, write_insn): Move earlier.
1062 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1063 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1064 plt stubs too.
1065 (Stub_table::update_size): Adjust.
1066 (Stub_table::prev_size, set_prev_size): Delete.
1067 (Stub_table::stub_align): Let --plt-align affect result.
1068 (Stub_table::plt_call_size): Calculate sizes for various stubs.
1069 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1070 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1071 (Stub_table::do_write): Support more stub variants.
1072
1073 2012-12-04 Alan Modra <amodra@gmail.com>
1074
1075 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1076 (Target_powerpc::do_define_standard_symbols): New function.
1077
1078 2012-12-03 Alan Modra <amodra@gmail.com>
1079
1080 * output.h: Formatting, whitespace.
1081
1082 2012-12-03 Alan Modra <amodra@gmail.com>
1083
1084 * layout.h (Layout::get_executable_sections): Declare.
1085 * layout.cc (Layout::get_executable_sections): New function.
1086 * arm.cc (Target_arm::group_sections): Use it.
1087 (Arm_output_section::group_sections): Delete now redundant test.
1088 * output.cc (Output_reloc::Output_reloc): Add is_relative.
1089 param to handle relative relocs.
1090 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1091 (Output_data_reloc::add_absolute): Adjust.
1092 (Output_data_reloc::add_relative): New function.
1093 (Output_data::reset_data_size): New function.
1094 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1095 (Output_section::set_addralign): New function.
1096 (Output_section::checkpoint_set_addralign): New function.
1097 (Output_section::clear_section_offsets_need_adjustment): New function.
1098 (Output_section::input_sections): Make public.
1099 * powerpc.cc (class Output_data_brlt_powerpc): New.
1100 (class Stub_table, class Stub_control): New.
1101 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1102 stub_table_, set_stub_table, stub_table): New vectors and accessor
1103 functions.
1104 (Target_powerpc::do_may_relax, do_relax, push_branch,
1105 new_stub_table, stub_tables, brlt_section, group_sections,
1106 add_branch_lookup_table, find_branch_lookup_table,
1107 write_branch_lookup_table, make_brlt_section): New functions.
1108 (Target_powerpc::struct Sort_sections, class Branch_info): New.
1109 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1110 branch_info_): New vars.
1111 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1112 make call stubs here.
1113 (Output_data_glink): Remove all call stub handling from this class.
1114 (Target_powerpc::Scan::local, global): Save interesting branch
1115 relocs and relocs for ifunc. Adjust calls to plt entry functions.
1116 (Target_powerpc::do_finalize_sections): Only make reg save/restore
1117 functions on final link.
1118 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1119 Handle long branch destinations too.
1120 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1121 do_plt_address_for_local): Adjust lookup of plt call stubs.
1122
1123 2012-11-30 Alan Modra <amodra@gmail.com>
1124
1125 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1126 relocs against protected symbols when building 32-bit shared libs.
1127
1128 2012-11-30 Alan Modra <amodra@gmail.com>
1129
1130 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1131 param. Call got_section() to make .got. Update all callers
1132 and their callers and so on.
1133
1134 2012-11-30 Alan Modra <amodra@gmail.com>
1135
1136 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1137 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1138 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1139 value if it already exists.
1140
1141 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
1142
1143 PR gold/14858
1144 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1145
1146 2012-11-14 Roland McGrath <mcgrathr@google.com>
1147
1148 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1149 than bfc instruction for data sandboxing.
1150
1151 2012-11-08 Alan Modra <amodra@gmail.com>
1152
1153 * po/POTFILES.in: Regenerate.
1154
1155 2012-11-05 Alan Modra <amodra@gmail.com>
1156
1157 * configure.ac: Apply 2012-09-10 change to config.in here.
1158 * configure: Regenerate.
1159
1160 2012-11-05 Alan Modra <amodra@gmail.com>
1161
1162 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1163 (struct Opd_ent): Use "Address" rather than "Offset".
1164 (Output_data_got_powerpc::got_base_offset): Return Valtype.
1165 (Target_powerpc::got_section): Make public.
1166 (Target_powerpc::scan_relocs): Move code setting symbols..
1167 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1168 Create _SDA_BASE_ only when referenced.
1169
1170 2012-11-02 Roland McGrath <mcgrathr@google.com>
1171
1172 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1173 from last change.
1174
1175 2012-11-01 Roland McGrath <mcgrathr@google.com>
1176
1177 * target.h (Sized_target::relocate_relocs): Use Elf_Off
1178 for offset_in_output_section parameter.
1179 (Sized_target::relocate_special_relocatable): Likewise.
1180 * arm.cc (Target_arm::relocate_relocs): Likewise.
1181 (Target_arm::relocate_special_relocatable): Likewise.
1182 * i386.cc (Target_i386::relocate_relocs): Likewise.
1183 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1184 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1185 * target-reloc.h (relocate_relocs): Likewise.
1186 * testsuite/testfile.cc (Target_test): Likewise.
1187 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1188 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1189
1190 * system.h: Move inclusion of <clocale> to after <libintl.h> in
1191 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1192
1193 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1194 parameter, which is unused in the [!F_SETFD] case.
1195
1196 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1197 SYMNDX to off_t before comparing it to this->data_size().
1198 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1199 * incremental.cc (Output_section_incremental_inputs::do_write):
1200 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1201
1202 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1203
1204 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
1205
1206 * gold.cc (Target_arm::do_adjust_elf_header): Add the
1207 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1208 in EABI_VER5.
1209
1210 2012-10-29 Cary Coutant <ccoutant@google.com>
1211
1212 * dwp.cc (usage): Add file and exit status parameters;
1213 add --help and --version options.
1214 (print_version): New function.
1215 (main): Add --help and --version options.
1216
1217 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1218
1219 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1220 final_layout_sequence.txt.
1221 * testsuite/Makefile.in: Regenerated.
1222
1223 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1224
1225 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1226 COMPILE generated by automake.
1227 (LINK1): Likewise.
1228 (CXXCOMPILE1): Likewise.
1229 (CXXLINK1): Likewise.
1230 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1231 (LINK): Likewise.
1232 (CXXCOMPILE): Likewise.
1233 (CXXLINK): Likewise.
1234 * testsuite/Makefile.in: Regenerated.
1235
1236 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1237
1238 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1239 on bad fwrite return.
1240
1241 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1242
1243 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1244 on val.
1245
1246 2012-10-23 Cary Coutant <ccoutant@google.com>
1247
1248 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1249 * testsuite/Makefile.in: Regenerate.
1250 * testsuite/dwp_test.h: New source file.
1251 * testsuite/dwp_test_1.cc: New source file.
1252 * testsuite/dwp_test_1.s: New source file.
1253 * testsuite/dwp_test_1.sh: New source file.
1254 * testsuite/dwp_test_1b.cc: New source file.
1255 * testsuite/dwp_test_1b.s: New source file.
1256 * testsuite/dwp_test_2.cc: New source file.
1257 * testsuite/dwp_test_2.s: New source file.
1258 * testsuite/dwp_test_2.sh: New source file.
1259 * testsuite/dwp_test_main.cc: New source file.
1260 * testsuite/dwp_test_main.s: New source file.
1261
1262 2012-10-23 Cary Coutant <ccoutant@google.com>
1263
1264 * dwp.h: New header file.
1265 * dwp.cc: New source file.
1266 * gold.h: Move shared declarations to system.h.
1267 * system.h: New header file.
1268 * Makefile.am: Add dwp.
1269 * Makefile.in: Regenerate.
1270
1271 2012-10-23 Cary Coutant <ccoutant@google.com>
1272
1273 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1274 Dwarf_info_reader::read_from_pointer.
1275 (Dwarf_pubnames_table::read_header): Likewise.
1276 (Dwarf_pubnames_table::next_name): Likewise.
1277 (Dwarf_die::read_attributes): Likewise.
1278 (Dwarf_die::skip_attributes): Likewise.
1279 (Dwarf_info_reader::read_from_pointer): New function template.
1280 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1281 (Dwarf_pubnames_table): Likewise.
1282 (Dwarf_info_reader::read_from_pointer): New function template.
1283 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1284 Dwarf_pubnames_table ctor.
1285
1286 2012-10-23 Cary Coutant <ccoutant@google.com>
1287
1288 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1289 abbrev_shndx.
1290 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1291 abbrev_shndx_.
1292 (Dwarf_info_reader::set_abbrev_shndx): New method.
1293 (Dwarf_info_reader::abbrev_shndx_): New data member.
1294
1295 2012-10-23 Cary Coutant <ccoutant@google.com>
1296
1297 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1298 from object, not parameters.
1299 (Dwarf_info_reader::parse): Likewise.
1300 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1301 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1302 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1303 methods.
1304
1305 2012-10-23 Cary Coutant <ccoutant@google.com>
1306
1307 * fileread.cc (Input_file::Input_file): New constructor.
1308 * fileread.h (class Input_file): Add new constructor.
1309
1310 2012-10-18 Alan Modra <amodra@gmail.com>
1311
1312 PR gold/14727
1313 * object.cc (Relobj::is_section_name_included): Also match
1314 .sdata personality section.
1315
1316 2012-10-18 Alan Modra <amodra@gmail.com>
1317
1318 * target-reloc.h (class Default_comdat_behavior): New, package up..
1319 (get_comdat_behaviour): ..this.
1320 (relocate_section): Add Relocate_comdat_behavior template arg,
1321 adjust code to suit.
1322 * arm.cc (Target_arm::relocate_section): Adjust to suit.
1323 (Target_arm::scan_reloc_section): Likewise.
1324 * i386.cc (Target_i386::relocate_section): Likewise.
1325 * sparc.cc (Target_sparc::relocate_section): Likewise.
1326 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1327 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1328 * powerpc.cc (class Relocate_comdat_behavior): New.
1329 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
1330 gold::relocate_section with new template arg.
1331
1332 2012-10-18 Alan Modra <amodra@gmail.com>
1333
1334 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1335 dynamic relocs for GOT_TPREL got entries, without symbol if
1336 resolving locally.
1337 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1338 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1339 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1340
1341 2012-10-17 Alan Modra <amodra@gmail.com>
1342
1343 PR gold/14726
1344 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1345
1346 2012-10-16 Sriraman Tallam <tmsriram@google.com>
1347
1348 * layout.cc (Layout::include_section): Keep sections marked
1349 SHF_EXCLUDE when doing relocatable links.
1350
1351 2012-10-16 Alan Modra <amodra@gmail.com>
1352
1353 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1354 (Target_powerpc::do_finalize_sections): Call it.
1355 (Output_data_save_res): New class and supporting functions.
1356 (Target_powerpc::symval_for_branch): Only look up .opd entry for
1357 normal symbols defined in object files.
1358
1359 2012-10-12 Alan Modra <amodra@gmail.com>
1360
1361 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1362 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
1363 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1364 section if scan_opd_relocs not yet called.
1365 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1366
1367 2012-10-12 Alan Modra <amodra@gmail.com>
1368
1369 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1370 add_local_ifunc_entry): Revert last change.
1371 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1372
1373 2012-10-05 Alan Modra <amodra@gmail.com>
1374
1375 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1376 do_plt_address_for_global): New functions.
1377 (Output_data_got_powerpc::do_write): Don't segfault when linking
1378 statically.
1379 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1380 add_local_ifunc_entry): Return true on adding entry..
1381 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1382 glink->add_entry call. Remove unused symtab param. Adjust calls.
1383 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1384 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
1385 set up symbols here.
1386 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1387 syms here. Do so even when no .iplt. Don't segfault when linking
1388 statically.
1389 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
1390 new variants without reloc param.
1391 (Glink_sym_ent::Glink_sym_ent): Likewise.
1392 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1393 reloc when refs will resolve to plt call stub.
1394 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
1395 R_PPC_PLTREL24 to resolve locally.
1396 (Target_powerpc::Scan::global): Correct ifunc handling.
1397 (Target_powerpc::Relocate::relocate): Correct local sym glink
1398 lookup. Don't destroy "value" when we have a plt call stub,
1399 and when checking plt call validity.
1400 (Target_powerpc::do_dynsym_value): Simplify.
1401
1402 2012-10-05 Alan Modra <amodra@gmail.com>
1403
1404 * i386.cc (Output_data_plt_i386::address_for_global,
1405 address_for_local): Add plt offset to returned value. Adjust uses.
1406 * sparc.cc (Output_data_plt_sparc::address_for_global,
1407 address_for_local): Likewise.
1408 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1409 address_for_local): Likewise.
1410 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1411 address_for_local): Likewise.
1412 * target.h (Target::plt_address_for_global, plt_address_for_local):
1413 Update comment.
1414 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1415 (Output_data_got::Got_entry::write): Nor here.
1416 * output.h: Comment fix.
1417
1418 2012-10-02 Jiong Wang <jiwang@tilera.com>
1419
1420 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1421 global_offset_table_ value for larget got.
1422 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1423
1424 2012-09-29 Alan Modra <amodra@gmail.com>
1425
1426 * powerpc.cc (Target_powerpc::iplt_): New output section.
1427 (Target_powerpc::iplt_section, make_iplt_section,
1428 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1429 (Target_powerpc::make_plt_entry): Handle ifunc syms.
1430 Target_powerpc::plt_entry_count): Count iplt entries too.
1431 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1432 reloc section in constructor. New params.
1433 (Target_powerpc::make_plt_section): Create reloc section here instead.
1434 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1435 functions.
1436 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1437 (Output_data_glink::add_entry, find_entry): New functions to
1438 deal with local syms.
1439 (Glink_sym_ent): Add support for local syms.
1440 (Output_data_glink::do_write): Handle ifunc plt entries.
1441 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1442 (Target_powerpc::Scan::local, global): Handle ifunc syms.
1443 (Target_powerpc::Relocate::relocate): Likewise.
1444 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1445
1446 2012-09-25 Alan Modra <amodra@gmail.com>
1447
1448 * object.h (Sized_relobj_file::adjust_local_symbol,
1449 do_adjust_local_symbol): New functions.
1450 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1451 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1452 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1453 and irregular opd entry spacing.
1454 (Powerpc_relobj::do_read_relocs): Add opd size checks.
1455 (Global_symbol_visitor_opd): New functor.
1456 (Target_powerpc::do_finalize_sections): Omit global symbols defined
1457 on deleted opd entries.
1458
1459 2012-09-15 Jiong Wang <jiwang@tilera.com>
1460
1461 * tilegx.cc: New file.
1462 * Makefile.am (TARGETSOURCES): Add tilegx.cc
1463 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1464 * configure.tgt: Add entries for tilegx*.
1465 * configure.ac: Likewise.
1466 * Makefile.in: Rebuild.
1467 * configure: Likewise.
1468 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1469 tilegx.
1470
1471 2012-09-13 Alan Modra <amodra@gmail.com>
1472
1473 * target-reloc.h (scan_relocs): Call scan.local for relocs
1474 against symbols in discarded sections. Pass is_discarded
1475 param.
1476 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1477 Add is_discarded param.
1478 * powerpc (Target_powerpc::Scan::local): Likewise. Use
1479 is_discarded to flag opd entry as discarded. Don't emit dyn
1480 relocs on such entries.
1481 (Target_powerpc::Scan::global): Similarly detect and handle
1482 such opd entries.
1483 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1484 opd_ent_. Update all uses.
1485 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1486 (Target_powerpc::relocate_section): Zero out discarded opd
1487 entry relocs.
1488
1489 2012-09-12 Ian Lance Taylor <iant@google.com>
1490
1491 PR gold/14570
1492 * output.cc: Rename Output_data_got template parameter from size
1493 to got_size for all functions. Compile all variants of
1494 Output_data_got.
1495 (Output_data_got::Got_entry::write): Correct use of size for
1496 symbol value. Use local_is_tls rather than casting to
1497 Sized_relobj_file.
1498 * object.h (class Object): Add local_is_tls and do_local_is_tls.
1499 (class Sized_relobj_file): Add do_local_is_tls.
1500 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1501
1502 2012-09-11 Alan Modra <amodra@gmail.com>
1503
1504 PR gold/14566
1505 * layout.cc (Layout::set_segment_offsets): When using
1506 common-page-size alignment, ensure we are on a new max-page-size
1507 page.
1508 * output.cc (Output_segment::set_section_addresses): Use
1509 abi_pagesize, not common_pagesize for relro boundary.
1510 (Output_segment::set_offset): Likewise.
1511
1512 2012-09-11 Alan Modra <amodra@gmail.com>
1513
1514 * output.h (Output_data_got::add_global_tls, add_local_tls,
1515 add_local_tls_pair): New functions.
1516 (Output_data_got::add_local_pair_with_rel): Remove second
1517 reloc param. Expand comment.
1518 (Output_data_got::Got_entry): Rename use_plt_offset_ to
1519 use_plt_or_tls_offset_, similarly for constructor param.
1520 (Output_data_got::Got_entry::write): Add got_index param.
1521 * output.cc (Output_data_got::add_global_tls, add_local_tls,
1522 add_local_tls_pair): New functions.
1523 (Output_data_got::Got_entry::write): Handle tls symbols
1524 with use_plt_or_tls_offset_ set specially.
1525 (Output_data_got::add_local_pair_with_rel): Only one reloc.
1526 (Output_data_got::do_write): Replace iterator with index, pass
1527 index to entry write function.
1528 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1529 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1530 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1531 call.
1532 * i386.cc (Target_i386::Scan::local): Likewise.
1533 * sparc.cc (Target_sparc::Scan::local): Likewise.
1534 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1535 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1536 do_tls_offset_for_global): New functions.
1537 (Target_powerpc::Scan::local): Correct TLS relocations and got
1538 entry values.
1539 (Target_powerpc::Scan::global): Don't emit unnecessary
1540 dynamic relocations on TLS GOT entries.
1541
1542 2012-09-10 Matthias Klose <doko@ubuntu.com>
1543
1544 * config.in: Disable sanity check for kfreebsd.
1545
1546 2012-09-10 Sterling Augustine <saugustine@google.com>
1547
1548 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1549 (Gdb_index::pubtypes_read): New parameter.
1550 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1551 to calls.
1552 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1553 pubtypes_object_.
1554
1555 2012-09-09 Alan Modra <amodra@gmail.com>
1556
1557 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1558 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1559 * gc.h (gc_process_relocs): Call target gc_add_reference.
1560 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1561 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1562 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1563 unnecessary cast.
1564 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1565 to cater for when we don't need code offset. Update use.
1566 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1567 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1568 set_opd_valid): New functions.
1569 (Target_powerpc::do_gc_add_reference): New function.
1570 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1571 stashed refs.
1572 (Target_powerpc::do_gc_mark_symbol): New function.
1573
1574 2012-09-06 Cary Coutant <ccoutant@google.com>
1575
1576 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1577 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1578 (Dwarf_die::skip_attributes): Likewise.
1579 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1580 * testsuite/gdb_index_test.cc (inline_func_1): New function.
1581 (main): Call it.
1582 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1583
1584 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
1585
1586 * testsuite/script_test_3.t: Add .got.plt output section
1587 statement.
1588 * testsuite/script_test_4.t: Likewise.
1589
1590 2012-09-05 Alan Modra <amodra@gmail.com>
1591
1592 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1593 update all uses and lose "enum" when using type.
1594
1595 2012-09-05 Alan Modra <amodra@gmail.com>
1596
1597 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1598 * configure: Regenerate.
1599 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1600 (plugin_final_layout.stdout): Likewise.
1601 (memory_test): Set page sizes to 0x1000.
1602 * testsuite/Makefile.in: Regenerate.
1603 * testsuite/discard_locals_test.sh: Add FIXME comment.
1604 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1605 * testsuite/pr14265.t: Add .got output section statement.
1606 * testsuite/script_test_2.t: Likewise.
1607 * testsuite/script_test_3.t: Likewise.
1608 * testsuite/script_test_4.t: Likewise.
1609 * testsuite/script_test_5.t: Likewise.
1610 * testsuite/script_test_6.t: Likewise.
1611 * testsuite/script_test_7.t: Likewise.
1612 * testsuite/script_test_9.t: Likewise.
1613
1614 2012-09-05 Alan Modra <amodra@gmail.com>
1615
1616 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1617 (Powerpc_relocate_functions::Status): New typedef.
1618 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1619 (Target_powerpc::Scan::local): Handle REL64.
1620 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1621 for REL32 and REL64.
1622 (Target_powerpc::symval_for_branch): New function, extracted from..
1623 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
1624 checks. Report overflow errors.
1625
1626 2012-09-05 Alan Modra <amodra@gmail.com>
1627
1628 * object.h (Sized_relobj_file::emit_relocs): Delete.
1629 (Sized_relobj_file::emit_relocs_reltype): Delete.
1630 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1631 relocate_relocs for --emit-relocs.
1632 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1633 * output.h: Update comment.
1634 (Output_segment::first_section): New function.
1635 (Output_segment::first_section_load_address): Use first_section.
1636 * output.cc (Output_segment::first_section): New function extracted..
1637 (Output_segment::first_section_load_address): ..from here. Delete.
1638 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1639 * target.h (Sized_target::relocate_for_relocatable): Likewise.
1640 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1641 adjust call to target.h function.
1642 * i386.cc (Target_i386): Likewise.
1643 * sparc.cc (Target_sparc): Likewise.
1644 * x86_64.cc (Target_x86_64): Likewise.
1645 * powerpc.cc (Target_powerpc): Likewise.
1646 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
1647 first tls section has section symbol for optimised local dynamic
1648 output relocs.
1649 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1650 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1651 optimised tls code.
1652 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1653 Rename to relocate_relocs. Update error message.
1654
1655 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
1656
1657 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1658 --just-symbols.
1659
1660 2012-08-31 Alan Modra <amodra@gmail.com>
1661
1662 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1663 (Powerpc_relobj::toc_base_offset): New stub function.
1664 (Target_powerpc): Add tp_offset, dtp_offset. Rename
1665 got_mod_index_offset to tlsld_got_offset. Update all refs.
1666 (Target_powerpc::Relocate::enum skip_tls): New.
1667 (Target_powerpc::call_tls_get_addr_): New var.
1668 (Target_powerpc::is_branch_reloc): Move to file scope.
1669 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1670 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1671 New functions.
1672 (Target_powerpc::enum Got_type): Delete old values, add new ones.
1673 (powerpc_info): Correct common_pagesize for ppc64.
1674 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1675 (Powerpc_relocate_functions): Add overflow check enums and functions.
1676 Add non-shift version of rela, rela_ua. Delete all rel public
1677 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
1678 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1679 addr16_ha3, addr14 functions.
1680 (Output_data_got_powerpc::add_constant_pair): New function.
1681 (Output_data_got_powerpc::got_base_offset): Likewise.
1682 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1683 (instruction constants): Sort, add some more.
1684 (Output_data_glink::do_write): Add and use Address typedef. Use
1685 object->toc_base_offset() stub for 64-bit.
1686 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1687 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1688 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1689 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
1690 Always treat .opd relocs as against locally defined symbol.
1691 Correct condition for RELATIVE relocs.
1692 (Target_powerpc::do_finalize_sections): Test for NULL sections.
1693 (Target_powerpc::Relocate::relocate): Use plt call stub as value
1694 for 32-bit syms with a plt entry. Correct ppc64 toc base
1695 calculations. Handle TLS relocs, and more. Add overflow
1696 checking and adjust for Powerpc_relocate_functions changes.
1697 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1698 Reinstate --emit-relocs code with FIXME.
1699
1700 2012-08-30 Alan Modra <amodra@gmail.com>
1701
1702 * layout.cc (Layout::set_segment_offsets): Set p_align to
1703 abi_pagesize, not common_pagesize.
1704 (Layout::relaxation_loop_body): Similarly use abi_pagesize
1705 to determine whether file header can go in segment.
1706
1707 2012-08-30 Alan Modra <amodra@gmail.com>
1708
1709 * output.h (Output_reloc::Output_reloc <output section>): Add
1710 is_relative param. Adjust calls.
1711 (Output_reloc::add_output_section_relative): New functions.
1712 * output.cc (Output_reloc::Output_reloc <output section>): Handle
1713 is_relative.
1714 (Output_reloc::symbol_value): Handle SECTION_CODE.
1715
1716 2012-08-24 Sriraman Tallam <tmsriram@google.com>
1717
1718 * gold.cc (queue_middle_tasks): Call layout again when unique
1719 segments for sections is desired.
1720 * layout.cc (Layout::Layout): Initialize new members.
1721 (Layout::get_output_section_flags): New function.
1722 (Layout::choose_output_section): Call get_output_section_flags.
1723 (Layout::layout): Make output section for mapping to a unique segment.
1724 (Layout::insert_section_segment_map): New function.
1725 (Layout::attach_allocated_section_to_segment): Make unique segment for
1726 output sections marked so.
1727 (Layout::segment_precedes): Check for unique segments when sorting.
1728 * layout.h (Layout::Unique_segment_info): New struct.
1729 (Layout::Section_segment_map): New typedef.
1730 (Layout::insert_section_segment_map): New function.
1731 (Layout::get_output_section_flags): New function.
1732 (Layout::is_unique_segment_for_sections_specified): New function.
1733 (Layout::set_unique_segment_for_sections_specified): New function.
1734 (Layout::unique_segment_for_sections_specified_): New member.
1735 (Layout::section_segment_map_): New member.
1736 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1737 Rename is_gc_pass_one to is_pass_one.
1738 Rename is_gc_pass_two to is_pass_two.
1739 Rename is_gc_or_icf to is_two_pass.
1740 Check for which pass based on whether symbols data is present.
1741 Make it two pass when unique segments for sections is desired.
1742 * output.cc (Output_section::Output_section): Initialize new
1743 members.
1744 * output.h (Output_section::is_unique_segment): New function.
1745 (Output_section::set_is_unique_segment): New function.
1746 (Output_section::is_unique_segment_): New member.
1747 (Output_section::extra_segment_flags): New function.
1748 (Output_section::set_extra_segment_flags): New function.
1749 (Output_section::extra_segment_flags_): New member.
1750 (Output_section::segment_alignment): New function.
1751 (Output_section::set_segment_alignment): New function.
1752 (Output_section::segment_alignment_): New member.
1753 (Output_segment::Output_segment): Initialize is_unique_segment_.
1754 (Output_segment::is_unique_segment): New function.
1755 (Output_segment::set_is_unique_segment): New function.
1756 (Output_segment::is_unique_segment_): New member.
1757 * plugin.cc (allow_unique_segment_for_sections): New function.
1758 (unique_segment_for_sections): New function.
1759 (Plugin::load): Add new functions to transfer vector.
1760 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1761 * Makefile.in: Regenerate.
1762 * testsuite/plugin_final_layout.sh: Check if unique segment
1763 functionality works.
1764 * testsuite/plugin_section_order.c (onload): Check if new interfaces
1765 are available.
1766 (allow_unique_segment_for_sections): New global.
1767 (unique_segment_for_sections): New global.
1768 (claim_file_hook): Call allow_unique_segment_for_sections.
1769 (all_symbols_read_hook): Call unique_segment_for_sections.
1770
1771 2012-08-22 Cary Coutant <ccoutant@google.com>
1772
1773 * layout.cc (Layout::include_section): Don't assert on GROUP
1774 sections with --emit-relocs.
1775
1776 2012-08-21 Cary Coutant <ccoutant@google.com>
1777
1778 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1779 if --export-dynamic-symbol names an undef symbol.
1780
1781 2012-08-18 Alan Modra <amodra@gmail.com>
1782
1783 * powerpc.cc: Formatting and white space.
1784 (Powerpc_relobj): Rename got2_section_ to special_.
1785 Add opd_ent_shndx_ and opd_ent_off_ vectors.
1786 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1787 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1788 (Target_powerpc): Add Address typedef and invalid_address. Use
1789 throughout.
1790 (Target_powerpc::is_branch_reloc): New function.
1791 (Powerpc_relocate_functions): Add Address typedef, use throughout.
1792 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1793 for dst_mask, value and addend.
1794 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1795 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1796 (Output_data_glink::do_write): Correct toc base. Don't try to use
1797 uint16_t for 24-bit offset. Use get_output_section_offset and
1798 check return.
1799 (Target_powerpc::Scan::local): Handle more relocs.
1800 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1801 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1802 Plug in toc restoring insn after plt calls. Translate branches
1803 to function descriptor symbols to corresponding entry point.
1804 (Target_powerpc::relocate_for_relocatable): Check return from
1805 get_output_section_offset.
1806 * symtab.h: Comment typo.
1807
1808 2012-08-14 Ian Lance Taylor <iant@google.com>
1809
1810 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1811 unsupported_relocal_local to call unsupported_reloc_global.
1812
1813 2012-08-14 Nick Clifton <nickc@redhat.com>
1814
1815 PR ld/14265
1816 * script-sections.cc (Sections_element::output_section_name): Add
1817 keep return parameter.
1818 (Output_section_element::match_name): Add keep return parameter.
1819 Return the value of the keep_ member.
1820 * script-sections.h (class Output_section): Update
1821 output_section_name prototype.
1822 * layout.cc (Layout::keep_input_section): New public member
1823 function.
1824 (Layout::choose_output_section): Pass keep parameter to
1825 output_section_name.
1826 * layout.h (class Layout): Add keep_input_section.
1827 * object.cc (Sized_relobj_file::do_layout): Check for kept input
1828 sections.
1829 * testsuite/Makefile.am: Add a test.
1830 * testsuite/Makefile.in: Regenerate.
1831 * testsuite/pr14265.c: Source file for the test.
1832 * testsuite/pr14265.t: Linker script for the test.
1833 * testsuite/pr14265.sh: Shell script for the test.
1834
1835 2012-08-14 Alan Modra <amodra@gmail.com>
1836
1837 * target.h (Target::output_section_name): New function.
1838 (Target::do_output_section_name): New function.
1839 * layout.cc (Layout::choose_output_section): Call the above.
1840 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1841
1842 2012-08-14 Alan Modra <amodra@gmail.com>
1843
1844 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1845 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1846 for replace_constant call.
1847 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1848 (Output_data_glink::do_print_to_mapfile): New function.
1849 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1850 (Target_powerpc::Relocate::relocate): Likewise.
1851
1852 2012-08-14 Alan Modra <amodra@gmail.com>
1853
1854 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1855 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1856 (Output_data_glink::add_entry,find_entry): Remove shndx param.
1857 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
1858 all references to shndx_. Handle special case for R_PPC_PLTREL24
1859 here.
1860 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1861 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1862 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1863 here.
1864 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1865 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1866
1867 2012-08-12 Alan Modra <amodra@gmail.com>
1868
1869 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
1870 (glink insn constants): Use uint32_t.
1871 (Output_data_glink::add_entry): Use insert, not [] operator.
1872
1873 2012-08-11 Alan Modra <amodra@gmail.com>
1874
1875 * object.h (Sized_relobj_file::find_shdr): New function.
1876 (Sized_relobj_file::find_special_sections): New function.
1877 * object.cc (Sized_relobj_file::find_shdr): New function.
1878 (Sized_relobj_file::find_eh_frame): Use find_shdr.
1879 (Sized_relobj_file::find_special_sections): New function, split out..
1880 (Sized_relobj_file::do_read_symbols): ..from here.
1881 * output.h (Output_data_got::replace_constant): New function.
1882 (Output_data_got::num_entries): New function.
1883 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1884 (Output_data_got::got_offset): Protected rather than private.
1885 (Output_data_got::replace_got_entry): New function.
1886 * output.cc (Output_data_got::replace_got_entry): New function.
1887 * powerpc.cc (class Powerpc_relobj): New.
1888 (class Powerpc_relocate_functions): Delete all psymval variants or
1889 convert to value,addend type. Delete pcrela, pcrela_unaligned.
1890 Implement _ha functions using corresponding _hi function.
1891 (Powerpc_relobj::find_special_sections): New function.
1892 (Target_powerpc::do_make_elf_object): New function.
1893 (class Output_data_got_powerpc): New.
1894 (class Output_data_glink): New.
1895 (class Powerpc_scan_relocatable_reloc): New.
1896 Many more changes througout file.
1897
1898 2012-08-09 Nick Clifton <nickc@redhat.com>
1899
1900 * po/vi.po: Updated Vietnamese translation.
1901
1902 2012-08-07 Ian Lance Taylor <iant@google.com>
1903
1904 * layout.cc (Layout::add_target_dynamic_tags): If
1905 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1906 plt_rel.
1907
1908 2012-07-30 Nick Clifton <nickc@redhat.com>
1909
1910 * po/gold.pot: Updated template.
1911 * po/es.po: Updated Spanish translation.
1912
1913 2012-07-18 Cary Coutant <ccoutant@google.com>
1914
1915 PR gold/14344
1916 * configure.ac: Add check for -gpubnames support.
1917 * configure: Regenerate.
1918 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1919 support; force -gno-pubnames.
1920 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1921 support.
1922 (gdb_index_test_4): New test.
1923 * testsuite/Makefile.in: Regenerate.
1924 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1925 * testsuite/gdb_index_test_2.sh: Likewise.
1926 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1927 * testsuite/gdb_index_test_4.sh: New script.
1928 * testsuite/gdb_index_test_comm.sh: New script with common code;
1929 don't look for space after colon.
1930
1931 2012-07-16 Sriraman Tallam <tmsriram@google.com>
1932
1933 * gold.cc (queue_middle_tasks): Update function order only after
1934 deferred objects due to plugins are processed.
1935
1936 2012-07-11 Ian Lance Taylor <iant@google.com>
1937
1938 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1939 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1940 (Target_arm::scan_reloc_for_stub): Likewise.
1941 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1942 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1943 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1944 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1945 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1946
1947 2012-07-10 Dodji Seketeli <dodji@redhat.com>
1948 Ian Lance Taylor <iant@google.com>
1949
1950 PR gold/14309
1951 * configure.ac: Test whether std::tr1::hash<off_t> works.
1952 * gold.h: Add a specialization for std::tr1::hash<off_t> if
1953 needed.
1954 * output.h (class Output_fill): Add virtual destructor.
1955 * configure, config.in: Rebuild.
1956
1957 2012-06-22 Roland McGrath <mcgrathr@google.com>
1958
1959 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1960
1961 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
1962
1963 * plugin.cc (Plugin::load): Handle position independent executables.
1964
1965 2012-06-06 Cary Coutant <ccoutant@google.com>
1966
1967 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1968 add .debug_macro.
1969 (lines_only_debug_sections): Likewise.
1970 (gdb_fast_lookup_sections): New static array.
1971 (is_gdb_debug_section): Rename formal parameter.
1972 (is_lines_only_debug_section): Likewise.
1973 (is_gdb_fast_lookup_section): New function.
1974 (Layout::include_section): Check for ".zdebug_" prefix; pass
1975 section name suffix to is_gdb_debug_section, et al.; check for
1976 fast-lookup sections when building .gdb_index.
1977 * options.h (--strip-debug-gdb): Update GDB version number.
1978
1979 2012-06-06 Cary Coutant <ccoutant@google.com>
1980
1981 * configure.ac: Add check for fallocate.
1982 * configure: Regenerate.
1983 * config.in: Regenerate.
1984
1985 * options.h (class General_options): Add --mmap-output-file and
1986 --posix-fallocate options.
1987 * output.cc: (posix_fallocate): Remove; replace with...
1988 (gold_fallocate): New function.
1989 (Output_file::map_no_anonymous): Call gold_fallocate.
1990 (Output_file::map): Check --mmap-output-file option.
1991
1992 2012-06-05 Jing Yu <jingyu@google.com>
1993
1994 * gold.h (textdomain): Add do {} to empty while(0).
1995 (bindtextdomain): Likewise.
1996
1997 2012-06-04 Cary Coutant <ccoutant@google.com>
1998
1999 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2000 has_dynsym_index.
2001
2002 2012-05-25 Sriraman Tallam <tmsriram@google.com>
2003
2004 * symtab.cc (Symbol_table::define_special_symbol):
2005 Initialize *poldsym to prevent uninitialized variable errors.
2006
2007 2012-05-23 Cary Coutant <ccoutant@google.com>
2008
2009 * layout.cc (Layout::section_name_mapping): Add rules to handle
2010 exact match on .data.rel.ro.local or .data.rel.ro.
2011 (Layout::output_section_name): Check for exact matches.
2012
2013 2012-05-23 Cary Coutant <ccoutant@google.com>
2014
2015 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2016 more carefully.
2017
2018 2012-05-22 Cary Coutant <ccoutant@google.com>
2019
2020 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2021 object before exporting symbol.
2022
2023 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
2024
2025 * testsuite/tls_test.cc: Include "config.h" first.
2026 * testsuite/tls_test_c.c: Likewise.
2027
2028 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
2029 Nick Clifton <nickc@redhat.com>
2030
2031 PR 14072
2032 * configure.in: Add check that sysdep.h has been included before
2033 any system header files.
2034 * configure: Regenerate.
2035 * config.in: Regenerate.
2036
2037 2012-05-14 Cary Coutant <ccoutant@google.com>
2038
2039 * layout.cc (Layout::make_output_section): Mark .tdata section
2040 as RELRO.
2041 * testsuite/relro_test.cc: Add a TLS variable.
2042
2043 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
2044
2045 PR gold/14091
2046 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2047 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2048 R_X86_64_64.
2049
2050 2012-05-08 Cary Coutant <ccoutant@google.com>
2051
2052 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2053 (lines_only_debug_sections): Likewise.
2054
2055 2012-05-02 Roland McGrath <mcgrathr@google.com>
2056
2057 * nacl.cc: New file.
2058 * nacl.h: New file.
2059 * Makefile.am (CCFILES, HFILES): Add them.
2060 * Makefile.in: Regenerate.
2061 * i386.cc (Output_data_plt_i386_nacl): New class.
2062 (Output_data_plt_i386_nacl_exec): New class.
2063 (Output_data_plt_i386_nacl_dyn): New class.
2064 (Target_i386_nacl): New class.
2065 (Target_selector_i386_nacl): New class.
2066 (target_selector_i386): Use it instead of Target_selector_i386.
2067 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2068 (Target_x86_64_nacl): New class.
2069 (Target_selector_x86_64_nacl): New class.
2070 (target_selector_x86_64, target_selector_x32): Use it instead of
2071 Target_selector_x86_64.
2072 * arm.cc (Output_data_plt_arm_nacl): New class.
2073 (Target_arm_nacl): New class.
2074 (Target_selector_arm_nacl): New class.
2075 (target_selector_arm, target_selector_armbe): Use it instead of
2076 Target_selector_arm.
2077
2078 * target-select.cc (select_target): Take new Input_file* and off_t
2079 arguments, pass them on to recognize method of selector.
2080 * object.cc (make_elf_sized_object): Update caller.
2081 * parameters.cc (parameters_force_valid_target): Likewise.
2082 * incremental.cc (make_sized_incremental_binary): Likewise.
2083 * target-select.h: Update decl.
2084 (Target_selector::recognize): Take new Input_file* argument,
2085 pass it on to do_recognize.
2086 (Target_selector::do_recognize): Take new Input_file* argument.
2087 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2088 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2089 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2090 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2091
2092 * target.h (Target::Target_info): New members isolate_execinstr
2093 and rosegment_gap.
2094 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2095 * arm.cc (Target_arm::arm_info): Update initializer.
2096 * i386.cc (Target_i386::i386_info): Likewise.
2097 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2098 * sparc.cc (Target_sparc::sparc_info): Likewise.
2099 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2100 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2101 * layout.cc (Layout::attach_allocated_section_to_segment):
2102 Take new const Target* argument. If target->isolate_execinstr(), act
2103 like --rosegment.
2104 (Layout::find_first_load_seg): Take new const Target* argument;
2105 if target->isolate_execinstr(), reject PF_X segments.
2106 (Layout::relaxation_loop_body): Update caller.
2107 (Layout::set_segment_offsets): If target->isolate_execinstr(),
2108 reset file offset to zero when we hit LOAD_SEG, and then do a second
2109 loop over the segments before LOAD_SEG to reassign offsets after
2110 addresses have been determined. Handle target->rosegment_gap().
2111 (Layout::attach_section_to_segment): Take new const Target* argument;
2112 pass it to attach_allocated_section_to_segment.
2113 (Layout::make_output_section): Update caller.
2114 (Layout::attach_sections_to_segments): Take new const Target* argument;
2115 pass it to attach_section_to_segment.
2116 * gold.cc (queue_middle_tasks): Update caller.
2117 * layout.h (Layout): Update method decls with new arguments.
2118
2119 * arm.cc (Target_arm::Target_arm): Take optional argument for the
2120 Target_info pointer to use.
2121 (Target_arm::do_make_data_plt): New virtual method.
2122 (Target_arm::make_data_plt): New method that calls it.
2123 (Target_arm::make_plt_entry): Use it.
2124 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2125 for the section alignment.
2126 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2127 method.
2128 (Output_data_plt_arm::first_plt_entry_offset): Call it.
2129 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2130 method.
2131 (Output_data_plt_arm::get_plt_entry_size): Call it.
2132 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2133 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2134 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2135 method.
2136 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2137 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2138 method instead of sizeof(plt_entry).
2139 (Output_data_plt_arm::add_entry): Likewise.
2140 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2141 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2142 than static method.
2143 (Target_arm::plt_entry_size): Likewise.
2144 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2145 Move to ...
2146 (Output_data_plt_arm_standard): ... here, new class.
2147 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2148 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2149 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2150
2151 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2152 Take additional argument for the PLT entry size.
2153 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2154 Use get_plt_entry_size method rather than plt_entry_size variable.
2155 (Output_data_plt_x86_64::reserve_slot): Likewise.
2156 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2157 (Output_data_plt_x86_64::add_entry): Likewise.
2158 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2159 (Output_data_plt_x86_64::address_for_global): Likewise.
2160 (Output_data_plt_x86_64::address_for_local): Likewise.
2161 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2162 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2163 Make method non-static.
2164 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2165 method.
2166 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2167 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2168 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2169 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2170 virtual method.
2171 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2172 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2173 virtual method.
2174 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2175 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2176 virtual method.
2177 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2178 (Output_data_plt_x86_64::plt_entry_size)
2179 (Output_data_plt_x86_64::first_plt_entry)
2180 (Output_data_plt_x86_64::plt_entry)
2181 (Output_data_plt_x86_64::tlsdesc_plt_entry)
2182 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2183 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2184 (Output_data_plt_x86_64_standard): ... here, new class.
2185 (Target_x86_64::Target_x86_64): Take optional argument for the
2186 Target_info pointer to use.
2187 (Target_x86_64::do_make_data_plt): New virtual method.
2188 (Target_x86_64::make_data_plt): New method to call it.
2189 (Target_x86_64::init_got_plt_for_update): Use that.
2190 Call this->plt_->add_eh_frame method here.
2191 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2192 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2193 rather than static method.
2194 (Target_x86_64::plt_entry_size): Likewise.
2195 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2196 rather than plt_entry_size variable. Move guts of PLT filling to...
2197 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2198 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2199 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2200
2201 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2202 additional argument for the section alignment.
2203 Don't do add_eh_frame_for_plt here.
2204 (Output_data_plt_i386::first_plt_entry_offset): Make the method
2205 non-static. Use get_plt_entry_size method rather than plt_entry_size
2206 variable.
2207 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2208 method.
2209 (Output_data_plt_i386::get_plt_entry_size): Call it.
2210 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2211 (Output_data_plt_i386::add_eh_frame): New method to call it.
2212 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2213 method.
2214 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2215 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2216 method.
2217 (Output_data_plt_i386::fill_plt_entry): New method to call it.
2218 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2219 method instead of plt_entry_size.
2220 (Output_data_plt_i386::plt_entry_size)
2221 (Output_data_plt_i386::plt_eh_frame_fde_size)
2222 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2223 (Output_data_plt_i386_standard): ... here, new class.
2224 (Output_data_plt_i386_exec): New class.
2225 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2226 (Output_data_plt_i386_exec::first_plt_entry): ... here.
2227 (Output_data_plt_i386::exec_plt_entry): Move to ...
2228 (Output_data_plt_i386_exec::plt_entry): ... here.
2229 (Output_data_plt_i386_dyn): New class.
2230 (Output_data_plt_i386::first_plt_entry): Move to ...
2231 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2232 (Output_data_plt_i386::dyn_plt_entry): Move to ...
2233 (Output_data_plt_i386_dyn::plt_entry): ... here.
2234 (Target_i386::Target_i386): Take optional argument for the Target_info
2235 pointer to use.
2236 (Target_i386::do_make_data_plt): New virtual method.
2237 (Target_i386::make_data_plt): New method to call it.
2238 (Target_i386::make_plt_section): Use that.
2239 Call this->plt_->add_eh_frame method here.
2240 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2241 rather than plt_entry_size variable.
2242 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2243 (Output_data_plt_i386::address_for_local): Likewise.
2244 (Output_data_plt_i386::do_write): Likewise.
2245 Move guts of PLT filling to...
2246 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2247 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2248 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2249 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2250
2251 2012-05-01 Cary Coutant <ccoutant@google.com>
2252
2253 * dwarf_reader.cc (Dwarf_die::read_attributes)
2254 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2255 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2256 * reduced_debug_output.cc
2257 (Output_reduced_debug_info_section::get_die_end): Remove
2258 DW_FORM_GNU_ref_index. Add default case.
2259
2260 2012-04-26 Mark Wielaard <mjw@redhat.com>
2261
2262 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2263 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2264 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2265 DW_AT_high_pc as offset from DW_AT_low_pc.
2266
2267 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2268 * testsuite/Makefile.in: Regenerate.
2269 * testsuite/gdb_index_test_3.c: New test source file.
2270 * testsuite/gdb_index_test_3.sh: New test source file.
2271
2272 2012-04-25 Ian Lance Taylor <iant@google.com>
2273
2274 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2275 pointer.
2276 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2277 as a class, not a struct.
2278 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2279 (Target_arm::apply_cortex_a8_workaround): Likewise.
2280 * gc.h: Declare Reloc_types as a struct, not a class.
2281 * object.h: Declare Symbols_data as a struct.
2282 * reloc.h: Declare Read_relocs_data as a struct.
2283 * target.h: Declare Relocate_info as a struct.
2284
2285 2012-04-24 David S. Miller <davem@davemloft.net>
2286
2287 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2288 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2289 and R_SPARC_WPLT30.
2290
2291 2012-04-24 Cary Coutant <ccoutant@google.com>
2292
2293 * incremental-dump.cc (find_input_containing_global): Replace
2294 magic number with symbolic constant.
2295 (dump_incremental_inputs): Update version number.
2296 * incremental.cc (Output_section_incremental_inputs): Update version
2297 number; import symbolic constants from Incremental_inputs_reader.
2298 (Incremental_inputs::create_data_sections): Align relocations
2299 section correctly for 64-bit targets.
2300 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2301 constants; add padding.
2302 (Output_section_incremental_inputs::write_header): Add assert for
2303 header_size.
2304 (Output_section_incremental_inputs::write_input_files): Add assert
2305 for input_entry_size.
2306 (Output_section_incremental_inputs::write_info_blocks): Add padding;
2307 add assert for object_info_size, input_section_entry_size,
2308 global_sym_entry_size.
2309 * incremental.h (Incremental_inputs_reader): Add symbolic constants
2310 for data structure sizes; use them.
2311 (Incremental_input_entry_reader): Import symbolic constants from
2312 Incremental_inputs_reader; use them.
2313
2314 2012-04-23 David S. Miller <davem@davemloft.net>
2315
2316 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2317 and elf_flags_set_.
2318 (Target_sparc::Target_sparc): Initialize new fields.
2319 (Target_sparc::do_make_elf_object): New function.
2320 (Target_sparc::do_adjust_elf_header): New function.
2321
2322 2012-04-23 Cary Coutant <ccoutant@google.com>
2323
2324 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2325 CU range table of gdb index.
2326
2327 2012-04-20 David S. Miller <davem@davemloft.net>
2328
2329 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2330 instead of false.
2331
2332 2012-04-16 David S. Miller <davem@davemloft.net>
2333
2334 * sparc.cc (Target_sparc::got_address): New function.
2335 (Sparc_relocate_functions::gdop_hix22): New function.
2336 (Sparc_relocate_functions::gdop_lox10): New function.
2337 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2338 relocs.
2339 (Target_sparc::Scan::local): Likewise if the global symbol is not
2340 preemptible and is not IFUNC.
2341 (Target_sparc::Relocate::relocate): Perform GOTDATA code
2342 transformations for local and non-preemptible non-IFUNC global
2343 symbols.
2344
2345 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2346 writing out 64-bit part of ranges.
2347
2348 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2349 -fpic and -fpie respectively.
2350 * Makefile.in: Regenerate.
2351
2352 * sparc.cc (class Target_sparc): Add rela_ifunc_.
2353 (Target_sparc::Target_sparc): Initialize new field.
2354 (Target_sparc::do_plt_section_for_global): New function.
2355 (Target_sparc::do_plt_section_for_local): New function.
2356 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2357 (Target_sparc::make_plt_section): New function, broken out of
2358 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
2359 (Target_sparc::make_plt_entry): Call make_plt_section.
2360 (Target_sparc::make_local_ifunc_plt_entry): New function.
2361 (Target_sparc::rela_ifunc_section): New function.
2362 (Target_sparc::plt_section): Remove const.
2363 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
2364 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2365 and ifunc_count_ fields.
2366 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2367 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2368 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2369 (Output_data_plt_sparc::rela_ifunc): New function.
2370 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2371 (Output_data_plt_sparc::has_ifunc_section): New function.
2372 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2373 (Output_data_plt_sparc::address_for_global): New function.
2374 (Output_data_plt_sparc::address_for_local): New function.
2375 (Output_data_plt_sparc::plt_index_to_offset): New function.
2376 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2377 and entry_count.
2378 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2379 entry_count.
2380 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2381 R_SPARC_JMP_IREL to switch.
2382 (Target_sparc::Scan::check_non_pic): Likewise.
2383 (Target_sparc::Scan::local): Handle IFUNC symbols.
2384 (Target_sparc::Scan::local): Likewise.
2385 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2386 and plt_address_for_local.
2387 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2388 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2389
2390 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2391 (class Output_data_reloc): Adjust calls to Output_reloc_type.
2392 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2393 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2394 global relocs too.
2395 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2396 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2397 calls.
2398 * sparc.cc (Target_sparc::Scan::global): Likewise.
2399 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2400
2401 2012-04-16 Cary Coutant <ccoutant@google.com>
2402
2403 * archive.cc (Library_base::should_include_member): Check for
2404 --export-dynamic-symbol.
2405 * options.h (class General_options): Add --export-dynamic-symbol.
2406 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2407 --export-dynamic-symbol.
2408 (Symbol_table::gc_mark_undef_symbols): Likewise.
2409 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2410
2411 2012-04-12 David S. Miller <davem@davemloft.net>
2412
2413 * sparc.cc (Reloc::wdisp10): New relocation method.
2414 (Reloc::h34): Likewise.
2415 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2416 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2417 R_SPARC_WDISP10.
2418 (Target_sparc::Scan::local): Likewise.
2419 (Target_sparc::Scan::global): Likewise.
2420 (Target_sparc::Relocate::relocate): Likewise.
2421
2422 2012-04-09 Cary Coutant <ccoutant@google.com>
2423
2424 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2425 low_pc == 0.
2426
2427 2012-04-06 Ian Lance Taylor <iant@google.com>
2428
2429 * timer.cc: #include <unistd.h>.
2430
2431 2012-04-06 Roland McGrath <mcgrathr@google.com>
2432
2433 * configure.in (AC_CHECK_HEADERS): Add locale.h.
2434 * config.in: Regenerate.
2435 * configure: Regenerate.
2436
2437 2012-04-05 Nick Clifton <nickc@redhat.com>
2438
2439 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2440 (AM_LC_MESSAGES): Add.
2441 * aclocal.m4: Regenerate.
2442 * config.in: Regenerate.
2443 * configure: Regenerate.
2444
2445 2012-03-21 Cary Coutant <ccoutant@google.com>
2446
2447 * Makefile.am: Add gdb-index.cc, gdb-index.h.
2448 * Makefile.in: Regenerate.
2449 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2450 (Sized_elf_reloc_mapper::symbol_section): New function.
2451 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2452 (make_elf_reloc_mapper): New function.
2453 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2454 (Dwarf_abbrev_table::do_read_abbrevs): New function.
2455 (Dwarf_abbrev_table::do_get_abbrev): New function.
2456 (Dwarf_ranges_table::read_ranges_table): New function.
2457 (Dwarf_ranges_table::read_range_list): New function.
2458 (Dwarf_pubnames_table::read_section): New function.
2459 (Dwarf_pubnames_table::read_header): New function.
2460 (Dwarf_pubnames_table::next_name): New function.
2461 (Dwarf_die::Dwarf_die): New function.
2462 (Dwarf_die::read_attributes): New function.
2463 (Dwarf_die::skip_attributes): New function.
2464 (Dwarf_die::set_name): New function.
2465 (Dwarf_die::set_linkage_name): New function.
2466 (Dwarf_die::attribute): New function.
2467 (Dwarf_die::string_attribute): New function.
2468 (Dwarf_die::int_attribute): New function.
2469 (Dwarf_die::uint_attribute): New function.
2470 (Dwarf_die::ref_attribute): New function.
2471 (Dwarf_die::child_offset): New function.
2472 (Dwarf_die::sibling_offset): New function.
2473 (Dwarf_info_reader::check_buffer): New function.
2474 (Dwarf_info_reader::parse): New function.
2475 (Dwarf_info_reader::do_parse): New function.
2476 (Dwarf_info_reader::do_read_string_table): New function.
2477 (Dwarf_info_reader::lookup_reloc): New function.
2478 (Dwarf_info_reader::get_string): New function.
2479 (Dwarf_info_reader::visit_compilation_unit): New function.
2480 (Dwarf_info_reader::visit_type_unit): New function.
2481 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2482 Sized_elf_reloc_mapper.
2483 (Sized_dwarf_line_info::symbol_section): Remove function.
2484 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2485 (Sized_dwarf_line_info::read_line_mappings): Remove object
2486 parameter, adjust callers.
2487 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2488 * dwarf_reader.h: Include <sys/types.h>.
2489 (class Track_relocs): Remove forward declaration.
2490 (class Elf_reloc_mapper): New class.
2491 (class Sized_elf_reloc_mapper): New class.
2492 (class Dwarf_abbrev_table): New class.
2493 (class Dwarf_range_list): New class.
2494 (class Dwarf_ranges_table): New class.
2495 (class Dwarf_pubnames_table): New class.
2496 (class Dwarf_die): New class.
2497 (class Dwarf_info_reader): New class.
2498 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2499 (Sized_dwarf_line_info::symbol_section): Remove member function.
2500 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2501 base class.
2502 * gdb-index.cc: New source file.
2503 * gdb-index.h: New source file.
2504 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2505 and .debug_types sections, call Layout::add_to_gdb_index.
2506 (Sized_relobj_incr::do_section_name): Implement.
2507 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2508 return type; Implement.
2509 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2510 return type.
2511 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2512 parameter list and return type.
2513 (Sized_incr_dynobj::do_section_contents): Likewise.
2514 * layout.cc: Include gdb-index.h.
2515 (Layout::Layout): Initialize gdb_index_data_.
2516 (Layout::init_fixed_output_section): Check for .gdb_index section.
2517 (Layout::add_to_gdb_index): New function. Instantiate.
2518 * layout.h: Add forward declaration for class Gdb_index.
2519 (Layout::add_to_gdb_index): New member function.
2520 (Layout::gdb_index_data_): New data member.
2521 * main.cc: Include gdb-index.h.
2522 (main): Print statistics for gdb index.
2523 * object.cc (Object::section_contents): Move code into
2524 do_section_contents.
2525 (need_decompressed_section): Check for sections needed when building
2526 gdb index.
2527 (build_compressed_section_map): Likewise.
2528 (Sized_relobj_file::do_read_symbols): Need local symbols when building
2529 gdb index.
2530 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2531 sections; call Layout::add_to_gdb_index.
2532 (Sized_relobj_file::do_decompressed_section_contents): Call
2533 do_section_contents directly.
2534 * object.h (Object::do_section_contents): Adjust parameter list and
2535 return type.
2536 (Object::do_decompressed_section_contents): Call do_section_contents
2537 directly.
2538 (Sized_relobj_file::do_section_contents): Adjust parameter list and
2539 return type.
2540 * options.h (class General_options): Add --gdb-index option.
2541 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2542 list and return type.
2543 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2544 * reloc.h (Track_relocs::checkpoint): New function.
2545 (Track_relocs::reset): New function.
2546
2547 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2548 New test cases.
2549 * testsuite/Makefile.in: Regenerate.
2550 * testsuite/gdb_index_test.cc: New test source file.
2551 * testsuite/gdb_index_test_1.sh: New test source file.
2552 * testsuite/gdb_index_test_2.sh: New test source file.
2553
2554 2012-03-19 Doug Kwan <dougkwan@google.com>
2555
2556 * arm.cc (Target_arm::do_define_standard_symbols): New method.
2557 (Target_arm::do_finalize_sections): Remove code which defines
2558 __exidx_start and __exidx_end. Make symbol table parameter
2559 anonymous as it is not used.
2560 * gold.cc (queue_middle_tasks): Call target hook to define any
2561 target-specific symbols.
2562 * target.h (Target::define_standard_symbols): New method.
2563 (Target::do_define_standard_symbols): Same.
2564 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2565 * testsuite/Makefile.in: Regenerate.
2566 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2567 and __exidx_end.
2568 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2569 relocations are generated for __exidx_start and __exidx_end.
2570
2571 2012-03-16 Doug Kwan <dougkwan@google.com>
2572
2573 * testsuite/Makefile.am: Disable test initpri3b.
2574 * testsuite/Makefile.in: Regenerate.
2575
2576 2012-03-15 Doug Kwan <dougkwan@google.com>
2577
2578 * arm.cc (Target_arm::got_section): Make .got section read-only
2579 if -z now is given.
2580
2581 2012-03-15 Ian Lance Taylor <iant@google.com>
2582
2583 PR gold/13850
2584 * layout.cc (Layout::make_output_section): Correctly mark
2585 SHT_INIT_ARRAY, et. al., as relro.
2586
2587 2012-03-14 Doug Kwan <dougkwan@google.com>
2588
2589 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2590 dynamic relocations for protected symbols in shared objects.
2591
2592 2012-03-13 Ian Lance Taylor <iant@google.com>
2593
2594 * resolve.cc (Symbol_table::resolve): When merging common symbols,
2595 keep the larger alignment.
2596
2597 2012-03-12 Cary Coutant <ccoutant@google.com>
2598
2599 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2600 handling of DW_LNE_define_file.
2601
2602 2012-03-12 Cary Coutant <ccoutant@google.com>
2603
2604 * reduced_debug_output.cc
2605 (Output_reduced_debug_info_section::get_die_end): Add new FORM
2606 codes to switch.
2607
2608 2012-02-29 Cary Coutant <ccoutant@google.com>
2609
2610 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2611
2612 2012-02-29 Cary Coutant <ccoutant@google.com>
2613
2614 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2615 Call Object::decompressed_section_contents.
2616 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2617 New dtor.
2618 (Sized_dwarf_line_info::buffer_start_): New data member.
2619 * merge.cc (Output_merge_data::do_add_input_section): Call
2620 Object::decompressed_section_contents.
2621 (Output_merge_string::do_add_input_section): Likewise.
2622 * object.cc (need_decompressed_section): New function.
2623 (build_compressed_section_map): Decompress sections needed later.
2624 (Sized_relobj_file::do_decompressed_section_contents): New function.
2625 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2626 * object.h (Object::decompressed_section_contents): New function.
2627 (Object::discard_decompressed_sections): New function.
2628 (Object::do_decompressed_section_contents): New function.
2629 (Object::do_discard_decompressed_sections): New function.
2630 (Compressed_section_info): New type.
2631 (Compressed_section_map): Include decompressed section contents.
2632 (Sized_relobj_file::do_decompressed_section_contents): New function.
2633 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2634
2635 2012-02-16 Cary Coutant <ccoutant@google.com>
2636
2637 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2638 * testsuite/Makefile.in: Regenerate.
2639
2640 2012-02-14 Cary Coutant <ccoutant@google.com>
2641
2642 * options.cc (General_options::finalize): Disallow -pie and -static.
2643
2644 2012-02-03 Doug Kwan <dougkwan@google.com>
2645
2646 * arm.cc (Arm_relocate_functions::abs8,
2647 Arm_relocate_functions::abs16): Use
2648 Bits::has_signed_unsigned_overflow32.
2649 (Arm_relocate_functions::thm_abs8): Correct range of
2650 overflow check.
2651 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2652 in assertions.
2653
2654 2012-02-02 Doug Kwan <dougkwan@google.com>
2655
2656 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2657 position independent outputs, not just shared objects.
2658
2659 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
2660
2661 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2662 * configure: Regenerated.
2663
2664 2012-01-27 Ian Lance Taylor <iant@google.com>
2665
2666 * reloc.h (Bits): New class with static functions, copied from
2667 namespace utils in arm.cc.
2668 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
2669 instead.
2670
2671 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2672
2673 * incremental.cc (write_info_blocks): Correct relocation offset.
2674
2675 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2676
2677 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2678 (Relocate::tls_gd_to_le): Likewise.
2679
2680 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2681
2682 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2683
2684 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2685
2686 * configure.ac: Check if -mcmodel=medium works.
2687 * configure: Regenerated.
2688
2689 2012-01-24 Cary Coutant <ccoutant@google.com>
2690
2691 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2692 definition and ...
2693 (read_unsigned_LEB_128_x): ... this new function.
2694 (read_signed_LEB_128): Replaced with inline definition and ...
2695 (read_signed_LEB_128_x): ... this new function.
2696 * int_encoding.h (read_unsigned_LEB_128_x): New function.
2697 (read_unsigned_LEB_128): Add inline definition.
2698 (read_signed_LEB_128_x): New function.
2699 (read_signed_LEB_128): Add inline definition.
2700 * testsuite/Makefile.am (leb128_unittest): New unit test.
2701 * testsuite/Makefile.in: Regenerate.
2702 * testsuite/leb128_unittest.cc: New unit test.
2703
2704 2012-01-23 Ian Lance Taylor <iant@google.com>
2705
2706 PR gold/13617
2707 * i386.cc (Target_i386::do_code_fill): When using a jmp
2708 instruction, pad with nop instructions.
2709 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2710
2711 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
2712
2713 * x86_64.cc (gc_process_relocs): Add typename on types used in
2714 template.
2715 (scan_relocs): Likewise.
2716 (relocate_section): Likewise.
2717 (apply_relocation): Likewise.
2718
2719 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
2720
2721 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2722 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2723 under x32.
2724
2725 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
2726
2727 * x86_64.cc: Initial support for x32.
2728
2729 2012-01-03 Cary Coutant <ccoutant@google.com>
2730
2731 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2732 Use abstract base class for GOT.
2733 * gold/output.h (class Output_data_got_base): New abstract base class.
2734 (class Output_data_got): Derive from new base class, adjust ctors.
2735 (Output_data_got::reserve_slot): Make virtual; rename to
2736 do_reserve_slot; Adjust callers.
2737 * gold/target.h (Sized_target::init_got_plt_for_update): Return
2738 pointer to abstract base class.
2739 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2740
2741 2011-12-18 Ian Lance Taylor <iant@google.com>
2742
2743 * object.h (Relobj::local_symbol_value): New function.
2744 (Relobj::local_plt_offset): New function.
2745 (Relobj::local_has_got_offset): New function.
2746 (Relobj::local_got_offset): New function.
2747 (Relobj::set_local_got_offset): New function.
2748 (Relobj::do_local_symbol_value): New pure virtual function.
2749 (Relobj::do_local_plt_offset): Likewise.
2750 (Relobj::do_local_has_got_offset): Likewise.
2751 (Relobj::do_local_got_offset): Likewise.
2752 (Relobj::do_set_local_got_offset): Likewise.
2753 (Sized_relobj::do_local_has_got_offset): Rename from
2754 local_has_got_offset.
2755 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2756 (Sized_relobj::do_set_local_got_offset): Rename from
2757 set_local_got_offset.
2758 (Sized_relobj_file::do_local_plt_offset): Rename from
2759 local_plt_offset.
2760 (Sized_relobj_file::do_local_symbol_value): New function.
2761 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2762 local_plt_offset.
2763 * output.cc (Output_data_got::Got_entry::write): Change object to
2764 Relobj. Use local_symbol_value.
2765 (Output_data_got::add_global_with_rel): Change rel_dyn to
2766 Output_data_reloc_generic*. Use add_global_generic.
2767 (Output_data_got::add_global_with_rela): Remove. Change all
2768 callers to use add_global_with_rel.
2769 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2770 Output_data_reloc_generic*. Use add_global_generic.
2771 (Output_data_got::add_global_pair_with_rela): Remove. Change all
2772 callers to use add_global_pair_with_rel.
2773 (Output_data_got::add_local): Change object to Relobj*.
2774 (Output_data_got::add_local_plt): Likewise.
2775 (Output_data_got::add_local_with_rel): Change object to Relobj*,
2776 change rel_dyn to Output_data_reloc_generic*. Use
2777 add_local_generic.
2778 (Output_data_got::add_local_with_rela): Remove. Change all
2779 callers to use all_local_with_rel.
2780 (Output_data_got::add_local_pair_with_rel): Change object to
2781 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
2782 add_output_section_generic.
2783 (Output_data_got::add_local_pair_with_rela): Remove. Change all
2784 callers to use add_local_pair_with_rel.
2785 (Output_data_got::reserve_local): Change object to Relobj*.
2786 * output.h: (class Output_data_reloc_generic): Add pure virtual
2787 declarations for add_global_generic, add_local_generic,
2788 add_output_section_generic.
2789 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2790 functions for Output_data_reloc_generic. Update declarations for
2791 changes listed in output.cc.
2792 (class Output_data_got): Change template parameter to got_size.
2793 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
2794 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2795 function.
2796 (Sized_relobj_incr::do_local_plt_offset): New function.
2797 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2798 add_global_generic.
2799
2800 2011-12-17 Cary Coutant <ccoutant@google.com>
2801
2802 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2803 * resolve.cc (Symbol_table::resolve): Likewise.
2804 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2805 arrays.
2806 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2807
2808 2011-12-16 Ian Lance Taylor <iant@google.com>
2809
2810 * output.h (Output_data_reloc_generic::add): Only call
2811 add_dynamic_reloc if this is a dynamic reloc section.
2812
2813 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
2814
2815 PR gold/13505
2816 * target-reloc.h (apply_relocation): Replace <64, false> with
2817 <size, big_endian>.
2818
2819 2011-11-25 Nick Clifton <nickc@redhat.com>
2820
2821 * po/it.po: New Italian translation.
2822
2823 2011-11-17 Sterling Augustine <saugustine@google.com>
2824
2825 * script.cc (script_include_directive): Implement.
2826 (read_script_file): New local variables name and search_path. Update
2827 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2828 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2829 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2830
2831 2011-11-11 Sterling Augustine <saugustine@google.com>
2832
2833 * yyscript.y (section_cmd): Add support for INCLUDE directive.
2834 (file_or_sections_cmd): Likewise.
2835
2836 2011-11-11 Doug Kwan <dougkwan@google.com>
2837
2838 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2839 if --just-symbols is given.
2840
2841 2011-11-10 Doug Kwan <dougkwan@google.com>
2842
2843 PR gold/13362
2844 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2845 when processing data relocs.
2846 * reloc.h (Relocate_functions::rel_unaligned): New method.
2847 (Relocate_functions::pcrel_unaligned): Ditto.
2848 (Relocate_functions::rel32_unaligned): Ditto.
2849 (Relocate_functions::pcrel32_unaligned): Ditto.
2850
2851 2011-11-09 Doug Kwan <dougkwan@google.com>
2852
2853 PR gold/13362
2854 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2855 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2856 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2857 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2858 (Relocate_functions::rel_unaligned): New.
2859 (Relocate_functions::rel32_unaligned): New.
2860 * target-reloc.h (relocate_for_relocatable): Add code to handle
2861 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2862 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2863 arm_unaligned_reloc_r): New targets.
2864 * testsuite/Makefile.in: Regenerate.
2865 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2866 linking.
2867
2868 2011-11-02 Ian Lance Taylor <iant@google.com>
2869
2870 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
2871 NATIVE_LINKER.
2872 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2873 * options.cc (General_options::finalize): Use library search path
2874 from configure script if specified. If not native and no sysroot,
2875 only search TOOLLIBDIR.
2876 * options.h (Search_directory::Search_directory): Change name to
2877 const std::string&.
2878 (General_options::add_to_library_path_with_sysroot): Change arg to
2879 const std::string&.
2880 * configure, Makefile.in, config.in: Rebuild.
2881
2882 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2883
2884 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2885 we are working around the ARM1176 Erratum.
2886 * options.h (General_options::fix_arm1176): Add option.
2887 * testsuite/Makefile.am: Add testcases, and keep current ones
2888 working.
2889 * testsuite/Makefile.in: Regenerate.
2890 * testsuite/arm_fix_1176.s: New file.
2891 * testsuite/arm_fix_1176.sh: Likewise.
2892
2893 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2894
2895 * arm.cc (Target_arm::Target_arm): Remove initialisation of
2896 may_use_blx_.
2897 (Target_arm::may_use_blx): Remove method.
2898 (Target_arm::set_may_use_blx): Likewise.
2899 (Target_arm::may_use_v4t_interworking): New method.
2900 (Target_arm::may_use_v5t_interworking): Likewise.
2901 (Target_arm::may_use_blx_): Remove member variable.
2902 (Arm_relocate_functions::arm_branch_common): Check for v5T
2903 interworking.
2904 (Arm_relocate_functions::thumb_branch_common): Likewise.
2905 (Reloc_stub::stub_type_for_reloc): Likewise.
2906 (Target_arm::do_finalize_sections): Correct interworking checks.
2907 * testsuite/Makefile.am: Add new tests.
2908 * testsuite/Makefile.in: Regenerate.
2909 * testsuite/arm_farcall_arm_arm.s: New test.
2910 * testsuite/arm_farcall_arm_arm.sh: Likewise.
2911 * testsuite/arm_farcall_arm_thumb.s: Likewise.
2912 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2913 * testsuite/arm_farcall_thumb_arm.s: Likewise.
2914 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2915 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2916 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2917
2918 2011-10-31 Cary Coutant <ccoutant@google.com>
2919
2920 PR gold/13023
2921 * expression.cc (Expression::eval_with_dot): Add
2922 is_section_dot_assignment parameter.
2923 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
2924 absolute and assigning to dot within a section.
2925 * script-sections.cc
2926 (Output_section_element_assignment::set_section_addresses): Pass
2927 dot_section to set_if_absolute.
2928 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2929 as is_section_dot_assignment flag to eval_with_dot.
2930 (Output_section_element_dot_assignment::set_section_addresses):
2931 Likewise.
2932 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2933 parameter. Also set value if relative to dot_section; set the
2934 symbol's output_section.
2935 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2936 parameter. Adjust all callers.
2937 (Expression::eval_maybe_dot): Likewise.
2938 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2939 Adjust all callers.
2940 * testsuite/script_test_2.t: Test assignment of an absolute value
2941 to dot within an output section element.
2942
2943 2011-10-31 Cary Coutant <ccoutant@google.com>
2944
2945 * options.h (class General_options): Add --[no-]gnu-unique options.
2946 * symtab.cc (Symbol_table::sized_write_globals): Convert
2947 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2948
2949 2011-10-31 Cary Coutant <ccoutant@google.com>
2950
2951 PR gold/13359
2952 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2953 unnecessary assertion.
2954 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2955
2956 2011-10-31 Sriraman Tallam <tmsriram@google.com>
2957
2958 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2959 gc_mark_symbol.
2960 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2961 gc_mark_symbol.
2962 Change to just keep the section associated with symbol.
2963 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2964 they are externally visible and --export-dynamic is turned on.
2965 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2966
2967 2011-10-19 Ian Lance Taylor <iant@google.com>
2968
2969 PR gold/13163
2970 * script-sections.cc
2971 (Output_section_element_dot_assignment::needs_output_section): New
2972 function.
2973
2974 2011-10-19 Ian Lance Taylor <iant@google.com>
2975
2976 PR gold/13204
2977 * layout.cc (Layout::segment_precedes): Don't assert failure if a
2978 --section-start option was seen.
2979 * options.h (General_options::any_section_start): New function.
2980
2981 2011-10-18 David S. Miller <davem@davemloft.net>
2982
2983 PR binutils/13301
2984 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2985 member to track relocation locations that have moved during TLS
2986 reloc optimizations.
2987 (Target_sparc::Relocate::Relocate): Initialize to NULL.
2988 (Target_sparc::Relocate::relocate): Adjust view down by 4
2989 bytes if it matches reloc_adjust_addr_.
2990 (Target_sparc::Relocate::relocate_tls): Always move the
2991 __tls_get_addr call delay slot instruction forward 4 bytes when
2992 performing relaxation.
2993
2994 2011-10-18 Cary Coutant <ccoutant@google.com>
2995
2996 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2997 (Output_file::map_no_anonymous): Check for non-zero
2998 return code from posix_fallocate.
2999
3000 2011-10-17 Cary Coutant <ccoutant@google.com>
3001
3002 PR gold/13245
3003 * plugin.cc (is_visible_from_outside): Check for symbols
3004 referenced from dynamic objects.
3005 * resolve.cc (Symbol_table::resolve): Don't count references
3006 from dynamic objects as references from real ELF files.
3007 * testsuite/plugin_test_2.sh: Adjust expected result.
3008
3009 2011-10-17 Cary Coutant <ccoutant@google.com>
3010
3011 * gold.cc: Include timer.h.
3012 (queue_middle_tasks): Stamp time.
3013 (queue_final_tasks): Likewise.
3014 * main.cc (main): Store timer in parameters. Print timers
3015 for each pass.
3016 * parameters.cc (Parameters::Parameters): Initialize timer_.
3017 (Parameters::set_timer): New function.
3018 (set_parameters_timer): New function.
3019 * parameters.h (Parameters::set_timer): New function.
3020 (Parameters::timer): New function.
3021 (Parameters::timer_): New data member.
3022 (set_parameters_timer): New function.
3023 * timer.cc (Timer::stamp): New function.
3024 (Timer::get_pass_time): New function.
3025 * timer.h (Timer::stamp): New function.
3026 (Timer::get_pass_time): New function.
3027 (Timer::pass_times_): New data member.
3028
3029 2011-10-17 Cary Coutant <ccoutant@google.com>
3030
3031 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3032 task for members of lib groups.
3033
3034 2011-10-17 Cary Coutant <ccoutant@google.com>
3035
3036 PR gold/13288
3037 * fileread.cc (File_read::find_view): Add assert.
3038 (File_read::make_view): Move bounds check (replace with assert)...
3039 (File_read::find_or_make_view): ... to here.
3040
3041 2011-10-12 Cary Coutant <ccoutant@google.com>
3042
3043 * output.cc (Output_file::open_base_file): Handle case where
3044 ::read returns less than requested size.
3045
3046 2011-10-10 Cary Coutant <ccoutant@google.com>
3047
3048 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3049 Initialize defined_count_.
3050 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3051 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3052 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3053 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3054 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3055 * incremental.h (Sized_relobj_incr::defined_count_): New data
3056 member.
3057 (Sized_incr_dynobj::defined_count_): New data member.
3058 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3059 Return zeroes instead of internal error.
3060
3061 2011-10-10 Cary Coutant <ccoutant@google.com>
3062
3063 PR gold/13249
3064 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3065 (Output_reloc::symbol_value): Return PLT offset if flag is set.
3066 * output.h (class Output_reloc): Add use_plt_offset flag.
3067 (Output_reloc::type_): Adjust size of bit field.
3068 (Output_reloc::use_plt_offset_): New bit field.
3069 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3070 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3071 flag. Adjust all callers.
3072 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3073 creating RELATIVE relocations.
3074
3075 2011-10-10 Nick Clifton <nickc@redhat.com>
3076
3077 * po/es.po: Updated Spanish translation.
3078 * po/fi.po: Updated Finnish translation.
3079
3080 2011-10-03 Diego Novillo <dnovillo@google.com>
3081
3082 * options.cc (parse_uint): Fix dereference of RETVAL.
3083
3084 2011-09-29 Sriraman Tallam <tmsriram@google.com>
3085
3086 * layout.h (section_order_map_): New member.
3087 (get_section_order_map): New member function.
3088 * output.cc (Output_section::add_input_section): Check for patterns
3089 only when --section-ordering-file is specified.
3090 * gold.cc (queue_middle_tasks): Delay updating order of sections till
3091 output_sections have been formed.
3092 * layout.cc (Layout_Layout): Initialize section_order_map_.
3093 * plugin.cc (update_section_order): Store order in order_map. Do not
3094 update the order.
3095 * testsuite/Makefile.am: Add test case for plugin_final_layout.
3096 * testsuite/Makefile.in: Regenerate.
3097 * testsuite/plugin_section_order.c: New file.
3098 * testsuite/plugin_final_layout.cc: New file.
3099 * testsuite/plugin_final_layout.sh: New file.
3100
3101 2011-09-29 Cary Coutant <ccoutant@google.com>
3102
3103 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3104 Check for NULL.
3105 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3106 symbols during incremental update.
3107 (Symbol_table::add_from_dynobj): Likewise.
3108
3109 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3110 Ian Lance Taylor <iant@google.com>
3111
3112 * symtab.cc (Symbol_table::define_special_symbol): Always
3113 canonicalize version string.
3114
3115 2011-09-26 Cary Coutant <ccoutant@google.com>
3116
3117 * gold.cc (queue_initial_tasks): Move option checks ...
3118 * options.cc (General_options::finalize): ... to here. Disable
3119 some options; make others fatal.
3120
3121 2011-09-26 Cary Coutant <ccoutant@google.com>
3122
3123 gcc PR lto/47247
3124 * plugin.cc (get_symbols_v2): New function.
3125 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3126 (is_referenced_from_outside): New function.
3127 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3128 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3129 (get_symbols): Pass version parameter.
3130 (get_symbols_v2): New function.
3131 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3132 parameter.
3133 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3134 (onload): Add LDPT_GET_SYMBOLS_V2.
3135 (all_symbols_read_hook): Use get_symbols_v2; check for
3136 LDPR_PREVAILING_DEF_IRONLY_EXP.
3137 * testsuite/plugin_test_3.sh: Update expected results.
3138
3139 2011-09-23 Simon Baldwin <simonb@google.com>
3140
3141 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3142 configuration options.
3143 * configure: Regenerate.
3144 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3145 * Makefile.in: Regenerate.
3146 * testsuite/Makefile.in: Regenerate.
3147
3148 2011-09-19 Sriraman Tallam <tmsriram@google.com>
3149
3150 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3151
3152 2011-09-19 Cary Coutant <ccoutant@google.com>
3153
3154 * incremental.cc (can_incremental_update): Fix typo in comment.
3155 * incremental.h (can_incremental_update): Likewise.
3156
3157 2011-09-18 Cary Coutant <ccoutant@google.com>
3158
3159 * incremental.cc (can_incremental_update): New function.
3160 * incremental.h (can_incremental_update): New function.
3161 * layout.cc (Layout::init_fixed_output_section): Call it.
3162 (Layout::make_output_section): Don't allow patch space in .eh_frame.
3163 * object.cc (Sized_relobj_file::do_layout): Call
3164 can_incremental_update.
3165
3166 2011-09-13 Cary Coutant <ccoutant@google.com>
3167
3168 * configure.ac: Check for glibc support for gnu_indirect_function
3169 support with static linking, setting automake conditional
3170 IFUNC_STATIC.
3171 * Makefile.in: Regenerate.
3172 * configure: Regenerate.
3173
3174 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3175 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3176 for IFUNC_STATIC.
3177 * testsuite/Makefile.in: Regenerate.
3178
3179 2011-09-13 Cary Coutant <ccoutant@google.com>
3180
3181 * incremental.cc (Sized_relobj_incr::do_layout): Call
3182 report_comdat_group for kept comdat sections.
3183 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3184 * testsuite/Makefile.in: Regenerate.
3185 * testsuite/incr_comdat_test_1.cc: New source file.
3186 * testsuite/incr_comdat_test_2_v1.cc: New source file.
3187 * testsuite/incr_comdat_test_2_v2.cc: New source file.
3188 * testsuite/incr_comdat_test_2_v3.cc: New source file.
3189
3190 2011-09-13 Ian Lance Taylor <iant@google.com>
3191
3192 * object.cc (Sized_relobj_file::do_layout): Remove unused local
3193 variable external_symbols_offset.
3194
3195 2011-09-12 Ian Lance Taylor <iant@google.com>
3196
3197 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3198 triggered if object has no symbols.
3199
3200 2011-09-09 David S. Miller <davem@davemloft.net>
3201
3202 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3203 (Output_fill_debug_line::do_write): Likewise.
3204
3205 2011-08-29 Cary Coutant <ccoutant@google.com>
3206
3207 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3208 casts to match formatting specs.
3209 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3210
3211 2011-08-26 Cary Coutant <ccoutant@google.com>
3212
3213 * layout.cc (Free_list::allocate): Provide guarantee of minimum
3214 remaining hole size when allocating.
3215 (Layout::make_output_section): Set fill methods for debug sections.
3216 * layout.h (Free_list::Free_list_node): Move from private to
3217 public.
3218 (Free_list::set_min_hole_size): New function.
3219 (Free_list::begin, Free_list::end): New functions.
3220 (Free_list::min_hole_): New data member.
3221 * output.cc: Include dwarf.h.
3222 (Output_fill_debug_info::do_minimum_hole_size): New function.
3223 (Output_fill_debug_info::do_write): New function.
3224 (Output_fill_debug_line::do_minimum_hole_size): New function.
3225 (Output_fill_debug_line::do_write): New function.
3226 (Output_section::Output_section): Initialize new data member.
3227 (Output_section::set_final_data_size): Ensure patch space is larger
3228 than minimum hole size.
3229 (Output_section::do_write): Fill holes in debug sections.
3230 * output.h (Output_fill): New class.
3231 (Output_fill_debug_info): New class.
3232 (Output_fill_debug_line): New class.
3233 (Output_section::set_free_space_fill): New function.
3234 (Output_section::free_space_fill_): New data member.
3235 * testsuite/Makefile.am (incremental_test_3): Add
3236 --incremental-patch option.
3237 (incremental_test_4): Likewise.
3238 (incremental_test_5): Likewise.
3239 (incremental_test_6): Likewise.
3240 (incremental_copy_test): Likewise.
3241 (incremental_common_test_1): Likewise.
3242 * testsuite/Makefile.in: Regenerate.
3243
3244 2011-08-26 Nick Clifton <nickc@redhat.com>
3245
3246 * po/es.po: Updated Spanish translation.
3247
3248 2011-08-01 Cary Coutant <ccoutant@google.com>
3249
3250 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3251 * gold/testsuite/Makefile.in: Regenerate.
3252 * gold/testsuite/justsyms_exec.c: New source file.
3253 * gold/testsuite/justsyms_lib.c: New source file.
3254
3255 2011-08-01 Cary Coutant <ccoutant@google.com>
3256
3257 * layout.cc (Layout::set_segment_offsets): Don't realign text
3258 segment if -Ttext was specified.
3259 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3260 file type.
3261 * object.h (Sized_relobj_file::e_type): New function.
3262 (Sized_relobj_file::e_type_): New data member.
3263 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3264 base address for ET_EXEC files.
3265 * target.cc (Target::do_make_elf_object_implementation): Allow
3266 ET_EXEC files with --just-symbols option.
3267
3268 2011-07-28 Cary Coutant <ccoutant@google.com>
3269
3270 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3271 Add thread_number parameter.
3272 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3273 * workqueue-threads.cc
3274 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3275 current thread if its thread number is greater than desired thread
3276 count.
3277 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3278 Add thread_number parameter.
3279 (Workqueue::should_cancel_thread): Likewise.
3280 (Workqueue::find_runnable_or_wait): Pass thread_number to
3281 should_cancel_thread.
3282 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3283 parameter.
3284
3285 2011-07-22 Sriraman Tallam <tmsriram@google.com>
3286
3287 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3288 only after checking if it cannot be forced local.
3289 * symtab.h (is_externally_visible): Check if the symbol is not forced
3290 local.
3291
3292 2011-07-15 Ian Lance Taylor <iant@google.com>
3293
3294 * options.h (class General_options): Add --print-output-format.
3295 Move -EL next to -EB, for better --help output.
3296 * target-select.cc: Include <cstdio>, "options.h", and
3297 "parameters.h".
3298 (Target_selector::do_target_bfd_name): New function.
3299 (print_output_format): New function.
3300 * target-select.h (class Target_selector): Update declarations.
3301 (Target_selector::target_bfd_name): New function.
3302 (print_output_format): Declare.
3303 * main.cc: Include "target-select.h".
3304 (main): Handle --print-output-format.
3305 * gold.cc: Include "target-select.h".
3306 (queue_initial_tasks): Handle --print-output-format when there are
3307 no input files.
3308 * parameters.cc (parameters_force_valid_target): Give a better
3309 error message if -EB/-EL does not match target.
3310 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3311 function.
3312
3313 2011-07-15 Ian Lance Taylor <iant@google.com>
3314
3315 * i386.cc (class Output_data_plt_i386): Add layout_ field.
3316 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3317 (Output_data_plt_i386::do_write): Write address of .dynamic
3318 section to first entry in .got.plt section.
3319 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3320 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3321 Initialize layout_.
3322 (Output_data_plt_x86_64::do_write): Write address of .dynamic
3323 section to first entry in .got.plt section.
3324 * layout.h (Layout::dynamic_section): New function.
3325
3326 2011-07-13 Sriraman Tallam <tmsriram@google.com>
3327
3328 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3329 to claim_file call.
3330 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3331 input_section_position_, and input_section_glob_.
3332 (read_layout_from_file): Call function section_ordering_specified.
3333 * layout.h (is_section_ordering_specified): New function.
3334 (section_ordering_specified): New function.
3335 (section_ordering_specified_): New boolean member.
3336 * main.cc(main): Call load_plugins after layout object is defined.
3337 * output.cc (Output_section::add_input_section): Use
3338 function section_ordering_specified to check if section ordering is
3339 needed.
3340 * output.cc (Output_section::add_relaxed_input_section): Use
3341 function section_ordering_specified to check if section ordering is
3342 needed.
3343 (Output_section::update_section_layout): New function.
3344 (Output_section::sort_attached_input_sections): Check if input section
3345 must be reordered.
3346 * output.h (Output_section::update_section_layout): New function.
3347 * plugin.cc (get_section_count): New function.
3348 (get_section_type): New function.
3349 (get_section_name): New function.
3350 (get_section_contents): New function.
3351 (update_section_order): New function.
3352 (allow_section_ordering): New function.
3353 (Plugin::load): Add the new interfaces to the transfer vector.
3354 (Plugin_manager::load_plugins): New parameter.
3355 (Plugin_manager::all_symbols_read): New parameter.
3356 (Plugin_manager::claim_file): New parameter. Save the elf object for
3357 unclaimed objects.
3358 (Plugin_manager::get_elf_object): New function.
3359 (Plugin_manager::get_view): Change to directly use the bool to check
3360 if get_view is called from claim_file_hook.
3361 * plugin.h (input_objects): New function
3362 (Plugin__manager::load_plugins): New parameter.
3363 (Plugin_manager::claim_file): New parameter.
3364 (Plugin_manager::get_elf_object): New function.
3365 (Plugin_manager::in_claim_file_handler): New function.
3366 (Plugin_manager::in_claim_file_handler_): New member.
3367 (layout): New function.
3368 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3369 handler with an extra parameter. Make the elf object before calling
3370 claim_file handler.
3371 * testsuite/plugin_test.c (get_section_count): New function pointer.
3372 (get_section_type): New function pointer.
3373 (get_section_name): New function pointer.
3374 (get_section_contents): New function pointer.
3375 (update_section_order): New function pointer.
3376 (allow_section_ordering): New function pointer.
3377 (onload): Check if the new interfaces exist.
3378
3379 2011-07-13 Ian Lance Taylor <iant@google.com>
3380
3381 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3382 relro section.
3383 * x86_64.cc (Target_x86_64::got_section): Likewise.
3384 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3385 (relro_now_test_SOURCES): New variable.
3386 (relro_now_test_DEPENDENCIES): New variable.
3387 (relro_now_test_LDFLAGS): New variable.
3388 (relro_now_test_LDADD): New variable.
3389 (relro_now_test.so): New target.
3390 * testsuite/Makefile.in: Rebuild.
3391
3392 2011-07-12 Ian Lance Taylor <iant@google.com>
3393
3394 PR gold/12980
3395 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3396 GLOB_DAT relocation rather than a RELATIVE relocation for a
3397 protected symbol when creating a shared library.
3398 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3399 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3400 * testsuite/protected_main_1.cc (main): Test that protected
3401 function has same address.
3402
3403 2011-07-11 Ian Lance Taylor <iant@google.com>
3404
3405 PR gold/12979
3406 * options.h (class General_options): Add -Bgroup.
3407 * options.cc (General_options::finalize): If -Bgroup is set,
3408 default to --unresolved-symbols=report-all.
3409 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3410 * target-reloc.h (issue_undefined_symbol_error): Handle
3411 --unresolved-symbols=report-all.
3412
3413 2011-07-08 Ian Lance Taylor <iant@google.com>
3414
3415 PR gold/11985
3416 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3417 if linker script discards key sections.
3418 (Layout::create_dynamic_symtab): Likewise.
3419 (Layout::assign_local_dynsym_offsets): Likewise.
3420 (Layout::sized_create_version_sections): Likewise.
3421 (Layout::create_interp): Likewise.
3422 (Layout::finish_dynamic_section): Likewise.
3423 (Layout::set_dynamic_symbol_size): Likewise.
3424
3425 2011-07-08 Ian Lance Taylor <iant@google.com>
3426
3427 PR gold/12386
3428 * options.h (class General_options): Add --unresolved-symbols.
3429 * target-reloc.h (issue_undefined_symbol_error): Check
3430 --unresolved-symbols. Add comments.
3431
3432 2011-07-08 Ian Lance Taylor <iant@google.com>
3433
3434 * testsuite/odr_violation2.cc (Ordering::operator()): Make
3435 expression more complex.
3436
3437 2011-07-08 Ian Lance Taylor <iant@google.com>
3438
3439 PR gold/11317
3440 * target-reloc.h (issue_undefined_symbol_error): New inline
3441 function, broken out of relocate_section.
3442 (relocate_section): Call issue_undefined_symbol_error.
3443 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3444 there is no TLS segment if we are about to issue an undefined
3445 symbol error.
3446 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3447
3448 2011-07-08 Ian Lance Taylor <iant@google.com>
3449
3450 PR gold/12279
3451 * resolve.cc (Symbol_table::should_override): Add fromtype
3452 parameter. Change all callers. Give error when linking together
3453 TLS and non-TLS symbol.
3454 (Symbol_table::should_override_with_special): Add fromtype
3455 parameter. Change all callers.
3456 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3457 there is no TLS segment if we have reported some errors.
3458 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3459
3460 2011-07-08 Ian Lance Taylor <iant@google.com>
3461
3462 PR gold/12372
3463 * target.h (Target::plt_address_for_global): New function.
3464 (Target::plt_address_for_local): New function.
3465 (Target::plt_section_for_global): Remove.
3466 (Target::plt_section_for_local): Remove.
3467 (Target::do_plt_address_for_global): New virtual function.
3468 (Target::do_plt_address_for_local): New virtual function.
3469 (Target::do_plt_section_for_global): Remove.
3470 (Target::do_plt_section_for_local): Remove.
3471 (Target::register_global_plt_entry): Add Symbol_table and Layout
3472 parameters.
3473 * output.cc (Output_data_got::Got_entry::write): Use
3474 plt_address_for_global and plt_address_for_local.
3475 * layout.cc (Layout::add_target_dynamic_tags): Use size and
3476 address of output section.
3477 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3478 got_irelative_, and irelative_count_ fields. Update
3479 declarations.
3480 (Output_data_plt_i386::has_irelative_section): New function.
3481 (Output_data_plt_i386::entry_count): Add irelative_count_.
3482 (Output_data_plt_i386::set_final_data_size): Likewise.
3483 (class Target_i386): Add got_irelative_ and rel_irelative_
3484 fields. Update declarations.
3485 (Target_i386::Target_i386): Initialize new fields.
3486 (Target_i386::do_plt_address_for_global): New function replacing
3487 do_plt_section_for_global.
3488 (Target_i386::do_plt_address_for_local): New function replacing
3489 do_plt_section_for_local.
3490 (Target_i386::got_section): Create got_irelative_.
3491 (Target_i386::rel_irelative_section): New function.
3492 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3493 fields. Don't define __rel_iplt_{start,end}.
3494 (Output_data_plt_i386::add_entry): Add symtab and layout
3495 parameters. Change all callers. Use different PLT and GOT for
3496 IFUNC symbols.
3497 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3498 layout parameters. Change all callers. Use different PLT and
3499 GOT.
3500 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3501 (Output_data_plt_i386::rel_irelative): New function.
3502 (Output_data_plt_i386::address_for_global): New function.
3503 (Output_data_plt_i386::address_for_local): New function.
3504 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
3505 IRELATIVE GOT when changing IFUNC GOT entries.
3506 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3507 reloc.
3508 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3509 if we didn't create an IRELATIVE GOT.
3510 (Target_i386::Relocate::relocate): Use plt_address_for_global and
3511 plt_address_for_local.
3512 (Target_i386::do_dynsym_value): Use plt_address_for_global.
3513 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3514 got_irelative_, and irelative_count_ fields. Update
3515 declarations.
3516 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3517 Initialize new fields. Remove symtab parameter. Change all
3518 callers.
3519 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3520 irelative_count_.
3521 (Output_data_plt_x86_64::has_irelative_section): New function.
3522 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3523 (class Target_x86_64): Add got_irelative_ and rel_irelative_
3524 fields. Update declarations.
3525 (Target_x86_64::Target_x86_64): Initialize new fields.
3526 (Target_x86_64::do_plt_address_for_global): New function replacing
3527 do_plt_section_for_global.
3528 (Target_x86_64::do_plt_address_for_local): New function replacing
3529 do_plt_section_for_local.
3530 (Target_x86_64::got_section): Create got_irelative_.
3531 (Target_x86_64::rela_irelative_section): New function.
3532 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
3533 all callers. Don't create __rel_iplt_{start,end}.
3534 (Output_data_plt_x86_64::add_entry): Add symtab and layout
3535 parameters. Change all callers. Use different PLT and GOT for
3536 IFUNC symbols.
3537 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3538 layout parameters. Change all callers. Use different PLT and
3539 GOT.
3540 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3541 parameters. Change all callers. Use different PLT and GOT for
3542 IFUNC symbols.
3543 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3544 (Output_data_plt_x86_64::rela_irelative): New function.
3545 (Output_data_plt_x86_64::address_for_global): New function.
3546 (Output_data_plt_x86_64::address_for_local): New function.
3547 (Output_data_plt_x86_64::set_final_data_size): Likewise.
3548 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3549 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3550 (Target_x86_64::register_global_plt_entry): Add symtab and layout
3551 parameters.
3552 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3553 reloc.
3554 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3555 symbols if we didn't create an IRELATIVE GOT.
3556 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3557 plt_address_for_local.
3558 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3559 * testsuite/ifuncvar1.c: New test file.
3560 * testsuite/ifuncvar2.c: New test file.
3561 * testsuite/ifuncvar3.c: New test file.
3562 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3563 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3564 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3565 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3566 * testsuite/Makefile.in: Rebuild.
3567
3568 2011-07-07 Cary Coutant <ccoutant@google.com>
3569
3570 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3571 (two_file_test_1_ndebug.o): Likewise.
3572 (two_file_test_1b_ndebug.o): Likewise.
3573 (two_file_test_2_ndebug.o): Likewise.
3574 (two_file_test_main_ndebug.o): Likewise.
3575 (incremental_test_2): Link with no-debug versions.
3576
3577 2011-07-06 Cary Coutant <ccoutant@google.com>
3578
3579 * gold/incremental.cc
3580 (Output_section_incremental_inputs::write_info_blocks): Check for
3581 hidden and internal symbols.
3582
3583 2011-07-06 Cary Coutant <ccoutant@google.com>
3584
3585 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3586 Check disposition for startup file.
3587 (Incremental_inputs::report_command_line): Ignore
3588 --incremental-startup-unchanged option.
3589 * options.cc (General_options::parse_incremental_startup_unchanged):
3590 New function.
3591 (General_options::General_options): Initialize new data member.
3592 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3593 (General_options): Add --incremental-startup-unchanged option.
3594 (General_options::incremental_startup_disposition): New function.
3595 (General_options::incremental_startup_disposition_): New data member.
3596
3597 2011-07-06 Cary Coutant <ccoutant@google.com>
3598
3599 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3600 input file index to Script_info ctor.
3601 (Sized_incremental_binary::do_file_has_changed): Find the
3602 command-line argument for files named in scripts.
3603 * incremental.h (Script_info::Script_info): New ctor
3604 with input file index.
3605 (Script_info::input_file_index): New function.
3606 (Script_info::input_file_index_): New data member.
3607 (Incremental_binary::get_library): Add const.
3608 (Incremental_binary::get_script_info): Add const.
3609 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3610 * testsuite/Makefile.am (incremental_test_5): New test case.
3611 (incremental_test_6): New test case.
3612 * testsuite/Makefile.in: Regenerate.
3613
3614 2011-07-06 Cary Coutant <ccoutant@google.com>
3615
3616 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3617 debug output when command lines differ.
3618
3619 2011-07-06 Cary Coutant <ccoutant@google.com>
3620
3621 * incremental.cc (Incremental_inputs::report_command_line): Ignore
3622 --incremental-patch option.
3623 * layout.cc (Free_list::allocate): Extend allocation beyond original
3624 end if enabled.
3625 (Layout::make_output_section): Mark sections that should get
3626 patch space.
3627 * options.cc (parse_percent): New function.
3628 * options.h (parse_percent): New function.
3629 (DEFINE_percent): New macro.
3630 (General_options): Add --incremental-patch option.
3631 * output.cc (Output_section::Output_section): Initialize new data
3632 members.
3633 (Output_section::add_input_section): Print section name when out
3634 of patch space.
3635 (Output_section::add_output_section_data): Likewise.
3636 (Output_section::set_final_data_size): Add patch space when
3637 doing --incremental-full.
3638 (Output_section::do_reset_address_and_file_offset): Remove patch
3639 space.
3640 (Output_segment::set_section_list_addresses): Print debug output
3641 only if --incremental-update.
3642 * output.h (Output_section::set_is_patch_space_allowed): New function.
3643 (Output_section::is_patch_space_allowed_): New data member.
3644 (Output_section::patch_space_): New data member.
3645 * parameters.cc (Parameters::incremental_full): New function.
3646 * parameters.h (Parameters::incremental_full): New function
3647 * testsuite/Makefile.am (incremental_test_2): Add test for
3648 --incremental-patch option.
3649 * testsuite/Makefile.in: Regenerate.
3650 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3651 (t18): Remove function body.
3652
3653 2011-07-05 Doug Kwan <dougkwan@google.com>
3654
3655 PR gold/12771
3656 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3657 Arm_Address type for relocation result.
3658 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
3659 overflow check.
3660 (Arm_relocate_functions::abs32): Use unaligned access.
3661 (Arm_relocate_functions::rel32): Ditto.
3662 (Arm_relocate_functions::prel31): Ditto.
3663 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3664 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3665 static data relocations.
3666 * testsuite/Makefile.in: Regnerate.
3667 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3668
3669 2011-07-05 Ian Lance Taylor <iant@google.com>
3670
3671 PR gold/12392
3672 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3673 symbols if necessary.
3674 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3675
3676 2011-07-05 Ian Lance Taylor <iant@google.com>
3677
3678 PR gold/12952
3679 * resolve.cc (Symbol::override_base_with_special): Simply override
3680 version with special symbol version, ignoring previous version.
3681
3682 2011-07-05 Ian Lance Taylor <iant@google.com>
3683
3684 * object.cc (Sized_relobj_file::include_section_group): Add
3685 information to comment about signature location.
3686
3687 2011-07-02 Ian Lance Taylor <iant@google.com>
3688
3689 PR gold/12957
3690 * options.h (class General_options): Add -f and -F.
3691 * options.cc (General_options::finalize): Fatal error if -f/-F
3692 are used without -shared.
3693 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3694
3695 2011-07-02 Ian Lance Taylor <iant@google.com>
3696
3697 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3698
3699 2011-07-01 Ian Lance Taylor <iant@google.com>
3700
3701 PR gold/12525
3702 PR gold/12952
3703 * resolve.cc (Symbol::override_base_with_special): Don't override
3704 the version if the overriding symbol has a different name.
3705 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
3706 all callers. If we give an error about an undefined version,
3707 define the base version if necessary.
3708 * dynobj.h (class Versions): Update declaration.
3709 * testsuite/weak_alias_test_5.cc: New file.
3710 * testsuite/weak_alias_test.script: New file.
3711 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3712 and versioned_alias have the right value, and call t2.
3713 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3714 weak_alias_test_5.so.
3715 (weak_alias_test_LDADD): Likewise.
3716 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3717 * testsuite/Makefile.in: Rebuild.
3718
3719 2011-07-01 Ian Lance Taylor <iant@google.com>
3720
3721 PR gold/12525
3722 * options.h (class General_options): Support -z notext.
3723 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3724 -Wl,-z,notext.
3725 (two_file_shared_nonpic.so): Likewise.
3726 (two_file_shared_mixed.so): Likewise.
3727 (two_file_shared_mixed_1.so): Likewise.
3728 (weak_undef_lib_nonpic.so): Likewise.
3729 (alt/weak_undef_lib_nonpic.so): Likewise.
3730 (tls_test_shared_nonpic.so): Likewise.
3731 * testsuite/Makefile.in: Rebuild.
3732
3733 2011-07-01 Ian Lance Taylor <iant@google.com>
3734
3735 PR gold/12525
3736 * configure.ac: Test whether static linking works, setting
3737 the automake conditional HAVE_STATIC.
3738 * testsuite/Makefile.am: Disable tests using -static if
3739 HAVE_STATIC is not true.
3740 * configure, testsuite/Makefile.in: Rebuild.
3741
3742 2011-07-01 Ian Lance Taylor <iant@google.com>
3743
3744 PR gold/12525
3745 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3746 Assert if we see DW_EH_PE_indirect.
3747 * target.h (Target::ehframe_datarel_base): New function.
3748 (Target::do_ehframe_datarel_base): New target function.
3749 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3750 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3751 function.
3752
3753 2011-07-01 Ian Lance Taylor <iant@google.com>
3754
3755 PR gold/12571
3756 * options.h (class General_options): Add
3757 --ld-generated-unwind-info.
3758 * ehframe.cc (Fde::write): Add address parameter. Change all
3759 callers. If associated with PLT, fill in address and size.
3760 (Cie::set_output_offset): Only add merge mapping if there is an
3761 object.
3762 (Cie::write): Add address parameter. Change all callers.
3763 (Eh_frame::add_ehframe_for_plt): New function.
3764 * ehframe.h (class Fde): Update declarations. Move shndx_ and
3765 input_offset_ fields into union u_, with new plt field.
3766 (Fde::Fde): Adjust for new union field.
3767 (Fde::Fde) [Output_data version]: New constructor.
3768 (Fde::add_mapping): Only add merge mapping if there is an object.
3769 (class Cie): Update declarations.
3770 (class Eh_frame): Declare add_ehframe_for_plt.
3771 * layout.cc (Layout::layout_eh_frame): Break out code into
3772 make_eh_frame_section, and call it.
3773 (Layout::make_eh_frame_section): New function.
3774 (Layout::add_eh_frame_for_plt): New function.
3775 * layout.h (class Layout): Update declarations.
3776 * merge.cc (Merge_map::add_mapping): Add assertion.
3777 * i386.cc: Include "dwarf.h".
3778 (class Output_data_plt_i386): Make first_plt_entry,
3779 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
3780 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3781 and plt_eh_frame_fde.
3782 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3783 boundary. Call add_eh_frame_for_plt if appropriate.
3784 * x86_64.cc: Include "dwarf.h".
3785 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
3786 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
3787 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3788 and plt_eh_frame_fde.
3789 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3790 appropriate.
3791
3792 2011-06-29 Ian Lance Taylor <iant@google.com>
3793
3794 PR gold/12629
3795 * object.cc (Sized_relobj_file::layout_section): Change shdr
3796 parameter to be const.
3797 (Sized_relobj_file::layout_eh_frame_section): New function, broken
3798 out of do_layout.
3799 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3800 appropriate. Call layout_eh_frame_section.
3801 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3802 sections.
3803 * object.h (class Sized_relobj_file): Update declarations.
3804
3805 2011-06-29 Ian Lance Taylor <iant@google.com>
3806
3807 PR gold/12652
3808 * script.cc (Token::integer_value): Accept trailing M/m/K/k
3809 modifier.
3810 (Lex::gather_token): Accept trailing M/m/K/k for integers.
3811
3812 2011-06-29 Ian Lance Taylor <iant@google.com>
3813
3814 PR gold/12675
3815 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3816 SHT_X86_64_UNWIND.
3817 * layout.cc (Layout::layout_eh_frame): Likewise.
3818
3819 2011-06-29 Ian Lance Taylor <iant@google.com>
3820
3821 PR gold/12695
3822 * layout.cc (Layout::symtab_section_shndx): New function.
3823 * layout.h (class Layout): Declare symtab_section_shndx.
3824 * output.cc (Output_section::write_header): Call it.
3825
3826 2011-06-29 Ian Lance Taylor <iant@google.com>
3827
3828 PR gold/12818
3829 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3830 symbols which are not used in a relocation.
3831
3832 2011-06-28 Ian Lance Taylor <iant@google.com>
3833
3834 PR gold/12898
3835 * layout.cc (Layout::segment_precedes): Don't crash if a linker
3836 script create indistinguishable segments.
3837 (Layout::set_segment_offsets): Use stable_sort when sorting
3838 segments. Pass this to Compare_segments constructor.
3839 * layout.h (class Layout): Make segment_precedes non-static.
3840 (class Compare_segments): Change from struct to class. Add
3841 layout_ field. Add constructor.
3842 * script-sections.cc
3843 (Script_sections::attach_sections_using_phdrs_clause): Rename
3844 local orphan to is_orphan. Don't report failure to put empty
3845 section in segment. On attachment failure, report name of
3846 section, and attach to first PT_LOAD segment.
3847
3848 2011-06-28 Ian Lance Taylor <iant@google.com>
3849
3850 PR gold/12934
3851 * target-select.cc (Target_selector::Target_selector): Add
3852 emulation parameter. Change all callers.
3853 (select_target_by_bfd_name): Rename from select_target_by_name.
3854 Change all callers.
3855 (select_target_by_emulation): New function.
3856 (supported_emulation_names): New function.
3857 * target-select.h (class Target_selector): Add emulation_ field.
3858 Update declarations.
3859 (Target_selector::recognize_by_bfd_name): Rename from
3860 recognize_by_name. Change all callers.
3861 (Target_selector::supported_bfd_names): Rename from
3862 supported_names. Change all callers.
3863 (Target_selector::recognize_by_emulation): New function.
3864 (Target_selector::supported_emulations): New function.
3865 (Target_selector::emulation): New function.
3866 (Target_selector::do_recognize_by_bfd_name): Rename from
3867 do_recognize_by_name. Change all callers.
3868 (Target_selector::do_supported_bfd_names): Rename from
3869 do_supported_names. Change all callers.
3870 (Target_selector::do_recognize_by_emulation): New function.
3871 (Target_selector::do_supported_emulations): New function.
3872 (select_target_by_bfd_name): Change name in declaration.
3873 (select_target_by_emulation): Declare.
3874 (supported_emulation_names): Declare.
3875 * parameters.cc (parameters_force_valid_target): Try to find
3876 target based on emulation from -m option.
3877 * options.h (class General_options): Change doc string for -m.
3878 * options.cc (help): Print emulations.
3879 (General_options::parse_V): Likewise.
3880 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3881 Add emulation parameter. Change all callers.
3882
3883 2011-06-28 Ian Lance Taylor <iant@google.com>
3884
3885 * target.h (class Target): Add osabi_ field.
3886 (Target::osabi): New function.
3887 (Target::set_osabi): New function.
3888 (Target::Target): Initialize osabi_.
3889 (Target::do_adjust_elf_header): Make pure virtual.
3890 (Sized_target::do_adjust_elf_header): Declare.
3891 * target.cc (Sized_target::do_adjust_elf_header): New function.
3892 (class Sized_target): Instantiate all versions.
3893 * freebsd.h (class Target_freebsd): Remove.
3894 (Target_selector_freebsd::do_recognize): Call set_osabi on
3895 Target.
3896 (Target_selector_freebsd::do_recognize_by_name): Likewise.
3897 (Target_selector_freebsd::set_osabi): Remove.
3898 * i386.cc (class Target_i386): Inherit from Sized_target rather
3899 than Target_freebsd.
3900 * x86_64.cc (class Target_x86_64): Likewise.
3901
3902 2011-06-28 Ian Lance Taylor <iant@google.com>
3903
3904 * target.h (Target::can_check_for_function_pointers): Rewrite.
3905 Make non-virtual.
3906 (Target::can_icf_inline_merge_sections): Likewise.
3907 (Target::section_may_have_icf_unsafe_poineters): Likewise.
3908 (Target::Target_info): Add can_icf_inline_merge_sections field.
3909 (Target::do_can_check_for_function_pointers): New virtual
3910 function.
3911 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3912 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3913 from can_check_for_function_pointers, move in file.
3914 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3915 section_may_have_icf_unsafe_poineters, move in file.
3916 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3917 * i386.cc (Target_i386::do_can_check_for_function_pointers):
3918 Rename from can_check_for_function_pointers, move in file.
3919 (Target_i386::can_icf_inline_merge_sections): Remove.
3920 (Target_i386::i386_info): Initialize
3921 can_icf_inline_merge_sections.
3922 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3923 Initialize can_icf_inline_merge_sections.
3924 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3925 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3926 Rename from can_check_for_function_pointers, move in file.
3927 (Target_x86_64::can_icf_inline_merge_sections): Remove.
3928 (Target_x86_64::x86_64_info): Initialize
3929 can_icf_inline_merge_sections.
3930 * testsuite/testfile.cc (Target_test::test_target_info):
3931 Likewise.
3932 * icf.cc (get_section_contents): Correct formatting.
3933
3934 2011-06-27 Ian Lance Taylor <iant@google.com>
3935
3936 * symtab.cc (Symbol::versioned_name): New function.
3937 (Symbol_table::add_to_final_symtab): Use versioned_name when
3938 appropriate.
3939 (Symbol_table::sized_write_symbol): Likewise.
3940 * symtab.h (class Symbol): Declare versioned_name.
3941 * stringpool.h (class Stringpool_template): Add variant of add
3942 which takes a std::basic_string.
3943 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3944 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3945 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3946 (ver_test_12.o): New target.
3947 * testsuite/Makefile.in: Rebuild.
3948
3949 2011-06-27 Doug Kwan <dougkwan@google.com>
3950
3951 * arm.cc (Arm_relocate_functions::thm_jump8,
3952 Arm_relocate_functions::thm_jump11): Use a wider signed
3953 type to compute offset.
3954 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3955 arm_thm_jump8.
3956 * testsuite/Makefile.in: Regenerate.
3957 * testsuite/arm_branch_in_range.sh: Check test results of
3958 arm_thm_jump11 and arm_thm_jump8.
3959 * testsuite/arm_thm_jump11.s: New test source file.
3960 * testsuite/arm_thm_jump11.t: New linker script.
3961 * testsuite/arm_thm_jump8.s: New test source file.
3962 * testsuite/arm_thm_jump8.t: New linker script.
3963
3964 2011-06-24 Ian Lance Taylor <iant@google.com>
3965
3966 * layout.cc: Include "object.h".
3967 (ctors_sections_in_init_array): New static variable.
3968 (Layout::is_ctors_in_init_array): New function.
3969 (Layout::layout): Add entry to ctors_sections_in_init_array if
3970 appropriate.
3971 * layout.h (class Layout): Declare is_ctors_in_init_array.
3972 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3973 is_ctors_reverse_view is set.
3974 (Sized_relobj_file::write_sections): Add layout parameter. Change
3975 all callers. Set is_ctors_reverse_view field of View_size.
3976 (Sized_relobj_file::reverse_words): New function.
3977 * object.h (Sized_relobj_file::View_size): Add
3978 is_ctors_reverse_view field.
3979 (class Sized_relobj_file): Update declarations.
3980 * testsuite/initpri3.c: New test.
3981 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3982 initpri3b.
3983 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3984 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3985 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3986 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3987 * testsuite/Makefile.in: Rebuild.
3988
3989 2011-06-24 Cary Coutant <ccoutant@google.com>
3990
3991 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3992 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3993 (debug_msg_cdebug.err): New targets.
3994 * testsuite/Makefile.in: Regenerate.
3995 * testsuite/debug_msg.sh: Check output of link with compressed debug.
3996 Fix checks for link with shared library.
3997
3998 2011-06-24 Doug Kwan <dougkwan@google.com>
3999
4000 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4001 skip empty text sections.
4002 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4003
4004 2011-06-22 Ian Lance Taylor <iant@google.com>
4005
4006 PR gold/12910
4007 * options.h (class General_options): Add --ctors-in-init-array.
4008 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4009 friends as SHT_PROGBITS for merging sections.
4010 (Layout::layout): Remove special handling of .init_array and
4011 friends. Don't sort if doing relocatable link. Sort for .ctors
4012 and .dtors if ctors_in_init_array.
4013 (Layout::make_output_section): Force correct section types for
4014 .init_array and friends. Don't sort if doing relocatable link,
4015 Don't sort .ctors and .dtors if ctors_in_init_array.
4016 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4017 (Layout::output_section_name): Add relobj parameter. Change all
4018 callers. Handle .ctors. and .dtors. in code rather than table.
4019 Handle .ctors and .dtors if ctors_in_init_array.
4020 (Layout::match_file_name): New function, moved from output.cc.
4021 * layout.h (class Layout): Update declarations.
4022 * output.cc: Include "layout.h".
4023 (Input_section_sort_entry::get_priority): New function.
4024 (Input_section_sort_entry::match_file_name): Just call
4025 Layout::match_file_name.
4026 (Output_section::Input_section_sort_init_fini_compare::operator()):
4027 Handle .ctors and .dtors. Sort by explicit priority rather than
4028 by name.
4029 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4030 * testsuite/initpri2.c: New test.
4031 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4032 (check_PROGRAMS): Add initpri2.
4033 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4034 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4035 * configure, testsuite/Makefile.in: Rebuild.
4036
4037 2011-06-19 Ian Lance Taylor <iant@google.com>
4038
4039 PR gold/12880
4040 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4041 .interp section to a PT_INTERP segment even if we have seen a
4042 --dynamic-linker option. Don't do it if we have seen a PHDRS
4043 clause in a linker script.
4044 (Layout::finalize): Don't create a .interp section if we've
4045 already create a PT_INTERP segment.
4046 (Layout::create_interp): Always call choose_output_section (revert
4047 patch of 2011-06-17). Don't create PT_INTERP segment.
4048 * script-sections.cc
4049 (Script_sections::create_note_and_tls_segments): Add a .interp
4050 section to a PT_INTERP segment even if we have seen a
4051 --dynamic-linker option.
4052
4053 2011-06-18 Ian Lance Taylor <iant@google.com>
4054
4055 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4056 merely because a non-PT_LOAD segment has a dynamic reloc.
4057
4058 2011-06-18 Ian Lance Taylor <iant@google.com>
4059
4060 * layout.cc (Layout::finish_dynamic_section): Don't create
4061 DT_FLAGS entry if not needed.
4062
4063 2011-06-18 Ian Lance Taylor <iant@google.com>
4064
4065 PR gold/12745
4066 * layout.cc (Layout::layout_eh_frame): Correct handling of
4067 writable .eh_frame section.
4068
4069 2011-06-17 Ian Lance Taylor <iant@google.com>
4070
4071 PR gold/12893
4072 * resolve.cc (Symbol_table::resolve): Don't give an error if a
4073 symbol is redefined with the exact same object and value.
4074
4075 2011-06-17 Ian Lance Taylor <iant@google.com>
4076
4077 PR gold/12880
4078 * layout.h (class Layout): Add interp_segment_ field.
4079 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4080 (Layout::attach_allocated_section_to_segment): If making shared
4081 library, put .interp section in PT_INTERP segment.
4082 (Layout::finalize): Also call create_interp if -dynamic-linker
4083 option was used.
4084 (Layout::create_interp): Assert that there is no PT_INTERP
4085 segment. If not using a SECTIONS clause, use make_output_section.
4086 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4087 * script-sections.cc
4088 (Script_sections::create_note_and_tls_segments): If making shared
4089 library, put .interp section in PT_INTERP segment.
4090
4091 2011-06-17 Ian Lance Taylor <iant@google.com>
4092
4093 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4094 when making a shared library.
4095
4096 2011-06-17 Ian Lance Taylor <iant@google.com>
4097
4098 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4099 parameter. Change all callers. Don't issue warning about PC32
4100 against locally defined symbol.
4101
4102 2011-06-16 Ian Lance Taylor <iant@google.com>
4103
4104 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4105 occurs in same object.
4106
4107 2011-06-14 Alan Modra <amodra@gmail.com>
4108
4109 * po/POTFILES.in: Regenerate.
4110
4111 2011-06-09 Ian Lance Taylor <iant@google.com>
4112
4113 * script-sections.cc
4114 (Orphan_output_section::set_section_addresses): For a relocatable
4115 link set address to 0.
4116
4117 2011-06-09 Cary Coutant <ccoutant@google.com>
4118
4119 PR gold/12804
4120 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4121 used with --compress-debug-sections.
4122 * gold/object.cc (Sized_relobj_file::do_layout): Report
4123 uncompressed size of compressed input sections.
4124
4125 2011-06-08 Cary Coutant <ccoutant@google.com>
4126
4127 PR gold/12804
4128 * testsuite/two_file_test_2_v1.cc: Change initialization of
4129 v2 to keep it in .data.
4130
4131 2011-06-07 Cary Coutant <ccoutant@google.com>
4132
4133 * common.cc (Symbol_table::do_allocate_commons_list): Call
4134 gold_fallback.
4135 * errors.cc (Errors::fatal): Adjust call to gold_exit.
4136 (Errors::fallback): New function.
4137 (gold_fallback): New function.
4138 * errors.h (Errors::fallback): New function.
4139 * gold.cc (gold_exit): Change status parameter to enum; adjust
4140 all callers.
4141 (queue_initial_tasks): Call gold_fallback.
4142 * gold.h: Include cstdlib.
4143 (Exit_status): New enum type.
4144 (gold_exit): Change status parameter to enum.
4145 (gold_fallback): New function.
4146 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4147 (Layout::create_symtab_sections): Likewise.
4148 (Layout::create_shdrs): Likewise.
4149 * main.cc (main): Adjust call to gold_exit.
4150 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4151 (Output_data_got::add_got_entry_pair): Likewise.
4152 (Output_section::add_input_section): Likewise.
4153 (Output_section::add_output_section_data): Likewise.
4154 (Output_segment::set_section_list_addresses): Likewise.
4155 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4156
4157 2011-06-07 Cary Coutant <ccoutant@google.com>
4158
4159 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4160 for incremental links.
4161 * output.cc (Output_segment::set_section_list_addresses): Remove
4162 FIXME and test for TLS or BSS.
4163
4164 2011-06-07 Cary Coutant <ccoutant@google.com>
4165
4166 * testsuite/Makefile.am: Add incremental_copy_test,
4167 incremental_common_test_1.
4168 * testsuite/Makefile.in: Regenerate.
4169 * testsuite/common_test_1_v1.c: New source file.
4170 * testsuite/common_test_1_v2.c: New source file.
4171 * testsuite/copy_test_v1.cc: New source file.
4172
4173 2011-06-07 Cary Coutant <ccoutant@google.com>
4174
4175 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4176 update, allocate common from bss section's free list.
4177 * incremental-dump.cc (dump_incremental_inputs): Print flag for
4178 linker-defined symbols.
4179 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4180 Skip GOT and PLT entries that are no longer referenced.
4181 (Output_section_incremental_inputs::write_info_blocks): Mark
4182 linker-defined symbols.
4183 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4184 * output.cc (Output_section::allocate): New function.
4185 * output.h (Output_section::allocate): New function.
4186 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4187 linker-defined symbols.
4188 (Symbol::override_base_with_special): Copy is_predefined_ flag.
4189 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4190 (Symbol::init_base_output_data): Likewise.
4191 (Symbol::init_base_output_segment): Likewise.
4192 (Symbol::init_base_constant): Likewise.
4193 (Sized_symbol::init_output_data): Likewise.
4194 (Sized_symbol::init_output_segment): Likewise.
4195 (Sized_symbol::init_constant): Likewise.
4196 (Symbol_table::do_define_in_output_data): Likewise.
4197 (Symbol_table::do_define_in_output_segment): Likewise.
4198 (Symbol_table::do_define_as_constant): Likewise.
4199 * symtab.h (Symbol::is_predefined): New function.
4200 (Symbol::init_base_output_data): Add is_predefined parameter.
4201 (Symbol::init_base_output_segment): Likewise.
4202 (Symbol::init_base_constant): Likewise.
4203 (Symbol::is_predefined_): New data member.
4204 (Sized_symbol::init_output_data): Add is_predefined parameter.
4205 (Sized_symbol::init_output_segment): Likewise.
4206 (Sized_symbol::init_constant): Likewise.
4207 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4208
4209 2011-06-07 Cary Coutant <ccoutant@google.com>
4210
4211 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4212 instead of emit_copy_reloc.
4213 (Copy_relocs::emit_copy_reloc): Refactor.
4214 (Copy_relocs::make_copy_reloc): New function.
4215 (Copy_relocs::add_copy_reloc): Remove.
4216 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4217 section.
4218 (Copy_relocs::make_copy_reloc): New function.
4219 (Copy_relocs::add_copy_reloc): Remove.
4220 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4221 unchanged input files.
4222 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4223 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4224 Reserve BSS space for COPY relocations.
4225 (Sized_incremental_binary::do_emit_copy_relocs): New function.
4226 (Output_section_incremental_inputs::write_info_blocks): Record
4227 whether a symbol is copied from a shared object.
4228 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4229 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4230 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4231 (Incremental_input_entry_reader::get_output_symbol_index): Add
4232 is_copy parameter.
4233 (Incremental_binary::emit_copy_relocs): New function.
4234 (Incremental_binary::do_emit_copy_relocs): New function.
4235 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4236 new data member.
4237 (Sized_incremental_binary::add_copy_reloc): New function.
4238 (Sized_incremental_binary::do_emit_copy_relocs): New function.
4239 (Sized_incremental_binary::Copy_reloc): New struct.
4240 (Sized_incremental_binary::Copy_relocs): New typedef.
4241 (Sized_incremental_binary::copy_relocs_): New data member.
4242 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4243 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4244 * target.h (Sized_target::emit_copy_reloc): New function.
4245 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4246
4247 2011-06-02 Cary Coutant <ccoutant@google.com>
4248
4249 PR gold/12163
4250 * gold/archive.cc (Archive::Archive): Initialize new data member.
4251 (Archive::include_all_members): Return if archive has already been
4252 included.
4253 * gold/archive.h (Archive::include_all_members_): New data member.
4254
4255 2011-06-02 Nick Clifton <nickc@redhat.com>
4256
4257 * dynobj.h: Fix spelling mistake in comment.
4258 * output.cc: Likewise.
4259
4260 2011-05-31 Doug Kwan <dougkwan@google.com>
4261 Asier Llano
4262
4263 PR gold/12826
4264 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4265 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4266 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
4267 redundant arm_exidx_test.so.
4268 * testsuite/Makefile.in: Regenerate.
4269 (check_SCRIPTS): Add pr12826.sh
4270 (check_DATA): Add pr12826.stdout
4271 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4272 * testsuite/pr12826.sh: New file.
4273 * testsuite/pr12826_1.s: Ditto.
4274 * testsuite/pr12826_1.s: Ditto.
4275
4276 2011-05-30 Ian Lance Taylor <iant@google.com>
4277
4278 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4279 sections.
4280
4281 2011-05-29 Ian Lance Taylor <iant@google.com>
4282
4283 PR gold/12804
4284 * testsuite/Makefile.am: Use different file name for two_file_test
4285 temporary file for each incremental test.
4286 * testsuite/Makefile.in: Rebuild.
4287
4288 2011-05-29 Ian Lance Taylor <iant@google.com>
4289
4290 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4291 binary input file is empty.
4292
4293 2011-05-27 Ian Lance Taylor <iant@google.com>
4294
4295 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4296 (ver_test_9.so): Likewise.
4297 * testsuite/Makefile.in: Rebuild.
4298
4299 2011-05-26 Cary Coutant <ccoutant@google.com>
4300
4301 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4302 * incremental.cc (Incremental_inputs::report_input_section): Fix
4303 comment, indentation.
4304 (Incremental_inputs::report_comdat_group): New function.
4305 (Output_section_incremental_inputs::set_final_data_size): Adjust size
4306 of data for incremental input file entry.
4307 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4308 group count, COMDAT group signatures.
4309 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4310 an unchanged input file.
4311 * incremental.h (Incremental_object_entry::Incremental_object_entry):
4312 Initialize new data member.
4313 (Incremental_object_entry::add_comdat_group): New function.
4314 (Incremental_object_entry::get_comdat_group_count): New function.
4315 (Incremental_object_entry::get_comdat_signature_key): New function.
4316 (Incremental_object_entry::groups_): New data member.
4317 (Incremental_inputs::report_comdat_group): New function.
4318 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4319 data for incremental input file entry.
4320 (Incremental_input_entry_reader::get_comdat_group_count): New function.
4321 (Incremental_input_entry_reader::get_input_section): Adjust size of
4322 data for incremental input file entry.
4323 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4324 (Incremental_input_entry_reader::get_comdat_group_signature): New
4325 function.
4326 * object.cc (Sized_relobj::include_section_group): Report kept
4327 COMDAT groups for incremental links.
4328
4329 2011-05-24 David Meyer <pdox@google.com>
4330
4331 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4332 with name parameter. Add found_name parameter.
4333 * fileread.cc (Input_file::find_file): Adjust code accordingly.
4334 * dirsearch.h (class Dirsearch): Update declaration.
4335
4336 2011-05-24 Ian Lance Taylor <iant@google.com>
4337
4338 * archive.cc (Library_base::should_include_member): Pull in object
4339 from archive if it defines the entry symbol.
4340 * parameters.cc (Parameters::entry): New function.
4341 * parameters.h (class Parameters): Declare entry.
4342 * output.h (class Output_file_header): Remove entry_ field.
4343 * output.cc (Output_file_header::Output_file_header): Remove entry
4344 parameter. Change all callers.
4345 (Output_file_header::entry): Use parameters->entry.
4346 * gold.cc (queue_middle_tasks): Likewise.
4347 * plugin.cc (Plugin_hook::run): Likewise.
4348
4349 2011-05-24 Cary Coutant <ccoutant@google.com>
4350
4351 * gold.cc (queue_initial_tasks): Pass incremental base filename
4352 to Output_file::open_base_file; don't print error message.
4353 * incremental-dump.cc (main): Adjust call to
4354 Output_file::open_for_modification.
4355 * incremental-dump.cc (main): Likewise.
4356 * incremental.cc (Incremental_inputs::report_command_line):
4357 Ignore --incremental-base option when comparing command lines.
4358 Ignore parameter when given as separate argument.
4359 * options.h (class General_options): Add --incremental-base.
4360 * output.cc (Output_file::Output_file):
4361 (Output_file::open_base_file): Add base_name and writable parameters;
4362 read base file into new file; print error message here.
4363 (Output_file::map_no_anonymous): Add writable parameter; adjust all
4364 callers.
4365 * output.h (Output_file::open_for_modification): Rename to...
4366 (Output_file::open_base_file): ...this; add base_name and
4367 writable parameters; adjust all callers.
4368 (Output_file::map_no_anonymous): Add writable parameter; adjust all
4369 callers.
4370 * testsuite/Makefile.am (incremental_test_4): Test
4371 --incremental-base.
4372 * testsuite/Makefile.in: Regenerate.
4373
4374 2011-05-24 Cary Coutant <ccoutant@google.com>
4375
4376 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4377 incremental_test_4.
4378 * testsuite/Makefile.in: Regenerate.
4379 * testsuite/two_file_test_1_v1.cc: New test source file.
4380 * testsuite/two_file_test_1b_v1.cc: New test source file.
4381 * testsuite/two_file_test_2_v1.cc: New test source file.
4382
4383 2011-05-24 Cary Coutant <ccoutant@google.com>
4384
4385 * dynobj.h (Dynobj::do_dynobj): New function.
4386 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4387 flag and soname for shared objects.
4388 * incremental.cc (Incremental_inputs::report_object): Make
4389 either Incremental_object_entry or Incremental_dynobj_entry; add
4390 soname to string table.
4391 (Incremental_inputs::report_input_section): Add assertion.
4392 (Output_section_incremental_inputs::set_final_data_size): Adjust
4393 type of input file entry for shared libraries; adjust size of
4394 shared library info entry.
4395 (Output_section_incremental_inputs::write_input_files): Write
4396 as_needed flag for shared libraries.
4397 (Output_section_incremental_inputs::write_info_blocks): Adjust type
4398 of input file entry for shared libraries; write soname.
4399 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4400 soname from incremental info.
4401 * incremental.h (enum Incremental_input_flags): Add
4402 INCREMENTAL_INPUT_AS_NEEDED.
4403 (Incremental_input_entry::Incremental_input_entry): Initialize new
4404 data member.
4405 (Incremental_input_entry::set_as_needed): New function.
4406 (Incremental_input_entry::as_needed): New function.
4407 (Incremental_input_entry::do_dynobj_entry): New function.
4408 (Incremental_input_entry::as_needed_): New data member.
4409 (Incremental_object_entry::Incremental_object_entry): Don't check
4410 for shared library.
4411 (Incremental_object_entry::do_type): Likewise.
4412 (class Incremental_dynobj_entry): New class.
4413 (Incremental_input_entry_reader::as_needed): New function.
4414 (Incremental_input_entry_reader::get_soname): New function.
4415 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4416 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4417 size of shared library info entry.
4418 * layout.cc (Layout::finish_dynamic_section): Don't test for
4419 incremental link when adding DT_NEEDED entries.
4420 * object.h (Object::Object): Initialize new data member.
4421 (Object::dynobj): New function.
4422 (Object::set_as_needed): New function.
4423 (Object::as_needed): New function.
4424 (Object::do_dynobj): New function.
4425 (Object::as_needed_): New data member.
4426
4427 2011-05-24 Cary Coutant <ccoutant@google.com>
4428
4429 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4430 info; adjust display of GOT entries.
4431 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4432 vector of input objects; remove file_status_.
4433 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4434 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4435 got_plt reader; call target hooks to reserve GOT entries.
4436 (Output_section_incremental_inputs::set_final_data_size): Adjust size
4437 of input file info header and GOT info entry.
4438 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4439 relocation info.
4440 (Got_plt_view_info::got_descriptor): Remove.
4441 (Got_plt_view_info::sym_index): New data member.
4442 (Got_plt_view_info::input_index): New data member.
4443 (Local_got_offset_visitor::visit): Write input file index.
4444 (Global_got_offset_visitor::visit): Write 0 for input file index.
4445 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4446 with sym_index and input_index.
4447 (Output_section_incremental_inputs::write_got_plt): Adjust size of
4448 incremental info GOT entry; replace got_descriptor with input_index.
4449 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4450 map from input file index to object.
4451 (Sized_relobj_incr::do_layout): Replace direct data member reference
4452 with accessor function.
4453 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4454 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4455 Adjust size of input file info header.
4456 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4457 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4458 (Incremental_input_entry_reader::get_input_section): Adjust size of
4459 input file info header.
4460 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4461 of incremental info GOT entry.
4462 (Incremental_got_plt_reader::get_got_desc): Remove.
4463 (Incremental_got_plt_reader::get_got_symndx): New function.
4464 (Incremental_got_plt_reader::get_got_input_index): New function.
4465 (Sized_incremental_binary::Sized_incremental_binary): Remove
4466 file_status_; add input_objects_.
4467 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4468 (Sized_incremental_binary::set_file_is_unchanged): Remove.
4469 (Sized_incremental_binary::file_is_unchanged): Remove.
4470 (Sized_incremental_binary::set_input_object): New function.
4471 (Sized_incremental_binary::input_object): New function.
4472 (Sized_incremental_binary::file_status_): Remove.
4473 (Sized_incremental_binary::input_objects_): New data member.
4474 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4475 references.
4476 (Sized_relobj_incr::invalid_address): Move to base class.
4477 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4478 class.
4479 (Sized_relobj_incr::do_output_section_offset): Likewise.
4480 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4481 (Sized_relobj_incr::section_offsets_): Likewise.
4482 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4483 function.
4484 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4485 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4486 with accessor function.
4487 (Sized_relobj_file::do_layout): Likewise.
4488 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4489 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4490 (Sized_relobj_file::compute_final_local_value): Replace refs to
4491 section_offsets_ with accessor function.
4492 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4493 * object.h (Relobj::Relobj): Initialize new data members.
4494 (Relobj::add_dyn_reloc): New function.
4495 (Relobj::first_dyn_reloc): New function.
4496 (Relobj::dyn_reloc_count): New function.
4497 (Relobj::first_dyn_reloc_): New data member.
4498 (Relobj::dyn_reloc_count_): New data member.
4499 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4500 references.
4501 (Sized_relobj::Address): New typedef.
4502 (Sized_relobj::invalid_address): Move here from child class.
4503 (Sized_relobj::Sized_relobj): Initialize new data members.
4504 (Sized_relobj::sized_relobj): New function.
4505 (Sized_relobj::is_output_section_offset_invalid): Move here from
4506 child class.
4507 (Sized_relobj::get_output_section_offset): Likewise.
4508 (Sized_relobj::local_has_got_offset): Likewise.
4509 (Sized_relobj::local_got_offset): Likewise.
4510 (Sized_relobj::set_local_got_offset): Likewise.
4511 (Sized_relobj::do_for_all_local_got_entries): Likewise.
4512 (Sized_relobj::clear_got_offsets): New function.
4513 (Sized_relobj::section_offsets): Move here from child class.
4514 (Sized_relobj::do_output_section_offset): Likewise.
4515 (Sized_relobj::do_set_section_offset): Likewise.
4516 (Sized_relobj::Local_got_offsets): Likewise.
4517 (Sized_relobj::local_got_offsets_): Likewise.
4518 (Sized_relobj::section_offsets_): Likewise.
4519 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4520 references.
4521 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4522 class.
4523 (Sized_relobj_file::sized_relobj): New function
4524 (Sized_relobj_file::local_has_got_offset): Move to base class.
4525 (Sized_relobj_file::local_got_offset): Likewise.
4526 (Sized_relobj_file::set_local_got_offset): Likewise.
4527 (Sized_relobj_file::get_output_section_offset): Likewise.
4528 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4529 (Sized_relobj_file::do_output_section_offset): Likewise.
4530 (Sized_relobj_file::do_set_section_offset): Likewise.
4531 (Sized_relobj_file::Local_got_offsets): Likewise.
4532 (Sized_relobj_file::local_got_offsets_): Likewise.
4533 (Sized_relobj_file::section_offsets_): Likewise.
4534 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4535 (all constructors).
4536 (set_needs_dynsym_index): Convert relobj to derived class pointer.
4537 (Output_reloc::get_symbol_index): Likewise.
4538 (Output_reloc::local_section_offset): Likewise.
4539 (Output_reloc::get_address): Likewise.
4540 (Output_reloc::symbol_value): Likewise.
4541 (Output_data_got::reserve_slot): Move to class definition.
4542 (Output_data_got::reserve_local): New function.
4543 (Output_data_got::reserve_slot_for_global): Remove.
4544 (Output_data_got::reserve_global): New function.
4545 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4546 (all constructors, two instantiations).
4547 (Output_reloc::get_relobj): New function (two instantiations).
4548 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4549 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4550 (Output_data_reloc::add_global): Adjust type of relobj.
4551 (Output_data_reloc::add_global_relative): Likewise.
4552 (Output_data_reloc::add_symbolless_global_addend): Likewise.
4553 (Output_data_reloc::add_local): Likewise.
4554 (Output_data_reloc::add_local_relative): Likewise.
4555 (Output_data_reloc::add_symbolless_local_addend): Likewise.
4556 (Output_data_reloc::add_local_section): Likewise.
4557 (Output_data_reloc::add_output_section): Likewise.
4558 (Output_data_reloc::add_absolute): Likewise.
4559 (Output_data_reloc::add_target_specific): Likewise.
4560 (Output_data_got::reserve_slot): Move definition here.
4561 (Output_data_got::reserve_local): New function.
4562 (Output_data_got::reserve_global): New function.
4563 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4564 section_offsets_ with accessor function.
4565 (Sized_relobj_file::write_sections): Likewise.
4566 (Sized_relobj_file::do_relocate_sections): Likewise.
4567 * target.h (Sized_target::reserve_local_got_entry): New function.
4568 (Sized_target::reserve_global_got_entry): New function.
4569 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4570 (Target_x86_64::reserve_global_got_entry): New function.
4571 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4572
4573 2011-05-23 Cary Coutant <ccoutant@google.com>
4574
4575 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4576 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4577 bit when checking got_type.
4578 * incremental.cc (Sized_incremental_binary::setup_readers):
4579 Store symbol table and string table locations; initialize bit vector
4580 of file status flags.
4581 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4582 unchanged files.
4583 (Sized_incremental_binary::do_process_got_plt): New function.
4584 (Sized_incremental_binary::get_symtab_view): Use stored locations.
4585 (Output_section_incremental_inputs::set_final_data_size): Record
4586 file index for each input file.
4587 (Output_section_incremental_inputs::write_got_plt): Store file index
4588 instead of input entry offset for each GOT entry.
4589 * incremental.h
4590 (Incremental_input_entry::Incremental_input_entry): Initialize new
4591 data member.
4592 (Incremental_input_entry::set_offset): Store file index.
4593 (Incremental_input_entry::get_file_index): New function.
4594 (Incremental_input_entry::file_index_): New data member.
4595 (Incremental_binary::process_got_plt): New function.
4596 (Incremental_binary::do_process_got_plt): New function.
4597 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4598 data members.
4599 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4600 (Sized_incremental_binary::set_file_is_unchanged): New function.
4601 (Sized_incremental_binary::file_is_unchanged): New function.
4602 (Sized_incremental_binary::do_process_got_plt): New function.
4603 (Sized_incremental_binary::file_status_): New data member.
4604 (Sized_incremental_binary::main_symtab_loc_): New data member.
4605 (Sized_incremental_binary::main_strtab_loc_): New data member.
4606 * output.cc (Output_data_got::Got_entry::write): Add case
4607 RESERVED_CODE.
4608 (Output_data_got::add_global): Call add_got_entry.
4609 (Output_data_got::add_global_plt): Likewise.
4610 (Output_data_got::add_global_with_rel): Likewise.
4611 (Output_data_got::add_global_with_rela): Likewise.
4612 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4613 (Output_data_got::add_global_pair_with_rela): Likewise.
4614 (Output_data_got::add_local): Call add_got_entry.
4615 (Output_data_got::add_local_plt): Likewise.
4616 (Output_data_got::add_local_with_rel): Likewise.
4617 (Output_data_got::add_local_with_rela): Likewise.
4618 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4619 (Output_data_got::add_local_pair_with_rela): Likewise.
4620 (Output_data_got::reserve_slot): New function.
4621 (Output_data_got::reserve_slot_for_global): New function.
4622 (Output_data_got::add_got_entry): New function.
4623 (Output_data_got::add_got_entry_pair): New function.
4624 (Output_section::add_output_section_data): Edit FIXME.
4625 * output.h
4626 (Output_section_data_build::Output_section_data_build): New
4627 constructor with size parameter.
4628 (Output_data_space::Output_data_space): Likewise.
4629 (Output_data_got::Output_data_got): Initialize new data member; new
4630 constructor with size parameter.
4631 (Output_data_got::add_constant): Call add_got_entry.
4632 (Output_data_got::reserve_slot): New function.
4633 (Output_data_got::reserve_slot_for_global): New function.
4634 (class Output_data_got::Got_entry): Add RESERVED_CODE.
4635 (Output_data_got::add_got_entry): New function.
4636 (Output_data_got::add_got_entry_pair): New function.
4637 (Output_data_got::free_list_): New data member.
4638 * target.h (Sized_target::init_got_plt_for_update): New function.
4639 (Sized_target::register_global_plt_entry): New function.
4640 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4641 Initialize new data member; call init; add constructor with PLT count.
4642 (Output_data_plt_x86_64::init): New function.
4643 (Output_data_plt_x86_64::add_relocation): New function.
4644 (Output_data_plt_x86_64::reserve_slot): New function.
4645 (Output_data_plt_x86_64::free_list_): New data member.
4646 (Target_x86_64::init_got_plt_for_update): New function.
4647 (Target_x86_64::register_global_plt_entry): New function.
4648 (Output_data_plt_x86_64::add_entry): Allocate from free list for
4649 incremental updates.
4650 (Output_data_plt_x86_64::add_relocation): New function.
4651 * testsuite/object_unittest.cc (Object_test): Set default options.
4652
4653 2011-05-16 Ian Lance Taylor <iant@google.com>
4654
4655 * options.h (class General_options): Make -i a synonym for -r.
4656
4657 2011-05-16 Ian Lance Taylor <iant@google.com>
4658
4659 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4660
4661 2011-05-10 Cary Coutant <ccoutant@google.com>
4662
4663 * object.cc (Sized_relobj::do_count_local_symbols): Check for
4664 strip_all (-s).
4665
4666 2011-05-06 Ian Lance Taylor <iant@google.com>
4667
4668 * layout.cc (Layout::layout): If the output section flags change,
4669 update the ordering.
4670
4671 2011-04-25 Cary Coutant <ccoutant@google.com>
4672
4673 * incremental-dump.cc (dump_incremental_inputs): Print local
4674 symbol info for each input file.
4675 * incremental.cc
4676 (Output_section_incremental_inputs::set_final_data_size): Add local
4677 symbol info to input file entries in incremental info.
4678 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4679 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4680 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4681 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4682 implementation.
4683 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4684 (Sized_incr_relobj::do_relocate): Write the local symbols.
4685 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4686 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4687 Adjust size of input file header.
4688 (Incremental_inputs_reader::get_local_symbol_offset): New function.
4689 (Incremental_inputs_reader::get_local_symbol_count): New function.
4690 (Incremental_inputs_reader::get_input_section): Adjust size of input
4691 file header.
4692 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4693 (Sized_incr_relobj::This): New typedef.
4694 (Sized_incr_relobj::sym_size): New const data member.
4695 (Sized_incr_relobj::Local_symbol): New struct.
4696 (Sized_incr_relobj::do_output_local_symbol_count): New function.
4697 (Sized_incr_relobj::do_local_symbol_offset): New function.
4698 (Sized_incr_relobj::local_symbol_count_): New data member.
4699 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4700 (Sized_incr_relobj::local_symbol_index_): New data member.
4701 (Sized_incr_relobj::local_symbol_offset_): New data member.
4702 (Sized_incr_relobj::local_dynsym_offset_): New data member.
4703 (Sized_incr_relobj::local_symbols_): New data member.
4704 * object.h (Relobj::output_local_symbol_count): New function.
4705 (Relobj::local_symbol_offset): New function.
4706 (Relobj::do_output_local_symbol_count): New function.
4707 (Relobj::do_local_symbol_offset): New function.
4708 (Sized_relobj::do_output_local_symbol_count): New function.
4709 (Sized_relobj::do_local_symbol_offset): New function.
4710
4711 2011-04-22 Vladimir Simonov <sv@sw.ru>
4712
4713 * descriptors.cc (set_close_on_exec): New function.
4714 (Descriptors::open): Use set_close_on_exec.
4715 * output.cc (S_ISLNK): Define if not defined.
4716
4717 2011-04-22 Cary Coutant <ccoutant@google.com>
4718
4719 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4720 global symbol map.
4721 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4722 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4723 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4724 relocations.
4725 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4726 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4727 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4728 * incremental.h
4729 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4730 function.
4731 (Incremental_binary::apply_incremental_relocs): New function.
4732 (Incremental_binary::do_apply_incremental_relocs): New function.
4733 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4734 data member.
4735 (Sized_incremental_binary::add_global_symbol): New function.
4736 (Sized_incremental_binary::global_symbol): New function.
4737 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4738 (Sized_incremental_binary::symbol_map_): New data member.
4739 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4740 * target.h (Sized_target::apply_relocation): New function.
4741 * target-reloc.h (apply_relocation): New function.
4742 * x86_64.cc (Target_x86_64::apply_relocation): New function.
4743
4744 2011-04-22 Doug Kwan <dougkwan@google.com>
4745
4746 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4747 flag of a SHT_ARM_EXIDX section.
4748 * testsuite/Makefile.am (arm_exidx_test): New test rules.
4749 * testsuite/Makefile.in: Regenerate.
4750 * testsuite/arm_exidx_test.s: New file.
4751 * testsuite/arm_exidx_test.sh: Same.
4752
4753 2011-04-20 Cary Coutant <ccoutant@google.com>
4754
4755 PR gold/12689
4756 * archive.h (Incremental_archive_entry::Archive_member):
4757 Initialize arg_serial_ (second constructor).
4758
4759 2011-04-17 Ian Lance Taylor <iant@google.com>
4760
4761 * object.cc (Relocate_info::location): Simplify location string.
4762 * errors.cc (Errors::error_at_location): Don't print program
4763 name.
4764 (Errors::warning_at_location): Likewise.
4765 (Errors::undefined_symbol): Likewise.
4766 * testsuite/debug_msg.sh: Update accordingly.
4767
4768 2011-04-14 Cary Coutant <ccoutant@google.com>
4769
4770 * gold/layout.cc (Layout::symtab_section_offset): New function.
4771 * gold/layout.h (Layout::symtab_section_offset): New function.
4772 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4773
4774 2011-04-12 Ian Lance Taylor <iant@google.com>
4775
4776 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
4777 with MREMAP_MAYMOVE.
4778 * output.h (class Output_file): Add map_is_allocated_ field.
4779 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
4780 not available, provide stubs. If mremap is not available, #define
4781 it to gold_mremap.
4782 (MREMAP_MAYMOVE): Define if not defined.
4783 (Output_file::Output_file): Initialize map_is_allocated_.
4784 (Output_file::resize): Check map_is_allocated_.
4785 (Output_file::map_anonymous): If mmap fails, use malloc.
4786 (Output_file::unmap): Don't do anything for an anonymous map.
4787 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
4788 is not available, provide stubs.
4789 (File_read::View::~View): Use free rather than delete[].
4790 (File_read::make_view): Use malloc rather than new[]. If mmap
4791 fails, use malloc.
4792 (File_read::find_or_make_view): Use malloc rather than new[].
4793 * gold.h: Remove HAVE_REMAP code.
4794 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
4795 exists. Rename mremap to gold_mremap. If mmap is not available
4796 don't do anything.
4797 * configure, config.in: Rebuild.
4798
4799 2011-04-11 Ian Lance Taylor <iant@google.com>
4800
4801 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4802 initialize local variable v.
4803
4804 2011-04-11 Cary Coutant <ccoutant@google.com>
4805
4806 * archive.cc (Archive::include_member): Adjust call to
4807 report_object.
4808 (Add_archive_symbols::run): Track argument serial numbers.
4809 (Lib_group::include_member): Likewise.
4810 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4811 * archive.h (Incremental_archive_entry::Archive_member):
4812 Initialize arg_serial_.
4813 (Archive_member::arg_serial_): New data member.
4814 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4815 (Sized_dynobj::do_add_symbols): Track symbols when doing an
4816 incremental link.
4817 (Sized_dynobj::do_for_all_local_got_entries): New function.
4818 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4819 function.
4820 * fileread.cc (get_mtime): New function.
4821 * fileread.h (get_mtime): New function.
4822 * gold.cc (queue_initial_tasks): Check for incremental update.
4823 (process_incremental_input): New function.
4824 (queue_middle_tasks): Don't force valid target for incremental
4825 update.
4826 * incremental-dump.cc (find_input_containing_global): Adjust
4827 size of symbol info entry.
4828 (dump_incremental_inputs): Dump argument serial number and
4829 in_system_directory flag; bias shndx by 1; print symbol names
4830 when dumping per-file symbol lists; use new symbol info readers.
4831 * incremental.cc
4832 (Output_section_incremental_inputs:update_data_size): New function.
4833 (Sized_incremental_binary::setup_readers): Setup input readers
4834 for each input file; build maps for files added from libraries
4835 and scripts.
4836 (Sized_incremental_binary::check_input_args): New function.
4837 (Sized_incremental_binary::do_check_inputs): Build map of argument
4838 serial numbers to input arguments.
4839 (Sized_incremental_binary::do_file_has_changed): Rename
4840 do_file_is_unchanged to this; compare file modification times.
4841 (Sized_incremental_binary::do_init_layout): New function.
4842 (Sized_incremental_binary::do_reserve_layout): New function.
4843 (Sized_incremental_binary::do_get_input_reader): Remove.
4844 (Sized_incremental_binary::get_symtab_view): New function.
4845 (Incremental_checker::can_incrementally_link_output_file): Remove.
4846 (Incremental_inputs::report_command_line): Exclude --debug options.
4847 (Incremental_inputs::report_archive_begin): Add parameter; track
4848 argument serial numbers; don't put input file entry for archive
4849 before archive members.
4850 (Incremental_inputs::report_archive_end): Put input file entry
4851 for archive after archive members.
4852 (Incremental_inputs::report_object): Add parameter; track argument
4853 serial numbers and in_system_directory flag.
4854 (Incremental_inputs::report_script): Add parameter; track argument
4855 serial numbers.
4856 (Output_section_incremental_inputs::set_final_data_size): Adjust
4857 size of symbol info entry; check for forwarding symbols.
4858 (Output_section_incremental_inputs::write_input_files): Write
4859 in_system_directory flag and argument serial number.
4860 (Output_section_incremental_inputs::write_info_blocks): Map section
4861 indices between incremental info and original input file; store
4862 input section index for each symbol.
4863 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4864 change operator() to visit().
4865 (class Global_got_offset_visitor): Likewise.
4866 (class Global_symbol_visitor_got_plt):
4867 (Output_section_incremental_inputs::write_got_plt): Use new visitor
4868 classes.
4869 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4870 (Sized_incr_relobj::do_read_symbols): New function.
4871 (Sized_incr_relobj::do_layout): New function.
4872 (Sized_incr_relobj::do_layout_deferred_sections): New function.
4873 (Sized_incr_relobj::do_add_symbols): New function.
4874 (Sized_incr_relobj::do_should_include_member): New function.
4875 (Sized_incr_relobj::do_for_all_global_symbols): New function.
4876 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4877 (Sized_incr_relobj::do_section_size): New function.
4878 (Sized_incr_relobj::do_section_name): New function.
4879 (Sized_incr_relobj::do_section_contents): New function.
4880 (Sized_incr_relobj::do_section_flags): New function.
4881 (Sized_incr_relobj::do_section_entsize): New function.
4882 (Sized_incr_relobj::do_section_address): New function.
4883 (Sized_incr_relobj::do_section_type): New function.
4884 (Sized_incr_relobj::do_section_link): New function.
4885 (Sized_incr_relobj::do_section_info): New function.
4886 (Sized_incr_relobj::do_section_addralign): New function.
4887 (Sized_incr_relobj::do_initialize_xindex): New function.
4888 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4889 (Sized_incr_relobj::do_read_relocs): New function.
4890 (Sized_incr_relobj::do_gc_process_relocs): New function.
4891 (Sized_incr_relobj::do_scan_relocs): New function.
4892 (Sized_incr_relobj::do_count_local_symbols): New function.
4893 (Sized_incr_relobj::do_finalize_local_symbols): New function.
4894 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4895 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4896 (Sized_incr_relobj::do_relocate): New function.
4897 (Sized_incr_relobj::do_set_section_offset): New function.
4898 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4899 (Sized_incr_dynobj::do_read_symbols): New function.
4900 (Sized_incr_dynobj::do_layout): New function.
4901 (Sized_incr_dynobj::do_add_symbols): New function.
4902 (Sized_incr_dynobj::do_should_include_member): New function.
4903 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4904 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4905 (Sized_incr_dynobj::do_section_size): New function.
4906 (Sized_incr_dynobj::do_section_name): New function.
4907 (Sized_incr_dynobj::do_section_contents): New function.
4908 (Sized_incr_dynobj::do_section_flags): New function.
4909 (Sized_incr_dynobj::do_section_entsize): New function.
4910 (Sized_incr_dynobj::do_section_address): New function.
4911 (Sized_incr_dynobj::do_section_type): New function.
4912 (Sized_incr_dynobj::do_section_link): New function.
4913 (Sized_incr_dynobj::do_section_info): New function.
4914 (Sized_incr_dynobj::do_section_addralign): New function.
4915 (Sized_incr_dynobj::do_initialize_xindex): New function.
4916 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4917 (make_sized_incremental_object): New function.
4918 (Incremental_library::copy_unused_symbols): New function.
4919 (Incremental_library::do_for_all_unused_symbols): New function.
4920 * incremental.h (enum Incremental_input_flags): New type.
4921 (class Incremental_checker): Remove.
4922 (Incremental_input_entry::Incremental_input_entry): Add argument
4923 serial number.
4924 (Incremental_input_entry::arg_serial): New function.
4925 (Incremental_input_entry::set_is_in_system_directory): New function.
4926 (Incremental_input_entry::is_in_system_directory): New function.
4927 (Incremental_input_entry::arg_serial_): New data member.
4928 (Incremental_input_entry::is_in_system_directory_): New data member.
4929 (class Script_info): Move here from script.h.
4930 (Script_info::Script_info): Add filename parameter.
4931 (Script_info::filename): New function.
4932 (Script_info::filename_): New data member.
4933 (Incremental_script_entry::Incremental_script_entry): Add argument
4934 serial number.
4935 (Incremental_object_entry::Incremental_object_entry): Likewise.
4936 (Incremental_object_entry::add_input_section): Build list of input
4937 sections with map to original shndx.
4938 (Incremental_object_entry::get_input_section_index): New function.
4939 (Incremental_object_entry::shndx_): New data member.
4940 (Incremental_object_entry::name_key_): Rename; adjust all refs.
4941 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4942 (Incremental_archive_entry::Incremental_archive_entry): Add argument
4943 serial number.
4944 (Incremental_inputs::report_archive_begin): Likewise.
4945 (Incremental_inputs::report_object): Likewise.
4946 (Incremental_inputs::report_script): Likewise.
4947 (class Incremental_global_symbol_reader): New class.
4948 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4949 and store flags and input file type.
4950 (Incremental_input_entry_reader::arg_serial): New function.
4951 (Incremental_input_entry_reader::type): Extract type from flags.
4952 (Incremental_input_entry_reader::is_in_system_directory): New function.
4953 (Incremental_input_entry_reader::get_input_section_count): Call
4954 accessor function for type.
4955 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4956 function for type; adjust size of global symbol entry.
4957 (Incremental_input_entry_reader::get_global_symbol_count): Call
4958 accessor function for type.
4959 (Incremental_input_entry_reader::get_object_count): Likewise.
4960 (Incremental_input_entry_reader::get_object_offset): Likewise.
4961 (Incremental_input_entry_reader::get_member_count): Likewise.
4962 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4963 (Incremental_input_entry_reader::get_member_offset): Likewise.
4964 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4965 (Incremental_input_entry_reader::Global_symbol_info): Remove.
4966 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4967 (Incremental_input_entry_reader::get_global_symbol_reader): New
4968 function.
4969 (Incremental_input_entry_reader::get_output_symbol_index): New
4970 function.
4971 (Incremental_input_entry_reader::type_): Remove.
4972 (Incremental_input_entry_reader::flags_): New data member.
4973 (Incremental_inputs_reader::input_file_offset): New function.
4974 (Incremental_inputs_reader::input_file_index): New function.
4975 (Incremental_inputs_reader::input_file): Call input_file_offset.
4976 (Incremental_inputs_reader::input_file_at_offset): New function.
4977 (Incremental_relocs_reader::get_r_type): Reformat.
4978 (Incremental_relocs_reader::get_r_shndx): Reformat.
4979 (Incremental_relocs_reader::get_r_offset): Reformat.
4980 (Incremental_relocs_reader::data): New function.
4981 (Incremental_binary::Incremental_binary): Initialize new data members.
4982 (Incremental_binary::check_inputs): Add cmdline parameter.
4983 (Incremental_binary::file_is_unchanged): Remove.
4984 (Input_reader::arg_serial): New function.
4985 (Input_reader::get_unused_symbol_count): New function.
4986 (Input_reader::get_unused_symbol): New function.
4987 (Input_reader::do_arg_serial): New function.
4988 (Input_reader::do_get_unused_symbol_count): New function.
4989 (Input_reader::do_get_unused_symbol): New function.
4990 (Incremental_binary::input_file_count): New function.
4991 (Incremental_binary::get_input_reader): Change signature to use
4992 index instead of filename.
4993 (Incremental_binary::file_has_changed): New function.
4994 (Incremental_binary::get_input_argument): New function.
4995 (Incremental_binary::get_library): New function.
4996 (Incremental_binary::get_script_info): New function.
4997 (Incremental_binary::init_layout): New function.
4998 (Incremental_binary::reserve_layout): New function.
4999 (Incremental_binary::output_file): New function.
5000 (Incremental_binary::do_check_inputs): New function.
5001 (Incremental_binary::do_file_is_unchanged): Remove.
5002 (Incremental_binary::do_file_has_changed): New function.
5003 (Incremental_binary::do_init_layout): New function.
5004 (Incremental_binary::do_reserve_layout): New function.
5005 (Incremental_binary::do_input_file_count): New function.
5006 (Incremental_binary::do_get_input_reader): Change signature.
5007 (Incremental_binary::input_args_map_): New data member.
5008 (Incremental_binary::library_map_): New data member.
5009 (Incremental_binary::script_map_): New data member.
5010 (Sized_incremental_binary::Sized_incremental_binary): Initialize
5011 new data members.
5012 (Sized_incremental_binary::output_section): New function.
5013 (Sized_incremental_binary::inputs_reader): Add const.
5014 (Sized_incremental_binary::symtab_reader): Add const.
5015 (Sized_incremental_binary::relocs_reader): Add const.
5016 (Sized_incremental_binary::got_plt_reader): Add const.
5017 (Sized_incremental_binary::get_symtab_view): New function.
5018 (Sized_incremental_binary::Inputs_reader): New typedef.
5019 (Sized_incremental_binary::Input_entry_reader): New typedef.
5020 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5021 (Sized_incremental_binary::do_file_is_unchanged): Remove.
5022 (Sized_incremental_binary::do_file_has_changed): New function.
5023 (Sized_incremental_binary::do_init_layout): New function.
5024 (Sized_incremental_binary::do_reserve_layout): New function.
5025 (Sized_input_reader::Inputs_reader): Remove.
5026 (Sized_input_reader::Input_entry_reader): Remove.
5027 (Sized_input_reader::do_arg_serial): New function.
5028 (Sized_input_reader::do_get_unused_symbol_count): New function.
5029 (Sized_input_reader::do_get_unused_symbol): New function.
5030 (Sized_incremental_binary::do_input_file_count): New function.
5031 (Sized_incremental_binary::do_get_input_reader): Change signature;
5032 use index instead of filename.
5033 (Sized_incremental_binary::section_map_): New data member.
5034 (Sized_incremental_binary::input_entry_readers_): New data member.
5035 (class Sized_incr_relobj): New class.
5036 (class Sized_incr_dynobj): New class.
5037 (make_sized_incremental_object): New function.
5038 (class Incremental_library): New class.
5039 * layout.cc (Free_list::num_lists): New static data member.
5040 (Free_list::num_nodes): New static data member.
5041 (Free_list::num_removes): New static data member.
5042 (Free_list::num_remove_visits): New static data member.
5043 (Free_list::num_allocates): New static data member.
5044 (Free_list::num_allocate_visits): New static data member.
5045 (Free_list::init): New function.
5046 (Free_list::remove): New function.
5047 (Free_list::allocate): New function.
5048 (Free_list::dump): New function.
5049 (Free_list::print_stats): New function.
5050 (Layout_task_runner::run): Resize output file for incremental updates.
5051 (Layout::Layout): Initialize new data members.
5052 (Layout::set_incremental_base): New function.
5053 (Layout::init_fixed_output_section): New function.
5054 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5055 incremental updates.
5056 (Layout::create_gold_note): Do not create gold note section for
5057 incremental updates.
5058 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5059 for incremental updates.
5060 (Layout::set_section_offsets): For incremental updates, allocate space
5061 from free list.
5062 (Layout::create_symtab_sections): Layout with offsets relative to
5063 start of section; for incremental updates, allocate space from free
5064 list.
5065 (Layout::create_shdrs): For incremental updates, allocate space from
5066 free list.
5067 (Layout::finish_dynamic_section): For incremental updates, do not
5068 check --as-needed (fixed in subsequent patch).
5069 * layout.h (class Free_list): New class.
5070 (Layout::set_incremental_base): New function.
5071 (Layout::incremental_base): New function.
5072 (Layout::init_fixed_output_section): New function.
5073 (Layout::allocate): New function.
5074 (Layout::incremental_base_): New data member.
5075 (Layout::free_list_): New data member.
5076 * main.cc (main): Print Free_list statistics.
5077 * object.cc (Relobj::finalize_incremental_relocs): Add
5078 clear_counts parameter; clear counts only when clear_counts is set.
5079 (Sized_relobj::Sized_relobj): Initialize new base class.
5080 (Sized_relobj::do_layout): Don't report special sections.
5081 (Sized_relobj::do_for_all_local_got_entries): New function.
5082 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5083 symtab_off to all symbol table offsets.
5084 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5085 * object.h (class Got_offset_list): Move to top of file.
5086 (Object::Object): Allow case where input_file == NULL.
5087 (Object::~Object): Likewise.
5088 (Object::input_file): Assert that input_file != NULL.
5089 (Object::lock): Allow case where input_file == NULL.
5090 (Object::unlock): Likewise.
5091 (Object::is_locked): Likewise.
5092 (Object::token): Likewise.
5093 (Object::release): Likewise.
5094 (Object::is_incremental): New function.
5095 (Object::get_mtime): New function.
5096 (Object::for_all_local_got_entries): New function.
5097 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5098 (Object::set_is_in_system_directory): New function.
5099 (Object::is_in_system_directory): New function.
5100 (Object::do_is_incremental): New function.
5101 (Object::do_get_mtime): New function.
5102 (Object::do_for_all_local_got_entries): New function.
5103 (Object::is_in_system_directory_): New data member.
5104 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5105 (class Sized_relobj_base): New class.
5106 (class Sized_relobj): Derive from Sized_relobj_base.
5107 (class Sized_relobj::Symbols): Redeclare from base class.
5108 (class Sized_relobj::local_got_offset_list): Remove.
5109 (class Sized_relobj::Output_sections): Redeclare from base class.
5110 (class Sized_relobj::do_for_all_local_got_entries): New function.
5111 (class Sized_relobj::write_local_symbols): Add offset parameter.
5112 (class Sized_relobj::local_symbol_offset_): Update comment.
5113 (class Sized_relobj::local_dynsym_offset_): Update comment.
5114 * options.cc (Input_arguments::add_file): Remove const.
5115 * options.h (Input_file_argument::Input_file_argument):
5116 Initialize arg_serial_ (all constructors).
5117 (Input_file_argument::set_arg_serial): New function.
5118 (Input_file_argument::arg_serial): New function.
5119 (Input_file_argument::arg_serial_): New data member.
5120 (Input_arguments::Input_arguments): Initialize file_count_.
5121 (Input_arguments::add_file): Remove const.
5122 (Input_arguments::number_of_input_files): New function.
5123 (Input_arguments::file_count_): New data member.
5124 (Command_line::number_of_input_files): Call
5125 Input_arguments::number_of_input_files.
5126 * output.cc (Output_segment_headers::Output_segment_headers):
5127 Set current size.
5128 (Output_section::Input_section::current_data_size): New function.
5129 (Output_section::Output_section): Initialize new data members.
5130 (Output_section::add_input_section): Don't do merge sections for
5131 an incremental link; allocate space from free list for an
5132 incremental update.
5133 (Output_section::add_output_section_data): Allocate space from
5134 free list for an incremental update.
5135 (Output_section::update_data_size): New function.
5136 (Output_section::set_fixed_layout): New function.
5137 (Output_section::reserve): New function.
5138 (Output_segment::set_section_addresses): Remove const.
5139 (Output_segment::set_section_list_addresses): Remove const; allocate
5140 space from free list for an incremental update.
5141 (Output_segment::set_offset): Adjust size of RELRO segment for an
5142 incremental update.
5143 * output.h (Output_data::current_data_size): Move here from
5144 child classes.
5145 (Output_data::pre_finalize_data_size): New function.
5146 (Output_data::update_data_size): New function.
5147 (Output_section_headers::update_data_size): new function.
5148 (Output_section_data_build::current_data_size): Move to Output_data.
5149 (Output_data_strtab::update_data_size): New function.
5150 (Output_section::current_data_size): Move to Output_data.
5151 (Output_section::set_fixed_layout): New function.
5152 (Output_section::has_fixed_layout): New function.
5153 (Output_section::reserve): New function.
5154 (Output_section::update_data_size): New function.
5155 (Output_section::has_fixed_layout_): New data member.
5156 (Output_section::free_list_): New data member.
5157 (Output_segment::set_section_addresses): Remove const.
5158 (Output_segment::set_section_list_addresses): Remove const.
5159 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5160 New function.
5161 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5162 New function.
5163 * readsyms.cc (Read_symbols::do_read_symbols): Add library
5164 parameter when calling Add_symbols constructor; store argument
5165 serial number for members of a lib group.
5166 (Add_symbols::locks): Allow case where token == NULL.
5167 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5168 (Read_member::~Read_member): New function.
5169 (Read_member::is_runnable): New function.
5170 (Read_member::locks): New function.
5171 (Read_member::run): New function.
5172 (Check_script::~Check_script): New function.
5173 (Check_script::is_runnable): New function.
5174 (Check_script::locks): New function.
5175 (Check_script::run): New function.
5176 (Check_library::~Check_library): New function.
5177 (Check_library::is_runnable): New function.
5178 (Check_library::locks): New function.
5179 (Check_library::run): New function.
5180 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5181 (Add_symbols::library_): New data member.
5182 (class Read_member): New class.
5183 (class Check_script): New class.
5184 (class Check_library): New class.
5185 * reloc.cc (Read_relocs::is_runnable): Allow case where
5186 token == NULL.
5187 (Read_relocs::locks): Likewise.
5188 (Scan_relocs::locks): Likewise.
5189 (Relocate_task::locks): Likewise.
5190 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5191 to clear counters.
5192 (Sized_relobj::incremental_relocs_scan): Fix comment.
5193 (Sized_relobj::do_relocate): Pass output file offset to
5194 write_local_symbols.
5195 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5196 from class declaration.
5197 * script.cc (read_input_script): Allocate Script_info; pass
5198 argument serial number to report_script.
5199 * script.h (class Script_info): Move to incremental.h.
5200 * symtab.cc (Symbol_table::add_from_incrobj): New function.
5201 * symtab.h (Symbol_table::add_from_incrobj): New function.
5202 (Symbol_table::set_file_offset): New function.
5203
5204 2011-04-05 Cary Coutant <ccoutant@google.com>
5205
5206 * incremental-dump.cc (dump_incremental_inputs): Change signature
5207 to take a Sized_incremental_binary; change caller. Use readers
5208 in Sized_incremental_binary.
5209 * incremental.cc
5210 (Sized_incremental_binary::find_incremental_inputs_sections):
5211 Rename do_find_incremental_inputs_sections to this.
5212 (Sized_incremental_binary::setup_readers): New function.
5213 (Sized_incremental_binary::do_check_inputs): Check
5214 has_incremental_info_ flag; move setup code to setup_readers;
5215 use input readers.
5216 (Sized_incremental_binary::do_file_is_unchanged): New function.
5217 (Sized_incremental_binary::do_get_input_reader): New function.
5218 * incremental.h (class Incremental_binary): Move to end of file.
5219 (Incremental_binary::file_is_unchanged): New function.
5220 (Incremental_binary::do_file_is_unchanged): New function.
5221 (Incremental_binary::Input_reader): New class.
5222 (Incremental_binary::get_input_reader): New function.
5223 (class Sized_incremental_binary): Move to end of file.
5224 (Sized_incremental_binary::Sized_incremental_binary): Setup the
5225 input section reader classes.
5226 (Sized_incremental_binary::has_incremental_info): New function.
5227 (Sized_incremental_binary::inputs_reader): New function.
5228 (Sized_incremental_binary::symtab_reader): New function.
5229 (Sized_incremental_binary::relocs_reader): New function.
5230 (Sized_incremental_binary::got_plt_reader): New function.
5231 (Sized_incremental_binary::do_file_is_unchanged): New function.
5232 (Sized_incremental_binary::Sized_input_reader): New class.
5233 (Sized_incremental_binary::get_input_reader): New function.
5234 (Sized_incremental_binary::find_incremental_inputs_sections):
5235 Rename do_find_incremental_inputs_sections to this.
5236 (Sized_incremental_binary::setup_readers): New function.
5237 (Sized_incremental_binary::has_incremental_info_): New data member.
5238 (Sized_incremental_binary::inputs_reader_): New data member.
5239 (Sized_incremental_binary::symtab_reader_): New data member.
5240 (Sized_incremental_binary::relocs_reader_): New data member.
5241 (Sized_incremental_binary::got_plt_reader_): New data member.
5242 (Sized_incremental_binary::current_input_file_): New data member.
5243
5244 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
5245
5246 PR gold/12640
5247 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5248 violation.
5249
5250 2011-03-30 Cary Coutant <ccoutant@google.com>
5251
5252 * archive.cc (Archive::include_member): Adjust call to report_object.
5253 (Add_archive_symbols::run): Add script_info to call to
5254 report_archive_begin.
5255 (Lib_group::include_member): Adjust call to report_object.
5256 (Add_lib_group_symbols::run): Adjust call to report_object.
5257 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5258 blocks. Add object count for script input files.
5259 * incremental.cc (Incremental_inputs::report_archive_begin): Add
5260 script_info parameter; change all callers.
5261 (Incremental_inputs::report_object): Add script_info parameter;
5262 change all callers.
5263 (Incremental_inputs::report_script): Store backpointer to
5264 incremental info entry.
5265 (Output_section_incremental_inputs::set_final_data_size): Record
5266 additional information for scripts.
5267 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5268 * incremental.h (Incremental_script_entry::add_object): New function.
5269 (Incremental_script_entry::get_object_count): New function.
5270 (Incremental_script_entry::get_object): New function.
5271 (Incremental_script_entry::objects_): New data member; adjust
5272 constructor.
5273 (Incremental_inputs::report_archive_begin): Add script_info parameter.
5274 (Incremental_inputs::report_object): Add script_info parameter.
5275 (Incremental_inputs_reader::get_object_count): New function.
5276 (Incremental_inputs_reader::get_object_offset): New function.
5277 * options.cc (Input_arguments::add_file): Return reference to
5278 new input argument.
5279 * options.h (Input_argument::set_script_info): New function.
5280 (Input_argument::script_info): New function.
5281 (Input_argument::script_info_): New data member; adjust all
5282 constructors.
5283 (Input_file_group::add_file): Return reference to new input argument.
5284 (Input_file_lib::add_file): Likewise.
5285 (Input_arguments::add_file): Likewise.
5286 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5287 * script.cc (Parser_closure::Parser_closure): Add script_info
5288 parameter; adjust all callers.
5289 (Parser_closure::script_info): New function.
5290 (Parser_closure::script_info_): New data member.
5291 (read_input_script): Report scripts earlier to incremental info.
5292 (script_add_file): Set script_info in Input_argument.
5293 (script_add_library): Likewise.
5294 * script.h (Script_options::Script_info): Rewrite class.
5295
5296 2011-03-29 Cary Coutant <ccoutant@google.com>
5297
5298 * archive.cc (Library_base::should_include_member): Move
5299 method here from class Archive.
5300 (Archive::Archive): Initialize base class.
5301 (Archive::should_include_member): Move to base class.
5302 (Archive::do_for_all_unused_symbols): New function.
5303 (Add_archive_symbols::run): Remove redundant access to
5304 incremental_inputs.
5305 (Lib_group::Lib_group): Initialize base class.
5306 (Lib_group::do_filename): New function.
5307 (Lib_group::include_member): Pass pointer to Lib_group to
5308 report_object.
5309 (Lib_group::do_for_all_unused_symbols): New function.
5310 (Add_lib_group_symbols::run): Report archive information for
5311 incremental links.
5312 * archive.h (class Library_base): New base class.
5313 (class Archive): Derive from Library_base.
5314 (Archive::filename): Move to base class.
5315 (Archive::set_incremental_info): Likewise.
5316 (Archive::incremental_info): Likewise.
5317 (Archive::Should_include): Likewise.
5318 (Archive::should_include_member): Likewise.
5319 (Archive::Armap_entry): Remove.
5320 (Archive::Unused_symbol_iterator): Remove.
5321 (Archive::unused_symbols_begin): Remove.
5322 (Archive::unused_symbols_end): Remove.
5323 (Archive::do_filename): New function.
5324 (Archive::do_get_mtime): New function.
5325 (Archive::do_for_all_unused_symbols): New function.
5326 (Archive::task_): Move to base class.
5327 (Archive::incremental_info_): Likewise.
5328 (class Lib_group): Derive from Library_base.
5329 (Lib_group::do_filename): New function.
5330 (Lib_group::do_get_mtime): New function.
5331 (Lib_group::do_for_all_unused_symbols): New function.
5332 (Lib_group::task_): Move to base class.
5333 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5334 function.
5335 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5336 function.
5337 * incremental.cc (Incremental_inputs::report_archive_begin):
5338 Use Library_base; call library's get_mtime; add incremental inputs
5339 entry before members.
5340 (class Unused_symbol_visitor): New class.
5341 (Incremental_inputs::report_archive_end): Use Library_base; use
5342 visitor class to record unused symbols; don't add incremental inputs
5343 entry after members.
5344 (Incremental_inputs::report_object): Use Library_base.
5345 * incremental.h
5346 (Incremental_archive_entry::Incremental_archive_entry): Remove
5347 unused Archive parameter.
5348 (Incremental_inputs::report_archive_begin): Use Library_base.
5349 (Incremental_inputs::report_archive_end): Likewise.
5350 (Incremental_inputs::report_object): Likewise.
5351 * object.cc (Sized_relobj::do_for_all_global_symbols): New
5352 function.
5353 * object.h (Object::for_all_global_symbols): New function.
5354 (Object::do_for_all_global_symbols): New function.
5355 (Sized_relobj::do_for_all_global_symbols): New function.
5356 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
5357 function.
5358 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
5359 function.
5360
5361 2011-03-27 Ian Lance Taylor <iant@google.com>
5362
5363 * archive.cc (Archive::interpret_header): Return -1 if something
5364 goes wrong. Change callers accordingly.
5365
5366 2011-03-25 Cary Coutant <ccoutant@google.com>
5367
5368 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5369 * testsuite/Makefile.in: Regenerate.
5370
5371 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
5372
5373 * plugin.cc (get_view): New.
5374 (Plugin::load): Pass get_view to the plugin.
5375 (Plugin_manager::get_view): New.
5376
5377 2011-03-21 Ian Lance Taylor <iant@google.com>
5378
5379 * testsuite/final_layout.sh: Rewrite to not use dc.
5380 * testsuite/relro_test.sh: Fail if dc is not present.
5381
5382 2011-03-21 Sriraman Tallam <tmsriram@google.com>
5383
5384 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5385 Change == to -eq.
5386 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5387 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5388 Change == to -eq.
5389 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5390 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5391
5392 2011-03-14 Ian Lance Taylor <iant@google.com>
5393
5394 * script-sections.cc (Sort_output_sections::script_compare):
5395 Rename from is_before, change return type.
5396 (Sort_output_sections::operator()): Adjust accordingly.
5397
5398 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
5399
5400 PR gold/12572
5401 * testsuite/odr_violation2.cc: Add comment to make all error line
5402 numbers double digits.
5403 * testsuite/debug_msg.sh: Adjust expected errors.
5404
5405 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
5406
5407 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5408 but mark earlier ones as non-canonical
5409 (offset_to_iterator): Update search target and example
5410 (do_addr2line): Return extra lines in a vector*
5411 (format_file_lineno): Extract from do_addr2line
5412 (one_addr2line): Add vector* out-param
5413 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5414 when a lineno entry appeared last for its instruction
5415 (Dwarf_line_info): Add vector* out-param
5416 * object.cc (Relocate_info): Pass NULL for the vector* out-param
5417 * symtab.cc (Odr_violation_compare): Include the lineno in the
5418 comparison again.
5419 (linenos_from_loc): New. Combine the canonical line for an
5420 address with its other lines.
5421 (True_if_intersect): New. Helper functor to make
5422 std::set_intersection a query.
5423 (detect_odr_violations): Compare sets of lines instead of just
5424 one line for each function. This became less deterministic, but
5425 has fewer false positives.
5426 * symtab.h: Declarations.
5427 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5428 mix an optimized and non-optimized object in the same binary
5429 (odr_violation2.so): Same.
5430 * testsuite/Makefile.in: Regenerate from Makefile.am.
5431 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5432 * testsuite/debug_msg.sh: Update line numbers and add
5433 assertions.
5434 * testsuite/odr_violation1.cc: Use OdrDerived, in a
5435 non-optimized context.
5436 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5437 isn't inlined, and use OdrDerived in an optimized context.
5438 * testsuite/odr_header1.h: Defines OdrDerived, where
5439 optimization will change the
5440 first-instruction-in-the-destructor's file and line number.
5441 * testsuite/odr_header2.h: Defines OdrBase.
5442
5443 2011-03-09 Ian Lance Taylor <iant@google.com>
5444
5445 * fileread.cc (File_read::clear_views): Don't delete the whole
5446 file view.
5447
5448 2011-03-08 Ian Lance Taylor <iant@google.com>
5449
5450 PR gold/12525
5451 * fileread.cc: #include <climits>.
5452 (GOLD_IOV_MAX): Define.
5453 (File_read::read_multiple): Limit number of entries by iov_max.
5454 * fileread.h (class File_read): Always set max_readv_entries to
5455 128.
5456
5457 2011-03-07 Ian Lance Taylor <iant@google.com>
5458
5459 PR gold/12525
5460 * options.h (class General_options): Add -dy and -dn.
5461
5462 2011-03-02 Cary Coutant <ccoutant@google.com>
5463
5464 * testsuite/script_test_9.t: Add TLS segment.
5465
5466 2011-03-02 Simon Baldwin <simonb@google.com>
5467
5468 * configure.ac: Add check for gnu_indirect_function support in
5469 the toolchain building binutils.
5470 * configure: Rebuild.
5471
5472 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
5473
5474 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5475 plugin only symbols.
5476 (Symbol_table::sized_finalize_symbol) Mark symbol only present
5477 in plugin files as not needed in the symbol table.
5478
5479 2011-02-11 Sriraman Tallam <tmsriram@google.com>
5480
5481 * output.cc (Output_section::add_input_section): Delay fill
5482 generation for section ordering.
5483
5484 2011-02-09 Ian Lance Taylor <iant@google.com>
5485
5486 PR gold/12316
5487 * object.h (class Sized_relobj): Remove clear_local_symbols.
5488 * reloc.cc (Sized_relobj::do_relocate): Don't call
5489 clear_local_symbols.
5490
5491 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
5492
5493 * plugin.cc (is_visible_from_outside): Return true for symbols
5494 in the -u option.
5495
5496 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
5497
5498 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5499 filename.
5500
5501 2011-02-02 Sriraman Tallam <tmsriram@google.com>
5502
5503 * icf.h (is_section_foldable_candidate): Change type of parameter
5504 to std::string.
5505 * icf.cc (Icf::find_identical_sections): Change type of local variable
5506 section_name to be std::string.
5507 (is_function_ctor_or_dtor): Change type of parameter to std::string.
5508
5509 2011-01-25 Ian Lance Taylor <iant@google.com>
5510
5511 * script.cc (script_add_extern): Rewrite to use
5512 add_symbol_reference.
5513
5514 2011-01-25 Doug Kwan <dougkwan@google.com>
5515
5516 * icf.cc (get_section_contents): Always lock section's object.
5517
5518 2011-01-24 Ian Lance Taylor <iant@google.com>
5519
5520 * options.h (class General_options): Accept
5521 --no-detect-odr-violations.
5522
5523 2011-01-24 Ian Lance Taylor <iant@google.com>
5524
5525 * version.cc (version_string): Bump to 1.11.
5526
5527 2011-01-24 Ian Lance Taylor <iant@google.com>
5528
5529 * plugin.cc (class Plugin_rescan): Define new class.
5530 (Plugin_manager::claim_file): Set any_claimed_.
5531 (Plugin_manager::save_archive): New function.
5532 (Plugin_manager::save_input_group): New function.
5533 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5534 necessary.
5535 (Plugin_manager::new_undefined_symbol): New function.
5536 (Plugin_manager::rescan): New function.
5537 (Plugin_manager::rescannable_defines): New function.
5538 (Plugin_manager::add_input_file): Set any_added_.
5539 * plugin.h (class Plugin_manager): define new fields rescannable_,
5540 undefined_symbols_, any_claimed_, and any_added_. Declare
5541 Plugin_rescan as friend. Declare new functions.
5542 (Plugin_manager::Rescannable): Define type.
5543 (Plugin_manager::Rescannable_list): Define type.
5544 (Plugin_manager::Undefined_symbol_list): Define type.
5545 (Plugin_manager::Plugin_manager): Initialize new fields.
5546 * archive.cc (Archive::defines_symbol): New function.
5547 (Add_archive_symbols::run): Pass archive to plugins if any.
5548 * archive.h (class Archive): Declare defines_symbol.
5549 * readsyms.cc (Input_group::~Input_group): New function.
5550 (Finish_group::run): Pass input_group to plugins if any.
5551 * readsyms.h (class Input_group): Declare destructor.
5552 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5553 any.
5554
5555 2011-01-10 Ian Lance Taylor <iant@google.com>
5556
5557 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5558 section as relro.
5559 (Layout::set_segment_offsets): Reset increase_relro before calling
5560 set_section_addresses a second time.
5561
5562 2011-01-04 Cary Coutant <ccoutant@google.com>
5563
5564 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5565 sections before NOBITS sections.
5566
5567 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
5568
5569 * version.cc (print_version): Update copyright to 2011.
5570
5571 2010-12-23 Cary Coutant <ccoutant@google.com>
5572
5573 * output.h (Output_data_reloc::add_output_section): Pass OD instead
5574 of OS to this->add. Add OD parameter to second form of the function.
5575
5576 2010-12-20 Ian Lance Taylor <iant@google.com>
5577
5578 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5579 second of two consecutive entries with same offset.
5580
5581 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5582
5583 * testsuite/Makefile.am (ifuncmain2static_LDADD)
5584 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5585 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5586 to avoid unneeded links against $(LDADD).
5587 * testsuite/Makefile.in: Regenerate.
5588
5589 2010-12-15 Ian Lance Taylor <iant@google.com>
5590
5591 PR gold/12324
5592 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5593 for R_X86_64_32 and R_X86_64_PC32.
5594 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5595 ver_matching_def_pic.o.
5596 (ver_matching_def_pic.o): New target.
5597
5598 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5599
5600 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5601 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5602 Move definition before File_read::View member definitions.
5603 (File_read::View::~View): Initialize and hold lock before
5604 updating current_mapped_bytes.
5605
5606 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5607
5608 * dwarf_reader.cc: Remove outdated comment.
5609 * gold-threads.cc: Fix typo in error message.
5610 * archive.cc: Fix typos in comments.
5611 * archive.h: Likewise.
5612 * arm-reloc-property.cc: Likewise.
5613 * arm-reloc-property.h: Likewise.
5614 * arm-reloc.def: Likewise.
5615 * arm.cc: Likewise.
5616 * attributes.h: Likewise.
5617 * cref.cc: Likewise.
5618 * ehframe.cc: Likewise.
5619 * fileread.h: Likewise.
5620 * gold.h: Likewise.
5621 * i386.cc: Likewise.
5622 * icf.cc: Likewise.
5623 * incremental.h: Likewise.
5624 * int_encoding.cc: Likewise.
5625 * layout.h: Likewise.
5626 * main.cc: Likewise.
5627 * merge.h: Likewise.
5628 * object.cc: Likewise.
5629 * object.h: Likewise.
5630 * options.cc: Likewise.
5631 * readsyms.cc: Likewise.
5632 * reduced_debug_output.cc: Likewise.
5633 * reloc.cc: Likewise.
5634 * script-sections.cc: Likewise.
5635 * sparc.cc: Likewise.
5636 * symtab.h: Likewise.
5637 * target-reloc.h: Likewise.
5638 * target.cc: Likewise.
5639 * target.h: Likewise.
5640 * timer.cc: Likewise.
5641 * timer.h: Likewise.
5642 * x86_64.cc: Likewise.
5643
5644 2010-12-09 Cary Coutant <ccoutant@google.com>
5645
5646 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5647 stack.
5648 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5649 parameter; change all callers.
5650 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5651 * options.h (warn_execstack): New option.
5652
5653 2010-12-07 Doug Kwan <dougkwan@google.com>
5654
5655 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5656 like function call relocations.
5657
5658 2010-12-07 Ian Lance Taylor <iant@google.com>
5659
5660 * archive.cc (Archive::get_elf_object_for_member): Permit
5661 punconfigured to be NULL.
5662 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5663 (Archive::include_member): Pass NULL to get_elf_object_for_member
5664 if we searched for the archive and this is the first included
5665 object.
5666
5667 2010-12-01 Ian Lance Taylor <iant@google.com>
5668
5669 * dwarf_reader.h (class Sized_dwarf_line_info): Add
5670 track_relocs_type_ field.
5671 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5672 Set track_relocs_type_.
5673 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5674 contents when using RELA relocs.
5675 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5676 reloc_map_.
5677 * reloc.cc (Track_relocs::next_addend): New function.
5678 * reloc.h (class Track_relocs): Declare next_addend.
5679
5680 2010-12-01 Ian Lance Taylor <iant@google.com>
5681
5682 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5683 virtual destructor.
5684
5685 2010-12-01 Ian Lance Taylor <iant@google.com>
5686
5687 * README: Update compilers known to work and fail.
5688
5689 2010-11-23 Matthias Klose <doko@ubuntu.com>
5690
5691 * configure.in: For --enable-gold, handle value `default' instead of
5692 `both*'. Always install ld as ld.bfd, install as ld if gold is
5693 not the default.
5694 * configure: Regenerate.
5695
5696 2010-11-18 Doug Kwan <dougkwan@google.com>
5697
5698 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5699 and right_alignment to be zero. Store result alignment only if it is
5700 greater than existing alignment.
5701
5702 2010-11-16 Cary Coutant <ccoutant@google.com>
5703
5704 PR gold/12220
5705 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5706 Check for ".zdebug_line".
5707
5708 2010-11-16 Doug Kwan <dougkwan@google.com>
5709 Cary Coutant <ccoutant@google.com>
5710
5711 * output.h (Output_segment::set_section_addresses): Pass increase_relro
5712 by reference; adjust all callers.
5713 * output.cc (Output_segment::set_section_addresses): Adjust references
5714 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5715 list is empty.
5716 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5717 end at page boundary.
5718
5719 2010-11-16 Cary Coutant <ccoutant@google.com>
5720
5721 PR gold/12220
5722 * layout.cc (Layout::choose_output_section): Transform names of
5723 compressed sections even when using a script with a SECTIONS clause.
5724 (Layout::output_section_name): Remove code to transform
5725 compressed debug section names.
5726 * output.cc (Output_section::add_input_section): Use uncompressed
5727 section size when tracking input sections.
5728
5729 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
5730
5731 * symtab.h (Symbol::NON_PIC_REF): Remove.
5732 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5733 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
5734 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5735 (Symbol::use_plt_offset): Take a flags argument and pass it
5736 directly to needs_dynamic_reloc. Restrict check for undefined
5737 weak symbols to function calls.
5738 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5739 (Target_arm::Scan::global): Use it.
5740 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5741 (Target_arm::Relocate::relocate): Likewise.
5742 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5743 parameter with an r_type parameter. Use get_reference_flags
5744 to get the flags.
5745 (Target_arm::Relocate::relocate): Update accordingly.
5746 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5747 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5748 (Target_i386::Scan::global): Likewise.
5749 (Target_i386::Relocate::relocate): Likewise.
5750 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5751 parameter with an r_type parameter. Use get_reference_flags
5752 to get the flags.
5753 (Target_i386::Relocate::relocate): Update accordingly.
5754 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5755 (Target_powerpc::Scan::global): Use it.
5756 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5757 (Target_powerpc::Relocate::relocate): Likewise.
5758 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5759 (Target_sparc::Scan::global): Use it.
5760 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5761 (Target_sparc::Relocate::relocate): Likewise.
5762 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5763 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5764 (Target_x86_64::Scan::global): Likewise.
5765 (Target_x86_64::Relocate::relocate): Likewise.
5766
5767 2010-11-08 Doug Kwan <dougkwan@google.com>
5768 Cary Coutant <ccoutant@google.com>
5769
5770 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5771 (Arm_exidx_merge_section::section_contents_): New data member.
5772 (Arm_input_section::Arm_input_section): Initialize original_contents_.
5773 (Arm_input_section::~Arm_input_section): De-allocate memory.
5774 (Arm_input_section::original_contents_): New data member.
5775 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5776 in parameters instead of calling Object::section_contents without
5777 locking.
5778 (Arm_output_section::group_section): New parameter TASK. Pass it
5779 to callees that need locking objects.
5780 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
5781 to lock EXIDX input sections. Fix a formatting issue. Call
5782 Arm_exidx_merged_section::build_contents to create merged section
5783 contents.
5784 (Arm_output_section::create_stub_group): New parameter TASK. Use it
5785 to lock object of stub table owner.
5786 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5787 TEXT_SIZE to initialize data member TEXT_SIZE_.
5788 (Arm_exidx_input_section::addralign): Fix typo in comment.
5789 (Arm_exidx_input_section::text_size): New method.
5790 (Target_arm::do_relax): New parameter TASK. Pass it to callees
5791 that require locking objects. Lock objects before scanning for stubs
5792 and updating local symbols.
5793 (Arm_input_section<big_endian>::init): Copy contents of original
5794 input section.
5795 (Arm_input_section<big_endian>::do_write): Use saved contents of
5796 original input section instead of calling Object::section_contents
5797 without locking.
5798 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5799 size without calling Object::section_size().
5800 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5801 for size. Allocate a buffer for merged EXIDX entries.
5802 (Arm_exidx_merged_section::build_contents): New method.
5803 (Arm_exidx_merged_section::do_write): Move merge section contents
5804 building code to Arm_exidx_merged_section::build_contetns. Write
5805 out contetns in buffer instead of building it on the fly.
5806 (Arm_relobj::make_exidx_input_section): Also pass text section size
5807 to Arm_exidx_input_section constructor.
5808 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
5809 (Arm_dynobj::do_read_symbols): Fix memory leak.
5810 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5811 * target.h: (class Task): Add forward declaration.
5812 (Target::relax): Add new parameter TASK and pass it to
5813 Target::do_relax().
5814 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
5815
5816 2010-11-05 Cary Coutant <ccoutant@google.com>
5817
5818 PR gold/10708
5819 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5820 object when reading from the file.
5821 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5822 second layout pass.
5823 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5824 when reading section contents.
5825 (get_section_contents): Likewise.
5826 (icf::find_identical_sections): Likewise.
5827 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5828 object when reading from the file.
5829 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5830 the object when doing deferred section layout.
5831
5832 2010-11-03 Nick Clifton <nickc@redhat.com>
5833
5834 PR gold/12001
5835 * script.h (class Symbol_assignment: name): New member. Returns
5836 the name of the symbol.
5837 * scrfipt.cc (Script_options::is_pending_assignment): New member.
5838 Returns true if the given symbol name is on the list of
5839 assignments wating to be processed.
5840 * archive.cc (should_incldue_member): If the symbol is undefined,
5841 check to see if it is on the list of symbols pending assignment.
5842
5843 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
5844
5845 * script-sections.cc (Script_sections::find_memory_region): Check
5846 for a NULL output section pointer.
5847
5848 2010-10-29 Doug Kwan <dougkwan@google.com>
5849
5850 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5851 Output_section::add_relaxed_input_section.
5852 * output.cc (Output_section::add_relaxed_input_section): Add new
5853 arguments LAYOUT and NAME. Set section order index.
5854 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5855 Copy section order index.
5856 * output.h (Output_section::add_relaxed_input_section): Add new
5857 arguments LAYOUT and NAME.
5858
5859 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5860
5861 * testsuite/Makefile.am: Move gcctestdir/ld rule to
5862 NATIVE_OR_CROSS_LINKER.
5863 * testsuite/Makefile.in: Regenerate.
5864
5865 2010-10-20 Doug Kwan <dougkwan@google.com>
5866
5867 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5868 without SHF_LINK_ORDER flags.
5869 * layout.cc (Layout::choose_output_section): Do not filter
5870 SHF_LINK_ORDER flag in a relocatable link.
5871
5872 2010-10-17 Cary Coutant <ccoutant@google.com>
5873
5874 * output.h (Output_segment::set_section_addresses): Change function
5875 signature. Update all callers.
5876 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5877 sections.
5878 (Output_segment::set_section_addresses): Align after last TLS
5879 section. Add padding before last relro section instead of after.
5880
5881 2010-10-17 Doug Kwan <dougkwan@google.com>
5882
5883 * gold/arm.cc (Target_arm::got_section): Use correct order and set
5884 GOT output section to be writable.
5885
5886 2010-10-14 Cary Coutant <ccoutant@google.com>
5887
5888 * debug.h (DEBUG_INCREMENTAL): New flag.
5889 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5890 * gold.cc (queue_initial_tasks): Check parameters for incremental link
5891 mode.
5892 * incremental.cc (report_command_line): Ignore all forms of
5893 --incremental.
5894 * layout.cc (Layout::Layout): Check parameters for incremental link
5895 mode.
5896 * options.cc (General_options::parse_incremental): New function.
5897 (General_options::parse_no_incremental): New function.
5898 (General_options::parse_incremental_full): New function.
5899 (General_options::parse_incremental_update): New function.
5900 (General_options::incremental_mode_): New data member.
5901 (General_options::finalize): Check incremental_mode_.
5902 * options.h (General_options): Update help text for --incremental.
5903 Add --no-incremental, --incremental-full, --incremental-update.
5904 (General_options::Incremental_mode): New enum type.
5905 (General_options::incremental_mode): New function.
5906 (General_options::incremental_mode_): New data member.
5907 * parameters.cc (Parameters::incremental_mode_): New data member.
5908 (Parameters::set_options): Set incremental_mode_.
5909 (Parameters::set_incremental_full): New function.
5910 (Parameters::incremental): New function.
5911 (Parameters::incremental_update): New function.
5912 (set_parameters_incremental_full): New function.
5913 * parameters.h (Parameters::set_incremental_full): New function.
5914 (Parameters::incremental): New function.
5915 (Parameters::incremental_update): New function.
5916 (Parameters::incremental_mode_): New data member.
5917 (set_parameters_incremental_full): New function.
5918 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5919 incremental link mode.
5920 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5921 (Sized_relobj::do_relocate_sections): Likewise.
5922 * testsuite/Makefile.am (incremental_test): Use --incremental-full
5923 option.
5924 * testsuite/Makefile.in: Regenerate.
5925 * testsuite/incremental_test.sh: Filter all forms of --incremental.
5926
5927 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5928
5929 * script-sections.h (class Script_sections): Make
5930 Sections_elements typedef public.
5931 * script-sections.cc (class Sort_output_sections): Add elements_
5932 field. Add constructor which sets it; change all callers.
5933 (Sort_output_sections::is_before): New function.
5934 (Sort_output_sections::operator()): Call is_before.
5935 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5936 conditional.
5937 * testsuite/script_test_10.sh: New test. Test script section
5938 order.
5939 * testsuite/script_test_10.t: Likewise.
5940 * testsuite/script_test_10.s: Likewise.
5941 * testsuite/Makefile.am: Wrap the cross linker tests and the
5942 common tests into NATIVE_OR_CROSS_LINKER.
5943 (check_SCRIPTS): Add script_test_10.sh.
5944 (check_DATA): Add script_test_10.stdout.
5945 (script_test_10.o, script_test_10): New targets.
5946 (script_test_10.stdout): New target.
5947 * configure, testsuite/Makefile.in: Regenerate.
5948
5949 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5950
5951 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5952 error for the deprecated relocations.
5953 (Target_arm::Scan::global): Likewise.
5954 (Target_arm::Relocate::relocate): Likewise.
5955
5956 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
5957
5958 * fileread.cc (Input_file::find_file): Initialize *found_name
5959 and *namep when using the fallback search for case 4.
5960
5961 2010-10-11 Cary Coutant <ccoutant@google.com>
5962
5963 * options.h (class General_options): Redefine -z lazy as an alias for
5964 the negation of -z now.
5965
5966 2010-10-11 Ian Lance Taylor <iant@google.com>
5967
5968 * resolve.cc (symbol_to_bits): Report the value of the unsupported
5969 binding.
5970
5971 2010-10-06 Nick Clifton <nickc@redhat.com>
5972
5973 * script-sections.cc(class Memory_region): Remove
5974 current_lma_offset_ field. Rename current_vma_offset_ to
5975 current_offset_. Add last_section_ field.
5976 (Memory_region::get_current_vma_address): Rename to
5977 get_current_address.
5978 (Memory_region::get_current_lma_address): Delete.
5979 (Memory_region::increment_vma_offset): Rename to
5980 increment_offset.
5981 (Memory_region::increment_lma_offset): Delete.
5982 (Memory_region::attributes_compatible): New method. Returns
5983 true if the provided section is compatible with the region.
5984 (Memory_region::get_last_section): New method. Returns the last
5985 section to use the region.
5986 (Memory_region::set_last_section): New method. Stores the last
5987 section to use the region.
5988 (Script_sections::block_in_region): New method. Returns true if
5989 a block of memory is contained within a region.
5990 (Script_sections::find_memory_region): New method. Locates a
5991 memory region to be used to set a VMA or LMA address.
5992 (Output_section_definition::set_section_addresses): Add code to
5993 check for addresses set by memory regions.
5994 (Output_segment::set_section_addresses): Remove memory region
5995 walking code.
5996 (Script_sections::create_segment): Add a warning if a header
5997 segment is created outside of any region.
5998 * script-sections.h (class Script_sections): Add prototypes for
5999 find_memory_region and block_in_region methods.
6000 * testsuite/memory_test.s: Use .long instead of .word.
6001 * testsuite/memory_test.t: Add some more output sections.
6002 * testsuite/memory_test.sh: Update expected output.
6003
6004 2010-10-02 Doug Kwan <dougkwan@google.com>
6005
6006 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6007 defintion to symtab.h
6008 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6009 declaration to defintion.
6010
6011 2010-10-01 Nick Clifton <nickc@redhat.com>
6012
6013 * expression.cc (eval): Replace dummy argument with NULL.
6014 (eval_maybe_dot): Check for a NULL result section pointer.
6015 (Symbol_expression::value): Likewise.
6016 (Dot_expression::value): Likewise.
6017 (BINARY_EXPRESSION): Likewise.
6018 (Max_expression::value): Likewise.
6019 (Min_expression::value): Likewise.
6020 (Absolute_expression::value): Likewise.
6021 (Addr_expression::value_from_output_section): Likewise.
6022 (Loaddddr_expression::value_from_output_section): Likewise.
6023 (Segment_start_expression::value): Likewise.
6024 * script-sections.cc
6025 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6026 argument with NULL.
6027 (Sections_elememt_dot_assignment::set_section_addresses):
6028 Likewise.
6029 (Output_data_expression::do_write_to_buffer): Likewise.
6030 (Output_section_definition::finalize_symbols): Likewise.
6031 (Output_section_definition::set_section_addresses): Likewise.
6032
6033 2010-09-30 Doug Kwan <dougkwan@google.com>
6034
6035 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6036
6037 2010-09-28 Sriraman Tallam <tmsriram@google.com>
6038
6039 * target.h (Target::can_icf_inline_merge_sections): New virtual
6040 function.
6041 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6042 virtual function.
6043 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6044 virtual function.
6045 * icf.cc (get_section_contents): Inline merge sections only when
6046 target allows it.
6047
6048 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6049
6050 * configure: Regenerate.
6051
6052 2010-09-17 Ian Lance Taylor <iant@google.com>
6053
6054 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6055 * testsuite/Makefile.am (memory_test.o): New target.
6056 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6057 memory_test.t.
6058 * testsuite/Makefile.in: Rebuild.
6059
6060 2010-09-17 Doug Kwan <dougkwan@google.com>
6061
6062 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6063 defintion if relocation uses GOT entries of the symbol.
6064 * testsuite/icf_safe_test.sh: Fix test.
6065 * testsuite/icf_safe_so_test.sh: Fix test.
6066
6067 2010-09-16 Cary Coutant <ccoutant@google.com>
6068
6069 * script_sections.cc (class Memory_region): Remove "NULL" from
6070 vector initializations.
6071
6072 2010-09-15 Cary Coutant <ccoutant@google.com>
6073
6074 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6075 Resolve forwarding symbols.
6076
6077 2010-09-15 Doug Kwan <dougkwan@google.com>
6078
6079 * gold/testsuite/script_test_3.t: Add ARM special sections.
6080 * gold/testsuite/script_test_4.t: Same.
6081 * gold/testsuite/script_test_5.t: Same.
6082 * gold/testsuite/script_test_6.t: Same.
6083 * gold/testsuite/script_test_7.t: Same.
6084 * gold/testsuite/script_test_7.t: Same.
6085 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6086
6087 2010-09-14 Cary Coutant <ccoutant@google.com>
6088
6089 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6090 (Target_x86_64::Relocate::relocate_tls): Replace check for
6091 saw_tls_block_reloc_ with test for executable section.
6092
6093 2010-09-12 Cary Coutant <ccoutant@google.com>
6094
6095 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6096 position-independent executables to shared libraries need dynamic
6097 relocations.
6098 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6099 position-independent executables.
6100 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6101 * testsuite/Makefile.in: Regenerate.
6102
6103 2010-09-10 Nick Clifton <nickc@redhat.com>
6104
6105 PR gold/11997
6106 * testsuite/memory_test.t: Discard any sections that are not
6107 needed.
6108
6109 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
6110
6111 PR gold/11996
6112 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6113 "This::" to work around a bug in gcc 4.2.
6114
6115 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6116
6117 2010-09-09 Rafael Espindola <espindola@google.com>
6118
6119 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6120 sections with different PF_X flags in the same segment.
6121 (Layout::find_first_load_seg): Search all segments to find the first
6122 one.
6123 * options.h (rosegment): New.
6124
6125 2010-09-08 Rafael Espindola <espindola@google.com>
6126
6127 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6128
6129 2010-09-08 Doug Kwan <dougkwan@google.com>
6130
6131 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6132 (Arm_relobj::do_relocate_sections): Add new parameter for output
6133 file to match the parent.
6134 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6135 of local symbols instead of input values. Update code to track
6136 changes in gold::relocate_section.
6137 * object.cc (Sized_relobj::compute_final_local_value): New methods.
6138 (Sized_relobj::compute_final_local_value_internal): New methods.
6139 (Sized_relobj::do_finalize_local_symbols): Move code from loop
6140 body into private version of Sized_relobj::compute_final_local_value.
6141 Call the inline method.
6142 * object.h (Symbol_value::Symbol_value): Define destructor. Free
6143 merged symbol value if there is one.
6144 (Symbol_value::has_output_value): New method defintiion.
6145 (Sized_relobj::Compute_final_local_value_status): New enum type.
6146 (Sized_relobj::compute_final_local_value): New methods.
6147 (Sized_relobj::compute_final_local_value_internal): New methods.
6148 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6149 and arm_cortex_a8.sh.
6150 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6151 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6152 New tests.
6153 * Makefile.in: Regenerate.
6154 * testsuite/arm_bl_out_of_range.s: Update test.
6155 * testsuite/thumb_bl_out_of_range.s: Ditto.
6156 * testsuite/thumb_blx_out_of_range.s: Ditto.
6157 * testsuite/arm_branch_out_of_range.sh: New file.
6158 * testsuite/arm_cortex_a8.sh: Ditto.
6159 * testsuite/arm_cortex_a8_b.s: Ditto.
6160 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6161 * testsuite/arm_cortex_a8_b_local.s: Ditto.
6162 * testsuite/arm_cortex_a8_bl.s: Ditto.
6163 * testsuite/arm_cortex_a8_blx.s: Ditto.
6164 * testsuite/arm_cortex_a8_local.s: Ditto.
6165 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6166 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6167
6168 2010-09-08 Rafael Espindola <espindola@google.com>
6169
6170 * Makefile.am (memory_test.stdout): Run readelf with -W.
6171 * Makefile.in: Regenerate.
6172 * testsuite/memory_test.sh: Make the regexps accept both 32 and
6173 64 bit output.
6174
6175 2010-09-08 Rafael Espindola <espindola@google.com>
6176
6177 * script-sections.cc (Script_sections::add_memory_region): Convert
6178 field precision to int.
6179 * script.cc (script_set_section_region, script_set_section_region):
6180 Convert field precision to int.
6181
6182 2010-09-08 Rafael Espindola <espindola@google.com>
6183
6184 * arm.cc (do_finalize_sections): Create the __exidx_start and
6185 __exdix_end symbols even when the section is missing.
6186
6187 2010-09-08 Nick Clifton <nickc@redhat.com>
6188
6189 * README: Remove claim that MEMORY is not supported.
6190 * expression.cc (script_exp_function_origin)
6191 (script_exp_function_length): Move from here to ...
6192 * script.cc: ... here.
6193 (script_set_section_region, script_add_memory)
6194 (script_parse_memory_attr, script_include_directive): New
6195 functions.
6196 * script-sections.cc
6197 (class Memory_region): New class.
6198 (class Output_section_definition): Add set_memory_region,
6199 set_section_vma, set_section_lma and get_section_name methods.
6200 (class Script_Sections): Add add_memory_region,
6201 find_memory_region, find_memory_region_origin,
6202 find_memory_region_length and set_memory_region methods.
6203 Have set_section_addresses method walk the list of set memory
6204 regions.
6205 Extend the print methos to display memory regions.
6206 * script-sections.h: Add prototypes for new methods.
6207 Add enum for MEMORY region attributes.
6208 * yyscript.y: Add support for parsing MEMORY regions.
6209 * script-c.h: Add prototypes for new functions.
6210 * testsuite/Makefile.am: Add test of MEMORY region functionality.
6211 * testsuite/Makefile.in: Regenerate.
6212 * testsuite/memory_test.sh: New script.
6213 * testsuite/memory_test.s: New assembler source file.
6214 * testsuite/memory_test.t: New linker script.
6215
6216 2010-08-27 Doug Kwan <dougkwan@google.com>
6217
6218 * gold/resolve.cc (Symbol_table::should_override): Let a weak
6219 reference override an existing dynamic weak reference.
6220 * testsuite/Makefile.am: Add new test dyn_weak_ref.
6221 * testsuite/Makefile.in: Regenerate.
6222 * testsuite/dyn_weak_ref.sh: New file.
6223 * testsuite/dyn_weak_ref_1.c: Ditto.
6224 * testsuite/dyn_weak_ref_2.c: Ditto.
6225
6226 2010-08-27 Ian Lance Taylor <iant@google.com>
6227
6228 * incremental.h (class Incremental_input_entry): Add virtual
6229 destructor.
6230
6231 2010-08-27 Ian Lance Taylor <iant@google.com>
6232
6233 * testsuite/start_lib_test_3.c: Mark t3 as used.
6234
6235 2010-08-27 Nick Clifton <nickc@redhat.com>
6236
6237 * options.cc (version_script): Fix small typo in previous
6238 whitespace tidyup.
6239
6240 2010-08-25 Nick Clifton <nickc@redhat.com>
6241
6242 * archive.cc: Formatting fixes: Remove whitespace between
6243 typename and following asterisk. Remove whitespace between
6244 function name and opening parenthesis.
6245 * archive.h: Likewise.
6246 * arm.cc: Likewise.
6247 * attributes.cc: Likewise.
6248 * attributes.h: Likewise.
6249 * common.cc: Likewise.
6250 * copy-relocs.cc: Likewise.
6251 * dirsearch.h: Likewise.
6252 * dynobj.cc: Likewise.
6253 * ehframe.cc: Likewise.
6254 * ehframe.h: Likewise.
6255 * expression.cc: Likewise.
6256 * fileread.cc: Likewise.
6257 * fileread.h: Likewise.
6258 * gc.h: Likewise.
6259 * gold-threads.cc: Likewise.
6260 * gold.cc: Likewise.
6261 * i386.cc: Likewise.
6262 * icf.h: Likewise.
6263 * incremental-dump.cc: Likewise.
6264 * incremental.cc: Likewise.
6265 * layout.cc: Likewise.
6266 * layout.h: Likewise.
6267 * main.cc: Likewise.
6268 * merge.cc: Likewise.
6269 * merge.h: Likewise.
6270 * object.cc: Likewise.
6271 * object.h: Likewise.
6272 * options.cc: Likewise.
6273 * options.h: Likewise.
6274 * output.cc: Likewise.
6275 * output.h: Likewise.
6276 * plugin.cc: Likewise.
6277 * plugin.h: Likewise.
6278 * powerpc.cc: Likewise.
6279 * reloc.cc: Likewise.
6280 * script-c.h: Likewise.
6281 * script-sections.cc: Likewise.
6282 * script.cc: Likewise.
6283 * stringpool.cc: Likewise.
6284 * symtab.cc: Likewise.
6285 * symtab.h: Likewise.
6286 * target.cc: Likewise.
6287 * timer.cc: Likewise.
6288 * timer.h: Likewise.
6289 * version.cc: Likewise.
6290 * x86_64.cc: Likewise.
6291
6292 2010-08-24 Nick Clifton <nickc@redhat.com>
6293
6294 PR 11899
6295 * layout.cc (segment_precedes): Sort segments by their physical
6296 addresses, if they have been set.
6297
6298 2010-08-23 Cary Coutant <ccoutant@google.com>
6299
6300 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6301 symbols data.
6302 (Lib_group::include_member): Unlock object after deleting its
6303 symbols data.
6304 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6305 the bug fixed here.
6306
6307 2010-08-19 Neil Vachharajani <nvachhar@google.com>
6308 Cary Coutant <ccoutant@google.com>
6309
6310 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6311 constructor, and set_blocker.
6312 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6313 readsyms_blocker_.
6314 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6315 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6316 * testsuite/Makefile.am (start_lib_test): New test case.
6317 * testsuite/Makefile.in: Regenerate.
6318 * testsuite/start_lib_test_main.c: New file.
6319 * testsuite/start_lib_test_1.c: New file.
6320 * testsuite/start_lib_test_2.c: New file.
6321 * testsuite/start_lib_test_3.c: New file.
6322
6323 2010-08-19 Ian Lance Taylor <iant@google.com>
6324
6325 * Makefile.in: Rebuild with automake 1.11.1.
6326 * aclocal.m4: Likewise.
6327 * testsuite/Makefile.in: Likewise.
6328
6329 2010-08-19 Ian Lance Taylor <iant@google.com>
6330
6331 PR 10893
6332 * i386.cc (class Output_data_plt_i386): Update declarations.
6333 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
6334 local_ifuncs_ fields.
6335 (Target_i386::do_plt_section_for_global): New function.
6336 (Target_i386::do_plt_section_for_local): New function.
6337 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6338 parameter; change all callers. Initialize global_ifuncs_ and
6339 local_ifuncs_. If doing a static link define __rel_iplt_start and
6340 __rel_iplt_end.
6341 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6342 (Output_data_plt_i386::add_local_ifunc_entry): New function.
6343 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6344 symbols.
6345 (Target_i386::make_plt_section): New function, broken out of
6346 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
6347 (Target_i386::make_plt_entry): Call make_plt_section.
6348 (Target_i386::make_local_ifunc_plt_entry): New function.
6349 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6350 (Target_i386::Scan::local): Handle IFUNC symbols. Add
6351 R_386_IRELATIVE to switch.
6352 (Target_i386::Scan::global): Likewise.
6353 (Target_i386::Relocate::relocate): Likewise.
6354 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6355 switch.
6356 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6357 (Target_x86_64::do_plt_section_for_global): New function.
6358 (Target_x86_64::do_plt_section_for_local): New function.
6359 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6360 parameter; change all callers. If doing a static link define
6361 __rela_iplt_start and __rela_iplt_end.
6362 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6363 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6364 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6365 to point to .plt.
6366 (Target_x86_64::make_local_ifunc_plt_entry): New function.
6367 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6368 switch.
6369 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6370 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
6371 R_X86_64_IRELATIVE to switch.
6372 (Target_x86_64::Scan::global): Likewise.
6373 (Target_x86_64::Relocate::relocate): Likewise.
6374 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6375 switch.
6376 * target.h (class Target): Add plt_section_for_global and
6377 plt_section_for_local functions. Add do_plt_section_for_global
6378 and do_plt_section_for_local virtual functions.
6379 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
6380 clarifying comments.
6381 (Symbol::use_plt_offset): Handle IFUNC symbol.
6382 * object.cc (Sized_relobj::Sized_relobj): Initialize
6383 local_plt_offsets_.
6384 (Sized_relobj::local_has_plt_offset): New function.
6385 (Sized_relobj::local_plt_offset): New function.
6386 (Sized_relobj::set_local_plt_offset): New function.
6387 (Sized_relobj::do_count): Handle IFUNC symbol.
6388 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
6389 a bit away from input_shndx_ field. Add set_is_func_symbol and
6390 is_ifunc_symbol functions.
6391 (class Sized_relobj): Update declarations. Remove Tls_got_entry
6392 and Local_tls_got_offsets. Define Local_plt_offsets. Add
6393 local_plt_offsets_ field.
6394 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6395 * output.h (class Output_section_data): Add non-const
6396 output_section function.
6397 (class Output_data_got): Update declarations.
6398 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6399 Add use_plt_offset parameter to global and local constructors.
6400 Change all callers. Change local_sym_index_ field to 31 bits.
6401 Change GSYM_CODE and CONSTANT_CODE accordingly.
6402 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6403 doing a static link don't set sh_link field.
6404 (Output_data_got::Got_entry::write): Use PLT offset if
6405 appropriate.
6406 (Output_data_got::add_global_plt): New function.
6407 (Output_data_got::add_local_plt): New function.
6408 * target-reloc.h (relocate_section): Handle IFUNC symbol.
6409 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6410 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6411 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6412 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6413 IFUNC conditional.
6414 * testsuite/ifunc-sel.h: New file.
6415 * testsuite/ifuncmain1.c: New file.
6416 * testsuite/ifuncmain1vis.c: New file.
6417 * testsuite/ifuncmod1.c: New file.
6418 * testsuite/ifuncdep2.c: New file.
6419 * testsuite/ifuncmain2.c: New file.
6420 * testsuite/ifuncmain3.c: New file.
6421 * testsuite/ifuncmod3.c: New file.
6422 * testsuite/ifuncmain4.c: New file.
6423 * testsuite/ifuncmain5.c: New file.
6424 * testsuite/ifuncmod5.c: New file.
6425 * testsuite/ifuncmain6pie.c: New file.
6426 * testsuite/ifuncmod6.c: New file.
6427 * testsuite/ifuncmain7.c: New file.
6428 * configure, testsuite/Makefile.in: Rebuild.
6429
6430 2010-08-18 Ian Lance Taylor <iant@google.com>
6431
6432 * incremental.cc
6433 (Output_section_incremental_inputs::write_input_files): Add cast
6434 to avoid signed/unsigned comparison warning.
6435 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6436
6437 2010-08-12 Cary Coutant <ccoutant@google.com>
6438
6439 * common.cc (Sort_commons::operator()): Remove unnecessary code.
6440
6441 2010-08-13 Ian Lance Taylor <iant@google.com>
6442
6443 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6444
6445 2010-08-12 Cary Coutant <ccoutant@google.com>
6446 Doug Kwan <dougkwan@google.com>
6447
6448 * resolve.cc (Symbol_table::should_override): When a weak dynamic
6449 defintion overrides non-weak undef, remember that the original undef
6450 is not weak.
6451 * symtab.cc (Symbol_table::sized_write_global): For undef without
6452 an original weak binding, set binding to global in output.
6453 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6454 * testsuite/Makefile.in: Regenerate.
6455 * testsuite/strong_ref_weak_def.sh: New file.
6456 * testsuite/strong_ref_weak_def_1.c: Ditto.
6457 * testsuite/strong_ref_weak_def_2.c: Ditto.
6458
6459 2010-08-12 Cary Coutant <ccoutant@google.com>
6460
6461 * testsuite/incremental_test.sh: Rewrite.
6462 * testsuite/incremental_test_1.c: Rewrite.
6463 * testsuite/incremental_test_2.c: Rewrite.
6464
6465 2010-08-12 Cary Coutant <ccoutant@google.com>
6466
6467 * arm.cc (Target_arm::got_size): Add const.
6468 (Target_arm::got_entry_count): New function.
6469 (Target_arm::plt_entry_count): New function.
6470 (Target_arm::first_plt_entry_offset): New function.
6471 (Target_arm::plt_entry_size): New function.
6472 (Output_data_plt_arm::entry_count): New function.
6473 (Output_data_plt_arm::first_plt_entry_offset): New function.
6474 (Output_data_plt_arm::get_plt_entry_size): New function.
6475 * i386.cc (Target_i386::got_size): Add const.
6476 (Target_i386::got_entry_count): New function.
6477 (Target_i386::plt_entry_count): New function.
6478 (Target_i386::first_plt_entry_offset): New function.
6479 (Target_i386::plt_entry_size): New function.
6480 (Output_data_plt_i386::entry_count): New function.
6481 (Output_data_plt_i386::first_plt_entry_offset): New function.
6482 (Output_data_plt_i386::get_plt_entry_size): New function.
6483 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6484 find_incremental_inputs_sections. Dump incremental_got_plt section.
6485 * incremental.cc: Include target.h.
6486 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6487 parameter. Adjust all callers. Find incremental_got_plt section.
6488 (Incremental_inputs::create_data_sections): Create incremental_got_plt
6489 section.
6490 (Output_section_incremental_inputs::set_final_data_size): Calculate
6491 size of incremental_got_plt section.
6492 (Output_section_incremental_inputs::do_write): Write the
6493 incremental_got_plt section.
6494 (Got_plt_view_info): New struct.
6495 (Local_got_offset_visitor): New class.
6496 (Global_got_offset_visitor): New class.
6497 (Global_symbol_visitor_got_plt): New class.
6498 (Output_section_incremental_inputs::write_got_plt): New function.
6499 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6500 Add parameter. Adjust all callers.
6501 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6502 (Incremental_inputs::got_plt_section): New function.
6503 (Incremental_inputs::got_plt_section_): New data member.
6504 (Incremental_got_plt_reader): New class.
6505 * layout.cc (Layout::create_incremental_info_sections): Add the
6506 incremental_got_plt section.
6507 * object.h (Got_offset_list::get_list): New function.
6508 (Got offset_list::for_all_got_offsets): New function.
6509 (Sized_relobj::local_got_offset_list): New function.
6510 * powerpc.cc (Target_powerpc::got_size): Add const.
6511 (Target_powerpc::got_entry_count): New function.
6512 (Target_powerpc::plt_entry_count): New function.
6513 (Target_powerpc::first_plt_entry_offset): New function.
6514 (Target_powerpc::plt_entry_size): New function.
6515 (Output_data_plt_powerpc::entry_count): New function.
6516 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6517 (Output_data_plt_powerpc::get_plt_entry_size): New function.
6518 * sparc.cc (Target_sparc::got_size): Add const.
6519 (Target_sparc::got_entry_count): New function.
6520 (Target_sparc::plt_entry_count): New function.
6521 (Target_sparc::first_plt_entry_offset): New function.
6522 (Target_sparc::plt_entry_size): New function.
6523 (Output_data_plt_sparc::entry_count): New function.
6524 (Output_data_plt_sparc::first_plt_entry_offset): New function.
6525 (Output_data_plt_sparc::get_plt_entry_size): New function.
6526 * symtab.h (Symbol::got_offset_list): New function.
6527 (Symbol_table::for_all_symbols): New function.
6528 * target.h (Sized_target::got_entry_count): New function.
6529 (Sized_target::plt_entry_count): New function.
6530 (Sized_target::plt_entry_size): New function.
6531 * x86_64.cc (Target_x86_64::got_size): Add const.
6532 (Target_x86_64::got_entry_count): New function.
6533 (Target_x86_64::plt_entry_count): New function.
6534 (Target_x86_64::first_plt_entry_offset): New function.
6535 (Target_x86_64::plt_entry_size): New function.
6536 (Output_data_plt_x86_64::entry_count): New function.
6537 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6538 (Output_data_plt_x86_64::get_plt_entry_size): New function.
6539
6540 2010-08-12 Cary Coutant <ccoutant@google.com>
6541
6542 * archive.cc: Include incremental.h.
6543 (Archive::Archive): Initialize incremental_info_.
6544 (Archive::include_member): Record archive members in incremental info.
6545 (Add_archive_symbols::run): Record begin and end of an archive in
6546 incremental info.
6547 (Lib_group::include_member): Record objects in incremental info.
6548 * archive.h (Incremental_archive_entry): Forward declaration.
6549 (Archive::set_incremental_info): New member function.
6550 (Archive::incremental_info): New member function.
6551 (Archive::Unused_symbol_iterator): New class.
6552 (Archive::unused_symbols_begin): New member function.
6553 (Archive::unused_symbols_end): New member function.
6554 (Archive::incremental_info_): New data member.
6555 * incremental-dump.cc (find_input_containing_global): New function.
6556 (dump_incremental_inputs): Dump new incremental info sections.
6557 * incremental.cc: Include symtab.h.
6558 (Output_section_incremental_inputs): New class.
6559 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6560 new incremental info sections.
6561 (Sized_incremental_binary::do_check_inputs): Likewise.
6562 (Incremental_inputs::report_archive): Remove.
6563 (Incremental_inputs::report_archive_begin): New function.
6564 (Incremental_inputs::report_archive_end): New function.
6565 (Incremental_inputs::report_object): New function.
6566 (Incremental_inputs::finalize_inputs): Remove.
6567 (Incremental_inputs::report_input_section): New function.
6568 (Incremental_inputs::report_script): Rewrite.
6569 (Incremental_inputs::finalize): Do nothing but finalize string table.
6570 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6571 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6572 (Incremental_inputs::create_data_sections): New function.
6573 (Incremental_inputs::relocs_entsize): New function.
6574 (Output_section_incremental_inputs::set_final_data_size): New function.
6575 (Output_section_incremental_inputs::do_write): New function.
6576 (Output_section_incremental_inputs::write_header): New function.
6577 (Output_section_incremental_inputs::write_input_files): New function.
6578 (Output_section_incremental_inputs::write_info_blocks): New function.
6579 (Output_section_incremental_inputs::write_symtab): New function.
6580 * incremental.h (Incremental_script_entry): Forward declaration.
6581 (Incremental_object_entry): Forward declaration.
6582 (Incremental_archive_entry): Forward declaration.
6583 (Incremental_inputs): Forward declaration.
6584 (Incremental_inputs_header_data): Remove.
6585 (Incremental_inputs_header): Remove.
6586 (Incremental_inputs_header_write): Remove.
6587 (Incremental_inputs_entry_data): Remove.
6588 (Incremental_inputs_entry): Remove.
6589 (Incremental_inputs_entry_write): Remove.
6590 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6591 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6592 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6593 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6594 Likewise.
6595 (Incremental_input_entry): New class.
6596 (Incremental_script_entry): New class.
6597 (Incremental_object_entry): New class.
6598 (Incremental_archive_entry): New class.
6599 (Incremental_inputs::Incremental_inputs): Initialize new data members.
6600 (Incremental_inputs::report_inputs): Remove.
6601 (Incremental_inputs::report_archive): Remove.
6602 (Incremental_inputs::report_archive_begin): New function.
6603 (Incremental_inputs::report_archive_end): New function.
6604 (Incremental_inputs::report_object): Change prototype.
6605 (Incremental_inputs::report_input_section): New function.
6606 (Incremental_inputs::report_script): Change prototype.
6607 (Incremental_inputs::get_reloc_count): New function.
6608 (Incremental_inputs::set_reloc_count): New function.
6609 (Incremental_inputs::create_data_sections): New function.
6610 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6611 (Incremental_inputs::inputs_section): New function.
6612 (Incremental_inputs::symtab_section): New function.
6613 (Incremental_inputs::relocs_section): New function.
6614 (Incremental_inputs::get_stringpool): Add const.
6615 (Incremental_inputs::command_line): Add const.
6616 (Incremental_inputs::inputs): Remove.
6617 (Incremental_inputs::command_line_key): New function.
6618 (Incremental_inputs::input_file_count): New function.
6619 (Incremental_inputs::input_files): New function.
6620 (Incremental_inputs::relocs_entsize): New function.
6621 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6622 (Incremental_inputs::finalize_inputs): Remove.
6623 (Incremental_inputs::Input_info): Remove.
6624 (Incremental_inputs::lock_): Remove.
6625 (Incremental_inputs::inputs_): Change type.
6626 (Incremental_inputs::inputs_map_): Remove.
6627 (Incremental_inputs::current_object_entry_): New data member.
6628 (Incremental_inputs::inputs_section_): New data member.
6629 (Incremental_inputs::symtab_section_): New data member.
6630 (Incremental_inputs::relocs_section_): New data member.
6631 (Incremental_inputs::reloc_count_): New data member.
6632 (Incremental_inputs_reader): New class.
6633 (Incremental_symtab_reader): New class.
6634 (Incremental_relocs_reader): New class.
6635 * layout.cc (Layout::finalize): Move finalization of incremental info
6636 and creation of incremental info sections to follow finalization of
6637 symbol table. Set offsets for postprocessing sections.
6638 (Layout::create_incremental_info_sections): Call
6639 Incremental_inputs::create_data_sections. Add incremental symtab
6640 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
6641 sections to layout after input sections.
6642 * layout.h (struct Timespec): Forward declaration.
6643 (Layout::incremental_inputs): Add const.
6644 (Layout::create_incremental_info_sections): Add parameter.
6645 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6646 * object.cc: Include incremental.h.
6647 (Relobj::finalize_incremental_relocs): New function.
6648 (Sized_relobj::do_layout): Record input sections in incremental info.
6649 * object.h (Object::output_section): New function.
6650 (Object::output_section_offset): Moved from Relobj.
6651 (Object::get_incremental_reloc_base): New function.
6652 (Object::get_incremental_reloc_count): New function.
6653 (Object::do_output_section): New function.
6654 (Object::do_output_section_offset): Moved from Relobj.
6655 (Object::do_get_incremental_reloc_base): New function.
6656 (Object::do_get_incremental_reloc_count): New function.
6657 (Object::Object): Initialize new data members.
6658 (Relobj::output_section): Renamed do_output_section and moved to
6659 protected.
6660 (Relobj::output_section_offset): Moved to Object.
6661 (Relobj::do_get_incremental_reloc_base): New function.
6662 (Relobj::do_get_incremental_reloc_count): New function.
6663 (Relobj::allocate_incremental_reloc_counts): New function.
6664 (Relobj::count_incremental_reloc): New function.
6665 (Relobj::finalize_incremental_relocs): New function.
6666 (Relobj::next_incremental_reloc_index): New function.
6667 (Relobj::reloc_counts_): New data member.
6668 (Relobj::reloc_bases_): New data member.
6669 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
6670 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
6671 (Sized_relobj::incremental_relocs_scan): New function.
6672 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6673 (Sized_relobj::incremental_relocs_write): New function.
6674 (Sized_relobj::incremental_relocs_write_reltype): New function.
6675 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6676 incremental link.
6677 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6678 archives and object files elsewhere.
6679 (Add_symbols::run): Report object files here.
6680 (Finish_group::run): Report end of archive at end of group.
6681 * reloc.cc: Include layout.h, incremental.h.
6682 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6683 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6684 (Sized_relobj::incremental_relocs_scan): New function.
6685 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6686 (Sized_relobj::do_relocate_sections): Write incremental relocations.
6687 (Sized_relobj::incremental_relocs_write): New function.
6688 (Sized_relobj::incremental_relocs_write_reltype): New function.
6689 * script.cc (read_input_script): Rewrite test for incremental link.
6690 Change call to Incremental_inputs::report_script.
6691 * symtab.h (Symbol_table::first_global_index): New function.
6692 (Symbol_table::output_count): New function.
6693
6694 2010-08-12 Doug Kwan <dougkwan@google.com>
6695
6696 * arm.cc (Target_arm::merge_object_attributes): Check command line
6697 options --no-wchar-size-warning and --no-enum-size-warning.
6698 * options.h (General_options): Add ld-compatible options
6699 --no-enum-size-warning and --no-wchar-size-warning.
6700
6701 2010-08-04 Ian Lance Taylor <iant@google.com>
6702
6703 * x86_64.cc (Target_x86_64::Scan::local): Use
6704 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6705 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6706 (Target_x86_64::Scan::global): Likewise.
6707 (Target_x86_64::Relocate::relocate): Likewise.
6708 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6709 Likewise.
6710
6711 2010-08-03 Cary Coutant <ccoutant@google.com>
6712
6713 * merge.cc (Output_merge_string::do_add_input_section): Count strings
6714 to reserve space in merged_strings vector. Keep total input size
6715 for stats.
6716 (Output_merge_string::do_print_merge_stats): Print total input size.
6717 * merge.h (Output_merge_string): Add input_size_ field.
6718 * stringpool.cc (Stringpool_template::string_length): Move
6719 implementations out of Stringpool_template class and place in
6720 stringpool.h.
6721 * stringpool.h (string_length): Move out of Stringpool_template.
6722
6723 2010-08-03 Ian Lance Taylor <iant@google.com>
6724
6725 PR 11712
6726 * layout.cc (relaxation_loop_body): If address of load segment is
6727 set, adjust address to include headers if possible.
6728
6729 2010-08-03 Ian Lance Taylor <iant@google.com>
6730
6731 * version.cc (version_string): Bump to 1.10.
6732
6733 2010-08-03 Ian Lance Taylor <iant@google.com>
6734
6735 PR 11805
6736 * layout.h (enum Output_section_order): Define.
6737 (class Layout): Update declarations.
6738 * layout.cc (Layout::get_output_section): Add order parameter.
6739 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6740 is_first_non_relro parameters. Change all callers.
6741 (Layout::choose_output_section): Likewise.
6742 (Layout::add_output_section_data): Likewise.
6743 (Layout::make_output_section): Likewise. Set order.
6744 (Layout::default_section_order): New function.
6745 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6746 * output.cc (Output_section::Output_section): Initialize order_.
6747 Don't initialize deleted fields.
6748 (Output_segment::Output_segment): Don't initialize deleted
6749 fields.
6750 (Output_segment::add_output_section_to_load): New function
6751 replacing add_output_section. Change all callers to call this or
6752 add_output_section_to_nonload.
6753 (Output_segment::add_output_section_to_nonload): New function.
6754 (Output_segment::remove_output_section): Rewrite.
6755 (Output_segment::add_initial_output_data): Likewise.
6756 (Output_segment::has_any_data_sections): Likewise.
6757 (Output_segment::is_first_section_relro): Likewise.
6758 (Output_segment::maximum_alignment): Likewise.
6759 (Output_segment::has_dynamic_reloc): New function replacing
6760 dynamic_reloc_count. Change all callers.
6761 (Output_segment::has_dynamic_reloc_list): New function replacing
6762 dynamic_reloc_count_list. Change all callers.
6763 (Output_segment::set_section_addresses): Rewrite.
6764 (Output_segment::set_offset): Rewrite.
6765 (Output_segment::find_first_and_last_list): Remove.
6766 (Output_segment::set_tls_offsets): Rewrite.
6767 (Output_segment::first_section_load_address): Likewise.
6768 (Output_segment::output_section_count): Likewise.
6769 (Output_segment::section_with_lowest_load_address): Likewise.
6770 (Output_segment::write_section_headers): Likewise.
6771 (Output_segment::print_sections_to_map): Likewise.
6772 * output.h (class Output_data): Remove dynamic_reloc_count_
6773 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
6774 (Output_data::add_dynamic_reloc): Rewrite.
6775 (Output_data::has_dynamic_reloc): New function.
6776 (Output_data::dynamic_reloc_count): Remove.
6777 (class Output_section): Add order_ field. Remvoe is_relro_local_,
6778 is_last_relro_, is_first_non_relro_, is_interp_,
6779 is_dynamic_linker_section_ fields. Add order and set_order
6780 functions. Remove is_relro_local, set_is_relro_local,
6781 is_last_relro, set_is_last_relro, is_first_non_relro,
6782 set_is_first_non_relro functions, is_interp, set_is_interp,
6783 is_dynamic_linker_section, and set_is_dynamic_linker_section
6784 functions.
6785 (class Output_segment): Change Output_data_list from std::list to
6786 std:;vector. Add output_lists_ field. Remove output_data_ and
6787 output_bss_ fields. Update declarations.
6788
6789 2010-08-02 Ian Lance Taylor <iant@google.com>
6790
6791 * arm.cc (Target_arm::gc_process_relocs): Use typename.
6792 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6793 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6794
6795 2010-08-02 Ian Lance Taylor <iant@google.com>
6796
6797 PR 11855
6798 * script.cc (Script_options::Script_options): Initialize
6799 symbol_definitions_ and symbol_references_.
6800 (Script_options::add_symbol_assignment): Update
6801 symbol_definitions_ and symbol_references_.
6802 (Script_options::add_symbol_reference): New function.
6803 (script_symbol): New function.
6804 * script.h (class Script_options): Add symbol_definitions_ and
6805 symbol_references_ fields.
6806 (Script_options::referenced_const_iterator): New type.
6807 (Script_options::referenced_begin): New function.
6808 (Script_options::referenced_end): New function.
6809 (Script_options::is_referenced): New function.
6810 (Script_options::any_unreferenced): New function.
6811 * script-c.h (script_symbol): Declare.
6812 * yyscript.y (exp): Call script_symbol.
6813 * symtab.cc: Include "script.h".
6814 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6815 Change all callers. Check symbols referenced by scripts.
6816 (Symbol_table::add_undefined_symbols_from_command_line): Add
6817 layout parameter. Change all callers.
6818 (Symbol_table::do_add_undefined_symbols_from_command_line):
6819 Likewise. Break out loop body. Check symbols referenced by
6820 scripts.
6821 (Symbol_table::add_undefined_symbol_from_command_line): New
6822 function broken out of
6823 do_add_undefined_symbols_from_command_line.
6824 * symtab.h (class Symbol_table): Update declarations.
6825 * archive.cc: Include "layout.h".
6826 (Archive::should_include_member): Add layout parameter. Change
6827 all callers. Check for symbol mentioned in expression.
6828 * archive.h (class Archive): Update declaration.
6829 * object.cc (Sized_relobj::do_should_include_member): Add layout
6830 parameter.
6831 * object.h (Object::should_include_member): Add layout parameter.
6832 Change all callers.
6833 (Object::do_should_include_member): Add layout parameter.
6834 (class Sized_relobj): Update declaration.
6835 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6836 parameter.
6837 * dynobj.h (class Sized_dynobj): Update declaration.
6838 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6839 layout parameter.
6840 * plugin.h (class Sized_pluginobj): Update declaration.
6841
6842 2010-08-02 Ian Lance Taylor <iant@google.com>
6843
6844 PR 11866
6845 * output.cc (Output_segment::set_offset): Search for the first and
6846 last sections rather than assuming that the list is in order.
6847 (Output_segment::find_first_and_last_list): New function.
6848 * output.h (class Output_segment): Update declarations.
6849 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6850 (relro_strip_test_SOURCES): New variable.
6851 (relro_strip_test_DEPENDENCIES): New variable.
6852 (relro_strip_test_LDFLAGS): New variable.
6853 (relro_strip_test_LDADD): New variable.
6854 (relro_strip_test.so): New target.
6855
6856 2010-08-02 Ian Lance Taylor <iant@google.com>
6857
6858 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6859 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6860 (Target_i386::got_tlsdesc_section): New function.
6861 (Target_i386::got_section): Create space for GOT entries for
6862 TLSDESC relocations.
6863 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6864 R_386_TLS_GOTDESC.
6865 (Target_i386::Scan::global): Likewise.
6866 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6867 using TLSDESC GOT.
6868 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6869 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6870 (Target_x86_64::got_tlsdesc_section): New function.
6871 (Target_x86_64::got_section): Create space for GOT entries for
6872 TLSDESC relocations.
6873 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6874 R_386_TLS_GOTDESC.
6875 (Target_x86_64::Scan::global): Likewise.
6876 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6877 using TLSDESC GOT.
6878
6879 2010-08-02 Ian Lance Taylor <iant@google.com>
6880
6881 * testsuite/final_layout.sh: Use dc to convert from hex to
6882 decimal.
6883
6884 2010-07-29 Sriraman Tallam <tmsriram@google.com>
6885
6886 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6887 paramter to the call to gold::gc_process_relocs.
6888 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6889 paramter to the call to gold::gc_process_relocs.
6890 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6891 parameter to the call to gold::gc_process_relocs.
6892 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6893 template parameter to the call to gold::gc_process_relocs.
6894 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6895 paramter to the call to gold::gc_process_relocs.
6896 * gc.h (get_embedded_addend_size): New function.
6897 (gc_process_relocs): Save the size of the reloc for use by ICF.
6898 * icf.cc (get_section_contents): Get the addend from the text section
6899 for SHT_REL relocation sections.
6900 * icf.h (Icf::Reloc_addend_size_info): New typedef.
6901 (Icf::Reloc_info): Add new member reloc_addend_size_info.
6902 * int_encoding.h (read_from_pointer): New overloaded function.
6903 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6904 * testsuite/icf_sht_rel_addend_test.sh: New file.
6905 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6906 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6907
6908 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6909
6910 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6911 * Makefile.in: Regenerate.
6912 * testsuite/Makefile.in: Regenerate.
6913
6914 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
6915
6916 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6917 * gold/testsuite/debug_msg.cc: Likewise.
6918 * gold/testsuite/odr_violation1.cc
6919 * gold/testsuite/odr_violation2.cc
6920
6921 2010-07-21 Cary Coutant <ccoutant@google.com>
6922
6923 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6924 string, and length fields.
6925 (Output_merge_string::Merged_strings_list): New type.
6926 (Output_merge_string::Merged_strings_lists): New typedef.
6927 (Output_merge_string): Replace merged_strings_ with
6928 merged_strings_lists_.
6929 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6930 Merged_strings_list per input object and section. Don't store pointer
6931 to the string. Don't store length with each merged string entry.
6932 (Output_merge_string::finalize_merged_data): Loop over list of merged
6933 strings lists. Recompute length of each merged string.
6934
6935 2010-07-15 Cary Coutant <ccoutant@google.com>
6936
6937 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6938 here.
6939
6940 2010-07-14 Ian Lance Taylor <iant@google.com>
6941
6942 * descriptors.cc (Descriptors::open): Report correct name in error
6943 message.
6944
6945 2010-07-13 Doug Kwan <dougkwan@google.com>
6946
6947 * arm.cc (Arm_input_section::Arm_input_section): For a
6948 SHT_ARM_EXIDX section, always keeps the input sections.
6949 (Arm_input_section::set_exidx_section_link): New method.
6950 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6951 has_errors_ to false.
6952 (Arm_exidx_input_section::has_errors,
6953 Arm_exidx_input_section::set_has_errors): New methods.
6954 (Arm_exidx_input_section::has_errors_): New data member.
6955 (Arm_relobj::get_exidx_shndx_list): New method.
6956 (Arm_output_section::append_text_sections_to_list): Do not skip
6957 section without SHF_EXECINSTR.
6958 (Arm_output_section::fix_exidx_coverage): Skip input sections with
6959 errors.
6960 (Arm_relobj::make_exidx_input_section): Add new parameter for text
6961 section header. Make error messages more verbose. Check for
6962 a non-executable section linked to an EXIDX section.
6963 (Arm_relobj::do_read_symbols): Remove error checking, which has been
6964 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
6965 check that there is no deferred EXIDX section if we exit early.
6966 Instead of not making an EXIDX section in case of an error, make one
6967 and set the has_errors flag of it.
6968 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6969 in a relocatable link.
6970 (Target_arm::do_relax): Look for the EXIDX output section instead of
6971 assuming that it is called .ARM.exidx.
6972 (Target_arm::fix_exidx_coverage): Add a new parameter for input
6973 section list. Do not check for SHF_EXECINSTR section flags but
6974 skip any input section with errors.
6975 * output.cc (Output_section::Output_section): Initialize
6976 always_keeps_input_sections_ to false.
6977 (Output_section::add_input_section): Check for
6978 always_keeps_input_sections_.
6979 * output.h (Output_section::always_keeps_input_sections,
6980 Output_section::set_always_keeps_input_sections): New methods.
6981 (Output_section::always_keeps_input_sections): New data member.
6982
6983 2010-07-13 Rafael Espindola <espindola@google.com>
6984
6985 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6986 * fileread.h (Input_file): Add try_extra_search_path and find_file.
6987
6988 2010-07-13 Philip Herron <herron.philip@googlemail.com>
6989 Ian Lance Taylor <iant@google.com>
6990
6991 * output.h (Output_section_lookup_maps::add_merge_section):
6992 Correct check of whether value was inserted.
6993 (Output_section_lookup_maps::add_merge_input_section): Likewise.
6994 (Output_section_lookup_maps::add_relaxed_input_section):
6995 Likewise.
6996 * arm.cc (Target_arm::got_section): Remove used local os.
6997 * i386.cc (Target_i386::got_section): Likewise.
6998 * x86_64.cc (Target_x86_64::got_section): Likewise.
6999 * sparc.cc (Target_sparc::got_section): Likewise.
7000 (Target_sparc::relocate): Remove unused local have_got_offset.
7001 * powerpc.cc (Target_powerpc::relocate): Likewise.
7002
7003 2010-07-13 Ian Lance Taylor <iant@google.com>
7004
7005 * compressed_output.cc (zlib_decompress): Fix signature in
7006 !HAVE_ZLIB_H case.
7007
7008 * archive.cc (Archive::include_member): Unlock an external member
7009 of a thin archive. Don't bother to delete an object we know is
7010 NULL.
7011
7012 2010-07-12 Cary Coutant <ccoutant@google.com>
7013
7014 * compressed_output.cc (zlib_decompress): New function.
7015 (get_uncompressed_size): New function.
7016 (decompress_input_section): New function.
7017 * compressed_output.h (get_uncompressed_size): New function.
7018 (decompress_input_section): New function.
7019 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7020 Handle compressed debug sections.
7021 * layout.cc (is_compressed_debug_section): New function.
7022 (Layout::output_section_name): Map compressed section names to
7023 canonical names.
7024 * layout.h (is_compressed_debug_section): New function.
7025 (is_debug_info_section): Recognize compressed debug sections.
7026 * merge.cc: Include compressed_output.h.
7027 (Output_merge_data::do_add_input_section): Handle compressed
7028 debug sections.
7029 (Output_merge_string::do_add_input_section): Handle compressed
7030 debug sections.
7031 * object.cc: Include compressed_output.h.
7032 (Sized_relobj::Sized_relobj): Initialize new data members.
7033 (build_compressed_section_map): New function.
7034 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7035 * object.h (Object::section_is_compressed): New method.
7036 (Object::do_section_is_compressed): New method.
7037 (Sized_relobj::Compressed_section_map): New type.
7038 (Sized_relobj::do_section_is_compressed): New method.
7039 (Sized_relobj::compressed_sections_): New data member.
7040 * output.cc (Output_section::add_input_section): Handle compressed
7041 debug sections.
7042 * reloc.cc: Include compressed_output.h.
7043 (Sized_relobj::write_sections): Handle compressed debug sections.
7044
7045 2010-07-08 Cary Coutant <ccoutant@google.com>
7046
7047 * resolve.cc (Symbol_table::resolve): Remember whether undef was
7048 weak when resolving to a dynamic def.
7049 (Symbol_table::should_override): Add adjust_dyndef flag; set it
7050 for weak undef/dynamic def cases. Adjust callers.
7051 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7052 undef_binding_weak_.
7053 (Symbol_table::sized_write_globals): Adjust symbol binding.
7054 (Symbol_table::sized_write_symbol): Add binding parameter.
7055 * symtab.h (Symbol::set_undef_binding): New method.
7056 (Symbol::is_undef_binding_weak): New method.
7057 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7058 (Symbol_table::should_override): Add new parameter.
7059 (Symbol_table::sized_write_symbol): Add new parameter.
7060
7061 * testsuite/weak_undef_file1.cc: Add new test case.
7062 * testsuite/weak_undef_file2.cc: Fix header comment.
7063 * testsuite/weak_undef_test.cc: Add new test case.
7064
7065 2010-06-29 Doug Kwan <dougkwan@google.com>
7066
7067 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7068 Initialize USE_SYMBOL_.
7069 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7070 definition.
7071 (Arm_reloc_property::uses_symbol_): New data member declaration.
7072 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7073 uses symbol value and symbol is undefined but not weakly undefined.
7074
7075 2010-06-28 Rafael Espindola <espindola@google.com>
7076
7077 * plugin.cc (Plugin::load): Use dlerror.
7078
7079 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
7080
7081 * symtab.cc (detect_odr_violations): When reporting an ODR
7082 violation, report an object where the symbol is defined.
7083
7084 2010-06-25 Doug Kwan <dougkwan@google.com>
7085
7086 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7087 (Target_arm::section_may_have_icf_unsafe_pointers): New method
7088 definition.
7089 (Target_arm::Scan::local_reloc_may_be_function_pointer,
7090 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7091 target hook to detect function points.
7092 (Target_arm::Scan::possible_function_pointer_reloc): New method.
7093 * icf.h (Icf::check_section_for_function_pointers): Change type of
7094 parameter SECTION_NAME to const reference to std::string. Use
7095 target hook to determine if section may have unsafe pointers.
7096 * target.h (Target::section_may_have_icf_unsafe_pointers): New
7097 method definition.
7098
7099 2010-06-21 Rafael Espindola <espindola@google.com>
7100
7101 * fileread.cc (Input_file::find_fie): New
7102 (Input_file::open): Use Input_file::find_fie.
7103 * fileread.h (Input_file::find_fie): New
7104 * plugin.cc (set_extra_library_path): New.
7105 (Plugin::load): Add set_extra_library_path to the transfer vector.
7106 (Plugin_manager::set_extra_library_path): New.
7107 (Plugin_manager::add_input_file): Use the extra search path if set.
7108 (set_extra_library_path(): New.
7109 * plugin.h (Plugin_manager): Add set_extra_library_path and
7110 extra_search_path_.
7111
7112 2010-06-19 Cary Coutant <ccoutant@google.com>
7113
7114 * layout.cc (gdb_sections): Add .debug_types.
7115 (lines_only_debug_sections): Likewise.
7116
7117 2010-06-18 Rafael Espindola <espindola@google.com>
7118
7119 * plugin.cc (add_input_file,add_input_library)
7120 (Plugin_manager::add_input_file): Make filename arguments const.
7121 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7122 const.
7123
7124 2010-06-16 Doug Kwan <dougkwan@google.com>
7125
7126 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7127 .ARM.attributes section if we have not merged any input
7128 attributes sections.
7129
7130 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7131
7132 * arm.cc: Allow combining objects with no EABI version
7133 information.
7134
7135 2010-06-15 Rafael Espindola <espindola@google.com>
7136
7137 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7138
7139 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7140
7141 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7142 (struct iovec): Correct !HAVE_READV definition.
7143
7144 2010-06-10 Cary Coutant <ccoutant@google.com>
7145
7146 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7147 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7148 reloc sections.
7149 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7150
7151 PR 11683
7152 * symtab.h (Symbol::is_placeholder): New member function.
7153 * target-reloc.h (relocate_section): Check for placeholder symbols.
7154
7155 * testsuite/Makefile.am (plugin_test_8): New test.
7156 (plugin_test_9): New test.
7157 * testsuite/Makefile.in: Regenerate.
7158
7159 2010-06-09 Nick Clifton <nickc@redhat.com>
7160
7161 * yyscript.y (input_list_element): Allow strings prefixed with
7162 the '-' character. Treat these as libraries.
7163 * script.cc (script_add_library): New function. Adds a library
7164 specified by "-l<name>" found in an input script.
7165 * script-c.h: Add prototype for script_add_library.
7166
7167 2010-06-07 Doug Kwan <dougkwan@google.com>
7168
7169 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7170 Restrict stub-group size to be within long conditional branch
7171 range when working around cortex-A8 erratum.
7172
7173 2010-06-07 Damien Diederen <dd@crosstwine.com>
7174
7175 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7176 #ifdef typo.
7177
7178 2010-06-03 Sriraman Tallam <tmsriram@google.com>
7179
7180 PR gold/11658
7181 * output.cc
7182 (Output_section::Input_section_sort_entry::compare_section_ordering):
7183 Change to return non-zero correctly.
7184 (Output_section::Input_section_sort_section_order_index_compare
7185 ::operator()): Change to fix ambiguity in comparisons.
7186
7187 2010-06-01 Sriraman Tallam <tmsriram@google.com>
7188
7189 * gold.h (is_wildcard_string): New function.
7190 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7191 (Layout::layout_eh_frame): Ditto.
7192 (Layout::find_section_order_index): New method.
7193 (Layout::read_layout_from_file): New method.
7194 * layout.h (Layout::find_section_order_index): New method.
7195 (Layout::read_layout_from_file): New method.
7196 (Layout::input_section_position_): New private member.
7197 (Layout::input_section_glob_): New private member.
7198 * main.cc (main): Call read_layout_from_file here.
7199 * options.h (--section-ordering-file): New option.
7200 * output.cc (Output_section::input_section_order_specified_): New
7201 member.
7202 (Output_section::Output_section): Initialize new member.
7203 (Output_section::add_input_section): Add new parameter.
7204 Keep input sections when --section-ordering-file is used.
7205 (Output_section::set_final_data_size): Sort input sections when
7206 section ordering file is specified.
7207 (Output_section::Input_section_sort_entry): Add new parameter.
7208 Check sorting type.
7209 (Output_section::Input_section_sort_entry::compare_section_ordering):
7210 New method.
7211 (Output_section::Input_section_sort_compare::operator()): Change to
7212 consider section_order_index.
7213 (Output_section::Input_section_sort_init_fini_compare::operator()):
7214 Change to consider section_order_index.
7215 (Output_section::Input_section_sort_section_order_index_compare
7216 ::operator()): New method.
7217 (Output_section::sort_attached_input_sections): Change to sort
7218 according to section order when specified.
7219 (Output_section::add_input_section<32, true>): Add new parameter.
7220 (Output_section::add_input_section<64, true>): Add new parameter.
7221 (Output_section::add_input_section<32, false>): Add new parameter.
7222 (Output_section::add_input_section<64, false>): Add new parameter.
7223 * output.h (Output_section::add_input_section): Add new parameter.
7224 (Output_section::input_section_order_specified): New
7225 method.
7226 (Output_section::set_input_section_order_specified): New method.
7227 (Input_section::Input_section): Initialize section_order_index_.
7228 (Input_section::section_order_index): New method.
7229 (Input_section::set_section_order_index): New method.
7230 (Input_section::section_order_index_): New member.
7231 (Input_section::Input_section_sort_section_order_index_compare): New
7232 struct.
7233 (Output_section::input_section_order_specified_): New member.
7234 * script-sections.cc (is_wildcard_string): Delete and move modified
7235 method to gold.h.
7236 (Output_section_element_input::Output_section_element_input): Modify
7237 call to is_wildcard_string.
7238 (Output_section_element_input::Input_section_pattern
7239 ::Input_section_pattern): Ditto.
7240 (Output_section_element_input::Output_section_element_input): Ditto.
7241 * testsuite/Makefile.am (final_layout): New test case.
7242 * testsuite/Makefile.in: Regenerate.
7243 * testsuite/final_layout.cc: New file.
7244 * testsuite/final_layout.sh: New file.
7245
7246 2010-06-01 Rafael Espindola <espindola@google.com>
7247
7248 * plugin.cc (Plugin::load): Pass the output name to the plugin.
7249
7250 2010-06-01 Rafael Espindola <espindola@google.com>
7251
7252 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7253 visibility of symbols.
7254
7255 2010-05-27 Doug Kwan <dougkwan@google.com>
7256
7257 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7258 from start of output section instead of address for a local symbol
7259 in a merged or relaxed section when doing a relocatable link.
7260
7261 2010-05-26 Rafael Espindola <espindola@google.com>
7262
7263 PR 11604
7264 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7265 adding sections the garbage collector removed.
7266 * gold/testsuite/Makefile.am: Add test.
7267 * gold/testsuite/Makefile.in: Regenerate.
7268 * gold/testsuite/plugin_test_7.sh: New.
7269 * gold/testsuite/plugin_test_7_1.c: New.
7270 * gold/testsuite/plugin_test_7_2.c: New.
7271
7272 2010-05-26 Rafael Espindola <espindola@google.com>
7273
7274 * script-sections.cc (Output_section_definition::set_section_addresses):
7275 Check for --section-start.
7276
7277 2010-05-26 Doug Kwan <dougkwan@google.com>
7278
7279 * arm.cc (Arm_scan_relocatable_relocs): New class.
7280 (Target_arm::relocate_special_relocatable): New method.
7281 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7282 (Arm_relocate_functions::thumb_branch_common): Same.
7283 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7284 instead of Default_scan_relocatable_relocs.
7285 * target-reloc.h (relocate_for_relocatable): Let target handle
7286 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7287 * target.h (Sized_target::relocate_special_relocatable): New method.
7288
7289 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7290
7291 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7292
7293 2010-05-23 Doug Kwan <dougkwan@google.com>
7294
7295 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7296 instead of a cast.
7297 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7298 with a direct branch, not a conditional branch, to a stub.
7299 * merge.cc (Output_merge_base::record_input_section): New method
7300 defintion.
7301 (Output_merge_data::do_add_input_section): Record input section if
7302 keeps-input-sections flag is set.
7303 (Output_merge_string::do_add_input_section): Ditto.
7304 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7305 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7306 INPUT_SECTIONS_.
7307 (Output_merge_base::keeps_input_sections,
7308 Output_merge_base::set_keeps_input_sections,
7309 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7310 method definitions.
7311 (Output_merge_base::Input_sections): New type declaration.
7312 (Output_merge_base::input_sections_begin,
7313 Output_merge_base::input_sections_end,
7314 Output_merge_base::do_set_keeps_input_sections): New method definitions.
7315 (Output_merge_base::bool keeps_input_sections_,
7316 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7317 Output_merge_base::input_sections_): New data members.
7318 (Output_merge_data::do_set_keeps_input_sections): New method
7319 defintion.
7320 (Output_merge_string::do_set_keeps_input_sections): Ditto.
7321 * output.cc (Output_section::Input_section::relobj): Move method
7322 defintion from class declaration to here and handle merge sections.
7323 (Output_section::Input_section::shndx): Ditto.
7324 (Output_section::Output_section): Remove initializations of removed
7325 data members and initialize new data member LOOKUP_MAPS_.
7326 (Output_section::add_input_section): Set keeps-input-sections flag
7327 for a newly created merge output section as appropriate. Adjust code
7328 to use Output_section_lookup_maps class.
7329 (Output_section::add_relaxed_input_section): Adjst code for lookup
7330 maps code refactoring.
7331 (Output_section::add_merge_input_section): Add a new parameter
7332 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
7333 class. If adding input section to a newly created merge output
7334 section fails, remove the new merge section.
7335 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7336 Adjust code for use of the Output_section_lookup_maps class.
7337 (Output_section::find_merge_section): Ditto.
7338 (Output_section::build_lookup_maps): New method defintion.
7339 (Output_section::find_relaxed_input_section): Adjust code to use
7340 Output_section_lookup_maps class.
7341 (Output_section::get_input_sections): Export merge sections. Adjust
7342 code to use Output_section_lookup_maps class.
7343 (Output_section:::add_script_input_section): Adjust code to use
7344 Output_section_lookup_maps class. Update lookup maps for merge
7345 sections also.
7346 (Output_section::discard_states): Use Output_section_lookup_maps.
7347 (Output_section::restore_states): Same.
7348 * output.h (Merge_section_properties): Move class defintion out of
7349 Output_section.
7350 (Output_section_lookup_maps): New class.
7351 (Output_section::Input_section::is_merge_section): New method
7352 defintion.
7353 (Output_section::Input_section::relobj): Move defintion out of class
7354 defintion. Declare method only.
7355 (Output_section::Input_section::shndx): Ditto.
7356 (Output_section::Input_section::output_merge_base): New method defintion.
7357 (Output_section::Input_section::u2_.pomb): New union field.
7358 (Output_section::Merge_section_by_properties_map,
7359 Output_section::Output_section_data_by_input_section_map,
7360 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7361 Remove types.
7362 (Output_section::add_merge_input_section): Add new parameter
7363 KEEPS_INPUT_SECTIONS.
7364 (Output_section::build_lookup_maps): New method declaration.
7365 (Output_section::merge_section_map_,
7366 Output_section::merge_section_by_properties_map_,
7367 Output_section::relaxed_input_section_map_,
7368 Output_section::is_relaxed_input_section_map_valid_): Remove data
7369 members.
7370 (Output_section::lookup_maps_): New data member.
7371
7372 2010-05-21 Doug Kwan <dougkwan@google.com>
7373
7374 PR gold/11619
7375 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7376 avoid a compilation error.
7377
7378 2010-05-19 Rafael Espindola <espindola@google.com>
7379
7380 * script-sections.cc (Output_section_definition::allocate_to_segment):
7381 Update the phdrs_list even when the output section is NULL.
7382 * testsuite/Makefile.am: Add test.
7383 * testsuite/Makefile.in: Regenerate.
7384 * testsuite/script_test_9.cc: New.
7385 * testsuite/script_test_9.sh: New.
7386 * testsuite/script_test_9.t: New.
7387
7388 2010-05-19 Doug Kwan <dougkwan@google.com>
7389
7390 * arm.cc (Arm_input_section::original_size): New method.
7391 (Arm_input_section::do_addralign): Add a cast.
7392 (Arm_input_section::do_output_offset): Remove static cast.
7393 (Arm_input_section::original_addralign,
7394 Arm_input_section::original_size_): Change type to uint32_t.
7395 (Arm_input_section::init): Add safe casts for section alignment
7396 and size.
7397 (Arm_input_section::set_final_data_size): Do not set address and
7398 offset of stub table.
7399 (Arm_output_section::fix_exidx_coverage): Change use of of
7400 Output_section::Simple_input_section to that of
7401 Output_section::Input_section.
7402 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7403 except for the first pass.
7404 * output.cc (Output_section::get_input_sections): Change type of
7405 input_sections to std::list<Input_section>.
7406 (Output_section::add_script_input_section): Rename from
7407 Output_section::add_simple_input_section. Change type of SIS
7408 parameter from Simple_input_section to Input_section.
7409 * output.h (Output_section::Simple_input_section): Remove class.
7410 (Output_section::Input_section): Change class visibility to public.
7411 (Output_section::Input_section::addralign): Use stored alignments
7412 for special input sections if set.
7413 (Output_section::Input_section::set_addralign): New method.
7414 (Output_section::get_input_sections): Change parameter type from
7415 list of Simple_input_section to list of Input_section.
7416 (Output_section::add_script_input_section): Rename from
7417 Output_section::add_simple_input_section. Change first parameter's
7418 type from Simple_input_section to Input_section and remove the
7419 second and third parameters.
7420 * script-sections.cc (Input_section::Input_section_list): Change
7421 type to list of Output_section::Input_section/
7422 (Input_section_info::Input_section_info): Change parameter type of
7423 INPUT_SECTION to Output_section::Input_section.
7424 (Input_section_info::input_section): Change return type.
7425 (Input_section_info::input_section_): Change type to
7426 Output_section::Input_section.
7427 (Output_section_element_input::set_section_addresses): Adjust code
7428 to use Output_section::Input_section instead of
7429 Output_section::Simple_input_section. Adjust code for renaming
7430 of Output_section::add_simple_input_section.
7431 (Orphan_output_section::set_section_addresses): Ditto.
7432
7433 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7434
7435 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7436 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7437
7438 2010-05-18 Rafael Espindola <espindola@google.com>
7439
7440 * options.cc (General_options::finalize): Handle -nostdlib.
7441 * options.h (nostdlib): New option.
7442 * script.cc (script_add_search_dir): Handle -nostdlib.
7443
7444 2010-05-12 Doug Kwan <dougkwan@google.com>
7445
7446 * arm.cc (Target_arm::do_finalize_sections): Create an empty
7447 attributes section only if there no attributes section after merging.
7448 (Target_arm::merge_object_attributes): Move value of
7449 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7450 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7451 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7452 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7453 and arm_attr_merge_7.stdout.
7454 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7455 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7456 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7457 arm_attr_merge_7b.o): New rules.
7458 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7459 arm_attr_merge_7
7460 * testsuite/Makefile.in: Regenerate.
7461 * testsuite/arm_attr_merge.sh: New file.
7462 * testsuite/arm_attr_merge_[67][ab].s: Same.
7463
7464 2010-05-05 Nick Clifton <nickc@redhat.com>
7465
7466 * po/es.po: Updated Spanish translation.
7467
7468 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
7469
7470 * Makefile.am (install-exec-local): Properly install gold as
7471 default cross linker.
7472 * Makefile.in: Regenerated.
7473
7474 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
7475 Nick Clifton <nickc@redhat.com>
7476
7477 * configure.ac (install_as_default): Define and set to false
7478 unless --enable-gold or --enable-gold=both/gold has been
7479 specified.
7480 * configure: Regenerate.
7481
7482 * Makefile.am (install-exec-local): Install the executable as
7483 'ld.gold'. If install_as_default is true then also install it as
7484 'ld'.
7485 * Makefile.in: Regenerated.
7486
7487 2010-04-24 Ian Lance Taylor <iant@google.com>
7488
7489 * layout.cc (Layout::layout_reloc): In relocatable link don't
7490 combine reloc sections for grouped sections.
7491
7492 2010-04-23 Sriraman Tallam <tmsriram@google.com>
7493
7494 * gc.h (gc_process_relocs): Pass information on relocs pointing to
7495 sections that are not ordinary to icf.
7496 * icf.cc (get_section_contents): Handle relocation pointing to section
7497 with no object or shndx information.
7498 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7499 * testsuite/Makefile.in: Regenerate.
7500 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7501 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7502
7503 2010-04-22 Ian Lance Taylor <iant@google.com>
7504
7505 * expression.cc (Expression::Expression_eval_info): Add
7506 result_alignment_pointer field.
7507 (Expression::eval_with_dot): Add result_alignment_pointer
7508 parameter. Change all callers.
7509 (Expression::eval_maybe_dot): Likewise.
7510 (class Binary_expression): Add alignment_pointer parameter to
7511 left_value and right_value. Change all callers.
7512 (BINARY_EXPRESSION): Set result alignment.
7513 (class Trinary_expression): Add alignment_pointer parameter to
7514 arg2_value and arg3_value. Change all callers.
7515 (Trinary_cond::value): Set result alignment.
7516 (Max_expression::value, Min_expression::value): Likewise.
7517 (Align_expression::value): Likewise.
7518 * script-sections.cc (class Sections_element): Add dot_alignment
7519 parameter to set_section_addresses virtual function. Update
7520 instantiations.
7521 (class Output_section_element): Likewise.
7522 (Script_sections::create_segments): Add dot_alignment parameter.
7523 Change all callers.
7524 (Script_sections::create_segments_from_phdrs_clause): Likewise.
7525 (Script_sections::set_phdrs_clause_addresses): Likewise.
7526 * script-sections.h: Update declarations.
7527 * script.h: Update declarations.
7528 * output.h (Output_segment::set_minimum_p_align): Don't decrease
7529 min_p_align.
7530 * testsuite/script_test_3.t: Set large alignment.
7531 * testsuite/script_test_3.sh: Make sure that at least one LOAD
7532 segment has expected alignment.
7533
7534 2010-04-22 Nick Clifton <nickc@redhat.com>
7535
7536 * po/gold.pot: Updated by the Translation project.
7537 * po/vi.po: Updated Vietnamese translation.
7538
7539 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
7540
7541 * testsuite/Makefile.am (check_PROGRAMS): Add
7542 icf_virtual_function_folding_test.
7543 * testsuite/Makefile.in: Regenerated.
7544
7545 2010-04-15 Andrew Haley <aph@redhat.com>
7546
7547 * options.h (merge_exidx_entries): New option.
7548 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7549 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7550 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7551 (Target_arm::merge_exidx_entries): New function.
7552 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7553 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7554 to Arm_exidx_fixup constructor.
7555 Add new arg, merge_exidx_entries.
7556 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7557 Arm_output_section::fix_exidx_coverage.
7558
7559 2010-04-18 Sriraman Tallam <tmsriram@google.com>
7560
7561 * icf.cc (get_section_contents): Check for preemptible functions.
7562 Ignore addend when appropriate.
7563 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
7564 section folded.
7565 (add_from_relobj): Check for section folded.
7566 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7567 * symtab.h (should_add_dynsym_entry): Add new parameter.
7568 * target-reloc.h (scan_relocs): Check for section folded.
7569 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7570 Check reloc types for function pointers in shared objects.
7571 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7572 case.
7573 (icf_preemptible_functions_test): New test case.
7574 (icf_string_merge_test): New test case.
7575 * testsuite.Makefile.in: Regenerate.
7576 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7577 bar_glob. Refactor code.
7578 * testsuite/icf_preemptible_functions_test.cc: New file.
7579 * testsuite/icf_preemptible_functions_test.sh: New file.
7580 * testsuite/icf_string_merge_test.cc: New file.
7581 * testsuite/icf_string_merge_test.sh: New file.
7582 * testsuite/icf_virtual_function_folding_test.cc: New file.
7583 * testsuite/icf_virtual_function_folding_test.sh: New file.
7584
7585 2010-04-14 Doug Kwan <dougkwan@google.com>
7586
7587 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7588 for local symbol recounting if we remove a section due to ICF.
7589 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7590 there are no regular objects in input.
7591
7592 2010-04-13 Doug Kwan <dougkwan@google.com>
7593
7594 * arm.cc (Arm_input_section::set_final_data_size): Compute
7595 accurate final data size instead of using current data size.
7596
7597 2010-04-09 Doug Kwan <dougkwan@google.com>
7598
7599 * layout.cc (Layout::choose_output_section): Handle script section
7600 types.
7601 (Layout::make_output_section_for_script): Add section type parameter.
7602 Handle script section types.
7603 * layout.h (Layout::make_output_section_for_script): Add section
7604 type parameter.
7605 * output.cc (Output_section::Output_section): Initialize data member
7606 is_noload_.
7607 (Output_section::do_reset_address_and_file_offset): Do not set address
7608 to 0 if section is a NOLOAD section.
7609 * output.h (Output_section::is_noload): New method.
7610 (Output_section::set_is_noload): Ditto.
7611 (Output_section::is_noload_): New data member.
7612 * script-c.h (Script_section_type): New enum type.
7613 (struct Parser_output_section_header): Add new file section_type.
7614 * script-sections.cc (Sections_element::output_section_name): Add
7615 parameter for returning script section type.
7616 (Output_section_definition::output_section_name): Ditto.
7617 (Output_section_definition::section_type)P; New method.
7618 (Output_section_definiton::script_section_type_name): Ditto.
7619 (Output_section_definition::script_section_type_): New data member.
7620 (Output_section_definition::Output_section_definition): Initialize
7621 data member Output_section_definition::script_section_type_.
7622 (Output_section_definition::create_sections): Pass script section type
7623 to Layout::make_output_section_for_script.
7624 (Output_section_definition::output_section_name): Return script
7625 section type to caller.
7626 (Output_section_definition::set_section_address): Do not advance
7627 dot value and load address if section type is NOLOAD. Set address
7628 of NOLOAD sections regardless of section flags.
7629 (Output_section_definition::print): Print section type if it is
7630 not SCRIPT_SECTION_TYPE_NONE.
7631 (Output_section_definition::section_type): New method.
7632 (Output_section_definition::script_section_type_name): Ditto.
7633 (Script_sections::output_section_name): Add new parameter
7634 PSECTION_TYPE for returning script section type. Pass it to
7635 section elements. Handle discard sections.
7636 (Sort_output_sections::operator()): Handle NOLOAD sections.
7637 * script-sections.h (Script_sections::Section_type): New enum type.
7638 (Script_sections::output_section_name): Add a new parameter for
7639 returning script section type.
7640 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7641 INFO and NOLOAD.
7642 * yyscript.y (union): Add new field SECTION_TYPE.
7643 (COPY, DSECT, INFO, NOLOAD): New tokens.
7644 (opt_address_and_section_type): Change type to output_section_header.
7645 (section_type): New non-terminal
7646 (section_header): Handle section type.
7647 (opt_address_and_section_type): Return section type value.
7648
7649 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
7650
7651 * testsuite/plugin_common_test_1.c (foo): Add prototype.
7652 * testsuite/plugin_common_test_2.c (foo): Likewise.
7653
7654 2010-04-08 Doug Kwan <dougkwan@google.com>
7655
7656 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7657 Output_merge_data.
7658 * output.cc (Output_section::add_merge_input_section): Simplify
7659 code and return status of Output_merge_base::add_input_section.
7660 Update merge section map only if Output_merge_base::add_input_section
7661 returns true.
7662
7663 2010-04-07 Doug Kwan <dougkwan@google.com>
7664
7665 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7666 if section is marked as containing instructions but has no mapping
7667 symbols.
7668 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7669 correct section index.
7670 (Arm_relobj::find_linked_text_section): Ditto.
7671
7672 2010-04-07 Cary Coutant <ccoutant@google.com>
7673
7674 * archive.cc (include_member): Destroy Read_symbols_data object before
7675 releasing file.
7676 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7677 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7678 (Read_symbols_data::~Read_symbols_data) New destructor.
7679 (Section_relocs::Section_relocs) New constructor.
7680 (Section_relocs::~Section_relocs) New destructor.
7681 (Read_relocs_data::Read_relocs_data) New constructor.
7682 (Read_relocs_data::~Read_relocs_data) New destructor.
7683 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7684 pointers to NULL after deleting.
7685
7686 2010-04-07 Doug Kwan <dougkwan@google.com>
7687
7688 * arm.cc: Replace "endianity" with "endianness" in comments.
7689 (Arm_exidx_cantunwind): Ditto.
7690 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7691 (Arm_relobj::merge_flags_and_attributes): New method.
7692 (Arm_relobj::merge_flags_and_attributes_): New data member.
7693 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7694 (Arm_relobj::scan_sections_for_stubs): Ditto.
7695 (Arm_relobj::do_read_symbols): Check to see if we really want to
7696 merge processor-specific flags and attributes. Exit early if
7697 an object is empty except for section names and the undefined symbol.
7698 (Target_arm::do_finalize_sections): Move check for ELF format to
7699 Arm_relobj::do_read_symbols. Merge processor specific flags and
7700 attributes from a regular object only when we have determined that
7701 it is aapropriate. Do not create an .ARM.attributes section in
7702 output if there is no regular input object.
7703 (Target_arm::merge_processor_specific_flags): Check
7704 --warn-mismatch before printing any error.
7705 (Target_arm::merge_object_attributes): Ditto.
7706 * gold.cc (queue_middle_tasks): Handle the case in which there is
7707 no regular object in input.
7708 * options.cc (General_options::parse_EB): New method.
7709 (General_options::parse_EL): Same.
7710 (General_options::General_options): Initialize endianness_.
7711 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7712 New options.
7713 (General_options::Endianness): New enum.
7714 (General_options::endianness): New method.
7715 (General_options::endianness_): New data member.
7716 * parameters.cc (Parameters::set_options): Check target endianness.
7717 (Parameters::set_target_once): Ditto.
7718 (Parameters::check_target_endianness): New method.
7719 (parameters_force_valid_target): If either -EL or -EB is specified,
7720 use it to define endianness of default target.
7721 * parameters.h (Parameters::check_target_endianness): New method
7722 declaration.
7723 * target.h (class Target): Change "endianity" to "endianness"
7724 in comments.
7725
7726 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7727
7728 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7729 * configure: Regenerate.
7730 * Makefile.in: Regenerate.
7731 * testsuite/Makefile.in: Regenerate.
7732
7733 2010-04-06 Cary Coutant <ccoutant@google.com>
7734
7735 gcc PR lto/42757
7736 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7737 prevailing definitions of common symbols.
7738 * testsuite/plugin_test_6.sh: New test case.
7739 * testsuite/plugin_common_test_1.c: New test case.
7740 * testsuite/plugin_common_test_2.c: New test case.
7741 * testsuite/Makefile.am (plugin_test_6): New test case.
7742 * testsuite/Makefile.in: Regenerate.
7743
7744 2010-04-06 Nick Clifton <nickc@redhat.com>
7745
7746 * po/vi.po: New Vietnamese translation.
7747
7748 2010-03-30 Doug Kwan <dougkwan@google.com>
7749
7750 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7751
7752 2010-03-25 Doug Kwan <dougkwan@google.com>
7753
7754 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7755 to avoid a conversion warning on a 32-bit host.
7756
7757 2010-03-24 Ian Lance Taylor <iant@google.com>
7758
7759 * testsuite/script_test_3.t: Add a TLS segment.
7760 * testsuite/Makefile.am (check_PROGRAMS): Add
7761 tls_phdrs_script_test.
7762 (tls_phdrs_script_test_SOURCES): Define.
7763 (tls_phdrs_script_test_DEPENDENCIES): Define.
7764 (tls_phdrs_script_test_LDFLAGS): Define.
7765 (tls_phdrs_script_test_LDADD): Define.
7766 * testsuite/Makefile.in: Rebuild.
7767
7768 2010-03-23 Cary Coutant <ccoutant@google.com>
7769
7770 * fileread.cc (find_or_make_view): Fix comment.
7771
7772 2010-03-23 Ian Lance Taylor <iant@google.com>
7773
7774 * script-sections.cc (class Orphan_section_placement): Define
7775 PLACE_TLS and PLACE_TLS_BSS.
7776 (Orphan_section_placement::Orphan_section_placement): Initialize
7777 new places.
7778 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7779 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7780 (tls_script_test_SOURCES): Define.
7781 (tls_script_test_DEPENDENCIES): Define.
7782 (tls_script_test_LDFLAGS): Define.
7783 (tls_script_test_LDADD): Define.
7784 * testsuite/Makefile.in: Rebuild.
7785
7786 2010-03-22 Doug Kwan <dougkwan@google.com>
7787
7788 * arm.cc (Arm_relocate_functions::abs8,
7789 Arm_relocate_functions::abs16): Use correct check for overflow
7790 specified in the ARM ELF specs.
7791 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
7792 target of a BLX instruction specially.
7793 (Reloc_stub::stub_type_for_reloc): Ditto.
7794 (Relocate::relocate): Use symbolic names instead of numeric relocation
7795 codes to report error.
7796 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7797 workaround.
7798 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7799 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7800 thumb2_blx_out_of_range.stdout
7801 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7802 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7803 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7804 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7805 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7806 thumb2_blx_in_range, thumb2_blx_in_range.o,
7807 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7808 thumb2_blx_out_of_range.o): New rules.
7809 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7810 thumb2_blx_in_range and thumb2_blx_out_of_range.
7811 * testsuite/Makefile.in: Regenerate.
7812 * arm_branch_in_range.sh: Add tests for THUMB BLX.
7813 * testsuite/thumb_blx_in_range.s: New file.
7814 * testsuite/thumb_blx_out_of_range.s: New file.
7815
7816 2010-03-22 Rafael Espindola <espindola@google.com>
7817
7818 * archive.cc (Should_include): Move to archive.h.
7819 (should_include_member): Make it a member of Archive.
7820 (Lib_group): New.
7821 (Add_lib_group_symbols): New.
7822 * archive.h: Include options.h.
7823 (Archive_member): Moved from Archive.
7824 (Should_include): Moved from archive.cc.
7825 (Lib_group): New.
7826 (Add_lib_group_symbols): New.
7827 * dynobj.cc (do_should_include_member): New.
7828 * dynobj.h (do_should_include_member): New.
7829 * gold.cc (queue_initial_tasks): Update call to queue.
7830 * main.cc (main): Print lib group stats.
7831 * object.cc (do_should_include_member): New.
7832 * object.h: Include archive.h.
7833 (Object::should_include_member): New.
7834 (Object::do_should_include_member): New.
7835 (Sized_relobj::do_should_include_member): New.
7836 * options.cc (General_options::parse_start_lib): New.
7837 (General_options::parse_end_lib): New.
7838 (Input_arguments::add_file): Handle lib groups.
7839 (Input_arguments::start_group): Check we are not in a lib.
7840 (Input_arguments::start_lib): New.
7841 (Input_arguments::end_lib): New.
7842 * options.h (General_options): Add start_lib and end_lib.
7843 (Input_argument::lib_): New.
7844 (Input_argument::lib): New.
7845 (Input_argument::is_lib): New.
7846 (Input_file_lib): New.
7847 (Input_arguments::in_lib_): New.
7848 (Input_arguments::in_lib): New.
7849 (Input_arguments::start_lib): New.
7850 (Input_arguments::end_lib_): New.
7851 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7852 in unused members as preempted.
7853 (Sized_pluginobj::do_should_include_member): New.
7854 * plugin.h (Sized_pluginobj::do_should_include_member): New.
7855 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7856 return the blocker.
7857 (Read_symbols::do_whole_lib_group): New.
7858 (Read_symbols::do_lib_group): New.
7859 (Read_symbols::do_read_symbols): Handle lib groups.
7860 (Read_symbols::get_name): Handle lib groups.
7861 * readsyms.h (Read_symbols): Add an archive member pointer.
7862 (Read_symbols::do_whole_lib_group): New.
7863 (Read_symbols::do_lib_group): New.
7864 (Read_symbols::member_): New.
7865 * script.cc (read_input_script): Update call to queue_soon.
7866
7867 2010-03-19 Doug Kwan <dougkwan@google.com>
7868
7869 * arm.cc (Stub_table::Stub_table): Initialize new data members
7870 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7871 (Stub_table::add_reloc_stub): Assign stub offset and update
7872 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7873 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7874 New data members.
7875 (Stub_table::update_data_size_and_addralign): Use
7876 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7877 instead of going over all reloc stubs.
7878 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7879 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7880 Stringpool_template::offset_ to size of Stringpool_char.
7881 (Stringpool_template::new_key_offset): Remove code to initialize
7882 Stringpool_template::offset_.
7883 * stringpool.h (Stringpool_template::set_no_zero_null): Set
7884 Stringpool_template::offset_ to zero.
7885
7886 2010-03-15 Doug Kwan <dougkwan@google.com>
7887
7888 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7889 offset_.
7890 (Stringpool_template::new_key_offset): New method.
7891 (Stringpool_template::add_string): Assign offsets when adding new
7892 strings.
7893 (Stringpool_template::set_string_offsets): Do not set string offsets
7894 when not optimizing.
7895 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7896 member size_.
7897 (Chunked_vector::clear): Clear size_.
7898 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7899 (Chunked_vector::size): Return size_.
7900 (Chunked_vector::push_back): Use size_ to find insert position.
7901 (Chunked_vector::size_): New data member.
7902 (Stringpool_template::set_no_zero_null): Assert string set is empty.
7903 (Stringpool_template::new_key_offset): New method declaration.
7904 (Stringpool_template::offset_): New data member.
7905
7906 2010-03-15 Rafael Espindola <espindola@google.com>
7907
7908 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7909 Add_symbols' constructor.
7910 * readsyms.h (Add_symbols): Remove the input_group member.
7911
7912 2010-03-10 Ian Lance Taylor <iant@google.com>
7913
7914 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7915 target to ask whether a reference to a symbol requires a stack
7916 split.
7917 * target.h (Target::is_call_to_non_split): New function.
7918 (Target::do_is_call_to_non_split): Declare virtual function.
7919 * target.cc: Include "symtab.h".
7920 (Target::do_is_call_to_non_split): New function.
7921 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7922
7923 2010-03-10 Cary Coutant <ccoutant@google.com>
7924
7925 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7926 (File_read::open[1]): Remove initial mapping of whole_file_view_.
7927 (File_read::open[2]): Add whole_file_view_ to list of views.
7928 (File_read::make_view): Remove test of whole_file_view_.
7929 (File_read::find_or_make_view): Create whole_file_view_ if
7930 necessary.
7931 (File_read::clear_views): Replace bool parameter with enum;
7932 adjust all callers. Don't delete views with permanent data;
7933 do delete cached views and views from archives if
7934 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
7935 if clearing the corresponding view.
7936 * fileread.h (File_read::Clear_views_mode): New enum.
7937 (File_read::View::is_permanent_view): New method.
7938 (File_read::clear_views): Replace bool parameter
7939 with enum; adjust all callers.
7940 * options.h (General_options): Change keep_files_mapped option;
7941 add map_whole_files.
7942 * readsyms.cc (Add_symbols::run): Delete sd_ object before
7943 releasing the file.
7944 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7945 the file.
7946
7947 2010-03-10 David S. Miller <davem@davemloft.net>
7948
7949 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7950
7951 2010-03-09 Sriraman Tallam <tmsriram@google.com>
7952
7953 * icf.cc (get_section_contents): Add '@' marker after processing the
7954 merge reloc.
7955
7956 2010-03-08 Doug Kwan <dougkwan@google.com>
7957
7958 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7959 due to a conversion warning.
7960 (Arm_relobj::update_output_local_symbol_count): Check for local
7961 symbol with unset output index.
7962
7963 2010-03-05 Ian Lance Taylor <iant@google.com>
7964
7965 * options.h (class General_options): Add --spare-dynamic-tags.
7966 * output.cc (Output_data_dynamic::set_final_data_size): Implement
7967 --spare-dynamic-tags.
7968
7969 2010-03-05 Ian Lance Taylor <iant@google.com>
7970
7971 * incremental.cc: Include "libiberty.h".
7972
7973 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
7974
7975 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7976 function, is_info_ member.
7977 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7978 (Versions::Versions): Update caller.
7979 (Versions::define_base_version): Likewise.
7980 (Versions::add_def): Likewise.
7981
7982 2010-03-03 Sriraman Tallam <tmsriram@google.com>
7983
7984 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7985 (Scan::possible_function_pointer_reloc): New function.
7986 (Scan::local_reloc_may_be_function_pointer): Change to call
7987 possible_function_pointer_reloc.
7988 (Scan::global_reloc_may_be_function_pointer): Ditto.
7989 * icf.h (Icf::check_section_for_function_pointers): Change to reject
7990 relocations in ".data.rel.ro._ZTV" section.
7991 * testsuite/icf_safe_so_test.sh: Change to pass i386.
7992 * testsuite/icf_safe_so_test.cc: Ditto.
7993 * testsuite/icf_safe_test.cc: Ditto.
7994 * testsuite/icf_safe_test.sh: Ditto.
7995
7996 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7997 Ian Lance Taylor <iant@google.com>
7998
7999 * target-reloc.h (relocate_section): Check the symbol table index
8000 for -1U before setting the local symbol index.
8001 (scan_relocatable_relocs): If copying the relocation, record that
8002 the local symbol is required.
8003 * object.h (Symbol_value::is_output_symtab_index_set): New
8004 function.
8005 (Symbol_value::may_be_discarded_from_output_symtab): New
8006 function.
8007 (Symbol_value::has_output_symtab_entry): New function.
8008 (Symbol_value::needs_output_symtab_entry): Remove.
8009 (Symbol_value::output_symtab_index): Make sure the symbol index is
8010 set.
8011 (Symbol_value::set_output_symtab_index): Make sure the symbol
8012 index is not set. Make sure the new index is valid.
8013 (Symbol_value::set_must_have_output_symtab_entry): New function.
8014 (Symbol_value::has_output_dynsym_entry): New function.
8015 (Symbol_value::set_output_dynsym_index): Make sure the new index
8016 is valid.
8017 (Sized_relobj::set_must_have_output_symtab_entry): New function.
8018 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8019 local symbol if permitted.
8020 (Sized_relobj::do_finalize_local_symbols): Call
8021 is_output_symtab_index_set rather than needs_output_symtab_entry.
8022 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8023 rather than needs_output_symtab_entry. Call
8024 has_output_dynsym_entry rather than needs_output_dynsym_entry.
8025 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8026 is_output_symtab_index_set rather than needs_output_symtab_entry.
8027 * testsuite/discard_locals_relocatable_test.c: New file.
8028 * testsuite/discard_locals_test.sh: Test -r.
8029 * testsuite/Makefile.am (check_DATA): Add
8030 discard_locals_relocatable_test1.syms,
8031 discard_local_relocatable_test2.syms.
8032 (MOSTLYCLEANFILES): Likewise. Also add
8033 discard_locals_relocatable_test1.lout and
8034 discard_locals_relocatable_test2.out.
8035 (discard_locals_relocatable_test1.syms): New target.
8036 (discard_locals_relocatable_test.o): New target.
8037 (discard_locals_relocatable_test1.out): New target.
8038 (discard_locals_relocatable_test2.syms): New target.
8039 (discard_locals_relocatable_test2.out): New target.
8040 (various): Add missing ../ld-new dependencies.
8041 * testsuite/Makefile.in: Rebuild.
8042
8043 2010-03-03 Nick Clifton <nickc@redhat.com>
8044
8045 * po/fi.po: New Finnish translation.
8046
8047 2010-03-01 Doug Kwan <dougkwan@google.com>
8048
8049 * layout.cc (Layout::Layout): Force section types of .init_array*,
8050 .preinit_array* and .fini_array* sections.
8051 * output.cc (Output_section::Input_section_sort_entry::has_priority):
8052 Fix check of return value of std::string::find.().
8053 (Output_section::Input_section_sort_compare::operator()): Remove
8054 comment about .init_array.
8055 (Output_section::Input_section_sort_init_fini_compare::operator()):
8056 New method.
8057 (Output_section::sort_attached_input_sections): Handle .init_array
8058 and .fini_array specially.
8059 * output.h (Output_section::Inut_section_sort_compare): Update
8060 comment.
8061 (Output_section::Input_section_sort_init_fini_compare): New struct.
8062
8063 2010-02-26 Doug Kwan <dougkwan@google.com>
8064
8065 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8066 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8067 * testsuite/debug_msg.sh: Avoid matching source line number for
8068 use of global variable undef_int.
8069
8070 2010-02-26 Doug Kwan <dougkwan@google.com>
8071
8072 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8073 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8074 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8075 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8076 * options.cc (General_options::General_options): Initialize member
8077 fix_v4bx_.
8078 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8079 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8080 and rm_no_fix_v4bx.stdout
8081 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8082 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8083 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8084 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8085 and arm_no_fix_v4bx.
8086 * Makefile.in: Regenerate.
8087 * testsuite/arm_fix_v4bx.s: New file.
8088 * testsuite/arm_fix_v4bx.sh: Ditto.
8089
8090 2010-02-24 Doug Kwan <dougkwan@google.com>
8091
8092 * arm.cc (Target_arm::got_section): Make the .got section the first
8093 non RELRO section in the data segment.
8094 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8095 suffixes of section names.
8096
8097 2010-02-24 Doug Kwan <dougkwan@google.com>
8098
8099 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8100 flags and attributes merging if an input file is a binary file.
8101 * fileread.cc (Input_file::open): Record format of original file.
8102 * fileread.h (Input_file::Format): New enum type.
8103 (Input_file::Input_file): Initialize data member format_.
8104 (Input_file::format): New method definition.
8105 (Input_file::format_):: New data member.
8106
8107 2010-02-24 Doug Kwan <dougkwan@google.com>
8108
8109 * arm.cc (Arm_output_data_got): New class.
8110 (ARM_TCB_SIZE): New constant
8111 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8112 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8113 If user uses a script with a SECTIONS clause, issue only a warning
8114 for a misplaced EXIDX input section. Otherwise, issue an error.
8115 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8116 garbage collection.
8117 (Target_arm::got_mode_index_entry): Handle static linking.
8118 (Target_arm::Scan::local): Ditto.
8119 (Target_arm::Scan::global): Ditto.
8120 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
8121 all incorrectly implemented relocations.
8122 (Target_arm::fix_exidx_coverage): Pass layout to
8123 Arm_output_section::fix_exidx_coverage.
8124 * layout.cc (Layout::section_name_mapping): Remove trailing dots
8125 from ".ARM.exidx." and ".ARM.extab.".
8126
8127 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8128
8129 * arm.cc (Target_arm::do_finalize_sections): Create attribute
8130 section if it does not already exist.
8131 * attributes.cc (Attributes_section_data::Attributes_section_data):
8132 Don't crash if size is zero.
8133
8134 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8135 Ian Lance Taylor <iant@google.com>
8136
8137 * gold.cc (queue_middle_tasks): If no input files were opened,
8138 exit.
8139 * workqueue.h (Task_function::Task_function): Assert that there is
8140 a blocker.
8141
8142 2010-02-22 Doug Kwan <dougkwan@google.com>
8143
8144 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8145 * icf.cc (get_section_contents): Cast snprintf arguments to long long
8146 types to avoid warnings due to different uint64_t implementations
8147 on different hosts.
8148
8149 2010-02-21 Doug Kwan <dougkwan@google.com>
8150
8151 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8152 handling of the maximum backward branch offset.
8153 (Arm_relocate_functions::thumb_branch_common): Ditto.
8154 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8155 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8156 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8157 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8158 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8159 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8160 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8161 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8162 thumb_bl_out_of_range thumb_bl_out_of_range.o,
8163 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8164 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8165 thumb2_bl_out_of_range.o): New rules.
8166 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8167 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8168 thumb2_bl_out_of_range
8169 * testsuite/Makefile.in: Regenerate.
8170 * testsuite/arm_bl_in_range.s: New file.
8171 * testsuite/arm_bl_out_of_range.s: Ditto.
8172 * testsuite/arm_branch_in_range.sh: Ditto.
8173 * testsuite/arm_branch_range.t: Ditto.
8174 * testsuite/thumb2_branch_range.t: Ditto.
8175 * testsuite/thumb_bl_in_range.s: Ditto.
8176 * testsuite/thumb_bl_out_of_range.s: Ditto.
8177 * testsuite/thumb_branch_range.t: Ditto.
8178
8179 2010-02-20 Sriraman Tallam <tmsriram@google.com>
8180
8181 * gc.h (gc_process_relocs): Change vectors to point to the new list.
8182 Add reloc offset information.
8183 * icf.cc (get_section_contents): Change iterators to point to the new
8184 vectors. Add reloc offset information to the contents.
8185 * icf.h (Icf::Sections_reachable_info): New typedef.
8186 (Icf::Sections_reachable_list): New typedef.
8187 (Icf::Offset_info): New typedef.
8188 (Icf::Reloc_info): New struct typedef.
8189 (Icf::Reloc_info_list): New typedef.
8190 (Icf::symbol_reloc_list): Delete method.
8191 (Icf::addend_reloc_list): Delete method.
8192 (Icf::section_reloc_list): Delete method.
8193 (Icf::reloc_info_list): New method.
8194 (Icf::reloc_info_list_): New member.
8195
8196 2010-02-19 Doug Kwan <dougkwan@google.com>
8197
8198 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8199 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8200 * arm.cc (Arm_relocation_functions): New forward declaration.
8201 (Target_arm::Target_arm): Initialize new data members
8202 got_mod_index_offset_ and tls_base_symbol_defined_.
8203 (Target_arm::Relocate::relocate_tls): New method.
8204 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8205 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8206 New methods.
8207 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8208 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8209 (Target_arm::got_mod_index_offset_,
8210 Target_arm::tls_base_symbol_defined_): New data members.
8211 (Target_arm::Scan::local, Target::Scan::global,
8212 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8213 relocations.
8214
8215 2010-02-18 Doug Kwan <dougkwan@google.com>
8216
8217 * arm.cc (Arm_relobj::find_linked_text_section): New method.
8218 (Arm_relobj::make_exidx_input_section): Pass section index of linked
8219 text section as a parameter becuase some broken tools may not set
8220 the link in section header.
8221 (Target_arm::has_got_section): New method.
8222 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8223 without any mapping symbol as data only. Remove warning.
8224 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8225 link in its section header, try to discover the link by inspecting the
8226 REL31 relocation at the beginning of the section.
8227 (Target_arm::Scan::check_non_pic): Report name of offending relocation
8228 in error message.
8229 (Target_arm::Scan::global): Treat any reference to the symbol
8230 _GLOBAL_OFFSET_TABLE_ as a GOT access.
8231
8232 2010-02-12 Sriraman Tallam <tmsriram@google.com>
8233
8234 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8235 (Scan::global_reloc_may_be_function_pointer): New function.
8236 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8237 (Scan::global_reloc_may_be_function_pointer): New function.
8238 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8239 (Scan::global_reloc_may_be_function_pointer): New function.
8240 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8241 (Scan::global_reloc_may_be_function_pointer): New function.
8242 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8243 (Scan::global_reloc_may_be_function_pointer): New function.
8244 (Scan::possible_function_pointer_reloc): New function.
8245 (Target_x86_64::can_check_for_function_pointers): New function.
8246 * gc.h (gc_process_relocs): Scan relocation types to determine if
8247 function pointers were taken for targets that support it.
8248 * icf.cc (Icf::find_identical_sections): Include functions for
8249 folding in safe ICF whose pointer is not taken.
8250 * icf.h (Secn_fptr_taken_set): New typedef.
8251 (fptr_section_id_): New member.
8252 (section_has_function_pointers): New function.
8253 (set_section_has_function_pointers): New function.
8254 (check_section_for_function_pointers): New function.
8255 * options.h: Fix comment for safe ICF option.
8256 * target.h (can_check_for_function_pointers): New function.
8257 * testsuite/Makefile.am: Add icf_safe_so_test test case.
8258 Modify icf_safe_test for X86-64.
8259 * testsuite/Makefile.in: Regenerate.
8260 * testsuite/icf_safe_so_test.cc: New file.
8261 * testsuite/icf_safe_so_test.sh: New file.
8262 * testsuite/icf_safe_test.cc (kept_func_3): New function.
8263 (main): Change to take pointer to function kept_func_3.
8264 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8265 folding is done correctly for X86-64.
8266
8267 2010-02-12 David S. Miller <davem@davemloft.net>
8268
8269 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8270 is_symbolless parameter.
8271 (Output_reloc<SHT_REL>::is_symbolless): New.
8272 (Output_reloc<SHT_REL>::is_symbolless_): New.
8273 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8274 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8275 (Output_reloc<SHT_RELA>::is_symbolless): New.
8276 (Output_data_reloc::add_global): Handle is_symbolless.
8277 (Output_data_reloc::add_global_relative): Likewise.
8278 (Output_data_reloc::add_local): Likewise.
8279 (Output_data_reloc::add_local_relative): Likewise.
8280 (Output_data_reloc::add_symbolless_global_addend): New.
8281 (Output_data_reloc::add_symbolless_local_addend): New.
8282 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8283 is_symbolless.
8284 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8285 instead of ->is_relative_
8286 (Output_reloc::write): Likewise.
8287 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8288 (Output_reloc::write_rel): Simplify.
8289
8290 * sparc.cc (Target_sparc::Scan::local): Use
8291 ->add_symbolless_local_addend as needed.
8292 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8293 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
8294 based upon relocation offset.
8295
8296 2010-02-11 Doug Kwan <dougkwan@google.com>
8297
8298 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8299 (Target_arm::Scan::global): Ditto. Also remove a comment before the
8300 beginning of function.
8301 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8302 and MOVT_ABS relocations. Those are non issued in scanning. Fix
8303 parameter is_32bit in calls to should_apply_static_reloc.
8304 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8305 (check_DATA): Add arm_abs_global.stdout.
8306 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8307 arm_abs_global.stdout): New rules.
8308 (MOSTLLYCLEANFILES): Add arm_abs_global
8309 * Makefile.in: Regenerate.
8310 * testsuite/arm_abs_global.s: New file.
8311 * testsuite/arm_abs_global.sh: Ditto.
8312 * testsuite/arm_abs_lib.s: Ditto.
8313
8314 2010-02-11 Ian Lance Taylor <iant@google.com>
8315
8316 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8317 Read_relocs task.
8318 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
8319 Allocate_commons_task first.
8320 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8321 task, rather than symtab_lock_.
8322 (Gc_process_relocs::~Gc_process_relocs): New function.
8323 (Gc_process_relocs::is_runnable): Check this_blocker_.
8324 (Gc_process_relocs::locks): Use next_blocker_ rather than
8325 blocker_.
8326 (Scan_relocs::~Scan_relocs): New function.
8327 (Scan_relocs::is_runnable): Check this_blocker_ rather than
8328 symtab_lock_.
8329 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
8330 next_blocker_.
8331 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8332 fields. Add this_blocker_ and next_blocker_ fields. Adjust
8333 constructor accordingly.
8334 (class Gc_process_relocs): Likewise.
8335 (class Scan_relocs): Likewise.
8336 * common.h (class Allocate_commons_task): Remove symtab_lock_
8337 field, and corresponding constructor parameter.
8338 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8339 symtab_lock_.
8340 (Allocate_commons_task::locks): Likewise.
8341
8342 2010-02-11 Ian Lance Taylor <iant@google.com>
8343
8344 * gold-threads.h (class Once): Define.
8345 (class Initialize_lock): Rewrite as child of Once.
8346 * gold-threads.cc (class Once_initialize): Define.
8347 (once_pointer_control): New static variable.
8348 (once_pointer, once_arg): New static variables.
8349 (c_run_once): New static function.
8350 (Once::Once, Once::run_once, Once::internal_run): New functions.
8351 (class Initialize_lock_once): Remove.
8352 (initialize_lock_control): Remove.
8353 (initialize_lock_pointer): Remove.
8354 (initialize_lock_once): Remove.
8355 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8356 (Initialize_lock::initialize): Rewrite.
8357 (Initialize_lock::do_run_once): New function.
8358 * archive.cc (Archive::interpret_header): Only clear name if it is
8359 not already empty.
8360 * fileread.cc: Include "gold-threads.h"
8361 (file_counts_lock): New static variable.
8362 (file_counts_initialize_lock): Likewise.
8363 (File_read::release): Only increment counts when using --stats.
8364 Use a lock around the increment.
8365 * parameters.cc (class Set_parameters_target_once): Define.
8366 (set_parameters_target_once): New static variable.
8367 (Parameters::Parameters): Move here from parameters.h.
8368 (Parameters::set_target): Rewrite.
8369 (Parameters::set_target_once): New function.
8370 (Parameters::clear_target): Move here and rewrite.
8371 * parameters.h (class Parameters): Update declarations. Add
8372 set_parameters_target_once_ field.
8373 (Parameters::Parameters): Move to parameters.cc.
8374 (Parameters::clear_target): Likewise.
8375 * readsyms.cc (Read_symbols::do_group): Create a Start_group
8376 task.
8377 (Start_group::~Start_group): New function.
8378 (Start_group::is_runnable): New function.
8379 (Start_group::locks, Start_group::run): New functions.
8380 (Finish_group::run): Change saw_undefined to size_t.
8381 * readsyms.h (class Start_group): Define.
8382 (class Finish_group): Change saw_undefined_ field to size_t.
8383 (Finish_group::Finish_group): Remove saw_undefined and
8384 this_blocker parameters. Change all callers.
8385 (Finish_group::set_saw_undefined): New function.
8386 (Finish_group::set_blocker): New function.
8387 * symtab.h (class Symbol_table): Change saw_undefined to return
8388 size_t. Change saw_undefined_ field to size_t.
8389 * target-select.cc (Set_target_once::do_run_once): New function.
8390 (Target_selector::Target_selector): Initialize set_target_once_
8391 field. Don't initialize lock_ and initialize_lock_ fields.
8392 (Target_selector::instantiate_target): Rewrite.
8393 (Target_selector::set_target): New function.
8394 * target-select.h (class Set_target_once): Define.
8395 (class Target_selector): Update declarations. Make
8396 Set_target_once a friend. Remove lock_ and initialize_lock_
8397 fields. Add set_target_once_ field.
8398
8399 2010-02-10 Ian Lance Taylor <iant@google.com>
8400
8401 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8402 queueing any tasks.
8403 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
8404 (queue_middle_tasks): Add all blockers before queueing any tasks.
8405 (queue_final_tasks): Likewise.
8406 * token.h (Task_token::add_blockers): New function.
8407 * object.h (Input_objects::number_of_relobjs): New function.
8408
8409 2010-02-10 Ian Lance Taylor <iant@google.com>
8410
8411 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8412 shared, not if not position independent.
8413 * x86_64.cc (Relocate::relocate_tls): Likewise.
8414 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8415 (tls_pie_pic_test): New target.
8416 * testsuite/Makefile.in: Rebuild.
8417
8418 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8419 (tls_test_main_pie.o, tls_test_pie.o): New targets.
8420 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8421 * testsuite/Makefile.in: Rebuild.
8422
8423 2010-02-09 David S. Miller <davem@davemloft.net>
8424
8425 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8426 R_SPARC_RELATIVE using ->add_local_relative().
8427 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8428
8429 * output.h (Output_data_dynamic::add_section_size): New method
8430 that takes two Output_data objects.
8431 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8432 entry param. Handle it in initializers.
8433 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8434 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8435 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8436 arg.
8437 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8438 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8439 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8440 for dynrel_includes_plt.
8441 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8442 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8443 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8444 before .rela.plt
8445 (Target_sparc::do_finalize_sections): Update to pass true for
8446 dynrel_includes_plt.
8447 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8448 output before .rela.plt
8449 (Target_powerpc::do_finalize_sections): Update to pass true for
8450 dynrel_includes_plt when 32-bit.
8451
8452 2010-02-08 Doug Kwan <dougkwan@google.com>
8453
8454 * arm.cc (Arm_relobj::simple_input_section_output_address): New
8455 method.
8456 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8457 Arm_relobj::scan_section_for_cortex_a8_stubs,
8458 Arm_relobj::do_relocation_section): Instead of calling
8459 Output_section::output_address, use faster
8460 Arm_relobj::simple_input_section_output_address.
8461
8462 2010-02-08 David S. Miller <davem@davemloft.net>
8463
8464 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8465 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8466 relocation helper function.
8467
8468 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8469 just like R_SPARC_GOT{10,13,22}.
8470 (Target_sparc::Scan::local): Likewise.
8471 (Target_sparc::Relocate:relocate): Likewise.
8472
8473 2010-02-06 Ian Lance Taylor <iant@google.com>
8474
8475 * configure.ac: Rewrite targetobjs duplicate removal code to use
8476 only shell constructs.
8477 * configure: Rebuild.
8478
8479 2010-02-05 Doug Kwan <dougkwan@google.com>
8480
8481 PR 11247
8482 * arm.cc (Arm_relobj::section_is_scannable): New method.
8483 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8484 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8485
8486 2010-02-04 Doug Kwan <dougkwan@google.com>
8487
8488 PR 11247
8489 * arm-reloc-property.cc (cstdio): Include.
8490 * configure.ac (targetobjs): Remove duplicates.
8491 * configure: Regenerate.
8492 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8493 big and little endian version for a given address size.
8494
8495 2010-02-03 Doug Kwan <dougkwan@google.com>
8496
8497 * arm-reloc-property.cc
8498 (Arm_reloc_property_table::reloc_name_in_error_message): New method
8499 definition.
8500 * arm-reloc-property.h
8501 (Arm_reloc_property_table::get_implemented_static_reloc_property):
8502 New method definition.
8503 (Arm_reloc_property_table::reloc_name_in_error_message): New method
8504 declaration.
8505 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8506 overflow to N.
8507 (GOT_PREL): Change implemented to Y.
8508 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8509 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8510 (Arm_relocate_functions::movw_abs_nc): Remove method.
8511 (Arm_relocate_functions::movt_abs): Ditto.
8512 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8513 (Arm_relocate_functions::thm_movt_abs): Ditto.
8514 (Arm_relocate_functions::movw_rel_nc): Ditto.
8515 (Arm_relocate_functions::movw_rel): Ditto.
8516 (Arm_relocate_functions::movt_rel): Ditto.
8517 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8518 (Arm_relocate_functions:thm_movw_rel): Ditto.
8519 (Arm_relocate_functions:thm_movt_rel): Ditto.
8520 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8521 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8522 New method definitions.
8523 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8524 (Arm_relocation_functions::arm_grp_ldr): Ditto.
8525 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8526 (Arm_relocation_functions::arm_grp_ldc): Ditto.
8527 (Target_arm::Relocate::relocate): Check for non-static or
8528 unimplemented relocation code and exit early. Change calls to
8529 Target_arm::reloc_uses_thumb_bit and
8530 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8531 instead. Refactor code to handle similar relocations to increase
8532 code sharing. Remove check for unsupported relocation code in switch
8533 statement.
8534 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8535 relocation property table to find out size. Change error message to
8536 print out the name of a relocation code instead of the numeric value.
8537 (Target_arm::scan_reloc_for_stub): Use relocation property table
8538 instead of calling Target_arm::reloc_uses_thumb_bit().
8539
8540 2010-02-02 Doug Kwan <dougkwan@google.com>
8541
8542 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8543 types of relaxed input section.
8544
8545 2010-02-02 Doug Kwan <dougkwan@google.com>
8546
8547 * Makefile.am (HFILES): Add arm-reloc-property.h.
8548 (DEFFILES): New.
8549 (TARGETSOURCES): Add arm-reloc-property.cc
8550 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8551 (libgold_a_SOURCES): $(DEFFILES)
8552 * Makefile.in: Regenerate.
8553 * arm-reloc-property.cc: New file.
8554 * arm-reloc-property.h: New file.
8555 * arm-reloc.def: New file.
8556 * arm.cc: Update comments.
8557 (arm-reloc-property.h): New included header.
8558 (arm_reloc_property_table): New global variable.
8559 (Target_arm::do_select_as_default_target): New method definition.
8560 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8561 arm-reloc-property to targ_extra_obj.
8562 * parameters.cc (set_parameters_target): Call
8563 Target::select_as_default_target().
8564 * target.h (Target::select_as_default_target): New method definition.
8565 (Target::do_select_as_default_target): Same.
8566
8567 2010-02-01 Doug Kwan <dougkwan@google.com>
8568
8569 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8570 first_output_text_section_.
8571 (Arm_exidx_fixup::first_output_text_section): New method definition.
8572 (Arm_exidx_fixup::first_output_text_section_): New data member.
8573 (Arm_exidx_fixup::process_exidx_section): Record the first text
8574 output section seen.
8575 (Arm_output_section::fix_exidx_coverage): Set correct linked section
8576 and entsize in output section header.
8577
8578 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8579
8580 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8581 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8582 (Arm_relocate_functions::thm_alu11): New Method.
8583 (Arm_relocate_functions::thm_pc8): New Method.
8584 (Arm_relocate_functions::thm_pc12): New Method.
8585 (Target_arm::Scan::local): Handle the relocations.
8586 (Target_arm::Scan::global): Likewise.
8587 (Target_arm::Relocate::relocate): Likewise.
8588 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8589
8590 2010-01-29 Doug Kwan <dougkwan@google.com>
8591
8592 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8593 of relocation types as ld.
8594
8595 2010-01-29 Doug Kwan <dougkwan@google.com>
8596
8597 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8598 to public.
8599 (Arm_relocate_functions::thumb_branch_common): Ditto.
8600 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8601 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8602 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8603 Arm_relocate_functions::jump24): Remove.
8604 (Target_arm::Relocate::relocate): Adjust code to call
8605 Arm_relocation_functions::arm_branch_common and
8606 Arm_relocation_functions::thumb_branch_common instead of their removed
8607 wrappers. Merge switch-cases together to reduce source code size.
8608
8609 2010-01-29 Doug Kwan <dougkwan@google.com>
8610
8611 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8612 output_local_symbol_count_needs_update_.
8613 (Arm_relobj::output_local_symbol_count_needs_update,
8614 Arm_relobj::set_output_local_symbol_count_needs_update,
8615 Arm_relobj::update_output_local_symbol_count): New methods.
8616 (Arm_relobj::output_local_symbol_count_needs_update_): New data
8617 member.
8618 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8619 of pointed function as in a R_ARM_PREL31 relocation.
8620 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8621 for output local symbol count updating.
8622 (Target_arm::do_relax): Update output local symbol counts in objects
8623 if necessary.
8624 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8625
8626 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8627
8628 * arm.cc: Added support for the ARM relocations:
8629 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8630 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8631 (Arm_relocate_functions::movw_rel_nc): Renamed (was
8632 movw_prel_nc).
8633 (Arm_relocate_functions::movw_rel): New method.
8634 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8635 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8636 thm_movw_prel_nc).
8637 (Arm_relocate_functions::thm_movw_rel): New method.
8638 (Arm_relocate_functions::thm_movt_rel): Renamed (was
8639 thm_movt_prel).
8640 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8641 relocations.
8642 (Target_arm::Scan::global): Likewise.
8643 (Target_arm::Relocate::relocate): Likewise.
8644 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8645 Likewise.
8646
8647 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8648
8649 * arm.cc: Added support for ARM group relocations.
8650 (Target_arm::reloc_needs_sym_origin): New method.
8651 (Arm_relocate_functions::calc_grp_kn): New method.
8652 (Arm_relocate_functions::calc_grp_residual): New method.
8653 (Arm_relocate_functions::calc_grp_gn): New method.
8654 (Arm_relocate_functions::arm_grp_alu): New Method.
8655 (Arm_relocate_functions::arm_grp_ldr): New Method.
8656 (Arm_relocate_functions::arm_grp_ldrs): New Method.
8657 (Arm_relocate_functions::arm_grp_ldc): New Method.
8658 (Target_arm::Scan::local): Handle the ARM group relocations.
8659 (Target_arm::Scan::global): Likewise.
8660 (Target_arm::Relocate::relocate): Likewise.
8661 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8662 Likewise.
8663
8664 2010-01-26 Doug Kwan <dougkwan@google.com>
8665
8666 * arm.cc (set): Include.
8667 (class Arm_exidx_fixup): Change type of last_input_section_ to const
8668 pointer type.
8669 (Arm_output_section::Text_section_list): New type.
8670 (Arm_output_section::append_text_sections_to_list): New method.
8671 (Arm_output_section::fix_exidx_coverage): Ditto.
8672 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8673 (Arm_relobj::convert_input_section_to_relaxed_section): Use
8674 Relobj::set_section_offset() instead of
8675 Sized_relobj::invalidate_section_offset().
8676 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8677 parameter for section headers. Ignore relocation sections for
8678 unallocated sections and EXIDX sections.
8679 (Target_arm::fix_exidx_coverage): New method.
8680 (Target_arm::output_section_address_less_than): New type.
8681 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8682 linked text section instead of the EXIDX section.
8683 (Arm_output_section::create_stub_group): Add an assertion to check
8684 that this is not an EXIDX output section.
8685 (Arm_output_section::append_text_sections_to_list): New method.
8686 (Arm_output_section::fix_exidx_coverage): Ditto.
8687 (Arm_relobj::scan_sections_for_stubs): Adjust call to
8688 Arm_relobj::section_needs_reloc_stub_scanning.
8689 (Target_arm::do_relax): Fix EXIDX output section coverage in the
8690 first pass.
8691 (Target_arm::fix_exidx_coverage): New method.
8692 * object.h (Relobj::set_output_section): New method.
8693 (Sized_relobj::invalidate_section_offset): Remove method.
8694 (Sized_relobj::do_invalidate_section_offset): Remove method.
8695 (Sized_relobj::do_set_section_offset): Handle offset value -1.
8696
8697 2010-01-25 Doug Kwan <dougkwan@google.com>
8698
8699 * arm.cc (Arm_exidx_merged_section::do_output_offset):
8700 Fix warning due to signed and unsigned comparison on a 32-bit host.
8701
8702 2010-01-22 Doug Kwan <dougkwan@google.com>
8703
8704 * arm.cc (Target_arm::do_relax): Record an output section for section
8705 offset adjustment it contains any stub table that has changed.
8706 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8707 offsets in an output section if necessary.
8708 * output.cc (Output_section::Output_section): Initialize
8709 section_offsets_need_adjustments_.
8710 (Output_section::add_input_section_for_script): Renamed to
8711 Output_section::add_simple_input_section.
8712 (Output_section::save_states): Add a comment.
8713 (Output_section::discard_states): New method defintion.
8714 (Output_section::adjust_section_offsets): Same.
8715 * output.h (Output_section::add_input_section_for_script): Renamed to
8716 Output_section::add_simple_input_section.
8717 (Output_section::discard_states): New method declaration.
8718 (Output_section::adjust_section_offsets): Same.
8719 (Output_section::section_offsets_need_adjustment,
8720 Output_section::set_section_offsets_need_adjustment): New method
8721 definitions.
8722 (Output_section::section_offsets_need_adjustment_): New data member.
8723 * script-sections.cc
8724 (Output_section_element_input::set_section_address): Adjust code for
8725 renaming of Output_section::add_input_section_for_script.
8726 (Orphan_output_section::set_section_address): Same.
8727
8728 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8729
8730 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8731 Fix_v4bx enum values .
8732 * gold/options.h (General_options): New option definitions.
8733 (General_options::fix_v4bx): New method.
8734 (General_options::Fix_v4bx): New enum.
8735 * gold/options.cc (General_options::parse_fix_v4bx): New method.
8736 (General_options::parse_fix_v4bx_interworking): New method.
8737
8738 2010-01-22 Doug Kwan <dougkwan@google.com>
8739
8740 * arm.cc (Arm_exidx_fixup): New class.
8741
8742 2010-01-21 Doug Kwan <dougkwan@google.com>
8743
8744 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8745 classes.
8746 (Arm_exidx_section_offset_map): New type.
8747
8748 2010-01-21 Doug Kwan <dougkwan@google.com>
8749
8750 * arm.cc (Arm_exidx_input_section): New class.
8751 (Arm_relobj::exidx_input_section_by_link,
8752 Arm_relobj::exidx_input_section_by_shndx,
8753 Arm_relobj::make_exidx_input_section): New methods.
8754 (read_arm_attributes_section): Remove.
8755 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8756 information about them.
8757 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8758 to here.
8759
8760 2010-01-20 Doug Kwan <dougkwan@google.com>
8761
8762 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8763 Input_section_specifier to Section_id.
8764 (Target_arm::new_arm_input_section: Adjust code for change of key
8765 type.
8766 (Target_arm::find_arm_input_section): Ditto.
8767 * gc.h (object.h): Include for Section_id nand Section_id_hash.
8768 (Section_id): Remove.
8769 (Garbage_collection::Section_id_hash): Remove.
8770 * icf.h (object.h): Include for Section_id nand Section_id_hash.
8771 (Section_id): Remove.
8772 (Icf::Section_id_hash): Remove.
8773 * object.h (Section_id, Const_section_id, Section_id_hash,
8774 Const_section_id_hash): New type definitions.
8775 * output.cc (Output_section::add_relaxed_input_section): Change to
8776 use Const_section_id instead of Input_section_specifier as key type.
8777 (Output_section::add_merge_input_section): Ditto.
8778 (Output_section::build_relaxation_map): Change to use Section_id
8779 instead of Input_section_specifier as key type.
8780 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8781 Ditto.
8782 (Output_section::convert_input_sections_to_relaxed_sections): Change
8783 to use Const_section_id instead of Input_section_specifier as key type.
8784 (Output_section::find_merge_section): Ditto.
8785 (Output_section::find_relaxed_input_section): Ditto.
8786 * output.h (Input_section_specifier): Remove class.
8787 (Output_section::Output_section_data_by_input_section_map): Change
8788 key type to Const_section_id.
8789 (Output_section::Output_relaxed_input_section_by_input_section_map):
8790 Ditto.
8791 (Output_section::Relaxation_map): Change key type to Section_id.
8792
8793 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8794
8795 * gold/arm.cc: Added support for R_ARM_V4BX relocation
8796 (class Arm_v4bx_stub): New class.
8797 (DEF_STUBS): Updated definition to support v4_veneer_bx.
8798 (Stub_factory::make_arm_v4bx_stub): New method.
8799 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8800 (Stub_table::empty): Handle v4bx stubs.
8801 (Stub_table::add_arm_v4bx_stub): New method.
8802 (Stub_table::find_arm_v4bx_stub): New method.
8803 (Arm_relocate_functions::v4bx): New method.
8804 (Target_arm::fix_v4bx): New method.
8805 (Target_arm::Target_arm): Handle R_ARM_V4BX.
8806 (Stub_table::relocate_stubs): Likewise.
8807 (Stub_table::do_write): Likewise.
8808 (Stub_table::update_data_size_and_addralign): Likewise.
8809 (Stub_table::finalize_stubs): Likewise.
8810 (Target_arm::Scan::local): Likewise.
8811 (Target_arm::Scan::global): Likewise.
8812 (Target_arm::do_finalize_sections): Likewise.
8813 (Target_arm::Relocate::relocate): Likewise.
8814 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8815 Likewise.
8816 (Target_arm::scan_reloc_for_stub): Likewise.
8817 (Target_arm::scan_reloc_section_for_stubs): Likewise.
8818
8819 2010-01-19 Ian Lance Taylor <iant@google.com>
8820
8821 * output.cc (Output_section_headers::do_sized_write): Write large
8822 segment count to sh_info field.
8823 (Output_file_header::do_sized_write): For large segment count,
8824 write PN_XNUM to e_phnum field.
8825
8826 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8827
8828 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8829 (Arm_relocate_functions::thm_jump8): New function.
8830 (Arm_relocate_functions::thm_jump11): New function.
8831 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8832 R_ARM_THM_JUMP11.
8833 (Target_arm::Scan::global): Likewise.
8834 (Target_arm::Relocate::relocate): Likewise.
8835 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8836 Likewise.
8837
8838 2010-01-14 Doug Kwan <dougkwan@google.com>
8839
8840 * arm.cc (map, utility): Include headers.
8841 (Target_arm::apply_cortex_a8_workaround): New method.
8842 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8843 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8844 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8845 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8846 the --[no-]fix-cortex-a8 command line options.
8847 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8848 (Target_arm::relocate_stub): Use addend in instruction template.
8849 * options.h (DEFINE_bool): Set the user-set flag.
8850 (General_options): Add --[no-]-fix-cortex options.
8851 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8852 : Update fast look-up map after conversion.
8853
8854 2010-01-14 Sriraman Tallam <tmsriram@google.com>
8855
8856 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8857 in the first pass of do_layout.
8858
8859 2010-01-13 Doug Kwan <dougkwan@google.com>
8860
8861 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8862 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8863 apparent compiler problem of not folding static constant integral
8864 data members of elfcpp::Elf_sizes<32>.
8865
8866 2010-01-13 Doug Kwan <dougkwan@google.com>
8867
8868 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8869 Arm_relobj::section_needs_cortex_a8_stub_scanning,
8870 Arm_relobj::scan_section_for_cortex_a8_erratum,
8871 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8872 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8873 sections to scan for relocation stubs into a new method
8874 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
8875 relocation and Cortex-A8 stub scanning.
8876 (Target_arm::do_relax): Force stubs to be after stubbed sections
8877 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
8878 the beginning of a new relaxation pass. Update a comment.
8879 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8880
8881 2010-01-12 Ian Lance Taylor <iant@google.com>
8882
8883 * target-reloc.h (visibility_error): New inline function.
8884 (relocate_section): Call visibility_error.
8885 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8886 (MOSTLYCLEANFILES): Likewise.
8887 (protected_4_pic.o, protected_3.err): New targets.
8888 * testsuite/protected_4.cc: New file.
8889
8890 2010-01-12 Doug Kwan <dougkwan@google.com>
8891
8892 * arm.cc (Cortex_a8_reloc): New class.
8893 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8894 and cortex_a8_relocs_info_.
8895 (Target_arm::fix_cortex_a8): New method definition.
8896 (Target_arm::Cortex_a8_relocs_info): New type.
8897 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8898 New data member declarations.
8899 (Target_arm::scan_reloc_for_stub): Record information about
8900 relocations for THUMB branches that might be exempted from the
8901 Cortex-A8 workaround.
8902 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8903 at the beginning of a relaxation pass.
8904
8905 2010-01-12 Doug Kwan <dougkwan@google.com>
8906
8907 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8908 (Arm_relobj::Mapping_symbol_position,
8909 Arm_reloj::Mapping_symbol_position_less,
8910 Arm_relobj::Mapping_symbols_info): New types.
8911 (Target_arm::is_mapping_symbol_name): New method definition.
8912 (Arm_relobj::do_count_local_symbols): Save information about mapping
8913 symbols.
8914
8915 2010-01-11 Doug Kwan <dougkwan@google.com>
8916
8917 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8918 Arm_relocate_functions::thumb32_branch_upper,
8919 Arm_relocate_functions::thumb32_branch_lower,
8920 Arm_relocate_functions::thumb32_cond_branch_offset,
8921 Arm_relocate_functions::thumb32_cond_branch_upper,
8922 Arm_relocate_functions::thumb32_cond_branch_lower,
8923 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8924 branch offset encoding.
8925 (Arm_relocate_functions::thumb_branch_common): Use new branch
8926 offset encoding methods to avoid code duplication.
8927 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8928 (Stub_addend_reader::operator()): Use new branch encoding method
8929 to avoid code duplication.
8930
8931 2010-01-11 Doug Kwan <dougkwan@google.com>
8932
8933 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8934 (Target_arm::do_finalize_sections): Define special EXIDX section
8935 symbols only if referenced.
8936 * gc.h (Garbage_collection::add_reference): New method.
8937 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8938 code duplication.
8939
8940 2010-01-11 Ian Lance Taylor <iant@google.com>
8941
8942 * script.cc (Version_script_info::build_expression_list_lookup):
8943 Change complaing about duplicate wildcard match from error to
8944 warning.
8945
8946 * script.cc (class Lazy_demangler): Recreate--revert part of patch
8947 of 2009-12-30.
8948 (Version_script_info::Version_script_info): Initialize globs_,
8949 default_version_, default_is_global_, and exact_. Don't
8950 initialize globals_ or locals_.
8951 (Version_script_info::build_lookup_tables): Build local symbols
8952 first.
8953 (Version_script_info::unquote): New function.
8954 (Version_script_info::add_exact_match): New function.
8955 (Version_script_info::build_expression_list_lookup): Remove lookup
8956 parameter. Add is_global parameter. Change all callers. Handle
8957 wildcard pattern specially. Unquote pattern. Call
8958 add_exact_match.
8959 (Version_script_info::get_name_to_match): New function.
8960 (Version_script_info::get_symbol_version): New function.
8961 (Version_script_info::get_symbol_version_helper): Remove.
8962 (Version_script_info::check_unmatched_names): Call unquote.
8963 * script.h (class Version_script_info): Change get_symbol_version
8964 to be non-inline and add is_global parameter; change all callers.
8965 Rewrite symbol_is_local. Update declarations. Define struct
8966 Version_tree_match, Exact, Globs. Don't define struct Lookup.
8967 Remove globals_ and locals_ members. Add exact_, globs_,
8968 default_version_, is_global_.
8969 (Version_script_info::Glob): Remove pattern, add expression and
8970 is_global. Update constructor. Change all callers.
8971 * dynobj.cc (Versions::finalize): Mark the version symbol as the
8972 default version.
8973 (Versions::symbol_section_contents): If a symbol is undefined, or
8974 defined in a dynamic object, set the version index to
8975 VER_NDX_LOCAL.
8976 * symtab.cc (Symbol_table::add_from_relobj): Don't call
8977 symbol_is_local.
8978 (Symbol_table::add_from_pluginobj): Likewise.
8979 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8980
8981 2010-01-11 Doug Kwan <dougkwan@google.com>
8982
8983 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8984 (incremental_dump_LDADD): Add linking option for libintl.
8985 * Makefile.in: Regenerate.
8986
8987 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
8988
8989 PR gold/11144
8990 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8991 instead of -Ds.
8992 * testsuite/Makefile.in: Regenerated.
8993
8994 2010-01-10 Doug Kwan <dougkwan@google.com>
8995
8996 * options.h (DEFINE_var): Use parentheses around argument varname__
8997 in macro body to avoid any unintended subsequent substitutions.
8998
8999 2010-01-10 Ian Lance Taylor <iant@google.com>
9000
9001 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9002 candidates before doing symbol resolution.
9003
9004 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9005 ODR candidates if only one is weak.
9006
9007 2010-01-08 Ian Lance Taylor <iant@google.com>
9008
9009 * script.cc (Version_script_info::build_expression_list_lookup):
9010 Don't warn about ambiguous version, just record the ambiguity.
9011 (Version_script_info::get_symbol_version_helper): Give error if
9012 version is ambiguous.
9013
9014 2010-01-08 Doug Kwan <dougkwan@google.com>
9015
9016 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9017 prev_data_size_ and prev_addralign_. Remove initializer for
9018 deleted data member has_been_changed_.
9019 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9020 to determine if the table is empty.
9021 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9022 Remove.
9023 (Stub_table::add_reloc_stub): Define method in class definition
9024 instead of just declaring it there.
9025 (Stub_table::add_cortex_a8_stub): New method definition.
9026 (Stub_table::update_data_size_and_addralign): Ditto.
9027 (Stub_table::finalize_stubs): Ditto.
9028 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9029 (Stub_table::do_addralign_): Return address alignment in the
9030 (Stub_table::do_reset_address_and_file_offset): Define method in
9031 class definition instead of declaring it there. Set current data
9032 size to be the data size of the previous pass.
9033 (Stub_table::set_final_data_size): Use current data size as the
9034 final data size.
9035 (Stub_table::relocate_stub): Change parameter type of stub from
9036 Reloc_stub pointer to Stub pointer.
9037 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9038 (Stub_table::Cortex_a8_stub_list): New typedef.
9039 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9040 Stub_table::prev_addralign_): New data member.
9041 (Arm_relobj::Arm_relobj): Initialize data member
9042 section_has_cortex_a8_workaround_.
9043 (Arm_relobj::section_has_cortex_a8_workaround,
9044 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9045 definitions.
9046 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9047 declarations.
9048 (Target_arm::relocate_stub): Change parameter type of stub from
9049 Reloc_stub pointer to Stub pointer.
9050 (Insn_template::size, Insn_template::alignment): Handle
9051 THUMB16_SPECIAL_TYPE.
9052 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9053 Stub_table::update_data_size_and_addralign,
9054 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9055 definitions.
9056 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9057 (Stub_table::do_write): Ditto.
9058 (Target_arm::do_relax): Adjust code for changes in Stub_table.
9059
9060 2010-01-08 Ian Lance Taylor <iant@google.com>
9061
9062 PR 11108
9063 * symtab.h (class Symbol): Remove fields is_target_special_ and
9064 has_plt_offset_. Add field is_defined_in_discarded_section_.
9065 (Symbol::is_defined_in_discarded_section): New function.
9066 (Symbol::set_is_defined_in_discarded_section): New function.
9067 (Symbol::has_plt_offset): Rewrite.
9068 (Symbol::set_plt_offset): Verify that new offset is not -1U.
9069 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9070 Don't initialize is_target_special_ or has_plt_offset_.
9071 Initialize is_defined_in_discarded_section_.
9072 (Symbol_table::add_from_relobj): If appropriate, set
9073 is_defined_in_discarded_section.
9074 * resolve.cc (Symbol::override_base_with_special): Don't test
9075 is_target_special_. Change has_plt_offset_ to has_plt_offset().
9076 * target-reloc.h (relocate_section): Do special handling for
9077 symbols defined in discarded sections for global symbols as well
9078 as local symbols.
9079
9080 2010-01-08 Ian Lance Taylor <iant@google.com>
9081
9082 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9083 the SHT_SYMTAB case.
9084
9085 2010-01-08 Ian Lance Taylor <iant@google.com>
9086
9087 * object.cc (Sized_relobj::do_layout): Don't get confused if
9088 layout_eh_frame returns NULL.
9089
9090 2010-01-08 Ian Lance Taylor <iant@google.com>
9091
9092 PR 11084
9093 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9094 dynamic symbol table, use the normal symbol table.
9095 (Sized_dynobj::do_read_symbols): Remove assertion about type of
9096 symbol table.
9097
9098 2010-01-08 Ian Lance Taylor <iant@google.com>
9099
9100 PR 11072
9101 * layout.cc (Layout::include_section): Remove .gnu_debuglink
9102 sections.
9103
9104 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
9105
9106 * version.cc (print_version): Change to "Copyright 2010".
9107
9108 2010-01-08 Ian Lance Taylor <iant@google.com>
9109
9110 PR 10287
9111 PR 11063
9112 * i386.cc (class Target_i386): Change return type of plt_section
9113 to be non-const.
9114 (class Output_data_plt_i386): Add tls_desc_rel_ field.
9115 (Output_data_plt_i386::Output_data_plt_i386): Initialize
9116 tls_desc_rel_ field.
9117 (Output_data_plt_i386::rel_tls_desc): New function.
9118 (Target_i386::rel_tls_desc_section): New function.
9119 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9120 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9121 R_386_TLS_DESC reloc in rel_tls_desc_section.
9122 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9123 Define struct Tlsdesc_info.
9124 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9125 (Target_x86_64::do_reloc_symbol_index): New function.
9126 (Target_x86_64::add_tlsdesc_info): New function.
9127 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9128 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9129 tlsdesc_rel_ field.
9130 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
9131 all callers.
9132 (Output_data_plt_x86_64::rela_tlsdesc): New function.
9133 (Target_x86_64::rela_tlsdesc_section): New function.
9134 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9135 handling.
9136 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9137 (Target_x86_64::do_reloc_addend): New function.
9138 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9139 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9140 declarations. Define TARGET_CODE. Add arg field to u1_ union.
9141 (Output_reloc::type): New function.
9142 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9143 (Output_reloc::is_target_specific): New function.
9144 (Output_reloc::target_arg): New function.
9145 (class Output_reloc) [SHT_RELA]: Add four new constructors for
9146 absolute relocs and target specific relocs.
9147 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9148 add_target_specific.
9149 (class Output_data_reloc) [SHT_RELA]: Likewise.
9150 * output.cc (Output_reloc::Output_reloc): Add four new versions
9151 for absolute relocs and target specific relocs.
9152 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9153 (Output_reloc::get_symbol_index): Likewise.
9154 (Output_reloc::local_section_offset): Check that local_sym_index_
9155 is not TARGET_CODE or 0.
9156 (Output_reloc::symbol_value): Likewise.
9157 (Output_reloc::write) [SHT_RELA]: Call target for target specific
9158 reloc.
9159 * target.h (class Target): Add reloc_symbol_index and reloc_addend
9160 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
9161 functions.
9162 * layout.cc (add_target_dynamic_tags): Use output section for
9163 DT_PLTRELSZ and DT_JMPREL.
9164
9165 2010-01-07 Ian Lance Taylor <iant@google.com>
9166
9167 PR 11061
9168 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9169 function.
9170 (class Output_data_reloc_generic): Define.
9171 (class Output_data_reloc_base): Change base class to
9172 Output_data_reloc_generic. Change add() method to call
9173 bump_relative_reloc_count for a relative reloc. Remove
9174 sort_relocs_ field.
9175 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9176 to sort_relocs().
9177 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9178 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
9179 appropriate.
9180 * layout.h (class Layout): Update declaration.
9181
9182 2010-01-07 Ian Lance Taylor <iant@google.com>
9183
9184 * output.h (class Output_data): Add const version of
9185 output_section and do_output_section.
9186 (class Output_section_data): Add const version of
9187 do_output_section.
9188 (class Output_section): Likewise.
9189 * layout.cc (Layout::add_target_dynamic_tags): New function.
9190 * layout.h (class Layout): Update declarations.
9191 * arm.cc (Target_arm::do_finalize_sections): Use
9192 add_target_dynamic_tags.
9193 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9194 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9195 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9196 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9197
9198 2010-01-07 Ian Lance Taylor <iant@google.com>
9199
9200 PR 11042
9201 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9202 object as needed.
9203
9204 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
9205 Ian Lance Taylor <iant@google.com>
9206
9207 PR 11019
9208 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9209 Xindex::read_symtab_xindex.
9210
9211 2010-01-07 Doug Kwan <dougkwan@google.com>
9212
9213 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9214 (Insn_template::thumb16_bcond_insn): New method declaration.
9215 (Insn_template): Fix spelling.
9216 (Stub::thumb16_special): New method declaration.
9217 (Stub::do_write): Define virtual method which was previously pure
9218 virtual.
9219 (Stub::do_thumb16_special): New method declaration.
9220 (Stub::do_fixed_endian_write): New template member.
9221 (Reloc_stub::do_write): Remove.
9222 (Reloc_stub::do_fixed_endian_write): Remove.
9223 (Cortex_a8_stub): New class definition.
9224 (Stub_factory::make_cortex_a8_stub): New method definition.
9225 (Stub_factory::Stub_factory): Add missing static storage class
9226 qualifier for elf32_arm_stub_a8_veneer_blx.
9227
9228 2010-01-07 Ian Lance Taylor <iant@google.com>
9229
9230 PR 10980
9231 * options.h (class General_options): Add --warn-unresolved-symbols
9232 and --error-unresolved-symbols.
9233 * errors.cc (Errors::undefined_symbol): Implement
9234 --warn-unresolved-symbols.
9235
9236 * options.h (class General_options): Add -z text and -z textoff.
9237 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9238
9239 2010-01-06 Sriraman Tallam <tmsriram@google.com>
9240
9241 * gc.h (Garbage_collection::Cident_section_map): New typedef.
9242 (Garbage_collection::cident_sections): New function.
9243 (Garbage_collection::add_cident_section): New function.
9244 (Garbage_collection::cident_sections_): New member.
9245 (gc_process_relocs): Add references to sections whose names are C
9246 identifiers.
9247 * gold.h (cident_section_start_prefix): New constant.
9248 (cident_section_stop_prefix): New constant.
9249 (is_cident): New function.
9250 * layout.cc (Layout::define_section_symbols): Replace string constants
9251 with the newly defined constants.
9252 * object.cc (Sized_relobj::do_layout): Track sections whose names are
9253 C identifiers.
9254 * testsuite/Makefile.am: Add gc_orphan_section_test.
9255 * testsuite/Makefile.in: Regenerate.
9256 * testsuite/gc_orphan_section_test.cc: New file.
9257 * testsuite/gc_orphan_section_test.sh: New file.
9258
9259 2010-01-06 Ian Lance Taylor <iant@google.com>
9260
9261 PR 10980
9262 * options.h (class General_options): Add --warn-shared-textrel.
9263 * layout.cc (Layout::finish_dynamic_section): Implement
9264 --warn-shared-textrel.
9265
9266 PR 10980
9267 * options.h (class General_options): Add --warn-multiple-gp.
9268
9269 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9270
9271 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9272 $(THREADSLIB) and $(LIBDL).
9273 * Makefile.in: Rebuild.
9274
9275 2010-01-06 Ian Lance Taylor <iant@google.com>
9276
9277 PR 10980
9278 * options.cc (General_options::parse_section_start): New function.
9279 (General_options::section_start): New function.
9280 (General_options::General_options): Initialize all members.
9281 * options.h: Include <map>
9282 (class General_options): Add --section-start. Add section_starts_
9283 member.
9284 * layout.cc (Layout::attach_allocated_section_to_segment): If
9285 --section-start was used, set the address of the segment. Remove
9286 local sort_sections.
9287 (Layout::relaxation_loop_body): If the address of the load segment
9288 has been set by --section-start, don't use it.
9289 * output.h (Output_segment::update_flags_for_output_section): New
9290 function.
9291 * output.cc (Output_segment::add_output_section): Call
9292 update_flags_for_output_section.
9293
9294 2010-01-05 Ian Lance Taylor <iant@google.com>
9295
9296 PR 10980
9297 * options.h (class General_options): Add --undefined-version.
9298 * script.cc (struct Version_expression): Add was_matched_by_symbol
9299 field.
9300 (Version_script_info::matched_symbol): New function.
9301 (Version_script_info::get_symbol_version_helper): Call
9302 matched_symbol.
9303 (Version_script_info::check_unmatched_names): New function.
9304 * script.h (class Version_script_info): Update declarations.
9305 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9306
9307 * options.h (class General_options): Use DEFINE_bool_alias for
9308 allow_multiple_definition.
9309 * resolve.cc (Symbol_table::should_override): Don't test
9310 allow_multiple_definition.
9311
9312 PR 10980
9313 * options.h (class General_options): Add --cref.
9314 * main.cc (main): Print cref table if --cref. Don't close mapfile
9315 until after printing cref table.
9316 * cref.cc: Include "symtab.h".
9317 (class Cref_inputs): Define Cref_table_compare and Cref_table.
9318 (Cref_table_compare::operator()): New function.
9319 (Cref_inputs::gather_cref): New function.
9320 (filecol): New static const.
9321 (Cref_inputs::print_cref): New function.
9322 (Cref::print_cref): New function.
9323 * cref.h: Include <cstdio>.
9324 (class Cref): Update declarations.
9325 * mapfile.h (Mapfile::file): New function.
9326 * object.h (class Object): Define Symbols. Declare virtual
9327 do_get_global_symbols.
9328 (Object::get_global_symbols): New function.
9329 * object.cc (Input_objects::add_object): Pass object to cref_ if
9330 --cref.
9331 (Input_objects::archive_start): Likewise.
9332 (Input_objects::archive_stop): Likewise.
9333 (Input_objects::print_cref): New function.
9334 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9335 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9336 --cref.
9337 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9338 function.
9339 * plugin.h (class Sized_pluginobj): Update declarations.
9340
9341 2010-01-05 Ian Lance Taylor <iant@google.com>
9342
9343 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9344 to is_default_version. Rename insdef to insdefault.
9345 (Symbol_table::add_from_relobj): Rename def to is_default_version
9346 and local to is_forced_local.
9347 (Symbol_table::add_from_pluginobj): Likewise.
9348 (Symbol_table::add_from_dynobj): Likewise.
9349 (Symbol_table::define_special_symbol): Rename insdef to
9350 insdefault.
9351
9352 2010-01-04 Ian Lance Taylor <iant@google.com>
9353
9354 PR 10980
9355 * options.h (class General_options): Add
9356 --allow-multiple-definition and -z muldefs.
9357 * resolve.cc (Symbol_table::should_override): Don't warn about a
9358 multiple symbol definition if --allow-multiple-definition or -z
9359 muldefs.
9360
9361 PR 10980
9362 * options.h (class General_options): Add --add-needed and
9363 --copy-dt-needed-entries. Tweak --as-needed help entry.
9364 * object.cc (Input_objects::check_dynamic_dependencies): Give an
9365 error if --copy-dt-needed-entries aka --add-needed is used and
9366 would cause a change in behaviour.
9367
9368 PR 10980
9369 * options.h (class General_options): Add -G as a short version of
9370 --shared. Add no-op options -assert, -g, and -i.
9371
9372 2010-01-04 Sriraman Tallam <tmsriram@google.com>
9373
9374 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9375 check for .text or .gnu.linkonce.t sections.
9376 * icf.cc (Icf::find_identical_sections): Ditto.
9377 Change the detection for mangled function name within the section
9378 name.
9379 * icf.h (is_section_foldable_candidate): New function.
9380
9381 2009-12-30 Ian Lance Taylor <iant@google.com>
9382
9383 PR 10980
9384 * options.h (class General_options): Permit two dashes with
9385 --retain-symbols-file.
9386
9387 2009-12-30 Ian Lance Taylor <iant@google.com>
9388
9389 PR 10979
9390 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9391 don't put the file header and segment headers in the text
9392 segment.
9393
9394 PR 10979
9395 * common.cc (Sort_commons::operator()): Stabilize sort when both
9396 entries are NULL.
9397 (Symbol_table::do_allocate_commons_list): When allocating common
9398 symbols, skip a symbol which is no longer common.
9399 * symtab.h (Symbol::is_common): Test whether the symbol comes from
9400 an object before checking its type.
9401 * testsuite/common_test_2.c: New file.
9402 * testsuite/common_test_3.c: New file.
9403 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9404 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9405 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9406 (common_test_2_pic.o, common_test_2.so): New targets.
9407 (common_test_3_pic.o, common_test_3.so): New targets.
9408 * testsuite/Makefile.in: Rebuild.
9409
9410 PR 10979
9411 * script.cc (read_input_script): If we see a new SECTIONS clause,
9412 and we have added an input section, give an error.
9413 * layout.h (class Layout): Add have_added_input_section function.
9414 Add have_added_input_section_ field.
9415 * layout.cc (Layout::Layout): Initialize
9416 have_added_input_section_.
9417 (Layout::layout): Set have_added_input_section_.
9418 (Layout::layout_eh_frame): Likewise.
9419
9420 2009-12-30 Ian Lance Taylor <iant@google.com>
9421
9422 PR 10931
9423 * options.h (class General_options): Add --sort-common option.
9424 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9425 * common.cc (Sort_common): Add sort_order parameter to
9426 constructor. Add sort_order_ field.
9427 (Sort_commons::operator): Check sort_order_.
9428 (Symbol_table::allocate_commons): Determine the sort order.
9429 (Symbol_table::do_allocate_commons): Add sort_order parameter.
9430 Change all callers.
9431 (Symbol_table::do_allocate_commons_list): Likewise.
9432
9433 2009-12-30 Ian Lance Taylor <iant@google.com>
9434
9435 PR 10916
9436 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9437 symbols from this object, don't change the visibility of an
9438 undefined symbol.
9439 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9440
9441 2009-12-30 Ian Lance Taylor <iant@google.com>
9442
9443 PR 10861
9444 * script.h (class Version_script_info): Define Language enum.
9445 Update declarations. Define Glob, Exact, and Lookup types. Add
9446 new fields globals_, locals_, and is_finalized_.
9447 * script.cc: Various formatting fixes.
9448 (class Parser_closure): Change language_stack_ from a vector of
9449 std::string to one of Version_script_info::Language. Adjust all
9450 uses accordingly.
9451 (class Lazy_demangler): Remove.
9452 (struct Version_expression): Change language from std::string to
9453 Version_script_info::Language.
9454 (Version_script_info::Version_script_info): New function.
9455 (Version_script_info::~Version_script_info): Don't call clear.
9456 (Version_script_info::finalize): New function.
9457 (Version_script_info::build_lookup_tables): New function.
9458 (Version_script_info::build_expression_list_lookup): New
9459 function.
9460 (Version_script_info::get_symbol_version_helper): Rewrite to use
9461 lookup tables.
9462 (Version_script_info::print_expression_list): Adjust to use
9463 Version_script_info::Language.
9464 (script_push_lex_into_version_mode): Check that the version script
9465 has not been finalized.
9466 (version_script_push_lang): Change language string to
9467 Version_script_info::Language.
9468 * options.cc (Command_line::version_script): New function.
9469 * options.h (class General_options): Add finalize_dynamic_list
9470 function. Change version_script from declaration to definition.
9471 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9472 * testsuite/version_script.map: Remove duplicate def of foo.
9473 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9474 version_script.map.
9475 * testsuite/Makefile.in: Rebuild.
9476
9477 2009-12-30 Ian Lance Taylor <iant@google.com>
9478
9479 PR 10843
9480 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9481 if the input symbol index is 0, make the output symbol index 0.
9482
9483 2009-12-30 Ian Lance Taylor <iant@google.com>
9484
9485 PR 10670
9486 * options.h (class General_options): Add -x/--discard-all.
9487 * object.cc (Sized_relobj::do_count_local_symbols): Handle
9488 --discard-all. If the local symbol needs a dynamic entry, check
9489 that before handling --discard-locals.
9490
9491 2009-12-30 Ian Lance Taylor <iant@google.com>
9492
9493 PR 10450
9494 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9495 flags to PF_R.
9496 (Output_segment::add_output_section): Don't change the flags if
9497 the type is PT_TLS.
9498
9499 PR 10450
9500 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9501 GNU hash table if they need a dynamic value. Otherwise, don't add
9502 them if they are defined in a dynamic object or are forced local.
9503
9504 2009-12-29 Ian Lance Taylor <iant@google.com>
9505
9506 PR 10450
9507 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9508 .gnu.hash table for a 32-bit target.
9509
9510 PR 10450
9511 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9512 regular and a dynamic object only needs a dynamic symbol table
9513 entry if it is externally visible.
9514
9515 PR 10450
9516 * i386.cc (class Target_i386): Initialize global_offset_table_ in
9517 constructor. Add global_offset_table_ field.
9518 (Target_i386::got_section): Set global_offset_table_.
9519 (Target_i386::do_finalize_sections): Set global_offset_table_
9520 size.
9521 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9522 in constructor. Add global_offset_table_ field.
9523 (Target_x86_64::got_section): Set global_offset_table_.
9524 (Target_x86_64::do_finalize_sections): Set global_offset_table_
9525 size.
9526
9527 * layout.cc (Layout::Layout): Initialize increase_relro_.
9528 (Layout::get_output_section): Add is_relro, is_last_relro, and
9529 is_first_non_relro parameters. Change all callers.
9530 (Layout::choose_output_section): Likewise.
9531 (Layout::add_output_section_data): Likewise.
9532 (Layout::make_output_section): Likewise.
9533 (Layout::set_segment_offsets): Clear increase_relro when using a
9534 linker script.
9535 * layout.h (class Layout): Add increase_relro method. Add
9536 increase_relro_ field. Update declarations.
9537 * output.cc (Output_section::Output_section): Initialize
9538 is_last_relro_ and is_first_non_relro_.
9539 (Output_segment::add_output_section): Group relro sections is
9540 do_sort is true. Handle is_last_relro and is_first_non_relro.
9541 (Output_segment::maximum_alignment): Remove relro handling.
9542 (Output_segment::set_section_addresses): Add increase_relro
9543 parameter. Change all callers. Add initial alignment to align
9544 relro sections on separate page. Remove old relro handling.
9545 (Output_segment::set_section_list_addresses): Remove in_relro
9546 parameter. Change all callers.
9547 (Output_segment::set_offset): Add increase parameter. Change all
9548 callers. Remove old relro handling.
9549 * output.h (class Output_section): Add new methods: is_last_relro,
9550 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9551 Add is_last_relro_ and is_first_non_relro_ fields.
9552 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9553 Create separate .got.plt section. Call increase_relro.
9554 * x86_64.cc (Target_x86_64::got_section): Likewise.
9555 * testsuite/relro_script_test.t: Add .got.plt.
9556
9557 PR 10450
9558 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9559 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9560 (Layout::finalize): Call set_dynamic_symbol_size.
9561 (Layout::set_dynamic_symbol_size): New function.
9562 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
9563 set_dynamic_symbol_size.
9564
9565 PR 10450
9566 * output.h (class Output_section): Add is_entsize_zero_ field.
9567 * output.cc (Output_section::Output_section): Initialize
9568 is_entsize_zero_.
9569 (Output_section::set_entsize): If two different entsizes are
9570 requested, force it to zero.
9571 (Output_section::add_input_section): Set flags for .debug_str
9572 before updating section flags. Set entsize.
9573 (Output_section::update_flags_for_input_section): Set SHF_MERGE
9574 and SHF_STRING if all input sections have those flags.
9575
9576 2009-12-29 Rafael Espindola <espindola@google.com>
9577
9578 * main.cc (main): Fix the sys time reporting.
9579 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9580 reporting.
9581
9582 2009-12-29 Sriraman Tallam <tmsriram@google.com>
9583
9584 * options.cc (General_options::parse_version): Allow -v to exit
9585 without an error if there is nothing to link.
9586
9587 2009-12-29 Ian Lance Taylor <iant@google.com>
9588
9589 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9590 using a version of gcc before 4.1.
9591 * configure: Rebuild.
9592
9593 2009-12-28 Chris Demetriou <cgd@google.com>
9594
9595 * attributes.cc (Output_attributes_section_data::do_write): Use
9596 std::vector::front rather than std::vector::data.
9597
9598 2009-12-28 Ian Lance Taylor <iant@google.com>
9599
9600 * symtab.h (class Symbol_table): Add enum Defined.
9601 * resolve.cc (Symbol_table::should_override): Add defined
9602 parameter. Change all callers. Test whether object is NULL
9603 before calling a method on it.
9604 (Symbol_table::report_resolve_problem): Add defined parameter.
9605 Change all callers.
9606 (Symbol_table::should_override_with_special): Likewise.
9607 * symtab.cc (Symbol_table::define_in_output_data): Add defined
9608 parameter. Change all callers.
9609 (Symbol_table::do_define_in_output_data): Likewise.
9610 (Symbol_table::define_in_output_segment): Likewise.
9611 (Symbol_table::do_define_in_output_segment): Likewise.
9612 (Symbol_table::define_as_constant): Likewise.
9613 (Symbol_table::do_define_as_constant): Likewise.
9614 * script.h (class Symbol_assignment): Add is_defsym parameter to
9615 constructor; change all callers.
9616 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9617 parameter. Change all callers. Add is_defsym_ field.
9618 (class Parser_closure): Add parsing_defsym parameter to
9619 constructor; change all callers. Add parsing_defsym accessor
9620 function. Add parsing_defsym_ field.
9621
9622 2009-12-28 Ian Lance Taylor <iant@google.com>
9623
9624 * gold.cc (queue_middle_tasks): Fix formatting.
9625 * object.cc (Relobj::is_section_name_included): Likewise.
9626
9627 2009-12-23 Ian Lance Taylor <iant@google.com>
9628
9629 * i386.cc (Target_i386::do_calls_non_split): Recognize
9630 -fsplit-stack prologue for a function with a static chain.
9631 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9632 -fsplit-stack prologue when using %r11.
9633
9634 2009-12-21 Sriraman Tallam <tmsriram@google.com>
9635
9636 * options.cc (General_options::parse_version): Make -v continue and do
9637 the link like GNU ld does.
9638
9639 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
9640
9641 * Makefile.am (CCFILES): Add timer.cc.
9642 (HFILES): Add timer.h.
9643 * configure.ac: Check for sysconf and times.
9644 * main.cc: include timer.h.
9645 (main): Use Timer instead of get_run_time.
9646 * timer.cc: New.
9647 * timer.h: New.
9648 * workqueue.cc: include timer.h.
9649 (Workqueue::find_and_run_task):
9650 Report user, sys and wall time.
9651 * Makefile.in: Regenerate.
9652 * config.in: Regenerate.
9653 * configure: Regenerate.
9654
9655 2009-12-16 Doug Kwan <dougkwan@google.com>
9656
9657 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9658 sections.
9659 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9660 relaxed input sections.
9661 * output.cc (Output_section::find_relaxed_input_section): Change
9662 return type to Output_relaxed_input_section pointer. Adjust code
9663 for new type of relaxed_input_section_map_.
9664 * output.h (Output_section::find_relaxed_input_section): Change
9665 return type to Output_relaxed_input_section pointer.
9666 (Output_section::Output_relaxed_input_section_by_input_section_map):
9667 New type.
9668 (Output_section::relaxed_input_section_map_): Change type to
9669 Output_section::Output_relaxed_input_section_by_input_section_map.
9670 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9671 input section.
9672
9673 2009-12-15 Ian Lance Taylor <iant@google.com>
9674
9675 * layout.cc (Layout::create_shstrtab): Only write out after input
9676 sections if we are compressing debug sections.
9677
9678 2009-12-15 Ian Lance Taylor <iant@google.com>
9679
9680 * archive.cc (Archive::add_symbols): Only look up a symbol without
9681 a version if there is, in fact, a version.
9682
9683 2009-12-14 Ian Lance Taylor <iant@google.com>
9684
9685 Revert -Wshadow changes, all changes from:
9686 2009-12-11 Doug Kwan <dougkwan@google.com>
9687 2009-12-11 Nick Clifton <nickc@redhat.com>
9688 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9689
9690 2009-12-11 Doug Kwan <dougkwan@google.com>
9691
9692 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9693 due to -Wshadow.
9694 * attributes.cc (Object_attribute::size): Ditto.
9695 (Attributes_section_data::size): Ditto.
9696 (Attributes_section_data::Attributes_section_data): Ditto.
9697 (Output_attributes_section_data::do_write): Ditto.
9698 * attributes.h (Object_attribute::set_type): Ditto.
9699 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9700
9701 2009-12-11 Nick Clifton <nickc@redhat.com>
9702
9703 * archive.cc: Fix shadowed variable warnings.
9704 * arm.cc: Likewise.
9705 * compressed_output.cc: Likewise.
9706 * compressed_output.h: Likewise.
9707 * configure: Likewise.
9708 * dwarf_reader.cc: Likewise.
9709 * dynobj.cc: Likewise.
9710 * dynobj.h: Likewise.
9711 * ehframe.cc: Likewise.
9712 * ehframe.h: Likewise.
9713 * errors.cc: Likewise.
9714 * expression.cc: Likewise.
9715 * fileread.cc: Likewise.
9716 * fileread.h: Likewise.
9717 * freebsd.h: Likewise.
9718 * i386.cc: Likewise.
9719 * icf.cc: Likewise.
9720 * incremental.h: Likewise.
9721 * layout.cc: Likewise.
9722 * layout.h: Likewise.
9723 * mapfile.cc: Likewise.
9724 * merge.cc: Likewise.
9725 * merge.h: Likewise.
9726 * object.cc: Likewise.
9727 * object.h: Likewise.
9728 * options.h: Likewise.
9729 * output.cc: Likewise.
9730 * output.h: Likewise.
9731 * parameters.cc: Likewise.
9732 * plugin.cc: Likewise.
9733 * powerpc.cc: Likewise.
9734 * reduced_debug_output.cc: Likewise.
9735 * reduced_debug_output.h: Likewise.
9736 * reloc.cc: Likewise.
9737 * reloc.h: Likewise.
9738 * resolve.cc: Likewise.
9739 * script-sections.cc: Likewise.
9740 * script.cc: Likewise.
9741 * script.h: Likewise.
9742 * sparc.cc: Likewise.
9743 * symtab.cc: Likewise.
9744 * symtab.h: Likewise.
9745 * target-select.cc: Likewise.
9746 * target-select.h: Likewise.
9747 * token.h: Likewise.
9748 * workqueue.cc: Likewise.
9749 * workqueue.h: Likewise.
9750 * x86_64.cc: Likewise.
9751
9752 2009-12-10 Doug Kwan <dougkwan@google.com>
9753
9754 * arm.cc (attributes.h): New include.
9755 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9756 (Arm_relobj::~Arm_relobj): Delete object pointed by
9757 attributes_section_data_.
9758 (Arm_relobj::attributes_section_data): New method definition.
9759 (Arm_relobj::attributes_section_data_): New data member declaration.
9760 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9761 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9762 attributes_section_data_.
9763 (Arm_dynobj::attributes_section_data): New method definition.
9764 (Arm_dynobj::attributes_section_data_): New data member declaration.
9765 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
9766 initialization value of may_use_blx_ to false.
9767 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9768 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9769 object attributes to compute results instead of hard-coding.
9770 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9771 Target_arm::get_secondary_compatible_arch,
9772 Target_arm::set_secondary_compatible_arch
9773 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9774 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9775 New method declarations.
9776 (Target_arm::get_aeabi_object_attribute): New method definition.
9777 (Target_arm::attributes_section_data_): New data member declaration.
9778 (read_arm_attributes_section): New template definition.
9779 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9780 (Arm_dynobj::do_read_symbols): Ditto.
9781 (Target_arm::do_finalize_sections): Merge attributes sections from
9782 input. Check for BLX use after attributes section merging.
9783 Fix __exidx_start and __exidx_end visibility. Create an
9784 .ARM.attributes section if necessary.
9785 (Target_arm::get_secondary_compatible_arch,
9786 Target_arm::set_secondary_compatible_arch,
9787 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9788 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9789 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9790 New method definitions.
9791
9792 2009-12-09 Ian Lance Taylor <iant@google.com>
9793
9794 * plugin.cc (Plugin::load): Don't cast from void* to a function
9795 pointer.
9796
9797 2009-12-09 Ian Lance Taylor <iant@google.com>
9798
9799 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9800 information fields.
9801
9802 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
9803
9804 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9805 Replace two_file_shared_1.so with two_file_shared_2.so.
9806 * testsuite/Makefile.in: Regenerated.
9807
9808 2009-12-08 Doug Kwan <dougkwan@google.com>
9809
9810 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9811 (HFILES): Add attributes.h and int_encoding.h.
9812 * Makefile.in: Regenerate.
9813 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9814 function definitions to int_encoding.cc
9815 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9816 prototypes to int_encoding.h
9817 * reduced_debug_output.cc (int_encoding.h): New include.
9818 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9819 function definitions to int_encoding.cc
9820 (insert_into_vector, read_from_pointer): Move template definitions to
9821 int_encoding.h
9822 * attributes.cc: New file.
9823 * attributes.h: New file.
9824 * int_encoding.cc: New file.
9825 * int_encoding.h: New file.
9826
9827 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
9828
9829 PR gold/11055
9830 * incremental-dump.cc (dump_incremental_inputs): New.
9831 (main): Use dump_incremental_inputs.
9832
9833 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
9834
9835 PR gold/10893
9836 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9837 checking elfcpp::STT_FUNC.
9838 (Target_i386::Relocate::relocate): Likewise.
9839 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9840
9841 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9842 symbols from shared libraries into normal FUNC symbols.
9843
9844 * symtab.h (Symbol): Add is_func and use it.
9845
9846 2009-12-05 Doug Kwan <dougkwan@google.com>
9847
9848 * arm.cc (Target_arm::arm_info): Initialize new fields
9849 attributes_section and attributes_vendor.
9850 * i386.cc (Target_i386::i386_info): Same.
9851 * object.cc (Sized_relobj::do_layout): Skip attribute section.
9852 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9853 fields attributes_section and attributes_vendor.
9854 * sparc.cc (Target_sparc::sparc_info): Same.
9855 * target.h (Target::attributes_section, Target::attributes_vendor,
9856 Target::is_attributes_section, Target::attribute_arg_type,
9857 Target::attributes_order): New method definitions.
9858 (Target::Target_info::attributes_section,
9859 Target::Target_info::attributes_vendor): New fields.
9860 (Target::do_attribute_arg_type, Target::do_attributes_order): New
9861 virtual method definitions.
9862 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9863 attributes_section and attributes_vendor.
9864 * testsuite/testfile.cc (Target_test::test_target_info): Same.
9865
9866 2009-12-05 Doug Kwan <dougkwan@google.com>
9867
9868 * arm.cc: Update comments about interworking and stub generation.
9869 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9870 considered as non-PIC.
9871 (Arm_relocate_functions::base_abs): Fix formatting.
9872 (Arm_relocate_functions::got_prel): Fix comment. Change interface
9873 of function to use GOT entry address instead of offset.
9874 (Target_arm::Scan::global): Issue an error if a symbol would need a
9875 PLT does not get one because it is untyped. Remove code to create
9876 dynamic symbols for relative branches.
9877 (Target_arm::Relocate::relocate: Use 0 instead of false since function
9878 takes unsigned integer instead of boolean.
9879
9880 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
9881
9882 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9883 (two_file_test_LDADD): Likewise.
9884 (common_test_1_LDADD): Likewise.
9885 (exception_test_LDADD) Likewise.
9886 (weak_test_LDADD): Likewise.
9887 (many_sections_test_LDADD): Likewise.
9888 (initpri1_LDADD): Likewise.
9889 (script_test_1_LDADD): Likewise.
9890 (script_test_2_LDADD): Likewise.
9891 (justsyms_LDADD): Likewise.
9892 (binary_test_LDADD): Likewise.
9893 (large_LDADD): Likewise.
9894 * testsuite/Makefile.in: Regenerated.
9895
9896 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
9897
9898 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9899 (Symbol_table::override_with_special): Likewise.
9900 (Symbol_table::add_from_object): Likewise.
9901
9902 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9903
9904 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9905 Don't set the data_offset twice.
9906
9907 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9908
9909 * testsuite/Makefile.in: Regenerate.
9910
9911 2009-12-03 Doug Kwan <dougkwan@google.com>
9912
9913 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9914 (Target_arm::do_finalize_sections): Add parameter for symbol table
9915 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
9916 * i386.cc (Target_i386::do_finalize_sections): Add an additional
9917 parameter for symbol table pointer.
9918 * layout.cc (Layout::finalize): Call Target::finalize_sections with
9919 an additional parameter for a pointer to symbol table.
9920 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9921 parameter for a symbol table pointer.
9922 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9923 * target.h (Target::finalize_sections, Target::do_finalize_sections):
9924 Ditto.
9925 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9926 parameter for a symbol table pointer.
9927
9928 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
9929
9930 * incremental.cc (Incremental_inputs_header)
9931 (Incremental_inputs_header_write, Incremental_inputs_entry)
9932 (Incremental_inputs_entry_write): Move ...
9933 * incremental.h (Incremental_inputs_header)
9934 (Incremental_inputs_header_write, Incremental_inputs_entry)
9935 (Incremental_inputs_entry_write): here.
9936
9937 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9938
9939 * incremental.cc (make_sized_incremental_binary): Set the target.
9940 Error if it is incompatible.
9941 * output.h (Output_file): Add filename method.
9942
9943 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9944
9945 * incremental.cc (Incremental_inputs_entry): Remove unused argument
9946 from the get_* methods.
9947
9948 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9949
9950 * incremental-dump.cc (main): Check that the offeset of a script is 0.
9951 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9952 Write 0 for the data_offset of scripts.
9953
9954 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9955
9956 * testsuite/Makefile.am: Add the incremental_test.sh test.
9957 * testsuite/incremental_test.sh: New.
9958 * testsuite/incremental_test_1.c: New.
9959 * testsuite/incremental_test_2.c: New.
9960
9961 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
9962
9963 * incremental-dump.cc (main): Fix typos.
9964
9965 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
9966
9967 PR gold/11025
9968 * incremental-dump.cc (main): Use llu to print 64 bit values.
9969
9970 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
9971 H.J. Lu <hongjiu.lu@intel.com>
9972
9973 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9974 $(LIBDL).
9975 (incremental_dump_LDADD): Likewise.
9976 * Makefile.in: Regenerated.
9977
9978 2009-11-25 Doug Kwan <dougkwan@google.com>
9979
9980 Revert:
9981
9982 2009-11-25 Doug Kwan <dougkwan@google.com>
9983
9984 * arm.cc (Target_arm::Target_arm): Move method definition
9985 outside of class definition. Add code to handle
9986 --target1-rel, --target1-abs and --target2= options.
9987 (Target_arm::get_reloc_reloc_type): Change method to be
9988 non-static and const.
9989 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9990 New data member declaration.
9991 (Target_arm::Scan::local, Target_arm::Scan::global,
9992 Target_arm::Relocate::relocate,
9993 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9994 Adjust call to Target_arm::get_real_reloc_type.
9995 (Target_arm::get_real_reloc_type): Use command line options
9996 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9997 * options.h (--target1-rel, --target1-abs, --target2): New
9998 ARM-only options.
9999
10000 2009-11-25 Doug Kwan <dougkwan@google.com>
10001
10002 * arm.cc (Target_arm::Target_arm): Move method definition outside of
10003 class definition. Add code to handle --target1-rel, --target1-abs
10004 and --target2= options.
10005 (Target_arm::get_reloc_reloc_type): Change method to be non-static
10006 and const.
10007 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10008 member declaration.
10009 (Target_arm::Scan::local, Target_arm::Scan::global,
10010 Target_arm::Relocate::relocate,
10011 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10012 call to Target_arm::get_real_reloc_type.
10013 (Target_arm::get_real_reloc_type): Use command line options to
10014 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10015 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10016 options.
10017
10018 2009-11-25 Doug Kwan <dougkwan@google.com>
10019
10020 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10021 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10022 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10023 formatting.
10024 (Arm_relocate_functions::thm_call): Replace body with a call to
10025 Arm_relocate_functions::thumb_branch_common.
10026 (Arm_relocate_functions::thm_jump24,
10027 Arm_relocate_functions::thm_xpc22): New method definitions.
10028 (Arm_relocate_functions::thumb_branch_common): New method definition.
10029 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10030 operator.
10031 (Target_arm::Relocate::relocate): Adjust call to thm_call.
10032 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10033
10034 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10035
10036 * Makefile.am: Build incremental-dump
10037 * Makefile.in: Regenerate.
10038 * incremental-dump.cc: New.
10039 * incremental.cc (Incremental_inputs_header_data,
10040 Incremental_inputs_entry_data): Move to incremental.h
10041 * incremental.h: (Incremental_inputs_header_data,
10042 Incremental_inputs_entry_data): Move from incremental.cc
10043
10044 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10045
10046 * incremental.cc (Incremental_inputs_header,
10047 Incremental_inputs_header_write, Incremental_inputs_entry,
10048 Incremental_inputs_entry_write): Add a typedef with the data type.
10049
10050 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10051
10052 * incremental.cc (Incremental_inputs_header,
10053 Incremental_inputs_header_write, Incremental_inputs_entry,
10054 Incremental_inputs_entry_write): Update comment about which
10055 type has the filed descriptions.
10056
10057 2009-11-15 Doug Kwan <dougkwan@google.com>
10058
10059 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10060 (Arm_relocate_functions::arm_branch_common): Change method defintion
10061 in class definition to a method declaration and update list of formal
10062 parameters.
10063 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10064 Arm_relocation_functions::jump24): Adjust call to
10065 Arm_relocate_functions::arm_branch_common. Update list of formal
10066 parameters.
10067 (Arm_relocate_functions::xpc25): New method definition.
10068 (Arm_relocate_functions::arm_branch_common): Move method defintion
10069 out from class definition. Use stubs for mode-switching and extending
10070 branch ranges.
10071 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10072 specially. Change code to enable use of stubs in ARM branches.
10073
10074 2009-11-10 Doug Kwan <dougkwan@google.com>
10075
10076 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10077 in method declaration.
10078 (Target_arm::relocate_stub): New method declaration.
10079 (Target_arm::default_target): Change to return a pointer instead of
10080 a const reference.
10081 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10082 Target_arm::default_target.
10083 (Arm_Relobj::do_relocate_sections): Remove options paramater in
10084 method definition.
10085 (Target_arm::relocate_section): Adjust view.
10086 (Target_arm::relocate_stub): New method definition.
10087
10088 2009-11-10 Doug Kwan <dougkwan@google.com>
10089
10090 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10091 a format warning.
10092 * incremental.cc (open_incremental_binary): Initialized local
10093 variables to avoid warnings.
10094 * object.cc (make_elf_object): Ditto.
10095 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10096 a format warning.
10097
10098 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
10099
10100 PR gold/10930
10101 * testsuite/plugin_test.c: Include "config.h".
10102
10103 2009-11-09 Doug Kwan <dougkwan@google.com>
10104
10105 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10106 (arm_symbol_value): Remove.
10107 (Arm_relocate_functions::arm_branch_common,
10108 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10109 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10110 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10111 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10112 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10113 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10114 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10115 Arm_relocate_functions::thm_mobw_abs_nc,
10116 Arm_relocate_functions::thm_mov_abs,
10117 Arm_relocate_functions::movw_prel_nc,
10118 Arm_relocate_functions::thm_movt_abs,
10119 Arm_relocate_functions::movt_prel,
10120 Arm_relocate_functions::thm_movw_prel_nc,
10121 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10122 (Target_arm::Relocate::relocate): Only decompose address into two
10123 parts if relocation type uses the thumb-bit and pass the actual
10124 bit instead of a flag indicating that the thumb-bit is used. Adjust
10125 calls to methods in Arm_relocate_functions for this change.
10126
10127 2009-11-08 Ian Lance Taylor <iant@google.com>
10128
10129 PR 10925
10130 * reloc.cc: Instantiate
10131 Sized_relobj::initialize_input_to_output_maps and
10132 Sized_relobj:free_input_to_output_maps.
10133
10134 2009-11-06 Ian Lance Taylor <iant@google.com>
10135
10136 PR 10876
10137 * defstd.cc (in_segment): Set only_if_ref true for "end".
10138
10139 2009-11-06 Doug Kwan <dougkwan@google.com>
10140
10141 * arm.cc (class Reloc_stub): Correct a comment.
10142 (Target_arm::Target_arm): Initialize arm_input_section_map_.
10143 (Target_arm::scan_section_for_stubs): New method declaration.
10144 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10145 Change methods from private to protected.
10146 (Target_arm::do_may_relax): New method definition.
10147 (Target_arm::do_relax, Target_arm::group_sections,
10148 Target_arm::scan_reloc_for_stub,
10149 Target_arm::scan_reloc_section_for_stubs): New method declarations.
10150 (Target_arm::arm_input_section_map_): New data member declaration.
10151 (Target_arm::scan_reloc_for_stub,
10152 Target_arm::scan_reloc_section_for_stubs,
10153 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10154 Target_arm::do_relax): New method definitions.
10155
10156 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
10157
10158 * configure.ac: Check for (struct stat)::st_mtim
10159 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10160 * config.in: Regenerate.
10161 * configure: Regenerate.
10162
10163 2009-11-05 Ian Lance Taylor <iant@google.com>
10164
10165 PR 10910
10166 * output.cc (Output_segment::add_output_section): Add missing
10167 return statement.
10168
10169 2009-11-04 Ian Lance Taylor <iant@google.com>
10170
10171 PR 10880
10172 * object.h (class Object): Add is_needed and set_is_needed
10173 methods. Add is_needed_ field. Make bool fields into bitfields.
10174 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10175 defined in a dynamic object and referenced by a regular object,
10176 set is_needed for the dynamic object.
10177 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10178 if the file is marked with as_needed and it is not needed.
10179
10180 2009-11-04 Ian Lance Taylor <iant@google.com>
10181
10182 PR 10887
10183 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10184 tags if data is discarded by linker script.
10185 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10186 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10187 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10188 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10189
10190 2009-11-04 Ian Lance Taylor <iant@google.com>
10191
10192 * layout.cc (Layout::get_output_section): Add is_interp and
10193 is_dynamic_linker_section parameters. Change all callers.
10194 (Layout::choose_output_section): Likewise.
10195 (Layout::make_output_section): Likewise.
10196 (Layout::add_output_section_data): Add is_dynamic_linker_section
10197 parameter. Change all callers.
10198 * layout.h (class Layout): Update declarations.
10199 * output.h (class Output_section): Add is_interp, set_is_interp,
10200 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10201 Add is_interp_, is_dynamic_linker_section_ fields. Change
10202 generate_code_fills_at_write_ to a bitfield.
10203 * output.cc (Output_section::Output_sections): Initialize new
10204 fields.
10205 (Output_segment::add_output_section): Add do_sort parameter.
10206 Change all callers.
10207
10208 2009-11-03 Ian Lance Taylor <iant@google.com>
10209
10210 PR 10860
10211 * options.h (class General_options): Add --warn-common.
10212 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10213 merging two common symbols.
10214 (Symbol_table::should_override): Handle --warn-common when merging
10215 a common symbol with a defined symbol. Use report_resolve_problem
10216 for multiple definitions.
10217 (Symbol_table::report_resolve_problem): New function.
10218 * symtab.h (class Symbol_table): Declare report_resolve_problem.
10219
10220 2009-11-03 Doug Kwan <dougkwan@google.com>
10221
10222 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10223 stub_factory_.
10224 (Target_arm::stub_factory): New method definition.
10225 (Target_arm::new_arm_input_section,
10226 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10227 Target_arm::reloc_uses_thumb_bit): New method declarations.
10228 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10229 New type definitions.
10230 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10231 member declarations.
10232 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10233 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10234 New method definitions.
10235
10236 2009-11-03 Ian Lance Taylor <iant@google.com>
10237
10238 * options.h (class General_options): Add --warn_constructors.
10239
10240 2009-11-03 Ian Lance Taylor <iant@google.com>
10241
10242 PR 10893
10243 * defstd.cc (in_section): Add entries for __rel_iplt_start,
10244 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10245
10246 2009-11-03 Ian Lance Taylor <iant@google.com>
10247
10248 PR 10895
10249 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10250 --msgid-bugs-address.
10251 (install-pdf): New target.
10252 (install-data_yes): Look up one directory to find mkinstalldirs.
10253
10254 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
10255
10256 * po/Make-in (.po.gmo): Don't generate .gmo files in source
10257 tree.
10258
10259 2009-10-30 Doug Kwan <dougkwan@google.com>
10260
10261 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10262
10263 2009-10-30 Doug Kwan <dougkwan@google.com>
10264
10265 * arm.cc (Stub_addend_reader): New struct template definition
10266 and partial specializations.
10267 (Stub_addend_reader::operator()): New method definition for a
10268 partially specialized template.
10269
10270 2009-10-30 Doug Kwan <dougkwan@google.com>
10271
10272 * arm.cc (Arm_relobj::processor_specific_flags): New method
10273 definition.
10274 (Arm_relobj::do_read_symbols): New method declaration.
10275 (Arm_relobj::processor_specific_flags_): New data member declaration.
10276 (Arm_dynobj): New class definition.
10277 (Target_arm::do_finalize_sections): Add input_objects parameter.
10278 (Target_arm::do_adjust_elf_header): New method declaration.
10279 (Target_arm::are_eabi_versions_compatible,
10280 (Target_arm::merge_processor_specific_flags): New method declaration.
10281 (Target_arm::do_make_elf_object): New overloaded method definitions
10282 and declaration.
10283 (Arm_relobj::do_read_symbols): New method definition.
10284 (Arm_dynobj::do_read_symbols): Ditto.
10285 (Target_arm::do_finalize_sections): Add input_objects parameters.
10286 Merge processor-specific flags from all input objects.
10287 (Target_arm::are_eabi_versions_compatible,
10288 Target_arm::merge_processor_specific_flags,
10289 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10290 New method definitions.
10291 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10292 Input_objects pointer type parameter.
10293 * layout.cc (Layout::finalize): Pass input objects to target's.
10294 finalize_sections function.
10295 * output.cc (Output_file_header::do_sized_write): Set ELF file
10296 header's processor-specific flags.
10297 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10298 Input_objects pointer type parameter.
10299 * sparc.cc (Target_sparc::do_finalize_sections): Same.
10300 * target.h (Input_objects): New forward class declaration.
10301 (Target::processor_specific_flags,
10302 Target::are_processor_specific_flags_sect): New method definitions.
10303 (Target::finalize_sections): Add input_objects parameter.
10304 (Target::Target): Initialize processor_specific_flags_ and
10305 are_processor_specific_flags_set_.
10306 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10307 parameter.
10308 (Target::set_processor_specific_flags): New method definition.
10309 (Target::processor_specific_flags_,
10310 Target::are_processor_specific_flags_set_): New data member
10311 declarations.
10312 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10313 Input_objects pointer type parameter.
10314
10315 2009-10-30 Doug Kwan <dougkwan@google.com>
10316
10317 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10318
10319 2009-10-28 Ian Lance Taylor <iant@google.com>
10320
10321 * object.h (class Relobj): Drop options parameter from
10322 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10323 do_scan_relocs, do_relocate. Change all callers.
10324 (class Sized_relobj): Drop options parameters from
10325 do_gc_process_relocs, do_scan_relocs, do_relocate,
10326 do_relocate_sections, relocate_sections, emit_relocs_scan,
10327 emit_relocs_scan_reltype. Change all callers.
10328 (struct Relocate_info): Remove options field and all references to
10329 it.
10330 * reloc.h (class Read_relocs): Remove options constructor
10331 parameter and options_ field. Change all callers.
10332 (class Gc_process_relocs, class Scan_relocs): Likewise.
10333 (class Relocate_task): Likewise.
10334 * target-reloc.h (scan_relocs): Remove options parameter. Change
10335 all callers.
10336 (scan_relocatable_relocs): Likewise.
10337 * target.h (class Sized_target): Remove options parameter from
10338 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
10339 all callers.
10340 * gc.h (gc_process_relocs): Remove options parameter. Change all
10341 callers.
10342 * arm.cc: Update functions to remove options parameters.
10343 * i386.cc: Likewise.
10344 * powerpc.cc: Likewise.
10345 * sparc.cc: Likewise.
10346 * x86_64.cc: Likewise.
10347 * testsuite/testfile.cc: Likewise.
10348
10349 2009-10-28 Doug Kwan <dougkwan@google.com>
10350
10351 * arm.cc (Arm_relobj): New class definition.
10352 (Arm_relobj::scan_sections_for_stubs,
10353 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10354 New method definitions.
10355
10356 2009-10-28 Cary Coutant <ccoutant@google.com>
10357
10358 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10359 (Plugin::cleanup_done_): New member.
10360 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10361 (Plugin_manager::cleanup_done_): Remove.
10362 (Plugin_manager::add_input_file): Edit error message.
10363 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10364 (Plugin_manager::cleanup): Remove use of cleanup_done_.
10365
10366 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
10367
10368 * fileread.cc: (File_read::View::~View): Use the new
10369 data_ownership_ filed.
10370 (File_read::~File_read): Dispose the new whole_file_view_.
10371 (File_read::open): Mmap the whole file if needed.
10372 (File_read::open): Use whole_file_view_ instead of contents_.
10373 (File_read::find_view): Use whole_file_view_ if applicable.
10374 (File_read::do_read): Use whole_file_view_ instead of contents_.
10375 (File_read::make_view): Use whole_file_view_ instead of contents_,
10376 update File_read::View::View call.
10377 (File_read::find_or_make_view): Update File_read::View::View
10378 call.
10379 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10380 remove contents_
10381 (File_read::View::Data_ownership): New enum.
10382 (File_read::View::View): Replace bool mapped_ with Data_ownership
10383 argument.
10384 (File_read::View::mapped_): Remove (replaced by data_ownership_).
10385 (File_read::View::data_ownership_): New field.
10386 (File_read::contents_): Remove (replaced by whole_file_view_).
10387 (File_read::whole_file_view_): New field.
10388 * options.h (class General_options): Add --keep-files-mapped.
10389
10390 2009-10-27 Cary Coutant <ccoutant@google.com>
10391
10392 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10393 * testsuite/Makefile.am (plugin_test_5): New test case.
10394 * testsuite/Makefile.in: Regenerate.
10395
10396 2009-10-25 Doug Kwan <dougkwan@google.com>
10397
10398 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10399 from private to protected to allow access by child class.
10400 (Sized_relobj::do_relocate_sections): New method declaration.
10401 (Sized_relobj::relocate_sections): Virtualize.
10402 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10403 Sized_relobj::relocate_sections. Instantiate template explicitly
10404 for different target sizes and endianity.
10405
10406 2009-10-24 Doug Kwan <dougkwan@google.com>
10407
10408 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10409 (Arm_input_section::as_arm_input_section): New method.
10410 (Arm_output_section): New class definition.
10411 (Arm_output_section::create_stub_group,
10412 Arm_output_section::group_sections): New method definitions.
10413
10414 2009-10-22 Doug Kwan <dougkwan@google.com>
10415
10416 * arm.cc (Arm_input_section): New class definition.
10417 (Arm_input_section::init, Arm_input_section:do_write,
10418 Arm_input_section::set_final_data_size,
10419 Arm_input_section::do_reset_address_and_file_offset): New method
10420 definitions.
10421
10422 2009-10-21 Doug Kwan <dougkwan@google.com>
10423
10424 * arm.cc (Stub_table, Arm_input_section): New forward class
10425 declarations.
10426 (Stub_table): New class defintion.
10427 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10428 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10429 New method definition.
10430
10431 2009-10-21 Doug Kwan <dougkwan@google.com>
10432
10433 * arm.cc: Update copyright comments.
10434 (Target_arm): New forward class template declaration.
10435 (Arm_address): New type.
10436 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10437 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10438 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10439 constants.
10440 (Insn_template): Same.
10441 (DEF_STUBS): New macro.
10442 (Stub_type): New enum type.
10443 (Stub_template): New class definition.
10444 (Stub): Same.
10445 (Reloc_stub): Same.
10446 (Stub_factory): Same.
10447 (Target_arm::Target_arm): Initialize may_use_blx_ and
10448 should_force_pic_veneer_.
10449 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10450 Target_arm::should_force_pic_veneer,
10451 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10452 Target_arm::using_thumb_only, Target_arm:;default_target): New
10453 method defintions.
10454 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10455 New data member declarations.
10456 (Insn_template::size, Insn_template::alignment): New method defintions.
10457 (Stub_template::Stub_template): New method definition.
10458 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10459 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10460 (Stub_factory::Stub_factory): New method definition.
10461 * gold.h (string_hash): New template.
10462 * output.h (Input_section_specifier::hash_value): Use
10463 gold::string_hash.
10464 (Input_section_specifier::string_hash): Remove.
10465 * stringpool.cc (Stringpool_template::string_hash): Use
10466 gold::string_hash.
10467
10468 2009-10-20 Doug Kwan <dougkwan@google.com>
10469
10470 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10471 symbols of relaxed input sections.
10472 * output.h (Output_section::find_relaxed_input_section): Make
10473 method public.
10474
10475 2009-10-16 Doug Kwan <dougkwan@google.com>
10476
10477 * dynobj.cc (Versions::Versions): Initialize version_script_.
10478 Only insert base version symbol definition for a shared object
10479 if version script defines any version versions.
10480 (Versions::define_base_version): New method definition.
10481 (Versions::add_def): Check that base version is not needed.
10482 (Versions::add_need): Define base version lazily.
10483 * dynobj.h (Versions::define_base_version): New method declaration.
10484 (Versions::needs_base_version_): New data member declaration.
10485 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10486 (check_DATA): Add no_version_test.stdout.
10487 (libno_version_test.so, no_version_test.o no_version_test.stdout):
10488 New make rules.
10489 * testsuite/Makefile.in: Regenerate.
10490 * testsuite/no_version_test.c: New file.
10491 * testsuite/no_version_test.sh: Ditto.
10492
10493 2009-10-16 Doug Kwan <dougkwan@google.com>
10494
10495 * expression.cc (class Segment_start_expression): New class definition.
10496 (Segment_start_expression::value): New method definition.
10497 (script_exp_function_segment_start): Return a new
10498 Segment_start_expression.
10499 * gold/script-c.h (script_saw_segment_start_expression): New function
10500 prototype.
10501 * script-sections.cc (Script_sections::Script_sections): Initialize
10502 SAW_SEGMENT_START_EXPRESSION_ to false.
10503 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10504 and -Tbbs options to specify section addresses if given in
10505 command line and no SEGMENT_START expression is seen in a script.
10506 * script-sections.h (Script_sections::saw_segment_start_expression,
10507 Script_sections::set_saw_segment_start_expression): New method
10508 definition.
10509 (Script_sections::saw_segment_start_expression_): New data member
10510 declaration.
10511 * script.cc (script_saw_segment_start_expression): New function.
10512 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10513 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10514 script_test_7.sh and script_test_8.sh.
10515 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10516 script_test_8.stdout.
10517 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10518 (script_test_6, script_test_6.stdout, script_test_7,
10519 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10520 * Makefile.in: Regenerate.
10521 * testsuite/script_test_6.sh: New file.
10522 * testsuite/script_test_6.t: Same.
10523 * testsuite/script_test_7.sh: Same.
10524 * testsuite/script_test_7.t: Same.
10525 * testsuite/script_test_8.sh: Same.
10526
10527 2009-10-16 Doug Kwan <dougkwan@google.com>
10528
10529 * output.cc (Output_segment::set_section_list_address): Cast
10530 expressions to unsigned long long type to avoid format warnings.
10531
10532 2009-10-15 Ian Lance Taylor <iant@google.com>
10533
10534 * script.cc (Script_options::add_symbol_assignment): Always add a
10535 dot assignment to script_sections_.
10536 * script-sections.cc (Script_sections::add_dot_assignment):
10537 Initialize if necessary.
10538
10539 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10540 program headers with no load segment if there is a linker script.
10541
10542 * layout.cc (Layout::set_segment_offsets): Align the file offset
10543 to the segment aligment for -N or -n with no load segment.
10544 * output.cc (Output_segment::add_output_section): Don't crash if
10545 the first section is a TLS section.
10546 (Output_segment::set_section_list_addresses): Print an error
10547 message if the address moves backward in a linker script.
10548 * script-sections.cc
10549 (Output_section_element_input::set_section_addresses): Don't
10550 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10551 (Orphan_output_section::set_section_addresses): Likewise.
10552
10553 2009-10-15 Doug Kwan <dougkwan@google.com>
10554
10555 * layout.cc (Layout::finish_dynamic_section): Generate tags
10556 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10557 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10558 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10559
10560 2009-10-14 Ian Lance Taylor <iant@google.com>
10561
10562 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10563 fields.
10564 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10565 data_shdr fields of relinfo.
10566 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10567 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
10568 R_386_TLS_LDO_32, adjust based on section flags.
10569 (Target_i386::Relocate::fix_up_ldo): Remove.
10570
10571 2009-10-13 Ian Lance Taylor <iant@google.com>
10572
10573 Add support for -pie.
10574 * options.h (class General_options): Add -pie and
10575 --pic-executable.
10576 (General_options::output_is_position_independent): Test -pie.
10577 (General_options::output_is_executable): Return true if not shared
10578 and not relocatable.
10579 (General_options::output_is_pie): Remove.
10580 * options.cc (General_options::finalize): Reject incompatible uses
10581 of -pie.
10582 * gold.cc (queue_middle_tasks): A -pie link is not static.
10583 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10584 * symtab.cc (Symbol::final_value_is_known): Return false if
10585 output_is_position_independent.
10586 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10587 output_is_position_independent.
10588 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10589 output_is_position_independent.
10590 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10591 output_is_position_independent.
10592 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10593 two_file_pie_test.
10594 (basic_pie_test.o, basic_pie_test): New targets.
10595 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10596 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10597 (two_file_pie_test): New target.
10598 * testsuite/Makefile.in: Rebuild.
10599 * README: Remove note saying that -pie is not supported.
10600
10601 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
10602
10603 * options.h (class General_options): Add -init and -fini.
10604 * layout.cc (Layout::finish_dynamic_section): Emit
10605 given init and fini functions.
10606
10607 2009-10-13 Sriraman Tallam <tmsriram@google.com>
10608
10609 * gc.h (gc_process_relocs): Check if icf is enabled using new
10610 function.
10611 * gold.cc (queue_initial_tasks): Likewise.
10612 (queue_middle_tasks): Likewise.
10613 * object.cc (do_layout): Likewise.
10614 * symtab.cc (is_section_folded): Likewise.
10615 * main.cc (main): Likewise.
10616 * reloc.cc (Read_relocs::run): Likewise.
10617 (Sized_relobj::do_scan_relocs): Likewise.
10618 * icf.cc (is_function_ctor_or_dtor): New function.
10619 (Icf::find_identical_sections): Check if function is ctor or dtor when
10620 safe icf is chosen.
10621 * options.h (General_options::icf): Change option to be an enum.
10622 (Icf_status): New enum.
10623 (icf_enabled): New method.
10624 (icf_safe_folding): New method.
10625 (set_icf_status): New method.
10626 (icf_status_): New variable.
10627 * (options.cc) (General_options::finalize): Set icf_status_.
10628 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10629 icf_test and icf_keep_unique_test to use the --icf enum flag.
10630 * testsuite/icf_safe_test.sh: New file.
10631 * testsuite/icf_safe_test.cc: New file.
10632
10633 2009-10-12 Sriraman Tallam <tmsriram@google.com>
10634
10635 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10636 includes to gc.h and icf.h.
10637 * arm.cc: Include gc.h.
10638 * gold.cc: Likewise.
10639 * i386.cc: Likewise.
10640 * powerpc.cc: Likewise.
10641 * sparc.cc: Likewise.
10642 * x86_64.cc: Likewise.
10643 * gc.h: Include icf.h.
10644
10645 2009-10-11 Ian Lance Taylor <iant@google.com>
10646
10647 * plugin.cc: Include "gold.h" before other header files.
10648
10649 2009-10-10 Chris Demetriou <cgd@google.com>
10650
10651 * options.h (Input_file_argument::Input_file_type): New enum.
10652 (Input_file_argument::is_lib_): Replace with...
10653 (Input_file_argument::type_): New member.
10654 (Input_file_argument::Input_file_argument): Take Input_file_type
10655 'type' rather than boolean 'is_lib' as second argument.
10656 (Input_file_argument::is_lib): Use type_.
10657 (Input_file_argument::is_searched_file): New function.
10658 (Input_file_argument::may_need_search): Handle is_searched_file.
10659 * options.cc (General_options::parse_library): Support -l:filename.
10660 (General_options::parse_just_symbols): Update for Input_file_argument
10661 changes.
10662 (Command_line::process): Likewise.
10663 * archive.cc (Archive::get_file_and_offset): Likewise.
10664 * plugin.cc (Plugin_manager::release_input_file): Likewise.
10665 * script.cc (read_script_file, script_add_file): Likewise.
10666 * fileread.cc (Input_file::Input_file): Likewise.
10667 (Input_file::will_search_for): Handle is_searched_file.
10668 (Input_file::open): Likewise.
10669 * readsyms.cc (Read_symbols::get_name): Likewise.
10670 * testsuite/Makefile.am (searched_file_test): New test.
10671 * testsuite/Makefile.in: Regenerate.
10672 * testsuite/searched_file_test.cc: New file.
10673 * testsuite/searched_file_test_lib.cc: New file.
10674
10675 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10676 Ian Lance Taylor <iant@google.com>
10677
10678 * descriptor.cc: Include <cstdio> and "binary-io.h".
10679 (Descriptors::open): Open the files in binary mode always.
10680 * script.cc (Lex::get_token): Treat \r as whitespace.
10681
10682 2009-10-09 Ian Lance Taylor <iant@google.com>
10683
10684 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10685
10686 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10687 Ian Lance Taylor <iant@google.com>
10688
10689 * configure.ac: Check for readv function also.
10690 * fileread.cc (readv): Define if not HAVE_READV.
10691 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10692 does not exist.
10693 * config.in: Regenerate.
10694 * configure: Regenerate.
10695
10696 2009-10-09 Doug Kwan <dougkwan@google.com>
10697
10698 * layout.cc (Layout::make_output_section): Call target hook to make
10699 ordinary output section.
10700 (Layout::finalize): Adjust parameter list of call the
10701 Target::may_relax().
10702 * layout.h (class Layout::section_list): New method.
10703 * merge.h (Output_merge_base::entsize): Change visibility to public.
10704 (Output_merge_base::is_string, Output_merge_base::do_is_string):
10705 New methods.
10706 (Output_merge_string::do_is_string): New method.
10707 * object.cc (Sized_relobj::do_setup): renamed from
10708 Sized_relobj::set_up.
10709 * object.h (Sized_relobj::adjust_shndx,
10710 Sized_relobj::initializ_input_to_output_maps,
10711 Sized_relobj::free_input_to_output_maps): Change visibilities to
10712 protected.
10713 (Sized_relobj::setup): Virtualize.
10714 (Sized_relobj::do_setup): New method declaration.
10715 (Sized_relobj::invalidate_section_offset,
10716 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10717 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10718 * options.cc (parse_int): New function.
10719 * options.h (parse_int): New declaration.
10720 (DEFINE_int): New macro.
10721 (stub_group_size): New option.
10722 * output.cc (Output_section::Output_section): Initialize memebers
10723 merge_section_map_, merge_section_by_properties_map_,
10724 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10725 (Output_section::add_input_section): Handled deferred code-fill
10726 generation and remove an old comment.
10727 (Output_section::add_relaxed_input_section): New method definition.
10728 (Output_section::add_merge_input_section): Use merge section by
10729 properties map to speed to search. Update merge section maps
10730 as appropriate.
10731 (Output_section::build_relaxation_map): New method definition.
10732 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10733 Same.
10734 (Output_section::relax_input_section): Renamed to
10735 Output_section::convert_input_sections_to_relaxed_sections and change
10736 interface to take a vector of pointers to relaxed sections.
10737 (Output_section::find_merge_section,
10738 Output_section::find_relaxed_input_section): New method definitions.
10739 (Output_section::is_input_address_mapped,
10740 Output_section::output_offset, Output_section::output_address):
10741 Use output section data maps to speed up searching.
10742 (Output_section::find_starting_output_address): Add comments.
10743 (Output_section::do_write,
10744 Output_section::write_to_postprocessing_buffer): Do code-fill
10745 generation as appropriate.
10746 (Output_section::get_input_sections): Invalidate relaxed input section
10747 map.
10748 (Output_section::restore_states): Adjust type of checkpoint .
10749 Invalidate relaxed input section map.
10750 * output.h (Output_merge_base): New class declaration.
10751 (Input_section_specifier): New class defintion.
10752 (class Output_relaxed_input_section) Change base class to
10753 Output_section_data_build.
10754 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10755 base class initializer.
10756 (Output_section::add_relaxed_input_section): New method declaration.
10757 (Output_section::Input_section): Change visibility to protected.
10758 (Output_section::Input_section::relobj,
10759 Output_section::Input_section::shndx): Handle relaxed input sections.
10760 Output_section::input_sections) Change visibility to protected. Also
10761 define overload to return a non-const pointer.
10762 (Output_section::Merge_section_properties): New class defintion.
10763 (Output_section::Merge_section_by_properties_map,
10764 Output_section::Output_section_data_by_input_section_map,
10765 Output_section::Relaxation_map): New types.
10766 (Output_section::relax_input_section): Rename method to
10767 Output_section::convert_input_sections_to_relaxed_sections and change
10768 interface to take a vector of relaxed section pointers.
10769 (Output_section::find_merge_section,
10770 Output_section::find_relaxed_input_section,
10771 Output_section::build_relaxation_map,
10772 Output_section::convert_input_sections_in_list_to_relaxed_sections):
10773 New method declarations.
10774 (Output_section::merge_section_map_
10775 Output_section::merge_section_by_properties_map_,
10776 Output_section::relaxed_input_section_map_,
10777 Output_section::is_relaxed_input_section_map_valid_,
10778 Output_section::generate_code_fills_at_write_): New data members.
10779 * script-sections.cc
10780 (Output_section_element_input::set_section_addresses): Call
10781 current_data_size and addralign methods of relaxed input sections.
10782 (Orphan_output_section::set_section_addresses): Call current_data_size
10783 and addralign methods of relaxed input sections.
10784 * symtab.cc (Symbol_table::compute_final_value): Extract template
10785 from the body of Symbol_table::sized_finalize_symbol.
10786 (Symbol_table::sized_finalized_symbol): Call
10787 Symbol_table::compute_final_value.
10788 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10789 (Symbol_table::compute_final_value): New templated method declaration.
10790 * target.cc (Target::do_make_output_section): New method defintion.
10791 * target.h (Target::make_output_section): New method declaration.
10792 (Target::relax): Add more parameters for input objects, symbol table
10793 and layout. Adjust call to do_relax.
10794 (Target::do_make_output_section): New method declaration.
10795 (Target::do_relax): Add parameters for input objects, symbol table
10796 and layout.
10797
10798 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10799
10800 * pread.c: Include stdio.h.
10801
10802 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10803
10804 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10805 defined.
10806
10807 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10808
10809 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10810 Change read_shndx type to unsigned int.
10811 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10812 int.
10813 (Sized_dwarf_line_info::read_line_mappings): Likewise.
10814 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10815 Change read_shndx type to unsigned int.
10816 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10817 int.
10818 (Sized_dwarf_line_info::read_line_mappings): Likewise.
10819 * layout.cc (Layout::create_symtab_sections): Cast the result of
10820 local_symcount * symsize to off_t in the gold_assert.
10821
10822 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10823
10824 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10825 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10826 R_ARM_BASE_ABS.
10827 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10828 (Arm_relocate_functions::thm_abs5): New function.
10829 (Arm_relocate_functions::abs12): New function.
10830 (Arm_relocate_functions::abs16): New function.
10831 (Arm_relocate_functions::base_abs): New function.
10832 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10833 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
10834 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10835 R_ARM_BASE_ABS.
10836 (Scan::global): Likewise.
10837 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10838 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10839 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10840 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10841 R_ARM_BASE_ABS.
10842
10843 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10844
10845 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10846 (Arm_relocate_functions::movt_prel): New function.
10847 (Arm_relocate_functions::thm_movw_prel_nc): New function.
10848 (Arm_relocate_functions::thm_movt_prel): New function.
10849 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10850 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10851 (Scan::global, Relocate::relocate): Likewise.
10852 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10853
10854 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10855
10856 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10857 Incremental_checker.
10858 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10859 unsigned int.
10860 (class Incremental_inputs_header): New class.
10861 (Incremental_inputs_header_writer): Edit comment.
10862 (Incremental_inputs_entry): New class.
10863 (Incremental_inputs_entry_writer): Edit comment.
10864 (Sized_incremental_binary::do_find_incremental_inputs_section):
10865 Add *strtab_shndx parameter, fill it.
10866 (Sized_incremental_binary::do_check_inputs): New method.
10867 (Incremental_checker::can_incrementally_link_output_file): Use
10868 Sized_incremental_binary::check_inputs.
10869 (Incremental_inputs::report_command_line): Save command line in
10870 command_line_.
10871 * incremental.h:
10872 (Incremental_binary::find_incremental_inputs_section): New
10873 method.
10874 (Incremental_binary::do_find_incremental_inputs_section): Add
10875 strtab_shndx parameter.
10876 (Incremental_binary::do_check_inputs): New pure virtual method.
10877 (Sized_incremental_binary::do_check_inputs): Declare.
10878 (Incremental_checker::Incremental_checker): Add incremental_inputs
10879 parameter, use it to initialize incremental_inputs_.
10880 (Incremental_checker::incremental_inputs_): New field.
10881 (Incremental_checker::command_line): New method.
10882 (Incremental_checker::inputs): New method.
10883 (Incremental_checker::command_line_): New field.
10884
10885 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10886
10887 * incremental.cc: Include <cstdarg> and "target-select.h".
10888 (vexplain_no_incremental): New function.
10889 (explain_no_incremental): New function.
10890 (Incremental_binary::error): New method.
10891 (Sized_incremental_binary::do_find_incremental_inputs_section): New
10892 method.
10893 (make_sized_incremental_binary): New function.
10894 (open_incremental_binary): New function.
10895 (can_incrementally_link_file): Add checks if output is ELF and has
10896 inputs section.
10897 * incremental.h: Include "elfcpp_file.h" and "output.h".
10898 (Incremental_binary): New class.
10899 (Sized_incremental_binary): New class.
10900 (open_incremental_binary): Declare.
10901 * object.cc (is_elf_object): Use
10902 elfcpp::Elf_recognizer::is_elf_file.
10903 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10904 * output.h (Output_file::filesize): New method.
10905
10906 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10907
10908 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10909 New function.
10910 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10911 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10912 function.
10913 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10914 function.
10915 (Arm_relocate_functions::movw_abs_nc): New function.
10916 (Arm_relocate_functions::movt_abs): New function.
10917 (Arm_relocate_functions::thm_movw_abs_nc): New function.
10918 (Arm_relocate_functions::thm_movt_abs): New function.
10919 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10920 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10921 (Scan::global): Likewise.
10922 (Relocate::relocate): Likewise.
10923 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10924
10925 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10926
10927 * arm.cc (Arm_relocate_functions::got_prel) New function.
10928 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10929 (Relocate::relocate): Likewise.
10930 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10931
10932 2009-10-06 Ian Lance Taylor <iant@google.com>
10933
10934 * options.h (class General_options): Define
10935 split_stack_adjust_size parameter.
10936 * object.h (class Object): Add uses_split_stack_ and
10937 has_no_split_stack_ fields. Add uses_split_stack and
10938 has_no_split_stack accessor functions. Declare
10939 handle_split_stack_section.
10940 (class Reloc_symbol_changes): Define.
10941 (class Sized_relobj): Define Function_offsets. Declare
10942 split_stack_adjust, split_stack_adjust_reltype, and
10943 find_functions.
10944 * object.cc (Object::handle_split_stack_section): New function.
10945 (Sized_relobj::do_layout): Call handle_split_stack_section.
10946 * dynobj.cc (Sized_dynobj::do_layout): Call
10947 handle_split_stack_section.
10948 * reloc.cc (Sized_relobj::relocate_sections): Call
10949 split_stack_adjust for executable sections in split_stack
10950 objects. Pass reloc_map to relocate_section.
10951 (Sized_relobj::split_stack_adjust): New function.
10952 (Sized_relobj::split_stack_adjust_reltype): New function.
10953 (Sized_relobj::find_functions): New function.
10954 * target-reloc.h: Include "object.h".
10955 (relocate_section): Add reloc_symbol_changes parameter. Change
10956 all callers.
10957 * target.h (class Target): Add calls_non_split method. Declare
10958 do_calls_non_split virtual method. Declare match_view and
10959 set_view_to_nop.
10960 * target.cc: Include "elfcpp.h".
10961 (Target::do_calls_non_split): New function.
10962 (Target::match_view): New function.
10963 (Target::set_view_to_nop): New function.
10964 * gold.cc (queue_middle_tasks): Give an error if mixing
10965 split-stack and non-split-stack objects with -r.
10966 * i386.cc (Target_i386::relocate_section): Add
10967 reloc_symbol_changes parameter.
10968 (Target_i386::do_calls_non_split): New function.
10969 * x86_64.cc (Target_x86_64::relocate_section): Add
10970 reloc_symbol_changes parameter.
10971 (Target_x86_64::do_calls_non_split): New function.
10972 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10973 parameter.
10974 * powerpc.cc (Target_powerpc::relocate_section): Add
10975 reloc_symbol_changes parameter.
10976 * sparc.cc (Target_sparc::relocate_section): Add
10977 reloc_symbol_changes parameter.
10978 * configure.ac: Call AM_CONDITIONAL for the default target.
10979 * configure: Rebuild.
10980 * testsuite/Makefile.am (TEST_AS): New variable.
10981 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10982 (check_DATA): Add split_i386 and split_x86_64 files.
10983 (SPLIT_DEFSYMS): Define.
10984 (split_i386_[1234n].o): New targets.
10985 (split_i386_[124]): New targets.
10986 (split_i386_[1234r].stdout): New targets.
10987 (split_x86_64_[1234n].o): New targets.
10988 (split_x86_64_[124]): New targets.
10989 (split_x86_64_[1234r].stdout): New targets.
10990 (MOSTLYCLEANFILES): Add new executables.
10991 * testsuite/split_i386.sh: New file.
10992 * testsuite/split_x86_64.sh: New file.
10993 * testsuite/split_i386_1.s: New file.
10994 * testsuite/split_i386_2.s: New file.
10995 * testsuite/split_i386_3.s: New file.
10996 * testsuite/split_i386_4.s: New file.
10997 * testsuite/split_i386_n.s: New file.
10998 * testsuite/split_x86_64_1.s: New file.
10999 * testsuite/split_x86_64_2.s: New file.
11000 * testsuite/split_x86_64_3.s: New file.
11001 * testsuite/split_x86_64_4.s: New file.
11002 * testsuite/split_x86_64_n.s: New file.
11003 * testsuite/testfile.cc (Target_test): Update relocation_section
11004 function.
11005 * testsuite/Makefile.in: Rebuild.
11006
11007 2009-10-06 Ian Lance Taylor <iant@google.com>
11008
11009 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11010 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11011 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
11012 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11013 the address on ldo_addrs_.
11014 (Target_i386::Relocate::fix_up_ldo): New function.
11015
11016 2009-10-06 Rafael Espindola <espindola@google.com>
11017
11018 * plugin.cc (add_input_library): New.
11019 (Plugin::load): Add add_input_library to tv.
11020 (Plugin_manager::add_input_file): Add the is_lib argument.
11021 (add_input_file): Update call to Plugin_manager::add_input_file.
11022 (add_input_library): New.
11023 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11024
11025 2009-09-30 Doug Kwan <dougkwan@google.com>
11026
11027 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11028 symbol and call Symbol::may_need_copy_reloc to determine if
11029 a copy reloc is needed.
11030 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11031 nocopyreloc is given in command line.
11032 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11033 given in command line.
11034 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11035 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11036 of the removed Target_i386::may_need_copy_reloc.
11037 * options.h (copyreloc): New option with default value false.
11038 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11039 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11040 instead of the removed Target_powerpc::may_need_copy_reloc.
11041 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11042 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11043 instead of the removed Target_sparc::may_need_copy_reloc.
11044 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11045 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11046 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11047 instead of the removed Target_x86_64::may_need_copy_reloc.
11048
11049 2009-09-30 Ian Lance Taylor <iant@google.com>
11050
11051 * object.h (class Object): Remove target_ field, and target,
11052 sized_target, and set_target methods.
11053 (Object::sized_target): Remove.
11054 (class Sized_relobj): Update declarations. Remove sized_target.
11055 * object.cc (Sized_relobj::setup): Remove target parameter.
11056 Change all callers.
11057 (Input_objects::add_object): Don't do anything with the target.
11058 (make_elf_sized_object): Add punconfigured parameter. Change all
11059 callers. Set or test parameter target.
11060 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11061 Change all callers.
11062 * parameters.cc (Parameters::set_target): Change parameter type to
11063 be non-const.
11064 (Parameters::default_target): Remove.
11065 (set_parameters_target): Change parameter type to be non-const.
11066 (parameters_force_valid_target): New function.
11067 (parameters_clear_target): New function.
11068 * parameters.h (class Parameters): Update declarations. Remove
11069 default_target method. Add sized_target and clear_target
11070 methods. Change target_ to be non-const.
11071 (set_parameters_target): Update declaration.
11072 (parameters_force_valid_target): Declare.
11073 (parameters_clear_target): Declare.
11074 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11075 as NULL if we aren't searching.
11076 (Add_symbols::run): Don't check for compatible target.
11077 * fileread.cc (Input_file::open_binary): Call
11078 parameters_force_valid_target.
11079 * gold.cc (queue_middle_tasks): Likewise.
11080 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
11081 set_target on object.
11082 * dynobj.h (class Sized_dynobj): Update declarations.
11083 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11084 make_elf_object returns NULL.
11085 (Archive::include_member): Don't check whether object target is
11086 compatible.
11087 * output.cc (Output_section::add_input_section): Get target from
11088 parameters.
11089 (Output_section::relax_input_section): Likewise.
11090 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11091 parameters.
11092 (Sized_relobj::do_scan_relocs): Likewise.
11093 (Sized_relobj::relocate_sections): Likewise.
11094 * resolve.cc (Symbol_table::resolve): Likewise.
11095 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
11096 parameter. Change all callers.
11097 (Symbol_table::add_from_object): Get target from parameters.
11098 (Symbol_table::add_from_relobj): Don't check object target.
11099 (Symbol_table::add_from_dynobj): Likewise.
11100 (Symbol_table::define_special_symbol): Get target from
11101 parameters.
11102 * symtab.h (class Symbol_table): Update declaration.
11103 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11104 parameter. Change all callers. Clear parameter target.
11105 (Binary_test): Test target here.
11106 * testsuite/object_unittest.cc (gold_testsuite): Remove
11107 target_test_pointer parameter. Change all callers.
11108 (Object_test): Test target here.
11109
11110 2009-09-26 Ian Lance Taylor <iant@google.com>
11111
11112 * testsuite/initpri1.c: Don't try to use constructor priorities if
11113 compiling with gcc before 4.3.
11114
11115 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
11116
11117 * testsuite/retain_symbols_file_test.sh (check_present): Change
11118 output file name to retain_symbols_file_test.stdout.
11119 (check_absent): Likewise.
11120
11121 2009-09-18 Craig Silverstein <csilvers@google.com>
11122
11123 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11124 * options.cc: Include <cerrno> and <fstream>.
11125 (General_options::finalize): Parse -retain-symbols-file tag.
11126 * options.h: New flag.
11127 (General_options): New method should_retain_symbol, new
11128 variable symbols_to_retain.
11129 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11130 should_retain_symbol map.
11131 * testsuite/Makefile.am (retain_symbols_file_test): New test.
11132 * testsuite/Makefile.in: Regenerate.
11133 * testsuite/retain_symbols_file_test.sh: New file.
11134
11135 2009-09-18 Nick Clifton <nickc@redhat.com>
11136
11137 * po/es.po: Updated Spanish translation.
11138
11139 2009-09-17 Doug Kwan <dougkwan@google.com>
11140
11141 * debug.h (DEBUG_RELAXATION): New constant.
11142 (DEBUG_ALL): Add DEBUG_RELAXATION.
11143 (debug_string_to_enum): Add relaxation debug option.
11144 * layout.cc
11145 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11146 Layout::Relaxation_debug_check::read_sections,
11147 Layout::Relaxation_debug_check::read_sections): New method definitions.
11148 (Layout::Layout): Initialize data members
11149 record_output_section_data_from_scrips_,
11150 script_output_section_data_list_ and relaxation_debug_check_.
11151 (Layout::save_segments, Layout::restore_segments,
11152 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11153 Layout::relaxation_loop_body): New method definitions.
11154 (Layout::finalize): Support relaxation. Move section layout code to
11155 Layout::relaxation_loop_body.
11156 (Layout::set_asection_address_from_script): Move code for orphan
11157 section placement out.
11158 (Layout::place_orphan_sections_in_script): New method definition.
11159 * layout.h (Output_segment_headers, Output_file_header):
11160 New forward class declarations.
11161 (Layout::~Layout): Define.
11162 (Layout::new_output_section_data_from_script): New method definition.
11163 (Layout::place_orphan_sections_in_script): New method declaration.
11164 (Layout::Segment_states): New type declaration.
11165 (Layout::save_segments, Layout::restore_segments,
11166 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11167 Layout::relaxation_loop_body): New method declarations.
11168 (Layout::Output_section_data_list): New type declaration.
11169 (Layout::Relaxation_debug_check): New class definition.
11170 (Layout::record_output_section_data_from_script_,
11171 Layout::script_output_section_data_list_, Layout::segment_states_,
11172 Layout::relaxation_debug_check_): New data members.
11173 * output.cc: (Output_section_headers::do_size): New method definition.
11174 (Output_section_headers::Output_section_headers): Move size
11175 computation to Output_section_headers::do_size.
11176 (Output_segment_headers::do_size): New method definition.
11177 (Output_file_header::Output_file_header): Move size computation to
11178 Output_file_header::do_size and call it.
11179 (Output_file_header::do_size): New method definition.
11180 (Output_data_group::Output_data_group): Adjust call to
11181 Output_section_data.
11182 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11183 (Output_symtab_xindex::do_write): Add array bound check.
11184 (Output_section::Input_section::print_to_mapfile): Handle
11185 RELAXED_INPUT_SECTION_CODE.
11186 (Output_section::Output_section): Initialize data member checkpoint_.
11187 (Output_section::~Output_section): Delete checkpoint object pointed
11188 by checkpoint_.
11189 (Output_section::add_input_section): Always add an Input_section if
11190 relaxing.
11191 (Output_section::add_merge_input_section): Add assert.
11192 (Output_section::relax_input_section): New method definition.
11193 (Output_section::set_final_data_size): Set load address to zero for
11194 an unallocated section.
11195 (Output_section::do_address_and_file_offset_have_reset_values):
11196 New method definition.
11197 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11198 Handle relaxed input section.
11199 (Output_section::sort_attached_input_sections): Checkpoint input
11200 section list lazily.
11201 (Output_section::get_input_sections): Change type of input_sections to
11202 list of Simple_input_section pointers. Checkpoint input section list
11203 lazily. Also handle relaxed input sections.
11204 (Output_section::add_input_section_for_script): Take a reference to
11205 a Simple_input_section object instead of Relobj pointer and section
11206 index as parameter. Handle relaxed input sections.
11207 (Output_section::save_states, Output_section::restore_states): New
11208 method definitions.
11209 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11210 (Output_data::is_data_size_fixed): New method definition.
11211 (Output_data::reset_addresss_and_file_offset): Do not reset data size
11212 if it is fixed.
11213 (Output_data::address_and_file_offset_have_reset_values): New method
11214 definition.
11215 (Output_data::do_address_and_file_offset_have_reset_values): New method
11216 definition.
11217 (Output_data::set_data_size): Check that data size is not fixed.
11218 (Output_data::fix_data_size): New method definition.
11219 (Output_data::is_data_size_fixed_): New data member.
11220 (Output_section_headers::set_final_data_size): New method definition.
11221 (Output_section_headers::do_size): New method declaration.
11222 (Output_segment_headers::set_final_data_size): New method definition.
11223 (Output_segment_headers::do_size): New method declaration.
11224 (Output_file_header::set_final_data_size)::New method definition.
11225 (Output_file_header::do_size)::New method declaration.
11226 (Output_section_data::Output_section_data): Add new parameter
11227 is_data_size_fixed and use it to fix data size.
11228 (Output_data_const::Output_data_const): Adjust call to base class
11229 constructor and fix data size.
11230 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11231 base class constructor and fix data size.
11232 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11233 base class constructor and fix data size.
11234 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11235 class constructor and fix data size.
11236 (Output_data_group::set_final_data_size): New method definition.
11237 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11238 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11239 class constructor and fix data size.
11240 (Output_relaxed_input_section): New class definition.
11241 (Output_section::Simple_input_section): New class definition.
11242 (Output_section::get_input_sections): Adjust parameter list.
11243 (Output_section::add_input_section_for_script): Same.
11244 (Output_section::save_states, Output_section::restore_states,
11245 Output_section::do_address_and_file_offset_have_reset_values,
11246 (Output_section::Input_section::Input_section): Handle
11247 RELAXED_INPUT_SECTION_CODE. Add new overload for
11248 Output_relaxed_input_section.
11249 (Output_section::Input_section::is_input_section,
11250 Output_section::Input_section::set_output_section): Handle relaxed
11251 input section.
11252 (Output_section::Input_section::is_relaxed_input_section,
11253 Output_section::Input_section::output_section_data,
11254 Output_section::Input_section::relaxed_input_section): New method
11255 definitions.
11256 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11257 value.
11258 (Output_section::Input_section::u1_): Update comments.
11259 (Output_section::Input_section::u2_): Add new union member poris.
11260 (Output_section::Checkpoint_output_section): New classs definition.
11261 (Output_section::relax_input_section): New method declaration.
11262 (Output_section::checkpoint_): New data member.
11263 (Output_segment): Update comments.
11264 (Output_segment::Output_segment): Un-privatize copy constructor.
11265 (Output_segment::operator=): Un-privatize.
11266 * script-sections.cc (Output_section_element::Input_section_list):
11267 Change element type to Output_section::Simple_input_section.
11268 (Output_section_element_dot_assignment::set_section_addresses):
11269 Register output section data for relaxation clean up.
11270 (Output_data_exression::Output_data_expression): Adjust call to base
11271 constructor to fix data size.
11272 (Output_section_element_data::set_section_addresses): Register
11273 Output_data_expression object for relaxation clean up.
11274 (struct Input_section_info): Replace Relobj pointer and section index
11275 pair with Output_section::Simple_input_section and Convert struct to a
11276 class.
11277 (Input_section_sorter::operator()): Adjust access to
11278 Input_section_info data member to use accessors.
11279 (Output_section_element_input::set_section_addresses): Use layout
11280 parameter. Adjust code to use Output_section::Simple_input_section
11281 and Input_secction_info classes. Register filler for relaxation
11282 clean up.
11283 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11284 and section index pair with Output_section::Simple_input_section
11285 class. Adjust code accordingly.
11286 (Phdrs_element::release_segment): New method definition.
11287 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11288 segment list.
11289 (Script_sections::release_segments): New method definition.
11290 * gold/script-sections.h (Script_sections::release_segments): New
11291 method declaration.
11292 * gold/target.h (Target::may_relax, Target::relax,
11293 Target::do_may_relax, Target::do_relax): New method definitions.
11294
11295 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11296
11297 * arm.cc (has_signed_unsigned_overflow): New function.
11298 (Arm_relocate_functions::abs8): New function.
11299 (Target_arm::Scan::local): Handle R_ARM_ABS8.
11300 (Target_arm::Scan::global): Likewise.
11301 (Target_arm::relocate::relocate): Likewise.
11302 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11303 Likewise.
11304
11305 2009-09-16 Cary Coutant <ccoutant@google.com>
11306
11307 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11308 * testsuite/Makefile.in: Regenerate.
11309
11310 2009-09-11 Nick Clifton <nickc@redhat.com>
11311
11312 * po/gold.pot: Updated by the Translation project.
11313
11314 2009-09-08 Cary Coutant <ccoutant@google.com>
11315
11316 * output.cc (Output_file::open): Add execute permission to empty file.
11317 * testsuite/Makefile.am (permission_test): New test.
11318 * testsuite/Makefile.in: Regenerate.
11319
11320 2009-09-02 Ian Lance Taylor <iant@google.com>
11321
11322 * output.cc (Output_file::resize): Call map_no_anonymous rather
11323 than map.
11324
11325 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
11326
11327 * gold.cc: Include "incremental.h".
11328 (queue_initial_tasks): Call Incremental_checker methods.
11329 * incremental.cc: Include "output.h".
11330 (Incremental_checker::can_incrementally_link_output_file): New
11331 method.
11332 * incremental.h (Incremental_checker): New class.
11333
11334 * output.cc (Output_file::open_for_modification): New method.
11335 (Output_file::map_anonymous): Changed return type to bool. Record
11336 map in base_ field.
11337 (Output_file::map_no_anonymous): New method, broken out of map.
11338 (Output_file::map): Use map_no_anonymous and map_anonymous.
11339 * output.h (class Output_file): Update declarations.
11340
11341 2009-08-24 Cary Coutant <ccoutant@google.com>
11342
11343 * options.h (Command_line::Pre_options): New class.
11344 (Command_line::pre_options): New member.
11345 * options.cc (gold::options::ready_to_register): New variable.
11346 (One_option::register_option): Do nothing if not registering options.
11347 Assert if same short option registered twice.
11348 (General_options::General_options): Turn off option registration when
11349 done constructing.
11350 (Command_line::Pre_options::Pre_options): New constructor.
11351
11352 2009-08-24 Cary Coutant <ccoutant@google.com>
11353
11354 * options.h (General_options::no_keep_memory): Remove incorrect
11355 short option.
11356
11357 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
11358
11359 * Makefile.am (am__skiplex, am__skipyacc): New.
11360 * Makefile.in: Regenerate.
11361
11362 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
11363
11364 * Makefile.am (AM_CPPFLAGS): Renamed from ...
11365 (INCLUDES): ... this.
11366 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11367 (AM_CPPFLAGS): Renamed from ...
11368 (INCLUDE): ... this.
11369 * Makefile.in, testsuite/Makefile.in: Regenerate.
11370
11371 * Makefile.in: Regenerate.
11372 * aclocal.m4: Likewise.
11373 * config.in: Likewise.
11374 * configure: Likewise.
11375 * testsuite/Makefile.in: Likewise.
11376
11377 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11378 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11379 * Makefile.in: Regenerate.
11380 * testsuite/Makefile.in: Regenerate.
11381
11382 2009-08-19 Cary Coutant <ccoutant@google.com>
11383
11384 * resolve.cc (Symbol_table::resolve): Don't complain about defined
11385 symbols in shared libraries overridden by hidden or internal symbols
11386 in the main program.
11387
11388 2009-08-19 Chris Demetriou <cgd@google.com>
11389
11390 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11391 checking source file names in error messages.
11392
11393 2009-08-18 Doug Kwan <dougkwan@google.com>
11394
11395 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11396 an elcpp::Ehdr as parameter. Adjust call to set_target.
11397 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11398 an elfcpp::Ehdr as parameter.
11399 * object.cc (Object::set_target): Remove the version that looks up
11400 a target and sets it.
11401 (Sized_relobj::setup): Take a Target object instead of
11402 an elfcpp::Ehdr as parameter. Adjust call to set_target.
11403 (make_elf_sized_object): Find target and ask target to
11404 make an ELF object.
11405 * object.h: (Object::set_target): Remove the version that looks up
11406 a target and sets it.
11407 (Sized_relobj::setup): Take a Target object instead of
11408 an elfcpp:Ehdr as parameter.
11409 * target.cc: Include dynobj.h.
11410 (Target::do_make_elf_object_implementation): New.
11411 (Target::do_make_elf_object): New.
11412 * target.h (Target::make_elf_object): New template declaration.
11413 (Target::do_make_elf_object): New method declarations.
11414 (Target::do_make_elf_object_implementation): New template declaration.
11415
11416 2009-08-14 Ian Lance Taylor <iant@google.com>
11417
11418 * gold.h (FUNCTION_NAME): Define.
11419 (gold_unreachable): Use FUNCTION_NAME.
11420
11421 2009-08-12 Sriraman Tallam <tmsriram@google.com>
11422
11423 * icf.cc (Icf::find_identical_sections): Issue a warning when a
11424 symbol in the --keep-unique list is not found.
11425
11426 2009-08-12 Sriraman Tallam <tmsriram@google.com>
11427
11428 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11429 been maked as --keep-unique.
11430 (Icf::unfold_section): New function.
11431 * icf.h (Icf::unfold_section): New function.
11432 * options.h (General_options::keep_unique): New option.
11433 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11434 * testsuite/Makefile.in: Regenerate.
11435 * testsuite/icf_keep_unique_test.sh: New file.
11436 * testsuite/icf_keep_unique_test.cc: New file.
11437
11438 2009-08-12 Cary Coutant <ccoutant@google.com>
11439
11440 PR 10471
11441 * resolve.cc (Symbol_table::resolve): Check for references from
11442 dynamic objects to hidden and internal symbols.
11443 * testsuite/Makefile.am (hidden_test.sh): New test.
11444 * testsuite/Makefile.in: Regenerate.
11445 * testsuite/hidden_test.sh: New script.
11446 * testsuite/hidden_test_1.c: New test source.
11447 * testsuite/hidden_test_main.c: New test source.
11448
11449 2009-08-11 Doug Kwan <dougkwan@google.com>
11450
11451 * arm.cc: Update comments.
11452 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11453 segment to locate the .ARM.exidx section if present.
11454
11455 2009-08-09 Doug Kwan <dougkwan@google.com>
11456
11457 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11458 patch.
11459
11460 2009-08-07 Sriraman Tallam <tmsriram@google.com>
11461 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11462 compiler warnings.
11463
11464 2009-08-06 Sriraman Tallam <tmsriram@google.com>
11465
11466 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11467 valid tls_segment only for non-debug-section relocations.
11468 * testsuite/Makefile.am: Add gc_tls_test.
11469 * testsuite/Makefile.in: Regenerate.
11470 * testsuite/gc_tls_test.cc: New file.
11471 * testsuite/gc_tls_test.sh: New file.
11472
11473 2009-08-05 Sriraman Tallam <tmsriram@google.com>
11474
11475 * icf.cc: New file.
11476 * icf.h: New file.
11477 * Makefile.am (CCFILES): Add icf.cc.
11478 (HFILES): Add icf.h
11479 * Makefile.in: Regenerate.
11480 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11481 * gc.h (gc_process_relocs): Populate lists used by icf to contain
11482 section, symbol and addend information for the relocs.
11483 * gold.cc (queue_middle_tasks): Call identical code folding.
11484 * gold.h: Add defines for multimap.
11485 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11486 to the call of finalize_local_symbols.
11487 * main.cc (main): Create object of class Icf.
11488 * object.cc (Sized_relobj::do_layout): Allow this function to be
11489 called twice during icf.
11490 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11491 to sections marked as identical by icf.
11492 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11493 when available.
11494 (Sized_relobj::do_section_entsize): New function.
11495 * object.h (Object::section_entsize): New function.
11496 (Object::do_section_entsize): New pure virtual function.
11497 (Relobj::finalize_local_symbols): Add new parameter.
11498 (Relobj::do_section_entsize): New function.
11499 * options.h (General_options::icf): New option.
11500 (General_options::icf_iterations): New option.
11501 (General_options::print_icf_sections): New option.
11502 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11503 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11504 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11505 icf.
11506 * symtab.cc (Symbol_table::is_section_folded): New function.
11507 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
11508 to sections marked as identical by icf.
11509 * symtab.h (Symbol_table::set_icf): New function.
11510 (Symbol_table::icf): New function.
11511 (Symbol_table::is_section_folded): New function.
11512 (Symbol_table::icf_): New data member.
11513 * target-reloc.h (relocate_section): Ignore sections folded by icf.
11514 * testsuite/Makefile.am: Add commands to build icf_test.
11515 * testsuite/Makefile.in: Regenerate.
11516 * testsuite/icf_test.sh: New file.
11517 * testsuite/icf_test.cc: New file.
11518
11519 2009-07-24 Chris Demetriou <cgd@google.com>
11520
11521 * layout.cc (is_compressible_debug_section): Fix incorrect
11522 comment about compressed section names.
11523
11524 2009-07-20 Ian Lance Taylor <ian@airs.com>
11525
11526 PR 10419
11527 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11528
11529 2009-07-16 Ian Lance Taylor <iant@google.com>
11530
11531 PR 10400
11532 * layout.h: #include <map>.
11533 (class Kept_section): Change from struct to class. Add accessors
11534 and setters. Add section size to Comdat_group mapping. Change
11535 Comdat_group to std::map. Add is_comdat_ field. Add
11536 linkonce_size field in union.
11537 (class Layout): Update declaration of find_or_add_kept_section.
11538 Don't declare find_kept_object.
11539 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11540 parameter. Add object, shndx, is_comdat, and is_group_name
11541 parameters. Change all callers. Adjust for new Kept_section.
11542 (Layout::find_kept_object): Remove.
11543 * object.cc (Sized_relobj::include_section_group): Update use of
11544 Kept_section. Rename secnum to shndx. Only record
11545 Kept_comdat_section if sections are the same size.
11546 (Sized_relobj::include_linkonce_section): Update use of
11547 Kept_section. Only record Kept_comdat_section if sections are the
11548 same size. Set size of linkonce section.
11549 (Sized_relobj::map_to_kept_section): Update call to
11550 get_kept_comdat_section.
11551 * object.h (class Sized_relobj): Rename fields in
11552 Kept_comdat_section to drop trailing underscores; change object
11553 field to Relobj*. Change Kept_comdat_section_table to store
11554 struct rather than pointer.
11555 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11556 Add kept_object and kept_shndx parameters. Change all callers.
11557 (Sized_relobj::get_kept_comdat_section): Change return type to
11558 bool. Add kept_object and kept_shndx parameters. Change all
11559 callers.
11560 * plugin.cc (Pluginobj::include_comdat_group): Update call to
11561 Layout::find_or_add_kept_section.
11562
11563 2009-07-09 Ian Lance Taylor <iant@google.com>
11564
11565 * merge.cc (Object_merge_map::initialize_input_to_output_map):
11566 Reserve space in the hash table.
11567
11568 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
11569
11570 * fileread.cc (File_read::get_mtime): New method.
11571 * fileread.h (Timespec): New structure.
11572 (File_read::get_mtime): New method.
11573 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11574 Renamed from timestamp_nsec.
11575 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11576 Elf_Xword.
11577 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11578 timestamp_nsec.
11579 (Incremental_inputs::report_archive): Save mtime; style fix.
11580 (Incremental_inputs::report_obejct): Save mtime; style fix.
11581 (Incremental_inputs::report_script): Save mtime; style fix.
11582 (Incremental_inputs::finalize_inputs): Style fix.
11583 (Incremental_inputs::finalize): Style fix.
11584 (Incremental_inputs::create_input_section_data): Store inputs
11585 mtime.
11586 * incremental.h (Incremental_inputs::report_script): Add mtime
11587 argument.
11588 (Incremental_inputs::Input_info::Input_info): Intialize only one
11589 union member.
11590 (Incremental_inputs::Input_info::archive): Move to nameless
11591 union.
11592 (Incremental_inputs::Input_info::obejct): Move to nameless union.
11593 (Incremental_inputs::Input_info::script): Move to nameless union.
11594 (Incremental_inputs::mtime): New field.
11595 * script.cc (read_input_script): Pass file mtime to
11596 Incremental_input.
11597 * script.h (Script_info::inputs): Style fix.
11598
11599 2009-07-01 Ian Lance Taylor <ian@airs.com>
11600
11601 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11602 instead of 32.
11603
11604 2009-06-24 Ian Lance Taylor <iant@google.com>
11605
11606 PR 10156
11607 * layout.cc (Layout::choose_output_section): If we find an
11608 existing section, update the flags.
11609 (Layout::create_notes): New function, broken out of
11610 Layout::finalize.
11611 (Layout::finalize): Don't create note sections.
11612 (Layout::create_note): Don't crash if linker script discards
11613 section.
11614 (Layout::create_gold_note): Likewise.
11615 (Layout::create_build_id): Likewise. Don't set
11616 after_input_sections on the section.
11617 (Layout::create_executable_stack_info): Remove target parameter.
11618 Change caller.
11619 * layout.h (class Layout): Declare create_notes. Update
11620 declaration of create_executable_stack_info.
11621 * gold.cc (queue_middle_tasks): Call create_notes.
11622 * output.cc (Output_section::update_flags_for_input_section): Move
11623 here from output.h. If SHF_ALLOC flag is newly set, mark address
11624 invalid.
11625 * output.h (Output_data::mark_address_invalid): New function.
11626 (class Output_section): Only declare, not define,
11627 update_flags_for_input_section. Remove set_flags.
11628
11629 2009-06-24 Ian Lance Taylor <iant@google.com>
11630
11631 * script-sections.cc (Output_section_definition::
11632 set_section_addresses): Rename shadowing local load_address to
11633 laddr.
11634
11635 2009-06-24 Ian Lance Taylor <iant@google.com>
11636
11637 PR 10244
11638 * reloc.cc (relocate_sections): Skip empty relocation sections.
11639
11640 2009-06-23 Ian Lance Taylor <iant@google.com>
11641
11642 PR 10156
11643 * layout.cc (Layout::create_note): Use choose_output_section
11644 rather than make_output_section.
11645
11646 2009-06-23 Ian Lance Taylor <iant@google.com>
11647
11648 PR 10237
11649 * options.cc (General_options::parse_V): Set printed_version_.
11650 (General_options::General_options): Initialize printed_version_.
11651 * options.h (class General_options): Add printed_version_ field.
11652 * gold.cc (queue_initial_tasks): If there are no input files,
11653 don't give a fatal error if we printed the version information.
11654 (queue_middle_tasks): If using -r with a shared object, give a
11655 fatal error rather than an ordinary error.
11656
11657 2009-06-23 Ian Lance Taylor <iant@google.com>
11658
11659 PR 10219
11660 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11661 (Layout::make_output_section): Set have_stabstr_section_ if we see
11662 a .stab*str section.
11663 (Layout::finalize): Call link_stabs_sections.
11664 (Layout::link_stabs_sections): New file.
11665 * layout.h (class Layout): Add have_stabstr_section_ field.
11666 Declare link_stabs_sections.
11667
11668 2009-06-23 Doug Kwan <dougkwan@google.com>
11669
11670 * Makefile.am (libgold_a_LIBADD): New.
11671 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11672 * Makefile.in: Regenerate.
11673 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11674 * configure: Regenerate.
11675 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11676 * fileread.cc: Include sys/state.h
11677 * gold.h: Declare memmem and strndup if found missing.
11678 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11679
11680 2009-06-23 Ian Lance Taylor <iant@google.com>
11681
11682 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11683 * configure: Rebuild.
11684
11685 2009-06-23 Ian Lance Taylor <iant@google.com>
11686
11687 PR 10147
11688 * object.cc (Object::section_contents): Don't try to get a view if
11689 the section has length zero.
11690 (Object::handle_gnu_warning_section): If the section is empty, use
11691 the name of the section as the warning.
11692
11693 2009-06-23 Ian Lance Taylor <iant@google.com>
11694
11695 PR 10133
11696 * stringpool.h (class Stringpool_template): Add optimize_ field.
11697 (Stringpool_template::set_optimize): New function.
11698 * stringpool.cc (Stringpool_template::Stringpool_template):
11699 Initialize optimize_ field.
11700 (Stringpool_template::set_string_offsets): Test local optimize
11701 fild rather than parameter.
11702 * layout.cc (Layout::Layout): Call set_optimize on the section
11703 name stringpool.
11704
11705 2009-06-22 Ian Lance Taylor <iant@google.com>
11706
11707 PR 10030
11708 * yyscript.y: Parse TARGET.
11709 * script.cc (script_set_target): New function.
11710 * script-c.h (script_set_target): Declare.
11711 * options.cc (General_options::string_to_object_format): Rename
11712 from string_to_object_format in anonymous namespace. Change
11713 callers.
11714 * options.h (class General_options): Declare
11715 string_to_object_format.
11716
11717 2009-06-22 Ian Lance Taylor <iant@google.com>
11718
11719 * script-sections.cc (Script_sections::create_segments): Don't put
11720 program headers in a PT_LOAD segment if -n or -N.
11721
11722 2009-06-22 Ian Lance Taylor <iant@google.com>
11723
11724 PR 10141
11725 * options.h (class General_options): Add -z lazy and -z now. Sort
11726 -z options into alphabetical order.
11727 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11728
11729 2009-06-21 Ian Lance Taylor <iant@google.com>
11730
11731 * layout.cc (Layout::make_output_section): Call
11732 Target::new_output_section.
11733 (Layout::attach_allocated_section_to_segment): Put large section
11734 sections in a separate load segment with the large segment flag
11735 set.
11736 (Layout::segment_precedes): Sort large data segments after other
11737 load segments.
11738 (align_file_offset): New static function.
11739 (Layout::set_segment_offsets): Use align_file_offset.
11740 * output.h (class Output_section): Add is_small_section_ and
11741 is_large_section_ fields.
11742 (Output_section::is_small_section): New function.
11743 (Output_section::set_is_small_section): New function.
11744 (Output_section::is_large_section): New function.
11745 (Output_section::set_is_large_section): New function.
11746 (Output_section::is_large_data_section): New function.
11747 (class Output_segment): Add is_large_data_segment_ field.
11748 (Output_segment::is_large_data_segment): New function.
11749 (Output_segment::set_is_large_data_segment): New function.
11750 * output.cc (Output_section::Output_section): Initialize new
11751 fields.
11752 (Output_segment::Output_segment): Likewise.
11753 (Output_segment::add_output_section): Add assertion that large
11754 data sections always go in large data segments. Force small data
11755 sections to the end of the list of data sections. Force small BSS
11756 sections to the start of the list of BSS sections. For large BSS
11757 sections to the end of the list of BSS sections.
11758 * symtab.h (class Symbol): Declare is_common_shndx.
11759 (Symbol::is_defined): Check Symbol::is_common_shndx.
11760 (Symbol::is_common): Likewise.
11761 (class Symbol_table): Define enum Commons_section_type. Update
11762 declarations. Add small_commons_ and large_commons_ fields.
11763 * symtab.cc (Symbol::is_common_shndx): New function.
11764 (Symbol_table::Symbol_table): Initialize new fields.
11765 (Symbol_table::add_from_object): Put small and large common
11766 symbols in the right list.
11767 (Symbol_table::sized_finalized_symbol): Check
11768 Symbol::is_common_shndx.
11769 (Symbol_table::sized_write_globals): Likewise.
11770 * common.cc (Symbol_table::do_allocate_commons): Allocate new
11771 common symbol lists. Don't call do_allocate_commons_list if the
11772 list is empty.
11773 (Symbol_table::do_allocate_commons_list): Remove is_tls
11774 parameter. Add comons_section_type parameter. Change all
11775 callers. Handle small and large common symbols.
11776 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11777 Symbol::is_common_shndx.
11778 * resolve.cc (symbol_to_bits): Likewise.
11779 * target.h (Target::small_common_shndx): New function.
11780 (Target::small_common_section_flags): New function.
11781 (Target::large_common_shndx): New function.
11782 (Target::large_common_section_flags): New function.
11783 (Target::new_output_section): New function.
11784 (Target::Target_info): Add small_common_shndx, large_common_shndx,
11785 small_common_section_flags, and large_common_section_flags
11786 fields.
11787 (Target::do_new_output_section): New virtual function.
11788 * arm.cc (Target_arm::arm_info): Initialize new fields.
11789 * i386.cc (Target_i386::i386_info): Likewise.
11790 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11791 Likewise.
11792 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11793 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11794 (Target_x86_64::do_new_output_section): New function.
11795 * configure.ac: Define conditional MCMODEL_MEDIUM.
11796 * testsuite/Makefile.am (check_PROGRAMS): Add large.
11797 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11798 (large_LDFLAGS): Define.
11799 * testsuite/large.c: New file.
11800 * testsuite/testfile.cc (Target_test::test_target_info):
11801 Initialize new fields.
11802 * configure, testsuite/Makefile.in: Rebuild.
11803
11804 2009-06-05 Doug Kwan <dougkwan@google.com>
11805
11806 * Makefile.am (CCFILES): Add target.cc.
11807 * Makefile.in: Regenerate.
11808 * i386.cc (class Target_i386): Define new virtual method to
11809 override do_is_local_label_name in parent.
11810 * object.cc (Sized_relobj::do_count_local_symbols): Discard
11811 local symbols if --discard-locals or -X is given.
11812 * options.h (class General_options): Declare new options
11813 '--discard-locals' and '-X' for discarding locals.
11814 * target.h (class Target): Define new methods is_local_label_name.
11815 Declare new virtual method do_is_local_label_name.
11816 * target.cc: New file.
11817 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11818 (check_SCRIPTS): Add discard_locals_test.sh.
11819 (check_DATA): Add discard_local_tests.syms.
11820 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11821 (discard_local_tests.syms, discard_locals_test.o): New make rules.
11822 * testsuite/Makefile.in: Regenerate.
11823 * testsuite/discard_locals_test.c: New file.
11824 * testsuite/discard_locals_test.sh: Same.
11825
11826 2009-06-05 Doug Kwan <dougkwan@google.com>
11827
11828 * object.cc (Sized_relobj::Sized_relobj): Initialize
11829 discarded_eh_frame_shndx_ to -1U.
11830 (Sized_relobj::do_layout): Record index of a discard .eh_frame
11831 section.
11832 (Sized_relobj::do_count_local_symbols): Skip local symbols in
11833 a discarded .eh_frame section.
11834 (Sized_relobj::do_finalize_local_symbols): Ditto.
11835 * object.h (class Sized_relobj): Declare new member
11836 discarded_eh_frame_shndx_.
11837 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11838 (local_labels_test.o, local_labels_test): New rules.
11839 * testsuite/Makefile.in: Regenerate.
11840
11841 2009-06-04 Doug Kwan <dougkwan@google.com>
11842
11843 * layout.cc (Layout::section_name_mapping): Add mapping for
11844 special ARM sections.
11845
11846 2009-06-03 Doug Kwan <dougkwan@google.com>
11847
11848 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11849 (utils::has_overflow): Same.
11850
11851 2009-06-03 Ian Lance Taylor <iant@google.com>
11852
11853 * layout.cc (Layout::section_name_mapping): New array, replacing
11854 Layout::linkonce_mapping.
11855 (Layout::section_name_mapping_count): New variable, replacing
11856 Layout::linkonce_mapping_count.
11857 (Layout::linkonce_output_name): Remove.
11858 (Layout::output_section_name): Rewrite.
11859 * layout.h (class Layout): Rename Linkonce_mapping to
11860 Section_name_mapping, linkonce_mapping to section_name_mapping,
11861 linkonce_mapping_count to section_name_mapping_count. Don't
11862 declare linkonce_output_name.
11863
11864 2009-06-03 Doug Kwan <dougkwan@google.com>
11865
11866 * gold/arm.cc (namespace utils): New.
11867 (Target_arm::reloc_is_non_pic): Define new method.
11868 (class Arm_relocate_functions): New.
11869 (Target_arm::Relocate::relocate): Handle relocation types used by
11870 Android.
11871
11872 2009-06-03 Ian Lance Taylor <iant@google.com>
11873
11874 * arm.cc (Target_arm::scan::global): Use || instead of |.
11875
11876 2009-06-02 Doug Kwan <dougkwan@google.com>
11877
11878 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
11879 issued_non_pic_error_.
11880 (class Target_arm::Scan): Declare new method check_non_pic.
11881 Define new method symbol_needs_plt_entry.
11882 Declare new data member issued_non_pic_error_.
11883 (class Target_arm::Relocate): Declare new method
11884 should_apply_static_reloc.
11885 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11886 (Target_arm::Scan::check_non_pic): Define new method.
11887 (Target_arm::Scan::local): Handle a small subset of reloc types used
11888 by Android.
11889 (Target_arm::Scan::local): Same.
11890 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11891
11892 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
11893
11894 * incremental.cc (Incremental_inputs::report_command_line): Filter
11895 out --incremental-* options.
11896
11897 2009-05-29 Doug Kwan <dougkwan@google.com>
11898
11899 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11900 template class.
11901 (class Target_arm): Update comment.
11902 (Target_arm::Target_arm): Initialize new data members GOT_,
11903 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11904 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11905 and Target_arm::rel_dyn_section.
11906 Declare new_enum Target_arm::Got_type.
11907 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11908 and DYNBSS_.
11909 Update commments for member do_dynsym_value.
11910 (Target_arm::got_size, Target_arm::plt_section,
11911 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11912 new methods inside class defintion.
11913 (Target_arm::got_section): Define new method.
11914 (Target_arm::rel_dyn_section): Same.
11915 (Output_data_plt_arm): New template class.
11916 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11917 (Output_data_plt_arm:do_adjust_output_section): Define new method.
11918 (Output_data_plt_arm::add_entry): Same.
11919 (Output_data_plt_arm::first_plt_entry): Define new
11920 static data member for PLT instruction template.
11921 (Output_data_plt_arm::plt_entry): Same.
11922 (Output_data_plt_arm::do_write): Define new method.
11923 (Target_arm::make_plt_entry): Same.
11924 (Target_arm::do_finalize_sections): Same.
11925 (Target_arm::do_dynsym_value): Same.
11926
11927 2009-05-28 Doug Kwan <dougkwan@google.com>
11928
11929 * Makefile.am (TARGETSOURCES): Add arm.cc.
11930 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11931 * Makefile.in: Regenerate.
11932 * arm.cc: New file.
11933 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11934
11935 2009-05-26 Doug Kwan <dougkwan@google.com>
11936
11937 * options.cc (General_options::parse_exclude_libs). Fix a comment.
11938 (General_options::check_excluded_libs): Strip off directories in
11939 archive name before matching like GNU ld does.
11940 * testsuite/Makefile.am (MOSTLYCLEANFILES,
11941 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11942 (exclude_libs_test_LDFLAGS): Add linker option
11943 -Wl,--exclude-libs,libexclude_libs_test_3
11944 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11945 an explicit archive without using -l.
11946 (alt/libexclude_libs_test_3.a): New make rule.
11947 * testsuite/Makefile.in: Regenerate.
11948 * testsuite/exclude_libs_test.c : Declare lib3_default().
11949 (main): Call it.
11950 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11951 * exclude_libs_test_3.c: New file.
11952
11953 2009-05-26 Nick Clifton <nickc@redhat.com>
11954
11955 * po/id.po: New Indonesian translation.
11956 * po/gold.pot: Updated template file.
11957
11958 2009-05-22 Sriraman Tallam <tmsriram@google.com>
11959
11960 * testsuite/Makefile.am: Add -ffunction-sections to compile
11961 gc_comdat_test files. Add -Wl,--gc-sections to build
11962 gc_comdat_test.
11963 * testsuite/Makefile.in: Regenerate.
11964 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11965
11966 2009-05-21 Sriraman Tallam <tmsriram@google.com>
11967
11968 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11969 kept comdat section was garbage collected.
11970 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11971 * testsuite/Makefile.in: Regenerate.
11972 * testsuite/gc_comdat_test.sh: New file.
11973 * testsuite/gc_comdat_test_1.cc: New file.
11974 * testsuite/gc_comdat_test_2.cc: New file.
11975
11976 2009-05-19 Doug Kwan <dougkwan@google.com>
11977
11978 * archive.cc (Archive::Archive): Move constructor from archive.h
11979 to here. Initialize no_export_.
11980 (Archive::get_elf_object_for_member): Set no_export flag of object.
11981 * archive.h (Archive::Archive): Move constructor body to
11982 archive.cc.
11983 (Archive::no_export): New method.
11984 (Archive::no_export_): New field.
11985 * object.h (Object::Object): Initialize no_export_ to false.
11986 (Object::no_export, Object::set_no_export): New methods.
11987 (Object::no_export_): New field.
11988 * options.cc (General_options::parse_exclude_libs): New method.
11989 (General_options::check_excluded_libs) Same.
11990 * options.h (exclude_libs): New option.
11991 (General_options::check_excluded_libs): New method declaration.
11992 (General_options::excluded_libs_): New field.
11993 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11994 default or protected visibility if an object has no-export flag set.
11995 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11996 (check_SCRIPTS): Add exclude_libs_test.sh.
11997 (check_DATA): Add exclude_libs_test.syms.
11998 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11999 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12000 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12001 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12002 (exclude_libs_test.syms, libexclude_libs_test_1.a,
12003 libexclude_libs_test_2.a): New rules.
12004 * testsuite/Makefile.in: Regenerate.
12005 * testsuite/exclude_libs_test.c: New file.
12006 * testsuite/exclude_libs_test.sh: Ditto.
12007 * testsuite/exclude_libs_test_1.c: Ditto.
12008 * testsuite/exclude_libs_test_2.c: Ditto.
12009
12010 2009-05-15 Ian Lance Taylor <iant@google.com>
12011
12012 * configure.ac: Check for declarations for cases where libiberty.h
12013 checks HAVE_DECL_xxx.
12014 * configure, config.in: Rebuild.
12015
12016 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
12017
12018 * gold.h (Incremental_argument_list): Remove (invalid) forward
12019 declaration.
12020 * incremental.cc (Incremental_inputs::report_achive): New method.
12021 (Incremental_inputs::report_object): New method.
12022 (Incremental_inputs::report_script): New method.
12023 (Incremental_inputs::finalize_inputs): New method.
12024 (Incremental_inputs::finalize): Call finalize_inputs().
12025 (Incremental_inputs::sized_create_incremental_inputs_section_data):
12026 Create inputs entries.
12027 * incremental.h (Incremental_input_type): New enum.
12028 (Incremental_inputs::Incremental_input): Initialize new fields.
12029 (Incremental_inputs::report_inputs): New method.
12030 (Incremental_inputs::report_achive): New method.
12031 (Incremental_inputs::report_object): New method.
12032 (Incremental_inputs::report_script): New method.
12033 (Incremental_inputs::finalize_inputs): New method.
12034 (Incremental_inputs::Input_info): New struct.
12035 (Incremental_inputs::Input_info_map): New typedef.
12036 (Incremental_inputs::lock_): New field.
12037 (Incremental_inputs::Inputs_): New field.
12038 (Incremental_inputs::Inputs_map): New field.
12039 * main.cc (main): Call Incremental_input::report_inputs.
12040 * options.h (Input_argument_list): Typedef moved from
12041 Input_arguments.
12042 (Input_file_group::Files): Remove, use ::Input_argument_list.
12043 (Input_file_group::Input_argument_list): Remove, use
12044 ::Input_argument_list.
12045 * plugin.cc (Plugin_manager::add_input_file): Add error in
12046 incremental build.
12047 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12048 functions.
12049 * script.cc (read_input_script): Call
12050 Incremental_input::report_script.
12051 * script.h (Script_info): New class.
12052
12053 2009-04-27 Ian Lance Taylor <iant@google.com>
12054
12055 * x86_64.cc (do_adjust_output_section): Set entsize to
12056 plt_entry_size.
12057
12058 2009-04-23 Elliott Hughes <enh@google.com>
12059
12060 * output.cc (Output_file::close): After short writes, continue
12061 writing from the correct offset in the buffer being written.
12062
12063 2009-04-23 Chris Demetriou <cgd@google.com>
12064
12065 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12066 * configure: Regenerate.
12067 * config.in: Regenerate.
12068 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12069 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12070
12071 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
12072
12073 * incremental.cc (Incremental_inputs_header_data): Renamed from
12074 Incremental_input_header_data.
12075 (Incremental_inputs_header_data::data_size): New field.
12076 (Incremental_inputs_header_data::put_input_file_count): Renamed
12077 from input_file_count.
12078 (Incremental_inputs_header_data::put_command_line_offset): Renamed
12079 from command_line_offset.
12080 (Incremental_inputs_header_data::put_reserved): Renamed from
12081 put_reserved.
12082 (Incremental_inputs_entry_data): Renamed from
12083 Incremental_input_entry_data.
12084 (Incremental_inputs_entry_data::data_size): New field.
12085 (Incremental_inputs::report_command_line): New method.
12086 (Incremental_inputs::finalize): New method.
12087 (Incremental_inputs::create_incremental_inputs_data): New method.
12088 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12089 * incremental.h: New file.
12090 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12091 (Layout::finalize): Create incremental inputs section in
12092 incremental builds.
12093 (Layout::create_incremental_info_sections): New method.
12094 * layout.h (Layout::incremental_inputs): New method.
12095 (Layout::create_incremental_info_sections): New method.
12096 (Layout::incremental_inputs_): New field.
12097 * main.cc (main): Notify Incremental_input of the command line.
12098
12099 2009-04-01 Ian Lance Taylor <iant@google.com>
12100 Mikolaj Zalewski <mikolajz@google.com>
12101
12102 * gold.h (reserve_unordered_map): Define, three versions, one for
12103 each version of Unordered_map.
12104 * layout.cc (Layout::Layout): Remove options parameter. Add
12105 number_of_input_files parameter. Don't initialize options_.
12106 Initialize number_of_input_files_ and resized_signatures_. Move
12107 sections_are_attached_.
12108 (Layout::layout_group): Reserve space for group_signatures_.
12109 (Layout::find_or_add_kept_section): Change name parameter to be a
12110 reference. Resize signatures_ map when it gets large enough.
12111 (Layout::layout_eh_frame): Use parameters->options() instead of
12112 this->options_.
12113 (Layout::make_output_section): Likewise.
12114 (Layout::attach_allocated_section_to_segment): Likewise.
12115 (Layout::finalize, Layout::create_executable_stack): Likewise.
12116 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12117 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12118 * layout.h (class Layout): Update declarations. Remove options_
12119 field. Add number_of_input_files_ and resized_signatures_
12120 fields. Move sections_are_attached_ field.
12121 * main.cc (main): Pass number of input files to Layout
12122 constructor. Don't pass options.
12123
12124 2009-03-30 Ian Lance Taylor <iant@google.com>
12125
12126 * ffsll.c (ffsll): Correct implementation.
12127
12128 2009-03-27 Ian Lance Taylor <iant@google.com>
12129
12130 * ffsll.c: New file.
12131 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12132 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12133 * ftruncate.c (ftruncate): Declare before definition.
12134 * mremap.c (mremap): Likewise.
12135 * pread.c (pread): Likewise.
12136 * configure, Makefile.in, config.in: Rebuild.
12137
12138 * mremap.c: New file.
12139 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12140 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12141 (mremap): Declare if HAVE_MREMAP is not defined.
12142 * configure, Makefile.in, config.in: Rebuild.
12143
12144 2009-03-27 Cary Coutant <ccoutant@google.com>
12145
12146 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12147 position independent.
12148 * sparc.cc (Target_sparc::check_non_pic): Likewise.
12149 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12150
12151 2009-03-24 Cary Coutant <ccoutant@google.com>
12152
12153 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12154 an executable.
12155 (needs_dynamic_reloc): Likewise.
12156
12157 2009-03-24 Ian Lance Taylor <iant@google.com>
12158
12159 * yyscript.y (file_cmd): Recognize EXTERN.
12160 (extern_name_list, extern_name_list_body): New nonterminals.
12161 * script.cc (script_add_extern): Define.
12162 * script-c.h (script_add_extern): Declare.
12163
12164 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
12165
12166 * object.cc (is_elf_object): Define.
12167 * object.h (is_elf_object): Declare.
12168 * archive.cc (Archive::get_elf_object_for_member): Call
12169 is_elf_object.
12170 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12171
12172 2009-03-24 Elliott Hughes <enh@google.com>
12173
12174 * output.cc (Output_file::map_anonymous): Define.
12175 (Output_file::map): Use map_anonymous. If the regular mmap fails,
12176 try an anonymous one. Report the size if the mmap fails.
12177 * output.h (class Output_file): Declare map_anonymous.
12178
12179 2009-03-24 Ian Lance Taylor <iant@google.com>
12180
12181 * target-select.cc (instantiate_target): Don't acquire the lock if
12182 the instantiated_target_ field has already been set.
12183
12184 2009-03-23 Ian Lance Taylor <iant@google.com>
12185
12186 * gold-threads.h (class Initialize_lock): Define.
12187 * gold-threads.cc (class Initialize_lock_once): Define.
12188 (initialize_lock_control): New static variable.
12189 (initialize_lock_pointer): New static variable.
12190 (initialize_lock_once): New static function.
12191 (Initialize_lock::Initialize_lock): Define.
12192 (Initialize_lock::initialize): Define.
12193 * target-select.h: Include "gold-threads.h".
12194 (class Target_selector): Add lock_ and initialize_lock_ fields.
12195 Don't define instantiate_target, just declare it.
12196 * target-select.cc (Target_selector::Target_selector): Initialize
12197 new fields.
12198 (Target_selector::instantiate_target): Define.
12199 * descriptors.h: Include "gold-threads.h".
12200 (class Descriptors): Add initialize_lock_ field.
12201 * descriptors.cc (Descriptors::Descriptors): Initialize new
12202 field.
12203 (Descriptors::open): Use initialize_lock_ field
12204 * errors.h (class Errors): Add initialize_lock_ field.
12205 * errors.cc (Errors::Errors): Initialize new field.
12206 (Errors::initialize_lock): Use initialize_lock_ field.
12207 * powerpc.cc (class Target_selector_powerpc): Remove
12208 instantiated_target_ field. In do_recognize call
12209 instantiate_target rather than do_instantiate_target. In
12210 do_instantiate_target just allocate a new target.
12211 * sparc.cc (class Target_selector_sparc): Likewise.
12212
12213 * freebsd.h: New file.
12214 * i386.cc: Include "freebsd.h".
12215 (Target_i386): Derive from Target_freebsd rather than
12216 Sized_target.
12217 (Target_selector_i386): Derive from Target_selector_freebsd rather
12218 than Target_selector.
12219 * x86_64.cc: Include "freebsd.h".
12220 (Target_x86_64): Derive from Target_freebsd rather than
12221 Sized_target.
12222 (Target_selector_x86_64): Derive from Target_selector_freebsd
12223 rather than Target_selector.
12224 * target.h (class Target): Add adjust_elf_header and
12225 do_adjust_elf_header.
12226 * output.cc (Output_file_header:: do_sized_write): Call target
12227 adjust_elf_header routine.
12228 * configure.tgt: Set targ_osabi.
12229 * configure.ac: Define GOLD_DEFAULT_OSABI.
12230 * parameters.cc (Parameters::default_target): Pass
12231 GOLD_DEFAULT_OSABI to select_target.
12232 * target-select.h (class Target_selector): Make instantiate_target
12233 protected rather than private.
12234 * Makefile.am (HFILES): Add freebsd.h.
12235 * configure, Makefile.in, config.in: Rebuild.
12236
12237 * merge.cc (do_add_input_section): Correct pend value. Change
12238 message about last entry not being null terminated from error to
12239 warning.
12240
12241 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
12242
12243 * incremental.cc: New file.
12244 * Makefile.am (CCFILES): Add incremental.cc.
12245 * Makefile.in: Rebuild.
12246
12247 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
12248
12249 * layout.cc (Layout::output_section_name): Preserve names
12250 of '.note.' sections.
12251
12252 2009-03-19 Ian Lance Taylor <iant@google.com>
12253
12254 * descriptors.cc (Descriptors::open): Check that the options are
12255 valid before using them.
12256
12257 2009-03-18 Ian Lance Taylor <iant@google.com>
12258
12259 * script-sections.h: Include <list>.
12260 (class Script_sections): Change Sections_elements from std::vector
12261 to std::list. Typedef public Elements_iterator. Add
12262 orphan_section_placement_, data_segment_align_start_, and
12263 saw_data_segment_align_ fields. Remove data_segment_align_index_
12264 field.
12265 * script-sections.cc (class Orphan_section_placement): New class.
12266 (class Sections_element): Add virtual functions is_relro and
12267 orphan_section_init. Remove virtual function place_orphan_here.
12268 (class Output_section_definition): Add is_relro and
12269 orphan_section_init. Remove place_orphan_here.
12270 (class Orphan_output_section): Likewise.
12271 (Script_sections::Script_sections): Update for field changes.
12272 (Script_sections::data_segment_align): Set saw_data_segment_align_
12273 and data_segment_align_start_, not data_segment_align_index.
12274 (Script_sections::data_segment_relro_end): Check
12275 saw_data_segment_align_. Use data_segment_align_start_ rather
12276 than data_segment_align_index_.
12277 (Script_sections::place_orphan): Rewrite to use
12278 Orphan_section_placement.
12279
12280 2009-03-17 Ian Lance Taylor <iant@google.com>
12281
12282 * archive.cc (Archive::add_symbols): Check for a version attached
12283 to the symbol name in the archive map.
12284 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12285 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12286 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12287 (ver_test_11.a): New target.
12288 * testsuite/Makefile.in: Rebuild.
12289
12290 * configure.ac: Check for chsize and posix_fallocate. Replace
12291 ftruncate.
12292 * ftruncate.c: New file, from gnulib.
12293 * output.cc (posix_fallocate): Define dummy version if not
12294 HAVE_POSIX_FALLOCATE.
12295 (Output_file::map): Call posix_fallocate rather than lseek and
12296 write.
12297 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12298 * configure, Makefile.in, config.in: Rebuild.
12299
12300 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
12301
12302 * layout.h (Layout::create_note): Add section_name parameter.
12303 * layout.cc (Layout::create_note): Likewise.
12304 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12305
12306 2009-03-17 Ian Lance Taylor <iant@google.com>
12307
12308 * descriptors.cc: Include "options.h".
12309 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12310 (Descriptors::open): Always use O_CLOEXEC when opening a new
12311 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
12312 then set FD_CLOEXEC.
12313
12314 * sparc.cc (class Target_sparc): Add has_got_section.
12315 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12316 make sure we have a GOT section.
12317
12318 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12319 (Target_sparc::Scan::local): Likewise.
12320 (Target_sparc::Scan::global): Likewise.
12321 (Target_sparc::Relocate::relocate): Likewise.
12322 (Target_sparc::Relocate::relocate_tls): Likewise.
12323
12324 * symtab.cc (Symbol_table::define_default_version): New function,
12325 broken out of add_from_object.
12326 (Symbol_table::add_from_object): Call define_default_version.
12327 (Symbol_table::define_special_symbol): Add resolve_oldsym
12328 parameter. Change all callers. If the version for a symbol comes
12329 from a version script, resolve it with the symbol with the same
12330 name with no version. Also add the symbol without a version if
12331 appropriate.
12332 (do_define_in_output_data): If resolving with oldsym, don't delete
12333 sym.
12334 (do_define_in_output_segment): Likewise.
12335 (do_define_as_constant): Likewise.
12336 * symtab.h (class Symbol_table): Update declarations.
12337
12338 2009-03-13 Ian Lance Taylor <iant@google.com>
12339
12340 * readsyms.cc (Read_symbols::incompatible_warning): New function.
12341 (Read_symbols::requeue): New function.
12342 (Read_symbols::do_read_symbols): If make_elf_object fails because
12343 the target type is not configured, and the file was searched for,
12344 issue a warning and retry with the next directory.
12345 (Add_symbols::run): If the file has an incompatible format, and
12346 it was searched for, requeue the Read_symbols task. On error,
12347 release the object.
12348 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
12349 dirindex parameter to constructor. Change all callers. Declare
12350 incompatible_warning and requeue.
12351 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12352 input_argument_ and input_group_ fields. Add them to
12353 constructor. Change all callers.
12354 (class Read_script): Add dirindex_ field. Add it to constructor.
12355 Change all callers.
12356 * archive.cc (Archive::setup): Remove input_objects parameter.
12357 Change all callers.
12358 (Archive::get_file_and_offset): Likewise.
12359 (Archive::read_all_symbols): Likewise.
12360 (Archive::read_symbols): Likewise.
12361 (Archive::get_elf_object_for_member): Remove input_objects
12362 parameter. Add punconfigured parameter. Change all callers.
12363 (Archive::add_symbols): Change return type to bool. Check return
12364 value of include_member.
12365 (Archive::include_all_members): Likewise.
12366 (Archive::include_member): Change return type to bool. Return
12367 false if first included object has incompatible target. Set
12368 included_member_ field.
12369 (Add_archive_symbols::run): If add_symbols returns false, requeue
12370 Read_symbols task.
12371 * archive.h (class Archive): Add included_member_ field.
12372 Initialize it in constructor. Add input_file and searched_for
12373 methods. Update declarations.
12374 (class Add_archive_symbols): Add dirpath_, dirindex_, and
12375 input_argument_ fields. Add them to constructor. Change all
12376 callers.
12377 * script.cc: Include "target-select.h".
12378 (class Parser_closure): Add skip_on_incompatible_target_ and
12379 found_incompatible_target_ fields. Add
12380 skip_on_incompatible_target parameter to constructor. Change all
12381 callers. Add methods skip_on_incompatible_target,
12382 clear_skip_on_incompatible_target, found_incompatible_target, and
12383 set_found_incompatible_target.
12384 (read_input_script): Add dirindex parameter. Change all callers.
12385 If parser finds an incompatible target, requeue Read_symbols
12386 task.
12387 (script_set_symbol): Clear skip_on_incompatible_target in
12388 closure.
12389 (script_add_assertion, script_parse_option): Likewise.
12390 (script_start_sections, script_add_phdr): Likewise.
12391 (script_check_output_format): New function.
12392 * script.h (read_input_script): Update declaration.
12393 * script-c.h (script_check_output_format): Declare.
12394 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12395 (ignore_cmd): Remove OUTPUT_FORMAT.
12396 * fileread.cc (Input_file::Input_file): Add explicit this.
12397 (Input_file::will_search_for): New function.
12398 (Input_file::open): Add pindex parameter. Change all callers.
12399 * fileread.h (class Input_file): Add input_file_argument method.
12400 Declare will_search_for. Update declarations.
12401 * object.cc (make_elf_object): Add punconfigured parameter.
12402 Change all callers.
12403 * object.h (class Object): Make input_file public. Add
12404 searched_for method.
12405 (make_elf_object): Update declaration.
12406 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
12407 restart search.
12408 * dirsearch.h (class Dirsearch): Update declaration.
12409 * options.h (class General_options): Add --warn-search-mismatch.
12410 * parameters.cc (Parameters::is_compatible_target): New function.
12411 * parameters.h (class Parameters): Declare is_compatible_target.
12412 * workqueue.cc (Workqueue::add_blocker): New function.
12413 * workqueue.h (class Workqueue): Declare add_blocker.
12414
12415 * fileread.cc (Input_file::open): Remove options parameter.
12416 Change all callers.
12417 (Input_file::open_binary): Likewise.
12418 * script.cc (read_input_script): Likewise.
12419 * readsyms.h (class Read_symbols): Remove options_ field. Remove
12420 options parameter from constructor. Change all callers.
12421 (class Read_script): Likewise.
12422 * fileread.h (class Input_file): Update declarations.
12423 * script.h (read_input_script): Update declaration.
12424
12425 2009-03-10 Nick Clifton <nickc@redhat.com>
12426
12427 * po/es.po: New Spanish translation.
12428
12429 2009-03-06 Cary Coutant <ccoutant@google.com>
12430
12431 * options.cc (parse_short_option): Keep dash_z from registering itself.
12432
12433 2009-03-03 Ian Lance Taylor <iant@google.com>
12434
12435 PR 9918
12436 * target-reloc.h (relocate_section): Pass output_section to
12437 relocate.
12438 * i386.cc (Target_i386::should_apply_static_reloc): Add
12439 output_section parameter. Change all callers.
12440 (Target_i386::Relocate::relocate): Add output_section parameter.
12441 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12442 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12443 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12444 * testsuite/two_file_shared.sh: New script.
12445 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12446 (check_DATA): Add two_file_shared.dbg.
12447 (two_file_shared.dbg): New target.
12448 * testsuite/Makefile.in: Rebuild.
12449
12450 2009-03-01 Ian Lance Taylor <iant@google.com>
12451
12452 * configure.ac: Check for byteswap.h.
12453 * configure: Rebuild.
12454 * config.in: Rebuild.
12455
12456 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
12457
12458 * layout.cc (Layout::find_or_add_kept_section): New function.
12459 (Layout::add_comdat): Removed.
12460 * layout.h (struct Kept_section): Move out of class Layout.
12461 Remove trailing underscores from field names. Add group_sections
12462 field. Rename group_ field to is_group. Change all uses.
12463 (class Layout): Declare find_or_add_kept_section, not add_comdat.
12464 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12465 comdat_groups_ field.
12466 (Sized_relobj::include_section_group): Use
12467 find_or_add_kept_section and Kept_section::group_sections.
12468 (Sized_relobj::include_linkonce_section): Likewise.
12469 * object.cc (class Sized_relobj): Don't define Comdat_group or
12470 Comdat_group_table. Remove find_comdat_group and
12471 add_comdat_group. Remove comdat_groups_ field.
12472 * plugin.cc (include_comdat_group): Use
12473 Layout::find_or_add_kept_section.
12474
12475 2009-02-28 Ian Lance Taylor <iant@google.com>
12476
12477 * README: --gc-sections and map files are now supported. Document
12478 some build requirements.
12479
12480 PR 6992
12481 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12482 relocatable link set the value of the section symbol to zero.
12483 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12484 relocatable link don't include the section address in the local
12485 symbol value.
12486
12487 2009-02-27 Ian Lance Taylor <iant@google.com>
12488
12489 PR 6811
12490 * options.h (class Search_directory): Add is_system_directory.
12491 (class General_options): Declare is_in_system_directory.
12492 * options.cc (get_relative_sysroot): Make static.
12493 (get_default_sysroot): Make static.
12494 (General_optoins::is_in_system_directory): New function.
12495 * fileread.cc (Input_file::is_in_system_directory): New function.
12496 * fileread.h (class Input_file): Declare is_in_system_directory.
12497 * object.h (class Object): Add is_in_system_directory.
12498 (class Input_objects): Remove system_library_directory_ field.
12499 * object.cc (Input_objects::add_object): Don't set
12500 system_library_directory_.
12501 (input_objects::found_in_system_library_directory): Remove.
12502 * symtab.cc (Symbol_table::write_globals): Remove input_objects
12503 parameter. Change all callers.
12504 (Symbol_table::sized_write_globals): Likewise.
12505 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12506 Call Object::is_in_system_directory.
12507 * symtab.h (class Symbol_table): Update declarations.
12508
12509 PR 5990
12510 * descriptors.h (Open_descriptor): Add is_on_stack field.
12511 * descriptors.cc (Descriptors::open): If the descriptor is on the
12512 top of the stack, remove it. Initialize is_on_stack field.
12513 (Descriptors::release): Only add pod to stack if it is not on the
12514 stack already.
12515 (Descriptors::close_some_descriptor): Clear stack_next and
12516 is_on_stack fields.
12517
12518 PR 7091
12519 * output.cc (Output_section::find_starting_output_address): Rename
12520 from starting_output_address; add PADDR parameter; change return
12521 type.
12522 * output.h (class Output_section): Declare
12523 find_starting_output_address instead of starting_output_address.
12524 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12525 section symbol for which we can't find a merge section.
12526
12527 PR 9836
12528 * symtab.cc (Symbol_table::add_from_object): If the visibility is
12529 hidden or internal, force the symbol to be local.
12530 * resolve.cc (Symbol::override_visibility): Define.
12531 (Symbol::override_base): Use override_visibility.
12532 (Symbol_table::resolve): Likewise.
12533 (Symbol::override_base_with_special): Likewise.
12534 (Symbol_table::override_with_special): If the visibility is hidden
12535 or internal, force the symbol to be local.
12536 * symtab.h (class Symbol): Add set_visibility and
12537 override_visibility.
12538 * testsuite/ver_test_1.sh: New file.
12539 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12540 (check_DATA): Add ver_test_1.syms.
12541 (ver_test_1.syms): New target.
12542 * testsuite/Makefile.in: Rebuild.
12543
12544 2009-02-25 Cary Coutant <ccoutant@google.com>
12545
12546 * layout.cc (Layout::choose_output_section): Don't rename sections
12547 when using a linker script that has a SECTIONS clause.
12548 * Makefile.in: Regenerate.
12549
12550 * testsuite/Makefile.am (script_test_5.sh): New test case.
12551 * testsuite/Makefile.in: Regenerate.
12552 * testsuite/script_test_5.cc: New file.
12553 * testsuite/script_test_5.sh: New file.
12554 * testsuite/script_test_5.t: New file.
12555
12556 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
12557
12558 * archive.cc (Archive::include_member): Update calls to add_symbols.
12559 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12560 the Layout argument.
12561 * dynobj.h (do_add_symbols): Add the Layout argument.
12562 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12563 Layout argument.
12564 * object.h (Object::add_symbols): Add the Layout argument.
12565 (Object::do_add_symbols): Add the Layout argument.
12566 (Sized_relobj::do_add_symbols): Add the Layout argument.
12567 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12568 Unify the two versions.
12569 (Add_plugin_symbols): Remove.
12570 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12571 (Sized_pluginobj::do_add_symbols): Unify the two versions.
12572 (Add_plugin_symbols): Remove.
12573 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12574 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12575 (Add_symbols::run): Make it work with Pulginobj.
12576
12577 2009-02-06 Ian Lance Taylor <iant@google.com>
12578
12579 * object.cc (Sized_relobj::do_layout): Make info message start
12580 with lower case letter.
12581
12582 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
12583
12584 * binary.cc: Fix file comment.
12585
12586 * options.h (enum Incremental_disposition): Define.
12587 (class General_options): Add new options: --incremental,
12588 --incremental_changed, --incremental_unchanged,
12589 --incremental_unknown. Add incremental_disposition_ and
12590 implicit_incremental_ fields.
12591 (General_options::incremental_disposition): New function.
12592 (class Position_dependent_options): Add incremental_disposition
12593 option.
12594 (Position_dependent_options::copy_from_options): Set incremental
12595 dispositions.
12596 * options.cc (General_options::parse_incremental_changed): New
12597 function.
12598 (General_options::parse_incremental_unchanged): New function.
12599 (General_options::parse_incremental_unknown): New function.
12600 (General_options::General_options): Initialize new fields
12601 incremental_disposition_ and implicit_incremental_.
12602 (General_options::finalize): Check for uasge of --incremental-*
12603 without --incremental.
12604
12605 2009-02-06 Chris Demetriou <cgd@google.com>
12606
12607 * gold.h (gold_undefined_symbol): Change to take only a Symbol
12608 pointer and to report location as the file name associated with
12609 the symbol.
12610 (gold_undefined_symbol_at_location): New function to replace the
12611 old gold_undefined_symbol functionality.
12612 * target-reloc.h (relocate_section): Update to use
12613 gold_undefined_symbol_at_location.
12614 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12615 Call gold_undefined_symbol function rather than gold_error.
12616 * errors.h (Errors::undefined_symbol): Take location as a
12617 string, rather than calculating it from a relocation.
12618 * errors.cc (Errors::fatal): Print "fatal error:" before the
12619 formatted message.
12620 (Errors::error, Errors::error_at_location): Print "error: "
12621 before the formatted message.
12622 (Errors::undefined_symbol): Take location as a string, rather
12623 than calculating it from a relocation.
12624 (gold_undefined_symbol_at_location): New function akin to
12625 old gold_undefined_symbol, calculates location from relocation.
12626 (gold_undefined_symbol): Change to take only a Symbol pointer
12627 and to report location as the file name associated with the symbol.
12628 * testsuite/debug_msg.sh: Update for changed error messages.
12629 * testsuite/undef_symbol.sh: Likewise.
12630
12631 2009-02-04 Duncan Sands <baldrick@free.fr>
12632
12633 PR 9812
12634 * reduced_debug_output.h
12635 (Output_reduced_debug_abbrev_section::failed): Use format for
12636 gold_warning.
12637 (Output_reduced_debug_info_section::faild): Likewise.
12638
12639 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
12640
12641 * script.cc (Lazy_demangler): New class.
12642 (Version_script_info::get_symbol_version_helper): Demangle a
12643 symbol only once.
12644
12645 2009-01-29 Cary Coutant <ccoutant@google.com>
12646
12647 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12648 to __tls_get_addr.
12649 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12650
12651 2009-01-28 Ian Lance Taylor <iant@google.com>
12652
12653 * version.cc (version_string): Bump to 1.9.
12654
12655 * gold.h: Include <cstring> and <stdint.h>.
12656 * version.cc: Include <cstdio>.
12657 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12658 warning.
12659 * reduced_debug_output.cc (insert_into_vector): Rename from
12660 Insert_into_vector; change all callers. Use Swap_unaligned to
12661 avoid aliasing issue; remove union since it is unnecessary.
12662
12663 2009-01-27 Sriraman Tallam <tmsriram@google.com>
12664
12665 * Makefile.am (CCFILES): Add gc.cc.
12666 (HFILES): Add gc.h.
12667 * Makefile.in: Regenerate.
12668 * gold.cc (Gc_runner): New class.
12669 (queue_initial_tasks): Call garbage collection related tasks
12670 when corresponding options are invoked.
12671 (queue_middle_gc_tasks): New function.
12672 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12673 processed early before laying out sections during garbage collection.
12674 * gold.h (queue_middle_gc_tasks): New function.
12675 (is_prefix_of): Move from "layout.cc".
12676 * i386.cc (Target_i386::gc_process_relocs): New function.
12677 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12678 * main.cc (main): Create object of class "Garbage_collection".
12679 * object.cc (Relobj::copy_symbols_data): New function.
12680 (Relobj::is_section_name_included): New function.
12681 (Sized_relobj::do_layout): Allow this function to be called twice
12682 during garbage collection and defer layout of section during the
12683 first call.
12684 * object.h (Relobj::get_symbols_data): New function.
12685 (Relobj::is_section_name_included): New function.
12686 (Relobj::copy_symbols_data): New function.
12687 (Relobj::set_symbols_data): New function.
12688 (Relobj::get_relocs_data): New function.
12689 (Relobj::set_relocs_data): New function.
12690 (Relobj::is_output_section_offset_invalid): New pure virtual function.
12691 (Relobj::gc_process_relocs): New function.
12692 (Relobj::do_gc_process_relocs): New pure virtual function.
12693 (Relobj::sd_): New data member.
12694 (Sized_relobj::is_output_section_offset_invalid): New function.
12695 (Sized_relobj::do_gc_process_relocs): New function.
12696 * options.h (General_options::gc_sections): Modify to not be a no-op.
12697 (General_options::print_gc_sections): New option.
12698 * plugin.cc (Plugin_finish::run): Remove function call to
12699 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
12700 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12701 * reloc.cc (Read_relocs::run): Add task to process relocs and
12702 determine unreferenced sections when doing garbage collection.
12703 (Gc_process_relocs): New class.
12704 (Sized_relobj::do_gc_process_relocs): New function.
12705 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12706 sections that are garbage collected.
12707 * reloc.h (Gc_process_relocs): New class.
12708 * sparc.cc (Target_sparc::gc_process_relocs): New function.
12709 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12710 symbols whose corresponding sections are garbage collected.
12711 (Symbol_table::Symbol_table): Add new parameter for the garbage
12712 collection object.
12713 (Symbol_table::gc_mark_undef_symbols): New function.
12714 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12715 (Symbol_table::gc_mark_dyn_syms): New function.
12716 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12717 as garbage.
12718 (Symbol_table::add_from_object): Likewise.
12719 (Symbol_table::add_from_relobj): When building shared objects, do not
12720 treat externally visible symbols as garbage.
12721 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12722 table information for static and relocatable links.
12723 * symtab.h (Symbol_table::set_gc): New function.
12724 (Symbol_table::gc): New function.
12725 (Symbol_table::gc_mark_undef_symbols): New function.
12726 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12727 (Symbol_table::gc_mark_dyn_syms): New function.
12728 (Symbol_table::gc_): New data member.
12729 * target.h (Sized_target::gc_process_relocs): New pure virtual
12730 function.
12731 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12732 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12733
12734 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
12735
12736 * options.h (General_options::gc_sections): Define as a no-op for now.
12737 (General_options::no_keep_memory): Ditto.
12738 (General_options::Bshareable): Define.
12739 * options.cc (General_options::finalize): Honor -Bshareable.
12740
12741 2009-01-20 Andreas Schwab <schwab@suse.de>
12742
12743 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12744 read the value in the contents, since we don't use it. Use the
12745 template endianness when writing.
12746 (Relocate::relocate): Use it for R_PPC_REL16_HA.
12747
12748 2009-01-19 Andreas Schwab <schwab@suse.de>
12749
12750 * configure.tgt (powerpc64-*): Fix targ_obj.
12751
12752 2009-01-15 Ian Lance Taylor <iant@google.com>
12753
12754 * object.cc (Sized_relobj::write_local_symbols): Don't write out
12755 local symbols when stripping all symbols.
12756
12757 2009-01-14 Cary Coutant <ccoutant@google.com>
12758
12759 * output.cc (Output_reloc): Add explicit instantiations.
12760
12761 2009-01-14 Cary Coutant <ccoutant@google.com>
12762
12763 * archive.cc (Archive::get_elf_object_for_member): Remove call
12764 to File_read::claim_for_plugin.
12765 * descriptors.cc (Descriptors::open): Remove reference to
12766 is_claimed.
12767 (Descriptors::claim_for_plugin): Remove.
12768 * descriptors.h (Descriptors::claim_for_plugin): Remove.
12769 (Descriptors::is_claimed): Remove.
12770 (claim_descriptor_for_plugin): Remove.
12771 * fileread.cc (File_read::claim_for_plugin): Remove.
12772 * fileread.h (File_read::claim_for_plugin): Remove.
12773 (File_read::descriptor): Reopen descriptor if necessary.
12774 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
12775 (Plugin_manager::all_symbols_read): Add task parameter. Change
12776 all callers.
12777 (Plugin_manager::get_input_file): New function.
12778 (Plugin_manager::release_input_file): New function.
12779 (Pluginobj::Pluginobj): Add filesize parameter and initialize
12780 corresponding data member.
12781 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12782 and pass to base constructor. Change all callers.
12783 (get_input_file, release_input_file): New functions.
12784 (make_sized_plugin_object): Add filesize parameter. Change all callers.
12785 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12786 (Plugin_manager::all_symbols_read): Add task parameter.
12787 (Plugin_manager::get_input_file): New function.
12788 (Plugin_manager::release_input_file): New function.
12789 (Plugin_manager::task_): New data member.
12790 (Pluginobj::Pluginobj): Add filesize parameter.
12791 (Pluginobj::filename): New function.
12792 (Pluginobj::descriptor): New function.
12793 (Pluginobj::filesize): New function.
12794 (Pluginobj::filesize_): New data member.
12795 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12796 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12797 File_read::claim_for_plugin; use Object::unlock to unlock the file.
12798
12799 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12800 with archive libraries.
12801 * testsuite/Makefile.in: Regenerate.
12802 * testsuite/plugin_test.c (struct sym_info): New type.
12803 (get_input_file, release_input_file): New static variables.
12804 (onload): Capture new transfer vector entries.
12805 (claim_file_hook): Stop reading at end of file according to filesize.
12806 Factor out parsing of readelf output into separate function.
12807 (all_symbols_read_hook): Exercise get_input_file and release_input_file
12808 APIs and get the source file name from the symbol table. Convert
12809 source file name to corresponding object file name. Print info
12810 message when adding new input files.
12811 (parse_readelf_line): New function.
12812 * testsuite/plugin_test_1.sh: Add checks for new info messages.
12813 * testsuite/plugin_test_2.sh: Likewise.
12814 * testsuite/plugin_test_3.sh: Likewise.
12815 * testsuite/plugin_test_4.sh: New test case.
12816
12817 2009-01-07 Ian Lance Taylor <iant@google.com>
12818
12819 * version.cc (version_string): Bump to 1.8.
12820
12821 2008-12-23 Cary Coutant <ccoutant@google.com>
12822
12823 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12824 * plugin.cc (Plugin_manager::finish): Rename as
12825 layout_deferred_objects. Move cleanup to separate function.
12826 (Plugin_manager::cleanup): New function.
12827 (Plugin_finish::run): Call layout_deferred_objects and cleanup
12828 separately.
12829 * plugin.h (Plugin_manager::finish): Rename as
12830 layout_deferred_objects.
12831 (Plugin_manager::cleanup): New function.
12832 (Plugin_manager::cleanup_done): New field.
12833
12834 2008-12-23 Cary Coutant <ccoutant@google.com>
12835
12836 * plugin.cc (is_visible_from_outside): New function.
12837 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12838 so we don't return "IR only" status for exported symbols or -r links.
12839
12840 * testsuite/Makefile.am (plugin_test_3): New test case.
12841 * testsuite/Makefile.in: Regenerate.
12842 * testsuite/plugin_test_3.sh: New file.
12843
12844 2008-12-22 Cary Coutant <ccoutant@google.com>
12845
12846 * object.cc (Sized_relobj::layout_section): New function.
12847 (Sized_relobj::do_layout): Defer layout of input sections until after
12848 plugin has provided replacement files.
12849 (Sized_relobj::do_layout_deferred_sections): New function.
12850 * object.h (Relobj::set_section_offset): Remove virtual keyword.
12851 (Relobj::layout_deferred_sections): New function.
12852 (Relobj::do_layout_deferred_sections): New function.
12853 (Sized_relobj::do_layout_deferred_sections): New function.
12854 (Sized_relobj::layout_section): New function.
12855 (Sized_relobj::Deferred_layout): New structure.
12856 (Sized_relobj::deferred_layout_): New field.
12857 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12858 Change all callers. Layout deferred sections.
12859 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
12860 references.
12861 (Plugin_hook::run): Move code from do_plugin_hook inline.
12862 (Plugin_hook::do_plugin_hook): Remove.
12863 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12864 (Plugin_manager::finish): Renamed, was cleanup.
12865 (Plugin_manager::should_defer_layout): New function.
12866 (Plugin_manager::add_deferred_layout_object): New function.
12867 (Plugin_manager::Deferred_layout_list): New type.
12868 (Plugin_manager::deferred_layout_objects_): New field.
12869 (Plugin_hook::do_plugin_hook): Remove.
12870
12871 2008-12-17 Ian Lance Taylor <iant@google.com>
12872
12873 * options.h (class General_options): Add --no case for
12874 --export-dynamic.
12875
12876 2008-12-16 Cary Coutant <ccoutant@google.com>
12877
12878 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12879 vector.
12880 (Plugin_manager::claim_file): Create plugin object even if
12881 plugin did not call the add_symbols callback.
12882 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12883 asking for more symbols than were added.
12884 * testsuite/Makefile.am (plugin_test_1): Add test case with
12885 no global symbols.
12886 (empty.syms): New target.
12887 * testsuite/Makefile.in: Regenerate.
12888 * testsuite/plugin_test.c (claim_file_hook): Add new debug
12889 message. Don't call add_symbols if no globals.
12890 (all_symbols_read_hook): Don't provide replacement for empty
12891 claimed file.
12892
12893 2008-12-12 Ian Lance Taylor <iant@google.com>
12894
12895 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12896 r_type == 0 for a local symbol with r_sym == 0.
12897 (scan_relocatable_relocs): Pass r_sym to
12898 local_non_section_strategy.
12899 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12900 r_sym parameter.
12901
12902 * configure.ac: Update test for TLS descriptors: they are
12903 supported as of glibc 2.9.
12904 * configure: Rebuild.
12905
12906 2008-12-11 Ian Lance Taylor <iant@google.com>
12907
12908 PR 7091
12909 * target-reloc.h (Default_scan_relocatable_relocs): For each
12910 function, map r_type == 0 to RELOC_DISCARD.
12911
12912 2008-12-10 Cary Coutant <ccoutant@google.com>
12913
12914 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12915 object to override a kept COMDAT group from a plugin object.
12916
12917 2008-12-09 Ian Lance Taylor <iant@google.com>
12918
12919 PR 7088
12920 * yyscript.y (file_cmd): Handle INPUT.
12921
12922 * testsuite/initpri1.c: Change all declarations to be full
12923 prototypes by adding void, to avoid compiler warnings.
12924
12925 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
12926
12927 * options.cc (General_options::parse_plugin_opt): New.
12928 (General_options::add_plugin): The argument now is just the filename.
12929 (General_options::add_plugin_option): New.
12930 * options.h (plugin_opt): New.
12931 (add_plugin): Change argument name.
12932 (add_plugin_option): New.
12933 * plugin.cc (Plugin::load): Don't parse the plugin option.
12934 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12935 (Plugin::add_option): New.
12936 (Plugin::args_): Change type.
12937 (Plugin::filename_): New.
12938 (Plugin_manager::add_plugin_option): New.
12939 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12940 * testsuite/Makefile.in: Regenerate.
12941
12942 2008-12-05 Cary Coutant <ccoutant@google.com>
12943
12944 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12945 Handle --strip-lto-sections option.
12946 * options.h (strip_lto_sections): New option.
12947
12948 2008-12-01 Cary Coutant <ccoutant@google.com>
12949
12950 * plugin.cc (ld_plugin_message): Change format parameter to const.
12951 Fix mismatch between new[] and delete.
12952
12953 2008-11-14 Cary Coutant <ccoutant@google.com>
12954
12955 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12956 instead of -1U.
12957
12958 2008-11-05 Craig Silverstein <csilvers@google.com>
12959
12960 * options.cc (General_options::parse_dynamic_list): New function.
12961 * options.h (General_options): New flags dynamic_list,
12962 dynamic_list_data, dynamic_list_cpp_new, and
12963 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
12964 (General_options::in_dynamic_list): New function.
12965 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12966 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12967 (Lex::can_continue_name): Likewise.
12968 (yylex): Likewise.
12969 (read_script_file): New parameter script_options.
12970 (read_dynamic_list): New function.
12971 (Script_options::define_dynamic_list): New function.
12972 (dynamic_list_keyword_parsecodes): New variable.
12973 (dynamic_list_keywords): New variable.
12974 * script.h (Script_options::define_dynamic_list): New function
12975 prototype.
12976 (read_dynamic_list): New function prototype.
12977 * symtab.cc (strprefix): New macro.
12978 (Symbol::should_add_dynsym_entry): Support dynamic_list,
12979 dynamic_list_data, dynamic_list_cpp_new, and
12980 dynamic_list_cpp_typeinfo.
12981 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12982 (dynamic_list_expr): New rule.
12983 (dynamic_list_nodes): Likewise.
12984 (dynamic_list_node): Likewise.
12985 * testsuite/Makefile.am (dynamic_list): New test.
12986 * testsuite/Makefile.in: Regenerated.
12987 * testsuite/dynamic_list.t: New file.
12988 * testsuite/dynamic_list.sh: New file.
12989
12990 2008-11-05 Craig Silverstein <csilvers@google.com>
12991
12992 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12993 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12994 (t11_last): Likewise.
12995 * testsuite/ver_test_6.c (main): Likewise.
12996
12997 2008-10-07 Cary Coutant <ccoutant@google.com>
12998
12999 * options.c (General_options::finalize): Add check for -static and
13000 -shared.
13001 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13002 is not empty.
13003
13004 2008-10-02 Cary Coutant <ccoutant@google.com>
13005
13006 * plugin.cc (make_sized_plugin_object): Fix conditional
13007 compilation to work when not all targets are enabled.
13008
13009 2008-09-29 Cary Coutant <ccoutant@google.com>
13010
13011 * archive.cc (Archive::get_file_and_offset): Use filename instead
13012 of name to get library path.
13013 (Archive::include_member): Unlock external member of a thin archive.
13014
13015 * testsuite/Makefile.am (TEST_AR): New variable.
13016 (thin_archive_test_1): New test.
13017 (thin_archive_test_2): New test.
13018 * testsuite/Makefile.in: Regenerate.
13019 * testsuite/thin_archive_main.cc: New file.
13020 * testsuite/thin_archive_test_1.cc: New file.
13021 * testsuite/thin_archive_test_2.cc: New file.
13022 * testsuite/thin_archive_test_3.cc: New file.
13023 * testsuite/thin_archive_test_4.cc: New file.
13024
13025 2008-09-29 Cary Coutant <ccoutant@google.com>
13026
13027 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13028 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13029 instead of -1U.
13030 (Sized_relobj::do_finalize_local_symbols): Likewise.
13031 (Sized_relobj::map_to_kept_section): Likewise.
13032 * object.h (Sized_relobj::invalid_address): New constant.
13033 (Sized_relobj::do_output_section_offset): Check for invalid_address
13034 and return -1ULL.
13035 * output.cc (Output_reloc::local_section_offset): Use constant
13036 invalid_address instead of -1U.
13037 (Output_reloc::get_address): Likewise.
13038 (Output_section::output_address): Change -1U to -1ULL.
13039 * output.h (Output_reloc::invalid_address): New constant.
13040 * reloc.cc (Sized_relobj::write_sections): Use constant
13041 invalid_address instead of -1U.
13042 (Sized_relobj::relocate_sections): Likewise.
13043 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13044 values for merge sections.
13045 * target-reloc.h (relocate_for_relocatable): Use constant
13046 invalid_address instead of -1U.
13047
13048 2008-09-19 Cary Coutant <ccoutant@google.com>
13049
13050 Add plugin functionality for link-time optimization (LTO).
13051 * configure.ac (plugins): Add --enable-plugins option.
13052 * configure: Regenerate.
13053 * config.in: Regenerate.
13054 * Makefile.am (LIBDL): New variable.
13055 (CCFILES): Add plugin.cc.
13056 (HFILES): Add plugin.h.
13057 (ldadd_var): Add LIBDL.
13058 * Makefile.in: Regenerate.
13059
13060 * archive.cc: Include "plugin.h".
13061 (Archive::setup): Don't preread archive symbols when using a plugin.
13062 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
13063 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13064 files.
13065 (Archive::include_member): Add symbols from plugin objects.
13066 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13067 * descriptors.cc (Descriptors::open): Check for file descriptors
13068 abandoned by plugins.
13069 (Descriptors::claim_for_plugin): New function.
13070 * descriptors.h (Descriptors::claim_for_plugin): New function.
13071 (Open_descriptor::is_claimed): New field.
13072 (claim_descriptor_for_plugin): New function.
13073 * fileread.cc (File_read::claim_for_plugin): New function.
13074 * fileread.h (File_read::claim_for_plugin): New function.
13075 (File_read::descriptor): New function.
13076 * gold.cc: Include "plugin.h".
13077 (queue_initial_tasks): Add task to call plugin hooks for generating
13078 new object files.
13079 * main.cc: Include "plugin.h".
13080 (main): Load plugin libraries.
13081 * object.h (Pluginobj): Declare.
13082 (Object::pluginobj): New function.
13083 (Object::do_pluginobj): New function.
13084 (Object::set_target): New function.
13085 * options.cc: Include "plugin.h".
13086 (General_options::parse_plugin): New function.
13087 (General_options::General_options): Initialize plugins_ field.
13088 (General_options::add_plugin): New function.
13089 * options.h (Plugin_manager): Declare.
13090 (General_options): Add --plugin option.
13091 (General_options::has_plugins): New function.
13092 (General_options::plugins): New function.
13093 (General_options::add_plugin): New function.
13094 (General_options::plugins_): New field.
13095 * plugin.cc: New file.
13096 * plugin.h: New file.
13097 * readsyms.cc: Include "plugin.h".
13098 (Read_symbols::do_read_symbols): Check for archive before checking
13099 for ELF file. Call plugin hooks to claim files.
13100 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13101 from a real object file; force override when processing replacement
13102 files.
13103 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13104 (Symbol::init_base_object): Likewise.
13105 (Symbol::init_base_output_data): Likewise.
13106 (Symbol::init_base_output_segment): Likewise.
13107 (Symbol::init_base_constant): Likewise.
13108 (Symbol::init_base_undefined): Likewise.
13109 (Symbol::output_section): Assert that object is not a plugin.
13110 (Symbol_table::add_from_pluginobj): New function.
13111 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13112 undefined.
13113 (Symbol_table::sized_write_globals): Likewise.
13114 (Symbol_table::add_from_pluginobj): Instantiate template.
13115 * symtab.h (Sized_pluginobj): Declare.
13116 (Symbol::in_real_elf): New function.
13117 (Symbol::set_in_real_elf): New function.
13118 (Symbol::in_real_elf_): New field.
13119 (Symbol_table::add_from_pluginobj): New function.
13120
13121 * testsuite/Makefile.am (AM_CFLAGS): New variable.
13122 (LIBDL): New variable.
13123 (LDADD): Add LIBDL.
13124 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13125 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13126 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13127 (MOSTLYCLEANFILES): Likewise.
13128 * testsuite/Makefile.in: Regenerate.
13129 * testsuite/plugin_test.c: New file.
13130 * testsuite/plugin_test_1.sh: New file.
13131 * testsuite/plugin_test_2.sh: New file.
13132
13133 2008-09-16 Ian Lance Taylor <iant@google.com>
13134
13135 * target-reloc.h (relocate_section): Check whether a symbol is
13136 defined by the ABI before reporting an undefined symbol error.
13137 * target.h (Target::is_defined_by_abi): Make parameter const.
13138 (Target::do_is_defined_by_abi): Likewise.
13139 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13140 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13141 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13142 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13143 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13144 * testsuite/Makefile.in: Rebuild.
13145
13146 * fileread.cc (make_view): Add casts to avoid warning.
13147
13148 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13149
13150 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13151 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13152
13153 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13154
13155 * options.h (General_options::output_is_executable): New.
13156 (General_options::output_is_pie): New.
13157 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13158 for shared libraries.
13159 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13160
13161 2008-09-11 Chris Demetriou <cgd@google.com>
13162
13163 * options.h (origin): New -z option.
13164 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13165 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13166 in DT_FLAGS_1.
13167
13168 2008-09-05 Cary Coutant <ccoutant@google.com>
13169
13170 * fileread.cc (File_read::make_view): Add check for attempt to map
13171 beyond end of file.
13172
13173 2008-09-05 Cary Coutant <ccoutant@google.com>
13174
13175 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13176 explicit instantiations.
13177
13178 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
13179
13180 PR gold/6858
13181 * options.cc (General_options::finalize): Allow undefined symbols
13182 in shlibs if linking -shared.
13183
13184 PR gold/6859
13185 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13186 symbols as not needing a dynsym entry.
13187
13188 2008-08-20 Craig Silverstein <csilvers@google.com>
13189
13190 * fileread.cc (File_read::open): Do not lock the file unless it
13191 was successfully opened.
13192
13193 2008-08-14 Cary Coutant <ccoutant@google.com>
13194
13195 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13196 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13197 * testsuite/tls_test.cc (struct int128): 128-bit struct
13198 for testing TLS relocs with non-zero addend.
13199 (v12): New TLS variable.
13200 (t12): New test.
13201 (t_last): Add check for v12.
13202 * testsuite/tls_test.h (t12): New function.
13203 * testsuite/tls_test_main.cc (thread_routine): Call new test.
13204
13205 2008-08-13 Ian Lance Taylor <iant@google.com>
13206
13207 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13208 set tls_segment_ or relro_segment_.
13209 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13210 when appropriate.
13211 * output.h (Output_section::clear_is_relro): New function.
13212 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13213 sections specially even when output_data_ is empty.
13214 (Output_segment::maximum_alignment): When first section is relro,
13215 only force alignment for PT_LOAD segments.
13216 * script.cc (script_data_segment_align): New function.
13217 (script_data_segment_relro_end): New function.
13218 * script-c.h (script_data_segment_align): Declare.
13219 (script_data_segment_relro_end): Declare.
13220 * script-sections.h (class Script_sections): Declare
13221 data_segment_align and data_segment_relro_end. Add fields
13222 segment_align_index_ and saw_relro_end_.
13223 * script-sections.cc (class Sections_element): Add set_is_relro
13224 virtual function. Add new bool* parameter to place_orphan_here.
13225 Add get_output_section virtual function.
13226 (class Output_section_definition): Add set_is_relro. Add new
13227 bool* parameter to place_orphan_here. Add get_output_section.
13228 Add is_relro_ field.
13229 (Output_section_definition::Output_section_definition): Initialize
13230 evaluated_address_, evaluated_load_address, evaluated_addralign_,
13231 and is_relro_ fields.
13232 (Output_section_definition::place_orphan_here): Add is_relro
13233 parameter.
13234 (Output_section_definition::set_section_addresses): Set relro for
13235 output section.
13236 (Output_section_definition::alternate_constraint): Likewise.
13237 (class Orphan_output_section): Add new bool* parameter to
13238 place_orphan_here. Add get_output_section.
13239 (Orphan_output_section::place_orphan_here): Add is_relro
13240 parameter.
13241 (Script_sections::Script_sections): Initialize
13242 data_segment_align_index_ and saw_relro_end_.
13243 (Script_sections::data_segment_align): New function.
13244 (Script_sections::data_segment_relro_end): New function.
13245 (Script_sections::place_orphan): Set or clear is_relro.
13246 (Script_sections::set_section_addresses): Force alignment of first
13247 TLS section.
13248 * yyscript.y (exp): Call script_data_segment_align and
13249 script_data_segment_relro_end.
13250 * testsuite/relro_script_test.t: New file.
13251 * testsuite/relro_test.cc (using_script): Declare.
13252 (t1, t2): Test using_script.
13253 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13254 (relro_script_test_SOURCES): Define.
13255 (relro_script_test_DEPENDENCIES): Define.
13256 (relro_script_test_LDFLAGS): Define.
13257 (relro_script_test_LDADD): Define.
13258 (relro_script_test.so): New target.
13259 * testsuite/Makefile.in: Rebuild.
13260
13261 2008-08-06 Cary Coutant <ccoutant@google.com>
13262
13263 * archive.cc (Archive::total_archives, Archive::total_members)
13264 (Archive::total_members_loaded): New variables.
13265 (Archive::setup): Add parameter. Add option to preread
13266 archive symbols.
13267 (Archive::read_armap): Add counter.
13268 (Archive::get_file_and_offset): New function.
13269 (Archive::get_elf_object_for_member): New function.
13270 (Archive::read_all_symbols): New function.
13271 (Archive::read_symbols): New function.
13272 (Archive::add_symbols): Add counters.
13273 (Archive::include_all_members): Use armap to find members if it's
13274 already built.
13275 (Archive::include_member): Skip reading symbols if already read.
13276 Factored code into Archive::get_file_and_offset and
13277 Archive::get_elf_object_for_member. Changed call to
13278 Mapfile::report_include_archive_member.
13279 (Archive::print_stats): New function.
13280 * archive.h: Declare Object and Read_symbols_data classes.
13281 (Archive::Archive): Add initializers for new members.
13282 (Archive::setup): Add parameter.
13283 (Archive::print_stats): New function.
13284 (Archive::total_archives, Archive::total_members)
13285 (Archive::total_members_loaded): New variables.
13286 (Archive::get_file_and_offset): New function.
13287 (Archive::get_elf_object_for_member): New function.
13288 (Archive::read_all_symbols): New function.
13289 (Archive::read_symbols): New function.
13290 (Archive::Archive_member): New class.
13291 (Archive::members_): New member.
13292 (Archive::num_members_): New member.
13293 * main.cc: Include archive.h.
13294 (main): Call Archive::print_stats.
13295 * mapfile.cc (Mapfile::report_include_archive_member): Delete
13296 archive parameter; member_name is now the fully-decorated name.
13297 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13298 * options.h: (General_options): Add --preread-archive-symbols option.
13299 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13300 Archive::setup.
13301
13302 2008-08-04 Ian Lance Taylor <iant@google.com>
13303
13304 * symtab.h (Symbol::use_plt_offset): New function.
13305 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13306 * powerpc.cc (Relocate::relocate): Likewise.
13307 * sparc.cc (Relocate::relocate): Likewise.
13308 * x86_64.cc (Relocate::relocate): Likewise.
13309 * testsuite/weak_plt.sh: New test.
13310 * testsuite/weak_plt_main.cc: New test.
13311 * testsuite/weak_plt_shared.cc: New test.
13312 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13313 (check_PROGRAMS): Add weak_plt.
13314 (check_DATA): Add weak_plt_shared.so.
13315 (weak_plt_main_pic.o, weak_plt): New targets.
13316 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13317 * testsuite/Makefile.in: Rebuild.
13318
13319 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13320 gcctestdir/ld.
13321 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13322 * testsuite/Makefile.in: Rebuild.
13323
13324 2008-08-04 Alan Modra <amodra@bigpond.net.au>
13325
13326 * Makefile.am (POTFILES.in): Set LC_ALL=C.
13327 * Makefile.in: Regenerate.
13328 * po/POTFILES.in: Regenerate.
13329
13330 2008-07-29 Ian Lance Taylor <iant@google.com>
13331
13332 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13333 symbols before other symbols.
13334 * testsuite/script_test_2.cc (test_addr): Declare.
13335 (test_addr_alias): Declare.
13336 (main): Check that test_addr and test_addr_alias have the right
13337 values.
13338 * testsuite/script_test_2.t: Define test_addr_alias and
13339 test_addr.
13340
13341 2008-07-24 Ian Lance Taylor <iant@google.com>
13342
13343 PR 5990
13344 * descriptors.cc: New file.
13345 * descriptors.h: New file.
13346 * gold-threads.h (class Hold_optional_lock): New class.
13347 * fileread.cc: Include "descriptors.h".
13348 (File_read::~File_read): Release descriptor rather than closing
13349 it.
13350 (File_read::open) [file]: Call open_descriptor rather than open.
13351 Set is_descriptor_opened_.
13352 (File_read::open) [memory]: Assert that descriptor is not open.
13353 (File_read::reopen_descriptor): New function.
13354 (File_read::release): Release descriptor.
13355 (File_read::do_read): Make non-const. Reopen descriptor.
13356 (File_read::read): Make non-const.
13357 (File_read::make_view): Reopen descriptor.
13358 (File_read::do_readv): Likewise.
13359 * fileread.h (class File_read): Add is_descriptor_opened_ field.
13360 Update declarations.
13361 * layout.cc: Include "descriptors.h".
13362 (Layout::create_build_id): Use open_descriptor rather than open.
13363 * output.cc: Include "descriptors.h".
13364 (Output_file::open): Use open_descriptor rather than open.
13365 * archive.cc (Archive::const_iterator): Change Archive to be
13366 non-const.
13367 (Archive::begin, Archive::end): Make non-const.
13368 (Archive::count_members): Likewise.
13369 * archive.h (class Archive): Update declarations.
13370 * object.h (Object::read): Make non-const.
13371 * Makefile.am (CCFILES): Add descriptors.cc.
13372 (HFILES): Add descriptors.h.
13373 * Makefile.in: Rebuild.
13374
13375 PR 6716
13376 * gold.h: Always include <clocale>. Add Solaris workarounds
13377 following code in binutils/sysdep.h.
13378
13379 PR 6048
13380 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13381 this->eh_frame_hdr_ is NULL before using it.
13382
13383 * dynobj.cc (Versions::Versions): Update comment.
13384
13385 * dynobj.cc (Versions::Versions): If there is an soname, use it as
13386 the base version name.
13387
13388 * stringpool.cc (Stringpool_template::add_with_length): Set key to
13389 array size plus one.
13390 (Stringpool_template::set_string_offsets): Subtract one from key
13391 before using it as an array index.
13392 (Stringpool_template::get_offset_with_length): Likewise.
13393 (Stringpool_template::write_to_buffer): Likewise.
13394 * stringpool.h (Stringpool_template::get_offset_from_key):
13395 Likewise.
13396
13397 2008-07-23 Ian Lance Taylor <iant@google.com>
13398
13399 PR 6658
13400 * object.h (Merged_symbol_value::value): Do our best to handle a
13401 negative addend.
13402
13403 PR 6647
13404 * script.cc (Version_script_info::get_versions): Don't add empty
13405 version tag to return value.
13406 (Version_script_info::get_symbol_version_helper): Change return
13407 type to bool. Add pversion parameter. Change all callers.
13408 (script_register_vers_node): Don't require a non-NULL tag.
13409 * script.h (class Version_script_info): Update declarations.
13410 (Version_script_info::get_symbol_version): Change return type to
13411 bool. Add version parameter. Change all callers.
13412 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13413 handling. Handle an empty version from a version script.
13414 (Symbol_table::define_special_symbol): Likewise.
13415 * testsuite/ver_test_10.script: New file.
13416 * testsuite/ver_test_10.sh: New file.
13417 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13418 (check_DATA): Add ver_test_10.syms.
13419 (ver_test_10.syms, ver_test_10.so): New target.
13420 * testsuite/Makefile.in: Rebuild.
13421
13422 2008-07-23 Simon Baldwin <simonb@google.com>
13423
13424 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13425 to zero for undefined symbols from dynamic libraries.
13426
13427 2008-07-23 Ian Lance Taylor <iant@google.com>
13428
13429 * symtab.cc (Symbol_table::resolve): Remove version parameter.
13430 Change all callers.
13431 * symtab.h (class Symbol_table): Update declaration.
13432 * testsuite/ver_test_9.cc: New file.
13433 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13434 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13435 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13436 (ver_test_9.so, ver_test_9.o): New targets.
13437 * testsuite/Makefile.in: Rebuild.
13438
13439 2008-07-22 Ian Lance Taylor <iant@google.com>
13440
13441 * options.h (class General_options): Define --check-sections.
13442 * layout.cc (Layout::set_segment_offsets): Handle
13443 --check-sections.
13444
13445 * options.h (class General_options): Define -n/--nmagic and
13446 -N/--omagic.
13447 * options.cc (General_options::finalize): For -n/--nmagic or
13448 -N/--omagic, set -static.
13449 * layout.cc (Layout::attach_allocated_section_to_segment): If
13450 -N/--omagic, don't put read-only and read-write sections in
13451 different segments.
13452 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13453 finding a read-only segment.
13454 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13455 don't set the minimum segment alignment to the common page size,
13456 and don't set the file offset to the address modulo the page size.
13457 * script-sections.cc (Script_sections::create_segments): If
13458 -n/--omagic, don't put read-only and read-write sections in
13459 different segments.
13460
13461 * cref.cc: New file.
13462 * cref.h: New file.
13463 * options.h (class General_options): Add --print-symbol-counts.
13464 * main.cc (main): Issue defined symbol report if requested.
13465 * archive.cc (Archive::interpret_header): Make into a const member
13466 function.
13467 (Archive::add_symbols): Call Input_objects::archive_start and
13468 archive_stop.
13469 (Archive::const_iterator): Define new class.
13470 (Archive::begin, Archive::end): New functions.
13471 (Archive::include_all_members): Rewrite to use iterator.
13472 (Archive::count_members): New function.
13473 * archive.h (class Archive): Update declarations.
13474 (Archive::filename): New function.
13475 * object.cc: Include "cref.h".
13476 (Sized_relobj::Sized_relobj): Initialize defined_count_.
13477 (Sized_relobj::do_get_global_symbol_counts): New function.
13478 (Input_objects::add_object): Add object to cross-referencer.
13479 (Input_objects::archive_start): New function.
13480 (Input_objects::archive_stop): New function.
13481 (Input_objects::print_symbol_counts): New function.
13482 * object.h: Declare Cref and Archive.
13483 (Object::get_global_symbol_counts): New function.
13484 (Object::do_get_global_symbol_counts): New pure virtual function.
13485 (class Sized_relobj): Add defined_count_ field. Update
13486 declarations.
13487 (class Input_objects): Add cref_ field. Update constructor.
13488 Update declarations.
13489 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13490 defined_count_.
13491 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13492 symbol counts.
13493 (Sized_dynobj::do_get_global_symbol_counts): New function.
13494 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13495 defined_count_. Update declarations. Define Symbols typedef.
13496 * symtab.cc (Symbol_table::add_from_relobj): Add defined
13497 parameter. Change all callers.
13498 (Symbol_table::add_from_dynobj): Add sympointers and defined
13499 parameters. Change all callers.
13500 * symtab.h (class Symbol_table): Update declarations.
13501 * Makefile.am (CCFILES): Add cref.cc.
13502 (HFILES): Add cref.h.
13503 * Makefile.in: Rebuild.
13504
13505 2008-07-22 Simon Baldwin <simonb@google.com>
13506
13507 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13508 to zero when writing undefined symbols.
13509
13510 2008-07-22 Ian Lance Taylor <iant@google.com>
13511
13512 * output.cc (Output_section::add_input_section): Don't try to
13513 merge empty merge sections.
13514
13515 2008-07-21 Craig Silverstein <csilvers@google.com>
13516
13517 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13518 Include symbol version in error message.
13519
13520 2008-07-20 Chris Demetriou <cgd@google.com>
13521
13522 * configure.ac (gold_cv_c_random_seed): New configured variable.
13523 (RANDOM_SEED_CFLAGS): New substituted variable.
13524 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13525 * configure: Rebuild.
13526 * Makefile.in: Likewise.
13527 * testsuite/Makefile.in: Likewise.
13528
13529 2008-07-18 Ian Lance Taylor <iant@google.com>
13530
13531 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13532 where we see NAME/NULL and NAME/VERSION as separate symbols.
13533 * testsuite/ver_test_main.cc (main): Call t4.
13534 (t4, t4_2a): Define.
13535 * testsuite/ver_test_2.cc (t4_2): Define.
13536 * testsuite/ver_test_2.script: Put t4_2a in VER2.
13537 * testsuite/ver_test_4.cc (t4_2a): Define.
13538 * testsuite/ver_test_4.script: Put t4_2a in VER2.
13539 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13540
13541 2008-07-17 Ian Lance Taylor <iant@google.com>
13542
13543 * dynobj.cc (Versions::add_def): If we give an error about a
13544 missing version, go ahead and create the version anyhow.
13545
13546 2008-07-10 Ian Lance Taylor <iant@google.com>
13547
13548 Handle output sections with more than 0x7fffffff bytes.
13549 * object.h (class Relobj): Change map_to_output_ to
13550 output_sections_, and just keep a section pointer. Change all
13551 uses. Move comdat group support to Sized_relobj.
13552 (Relobj::is_section_specially_mapped): Remove.
13553 (Relobj::output_section): Remove poff parameter. Change all
13554 callers.
13555 (Relobj::output_section_offset): New function.
13556 (Relobj::set_section_offset): Rewrite.
13557 (Relobj::map_to_output): Remove.
13558 (Relobj::output_sections): New function.
13559 (Relobj::do_output_section_offset): New pure virtual function.
13560 (Relobj::do_set_section_offset): Likewise.
13561 (class Sized_relobj): Add section_offsets_ field. Add comdat
13562 group support from Relobj. Update declarations.
13563 (Sized_relobj::get_output_section_offset): New function.
13564 (Sized_relobj::do_output_section_offset): New function.
13565 (Sized_relobj::do_set_section_offset): New function.
13566 * object.cc (Relobj::output_section_address): Remove.
13567 (Sized_relobj::Sized_relobj): Initialize new fields.
13568 (Sized_relobj::include_section_group): Cast find_kept_object to
13569 Sized_relobj.
13570 (Sized_relobj::include_linkonce_section): Likewise.
13571 (Sized_relobj::do_layout): Use separate arrays for output section
13572 and output offset.
13573 (Sized_relobj::do_count_local_symbols): Change map_to_output to
13574 output_sections.
13575 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13576 output_sections and section_offsets.
13577 (Sized_relobj::write_local_symbols): Likewise.
13578 (map_to_kept_section): Compute output address directly.
13579 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13580 output_sections and section_offsets.
13581 (Sized_relobj::write_sections): Likewise.
13582 (Sized_relobj::relocate_sections): Likewise.
13583 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13584 * output.h (class Output_reloc): Update declarations. Change
13585 u2_.relobj to Sized_relobj*.
13586 (class Output_data_reloc): Change add functions to use
13587 Sized_relobj*.
13588 * output.cc (Output_reloc::Output_reloc): Change relobj to
13589 Sized_relobj*.
13590 (Output_reloc::local_section_offset): Change return type to
13591 Elf_Addr. Use get_output_section_offset.
13592 (Output_reloc::get_address): Likewise.
13593 (Output_section::is_input_address_mapped): Don't call
13594 is_section_specially_mapped.
13595 (Output_section::output_offset): Likewise.
13596 (Output_section::output_address): Likewise.
13597 (Output_section::starting_output_address): Likewise.
13598 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13599 parameter to Sized_relobj*.
13600 (Copy_relocs::need_copy_reloc): Likewise.
13601 (Copy_relocs::save): Likewise.
13602 * copy-relocs.h (class Copy_relocs): Update declarations.
13603 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13604 Sized_relobj*. Change relobj_ field to Sized_relobj*.
13605 * target-reloc.h (relocate_for_relocatable): Change
13606 offset_in_output_section type to Elf_Addr. Change code that uses
13607 it as well.
13608 * layout.cc (Layout::layout): Always set *off.
13609 * mapfile.cc (Mapfile::print_input_section): Use
13610 output_section_offset.
13611 * i386.cc (Target_i386::copy_reloc): Change object parameter to
13612 Sized_relobj*.
13613 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13614 * sparc.cc (Target_sparc::copy_reloc): Likewise.
13615 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13616
13617 2008-07-03 Ian Lance Taylor <iant@google.com>
13618
13619 * layout.cc (Layout::include_section): Do not discard unrecognized
13620 SHT_STRTAB sections.
13621
13622 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
13623
13624 * script.cc (Lex::can_continue_name): Make '?' allowable in
13625 version-script names.
13626 * testsuite/version_script.map: Change glob pattern to use '?'
13627
13628 2008-06-30 Manish Singh <yosh@gimp.org>
13629
13630 PR 6585
13631 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13632 Correct typo.
13633
13634 2008-06-30 Ian Lance Taylor <iant@google.com>
13635
13636 PR 6660
13637 PR 6682
13638 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13639 versions]: Don't try to read the value in the contents, since we
13640 don't use it. Use the template endianness when writing.
13641
13642 2008-06-25 Cary Coutant <ccoutant@google.com>
13643
13644 * fileread.cc (File_read::make_view): Assert on zero-length view.
13645 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13646 symbol table when there are no symbols to read.
13647
13648 2008-06-23 Craig Silverstein <csilvers@google.com>
13649
13650 * version.cc (version_string): Bump to 1.7
13651
13652 2008-06-18 Craig Silverstein <csilvers@google.com>
13653
13654 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13655 constant 0xFFFF to type Valtype.
13656 (Powerpc_relocate_functions::rel16_ha): Likewise.
13657
13658 2008-06-17 Ian Lance Taylor <iant@google.com>
13659
13660 * output.h (Output_section::Input_section): Initialize p2align_ to
13661 zero for Output_section_data constructors.
13662 (Output_section::Input_section::addralign): If not an input
13663 section, return the alignment of the Output_section_data.
13664 * testsuite/copy_test.cc: New file.
13665 * testsuite/copy_test_1.cc: New file.
13666 * testsuite/copy_test_2.cc: New file.
13667 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13668 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13669 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13670 (copy_test_1_pic.o, copy_test_1.so): New targets.
13671 (copy_test_2_pic.o, copy_test_2.so): New targets.
13672 * testsuite/Makefile.in: Rebuild.
13673
13674 * script-sections.cc (Script_sections::place_orphan): Initialize
13675 local variable exact.
13676
13677 2008-06-13 David Edelsohn <edelsohn@gnu.org>
13678
13679 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13680
13681 2008-06-12 David Edelsohn <edelsohn@gnu.org>
13682 David S. Miller <davem@davemloft.net>
13683
13684 * powerpc.cc: New file.
13685 * Makefile.am (TARGETSOURCES): Add powerpc.cc
13686 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13687 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13688 * Makefile.in: Rebuild.
13689
13690 2008-06-09 Ian Lance Taylor <iant@google.com>
13691
13692 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13693 <exception>.
13694 (throwing, orig_terminate): New static variables.
13695 (terminate_handler): New static function.
13696 (t2): Set terminate handler.
13697
13698 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
13699
13700 PR 6584
13701 * binary.cc (Binary_to_elf::sized_convert): Fix .data
13702 alignment.
13703
13704 2008-05-30 Cary Coutant <ccoutant@google.com>
13705
13706 * archive.cc (Archive::include_all_members) Correct to step
13707 over symbol table and extended name table in thin archives.
13708
13709 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
13710
13711 PR 6407
13712 * target-reloc.h (relocate_for_relocatable): Fix new_offset
13713 calculation.
13714
13715 2008-05-28 Caleb Howe <cshowe@google.com>
13716
13717 * reduced_debug_output.cc: New file.
13718 * reduced_debug_output.h: New file.
13719 * options.h (class General_options): Add --strip-debug-non-line.
13720 * options.cc (General_options::finalize): Add strip_debug_non_line
13721 to the strip heirarchy.
13722 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13723 fields.
13724 * layout.cc: Include "reduced_debug_output.h".
13725 (Layout::Layout): Initialize new fields.
13726 (line_only_debug_sections): New static array.
13727 (is_lines_only_debug_sections): New static inline function.
13728 (Layout::include_section): Handle --strip-debug-non-line.
13729 (Layout::make_output_section): If --strip-debug-non-line, build
13730 new output sections for .debug_abbrev and .debug_info.
13731 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13732 gold. Warn about possible overflow.
13733 (read_signed_LEB_128): Likewise.
13734 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13735 (read_signed_LEB_128): Declare.
13736 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13737 (HFILES): Add reduced_debug_output.h.
13738 * Makefile.in: Rebuild.
13739
13740 2008-05-21 Ian Lance Taylor <iant@google.com>
13741
13742 * mapfile.cc: New file.
13743 * mapfile.h: New file.
13744 * options.h (class General_options): Add -M/--print-map and -Map.
13745 * options.cc (General_options::finalize): Make -M equivalent to
13746 -Map -.
13747 * main.cc: Include <cstdio> and "mapfile.h".
13748 (main): Open mapfile if requested.
13749 * gold.cc (class Middle_runner): Add mapfile_ field. Update
13750 constructor. Change caller.
13751 (queue_initial_tasks): Add mapfile parameter. Change caller.
13752 (queue_middle_tasks): Likewise.
13753 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13754 declarations.
13755 * archive.cc: Include "mapfile.h".
13756 (Archive::add_symbols): Add mapfile parameter. Change all
13757 callers. Pass mapfile, symbol, and reason to include_member.
13758 (Archive::include_all_members): Add mapfile parameter. Change all
13759 callers.
13760 (Archive::include_member): Add mapfile, sym, and why parameters.
13761 Change all callers. Report inclusion to map file.
13762 * archive.h: Include "fileread.h".
13763 (class Archive): Update declarations.
13764 (Archive::file): New const method.
13765 (class Add_archive_symbols): Add mapfile_ field. Update
13766 constructor. Change all callers.
13767 * readsyms.h (class Read_symbols): Likewise.
13768 (class Finish_group): Likewise.
13769 (class Read_script): Likewise.
13770 * common.cc: Include "mapfile.h".
13771 (Symbol_table::allocate_commons): Add mapfile parameter. Change
13772 all callers.
13773 (Symbol_table::do_allocate_commons): Likewise.
13774 (Symbol_table::do_allocate_commons_list): Likewise. Report common
13775 symbol allocation to mapfile.
13776 * common.h (class Allocate_commons_task): Add mapfile_ field.
13777 Update constructor. Change all callers.
13778 * symtab.h (class Symbol_table): Update declarations.
13779 * layout.cc: Include "mapfile.h".
13780 (Layout_task_runner::run): Print information to mapfile.
13781 (Layout::create_gold_note): Change Output_data_fixed_space to
13782 Output_data_zero_fill.
13783 (Layout::create_build_id): Likewise.
13784 (Layout::print_to_mapfile): New function.
13785 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
13786 constructor. Change caller.
13787 (class Layout): Declare print_to_mapfile.
13788 * output.cc (Output_section::Input_section::print_to_mapfile): New
13789 function.
13790 (Output_section::add_input_section): If producing a map, always
13791 add to input_sections_ list.
13792 (Output_section::do_print_to_mapfile): New function.
13793 (Output_segment::print_sections_to_mapfile): New function.
13794 (Output_segment::print_section_list_to_mapfile): New function.
13795 * output.h: Include "mapfile.h".
13796 (Output_data::print_to_mapfile): New function.
13797 (Output_data::do_print_to_mapfile): New virtual function.
13798 (Output_segment_headers::do_print_to_mapfile): New function.
13799 (Output_file_header::do_print_to_mapfile): New function.
13800 (Output_data_const::do_print_to_mapfile): New function.
13801 (class Output_data_const_buffer): Add map_name_ field. Update
13802 constructor. Change all callers. Add do_print_to_mapfile
13803 function.
13804 (class Output_data_fixed_space): Likewise.
13805 (class Output_data_space): Likewise.
13806 (class Output_data_zero_fill): New class.
13807 (Output_data_strtab::do_print_to_mapfile): New function.
13808 (Output_data_reloc_base::do_print_to_mapfile): New function.
13809 (Output_relocatable_relocs::do_print_to_mapfile): New function.
13810 (Output_data_group::do_print_to_mapfile): New function.
13811 (Output_data_got::do_print_to_mapfile): New function.
13812 (Output_data_dynamic::do_print_to_mapfile): New function.
13813 (Output_symtab_xindex::do_print_to_mapfile): New function.
13814 (class Output_section): Declare do_print_to_mapflie. Declare
13815 print_to_mapfile in Input_section.
13816 (class Output_segment): Declare new functions.
13817 * object.h (Sized_relobj::symbol_count): New function.
13818 * script-sections.cc
13819 (Output_section_element_dot_assignment::set_section_addresses):
13820 Change Output_data_fixed_space to Output_data_zero_fill.
13821 (Output_data_expression::do_print_to_mapfile): New function.
13822 * script.cc (read_input_script): Add mapfile parameter. Change
13823 all callers.
13824 * script.h (read_input_script): Update declaration.
13825 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13826 (Eh_frame::do_print_to_mapfile): New function.
13827 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13828 (Output_merge_string::do_print_to_mapfile): New function.
13829 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13830 function.
13831 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13832 function.
13833 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13834 function.
13835 * Makefile.am (CCFILES): Add mapfile.cc.
13836 (HFILES): Add mapfile.h.
13837 * Makefile.in: Rebuild.
13838
13839 2008-05-19 Ian Lance Taylor <iant@google.com>
13840
13841 * options.h (class General_options): Add -z relro.
13842 * layout.cc (Layout::Layout): Initialize relro_segment_.
13843 (Layout::add_output_section_data): Return the output section.
13844 (Layout::make_output_section): Rcognize relro sections and mark
13845 them appropriately.
13846 (Layout::attach_allocated_section_to_segment): Put relro sections
13847 in a PT_GNU_RELRO segment.
13848 (Layout::create_initial_dynamic_sections): Mark the .dynamic
13849 section as relro.
13850 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13851 PT_TLS segments.
13852 (Layout::linkonce_mapping): Map d.rel.ro.local to
13853 .data.rel.ro.local.
13854 (Layout::output_section_name): Us .data.rel.ro.local for any
13855 section which begins with that.
13856 * layout.h (class Layout): Update add_output_section_data
13857 declaration. Add relro_segment_ field.
13858 * output.cc (Output_section::Output_section): Initialize is_relro_
13859 and is_relro_local_ fields.
13860 (Output_segment::add_output_section): Group relro sections.
13861 (Output_segment::is_first_section_relro): New function.
13862 (Output_segment::maximum_alignment): If there is a relro section,
13863 align the segment to the common page size.
13864 (Output_segment::set_section_addresses): Track whether we are
13865 looking at relro sections. If the last section is a relro
13866 section, align to the common page size.
13867 (Output_segment::set_section_list_addresses): Add in_relro
13868 parameter. Change all callers. Align to the page size when
13869 moving from relro to non-relro section.
13870 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13871 segment.
13872 * output.h (class Output_section): Add is_relro_ and
13873 is_relro_local_ fields.
13874 (Output_section::is_relro): New function.
13875 (Output_section::set_is_relro): New function.
13876 (Output_section::is_relro_local): New function.
13877 (Output_section::set_is_relro_local): New function.
13878 (class Output_segment): Update declarations.
13879 * i386.cc (Target_i386::got_section): Mark .got section as relro.
13880 * sparc.cc (Target_sparc::got_section): Likewise.
13881 * x86_64.cc (Target_x86_64::got_section): Likewise.
13882 * testsuite/relro_test_main.cc: New file.
13883 * testsuite/relro_test.cc: New file.
13884 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13885 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13886 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13887 (relro_test.so, relro_test_pic.o): New targets.
13888 * testsuite/Makefile.in: Rebuild.
13889
13890 2008-05-16 Ian Lance Taylor <iant@google.com>
13891
13892 * output.cc (Output_segment::add_output_section): Remove front
13893 parameter.
13894 * output.h (class Output_segment): Remove
13895 add_initial_output_section and overloaded add_output_section.
13896 Update declaration of remaining add_output_section.
13897 * layout.cc (Layout::create_interp): Call add_output_section
13898 rather than add_initial_output_section.
13899 (Layout::finish_dynamic_section): Likewise.
13900
13901 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13902 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
13903 know the dynamic type.
13904 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13905 field. Initialize it in constructor.
13906 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13907 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13908 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13909 reloc.
13910
13911 * output.cc (Output_reloc::get_address): Change return type to
13912 Elf_Addr.
13913 * output.h (class Output_reloc): Update get_address declaration.
13914 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13915 for section addresses.
13916
13917 2008-05-09 Ian Lance Taylor <iant@google.com>
13918
13919 PR 6493
13920 * gold.cc (gold_nomem): Use return value of write.
13921
13922 2008-05-08 Ian Lance Taylor <iant@google.com>
13923
13924 * symtab.c (Symbol::init_base_output_data): Add version
13925 parameter. Change all callers.
13926 (Symbol::init_base_output_segment): Likewise.
13927 (Symbol::init_base_constant): Likewise.
13928 (Symbol::init_base_undefined): Likewise.
13929 (Sized_symbol::init_output_data): Likewise.
13930 (Sized_symbol::init_output_segment): Likewise.
13931 (Sized_symbol::init_constant): Likewise.
13932 (Sized_symbol::init_undefined): Likewise.
13933 (Symbol_table::do_define_in_output_data): If the new symbol has a
13934 version, mark it as the default.
13935 (Symbol_table::do_define_in_output_segment): Likewise.
13936 (Symbol_table::do_define_as_constant): Likewise.
13937 * symtab.h (class Symbol): Update declarations.
13938 (class Sized_symbol): Likewise.
13939 * resolve.cc (Symbol::override_version): New function.
13940 (Symbol::override_base): Call override_version.
13941 (Symbol::override_base_with_special): Likewise.
13942 * testsuite/ver_script_8.script: New file.
13943 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13944 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13945 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13946 (ver_test_8_1.so, ver_test_8_2.so): New targets.
13947
13948 2008-05-06 Ian Lance Taylor <iant@google.com>
13949
13950 PR 6049
13951 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13952 functions.
13953 (class General_options): Remove existing --undefined, and add
13954 --no-undefined instead. Add new --undefined as synonym for -u.
13955 * archive.cc (Archive::add_symbols): Check whether symbol was
13956 named with -u.
13957 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13958 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13959 all uses. Add IS_UNDEFINED. Update declarations to split
13960 different versions of init_base. Declare init_base_undefined.
13961 (Symbol::is_defined): Handle IS_UNDEFINED.
13962 (Symbol::is_undefined): Likewise.
13963 (Symbol::is_weak_undefined): Call is_undefined.
13964 (Symbol::is_absolute): Handle IS_CONSTANT.
13965 (class Sized_symbol): Update declarations to split different
13966 versions of init. Declare init_undefined.
13967 (class Symbol_table): Declare new functions.
13968 * symtab.cc (Symbol::init_base_object): Rename from init_base.
13969 Change all callers.
13970 (Symbol::init_base_output_data): Likewise.
13971 (Symbol::init_base_output_segment): Likewise.
13972 (Symbol::init_base_constant): Likewise.
13973 (Symbol::init_base_undefined): New function.
13974 (Sized_symbol::init_object): Rename from init. Change all
13975 callers.
13976 (Sized_symbol::init_output_data): Likewise.
13977 (Sized_symbol::init_output_segment): Likewise.
13978 (Sized_symbol::init_constant): Likewise.
13979 (Sized_symbol::init_undefined): New function.
13980 (Symbol_table::add_undefined_symbols_from_command_line): New
13981 function.
13982 (Symbol_table::do_add_undefined_symbols_from_command_line): New
13983 function.
13984 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13985 (Symbol::output_section): Likewise.
13986 (Symbol::set_output_section): Likewise.
13987 (Symbol_table::sized_finalize_symbol): Likewise.
13988 (Symbol_table::sized_write_globals): Likewise.
13989 * resolve.cc (Symbol_table::should_override): Likewise.
13990 (Symbol::override_base_with_special): Likewise.
13991
13992 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13993 symbol, change it to have default visibility.
13994 * testsuite/protected_1.cc: New file.
13995 * testsuite/protected_2.cc: New file.
13996 * testsuite/protected_3.cc: New file.
13997 * testsuite/protected_main_1.cc: New file.
13998 * testsuite/protected_main_2.cc: New file.
13999 * testsuite/protected_main_3.cc: New file.
14000 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14001 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14002 (protected_1_LDFLAGS, protected_1_LDADD): Define.
14003 (protected_1.so): New target.
14004 (protected_1_pic.o, protected_2_pic.o): New targets.
14005 (protected_3_pic.o): New target.
14006 (check_PROGRAMS): Add protected_2.
14007 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14008 (protected_2_LDFLAGS, protected_2_LDADD): Define.
14009 * testsuite/Makefile.in: Rebuild.
14010
14011 * options.h (DEFINE_var): Add set_user_set_##varname__.
14012 (DEFINE_bool_alias): New macro.
14013 (class General_options): Define -Bstatic using DEFINE_bool_alias
14014 rather than DEFINE_special. Add --undefined as an alias for -z
14015 defs.
14016 * options.cc (General_options::parse_Bstatic): Remove.
14017
14018 * options.h (class General_options): Add --fatal-warnings.
14019 * main.cc (main): Implement --fatal-warnings.
14020 * errors.h (Errors::warning_count): New function.
14021
14022 * options.h (class General_options): Add -Bsymbolic-functions.
14023 * symtab.h (Symbol::is_preemptible): Check for
14024 -Bsymbolic-functions.
14025
14026 2008-05-05 Ian Lance Taylor <iant@google.com>
14027
14028 * options.h (DEFINE_bool): For DASH_Z, create the negative option
14029 as noVARNAME rather than no-VARNAME.
14030 (class General_options): Add option -z combreloc.
14031 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14032 get_address.
14033 (Output_reloc::sort_before) [SHT_REL]: New function.
14034 (Output_reloc::sort_before) [SHT_RELA]: New function.
14035 (class Output_data_reloc_base): Add sort_relocs_ field. Define
14036 Sort_relocs_comparison.
14037 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14038 parameter. Change all callers.
14039 (Output_data_reloc::Output_data_reloc) [both versions]: Add
14040 sort_relocs parameter. Change all callers.
14041 * output.cc (Output_reloc::get_address): New function, broken out
14042 of write_rel.
14043 (Output_reloc::write_rel): Call it.
14044 (Output_reloc::compare): New function.
14045 (Output_data_reloc_base::do_write): Optionally sort relocs.
14046
14047 * configure.ac: If targ_extra_obj is set, link it in.
14048 * configure.tgt: Initialize all variables.
14049 (x86_64*): Set targ_extra_obj and targ_extra_size.
14050 * configure: Rebuild.
14051
14052 * object.cc (Sized_relobj::include_section_group): Adjust section
14053 indexes read from group data. Build vector to pass to
14054 layout_group.
14055 * layout.cc (Layout::layout_group): Add flags and shndxes
14056 parameters. Remove contents parameter. Change caller. Update
14057 explicit instantiations.
14058 * layout.h (class Layout): Update layout_group declaration.
14059 * output.cc (Output_data_group::Output_data_group): Add flags and
14060 input_shndxes parameters. Remove contents parameter. Change
14061 caller.
14062 (Output_data_group::do_write): Change input_sections_ to
14063 input_shndxes_.
14064 * output.h (class Output_data_group): Update constructor
14065 declaration. Rename input_sections_ to input_shndxes_.
14066 * testsuite/many_sections_test.cc: Add template.
14067
14068 2008-04-30 Cary Coutant <ccoutant@google.com>
14069
14070 * target-reloc.h (relocate_section): Fix dead-pointer bug.
14071
14072 * layout.cc (Layout::include_section): Refactored check for debug
14073 info section.
14074 (Layout::add_comdat): Add new parameters. Change type
14075 of signature parameter. Add object and shndx to signatures table.
14076 (Layout::find_kept_object): New function.
14077 * layout.h: Include <cstring>.
14078 (Layout::is_debug_info_section): New function.
14079 (Layout::add_comdat): Add new parameters.
14080 (Layout::find_kept_object): New function.
14081 (Layout::Kept_section): New struct.
14082 (Layout::Signatures): Change type of map range.
14083 * object.cc (Relobj::output_section_address): New function.
14084 (Sized_relobj::include_section_group): Add new parameters. Change
14085 calls to Layout::add_comdat. Change to build table of kept comdat
14086 groups and table mapping discarded sections to kept sections.
14087 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
14088 (Sized_relobj::do_layout): Change calls to include_section_group and
14089 include_linkonce_section.
14090 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14091 value to zero when section is discarded.
14092 (Sized_relobj::map_to_kept_section): New function.
14093 * object.h (Relobj::output_section_address): New function.
14094 (Relobj::Comdat_group): New type.
14095 (Relobj::find_comdat_group): New function.
14096 (Relobj::Comdat_group_table): New type.
14097 (Relobj::Kept_comdat_section): New type.
14098 (Relobj::Kept_comdat_section_table): New type.
14099 (Relobj::add_comdat_group): New function.
14100 (Relobj::set_kept_comdat_section): New function.
14101 (Relobj::get_kept_comdat_section): New function.
14102 (Relobj::comdat_groups_): New field.
14103 (Relobj::kept_comdat_sections_): New field.
14104 (Symbol_value::input_value): Update comment.
14105 (Sized_relobj::map_to_kept_section) New function.
14106 (Sized_relobj::include_linkonce_section): Add new parameter.
14107 * target-reloc.h (Comdat_behavior): New type.
14108 (get_comdat_behavior): New function.
14109 (relocate_section): Add code to map a discarded section to the
14110 corresponding kept section when applying a relocation.
14111
14112 2008-04-30 Craig Silverstein <csilvers@google.com>
14113
14114 * dwarf_reader.cc (next_generation_count): New static var.
14115 (Addr2line_cache_entry): New struct.
14116 (addr2line_cache): New static var.
14117 (Dwarf_line_info::one_addr2line): Added caching.
14118 (Dwarf_line_info::clear_addr2line_cache): New function.
14119 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14120 cache-size parameter.
14121 (Dwarf_line_info::one_addr2line_cache): New function.
14122 * symtab.cc (Symbol_table::detect_odr_violations): Pass
14123 new cache-size argument to one_addr2line(), and clear cache.
14124
14125 2008-04-28 Cary Coutant <ccoutant@google.com>
14126
14127 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14128 R_386_PC8 relocations.
14129
14130 2008-04-23 Ian Lance Taylor <iant@google.com>
14131
14132 * object.cc (Sized_relobj::include_section_group): Check for
14133 invalid section group.
14134
14135 * object.cc (make_elf_object): Correct test for 64-bit ELF file
14136 header size.
14137
14138 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14139 than read for file header.
14140 * archive.cc (Archive::include_member): Likewise.
14141
14142 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
14143
14144 * aclocal.m4: Regenerate.
14145 * configure: Regenerate.
14146
14147 2008-04-19 Ian Lance Taylor <iant@google.com>
14148
14149 * version.cc (version_string): Bump to 1.6.
14150
14151 * testsuite/Makefile.am (many_sections_r_test): New target.
14152 (many_sections_r_test_SOURCES): Remove.
14153 (many_sections_r_test_DEPENDENCIES): Remove.
14154 (many_sections_r_test_LDFLAGS): Remove.
14155 (many_sections_r_test_LDADD): Remove.
14156
14157 * object.cc (Sized_relobj::do_add_symbols): Always pass
14158 local_symbol_count_ to add_from_relobj.
14159
14160 * testsuite/Makefile.am (many_sections_check.h): Only check one in
14161 every thousand variables.
14162 * testsuite/Makefile.in: Rebuild.
14163
14164 * object.cc (Xindex::initialize_symtab_xindex): New function.
14165 (Xindex::read_symtab_xindex): New function.
14166 (Xindex::sym_xindex_to_shndx): New function.
14167 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14168 available.
14169 (Sized_relobj::do_initialize_xindex): New function.
14170 (Sized_relobj::do_read_symbols): Adjust section links.
14171 (Sized_relobj::symbol_section_and_value): Add is_ordinary
14172 parameter. Change all callers.
14173 (Sized_relobj::include_section_group): Adjust section links and
14174 symbol section indexes.
14175 (Sized_relobj::do_layout): Adjust section links.
14176 (Sized_relobj::do_count_local_symbols): Adjust section links and
14177 symbol section indexes.
14178 (Sized_relobj::do_finalize_local_symbols): Distinguish between
14179 ordinary and special symbols.
14180 (Sized_relobj::write_local_symbols): Add symtab_xindex and
14181 dynsym_xindex parameters. Change all callers. Adjust section
14182 links. Use SHN_XINDEX when needed.
14183 (Sized_relobj::get_symbol_location_info): Adjust section links.
14184 Don't get fooled by special symbols.
14185 * object.h (class Xindex): Define.
14186 (class Object): Add xindex_ parameter. Declare virtual functoin
14187 do_initialize_xindex.
14188 (Object::adjust_sym_shndx): New function.
14189 (Object::set_xindex): New protected function.
14190 (class Symbol_value): Add is_ordinary_shndx_ field.
14191 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14192 (Symbol_value::value): Assert ordinary section.
14193 (Symbol_value::initialize_input_to_output_map): Likewise.
14194 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14195 Change all callers.
14196 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
14197 all callers.
14198 (class Sized_relobj): Update declarations.
14199 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14200 parameter. Change all callers.
14201 (Sized_relobj::adjust_shndx): New function.
14202 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14203 field.
14204 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14205 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
14206 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
14207 (Sized_dynobj::read_dynsym_section): Adjust section links.
14208 (Sized_dynobj::read_dynamic): Likewise.
14209 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
14210 section links.
14211 (Sized_dynobj::do_initialize_xindex): New function.
14212 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
14213 do_initialize_xindex.
14214 (Sized_dynobj::adjust_shndx): New function.
14215 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14216 dynsym_xindex_ fields.
14217 (Layout::finalize): Add a call to set_section_indexes before
14218 creating the symtab sections.
14219 (Layout::set_section_indexes): Don't do anything if the section
14220 already has a section index.
14221 (Layout::create_symtab_sections): Add shnum parameter. Change
14222 caller. Create .symtab_shndx section if needed.
14223 (Layout::create_shdrs): Add shstrtab_section parameter. Change
14224 caller.
14225 (Layout::allocated_output_section_count): New function.
14226 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14227 needed.
14228 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14229 fields. Update declarations.
14230 (Layout::symtab_xindex): New function.
14231 (Layout::dynsym_xindex): New function.
14232 (class Write_symbols_task): Add layout_ field.
14233 (Write_symbols_task::Write_symbols_task): Add layout parameter.
14234 Change caller.
14235 * output.cc (Output_section_headers::Output_section_headers): Add
14236 shstrtab_section parameter. Change all callers.
14237 (Output_section_headers::do_sized_write): Store overflow values
14238 for section count and section string table section index in
14239 section header zero.
14240 (Output_file_header::do_sized_write): Check for overflow of
14241 section count and section string table section index.
14242 (Output_symtab_xindex::do_write): New function.
14243 (Output_symtab_xindex::endian_do_write): New function.
14244 * output.h (class Output_section_headers): Add shstrtab_section_.
14245 Update declarations.
14246 (class Output_symtab_xindex): Define.
14247 (Output_section::has_out_shndx): New function.
14248 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14249 field.
14250 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14251 Change all callers.
14252 (Sized_symbol::init): Likewise.
14253 (Symbol::output_section): Check for ordinary symbol.
14254 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
14255 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
14256 callers.
14257 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14258 Change all callers. Simplify handling of symbols from sections
14259 not included in the link.
14260 (Symbol_table::add_from_dynobj): Handle ordinary symbol
14261 distinction.
14262 (Weak_alias_sorter::operator()): Assert that symbols are
14263 ordinary.
14264 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14265 distinction.
14266 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14267 parameters. Change all callers.
14268 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
14269 symbol distinction. Use SHN_XINDEX when needed.
14270 (Symbol_table::write_section_symbol): Add symtab_xindex
14271 parameter. Change all callers.
14272 (Symbol_table::sized_write_section_symbol): Likewise. Use
14273 SHN_XINDEX when needed.
14274 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
14275 declarations.
14276 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
14277 (Symbol::is_defined): Check is_ordinary.
14278 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14279 (Symbol::is_absolute, Symbol::is_common): Likewise.
14280 (class Sized_symbol): Update declarations.
14281 (class Symbol_table): Update declarations.
14282 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14283 parameters. Change all callers.
14284 (Sized_symbol::override): Likewise.
14285 (Symbol_table::override): Likewise.
14286 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
14287 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
14288 is_ordinary, and orig_st_shndx parameters. Change all callers.
14289 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14290 to be in an ordinary section.
14291 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14292 object and is_ordinary parameters. Change all callers.
14293 (Sized_dwarf_line_info::read_relocs): Add object parameter.
14294 Change all callers. Don't add undefined or non-ordinary symbols
14295 to reloc_map_.
14296 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14297 Change all callers.
14298 * dwarf_reader.h (class Sized_dwarf_line_info): Update
14299 declarations.
14300 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14301 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14302 (Sized_relobj::relocate_sections): Likewise.
14303 * target-reloc.h (scan_relocs): Adjust section symbol index.
14304 (scan_relocatable_relocs): Likewise.
14305 * i386.cc (Scan::local): Check for ordinary symbols.
14306 * sparc.cc (Scan::local): Likewise.
14307 * x86_64.cc (Scan::local): Likewise.
14308 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14309 to symbol_section_and_value.
14310 * testsuite/many_sections_test.cc: New file.
14311 * testsuite/Makefile.am (BUILT_SOURCES): Define.
14312 (check_PROGRAMS): Add many_sections_test.
14313 (many_sections_test_SOURCES): Define.
14314 (many_sections_test_DEPENDENCIES): Define.
14315 (many_sections_test_LDFLAGS): Define.
14316 (BUILT_SOURCES): Add many_sections_define.h.
14317 (many_sections_define.h): New target.
14318 (BUILT_SOURCES): Add many_sections_check.h.
14319 (many_sections_check.h): New target.
14320 (check_PROGRAMS): Add many_sections_r_test.
14321 (many_sections_r_test_SOURCES): Define.
14322 (many_sections_r_test_DEPENDENCIES): Define.
14323 (many_sections_r_test_LDFLAGS): Define.
14324 (many_sections_r_test_LDADD): Define.
14325 (many_sections_r_test.o): New target.
14326 * testsuite/Makefile.in: Rebuild.
14327
14328 2008-04-17 Cary Coutant <ccoutant@google.com>
14329
14330 * errors.cc (Errors::info): New function.
14331 (gold_info): New function.
14332 * errors.h (Errors::info): New function.
14333 * gold.h (gold_info): New function.
14334 * object.cc (Input_objects::add_object): Print trace output.
14335 * options.cc (options::parse_set): New function.
14336 (General_options::parse_wrap): Deleted.
14337 (General_options::General_options): Deleted initializer.
14338 * options.h (options::String_set): New typedef.
14339 (options::parse_set): New function.
14340 (DEFINE_set): New macro.
14341 (General_options::wrap): Changed to use DEFINE_set. Changed
14342 callers of any_wrap_symbols and is_wrap_symbol.
14343 (General_options::trace, General_options::trace_symbol):
14344 New options.
14345 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14346 (General_options::wrap_symbols_): Deleted.
14347 * symtab.cc (Symbol_table::add_from_object): Print trace output.
14348
14349 2008-04-17 David S. Miller <davem@davemloft.net>
14350
14351 * options.cc (General_options::parse_V): New function.
14352 * options.h: Add entries for -V and -Qy.
14353
14354 2008-04-17 Ian Lance Taylor <iant@google.com>
14355
14356 * common.cc (Symbol_table::allocate_commons): Remove options
14357 parameter. Change caller.
14358 (Symbol_table::do_allocate_commons): Remove options parameter.
14359 Change caller. Just call do_allocate_commons_list twice.
14360 (Symbol_table::do_allocate_commons_list): New function, broken out
14361 of do_allocate_commons.
14362 * common.h (class Allocate_commons_task): Remove options_ field.
14363 Update constructor.
14364 * symtab.cc (Symbol_table::Symbol_table): Initialize
14365 tls_commons_.
14366 (Symbol_table::add_from_object): Put TLS common symbols on
14367 tls_commons_ list.
14368 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14369 which are IN_OUTPUT_DATA.
14370 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
14371 allocate_commons and do_allocate_commons declarations. Declare
14372 do_allocate_commons_list.
14373 * gold.cc (queue_middle_tasks): Update creation of
14374 Allocate_commons_task to not pass options.
14375 * testsuite/Makefile.am (INCLUDES): Add -I.. .
14376 (TLS_TEST_C_FLAGS): New variable.
14377 (tls_test_c_pic.o): New target.
14378 (tls_test_shared.so): Link in tls_test_c_pic.o.
14379 (tls_test_c_pic_ie.o): New target.
14380 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14381 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14382 (tls_test_c.o): New target.
14383 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14384 (tls_pic_test_LDADD): Likewise.
14385 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14386 (tls_shared_gd_to_ie_test_LDADD): Likewise.
14387 (tls_test_c_gnu2.o): New target.
14388 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14389 tls_test_c_gnu2.o.
14390 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14391 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14392 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14393 * testsuite/tls_test.cc: Include "config.h".
14394 (t_last): Call t11_last.
14395 * testsuite/tls_test.h (t11, t11_last): Declare.
14396 * testsuite/tls_test_c.c: New file.
14397 * testsuite/tls_test_main.cc (thread_routine): Call t11.
14398 * configure.ac: Check for OpenMP support.
14399 * configure, config.in, Makefile.in: Rebuild.
14400 * testsuite/Makefile.in: Rebuild.
14401
14402 2008-04-16 Cary Coutant <ccoutant@google.com>
14403
14404 * i386.cc (Target_i386::define_tls_base_symbol): New function.
14405 (Target_i386::tls_base_symbol_defined_): New field.
14406 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14407 (Target_i386::Scan::global): Likewise.
14408 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14409 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14410 (Target_x86_64::tls_base_symbol_defined_): New field.
14411 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14412 (Target_x86_64::Scan::global): Likewise.
14413
14414 2008-04-16 Cary Coutant <ccoutant@google.com>
14415
14416 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14417 (Symbol::needs_plt_entry): Allow weak undefined symbols.
14418 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14419 building shared libraries.
14420 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14421 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14422 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14423 * testsuite/Makefile.in: Rebuild.
14424 * testsuite/weak_undef.h: New file.
14425 * testsuite/weak_undef_file1.cc: Add extra test cases.
14426 * testsuite/weak_undef_file2.cc: Likewise.
14427 * testsuite/weak_undef_test.cc: Likewise.
14428
14429 2008-04-16 David S. Miller <davem@davemloft.net>
14430
14431 * sparc.cc (Target_sparc::Scan): Change from struct to class.
14432 Add issued_non_pic_error_ field. Declare check_non_pic.
14433 (Target_sparc::Scan::check_non_pic): New function.
14434 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14435 (Target_sparc::Scan::global): Likewise.
14436
14437 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14438 * configure: Rebuild.
14439
14440 * options.h (DEFINE_enable): New macro.
14441 (new_dtags): New enable option.
14442 (initfirst, interpose, loadfltr, nodefaultlib,
14443 nodelete, nodlopen, nodump): New -z options.
14444 * layout.cc (Layout:finish_dynamic_section): If new
14445 dtags enabled, emit DT_RUNPATH. Also, emit a
14446 DT_FLAGS_1 containing any specified -z flags.
14447
14448 2008-04-16 Ian Lance Taylor <iant@google.com>
14449
14450 * copy-relocs.cc: New file.
14451 * copy-relocs.h: New file.
14452 * reloc.cc: Remove Copy_relocs code.
14453 * reloc.h: Likewise.
14454 * reloc-types.h (struct Reloc_types) [both versions]: Add
14455 get_reloc_addend_noerror.
14456 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14457 variants of add_global which take an addend which must be zero.
14458 * i386.cc: Include "copy-relocs.h".
14459 (class Target_i386): Change type of copy_relocs_ to variable,
14460 update initializer.
14461 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14462 Change all callers.
14463 (Target_i386::do_finalize_sections): Change handling of
14464 copy_relocs_.
14465 * sparc.cc: Include "copy-relocs.h".
14466 (class Target_sparc): Change type of copy_relocs_ to variable,
14467 update initializer.
14468 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14469 Change all callers.
14470 (Target_sparc::do_finalize_sections): Change handling of
14471 copy_relocs_.
14472 * x86_64.cc: Include "copy-relocs.h".
14473 (class Target_x86_64): Change type of copy_relocs_ to variable,
14474 update initializer.
14475 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14476 class. Change all callers.
14477 (Target_x86_64::do_finalize_sections): Change handling of
14478 copy_relocs_.
14479 * Makefile.am (CCFILES): Add copy-relocs.cc.
14480 (HFILES): Add copy-relocs.h.
14481
14482 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14483
14484 * testsuite/script_test_4.sh: Permit leading zeroes.
14485
14486 2008-04-15 Ian Lance Taylor <iant@google.com>
14487
14488 * script-sections.cc (Script_sections::create_segments): Use
14489 header_size_adjustment even when there is enough room for the
14490 headers.
14491 * testsuite/script_test_4.sh: New file.
14492 * testsuite/script_test_4.t: New file.
14493 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14494 (check_DATA): Add script_test_4.stdout.
14495 (MOSTLYCLEANFILES): Likewise.
14496 (script_test_4): New target.
14497 (script_test_4.stdout): New target.
14498 * testsuite/Makefile.in: Rebuild.
14499
14500 * sparc.cc: Add definitions for Output_data_plt_sparc class
14501 constants.
14502
14503 2008-04-14 David S. Miller <davem@davemloft.net>
14504
14505 * sparc.cc: New file.
14506 * Makefile.am (TARGETSOURCES): Add sparc.cc
14507 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14508 * configure.tgt: Document targ_extra_size and
14509 targ_extra_big_endian. Add entries for sparc-* and
14510 sparc64-*.
14511 * configure.ac: Handle targ_extra_size and
14512 targ_extra_big_endian.
14513 * Makefile.in: Rebuild.
14514 * configure: Likewise.
14515 * po/POTFILES.in: Likewise.
14516 * po/gold.pot: Likewise.
14517
14518 2008-04-14 Ian Lance Taylor <iant@google.com>
14519
14520 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14521 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14522 in the name/type/flags to section mapping. Don't call
14523 allocate_output_section.
14524 (Layout::choose_output_section): Change parameter from adjust_name
14525 to is_input_section. Don't permit input sections after sections
14526 are attached to segments. Don't call allocate_output_section.
14527 (Layout::layout_eh_frame): Call update_flags_for_input_section,
14528 not write_enable_output_section.
14529 (Layout::make_output_section): Don't push to
14530 unattached_section_list_ nor call attach_to_segment. Call
14531 attach_section_to_segment if sections are attached.
14532 (Layout::attach_sections_to_segments): New function.
14533 (Layout::attach_section_to_segment): New function.
14534 (Layout::attach_allocated_section_to_segment): Rename from
14535 attach_to_segment. Remove flags parameter.
14536 (Layout::allocate_output_section): Remove function.
14537 (Layout::write_enable_output_section): Remove function.
14538 * layout.h (class Layout): Update for above changes. Add new
14539 field sections_are_attached_.
14540 * output.h (Output_section::update_flags_for_input_section): New
14541 function.
14542 * output.cc (Output_section::add_input_section): Call
14543 update_flags_for_input_section.
14544 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14545
14546 2008-04-11 Cary Coutant <ccoutant@google.com>
14547
14548 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14549 thought unnecessary.
14550 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14551
14552 2008-04-11 Ian Lance Taylor <iant@google.com>
14553
14554 * output.h (class Output_section_data): Remove inline definition
14555 of set_addralign.
14556 * output.cc (Output_section_data::set_addralign): New function.
14557
14558 2008-04-11 Cary Coutant <ccoutant@google.com>
14559
14560 Add support for TLS descriptors for i386 and x86_64.
14561 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14562 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14563 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14564 GOT_TYPE_TLS_DESC.
14565 (Target_i386::got_mod_index_entry): Remove unnecessary code.
14566 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14567 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
14568 relocations.
14569 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14570 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14571 Fix problem with initial-exec relocations.
14572 (Target_i386::Relocate::relocate_tls): Likewise.
14573 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14574 relaxation.
14575 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14576 support for section-plus-offset dynamic table entries.
14577 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14578 (Output_data_dynamic::Dynamic_entry): Add support for
14579 section-plus-offset dynamic table entries.
14580 (Output_data_dynamic::Classification): Likewise.
14581 (Output_data_dynamic::classification_): Renamed offset_.
14582 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14583 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14584 (Target_x86_64::make_plt_section): New function.
14585 (Target_x86_64::reserve_tlsdesc_entries): New function.
14586 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14587 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14588 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14589 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14590 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14591 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14592 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14593 add extra PLT entry for TLS descriptors.
14594 (Output_data_plt_x86_64::got_): New field.
14595 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14596 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14597 fields.
14598 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14599 descriptors.
14600 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14601 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14602 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14603 R_386_TLS_DESC_CALL relocations.
14604 (Target_x86_64::Scan::global): Likewise.
14605 (Target_x86_64::do_finalize_sections): Add dynamic table entries
14606 for TLS descriptors.
14607 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14608 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14609 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14610 GD-to-IE relaxation.
14611 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14612 and TLS_DESCRIPTORS.
14613 * Makefile.in: Rebuild.
14614 * configure: Rebuild.
14615 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14616 (tls_test_shared2.so): New target.
14617 (tls_shared_gd_to_ie_test_SOURCES): New variable.
14618 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14619 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14620 (tls_shared_gd_to_ie_test_LDADD): New variable.
14621 (tls_shared_gnu2_gd_to_ie_test): New target.
14622 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14623 New targets.
14624 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14625 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14626 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14627 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14628 (tls_shared_gnu2_test): New target.
14629 (tls_test_gnu2_shared.so): New target.
14630 (tls_shared_gnu2_test_SOURCES): New variable.
14631 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14632 (tls_shared_gnu2_test_LDFLAGS): New variable.
14633 (tls_shared_gnu2_test_LDADD): New variable.
14634 * testsuite/Makefile.in: Rebuild.
14635 * testsuite/Makefile.
14636
14637 2008-04-11 Ian Lance Taylor <iant@google.com>
14638
14639 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14640 justsyms.t.
14641 * testsuite/Makefile.in: Rebuild.
14642
14643 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14644 long.
14645 * testsuite/script_test_2.cc (main): Adjust test.
14646
14647 2008-04-11 David S. Miller <davem@davemloft.net>
14648 Ian Lance Taylor <iant@google.com>
14649
14650 * options.h (General_options): Add entries for '-Y' and
14651 '-relax'.
14652 * options.cc (General_options:finalize): If -Y was used, add those
14653 entries to the library path instead of the default "/lib" and
14654 "/usr/lib".
14655
14656 2008-04-11 David S. Miller <davem@davemloft.net>
14657
14658 * testsuite/justsyms.t: Start at 0x100.
14659 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14660 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14661 long.
14662 * testsuite/script_test_2.cc: Adjust string and section length
14663 checks.
14664
14665 2008-04-09 Ian Lance Taylor <iant@google.com>
14666
14667 PR gold/5996
14668 * script-sections.cc (Sections_element::allocate_to_segment): Add
14669 orphan parameter.
14670 (Output_section_definition::allocate_to_segment): Likewise.
14671 (Orphan_output_section::allocate_to_segment): Likewise.
14672 (Script_sections::attach_sections_using_phdrs_clause): Don't
14673 propagate non-PT_LOAD segments to orphan sections.
14674 * testsuite/Makefile.am (script_test_3.stdout): Generate using
14675 readelf rather than objdump.
14676 * testsuite/script_test_3.sh: Adjust accordingly. Test that
14677 .interp section and PT_INTERP segment are the same size.
14678 * testsuite/Makefile.in: Rebuild.
14679
14680 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14681 aliases for symbols defined in the same object.
14682 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14683 (weak_alias_test_SOURCES): New variable.
14684 (weak_alias_test_DEPENDENCIES): New variable.
14685 (weak_alias_test_LDFLAGS): New variable.
14686 (weak_alias_test_LDADD): New variable.
14687 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14688 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14689 (weak_alias_test_3.o): New target.
14690 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14691 * testsuite/weak_alias_test_main.cc: New file.
14692 * testsuite/weak_alias_test_1.cc: New file.
14693 * testsuite/weak_alias_test_2.cc: New file.
14694 * testsuite/weak_alias_test_3.cc: New file.
14695
14696 2008-04-08 Ian Lance Taylor <iant@google.com>
14697
14698 * options.h (class General_options): Add --noinhibit-exec option.
14699 * main.cc (main): Check --noinhibit-exec.
14700
14701 * options.h (class General_options): Define --wrap as a special
14702 option. Add wrap_symbols_ field.
14703 (General_options::any_wrap_symbols): New function.
14704 (General_options::is_wrap_symbol): New function.
14705 * options.cc (General_options::parse_wrap): New function.
14706 (General_options::General_options): Initialize wrap_symbols_.
14707 * symtab.cc (Symbol_table::wrap_symbol): New function.
14708 (Symbol_table::add_from_object): Handle --wrap.
14709 * symtab.h (class Symbol_table): Declare wrap_symbol.
14710 * target.h (Target::wrap_char): New function.
14711 (Target::Target_info): Add wrap_char field.
14712 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14713 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14714 * testsuite/testfile.cc (Target_test::test_target_info):
14715 Likewise.
14716
14717 * errors.cc (Errors::undefined_symbol): Mention symbol version if
14718 there is one.
14719
14720 * layout.h (class Layout): Add added_eh_frame_data_ field.
14721 * layout.cc (Layout::Layout): Initialize new field.
14722 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14723 output section until we find a section we merged successfully.
14724 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14725 that the size be non-zero.
14726
14727 * merge.cc (Object_merge_map::get_output_offset): Remove inline
14728 qualifier.
14729
14730 2008-04-08 Craig Silverstein <csilvers@google.com>
14731
14732 * configure.ac: Export new conditional variable HAVE_ZLIB.
14733 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14734 on HAVE_ZLIB.
14735 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14736 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14737
14738 2008-04-07 Ian Lance Taylor <iant@google.com>
14739
14740 * version.cc (version_string): Set to "1.5".
14741
14742 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14743 Add issued_non_pic_error_ field. Declare check_non_pic.
14744 (Target_x86_64::Scan::check_non_pic): New function.
14745 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14746 (Target_x86_64::Scan::global): Likewise.
14747
14748 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14749 addend parameter. Change caller. Handle merge sections.
14750 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14751 Address to Addend. Don't add in the result of
14752 local_section_offset, pass down the addend and use the returned
14753 value.
14754 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14755 Update declarations of local_section_offset and symbol_value.
14756 * testsuite/two_file_test_1.cc (t18): New function.
14757 * testsuite/two_file_test_2.cc (f18): New function.
14758 * testsuite/two_file_test_main.cc (main): Call t18.
14759 * testsuite/two_file_test.h (t18, f18): Declare.
14760
14761 * configure.ac: Don't test for objdump, c++filt, or readelf.
14762 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14763 conditionals.
14764 (TEST_READELF): New variable.
14765 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14766 (check_PROGRAMS): Add two_file_strip_test.
14767 (two_file_strip_test): New target.
14768 (check_PROGRAMS): Add two_file_same_shared_strip_test.
14769 (two_file_same_shared_strip_test_SOURCES): New variable.
14770 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14771 (two_file_same_shared_strip_test_LDFLAGS): New variable.
14772 (two_file_same_shared_strip_test_LDADD): New variable.
14773 (two_file_shared_strip.so): New target.
14774 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14775 (ver_test_5.syms, ver_test_7.syms): Likewise.
14776 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14777 (strip_test_3.stdout): Use TEST_OBJDUMP.
14778 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14779
14780 2008-04-04 Cary Coutant <ccoutant@google.com>
14781
14782 * symtab.h (Symbol::is_weak_undefined): New function.
14783 (Symbol::is_strong_undefined): New function.
14784 (Symbol::is_absolute): New function.
14785 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14786 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14787 absolute symbols.
14788 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14789 (weak_undef_test): New target.
14790 * testsuite/Makefile.in: Rebuild.
14791 * testsuite/weak_undef_file1.cc: New file.
14792 * testsuite/weak_undef_file2.cc: New file.
14793 * testsuite/weak_undef_test.cc: New file.
14794
14795 2008-04-03 Craig Silverstein <csilvers@google.com>
14796
14797 * compressed_output.h (class Output_compressed_section): Use
14798 unsigned buffer.
14799 * compressed_output.cc (zlib_compress): Use unsigned buffers,
14800 add zlib header.
14801 (zlib_compressed_suffix): Removed.
14802 (Output_compressed_section::set_final_data_size): Use unsigned
14803 buffers.
14804 * testsuite/Makefile.am (flagstest_compress_debug_sections):
14805 Fix linker invocation.
14806 (flagstest_o_specialfile_and_compress_debug_sections):
14807 Likewise.
14808 * testsuite/Makefile.in: Regenerated.
14809
14810 2008-04-02 David S. Miller <davem@davemloft.net>
14811
14812 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14813 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14814
14815 2008-04-02 Craig Silverstein <csilvers@google.com>
14816
14817 * TODO: New file.
14818
14819 2008-04-02 Ian Lance Taylor <iant@google.com>
14820
14821 * fileread.cc (File_read::find_view): Add byteshift and vshifted
14822 parameters. Update for new key type to views_. Change all
14823 callers.
14824 (File_read::read): Adjust for byteshift in returned view.
14825 (File_read::add_view): New function, broken out of
14826 find_and_make_view.
14827 (File_read::make_view): New function, broken out of
14828 find_and_make_view.
14829 (File_read::find_or_make_view): Add offset and aligned
14830 parameters. Rewrite accordingly. Change all callers.
14831 (File_read::get_view): Add offset and aligned parameters. Adjust
14832 for byteshift in return value.
14833 (File_read::get_lasting_view): Likewise.
14834 * fileread.h (class File_read): Update declarations.
14835 (class File_read::View): Add byteshift_ field. Add byteshift to
14836 constructor. Add byteshift method.
14837 * archive.h (Archive::clear_uncached_views): New function.
14838 (Archive::get_view): Add aligned parameter. Change all callers.
14839 * object.h (Object::get_view): Add aligned parameter. Change all
14840 callers.
14841 (Object::get_lasting_view): Likewise.
14842
14843 * fileread.cc (File_read::release): Don't call clear_views if
14844 there are multiple objects.
14845 * fileread.h (File_read::clear_uncached_views): New function.
14846 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14847 on the archive.
14848
14849 2008-03-31 Cary Coutant <ccoutant@google.com>
14850
14851 Add thin archive support.
14852 * archive.cc (Archive::armagt): New const.
14853 (Archive::setup): Remove task parameter and calls to unlock.
14854 (Archive::unlock_nested_archives): New function.
14855 (Archive::read_header): Add nested_off parameter. Change
14856 all callers.
14857 (Archive::interpret_header): Likewise.
14858 (Archive::include_all_members): Change to handle thin
14859 archives.
14860 (Archive::include_member): Likewise.
14861 * archive.h (Archive::Archive): Add new parameters and
14862 initializers.
14863 (Archive::armagt): New const.
14864 (Archive::setup): Remove task parameter.
14865 (Archive::unlock_nested_archives): New function.
14866 (Archive::read_header): Add nested_off parameter.
14867 (Archive::interpret_header): Likewise.
14868 (Archive::Nested_archive_table): New typedef.
14869 (Archive::is_thin_archive_): New field.
14870 (Archive::nested_archives_): New field.
14871 (Archive::options_): New field.
14872 (Archive::dirpath_): New field.
14873 (Archive::task_): New field.
14874 * readsyms.cc (Read_symbols::do_read_symbols): Add check
14875 for thin archives. Pass additional parameters to
14876 Archive::Archive. Unlock the archive file after calling
14877 Archive::setup.
14878
14879 2008-03-29 Ian Lance Taylor <iant@google.com>
14880
14881 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14882 version symbol to be local.
14883 * testsuite/ver_test_4.sh: New file.
14884 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14885 (check_DATA): Add ver_test_4.syms.
14886 (ver_test_4.syms): New target.
14887 * testsuite/Makefile.in: Rebuild.
14888
14889 * output.cc
14890 (Output_section::Input_section_sort_entry::has_priority): New
14891 function.
14892 (Output_section::Input_section_sort_entry::match_file_name): New
14893 function.
14894 (Output_section::Input_section_sort_entry::match_section_name):
14895 Remove.
14896 (Output_section::Input_section_sort_entry::match_section_name_prefix):
14897 Remove.
14898 (Output_section::Input_section_sort_entry::match_section_file):
14899 Remove.
14900 (Output_section::Input_section_sort_compare::operator()): Rewrite
14901 using new Input_section_sort_entry functions. Sort crtbegin and
14902 crtend first. Sort sections with no priority before sections with
14903 a priority.
14904 * testsuite/initpri1.c (d3): Check j != 4.
14905 (cd5): New constructor/destructor function.
14906 (main): Check j != 2.
14907
14908 * symtab.cc (Symbol_table::add_from_object): If we don't use the
14909 new symbol when resolving, don't call set_is_default.
14910 * testsuite/ver_test_7.cc: New file.
14911 * testsuite/ver_test_7.sh: New file.
14912 * testsuite/Makefile.am (ver_test_7.so): New target.
14913 (ver_test_7.o): New target.
14914 (check_SCRIPTS): Add ver_test_7.sh.
14915 (check_DATA): Add ver_test_7.syms.
14916 (ver_test_7.syms): New target.
14917
14918 2008-03-28 Ian Lance Taylor <iant@google.com>
14919
14920 * layout.cc (Layout::layout): If we see an input section with a
14921 name that needs sorting, set the must_sort flag for the output
14922 section.
14923 (Layout::make_output_section): If the name of the output section
14924 indicates that it might require sorting, set the may_sort flag.
14925 * output.h (Output_section::may_sort_attached_input_sections): New
14926 function.
14927 (Output_section::set_may_sort_attached_input_sections): New
14928 function.
14929 (Output_section::must_sort_attached_input_sections): New
14930 function.
14931 (Output_section::set_must_sort_attached_input_sections): New
14932 function.
14933 (class Output_section): Declare Input_section_sort_entry. Define
14934 Input_section_sort_compare. Declare
14935 sort_attached_input_sections. Add new fields:
14936 may_sort_attached_input_sections_,
14937 must_sort_attached_input_sections_,
14938 attached_input_sections_are_sorted_.
14939 * output.cc (Output_section::Output_section): Initialize new
14940 fields.
14941 (Output_section::add_input_section): Add an entry to
14942 input_sections_ if may_sort or must_sort are true.
14943 (Output_section::set_final_data_size): Call
14944 sort_attached_input_sections if necessary.
14945 (Output_section::Input_section_sort_entry): Define new class.
14946 (Output_section::Input_section_sort_compare::operator()): New
14947 function.
14948 (Output_section::sort_attached_input_sections): New function.
14949 * configure.ac: Check whether the compiler supports constructor
14950 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
14951 * testsuite/initpri1.c: New file.
14952 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14953 CONSTRUCTOR_PRIORITY.
14954 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14955 (initpri1_LDFLAGS): New variable.
14956 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14957
14958 2008-03-27 Ian Lance Taylor <iant@google.com>
14959
14960 * common.cc (Sort_commons::operator): Correct sorting algorithm.
14961 * testsuite/common_test_1.c: New file.
14962 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14963 (common_test_1_SOURCES): New variable.
14964 (common_test_1_DEPENDENCIES): New variable.
14965 (common_test_1_LDFLAGS): New variable.
14966
14967 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14968 and commons_ correctly when NAME/VERSION does not override
14969 NAME/NULL.
14970 * testsuite/ver_test_6.c: New file.
14971 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14972 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14973 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14974
14975 2008-03-26 Ian Lance Taylor <iant@google.com>
14976
14977 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14978 of an undefined symbol from a version script.
14979 * testsuite/Makefile.am (ver_test_5.so): New target.
14980 (ver_test_5.o): New target.
14981 (check_SCRIPTS): Add ver_test_5.sh.
14982 (check_DATA): Add ver_test_5.syms.
14983 (ver_test_5.syms): New target.
14984 * testsuite/ver_test_5.cc: New file.
14985 * testsuite/ver_test_5.script: New file.
14986 * testsuite/ver_test_5.sh: New file.
14987 * Makefile.in, testsuite/Makefile.in: Rebuild.
14988
14989 PR gold/5986
14990 Fix problems building gold with gcc 4.3.0.
14991 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14992 (gold_error_at_location, gold_warning_at_location): Use it.
14993 * configure.ac: Check whether we can compile and use a template
14994 function with a printf attribute.
14995 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14996 when jumping over bytes.
14997 * object.cc: Instantiate Object::read_section_data.
14998 * debug.h: Include <cstring>
14999 * dwarf_reader.cc: Include <algorithm>
15000 * main.cc: Include <cstring>.
15001 * options.cc: Include <cstring>.
15002 * output.cc: Include <cstring>.
15003 * script.cc: Include <cstring>.
15004 * script.h: Include <string>.
15005 * symtab.cc: Include <cstring> and <algorithm>.
15006 * target-select.cc: Include <cstring>.
15007 * version.cc: Include <string>.
15008 * testsuite/testmain.cc: Include <cstdlib>.
15009 * configure, config.in: Rebuild.
15010
15011 2008-03-25 Ian Lance Taylor <iant@google.com>
15012
15013 * options.cc: Include "../bfd/bfdver.h".
15014 (options::help): Print bug reporting address.
15015
15016 * version.cc (print_version): Adjust output for current value of
15017 BFD_VERSION_STRING.
15018
15019 * NEWS: New file.
15020
15021 * options.cc (options::help): Print list of supported targets.
15022 * target-select.h: Include <vector>.
15023 (class Target_selector): Make machine_, size_, and is_big_endian_
15024 fields const. Add bfd_name_ and instantiated_target_ fields.
15025 (Target_selector::Target_selector): Add bfd_name parameter.
15026 (Target_selector::recognize): Make non-virtual, call
15027 do_recognize.
15028 (Target_selector::recognize_by_name): Make non-virtual, call
15029 do_recognize_by_name.
15030 (Target_selector::supported_names): New function.
15031 (Target_selector::bfd_name): New function.
15032 (Target_selector::do_instantiate_target): New pure virtual
15033 function.
15034 (Target_selector::do_recognize): New virtual function.
15035 (Target_selector::do_recognize_by_name): New virtual function.
15036 (Target_selector::instantiate_target): New private function.
15037 (supported_target_names): Declare.
15038 * target-select.cc (Target_selector::Target_selector): Update for
15039 new parameter and fields.
15040 (select_target_by_name): Check that the name matches before
15041 calling recognize_by_name.
15042 (supported_target_names): New function.
15043 * i386.cc (class Target_selector_i386): Update Target_selector
15044 constructor call. Remove recognize and recognize_by_name. Add
15045 do_instantiate_target.
15046 * x86_64.cc (class Target_selector_x86_64): Likewise.
15047 * testsuite/testfile.cc (class Target_selector_test): Update for
15048 changes to Target_selector.
15049
15050 * README: Rewrite, with some notes on unsupported features.
15051
15052 2008-03-24 Cary Coutant <ccoutant@google.com>
15053
15054 * i386.cc (Target_i386::Got_type): New enum declaration.
15055 (Target_i386::Scan::local): Updated callers of Output_data_got
15056 member functions.
15057 (Target_i386::Scan::global): Likewise.
15058 (Target_i386::Relocate::relocate): Likewise.
15059 (Target_i386::Relocate::relocate_tls): Likewise.
15060 * object.h (Got_offset_list): New class.
15061 (Sized_relobj::local_has_got_offset): Added got_type parameter.
15062 (Sized_relobj::local_got_offset): Likewise.
15063 (Sized_relobj::set_local_got_offset): Likewise.
15064 (Sized_relobj::local_has_tls_got_offset): Removed.
15065 (Sized_relobj::local_tls_got_offset): Removed.
15066 (Sized_relobj::set_local_tls_got_offset): Removed.
15067 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15068 * output.cc (Output_data_got::add_global): Added got_type parameter.
15069 (Output_data_got::add_global_with_rel): Likewise.
15070 (Output_data_got::add_global_with_rela): Likewise.
15071 (Output_data_got::add_global_pair_with_rel): New function.
15072 (Output_data_got::add_global_pair_with_rela): New function.
15073 (Output_data_got::add_local): Added got_type parameter.
15074 (Output_data_got::add_local_with_rel): Likewise.
15075 (Output_data_got::add_local_with_rela): Likewise.
15076 (Output_data_got::add_local_pair_with_rel): New function.
15077 (Output_data_got::add_local_pair_with_rela): New function.
15078 (Output_data_got::add_global_tls): Removed.
15079 (Output_data_got::add_global_tls_with_rel): Removed.
15080 (Output_data_got::add_global_tls_with_rela): Removed.
15081 (Output_data_got::add_local_tls): Removed.
15082 (Output_data_got::add_local_tls_with_rel): Removed.
15083 (Output_data_got::add_local_tls_with_rela): Removed.
15084 * output.h (Output_data_got::add_global): Added got_type parameter.
15085 (Output_data_got::add_global_with_rel): Likewise.
15086 (Output_data_got::add_global_with_rela): Likewise.
15087 (Output_data_got::add_global_pair_with_rel): New function.
15088 (Output_data_got::add_global_pair_with_rela): New function.
15089 (Output_data_got::add_local): Added got_type parameter.
15090 (Output_data_got::add_local_with_rel): Likewise.
15091 (Output_data_got::add_local_with_rela): Likewise.
15092 (Output_data_got::add_local_pair_with_rel): New function.
15093 (Output_data_got::add_local_pair_with_rela): New function.
15094 (Output_data_got::add_global_tls): Removed.
15095 (Output_data_got::add_global_tls_with_rel): Removed.
15096 (Output_data_got::add_global_tls_with_rela): Removed.
15097 (Output_data_got::add_local_tls): Removed.
15098 (Output_data_got::add_local_tls_with_rel): Removed.
15099 (Output_data_got::add_local_tls_with_rela): Removed.
15100 * resolve.cc (Symbol::override_base_with_special): Removed
15101 reference to has_got_offset_ field.
15102 * symtab.cc (Symbol::init_fields): Replaced initialization
15103 of got_offset_ with got_offsets_. Removed initialization
15104 of has_got_offset_
15105 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15106 (Symbol::got_offset): Likewise.
15107 (Symbol::set_got_offset): Likewise.
15108 (Symbol::has_tls_got_offset): Removed.
15109 (Symbol::tls_got_offset): Removed.
15110 (Symbol::set_tls_got_offset): Removed.
15111 (Symbol::got_offset_): Removed.
15112 (Symbol::tls_mod_got_offset_): Removed.
15113 (Symbol::tls_pair_got_offset_): Removed.
15114 (Symbol::got_offsets_): New field.
15115 (Symbol::has_got_offset): Removed.
15116 (Symbol::has_tls_mod_got_offset): Removed.
15117 (Symbol::has_tls_pair_got_offset): Removed.
15118 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15119 (Target_x86_64::Scan::local): Updated callers of Output_data_got
15120 member functions.
15121 (Target_x86_64::Scan::global): Likewise.
15122 (Target_x86_64::Relocate::relocate): Likewise.
15123 (Target_x86_64::Relocate::relocate_tls): Likewise.
15124
15125 2008-03-25 Ben Elliston <bje@au.ibm.com>
15126
15127 * yyscript.y: Fix spelling error in comment.
15128
15129 2008-03-24 Ian Lance Taylor <iant@google.com>
15130
15131 * options.h (class General_options): Define build_id option.
15132 * layout.h (class Layout): Declare write_build_id, create_note,
15133 create_build_id. Add build_id_note_ member.
15134 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15135 "libiberty.h", "md5.h", "sha1.h".
15136 (Layout::Layout): Initialize eh_frame_data_,
15137 eh_frame_hdr_section_, and build_id_note_.
15138 (Layout::finalize): Call create_build_id.
15139 (Layout::create_note): New function, broken out of
15140 Layout::create_gold_note.
15141 (Layout::create_gold_note): Call create_note.
15142 (Layout::create_build_id): New function.
15143 (Layout::write_build_id): New function.
15144 (Close_task_runner::run): Call write_build_id.
15145
15146 * x86_64.cc: Correct license to GPLv3.
15147
15148 2008-03-23 Ian Lance Taylor <iant@google.com>
15149
15150 * options.cc: Include "demangle.h".
15151 (parse_optional_string): New function.
15152 (parse_long_option): Handle takes_optional_argument.
15153 (parse_short_option): Update dash_z initializer. Handle
15154 takes_optional_argument.
15155 (General_options::General_options): Initialize do_demangle_.
15156 (General_options::finalize): Set do_demangle_. Handle demangling
15157 style.
15158 * options.h (parse_optional_string): Declare.
15159 (struct One_option): Add optional_arg field. Update constructor.
15160 Update call constructor calls. Add takes_optional_argument
15161 function.
15162 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
15163 (DEFINE_optional_string): Define.
15164 (General_options::demangle): Change from DEFINE_bool to
15165 DEFINE_optional_string.
15166 (General_options::no_demangle): New function.
15167 (General_options::do_demangle): New function.
15168 (General_options::set_do_demangle): New function.
15169 (General_options::execstack_status_): Move definition to end of
15170 class definition.
15171 (General_options::static_): Likewise.
15172 (General_options::do_demangle_): New field.
15173 * object.cc (big_endian>::get_symbol_location_info): Call
15174 Options::do_demangle, not Options::demangle.
15175 * symtab.cc (demangle): Likewise.
15176
15177 2008-03-22 Ian Lance Taylor <iant@google.com>
15178
15179 * gold.h: Include <cstddef> and <sys/types.h>
15180 * options.h: Include <cstring>.
15181
15182 2008-03-21 Ian Lance Taylor <iant@google.com>
15183
15184 * Added source code to GNU binutils.
15185 \f
15186 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15187
15188 Copying and distribution of this file, with or without modification,
15189 are permitted in any medium without royalty provided the copyright
15190 notice and this notice are preserved.
15191
15192 Local Variables:
15193 mode: change-log
15194 left-margin: 8
15195 fill-column: 74
15196 version-control: never
15197 End: