daily update
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2013-10-14 Alan Modra <amodra@gmail.com>
2
3 * output.h (Output_data_got::add_constant): Tidy.
4 (Output_data_got::add_constant_pair): New function.
5 * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
6 methods used so as to first call reserve_ent().
7
8 2013-10-11 Roland McGrath <mcgrathr@google.com>
9
10 * powerpc.cc (Output_data_got_powerpc): Remove unused methods
11 add_got_entry and add_got_entry_pair.
12
13 * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
14 (HAVE_PUBNAMES): Likewise.
15 * configure: Regenerate.
16
17 * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
18 * testsuite/Makefile.in: Regenerate.
19
20 * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
21 Remove const from declaration.
22 * target.cc (Sized_target::do_adjust_elf_header): Update definition.
23 * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
24 * output.h (Output_file_header): Remove const from member target_
25 and corresponding constructor argument.
26 * output.cc (Output_file_header::Output_file_header): Update prototype.
27 (Output_file_header::do_sized_write): Use this->target_ in place
28 of parameters()->target().
29
30 * testsuite/undef_symbol.cc (Foo::get_a): New method.
31
32 * configure.ac (MERGE_CONSTANTS_FLAG): New check.
33 * configure: Regenerate.
34 * Makefile.in: Regenerate.
35 * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
36 * testsuite/merge_string_literals_2.c: Likewise.
37 * testsuite/Makefile.am
38 (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
39 (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
40 literal -fmerge-constants.
41 * testsuite/Makefile.in: Regenerate.
42
43 * i386.cc (Target_i386): Remove unused member dynbss_.
44 * arm.cc (Target_arm): Likewise.
45 * powerpc.cc (Target_powerpc): Likewise.
46 * sparc.cc (Target_sparc): Likewise.
47 * tilegx.cc (Target_tilegx): Likewise.
48 * x86_64.cc (Target_x86_64): Likewise.
49 * dwarf_reader.h (Dwarf_info_reader): Remove unused members
50 type_signature_, type_offset_.
51 * plugin.h (Plugin_hook): Remove unused member layout_.
52 * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
53 mapfile_.
54 (Read_member): Remove unused members input_objects_, symtab_,
55 mapfile_, layout_.
56 (Check_library): Remove unused member symtab_.
57 * archive.h (Lib_group): Remove unused member lib_.
58 * archive.cc (Lib_group::Lib_group): Update initializer.
59 * incremental.h (Incremental_binary): Remove unused member target_.
60 (Incremental_script_entry): Removed unused member script_.
61 * layout.h (Write_symbols_task): Remove unused member input_objects_.
62 * icf.h (Icf): Remove unused member num_tracked_relocs.
63
64 * gold-threads.h (Once): Conditionalize member was_run_lock_ on
65 [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
66 its only use.
67 * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
68
69 * archive.h: Use struct rather than class for forward declaration
70 of Read_symbols_data.
71
72 2013-10-07 Cary Coutant <ccoutant@google.com>
73
74 PR gold/16010
75 * testsuite/Makefile.am (icf_test): Fix dependencies.
76 (icf_safe_test): Likewise.
77 (icf_safe_so_test): Likewise.
78 (large_symbol_alignment): Add empty _LDADD rule.
79 * testsuite/Makefile.in: Regenerate.
80
81 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
82
83 PR gold/15927
84 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
85 relocation for R_X86_64_32 on x32.
86
87 2013-08-27 Roland McGrath <mcgrathr@google.com>
88
89 * output.cc (Output_segment::set_section_addresses): Take new
90 Target* argument. If target->isolate_execinstr() and the segment
91 is executable and starts at a target->abi_pagesize() boundary,
92 pad its end out to a target->abi_pagesize() boundary with code fill.
93 * output.h (Output_segment::set_section_addresses): Update decl.
94 * layout.h (Layout::check_output_data_for_reset_values): Take new
95 argument RELAX_OUTPUTS.
96 (Layout): New member relax_output_list_.
97 (Layout::add_relax_output): New method.
98 * layout.cc (Layout::Layout): Update constructor.
99 (Layout::reset_relax_output): New method.
100 (Layout::clean_up_after_relaxation): Call it.
101 (Layout::prepare_for_relaxation): Update caller.
102 (Layout::set_segment_offsets): Update callers of set_section_addresses.
103 Call reset_relax_output before re-processing segments for
104 isolate_execinstr case.
105 (Layout::write_data): Handle relax_output_list_.
106 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
107 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
108
109 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
110
111 PR binutils/15834
112 * object.h: Fix typos.
113
114 2013-08-16 Roland McGrath <mcgrathr@google.com>
115
116 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
117 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
118
119 2013-08-07 Cary Coutant <ccoutant@google.com>
120
121 Revert support for v2 DWP files:
122
123 2013-03-01 Cary Coutant <ccoutant@google.com>
124
125 Add dwp support for v2 DWARF package file format.
126 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
127 tu_length parameter. Adjust all callers.
128 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
129 * dwp.cc: Include dwarf.h.
130 (Section_bounds): New struct type.
131 (Unit_set): New struct type.
132 (Dwo_file::Dwo_file): Initialize new data member.
133 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
134 Combine and rename to...
135 (Dwo_file::read_unit_index): ...this.
136 (Dwo_file::sized_read_compunit_index)
137 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
138 (Dwo_file::sized_read_unit_index): ...this.
139 (Dwo_file::copy_section): Remove section_name, is_str_offsets
140 parameters; add section_id parameter.
141 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
142 (Dwo_file::add_unit_set): ...this.
143 (Dwo_file::shndx_map_): Remove.
144 (Dwo_file::sect_offsets_): New data member.
145 (Dwp_output_file::Dwp_output_file): Initialize new data members.
146 (Dwp_output_file::add_section): Rename to...
147 (Dwp_output_file::add_contribution): ...this.
148 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
149 (Dwp_output_file::add_tu_set): Likewise.
150 (Dwp_output_file::Contribution): New type.
151 (Dwp_output_file::Section::contributions): New data member.
152 (Dwp_output_file::Cu_or_tu_set): Remove.
153 (Dwp_output_file::Section::Section): New ctor.
154 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
155 (Dwp_output_file::Dwp_index::Section_table): New type.
156 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
157 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
158 parameter.
159 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
160 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
161 (Dwp_output_file::Dwp_index::section_table): New member function.
162 (Dwp_output_file::Dwp_index::section_table_end): New member function.
163 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
164 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
165 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
166 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
167 (Dwp_output_file::Dwp_index::section_table_): New data member.
168 (Dwp_output_file::Dwp_index::section_mask_): New data member.
169 (Dwp_output_file::add_output_section): New member function.
170 (Dwp_output_file::write_new_section): New member function.
171 (Dwp_output_file::write_contributions): New member function.
172 (Dwp_output_file::section_id_map_): New data member.
173 (class Dwo_id_info_reader): Remove.
174 (class Unit_reader): New class.
175 (get_dwarf_section_name): New function.
176 (Dwo_file::read_executable): Adjust initializations of class data.
177 (Dwo_file::read): Add support for v2 package file format.
178 (Dwo_file::read_unit_index): Likewise.
179 (Dwo_file::sized_read_unit_index): Likewise.
180 (Dwo_file::copy_section): Likewise.
181 (Dwo_file::add_unit_set): Likewise.
182 (Dwp_output_file::add_output_section): Likewise.
183 (Dwp_output_file::add_contribution): Likewise.
184 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
185 for empty slot.
186 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
187 file format.
188 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
189 slot.
190 (Dwp_output_file::initialize): Remove unused function.
191 (Dwp_output_file::finalize): Add support for v2 package file format.
192 (Dwp_output_file::write_index): Likewise.
193 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
194 function prototype.
195
196 2013-07-31 Cary Coutant <ccoutant@google.com>
197
198 * object.cc (Sized_relobj::do_output_section_address): New function.
199 (Sized_relobj): Instantiate explicitly.
200 * object.h (Object::output_section_address): New function.
201 (Object::do_output_section_address): New function.
202 (Sized_relobj::do_output_section_address): New function.
203 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
204
205 2013-07-30 Cary Coutant <ccoutant@google.com>
206 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
207
208 * parameters.cc (Parameters::entry): Return target-specific entry
209 symbol name.
210 * target.h (Target::entry_symbol_name): New function.
211 (Target_info::entry_symbol_name): New data member.
212
213 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
214 * i386.cc (Target_i386::i386_info): Likewise.
215 (Target_i386_nacl::i386_nacl_info): Likewise.
216 * sparc.cc (Target_sparc::sparc_info): Likewise.
217 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
218 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
219 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
220 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
221
222 2013-07-22 Sterling Augustine <saugustine@google.com>
223
224 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
225 Convert parameter shndx to local variable. Add parameters symtab
226 and symtab_size. Scan over section names. Find relocation
227 section corresponding to current section. Create and initialize
228 reloc_mapper_ and reloc_type_.
229 (Dwarf_pubnames_table::read_header): Add assertion. Change
230 unit_length to off_t. Initialize member unit_length_. Fill in field
231 cu_offset_.
232 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
233 Initialize new fields unit_length_ and cu_offset_.
234 (Dwarf_pubnames_table::read_section): Update prototype.
235 (Dwarf_pubnames_table::cu_offset): New member function.
236 (Dwarf_pubnames_table::subsection_size): Likewise.
237 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
238 New fields.
239 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
240 member functions public.
241 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
242 Update comment. Rework logic. Move repeated parts to...
243 (Gdb_index_info_reader::read_pubtable): ...here. New function.
244 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
245 pubtypes_table_, and stmt_list_offset.
246 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
247 Gdb_index::find_pubtype_offset,
248 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
249 (Gdb_index::pubnames_read): Update prototype and rework logic.
250 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
251 Forward declare.
252 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
253 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
254 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
255 Gdb_index::map_pubtable_to_dies):
256 Declare functions.
257 (Gdb_index::pubnames_read): Update declaration.
258 (Gdb_index::Pubname_offset_map): New type.
259 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
260 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
261 Gdb_index::stmt_list_offset): Declare.
262 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
263 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
264 Gdb_index::pubtypes_offset_): Remove.
265
266 2013-07-19 Roland McGrath <mcgrathr@google.com>
267
268 * options.h (General_options): Add -Trodata-segment option.
269 * parameters.cc (Parameters::check_rodata_segment): New function.
270 (Parameters::set_target_once): Call it.
271 * parameters.h (Parameters): Declare it (private member function).
272 * layout.cc (load_seg_unusable_for_headers): New function, broken
273 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
274 then validate rodata segment rather than text segment.
275 (relaxation_loop_body): Call that.
276 (is_text_segment): New function. Don't admit a non-executable
277 segment if TARGET->isolate_execinstr().
278 (set_segment_offsets): Call it. Honor -Trodata-segment option.
279
280 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
281
282 PR gold/15070
283 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
284 * nacl.h (Sniff_file::View::View): Request aligned view.
285
286 2013-07-11 Cary Coutant <ccoutant@google.com>
287
288 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
289 correct BRLT entry size.
290
291 2013-07-03 Alan Modra <amodra@gmail.com>
292
293 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
294 comment.
295
296 2013-07-01 Cary Coutant <ccoutant@google.com>
297
298 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
299 reloc_type_.
300 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
301 (Dwarf_ranges_table::lookup_reloc): New function.
302 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
303 reloc_type_.
304 (Dwarf_ranges_table::lookup_reloc): New function.
305 (Dwarf_ranges_table::reloc_type_): New data member.
306
307 2013-06-27 Jing Yu <jingyu@google.com>
308
309 PR gold/15662
310 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
311 function.
312 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
313 (Target_powerpc::do_relax): Call the above.
314
315 2013-06-27 Cary Coutant <ccoutant@google.com>
316
317 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
318 on garbage collected .opd section.
319
320 2013-06-27 Alan Modra <amodra@gmail.com>
321
322 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
323 is non-zero.
324 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
325 (Target_powerpc::do_function_location): Likewise for loc->shndx.
326
327 2013-06-14 Cary Coutant <ccoutant@google.com>
328
329 * resolve.cc (Symbol::override_base): Don't override st_type
330 from plugin placeholder symbols.
331 (Symbol_table::resolve): Likewise.
332 (Symbol_table::should_override): Don't complain about TLS mismatch
333 if the TO symbol is a plugin placeholder.
334 * testsuite/Makefile.am (plugin_test_tls): New test.
335 * testsuite/Makefile.in: Regenerate.
336 * testsuite/plugin_test_tls.sh: New test script.
337 * testsuite/two_file_test_2_tls.cc: New test source.
338 * testsuite/two_file_test_tls.cc: New test source.
339
340 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
341
342 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
343 the maximum segment alignment is larger than the page size.
344 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
345 correctly aligns the symbols with large alignemnt.
346 * testsuite/Makefile.in: Regenerate.
347 * testsuite/large_symbol_alignment.cc: New file.
348
349 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
350 Sriraman Tallam <tmsriram@google.com>
351
352 * options.h (sort_section): New option.
353 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
354 Rename from Input_section_sort_section_name_special_ordering_compare.
355 (Input_section_sort_section_name_compare): New struct.
356 * output.cc (Output_section::Input_section_sort_section_name_compare::
357 operator()): New function.
358 (Output_section::sort_attached_input_sections): Use new sort function
359 for .text if --sort-section=name is specified.
360 * layout.cc (Layout::make_output_section):
361 Add sorting by name when --sort-section=name is specified.
362 * testsuite/Makefile.am (text_section_grouping): Test option
363 --sort-section=name.
364 * testsuite/Makefile.in: Regenerate.
365 * testsuite/section_sorting_name.cc: New file.
366 * testsuite/section_sorting_name.sh: New file.
367
368 2013-05-21 Cary Coutant <ccoutant@google.com>
369
370 * symtab.h (Symbol::is_cxx_vtable): New function.
371 * target-reloc.h (relocate_section): Check for vtable symbol.
372 * testsuite/Makefile.am (missing_key_func.sh): New test case.
373 * testsuite/Makefile.in: Regenerate.
374 * testsuite/missing_key_func.cc: New test source.
375 * testsuite/missing_key_func.sh: New test script.
376
377 2013-05-21 Cary Coutant <ccoutant@google.com>
378
379 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
380 type of enclosing symbol.
381 (Relocate_info::location): Check symbol type when describing symbol.
382 * object.h (Symbol_location_info): Remove unused line_number;
383 add enclosing_symbol_type.
384 * testsuite/debug_msg.sh: Adjust expected output.
385
386 2013-05-13 Cary Coutant <ccoutant@google.com>
387
388 * configure.ac: Export DEFAULT_TARGET.
389 * configure: Regenerate.
390 * Makefile.in: Regenerate.
391 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
392 * testsuite/Makefile.in: Regenerate.
393 * testsuite/debug_msg.sh: Delete duplicate tests.
394 Don't check undef_int error message match for powerpc where the
395 source file and line number aren't available.
396
397 2013-05-10 Roland McGrath <mcgrathr@google.com>
398
399 * options.h (General_options): Add --rosegment-gap option.
400 * options.cc (finalize): --rosegment-gap implies --rosegment.
401 * layout.cc (set_segment_offsets): Let user option override
402 target->rosegment_gap().
403
404 2013-05-10 Roland McGrath <mcgrathr@google.com>
405
406 * options.h (General_options): Remove leading space from help
407 messages for -nostdlib and --rosegment.
408
409 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
410
411 PR ld/15365
412 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
413
414 2013-05-03 Alan Modra <amodra@gmail.com>
415
416 * merge.cc (Output_merge_string::do_add_input_section): Correct
417 scan for number of strings. Rename vars to avoid shadowing.
418 Include missing terminator in input_size_.
419
420 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
421
422 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
423 Restore empty string handling.
424
425 2013-05-01 Cary Coutant <ccoutant@google.com>
426
427 * stringpool.cc (Stringpool_template::new_key_offset): Fix
428 uninitialized warning.
429
430 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
431
432 * output.cc (Output_section::add_merge_input_section): Allow
433 to merge sections if the alignment is more than character size.
434 * merge.h (Output_merge_string::Output_merge_string): Remove
435 assert.
436 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
437 only not-null strings. Check the alignment of strings.
438 * stringpool.h
439 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
440 alignment as the argument.
441 (Stringpool_template<Stringpool_char>::addralign_): New class member.
442 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
443 Align non-zero length strings according to the addralign_.
444 (Stringpool_template<Stringpool_char>::set_string_offsets):
445 Updating offsets according to the given alignment.
446 * testsuite/Makefile.am (text_section_grouping): Test if string
447 literals are getting merged.
448 * testsuite/Makefile.in: Regenerate.
449 * testsuite/merge_string_literals_1.c: New file.
450 * testsuite/merge_string_literals_2.c: Ditto.
451 * testsuite/merge_string_literals.sh: Ditto.
452
453 2013-04-26 Ian Lance Taylor <iant@google.com>
454
455 * target-reloc.h (relocate_section): If the reloc offset is out of
456 range, pass VIEW as NULL to relocate.relocate.
457 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
458 * i386.cc (Target_i386::Relocate::relocate): Likewise.
459 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
460 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
461 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
462 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
463
464 2013-04-26 Geoff Pike <gpike@chromium.org>
465
466 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
467 * layout.cc (Hash_task): New class.
468 (Layout::queue_build_id_tasks): New function.
469 (Layout::write_build_id): Handle single-thread portion of build ID
470 computation. (In some cases, all of it is single-threaded.) Replace
471 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
472 functionality in fewer lines of code.
473 * layout.h (Layout::queue_build_id_tasks): New function declaration.
474 * options.h (General_options): make "--build-id" default to tree
475 rather than sha1. Add two new options related to --build-id=tree:
476 --build-id-chunk-size-for-treehash and
477 --build-id-min-file-size-for-treehash.
478 * Makefile.am: add testing of --build-id=tree and related new options
479 (these tests will be invoked by "make check").
480 * Makefile.in: Regenerate.
481
482 2013-04-25 Alan Modra <amodra@gmail.com>
483
484 * configure.tgt: Add powerpcle and powerpc64le.
485
486 2013-04-22 Alan Modra <amodra@gmail.com>
487
488 PR gold/15355
489 * layout.cc (Layout::segment_precedes): Allow more than one
490 segment with the same type and flags.
491
492 2013-04-15 Cary Coutant <ccoutant@google.com>
493
494 * layout.cc (Layout::set_relocatable_section_offsets): Don't
495 allocate space in file for BSS sections.
496
497 2013-04-15 Cary Coutant <ccoutant@google.com>
498
499 * script-sections.cc (Orphan_output_section): Reset address
500 to zero after each orphaned section for relocatable links.
501
502 2013-04-15 Cary Coutant <ccoutant@google.com>
503
504 * symtab.cc (Symbol_table::sized_write_globals): Subtract
505 section starting address for relocatable link.
506 * testsuite/Makefile.am (script_test_11): New test.
507 * testsuite/Makefile.in: Regenerate.
508 * testsuite/script_test_11.c: New source file.
509 * testsuite/script_test_11.t: New linker script.
510
511 2013-04-13 Alan Modra <amodra@gmail.com>
512
513 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
514 owner when sections are not adjacent and exceed group size.
515 (Target_powerpc::group_sections): Handle corner case.
516 (Target_powerpc::Branch_info::make_stub): Handle case where
517 stub table doesn't exist due to branches in non-exec sections.
518 (Target_powerpc::Relocate::relocate): Likewise.
519
520 2013-04-11 Alan Modra <amodra@gmail.com>
521
522 PR gold/15354
523 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
524 .branch_lt to match bfd ld. Adjust comments throughout file.
525
526 2013-04-04 Ian Lance Taylor <iant@google.com>
527
528 GCC PR c++/56840
529 * object.cc (do_layout_deferred_sections): Handle .eh_frame
530 sections before checking whether they are included in the link.
531
532 2013-03-29 Sriraman Tallam <tmsriram@google.com>
533
534 * archive.cc (Archive::get_elf_object_for_member): Create the elf
535 object before calling the plugin claim_file handler. Pass the elf
536 object of the archive to the plugin. Delete the elf object if the
537 plugin claims the file.
538
539 2013-03-21 Alan Modra <amodra@gmail.com>
540
541 * layout.cc (Layout::set_segment_offsets): Accept writable .text
542 segment when omagic.
543
544 2013-03-21 Alan Modra <amodra@gmail.com>
545
546 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
547 comparison warning.
548 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
549 uninitialized" warning.
550
551 2013-03-20 Alan Modra <amodra@gmail.com>
552
553 * symtab.h (Symbol::clear_version): New function.
554 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
555 is_needed by weak references. Clear version for symbols defined
556 in as-needed objects that are not needed.
557
558 2013-03-15 Alan Modra <amodra@gmail.com>
559
560 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
561 static and public. Add report_err param. Return false for data refs.
562 (Target_powerpc::rela_dyn_section): New overloaded function.
563 (Target_powerpc::plt_, iplt_): Elucidate.
564 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
565 (Output_data_plt_powerpc::do_write): Don't write .iplt.
566 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
567 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
568 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
569 push_branch and make_plt_entry for ifunc syms when
570 reloc_needs_plt_for_ifunc.
571 (Target_powerpc::Relocate::relocate): Don't use plt entry value
572 for ifunc unless reloc_needs_plt_for_ifunc.
573
574 2013-03-15 Alan Modra <amodra@gmail.com>
575
576 * gc.h (gc_process_relocs): Don't look through function descriptors.
577 * icf.cc (get_section_contents): Do so here instead.
578
579 2013-03-13 Alan Modra <amodra@gmail.com>
580
581 * powerpc.cc (is_branch_reloc): Forward declare.
582 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
583 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
584 false for 64-bit, true for 32-bit non-branch relocs.
585 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
586 * testsuite/Makefile.am (icf_test): Use linker map file instead of
587 nm output.
588 (icf_safe_test): Generate linker map file as well as nm output.
589 (icf_safe_so_test): Likewise.
590 * testsuite/Makefile.in: Regenerate.
591 * testsuite/icf_test.sh: Parse linker map file to determine
592 section folding.
593 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
594 * testsuite/icf_safe_so_test.sh: Likewise.
595 (X86_32_or_ARM_specific_safe_fold): Merge into..
596 (arch_specific_safe_fold): ..this.
597 (X86_64_specific_safe_fold): Delete unused function.
598
599 2013-03-12 Alan Modra <amodra@gmail.com>
600
601 * gc.h (gc_process_relocs): Look through function descriptors
602 to determine shndx, symvalue and addend used by ICF. Tidy
603 variable duplication.
604
605 2013-03-11 Alan Modra <amodra@gmail.com>
606
607 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
608 * layout.cc (Layout_task_runner::run): ..to here.
609 * symtab.h (struct Symbol_location): Extract from..
610 (class Symbol_table): ..here.
611 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
612 * target.h (class Target): Add function_location and
613 do_function_location functions.
614 (class Sized_target): Add do_function_location.
615 * object.h (class Sized_relobj_file): Move find_shdr..
616 (class Object): ..to here.
617 * object.cc: Likewise. Update to suit. Instantiate.
618 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
619 * powerpc.cc (class Powerpc_dynobj): New.
620 (Target_powerpc::do_function_location): New function.
621 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
622 (Powerpc_dynobj::do_read_symbols): New function.
623 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
624
625 2013-03-08 Ian Lance Taylor <iant@google.com>
626
627 * options.cc (General_options::string_to_object_format): Accept
628 "default".
629
630 2013-03-08 Alan Modra <amodra@gmail.com>
631
632 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
633 pointer to Post_fde.
634 (struct Post_fde): Move definition to here..
635 * ehframe.cc (struct Post_fde): ..from here.
636 (Cie::write): Don't alloc Post_fde.
637 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
638
639 2013-03-07 Alan Modra <amodra@gmail.com>
640
641 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
642 relocation referencing .LC0.
643 * testsuite/discard_locals_test.sh: Remove FIXMEs.
644
645 2013-03-07 Alan Modra <amodra@gmail.com>
646
647 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
648 always_inline. Add assembly for powerpc to avoid GOT.
649
650 2013-03-07 Alan Modra <amodra@gmail.com>
651
652 * testsuite/script_test_10.sh: Don't test .bss section
653 header number.
654
655 2013-03-06 Alan Modra <amodra@gmail.com>
656
657 * powerpc.cc (class Powerpc_relobj): Move some member functions.
658 (Target_powerpc::symval_for_branch): Add symtab param. Update
659 all callers. Handle folded sections.
660 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
661 to Powerpc_relobj.
662 (Global_symbol_visitor_opd::operator()): Likewise.
663
664 2013-03-04 Alan Modra <amodra@gmail.com>
665
666 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
667 * testsuite/Makefile.in: Regenerate.
668
669 2013-03-01 Cary Coutant <ccoutant@google.com>
670
671 Add dwp support for v2 DWARF package file format.
672 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
673 tu_length parameter. Adjust all callers.
674 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
675 * dwp.cc: Include dwarf.h.
676 (Section_bounds): New struct type.
677 (Unit_set): New struct type.
678 (Dwo_file::Dwo_file): Initialize new data member.
679 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
680 Combine and rename to...
681 (Dwo_file::read_unit_index): ...this.
682 (Dwo_file::sized_read_compunit_index)
683 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
684 (Dwo_file::sized_read_unit_index): ...this.
685 (Dwo_file::copy_section): Remove section_name, is_str_offsets
686 parameters; add section_id parameter.
687 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
688 (Dwo_file::add_unit_set): ...this.
689 (Dwo_file::shndx_map_): Remove.
690 (Dwo_file::sect_offsets_): New data member.
691 (Dwp_output_file::Dwp_output_file): Initialize new data members.
692 (Dwp_output_file::add_section): Rename to...
693 (Dwp_output_file::add_contribution): ...this.
694 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
695 (Dwp_output_file::add_tu_set): Likewise.
696 (Dwp_output_file::Contribution): New type.
697 (Dwp_output_file::Section::contributions): New data member.
698 (Dwp_output_file::Cu_or_tu_set): Remove.
699 (Dwp_output_file::Section::Section): New ctor.
700 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
701 (Dwp_output_file::Dwp_index::Section_table): New type.
702 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
703 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
704 parameter.
705 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
706 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
707 (Dwp_output_file::Dwp_index::section_table): New member function.
708 (Dwp_output_file::Dwp_index::section_table_end): New member function.
709 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
710 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
711 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
712 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
713 (Dwp_output_file::Dwp_index::section_table_): New data member.
714 (Dwp_output_file::Dwp_index::section_mask_): New data member.
715 (Dwp_output_file::add_output_section): New member function.
716 (Dwp_output_file::write_new_section): New member function.
717 (Dwp_output_file::write_contributions): New member function.
718 (Dwp_output_file::section_id_map_): New data member.
719 (class Dwo_id_info_reader): Remove.
720 (class Unit_reader): New class.
721 (get_dwarf_section_name): New function.
722 (Dwo_file::read_executable): Adjust initializations of class data.
723 (Dwo_file::read): Add support for v2 package file format.
724 (Dwo_file::read_unit_index): Likewise.
725 (Dwo_file::sized_read_unit_index): Likewise.
726 (Dwo_file::copy_section): Likewise.
727 (Dwo_file::add_unit_set): Likewise.
728 (Dwp_output_file::add_output_section): Likewise.
729 (Dwp_output_file::add_contribution): Likewise.
730 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
731 for empty slot.
732 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
733 file format.
734 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
735 slot.
736 (Dwp_output_file::initialize): Remove unused function.
737 (Dwp_output_file::finalize): Add support for v2 package file format.
738 (Dwp_output_file::write_index): Likewise.
739 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
740 function prototype.
741
742 2013-03-01 Cary Coutant <ccoutant@google.com>
743
744 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
745 function into class definition in header file.
746 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
747 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
748 New function.
749 (Dwarf_info_reader::check_buffer): Move here from .cc file.
750
751 2013-02-28 Alan Modra <amodra@gmail.com>
752
753 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
754 * target.cc (Target::do_plt_fde_location): New function.
755 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
756 accessor function, and constructor param.
757 (struct Post_fde, Post_fdes): Declare.
758 (Cie::write): Add post_fdes param.
759 * ehframe.cc (Fde::write): Use plt_fde_location.
760 (struct Post_fde): Define.
761 (Cie::write): Stash FDEs added post merge mapping.
762 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
763 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
764 (Eh_frame::do_sized_write): Arrange to write post map FDES after
765 other FDEs.
766 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
767 (Target_powerpc::has_glink): New function.
768 (Target_powerpc::do_relax): Add eh_frame info for stubs.
769 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
770 glink_eh_frame_fde_32, default_fde): New data.
771 (Stub_table::eh_frame_added_): New var.
772 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
773 Make const.
774 (Stub_table::add_eh_frame): New function.
775 (Output_data_glink::add_eh_frame): New function.
776 (Target_powerpc::make_glink_section): Call add_eh_frame.
777
778 2013-02-15 Ian Lance Taylor <iant@google.com>
779
780 * options.h (DEFINE_uint64_alias): Define.
781 (class General_options): Add -Ttext-segment as an alias for
782 -Ttext.
783
784 2013-02-15 Alan Modra <amodra@gmail.com>
785
786 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
787 (Stub_table::do_write): ..here, two places.
788 (Stub_table::plt_call_size): Use it here too.
789
790 2013-02-11 Ian Lance Taylor <iant@google.com>
791
792 * descriptors.cc (Descriptors::close_all): New function.
793 * descriptors.h (class Descriptors): Declare close_all.
794 (close_all_descriptors): New inline function.
795 * plugin.cc: Include "descriptors.h".
796 (Plugin_manager::cleanup): Call close_all_descriptors.
797
798 2013-02-06 Alan Modra <amodra@gmail.com>
799
800 * README: Update coding style link.
801
802 2013-01-28 Cary Coutant <ccoutant@google.com>
803
804 * dwp.cc (File_list): New typedef.
805 (Dwo_name_info_reader): New class.
806 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
807 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
808 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
809 (Dwo_file::read_executable): New function.
810 (Dwo_file::read): Move common setup code to ...
811 (Dwo_file::make_object): ... here.
812 (dwp_options): Add --exec/-e.
813 (usage): Likewise.
814 (main): Likewise.
815
816 2013-01-24 Sriraman Tallam <tmsriram@google.com>
817
818 * layout.cc (Layout::layout): Check for option text_reorder.
819 (Layout::make_output_section): Ditto.
820 * options.h (text_reorder): New option.
821 * output.cc (Input_section_sort_compare): Remove special ordering
822 of section names.
823 (Output_section::
824 Input_section_sort_section_name_special_ordering_compare::
825 operator()): New function.
826 (Output_section::sort_attached_input_sections): Use new sort function
827 for .text.
828 * output.h (Input_section_sort_section_name_special_ordering_compare):
829 New struct.
830 * testsuite/Makefile.am (text_section_grouping): Test option
831 --no-text-reorder
832 * testsuite/Makefile.in: Regenerate.
833 * testsuite/text_section_grouping.sh: Check order of functions without
834 default text reordering.
835
836 2013-01-18 Mike Frysinger <vapier@gentoo.org>
837
838 * options.h (General_options): Change default to true for new_dtags.
839
840 2013-01-18 Mike Frysinger <vapier@gentoo.org>
841
842 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
843 when enable_new_dtags is false. Only add DT_RUNPATH when
844 enable_new_dtags is true.
845
846 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
847
848 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
849 used in declaration and definition consistent.
850 (Target_powerpc::symval_for_branch): Ditto.
851
852 2013-01-16 Sriraman Tallam <tmsriram@google.com>
853
854 * testsuite/plugin_final_layout.cc: Fix comment.
855
856 2013-01-16 Sriraman Tallam <tmsriram@google.com>
857
858 * layout.cc (Layout::layout): Do not do default sorting for
859 text sections when section ordering is specified.
860 (make_output_section): Ditto.
861 * testsuite/plugin_final_layout.cc: Name the function sections
862 to catch reordering issues.
863
864 2013-01-15 Alan Modra <amodra@gmail.com>
865
866 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
867 plt-thread-safe.
868
869 2013-01-15 Alan Modra <amodra@gmail.com>
870
871 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
872 * testsuite/Makefile.in: Regenerate.
873
874 2013-01-14 Alan Modra <amodra@gmail.com>
875
876 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
877 * testsuite/Makefile.in: Regenerate.
878
879 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
880
881 PR bfd/14430
882 Fix mingw gold build with plugins enabled
883 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
884 * configure.ac: Export DLOPEN_LIBS and add headers check.
885 * plugin.cc: Handle non-dlfcn case.
886 * Makefile.in: Regenerate.
887 * config.in: Regenerate.
888 * configure: Regenerate.
889 * testsuite/Makefile.in: Regenerate.
890
891 2013-01-09 Sriraman Tallam <tmsriram@google.com>
892
893 * output.h (sort_attached_input_sections): Change to be public.
894 * script-sections.cc
895 (Output_section_definition::set_section_addresses): Sort
896 attached input sections according to section order before linker
897 script assigns section addresses.
898 (Orphan_output_section::set_section_addresses): Sort
899 attached input sections according to section order before linker
900 script assigns section addresses.
901 * Makefile.am (final_layout.sh): Use a simple linker script to
902 check if section ordering still works.
903 * Makefile.in: Regenerate.
904
905 2013-01-09 Ben Cheng <bccheng@google.com>
906
907 * arm.cc (Target_arm::attributes_accept_div): New function.
908 (Target_arm::attributes_forbid_div): New function.
909 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
910 attribute using the same new functions as what bfd/elf32_arm.c
911 does.
912
913 2013-01-07 Cary Coutant <ccoutant@google.com>
914
915 PR gold/14993
916 * output.cc (Output_section::add_input_section): For incremental
917 updates, don't track input sections that are allocated from patch
918 space.
919
920 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
921 Ian Lance Taylor <iant@google.com>
922
923 PR gold/14897
924 * configure.ac (--enable-ld): Removed.
925 (install_as_default): Set to yes only for --enable-gold=default
926 or --disable-ld.
927 * configure: Regenerated.
928
929 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
930
931 * options.h (General_options): Add -fuse-ld= for GCC linker
932 option compatibility.
933
934 2013-01-04 Cary Coutant <ccoutant@google.com>
935
936 * configure.ac: Fix typo restoring CXXFLAGS.
937 * configure: Regenerate.
938
939 2013-01-04 Cary Coutant <ccoutant@google.com>
940
941 * testsuite/Makefile.am (CXXLINK_S): New macro.
942 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
943 * testsuite/Makefile.in: Regenerate.
944
945 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
946
947 * version.cc (print_version): Update copyright year to 2013.
948
949 2012-12-20 Ian Lance Taylor <iant@google.com>
950
951 * layout.cc (Layout::special_ordering_of_input_section): New
952 function.
953 (Layout::layout): If input section requires special ordering, must
954 sort input sections.
955 (Layout::make_output_section): May sort .text input sections.
956 (Layout::is_section_name_prefix_grouped): Remove.
957 * layout.h (class Layout): Declare
958 special_ordering_of_input_section. Don't declare
959 is_section_name_prefix_grouped.
960 * output.cc (Output_section::add_input_section): Revert last
961 change.
962 (Output_section::Input_section_sort::match_file_name): Don't crash
963 if called on output section data.
964 (Output_section::Input_section_sort_compare): Sort based on
965 special ordering.
966 (Output_section::Input_section_sort_section_order_index_compare):
967 Revert last patch.
968 (Output_section::sort_attached_input_sections): Likewise.
969
970 2012-12-18 Sriraman Tallam <tmsriram@google.com>
971
972 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
973 * layout.h (Layout::is_section_name_prefix_grouped): New function.
974 * output.cc (Output_section::add_input_section): Check if section
975 name contains special prefix. Keep input sections to sort such
976 sections.
977 (Output_section::Input_section_sort_section_order_index_compare
978 ::operator()): Group sections according to prefixes.
979 (Output_section::sort_attached_input_sections): Add condition to
980 Input_section_entry constructor call.
981 * testsuite/Makefile.am (text_section_grouping): New test.
982 * testsuite/Makefile.in: Regenerate.
983 * testsuite/text_section_grouping.cc: New file.
984 * testsuite/text_section_grouping.sh: New file.
985
986 2012-12-17 Nick Clifton <nickc@redhat.com>
987
988 * Makefile.am: Add copyright notice.
989 * NEWS: Likewise.
990 * README: Likewise.
991 * configure.ac: Likewise.
992 * ftruncate.c: Likewise.
993 * Makefile.in: Regenerate.
994
995 2012-12-14 Cary Coutant <ccoutant@google.com>
996
997 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
998 --no-as-needed flag.
999 (exception_separate_shared_12_test): Likewise.
1000 (incremental_copy_test): Likewise.
1001 * testsuite/Makefile.in: Regenerate.
1002
1003 2012-12-14 Cary Coutant <ccoutant@google.com>
1004
1005 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1006 (Dwp_output_file::Dwp_index::enter_set): Add assert.
1007
1008 2012-12-12 Alan Modra <amodra@gmail.com>
1009
1010 * powerpc.cc (class Track_tls): New.
1011 (class Relocate, class Scan): Inherit Track_tls.
1012 (Target_powerpc::Scan::local, global): Track tls optimization
1013 and avoid creating plt entry for __tls_get_addr if all uses
1014 are optimized away.
1015 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1016
1017 2012-12-12 Alan Modra <amodra@gmail.com>
1018
1019 * options.h (General_options): Add --toc-sort/--no-toc-sort.
1020 Replace no_toc_optimize with toc_optimize.
1021 * output.h (Output_section::input_sections): Provide non-const variant.
1022 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1023 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1024 accessors.
1025 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1026 (class Sort_toc_sections): New.
1027 (Target_powerpc::do_finalize_sections): Sort toc sections.
1028 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1029
1030 2012-12-10 Roland McGrath <mcgrathr@google.com>
1031
1032 * testsuite/binary_unittest.cc (read_all): New function.
1033 (Sized_binary_test): Use it instead of ::read.
1034 * fileread.cc (do_read): Don't assume pread always reads the whole
1035 amount in a single call.
1036
1037 2012-12-10 Alan Modra <amodra@gmail.com>
1038
1039 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1040 Set EM_PPC64 or EM_PPC here.
1041 (Target_selector_powerpc::do_recognize): Delete.
1042
1043 2012-12-10 Alan Modra <amodra@gmail.com>
1044
1045 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1046 stub_table_.
1047 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1048
1049 2012-12-07 Roland McGrath <mcgrathr@google.com>
1050
1051 * testsuite/binary_unittest.cc (Sized_binary_test):
1052 Use open_descriptor rather than ::open.
1053
1054 2012-12-07 Alan Modra <amodra@gmail.com>
1055
1056 * powerpc.cc (Stub_table::do_write): Delete redundant Address
1057 typedef and invalid_address constant.
1058 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1059 instantiate constants.
1060
1061 2012-12-06 Roland McGrath <mcgrathr@google.com>
1062
1063 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1064 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1065 * aclocal.m4: Regenerate.
1066 * configure: Regenerate.
1067 * Makefile.in: Regenerate.
1068 * testsuite/Makefile.in: Regenerate.
1069
1070 2012-12-07 Alan Modra <amodra@gmail.com>
1071
1072 * options.h (General_options): Add no_toc_optimize.
1073 * powerpc.cc (ok_lo_toc_insn): New function.
1074 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1075
1076 2012-12-06 Alan Modra <amodra@gmail.com>
1077
1078 * options.h (General_options): Add plt_align, plt_static_chain,
1079 plt_thread_safe. Update stub_group_size help text.
1080 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1081 for new plt_thread_safe_ var.
1082 (use_plt_offset): Correct comments.
1083 (Target_powerpc::do_relax): Look for thread creation symbols to
1084 determine default plt_thread_safe value. Clear plt call stubs
1085 as well as branch stubs each iteration.
1086 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1087 insn constants.
1088 (l, hi, ha, write_insn): Move earlier.
1089 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1090 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1091 plt stubs too.
1092 (Stub_table::update_size): Adjust.
1093 (Stub_table::prev_size, set_prev_size): Delete.
1094 (Stub_table::stub_align): Let --plt-align affect result.
1095 (Stub_table::plt_call_size): Calculate sizes for various stubs.
1096 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1097 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1098 (Stub_table::do_write): Support more stub variants.
1099
1100 2012-12-04 Alan Modra <amodra@gmail.com>
1101
1102 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1103 (Target_powerpc::do_define_standard_symbols): New function.
1104
1105 2012-12-03 Alan Modra <amodra@gmail.com>
1106
1107 * output.h: Formatting, whitespace.
1108
1109 2012-12-03 Alan Modra <amodra@gmail.com>
1110
1111 * layout.h (Layout::get_executable_sections): Declare.
1112 * layout.cc (Layout::get_executable_sections): New function.
1113 * arm.cc (Target_arm::group_sections): Use it.
1114 (Arm_output_section::group_sections): Delete now redundant test.
1115 * output.cc (Output_reloc::Output_reloc): Add is_relative.
1116 param to handle relative relocs.
1117 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1118 (Output_data_reloc::add_absolute): Adjust.
1119 (Output_data_reloc::add_relative): New function.
1120 (Output_data::reset_data_size): New function.
1121 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1122 (Output_section::set_addralign): New function.
1123 (Output_section::checkpoint_set_addralign): New function.
1124 (Output_section::clear_section_offsets_need_adjustment): New function.
1125 (Output_section::input_sections): Make public.
1126 * powerpc.cc (class Output_data_brlt_powerpc): New.
1127 (class Stub_table, class Stub_control): New.
1128 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1129 stub_table_, set_stub_table, stub_table): New vectors and accessor
1130 functions.
1131 (Target_powerpc::do_may_relax, do_relax, push_branch,
1132 new_stub_table, stub_tables, brlt_section, group_sections,
1133 add_branch_lookup_table, find_branch_lookup_table,
1134 write_branch_lookup_table, make_brlt_section): New functions.
1135 (Target_powerpc::struct Sort_sections, class Branch_info): New.
1136 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1137 branch_info_): New vars.
1138 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1139 make call stubs here.
1140 (Output_data_glink): Remove all call stub handling from this class.
1141 (Target_powerpc::Scan::local, global): Save interesting branch
1142 relocs and relocs for ifunc. Adjust calls to plt entry functions.
1143 (Target_powerpc::do_finalize_sections): Only make reg save/restore
1144 functions on final link.
1145 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1146 Handle long branch destinations too.
1147 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1148 do_plt_address_for_local): Adjust lookup of plt call stubs.
1149
1150 2012-11-30 Alan Modra <amodra@gmail.com>
1151
1152 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1153 relocs against protected symbols when building 32-bit shared libs.
1154
1155 2012-11-30 Alan Modra <amodra@gmail.com>
1156
1157 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1158 param. Call got_section() to make .got. Update all callers
1159 and their callers and so on.
1160
1161 2012-11-30 Alan Modra <amodra@gmail.com>
1162
1163 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1164 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1165 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1166 value if it already exists.
1167
1168 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
1169
1170 PR gold/14858
1171 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1172
1173 2012-11-14 Roland McGrath <mcgrathr@google.com>
1174
1175 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1176 than bfc instruction for data sandboxing.
1177
1178 2012-11-08 Alan Modra <amodra@gmail.com>
1179
1180 * po/POTFILES.in: Regenerate.
1181
1182 2012-11-05 Alan Modra <amodra@gmail.com>
1183
1184 * configure.ac: Apply 2012-09-10 change to config.in here.
1185 * configure: Regenerate.
1186
1187 2012-11-05 Alan Modra <amodra@gmail.com>
1188
1189 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1190 (struct Opd_ent): Use "Address" rather than "Offset".
1191 (Output_data_got_powerpc::got_base_offset): Return Valtype.
1192 (Target_powerpc::got_section): Make public.
1193 (Target_powerpc::scan_relocs): Move code setting symbols..
1194 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1195 Create _SDA_BASE_ only when referenced.
1196
1197 2012-11-02 Roland McGrath <mcgrathr@google.com>
1198
1199 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1200 from last change.
1201
1202 2012-11-01 Roland McGrath <mcgrathr@google.com>
1203
1204 * target.h (Sized_target::relocate_relocs): Use Elf_Off
1205 for offset_in_output_section parameter.
1206 (Sized_target::relocate_special_relocatable): Likewise.
1207 * arm.cc (Target_arm::relocate_relocs): Likewise.
1208 (Target_arm::relocate_special_relocatable): Likewise.
1209 * i386.cc (Target_i386::relocate_relocs): Likewise.
1210 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1211 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1212 * target-reloc.h (relocate_relocs): Likewise.
1213 * testsuite/testfile.cc (Target_test): Likewise.
1214 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1215 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1216
1217 * system.h: Move inclusion of <clocale> to after <libintl.h> in
1218 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1219
1220 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1221 parameter, which is unused in the [!F_SETFD] case.
1222
1223 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1224 SYMNDX to off_t before comparing it to this->data_size().
1225 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1226 * incremental.cc (Output_section_incremental_inputs::do_write):
1227 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1228
1229 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1230
1231 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
1232
1233 * gold.cc (Target_arm::do_adjust_elf_header): Add the
1234 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1235 in EABI_VER5.
1236
1237 2012-10-29 Cary Coutant <ccoutant@google.com>
1238
1239 * dwp.cc (usage): Add file and exit status parameters;
1240 add --help and --version options.
1241 (print_version): New function.
1242 (main): Add --help and --version options.
1243
1244 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1245
1246 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1247 final_layout_sequence.txt.
1248 * testsuite/Makefile.in: Regenerated.
1249
1250 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1251
1252 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1253 COMPILE generated by automake.
1254 (LINK1): Likewise.
1255 (CXXCOMPILE1): Likewise.
1256 (CXXLINK1): Likewise.
1257 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1258 (LINK): Likewise.
1259 (CXXCOMPILE): Likewise.
1260 (CXXLINK): Likewise.
1261 * testsuite/Makefile.in: Regenerated.
1262
1263 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1264
1265 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1266 on bad fwrite return.
1267
1268 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1269
1270 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1271 on val.
1272
1273 2012-10-23 Cary Coutant <ccoutant@google.com>
1274
1275 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1276 * testsuite/Makefile.in: Regenerate.
1277 * testsuite/dwp_test.h: New source file.
1278 * testsuite/dwp_test_1.cc: New source file.
1279 * testsuite/dwp_test_1.s: New source file.
1280 * testsuite/dwp_test_1.sh: New source file.
1281 * testsuite/dwp_test_1b.cc: New source file.
1282 * testsuite/dwp_test_1b.s: New source file.
1283 * testsuite/dwp_test_2.cc: New source file.
1284 * testsuite/dwp_test_2.s: New source file.
1285 * testsuite/dwp_test_2.sh: New source file.
1286 * testsuite/dwp_test_main.cc: New source file.
1287 * testsuite/dwp_test_main.s: New source file.
1288
1289 2012-10-23 Cary Coutant <ccoutant@google.com>
1290
1291 * dwp.h: New header file.
1292 * dwp.cc: New source file.
1293 * gold.h: Move shared declarations to system.h.
1294 * system.h: New header file.
1295 * Makefile.am: Add dwp.
1296 * Makefile.in: Regenerate.
1297
1298 2012-10-23 Cary Coutant <ccoutant@google.com>
1299
1300 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1301 Dwarf_info_reader::read_from_pointer.
1302 (Dwarf_pubnames_table::read_header): Likewise.
1303 (Dwarf_pubnames_table::next_name): Likewise.
1304 (Dwarf_die::read_attributes): Likewise.
1305 (Dwarf_die::skip_attributes): Likewise.
1306 (Dwarf_info_reader::read_from_pointer): New function template.
1307 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1308 (Dwarf_pubnames_table): Likewise.
1309 (Dwarf_info_reader::read_from_pointer): New function template.
1310 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1311 Dwarf_pubnames_table ctor.
1312
1313 2012-10-23 Cary Coutant <ccoutant@google.com>
1314
1315 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1316 abbrev_shndx.
1317 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1318 abbrev_shndx_.
1319 (Dwarf_info_reader::set_abbrev_shndx): New method.
1320 (Dwarf_info_reader::abbrev_shndx_): New data member.
1321
1322 2012-10-23 Cary Coutant <ccoutant@google.com>
1323
1324 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1325 from object, not parameters.
1326 (Dwarf_info_reader::parse): Likewise.
1327 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1328 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1329 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1330 methods.
1331
1332 2012-10-23 Cary Coutant <ccoutant@google.com>
1333
1334 * fileread.cc (Input_file::Input_file): New constructor.
1335 * fileread.h (class Input_file): Add new constructor.
1336
1337 2012-10-18 Alan Modra <amodra@gmail.com>
1338
1339 PR gold/14727
1340 * object.cc (Relobj::is_section_name_included): Also match
1341 .sdata personality section.
1342
1343 2012-10-18 Alan Modra <amodra@gmail.com>
1344
1345 * target-reloc.h (class Default_comdat_behavior): New, package up..
1346 (get_comdat_behaviour): ..this.
1347 (relocate_section): Add Relocate_comdat_behavior template arg,
1348 adjust code to suit.
1349 * arm.cc (Target_arm::relocate_section): Adjust to suit.
1350 (Target_arm::scan_reloc_section): Likewise.
1351 * i386.cc (Target_i386::relocate_section): Likewise.
1352 * sparc.cc (Target_sparc::relocate_section): Likewise.
1353 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1354 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1355 * powerpc.cc (class Relocate_comdat_behavior): New.
1356 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
1357 gold::relocate_section with new template arg.
1358
1359 2012-10-18 Alan Modra <amodra@gmail.com>
1360
1361 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1362 dynamic relocs for GOT_TPREL got entries, without symbol if
1363 resolving locally.
1364 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1365 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1366 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1367
1368 2012-10-17 Alan Modra <amodra@gmail.com>
1369
1370 PR gold/14726
1371 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1372
1373 2012-10-16 Sriraman Tallam <tmsriram@google.com>
1374
1375 * layout.cc (Layout::include_section): Keep sections marked
1376 SHF_EXCLUDE when doing relocatable links.
1377
1378 2012-10-16 Alan Modra <amodra@gmail.com>
1379
1380 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1381 (Target_powerpc::do_finalize_sections): Call it.
1382 (Output_data_save_res): New class and supporting functions.
1383 (Target_powerpc::symval_for_branch): Only look up .opd entry for
1384 normal symbols defined in object files.
1385
1386 2012-10-12 Alan Modra <amodra@gmail.com>
1387
1388 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1389 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
1390 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1391 section if scan_opd_relocs not yet called.
1392 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1393
1394 2012-10-12 Alan Modra <amodra@gmail.com>
1395
1396 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1397 add_local_ifunc_entry): Revert last change.
1398 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1399
1400 2012-10-05 Alan Modra <amodra@gmail.com>
1401
1402 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1403 do_plt_address_for_global): New functions.
1404 (Output_data_got_powerpc::do_write): Don't segfault when linking
1405 statically.
1406 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1407 add_local_ifunc_entry): Return true on adding entry..
1408 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1409 glink->add_entry call. Remove unused symtab param. Adjust calls.
1410 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1411 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
1412 set up symbols here.
1413 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1414 syms here. Do so even when no .iplt. Don't segfault when linking
1415 statically.
1416 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
1417 new variants without reloc param.
1418 (Glink_sym_ent::Glink_sym_ent): Likewise.
1419 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1420 reloc when refs will resolve to plt call stub.
1421 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
1422 R_PPC_PLTREL24 to resolve locally.
1423 (Target_powerpc::Scan::global): Correct ifunc handling.
1424 (Target_powerpc::Relocate::relocate): Correct local sym glink
1425 lookup. Don't destroy "value" when we have a plt call stub,
1426 and when checking plt call validity.
1427 (Target_powerpc::do_dynsym_value): Simplify.
1428
1429 2012-10-05 Alan Modra <amodra@gmail.com>
1430
1431 * i386.cc (Output_data_plt_i386::address_for_global,
1432 address_for_local): Add plt offset to returned value. Adjust uses.
1433 * sparc.cc (Output_data_plt_sparc::address_for_global,
1434 address_for_local): Likewise.
1435 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1436 address_for_local): Likewise.
1437 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1438 address_for_local): Likewise.
1439 * target.h (Target::plt_address_for_global, plt_address_for_local):
1440 Update comment.
1441 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1442 (Output_data_got::Got_entry::write): Nor here.
1443 * output.h: Comment fix.
1444
1445 2012-10-02 Jiong Wang <jiwang@tilera.com>
1446
1447 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1448 global_offset_table_ value for larget got.
1449 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1450
1451 2012-09-29 Alan Modra <amodra@gmail.com>
1452
1453 * powerpc.cc (Target_powerpc::iplt_): New output section.
1454 (Target_powerpc::iplt_section, make_iplt_section,
1455 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1456 (Target_powerpc::make_plt_entry): Handle ifunc syms.
1457 Target_powerpc::plt_entry_count): Count iplt entries too.
1458 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1459 reloc section in constructor. New params.
1460 (Target_powerpc::make_plt_section): Create reloc section here instead.
1461 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1462 functions.
1463 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1464 (Output_data_glink::add_entry, find_entry): New functions to
1465 deal with local syms.
1466 (Glink_sym_ent): Add support for local syms.
1467 (Output_data_glink::do_write): Handle ifunc plt entries.
1468 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1469 (Target_powerpc::Scan::local, global): Handle ifunc syms.
1470 (Target_powerpc::Relocate::relocate): Likewise.
1471 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1472
1473 2012-09-25 Alan Modra <amodra@gmail.com>
1474
1475 * object.h (Sized_relobj_file::adjust_local_symbol,
1476 do_adjust_local_symbol): New functions.
1477 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1478 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1479 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1480 and irregular opd entry spacing.
1481 (Powerpc_relobj::do_read_relocs): Add opd size checks.
1482 (Global_symbol_visitor_opd): New functor.
1483 (Target_powerpc::do_finalize_sections): Omit global symbols defined
1484 on deleted opd entries.
1485
1486 2012-09-15 Jiong Wang <jiwang@tilera.com>
1487
1488 * tilegx.cc: New file.
1489 * Makefile.am (TARGETSOURCES): Add tilegx.cc
1490 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1491 * configure.tgt: Add entries for tilegx*.
1492 * configure.ac: Likewise.
1493 * Makefile.in: Rebuild.
1494 * configure: Likewise.
1495 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1496 tilegx.
1497
1498 2012-09-13 Alan Modra <amodra@gmail.com>
1499
1500 * target-reloc.h (scan_relocs): Call scan.local for relocs
1501 against symbols in discarded sections. Pass is_discarded
1502 param.
1503 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1504 Add is_discarded param.
1505 * powerpc (Target_powerpc::Scan::local): Likewise. Use
1506 is_discarded to flag opd entry as discarded. Don't emit dyn
1507 relocs on such entries.
1508 (Target_powerpc::Scan::global): Similarly detect and handle
1509 such opd entries.
1510 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1511 opd_ent_. Update all uses.
1512 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1513 (Target_powerpc::relocate_section): Zero out discarded opd
1514 entry relocs.
1515
1516 2012-09-12 Ian Lance Taylor <iant@google.com>
1517
1518 PR gold/14570
1519 * output.cc: Rename Output_data_got template parameter from size
1520 to got_size for all functions. Compile all variants of
1521 Output_data_got.
1522 (Output_data_got::Got_entry::write): Correct use of size for
1523 symbol value. Use local_is_tls rather than casting to
1524 Sized_relobj_file.
1525 * object.h (class Object): Add local_is_tls and do_local_is_tls.
1526 (class Sized_relobj_file): Add do_local_is_tls.
1527 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1528
1529 2012-09-11 Alan Modra <amodra@gmail.com>
1530
1531 PR gold/14566
1532 * layout.cc (Layout::set_segment_offsets): When using
1533 common-page-size alignment, ensure we are on a new max-page-size
1534 page.
1535 * output.cc (Output_segment::set_section_addresses): Use
1536 abi_pagesize, not common_pagesize for relro boundary.
1537 (Output_segment::set_offset): Likewise.
1538
1539 2012-09-11 Alan Modra <amodra@gmail.com>
1540
1541 * output.h (Output_data_got::add_global_tls, add_local_tls,
1542 add_local_tls_pair): New functions.
1543 (Output_data_got::add_local_pair_with_rel): Remove second
1544 reloc param. Expand comment.
1545 (Output_data_got::Got_entry): Rename use_plt_offset_ to
1546 use_plt_or_tls_offset_, similarly for constructor param.
1547 (Output_data_got::Got_entry::write): Add got_index param.
1548 * output.cc (Output_data_got::add_global_tls, add_local_tls,
1549 add_local_tls_pair): New functions.
1550 (Output_data_got::Got_entry::write): Handle tls symbols
1551 with use_plt_or_tls_offset_ set specially.
1552 (Output_data_got::add_local_pair_with_rel): Only one reloc.
1553 (Output_data_got::do_write): Replace iterator with index, pass
1554 index to entry write function.
1555 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1556 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1557 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1558 call.
1559 * i386.cc (Target_i386::Scan::local): Likewise.
1560 * sparc.cc (Target_sparc::Scan::local): Likewise.
1561 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1562 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1563 do_tls_offset_for_global): New functions.
1564 (Target_powerpc::Scan::local): Correct TLS relocations and got
1565 entry values.
1566 (Target_powerpc::Scan::global): Don't emit unnecessary
1567 dynamic relocations on TLS GOT entries.
1568
1569 2012-09-10 Matthias Klose <doko@ubuntu.com>
1570
1571 * config.in: Disable sanity check for kfreebsd.
1572
1573 2012-09-10 Sterling Augustine <saugustine@google.com>
1574
1575 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1576 (Gdb_index::pubtypes_read): New parameter.
1577 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1578 to calls.
1579 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1580 pubtypes_object_.
1581
1582 2012-09-09 Alan Modra <amodra@gmail.com>
1583
1584 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1585 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1586 * gc.h (gc_process_relocs): Call target gc_add_reference.
1587 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1588 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1589 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1590 unnecessary cast.
1591 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1592 to cater for when we don't need code offset. Update use.
1593 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1594 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1595 set_opd_valid): New functions.
1596 (Target_powerpc::do_gc_add_reference): New function.
1597 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1598 stashed refs.
1599 (Target_powerpc::do_gc_mark_symbol): New function.
1600
1601 2012-09-06 Cary Coutant <ccoutant@google.com>
1602
1603 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1604 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1605 (Dwarf_die::skip_attributes): Likewise.
1606 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1607 * testsuite/gdb_index_test.cc (inline_func_1): New function.
1608 (main): Call it.
1609 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1610
1611 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
1612
1613 * testsuite/script_test_3.t: Add .got.plt output section
1614 statement.
1615 * testsuite/script_test_4.t: Likewise.
1616
1617 2012-09-05 Alan Modra <amodra@gmail.com>
1618
1619 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1620 update all uses and lose "enum" when using type.
1621
1622 2012-09-05 Alan Modra <amodra@gmail.com>
1623
1624 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1625 * configure: Regenerate.
1626 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1627 (plugin_final_layout.stdout): Likewise.
1628 (memory_test): Set page sizes to 0x1000.
1629 * testsuite/Makefile.in: Regenerate.
1630 * testsuite/discard_locals_test.sh: Add FIXME comment.
1631 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1632 * testsuite/pr14265.t: Add .got output section statement.
1633 * testsuite/script_test_2.t: Likewise.
1634 * testsuite/script_test_3.t: Likewise.
1635 * testsuite/script_test_4.t: Likewise.
1636 * testsuite/script_test_5.t: Likewise.
1637 * testsuite/script_test_6.t: Likewise.
1638 * testsuite/script_test_7.t: Likewise.
1639 * testsuite/script_test_9.t: Likewise.
1640
1641 2012-09-05 Alan Modra <amodra@gmail.com>
1642
1643 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1644 (Powerpc_relocate_functions::Status): New typedef.
1645 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1646 (Target_powerpc::Scan::local): Handle REL64.
1647 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1648 for REL32 and REL64.
1649 (Target_powerpc::symval_for_branch): New function, extracted from..
1650 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
1651 checks. Report overflow errors.
1652
1653 2012-09-05 Alan Modra <amodra@gmail.com>
1654
1655 * object.h (Sized_relobj_file::emit_relocs): Delete.
1656 (Sized_relobj_file::emit_relocs_reltype): Delete.
1657 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1658 relocate_relocs for --emit-relocs.
1659 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1660 * output.h: Update comment.
1661 (Output_segment::first_section): New function.
1662 (Output_segment::first_section_load_address): Use first_section.
1663 * output.cc (Output_segment::first_section): New function extracted..
1664 (Output_segment::first_section_load_address): ..from here. Delete.
1665 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1666 * target.h (Sized_target::relocate_for_relocatable): Likewise.
1667 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1668 adjust call to target.h function.
1669 * i386.cc (Target_i386): Likewise.
1670 * sparc.cc (Target_sparc): Likewise.
1671 * x86_64.cc (Target_x86_64): Likewise.
1672 * powerpc.cc (Target_powerpc): Likewise.
1673 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
1674 first tls section has section symbol for optimised local dynamic
1675 output relocs.
1676 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1677 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1678 optimised tls code.
1679 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1680 Rename to relocate_relocs. Update error message.
1681
1682 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
1683
1684 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1685 --just-symbols.
1686
1687 2012-08-31 Alan Modra <amodra@gmail.com>
1688
1689 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1690 (Powerpc_relobj::toc_base_offset): New stub function.
1691 (Target_powerpc): Add tp_offset, dtp_offset. Rename
1692 got_mod_index_offset to tlsld_got_offset. Update all refs.
1693 (Target_powerpc::Relocate::enum skip_tls): New.
1694 (Target_powerpc::call_tls_get_addr_): New var.
1695 (Target_powerpc::is_branch_reloc): Move to file scope.
1696 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1697 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1698 New functions.
1699 (Target_powerpc::enum Got_type): Delete old values, add new ones.
1700 (powerpc_info): Correct common_pagesize for ppc64.
1701 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1702 (Powerpc_relocate_functions): Add overflow check enums and functions.
1703 Add non-shift version of rela, rela_ua. Delete all rel public
1704 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
1705 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1706 addr16_ha3, addr14 functions.
1707 (Output_data_got_powerpc::add_constant_pair): New function.
1708 (Output_data_got_powerpc::got_base_offset): Likewise.
1709 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1710 (instruction constants): Sort, add some more.
1711 (Output_data_glink::do_write): Add and use Address typedef. Use
1712 object->toc_base_offset() stub for 64-bit.
1713 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1714 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1715 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1716 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
1717 Always treat .opd relocs as against locally defined symbol.
1718 Correct condition for RELATIVE relocs.
1719 (Target_powerpc::do_finalize_sections): Test for NULL sections.
1720 (Target_powerpc::Relocate::relocate): Use plt call stub as value
1721 for 32-bit syms with a plt entry. Correct ppc64 toc base
1722 calculations. Handle TLS relocs, and more. Add overflow
1723 checking and adjust for Powerpc_relocate_functions changes.
1724 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1725 Reinstate --emit-relocs code with FIXME.
1726
1727 2012-08-30 Alan Modra <amodra@gmail.com>
1728
1729 * layout.cc (Layout::set_segment_offsets): Set p_align to
1730 abi_pagesize, not common_pagesize.
1731 (Layout::relaxation_loop_body): Similarly use abi_pagesize
1732 to determine whether file header can go in segment.
1733
1734 2012-08-30 Alan Modra <amodra@gmail.com>
1735
1736 * output.h (Output_reloc::Output_reloc <output section>): Add
1737 is_relative param. Adjust calls.
1738 (Output_reloc::add_output_section_relative): New functions.
1739 * output.cc (Output_reloc::Output_reloc <output section>): Handle
1740 is_relative.
1741 (Output_reloc::symbol_value): Handle SECTION_CODE.
1742
1743 2012-08-24 Sriraman Tallam <tmsriram@google.com>
1744
1745 * gold.cc (queue_middle_tasks): Call layout again when unique
1746 segments for sections is desired.
1747 * layout.cc (Layout::Layout): Initialize new members.
1748 (Layout::get_output_section_flags): New function.
1749 (Layout::choose_output_section): Call get_output_section_flags.
1750 (Layout::layout): Make output section for mapping to a unique segment.
1751 (Layout::insert_section_segment_map): New function.
1752 (Layout::attach_allocated_section_to_segment): Make unique segment for
1753 output sections marked so.
1754 (Layout::segment_precedes): Check for unique segments when sorting.
1755 * layout.h (Layout::Unique_segment_info): New struct.
1756 (Layout::Section_segment_map): New typedef.
1757 (Layout::insert_section_segment_map): New function.
1758 (Layout::get_output_section_flags): New function.
1759 (Layout::is_unique_segment_for_sections_specified): New function.
1760 (Layout::set_unique_segment_for_sections_specified): New function.
1761 (Layout::unique_segment_for_sections_specified_): New member.
1762 (Layout::section_segment_map_): New member.
1763 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1764 Rename is_gc_pass_one to is_pass_one.
1765 Rename is_gc_pass_two to is_pass_two.
1766 Rename is_gc_or_icf to is_two_pass.
1767 Check for which pass based on whether symbols data is present.
1768 Make it two pass when unique segments for sections is desired.
1769 * output.cc (Output_section::Output_section): Initialize new
1770 members.
1771 * output.h (Output_section::is_unique_segment): New function.
1772 (Output_section::set_is_unique_segment): New function.
1773 (Output_section::is_unique_segment_): New member.
1774 (Output_section::extra_segment_flags): New function.
1775 (Output_section::set_extra_segment_flags): New function.
1776 (Output_section::extra_segment_flags_): New member.
1777 (Output_section::segment_alignment): New function.
1778 (Output_section::set_segment_alignment): New function.
1779 (Output_section::segment_alignment_): New member.
1780 (Output_segment::Output_segment): Initialize is_unique_segment_.
1781 (Output_segment::is_unique_segment): New function.
1782 (Output_segment::set_is_unique_segment): New function.
1783 (Output_segment::is_unique_segment_): New member.
1784 * plugin.cc (allow_unique_segment_for_sections): New function.
1785 (unique_segment_for_sections): New function.
1786 (Plugin::load): Add new functions to transfer vector.
1787 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1788 * Makefile.in: Regenerate.
1789 * testsuite/plugin_final_layout.sh: Check if unique segment
1790 functionality works.
1791 * testsuite/plugin_section_order.c (onload): Check if new interfaces
1792 are available.
1793 (allow_unique_segment_for_sections): New global.
1794 (unique_segment_for_sections): New global.
1795 (claim_file_hook): Call allow_unique_segment_for_sections.
1796 (all_symbols_read_hook): Call unique_segment_for_sections.
1797
1798 2012-08-22 Cary Coutant <ccoutant@google.com>
1799
1800 * layout.cc (Layout::include_section): Don't assert on GROUP
1801 sections with --emit-relocs.
1802
1803 2012-08-21 Cary Coutant <ccoutant@google.com>
1804
1805 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1806 if --export-dynamic-symbol names an undef symbol.
1807
1808 2012-08-18 Alan Modra <amodra@gmail.com>
1809
1810 * powerpc.cc: Formatting and white space.
1811 (Powerpc_relobj): Rename got2_section_ to special_.
1812 Add opd_ent_shndx_ and opd_ent_off_ vectors.
1813 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1814 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1815 (Target_powerpc): Add Address typedef and invalid_address. Use
1816 throughout.
1817 (Target_powerpc::is_branch_reloc): New function.
1818 (Powerpc_relocate_functions): Add Address typedef, use throughout.
1819 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1820 for dst_mask, value and addend.
1821 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1822 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1823 (Output_data_glink::do_write): Correct toc base. Don't try to use
1824 uint16_t for 24-bit offset. Use get_output_section_offset and
1825 check return.
1826 (Target_powerpc::Scan::local): Handle more relocs.
1827 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1828 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1829 Plug in toc restoring insn after plt calls. Translate branches
1830 to function descriptor symbols to corresponding entry point.
1831 (Target_powerpc::relocate_for_relocatable): Check return from
1832 get_output_section_offset.
1833 * symtab.h: Comment typo.
1834
1835 2012-08-14 Ian Lance Taylor <iant@google.com>
1836
1837 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1838 unsupported_relocal_local to call unsupported_reloc_global.
1839
1840 2012-08-14 Nick Clifton <nickc@redhat.com>
1841
1842 PR ld/14265
1843 * script-sections.cc (Sections_element::output_section_name): Add
1844 keep return parameter.
1845 (Output_section_element::match_name): Add keep return parameter.
1846 Return the value of the keep_ member.
1847 * script-sections.h (class Output_section): Update
1848 output_section_name prototype.
1849 * layout.cc (Layout::keep_input_section): New public member
1850 function.
1851 (Layout::choose_output_section): Pass keep parameter to
1852 output_section_name.
1853 * layout.h (class Layout): Add keep_input_section.
1854 * object.cc (Sized_relobj_file::do_layout): Check for kept input
1855 sections.
1856 * testsuite/Makefile.am: Add a test.
1857 * testsuite/Makefile.in: Regenerate.
1858 * testsuite/pr14265.c: Source file for the test.
1859 * testsuite/pr14265.t: Linker script for the test.
1860 * testsuite/pr14265.sh: Shell script for the test.
1861
1862 2012-08-14 Alan Modra <amodra@gmail.com>
1863
1864 * target.h (Target::output_section_name): New function.
1865 (Target::do_output_section_name): New function.
1866 * layout.cc (Layout::choose_output_section): Call the above.
1867 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1868
1869 2012-08-14 Alan Modra <amodra@gmail.com>
1870
1871 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1872 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1873 for replace_constant call.
1874 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1875 (Output_data_glink::do_print_to_mapfile): New function.
1876 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1877 (Target_powerpc::Relocate::relocate): Likewise.
1878
1879 2012-08-14 Alan Modra <amodra@gmail.com>
1880
1881 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1882 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1883 (Output_data_glink::add_entry,find_entry): Remove shndx param.
1884 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
1885 all references to shndx_. Handle special case for R_PPC_PLTREL24
1886 here.
1887 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1888 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1889 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1890 here.
1891 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1892 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1893
1894 2012-08-12 Alan Modra <amodra@gmail.com>
1895
1896 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
1897 (glink insn constants): Use uint32_t.
1898 (Output_data_glink::add_entry): Use insert, not [] operator.
1899
1900 2012-08-11 Alan Modra <amodra@gmail.com>
1901
1902 * object.h (Sized_relobj_file::find_shdr): New function.
1903 (Sized_relobj_file::find_special_sections): New function.
1904 * object.cc (Sized_relobj_file::find_shdr): New function.
1905 (Sized_relobj_file::find_eh_frame): Use find_shdr.
1906 (Sized_relobj_file::find_special_sections): New function, split out..
1907 (Sized_relobj_file::do_read_symbols): ..from here.
1908 * output.h (Output_data_got::replace_constant): New function.
1909 (Output_data_got::num_entries): New function.
1910 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1911 (Output_data_got::got_offset): Protected rather than private.
1912 (Output_data_got::replace_got_entry): New function.
1913 * output.cc (Output_data_got::replace_got_entry): New function.
1914 * powerpc.cc (class Powerpc_relobj): New.
1915 (class Powerpc_relocate_functions): Delete all psymval variants or
1916 convert to value,addend type. Delete pcrela, pcrela_unaligned.
1917 Implement _ha functions using corresponding _hi function.
1918 (Powerpc_relobj::find_special_sections): New function.
1919 (Target_powerpc::do_make_elf_object): New function.
1920 (class Output_data_got_powerpc): New.
1921 (class Output_data_glink): New.
1922 (class Powerpc_scan_relocatable_reloc): New.
1923 Many more changes througout file.
1924
1925 2012-08-09 Nick Clifton <nickc@redhat.com>
1926
1927 * po/vi.po: Updated Vietnamese translation.
1928
1929 2012-08-07 Ian Lance Taylor <iant@google.com>
1930
1931 * layout.cc (Layout::add_target_dynamic_tags): If
1932 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1933 plt_rel.
1934
1935 2012-07-30 Nick Clifton <nickc@redhat.com>
1936
1937 * po/gold.pot: Updated template.
1938 * po/es.po: Updated Spanish translation.
1939
1940 2012-07-18 Cary Coutant <ccoutant@google.com>
1941
1942 PR gold/14344
1943 * configure.ac: Add check for -gpubnames support.
1944 * configure: Regenerate.
1945 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1946 support; force -gno-pubnames.
1947 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1948 support.
1949 (gdb_index_test_4): New test.
1950 * testsuite/Makefile.in: Regenerate.
1951 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1952 * testsuite/gdb_index_test_2.sh: Likewise.
1953 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1954 * testsuite/gdb_index_test_4.sh: New script.
1955 * testsuite/gdb_index_test_comm.sh: New script with common code;
1956 don't look for space after colon.
1957
1958 2012-07-16 Sriraman Tallam <tmsriram@google.com>
1959
1960 * gold.cc (queue_middle_tasks): Update function order only after
1961 deferred objects due to plugins are processed.
1962
1963 2012-07-11 Ian Lance Taylor <iant@google.com>
1964
1965 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1966 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1967 (Target_arm::scan_reloc_for_stub): Likewise.
1968 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1969 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1970 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1971 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1972 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1973
1974 2012-07-10 Dodji Seketeli <dodji@redhat.com>
1975 Ian Lance Taylor <iant@google.com>
1976
1977 PR gold/14309
1978 * configure.ac: Test whether std::tr1::hash<off_t> works.
1979 * gold.h: Add a specialization for std::tr1::hash<off_t> if
1980 needed.
1981 * output.h (class Output_fill): Add virtual destructor.
1982 * configure, config.in: Rebuild.
1983
1984 2012-06-22 Roland McGrath <mcgrathr@google.com>
1985
1986 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1987
1988 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
1989
1990 * plugin.cc (Plugin::load): Handle position independent executables.
1991
1992 2012-06-06 Cary Coutant <ccoutant@google.com>
1993
1994 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1995 add .debug_macro.
1996 (lines_only_debug_sections): Likewise.
1997 (gdb_fast_lookup_sections): New static array.
1998 (is_gdb_debug_section): Rename formal parameter.
1999 (is_lines_only_debug_section): Likewise.
2000 (is_gdb_fast_lookup_section): New function.
2001 (Layout::include_section): Check for ".zdebug_" prefix; pass
2002 section name suffix to is_gdb_debug_section, et al.; check for
2003 fast-lookup sections when building .gdb_index.
2004 * options.h (--strip-debug-gdb): Update GDB version number.
2005
2006 2012-06-06 Cary Coutant <ccoutant@google.com>
2007
2008 * configure.ac: Add check for fallocate.
2009 * configure: Regenerate.
2010 * config.in: Regenerate.
2011
2012 * options.h (class General_options): Add --mmap-output-file and
2013 --posix-fallocate options.
2014 * output.cc: (posix_fallocate): Remove; replace with...
2015 (gold_fallocate): New function.
2016 (Output_file::map_no_anonymous): Call gold_fallocate.
2017 (Output_file::map): Check --mmap-output-file option.
2018
2019 2012-06-05 Jing Yu <jingyu@google.com>
2020
2021 * gold.h (textdomain): Add do {} to empty while(0).
2022 (bindtextdomain): Likewise.
2023
2024 2012-06-04 Cary Coutant <ccoutant@google.com>
2025
2026 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2027 has_dynsym_index.
2028
2029 2012-05-25 Sriraman Tallam <tmsriram@google.com>
2030
2031 * symtab.cc (Symbol_table::define_special_symbol):
2032 Initialize *poldsym to prevent uninitialized variable errors.
2033
2034 2012-05-23 Cary Coutant <ccoutant@google.com>
2035
2036 * layout.cc (Layout::section_name_mapping): Add rules to handle
2037 exact match on .data.rel.ro.local or .data.rel.ro.
2038 (Layout::output_section_name): Check for exact matches.
2039
2040 2012-05-23 Cary Coutant <ccoutant@google.com>
2041
2042 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2043 more carefully.
2044
2045 2012-05-22 Cary Coutant <ccoutant@google.com>
2046
2047 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2048 object before exporting symbol.
2049
2050 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
2051
2052 * testsuite/tls_test.cc: Include "config.h" first.
2053 * testsuite/tls_test_c.c: Likewise.
2054
2055 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
2056 Nick Clifton <nickc@redhat.com>
2057
2058 PR 14072
2059 * configure.in: Add check that sysdep.h has been included before
2060 any system header files.
2061 * configure: Regenerate.
2062 * config.in: Regenerate.
2063
2064 2012-05-14 Cary Coutant <ccoutant@google.com>
2065
2066 * layout.cc (Layout::make_output_section): Mark .tdata section
2067 as RELRO.
2068 * testsuite/relro_test.cc: Add a TLS variable.
2069
2070 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
2071
2072 PR gold/14091
2073 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2074 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2075 R_X86_64_64.
2076
2077 2012-05-08 Cary Coutant <ccoutant@google.com>
2078
2079 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2080 (lines_only_debug_sections): Likewise.
2081
2082 2012-05-02 Roland McGrath <mcgrathr@google.com>
2083
2084 * nacl.cc: New file.
2085 * nacl.h: New file.
2086 * Makefile.am (CCFILES, HFILES): Add them.
2087 * Makefile.in: Regenerate.
2088 * i386.cc (Output_data_plt_i386_nacl): New class.
2089 (Output_data_plt_i386_nacl_exec): New class.
2090 (Output_data_plt_i386_nacl_dyn): New class.
2091 (Target_i386_nacl): New class.
2092 (Target_selector_i386_nacl): New class.
2093 (target_selector_i386): Use it instead of Target_selector_i386.
2094 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2095 (Target_x86_64_nacl): New class.
2096 (Target_selector_x86_64_nacl): New class.
2097 (target_selector_x86_64, target_selector_x32): Use it instead of
2098 Target_selector_x86_64.
2099 * arm.cc (Output_data_plt_arm_nacl): New class.
2100 (Target_arm_nacl): New class.
2101 (Target_selector_arm_nacl): New class.
2102 (target_selector_arm, target_selector_armbe): Use it instead of
2103 Target_selector_arm.
2104
2105 * target-select.cc (select_target): Take new Input_file* and off_t
2106 arguments, pass them on to recognize method of selector.
2107 * object.cc (make_elf_sized_object): Update caller.
2108 * parameters.cc (parameters_force_valid_target): Likewise.
2109 * incremental.cc (make_sized_incremental_binary): Likewise.
2110 * target-select.h: Update decl.
2111 (Target_selector::recognize): Take new Input_file* argument,
2112 pass it on to do_recognize.
2113 (Target_selector::do_recognize): Take new Input_file* argument.
2114 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2115 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2116 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2117 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2118
2119 * target.h (Target::Target_info): New members isolate_execinstr
2120 and rosegment_gap.
2121 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2122 * arm.cc (Target_arm::arm_info): Update initializer.
2123 * i386.cc (Target_i386::i386_info): Likewise.
2124 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2125 * sparc.cc (Target_sparc::sparc_info): Likewise.
2126 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2127 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2128 * layout.cc (Layout::attach_allocated_section_to_segment):
2129 Take new const Target* argument. If target->isolate_execinstr(), act
2130 like --rosegment.
2131 (Layout::find_first_load_seg): Take new const Target* argument;
2132 if target->isolate_execinstr(), reject PF_X segments.
2133 (Layout::relaxation_loop_body): Update caller.
2134 (Layout::set_segment_offsets): If target->isolate_execinstr(),
2135 reset file offset to zero when we hit LOAD_SEG, and then do a second
2136 loop over the segments before LOAD_SEG to reassign offsets after
2137 addresses have been determined. Handle target->rosegment_gap().
2138 (Layout::attach_section_to_segment): Take new const Target* argument;
2139 pass it to attach_allocated_section_to_segment.
2140 (Layout::make_output_section): Update caller.
2141 (Layout::attach_sections_to_segments): Take new const Target* argument;
2142 pass it to attach_section_to_segment.
2143 * gold.cc (queue_middle_tasks): Update caller.
2144 * layout.h (Layout): Update method decls with new arguments.
2145
2146 * arm.cc (Target_arm::Target_arm): Take optional argument for the
2147 Target_info pointer to use.
2148 (Target_arm::do_make_data_plt): New virtual method.
2149 (Target_arm::make_data_plt): New method that calls it.
2150 (Target_arm::make_plt_entry): Use it.
2151 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2152 for the section alignment.
2153 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2154 method.
2155 (Output_data_plt_arm::first_plt_entry_offset): Call it.
2156 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2157 method.
2158 (Output_data_plt_arm::get_plt_entry_size): Call it.
2159 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2160 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2161 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2162 method.
2163 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2164 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2165 method instead of sizeof(plt_entry).
2166 (Output_data_plt_arm::add_entry): Likewise.
2167 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2168 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2169 than static method.
2170 (Target_arm::plt_entry_size): Likewise.
2171 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2172 Move to ...
2173 (Output_data_plt_arm_standard): ... here, new class.
2174 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2175 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2176 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2177
2178 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2179 Take additional argument for the PLT entry size.
2180 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2181 Use get_plt_entry_size method rather than plt_entry_size variable.
2182 (Output_data_plt_x86_64::reserve_slot): Likewise.
2183 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2184 (Output_data_plt_x86_64::add_entry): Likewise.
2185 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2186 (Output_data_plt_x86_64::address_for_global): Likewise.
2187 (Output_data_plt_x86_64::address_for_local): Likewise.
2188 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2189 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2190 Make method non-static.
2191 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2192 method.
2193 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2194 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2195 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2196 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2197 virtual method.
2198 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2199 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2200 virtual method.
2201 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2202 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2203 virtual method.
2204 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2205 (Output_data_plt_x86_64::plt_entry_size)
2206 (Output_data_plt_x86_64::first_plt_entry)
2207 (Output_data_plt_x86_64::plt_entry)
2208 (Output_data_plt_x86_64::tlsdesc_plt_entry)
2209 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2210 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2211 (Output_data_plt_x86_64_standard): ... here, new class.
2212 (Target_x86_64::Target_x86_64): Take optional argument for the
2213 Target_info pointer to use.
2214 (Target_x86_64::do_make_data_plt): New virtual method.
2215 (Target_x86_64::make_data_plt): New method to call it.
2216 (Target_x86_64::init_got_plt_for_update): Use that.
2217 Call this->plt_->add_eh_frame method here.
2218 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2219 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2220 rather than static method.
2221 (Target_x86_64::plt_entry_size): Likewise.
2222 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2223 rather than plt_entry_size variable. Move guts of PLT filling to...
2224 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2225 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2226 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2227
2228 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2229 additional argument for the section alignment.
2230 Don't do add_eh_frame_for_plt here.
2231 (Output_data_plt_i386::first_plt_entry_offset): Make the method
2232 non-static. Use get_plt_entry_size method rather than plt_entry_size
2233 variable.
2234 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2235 method.
2236 (Output_data_plt_i386::get_plt_entry_size): Call it.
2237 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2238 (Output_data_plt_i386::add_eh_frame): New method to call it.
2239 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2240 method.
2241 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2242 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2243 method.
2244 (Output_data_plt_i386::fill_plt_entry): New method to call it.
2245 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2246 method instead of plt_entry_size.
2247 (Output_data_plt_i386::plt_entry_size)
2248 (Output_data_plt_i386::plt_eh_frame_fde_size)
2249 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2250 (Output_data_plt_i386_standard): ... here, new class.
2251 (Output_data_plt_i386_exec): New class.
2252 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2253 (Output_data_plt_i386_exec::first_plt_entry): ... here.
2254 (Output_data_plt_i386::exec_plt_entry): Move to ...
2255 (Output_data_plt_i386_exec::plt_entry): ... here.
2256 (Output_data_plt_i386_dyn): New class.
2257 (Output_data_plt_i386::first_plt_entry): Move to ...
2258 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2259 (Output_data_plt_i386::dyn_plt_entry): Move to ...
2260 (Output_data_plt_i386_dyn::plt_entry): ... here.
2261 (Target_i386::Target_i386): Take optional argument for the Target_info
2262 pointer to use.
2263 (Target_i386::do_make_data_plt): New virtual method.
2264 (Target_i386::make_data_plt): New method to call it.
2265 (Target_i386::make_plt_section): Use that.
2266 Call this->plt_->add_eh_frame method here.
2267 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2268 rather than plt_entry_size variable.
2269 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2270 (Output_data_plt_i386::address_for_local): Likewise.
2271 (Output_data_plt_i386::do_write): Likewise.
2272 Move guts of PLT filling to...
2273 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2274 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2275 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2276 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2277
2278 2012-05-01 Cary Coutant <ccoutant@google.com>
2279
2280 * dwarf_reader.cc (Dwarf_die::read_attributes)
2281 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2282 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2283 * reduced_debug_output.cc
2284 (Output_reduced_debug_info_section::get_die_end): Remove
2285 DW_FORM_GNU_ref_index. Add default case.
2286
2287 2012-04-26 Mark Wielaard <mjw@redhat.com>
2288
2289 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2290 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2291 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2292 DW_AT_high_pc as offset from DW_AT_low_pc.
2293
2294 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2295 * testsuite/Makefile.in: Regenerate.
2296 * testsuite/gdb_index_test_3.c: New test source file.
2297 * testsuite/gdb_index_test_3.sh: New test source file.
2298
2299 2012-04-25 Ian Lance Taylor <iant@google.com>
2300
2301 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2302 pointer.
2303 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2304 as a class, not a struct.
2305 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2306 (Target_arm::apply_cortex_a8_workaround): Likewise.
2307 * gc.h: Declare Reloc_types as a struct, not a class.
2308 * object.h: Declare Symbols_data as a struct.
2309 * reloc.h: Declare Read_relocs_data as a struct.
2310 * target.h: Declare Relocate_info as a struct.
2311
2312 2012-04-24 David S. Miller <davem@davemloft.net>
2313
2314 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2315 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2316 and R_SPARC_WPLT30.
2317
2318 2012-04-24 Cary Coutant <ccoutant@google.com>
2319
2320 * incremental-dump.cc (find_input_containing_global): Replace
2321 magic number with symbolic constant.
2322 (dump_incremental_inputs): Update version number.
2323 * incremental.cc (Output_section_incremental_inputs): Update version
2324 number; import symbolic constants from Incremental_inputs_reader.
2325 (Incremental_inputs::create_data_sections): Align relocations
2326 section correctly for 64-bit targets.
2327 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2328 constants; add padding.
2329 (Output_section_incremental_inputs::write_header): Add assert for
2330 header_size.
2331 (Output_section_incremental_inputs::write_input_files): Add assert
2332 for input_entry_size.
2333 (Output_section_incremental_inputs::write_info_blocks): Add padding;
2334 add assert for object_info_size, input_section_entry_size,
2335 global_sym_entry_size.
2336 * incremental.h (Incremental_inputs_reader): Add symbolic constants
2337 for data structure sizes; use them.
2338 (Incremental_input_entry_reader): Import symbolic constants from
2339 Incremental_inputs_reader; use them.
2340
2341 2012-04-23 David S. Miller <davem@davemloft.net>
2342
2343 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2344 and elf_flags_set_.
2345 (Target_sparc::Target_sparc): Initialize new fields.
2346 (Target_sparc::do_make_elf_object): New function.
2347 (Target_sparc::do_adjust_elf_header): New function.
2348
2349 2012-04-23 Cary Coutant <ccoutant@google.com>
2350
2351 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2352 CU range table of gdb index.
2353
2354 2012-04-20 David S. Miller <davem@davemloft.net>
2355
2356 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2357 instead of false.
2358
2359 2012-04-16 David S. Miller <davem@davemloft.net>
2360
2361 * sparc.cc (Target_sparc::got_address): New function.
2362 (Sparc_relocate_functions::gdop_hix22): New function.
2363 (Sparc_relocate_functions::gdop_lox10): New function.
2364 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2365 relocs.
2366 (Target_sparc::Scan::local): Likewise if the global symbol is not
2367 preemptible and is not IFUNC.
2368 (Target_sparc::Relocate::relocate): Perform GOTDATA code
2369 transformations for local and non-preemptible non-IFUNC global
2370 symbols.
2371
2372 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2373 writing out 64-bit part of ranges.
2374
2375 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2376 -fpic and -fpie respectively.
2377 * Makefile.in: Regenerate.
2378
2379 * sparc.cc (class Target_sparc): Add rela_ifunc_.
2380 (Target_sparc::Target_sparc): Initialize new field.
2381 (Target_sparc::do_plt_section_for_global): New function.
2382 (Target_sparc::do_plt_section_for_local): New function.
2383 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2384 (Target_sparc::make_plt_section): New function, broken out of
2385 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
2386 (Target_sparc::make_plt_entry): Call make_plt_section.
2387 (Target_sparc::make_local_ifunc_plt_entry): New function.
2388 (Target_sparc::rela_ifunc_section): New function.
2389 (Target_sparc::plt_section): Remove const.
2390 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
2391 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2392 and ifunc_count_ fields.
2393 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2394 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2395 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2396 (Output_data_plt_sparc::rela_ifunc): New function.
2397 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2398 (Output_data_plt_sparc::has_ifunc_section): New function.
2399 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2400 (Output_data_plt_sparc::address_for_global): New function.
2401 (Output_data_plt_sparc::address_for_local): New function.
2402 (Output_data_plt_sparc::plt_index_to_offset): New function.
2403 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2404 and entry_count.
2405 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2406 entry_count.
2407 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2408 R_SPARC_JMP_IREL to switch.
2409 (Target_sparc::Scan::check_non_pic): Likewise.
2410 (Target_sparc::Scan::local): Handle IFUNC symbols.
2411 (Target_sparc::Scan::local): Likewise.
2412 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2413 and plt_address_for_local.
2414 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2415 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2416
2417 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2418 (class Output_data_reloc): Adjust calls to Output_reloc_type.
2419 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2420 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2421 global relocs too.
2422 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2423 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2424 calls.
2425 * sparc.cc (Target_sparc::Scan::global): Likewise.
2426 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2427
2428 2012-04-16 Cary Coutant <ccoutant@google.com>
2429
2430 * archive.cc (Library_base::should_include_member): Check for
2431 --export-dynamic-symbol.
2432 * options.h (class General_options): Add --export-dynamic-symbol.
2433 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2434 --export-dynamic-symbol.
2435 (Symbol_table::gc_mark_undef_symbols): Likewise.
2436 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2437
2438 2012-04-12 David S. Miller <davem@davemloft.net>
2439
2440 * sparc.cc (Reloc::wdisp10): New relocation method.
2441 (Reloc::h34): Likewise.
2442 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2443 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2444 R_SPARC_WDISP10.
2445 (Target_sparc::Scan::local): Likewise.
2446 (Target_sparc::Scan::global): Likewise.
2447 (Target_sparc::Relocate::relocate): Likewise.
2448
2449 2012-04-09 Cary Coutant <ccoutant@google.com>
2450
2451 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2452 low_pc == 0.
2453
2454 2012-04-06 Ian Lance Taylor <iant@google.com>
2455
2456 * timer.cc: #include <unistd.h>.
2457
2458 2012-04-06 Roland McGrath <mcgrathr@google.com>
2459
2460 * configure.in (AC_CHECK_HEADERS): Add locale.h.
2461 * config.in: Regenerate.
2462 * configure: Regenerate.
2463
2464 2012-04-05 Nick Clifton <nickc@redhat.com>
2465
2466 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2467 (AM_LC_MESSAGES): Add.
2468 * aclocal.m4: Regenerate.
2469 * config.in: Regenerate.
2470 * configure: Regenerate.
2471
2472 2012-03-21 Cary Coutant <ccoutant@google.com>
2473
2474 * Makefile.am: Add gdb-index.cc, gdb-index.h.
2475 * Makefile.in: Regenerate.
2476 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2477 (Sized_elf_reloc_mapper::symbol_section): New function.
2478 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2479 (make_elf_reloc_mapper): New function.
2480 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2481 (Dwarf_abbrev_table::do_read_abbrevs): New function.
2482 (Dwarf_abbrev_table::do_get_abbrev): New function.
2483 (Dwarf_ranges_table::read_ranges_table): New function.
2484 (Dwarf_ranges_table::read_range_list): New function.
2485 (Dwarf_pubnames_table::read_section): New function.
2486 (Dwarf_pubnames_table::read_header): New function.
2487 (Dwarf_pubnames_table::next_name): New function.
2488 (Dwarf_die::Dwarf_die): New function.
2489 (Dwarf_die::read_attributes): New function.
2490 (Dwarf_die::skip_attributes): New function.
2491 (Dwarf_die::set_name): New function.
2492 (Dwarf_die::set_linkage_name): New function.
2493 (Dwarf_die::attribute): New function.
2494 (Dwarf_die::string_attribute): New function.
2495 (Dwarf_die::int_attribute): New function.
2496 (Dwarf_die::uint_attribute): New function.
2497 (Dwarf_die::ref_attribute): New function.
2498 (Dwarf_die::child_offset): New function.
2499 (Dwarf_die::sibling_offset): New function.
2500 (Dwarf_info_reader::check_buffer): New function.
2501 (Dwarf_info_reader::parse): New function.
2502 (Dwarf_info_reader::do_parse): New function.
2503 (Dwarf_info_reader::do_read_string_table): New function.
2504 (Dwarf_info_reader::lookup_reloc): New function.
2505 (Dwarf_info_reader::get_string): New function.
2506 (Dwarf_info_reader::visit_compilation_unit): New function.
2507 (Dwarf_info_reader::visit_type_unit): New function.
2508 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2509 Sized_elf_reloc_mapper.
2510 (Sized_dwarf_line_info::symbol_section): Remove function.
2511 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2512 (Sized_dwarf_line_info::read_line_mappings): Remove object
2513 parameter, adjust callers.
2514 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2515 * dwarf_reader.h: Include <sys/types.h>.
2516 (class Track_relocs): Remove forward declaration.
2517 (class Elf_reloc_mapper): New class.
2518 (class Sized_elf_reloc_mapper): New class.
2519 (class Dwarf_abbrev_table): New class.
2520 (class Dwarf_range_list): New class.
2521 (class Dwarf_ranges_table): New class.
2522 (class Dwarf_pubnames_table): New class.
2523 (class Dwarf_die): New class.
2524 (class Dwarf_info_reader): New class.
2525 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2526 (Sized_dwarf_line_info::symbol_section): Remove member function.
2527 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2528 base class.
2529 * gdb-index.cc: New source file.
2530 * gdb-index.h: New source file.
2531 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2532 and .debug_types sections, call Layout::add_to_gdb_index.
2533 (Sized_relobj_incr::do_section_name): Implement.
2534 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2535 return type; Implement.
2536 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2537 return type.
2538 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2539 parameter list and return type.
2540 (Sized_incr_dynobj::do_section_contents): Likewise.
2541 * layout.cc: Include gdb-index.h.
2542 (Layout::Layout): Initialize gdb_index_data_.
2543 (Layout::init_fixed_output_section): Check for .gdb_index section.
2544 (Layout::add_to_gdb_index): New function. Instantiate.
2545 * layout.h: Add forward declaration for class Gdb_index.
2546 (Layout::add_to_gdb_index): New member function.
2547 (Layout::gdb_index_data_): New data member.
2548 * main.cc: Include gdb-index.h.
2549 (main): Print statistics for gdb index.
2550 * object.cc (Object::section_contents): Move code into
2551 do_section_contents.
2552 (need_decompressed_section): Check for sections needed when building
2553 gdb index.
2554 (build_compressed_section_map): Likewise.
2555 (Sized_relobj_file::do_read_symbols): Need local symbols when building
2556 gdb index.
2557 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2558 sections; call Layout::add_to_gdb_index.
2559 (Sized_relobj_file::do_decompressed_section_contents): Call
2560 do_section_contents directly.
2561 * object.h (Object::do_section_contents): Adjust parameter list and
2562 return type.
2563 (Object::do_decompressed_section_contents): Call do_section_contents
2564 directly.
2565 (Sized_relobj_file::do_section_contents): Adjust parameter list and
2566 return type.
2567 * options.h (class General_options): Add --gdb-index option.
2568 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2569 list and return type.
2570 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2571 * reloc.h (Track_relocs::checkpoint): New function.
2572 (Track_relocs::reset): New function.
2573
2574 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2575 New test cases.
2576 * testsuite/Makefile.in: Regenerate.
2577 * testsuite/gdb_index_test.cc: New test source file.
2578 * testsuite/gdb_index_test_1.sh: New test source file.
2579 * testsuite/gdb_index_test_2.sh: New test source file.
2580
2581 2012-03-19 Doug Kwan <dougkwan@google.com>
2582
2583 * arm.cc (Target_arm::do_define_standard_symbols): New method.
2584 (Target_arm::do_finalize_sections): Remove code which defines
2585 __exidx_start and __exidx_end. Make symbol table parameter
2586 anonymous as it is not used.
2587 * gold.cc (queue_middle_tasks): Call target hook to define any
2588 target-specific symbols.
2589 * target.h (Target::define_standard_symbols): New method.
2590 (Target::do_define_standard_symbols): Same.
2591 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2592 * testsuite/Makefile.in: Regenerate.
2593 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2594 and __exidx_end.
2595 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2596 relocations are generated for __exidx_start and __exidx_end.
2597
2598 2012-03-16 Doug Kwan <dougkwan@google.com>
2599
2600 * testsuite/Makefile.am: Disable test initpri3b.
2601 * testsuite/Makefile.in: Regenerate.
2602
2603 2012-03-15 Doug Kwan <dougkwan@google.com>
2604
2605 * arm.cc (Target_arm::got_section): Make .got section read-only
2606 if -z now is given.
2607
2608 2012-03-15 Ian Lance Taylor <iant@google.com>
2609
2610 PR gold/13850
2611 * layout.cc (Layout::make_output_section): Correctly mark
2612 SHT_INIT_ARRAY, et. al., as relro.
2613
2614 2012-03-14 Doug Kwan <dougkwan@google.com>
2615
2616 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2617 dynamic relocations for protected symbols in shared objects.
2618
2619 2012-03-13 Ian Lance Taylor <iant@google.com>
2620
2621 * resolve.cc (Symbol_table::resolve): When merging common symbols,
2622 keep the larger alignment.
2623
2624 2012-03-12 Cary Coutant <ccoutant@google.com>
2625
2626 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2627 handling of DW_LNE_define_file.
2628
2629 2012-03-12 Cary Coutant <ccoutant@google.com>
2630
2631 * reduced_debug_output.cc
2632 (Output_reduced_debug_info_section::get_die_end): Add new FORM
2633 codes to switch.
2634
2635 2012-02-29 Cary Coutant <ccoutant@google.com>
2636
2637 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2638
2639 2012-02-29 Cary Coutant <ccoutant@google.com>
2640
2641 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2642 Call Object::decompressed_section_contents.
2643 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2644 New dtor.
2645 (Sized_dwarf_line_info::buffer_start_): New data member.
2646 * merge.cc (Output_merge_data::do_add_input_section): Call
2647 Object::decompressed_section_contents.
2648 (Output_merge_string::do_add_input_section): Likewise.
2649 * object.cc (need_decompressed_section): New function.
2650 (build_compressed_section_map): Decompress sections needed later.
2651 (Sized_relobj_file::do_decompressed_section_contents): New function.
2652 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2653 * object.h (Object::decompressed_section_contents): New function.
2654 (Object::discard_decompressed_sections): New function.
2655 (Object::do_decompressed_section_contents): New function.
2656 (Object::do_discard_decompressed_sections): New function.
2657 (Compressed_section_info): New type.
2658 (Compressed_section_map): Include decompressed section contents.
2659 (Sized_relobj_file::do_decompressed_section_contents): New function.
2660 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2661
2662 2012-02-16 Cary Coutant <ccoutant@google.com>
2663
2664 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2665 * testsuite/Makefile.in: Regenerate.
2666
2667 2012-02-14 Cary Coutant <ccoutant@google.com>
2668
2669 * options.cc (General_options::finalize): Disallow -pie and -static.
2670
2671 2012-02-03 Doug Kwan <dougkwan@google.com>
2672
2673 * arm.cc (Arm_relocate_functions::abs8,
2674 Arm_relocate_functions::abs16): Use
2675 Bits::has_signed_unsigned_overflow32.
2676 (Arm_relocate_functions::thm_abs8): Correct range of
2677 overflow check.
2678 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2679 in assertions.
2680
2681 2012-02-02 Doug Kwan <dougkwan@google.com>
2682
2683 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2684 position independent outputs, not just shared objects.
2685
2686 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
2687
2688 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2689 * configure: Regenerated.
2690
2691 2012-01-27 Ian Lance Taylor <iant@google.com>
2692
2693 * reloc.h (Bits): New class with static functions, copied from
2694 namespace utils in arm.cc.
2695 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
2696 instead.
2697
2698 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2699
2700 * incremental.cc (write_info_blocks): Correct relocation offset.
2701
2702 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2703
2704 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2705 (Relocate::tls_gd_to_le): Likewise.
2706
2707 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2708
2709 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2710
2711 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2712
2713 * configure.ac: Check if -mcmodel=medium works.
2714 * configure: Regenerated.
2715
2716 2012-01-24 Cary Coutant <ccoutant@google.com>
2717
2718 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2719 definition and ...
2720 (read_unsigned_LEB_128_x): ... this new function.
2721 (read_signed_LEB_128): Replaced with inline definition and ...
2722 (read_signed_LEB_128_x): ... this new function.
2723 * int_encoding.h (read_unsigned_LEB_128_x): New function.
2724 (read_unsigned_LEB_128): Add inline definition.
2725 (read_signed_LEB_128_x): New function.
2726 (read_signed_LEB_128): Add inline definition.
2727 * testsuite/Makefile.am (leb128_unittest): New unit test.
2728 * testsuite/Makefile.in: Regenerate.
2729 * testsuite/leb128_unittest.cc: New unit test.
2730
2731 2012-01-23 Ian Lance Taylor <iant@google.com>
2732
2733 PR gold/13617
2734 * i386.cc (Target_i386::do_code_fill): When using a jmp
2735 instruction, pad with nop instructions.
2736 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2737
2738 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
2739
2740 * x86_64.cc (gc_process_relocs): Add typename on types used in
2741 template.
2742 (scan_relocs): Likewise.
2743 (relocate_section): Likewise.
2744 (apply_relocation): Likewise.
2745
2746 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
2747
2748 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2749 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2750 under x32.
2751
2752 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
2753
2754 * x86_64.cc: Initial support for x32.
2755
2756 2012-01-03 Cary Coutant <ccoutant@google.com>
2757
2758 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2759 Use abstract base class for GOT.
2760 * gold/output.h (class Output_data_got_base): New abstract base class.
2761 (class Output_data_got): Derive from new base class, adjust ctors.
2762 (Output_data_got::reserve_slot): Make virtual; rename to
2763 do_reserve_slot; Adjust callers.
2764 * gold/target.h (Sized_target::init_got_plt_for_update): Return
2765 pointer to abstract base class.
2766 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2767
2768 2011-12-18 Ian Lance Taylor <iant@google.com>
2769
2770 * object.h (Relobj::local_symbol_value): New function.
2771 (Relobj::local_plt_offset): New function.
2772 (Relobj::local_has_got_offset): New function.
2773 (Relobj::local_got_offset): New function.
2774 (Relobj::set_local_got_offset): New function.
2775 (Relobj::do_local_symbol_value): New pure virtual function.
2776 (Relobj::do_local_plt_offset): Likewise.
2777 (Relobj::do_local_has_got_offset): Likewise.
2778 (Relobj::do_local_got_offset): Likewise.
2779 (Relobj::do_set_local_got_offset): Likewise.
2780 (Sized_relobj::do_local_has_got_offset): Rename from
2781 local_has_got_offset.
2782 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2783 (Sized_relobj::do_set_local_got_offset): Rename from
2784 set_local_got_offset.
2785 (Sized_relobj_file::do_local_plt_offset): Rename from
2786 local_plt_offset.
2787 (Sized_relobj_file::do_local_symbol_value): New function.
2788 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2789 local_plt_offset.
2790 * output.cc (Output_data_got::Got_entry::write): Change object to
2791 Relobj. Use local_symbol_value.
2792 (Output_data_got::add_global_with_rel): Change rel_dyn to
2793 Output_data_reloc_generic*. Use add_global_generic.
2794 (Output_data_got::add_global_with_rela): Remove. Change all
2795 callers to use add_global_with_rel.
2796 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2797 Output_data_reloc_generic*. Use add_global_generic.
2798 (Output_data_got::add_global_pair_with_rela): Remove. Change all
2799 callers to use add_global_pair_with_rel.
2800 (Output_data_got::add_local): Change object to Relobj*.
2801 (Output_data_got::add_local_plt): Likewise.
2802 (Output_data_got::add_local_with_rel): Change object to Relobj*,
2803 change rel_dyn to Output_data_reloc_generic*. Use
2804 add_local_generic.
2805 (Output_data_got::add_local_with_rela): Remove. Change all
2806 callers to use all_local_with_rel.
2807 (Output_data_got::add_local_pair_with_rel): Change object to
2808 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
2809 add_output_section_generic.
2810 (Output_data_got::add_local_pair_with_rela): Remove. Change all
2811 callers to use add_local_pair_with_rel.
2812 (Output_data_got::reserve_local): Change object to Relobj*.
2813 * output.h: (class Output_data_reloc_generic): Add pure virtual
2814 declarations for add_global_generic, add_local_generic,
2815 add_output_section_generic.
2816 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2817 functions for Output_data_reloc_generic. Update declarations for
2818 changes listed in output.cc.
2819 (class Output_data_got): Change template parameter to got_size.
2820 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
2821 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2822 function.
2823 (Sized_relobj_incr::do_local_plt_offset): New function.
2824 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2825 add_global_generic.
2826
2827 2011-12-17 Cary Coutant <ccoutant@google.com>
2828
2829 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2830 * resolve.cc (Symbol_table::resolve): Likewise.
2831 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2832 arrays.
2833 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2834
2835 2011-12-16 Ian Lance Taylor <iant@google.com>
2836
2837 * output.h (Output_data_reloc_generic::add): Only call
2838 add_dynamic_reloc if this is a dynamic reloc section.
2839
2840 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
2841
2842 PR gold/13505
2843 * target-reloc.h (apply_relocation): Replace <64, false> with
2844 <size, big_endian>.
2845
2846 2011-11-25 Nick Clifton <nickc@redhat.com>
2847
2848 * po/it.po: New Italian translation.
2849
2850 2011-11-17 Sterling Augustine <saugustine@google.com>
2851
2852 * script.cc (script_include_directive): Implement.
2853 (read_script_file): New local variables name and search_path. Update
2854 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2855 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2856 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2857
2858 2011-11-11 Sterling Augustine <saugustine@google.com>
2859
2860 * yyscript.y (section_cmd): Add support for INCLUDE directive.
2861 (file_or_sections_cmd): Likewise.
2862
2863 2011-11-11 Doug Kwan <dougkwan@google.com>
2864
2865 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2866 if --just-symbols is given.
2867
2868 2011-11-10 Doug Kwan <dougkwan@google.com>
2869
2870 PR gold/13362
2871 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2872 when processing data relocs.
2873 * reloc.h (Relocate_functions::rel_unaligned): New method.
2874 (Relocate_functions::pcrel_unaligned): Ditto.
2875 (Relocate_functions::rel32_unaligned): Ditto.
2876 (Relocate_functions::pcrel32_unaligned): Ditto.
2877
2878 2011-11-09 Doug Kwan <dougkwan@google.com>
2879
2880 PR gold/13362
2881 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2882 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2883 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2884 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2885 (Relocate_functions::rel_unaligned): New.
2886 (Relocate_functions::rel32_unaligned): New.
2887 * target-reloc.h (relocate_for_relocatable): Add code to handle
2888 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2889 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2890 arm_unaligned_reloc_r): New targets.
2891 * testsuite/Makefile.in: Regenerate.
2892 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2893 linking.
2894
2895 2011-11-02 Ian Lance Taylor <iant@google.com>
2896
2897 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
2898 NATIVE_LINKER.
2899 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2900 * options.cc (General_options::finalize): Use library search path
2901 from configure script if specified. If not native and no sysroot,
2902 only search TOOLLIBDIR.
2903 * options.h (Search_directory::Search_directory): Change name to
2904 const std::string&.
2905 (General_options::add_to_library_path_with_sysroot): Change arg to
2906 const std::string&.
2907 * configure, Makefile.in, config.in: Rebuild.
2908
2909 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2910
2911 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2912 we are working around the ARM1176 Erratum.
2913 * options.h (General_options::fix_arm1176): Add option.
2914 * testsuite/Makefile.am: Add testcases, and keep current ones
2915 working.
2916 * testsuite/Makefile.in: Regenerate.
2917 * testsuite/arm_fix_1176.s: New file.
2918 * testsuite/arm_fix_1176.sh: Likewise.
2919
2920 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2921
2922 * arm.cc (Target_arm::Target_arm): Remove initialisation of
2923 may_use_blx_.
2924 (Target_arm::may_use_blx): Remove method.
2925 (Target_arm::set_may_use_blx): Likewise.
2926 (Target_arm::may_use_v4t_interworking): New method.
2927 (Target_arm::may_use_v5t_interworking): Likewise.
2928 (Target_arm::may_use_blx_): Remove member variable.
2929 (Arm_relocate_functions::arm_branch_common): Check for v5T
2930 interworking.
2931 (Arm_relocate_functions::thumb_branch_common): Likewise.
2932 (Reloc_stub::stub_type_for_reloc): Likewise.
2933 (Target_arm::do_finalize_sections): Correct interworking checks.
2934 * testsuite/Makefile.am: Add new tests.
2935 * testsuite/Makefile.in: Regenerate.
2936 * testsuite/arm_farcall_arm_arm.s: New test.
2937 * testsuite/arm_farcall_arm_arm.sh: Likewise.
2938 * testsuite/arm_farcall_arm_thumb.s: Likewise.
2939 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2940 * testsuite/arm_farcall_thumb_arm.s: Likewise.
2941 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2942 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2943 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2944
2945 2011-10-31 Cary Coutant <ccoutant@google.com>
2946
2947 PR gold/13023
2948 * expression.cc (Expression::eval_with_dot): Add
2949 is_section_dot_assignment parameter.
2950 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
2951 absolute and assigning to dot within a section.
2952 * script-sections.cc
2953 (Output_section_element_assignment::set_section_addresses): Pass
2954 dot_section to set_if_absolute.
2955 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2956 as is_section_dot_assignment flag to eval_with_dot.
2957 (Output_section_element_dot_assignment::set_section_addresses):
2958 Likewise.
2959 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2960 parameter. Also set value if relative to dot_section; set the
2961 symbol's output_section.
2962 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2963 parameter. Adjust all callers.
2964 (Expression::eval_maybe_dot): Likewise.
2965 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2966 Adjust all callers.
2967 * testsuite/script_test_2.t: Test assignment of an absolute value
2968 to dot within an output section element.
2969
2970 2011-10-31 Cary Coutant <ccoutant@google.com>
2971
2972 * options.h (class General_options): Add --[no-]gnu-unique options.
2973 * symtab.cc (Symbol_table::sized_write_globals): Convert
2974 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2975
2976 2011-10-31 Cary Coutant <ccoutant@google.com>
2977
2978 PR gold/13359
2979 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2980 unnecessary assertion.
2981 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2982
2983 2011-10-31 Sriraman Tallam <tmsriram@google.com>
2984
2985 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2986 gc_mark_symbol.
2987 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2988 gc_mark_symbol.
2989 Change to just keep the section associated with symbol.
2990 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2991 they are externally visible and --export-dynamic is turned on.
2992 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2993
2994 2011-10-19 Ian Lance Taylor <iant@google.com>
2995
2996 PR gold/13163
2997 * script-sections.cc
2998 (Output_section_element_dot_assignment::needs_output_section): New
2999 function.
3000
3001 2011-10-19 Ian Lance Taylor <iant@google.com>
3002
3003 PR gold/13204
3004 * layout.cc (Layout::segment_precedes): Don't assert failure if a
3005 --section-start option was seen.
3006 * options.h (General_options::any_section_start): New function.
3007
3008 2011-10-18 David S. Miller <davem@davemloft.net>
3009
3010 PR binutils/13301
3011 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3012 member to track relocation locations that have moved during TLS
3013 reloc optimizations.
3014 (Target_sparc::Relocate::Relocate): Initialize to NULL.
3015 (Target_sparc::Relocate::relocate): Adjust view down by 4
3016 bytes if it matches reloc_adjust_addr_.
3017 (Target_sparc::Relocate::relocate_tls): Always move the
3018 __tls_get_addr call delay slot instruction forward 4 bytes when
3019 performing relaxation.
3020
3021 2011-10-18 Cary Coutant <ccoutant@google.com>
3022
3023 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3024 (Output_file::map_no_anonymous): Check for non-zero
3025 return code from posix_fallocate.
3026
3027 2011-10-17 Cary Coutant <ccoutant@google.com>
3028
3029 PR gold/13245
3030 * plugin.cc (is_visible_from_outside): Check for symbols
3031 referenced from dynamic objects.
3032 * resolve.cc (Symbol_table::resolve): Don't count references
3033 from dynamic objects as references from real ELF files.
3034 * testsuite/plugin_test_2.sh: Adjust expected result.
3035
3036 2011-10-17 Cary Coutant <ccoutant@google.com>
3037
3038 * gold.cc: Include timer.h.
3039 (queue_middle_tasks): Stamp time.
3040 (queue_final_tasks): Likewise.
3041 * main.cc (main): Store timer in parameters. Print timers
3042 for each pass.
3043 * parameters.cc (Parameters::Parameters): Initialize timer_.
3044 (Parameters::set_timer): New function.
3045 (set_parameters_timer): New function.
3046 * parameters.h (Parameters::set_timer): New function.
3047 (Parameters::timer): New function.
3048 (Parameters::timer_): New data member.
3049 (set_parameters_timer): New function.
3050 * timer.cc (Timer::stamp): New function.
3051 (Timer::get_pass_time): New function.
3052 * timer.h (Timer::stamp): New function.
3053 (Timer::get_pass_time): New function.
3054 (Timer::pass_times_): New data member.
3055
3056 2011-10-17 Cary Coutant <ccoutant@google.com>
3057
3058 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3059 task for members of lib groups.
3060
3061 2011-10-17 Cary Coutant <ccoutant@google.com>
3062
3063 PR gold/13288
3064 * fileread.cc (File_read::find_view): Add assert.
3065 (File_read::make_view): Move bounds check (replace with assert)...
3066 (File_read::find_or_make_view): ... to here.
3067
3068 2011-10-12 Cary Coutant <ccoutant@google.com>
3069
3070 * output.cc (Output_file::open_base_file): Handle case where
3071 ::read returns less than requested size.
3072
3073 2011-10-10 Cary Coutant <ccoutant@google.com>
3074
3075 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3076 Initialize defined_count_.
3077 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3078 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3079 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3080 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3081 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3082 * incremental.h (Sized_relobj_incr::defined_count_): New data
3083 member.
3084 (Sized_incr_dynobj::defined_count_): New data member.
3085 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3086 Return zeroes instead of internal error.
3087
3088 2011-10-10 Cary Coutant <ccoutant@google.com>
3089
3090 PR gold/13249
3091 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3092 (Output_reloc::symbol_value): Return PLT offset if flag is set.
3093 * output.h (class Output_reloc): Add use_plt_offset flag.
3094 (Output_reloc::type_): Adjust size of bit field.
3095 (Output_reloc::use_plt_offset_): New bit field.
3096 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3097 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3098 flag. Adjust all callers.
3099 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3100 creating RELATIVE relocations.
3101
3102 2011-10-10 Nick Clifton <nickc@redhat.com>
3103
3104 * po/es.po: Updated Spanish translation.
3105 * po/fi.po: Updated Finnish translation.
3106
3107 2011-10-03 Diego Novillo <dnovillo@google.com>
3108
3109 * options.cc (parse_uint): Fix dereference of RETVAL.
3110
3111 2011-09-29 Sriraman Tallam <tmsriram@google.com>
3112
3113 * layout.h (section_order_map_): New member.
3114 (get_section_order_map): New member function.
3115 * output.cc (Output_section::add_input_section): Check for patterns
3116 only when --section-ordering-file is specified.
3117 * gold.cc (queue_middle_tasks): Delay updating order of sections till
3118 output_sections have been formed.
3119 * layout.cc (Layout_Layout): Initialize section_order_map_.
3120 * plugin.cc (update_section_order): Store order in order_map. Do not
3121 update the order.
3122 * testsuite/Makefile.am: Add test case for plugin_final_layout.
3123 * testsuite/Makefile.in: Regenerate.
3124 * testsuite/plugin_section_order.c: New file.
3125 * testsuite/plugin_final_layout.cc: New file.
3126 * testsuite/plugin_final_layout.sh: New file.
3127
3128 2011-09-29 Cary Coutant <ccoutant@google.com>
3129
3130 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3131 Check for NULL.
3132 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3133 symbols during incremental update.
3134 (Symbol_table::add_from_dynobj): Likewise.
3135
3136 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3137 Ian Lance Taylor <iant@google.com>
3138
3139 * symtab.cc (Symbol_table::define_special_symbol): Always
3140 canonicalize version string.
3141
3142 2011-09-26 Cary Coutant <ccoutant@google.com>
3143
3144 * gold.cc (queue_initial_tasks): Move option checks ...
3145 * options.cc (General_options::finalize): ... to here. Disable
3146 some options; make others fatal.
3147
3148 2011-09-26 Cary Coutant <ccoutant@google.com>
3149
3150 gcc PR lto/47247
3151 * plugin.cc (get_symbols_v2): New function.
3152 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3153 (is_referenced_from_outside): New function.
3154 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3155 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3156 (get_symbols): Pass version parameter.
3157 (get_symbols_v2): New function.
3158 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3159 parameter.
3160 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3161 (onload): Add LDPT_GET_SYMBOLS_V2.
3162 (all_symbols_read_hook): Use get_symbols_v2; check for
3163 LDPR_PREVAILING_DEF_IRONLY_EXP.
3164 * testsuite/plugin_test_3.sh: Update expected results.
3165
3166 2011-09-23 Simon Baldwin <simonb@google.com>
3167
3168 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3169 configuration options.
3170 * configure: Regenerate.
3171 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3172 * Makefile.in: Regenerate.
3173 * testsuite/Makefile.in: Regenerate.
3174
3175 2011-09-19 Sriraman Tallam <tmsriram@google.com>
3176
3177 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3178
3179 2011-09-19 Cary Coutant <ccoutant@google.com>
3180
3181 * incremental.cc (can_incremental_update): Fix typo in comment.
3182 * incremental.h (can_incremental_update): Likewise.
3183
3184 2011-09-18 Cary Coutant <ccoutant@google.com>
3185
3186 * incremental.cc (can_incremental_update): New function.
3187 * incremental.h (can_incremental_update): New function.
3188 * layout.cc (Layout::init_fixed_output_section): Call it.
3189 (Layout::make_output_section): Don't allow patch space in .eh_frame.
3190 * object.cc (Sized_relobj_file::do_layout): Call
3191 can_incremental_update.
3192
3193 2011-09-13 Cary Coutant <ccoutant@google.com>
3194
3195 * configure.ac: Check for glibc support for gnu_indirect_function
3196 support with static linking, setting automake conditional
3197 IFUNC_STATIC.
3198 * Makefile.in: Regenerate.
3199 * configure: Regenerate.
3200
3201 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3202 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3203 for IFUNC_STATIC.
3204 * testsuite/Makefile.in: Regenerate.
3205
3206 2011-09-13 Cary Coutant <ccoutant@google.com>
3207
3208 * incremental.cc (Sized_relobj_incr::do_layout): Call
3209 report_comdat_group for kept comdat sections.
3210 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3211 * testsuite/Makefile.in: Regenerate.
3212 * testsuite/incr_comdat_test_1.cc: New source file.
3213 * testsuite/incr_comdat_test_2_v1.cc: New source file.
3214 * testsuite/incr_comdat_test_2_v2.cc: New source file.
3215 * testsuite/incr_comdat_test_2_v3.cc: New source file.
3216
3217 2011-09-13 Ian Lance Taylor <iant@google.com>
3218
3219 * object.cc (Sized_relobj_file::do_layout): Remove unused local
3220 variable external_symbols_offset.
3221
3222 2011-09-12 Ian Lance Taylor <iant@google.com>
3223
3224 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3225 triggered if object has no symbols.
3226
3227 2011-09-09 David S. Miller <davem@davemloft.net>
3228
3229 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3230 (Output_fill_debug_line::do_write): Likewise.
3231
3232 2011-08-29 Cary Coutant <ccoutant@google.com>
3233
3234 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3235 casts to match formatting specs.
3236 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3237
3238 2011-08-26 Cary Coutant <ccoutant@google.com>
3239
3240 * layout.cc (Free_list::allocate): Provide guarantee of minimum
3241 remaining hole size when allocating.
3242 (Layout::make_output_section): Set fill methods for debug sections.
3243 * layout.h (Free_list::Free_list_node): Move from private to
3244 public.
3245 (Free_list::set_min_hole_size): New function.
3246 (Free_list::begin, Free_list::end): New functions.
3247 (Free_list::min_hole_): New data member.
3248 * output.cc: Include dwarf.h.
3249 (Output_fill_debug_info::do_minimum_hole_size): New function.
3250 (Output_fill_debug_info::do_write): New function.
3251 (Output_fill_debug_line::do_minimum_hole_size): New function.
3252 (Output_fill_debug_line::do_write): New function.
3253 (Output_section::Output_section): Initialize new data member.
3254 (Output_section::set_final_data_size): Ensure patch space is larger
3255 than minimum hole size.
3256 (Output_section::do_write): Fill holes in debug sections.
3257 * output.h (Output_fill): New class.
3258 (Output_fill_debug_info): New class.
3259 (Output_fill_debug_line): New class.
3260 (Output_section::set_free_space_fill): New function.
3261 (Output_section::free_space_fill_): New data member.
3262 * testsuite/Makefile.am (incremental_test_3): Add
3263 --incremental-patch option.
3264 (incremental_test_4): Likewise.
3265 (incremental_test_5): Likewise.
3266 (incremental_test_6): Likewise.
3267 (incremental_copy_test): Likewise.
3268 (incremental_common_test_1): Likewise.
3269 * testsuite/Makefile.in: Regenerate.
3270
3271 2011-08-26 Nick Clifton <nickc@redhat.com>
3272
3273 * po/es.po: Updated Spanish translation.
3274
3275 2011-08-01 Cary Coutant <ccoutant@google.com>
3276
3277 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3278 * gold/testsuite/Makefile.in: Regenerate.
3279 * gold/testsuite/justsyms_exec.c: New source file.
3280 * gold/testsuite/justsyms_lib.c: New source file.
3281
3282 2011-08-01 Cary Coutant <ccoutant@google.com>
3283
3284 * layout.cc (Layout::set_segment_offsets): Don't realign text
3285 segment if -Ttext was specified.
3286 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3287 file type.
3288 * object.h (Sized_relobj_file::e_type): New function.
3289 (Sized_relobj_file::e_type_): New data member.
3290 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3291 base address for ET_EXEC files.
3292 * target.cc (Target::do_make_elf_object_implementation): Allow
3293 ET_EXEC files with --just-symbols option.
3294
3295 2011-07-28 Cary Coutant <ccoutant@google.com>
3296
3297 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3298 Add thread_number parameter.
3299 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3300 * workqueue-threads.cc
3301 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3302 current thread if its thread number is greater than desired thread
3303 count.
3304 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3305 Add thread_number parameter.
3306 (Workqueue::should_cancel_thread): Likewise.
3307 (Workqueue::find_runnable_or_wait): Pass thread_number to
3308 should_cancel_thread.
3309 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3310 parameter.
3311
3312 2011-07-22 Sriraman Tallam <tmsriram@google.com>
3313
3314 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3315 only after checking if it cannot be forced local.
3316 * symtab.h (is_externally_visible): Check if the symbol is not forced
3317 local.
3318
3319 2011-07-15 Ian Lance Taylor <iant@google.com>
3320
3321 * options.h (class General_options): Add --print-output-format.
3322 Move -EL next to -EB, for better --help output.
3323 * target-select.cc: Include <cstdio>, "options.h", and
3324 "parameters.h".
3325 (Target_selector::do_target_bfd_name): New function.
3326 (print_output_format): New function.
3327 * target-select.h (class Target_selector): Update declarations.
3328 (Target_selector::target_bfd_name): New function.
3329 (print_output_format): Declare.
3330 * main.cc: Include "target-select.h".
3331 (main): Handle --print-output-format.
3332 * gold.cc: Include "target-select.h".
3333 (queue_initial_tasks): Handle --print-output-format when there are
3334 no input files.
3335 * parameters.cc (parameters_force_valid_target): Give a better
3336 error message if -EB/-EL does not match target.
3337 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3338 function.
3339
3340 2011-07-15 Ian Lance Taylor <iant@google.com>
3341
3342 * i386.cc (class Output_data_plt_i386): Add layout_ field.
3343 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3344 (Output_data_plt_i386::do_write): Write address of .dynamic
3345 section to first entry in .got.plt section.
3346 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3347 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3348 Initialize layout_.
3349 (Output_data_plt_x86_64::do_write): Write address of .dynamic
3350 section to first entry in .got.plt section.
3351 * layout.h (Layout::dynamic_section): New function.
3352
3353 2011-07-13 Sriraman Tallam <tmsriram@google.com>
3354
3355 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3356 to claim_file call.
3357 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3358 input_section_position_, and input_section_glob_.
3359 (read_layout_from_file): Call function section_ordering_specified.
3360 * layout.h (is_section_ordering_specified): New function.
3361 (section_ordering_specified): New function.
3362 (section_ordering_specified_): New boolean member.
3363 * main.cc(main): Call load_plugins after layout object is defined.
3364 * output.cc (Output_section::add_input_section): Use
3365 function section_ordering_specified to check if section ordering is
3366 needed.
3367 * output.cc (Output_section::add_relaxed_input_section): Use
3368 function section_ordering_specified to check if section ordering is
3369 needed.
3370 (Output_section::update_section_layout): New function.
3371 (Output_section::sort_attached_input_sections): Check if input section
3372 must be reordered.
3373 * output.h (Output_section::update_section_layout): New function.
3374 * plugin.cc (get_section_count): New function.
3375 (get_section_type): New function.
3376 (get_section_name): New function.
3377 (get_section_contents): New function.
3378 (update_section_order): New function.
3379 (allow_section_ordering): New function.
3380 (Plugin::load): Add the new interfaces to the transfer vector.
3381 (Plugin_manager::load_plugins): New parameter.
3382 (Plugin_manager::all_symbols_read): New parameter.
3383 (Plugin_manager::claim_file): New parameter. Save the elf object for
3384 unclaimed objects.
3385 (Plugin_manager::get_elf_object): New function.
3386 (Plugin_manager::get_view): Change to directly use the bool to check
3387 if get_view is called from claim_file_hook.
3388 * plugin.h (input_objects): New function
3389 (Plugin__manager::load_plugins): New parameter.
3390 (Plugin_manager::claim_file): New parameter.
3391 (Plugin_manager::get_elf_object): New function.
3392 (Plugin_manager::in_claim_file_handler): New function.
3393 (Plugin_manager::in_claim_file_handler_): New member.
3394 (layout): New function.
3395 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3396 handler with an extra parameter. Make the elf object before calling
3397 claim_file handler.
3398 * testsuite/plugin_test.c (get_section_count): New function pointer.
3399 (get_section_type): New function pointer.
3400 (get_section_name): New function pointer.
3401 (get_section_contents): New function pointer.
3402 (update_section_order): New function pointer.
3403 (allow_section_ordering): New function pointer.
3404 (onload): Check if the new interfaces exist.
3405
3406 2011-07-13 Ian Lance Taylor <iant@google.com>
3407
3408 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3409 relro section.
3410 * x86_64.cc (Target_x86_64::got_section): Likewise.
3411 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3412 (relro_now_test_SOURCES): New variable.
3413 (relro_now_test_DEPENDENCIES): New variable.
3414 (relro_now_test_LDFLAGS): New variable.
3415 (relro_now_test_LDADD): New variable.
3416 (relro_now_test.so): New target.
3417 * testsuite/Makefile.in: Rebuild.
3418
3419 2011-07-12 Ian Lance Taylor <iant@google.com>
3420
3421 PR gold/12980
3422 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3423 GLOB_DAT relocation rather than a RELATIVE relocation for a
3424 protected symbol when creating a shared library.
3425 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3426 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3427 * testsuite/protected_main_1.cc (main): Test that protected
3428 function has same address.
3429
3430 2011-07-11 Ian Lance Taylor <iant@google.com>
3431
3432 PR gold/12979
3433 * options.h (class General_options): Add -Bgroup.
3434 * options.cc (General_options::finalize): If -Bgroup is set,
3435 default to --unresolved-symbols=report-all.
3436 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3437 * target-reloc.h (issue_undefined_symbol_error): Handle
3438 --unresolved-symbols=report-all.
3439
3440 2011-07-08 Ian Lance Taylor <iant@google.com>
3441
3442 PR gold/11985
3443 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3444 if linker script discards key sections.
3445 (Layout::create_dynamic_symtab): Likewise.
3446 (Layout::assign_local_dynsym_offsets): Likewise.
3447 (Layout::sized_create_version_sections): Likewise.
3448 (Layout::create_interp): Likewise.
3449 (Layout::finish_dynamic_section): Likewise.
3450 (Layout::set_dynamic_symbol_size): Likewise.
3451
3452 2011-07-08 Ian Lance Taylor <iant@google.com>
3453
3454 PR gold/12386
3455 * options.h (class General_options): Add --unresolved-symbols.
3456 * target-reloc.h (issue_undefined_symbol_error): Check
3457 --unresolved-symbols. Add comments.
3458
3459 2011-07-08 Ian Lance Taylor <iant@google.com>
3460
3461 * testsuite/odr_violation2.cc (Ordering::operator()): Make
3462 expression more complex.
3463
3464 2011-07-08 Ian Lance Taylor <iant@google.com>
3465
3466 PR gold/11317
3467 * target-reloc.h (issue_undefined_symbol_error): New inline
3468 function, broken out of relocate_section.
3469 (relocate_section): Call issue_undefined_symbol_error.
3470 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3471 there is no TLS segment if we are about to issue an undefined
3472 symbol error.
3473 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3474
3475 2011-07-08 Ian Lance Taylor <iant@google.com>
3476
3477 PR gold/12279
3478 * resolve.cc (Symbol_table::should_override): Add fromtype
3479 parameter. Change all callers. Give error when linking together
3480 TLS and non-TLS symbol.
3481 (Symbol_table::should_override_with_special): Add fromtype
3482 parameter. Change all callers.
3483 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3484 there is no TLS segment if we have reported some errors.
3485 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3486
3487 2011-07-08 Ian Lance Taylor <iant@google.com>
3488
3489 PR gold/12372
3490 * target.h (Target::plt_address_for_global): New function.
3491 (Target::plt_address_for_local): New function.
3492 (Target::plt_section_for_global): Remove.
3493 (Target::plt_section_for_local): Remove.
3494 (Target::do_plt_address_for_global): New virtual function.
3495 (Target::do_plt_address_for_local): New virtual function.
3496 (Target::do_plt_section_for_global): Remove.
3497 (Target::do_plt_section_for_local): Remove.
3498 (Target::register_global_plt_entry): Add Symbol_table and Layout
3499 parameters.
3500 * output.cc (Output_data_got::Got_entry::write): Use
3501 plt_address_for_global and plt_address_for_local.
3502 * layout.cc (Layout::add_target_dynamic_tags): Use size and
3503 address of output section.
3504 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3505 got_irelative_, and irelative_count_ fields. Update
3506 declarations.
3507 (Output_data_plt_i386::has_irelative_section): New function.
3508 (Output_data_plt_i386::entry_count): Add irelative_count_.
3509 (Output_data_plt_i386::set_final_data_size): Likewise.
3510 (class Target_i386): Add got_irelative_ and rel_irelative_
3511 fields. Update declarations.
3512 (Target_i386::Target_i386): Initialize new fields.
3513 (Target_i386::do_plt_address_for_global): New function replacing
3514 do_plt_section_for_global.
3515 (Target_i386::do_plt_address_for_local): New function replacing
3516 do_plt_section_for_local.
3517 (Target_i386::got_section): Create got_irelative_.
3518 (Target_i386::rel_irelative_section): New function.
3519 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3520 fields. Don't define __rel_iplt_{start,end}.
3521 (Output_data_plt_i386::add_entry): Add symtab and layout
3522 parameters. Change all callers. Use different PLT and GOT for
3523 IFUNC symbols.
3524 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3525 layout parameters. Change all callers. Use different PLT and
3526 GOT.
3527 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3528 (Output_data_plt_i386::rel_irelative): New function.
3529 (Output_data_plt_i386::address_for_global): New function.
3530 (Output_data_plt_i386::address_for_local): New function.
3531 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
3532 IRELATIVE GOT when changing IFUNC GOT entries.
3533 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3534 reloc.
3535 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3536 if we didn't create an IRELATIVE GOT.
3537 (Target_i386::Relocate::relocate): Use plt_address_for_global and
3538 plt_address_for_local.
3539 (Target_i386::do_dynsym_value): Use plt_address_for_global.
3540 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3541 got_irelative_, and irelative_count_ fields. Update
3542 declarations.
3543 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3544 Initialize new fields. Remove symtab parameter. Change all
3545 callers.
3546 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3547 irelative_count_.
3548 (Output_data_plt_x86_64::has_irelative_section): New function.
3549 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3550 (class Target_x86_64): Add got_irelative_ and rel_irelative_
3551 fields. Update declarations.
3552 (Target_x86_64::Target_x86_64): Initialize new fields.
3553 (Target_x86_64::do_plt_address_for_global): New function replacing
3554 do_plt_section_for_global.
3555 (Target_x86_64::do_plt_address_for_local): New function replacing
3556 do_plt_section_for_local.
3557 (Target_x86_64::got_section): Create got_irelative_.
3558 (Target_x86_64::rela_irelative_section): New function.
3559 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
3560 all callers. Don't create __rel_iplt_{start,end}.
3561 (Output_data_plt_x86_64::add_entry): Add symtab and layout
3562 parameters. Change all callers. Use different PLT and GOT for
3563 IFUNC symbols.
3564 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3565 layout parameters. Change all callers. Use different PLT and
3566 GOT.
3567 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3568 parameters. Change all callers. Use different PLT and GOT for
3569 IFUNC symbols.
3570 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3571 (Output_data_plt_x86_64::rela_irelative): New function.
3572 (Output_data_plt_x86_64::address_for_global): New function.
3573 (Output_data_plt_x86_64::address_for_local): New function.
3574 (Output_data_plt_x86_64::set_final_data_size): Likewise.
3575 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3576 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3577 (Target_x86_64::register_global_plt_entry): Add symtab and layout
3578 parameters.
3579 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3580 reloc.
3581 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3582 symbols if we didn't create an IRELATIVE GOT.
3583 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3584 plt_address_for_local.
3585 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3586 * testsuite/ifuncvar1.c: New test file.
3587 * testsuite/ifuncvar2.c: New test file.
3588 * testsuite/ifuncvar3.c: New test file.
3589 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3590 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3591 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3592 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3593 * testsuite/Makefile.in: Rebuild.
3594
3595 2011-07-07 Cary Coutant <ccoutant@google.com>
3596
3597 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3598 (two_file_test_1_ndebug.o): Likewise.
3599 (two_file_test_1b_ndebug.o): Likewise.
3600 (two_file_test_2_ndebug.o): Likewise.
3601 (two_file_test_main_ndebug.o): Likewise.
3602 (incremental_test_2): Link with no-debug versions.
3603
3604 2011-07-06 Cary Coutant <ccoutant@google.com>
3605
3606 * gold/incremental.cc
3607 (Output_section_incremental_inputs::write_info_blocks): Check for
3608 hidden and internal symbols.
3609
3610 2011-07-06 Cary Coutant <ccoutant@google.com>
3611
3612 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3613 Check disposition for startup file.
3614 (Incremental_inputs::report_command_line): Ignore
3615 --incremental-startup-unchanged option.
3616 * options.cc (General_options::parse_incremental_startup_unchanged):
3617 New function.
3618 (General_options::General_options): Initialize new data member.
3619 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3620 (General_options): Add --incremental-startup-unchanged option.
3621 (General_options::incremental_startup_disposition): New function.
3622 (General_options::incremental_startup_disposition_): New data member.
3623
3624 2011-07-06 Cary Coutant <ccoutant@google.com>
3625
3626 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3627 input file index to Script_info ctor.
3628 (Sized_incremental_binary::do_file_has_changed): Find the
3629 command-line argument for files named in scripts.
3630 * incremental.h (Script_info::Script_info): New ctor
3631 with input file index.
3632 (Script_info::input_file_index): New function.
3633 (Script_info::input_file_index_): New data member.
3634 (Incremental_binary::get_library): Add const.
3635 (Incremental_binary::get_script_info): Add const.
3636 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3637 * testsuite/Makefile.am (incremental_test_5): New test case.
3638 (incremental_test_6): New test case.
3639 * testsuite/Makefile.in: Regenerate.
3640
3641 2011-07-06 Cary Coutant <ccoutant@google.com>
3642
3643 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3644 debug output when command lines differ.
3645
3646 2011-07-06 Cary Coutant <ccoutant@google.com>
3647
3648 * incremental.cc (Incremental_inputs::report_command_line): Ignore
3649 --incremental-patch option.
3650 * layout.cc (Free_list::allocate): Extend allocation beyond original
3651 end if enabled.
3652 (Layout::make_output_section): Mark sections that should get
3653 patch space.
3654 * options.cc (parse_percent): New function.
3655 * options.h (parse_percent): New function.
3656 (DEFINE_percent): New macro.
3657 (General_options): Add --incremental-patch option.
3658 * output.cc (Output_section::Output_section): Initialize new data
3659 members.
3660 (Output_section::add_input_section): Print section name when out
3661 of patch space.
3662 (Output_section::add_output_section_data): Likewise.
3663 (Output_section::set_final_data_size): Add patch space when
3664 doing --incremental-full.
3665 (Output_section::do_reset_address_and_file_offset): Remove patch
3666 space.
3667 (Output_segment::set_section_list_addresses): Print debug output
3668 only if --incremental-update.
3669 * output.h (Output_section::set_is_patch_space_allowed): New function.
3670 (Output_section::is_patch_space_allowed_): New data member.
3671 (Output_section::patch_space_): New data member.
3672 * parameters.cc (Parameters::incremental_full): New function.
3673 * parameters.h (Parameters::incremental_full): New function
3674 * testsuite/Makefile.am (incremental_test_2): Add test for
3675 --incremental-patch option.
3676 * testsuite/Makefile.in: Regenerate.
3677 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3678 (t18): Remove function body.
3679
3680 2011-07-05 Doug Kwan <dougkwan@google.com>
3681
3682 PR gold/12771
3683 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3684 Arm_Address type for relocation result.
3685 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
3686 overflow check.
3687 (Arm_relocate_functions::abs32): Use unaligned access.
3688 (Arm_relocate_functions::rel32): Ditto.
3689 (Arm_relocate_functions::prel31): Ditto.
3690 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3691 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3692 static data relocations.
3693 * testsuite/Makefile.in: Regnerate.
3694 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3695
3696 2011-07-05 Ian Lance Taylor <iant@google.com>
3697
3698 PR gold/12392
3699 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3700 symbols if necessary.
3701 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3702
3703 2011-07-05 Ian Lance Taylor <iant@google.com>
3704
3705 PR gold/12952
3706 * resolve.cc (Symbol::override_base_with_special): Simply override
3707 version with special symbol version, ignoring previous version.
3708
3709 2011-07-05 Ian Lance Taylor <iant@google.com>
3710
3711 * object.cc (Sized_relobj_file::include_section_group): Add
3712 information to comment about signature location.
3713
3714 2011-07-02 Ian Lance Taylor <iant@google.com>
3715
3716 PR gold/12957
3717 * options.h (class General_options): Add -f and -F.
3718 * options.cc (General_options::finalize): Fatal error if -f/-F
3719 are used without -shared.
3720 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3721
3722 2011-07-02 Ian Lance Taylor <iant@google.com>
3723
3724 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3725
3726 2011-07-01 Ian Lance Taylor <iant@google.com>
3727
3728 PR gold/12525
3729 PR gold/12952
3730 * resolve.cc (Symbol::override_base_with_special): Don't override
3731 the version if the overriding symbol has a different name.
3732 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
3733 all callers. If we give an error about an undefined version,
3734 define the base version if necessary.
3735 * dynobj.h (class Versions): Update declaration.
3736 * testsuite/weak_alias_test_5.cc: New file.
3737 * testsuite/weak_alias_test.script: New file.
3738 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3739 and versioned_alias have the right value, and call t2.
3740 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3741 weak_alias_test_5.so.
3742 (weak_alias_test_LDADD): Likewise.
3743 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3744 * testsuite/Makefile.in: Rebuild.
3745
3746 2011-07-01 Ian Lance Taylor <iant@google.com>
3747
3748 PR gold/12525
3749 * options.h (class General_options): Support -z notext.
3750 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3751 -Wl,-z,notext.
3752 (two_file_shared_nonpic.so): Likewise.
3753 (two_file_shared_mixed.so): Likewise.
3754 (two_file_shared_mixed_1.so): Likewise.
3755 (weak_undef_lib_nonpic.so): Likewise.
3756 (alt/weak_undef_lib_nonpic.so): Likewise.
3757 (tls_test_shared_nonpic.so): Likewise.
3758 * testsuite/Makefile.in: Rebuild.
3759
3760 2011-07-01 Ian Lance Taylor <iant@google.com>
3761
3762 PR gold/12525
3763 * configure.ac: Test whether static linking works, setting
3764 the automake conditional HAVE_STATIC.
3765 * testsuite/Makefile.am: Disable tests using -static if
3766 HAVE_STATIC is not true.
3767 * configure, testsuite/Makefile.in: Rebuild.
3768
3769 2011-07-01 Ian Lance Taylor <iant@google.com>
3770
3771 PR gold/12525
3772 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3773 Assert if we see DW_EH_PE_indirect.
3774 * target.h (Target::ehframe_datarel_base): New function.
3775 (Target::do_ehframe_datarel_base): New target function.
3776 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3777 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3778 function.
3779
3780 2011-07-01 Ian Lance Taylor <iant@google.com>
3781
3782 PR gold/12571
3783 * options.h (class General_options): Add
3784 --ld-generated-unwind-info.
3785 * ehframe.cc (Fde::write): Add address parameter. Change all
3786 callers. If associated with PLT, fill in address and size.
3787 (Cie::set_output_offset): Only add merge mapping if there is an
3788 object.
3789 (Cie::write): Add address parameter. Change all callers.
3790 (Eh_frame::add_ehframe_for_plt): New function.
3791 * ehframe.h (class Fde): Update declarations. Move shndx_ and
3792 input_offset_ fields into union u_, with new plt field.
3793 (Fde::Fde): Adjust for new union field.
3794 (Fde::Fde) [Output_data version]: New constructor.
3795 (Fde::add_mapping): Only add merge mapping if there is an object.
3796 (class Cie): Update declarations.
3797 (class Eh_frame): Declare add_ehframe_for_plt.
3798 * layout.cc (Layout::layout_eh_frame): Break out code into
3799 make_eh_frame_section, and call it.
3800 (Layout::make_eh_frame_section): New function.
3801 (Layout::add_eh_frame_for_plt): New function.
3802 * layout.h (class Layout): Update declarations.
3803 * merge.cc (Merge_map::add_mapping): Add assertion.
3804 * i386.cc: Include "dwarf.h".
3805 (class Output_data_plt_i386): Make first_plt_entry,
3806 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
3807 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3808 and plt_eh_frame_fde.
3809 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3810 boundary. Call add_eh_frame_for_plt if appropriate.
3811 * x86_64.cc: Include "dwarf.h".
3812 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
3813 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
3814 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3815 and plt_eh_frame_fde.
3816 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3817 appropriate.
3818
3819 2011-06-29 Ian Lance Taylor <iant@google.com>
3820
3821 PR gold/12629
3822 * object.cc (Sized_relobj_file::layout_section): Change shdr
3823 parameter to be const.
3824 (Sized_relobj_file::layout_eh_frame_section): New function, broken
3825 out of do_layout.
3826 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3827 appropriate. Call layout_eh_frame_section.
3828 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3829 sections.
3830 * object.h (class Sized_relobj_file): Update declarations.
3831
3832 2011-06-29 Ian Lance Taylor <iant@google.com>
3833
3834 PR gold/12652
3835 * script.cc (Token::integer_value): Accept trailing M/m/K/k
3836 modifier.
3837 (Lex::gather_token): Accept trailing M/m/K/k for integers.
3838
3839 2011-06-29 Ian Lance Taylor <iant@google.com>
3840
3841 PR gold/12675
3842 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3843 SHT_X86_64_UNWIND.
3844 * layout.cc (Layout::layout_eh_frame): Likewise.
3845
3846 2011-06-29 Ian Lance Taylor <iant@google.com>
3847
3848 PR gold/12695
3849 * layout.cc (Layout::symtab_section_shndx): New function.
3850 * layout.h (class Layout): Declare symtab_section_shndx.
3851 * output.cc (Output_section::write_header): Call it.
3852
3853 2011-06-29 Ian Lance Taylor <iant@google.com>
3854
3855 PR gold/12818
3856 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3857 symbols which are not used in a relocation.
3858
3859 2011-06-28 Ian Lance Taylor <iant@google.com>
3860
3861 PR gold/12898
3862 * layout.cc (Layout::segment_precedes): Don't crash if a linker
3863 script create indistinguishable segments.
3864 (Layout::set_segment_offsets): Use stable_sort when sorting
3865 segments. Pass this to Compare_segments constructor.
3866 * layout.h (class Layout): Make segment_precedes non-static.
3867 (class Compare_segments): Change from struct to class. Add
3868 layout_ field. Add constructor.
3869 * script-sections.cc
3870 (Script_sections::attach_sections_using_phdrs_clause): Rename
3871 local orphan to is_orphan. Don't report failure to put empty
3872 section in segment. On attachment failure, report name of
3873 section, and attach to first PT_LOAD segment.
3874
3875 2011-06-28 Ian Lance Taylor <iant@google.com>
3876
3877 PR gold/12934
3878 * target-select.cc (Target_selector::Target_selector): Add
3879 emulation parameter. Change all callers.
3880 (select_target_by_bfd_name): Rename from select_target_by_name.
3881 Change all callers.
3882 (select_target_by_emulation): New function.
3883 (supported_emulation_names): New function.
3884 * target-select.h (class Target_selector): Add emulation_ field.
3885 Update declarations.
3886 (Target_selector::recognize_by_bfd_name): Rename from
3887 recognize_by_name. Change all callers.
3888 (Target_selector::supported_bfd_names): Rename from
3889 supported_names. Change all callers.
3890 (Target_selector::recognize_by_emulation): New function.
3891 (Target_selector::supported_emulations): New function.
3892 (Target_selector::emulation): New function.
3893 (Target_selector::do_recognize_by_bfd_name): Rename from
3894 do_recognize_by_name. Change all callers.
3895 (Target_selector::do_supported_bfd_names): Rename from
3896 do_supported_names. Change all callers.
3897 (Target_selector::do_recognize_by_emulation): New function.
3898 (Target_selector::do_supported_emulations): New function.
3899 (select_target_by_bfd_name): Change name in declaration.
3900 (select_target_by_emulation): Declare.
3901 (supported_emulation_names): Declare.
3902 * parameters.cc (parameters_force_valid_target): Try to find
3903 target based on emulation from -m option.
3904 * options.h (class General_options): Change doc string for -m.
3905 * options.cc (help): Print emulations.
3906 (General_options::parse_V): Likewise.
3907 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3908 Add emulation parameter. Change all callers.
3909
3910 2011-06-28 Ian Lance Taylor <iant@google.com>
3911
3912 * target.h (class Target): Add osabi_ field.
3913 (Target::osabi): New function.
3914 (Target::set_osabi): New function.
3915 (Target::Target): Initialize osabi_.
3916 (Target::do_adjust_elf_header): Make pure virtual.
3917 (Sized_target::do_adjust_elf_header): Declare.
3918 * target.cc (Sized_target::do_adjust_elf_header): New function.
3919 (class Sized_target): Instantiate all versions.
3920 * freebsd.h (class Target_freebsd): Remove.
3921 (Target_selector_freebsd::do_recognize): Call set_osabi on
3922 Target.
3923 (Target_selector_freebsd::do_recognize_by_name): Likewise.
3924 (Target_selector_freebsd::set_osabi): Remove.
3925 * i386.cc (class Target_i386): Inherit from Sized_target rather
3926 than Target_freebsd.
3927 * x86_64.cc (class Target_x86_64): Likewise.
3928
3929 2011-06-28 Ian Lance Taylor <iant@google.com>
3930
3931 * target.h (Target::can_check_for_function_pointers): Rewrite.
3932 Make non-virtual.
3933 (Target::can_icf_inline_merge_sections): Likewise.
3934 (Target::section_may_have_icf_unsafe_poineters): Likewise.
3935 (Target::Target_info): Add can_icf_inline_merge_sections field.
3936 (Target::do_can_check_for_function_pointers): New virtual
3937 function.
3938 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3939 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3940 from can_check_for_function_pointers, move in file.
3941 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3942 section_may_have_icf_unsafe_poineters, move in file.
3943 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3944 * i386.cc (Target_i386::do_can_check_for_function_pointers):
3945 Rename from can_check_for_function_pointers, move in file.
3946 (Target_i386::can_icf_inline_merge_sections): Remove.
3947 (Target_i386::i386_info): Initialize
3948 can_icf_inline_merge_sections.
3949 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3950 Initialize can_icf_inline_merge_sections.
3951 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3952 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3953 Rename from can_check_for_function_pointers, move in file.
3954 (Target_x86_64::can_icf_inline_merge_sections): Remove.
3955 (Target_x86_64::x86_64_info): Initialize
3956 can_icf_inline_merge_sections.
3957 * testsuite/testfile.cc (Target_test::test_target_info):
3958 Likewise.
3959 * icf.cc (get_section_contents): Correct formatting.
3960
3961 2011-06-27 Ian Lance Taylor <iant@google.com>
3962
3963 * symtab.cc (Symbol::versioned_name): New function.
3964 (Symbol_table::add_to_final_symtab): Use versioned_name when
3965 appropriate.
3966 (Symbol_table::sized_write_symbol): Likewise.
3967 * symtab.h (class Symbol): Declare versioned_name.
3968 * stringpool.h (class Stringpool_template): Add variant of add
3969 which takes a std::basic_string.
3970 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3971 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3972 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3973 (ver_test_12.o): New target.
3974 * testsuite/Makefile.in: Rebuild.
3975
3976 2011-06-27 Doug Kwan <dougkwan@google.com>
3977
3978 * arm.cc (Arm_relocate_functions::thm_jump8,
3979 Arm_relocate_functions::thm_jump11): Use a wider signed
3980 type to compute offset.
3981 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3982 arm_thm_jump8.
3983 * testsuite/Makefile.in: Regenerate.
3984 * testsuite/arm_branch_in_range.sh: Check test results of
3985 arm_thm_jump11 and arm_thm_jump8.
3986 * testsuite/arm_thm_jump11.s: New test source file.
3987 * testsuite/arm_thm_jump11.t: New linker script.
3988 * testsuite/arm_thm_jump8.s: New test source file.
3989 * testsuite/arm_thm_jump8.t: New linker script.
3990
3991 2011-06-24 Ian Lance Taylor <iant@google.com>
3992
3993 * layout.cc: Include "object.h".
3994 (ctors_sections_in_init_array): New static variable.
3995 (Layout::is_ctors_in_init_array): New function.
3996 (Layout::layout): Add entry to ctors_sections_in_init_array if
3997 appropriate.
3998 * layout.h (class Layout): Declare is_ctors_in_init_array.
3999 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4000 is_ctors_reverse_view is set.
4001 (Sized_relobj_file::write_sections): Add layout parameter. Change
4002 all callers. Set is_ctors_reverse_view field of View_size.
4003 (Sized_relobj_file::reverse_words): New function.
4004 * object.h (Sized_relobj_file::View_size): Add
4005 is_ctors_reverse_view field.
4006 (class Sized_relobj_file): Update declarations.
4007 * testsuite/initpri3.c: New test.
4008 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4009 initpri3b.
4010 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4011 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4012 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4013 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4014 * testsuite/Makefile.in: Rebuild.
4015
4016 2011-06-24 Cary Coutant <ccoutant@google.com>
4017
4018 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4019 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4020 (debug_msg_cdebug.err): New targets.
4021 * testsuite/Makefile.in: Regenerate.
4022 * testsuite/debug_msg.sh: Check output of link with compressed debug.
4023 Fix checks for link with shared library.
4024
4025 2011-06-24 Doug Kwan <dougkwan@google.com>
4026
4027 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4028 skip empty text sections.
4029 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4030
4031 2011-06-22 Ian Lance Taylor <iant@google.com>
4032
4033 PR gold/12910
4034 * options.h (class General_options): Add --ctors-in-init-array.
4035 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4036 friends as SHT_PROGBITS for merging sections.
4037 (Layout::layout): Remove special handling of .init_array and
4038 friends. Don't sort if doing relocatable link. Sort for .ctors
4039 and .dtors if ctors_in_init_array.
4040 (Layout::make_output_section): Force correct section types for
4041 .init_array and friends. Don't sort if doing relocatable link,
4042 Don't sort .ctors and .dtors if ctors_in_init_array.
4043 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4044 (Layout::output_section_name): Add relobj parameter. Change all
4045 callers. Handle .ctors. and .dtors. in code rather than table.
4046 Handle .ctors and .dtors if ctors_in_init_array.
4047 (Layout::match_file_name): New function, moved from output.cc.
4048 * layout.h (class Layout): Update declarations.
4049 * output.cc: Include "layout.h".
4050 (Input_section_sort_entry::get_priority): New function.
4051 (Input_section_sort_entry::match_file_name): Just call
4052 Layout::match_file_name.
4053 (Output_section::Input_section_sort_init_fini_compare::operator()):
4054 Handle .ctors and .dtors. Sort by explicit priority rather than
4055 by name.
4056 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4057 * testsuite/initpri2.c: New test.
4058 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4059 (check_PROGRAMS): Add initpri2.
4060 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4061 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4062 * configure, testsuite/Makefile.in: Rebuild.
4063
4064 2011-06-19 Ian Lance Taylor <iant@google.com>
4065
4066 PR gold/12880
4067 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4068 .interp section to a PT_INTERP segment even if we have seen a
4069 --dynamic-linker option. Don't do it if we have seen a PHDRS
4070 clause in a linker script.
4071 (Layout::finalize): Don't create a .interp section if we've
4072 already create a PT_INTERP segment.
4073 (Layout::create_interp): Always call choose_output_section (revert
4074 patch of 2011-06-17). Don't create PT_INTERP segment.
4075 * script-sections.cc
4076 (Script_sections::create_note_and_tls_segments): Add a .interp
4077 section to a PT_INTERP segment even if we have seen a
4078 --dynamic-linker option.
4079
4080 2011-06-18 Ian Lance Taylor <iant@google.com>
4081
4082 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4083 merely because a non-PT_LOAD segment has a dynamic reloc.
4084
4085 2011-06-18 Ian Lance Taylor <iant@google.com>
4086
4087 * layout.cc (Layout::finish_dynamic_section): Don't create
4088 DT_FLAGS entry if not needed.
4089
4090 2011-06-18 Ian Lance Taylor <iant@google.com>
4091
4092 PR gold/12745
4093 * layout.cc (Layout::layout_eh_frame): Correct handling of
4094 writable .eh_frame section.
4095
4096 2011-06-17 Ian Lance Taylor <iant@google.com>
4097
4098 PR gold/12893
4099 * resolve.cc (Symbol_table::resolve): Don't give an error if a
4100 symbol is redefined with the exact same object and value.
4101
4102 2011-06-17 Ian Lance Taylor <iant@google.com>
4103
4104 PR gold/12880
4105 * layout.h (class Layout): Add interp_segment_ field.
4106 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4107 (Layout::attach_allocated_section_to_segment): If making shared
4108 library, put .interp section in PT_INTERP segment.
4109 (Layout::finalize): Also call create_interp if -dynamic-linker
4110 option was used.
4111 (Layout::create_interp): Assert that there is no PT_INTERP
4112 segment. If not using a SECTIONS clause, use make_output_section.
4113 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4114 * script-sections.cc
4115 (Script_sections::create_note_and_tls_segments): If making shared
4116 library, put .interp section in PT_INTERP segment.
4117
4118 2011-06-17 Ian Lance Taylor <iant@google.com>
4119
4120 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4121 when making a shared library.
4122
4123 2011-06-17 Ian Lance Taylor <iant@google.com>
4124
4125 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4126 parameter. Change all callers. Don't issue warning about PC32
4127 against locally defined symbol.
4128
4129 2011-06-16 Ian Lance Taylor <iant@google.com>
4130
4131 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4132 occurs in same object.
4133
4134 2011-06-14 Alan Modra <amodra@gmail.com>
4135
4136 * po/POTFILES.in: Regenerate.
4137
4138 2011-06-09 Ian Lance Taylor <iant@google.com>
4139
4140 * script-sections.cc
4141 (Orphan_output_section::set_section_addresses): For a relocatable
4142 link set address to 0.
4143
4144 2011-06-09 Cary Coutant <ccoutant@google.com>
4145
4146 PR gold/12804
4147 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4148 used with --compress-debug-sections.
4149 * gold/object.cc (Sized_relobj_file::do_layout): Report
4150 uncompressed size of compressed input sections.
4151
4152 2011-06-08 Cary Coutant <ccoutant@google.com>
4153
4154 PR gold/12804
4155 * testsuite/two_file_test_2_v1.cc: Change initialization of
4156 v2 to keep it in .data.
4157
4158 2011-06-07 Cary Coutant <ccoutant@google.com>
4159
4160 * common.cc (Symbol_table::do_allocate_commons_list): Call
4161 gold_fallback.
4162 * errors.cc (Errors::fatal): Adjust call to gold_exit.
4163 (Errors::fallback): New function.
4164 (gold_fallback): New function.
4165 * errors.h (Errors::fallback): New function.
4166 * gold.cc (gold_exit): Change status parameter to enum; adjust
4167 all callers.
4168 (queue_initial_tasks): Call gold_fallback.
4169 * gold.h: Include cstdlib.
4170 (Exit_status): New enum type.
4171 (gold_exit): Change status parameter to enum.
4172 (gold_fallback): New function.
4173 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4174 (Layout::create_symtab_sections): Likewise.
4175 (Layout::create_shdrs): Likewise.
4176 * main.cc (main): Adjust call to gold_exit.
4177 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4178 (Output_data_got::add_got_entry_pair): Likewise.
4179 (Output_section::add_input_section): Likewise.
4180 (Output_section::add_output_section_data): Likewise.
4181 (Output_segment::set_section_list_addresses): Likewise.
4182 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4183
4184 2011-06-07 Cary Coutant <ccoutant@google.com>
4185
4186 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4187 for incremental links.
4188 * output.cc (Output_segment::set_section_list_addresses): Remove
4189 FIXME and test for TLS or BSS.
4190
4191 2011-06-07 Cary Coutant <ccoutant@google.com>
4192
4193 * testsuite/Makefile.am: Add incremental_copy_test,
4194 incremental_common_test_1.
4195 * testsuite/Makefile.in: Regenerate.
4196 * testsuite/common_test_1_v1.c: New source file.
4197 * testsuite/common_test_1_v2.c: New source file.
4198 * testsuite/copy_test_v1.cc: New source file.
4199
4200 2011-06-07 Cary Coutant <ccoutant@google.com>
4201
4202 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4203 update, allocate common from bss section's free list.
4204 * incremental-dump.cc (dump_incremental_inputs): Print flag for
4205 linker-defined symbols.
4206 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4207 Skip GOT and PLT entries that are no longer referenced.
4208 (Output_section_incremental_inputs::write_info_blocks): Mark
4209 linker-defined symbols.
4210 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4211 * output.cc (Output_section::allocate): New function.
4212 * output.h (Output_section::allocate): New function.
4213 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4214 linker-defined symbols.
4215 (Symbol::override_base_with_special): Copy is_predefined_ flag.
4216 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4217 (Symbol::init_base_output_data): Likewise.
4218 (Symbol::init_base_output_segment): Likewise.
4219 (Symbol::init_base_constant): Likewise.
4220 (Sized_symbol::init_output_data): Likewise.
4221 (Sized_symbol::init_output_segment): Likewise.
4222 (Sized_symbol::init_constant): Likewise.
4223 (Symbol_table::do_define_in_output_data): Likewise.
4224 (Symbol_table::do_define_in_output_segment): Likewise.
4225 (Symbol_table::do_define_as_constant): Likewise.
4226 * symtab.h (Symbol::is_predefined): New function.
4227 (Symbol::init_base_output_data): Add is_predefined parameter.
4228 (Symbol::init_base_output_segment): Likewise.
4229 (Symbol::init_base_constant): Likewise.
4230 (Symbol::is_predefined_): New data member.
4231 (Sized_symbol::init_output_data): Add is_predefined parameter.
4232 (Sized_symbol::init_output_segment): Likewise.
4233 (Sized_symbol::init_constant): Likewise.
4234 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4235
4236 2011-06-07 Cary Coutant <ccoutant@google.com>
4237
4238 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4239 instead of emit_copy_reloc.
4240 (Copy_relocs::emit_copy_reloc): Refactor.
4241 (Copy_relocs::make_copy_reloc): New function.
4242 (Copy_relocs::add_copy_reloc): Remove.
4243 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4244 section.
4245 (Copy_relocs::make_copy_reloc): New function.
4246 (Copy_relocs::add_copy_reloc): Remove.
4247 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4248 unchanged input files.
4249 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4250 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4251 Reserve BSS space for COPY relocations.
4252 (Sized_incremental_binary::do_emit_copy_relocs): New function.
4253 (Output_section_incremental_inputs::write_info_blocks): Record
4254 whether a symbol is copied from a shared object.
4255 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4256 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4257 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4258 (Incremental_input_entry_reader::get_output_symbol_index): Add
4259 is_copy parameter.
4260 (Incremental_binary::emit_copy_relocs): New function.
4261 (Incremental_binary::do_emit_copy_relocs): New function.
4262 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4263 new data member.
4264 (Sized_incremental_binary::add_copy_reloc): New function.
4265 (Sized_incremental_binary::do_emit_copy_relocs): New function.
4266 (Sized_incremental_binary::Copy_reloc): New struct.
4267 (Sized_incremental_binary::Copy_relocs): New typedef.
4268 (Sized_incremental_binary::copy_relocs_): New data member.
4269 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4270 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4271 * target.h (Sized_target::emit_copy_reloc): New function.
4272 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4273
4274 2011-06-02 Cary Coutant <ccoutant@google.com>
4275
4276 PR gold/12163
4277 * gold/archive.cc (Archive::Archive): Initialize new data member.
4278 (Archive::include_all_members): Return if archive has already been
4279 included.
4280 * gold/archive.h (Archive::include_all_members_): New data member.
4281
4282 2011-06-02 Nick Clifton <nickc@redhat.com>
4283
4284 * dynobj.h: Fix spelling mistake in comment.
4285 * output.cc: Likewise.
4286
4287 2011-05-31 Doug Kwan <dougkwan@google.com>
4288 Asier Llano
4289
4290 PR gold/12826
4291 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4292 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4293 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
4294 redundant arm_exidx_test.so.
4295 * testsuite/Makefile.in: Regenerate.
4296 (check_SCRIPTS): Add pr12826.sh
4297 (check_DATA): Add pr12826.stdout
4298 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4299 * testsuite/pr12826.sh: New file.
4300 * testsuite/pr12826_1.s: Ditto.
4301 * testsuite/pr12826_1.s: Ditto.
4302
4303 2011-05-30 Ian Lance Taylor <iant@google.com>
4304
4305 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4306 sections.
4307
4308 2011-05-29 Ian Lance Taylor <iant@google.com>
4309
4310 PR gold/12804
4311 * testsuite/Makefile.am: Use different file name for two_file_test
4312 temporary file for each incremental test.
4313 * testsuite/Makefile.in: Rebuild.
4314
4315 2011-05-29 Ian Lance Taylor <iant@google.com>
4316
4317 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4318 binary input file is empty.
4319
4320 2011-05-27 Ian Lance Taylor <iant@google.com>
4321
4322 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4323 (ver_test_9.so): Likewise.
4324 * testsuite/Makefile.in: Rebuild.
4325
4326 2011-05-26 Cary Coutant <ccoutant@google.com>
4327
4328 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4329 * incremental.cc (Incremental_inputs::report_input_section): Fix
4330 comment, indentation.
4331 (Incremental_inputs::report_comdat_group): New function.
4332 (Output_section_incremental_inputs::set_final_data_size): Adjust size
4333 of data for incremental input file entry.
4334 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4335 group count, COMDAT group signatures.
4336 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4337 an unchanged input file.
4338 * incremental.h (Incremental_object_entry::Incremental_object_entry):
4339 Initialize new data member.
4340 (Incremental_object_entry::add_comdat_group): New function.
4341 (Incremental_object_entry::get_comdat_group_count): New function.
4342 (Incremental_object_entry::get_comdat_signature_key): New function.
4343 (Incremental_object_entry::groups_): New data member.
4344 (Incremental_inputs::report_comdat_group): New function.
4345 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4346 data for incremental input file entry.
4347 (Incremental_input_entry_reader::get_comdat_group_count): New function.
4348 (Incremental_input_entry_reader::get_input_section): Adjust size of
4349 data for incremental input file entry.
4350 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4351 (Incremental_input_entry_reader::get_comdat_group_signature): New
4352 function.
4353 * object.cc (Sized_relobj::include_section_group): Report kept
4354 COMDAT groups for incremental links.
4355
4356 2011-05-24 David Meyer <pdox@google.com>
4357
4358 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4359 with name parameter. Add found_name parameter.
4360 * fileread.cc (Input_file::find_file): Adjust code accordingly.
4361 * dirsearch.h (class Dirsearch): Update declaration.
4362
4363 2011-05-24 Ian Lance Taylor <iant@google.com>
4364
4365 * archive.cc (Library_base::should_include_member): Pull in object
4366 from archive if it defines the entry symbol.
4367 * parameters.cc (Parameters::entry): New function.
4368 * parameters.h (class Parameters): Declare entry.
4369 * output.h (class Output_file_header): Remove entry_ field.
4370 * output.cc (Output_file_header::Output_file_header): Remove entry
4371 parameter. Change all callers.
4372 (Output_file_header::entry): Use parameters->entry.
4373 * gold.cc (queue_middle_tasks): Likewise.
4374 * plugin.cc (Plugin_hook::run): Likewise.
4375
4376 2011-05-24 Cary Coutant <ccoutant@google.com>
4377
4378 * gold.cc (queue_initial_tasks): Pass incremental base filename
4379 to Output_file::open_base_file; don't print error message.
4380 * incremental-dump.cc (main): Adjust call to
4381 Output_file::open_for_modification.
4382 * incremental-dump.cc (main): Likewise.
4383 * incremental.cc (Incremental_inputs::report_command_line):
4384 Ignore --incremental-base option when comparing command lines.
4385 Ignore parameter when given as separate argument.
4386 * options.h (class General_options): Add --incremental-base.
4387 * output.cc (Output_file::Output_file):
4388 (Output_file::open_base_file): Add base_name and writable parameters;
4389 read base file into new file; print error message here.
4390 (Output_file::map_no_anonymous): Add writable parameter; adjust all
4391 callers.
4392 * output.h (Output_file::open_for_modification): Rename to...
4393 (Output_file::open_base_file): ...this; add base_name and
4394 writable parameters; adjust all callers.
4395 (Output_file::map_no_anonymous): Add writable parameter; adjust all
4396 callers.
4397 * testsuite/Makefile.am (incremental_test_4): Test
4398 --incremental-base.
4399 * testsuite/Makefile.in: Regenerate.
4400
4401 2011-05-24 Cary Coutant <ccoutant@google.com>
4402
4403 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4404 incremental_test_4.
4405 * testsuite/Makefile.in: Regenerate.
4406 * testsuite/two_file_test_1_v1.cc: New test source file.
4407 * testsuite/two_file_test_1b_v1.cc: New test source file.
4408 * testsuite/two_file_test_2_v1.cc: New test source file.
4409
4410 2011-05-24 Cary Coutant <ccoutant@google.com>
4411
4412 * dynobj.h (Dynobj::do_dynobj): New function.
4413 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4414 flag and soname for shared objects.
4415 * incremental.cc (Incremental_inputs::report_object): Make
4416 either Incremental_object_entry or Incremental_dynobj_entry; add
4417 soname to string table.
4418 (Incremental_inputs::report_input_section): Add assertion.
4419 (Output_section_incremental_inputs::set_final_data_size): Adjust
4420 type of input file entry for shared libraries; adjust size of
4421 shared library info entry.
4422 (Output_section_incremental_inputs::write_input_files): Write
4423 as_needed flag for shared libraries.
4424 (Output_section_incremental_inputs::write_info_blocks): Adjust type
4425 of input file entry for shared libraries; write soname.
4426 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4427 soname from incremental info.
4428 * incremental.h (enum Incremental_input_flags): Add
4429 INCREMENTAL_INPUT_AS_NEEDED.
4430 (Incremental_input_entry::Incremental_input_entry): Initialize new
4431 data member.
4432 (Incremental_input_entry::set_as_needed): New function.
4433 (Incremental_input_entry::as_needed): New function.
4434 (Incremental_input_entry::do_dynobj_entry): New function.
4435 (Incremental_input_entry::as_needed_): New data member.
4436 (Incremental_object_entry::Incremental_object_entry): Don't check
4437 for shared library.
4438 (Incremental_object_entry::do_type): Likewise.
4439 (class Incremental_dynobj_entry): New class.
4440 (Incremental_input_entry_reader::as_needed): New function.
4441 (Incremental_input_entry_reader::get_soname): New function.
4442 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4443 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4444 size of shared library info entry.
4445 * layout.cc (Layout::finish_dynamic_section): Don't test for
4446 incremental link when adding DT_NEEDED entries.
4447 * object.h (Object::Object): Initialize new data member.
4448 (Object::dynobj): New function.
4449 (Object::set_as_needed): New function.
4450 (Object::as_needed): New function.
4451 (Object::do_dynobj): New function.
4452 (Object::as_needed_): New data member.
4453
4454 2011-05-24 Cary Coutant <ccoutant@google.com>
4455
4456 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4457 info; adjust display of GOT entries.
4458 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4459 vector of input objects; remove file_status_.
4460 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4461 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4462 got_plt reader; call target hooks to reserve GOT entries.
4463 (Output_section_incremental_inputs::set_final_data_size): Adjust size
4464 of input file info header and GOT info entry.
4465 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4466 relocation info.
4467 (Got_plt_view_info::got_descriptor): Remove.
4468 (Got_plt_view_info::sym_index): New data member.
4469 (Got_plt_view_info::input_index): New data member.
4470 (Local_got_offset_visitor::visit): Write input file index.
4471 (Global_got_offset_visitor::visit): Write 0 for input file index.
4472 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4473 with sym_index and input_index.
4474 (Output_section_incremental_inputs::write_got_plt): Adjust size of
4475 incremental info GOT entry; replace got_descriptor with input_index.
4476 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4477 map from input file index to object.
4478 (Sized_relobj_incr::do_layout): Replace direct data member reference
4479 with accessor function.
4480 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4481 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4482 Adjust size of input file info header.
4483 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4484 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4485 (Incremental_input_entry_reader::get_input_section): Adjust size of
4486 input file info header.
4487 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4488 of incremental info GOT entry.
4489 (Incremental_got_plt_reader::get_got_desc): Remove.
4490 (Incremental_got_plt_reader::get_got_symndx): New function.
4491 (Incremental_got_plt_reader::get_got_input_index): New function.
4492 (Sized_incremental_binary::Sized_incremental_binary): Remove
4493 file_status_; add input_objects_.
4494 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4495 (Sized_incremental_binary::set_file_is_unchanged): Remove.
4496 (Sized_incremental_binary::file_is_unchanged): Remove.
4497 (Sized_incremental_binary::set_input_object): New function.
4498 (Sized_incremental_binary::input_object): New function.
4499 (Sized_incremental_binary::file_status_): Remove.
4500 (Sized_incremental_binary::input_objects_): New data member.
4501 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4502 references.
4503 (Sized_relobj_incr::invalid_address): Move to base class.
4504 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4505 class.
4506 (Sized_relobj_incr::do_output_section_offset): Likewise.
4507 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4508 (Sized_relobj_incr::section_offsets_): Likewise.
4509 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4510 function.
4511 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4512 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4513 with accessor function.
4514 (Sized_relobj_file::do_layout): Likewise.
4515 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4516 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4517 (Sized_relobj_file::compute_final_local_value): Replace refs to
4518 section_offsets_ with accessor function.
4519 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4520 * object.h (Relobj::Relobj): Initialize new data members.
4521 (Relobj::add_dyn_reloc): New function.
4522 (Relobj::first_dyn_reloc): New function.
4523 (Relobj::dyn_reloc_count): New function.
4524 (Relobj::first_dyn_reloc_): New data member.
4525 (Relobj::dyn_reloc_count_): New data member.
4526 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4527 references.
4528 (Sized_relobj::Address): New typedef.
4529 (Sized_relobj::invalid_address): Move here from child class.
4530 (Sized_relobj::Sized_relobj): Initialize new data members.
4531 (Sized_relobj::sized_relobj): New function.
4532 (Sized_relobj::is_output_section_offset_invalid): Move here from
4533 child class.
4534 (Sized_relobj::get_output_section_offset): Likewise.
4535 (Sized_relobj::local_has_got_offset): Likewise.
4536 (Sized_relobj::local_got_offset): Likewise.
4537 (Sized_relobj::set_local_got_offset): Likewise.
4538 (Sized_relobj::do_for_all_local_got_entries): Likewise.
4539 (Sized_relobj::clear_got_offsets): New function.
4540 (Sized_relobj::section_offsets): Move here from child class.
4541 (Sized_relobj::do_output_section_offset): Likewise.
4542 (Sized_relobj::do_set_section_offset): Likewise.
4543 (Sized_relobj::Local_got_offsets): Likewise.
4544 (Sized_relobj::local_got_offsets_): Likewise.
4545 (Sized_relobj::section_offsets_): Likewise.
4546 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4547 references.
4548 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4549 class.
4550 (Sized_relobj_file::sized_relobj): New function
4551 (Sized_relobj_file::local_has_got_offset): Move to base class.
4552 (Sized_relobj_file::local_got_offset): Likewise.
4553 (Sized_relobj_file::set_local_got_offset): Likewise.
4554 (Sized_relobj_file::get_output_section_offset): Likewise.
4555 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4556 (Sized_relobj_file::do_output_section_offset): Likewise.
4557 (Sized_relobj_file::do_set_section_offset): Likewise.
4558 (Sized_relobj_file::Local_got_offsets): Likewise.
4559 (Sized_relobj_file::local_got_offsets_): Likewise.
4560 (Sized_relobj_file::section_offsets_): Likewise.
4561 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4562 (all constructors).
4563 (set_needs_dynsym_index): Convert relobj to derived class pointer.
4564 (Output_reloc::get_symbol_index): Likewise.
4565 (Output_reloc::local_section_offset): Likewise.
4566 (Output_reloc::get_address): Likewise.
4567 (Output_reloc::symbol_value): Likewise.
4568 (Output_data_got::reserve_slot): Move to class definition.
4569 (Output_data_got::reserve_local): New function.
4570 (Output_data_got::reserve_slot_for_global): Remove.
4571 (Output_data_got::reserve_global): New function.
4572 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4573 (all constructors, two instantiations).
4574 (Output_reloc::get_relobj): New function (two instantiations).
4575 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4576 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4577 (Output_data_reloc::add_global): Adjust type of relobj.
4578 (Output_data_reloc::add_global_relative): Likewise.
4579 (Output_data_reloc::add_symbolless_global_addend): Likewise.
4580 (Output_data_reloc::add_local): Likewise.
4581 (Output_data_reloc::add_local_relative): Likewise.
4582 (Output_data_reloc::add_symbolless_local_addend): Likewise.
4583 (Output_data_reloc::add_local_section): Likewise.
4584 (Output_data_reloc::add_output_section): Likewise.
4585 (Output_data_reloc::add_absolute): Likewise.
4586 (Output_data_reloc::add_target_specific): Likewise.
4587 (Output_data_got::reserve_slot): Move definition here.
4588 (Output_data_got::reserve_local): New function.
4589 (Output_data_got::reserve_global): New function.
4590 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4591 section_offsets_ with accessor function.
4592 (Sized_relobj_file::write_sections): Likewise.
4593 (Sized_relobj_file::do_relocate_sections): Likewise.
4594 * target.h (Sized_target::reserve_local_got_entry): New function.
4595 (Sized_target::reserve_global_got_entry): New function.
4596 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4597 (Target_x86_64::reserve_global_got_entry): New function.
4598 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4599
4600 2011-05-23 Cary Coutant <ccoutant@google.com>
4601
4602 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4603 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4604 bit when checking got_type.
4605 * incremental.cc (Sized_incremental_binary::setup_readers):
4606 Store symbol table and string table locations; initialize bit vector
4607 of file status flags.
4608 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4609 unchanged files.
4610 (Sized_incremental_binary::do_process_got_plt): New function.
4611 (Sized_incremental_binary::get_symtab_view): Use stored locations.
4612 (Output_section_incremental_inputs::set_final_data_size): Record
4613 file index for each input file.
4614 (Output_section_incremental_inputs::write_got_plt): Store file index
4615 instead of input entry offset for each GOT entry.
4616 * incremental.h
4617 (Incremental_input_entry::Incremental_input_entry): Initialize new
4618 data member.
4619 (Incremental_input_entry::set_offset): Store file index.
4620 (Incremental_input_entry::get_file_index): New function.
4621 (Incremental_input_entry::file_index_): New data member.
4622 (Incremental_binary::process_got_plt): New function.
4623 (Incremental_binary::do_process_got_plt): New function.
4624 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4625 data members.
4626 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4627 (Sized_incremental_binary::set_file_is_unchanged): New function.
4628 (Sized_incremental_binary::file_is_unchanged): New function.
4629 (Sized_incremental_binary::do_process_got_plt): New function.
4630 (Sized_incremental_binary::file_status_): New data member.
4631 (Sized_incremental_binary::main_symtab_loc_): New data member.
4632 (Sized_incremental_binary::main_strtab_loc_): New data member.
4633 * output.cc (Output_data_got::Got_entry::write): Add case
4634 RESERVED_CODE.
4635 (Output_data_got::add_global): Call add_got_entry.
4636 (Output_data_got::add_global_plt): Likewise.
4637 (Output_data_got::add_global_with_rel): Likewise.
4638 (Output_data_got::add_global_with_rela): Likewise.
4639 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4640 (Output_data_got::add_global_pair_with_rela): Likewise.
4641 (Output_data_got::add_local): Call add_got_entry.
4642 (Output_data_got::add_local_plt): Likewise.
4643 (Output_data_got::add_local_with_rel): Likewise.
4644 (Output_data_got::add_local_with_rela): Likewise.
4645 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4646 (Output_data_got::add_local_pair_with_rela): Likewise.
4647 (Output_data_got::reserve_slot): New function.
4648 (Output_data_got::reserve_slot_for_global): New function.
4649 (Output_data_got::add_got_entry): New function.
4650 (Output_data_got::add_got_entry_pair): New function.
4651 (Output_section::add_output_section_data): Edit FIXME.
4652 * output.h
4653 (Output_section_data_build::Output_section_data_build): New
4654 constructor with size parameter.
4655 (Output_data_space::Output_data_space): Likewise.
4656 (Output_data_got::Output_data_got): Initialize new data member; new
4657 constructor with size parameter.
4658 (Output_data_got::add_constant): Call add_got_entry.
4659 (Output_data_got::reserve_slot): New function.
4660 (Output_data_got::reserve_slot_for_global): New function.
4661 (class Output_data_got::Got_entry): Add RESERVED_CODE.
4662 (Output_data_got::add_got_entry): New function.
4663 (Output_data_got::add_got_entry_pair): New function.
4664 (Output_data_got::free_list_): New data member.
4665 * target.h (Sized_target::init_got_plt_for_update): New function.
4666 (Sized_target::register_global_plt_entry): New function.
4667 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4668 Initialize new data member; call init; add constructor with PLT count.
4669 (Output_data_plt_x86_64::init): New function.
4670 (Output_data_plt_x86_64::add_relocation): New function.
4671 (Output_data_plt_x86_64::reserve_slot): New function.
4672 (Output_data_plt_x86_64::free_list_): New data member.
4673 (Target_x86_64::init_got_plt_for_update): New function.
4674 (Target_x86_64::register_global_plt_entry): New function.
4675 (Output_data_plt_x86_64::add_entry): Allocate from free list for
4676 incremental updates.
4677 (Output_data_plt_x86_64::add_relocation): New function.
4678 * testsuite/object_unittest.cc (Object_test): Set default options.
4679
4680 2011-05-16 Ian Lance Taylor <iant@google.com>
4681
4682 * options.h (class General_options): Make -i a synonym for -r.
4683
4684 2011-05-16 Ian Lance Taylor <iant@google.com>
4685
4686 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4687
4688 2011-05-10 Cary Coutant <ccoutant@google.com>
4689
4690 * object.cc (Sized_relobj::do_count_local_symbols): Check for
4691 strip_all (-s).
4692
4693 2011-05-06 Ian Lance Taylor <iant@google.com>
4694
4695 * layout.cc (Layout::layout): If the output section flags change,
4696 update the ordering.
4697
4698 2011-04-25 Cary Coutant <ccoutant@google.com>
4699
4700 * incremental-dump.cc (dump_incremental_inputs): Print local
4701 symbol info for each input file.
4702 * incremental.cc
4703 (Output_section_incremental_inputs::set_final_data_size): Add local
4704 symbol info to input file entries in incremental info.
4705 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4706 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4707 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4708 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4709 implementation.
4710 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4711 (Sized_incr_relobj::do_relocate): Write the local symbols.
4712 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4713 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4714 Adjust size of input file header.
4715 (Incremental_inputs_reader::get_local_symbol_offset): New function.
4716 (Incremental_inputs_reader::get_local_symbol_count): New function.
4717 (Incremental_inputs_reader::get_input_section): Adjust size of input
4718 file header.
4719 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4720 (Sized_incr_relobj::This): New typedef.
4721 (Sized_incr_relobj::sym_size): New const data member.
4722 (Sized_incr_relobj::Local_symbol): New struct.
4723 (Sized_incr_relobj::do_output_local_symbol_count): New function.
4724 (Sized_incr_relobj::do_local_symbol_offset): New function.
4725 (Sized_incr_relobj::local_symbol_count_): New data member.
4726 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4727 (Sized_incr_relobj::local_symbol_index_): New data member.
4728 (Sized_incr_relobj::local_symbol_offset_): New data member.
4729 (Sized_incr_relobj::local_dynsym_offset_): New data member.
4730 (Sized_incr_relobj::local_symbols_): New data member.
4731 * object.h (Relobj::output_local_symbol_count): New function.
4732 (Relobj::local_symbol_offset): New function.
4733 (Relobj::do_output_local_symbol_count): New function.
4734 (Relobj::do_local_symbol_offset): New function.
4735 (Sized_relobj::do_output_local_symbol_count): New function.
4736 (Sized_relobj::do_local_symbol_offset): New function.
4737
4738 2011-04-22 Vladimir Simonov <sv@sw.ru>
4739
4740 * descriptors.cc (set_close_on_exec): New function.
4741 (Descriptors::open): Use set_close_on_exec.
4742 * output.cc (S_ISLNK): Define if not defined.
4743
4744 2011-04-22 Cary Coutant <ccoutant@google.com>
4745
4746 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4747 global symbol map.
4748 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4749 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4750 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4751 relocations.
4752 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4753 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4754 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4755 * incremental.h
4756 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4757 function.
4758 (Incremental_binary::apply_incremental_relocs): New function.
4759 (Incremental_binary::do_apply_incremental_relocs): New function.
4760 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4761 data member.
4762 (Sized_incremental_binary::add_global_symbol): New function.
4763 (Sized_incremental_binary::global_symbol): New function.
4764 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4765 (Sized_incremental_binary::symbol_map_): New data member.
4766 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4767 * target.h (Sized_target::apply_relocation): New function.
4768 * target-reloc.h (apply_relocation): New function.
4769 * x86_64.cc (Target_x86_64::apply_relocation): New function.
4770
4771 2011-04-22 Doug Kwan <dougkwan@google.com>
4772
4773 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4774 flag of a SHT_ARM_EXIDX section.
4775 * testsuite/Makefile.am (arm_exidx_test): New test rules.
4776 * testsuite/Makefile.in: Regenerate.
4777 * testsuite/arm_exidx_test.s: New file.
4778 * testsuite/arm_exidx_test.sh: Same.
4779
4780 2011-04-20 Cary Coutant <ccoutant@google.com>
4781
4782 PR gold/12689
4783 * archive.h (Incremental_archive_entry::Archive_member):
4784 Initialize arg_serial_ (second constructor).
4785
4786 2011-04-17 Ian Lance Taylor <iant@google.com>
4787
4788 * object.cc (Relocate_info::location): Simplify location string.
4789 * errors.cc (Errors::error_at_location): Don't print program
4790 name.
4791 (Errors::warning_at_location): Likewise.
4792 (Errors::undefined_symbol): Likewise.
4793 * testsuite/debug_msg.sh: Update accordingly.
4794
4795 2011-04-14 Cary Coutant <ccoutant@google.com>
4796
4797 * gold/layout.cc (Layout::symtab_section_offset): New function.
4798 * gold/layout.h (Layout::symtab_section_offset): New function.
4799 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4800
4801 2011-04-12 Ian Lance Taylor <iant@google.com>
4802
4803 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
4804 with MREMAP_MAYMOVE.
4805 * output.h (class Output_file): Add map_is_allocated_ field.
4806 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
4807 not available, provide stubs. If mremap is not available, #define
4808 it to gold_mremap.
4809 (MREMAP_MAYMOVE): Define if not defined.
4810 (Output_file::Output_file): Initialize map_is_allocated_.
4811 (Output_file::resize): Check map_is_allocated_.
4812 (Output_file::map_anonymous): If mmap fails, use malloc.
4813 (Output_file::unmap): Don't do anything for an anonymous map.
4814 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
4815 is not available, provide stubs.
4816 (File_read::View::~View): Use free rather than delete[].
4817 (File_read::make_view): Use malloc rather than new[]. If mmap
4818 fails, use malloc.
4819 (File_read::find_or_make_view): Use malloc rather than new[].
4820 * gold.h: Remove HAVE_REMAP code.
4821 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
4822 exists. Rename mremap to gold_mremap. If mmap is not available
4823 don't do anything.
4824 * configure, config.in: Rebuild.
4825
4826 2011-04-11 Ian Lance Taylor <iant@google.com>
4827
4828 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4829 initialize local variable v.
4830
4831 2011-04-11 Cary Coutant <ccoutant@google.com>
4832
4833 * archive.cc (Archive::include_member): Adjust call to
4834 report_object.
4835 (Add_archive_symbols::run): Track argument serial numbers.
4836 (Lib_group::include_member): Likewise.
4837 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4838 * archive.h (Incremental_archive_entry::Archive_member):
4839 Initialize arg_serial_.
4840 (Archive_member::arg_serial_): New data member.
4841 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4842 (Sized_dynobj::do_add_symbols): Track symbols when doing an
4843 incremental link.
4844 (Sized_dynobj::do_for_all_local_got_entries): New function.
4845 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4846 function.
4847 * fileread.cc (get_mtime): New function.
4848 * fileread.h (get_mtime): New function.
4849 * gold.cc (queue_initial_tasks): Check for incremental update.
4850 (process_incremental_input): New function.
4851 (queue_middle_tasks): Don't force valid target for incremental
4852 update.
4853 * incremental-dump.cc (find_input_containing_global): Adjust
4854 size of symbol info entry.
4855 (dump_incremental_inputs): Dump argument serial number and
4856 in_system_directory flag; bias shndx by 1; print symbol names
4857 when dumping per-file symbol lists; use new symbol info readers.
4858 * incremental.cc
4859 (Output_section_incremental_inputs:update_data_size): New function.
4860 (Sized_incremental_binary::setup_readers): Setup input readers
4861 for each input file; build maps for files added from libraries
4862 and scripts.
4863 (Sized_incremental_binary::check_input_args): New function.
4864 (Sized_incremental_binary::do_check_inputs): Build map of argument
4865 serial numbers to input arguments.
4866 (Sized_incremental_binary::do_file_has_changed): Rename
4867 do_file_is_unchanged to this; compare file modification times.
4868 (Sized_incremental_binary::do_init_layout): New function.
4869 (Sized_incremental_binary::do_reserve_layout): New function.
4870 (Sized_incremental_binary::do_get_input_reader): Remove.
4871 (Sized_incremental_binary::get_symtab_view): New function.
4872 (Incremental_checker::can_incrementally_link_output_file): Remove.
4873 (Incremental_inputs::report_command_line): Exclude --debug options.
4874 (Incremental_inputs::report_archive_begin): Add parameter; track
4875 argument serial numbers; don't put input file entry for archive
4876 before archive members.
4877 (Incremental_inputs::report_archive_end): Put input file entry
4878 for archive after archive members.
4879 (Incremental_inputs::report_object): Add parameter; track argument
4880 serial numbers and in_system_directory flag.
4881 (Incremental_inputs::report_script): Add parameter; track argument
4882 serial numbers.
4883 (Output_section_incremental_inputs::set_final_data_size): Adjust
4884 size of symbol info entry; check for forwarding symbols.
4885 (Output_section_incremental_inputs::write_input_files): Write
4886 in_system_directory flag and argument serial number.
4887 (Output_section_incremental_inputs::write_info_blocks): Map section
4888 indices between incremental info and original input file; store
4889 input section index for each symbol.
4890 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4891 change operator() to visit().
4892 (class Global_got_offset_visitor): Likewise.
4893 (class Global_symbol_visitor_got_plt):
4894 (Output_section_incremental_inputs::write_got_plt): Use new visitor
4895 classes.
4896 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4897 (Sized_incr_relobj::do_read_symbols): New function.
4898 (Sized_incr_relobj::do_layout): New function.
4899 (Sized_incr_relobj::do_layout_deferred_sections): New function.
4900 (Sized_incr_relobj::do_add_symbols): New function.
4901 (Sized_incr_relobj::do_should_include_member): New function.
4902 (Sized_incr_relobj::do_for_all_global_symbols): New function.
4903 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4904 (Sized_incr_relobj::do_section_size): New function.
4905 (Sized_incr_relobj::do_section_name): New function.
4906 (Sized_incr_relobj::do_section_contents): New function.
4907 (Sized_incr_relobj::do_section_flags): New function.
4908 (Sized_incr_relobj::do_section_entsize): New function.
4909 (Sized_incr_relobj::do_section_address): New function.
4910 (Sized_incr_relobj::do_section_type): New function.
4911 (Sized_incr_relobj::do_section_link): New function.
4912 (Sized_incr_relobj::do_section_info): New function.
4913 (Sized_incr_relobj::do_section_addralign): New function.
4914 (Sized_incr_relobj::do_initialize_xindex): New function.
4915 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4916 (Sized_incr_relobj::do_read_relocs): New function.
4917 (Sized_incr_relobj::do_gc_process_relocs): New function.
4918 (Sized_incr_relobj::do_scan_relocs): New function.
4919 (Sized_incr_relobj::do_count_local_symbols): New function.
4920 (Sized_incr_relobj::do_finalize_local_symbols): New function.
4921 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4922 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4923 (Sized_incr_relobj::do_relocate): New function.
4924 (Sized_incr_relobj::do_set_section_offset): New function.
4925 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4926 (Sized_incr_dynobj::do_read_symbols): New function.
4927 (Sized_incr_dynobj::do_layout): New function.
4928 (Sized_incr_dynobj::do_add_symbols): New function.
4929 (Sized_incr_dynobj::do_should_include_member): New function.
4930 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4931 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4932 (Sized_incr_dynobj::do_section_size): New function.
4933 (Sized_incr_dynobj::do_section_name): New function.
4934 (Sized_incr_dynobj::do_section_contents): New function.
4935 (Sized_incr_dynobj::do_section_flags): New function.
4936 (Sized_incr_dynobj::do_section_entsize): New function.
4937 (Sized_incr_dynobj::do_section_address): New function.
4938 (Sized_incr_dynobj::do_section_type): New function.
4939 (Sized_incr_dynobj::do_section_link): New function.
4940 (Sized_incr_dynobj::do_section_info): New function.
4941 (Sized_incr_dynobj::do_section_addralign): New function.
4942 (Sized_incr_dynobj::do_initialize_xindex): New function.
4943 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4944 (make_sized_incremental_object): New function.
4945 (Incremental_library::copy_unused_symbols): New function.
4946 (Incremental_library::do_for_all_unused_symbols): New function.
4947 * incremental.h (enum Incremental_input_flags): New type.
4948 (class Incremental_checker): Remove.
4949 (Incremental_input_entry::Incremental_input_entry): Add argument
4950 serial number.
4951 (Incremental_input_entry::arg_serial): New function.
4952 (Incremental_input_entry::set_is_in_system_directory): New function.
4953 (Incremental_input_entry::is_in_system_directory): New function.
4954 (Incremental_input_entry::arg_serial_): New data member.
4955 (Incremental_input_entry::is_in_system_directory_): New data member.
4956 (class Script_info): Move here from script.h.
4957 (Script_info::Script_info): Add filename parameter.
4958 (Script_info::filename): New function.
4959 (Script_info::filename_): New data member.
4960 (Incremental_script_entry::Incremental_script_entry): Add argument
4961 serial number.
4962 (Incremental_object_entry::Incremental_object_entry): Likewise.
4963 (Incremental_object_entry::add_input_section): Build list of input
4964 sections with map to original shndx.
4965 (Incremental_object_entry::get_input_section_index): New function.
4966 (Incremental_object_entry::shndx_): New data member.
4967 (Incremental_object_entry::name_key_): Rename; adjust all refs.
4968 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4969 (Incremental_archive_entry::Incremental_archive_entry): Add argument
4970 serial number.
4971 (Incremental_inputs::report_archive_begin): Likewise.
4972 (Incremental_inputs::report_object): Likewise.
4973 (Incremental_inputs::report_script): Likewise.
4974 (class Incremental_global_symbol_reader): New class.
4975 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4976 and store flags and input file type.
4977 (Incremental_input_entry_reader::arg_serial): New function.
4978 (Incremental_input_entry_reader::type): Extract type from flags.
4979 (Incremental_input_entry_reader::is_in_system_directory): New function.
4980 (Incremental_input_entry_reader::get_input_section_count): Call
4981 accessor function for type.
4982 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4983 function for type; adjust size of global symbol entry.
4984 (Incremental_input_entry_reader::get_global_symbol_count): Call
4985 accessor function for type.
4986 (Incremental_input_entry_reader::get_object_count): Likewise.
4987 (Incremental_input_entry_reader::get_object_offset): Likewise.
4988 (Incremental_input_entry_reader::get_member_count): Likewise.
4989 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4990 (Incremental_input_entry_reader::get_member_offset): Likewise.
4991 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4992 (Incremental_input_entry_reader::Global_symbol_info): Remove.
4993 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4994 (Incremental_input_entry_reader::get_global_symbol_reader): New
4995 function.
4996 (Incremental_input_entry_reader::get_output_symbol_index): New
4997 function.
4998 (Incremental_input_entry_reader::type_): Remove.
4999 (Incremental_input_entry_reader::flags_): New data member.
5000 (Incremental_inputs_reader::input_file_offset): New function.
5001 (Incremental_inputs_reader::input_file_index): New function.
5002 (Incremental_inputs_reader::input_file): Call input_file_offset.
5003 (Incremental_inputs_reader::input_file_at_offset): New function.
5004 (Incremental_relocs_reader::get_r_type): Reformat.
5005 (Incremental_relocs_reader::get_r_shndx): Reformat.
5006 (Incremental_relocs_reader::get_r_offset): Reformat.
5007 (Incremental_relocs_reader::data): New function.
5008 (Incremental_binary::Incremental_binary): Initialize new data members.
5009 (Incremental_binary::check_inputs): Add cmdline parameter.
5010 (Incremental_binary::file_is_unchanged): Remove.
5011 (Input_reader::arg_serial): New function.
5012 (Input_reader::get_unused_symbol_count): New function.
5013 (Input_reader::get_unused_symbol): New function.
5014 (Input_reader::do_arg_serial): New function.
5015 (Input_reader::do_get_unused_symbol_count): New function.
5016 (Input_reader::do_get_unused_symbol): New function.
5017 (Incremental_binary::input_file_count): New function.
5018 (Incremental_binary::get_input_reader): Change signature to use
5019 index instead of filename.
5020 (Incremental_binary::file_has_changed): New function.
5021 (Incremental_binary::get_input_argument): New function.
5022 (Incremental_binary::get_library): New function.
5023 (Incremental_binary::get_script_info): New function.
5024 (Incremental_binary::init_layout): New function.
5025 (Incremental_binary::reserve_layout): New function.
5026 (Incremental_binary::output_file): New function.
5027 (Incremental_binary::do_check_inputs): New function.
5028 (Incremental_binary::do_file_is_unchanged): Remove.
5029 (Incremental_binary::do_file_has_changed): New function.
5030 (Incremental_binary::do_init_layout): New function.
5031 (Incremental_binary::do_reserve_layout): New function.
5032 (Incremental_binary::do_input_file_count): New function.
5033 (Incremental_binary::do_get_input_reader): Change signature.
5034 (Incremental_binary::input_args_map_): New data member.
5035 (Incremental_binary::library_map_): New data member.
5036 (Incremental_binary::script_map_): New data member.
5037 (Sized_incremental_binary::Sized_incremental_binary): Initialize
5038 new data members.
5039 (Sized_incremental_binary::output_section): New function.
5040 (Sized_incremental_binary::inputs_reader): Add const.
5041 (Sized_incremental_binary::symtab_reader): Add const.
5042 (Sized_incremental_binary::relocs_reader): Add const.
5043 (Sized_incremental_binary::got_plt_reader): Add const.
5044 (Sized_incremental_binary::get_symtab_view): New function.
5045 (Sized_incremental_binary::Inputs_reader): New typedef.
5046 (Sized_incremental_binary::Input_entry_reader): New typedef.
5047 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5048 (Sized_incremental_binary::do_file_is_unchanged): Remove.
5049 (Sized_incremental_binary::do_file_has_changed): New function.
5050 (Sized_incremental_binary::do_init_layout): New function.
5051 (Sized_incremental_binary::do_reserve_layout): New function.
5052 (Sized_input_reader::Inputs_reader): Remove.
5053 (Sized_input_reader::Input_entry_reader): Remove.
5054 (Sized_input_reader::do_arg_serial): New function.
5055 (Sized_input_reader::do_get_unused_symbol_count): New function.
5056 (Sized_input_reader::do_get_unused_symbol): New function.
5057 (Sized_incremental_binary::do_input_file_count): New function.
5058 (Sized_incremental_binary::do_get_input_reader): Change signature;
5059 use index instead of filename.
5060 (Sized_incremental_binary::section_map_): New data member.
5061 (Sized_incremental_binary::input_entry_readers_): New data member.
5062 (class Sized_incr_relobj): New class.
5063 (class Sized_incr_dynobj): New class.
5064 (make_sized_incremental_object): New function.
5065 (class Incremental_library): New class.
5066 * layout.cc (Free_list::num_lists): New static data member.
5067 (Free_list::num_nodes): New static data member.
5068 (Free_list::num_removes): New static data member.
5069 (Free_list::num_remove_visits): New static data member.
5070 (Free_list::num_allocates): New static data member.
5071 (Free_list::num_allocate_visits): New static data member.
5072 (Free_list::init): New function.
5073 (Free_list::remove): New function.
5074 (Free_list::allocate): New function.
5075 (Free_list::dump): New function.
5076 (Free_list::print_stats): New function.
5077 (Layout_task_runner::run): Resize output file for incremental updates.
5078 (Layout::Layout): Initialize new data members.
5079 (Layout::set_incremental_base): New function.
5080 (Layout::init_fixed_output_section): New function.
5081 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5082 incremental updates.
5083 (Layout::create_gold_note): Do not create gold note section for
5084 incremental updates.
5085 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5086 for incremental updates.
5087 (Layout::set_section_offsets): For incremental updates, allocate space
5088 from free list.
5089 (Layout::create_symtab_sections): Layout with offsets relative to
5090 start of section; for incremental updates, allocate space from free
5091 list.
5092 (Layout::create_shdrs): For incremental updates, allocate space from
5093 free list.
5094 (Layout::finish_dynamic_section): For incremental updates, do not
5095 check --as-needed (fixed in subsequent patch).
5096 * layout.h (class Free_list): New class.
5097 (Layout::set_incremental_base): New function.
5098 (Layout::incremental_base): New function.
5099 (Layout::init_fixed_output_section): New function.
5100 (Layout::allocate): New function.
5101 (Layout::incremental_base_): New data member.
5102 (Layout::free_list_): New data member.
5103 * main.cc (main): Print Free_list statistics.
5104 * object.cc (Relobj::finalize_incremental_relocs): Add
5105 clear_counts parameter; clear counts only when clear_counts is set.
5106 (Sized_relobj::Sized_relobj): Initialize new base class.
5107 (Sized_relobj::do_layout): Don't report special sections.
5108 (Sized_relobj::do_for_all_local_got_entries): New function.
5109 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5110 symtab_off to all symbol table offsets.
5111 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5112 * object.h (class Got_offset_list): Move to top of file.
5113 (Object::Object): Allow case where input_file == NULL.
5114 (Object::~Object): Likewise.
5115 (Object::input_file): Assert that input_file != NULL.
5116 (Object::lock): Allow case where input_file == NULL.
5117 (Object::unlock): Likewise.
5118 (Object::is_locked): Likewise.
5119 (Object::token): Likewise.
5120 (Object::release): Likewise.
5121 (Object::is_incremental): New function.
5122 (Object::get_mtime): New function.
5123 (Object::for_all_local_got_entries): New function.
5124 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5125 (Object::set_is_in_system_directory): New function.
5126 (Object::is_in_system_directory): New function.
5127 (Object::do_is_incremental): New function.
5128 (Object::do_get_mtime): New function.
5129 (Object::do_for_all_local_got_entries): New function.
5130 (Object::is_in_system_directory_): New data member.
5131 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5132 (class Sized_relobj_base): New class.
5133 (class Sized_relobj): Derive from Sized_relobj_base.
5134 (class Sized_relobj::Symbols): Redeclare from base class.
5135 (class Sized_relobj::local_got_offset_list): Remove.
5136 (class Sized_relobj::Output_sections): Redeclare from base class.
5137 (class Sized_relobj::do_for_all_local_got_entries): New function.
5138 (class Sized_relobj::write_local_symbols): Add offset parameter.
5139 (class Sized_relobj::local_symbol_offset_): Update comment.
5140 (class Sized_relobj::local_dynsym_offset_): Update comment.
5141 * options.cc (Input_arguments::add_file): Remove const.
5142 * options.h (Input_file_argument::Input_file_argument):
5143 Initialize arg_serial_ (all constructors).
5144 (Input_file_argument::set_arg_serial): New function.
5145 (Input_file_argument::arg_serial): New function.
5146 (Input_file_argument::arg_serial_): New data member.
5147 (Input_arguments::Input_arguments): Initialize file_count_.
5148 (Input_arguments::add_file): Remove const.
5149 (Input_arguments::number_of_input_files): New function.
5150 (Input_arguments::file_count_): New data member.
5151 (Command_line::number_of_input_files): Call
5152 Input_arguments::number_of_input_files.
5153 * output.cc (Output_segment_headers::Output_segment_headers):
5154 Set current size.
5155 (Output_section::Input_section::current_data_size): New function.
5156 (Output_section::Output_section): Initialize new data members.
5157 (Output_section::add_input_section): Don't do merge sections for
5158 an incremental link; allocate space from free list for an
5159 incremental update.
5160 (Output_section::add_output_section_data): Allocate space from
5161 free list for an incremental update.
5162 (Output_section::update_data_size): New function.
5163 (Output_section::set_fixed_layout): New function.
5164 (Output_section::reserve): New function.
5165 (Output_segment::set_section_addresses): Remove const.
5166 (Output_segment::set_section_list_addresses): Remove const; allocate
5167 space from free list for an incremental update.
5168 (Output_segment::set_offset): Adjust size of RELRO segment for an
5169 incremental update.
5170 * output.h (Output_data::current_data_size): Move here from
5171 child classes.
5172 (Output_data::pre_finalize_data_size): New function.
5173 (Output_data::update_data_size): New function.
5174 (Output_section_headers::update_data_size): new function.
5175 (Output_section_data_build::current_data_size): Move to Output_data.
5176 (Output_data_strtab::update_data_size): New function.
5177 (Output_section::current_data_size): Move to Output_data.
5178 (Output_section::set_fixed_layout): New function.
5179 (Output_section::has_fixed_layout): New function.
5180 (Output_section::reserve): New function.
5181 (Output_section::update_data_size): New function.
5182 (Output_section::has_fixed_layout_): New data member.
5183 (Output_section::free_list_): New data member.
5184 (Output_segment::set_section_addresses): Remove const.
5185 (Output_segment::set_section_list_addresses): Remove const.
5186 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5187 New function.
5188 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5189 New function.
5190 * readsyms.cc (Read_symbols::do_read_symbols): Add library
5191 parameter when calling Add_symbols constructor; store argument
5192 serial number for members of a lib group.
5193 (Add_symbols::locks): Allow case where token == NULL.
5194 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5195 (Read_member::~Read_member): New function.
5196 (Read_member::is_runnable): New function.
5197 (Read_member::locks): New function.
5198 (Read_member::run): New function.
5199 (Check_script::~Check_script): New function.
5200 (Check_script::is_runnable): New function.
5201 (Check_script::locks): New function.
5202 (Check_script::run): New function.
5203 (Check_library::~Check_library): New function.
5204 (Check_library::is_runnable): New function.
5205 (Check_library::locks): New function.
5206 (Check_library::run): New function.
5207 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5208 (Add_symbols::library_): New data member.
5209 (class Read_member): New class.
5210 (class Check_script): New class.
5211 (class Check_library): New class.
5212 * reloc.cc (Read_relocs::is_runnable): Allow case where
5213 token == NULL.
5214 (Read_relocs::locks): Likewise.
5215 (Scan_relocs::locks): Likewise.
5216 (Relocate_task::locks): Likewise.
5217 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5218 to clear counters.
5219 (Sized_relobj::incremental_relocs_scan): Fix comment.
5220 (Sized_relobj::do_relocate): Pass output file offset to
5221 write_local_symbols.
5222 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5223 from class declaration.
5224 * script.cc (read_input_script): Allocate Script_info; pass
5225 argument serial number to report_script.
5226 * script.h (class Script_info): Move to incremental.h.
5227 * symtab.cc (Symbol_table::add_from_incrobj): New function.
5228 * symtab.h (Symbol_table::add_from_incrobj): New function.
5229 (Symbol_table::set_file_offset): New function.
5230
5231 2011-04-05 Cary Coutant <ccoutant@google.com>
5232
5233 * incremental-dump.cc (dump_incremental_inputs): Change signature
5234 to take a Sized_incremental_binary; change caller. Use readers
5235 in Sized_incremental_binary.
5236 * incremental.cc
5237 (Sized_incremental_binary::find_incremental_inputs_sections):
5238 Rename do_find_incremental_inputs_sections to this.
5239 (Sized_incremental_binary::setup_readers): New function.
5240 (Sized_incremental_binary::do_check_inputs): Check
5241 has_incremental_info_ flag; move setup code to setup_readers;
5242 use input readers.
5243 (Sized_incremental_binary::do_file_is_unchanged): New function.
5244 (Sized_incremental_binary::do_get_input_reader): New function.
5245 * incremental.h (class Incremental_binary): Move to end of file.
5246 (Incremental_binary::file_is_unchanged): New function.
5247 (Incremental_binary::do_file_is_unchanged): New function.
5248 (Incremental_binary::Input_reader): New class.
5249 (Incremental_binary::get_input_reader): New function.
5250 (class Sized_incremental_binary): Move to end of file.
5251 (Sized_incremental_binary::Sized_incremental_binary): Setup the
5252 input section reader classes.
5253 (Sized_incremental_binary::has_incremental_info): New function.
5254 (Sized_incremental_binary::inputs_reader): New function.
5255 (Sized_incremental_binary::symtab_reader): New function.
5256 (Sized_incremental_binary::relocs_reader): New function.
5257 (Sized_incremental_binary::got_plt_reader): New function.
5258 (Sized_incremental_binary::do_file_is_unchanged): New function.
5259 (Sized_incremental_binary::Sized_input_reader): New class.
5260 (Sized_incremental_binary::get_input_reader): New function.
5261 (Sized_incremental_binary::find_incremental_inputs_sections):
5262 Rename do_find_incremental_inputs_sections to this.
5263 (Sized_incremental_binary::setup_readers): New function.
5264 (Sized_incremental_binary::has_incremental_info_): New data member.
5265 (Sized_incremental_binary::inputs_reader_): New data member.
5266 (Sized_incremental_binary::symtab_reader_): New data member.
5267 (Sized_incremental_binary::relocs_reader_): New data member.
5268 (Sized_incremental_binary::got_plt_reader_): New data member.
5269 (Sized_incremental_binary::current_input_file_): New data member.
5270
5271 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
5272
5273 PR gold/12640
5274 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5275 violation.
5276
5277 2011-03-30 Cary Coutant <ccoutant@google.com>
5278
5279 * archive.cc (Archive::include_member): Adjust call to report_object.
5280 (Add_archive_symbols::run): Add script_info to call to
5281 report_archive_begin.
5282 (Lib_group::include_member): Adjust call to report_object.
5283 (Add_lib_group_symbols::run): Adjust call to report_object.
5284 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5285 blocks. Add object count for script input files.
5286 * incremental.cc (Incremental_inputs::report_archive_begin): Add
5287 script_info parameter; change all callers.
5288 (Incremental_inputs::report_object): Add script_info parameter;
5289 change all callers.
5290 (Incremental_inputs::report_script): Store backpointer to
5291 incremental info entry.
5292 (Output_section_incremental_inputs::set_final_data_size): Record
5293 additional information for scripts.
5294 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5295 * incremental.h (Incremental_script_entry::add_object): New function.
5296 (Incremental_script_entry::get_object_count): New function.
5297 (Incremental_script_entry::get_object): New function.
5298 (Incremental_script_entry::objects_): New data member; adjust
5299 constructor.
5300 (Incremental_inputs::report_archive_begin): Add script_info parameter.
5301 (Incremental_inputs::report_object): Add script_info parameter.
5302 (Incremental_inputs_reader::get_object_count): New function.
5303 (Incremental_inputs_reader::get_object_offset): New function.
5304 * options.cc (Input_arguments::add_file): Return reference to
5305 new input argument.
5306 * options.h (Input_argument::set_script_info): New function.
5307 (Input_argument::script_info): New function.
5308 (Input_argument::script_info_): New data member; adjust all
5309 constructors.
5310 (Input_file_group::add_file): Return reference to new input argument.
5311 (Input_file_lib::add_file): Likewise.
5312 (Input_arguments::add_file): Likewise.
5313 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5314 * script.cc (Parser_closure::Parser_closure): Add script_info
5315 parameter; adjust all callers.
5316 (Parser_closure::script_info): New function.
5317 (Parser_closure::script_info_): New data member.
5318 (read_input_script): Report scripts earlier to incremental info.
5319 (script_add_file): Set script_info in Input_argument.
5320 (script_add_library): Likewise.
5321 * script.h (Script_options::Script_info): Rewrite class.
5322
5323 2011-03-29 Cary Coutant <ccoutant@google.com>
5324
5325 * archive.cc (Library_base::should_include_member): Move
5326 method here from class Archive.
5327 (Archive::Archive): Initialize base class.
5328 (Archive::should_include_member): Move to base class.
5329 (Archive::do_for_all_unused_symbols): New function.
5330 (Add_archive_symbols::run): Remove redundant access to
5331 incremental_inputs.
5332 (Lib_group::Lib_group): Initialize base class.
5333 (Lib_group::do_filename): New function.
5334 (Lib_group::include_member): Pass pointer to Lib_group to
5335 report_object.
5336 (Lib_group::do_for_all_unused_symbols): New function.
5337 (Add_lib_group_symbols::run): Report archive information for
5338 incremental links.
5339 * archive.h (class Library_base): New base class.
5340 (class Archive): Derive from Library_base.
5341 (Archive::filename): Move to base class.
5342 (Archive::set_incremental_info): Likewise.
5343 (Archive::incremental_info): Likewise.
5344 (Archive::Should_include): Likewise.
5345 (Archive::should_include_member): Likewise.
5346 (Archive::Armap_entry): Remove.
5347 (Archive::Unused_symbol_iterator): Remove.
5348 (Archive::unused_symbols_begin): Remove.
5349 (Archive::unused_symbols_end): Remove.
5350 (Archive::do_filename): New function.
5351 (Archive::do_get_mtime): New function.
5352 (Archive::do_for_all_unused_symbols): New function.
5353 (Archive::task_): Move to base class.
5354 (Archive::incremental_info_): Likewise.
5355 (class Lib_group): Derive from Library_base.
5356 (Lib_group::do_filename): New function.
5357 (Lib_group::do_get_mtime): New function.
5358 (Lib_group::do_for_all_unused_symbols): New function.
5359 (Lib_group::task_): Move to base class.
5360 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5361 function.
5362 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5363 function.
5364 * incremental.cc (Incremental_inputs::report_archive_begin):
5365 Use Library_base; call library's get_mtime; add incremental inputs
5366 entry before members.
5367 (class Unused_symbol_visitor): New class.
5368 (Incremental_inputs::report_archive_end): Use Library_base; use
5369 visitor class to record unused symbols; don't add incremental inputs
5370 entry after members.
5371 (Incremental_inputs::report_object): Use Library_base.
5372 * incremental.h
5373 (Incremental_archive_entry::Incremental_archive_entry): Remove
5374 unused Archive parameter.
5375 (Incremental_inputs::report_archive_begin): Use Library_base.
5376 (Incremental_inputs::report_archive_end): Likewise.
5377 (Incremental_inputs::report_object): Likewise.
5378 * object.cc (Sized_relobj::do_for_all_global_symbols): New
5379 function.
5380 * object.h (Object::for_all_global_symbols): New function.
5381 (Object::do_for_all_global_symbols): New function.
5382 (Sized_relobj::do_for_all_global_symbols): New function.
5383 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
5384 function.
5385 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
5386 function.
5387
5388 2011-03-27 Ian Lance Taylor <iant@google.com>
5389
5390 * archive.cc (Archive::interpret_header): Return -1 if something
5391 goes wrong. Change callers accordingly.
5392
5393 2011-03-25 Cary Coutant <ccoutant@google.com>
5394
5395 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5396 * testsuite/Makefile.in: Regenerate.
5397
5398 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
5399
5400 * plugin.cc (get_view): New.
5401 (Plugin::load): Pass get_view to the plugin.
5402 (Plugin_manager::get_view): New.
5403
5404 2011-03-21 Ian Lance Taylor <iant@google.com>
5405
5406 * testsuite/final_layout.sh: Rewrite to not use dc.
5407 * testsuite/relro_test.sh: Fail if dc is not present.
5408
5409 2011-03-21 Sriraman Tallam <tmsriram@google.com>
5410
5411 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5412 Change == to -eq.
5413 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5414 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5415 Change == to -eq.
5416 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5417 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5418
5419 2011-03-14 Ian Lance Taylor <iant@google.com>
5420
5421 * script-sections.cc (Sort_output_sections::script_compare):
5422 Rename from is_before, change return type.
5423 (Sort_output_sections::operator()): Adjust accordingly.
5424
5425 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
5426
5427 PR gold/12572
5428 * testsuite/odr_violation2.cc: Add comment to make all error line
5429 numbers double digits.
5430 * testsuite/debug_msg.sh: Adjust expected errors.
5431
5432 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
5433
5434 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5435 but mark earlier ones as non-canonical
5436 (offset_to_iterator): Update search target and example
5437 (do_addr2line): Return extra lines in a vector*
5438 (format_file_lineno): Extract from do_addr2line
5439 (one_addr2line): Add vector* out-param
5440 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5441 when a lineno entry appeared last for its instruction
5442 (Dwarf_line_info): Add vector* out-param
5443 * object.cc (Relocate_info): Pass NULL for the vector* out-param
5444 * symtab.cc (Odr_violation_compare): Include the lineno in the
5445 comparison again.
5446 (linenos_from_loc): New. Combine the canonical line for an
5447 address with its other lines.
5448 (True_if_intersect): New. Helper functor to make
5449 std::set_intersection a query.
5450 (detect_odr_violations): Compare sets of lines instead of just
5451 one line for each function. This became less deterministic, but
5452 has fewer false positives.
5453 * symtab.h: Declarations.
5454 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5455 mix an optimized and non-optimized object in the same binary
5456 (odr_violation2.so): Same.
5457 * testsuite/Makefile.in: Regenerate from Makefile.am.
5458 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5459 * testsuite/debug_msg.sh: Update line numbers and add
5460 assertions.
5461 * testsuite/odr_violation1.cc: Use OdrDerived, in a
5462 non-optimized context.
5463 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5464 isn't inlined, and use OdrDerived in an optimized context.
5465 * testsuite/odr_header1.h: Defines OdrDerived, where
5466 optimization will change the
5467 first-instruction-in-the-destructor's file and line number.
5468 * testsuite/odr_header2.h: Defines OdrBase.
5469
5470 2011-03-09 Ian Lance Taylor <iant@google.com>
5471
5472 * fileread.cc (File_read::clear_views): Don't delete the whole
5473 file view.
5474
5475 2011-03-08 Ian Lance Taylor <iant@google.com>
5476
5477 PR gold/12525
5478 * fileread.cc: #include <climits>.
5479 (GOLD_IOV_MAX): Define.
5480 (File_read::read_multiple): Limit number of entries by iov_max.
5481 * fileread.h (class File_read): Always set max_readv_entries to
5482 128.
5483
5484 2011-03-07 Ian Lance Taylor <iant@google.com>
5485
5486 PR gold/12525
5487 * options.h (class General_options): Add -dy and -dn.
5488
5489 2011-03-02 Cary Coutant <ccoutant@google.com>
5490
5491 * testsuite/script_test_9.t: Add TLS segment.
5492
5493 2011-03-02 Simon Baldwin <simonb@google.com>
5494
5495 * configure.ac: Add check for gnu_indirect_function support in
5496 the toolchain building binutils.
5497 * configure: Rebuild.
5498
5499 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
5500
5501 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5502 plugin only symbols.
5503 (Symbol_table::sized_finalize_symbol) Mark symbol only present
5504 in plugin files as not needed in the symbol table.
5505
5506 2011-02-11 Sriraman Tallam <tmsriram@google.com>
5507
5508 * output.cc (Output_section::add_input_section): Delay fill
5509 generation for section ordering.
5510
5511 2011-02-09 Ian Lance Taylor <iant@google.com>
5512
5513 PR gold/12316
5514 * object.h (class Sized_relobj): Remove clear_local_symbols.
5515 * reloc.cc (Sized_relobj::do_relocate): Don't call
5516 clear_local_symbols.
5517
5518 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
5519
5520 * plugin.cc (is_visible_from_outside): Return true for symbols
5521 in the -u option.
5522
5523 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
5524
5525 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5526 filename.
5527
5528 2011-02-02 Sriraman Tallam <tmsriram@google.com>
5529
5530 * icf.h (is_section_foldable_candidate): Change type of parameter
5531 to std::string.
5532 * icf.cc (Icf::find_identical_sections): Change type of local variable
5533 section_name to be std::string.
5534 (is_function_ctor_or_dtor): Change type of parameter to std::string.
5535
5536 2011-01-25 Ian Lance Taylor <iant@google.com>
5537
5538 * script.cc (script_add_extern): Rewrite to use
5539 add_symbol_reference.
5540
5541 2011-01-25 Doug Kwan <dougkwan@google.com>
5542
5543 * icf.cc (get_section_contents): Always lock section's object.
5544
5545 2011-01-24 Ian Lance Taylor <iant@google.com>
5546
5547 * options.h (class General_options): Accept
5548 --no-detect-odr-violations.
5549
5550 2011-01-24 Ian Lance Taylor <iant@google.com>
5551
5552 * version.cc (version_string): Bump to 1.11.
5553
5554 2011-01-24 Ian Lance Taylor <iant@google.com>
5555
5556 * plugin.cc (class Plugin_rescan): Define new class.
5557 (Plugin_manager::claim_file): Set any_claimed_.
5558 (Plugin_manager::save_archive): New function.
5559 (Plugin_manager::save_input_group): New function.
5560 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5561 necessary.
5562 (Plugin_manager::new_undefined_symbol): New function.
5563 (Plugin_manager::rescan): New function.
5564 (Plugin_manager::rescannable_defines): New function.
5565 (Plugin_manager::add_input_file): Set any_added_.
5566 * plugin.h (class Plugin_manager): define new fields rescannable_,
5567 undefined_symbols_, any_claimed_, and any_added_. Declare
5568 Plugin_rescan as friend. Declare new functions.
5569 (Plugin_manager::Rescannable): Define type.
5570 (Plugin_manager::Rescannable_list): Define type.
5571 (Plugin_manager::Undefined_symbol_list): Define type.
5572 (Plugin_manager::Plugin_manager): Initialize new fields.
5573 * archive.cc (Archive::defines_symbol): New function.
5574 (Add_archive_symbols::run): Pass archive to plugins if any.
5575 * archive.h (class Archive): Declare defines_symbol.
5576 * readsyms.cc (Input_group::~Input_group): New function.
5577 (Finish_group::run): Pass input_group to plugins if any.
5578 * readsyms.h (class Input_group): Declare destructor.
5579 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5580 any.
5581
5582 2011-01-10 Ian Lance Taylor <iant@google.com>
5583
5584 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5585 section as relro.
5586 (Layout::set_segment_offsets): Reset increase_relro before calling
5587 set_section_addresses a second time.
5588
5589 2011-01-04 Cary Coutant <ccoutant@google.com>
5590
5591 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5592 sections before NOBITS sections.
5593
5594 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
5595
5596 * version.cc (print_version): Update copyright to 2011.
5597
5598 2010-12-23 Cary Coutant <ccoutant@google.com>
5599
5600 * output.h (Output_data_reloc::add_output_section): Pass OD instead
5601 of OS to this->add. Add OD parameter to second form of the function.
5602
5603 2010-12-20 Ian Lance Taylor <iant@google.com>
5604
5605 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5606 second of two consecutive entries with same offset.
5607
5608 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5609
5610 * testsuite/Makefile.am (ifuncmain2static_LDADD)
5611 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5612 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5613 to avoid unneeded links against $(LDADD).
5614 * testsuite/Makefile.in: Regenerate.
5615
5616 2010-12-15 Ian Lance Taylor <iant@google.com>
5617
5618 PR gold/12324
5619 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5620 for R_X86_64_32 and R_X86_64_PC32.
5621 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5622 ver_matching_def_pic.o.
5623 (ver_matching_def_pic.o): New target.
5624
5625 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5626
5627 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5628 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5629 Move definition before File_read::View member definitions.
5630 (File_read::View::~View): Initialize and hold lock before
5631 updating current_mapped_bytes.
5632
5633 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5634
5635 * dwarf_reader.cc: Remove outdated comment.
5636 * gold-threads.cc: Fix typo in error message.
5637 * archive.cc: Fix typos in comments.
5638 * archive.h: Likewise.
5639 * arm-reloc-property.cc: Likewise.
5640 * arm-reloc-property.h: Likewise.
5641 * arm-reloc.def: Likewise.
5642 * arm.cc: Likewise.
5643 * attributes.h: Likewise.
5644 * cref.cc: Likewise.
5645 * ehframe.cc: Likewise.
5646 * fileread.h: Likewise.
5647 * gold.h: Likewise.
5648 * i386.cc: Likewise.
5649 * icf.cc: Likewise.
5650 * incremental.h: Likewise.
5651 * int_encoding.cc: Likewise.
5652 * layout.h: Likewise.
5653 * main.cc: Likewise.
5654 * merge.h: Likewise.
5655 * object.cc: Likewise.
5656 * object.h: Likewise.
5657 * options.cc: Likewise.
5658 * readsyms.cc: Likewise.
5659 * reduced_debug_output.cc: Likewise.
5660 * reloc.cc: Likewise.
5661 * script-sections.cc: Likewise.
5662 * sparc.cc: Likewise.
5663 * symtab.h: Likewise.
5664 * target-reloc.h: Likewise.
5665 * target.cc: Likewise.
5666 * target.h: Likewise.
5667 * timer.cc: Likewise.
5668 * timer.h: Likewise.
5669 * x86_64.cc: Likewise.
5670
5671 2010-12-09 Cary Coutant <ccoutant@google.com>
5672
5673 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5674 stack.
5675 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5676 parameter; change all callers.
5677 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5678 * options.h (warn_execstack): New option.
5679
5680 2010-12-07 Doug Kwan <dougkwan@google.com>
5681
5682 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5683 like function call relocations.
5684
5685 2010-12-07 Ian Lance Taylor <iant@google.com>
5686
5687 * archive.cc (Archive::get_elf_object_for_member): Permit
5688 punconfigured to be NULL.
5689 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5690 (Archive::include_member): Pass NULL to get_elf_object_for_member
5691 if we searched for the archive and this is the first included
5692 object.
5693
5694 2010-12-01 Ian Lance Taylor <iant@google.com>
5695
5696 * dwarf_reader.h (class Sized_dwarf_line_info): Add
5697 track_relocs_type_ field.
5698 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5699 Set track_relocs_type_.
5700 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5701 contents when using RELA relocs.
5702 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5703 reloc_map_.
5704 * reloc.cc (Track_relocs::next_addend): New function.
5705 * reloc.h (class Track_relocs): Declare next_addend.
5706
5707 2010-12-01 Ian Lance Taylor <iant@google.com>
5708
5709 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5710 virtual destructor.
5711
5712 2010-12-01 Ian Lance Taylor <iant@google.com>
5713
5714 * README: Update compilers known to work and fail.
5715
5716 2010-11-23 Matthias Klose <doko@ubuntu.com>
5717
5718 * configure.in: For --enable-gold, handle value `default' instead of
5719 `both*'. Always install ld as ld.bfd, install as ld if gold is
5720 not the default.
5721 * configure: Regenerate.
5722
5723 2010-11-18 Doug Kwan <dougkwan@google.com>
5724
5725 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5726 and right_alignment to be zero. Store result alignment only if it is
5727 greater than existing alignment.
5728
5729 2010-11-16 Cary Coutant <ccoutant@google.com>
5730
5731 PR gold/12220
5732 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5733 Check for ".zdebug_line".
5734
5735 2010-11-16 Doug Kwan <dougkwan@google.com>
5736 Cary Coutant <ccoutant@google.com>
5737
5738 * output.h (Output_segment::set_section_addresses): Pass increase_relro
5739 by reference; adjust all callers.
5740 * output.cc (Output_segment::set_section_addresses): Adjust references
5741 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5742 list is empty.
5743 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5744 end at page boundary.
5745
5746 2010-11-16 Cary Coutant <ccoutant@google.com>
5747
5748 PR gold/12220
5749 * layout.cc (Layout::choose_output_section): Transform names of
5750 compressed sections even when using a script with a SECTIONS clause.
5751 (Layout::output_section_name): Remove code to transform
5752 compressed debug section names.
5753 * output.cc (Output_section::add_input_section): Use uncompressed
5754 section size when tracking input sections.
5755
5756 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
5757
5758 * symtab.h (Symbol::NON_PIC_REF): Remove.
5759 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5760 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
5761 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5762 (Symbol::use_plt_offset): Take a flags argument and pass it
5763 directly to needs_dynamic_reloc. Restrict check for undefined
5764 weak symbols to function calls.
5765 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5766 (Target_arm::Scan::global): Use it.
5767 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5768 (Target_arm::Relocate::relocate): Likewise.
5769 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5770 parameter with an r_type parameter. Use get_reference_flags
5771 to get the flags.
5772 (Target_arm::Relocate::relocate): Update accordingly.
5773 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5774 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5775 (Target_i386::Scan::global): Likewise.
5776 (Target_i386::Relocate::relocate): Likewise.
5777 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5778 parameter with an r_type parameter. Use get_reference_flags
5779 to get the flags.
5780 (Target_i386::Relocate::relocate): Update accordingly.
5781 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5782 (Target_powerpc::Scan::global): Use it.
5783 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5784 (Target_powerpc::Relocate::relocate): Likewise.
5785 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5786 (Target_sparc::Scan::global): Use it.
5787 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5788 (Target_sparc::Relocate::relocate): Likewise.
5789 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5790 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5791 (Target_x86_64::Scan::global): Likewise.
5792 (Target_x86_64::Relocate::relocate): Likewise.
5793
5794 2010-11-08 Doug Kwan <dougkwan@google.com>
5795 Cary Coutant <ccoutant@google.com>
5796
5797 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5798 (Arm_exidx_merge_section::section_contents_): New data member.
5799 (Arm_input_section::Arm_input_section): Initialize original_contents_.
5800 (Arm_input_section::~Arm_input_section): De-allocate memory.
5801 (Arm_input_section::original_contents_): New data member.
5802 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5803 in parameters instead of calling Object::section_contents without
5804 locking.
5805 (Arm_output_section::group_section): New parameter TASK. Pass it
5806 to callees that need locking objects.
5807 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
5808 to lock EXIDX input sections. Fix a formatting issue. Call
5809 Arm_exidx_merged_section::build_contents to create merged section
5810 contents.
5811 (Arm_output_section::create_stub_group): New parameter TASK. Use it
5812 to lock object of stub table owner.
5813 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5814 TEXT_SIZE to initialize data member TEXT_SIZE_.
5815 (Arm_exidx_input_section::addralign): Fix typo in comment.
5816 (Arm_exidx_input_section::text_size): New method.
5817 (Target_arm::do_relax): New parameter TASK. Pass it to callees
5818 that require locking objects. Lock objects before scanning for stubs
5819 and updating local symbols.
5820 (Arm_input_section<big_endian>::init): Copy contents of original
5821 input section.
5822 (Arm_input_section<big_endian>::do_write): Use saved contents of
5823 original input section instead of calling Object::section_contents
5824 without locking.
5825 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5826 size without calling Object::section_size().
5827 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5828 for size. Allocate a buffer for merged EXIDX entries.
5829 (Arm_exidx_merged_section::build_contents): New method.
5830 (Arm_exidx_merged_section::do_write): Move merge section contents
5831 building code to Arm_exidx_merged_section::build_contetns. Write
5832 out contetns in buffer instead of building it on the fly.
5833 (Arm_relobj::make_exidx_input_section): Also pass text section size
5834 to Arm_exidx_input_section constructor.
5835 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
5836 (Arm_dynobj::do_read_symbols): Fix memory leak.
5837 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5838 * target.h: (class Task): Add forward declaration.
5839 (Target::relax): Add new parameter TASK and pass it to
5840 Target::do_relax().
5841 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
5842
5843 2010-11-05 Cary Coutant <ccoutant@google.com>
5844
5845 PR gold/10708
5846 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5847 object when reading from the file.
5848 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5849 second layout pass.
5850 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5851 when reading section contents.
5852 (get_section_contents): Likewise.
5853 (icf::find_identical_sections): Likewise.
5854 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5855 object when reading from the file.
5856 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5857 the object when doing deferred section layout.
5858
5859 2010-11-03 Nick Clifton <nickc@redhat.com>
5860
5861 PR gold/12001
5862 * script.h (class Symbol_assignment: name): New member. Returns
5863 the name of the symbol.
5864 * scrfipt.cc (Script_options::is_pending_assignment): New member.
5865 Returns true if the given symbol name is on the list of
5866 assignments wating to be processed.
5867 * archive.cc (should_incldue_member): If the symbol is undefined,
5868 check to see if it is on the list of symbols pending assignment.
5869
5870 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
5871
5872 * script-sections.cc (Script_sections::find_memory_region): Check
5873 for a NULL output section pointer.
5874
5875 2010-10-29 Doug Kwan <dougkwan@google.com>
5876
5877 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5878 Output_section::add_relaxed_input_section.
5879 * output.cc (Output_section::add_relaxed_input_section): Add new
5880 arguments LAYOUT and NAME. Set section order index.
5881 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5882 Copy section order index.
5883 * output.h (Output_section::add_relaxed_input_section): Add new
5884 arguments LAYOUT and NAME.
5885
5886 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5887
5888 * testsuite/Makefile.am: Move gcctestdir/ld rule to
5889 NATIVE_OR_CROSS_LINKER.
5890 * testsuite/Makefile.in: Regenerate.
5891
5892 2010-10-20 Doug Kwan <dougkwan@google.com>
5893
5894 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5895 without SHF_LINK_ORDER flags.
5896 * layout.cc (Layout::choose_output_section): Do not filter
5897 SHF_LINK_ORDER flag in a relocatable link.
5898
5899 2010-10-17 Cary Coutant <ccoutant@google.com>
5900
5901 * output.h (Output_segment::set_section_addresses): Change function
5902 signature. Update all callers.
5903 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5904 sections.
5905 (Output_segment::set_section_addresses): Align after last TLS
5906 section. Add padding before last relro section instead of after.
5907
5908 2010-10-17 Doug Kwan <dougkwan@google.com>
5909
5910 * gold/arm.cc (Target_arm::got_section): Use correct order and set
5911 GOT output section to be writable.
5912
5913 2010-10-14 Cary Coutant <ccoutant@google.com>
5914
5915 * debug.h (DEBUG_INCREMENTAL): New flag.
5916 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5917 * gold.cc (queue_initial_tasks): Check parameters for incremental link
5918 mode.
5919 * incremental.cc (report_command_line): Ignore all forms of
5920 --incremental.
5921 * layout.cc (Layout::Layout): Check parameters for incremental link
5922 mode.
5923 * options.cc (General_options::parse_incremental): New function.
5924 (General_options::parse_no_incremental): New function.
5925 (General_options::parse_incremental_full): New function.
5926 (General_options::parse_incremental_update): New function.
5927 (General_options::incremental_mode_): New data member.
5928 (General_options::finalize): Check incremental_mode_.
5929 * options.h (General_options): Update help text for --incremental.
5930 Add --no-incremental, --incremental-full, --incremental-update.
5931 (General_options::Incremental_mode): New enum type.
5932 (General_options::incremental_mode): New function.
5933 (General_options::incremental_mode_): New data member.
5934 * parameters.cc (Parameters::incremental_mode_): New data member.
5935 (Parameters::set_options): Set incremental_mode_.
5936 (Parameters::set_incremental_full): New function.
5937 (Parameters::incremental): New function.
5938 (Parameters::incremental_update): New function.
5939 (set_parameters_incremental_full): New function.
5940 * parameters.h (Parameters::set_incremental_full): New function.
5941 (Parameters::incremental): New function.
5942 (Parameters::incremental_update): New function.
5943 (Parameters::incremental_mode_): New data member.
5944 (set_parameters_incremental_full): New function.
5945 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5946 incremental link mode.
5947 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5948 (Sized_relobj::do_relocate_sections): Likewise.
5949 * testsuite/Makefile.am (incremental_test): Use --incremental-full
5950 option.
5951 * testsuite/Makefile.in: Regenerate.
5952 * testsuite/incremental_test.sh: Filter all forms of --incremental.
5953
5954 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5955
5956 * script-sections.h (class Script_sections): Make
5957 Sections_elements typedef public.
5958 * script-sections.cc (class Sort_output_sections): Add elements_
5959 field. Add constructor which sets it; change all callers.
5960 (Sort_output_sections::is_before): New function.
5961 (Sort_output_sections::operator()): Call is_before.
5962 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5963 conditional.
5964 * testsuite/script_test_10.sh: New test. Test script section
5965 order.
5966 * testsuite/script_test_10.t: Likewise.
5967 * testsuite/script_test_10.s: Likewise.
5968 * testsuite/Makefile.am: Wrap the cross linker tests and the
5969 common tests into NATIVE_OR_CROSS_LINKER.
5970 (check_SCRIPTS): Add script_test_10.sh.
5971 (check_DATA): Add script_test_10.stdout.
5972 (script_test_10.o, script_test_10): New targets.
5973 (script_test_10.stdout): New target.
5974 * configure, testsuite/Makefile.in: Regenerate.
5975
5976 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5977
5978 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5979 error for the deprecated relocations.
5980 (Target_arm::Scan::global): Likewise.
5981 (Target_arm::Relocate::relocate): Likewise.
5982
5983 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
5984
5985 * fileread.cc (Input_file::find_file): Initialize *found_name
5986 and *namep when using the fallback search for case 4.
5987
5988 2010-10-11 Cary Coutant <ccoutant@google.com>
5989
5990 * options.h (class General_options): Redefine -z lazy as an alias for
5991 the negation of -z now.
5992
5993 2010-10-11 Ian Lance Taylor <iant@google.com>
5994
5995 * resolve.cc (symbol_to_bits): Report the value of the unsupported
5996 binding.
5997
5998 2010-10-06 Nick Clifton <nickc@redhat.com>
5999
6000 * script-sections.cc(class Memory_region): Remove
6001 current_lma_offset_ field. Rename current_vma_offset_ to
6002 current_offset_. Add last_section_ field.
6003 (Memory_region::get_current_vma_address): Rename to
6004 get_current_address.
6005 (Memory_region::get_current_lma_address): Delete.
6006 (Memory_region::increment_vma_offset): Rename to
6007 increment_offset.
6008 (Memory_region::increment_lma_offset): Delete.
6009 (Memory_region::attributes_compatible): New method. Returns
6010 true if the provided section is compatible with the region.
6011 (Memory_region::get_last_section): New method. Returns the last
6012 section to use the region.
6013 (Memory_region::set_last_section): New method. Stores the last
6014 section to use the region.
6015 (Script_sections::block_in_region): New method. Returns true if
6016 a block of memory is contained within a region.
6017 (Script_sections::find_memory_region): New method. Locates a
6018 memory region to be used to set a VMA or LMA address.
6019 (Output_section_definition::set_section_addresses): Add code to
6020 check for addresses set by memory regions.
6021 (Output_segment::set_section_addresses): Remove memory region
6022 walking code.
6023 (Script_sections::create_segment): Add a warning if a header
6024 segment is created outside of any region.
6025 * script-sections.h (class Script_sections): Add prototypes for
6026 find_memory_region and block_in_region methods.
6027 * testsuite/memory_test.s: Use .long instead of .word.
6028 * testsuite/memory_test.t: Add some more output sections.
6029 * testsuite/memory_test.sh: Update expected output.
6030
6031 2010-10-02 Doug Kwan <dougkwan@google.com>
6032
6033 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6034 defintion to symtab.h
6035 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6036 declaration to defintion.
6037
6038 2010-10-01 Nick Clifton <nickc@redhat.com>
6039
6040 * expression.cc (eval): Replace dummy argument with NULL.
6041 (eval_maybe_dot): Check for a NULL result section pointer.
6042 (Symbol_expression::value): Likewise.
6043 (Dot_expression::value): Likewise.
6044 (BINARY_EXPRESSION): Likewise.
6045 (Max_expression::value): Likewise.
6046 (Min_expression::value): Likewise.
6047 (Absolute_expression::value): Likewise.
6048 (Addr_expression::value_from_output_section): Likewise.
6049 (Loaddddr_expression::value_from_output_section): Likewise.
6050 (Segment_start_expression::value): Likewise.
6051 * script-sections.cc
6052 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6053 argument with NULL.
6054 (Sections_elememt_dot_assignment::set_section_addresses):
6055 Likewise.
6056 (Output_data_expression::do_write_to_buffer): Likewise.
6057 (Output_section_definition::finalize_symbols): Likewise.
6058 (Output_section_definition::set_section_addresses): Likewise.
6059
6060 2010-09-30 Doug Kwan <dougkwan@google.com>
6061
6062 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6063
6064 2010-09-28 Sriraman Tallam <tmsriram@google.com>
6065
6066 * target.h (Target::can_icf_inline_merge_sections): New virtual
6067 function.
6068 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6069 virtual function.
6070 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6071 virtual function.
6072 * icf.cc (get_section_contents): Inline merge sections only when
6073 target allows it.
6074
6075 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6076
6077 * configure: Regenerate.
6078
6079 2010-09-17 Ian Lance Taylor <iant@google.com>
6080
6081 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6082 * testsuite/Makefile.am (memory_test.o): New target.
6083 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6084 memory_test.t.
6085 * testsuite/Makefile.in: Rebuild.
6086
6087 2010-09-17 Doug Kwan <dougkwan@google.com>
6088
6089 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6090 defintion if relocation uses GOT entries of the symbol.
6091 * testsuite/icf_safe_test.sh: Fix test.
6092 * testsuite/icf_safe_so_test.sh: Fix test.
6093
6094 2010-09-16 Cary Coutant <ccoutant@google.com>
6095
6096 * script_sections.cc (class Memory_region): Remove "NULL" from
6097 vector initializations.
6098
6099 2010-09-15 Cary Coutant <ccoutant@google.com>
6100
6101 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6102 Resolve forwarding symbols.
6103
6104 2010-09-15 Doug Kwan <dougkwan@google.com>
6105
6106 * gold/testsuite/script_test_3.t: Add ARM special sections.
6107 * gold/testsuite/script_test_4.t: Same.
6108 * gold/testsuite/script_test_5.t: Same.
6109 * gold/testsuite/script_test_6.t: Same.
6110 * gold/testsuite/script_test_7.t: Same.
6111 * gold/testsuite/script_test_7.t: Same.
6112 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6113
6114 2010-09-14 Cary Coutant <ccoutant@google.com>
6115
6116 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6117 (Target_x86_64::Relocate::relocate_tls): Replace check for
6118 saw_tls_block_reloc_ with test for executable section.
6119
6120 2010-09-12 Cary Coutant <ccoutant@google.com>
6121
6122 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6123 position-independent executables to shared libraries need dynamic
6124 relocations.
6125 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6126 position-independent executables.
6127 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6128 * testsuite/Makefile.in: Regenerate.
6129
6130 2010-09-10 Nick Clifton <nickc@redhat.com>
6131
6132 PR gold/11997
6133 * testsuite/memory_test.t: Discard any sections that are not
6134 needed.
6135
6136 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
6137
6138 PR gold/11996
6139 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6140 "This::" to work around a bug in gcc 4.2.
6141
6142 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6143
6144 2010-09-09 Rafael Espindola <espindola@google.com>
6145
6146 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6147 sections with different PF_X flags in the same segment.
6148 (Layout::find_first_load_seg): Search all segments to find the first
6149 one.
6150 * options.h (rosegment): New.
6151
6152 2010-09-08 Rafael Espindola <espindola@google.com>
6153
6154 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6155
6156 2010-09-08 Doug Kwan <dougkwan@google.com>
6157
6158 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6159 (Arm_relobj::do_relocate_sections): Add new parameter for output
6160 file to match the parent.
6161 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6162 of local symbols instead of input values. Update code to track
6163 changes in gold::relocate_section.
6164 * object.cc (Sized_relobj::compute_final_local_value): New methods.
6165 (Sized_relobj::compute_final_local_value_internal): New methods.
6166 (Sized_relobj::do_finalize_local_symbols): Move code from loop
6167 body into private version of Sized_relobj::compute_final_local_value.
6168 Call the inline method.
6169 * object.h (Symbol_value::Symbol_value): Define destructor. Free
6170 merged symbol value if there is one.
6171 (Symbol_value::has_output_value): New method defintiion.
6172 (Sized_relobj::Compute_final_local_value_status): New enum type.
6173 (Sized_relobj::compute_final_local_value): New methods.
6174 (Sized_relobj::compute_final_local_value_internal): New methods.
6175 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6176 and arm_cortex_a8.sh.
6177 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6178 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6179 New tests.
6180 * Makefile.in: Regenerate.
6181 * testsuite/arm_bl_out_of_range.s: Update test.
6182 * testsuite/thumb_bl_out_of_range.s: Ditto.
6183 * testsuite/thumb_blx_out_of_range.s: Ditto.
6184 * testsuite/arm_branch_out_of_range.sh: New file.
6185 * testsuite/arm_cortex_a8.sh: Ditto.
6186 * testsuite/arm_cortex_a8_b.s: Ditto.
6187 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6188 * testsuite/arm_cortex_a8_b_local.s: Ditto.
6189 * testsuite/arm_cortex_a8_bl.s: Ditto.
6190 * testsuite/arm_cortex_a8_blx.s: Ditto.
6191 * testsuite/arm_cortex_a8_local.s: Ditto.
6192 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6193 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6194
6195 2010-09-08 Rafael Espindola <espindola@google.com>
6196
6197 * Makefile.am (memory_test.stdout): Run readelf with -W.
6198 * Makefile.in: Regenerate.
6199 * testsuite/memory_test.sh: Make the regexps accept both 32 and
6200 64 bit output.
6201
6202 2010-09-08 Rafael Espindola <espindola@google.com>
6203
6204 * script-sections.cc (Script_sections::add_memory_region): Convert
6205 field precision to int.
6206 * script.cc (script_set_section_region, script_set_section_region):
6207 Convert field precision to int.
6208
6209 2010-09-08 Rafael Espindola <espindola@google.com>
6210
6211 * arm.cc (do_finalize_sections): Create the __exidx_start and
6212 __exdix_end symbols even when the section is missing.
6213
6214 2010-09-08 Nick Clifton <nickc@redhat.com>
6215
6216 * README: Remove claim that MEMORY is not supported.
6217 * expression.cc (script_exp_function_origin)
6218 (script_exp_function_length): Move from here to ...
6219 * script.cc: ... here.
6220 (script_set_section_region, script_add_memory)
6221 (script_parse_memory_attr, script_include_directive): New
6222 functions.
6223 * script-sections.cc
6224 (class Memory_region): New class.
6225 (class Output_section_definition): Add set_memory_region,
6226 set_section_vma, set_section_lma and get_section_name methods.
6227 (class Script_Sections): Add add_memory_region,
6228 find_memory_region, find_memory_region_origin,
6229 find_memory_region_length and set_memory_region methods.
6230 Have set_section_addresses method walk the list of set memory
6231 regions.
6232 Extend the print methos to display memory regions.
6233 * script-sections.h: Add prototypes for new methods.
6234 Add enum for MEMORY region attributes.
6235 * yyscript.y: Add support for parsing MEMORY regions.
6236 * script-c.h: Add prototypes for new functions.
6237 * testsuite/Makefile.am: Add test of MEMORY region functionality.
6238 * testsuite/Makefile.in: Regenerate.
6239 * testsuite/memory_test.sh: New script.
6240 * testsuite/memory_test.s: New assembler source file.
6241 * testsuite/memory_test.t: New linker script.
6242
6243 2010-08-27 Doug Kwan <dougkwan@google.com>
6244
6245 * gold/resolve.cc (Symbol_table::should_override): Let a weak
6246 reference override an existing dynamic weak reference.
6247 * testsuite/Makefile.am: Add new test dyn_weak_ref.
6248 * testsuite/Makefile.in: Regenerate.
6249 * testsuite/dyn_weak_ref.sh: New file.
6250 * testsuite/dyn_weak_ref_1.c: Ditto.
6251 * testsuite/dyn_weak_ref_2.c: Ditto.
6252
6253 2010-08-27 Ian Lance Taylor <iant@google.com>
6254
6255 * incremental.h (class Incremental_input_entry): Add virtual
6256 destructor.
6257
6258 2010-08-27 Ian Lance Taylor <iant@google.com>
6259
6260 * testsuite/start_lib_test_3.c: Mark t3 as used.
6261
6262 2010-08-27 Nick Clifton <nickc@redhat.com>
6263
6264 * options.cc (version_script): Fix small typo in previous
6265 whitespace tidyup.
6266
6267 2010-08-25 Nick Clifton <nickc@redhat.com>
6268
6269 * archive.cc: Formatting fixes: Remove whitespace between
6270 typename and following asterisk. Remove whitespace between
6271 function name and opening parenthesis.
6272 * archive.h: Likewise.
6273 * arm.cc: Likewise.
6274 * attributes.cc: Likewise.
6275 * attributes.h: Likewise.
6276 * common.cc: Likewise.
6277 * copy-relocs.cc: Likewise.
6278 * dirsearch.h: Likewise.
6279 * dynobj.cc: Likewise.
6280 * ehframe.cc: Likewise.
6281 * ehframe.h: Likewise.
6282 * expression.cc: Likewise.
6283 * fileread.cc: Likewise.
6284 * fileread.h: Likewise.
6285 * gc.h: Likewise.
6286 * gold-threads.cc: Likewise.
6287 * gold.cc: Likewise.
6288 * i386.cc: Likewise.
6289 * icf.h: Likewise.
6290 * incremental-dump.cc: Likewise.
6291 * incremental.cc: Likewise.
6292 * layout.cc: Likewise.
6293 * layout.h: Likewise.
6294 * main.cc: Likewise.
6295 * merge.cc: Likewise.
6296 * merge.h: Likewise.
6297 * object.cc: Likewise.
6298 * object.h: Likewise.
6299 * options.cc: Likewise.
6300 * options.h: Likewise.
6301 * output.cc: Likewise.
6302 * output.h: Likewise.
6303 * plugin.cc: Likewise.
6304 * plugin.h: Likewise.
6305 * powerpc.cc: Likewise.
6306 * reloc.cc: Likewise.
6307 * script-c.h: Likewise.
6308 * script-sections.cc: Likewise.
6309 * script.cc: Likewise.
6310 * stringpool.cc: Likewise.
6311 * symtab.cc: Likewise.
6312 * symtab.h: Likewise.
6313 * target.cc: Likewise.
6314 * timer.cc: Likewise.
6315 * timer.h: Likewise.
6316 * version.cc: Likewise.
6317 * x86_64.cc: Likewise.
6318
6319 2010-08-24 Nick Clifton <nickc@redhat.com>
6320
6321 PR 11899
6322 * layout.cc (segment_precedes): Sort segments by their physical
6323 addresses, if they have been set.
6324
6325 2010-08-23 Cary Coutant <ccoutant@google.com>
6326
6327 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6328 symbols data.
6329 (Lib_group::include_member): Unlock object after deleting its
6330 symbols data.
6331 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6332 the bug fixed here.
6333
6334 2010-08-19 Neil Vachharajani <nvachhar@google.com>
6335 Cary Coutant <ccoutant@google.com>
6336
6337 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6338 constructor, and set_blocker.
6339 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6340 readsyms_blocker_.
6341 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6342 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6343 * testsuite/Makefile.am (start_lib_test): New test case.
6344 * testsuite/Makefile.in: Regenerate.
6345 * testsuite/start_lib_test_main.c: New file.
6346 * testsuite/start_lib_test_1.c: New file.
6347 * testsuite/start_lib_test_2.c: New file.
6348 * testsuite/start_lib_test_3.c: New file.
6349
6350 2010-08-19 Ian Lance Taylor <iant@google.com>
6351
6352 * Makefile.in: Rebuild with automake 1.11.1.
6353 * aclocal.m4: Likewise.
6354 * testsuite/Makefile.in: Likewise.
6355
6356 2010-08-19 Ian Lance Taylor <iant@google.com>
6357
6358 PR 10893
6359 * i386.cc (class Output_data_plt_i386): Update declarations.
6360 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
6361 local_ifuncs_ fields.
6362 (Target_i386::do_plt_section_for_global): New function.
6363 (Target_i386::do_plt_section_for_local): New function.
6364 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6365 parameter; change all callers. Initialize global_ifuncs_ and
6366 local_ifuncs_. If doing a static link define __rel_iplt_start and
6367 __rel_iplt_end.
6368 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6369 (Output_data_plt_i386::add_local_ifunc_entry): New function.
6370 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6371 symbols.
6372 (Target_i386::make_plt_section): New function, broken out of
6373 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
6374 (Target_i386::make_plt_entry): Call make_plt_section.
6375 (Target_i386::make_local_ifunc_plt_entry): New function.
6376 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6377 (Target_i386::Scan::local): Handle IFUNC symbols. Add
6378 R_386_IRELATIVE to switch.
6379 (Target_i386::Scan::global): Likewise.
6380 (Target_i386::Relocate::relocate): Likewise.
6381 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6382 switch.
6383 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6384 (Target_x86_64::do_plt_section_for_global): New function.
6385 (Target_x86_64::do_plt_section_for_local): New function.
6386 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6387 parameter; change all callers. If doing a static link define
6388 __rela_iplt_start and __rela_iplt_end.
6389 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6390 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6391 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6392 to point to .plt.
6393 (Target_x86_64::make_local_ifunc_plt_entry): New function.
6394 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6395 switch.
6396 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6397 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
6398 R_X86_64_IRELATIVE to switch.
6399 (Target_x86_64::Scan::global): Likewise.
6400 (Target_x86_64::Relocate::relocate): Likewise.
6401 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6402 switch.
6403 * target.h (class Target): Add plt_section_for_global and
6404 plt_section_for_local functions. Add do_plt_section_for_global
6405 and do_plt_section_for_local virtual functions.
6406 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
6407 clarifying comments.
6408 (Symbol::use_plt_offset): Handle IFUNC symbol.
6409 * object.cc (Sized_relobj::Sized_relobj): Initialize
6410 local_plt_offsets_.
6411 (Sized_relobj::local_has_plt_offset): New function.
6412 (Sized_relobj::local_plt_offset): New function.
6413 (Sized_relobj::set_local_plt_offset): New function.
6414 (Sized_relobj::do_count): Handle IFUNC symbol.
6415 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
6416 a bit away from input_shndx_ field. Add set_is_func_symbol and
6417 is_ifunc_symbol functions.
6418 (class Sized_relobj): Update declarations. Remove Tls_got_entry
6419 and Local_tls_got_offsets. Define Local_plt_offsets. Add
6420 local_plt_offsets_ field.
6421 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6422 * output.h (class Output_section_data): Add non-const
6423 output_section function.
6424 (class Output_data_got): Update declarations.
6425 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6426 Add use_plt_offset parameter to global and local constructors.
6427 Change all callers. Change local_sym_index_ field to 31 bits.
6428 Change GSYM_CODE and CONSTANT_CODE accordingly.
6429 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6430 doing a static link don't set sh_link field.
6431 (Output_data_got::Got_entry::write): Use PLT offset if
6432 appropriate.
6433 (Output_data_got::add_global_plt): New function.
6434 (Output_data_got::add_local_plt): New function.
6435 * target-reloc.h (relocate_section): Handle IFUNC symbol.
6436 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6437 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6438 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6439 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6440 IFUNC conditional.
6441 * testsuite/ifunc-sel.h: New file.
6442 * testsuite/ifuncmain1.c: New file.
6443 * testsuite/ifuncmain1vis.c: New file.
6444 * testsuite/ifuncmod1.c: New file.
6445 * testsuite/ifuncdep2.c: New file.
6446 * testsuite/ifuncmain2.c: New file.
6447 * testsuite/ifuncmain3.c: New file.
6448 * testsuite/ifuncmod3.c: New file.
6449 * testsuite/ifuncmain4.c: New file.
6450 * testsuite/ifuncmain5.c: New file.
6451 * testsuite/ifuncmod5.c: New file.
6452 * testsuite/ifuncmain6pie.c: New file.
6453 * testsuite/ifuncmod6.c: New file.
6454 * testsuite/ifuncmain7.c: New file.
6455 * configure, testsuite/Makefile.in: Rebuild.
6456
6457 2010-08-18 Ian Lance Taylor <iant@google.com>
6458
6459 * incremental.cc
6460 (Output_section_incremental_inputs::write_input_files): Add cast
6461 to avoid signed/unsigned comparison warning.
6462 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6463
6464 2010-08-12 Cary Coutant <ccoutant@google.com>
6465
6466 * common.cc (Sort_commons::operator()): Remove unnecessary code.
6467
6468 2010-08-13 Ian Lance Taylor <iant@google.com>
6469
6470 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6471
6472 2010-08-12 Cary Coutant <ccoutant@google.com>
6473 Doug Kwan <dougkwan@google.com>
6474
6475 * resolve.cc (Symbol_table::should_override): When a weak dynamic
6476 defintion overrides non-weak undef, remember that the original undef
6477 is not weak.
6478 * symtab.cc (Symbol_table::sized_write_global): For undef without
6479 an original weak binding, set binding to global in output.
6480 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6481 * testsuite/Makefile.in: Regenerate.
6482 * testsuite/strong_ref_weak_def.sh: New file.
6483 * testsuite/strong_ref_weak_def_1.c: Ditto.
6484 * testsuite/strong_ref_weak_def_2.c: Ditto.
6485
6486 2010-08-12 Cary Coutant <ccoutant@google.com>
6487
6488 * testsuite/incremental_test.sh: Rewrite.
6489 * testsuite/incremental_test_1.c: Rewrite.
6490 * testsuite/incremental_test_2.c: Rewrite.
6491
6492 2010-08-12 Cary Coutant <ccoutant@google.com>
6493
6494 * arm.cc (Target_arm::got_size): Add const.
6495 (Target_arm::got_entry_count): New function.
6496 (Target_arm::plt_entry_count): New function.
6497 (Target_arm::first_plt_entry_offset): New function.
6498 (Target_arm::plt_entry_size): New function.
6499 (Output_data_plt_arm::entry_count): New function.
6500 (Output_data_plt_arm::first_plt_entry_offset): New function.
6501 (Output_data_plt_arm::get_plt_entry_size): New function.
6502 * i386.cc (Target_i386::got_size): Add const.
6503 (Target_i386::got_entry_count): New function.
6504 (Target_i386::plt_entry_count): New function.
6505 (Target_i386::first_plt_entry_offset): New function.
6506 (Target_i386::plt_entry_size): New function.
6507 (Output_data_plt_i386::entry_count): New function.
6508 (Output_data_plt_i386::first_plt_entry_offset): New function.
6509 (Output_data_plt_i386::get_plt_entry_size): New function.
6510 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6511 find_incremental_inputs_sections. Dump incremental_got_plt section.
6512 * incremental.cc: Include target.h.
6513 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6514 parameter. Adjust all callers. Find incremental_got_plt section.
6515 (Incremental_inputs::create_data_sections): Create incremental_got_plt
6516 section.
6517 (Output_section_incremental_inputs::set_final_data_size): Calculate
6518 size of incremental_got_plt section.
6519 (Output_section_incremental_inputs::do_write): Write the
6520 incremental_got_plt section.
6521 (Got_plt_view_info): New struct.
6522 (Local_got_offset_visitor): New class.
6523 (Global_got_offset_visitor): New class.
6524 (Global_symbol_visitor_got_plt): New class.
6525 (Output_section_incremental_inputs::write_got_plt): New function.
6526 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6527 Add parameter. Adjust all callers.
6528 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6529 (Incremental_inputs::got_plt_section): New function.
6530 (Incremental_inputs::got_plt_section_): New data member.
6531 (Incremental_got_plt_reader): New class.
6532 * layout.cc (Layout::create_incremental_info_sections): Add the
6533 incremental_got_plt section.
6534 * object.h (Got_offset_list::get_list): New function.
6535 (Got offset_list::for_all_got_offsets): New function.
6536 (Sized_relobj::local_got_offset_list): New function.
6537 * powerpc.cc (Target_powerpc::got_size): Add const.
6538 (Target_powerpc::got_entry_count): New function.
6539 (Target_powerpc::plt_entry_count): New function.
6540 (Target_powerpc::first_plt_entry_offset): New function.
6541 (Target_powerpc::plt_entry_size): New function.
6542 (Output_data_plt_powerpc::entry_count): New function.
6543 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6544 (Output_data_plt_powerpc::get_plt_entry_size): New function.
6545 * sparc.cc (Target_sparc::got_size): Add const.
6546 (Target_sparc::got_entry_count): New function.
6547 (Target_sparc::plt_entry_count): New function.
6548 (Target_sparc::first_plt_entry_offset): New function.
6549 (Target_sparc::plt_entry_size): New function.
6550 (Output_data_plt_sparc::entry_count): New function.
6551 (Output_data_plt_sparc::first_plt_entry_offset): New function.
6552 (Output_data_plt_sparc::get_plt_entry_size): New function.
6553 * symtab.h (Symbol::got_offset_list): New function.
6554 (Symbol_table::for_all_symbols): New function.
6555 * target.h (Sized_target::got_entry_count): New function.
6556 (Sized_target::plt_entry_count): New function.
6557 (Sized_target::plt_entry_size): New function.
6558 * x86_64.cc (Target_x86_64::got_size): Add const.
6559 (Target_x86_64::got_entry_count): New function.
6560 (Target_x86_64::plt_entry_count): New function.
6561 (Target_x86_64::first_plt_entry_offset): New function.
6562 (Target_x86_64::plt_entry_size): New function.
6563 (Output_data_plt_x86_64::entry_count): New function.
6564 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6565 (Output_data_plt_x86_64::get_plt_entry_size): New function.
6566
6567 2010-08-12 Cary Coutant <ccoutant@google.com>
6568
6569 * archive.cc: Include incremental.h.
6570 (Archive::Archive): Initialize incremental_info_.
6571 (Archive::include_member): Record archive members in incremental info.
6572 (Add_archive_symbols::run): Record begin and end of an archive in
6573 incremental info.
6574 (Lib_group::include_member): Record objects in incremental info.
6575 * archive.h (Incremental_archive_entry): Forward declaration.
6576 (Archive::set_incremental_info): New member function.
6577 (Archive::incremental_info): New member function.
6578 (Archive::Unused_symbol_iterator): New class.
6579 (Archive::unused_symbols_begin): New member function.
6580 (Archive::unused_symbols_end): New member function.
6581 (Archive::incremental_info_): New data member.
6582 * incremental-dump.cc (find_input_containing_global): New function.
6583 (dump_incremental_inputs): Dump new incremental info sections.
6584 * incremental.cc: Include symtab.h.
6585 (Output_section_incremental_inputs): New class.
6586 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6587 new incremental info sections.
6588 (Sized_incremental_binary::do_check_inputs): Likewise.
6589 (Incremental_inputs::report_archive): Remove.
6590 (Incremental_inputs::report_archive_begin): New function.
6591 (Incremental_inputs::report_archive_end): New function.
6592 (Incremental_inputs::report_object): New function.
6593 (Incremental_inputs::finalize_inputs): Remove.
6594 (Incremental_inputs::report_input_section): New function.
6595 (Incremental_inputs::report_script): Rewrite.
6596 (Incremental_inputs::finalize): Do nothing but finalize string table.
6597 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6598 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6599 (Incremental_inputs::create_data_sections): New function.
6600 (Incremental_inputs::relocs_entsize): New function.
6601 (Output_section_incremental_inputs::set_final_data_size): New function.
6602 (Output_section_incremental_inputs::do_write): New function.
6603 (Output_section_incremental_inputs::write_header): New function.
6604 (Output_section_incremental_inputs::write_input_files): New function.
6605 (Output_section_incremental_inputs::write_info_blocks): New function.
6606 (Output_section_incremental_inputs::write_symtab): New function.
6607 * incremental.h (Incremental_script_entry): Forward declaration.
6608 (Incremental_object_entry): Forward declaration.
6609 (Incremental_archive_entry): Forward declaration.
6610 (Incremental_inputs): Forward declaration.
6611 (Incremental_inputs_header_data): Remove.
6612 (Incremental_inputs_header): Remove.
6613 (Incremental_inputs_header_write): Remove.
6614 (Incremental_inputs_entry_data): Remove.
6615 (Incremental_inputs_entry): Remove.
6616 (Incremental_inputs_entry_write): Remove.
6617 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6618 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6619 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6620 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6621 Likewise.
6622 (Incremental_input_entry): New class.
6623 (Incremental_script_entry): New class.
6624 (Incremental_object_entry): New class.
6625 (Incremental_archive_entry): New class.
6626 (Incremental_inputs::Incremental_inputs): Initialize new data members.
6627 (Incremental_inputs::report_inputs): Remove.
6628 (Incremental_inputs::report_archive): Remove.
6629 (Incremental_inputs::report_archive_begin): New function.
6630 (Incremental_inputs::report_archive_end): New function.
6631 (Incremental_inputs::report_object): Change prototype.
6632 (Incremental_inputs::report_input_section): New function.
6633 (Incremental_inputs::report_script): Change prototype.
6634 (Incremental_inputs::get_reloc_count): New function.
6635 (Incremental_inputs::set_reloc_count): New function.
6636 (Incremental_inputs::create_data_sections): New function.
6637 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6638 (Incremental_inputs::inputs_section): New function.
6639 (Incremental_inputs::symtab_section): New function.
6640 (Incremental_inputs::relocs_section): New function.
6641 (Incremental_inputs::get_stringpool): Add const.
6642 (Incremental_inputs::command_line): Add const.
6643 (Incremental_inputs::inputs): Remove.
6644 (Incremental_inputs::command_line_key): New function.
6645 (Incremental_inputs::input_file_count): New function.
6646 (Incremental_inputs::input_files): New function.
6647 (Incremental_inputs::relocs_entsize): New function.
6648 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6649 (Incremental_inputs::finalize_inputs): Remove.
6650 (Incremental_inputs::Input_info): Remove.
6651 (Incremental_inputs::lock_): Remove.
6652 (Incremental_inputs::inputs_): Change type.
6653 (Incremental_inputs::inputs_map_): Remove.
6654 (Incremental_inputs::current_object_entry_): New data member.
6655 (Incremental_inputs::inputs_section_): New data member.
6656 (Incremental_inputs::symtab_section_): New data member.
6657 (Incremental_inputs::relocs_section_): New data member.
6658 (Incremental_inputs::reloc_count_): New data member.
6659 (Incremental_inputs_reader): New class.
6660 (Incremental_symtab_reader): New class.
6661 (Incremental_relocs_reader): New class.
6662 * layout.cc (Layout::finalize): Move finalization of incremental info
6663 and creation of incremental info sections to follow finalization of
6664 symbol table. Set offsets for postprocessing sections.
6665 (Layout::create_incremental_info_sections): Call
6666 Incremental_inputs::create_data_sections. Add incremental symtab
6667 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
6668 sections to layout after input sections.
6669 * layout.h (struct Timespec): Forward declaration.
6670 (Layout::incremental_inputs): Add const.
6671 (Layout::create_incremental_info_sections): Add parameter.
6672 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6673 * object.cc: Include incremental.h.
6674 (Relobj::finalize_incremental_relocs): New function.
6675 (Sized_relobj::do_layout): Record input sections in incremental info.
6676 * object.h (Object::output_section): New function.
6677 (Object::output_section_offset): Moved from Relobj.
6678 (Object::get_incremental_reloc_base): New function.
6679 (Object::get_incremental_reloc_count): New function.
6680 (Object::do_output_section): New function.
6681 (Object::do_output_section_offset): Moved from Relobj.
6682 (Object::do_get_incremental_reloc_base): New function.
6683 (Object::do_get_incremental_reloc_count): New function.
6684 (Object::Object): Initialize new data members.
6685 (Relobj::output_section): Renamed do_output_section and moved to
6686 protected.
6687 (Relobj::output_section_offset): Moved to Object.
6688 (Relobj::do_get_incremental_reloc_base): New function.
6689 (Relobj::do_get_incremental_reloc_count): New function.
6690 (Relobj::allocate_incremental_reloc_counts): New function.
6691 (Relobj::count_incremental_reloc): New function.
6692 (Relobj::finalize_incremental_relocs): New function.
6693 (Relobj::next_incremental_reloc_index): New function.
6694 (Relobj::reloc_counts_): New data member.
6695 (Relobj::reloc_bases_): New data member.
6696 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
6697 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
6698 (Sized_relobj::incremental_relocs_scan): New function.
6699 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6700 (Sized_relobj::incremental_relocs_write): New function.
6701 (Sized_relobj::incremental_relocs_write_reltype): New function.
6702 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6703 incremental link.
6704 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6705 archives and object files elsewhere.
6706 (Add_symbols::run): Report object files here.
6707 (Finish_group::run): Report end of archive at end of group.
6708 * reloc.cc: Include layout.h, incremental.h.
6709 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6710 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6711 (Sized_relobj::incremental_relocs_scan): New function.
6712 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6713 (Sized_relobj::do_relocate_sections): Write incremental relocations.
6714 (Sized_relobj::incremental_relocs_write): New function.
6715 (Sized_relobj::incremental_relocs_write_reltype): New function.
6716 * script.cc (read_input_script): Rewrite test for incremental link.
6717 Change call to Incremental_inputs::report_script.
6718 * symtab.h (Symbol_table::first_global_index): New function.
6719 (Symbol_table::output_count): New function.
6720
6721 2010-08-12 Doug Kwan <dougkwan@google.com>
6722
6723 * arm.cc (Target_arm::merge_object_attributes): Check command line
6724 options --no-wchar-size-warning and --no-enum-size-warning.
6725 * options.h (General_options): Add ld-compatible options
6726 --no-enum-size-warning and --no-wchar-size-warning.
6727
6728 2010-08-04 Ian Lance Taylor <iant@google.com>
6729
6730 * x86_64.cc (Target_x86_64::Scan::local): Use
6731 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6732 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6733 (Target_x86_64::Scan::global): Likewise.
6734 (Target_x86_64::Relocate::relocate): Likewise.
6735 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6736 Likewise.
6737
6738 2010-08-03 Cary Coutant <ccoutant@google.com>
6739
6740 * merge.cc (Output_merge_string::do_add_input_section): Count strings
6741 to reserve space in merged_strings vector. Keep total input size
6742 for stats.
6743 (Output_merge_string::do_print_merge_stats): Print total input size.
6744 * merge.h (Output_merge_string): Add input_size_ field.
6745 * stringpool.cc (Stringpool_template::string_length): Move
6746 implementations out of Stringpool_template class and place in
6747 stringpool.h.
6748 * stringpool.h (string_length): Move out of Stringpool_template.
6749
6750 2010-08-03 Ian Lance Taylor <iant@google.com>
6751
6752 PR 11712
6753 * layout.cc (relaxation_loop_body): If address of load segment is
6754 set, adjust address to include headers if possible.
6755
6756 2010-08-03 Ian Lance Taylor <iant@google.com>
6757
6758 * version.cc (version_string): Bump to 1.10.
6759
6760 2010-08-03 Ian Lance Taylor <iant@google.com>
6761
6762 PR 11805
6763 * layout.h (enum Output_section_order): Define.
6764 (class Layout): Update declarations.
6765 * layout.cc (Layout::get_output_section): Add order parameter.
6766 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6767 is_first_non_relro parameters. Change all callers.
6768 (Layout::choose_output_section): Likewise.
6769 (Layout::add_output_section_data): Likewise.
6770 (Layout::make_output_section): Likewise. Set order.
6771 (Layout::default_section_order): New function.
6772 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6773 * output.cc (Output_section::Output_section): Initialize order_.
6774 Don't initialize deleted fields.
6775 (Output_segment::Output_segment): Don't initialize deleted
6776 fields.
6777 (Output_segment::add_output_section_to_load): New function
6778 replacing add_output_section. Change all callers to call this or
6779 add_output_section_to_nonload.
6780 (Output_segment::add_output_section_to_nonload): New function.
6781 (Output_segment::remove_output_section): Rewrite.
6782 (Output_segment::add_initial_output_data): Likewise.
6783 (Output_segment::has_any_data_sections): Likewise.
6784 (Output_segment::is_first_section_relro): Likewise.
6785 (Output_segment::maximum_alignment): Likewise.
6786 (Output_segment::has_dynamic_reloc): New function replacing
6787 dynamic_reloc_count. Change all callers.
6788 (Output_segment::has_dynamic_reloc_list): New function replacing
6789 dynamic_reloc_count_list. Change all callers.
6790 (Output_segment::set_section_addresses): Rewrite.
6791 (Output_segment::set_offset): Rewrite.
6792 (Output_segment::find_first_and_last_list): Remove.
6793 (Output_segment::set_tls_offsets): Rewrite.
6794 (Output_segment::first_section_load_address): Likewise.
6795 (Output_segment::output_section_count): Likewise.
6796 (Output_segment::section_with_lowest_load_address): Likewise.
6797 (Output_segment::write_section_headers): Likewise.
6798 (Output_segment::print_sections_to_map): Likewise.
6799 * output.h (class Output_data): Remove dynamic_reloc_count_
6800 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
6801 (Output_data::add_dynamic_reloc): Rewrite.
6802 (Output_data::has_dynamic_reloc): New function.
6803 (Output_data::dynamic_reloc_count): Remove.
6804 (class Output_section): Add order_ field. Remvoe is_relro_local_,
6805 is_last_relro_, is_first_non_relro_, is_interp_,
6806 is_dynamic_linker_section_ fields. Add order and set_order
6807 functions. Remove is_relro_local, set_is_relro_local,
6808 is_last_relro, set_is_last_relro, is_first_non_relro,
6809 set_is_first_non_relro functions, is_interp, set_is_interp,
6810 is_dynamic_linker_section, and set_is_dynamic_linker_section
6811 functions.
6812 (class Output_segment): Change Output_data_list from std::list to
6813 std:;vector. Add output_lists_ field. Remove output_data_ and
6814 output_bss_ fields. Update declarations.
6815
6816 2010-08-02 Ian Lance Taylor <iant@google.com>
6817
6818 * arm.cc (Target_arm::gc_process_relocs): Use typename.
6819 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6820 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6821
6822 2010-08-02 Ian Lance Taylor <iant@google.com>
6823
6824 PR 11855
6825 * script.cc (Script_options::Script_options): Initialize
6826 symbol_definitions_ and symbol_references_.
6827 (Script_options::add_symbol_assignment): Update
6828 symbol_definitions_ and symbol_references_.
6829 (Script_options::add_symbol_reference): New function.
6830 (script_symbol): New function.
6831 * script.h (class Script_options): Add symbol_definitions_ and
6832 symbol_references_ fields.
6833 (Script_options::referenced_const_iterator): New type.
6834 (Script_options::referenced_begin): New function.
6835 (Script_options::referenced_end): New function.
6836 (Script_options::is_referenced): New function.
6837 (Script_options::any_unreferenced): New function.
6838 * script-c.h (script_symbol): Declare.
6839 * yyscript.y (exp): Call script_symbol.
6840 * symtab.cc: Include "script.h".
6841 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6842 Change all callers. Check symbols referenced by scripts.
6843 (Symbol_table::add_undefined_symbols_from_command_line): Add
6844 layout parameter. Change all callers.
6845 (Symbol_table::do_add_undefined_symbols_from_command_line):
6846 Likewise. Break out loop body. Check symbols referenced by
6847 scripts.
6848 (Symbol_table::add_undefined_symbol_from_command_line): New
6849 function broken out of
6850 do_add_undefined_symbols_from_command_line.
6851 * symtab.h (class Symbol_table): Update declarations.
6852 * archive.cc: Include "layout.h".
6853 (Archive::should_include_member): Add layout parameter. Change
6854 all callers. Check for symbol mentioned in expression.
6855 * archive.h (class Archive): Update declaration.
6856 * object.cc (Sized_relobj::do_should_include_member): Add layout
6857 parameter.
6858 * object.h (Object::should_include_member): Add layout parameter.
6859 Change all callers.
6860 (Object::do_should_include_member): Add layout parameter.
6861 (class Sized_relobj): Update declaration.
6862 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6863 parameter.
6864 * dynobj.h (class Sized_dynobj): Update declaration.
6865 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6866 layout parameter.
6867 * plugin.h (class Sized_pluginobj): Update declaration.
6868
6869 2010-08-02 Ian Lance Taylor <iant@google.com>
6870
6871 PR 11866
6872 * output.cc (Output_segment::set_offset): Search for the first and
6873 last sections rather than assuming that the list is in order.
6874 (Output_segment::find_first_and_last_list): New function.
6875 * output.h (class Output_segment): Update declarations.
6876 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6877 (relro_strip_test_SOURCES): New variable.
6878 (relro_strip_test_DEPENDENCIES): New variable.
6879 (relro_strip_test_LDFLAGS): New variable.
6880 (relro_strip_test_LDADD): New variable.
6881 (relro_strip_test.so): New target.
6882
6883 2010-08-02 Ian Lance Taylor <iant@google.com>
6884
6885 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6886 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6887 (Target_i386::got_tlsdesc_section): New function.
6888 (Target_i386::got_section): Create space for GOT entries for
6889 TLSDESC relocations.
6890 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6891 R_386_TLS_GOTDESC.
6892 (Target_i386::Scan::global): Likewise.
6893 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6894 using TLSDESC GOT.
6895 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6896 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6897 (Target_x86_64::got_tlsdesc_section): New function.
6898 (Target_x86_64::got_section): Create space for GOT entries for
6899 TLSDESC relocations.
6900 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6901 R_386_TLS_GOTDESC.
6902 (Target_x86_64::Scan::global): Likewise.
6903 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6904 using TLSDESC GOT.
6905
6906 2010-08-02 Ian Lance Taylor <iant@google.com>
6907
6908 * testsuite/final_layout.sh: Use dc to convert from hex to
6909 decimal.
6910
6911 2010-07-29 Sriraman Tallam <tmsriram@google.com>
6912
6913 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6914 paramter to the call to gold::gc_process_relocs.
6915 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6916 paramter to the call to gold::gc_process_relocs.
6917 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6918 parameter to the call to gold::gc_process_relocs.
6919 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6920 template parameter to the call to gold::gc_process_relocs.
6921 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6922 paramter to the call to gold::gc_process_relocs.
6923 * gc.h (get_embedded_addend_size): New function.
6924 (gc_process_relocs): Save the size of the reloc for use by ICF.
6925 * icf.cc (get_section_contents): Get the addend from the text section
6926 for SHT_REL relocation sections.
6927 * icf.h (Icf::Reloc_addend_size_info): New typedef.
6928 (Icf::Reloc_info): Add new member reloc_addend_size_info.
6929 * int_encoding.h (read_from_pointer): New overloaded function.
6930 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6931 * testsuite/icf_sht_rel_addend_test.sh: New file.
6932 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6933 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6934
6935 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6936
6937 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6938 * Makefile.in: Regenerate.
6939 * testsuite/Makefile.in: Regenerate.
6940
6941 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
6942
6943 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6944 * gold/testsuite/debug_msg.cc: Likewise.
6945 * gold/testsuite/odr_violation1.cc
6946 * gold/testsuite/odr_violation2.cc
6947
6948 2010-07-21 Cary Coutant <ccoutant@google.com>
6949
6950 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6951 string, and length fields.
6952 (Output_merge_string::Merged_strings_list): New type.
6953 (Output_merge_string::Merged_strings_lists): New typedef.
6954 (Output_merge_string): Replace merged_strings_ with
6955 merged_strings_lists_.
6956 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6957 Merged_strings_list per input object and section. Don't store pointer
6958 to the string. Don't store length with each merged string entry.
6959 (Output_merge_string::finalize_merged_data): Loop over list of merged
6960 strings lists. Recompute length of each merged string.
6961
6962 2010-07-15 Cary Coutant <ccoutant@google.com>
6963
6964 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6965 here.
6966
6967 2010-07-14 Ian Lance Taylor <iant@google.com>
6968
6969 * descriptors.cc (Descriptors::open): Report correct name in error
6970 message.
6971
6972 2010-07-13 Doug Kwan <dougkwan@google.com>
6973
6974 * arm.cc (Arm_input_section::Arm_input_section): For a
6975 SHT_ARM_EXIDX section, always keeps the input sections.
6976 (Arm_input_section::set_exidx_section_link): New method.
6977 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6978 has_errors_ to false.
6979 (Arm_exidx_input_section::has_errors,
6980 Arm_exidx_input_section::set_has_errors): New methods.
6981 (Arm_exidx_input_section::has_errors_): New data member.
6982 (Arm_relobj::get_exidx_shndx_list): New method.
6983 (Arm_output_section::append_text_sections_to_list): Do not skip
6984 section without SHF_EXECINSTR.
6985 (Arm_output_section::fix_exidx_coverage): Skip input sections with
6986 errors.
6987 (Arm_relobj::make_exidx_input_section): Add new parameter for text
6988 section header. Make error messages more verbose. Check for
6989 a non-executable section linked to an EXIDX section.
6990 (Arm_relobj::do_read_symbols): Remove error checking, which has been
6991 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
6992 check that there is no deferred EXIDX section if we exit early.
6993 Instead of not making an EXIDX section in case of an error, make one
6994 and set the has_errors flag of it.
6995 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6996 in a relocatable link.
6997 (Target_arm::do_relax): Look for the EXIDX output section instead of
6998 assuming that it is called .ARM.exidx.
6999 (Target_arm::fix_exidx_coverage): Add a new parameter for input
7000 section list. Do not check for SHF_EXECINSTR section flags but
7001 skip any input section with errors.
7002 * output.cc (Output_section::Output_section): Initialize
7003 always_keeps_input_sections_ to false.
7004 (Output_section::add_input_section): Check for
7005 always_keeps_input_sections_.
7006 * output.h (Output_section::always_keeps_input_sections,
7007 Output_section::set_always_keeps_input_sections): New methods.
7008 (Output_section::always_keeps_input_sections): New data member.
7009
7010 2010-07-13 Rafael Espindola <espindola@google.com>
7011
7012 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7013 * fileread.h (Input_file): Add try_extra_search_path and find_file.
7014
7015 2010-07-13 Philip Herron <herron.philip@googlemail.com>
7016 Ian Lance Taylor <iant@google.com>
7017
7018 * output.h (Output_section_lookup_maps::add_merge_section):
7019 Correct check of whether value was inserted.
7020 (Output_section_lookup_maps::add_merge_input_section): Likewise.
7021 (Output_section_lookup_maps::add_relaxed_input_section):
7022 Likewise.
7023 * arm.cc (Target_arm::got_section): Remove used local os.
7024 * i386.cc (Target_i386::got_section): Likewise.
7025 * x86_64.cc (Target_x86_64::got_section): Likewise.
7026 * sparc.cc (Target_sparc::got_section): Likewise.
7027 (Target_sparc::relocate): Remove unused local have_got_offset.
7028 * powerpc.cc (Target_powerpc::relocate): Likewise.
7029
7030 2010-07-13 Ian Lance Taylor <iant@google.com>
7031
7032 * compressed_output.cc (zlib_decompress): Fix signature in
7033 !HAVE_ZLIB_H case.
7034
7035 * archive.cc (Archive::include_member): Unlock an external member
7036 of a thin archive. Don't bother to delete an object we know is
7037 NULL.
7038
7039 2010-07-12 Cary Coutant <ccoutant@google.com>
7040
7041 * compressed_output.cc (zlib_decompress): New function.
7042 (get_uncompressed_size): New function.
7043 (decompress_input_section): New function.
7044 * compressed_output.h (get_uncompressed_size): New function.
7045 (decompress_input_section): New function.
7046 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7047 Handle compressed debug sections.
7048 * layout.cc (is_compressed_debug_section): New function.
7049 (Layout::output_section_name): Map compressed section names to
7050 canonical names.
7051 * layout.h (is_compressed_debug_section): New function.
7052 (is_debug_info_section): Recognize compressed debug sections.
7053 * merge.cc: Include compressed_output.h.
7054 (Output_merge_data::do_add_input_section): Handle compressed
7055 debug sections.
7056 (Output_merge_string::do_add_input_section): Handle compressed
7057 debug sections.
7058 * object.cc: Include compressed_output.h.
7059 (Sized_relobj::Sized_relobj): Initialize new data members.
7060 (build_compressed_section_map): New function.
7061 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7062 * object.h (Object::section_is_compressed): New method.
7063 (Object::do_section_is_compressed): New method.
7064 (Sized_relobj::Compressed_section_map): New type.
7065 (Sized_relobj::do_section_is_compressed): New method.
7066 (Sized_relobj::compressed_sections_): New data member.
7067 * output.cc (Output_section::add_input_section): Handle compressed
7068 debug sections.
7069 * reloc.cc: Include compressed_output.h.
7070 (Sized_relobj::write_sections): Handle compressed debug sections.
7071
7072 2010-07-08 Cary Coutant <ccoutant@google.com>
7073
7074 * resolve.cc (Symbol_table::resolve): Remember whether undef was
7075 weak when resolving to a dynamic def.
7076 (Symbol_table::should_override): Add adjust_dyndef flag; set it
7077 for weak undef/dynamic def cases. Adjust callers.
7078 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7079 undef_binding_weak_.
7080 (Symbol_table::sized_write_globals): Adjust symbol binding.
7081 (Symbol_table::sized_write_symbol): Add binding parameter.
7082 * symtab.h (Symbol::set_undef_binding): New method.
7083 (Symbol::is_undef_binding_weak): New method.
7084 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7085 (Symbol_table::should_override): Add new parameter.
7086 (Symbol_table::sized_write_symbol): Add new parameter.
7087
7088 * testsuite/weak_undef_file1.cc: Add new test case.
7089 * testsuite/weak_undef_file2.cc: Fix header comment.
7090 * testsuite/weak_undef_test.cc: Add new test case.
7091
7092 2010-06-29 Doug Kwan <dougkwan@google.com>
7093
7094 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7095 Initialize USE_SYMBOL_.
7096 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7097 definition.
7098 (Arm_reloc_property::uses_symbol_): New data member declaration.
7099 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7100 uses symbol value and symbol is undefined but not weakly undefined.
7101
7102 2010-06-28 Rafael Espindola <espindola@google.com>
7103
7104 * plugin.cc (Plugin::load): Use dlerror.
7105
7106 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
7107
7108 * symtab.cc (detect_odr_violations): When reporting an ODR
7109 violation, report an object where the symbol is defined.
7110
7111 2010-06-25 Doug Kwan <dougkwan@google.com>
7112
7113 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7114 (Target_arm::section_may_have_icf_unsafe_pointers): New method
7115 definition.
7116 (Target_arm::Scan::local_reloc_may_be_function_pointer,
7117 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7118 target hook to detect function points.
7119 (Target_arm::Scan::possible_function_pointer_reloc): New method.
7120 * icf.h (Icf::check_section_for_function_pointers): Change type of
7121 parameter SECTION_NAME to const reference to std::string. Use
7122 target hook to determine if section may have unsafe pointers.
7123 * target.h (Target::section_may_have_icf_unsafe_pointers): New
7124 method definition.
7125
7126 2010-06-21 Rafael Espindola <espindola@google.com>
7127
7128 * fileread.cc (Input_file::find_fie): New
7129 (Input_file::open): Use Input_file::find_fie.
7130 * fileread.h (Input_file::find_fie): New
7131 * plugin.cc (set_extra_library_path): New.
7132 (Plugin::load): Add set_extra_library_path to the transfer vector.
7133 (Plugin_manager::set_extra_library_path): New.
7134 (Plugin_manager::add_input_file): Use the extra search path if set.
7135 (set_extra_library_path(): New.
7136 * plugin.h (Plugin_manager): Add set_extra_library_path and
7137 extra_search_path_.
7138
7139 2010-06-19 Cary Coutant <ccoutant@google.com>
7140
7141 * layout.cc (gdb_sections): Add .debug_types.
7142 (lines_only_debug_sections): Likewise.
7143
7144 2010-06-18 Rafael Espindola <espindola@google.com>
7145
7146 * plugin.cc (add_input_file,add_input_library)
7147 (Plugin_manager::add_input_file): Make filename arguments const.
7148 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7149 const.
7150
7151 2010-06-16 Doug Kwan <dougkwan@google.com>
7152
7153 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7154 .ARM.attributes section if we have not merged any input
7155 attributes sections.
7156
7157 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7158
7159 * arm.cc: Allow combining objects with no EABI version
7160 information.
7161
7162 2010-06-15 Rafael Espindola <espindola@google.com>
7163
7164 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7165
7166 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7167
7168 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7169 (struct iovec): Correct !HAVE_READV definition.
7170
7171 2010-06-10 Cary Coutant <ccoutant@google.com>
7172
7173 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7174 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7175 reloc sections.
7176 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7177
7178 PR 11683
7179 * symtab.h (Symbol::is_placeholder): New member function.
7180 * target-reloc.h (relocate_section): Check for placeholder symbols.
7181
7182 * testsuite/Makefile.am (plugin_test_8): New test.
7183 (plugin_test_9): New test.
7184 * testsuite/Makefile.in: Regenerate.
7185
7186 2010-06-09 Nick Clifton <nickc@redhat.com>
7187
7188 * yyscript.y (input_list_element): Allow strings prefixed with
7189 the '-' character. Treat these as libraries.
7190 * script.cc (script_add_library): New function. Adds a library
7191 specified by "-l<name>" found in an input script.
7192 * script-c.h: Add prototype for script_add_library.
7193
7194 2010-06-07 Doug Kwan <dougkwan@google.com>
7195
7196 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7197 Restrict stub-group size to be within long conditional branch
7198 range when working around cortex-A8 erratum.
7199
7200 2010-06-07 Damien Diederen <dd@crosstwine.com>
7201
7202 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7203 #ifdef typo.
7204
7205 2010-06-03 Sriraman Tallam <tmsriram@google.com>
7206
7207 PR gold/11658
7208 * output.cc
7209 (Output_section::Input_section_sort_entry::compare_section_ordering):
7210 Change to return non-zero correctly.
7211 (Output_section::Input_section_sort_section_order_index_compare
7212 ::operator()): Change to fix ambiguity in comparisons.
7213
7214 2010-06-01 Sriraman Tallam <tmsriram@google.com>
7215
7216 * gold.h (is_wildcard_string): New function.
7217 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7218 (Layout::layout_eh_frame): Ditto.
7219 (Layout::find_section_order_index): New method.
7220 (Layout::read_layout_from_file): New method.
7221 * layout.h (Layout::find_section_order_index): New method.
7222 (Layout::read_layout_from_file): New method.
7223 (Layout::input_section_position_): New private member.
7224 (Layout::input_section_glob_): New private member.
7225 * main.cc (main): Call read_layout_from_file here.
7226 * options.h (--section-ordering-file): New option.
7227 * output.cc (Output_section::input_section_order_specified_): New
7228 member.
7229 (Output_section::Output_section): Initialize new member.
7230 (Output_section::add_input_section): Add new parameter.
7231 Keep input sections when --section-ordering-file is used.
7232 (Output_section::set_final_data_size): Sort input sections when
7233 section ordering file is specified.
7234 (Output_section::Input_section_sort_entry): Add new parameter.
7235 Check sorting type.
7236 (Output_section::Input_section_sort_entry::compare_section_ordering):
7237 New method.
7238 (Output_section::Input_section_sort_compare::operator()): Change to
7239 consider section_order_index.
7240 (Output_section::Input_section_sort_init_fini_compare::operator()):
7241 Change to consider section_order_index.
7242 (Output_section::Input_section_sort_section_order_index_compare
7243 ::operator()): New method.
7244 (Output_section::sort_attached_input_sections): Change to sort
7245 according to section order when specified.
7246 (Output_section::add_input_section<32, true>): Add new parameter.
7247 (Output_section::add_input_section<64, true>): Add new parameter.
7248 (Output_section::add_input_section<32, false>): Add new parameter.
7249 (Output_section::add_input_section<64, false>): Add new parameter.
7250 * output.h (Output_section::add_input_section): Add new parameter.
7251 (Output_section::input_section_order_specified): New
7252 method.
7253 (Output_section::set_input_section_order_specified): New method.
7254 (Input_section::Input_section): Initialize section_order_index_.
7255 (Input_section::section_order_index): New method.
7256 (Input_section::set_section_order_index): New method.
7257 (Input_section::section_order_index_): New member.
7258 (Input_section::Input_section_sort_section_order_index_compare): New
7259 struct.
7260 (Output_section::input_section_order_specified_): New member.
7261 * script-sections.cc (is_wildcard_string): Delete and move modified
7262 method to gold.h.
7263 (Output_section_element_input::Output_section_element_input): Modify
7264 call to is_wildcard_string.
7265 (Output_section_element_input::Input_section_pattern
7266 ::Input_section_pattern): Ditto.
7267 (Output_section_element_input::Output_section_element_input): Ditto.
7268 * testsuite/Makefile.am (final_layout): New test case.
7269 * testsuite/Makefile.in: Regenerate.
7270 * testsuite/final_layout.cc: New file.
7271 * testsuite/final_layout.sh: New file.
7272
7273 2010-06-01 Rafael Espindola <espindola@google.com>
7274
7275 * plugin.cc (Plugin::load): Pass the output name to the plugin.
7276
7277 2010-06-01 Rafael Espindola <espindola@google.com>
7278
7279 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7280 visibility of symbols.
7281
7282 2010-05-27 Doug Kwan <dougkwan@google.com>
7283
7284 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7285 from start of output section instead of address for a local symbol
7286 in a merged or relaxed section when doing a relocatable link.
7287
7288 2010-05-26 Rafael Espindola <espindola@google.com>
7289
7290 PR 11604
7291 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7292 adding sections the garbage collector removed.
7293 * gold/testsuite/Makefile.am: Add test.
7294 * gold/testsuite/Makefile.in: Regenerate.
7295 * gold/testsuite/plugin_test_7.sh: New.
7296 * gold/testsuite/plugin_test_7_1.c: New.
7297 * gold/testsuite/plugin_test_7_2.c: New.
7298
7299 2010-05-26 Rafael Espindola <espindola@google.com>
7300
7301 * script-sections.cc (Output_section_definition::set_section_addresses):
7302 Check for --section-start.
7303
7304 2010-05-26 Doug Kwan <dougkwan@google.com>
7305
7306 * arm.cc (Arm_scan_relocatable_relocs): New class.
7307 (Target_arm::relocate_special_relocatable): New method.
7308 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7309 (Arm_relocate_functions::thumb_branch_common): Same.
7310 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7311 instead of Default_scan_relocatable_relocs.
7312 * target-reloc.h (relocate_for_relocatable): Let target handle
7313 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7314 * target.h (Sized_target::relocate_special_relocatable): New method.
7315
7316 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7317
7318 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7319
7320 2010-05-23 Doug Kwan <dougkwan@google.com>
7321
7322 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7323 instead of a cast.
7324 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7325 with a direct branch, not a conditional branch, to a stub.
7326 * merge.cc (Output_merge_base::record_input_section): New method
7327 defintion.
7328 (Output_merge_data::do_add_input_section): Record input section if
7329 keeps-input-sections flag is set.
7330 (Output_merge_string::do_add_input_section): Ditto.
7331 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7332 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7333 INPUT_SECTIONS_.
7334 (Output_merge_base::keeps_input_sections,
7335 Output_merge_base::set_keeps_input_sections,
7336 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7337 method definitions.
7338 (Output_merge_base::Input_sections): New type declaration.
7339 (Output_merge_base::input_sections_begin,
7340 Output_merge_base::input_sections_end,
7341 Output_merge_base::do_set_keeps_input_sections): New method definitions.
7342 (Output_merge_base::bool keeps_input_sections_,
7343 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7344 Output_merge_base::input_sections_): New data members.
7345 (Output_merge_data::do_set_keeps_input_sections): New method
7346 defintion.
7347 (Output_merge_string::do_set_keeps_input_sections): Ditto.
7348 * output.cc (Output_section::Input_section::relobj): Move method
7349 defintion from class declaration to here and handle merge sections.
7350 (Output_section::Input_section::shndx): Ditto.
7351 (Output_section::Output_section): Remove initializations of removed
7352 data members and initialize new data member LOOKUP_MAPS_.
7353 (Output_section::add_input_section): Set keeps-input-sections flag
7354 for a newly created merge output section as appropriate. Adjust code
7355 to use Output_section_lookup_maps class.
7356 (Output_section::add_relaxed_input_section): Adjst code for lookup
7357 maps code refactoring.
7358 (Output_section::add_merge_input_section): Add a new parameter
7359 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
7360 class. If adding input section to a newly created merge output
7361 section fails, remove the new merge section.
7362 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7363 Adjust code for use of the Output_section_lookup_maps class.
7364 (Output_section::find_merge_section): Ditto.
7365 (Output_section::build_lookup_maps): New method defintion.
7366 (Output_section::find_relaxed_input_section): Adjust code to use
7367 Output_section_lookup_maps class.
7368 (Output_section::get_input_sections): Export merge sections. Adjust
7369 code to use Output_section_lookup_maps class.
7370 (Output_section:::add_script_input_section): Adjust code to use
7371 Output_section_lookup_maps class. Update lookup maps for merge
7372 sections also.
7373 (Output_section::discard_states): Use Output_section_lookup_maps.
7374 (Output_section::restore_states): Same.
7375 * output.h (Merge_section_properties): Move class defintion out of
7376 Output_section.
7377 (Output_section_lookup_maps): New class.
7378 (Output_section::Input_section::is_merge_section): New method
7379 defintion.
7380 (Output_section::Input_section::relobj): Move defintion out of class
7381 defintion. Declare method only.
7382 (Output_section::Input_section::shndx): Ditto.
7383 (Output_section::Input_section::output_merge_base): New method defintion.
7384 (Output_section::Input_section::u2_.pomb): New union field.
7385 (Output_section::Merge_section_by_properties_map,
7386 Output_section::Output_section_data_by_input_section_map,
7387 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7388 Remove types.
7389 (Output_section::add_merge_input_section): Add new parameter
7390 KEEPS_INPUT_SECTIONS.
7391 (Output_section::build_lookup_maps): New method declaration.
7392 (Output_section::merge_section_map_,
7393 Output_section::merge_section_by_properties_map_,
7394 Output_section::relaxed_input_section_map_,
7395 Output_section::is_relaxed_input_section_map_valid_): Remove data
7396 members.
7397 (Output_section::lookup_maps_): New data member.
7398
7399 2010-05-21 Doug Kwan <dougkwan@google.com>
7400
7401 PR gold/11619
7402 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7403 avoid a compilation error.
7404
7405 2010-05-19 Rafael Espindola <espindola@google.com>
7406
7407 * script-sections.cc (Output_section_definition::allocate_to_segment):
7408 Update the phdrs_list even when the output section is NULL.
7409 * testsuite/Makefile.am: Add test.
7410 * testsuite/Makefile.in: Regenerate.
7411 * testsuite/script_test_9.cc: New.
7412 * testsuite/script_test_9.sh: New.
7413 * testsuite/script_test_9.t: New.
7414
7415 2010-05-19 Doug Kwan <dougkwan@google.com>
7416
7417 * arm.cc (Arm_input_section::original_size): New method.
7418 (Arm_input_section::do_addralign): Add a cast.
7419 (Arm_input_section::do_output_offset): Remove static cast.
7420 (Arm_input_section::original_addralign,
7421 Arm_input_section::original_size_): Change type to uint32_t.
7422 (Arm_input_section::init): Add safe casts for section alignment
7423 and size.
7424 (Arm_input_section::set_final_data_size): Do not set address and
7425 offset of stub table.
7426 (Arm_output_section::fix_exidx_coverage): Change use of of
7427 Output_section::Simple_input_section to that of
7428 Output_section::Input_section.
7429 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7430 except for the first pass.
7431 * output.cc (Output_section::get_input_sections): Change type of
7432 input_sections to std::list<Input_section>.
7433 (Output_section::add_script_input_section): Rename from
7434 Output_section::add_simple_input_section. Change type of SIS
7435 parameter from Simple_input_section to Input_section.
7436 * output.h (Output_section::Simple_input_section): Remove class.
7437 (Output_section::Input_section): Change class visibility to public.
7438 (Output_section::Input_section::addralign): Use stored alignments
7439 for special input sections if set.
7440 (Output_section::Input_section::set_addralign): New method.
7441 (Output_section::get_input_sections): Change parameter type from
7442 list of Simple_input_section to list of Input_section.
7443 (Output_section::add_script_input_section): Rename from
7444 Output_section::add_simple_input_section. Change first parameter's
7445 type from Simple_input_section to Input_section and remove the
7446 second and third parameters.
7447 * script-sections.cc (Input_section::Input_section_list): Change
7448 type to list of Output_section::Input_section/
7449 (Input_section_info::Input_section_info): Change parameter type of
7450 INPUT_SECTION to Output_section::Input_section.
7451 (Input_section_info::input_section): Change return type.
7452 (Input_section_info::input_section_): Change type to
7453 Output_section::Input_section.
7454 (Output_section_element_input::set_section_addresses): Adjust code
7455 to use Output_section::Input_section instead of
7456 Output_section::Simple_input_section. Adjust code for renaming
7457 of Output_section::add_simple_input_section.
7458 (Orphan_output_section::set_section_addresses): Ditto.
7459
7460 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7461
7462 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7463 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7464
7465 2010-05-18 Rafael Espindola <espindola@google.com>
7466
7467 * options.cc (General_options::finalize): Handle -nostdlib.
7468 * options.h (nostdlib): New option.
7469 * script.cc (script_add_search_dir): Handle -nostdlib.
7470
7471 2010-05-12 Doug Kwan <dougkwan@google.com>
7472
7473 * arm.cc (Target_arm::do_finalize_sections): Create an empty
7474 attributes section only if there no attributes section after merging.
7475 (Target_arm::merge_object_attributes): Move value of
7476 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7477 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7478 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7479 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7480 and arm_attr_merge_7.stdout.
7481 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7482 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7483 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7484 arm_attr_merge_7b.o): New rules.
7485 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7486 arm_attr_merge_7
7487 * testsuite/Makefile.in: Regenerate.
7488 * testsuite/arm_attr_merge.sh: New file.
7489 * testsuite/arm_attr_merge_[67][ab].s: Same.
7490
7491 2010-05-05 Nick Clifton <nickc@redhat.com>
7492
7493 * po/es.po: Updated Spanish translation.
7494
7495 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
7496
7497 * Makefile.am (install-exec-local): Properly install gold as
7498 default cross linker.
7499 * Makefile.in: Regenerated.
7500
7501 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
7502 Nick Clifton <nickc@redhat.com>
7503
7504 * configure.ac (install_as_default): Define and set to false
7505 unless --enable-gold or --enable-gold=both/gold has been
7506 specified.
7507 * configure: Regenerate.
7508
7509 * Makefile.am (install-exec-local): Install the executable as
7510 'ld.gold'. If install_as_default is true then also install it as
7511 'ld'.
7512 * Makefile.in: Regenerated.
7513
7514 2010-04-24 Ian Lance Taylor <iant@google.com>
7515
7516 * layout.cc (Layout::layout_reloc): In relocatable link don't
7517 combine reloc sections for grouped sections.
7518
7519 2010-04-23 Sriraman Tallam <tmsriram@google.com>
7520
7521 * gc.h (gc_process_relocs): Pass information on relocs pointing to
7522 sections that are not ordinary to icf.
7523 * icf.cc (get_section_contents): Handle relocation pointing to section
7524 with no object or shndx information.
7525 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7526 * testsuite/Makefile.in: Regenerate.
7527 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7528 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7529
7530 2010-04-22 Ian Lance Taylor <iant@google.com>
7531
7532 * expression.cc (Expression::Expression_eval_info): Add
7533 result_alignment_pointer field.
7534 (Expression::eval_with_dot): Add result_alignment_pointer
7535 parameter. Change all callers.
7536 (Expression::eval_maybe_dot): Likewise.
7537 (class Binary_expression): Add alignment_pointer parameter to
7538 left_value and right_value. Change all callers.
7539 (BINARY_EXPRESSION): Set result alignment.
7540 (class Trinary_expression): Add alignment_pointer parameter to
7541 arg2_value and arg3_value. Change all callers.
7542 (Trinary_cond::value): Set result alignment.
7543 (Max_expression::value, Min_expression::value): Likewise.
7544 (Align_expression::value): Likewise.
7545 * script-sections.cc (class Sections_element): Add dot_alignment
7546 parameter to set_section_addresses virtual function. Update
7547 instantiations.
7548 (class Output_section_element): Likewise.
7549 (Script_sections::create_segments): Add dot_alignment parameter.
7550 Change all callers.
7551 (Script_sections::create_segments_from_phdrs_clause): Likewise.
7552 (Script_sections::set_phdrs_clause_addresses): Likewise.
7553 * script-sections.h: Update declarations.
7554 * script.h: Update declarations.
7555 * output.h (Output_segment::set_minimum_p_align): Don't decrease
7556 min_p_align.
7557 * testsuite/script_test_3.t: Set large alignment.
7558 * testsuite/script_test_3.sh: Make sure that at least one LOAD
7559 segment has expected alignment.
7560
7561 2010-04-22 Nick Clifton <nickc@redhat.com>
7562
7563 * po/gold.pot: Updated by the Translation project.
7564 * po/vi.po: Updated Vietnamese translation.
7565
7566 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
7567
7568 * testsuite/Makefile.am (check_PROGRAMS): Add
7569 icf_virtual_function_folding_test.
7570 * testsuite/Makefile.in: Regenerated.
7571
7572 2010-04-15 Andrew Haley <aph@redhat.com>
7573
7574 * options.h (merge_exidx_entries): New option.
7575 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7576 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7577 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7578 (Target_arm::merge_exidx_entries): New function.
7579 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7580 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7581 to Arm_exidx_fixup constructor.
7582 Add new arg, merge_exidx_entries.
7583 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7584 Arm_output_section::fix_exidx_coverage.
7585
7586 2010-04-18 Sriraman Tallam <tmsriram@google.com>
7587
7588 * icf.cc (get_section_contents): Check for preemptible functions.
7589 Ignore addend when appropriate.
7590 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
7591 section folded.
7592 (add_from_relobj): Check for section folded.
7593 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7594 * symtab.h (should_add_dynsym_entry): Add new parameter.
7595 * target-reloc.h (scan_relocs): Check for section folded.
7596 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7597 Check reloc types for function pointers in shared objects.
7598 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7599 case.
7600 (icf_preemptible_functions_test): New test case.
7601 (icf_string_merge_test): New test case.
7602 * testsuite.Makefile.in: Regenerate.
7603 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7604 bar_glob. Refactor code.
7605 * testsuite/icf_preemptible_functions_test.cc: New file.
7606 * testsuite/icf_preemptible_functions_test.sh: New file.
7607 * testsuite/icf_string_merge_test.cc: New file.
7608 * testsuite/icf_string_merge_test.sh: New file.
7609 * testsuite/icf_virtual_function_folding_test.cc: New file.
7610 * testsuite/icf_virtual_function_folding_test.sh: New file.
7611
7612 2010-04-14 Doug Kwan <dougkwan@google.com>
7613
7614 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7615 for local symbol recounting if we remove a section due to ICF.
7616 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7617 there are no regular objects in input.
7618
7619 2010-04-13 Doug Kwan <dougkwan@google.com>
7620
7621 * arm.cc (Arm_input_section::set_final_data_size): Compute
7622 accurate final data size instead of using current data size.
7623
7624 2010-04-09 Doug Kwan <dougkwan@google.com>
7625
7626 * layout.cc (Layout::choose_output_section): Handle script section
7627 types.
7628 (Layout::make_output_section_for_script): Add section type parameter.
7629 Handle script section types.
7630 * layout.h (Layout::make_output_section_for_script): Add section
7631 type parameter.
7632 * output.cc (Output_section::Output_section): Initialize data member
7633 is_noload_.
7634 (Output_section::do_reset_address_and_file_offset): Do not set address
7635 to 0 if section is a NOLOAD section.
7636 * output.h (Output_section::is_noload): New method.
7637 (Output_section::set_is_noload): Ditto.
7638 (Output_section::is_noload_): New data member.
7639 * script-c.h (Script_section_type): New enum type.
7640 (struct Parser_output_section_header): Add new file section_type.
7641 * script-sections.cc (Sections_element::output_section_name): Add
7642 parameter for returning script section type.
7643 (Output_section_definition::output_section_name): Ditto.
7644 (Output_section_definition::section_type)P; New method.
7645 (Output_section_definiton::script_section_type_name): Ditto.
7646 (Output_section_definition::script_section_type_): New data member.
7647 (Output_section_definition::Output_section_definition): Initialize
7648 data member Output_section_definition::script_section_type_.
7649 (Output_section_definition::create_sections): Pass script section type
7650 to Layout::make_output_section_for_script.
7651 (Output_section_definition::output_section_name): Return script
7652 section type to caller.
7653 (Output_section_definition::set_section_address): Do not advance
7654 dot value and load address if section type is NOLOAD. Set address
7655 of NOLOAD sections regardless of section flags.
7656 (Output_section_definition::print): Print section type if it is
7657 not SCRIPT_SECTION_TYPE_NONE.
7658 (Output_section_definition::section_type): New method.
7659 (Output_section_definition::script_section_type_name): Ditto.
7660 (Script_sections::output_section_name): Add new parameter
7661 PSECTION_TYPE for returning script section type. Pass it to
7662 section elements. Handle discard sections.
7663 (Sort_output_sections::operator()): Handle NOLOAD sections.
7664 * script-sections.h (Script_sections::Section_type): New enum type.
7665 (Script_sections::output_section_name): Add a new parameter for
7666 returning script section type.
7667 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7668 INFO and NOLOAD.
7669 * yyscript.y (union): Add new field SECTION_TYPE.
7670 (COPY, DSECT, INFO, NOLOAD): New tokens.
7671 (opt_address_and_section_type): Change type to output_section_header.
7672 (section_type): New non-terminal
7673 (section_header): Handle section type.
7674 (opt_address_and_section_type): Return section type value.
7675
7676 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
7677
7678 * testsuite/plugin_common_test_1.c (foo): Add prototype.
7679 * testsuite/plugin_common_test_2.c (foo): Likewise.
7680
7681 2010-04-08 Doug Kwan <dougkwan@google.com>
7682
7683 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7684 Output_merge_data.
7685 * output.cc (Output_section::add_merge_input_section): Simplify
7686 code and return status of Output_merge_base::add_input_section.
7687 Update merge section map only if Output_merge_base::add_input_section
7688 returns true.
7689
7690 2010-04-07 Doug Kwan <dougkwan@google.com>
7691
7692 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7693 if section is marked as containing instructions but has no mapping
7694 symbols.
7695 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7696 correct section index.
7697 (Arm_relobj::find_linked_text_section): Ditto.
7698
7699 2010-04-07 Cary Coutant <ccoutant@google.com>
7700
7701 * archive.cc (include_member): Destroy Read_symbols_data object before
7702 releasing file.
7703 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7704 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7705 (Read_symbols_data::~Read_symbols_data) New destructor.
7706 (Section_relocs::Section_relocs) New constructor.
7707 (Section_relocs::~Section_relocs) New destructor.
7708 (Read_relocs_data::Read_relocs_data) New constructor.
7709 (Read_relocs_data::~Read_relocs_data) New destructor.
7710 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7711 pointers to NULL after deleting.
7712
7713 2010-04-07 Doug Kwan <dougkwan@google.com>
7714
7715 * arm.cc: Replace "endianity" with "endianness" in comments.
7716 (Arm_exidx_cantunwind): Ditto.
7717 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7718 (Arm_relobj::merge_flags_and_attributes): New method.
7719 (Arm_relobj::merge_flags_and_attributes_): New data member.
7720 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7721 (Arm_relobj::scan_sections_for_stubs): Ditto.
7722 (Arm_relobj::do_read_symbols): Check to see if we really want to
7723 merge processor-specific flags and attributes. Exit early if
7724 an object is empty except for section names and the undefined symbol.
7725 (Target_arm::do_finalize_sections): Move check for ELF format to
7726 Arm_relobj::do_read_symbols. Merge processor specific flags and
7727 attributes from a regular object only when we have determined that
7728 it is aapropriate. Do not create an .ARM.attributes section in
7729 output if there is no regular input object.
7730 (Target_arm::merge_processor_specific_flags): Check
7731 --warn-mismatch before printing any error.
7732 (Target_arm::merge_object_attributes): Ditto.
7733 * gold.cc (queue_middle_tasks): Handle the case in which there is
7734 no regular object in input.
7735 * options.cc (General_options::parse_EB): New method.
7736 (General_options::parse_EL): Same.
7737 (General_options::General_options): Initialize endianness_.
7738 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7739 New options.
7740 (General_options::Endianness): New enum.
7741 (General_options::endianness): New method.
7742 (General_options::endianness_): New data member.
7743 * parameters.cc (Parameters::set_options): Check target endianness.
7744 (Parameters::set_target_once): Ditto.
7745 (Parameters::check_target_endianness): New method.
7746 (parameters_force_valid_target): If either -EL or -EB is specified,
7747 use it to define endianness of default target.
7748 * parameters.h (Parameters::check_target_endianness): New method
7749 declaration.
7750 * target.h (class Target): Change "endianity" to "endianness"
7751 in comments.
7752
7753 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7754
7755 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7756 * configure: Regenerate.
7757 * Makefile.in: Regenerate.
7758 * testsuite/Makefile.in: Regenerate.
7759
7760 2010-04-06 Cary Coutant <ccoutant@google.com>
7761
7762 gcc PR lto/42757
7763 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7764 prevailing definitions of common symbols.
7765 * testsuite/plugin_test_6.sh: New test case.
7766 * testsuite/plugin_common_test_1.c: New test case.
7767 * testsuite/plugin_common_test_2.c: New test case.
7768 * testsuite/Makefile.am (plugin_test_6): New test case.
7769 * testsuite/Makefile.in: Regenerate.
7770
7771 2010-04-06 Nick Clifton <nickc@redhat.com>
7772
7773 * po/vi.po: New Vietnamese translation.
7774
7775 2010-03-30 Doug Kwan <dougkwan@google.com>
7776
7777 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7778
7779 2010-03-25 Doug Kwan <dougkwan@google.com>
7780
7781 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7782 to avoid a conversion warning on a 32-bit host.
7783
7784 2010-03-24 Ian Lance Taylor <iant@google.com>
7785
7786 * testsuite/script_test_3.t: Add a TLS segment.
7787 * testsuite/Makefile.am (check_PROGRAMS): Add
7788 tls_phdrs_script_test.
7789 (tls_phdrs_script_test_SOURCES): Define.
7790 (tls_phdrs_script_test_DEPENDENCIES): Define.
7791 (tls_phdrs_script_test_LDFLAGS): Define.
7792 (tls_phdrs_script_test_LDADD): Define.
7793 * testsuite/Makefile.in: Rebuild.
7794
7795 2010-03-23 Cary Coutant <ccoutant@google.com>
7796
7797 * fileread.cc (find_or_make_view): Fix comment.
7798
7799 2010-03-23 Ian Lance Taylor <iant@google.com>
7800
7801 * script-sections.cc (class Orphan_section_placement): Define
7802 PLACE_TLS and PLACE_TLS_BSS.
7803 (Orphan_section_placement::Orphan_section_placement): Initialize
7804 new places.
7805 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7806 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7807 (tls_script_test_SOURCES): Define.
7808 (tls_script_test_DEPENDENCIES): Define.
7809 (tls_script_test_LDFLAGS): Define.
7810 (tls_script_test_LDADD): Define.
7811 * testsuite/Makefile.in: Rebuild.
7812
7813 2010-03-22 Doug Kwan <dougkwan@google.com>
7814
7815 * arm.cc (Arm_relocate_functions::abs8,
7816 Arm_relocate_functions::abs16): Use correct check for overflow
7817 specified in the ARM ELF specs.
7818 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
7819 target of a BLX instruction specially.
7820 (Reloc_stub::stub_type_for_reloc): Ditto.
7821 (Relocate::relocate): Use symbolic names instead of numeric relocation
7822 codes to report error.
7823 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7824 workaround.
7825 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7826 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7827 thumb2_blx_out_of_range.stdout
7828 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7829 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7830 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7831 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7832 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7833 thumb2_blx_in_range, thumb2_blx_in_range.o,
7834 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7835 thumb2_blx_out_of_range.o): New rules.
7836 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7837 thumb2_blx_in_range and thumb2_blx_out_of_range.
7838 * testsuite/Makefile.in: Regenerate.
7839 * arm_branch_in_range.sh: Add tests for THUMB BLX.
7840 * testsuite/thumb_blx_in_range.s: New file.
7841 * testsuite/thumb_blx_out_of_range.s: New file.
7842
7843 2010-03-22 Rafael Espindola <espindola@google.com>
7844
7845 * archive.cc (Should_include): Move to archive.h.
7846 (should_include_member): Make it a member of Archive.
7847 (Lib_group): New.
7848 (Add_lib_group_symbols): New.
7849 * archive.h: Include options.h.
7850 (Archive_member): Moved from Archive.
7851 (Should_include): Moved from archive.cc.
7852 (Lib_group): New.
7853 (Add_lib_group_symbols): New.
7854 * dynobj.cc (do_should_include_member): New.
7855 * dynobj.h (do_should_include_member): New.
7856 * gold.cc (queue_initial_tasks): Update call to queue.
7857 * main.cc (main): Print lib group stats.
7858 * object.cc (do_should_include_member): New.
7859 * object.h: Include archive.h.
7860 (Object::should_include_member): New.
7861 (Object::do_should_include_member): New.
7862 (Sized_relobj::do_should_include_member): New.
7863 * options.cc (General_options::parse_start_lib): New.
7864 (General_options::parse_end_lib): New.
7865 (Input_arguments::add_file): Handle lib groups.
7866 (Input_arguments::start_group): Check we are not in a lib.
7867 (Input_arguments::start_lib): New.
7868 (Input_arguments::end_lib): New.
7869 * options.h (General_options): Add start_lib and end_lib.
7870 (Input_argument::lib_): New.
7871 (Input_argument::lib): New.
7872 (Input_argument::is_lib): New.
7873 (Input_file_lib): New.
7874 (Input_arguments::in_lib_): New.
7875 (Input_arguments::in_lib): New.
7876 (Input_arguments::start_lib): New.
7877 (Input_arguments::end_lib_): New.
7878 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7879 in unused members as preempted.
7880 (Sized_pluginobj::do_should_include_member): New.
7881 * plugin.h (Sized_pluginobj::do_should_include_member): New.
7882 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7883 return the blocker.
7884 (Read_symbols::do_whole_lib_group): New.
7885 (Read_symbols::do_lib_group): New.
7886 (Read_symbols::do_read_symbols): Handle lib groups.
7887 (Read_symbols::get_name): Handle lib groups.
7888 * readsyms.h (Read_symbols): Add an archive member pointer.
7889 (Read_symbols::do_whole_lib_group): New.
7890 (Read_symbols::do_lib_group): New.
7891 (Read_symbols::member_): New.
7892 * script.cc (read_input_script): Update call to queue_soon.
7893
7894 2010-03-19 Doug Kwan <dougkwan@google.com>
7895
7896 * arm.cc (Stub_table::Stub_table): Initialize new data members
7897 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7898 (Stub_table::add_reloc_stub): Assign stub offset and update
7899 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7900 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7901 New data members.
7902 (Stub_table::update_data_size_and_addralign): Use
7903 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7904 instead of going over all reloc stubs.
7905 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7906 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7907 Stringpool_template::offset_ to size of Stringpool_char.
7908 (Stringpool_template::new_key_offset): Remove code to initialize
7909 Stringpool_template::offset_.
7910 * stringpool.h (Stringpool_template::set_no_zero_null): Set
7911 Stringpool_template::offset_ to zero.
7912
7913 2010-03-15 Doug Kwan <dougkwan@google.com>
7914
7915 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7916 offset_.
7917 (Stringpool_template::new_key_offset): New method.
7918 (Stringpool_template::add_string): Assign offsets when adding new
7919 strings.
7920 (Stringpool_template::set_string_offsets): Do not set string offsets
7921 when not optimizing.
7922 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7923 member size_.
7924 (Chunked_vector::clear): Clear size_.
7925 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7926 (Chunked_vector::size): Return size_.
7927 (Chunked_vector::push_back): Use size_ to find insert position.
7928 (Chunked_vector::size_): New data member.
7929 (Stringpool_template::set_no_zero_null): Assert string set is empty.
7930 (Stringpool_template::new_key_offset): New method declaration.
7931 (Stringpool_template::offset_): New data member.
7932
7933 2010-03-15 Rafael Espindola <espindola@google.com>
7934
7935 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7936 Add_symbols' constructor.
7937 * readsyms.h (Add_symbols): Remove the input_group member.
7938
7939 2010-03-10 Ian Lance Taylor <iant@google.com>
7940
7941 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7942 target to ask whether a reference to a symbol requires a stack
7943 split.
7944 * target.h (Target::is_call_to_non_split): New function.
7945 (Target::do_is_call_to_non_split): Declare virtual function.
7946 * target.cc: Include "symtab.h".
7947 (Target::do_is_call_to_non_split): New function.
7948 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7949
7950 2010-03-10 Cary Coutant <ccoutant@google.com>
7951
7952 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7953 (File_read::open[1]): Remove initial mapping of whole_file_view_.
7954 (File_read::open[2]): Add whole_file_view_ to list of views.
7955 (File_read::make_view): Remove test of whole_file_view_.
7956 (File_read::find_or_make_view): Create whole_file_view_ if
7957 necessary.
7958 (File_read::clear_views): Replace bool parameter with enum;
7959 adjust all callers. Don't delete views with permanent data;
7960 do delete cached views and views from archives if
7961 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
7962 if clearing the corresponding view.
7963 * fileread.h (File_read::Clear_views_mode): New enum.
7964 (File_read::View::is_permanent_view): New method.
7965 (File_read::clear_views): Replace bool parameter
7966 with enum; adjust all callers.
7967 * options.h (General_options): Change keep_files_mapped option;
7968 add map_whole_files.
7969 * readsyms.cc (Add_symbols::run): Delete sd_ object before
7970 releasing the file.
7971 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7972 the file.
7973
7974 2010-03-10 David S. Miller <davem@davemloft.net>
7975
7976 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7977
7978 2010-03-09 Sriraman Tallam <tmsriram@google.com>
7979
7980 * icf.cc (get_section_contents): Add '@' marker after processing the
7981 merge reloc.
7982
7983 2010-03-08 Doug Kwan <dougkwan@google.com>
7984
7985 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7986 due to a conversion warning.
7987 (Arm_relobj::update_output_local_symbol_count): Check for local
7988 symbol with unset output index.
7989
7990 2010-03-05 Ian Lance Taylor <iant@google.com>
7991
7992 * options.h (class General_options): Add --spare-dynamic-tags.
7993 * output.cc (Output_data_dynamic::set_final_data_size): Implement
7994 --spare-dynamic-tags.
7995
7996 2010-03-05 Ian Lance Taylor <iant@google.com>
7997
7998 * incremental.cc: Include "libiberty.h".
7999
8000 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
8001
8002 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8003 function, is_info_ member.
8004 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8005 (Versions::Versions): Update caller.
8006 (Versions::define_base_version): Likewise.
8007 (Versions::add_def): Likewise.
8008
8009 2010-03-03 Sriraman Tallam <tmsriram@google.com>
8010
8011 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8012 (Scan::possible_function_pointer_reloc): New function.
8013 (Scan::local_reloc_may_be_function_pointer): Change to call
8014 possible_function_pointer_reloc.
8015 (Scan::global_reloc_may_be_function_pointer): Ditto.
8016 * icf.h (Icf::check_section_for_function_pointers): Change to reject
8017 relocations in ".data.rel.ro._ZTV" section.
8018 * testsuite/icf_safe_so_test.sh: Change to pass i386.
8019 * testsuite/icf_safe_so_test.cc: Ditto.
8020 * testsuite/icf_safe_test.cc: Ditto.
8021 * testsuite/icf_safe_test.sh: Ditto.
8022
8023 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8024 Ian Lance Taylor <iant@google.com>
8025
8026 * target-reloc.h (relocate_section): Check the symbol table index
8027 for -1U before setting the local symbol index.
8028 (scan_relocatable_relocs): If copying the relocation, record that
8029 the local symbol is required.
8030 * object.h (Symbol_value::is_output_symtab_index_set): New
8031 function.
8032 (Symbol_value::may_be_discarded_from_output_symtab): New
8033 function.
8034 (Symbol_value::has_output_symtab_entry): New function.
8035 (Symbol_value::needs_output_symtab_entry): Remove.
8036 (Symbol_value::output_symtab_index): Make sure the symbol index is
8037 set.
8038 (Symbol_value::set_output_symtab_index): Make sure the symbol
8039 index is not set. Make sure the new index is valid.
8040 (Symbol_value::set_must_have_output_symtab_entry): New function.
8041 (Symbol_value::has_output_dynsym_entry): New function.
8042 (Symbol_value::set_output_dynsym_index): Make sure the new index
8043 is valid.
8044 (Sized_relobj::set_must_have_output_symtab_entry): New function.
8045 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8046 local symbol if permitted.
8047 (Sized_relobj::do_finalize_local_symbols): Call
8048 is_output_symtab_index_set rather than needs_output_symtab_entry.
8049 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8050 rather than needs_output_symtab_entry. Call
8051 has_output_dynsym_entry rather than needs_output_dynsym_entry.
8052 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8053 is_output_symtab_index_set rather than needs_output_symtab_entry.
8054 * testsuite/discard_locals_relocatable_test.c: New file.
8055 * testsuite/discard_locals_test.sh: Test -r.
8056 * testsuite/Makefile.am (check_DATA): Add
8057 discard_locals_relocatable_test1.syms,
8058 discard_local_relocatable_test2.syms.
8059 (MOSTLYCLEANFILES): Likewise. Also add
8060 discard_locals_relocatable_test1.lout and
8061 discard_locals_relocatable_test2.out.
8062 (discard_locals_relocatable_test1.syms): New target.
8063 (discard_locals_relocatable_test.o): New target.
8064 (discard_locals_relocatable_test1.out): New target.
8065 (discard_locals_relocatable_test2.syms): New target.
8066 (discard_locals_relocatable_test2.out): New target.
8067 (various): Add missing ../ld-new dependencies.
8068 * testsuite/Makefile.in: Rebuild.
8069
8070 2010-03-03 Nick Clifton <nickc@redhat.com>
8071
8072 * po/fi.po: New Finnish translation.
8073
8074 2010-03-01 Doug Kwan <dougkwan@google.com>
8075
8076 * layout.cc (Layout::Layout): Force section types of .init_array*,
8077 .preinit_array* and .fini_array* sections.
8078 * output.cc (Output_section::Input_section_sort_entry::has_priority):
8079 Fix check of return value of std::string::find.().
8080 (Output_section::Input_section_sort_compare::operator()): Remove
8081 comment about .init_array.
8082 (Output_section::Input_section_sort_init_fini_compare::operator()):
8083 New method.
8084 (Output_section::sort_attached_input_sections): Handle .init_array
8085 and .fini_array specially.
8086 * output.h (Output_section::Inut_section_sort_compare): Update
8087 comment.
8088 (Output_section::Input_section_sort_init_fini_compare): New struct.
8089
8090 2010-02-26 Doug Kwan <dougkwan@google.com>
8091
8092 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8093 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8094 * testsuite/debug_msg.sh: Avoid matching source line number for
8095 use of global variable undef_int.
8096
8097 2010-02-26 Doug Kwan <dougkwan@google.com>
8098
8099 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8100 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8101 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8102 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8103 * options.cc (General_options::General_options): Initialize member
8104 fix_v4bx_.
8105 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8106 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8107 and rm_no_fix_v4bx.stdout
8108 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8109 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8110 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8111 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8112 and arm_no_fix_v4bx.
8113 * Makefile.in: Regenerate.
8114 * testsuite/arm_fix_v4bx.s: New file.
8115 * testsuite/arm_fix_v4bx.sh: Ditto.
8116
8117 2010-02-24 Doug Kwan <dougkwan@google.com>
8118
8119 * arm.cc (Target_arm::got_section): Make the .got section the first
8120 non RELRO section in the data segment.
8121 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8122 suffixes of section names.
8123
8124 2010-02-24 Doug Kwan <dougkwan@google.com>
8125
8126 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8127 flags and attributes merging if an input file is a binary file.
8128 * fileread.cc (Input_file::open): Record format of original file.
8129 * fileread.h (Input_file::Format): New enum type.
8130 (Input_file::Input_file): Initialize data member format_.
8131 (Input_file::format): New method definition.
8132 (Input_file::format_):: New data member.
8133
8134 2010-02-24 Doug Kwan <dougkwan@google.com>
8135
8136 * arm.cc (Arm_output_data_got): New class.
8137 (ARM_TCB_SIZE): New constant
8138 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8139 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8140 If user uses a script with a SECTIONS clause, issue only a warning
8141 for a misplaced EXIDX input section. Otherwise, issue an error.
8142 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8143 garbage collection.
8144 (Target_arm::got_mode_index_entry): Handle static linking.
8145 (Target_arm::Scan::local): Ditto.
8146 (Target_arm::Scan::global): Ditto.
8147 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
8148 all incorrectly implemented relocations.
8149 (Target_arm::fix_exidx_coverage): Pass layout to
8150 Arm_output_section::fix_exidx_coverage.
8151 * layout.cc (Layout::section_name_mapping): Remove trailing dots
8152 from ".ARM.exidx." and ".ARM.extab.".
8153
8154 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8155
8156 * arm.cc (Target_arm::do_finalize_sections): Create attribute
8157 section if it does not already exist.
8158 * attributes.cc (Attributes_section_data::Attributes_section_data):
8159 Don't crash if size is zero.
8160
8161 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8162 Ian Lance Taylor <iant@google.com>
8163
8164 * gold.cc (queue_middle_tasks): If no input files were opened,
8165 exit.
8166 * workqueue.h (Task_function::Task_function): Assert that there is
8167 a blocker.
8168
8169 2010-02-22 Doug Kwan <dougkwan@google.com>
8170
8171 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8172 * icf.cc (get_section_contents): Cast snprintf arguments to long long
8173 types to avoid warnings due to different uint64_t implementations
8174 on different hosts.
8175
8176 2010-02-21 Doug Kwan <dougkwan@google.com>
8177
8178 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8179 handling of the maximum backward branch offset.
8180 (Arm_relocate_functions::thumb_branch_common): Ditto.
8181 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8182 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8183 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8184 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8185 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8186 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8187 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8188 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8189 thumb_bl_out_of_range thumb_bl_out_of_range.o,
8190 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8191 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8192 thumb2_bl_out_of_range.o): New rules.
8193 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8194 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8195 thumb2_bl_out_of_range
8196 * testsuite/Makefile.in: Regenerate.
8197 * testsuite/arm_bl_in_range.s: New file.
8198 * testsuite/arm_bl_out_of_range.s: Ditto.
8199 * testsuite/arm_branch_in_range.sh: Ditto.
8200 * testsuite/arm_branch_range.t: Ditto.
8201 * testsuite/thumb2_branch_range.t: Ditto.
8202 * testsuite/thumb_bl_in_range.s: Ditto.
8203 * testsuite/thumb_bl_out_of_range.s: Ditto.
8204 * testsuite/thumb_branch_range.t: Ditto.
8205
8206 2010-02-20 Sriraman Tallam <tmsriram@google.com>
8207
8208 * gc.h (gc_process_relocs): Change vectors to point to the new list.
8209 Add reloc offset information.
8210 * icf.cc (get_section_contents): Change iterators to point to the new
8211 vectors. Add reloc offset information to the contents.
8212 * icf.h (Icf::Sections_reachable_info): New typedef.
8213 (Icf::Sections_reachable_list): New typedef.
8214 (Icf::Offset_info): New typedef.
8215 (Icf::Reloc_info): New struct typedef.
8216 (Icf::Reloc_info_list): New typedef.
8217 (Icf::symbol_reloc_list): Delete method.
8218 (Icf::addend_reloc_list): Delete method.
8219 (Icf::section_reloc_list): Delete method.
8220 (Icf::reloc_info_list): New method.
8221 (Icf::reloc_info_list_): New member.
8222
8223 2010-02-19 Doug Kwan <dougkwan@google.com>
8224
8225 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8226 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8227 * arm.cc (Arm_relocation_functions): New forward declaration.
8228 (Target_arm::Target_arm): Initialize new data members
8229 got_mod_index_offset_ and tls_base_symbol_defined_.
8230 (Target_arm::Relocate::relocate_tls): New method.
8231 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8232 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8233 New methods.
8234 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8235 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8236 (Target_arm::got_mod_index_offset_,
8237 Target_arm::tls_base_symbol_defined_): New data members.
8238 (Target_arm::Scan::local, Target::Scan::global,
8239 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8240 relocations.
8241
8242 2010-02-18 Doug Kwan <dougkwan@google.com>
8243
8244 * arm.cc (Arm_relobj::find_linked_text_section): New method.
8245 (Arm_relobj::make_exidx_input_section): Pass section index of linked
8246 text section as a parameter becuase some broken tools may not set
8247 the link in section header.
8248 (Target_arm::has_got_section): New method.
8249 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8250 without any mapping symbol as data only. Remove warning.
8251 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8252 link in its section header, try to discover the link by inspecting the
8253 REL31 relocation at the beginning of the section.
8254 (Target_arm::Scan::check_non_pic): Report name of offending relocation
8255 in error message.
8256 (Target_arm::Scan::global): Treat any reference to the symbol
8257 _GLOBAL_OFFSET_TABLE_ as a GOT access.
8258
8259 2010-02-12 Sriraman Tallam <tmsriram@google.com>
8260
8261 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8262 (Scan::global_reloc_may_be_function_pointer): New function.
8263 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8264 (Scan::global_reloc_may_be_function_pointer): New function.
8265 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8266 (Scan::global_reloc_may_be_function_pointer): New function.
8267 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8268 (Scan::global_reloc_may_be_function_pointer): New function.
8269 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8270 (Scan::global_reloc_may_be_function_pointer): New function.
8271 (Scan::possible_function_pointer_reloc): New function.
8272 (Target_x86_64::can_check_for_function_pointers): New function.
8273 * gc.h (gc_process_relocs): Scan relocation types to determine if
8274 function pointers were taken for targets that support it.
8275 * icf.cc (Icf::find_identical_sections): Include functions for
8276 folding in safe ICF whose pointer is not taken.
8277 * icf.h (Secn_fptr_taken_set): New typedef.
8278 (fptr_section_id_): New member.
8279 (section_has_function_pointers): New function.
8280 (set_section_has_function_pointers): New function.
8281 (check_section_for_function_pointers): New function.
8282 * options.h: Fix comment for safe ICF option.
8283 * target.h (can_check_for_function_pointers): New function.
8284 * testsuite/Makefile.am: Add icf_safe_so_test test case.
8285 Modify icf_safe_test for X86-64.
8286 * testsuite/Makefile.in: Regenerate.
8287 * testsuite/icf_safe_so_test.cc: New file.
8288 * testsuite/icf_safe_so_test.sh: New file.
8289 * testsuite/icf_safe_test.cc (kept_func_3): New function.
8290 (main): Change to take pointer to function kept_func_3.
8291 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8292 folding is done correctly for X86-64.
8293
8294 2010-02-12 David S. Miller <davem@davemloft.net>
8295
8296 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8297 is_symbolless parameter.
8298 (Output_reloc<SHT_REL>::is_symbolless): New.
8299 (Output_reloc<SHT_REL>::is_symbolless_): New.
8300 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8301 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8302 (Output_reloc<SHT_RELA>::is_symbolless): New.
8303 (Output_data_reloc::add_global): Handle is_symbolless.
8304 (Output_data_reloc::add_global_relative): Likewise.
8305 (Output_data_reloc::add_local): Likewise.
8306 (Output_data_reloc::add_local_relative): Likewise.
8307 (Output_data_reloc::add_symbolless_global_addend): New.
8308 (Output_data_reloc::add_symbolless_local_addend): New.
8309 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8310 is_symbolless.
8311 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8312 instead of ->is_relative_
8313 (Output_reloc::write): Likewise.
8314 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8315 (Output_reloc::write_rel): Simplify.
8316
8317 * sparc.cc (Target_sparc::Scan::local): Use
8318 ->add_symbolless_local_addend as needed.
8319 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8320 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
8321 based upon relocation offset.
8322
8323 2010-02-11 Doug Kwan <dougkwan@google.com>
8324
8325 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8326 (Target_arm::Scan::global): Ditto. Also remove a comment before the
8327 beginning of function.
8328 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8329 and MOVT_ABS relocations. Those are non issued in scanning. Fix
8330 parameter is_32bit in calls to should_apply_static_reloc.
8331 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8332 (check_DATA): Add arm_abs_global.stdout.
8333 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8334 arm_abs_global.stdout): New rules.
8335 (MOSTLLYCLEANFILES): Add arm_abs_global
8336 * Makefile.in: Regenerate.
8337 * testsuite/arm_abs_global.s: New file.
8338 * testsuite/arm_abs_global.sh: Ditto.
8339 * testsuite/arm_abs_lib.s: Ditto.
8340
8341 2010-02-11 Ian Lance Taylor <iant@google.com>
8342
8343 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8344 Read_relocs task.
8345 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
8346 Allocate_commons_task first.
8347 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8348 task, rather than symtab_lock_.
8349 (Gc_process_relocs::~Gc_process_relocs): New function.
8350 (Gc_process_relocs::is_runnable): Check this_blocker_.
8351 (Gc_process_relocs::locks): Use next_blocker_ rather than
8352 blocker_.
8353 (Scan_relocs::~Scan_relocs): New function.
8354 (Scan_relocs::is_runnable): Check this_blocker_ rather than
8355 symtab_lock_.
8356 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
8357 next_blocker_.
8358 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8359 fields. Add this_blocker_ and next_blocker_ fields. Adjust
8360 constructor accordingly.
8361 (class Gc_process_relocs): Likewise.
8362 (class Scan_relocs): Likewise.
8363 * common.h (class Allocate_commons_task): Remove symtab_lock_
8364 field, and corresponding constructor parameter.
8365 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8366 symtab_lock_.
8367 (Allocate_commons_task::locks): Likewise.
8368
8369 2010-02-11 Ian Lance Taylor <iant@google.com>
8370
8371 * gold-threads.h (class Once): Define.
8372 (class Initialize_lock): Rewrite as child of Once.
8373 * gold-threads.cc (class Once_initialize): Define.
8374 (once_pointer_control): New static variable.
8375 (once_pointer, once_arg): New static variables.
8376 (c_run_once): New static function.
8377 (Once::Once, Once::run_once, Once::internal_run): New functions.
8378 (class Initialize_lock_once): Remove.
8379 (initialize_lock_control): Remove.
8380 (initialize_lock_pointer): Remove.
8381 (initialize_lock_once): Remove.
8382 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8383 (Initialize_lock::initialize): Rewrite.
8384 (Initialize_lock::do_run_once): New function.
8385 * archive.cc (Archive::interpret_header): Only clear name if it is
8386 not already empty.
8387 * fileread.cc: Include "gold-threads.h"
8388 (file_counts_lock): New static variable.
8389 (file_counts_initialize_lock): Likewise.
8390 (File_read::release): Only increment counts when using --stats.
8391 Use a lock around the increment.
8392 * parameters.cc (class Set_parameters_target_once): Define.
8393 (set_parameters_target_once): New static variable.
8394 (Parameters::Parameters): Move here from parameters.h.
8395 (Parameters::set_target): Rewrite.
8396 (Parameters::set_target_once): New function.
8397 (Parameters::clear_target): Move here and rewrite.
8398 * parameters.h (class Parameters): Update declarations. Add
8399 set_parameters_target_once_ field.
8400 (Parameters::Parameters): Move to parameters.cc.
8401 (Parameters::clear_target): Likewise.
8402 * readsyms.cc (Read_symbols::do_group): Create a Start_group
8403 task.
8404 (Start_group::~Start_group): New function.
8405 (Start_group::is_runnable): New function.
8406 (Start_group::locks, Start_group::run): New functions.
8407 (Finish_group::run): Change saw_undefined to size_t.
8408 * readsyms.h (class Start_group): Define.
8409 (class Finish_group): Change saw_undefined_ field to size_t.
8410 (Finish_group::Finish_group): Remove saw_undefined and
8411 this_blocker parameters. Change all callers.
8412 (Finish_group::set_saw_undefined): New function.
8413 (Finish_group::set_blocker): New function.
8414 * symtab.h (class Symbol_table): Change saw_undefined to return
8415 size_t. Change saw_undefined_ field to size_t.
8416 * target-select.cc (Set_target_once::do_run_once): New function.
8417 (Target_selector::Target_selector): Initialize set_target_once_
8418 field. Don't initialize lock_ and initialize_lock_ fields.
8419 (Target_selector::instantiate_target): Rewrite.
8420 (Target_selector::set_target): New function.
8421 * target-select.h (class Set_target_once): Define.
8422 (class Target_selector): Update declarations. Make
8423 Set_target_once a friend. Remove lock_ and initialize_lock_
8424 fields. Add set_target_once_ field.
8425
8426 2010-02-10 Ian Lance Taylor <iant@google.com>
8427
8428 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8429 queueing any tasks.
8430 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
8431 (queue_middle_tasks): Add all blockers before queueing any tasks.
8432 (queue_final_tasks): Likewise.
8433 * token.h (Task_token::add_blockers): New function.
8434 * object.h (Input_objects::number_of_relobjs): New function.
8435
8436 2010-02-10 Ian Lance Taylor <iant@google.com>
8437
8438 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8439 shared, not if not position independent.
8440 * x86_64.cc (Relocate::relocate_tls): Likewise.
8441 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8442 (tls_pie_pic_test): New target.
8443 * testsuite/Makefile.in: Rebuild.
8444
8445 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8446 (tls_test_main_pie.o, tls_test_pie.o): New targets.
8447 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8448 * testsuite/Makefile.in: Rebuild.
8449
8450 2010-02-09 David S. Miller <davem@davemloft.net>
8451
8452 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8453 R_SPARC_RELATIVE using ->add_local_relative().
8454 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8455
8456 * output.h (Output_data_dynamic::add_section_size): New method
8457 that takes two Output_data objects.
8458 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8459 entry param. Handle it in initializers.
8460 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8461 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8462 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8463 arg.
8464 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8465 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8466 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8467 for dynrel_includes_plt.
8468 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8469 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8470 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8471 before .rela.plt
8472 (Target_sparc::do_finalize_sections): Update to pass true for
8473 dynrel_includes_plt.
8474 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8475 output before .rela.plt
8476 (Target_powerpc::do_finalize_sections): Update to pass true for
8477 dynrel_includes_plt when 32-bit.
8478
8479 2010-02-08 Doug Kwan <dougkwan@google.com>
8480
8481 * arm.cc (Arm_relobj::simple_input_section_output_address): New
8482 method.
8483 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8484 Arm_relobj::scan_section_for_cortex_a8_stubs,
8485 Arm_relobj::do_relocation_section): Instead of calling
8486 Output_section::output_address, use faster
8487 Arm_relobj::simple_input_section_output_address.
8488
8489 2010-02-08 David S. Miller <davem@davemloft.net>
8490
8491 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8492 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8493 relocation helper function.
8494
8495 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8496 just like R_SPARC_GOT{10,13,22}.
8497 (Target_sparc::Scan::local): Likewise.
8498 (Target_sparc::Relocate:relocate): Likewise.
8499
8500 2010-02-06 Ian Lance Taylor <iant@google.com>
8501
8502 * configure.ac: Rewrite targetobjs duplicate removal code to use
8503 only shell constructs.
8504 * configure: Rebuild.
8505
8506 2010-02-05 Doug Kwan <dougkwan@google.com>
8507
8508 PR 11247
8509 * arm.cc (Arm_relobj::section_is_scannable): New method.
8510 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8511 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8512
8513 2010-02-04 Doug Kwan <dougkwan@google.com>
8514
8515 PR 11247
8516 * arm-reloc-property.cc (cstdio): Include.
8517 * configure.ac (targetobjs): Remove duplicates.
8518 * configure: Regenerate.
8519 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8520 big and little endian version for a given address size.
8521
8522 2010-02-03 Doug Kwan <dougkwan@google.com>
8523
8524 * arm-reloc-property.cc
8525 (Arm_reloc_property_table::reloc_name_in_error_message): New method
8526 definition.
8527 * arm-reloc-property.h
8528 (Arm_reloc_property_table::get_implemented_static_reloc_property):
8529 New method definition.
8530 (Arm_reloc_property_table::reloc_name_in_error_message): New method
8531 declaration.
8532 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8533 overflow to N.
8534 (GOT_PREL): Change implemented to Y.
8535 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8536 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8537 (Arm_relocate_functions::movw_abs_nc): Remove method.
8538 (Arm_relocate_functions::movt_abs): Ditto.
8539 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8540 (Arm_relocate_functions::thm_movt_abs): Ditto.
8541 (Arm_relocate_functions::movw_rel_nc): Ditto.
8542 (Arm_relocate_functions::movw_rel): Ditto.
8543 (Arm_relocate_functions::movt_rel): Ditto.
8544 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8545 (Arm_relocate_functions:thm_movw_rel): Ditto.
8546 (Arm_relocate_functions:thm_movt_rel): Ditto.
8547 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8548 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8549 New method definitions.
8550 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8551 (Arm_relocation_functions::arm_grp_ldr): Ditto.
8552 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8553 (Arm_relocation_functions::arm_grp_ldc): Ditto.
8554 (Target_arm::Relocate::relocate): Check for non-static or
8555 unimplemented relocation code and exit early. Change calls to
8556 Target_arm::reloc_uses_thumb_bit and
8557 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8558 instead. Refactor code to handle similar relocations to increase
8559 code sharing. Remove check for unsupported relocation code in switch
8560 statement.
8561 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8562 relocation property table to find out size. Change error message to
8563 print out the name of a relocation code instead of the numeric value.
8564 (Target_arm::scan_reloc_for_stub): Use relocation property table
8565 instead of calling Target_arm::reloc_uses_thumb_bit().
8566
8567 2010-02-02 Doug Kwan <dougkwan@google.com>
8568
8569 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8570 types of relaxed input section.
8571
8572 2010-02-02 Doug Kwan <dougkwan@google.com>
8573
8574 * Makefile.am (HFILES): Add arm-reloc-property.h.
8575 (DEFFILES): New.
8576 (TARGETSOURCES): Add arm-reloc-property.cc
8577 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8578 (libgold_a_SOURCES): $(DEFFILES)
8579 * Makefile.in: Regenerate.
8580 * arm-reloc-property.cc: New file.
8581 * arm-reloc-property.h: New file.
8582 * arm-reloc.def: New file.
8583 * arm.cc: Update comments.
8584 (arm-reloc-property.h): New included header.
8585 (arm_reloc_property_table): New global variable.
8586 (Target_arm::do_select_as_default_target): New method definition.
8587 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8588 arm-reloc-property to targ_extra_obj.
8589 * parameters.cc (set_parameters_target): Call
8590 Target::select_as_default_target().
8591 * target.h (Target::select_as_default_target): New method definition.
8592 (Target::do_select_as_default_target): Same.
8593
8594 2010-02-01 Doug Kwan <dougkwan@google.com>
8595
8596 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8597 first_output_text_section_.
8598 (Arm_exidx_fixup::first_output_text_section): New method definition.
8599 (Arm_exidx_fixup::first_output_text_section_): New data member.
8600 (Arm_exidx_fixup::process_exidx_section): Record the first text
8601 output section seen.
8602 (Arm_output_section::fix_exidx_coverage): Set correct linked section
8603 and entsize in output section header.
8604
8605 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8606
8607 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8608 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8609 (Arm_relocate_functions::thm_alu11): New Method.
8610 (Arm_relocate_functions::thm_pc8): New Method.
8611 (Arm_relocate_functions::thm_pc12): New Method.
8612 (Target_arm::Scan::local): Handle the relocations.
8613 (Target_arm::Scan::global): Likewise.
8614 (Target_arm::Relocate::relocate): Likewise.
8615 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8616
8617 2010-01-29 Doug Kwan <dougkwan@google.com>
8618
8619 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8620 of relocation types as ld.
8621
8622 2010-01-29 Doug Kwan <dougkwan@google.com>
8623
8624 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8625 to public.
8626 (Arm_relocate_functions::thumb_branch_common): Ditto.
8627 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8628 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8629 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8630 Arm_relocate_functions::jump24): Remove.
8631 (Target_arm::Relocate::relocate): Adjust code to call
8632 Arm_relocation_functions::arm_branch_common and
8633 Arm_relocation_functions::thumb_branch_common instead of their removed
8634 wrappers. Merge switch-cases together to reduce source code size.
8635
8636 2010-01-29 Doug Kwan <dougkwan@google.com>
8637
8638 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8639 output_local_symbol_count_needs_update_.
8640 (Arm_relobj::output_local_symbol_count_needs_update,
8641 Arm_relobj::set_output_local_symbol_count_needs_update,
8642 Arm_relobj::update_output_local_symbol_count): New methods.
8643 (Arm_relobj::output_local_symbol_count_needs_update_): New data
8644 member.
8645 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8646 of pointed function as in a R_ARM_PREL31 relocation.
8647 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8648 for output local symbol count updating.
8649 (Target_arm::do_relax): Update output local symbol counts in objects
8650 if necessary.
8651 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8652
8653 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8654
8655 * arm.cc: Added support for the ARM relocations:
8656 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8657 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8658 (Arm_relocate_functions::movw_rel_nc): Renamed (was
8659 movw_prel_nc).
8660 (Arm_relocate_functions::movw_rel): New method.
8661 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8662 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8663 thm_movw_prel_nc).
8664 (Arm_relocate_functions::thm_movw_rel): New method.
8665 (Arm_relocate_functions::thm_movt_rel): Renamed (was
8666 thm_movt_prel).
8667 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8668 relocations.
8669 (Target_arm::Scan::global): Likewise.
8670 (Target_arm::Relocate::relocate): Likewise.
8671 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8672 Likewise.
8673
8674 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8675
8676 * arm.cc: Added support for ARM group relocations.
8677 (Target_arm::reloc_needs_sym_origin): New method.
8678 (Arm_relocate_functions::calc_grp_kn): New method.
8679 (Arm_relocate_functions::calc_grp_residual): New method.
8680 (Arm_relocate_functions::calc_grp_gn): New method.
8681 (Arm_relocate_functions::arm_grp_alu): New Method.
8682 (Arm_relocate_functions::arm_grp_ldr): New Method.
8683 (Arm_relocate_functions::arm_grp_ldrs): New Method.
8684 (Arm_relocate_functions::arm_grp_ldc): New Method.
8685 (Target_arm::Scan::local): Handle the ARM group relocations.
8686 (Target_arm::Scan::global): Likewise.
8687 (Target_arm::Relocate::relocate): Likewise.
8688 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8689 Likewise.
8690
8691 2010-01-26 Doug Kwan <dougkwan@google.com>
8692
8693 * arm.cc (set): Include.
8694 (class Arm_exidx_fixup): Change type of last_input_section_ to const
8695 pointer type.
8696 (Arm_output_section::Text_section_list): New type.
8697 (Arm_output_section::append_text_sections_to_list): New method.
8698 (Arm_output_section::fix_exidx_coverage): Ditto.
8699 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8700 (Arm_relobj::convert_input_section_to_relaxed_section): Use
8701 Relobj::set_section_offset() instead of
8702 Sized_relobj::invalidate_section_offset().
8703 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8704 parameter for section headers. Ignore relocation sections for
8705 unallocated sections and EXIDX sections.
8706 (Target_arm::fix_exidx_coverage): New method.
8707 (Target_arm::output_section_address_less_than): New type.
8708 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8709 linked text section instead of the EXIDX section.
8710 (Arm_output_section::create_stub_group): Add an assertion to check
8711 that this is not an EXIDX output section.
8712 (Arm_output_section::append_text_sections_to_list): New method.
8713 (Arm_output_section::fix_exidx_coverage): Ditto.
8714 (Arm_relobj::scan_sections_for_stubs): Adjust call to
8715 Arm_relobj::section_needs_reloc_stub_scanning.
8716 (Target_arm::do_relax): Fix EXIDX output section coverage in the
8717 first pass.
8718 (Target_arm::fix_exidx_coverage): New method.
8719 * object.h (Relobj::set_output_section): New method.
8720 (Sized_relobj::invalidate_section_offset): Remove method.
8721 (Sized_relobj::do_invalidate_section_offset): Remove method.
8722 (Sized_relobj::do_set_section_offset): Handle offset value -1.
8723
8724 2010-01-25 Doug Kwan <dougkwan@google.com>
8725
8726 * arm.cc (Arm_exidx_merged_section::do_output_offset):
8727 Fix warning due to signed and unsigned comparison on a 32-bit host.
8728
8729 2010-01-22 Doug Kwan <dougkwan@google.com>
8730
8731 * arm.cc (Target_arm::do_relax): Record an output section for section
8732 offset adjustment it contains any stub table that has changed.
8733 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8734 offsets in an output section if necessary.
8735 * output.cc (Output_section::Output_section): Initialize
8736 section_offsets_need_adjustments_.
8737 (Output_section::add_input_section_for_script): Renamed to
8738 Output_section::add_simple_input_section.
8739 (Output_section::save_states): Add a comment.
8740 (Output_section::discard_states): New method defintion.
8741 (Output_section::adjust_section_offsets): Same.
8742 * output.h (Output_section::add_input_section_for_script): Renamed to
8743 Output_section::add_simple_input_section.
8744 (Output_section::discard_states): New method declaration.
8745 (Output_section::adjust_section_offsets): Same.
8746 (Output_section::section_offsets_need_adjustment,
8747 Output_section::set_section_offsets_need_adjustment): New method
8748 definitions.
8749 (Output_section::section_offsets_need_adjustment_): New data member.
8750 * script-sections.cc
8751 (Output_section_element_input::set_section_address): Adjust code for
8752 renaming of Output_section::add_input_section_for_script.
8753 (Orphan_output_section::set_section_address): Same.
8754
8755 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8756
8757 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8758 Fix_v4bx enum values .
8759 * gold/options.h (General_options): New option definitions.
8760 (General_options::fix_v4bx): New method.
8761 (General_options::Fix_v4bx): New enum.
8762 * gold/options.cc (General_options::parse_fix_v4bx): New method.
8763 (General_options::parse_fix_v4bx_interworking): New method.
8764
8765 2010-01-22 Doug Kwan <dougkwan@google.com>
8766
8767 * arm.cc (Arm_exidx_fixup): New class.
8768
8769 2010-01-21 Doug Kwan <dougkwan@google.com>
8770
8771 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8772 classes.
8773 (Arm_exidx_section_offset_map): New type.
8774
8775 2010-01-21 Doug Kwan <dougkwan@google.com>
8776
8777 * arm.cc (Arm_exidx_input_section): New class.
8778 (Arm_relobj::exidx_input_section_by_link,
8779 Arm_relobj::exidx_input_section_by_shndx,
8780 Arm_relobj::make_exidx_input_section): New methods.
8781 (read_arm_attributes_section): Remove.
8782 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8783 information about them.
8784 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8785 to here.
8786
8787 2010-01-20 Doug Kwan <dougkwan@google.com>
8788
8789 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8790 Input_section_specifier to Section_id.
8791 (Target_arm::new_arm_input_section: Adjust code for change of key
8792 type.
8793 (Target_arm::find_arm_input_section): Ditto.
8794 * gc.h (object.h): Include for Section_id nand Section_id_hash.
8795 (Section_id): Remove.
8796 (Garbage_collection::Section_id_hash): Remove.
8797 * icf.h (object.h): Include for Section_id nand Section_id_hash.
8798 (Section_id): Remove.
8799 (Icf::Section_id_hash): Remove.
8800 * object.h (Section_id, Const_section_id, Section_id_hash,
8801 Const_section_id_hash): New type definitions.
8802 * output.cc (Output_section::add_relaxed_input_section): Change to
8803 use Const_section_id instead of Input_section_specifier as key type.
8804 (Output_section::add_merge_input_section): Ditto.
8805 (Output_section::build_relaxation_map): Change to use Section_id
8806 instead of Input_section_specifier as key type.
8807 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8808 Ditto.
8809 (Output_section::convert_input_sections_to_relaxed_sections): Change
8810 to use Const_section_id instead of Input_section_specifier as key type.
8811 (Output_section::find_merge_section): Ditto.
8812 (Output_section::find_relaxed_input_section): Ditto.
8813 * output.h (Input_section_specifier): Remove class.
8814 (Output_section::Output_section_data_by_input_section_map): Change
8815 key type to Const_section_id.
8816 (Output_section::Output_relaxed_input_section_by_input_section_map):
8817 Ditto.
8818 (Output_section::Relaxation_map): Change key type to Section_id.
8819
8820 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8821
8822 * gold/arm.cc: Added support for R_ARM_V4BX relocation
8823 (class Arm_v4bx_stub): New class.
8824 (DEF_STUBS): Updated definition to support v4_veneer_bx.
8825 (Stub_factory::make_arm_v4bx_stub): New method.
8826 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8827 (Stub_table::empty): Handle v4bx stubs.
8828 (Stub_table::add_arm_v4bx_stub): New method.
8829 (Stub_table::find_arm_v4bx_stub): New method.
8830 (Arm_relocate_functions::v4bx): New method.
8831 (Target_arm::fix_v4bx): New method.
8832 (Target_arm::Target_arm): Handle R_ARM_V4BX.
8833 (Stub_table::relocate_stubs): Likewise.
8834 (Stub_table::do_write): Likewise.
8835 (Stub_table::update_data_size_and_addralign): Likewise.
8836 (Stub_table::finalize_stubs): Likewise.
8837 (Target_arm::Scan::local): Likewise.
8838 (Target_arm::Scan::global): Likewise.
8839 (Target_arm::do_finalize_sections): Likewise.
8840 (Target_arm::Relocate::relocate): Likewise.
8841 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8842 Likewise.
8843 (Target_arm::scan_reloc_for_stub): Likewise.
8844 (Target_arm::scan_reloc_section_for_stubs): Likewise.
8845
8846 2010-01-19 Ian Lance Taylor <iant@google.com>
8847
8848 * output.cc (Output_section_headers::do_sized_write): Write large
8849 segment count to sh_info field.
8850 (Output_file_header::do_sized_write): For large segment count,
8851 write PN_XNUM to e_phnum field.
8852
8853 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8854
8855 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8856 (Arm_relocate_functions::thm_jump8): New function.
8857 (Arm_relocate_functions::thm_jump11): New function.
8858 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8859 R_ARM_THM_JUMP11.
8860 (Target_arm::Scan::global): Likewise.
8861 (Target_arm::Relocate::relocate): Likewise.
8862 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8863 Likewise.
8864
8865 2010-01-14 Doug Kwan <dougkwan@google.com>
8866
8867 * arm.cc (map, utility): Include headers.
8868 (Target_arm::apply_cortex_a8_workaround): New method.
8869 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8870 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8871 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8872 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8873 the --[no-]fix-cortex-a8 command line options.
8874 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8875 (Target_arm::relocate_stub): Use addend in instruction template.
8876 * options.h (DEFINE_bool): Set the user-set flag.
8877 (General_options): Add --[no-]-fix-cortex options.
8878 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8879 : Update fast look-up map after conversion.
8880
8881 2010-01-14 Sriraman Tallam <tmsriram@google.com>
8882
8883 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8884 in the first pass of do_layout.
8885
8886 2010-01-13 Doug Kwan <dougkwan@google.com>
8887
8888 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8889 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8890 apparent compiler problem of not folding static constant integral
8891 data members of elfcpp::Elf_sizes<32>.
8892
8893 2010-01-13 Doug Kwan <dougkwan@google.com>
8894
8895 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8896 Arm_relobj::section_needs_cortex_a8_stub_scanning,
8897 Arm_relobj::scan_section_for_cortex_a8_erratum,
8898 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8899 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8900 sections to scan for relocation stubs into a new method
8901 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
8902 relocation and Cortex-A8 stub scanning.
8903 (Target_arm::do_relax): Force stubs to be after stubbed sections
8904 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
8905 the beginning of a new relaxation pass. Update a comment.
8906 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8907
8908 2010-01-12 Ian Lance Taylor <iant@google.com>
8909
8910 * target-reloc.h (visibility_error): New inline function.
8911 (relocate_section): Call visibility_error.
8912 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8913 (MOSTLYCLEANFILES): Likewise.
8914 (protected_4_pic.o, protected_3.err): New targets.
8915 * testsuite/protected_4.cc: New file.
8916
8917 2010-01-12 Doug Kwan <dougkwan@google.com>
8918
8919 * arm.cc (Cortex_a8_reloc): New class.
8920 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8921 and cortex_a8_relocs_info_.
8922 (Target_arm::fix_cortex_a8): New method definition.
8923 (Target_arm::Cortex_a8_relocs_info): New type.
8924 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8925 New data member declarations.
8926 (Target_arm::scan_reloc_for_stub): Record information about
8927 relocations for THUMB branches that might be exempted from the
8928 Cortex-A8 workaround.
8929 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8930 at the beginning of a relaxation pass.
8931
8932 2010-01-12 Doug Kwan <dougkwan@google.com>
8933
8934 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8935 (Arm_relobj::Mapping_symbol_position,
8936 Arm_reloj::Mapping_symbol_position_less,
8937 Arm_relobj::Mapping_symbols_info): New types.
8938 (Target_arm::is_mapping_symbol_name): New method definition.
8939 (Arm_relobj::do_count_local_symbols): Save information about mapping
8940 symbols.
8941
8942 2010-01-11 Doug Kwan <dougkwan@google.com>
8943
8944 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8945 Arm_relocate_functions::thumb32_branch_upper,
8946 Arm_relocate_functions::thumb32_branch_lower,
8947 Arm_relocate_functions::thumb32_cond_branch_offset,
8948 Arm_relocate_functions::thumb32_cond_branch_upper,
8949 Arm_relocate_functions::thumb32_cond_branch_lower,
8950 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8951 branch offset encoding.
8952 (Arm_relocate_functions::thumb_branch_common): Use new branch
8953 offset encoding methods to avoid code duplication.
8954 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8955 (Stub_addend_reader::operator()): Use new branch encoding method
8956 to avoid code duplication.
8957
8958 2010-01-11 Doug Kwan <dougkwan@google.com>
8959
8960 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8961 (Target_arm::do_finalize_sections): Define special EXIDX section
8962 symbols only if referenced.
8963 * gc.h (Garbage_collection::add_reference): New method.
8964 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8965 code duplication.
8966
8967 2010-01-11 Ian Lance Taylor <iant@google.com>
8968
8969 * script.cc (Version_script_info::build_expression_list_lookup):
8970 Change complaing about duplicate wildcard match from error to
8971 warning.
8972
8973 * script.cc (class Lazy_demangler): Recreate--revert part of patch
8974 of 2009-12-30.
8975 (Version_script_info::Version_script_info): Initialize globs_,
8976 default_version_, default_is_global_, and exact_. Don't
8977 initialize globals_ or locals_.
8978 (Version_script_info::build_lookup_tables): Build local symbols
8979 first.
8980 (Version_script_info::unquote): New function.
8981 (Version_script_info::add_exact_match): New function.
8982 (Version_script_info::build_expression_list_lookup): Remove lookup
8983 parameter. Add is_global parameter. Change all callers. Handle
8984 wildcard pattern specially. Unquote pattern. Call
8985 add_exact_match.
8986 (Version_script_info::get_name_to_match): New function.
8987 (Version_script_info::get_symbol_version): New function.
8988 (Version_script_info::get_symbol_version_helper): Remove.
8989 (Version_script_info::check_unmatched_names): Call unquote.
8990 * script.h (class Version_script_info): Change get_symbol_version
8991 to be non-inline and add is_global parameter; change all callers.
8992 Rewrite symbol_is_local. Update declarations. Define struct
8993 Version_tree_match, Exact, Globs. Don't define struct Lookup.
8994 Remove globals_ and locals_ members. Add exact_, globs_,
8995 default_version_, is_global_.
8996 (Version_script_info::Glob): Remove pattern, add expression and
8997 is_global. Update constructor. Change all callers.
8998 * dynobj.cc (Versions::finalize): Mark the version symbol as the
8999 default version.
9000 (Versions::symbol_section_contents): If a symbol is undefined, or
9001 defined in a dynamic object, set the version index to
9002 VER_NDX_LOCAL.
9003 * symtab.cc (Symbol_table::add_from_relobj): Don't call
9004 symbol_is_local.
9005 (Symbol_table::add_from_pluginobj): Likewise.
9006 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9007
9008 2010-01-11 Doug Kwan <dougkwan@google.com>
9009
9010 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9011 (incremental_dump_LDADD): Add linking option for libintl.
9012 * Makefile.in: Regenerate.
9013
9014 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
9015
9016 PR gold/11144
9017 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9018 instead of -Ds.
9019 * testsuite/Makefile.in: Regenerated.
9020
9021 2010-01-10 Doug Kwan <dougkwan@google.com>
9022
9023 * options.h (DEFINE_var): Use parentheses around argument varname__
9024 in macro body to avoid any unintended subsequent substitutions.
9025
9026 2010-01-10 Ian Lance Taylor <iant@google.com>
9027
9028 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9029 candidates before doing symbol resolution.
9030
9031 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9032 ODR candidates if only one is weak.
9033
9034 2010-01-08 Ian Lance Taylor <iant@google.com>
9035
9036 * script.cc (Version_script_info::build_expression_list_lookup):
9037 Don't warn about ambiguous version, just record the ambiguity.
9038 (Version_script_info::get_symbol_version_helper): Give error if
9039 version is ambiguous.
9040
9041 2010-01-08 Doug Kwan <dougkwan@google.com>
9042
9043 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9044 prev_data_size_ and prev_addralign_. Remove initializer for
9045 deleted data member has_been_changed_.
9046 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9047 to determine if the table is empty.
9048 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9049 Remove.
9050 (Stub_table::add_reloc_stub): Define method in class definition
9051 instead of just declaring it there.
9052 (Stub_table::add_cortex_a8_stub): New method definition.
9053 (Stub_table::update_data_size_and_addralign): Ditto.
9054 (Stub_table::finalize_stubs): Ditto.
9055 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9056 (Stub_table::do_addralign_): Return address alignment in the
9057 (Stub_table::do_reset_address_and_file_offset): Define method in
9058 class definition instead of declaring it there. Set current data
9059 size to be the data size of the previous pass.
9060 (Stub_table::set_final_data_size): Use current data size as the
9061 final data size.
9062 (Stub_table::relocate_stub): Change parameter type of stub from
9063 Reloc_stub pointer to Stub pointer.
9064 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9065 (Stub_table::Cortex_a8_stub_list): New typedef.
9066 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9067 Stub_table::prev_addralign_): New data member.
9068 (Arm_relobj::Arm_relobj): Initialize data member
9069 section_has_cortex_a8_workaround_.
9070 (Arm_relobj::section_has_cortex_a8_workaround,
9071 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9072 definitions.
9073 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9074 declarations.
9075 (Target_arm::relocate_stub): Change parameter type of stub from
9076 Reloc_stub pointer to Stub pointer.
9077 (Insn_template::size, Insn_template::alignment): Handle
9078 THUMB16_SPECIAL_TYPE.
9079 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9080 Stub_table::update_data_size_and_addralign,
9081 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9082 definitions.
9083 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9084 (Stub_table::do_write): Ditto.
9085 (Target_arm::do_relax): Adjust code for changes in Stub_table.
9086
9087 2010-01-08 Ian Lance Taylor <iant@google.com>
9088
9089 PR 11108
9090 * symtab.h (class Symbol): Remove fields is_target_special_ and
9091 has_plt_offset_. Add field is_defined_in_discarded_section_.
9092 (Symbol::is_defined_in_discarded_section): New function.
9093 (Symbol::set_is_defined_in_discarded_section): New function.
9094 (Symbol::has_plt_offset): Rewrite.
9095 (Symbol::set_plt_offset): Verify that new offset is not -1U.
9096 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9097 Don't initialize is_target_special_ or has_plt_offset_.
9098 Initialize is_defined_in_discarded_section_.
9099 (Symbol_table::add_from_relobj): If appropriate, set
9100 is_defined_in_discarded_section.
9101 * resolve.cc (Symbol::override_base_with_special): Don't test
9102 is_target_special_. Change has_plt_offset_ to has_plt_offset().
9103 * target-reloc.h (relocate_section): Do special handling for
9104 symbols defined in discarded sections for global symbols as well
9105 as local symbols.
9106
9107 2010-01-08 Ian Lance Taylor <iant@google.com>
9108
9109 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9110 the SHT_SYMTAB case.
9111
9112 2010-01-08 Ian Lance Taylor <iant@google.com>
9113
9114 * object.cc (Sized_relobj::do_layout): Don't get confused if
9115 layout_eh_frame returns NULL.
9116
9117 2010-01-08 Ian Lance Taylor <iant@google.com>
9118
9119 PR 11084
9120 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9121 dynamic symbol table, use the normal symbol table.
9122 (Sized_dynobj::do_read_symbols): Remove assertion about type of
9123 symbol table.
9124
9125 2010-01-08 Ian Lance Taylor <iant@google.com>
9126
9127 PR 11072
9128 * layout.cc (Layout::include_section): Remove .gnu_debuglink
9129 sections.
9130
9131 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
9132
9133 * version.cc (print_version): Change to "Copyright 2010".
9134
9135 2010-01-08 Ian Lance Taylor <iant@google.com>
9136
9137 PR 10287
9138 PR 11063
9139 * i386.cc (class Target_i386): Change return type of plt_section
9140 to be non-const.
9141 (class Output_data_plt_i386): Add tls_desc_rel_ field.
9142 (Output_data_plt_i386::Output_data_plt_i386): Initialize
9143 tls_desc_rel_ field.
9144 (Output_data_plt_i386::rel_tls_desc): New function.
9145 (Target_i386::rel_tls_desc_section): New function.
9146 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9147 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9148 R_386_TLS_DESC reloc in rel_tls_desc_section.
9149 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9150 Define struct Tlsdesc_info.
9151 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9152 (Target_x86_64::do_reloc_symbol_index): New function.
9153 (Target_x86_64::add_tlsdesc_info): New function.
9154 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9155 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9156 tlsdesc_rel_ field.
9157 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
9158 all callers.
9159 (Output_data_plt_x86_64::rela_tlsdesc): New function.
9160 (Target_x86_64::rela_tlsdesc_section): New function.
9161 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9162 handling.
9163 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9164 (Target_x86_64::do_reloc_addend): New function.
9165 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9166 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9167 declarations. Define TARGET_CODE. Add arg field to u1_ union.
9168 (Output_reloc::type): New function.
9169 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9170 (Output_reloc::is_target_specific): New function.
9171 (Output_reloc::target_arg): New function.
9172 (class Output_reloc) [SHT_RELA]: Add four new constructors for
9173 absolute relocs and target specific relocs.
9174 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9175 add_target_specific.
9176 (class Output_data_reloc) [SHT_RELA]: Likewise.
9177 * output.cc (Output_reloc::Output_reloc): Add four new versions
9178 for absolute relocs and target specific relocs.
9179 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9180 (Output_reloc::get_symbol_index): Likewise.
9181 (Output_reloc::local_section_offset): Check that local_sym_index_
9182 is not TARGET_CODE or 0.
9183 (Output_reloc::symbol_value): Likewise.
9184 (Output_reloc::write) [SHT_RELA]: Call target for target specific
9185 reloc.
9186 * target.h (class Target): Add reloc_symbol_index and reloc_addend
9187 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
9188 functions.
9189 * layout.cc (add_target_dynamic_tags): Use output section for
9190 DT_PLTRELSZ and DT_JMPREL.
9191
9192 2010-01-07 Ian Lance Taylor <iant@google.com>
9193
9194 PR 11061
9195 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9196 function.
9197 (class Output_data_reloc_generic): Define.
9198 (class Output_data_reloc_base): Change base class to
9199 Output_data_reloc_generic. Change add() method to call
9200 bump_relative_reloc_count for a relative reloc. Remove
9201 sort_relocs_ field.
9202 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9203 to sort_relocs().
9204 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9205 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
9206 appropriate.
9207 * layout.h (class Layout): Update declaration.
9208
9209 2010-01-07 Ian Lance Taylor <iant@google.com>
9210
9211 * output.h (class Output_data): Add const version of
9212 output_section and do_output_section.
9213 (class Output_section_data): Add const version of
9214 do_output_section.
9215 (class Output_section): Likewise.
9216 * layout.cc (Layout::add_target_dynamic_tags): New function.
9217 * layout.h (class Layout): Update declarations.
9218 * arm.cc (Target_arm::do_finalize_sections): Use
9219 add_target_dynamic_tags.
9220 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9221 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9222 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9223 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9224
9225 2010-01-07 Ian Lance Taylor <iant@google.com>
9226
9227 PR 11042
9228 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9229 object as needed.
9230
9231 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
9232 Ian Lance Taylor <iant@google.com>
9233
9234 PR 11019
9235 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9236 Xindex::read_symtab_xindex.
9237
9238 2010-01-07 Doug Kwan <dougkwan@google.com>
9239
9240 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9241 (Insn_template::thumb16_bcond_insn): New method declaration.
9242 (Insn_template): Fix spelling.
9243 (Stub::thumb16_special): New method declaration.
9244 (Stub::do_write): Define virtual method which was previously pure
9245 virtual.
9246 (Stub::do_thumb16_special): New method declaration.
9247 (Stub::do_fixed_endian_write): New template member.
9248 (Reloc_stub::do_write): Remove.
9249 (Reloc_stub::do_fixed_endian_write): Remove.
9250 (Cortex_a8_stub): New class definition.
9251 (Stub_factory::make_cortex_a8_stub): New method definition.
9252 (Stub_factory::Stub_factory): Add missing static storage class
9253 qualifier for elf32_arm_stub_a8_veneer_blx.
9254
9255 2010-01-07 Ian Lance Taylor <iant@google.com>
9256
9257 PR 10980
9258 * options.h (class General_options): Add --warn-unresolved-symbols
9259 and --error-unresolved-symbols.
9260 * errors.cc (Errors::undefined_symbol): Implement
9261 --warn-unresolved-symbols.
9262
9263 * options.h (class General_options): Add -z text and -z textoff.
9264 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9265
9266 2010-01-06 Sriraman Tallam <tmsriram@google.com>
9267
9268 * gc.h (Garbage_collection::Cident_section_map): New typedef.
9269 (Garbage_collection::cident_sections): New function.
9270 (Garbage_collection::add_cident_section): New function.
9271 (Garbage_collection::cident_sections_): New member.
9272 (gc_process_relocs): Add references to sections whose names are C
9273 identifiers.
9274 * gold.h (cident_section_start_prefix): New constant.
9275 (cident_section_stop_prefix): New constant.
9276 (is_cident): New function.
9277 * layout.cc (Layout::define_section_symbols): Replace string constants
9278 with the newly defined constants.
9279 * object.cc (Sized_relobj::do_layout): Track sections whose names are
9280 C identifiers.
9281 * testsuite/Makefile.am: Add gc_orphan_section_test.
9282 * testsuite/Makefile.in: Regenerate.
9283 * testsuite/gc_orphan_section_test.cc: New file.
9284 * testsuite/gc_orphan_section_test.sh: New file.
9285
9286 2010-01-06 Ian Lance Taylor <iant@google.com>
9287
9288 PR 10980
9289 * options.h (class General_options): Add --warn-shared-textrel.
9290 * layout.cc (Layout::finish_dynamic_section): Implement
9291 --warn-shared-textrel.
9292
9293 PR 10980
9294 * options.h (class General_options): Add --warn-multiple-gp.
9295
9296 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9297
9298 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9299 $(THREADSLIB) and $(LIBDL).
9300 * Makefile.in: Rebuild.
9301
9302 2010-01-06 Ian Lance Taylor <iant@google.com>
9303
9304 PR 10980
9305 * options.cc (General_options::parse_section_start): New function.
9306 (General_options::section_start): New function.
9307 (General_options::General_options): Initialize all members.
9308 * options.h: Include <map>
9309 (class General_options): Add --section-start. Add section_starts_
9310 member.
9311 * layout.cc (Layout::attach_allocated_section_to_segment): If
9312 --section-start was used, set the address of the segment. Remove
9313 local sort_sections.
9314 (Layout::relaxation_loop_body): If the address of the load segment
9315 has been set by --section-start, don't use it.
9316 * output.h (Output_segment::update_flags_for_output_section): New
9317 function.
9318 * output.cc (Output_segment::add_output_section): Call
9319 update_flags_for_output_section.
9320
9321 2010-01-05 Ian Lance Taylor <iant@google.com>
9322
9323 PR 10980
9324 * options.h (class General_options): Add --undefined-version.
9325 * script.cc (struct Version_expression): Add was_matched_by_symbol
9326 field.
9327 (Version_script_info::matched_symbol): New function.
9328 (Version_script_info::get_symbol_version_helper): Call
9329 matched_symbol.
9330 (Version_script_info::check_unmatched_names): New function.
9331 * script.h (class Version_script_info): Update declarations.
9332 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9333
9334 * options.h (class General_options): Use DEFINE_bool_alias for
9335 allow_multiple_definition.
9336 * resolve.cc (Symbol_table::should_override): Don't test
9337 allow_multiple_definition.
9338
9339 PR 10980
9340 * options.h (class General_options): Add --cref.
9341 * main.cc (main): Print cref table if --cref. Don't close mapfile
9342 until after printing cref table.
9343 * cref.cc: Include "symtab.h".
9344 (class Cref_inputs): Define Cref_table_compare and Cref_table.
9345 (Cref_table_compare::operator()): New function.
9346 (Cref_inputs::gather_cref): New function.
9347 (filecol): New static const.
9348 (Cref_inputs::print_cref): New function.
9349 (Cref::print_cref): New function.
9350 * cref.h: Include <cstdio>.
9351 (class Cref): Update declarations.
9352 * mapfile.h (Mapfile::file): New function.
9353 * object.h (class Object): Define Symbols. Declare virtual
9354 do_get_global_symbols.
9355 (Object::get_global_symbols): New function.
9356 * object.cc (Input_objects::add_object): Pass object to cref_ if
9357 --cref.
9358 (Input_objects::archive_start): Likewise.
9359 (Input_objects::archive_stop): Likewise.
9360 (Input_objects::print_cref): New function.
9361 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9362 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9363 --cref.
9364 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9365 function.
9366 * plugin.h (class Sized_pluginobj): Update declarations.
9367
9368 2010-01-05 Ian Lance Taylor <iant@google.com>
9369
9370 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9371 to is_default_version. Rename insdef to insdefault.
9372 (Symbol_table::add_from_relobj): Rename def to is_default_version
9373 and local to is_forced_local.
9374 (Symbol_table::add_from_pluginobj): Likewise.
9375 (Symbol_table::add_from_dynobj): Likewise.
9376 (Symbol_table::define_special_symbol): Rename insdef to
9377 insdefault.
9378
9379 2010-01-04 Ian Lance Taylor <iant@google.com>
9380
9381 PR 10980
9382 * options.h (class General_options): Add
9383 --allow-multiple-definition and -z muldefs.
9384 * resolve.cc (Symbol_table::should_override): Don't warn about a
9385 multiple symbol definition if --allow-multiple-definition or -z
9386 muldefs.
9387
9388 PR 10980
9389 * options.h (class General_options): Add --add-needed and
9390 --copy-dt-needed-entries. Tweak --as-needed help entry.
9391 * object.cc (Input_objects::check_dynamic_dependencies): Give an
9392 error if --copy-dt-needed-entries aka --add-needed is used and
9393 would cause a change in behaviour.
9394
9395 PR 10980
9396 * options.h (class General_options): Add -G as a short version of
9397 --shared. Add no-op options -assert, -g, and -i.
9398
9399 2010-01-04 Sriraman Tallam <tmsriram@google.com>
9400
9401 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9402 check for .text or .gnu.linkonce.t sections.
9403 * icf.cc (Icf::find_identical_sections): Ditto.
9404 Change the detection for mangled function name within the section
9405 name.
9406 * icf.h (is_section_foldable_candidate): New function.
9407
9408 2009-12-30 Ian Lance Taylor <iant@google.com>
9409
9410 PR 10980
9411 * options.h (class General_options): Permit two dashes with
9412 --retain-symbols-file.
9413
9414 2009-12-30 Ian Lance Taylor <iant@google.com>
9415
9416 PR 10979
9417 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9418 don't put the file header and segment headers in the text
9419 segment.
9420
9421 PR 10979
9422 * common.cc (Sort_commons::operator()): Stabilize sort when both
9423 entries are NULL.
9424 (Symbol_table::do_allocate_commons_list): When allocating common
9425 symbols, skip a symbol which is no longer common.
9426 * symtab.h (Symbol::is_common): Test whether the symbol comes from
9427 an object before checking its type.
9428 * testsuite/common_test_2.c: New file.
9429 * testsuite/common_test_3.c: New file.
9430 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9431 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9432 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9433 (common_test_2_pic.o, common_test_2.so): New targets.
9434 (common_test_3_pic.o, common_test_3.so): New targets.
9435 * testsuite/Makefile.in: Rebuild.
9436
9437 PR 10979
9438 * script.cc (read_input_script): If we see a new SECTIONS clause,
9439 and we have added an input section, give an error.
9440 * layout.h (class Layout): Add have_added_input_section function.
9441 Add have_added_input_section_ field.
9442 * layout.cc (Layout::Layout): Initialize
9443 have_added_input_section_.
9444 (Layout::layout): Set have_added_input_section_.
9445 (Layout::layout_eh_frame): Likewise.
9446
9447 2009-12-30 Ian Lance Taylor <iant@google.com>
9448
9449 PR 10931
9450 * options.h (class General_options): Add --sort-common option.
9451 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9452 * common.cc (Sort_common): Add sort_order parameter to
9453 constructor. Add sort_order_ field.
9454 (Sort_commons::operator): Check sort_order_.
9455 (Symbol_table::allocate_commons): Determine the sort order.
9456 (Symbol_table::do_allocate_commons): Add sort_order parameter.
9457 Change all callers.
9458 (Symbol_table::do_allocate_commons_list): Likewise.
9459
9460 2009-12-30 Ian Lance Taylor <iant@google.com>
9461
9462 PR 10916
9463 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9464 symbols from this object, don't change the visibility of an
9465 undefined symbol.
9466 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9467
9468 2009-12-30 Ian Lance Taylor <iant@google.com>
9469
9470 PR 10861
9471 * script.h (class Version_script_info): Define Language enum.
9472 Update declarations. Define Glob, Exact, and Lookup types. Add
9473 new fields globals_, locals_, and is_finalized_.
9474 * script.cc: Various formatting fixes.
9475 (class Parser_closure): Change language_stack_ from a vector of
9476 std::string to one of Version_script_info::Language. Adjust all
9477 uses accordingly.
9478 (class Lazy_demangler): Remove.
9479 (struct Version_expression): Change language from std::string to
9480 Version_script_info::Language.
9481 (Version_script_info::Version_script_info): New function.
9482 (Version_script_info::~Version_script_info): Don't call clear.
9483 (Version_script_info::finalize): New function.
9484 (Version_script_info::build_lookup_tables): New function.
9485 (Version_script_info::build_expression_list_lookup): New
9486 function.
9487 (Version_script_info::get_symbol_version_helper): Rewrite to use
9488 lookup tables.
9489 (Version_script_info::print_expression_list): Adjust to use
9490 Version_script_info::Language.
9491 (script_push_lex_into_version_mode): Check that the version script
9492 has not been finalized.
9493 (version_script_push_lang): Change language string to
9494 Version_script_info::Language.
9495 * options.cc (Command_line::version_script): New function.
9496 * options.h (class General_options): Add finalize_dynamic_list
9497 function. Change version_script from declaration to definition.
9498 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9499 * testsuite/version_script.map: Remove duplicate def of foo.
9500 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9501 version_script.map.
9502 * testsuite/Makefile.in: Rebuild.
9503
9504 2009-12-30 Ian Lance Taylor <iant@google.com>
9505
9506 PR 10843
9507 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9508 if the input symbol index is 0, make the output symbol index 0.
9509
9510 2009-12-30 Ian Lance Taylor <iant@google.com>
9511
9512 PR 10670
9513 * options.h (class General_options): Add -x/--discard-all.
9514 * object.cc (Sized_relobj::do_count_local_symbols): Handle
9515 --discard-all. If the local symbol needs a dynamic entry, check
9516 that before handling --discard-locals.
9517
9518 2009-12-30 Ian Lance Taylor <iant@google.com>
9519
9520 PR 10450
9521 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9522 flags to PF_R.
9523 (Output_segment::add_output_section): Don't change the flags if
9524 the type is PT_TLS.
9525
9526 PR 10450
9527 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9528 GNU hash table if they need a dynamic value. Otherwise, don't add
9529 them if they are defined in a dynamic object or are forced local.
9530
9531 2009-12-29 Ian Lance Taylor <iant@google.com>
9532
9533 PR 10450
9534 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9535 .gnu.hash table for a 32-bit target.
9536
9537 PR 10450
9538 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9539 regular and a dynamic object only needs a dynamic symbol table
9540 entry if it is externally visible.
9541
9542 PR 10450
9543 * i386.cc (class Target_i386): Initialize global_offset_table_ in
9544 constructor. Add global_offset_table_ field.
9545 (Target_i386::got_section): Set global_offset_table_.
9546 (Target_i386::do_finalize_sections): Set global_offset_table_
9547 size.
9548 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9549 in constructor. Add global_offset_table_ field.
9550 (Target_x86_64::got_section): Set global_offset_table_.
9551 (Target_x86_64::do_finalize_sections): Set global_offset_table_
9552 size.
9553
9554 * layout.cc (Layout::Layout): Initialize increase_relro_.
9555 (Layout::get_output_section): Add is_relro, is_last_relro, and
9556 is_first_non_relro parameters. Change all callers.
9557 (Layout::choose_output_section): Likewise.
9558 (Layout::add_output_section_data): Likewise.
9559 (Layout::make_output_section): Likewise.
9560 (Layout::set_segment_offsets): Clear increase_relro when using a
9561 linker script.
9562 * layout.h (class Layout): Add increase_relro method. Add
9563 increase_relro_ field. Update declarations.
9564 * output.cc (Output_section::Output_section): Initialize
9565 is_last_relro_ and is_first_non_relro_.
9566 (Output_segment::add_output_section): Group relro sections is
9567 do_sort is true. Handle is_last_relro and is_first_non_relro.
9568 (Output_segment::maximum_alignment): Remove relro handling.
9569 (Output_segment::set_section_addresses): Add increase_relro
9570 parameter. Change all callers. Add initial alignment to align
9571 relro sections on separate page. Remove old relro handling.
9572 (Output_segment::set_section_list_addresses): Remove in_relro
9573 parameter. Change all callers.
9574 (Output_segment::set_offset): Add increase parameter. Change all
9575 callers. Remove old relro handling.
9576 * output.h (class Output_section): Add new methods: is_last_relro,
9577 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9578 Add is_last_relro_ and is_first_non_relro_ fields.
9579 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9580 Create separate .got.plt section. Call increase_relro.
9581 * x86_64.cc (Target_x86_64::got_section): Likewise.
9582 * testsuite/relro_script_test.t: Add .got.plt.
9583
9584 PR 10450
9585 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9586 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9587 (Layout::finalize): Call set_dynamic_symbol_size.
9588 (Layout::set_dynamic_symbol_size): New function.
9589 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
9590 set_dynamic_symbol_size.
9591
9592 PR 10450
9593 * output.h (class Output_section): Add is_entsize_zero_ field.
9594 * output.cc (Output_section::Output_section): Initialize
9595 is_entsize_zero_.
9596 (Output_section::set_entsize): If two different entsizes are
9597 requested, force it to zero.
9598 (Output_section::add_input_section): Set flags for .debug_str
9599 before updating section flags. Set entsize.
9600 (Output_section::update_flags_for_input_section): Set SHF_MERGE
9601 and SHF_STRING if all input sections have those flags.
9602
9603 2009-12-29 Rafael Espindola <espindola@google.com>
9604
9605 * main.cc (main): Fix the sys time reporting.
9606 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9607 reporting.
9608
9609 2009-12-29 Sriraman Tallam <tmsriram@google.com>
9610
9611 * options.cc (General_options::parse_version): Allow -v to exit
9612 without an error if there is nothing to link.
9613
9614 2009-12-29 Ian Lance Taylor <iant@google.com>
9615
9616 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9617 using a version of gcc before 4.1.
9618 * configure: Rebuild.
9619
9620 2009-12-28 Chris Demetriou <cgd@google.com>
9621
9622 * attributes.cc (Output_attributes_section_data::do_write): Use
9623 std::vector::front rather than std::vector::data.
9624
9625 2009-12-28 Ian Lance Taylor <iant@google.com>
9626
9627 * symtab.h (class Symbol_table): Add enum Defined.
9628 * resolve.cc (Symbol_table::should_override): Add defined
9629 parameter. Change all callers. Test whether object is NULL
9630 before calling a method on it.
9631 (Symbol_table::report_resolve_problem): Add defined parameter.
9632 Change all callers.
9633 (Symbol_table::should_override_with_special): Likewise.
9634 * symtab.cc (Symbol_table::define_in_output_data): Add defined
9635 parameter. Change all callers.
9636 (Symbol_table::do_define_in_output_data): Likewise.
9637 (Symbol_table::define_in_output_segment): Likewise.
9638 (Symbol_table::do_define_in_output_segment): Likewise.
9639 (Symbol_table::define_as_constant): Likewise.
9640 (Symbol_table::do_define_as_constant): Likewise.
9641 * script.h (class Symbol_assignment): Add is_defsym parameter to
9642 constructor; change all callers.
9643 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9644 parameter. Change all callers. Add is_defsym_ field.
9645 (class Parser_closure): Add parsing_defsym parameter to
9646 constructor; change all callers. Add parsing_defsym accessor
9647 function. Add parsing_defsym_ field.
9648
9649 2009-12-28 Ian Lance Taylor <iant@google.com>
9650
9651 * gold.cc (queue_middle_tasks): Fix formatting.
9652 * object.cc (Relobj::is_section_name_included): Likewise.
9653
9654 2009-12-23 Ian Lance Taylor <iant@google.com>
9655
9656 * i386.cc (Target_i386::do_calls_non_split): Recognize
9657 -fsplit-stack prologue for a function with a static chain.
9658 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9659 -fsplit-stack prologue when using %r11.
9660
9661 2009-12-21 Sriraman Tallam <tmsriram@google.com>
9662
9663 * options.cc (General_options::parse_version): Make -v continue and do
9664 the link like GNU ld does.
9665
9666 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
9667
9668 * Makefile.am (CCFILES): Add timer.cc.
9669 (HFILES): Add timer.h.
9670 * configure.ac: Check for sysconf and times.
9671 * main.cc: include timer.h.
9672 (main): Use Timer instead of get_run_time.
9673 * timer.cc: New.
9674 * timer.h: New.
9675 * workqueue.cc: include timer.h.
9676 (Workqueue::find_and_run_task):
9677 Report user, sys and wall time.
9678 * Makefile.in: Regenerate.
9679 * config.in: Regenerate.
9680 * configure: Regenerate.
9681
9682 2009-12-16 Doug Kwan <dougkwan@google.com>
9683
9684 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9685 sections.
9686 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9687 relaxed input sections.
9688 * output.cc (Output_section::find_relaxed_input_section): Change
9689 return type to Output_relaxed_input_section pointer. Adjust code
9690 for new type of relaxed_input_section_map_.
9691 * output.h (Output_section::find_relaxed_input_section): Change
9692 return type to Output_relaxed_input_section pointer.
9693 (Output_section::Output_relaxed_input_section_by_input_section_map):
9694 New type.
9695 (Output_section::relaxed_input_section_map_): Change type to
9696 Output_section::Output_relaxed_input_section_by_input_section_map.
9697 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9698 input section.
9699
9700 2009-12-15 Ian Lance Taylor <iant@google.com>
9701
9702 * layout.cc (Layout::create_shstrtab): Only write out after input
9703 sections if we are compressing debug sections.
9704
9705 2009-12-15 Ian Lance Taylor <iant@google.com>
9706
9707 * archive.cc (Archive::add_symbols): Only look up a symbol without
9708 a version if there is, in fact, a version.
9709
9710 2009-12-14 Ian Lance Taylor <iant@google.com>
9711
9712 Revert -Wshadow changes, all changes from:
9713 2009-12-11 Doug Kwan <dougkwan@google.com>
9714 2009-12-11 Nick Clifton <nickc@redhat.com>
9715 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9716
9717 2009-12-11 Doug Kwan <dougkwan@google.com>
9718
9719 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9720 due to -Wshadow.
9721 * attributes.cc (Object_attribute::size): Ditto.
9722 (Attributes_section_data::size): Ditto.
9723 (Attributes_section_data::Attributes_section_data): Ditto.
9724 (Output_attributes_section_data::do_write): Ditto.
9725 * attributes.h (Object_attribute::set_type): Ditto.
9726 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9727
9728 2009-12-11 Nick Clifton <nickc@redhat.com>
9729
9730 * archive.cc: Fix shadowed variable warnings.
9731 * arm.cc: Likewise.
9732 * compressed_output.cc: Likewise.
9733 * compressed_output.h: Likewise.
9734 * configure: Likewise.
9735 * dwarf_reader.cc: Likewise.
9736 * dynobj.cc: Likewise.
9737 * dynobj.h: Likewise.
9738 * ehframe.cc: Likewise.
9739 * ehframe.h: Likewise.
9740 * errors.cc: Likewise.
9741 * expression.cc: Likewise.
9742 * fileread.cc: Likewise.
9743 * fileread.h: Likewise.
9744 * freebsd.h: Likewise.
9745 * i386.cc: Likewise.
9746 * icf.cc: Likewise.
9747 * incremental.h: Likewise.
9748 * layout.cc: Likewise.
9749 * layout.h: Likewise.
9750 * mapfile.cc: Likewise.
9751 * merge.cc: Likewise.
9752 * merge.h: Likewise.
9753 * object.cc: Likewise.
9754 * object.h: Likewise.
9755 * options.h: Likewise.
9756 * output.cc: Likewise.
9757 * output.h: Likewise.
9758 * parameters.cc: Likewise.
9759 * plugin.cc: Likewise.
9760 * powerpc.cc: Likewise.
9761 * reduced_debug_output.cc: Likewise.
9762 * reduced_debug_output.h: Likewise.
9763 * reloc.cc: Likewise.
9764 * reloc.h: Likewise.
9765 * resolve.cc: Likewise.
9766 * script-sections.cc: Likewise.
9767 * script.cc: Likewise.
9768 * script.h: Likewise.
9769 * sparc.cc: Likewise.
9770 * symtab.cc: Likewise.
9771 * symtab.h: Likewise.
9772 * target-select.cc: Likewise.
9773 * target-select.h: Likewise.
9774 * token.h: Likewise.
9775 * workqueue.cc: Likewise.
9776 * workqueue.h: Likewise.
9777 * x86_64.cc: Likewise.
9778
9779 2009-12-10 Doug Kwan <dougkwan@google.com>
9780
9781 * arm.cc (attributes.h): New include.
9782 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9783 (Arm_relobj::~Arm_relobj): Delete object pointed by
9784 attributes_section_data_.
9785 (Arm_relobj::attributes_section_data): New method definition.
9786 (Arm_relobj::attributes_section_data_): New data member declaration.
9787 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9788 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9789 attributes_section_data_.
9790 (Arm_dynobj::attributes_section_data): New method definition.
9791 (Arm_dynobj::attributes_section_data_): New data member declaration.
9792 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
9793 initialization value of may_use_blx_ to false.
9794 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9795 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9796 object attributes to compute results instead of hard-coding.
9797 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9798 Target_arm::get_secondary_compatible_arch,
9799 Target_arm::set_secondary_compatible_arch
9800 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9801 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9802 New method declarations.
9803 (Target_arm::get_aeabi_object_attribute): New method definition.
9804 (Target_arm::attributes_section_data_): New data member declaration.
9805 (read_arm_attributes_section): New template definition.
9806 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9807 (Arm_dynobj::do_read_symbols): Ditto.
9808 (Target_arm::do_finalize_sections): Merge attributes sections from
9809 input. Check for BLX use after attributes section merging.
9810 Fix __exidx_start and __exidx_end visibility. Create an
9811 .ARM.attributes section if necessary.
9812 (Target_arm::get_secondary_compatible_arch,
9813 Target_arm::set_secondary_compatible_arch,
9814 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9815 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9816 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9817 New method definitions.
9818
9819 2009-12-09 Ian Lance Taylor <iant@google.com>
9820
9821 * plugin.cc (Plugin::load): Don't cast from void* to a function
9822 pointer.
9823
9824 2009-12-09 Ian Lance Taylor <iant@google.com>
9825
9826 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9827 information fields.
9828
9829 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
9830
9831 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9832 Replace two_file_shared_1.so with two_file_shared_2.so.
9833 * testsuite/Makefile.in: Regenerated.
9834
9835 2009-12-08 Doug Kwan <dougkwan@google.com>
9836
9837 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9838 (HFILES): Add attributes.h and int_encoding.h.
9839 * Makefile.in: Regenerate.
9840 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9841 function definitions to int_encoding.cc
9842 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9843 prototypes to int_encoding.h
9844 * reduced_debug_output.cc (int_encoding.h): New include.
9845 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9846 function definitions to int_encoding.cc
9847 (insert_into_vector, read_from_pointer): Move template definitions to
9848 int_encoding.h
9849 * attributes.cc: New file.
9850 * attributes.h: New file.
9851 * int_encoding.cc: New file.
9852 * int_encoding.h: New file.
9853
9854 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
9855
9856 PR gold/11055
9857 * incremental-dump.cc (dump_incremental_inputs): New.
9858 (main): Use dump_incremental_inputs.
9859
9860 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
9861
9862 PR gold/10893
9863 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9864 checking elfcpp::STT_FUNC.
9865 (Target_i386::Relocate::relocate): Likewise.
9866 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9867
9868 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9869 symbols from shared libraries into normal FUNC symbols.
9870
9871 * symtab.h (Symbol): Add is_func and use it.
9872
9873 2009-12-05 Doug Kwan <dougkwan@google.com>
9874
9875 * arm.cc (Target_arm::arm_info): Initialize new fields
9876 attributes_section and attributes_vendor.
9877 * i386.cc (Target_i386::i386_info): Same.
9878 * object.cc (Sized_relobj::do_layout): Skip attribute section.
9879 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9880 fields attributes_section and attributes_vendor.
9881 * sparc.cc (Target_sparc::sparc_info): Same.
9882 * target.h (Target::attributes_section, Target::attributes_vendor,
9883 Target::is_attributes_section, Target::attribute_arg_type,
9884 Target::attributes_order): New method definitions.
9885 (Target::Target_info::attributes_section,
9886 Target::Target_info::attributes_vendor): New fields.
9887 (Target::do_attribute_arg_type, Target::do_attributes_order): New
9888 virtual method definitions.
9889 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9890 attributes_section and attributes_vendor.
9891 * testsuite/testfile.cc (Target_test::test_target_info): Same.
9892
9893 2009-12-05 Doug Kwan <dougkwan@google.com>
9894
9895 * arm.cc: Update comments about interworking and stub generation.
9896 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9897 considered as non-PIC.
9898 (Arm_relocate_functions::base_abs): Fix formatting.
9899 (Arm_relocate_functions::got_prel): Fix comment. Change interface
9900 of function to use GOT entry address instead of offset.
9901 (Target_arm::Scan::global): Issue an error if a symbol would need a
9902 PLT does not get one because it is untyped. Remove code to create
9903 dynamic symbols for relative branches.
9904 (Target_arm::Relocate::relocate: Use 0 instead of false since function
9905 takes unsigned integer instead of boolean.
9906
9907 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
9908
9909 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9910 (two_file_test_LDADD): Likewise.
9911 (common_test_1_LDADD): Likewise.
9912 (exception_test_LDADD) Likewise.
9913 (weak_test_LDADD): Likewise.
9914 (many_sections_test_LDADD): Likewise.
9915 (initpri1_LDADD): Likewise.
9916 (script_test_1_LDADD): Likewise.
9917 (script_test_2_LDADD): Likewise.
9918 (justsyms_LDADD): Likewise.
9919 (binary_test_LDADD): Likewise.
9920 (large_LDADD): Likewise.
9921 * testsuite/Makefile.in: Regenerated.
9922
9923 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
9924
9925 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9926 (Symbol_table::override_with_special): Likewise.
9927 (Symbol_table::add_from_object): Likewise.
9928
9929 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9930
9931 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9932 Don't set the data_offset twice.
9933
9934 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9935
9936 * testsuite/Makefile.in: Regenerate.
9937
9938 2009-12-03 Doug Kwan <dougkwan@google.com>
9939
9940 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9941 (Target_arm::do_finalize_sections): Add parameter for symbol table
9942 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
9943 * i386.cc (Target_i386::do_finalize_sections): Add an additional
9944 parameter for symbol table pointer.
9945 * layout.cc (Layout::finalize): Call Target::finalize_sections with
9946 an additional parameter for a pointer to symbol table.
9947 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9948 parameter for a symbol table pointer.
9949 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9950 * target.h (Target::finalize_sections, Target::do_finalize_sections):
9951 Ditto.
9952 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9953 parameter for a symbol table pointer.
9954
9955 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
9956
9957 * incremental.cc (Incremental_inputs_header)
9958 (Incremental_inputs_header_write, Incremental_inputs_entry)
9959 (Incremental_inputs_entry_write): Move ...
9960 * incremental.h (Incremental_inputs_header)
9961 (Incremental_inputs_header_write, Incremental_inputs_entry)
9962 (Incremental_inputs_entry_write): here.
9963
9964 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9965
9966 * incremental.cc (make_sized_incremental_binary): Set the target.
9967 Error if it is incompatible.
9968 * output.h (Output_file): Add filename method.
9969
9970 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9971
9972 * incremental.cc (Incremental_inputs_entry): Remove unused argument
9973 from the get_* methods.
9974
9975 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9976
9977 * incremental-dump.cc (main): Check that the offeset of a script is 0.
9978 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9979 Write 0 for the data_offset of scripts.
9980
9981 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9982
9983 * testsuite/Makefile.am: Add the incremental_test.sh test.
9984 * testsuite/incremental_test.sh: New.
9985 * testsuite/incremental_test_1.c: New.
9986 * testsuite/incremental_test_2.c: New.
9987
9988 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
9989
9990 * incremental-dump.cc (main): Fix typos.
9991
9992 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
9993
9994 PR gold/11025
9995 * incremental-dump.cc (main): Use llu to print 64 bit values.
9996
9997 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
9998 H.J. Lu <hongjiu.lu@intel.com>
9999
10000 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10001 $(LIBDL).
10002 (incremental_dump_LDADD): Likewise.
10003 * Makefile.in: Regenerated.
10004
10005 2009-11-25 Doug Kwan <dougkwan@google.com>
10006
10007 Revert:
10008
10009 2009-11-25 Doug Kwan <dougkwan@google.com>
10010
10011 * arm.cc (Target_arm::Target_arm): Move method definition
10012 outside of class definition. Add code to handle
10013 --target1-rel, --target1-abs and --target2= options.
10014 (Target_arm::get_reloc_reloc_type): Change method to be
10015 non-static and const.
10016 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10017 New data member declaration.
10018 (Target_arm::Scan::local, Target_arm::Scan::global,
10019 Target_arm::Relocate::relocate,
10020 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10021 Adjust call to Target_arm::get_real_reloc_type.
10022 (Target_arm::get_real_reloc_type): Use command line options
10023 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10024 * options.h (--target1-rel, --target1-abs, --target2): New
10025 ARM-only options.
10026
10027 2009-11-25 Doug Kwan <dougkwan@google.com>
10028
10029 * arm.cc (Target_arm::Target_arm): Move method definition outside of
10030 class definition. Add code to handle --target1-rel, --target1-abs
10031 and --target2= options.
10032 (Target_arm::get_reloc_reloc_type): Change method to be non-static
10033 and const.
10034 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10035 member declaration.
10036 (Target_arm::Scan::local, Target_arm::Scan::global,
10037 Target_arm::Relocate::relocate,
10038 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10039 call to Target_arm::get_real_reloc_type.
10040 (Target_arm::get_real_reloc_type): Use command line options to
10041 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10042 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10043 options.
10044
10045 2009-11-25 Doug Kwan <dougkwan@google.com>
10046
10047 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10048 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10049 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10050 formatting.
10051 (Arm_relocate_functions::thm_call): Replace body with a call to
10052 Arm_relocate_functions::thumb_branch_common.
10053 (Arm_relocate_functions::thm_jump24,
10054 Arm_relocate_functions::thm_xpc22): New method definitions.
10055 (Arm_relocate_functions::thumb_branch_common): New method definition.
10056 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10057 operator.
10058 (Target_arm::Relocate::relocate): Adjust call to thm_call.
10059 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10060
10061 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10062
10063 * Makefile.am: Build incremental-dump
10064 * Makefile.in: Regenerate.
10065 * incremental-dump.cc: New.
10066 * incremental.cc (Incremental_inputs_header_data,
10067 Incremental_inputs_entry_data): Move to incremental.h
10068 * incremental.h: (Incremental_inputs_header_data,
10069 Incremental_inputs_entry_data): Move from incremental.cc
10070
10071 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10072
10073 * incremental.cc (Incremental_inputs_header,
10074 Incremental_inputs_header_write, Incremental_inputs_entry,
10075 Incremental_inputs_entry_write): Add a typedef with the data type.
10076
10077 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10078
10079 * incremental.cc (Incremental_inputs_header,
10080 Incremental_inputs_header_write, Incremental_inputs_entry,
10081 Incremental_inputs_entry_write): Update comment about which
10082 type has the filed descriptions.
10083
10084 2009-11-15 Doug Kwan <dougkwan@google.com>
10085
10086 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10087 (Arm_relocate_functions::arm_branch_common): Change method defintion
10088 in class definition to a method declaration and update list of formal
10089 parameters.
10090 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10091 Arm_relocation_functions::jump24): Adjust call to
10092 Arm_relocate_functions::arm_branch_common. Update list of formal
10093 parameters.
10094 (Arm_relocate_functions::xpc25): New method definition.
10095 (Arm_relocate_functions::arm_branch_common): Move method defintion
10096 out from class definition. Use stubs for mode-switching and extending
10097 branch ranges.
10098 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10099 specially. Change code to enable use of stubs in ARM branches.
10100
10101 2009-11-10 Doug Kwan <dougkwan@google.com>
10102
10103 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10104 in method declaration.
10105 (Target_arm::relocate_stub): New method declaration.
10106 (Target_arm::default_target): Change to return a pointer instead of
10107 a const reference.
10108 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10109 Target_arm::default_target.
10110 (Arm_Relobj::do_relocate_sections): Remove options paramater in
10111 method definition.
10112 (Target_arm::relocate_section): Adjust view.
10113 (Target_arm::relocate_stub): New method definition.
10114
10115 2009-11-10 Doug Kwan <dougkwan@google.com>
10116
10117 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10118 a format warning.
10119 * incremental.cc (open_incremental_binary): Initialized local
10120 variables to avoid warnings.
10121 * object.cc (make_elf_object): Ditto.
10122 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10123 a format warning.
10124
10125 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
10126
10127 PR gold/10930
10128 * testsuite/plugin_test.c: Include "config.h".
10129
10130 2009-11-09 Doug Kwan <dougkwan@google.com>
10131
10132 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10133 (arm_symbol_value): Remove.
10134 (Arm_relocate_functions::arm_branch_common,
10135 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10136 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10137 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10138 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10139 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10140 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10141 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10142 Arm_relocate_functions::thm_mobw_abs_nc,
10143 Arm_relocate_functions::thm_mov_abs,
10144 Arm_relocate_functions::movw_prel_nc,
10145 Arm_relocate_functions::thm_movt_abs,
10146 Arm_relocate_functions::movt_prel,
10147 Arm_relocate_functions::thm_movw_prel_nc,
10148 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10149 (Target_arm::Relocate::relocate): Only decompose address into two
10150 parts if relocation type uses the thumb-bit and pass the actual
10151 bit instead of a flag indicating that the thumb-bit is used. Adjust
10152 calls to methods in Arm_relocate_functions for this change.
10153
10154 2009-11-08 Ian Lance Taylor <iant@google.com>
10155
10156 PR 10925
10157 * reloc.cc: Instantiate
10158 Sized_relobj::initialize_input_to_output_maps and
10159 Sized_relobj:free_input_to_output_maps.
10160
10161 2009-11-06 Ian Lance Taylor <iant@google.com>
10162
10163 PR 10876
10164 * defstd.cc (in_segment): Set only_if_ref true for "end".
10165
10166 2009-11-06 Doug Kwan <dougkwan@google.com>
10167
10168 * arm.cc (class Reloc_stub): Correct a comment.
10169 (Target_arm::Target_arm): Initialize arm_input_section_map_.
10170 (Target_arm::scan_section_for_stubs): New method declaration.
10171 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10172 Change methods from private to protected.
10173 (Target_arm::do_may_relax): New method definition.
10174 (Target_arm::do_relax, Target_arm::group_sections,
10175 Target_arm::scan_reloc_for_stub,
10176 Target_arm::scan_reloc_section_for_stubs): New method declarations.
10177 (Target_arm::arm_input_section_map_): New data member declaration.
10178 (Target_arm::scan_reloc_for_stub,
10179 Target_arm::scan_reloc_section_for_stubs,
10180 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10181 Target_arm::do_relax): New method definitions.
10182
10183 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
10184
10185 * configure.ac: Check for (struct stat)::st_mtim
10186 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10187 * config.in: Regenerate.
10188 * configure: Regenerate.
10189
10190 2009-11-05 Ian Lance Taylor <iant@google.com>
10191
10192 PR 10910
10193 * output.cc (Output_segment::add_output_section): Add missing
10194 return statement.
10195
10196 2009-11-04 Ian Lance Taylor <iant@google.com>
10197
10198 PR 10880
10199 * object.h (class Object): Add is_needed and set_is_needed
10200 methods. Add is_needed_ field. Make bool fields into bitfields.
10201 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10202 defined in a dynamic object and referenced by a regular object,
10203 set is_needed for the dynamic object.
10204 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10205 if the file is marked with as_needed and it is not needed.
10206
10207 2009-11-04 Ian Lance Taylor <iant@google.com>
10208
10209 PR 10887
10210 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10211 tags if data is discarded by linker script.
10212 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10213 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10214 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10215 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10216
10217 2009-11-04 Ian Lance Taylor <iant@google.com>
10218
10219 * layout.cc (Layout::get_output_section): Add is_interp and
10220 is_dynamic_linker_section parameters. Change all callers.
10221 (Layout::choose_output_section): Likewise.
10222 (Layout::make_output_section): Likewise.
10223 (Layout::add_output_section_data): Add is_dynamic_linker_section
10224 parameter. Change all callers.
10225 * layout.h (class Layout): Update declarations.
10226 * output.h (class Output_section): Add is_interp, set_is_interp,
10227 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10228 Add is_interp_, is_dynamic_linker_section_ fields. Change
10229 generate_code_fills_at_write_ to a bitfield.
10230 * output.cc (Output_section::Output_sections): Initialize new
10231 fields.
10232 (Output_segment::add_output_section): Add do_sort parameter.
10233 Change all callers.
10234
10235 2009-11-03 Ian Lance Taylor <iant@google.com>
10236
10237 PR 10860
10238 * options.h (class General_options): Add --warn-common.
10239 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10240 merging two common symbols.
10241 (Symbol_table::should_override): Handle --warn-common when merging
10242 a common symbol with a defined symbol. Use report_resolve_problem
10243 for multiple definitions.
10244 (Symbol_table::report_resolve_problem): New function.
10245 * symtab.h (class Symbol_table): Declare report_resolve_problem.
10246
10247 2009-11-03 Doug Kwan <dougkwan@google.com>
10248
10249 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10250 stub_factory_.
10251 (Target_arm::stub_factory): New method definition.
10252 (Target_arm::new_arm_input_section,
10253 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10254 Target_arm::reloc_uses_thumb_bit): New method declarations.
10255 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10256 New type definitions.
10257 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10258 member declarations.
10259 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10260 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10261 New method definitions.
10262
10263 2009-11-03 Ian Lance Taylor <iant@google.com>
10264
10265 * options.h (class General_options): Add --warn_constructors.
10266
10267 2009-11-03 Ian Lance Taylor <iant@google.com>
10268
10269 PR 10893
10270 * defstd.cc (in_section): Add entries for __rel_iplt_start,
10271 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10272
10273 2009-11-03 Ian Lance Taylor <iant@google.com>
10274
10275 PR 10895
10276 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10277 --msgid-bugs-address.
10278 (install-pdf): New target.
10279 (install-data_yes): Look up one directory to find mkinstalldirs.
10280
10281 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
10282
10283 * po/Make-in (.po.gmo): Don't generate .gmo files in source
10284 tree.
10285
10286 2009-10-30 Doug Kwan <dougkwan@google.com>
10287
10288 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10289
10290 2009-10-30 Doug Kwan <dougkwan@google.com>
10291
10292 * arm.cc (Stub_addend_reader): New struct template definition
10293 and partial specializations.
10294 (Stub_addend_reader::operator()): New method definition for a
10295 partially specialized template.
10296
10297 2009-10-30 Doug Kwan <dougkwan@google.com>
10298
10299 * arm.cc (Arm_relobj::processor_specific_flags): New method
10300 definition.
10301 (Arm_relobj::do_read_symbols): New method declaration.
10302 (Arm_relobj::processor_specific_flags_): New data member declaration.
10303 (Arm_dynobj): New class definition.
10304 (Target_arm::do_finalize_sections): Add input_objects parameter.
10305 (Target_arm::do_adjust_elf_header): New method declaration.
10306 (Target_arm::are_eabi_versions_compatible,
10307 (Target_arm::merge_processor_specific_flags): New method declaration.
10308 (Target_arm::do_make_elf_object): New overloaded method definitions
10309 and declaration.
10310 (Arm_relobj::do_read_symbols): New method definition.
10311 (Arm_dynobj::do_read_symbols): Ditto.
10312 (Target_arm::do_finalize_sections): Add input_objects parameters.
10313 Merge processor-specific flags from all input objects.
10314 (Target_arm::are_eabi_versions_compatible,
10315 Target_arm::merge_processor_specific_flags,
10316 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10317 New method definitions.
10318 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10319 Input_objects pointer type parameter.
10320 * layout.cc (Layout::finalize): Pass input objects to target's.
10321 finalize_sections function.
10322 * output.cc (Output_file_header::do_sized_write): Set ELF file
10323 header's processor-specific flags.
10324 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10325 Input_objects pointer type parameter.
10326 * sparc.cc (Target_sparc::do_finalize_sections): Same.
10327 * target.h (Input_objects): New forward class declaration.
10328 (Target::processor_specific_flags,
10329 Target::are_processor_specific_flags_sect): New method definitions.
10330 (Target::finalize_sections): Add input_objects parameter.
10331 (Target::Target): Initialize processor_specific_flags_ and
10332 are_processor_specific_flags_set_.
10333 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10334 parameter.
10335 (Target::set_processor_specific_flags): New method definition.
10336 (Target::processor_specific_flags_,
10337 Target::are_processor_specific_flags_set_): New data member
10338 declarations.
10339 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10340 Input_objects pointer type parameter.
10341
10342 2009-10-30 Doug Kwan <dougkwan@google.com>
10343
10344 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10345
10346 2009-10-28 Ian Lance Taylor <iant@google.com>
10347
10348 * object.h (class Relobj): Drop options parameter from
10349 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10350 do_scan_relocs, do_relocate. Change all callers.
10351 (class Sized_relobj): Drop options parameters from
10352 do_gc_process_relocs, do_scan_relocs, do_relocate,
10353 do_relocate_sections, relocate_sections, emit_relocs_scan,
10354 emit_relocs_scan_reltype. Change all callers.
10355 (struct Relocate_info): Remove options field and all references to
10356 it.
10357 * reloc.h (class Read_relocs): Remove options constructor
10358 parameter and options_ field. Change all callers.
10359 (class Gc_process_relocs, class Scan_relocs): Likewise.
10360 (class Relocate_task): Likewise.
10361 * target-reloc.h (scan_relocs): Remove options parameter. Change
10362 all callers.
10363 (scan_relocatable_relocs): Likewise.
10364 * target.h (class Sized_target): Remove options parameter from
10365 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
10366 all callers.
10367 * gc.h (gc_process_relocs): Remove options parameter. Change all
10368 callers.
10369 * arm.cc: Update functions to remove options parameters.
10370 * i386.cc: Likewise.
10371 * powerpc.cc: Likewise.
10372 * sparc.cc: Likewise.
10373 * x86_64.cc: Likewise.
10374 * testsuite/testfile.cc: Likewise.
10375
10376 2009-10-28 Doug Kwan <dougkwan@google.com>
10377
10378 * arm.cc (Arm_relobj): New class definition.
10379 (Arm_relobj::scan_sections_for_stubs,
10380 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10381 New method definitions.
10382
10383 2009-10-28 Cary Coutant <ccoutant@google.com>
10384
10385 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10386 (Plugin::cleanup_done_): New member.
10387 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10388 (Plugin_manager::cleanup_done_): Remove.
10389 (Plugin_manager::add_input_file): Edit error message.
10390 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10391 (Plugin_manager::cleanup): Remove use of cleanup_done_.
10392
10393 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
10394
10395 * fileread.cc: (File_read::View::~View): Use the new
10396 data_ownership_ filed.
10397 (File_read::~File_read): Dispose the new whole_file_view_.
10398 (File_read::open): Mmap the whole file if needed.
10399 (File_read::open): Use whole_file_view_ instead of contents_.
10400 (File_read::find_view): Use whole_file_view_ if applicable.
10401 (File_read::do_read): Use whole_file_view_ instead of contents_.
10402 (File_read::make_view): Use whole_file_view_ instead of contents_,
10403 update File_read::View::View call.
10404 (File_read::find_or_make_view): Update File_read::View::View
10405 call.
10406 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10407 remove contents_
10408 (File_read::View::Data_ownership): New enum.
10409 (File_read::View::View): Replace bool mapped_ with Data_ownership
10410 argument.
10411 (File_read::View::mapped_): Remove (replaced by data_ownership_).
10412 (File_read::View::data_ownership_): New field.
10413 (File_read::contents_): Remove (replaced by whole_file_view_).
10414 (File_read::whole_file_view_): New field.
10415 * options.h (class General_options): Add --keep-files-mapped.
10416
10417 2009-10-27 Cary Coutant <ccoutant@google.com>
10418
10419 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10420 * testsuite/Makefile.am (plugin_test_5): New test case.
10421 * testsuite/Makefile.in: Regenerate.
10422
10423 2009-10-25 Doug Kwan <dougkwan@google.com>
10424
10425 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10426 from private to protected to allow access by child class.
10427 (Sized_relobj::do_relocate_sections): New method declaration.
10428 (Sized_relobj::relocate_sections): Virtualize.
10429 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10430 Sized_relobj::relocate_sections. Instantiate template explicitly
10431 for different target sizes and endianity.
10432
10433 2009-10-24 Doug Kwan <dougkwan@google.com>
10434
10435 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10436 (Arm_input_section::as_arm_input_section): New method.
10437 (Arm_output_section): New class definition.
10438 (Arm_output_section::create_stub_group,
10439 Arm_output_section::group_sections): New method definitions.
10440
10441 2009-10-22 Doug Kwan <dougkwan@google.com>
10442
10443 * arm.cc (Arm_input_section): New class definition.
10444 (Arm_input_section::init, Arm_input_section:do_write,
10445 Arm_input_section::set_final_data_size,
10446 Arm_input_section::do_reset_address_and_file_offset): New method
10447 definitions.
10448
10449 2009-10-21 Doug Kwan <dougkwan@google.com>
10450
10451 * arm.cc (Stub_table, Arm_input_section): New forward class
10452 declarations.
10453 (Stub_table): New class defintion.
10454 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10455 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10456 New method definition.
10457
10458 2009-10-21 Doug Kwan <dougkwan@google.com>
10459
10460 * arm.cc: Update copyright comments.
10461 (Target_arm): New forward class template declaration.
10462 (Arm_address): New type.
10463 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10464 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10465 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10466 constants.
10467 (Insn_template): Same.
10468 (DEF_STUBS): New macro.
10469 (Stub_type): New enum type.
10470 (Stub_template): New class definition.
10471 (Stub): Same.
10472 (Reloc_stub): Same.
10473 (Stub_factory): Same.
10474 (Target_arm::Target_arm): Initialize may_use_blx_ and
10475 should_force_pic_veneer_.
10476 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10477 Target_arm::should_force_pic_veneer,
10478 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10479 Target_arm::using_thumb_only, Target_arm:;default_target): New
10480 method defintions.
10481 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10482 New data member declarations.
10483 (Insn_template::size, Insn_template::alignment): New method defintions.
10484 (Stub_template::Stub_template): New method definition.
10485 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10486 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10487 (Stub_factory::Stub_factory): New method definition.
10488 * gold.h (string_hash): New template.
10489 * output.h (Input_section_specifier::hash_value): Use
10490 gold::string_hash.
10491 (Input_section_specifier::string_hash): Remove.
10492 * stringpool.cc (Stringpool_template::string_hash): Use
10493 gold::string_hash.
10494
10495 2009-10-20 Doug Kwan <dougkwan@google.com>
10496
10497 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10498 symbols of relaxed input sections.
10499 * output.h (Output_section::find_relaxed_input_section): Make
10500 method public.
10501
10502 2009-10-16 Doug Kwan <dougkwan@google.com>
10503
10504 * dynobj.cc (Versions::Versions): Initialize version_script_.
10505 Only insert base version symbol definition for a shared object
10506 if version script defines any version versions.
10507 (Versions::define_base_version): New method definition.
10508 (Versions::add_def): Check that base version is not needed.
10509 (Versions::add_need): Define base version lazily.
10510 * dynobj.h (Versions::define_base_version): New method declaration.
10511 (Versions::needs_base_version_): New data member declaration.
10512 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10513 (check_DATA): Add no_version_test.stdout.
10514 (libno_version_test.so, no_version_test.o no_version_test.stdout):
10515 New make rules.
10516 * testsuite/Makefile.in: Regenerate.
10517 * testsuite/no_version_test.c: New file.
10518 * testsuite/no_version_test.sh: Ditto.
10519
10520 2009-10-16 Doug Kwan <dougkwan@google.com>
10521
10522 * expression.cc (class Segment_start_expression): New class definition.
10523 (Segment_start_expression::value): New method definition.
10524 (script_exp_function_segment_start): Return a new
10525 Segment_start_expression.
10526 * gold/script-c.h (script_saw_segment_start_expression): New function
10527 prototype.
10528 * script-sections.cc (Script_sections::Script_sections): Initialize
10529 SAW_SEGMENT_START_EXPRESSION_ to false.
10530 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10531 and -Tbbs options to specify section addresses if given in
10532 command line and no SEGMENT_START expression is seen in a script.
10533 * script-sections.h (Script_sections::saw_segment_start_expression,
10534 Script_sections::set_saw_segment_start_expression): New method
10535 definition.
10536 (Script_sections::saw_segment_start_expression_): New data member
10537 declaration.
10538 * script.cc (script_saw_segment_start_expression): New function.
10539 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10540 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10541 script_test_7.sh and script_test_8.sh.
10542 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10543 script_test_8.stdout.
10544 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10545 (script_test_6, script_test_6.stdout, script_test_7,
10546 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10547 * Makefile.in: Regenerate.
10548 * testsuite/script_test_6.sh: New file.
10549 * testsuite/script_test_6.t: Same.
10550 * testsuite/script_test_7.sh: Same.
10551 * testsuite/script_test_7.t: Same.
10552 * testsuite/script_test_8.sh: Same.
10553
10554 2009-10-16 Doug Kwan <dougkwan@google.com>
10555
10556 * output.cc (Output_segment::set_section_list_address): Cast
10557 expressions to unsigned long long type to avoid format warnings.
10558
10559 2009-10-15 Ian Lance Taylor <iant@google.com>
10560
10561 * script.cc (Script_options::add_symbol_assignment): Always add a
10562 dot assignment to script_sections_.
10563 * script-sections.cc (Script_sections::add_dot_assignment):
10564 Initialize if necessary.
10565
10566 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10567 program headers with no load segment if there is a linker script.
10568
10569 * layout.cc (Layout::set_segment_offsets): Align the file offset
10570 to the segment aligment for -N or -n with no load segment.
10571 * output.cc (Output_segment::add_output_section): Don't crash if
10572 the first section is a TLS section.
10573 (Output_segment::set_section_list_addresses): Print an error
10574 message if the address moves backward in a linker script.
10575 * script-sections.cc
10576 (Output_section_element_input::set_section_addresses): Don't
10577 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10578 (Orphan_output_section::set_section_addresses): Likewise.
10579
10580 2009-10-15 Doug Kwan <dougkwan@google.com>
10581
10582 * layout.cc (Layout::finish_dynamic_section): Generate tags
10583 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10584 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10585 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10586
10587 2009-10-14 Ian Lance Taylor <iant@google.com>
10588
10589 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10590 fields.
10591 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10592 data_shdr fields of relinfo.
10593 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10594 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
10595 R_386_TLS_LDO_32, adjust based on section flags.
10596 (Target_i386::Relocate::fix_up_ldo): Remove.
10597
10598 2009-10-13 Ian Lance Taylor <iant@google.com>
10599
10600 Add support for -pie.
10601 * options.h (class General_options): Add -pie and
10602 --pic-executable.
10603 (General_options::output_is_position_independent): Test -pie.
10604 (General_options::output_is_executable): Return true if not shared
10605 and not relocatable.
10606 (General_options::output_is_pie): Remove.
10607 * options.cc (General_options::finalize): Reject incompatible uses
10608 of -pie.
10609 * gold.cc (queue_middle_tasks): A -pie link is not static.
10610 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10611 * symtab.cc (Symbol::final_value_is_known): Return false if
10612 output_is_position_independent.
10613 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10614 output_is_position_independent.
10615 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10616 output_is_position_independent.
10617 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10618 output_is_position_independent.
10619 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10620 two_file_pie_test.
10621 (basic_pie_test.o, basic_pie_test): New targets.
10622 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10623 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10624 (two_file_pie_test): New target.
10625 * testsuite/Makefile.in: Rebuild.
10626 * README: Remove note saying that -pie is not supported.
10627
10628 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
10629
10630 * options.h (class General_options): Add -init and -fini.
10631 * layout.cc (Layout::finish_dynamic_section): Emit
10632 given init and fini functions.
10633
10634 2009-10-13 Sriraman Tallam <tmsriram@google.com>
10635
10636 * gc.h (gc_process_relocs): Check if icf is enabled using new
10637 function.
10638 * gold.cc (queue_initial_tasks): Likewise.
10639 (queue_middle_tasks): Likewise.
10640 * object.cc (do_layout): Likewise.
10641 * symtab.cc (is_section_folded): Likewise.
10642 * main.cc (main): Likewise.
10643 * reloc.cc (Read_relocs::run): Likewise.
10644 (Sized_relobj::do_scan_relocs): Likewise.
10645 * icf.cc (is_function_ctor_or_dtor): New function.
10646 (Icf::find_identical_sections): Check if function is ctor or dtor when
10647 safe icf is chosen.
10648 * options.h (General_options::icf): Change option to be an enum.
10649 (Icf_status): New enum.
10650 (icf_enabled): New method.
10651 (icf_safe_folding): New method.
10652 (set_icf_status): New method.
10653 (icf_status_): New variable.
10654 * (options.cc) (General_options::finalize): Set icf_status_.
10655 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10656 icf_test and icf_keep_unique_test to use the --icf enum flag.
10657 * testsuite/icf_safe_test.sh: New file.
10658 * testsuite/icf_safe_test.cc: New file.
10659
10660 2009-10-12 Sriraman Tallam <tmsriram@google.com>
10661
10662 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10663 includes to gc.h and icf.h.
10664 * arm.cc: Include gc.h.
10665 * gold.cc: Likewise.
10666 * i386.cc: Likewise.
10667 * powerpc.cc: Likewise.
10668 * sparc.cc: Likewise.
10669 * x86_64.cc: Likewise.
10670 * gc.h: Include icf.h.
10671
10672 2009-10-11 Ian Lance Taylor <iant@google.com>
10673
10674 * plugin.cc: Include "gold.h" before other header files.
10675
10676 2009-10-10 Chris Demetriou <cgd@google.com>
10677
10678 * options.h (Input_file_argument::Input_file_type): New enum.
10679 (Input_file_argument::is_lib_): Replace with...
10680 (Input_file_argument::type_): New member.
10681 (Input_file_argument::Input_file_argument): Take Input_file_type
10682 'type' rather than boolean 'is_lib' as second argument.
10683 (Input_file_argument::is_lib): Use type_.
10684 (Input_file_argument::is_searched_file): New function.
10685 (Input_file_argument::may_need_search): Handle is_searched_file.
10686 * options.cc (General_options::parse_library): Support -l:filename.
10687 (General_options::parse_just_symbols): Update for Input_file_argument
10688 changes.
10689 (Command_line::process): Likewise.
10690 * archive.cc (Archive::get_file_and_offset): Likewise.
10691 * plugin.cc (Plugin_manager::release_input_file): Likewise.
10692 * script.cc (read_script_file, script_add_file): Likewise.
10693 * fileread.cc (Input_file::Input_file): Likewise.
10694 (Input_file::will_search_for): Handle is_searched_file.
10695 (Input_file::open): Likewise.
10696 * readsyms.cc (Read_symbols::get_name): Likewise.
10697 * testsuite/Makefile.am (searched_file_test): New test.
10698 * testsuite/Makefile.in: Regenerate.
10699 * testsuite/searched_file_test.cc: New file.
10700 * testsuite/searched_file_test_lib.cc: New file.
10701
10702 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10703 Ian Lance Taylor <iant@google.com>
10704
10705 * descriptor.cc: Include <cstdio> and "binary-io.h".
10706 (Descriptors::open): Open the files in binary mode always.
10707 * script.cc (Lex::get_token): Treat \r as whitespace.
10708
10709 2009-10-09 Ian Lance Taylor <iant@google.com>
10710
10711 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10712
10713 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10714 Ian Lance Taylor <iant@google.com>
10715
10716 * configure.ac: Check for readv function also.
10717 * fileread.cc (readv): Define if not HAVE_READV.
10718 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10719 does not exist.
10720 * config.in: Regenerate.
10721 * configure: Regenerate.
10722
10723 2009-10-09 Doug Kwan <dougkwan@google.com>
10724
10725 * layout.cc (Layout::make_output_section): Call target hook to make
10726 ordinary output section.
10727 (Layout::finalize): Adjust parameter list of call the
10728 Target::may_relax().
10729 * layout.h (class Layout::section_list): New method.
10730 * merge.h (Output_merge_base::entsize): Change visibility to public.
10731 (Output_merge_base::is_string, Output_merge_base::do_is_string):
10732 New methods.
10733 (Output_merge_string::do_is_string): New method.
10734 * object.cc (Sized_relobj::do_setup): renamed from
10735 Sized_relobj::set_up.
10736 * object.h (Sized_relobj::adjust_shndx,
10737 Sized_relobj::initializ_input_to_output_maps,
10738 Sized_relobj::free_input_to_output_maps): Change visibilities to
10739 protected.
10740 (Sized_relobj::setup): Virtualize.
10741 (Sized_relobj::do_setup): New method declaration.
10742 (Sized_relobj::invalidate_section_offset,
10743 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10744 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10745 * options.cc (parse_int): New function.
10746 * options.h (parse_int): New declaration.
10747 (DEFINE_int): New macro.
10748 (stub_group_size): New option.
10749 * output.cc (Output_section::Output_section): Initialize memebers
10750 merge_section_map_, merge_section_by_properties_map_,
10751 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10752 (Output_section::add_input_section): Handled deferred code-fill
10753 generation and remove an old comment.
10754 (Output_section::add_relaxed_input_section): New method definition.
10755 (Output_section::add_merge_input_section): Use merge section by
10756 properties map to speed to search. Update merge section maps
10757 as appropriate.
10758 (Output_section::build_relaxation_map): New method definition.
10759 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10760 Same.
10761 (Output_section::relax_input_section): Renamed to
10762 Output_section::convert_input_sections_to_relaxed_sections and change
10763 interface to take a vector of pointers to relaxed sections.
10764 (Output_section::find_merge_section,
10765 Output_section::find_relaxed_input_section): New method definitions.
10766 (Output_section::is_input_address_mapped,
10767 Output_section::output_offset, Output_section::output_address):
10768 Use output section data maps to speed up searching.
10769 (Output_section::find_starting_output_address): Add comments.
10770 (Output_section::do_write,
10771 Output_section::write_to_postprocessing_buffer): Do code-fill
10772 generation as appropriate.
10773 (Output_section::get_input_sections): Invalidate relaxed input section
10774 map.
10775 (Output_section::restore_states): Adjust type of checkpoint .
10776 Invalidate relaxed input section map.
10777 * output.h (Output_merge_base): New class declaration.
10778 (Input_section_specifier): New class defintion.
10779 (class Output_relaxed_input_section) Change base class to
10780 Output_section_data_build.
10781 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10782 base class initializer.
10783 (Output_section::add_relaxed_input_section): New method declaration.
10784 (Output_section::Input_section): Change visibility to protected.
10785 (Output_section::Input_section::relobj,
10786 Output_section::Input_section::shndx): Handle relaxed input sections.
10787 Output_section::input_sections) Change visibility to protected. Also
10788 define overload to return a non-const pointer.
10789 (Output_section::Merge_section_properties): New class defintion.
10790 (Output_section::Merge_section_by_properties_map,
10791 Output_section::Output_section_data_by_input_section_map,
10792 Output_section::Relaxation_map): New types.
10793 (Output_section::relax_input_section): Rename method to
10794 Output_section::convert_input_sections_to_relaxed_sections and change
10795 interface to take a vector of relaxed section pointers.
10796 (Output_section::find_merge_section,
10797 Output_section::find_relaxed_input_section,
10798 Output_section::build_relaxation_map,
10799 Output_section::convert_input_sections_in_list_to_relaxed_sections):
10800 New method declarations.
10801 (Output_section::merge_section_map_
10802 Output_section::merge_section_by_properties_map_,
10803 Output_section::relaxed_input_section_map_,
10804 Output_section::is_relaxed_input_section_map_valid_,
10805 Output_section::generate_code_fills_at_write_): New data members.
10806 * script-sections.cc
10807 (Output_section_element_input::set_section_addresses): Call
10808 current_data_size and addralign methods of relaxed input sections.
10809 (Orphan_output_section::set_section_addresses): Call current_data_size
10810 and addralign methods of relaxed input sections.
10811 * symtab.cc (Symbol_table::compute_final_value): Extract template
10812 from the body of Symbol_table::sized_finalize_symbol.
10813 (Symbol_table::sized_finalized_symbol): Call
10814 Symbol_table::compute_final_value.
10815 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10816 (Symbol_table::compute_final_value): New templated method declaration.
10817 * target.cc (Target::do_make_output_section): New method defintion.
10818 * target.h (Target::make_output_section): New method declaration.
10819 (Target::relax): Add more parameters for input objects, symbol table
10820 and layout. Adjust call to do_relax.
10821 (Target::do_make_output_section): New method declaration.
10822 (Target::do_relax): Add parameters for input objects, symbol table
10823 and layout.
10824
10825 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10826
10827 * pread.c: Include stdio.h.
10828
10829 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10830
10831 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10832 defined.
10833
10834 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10835
10836 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10837 Change read_shndx type to unsigned int.
10838 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10839 int.
10840 (Sized_dwarf_line_info::read_line_mappings): Likewise.
10841 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10842 Change read_shndx type to unsigned int.
10843 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10844 int.
10845 (Sized_dwarf_line_info::read_line_mappings): Likewise.
10846 * layout.cc (Layout::create_symtab_sections): Cast the result of
10847 local_symcount * symsize to off_t in the gold_assert.
10848
10849 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10850
10851 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10852 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10853 R_ARM_BASE_ABS.
10854 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10855 (Arm_relocate_functions::thm_abs5): New function.
10856 (Arm_relocate_functions::abs12): New function.
10857 (Arm_relocate_functions::abs16): New function.
10858 (Arm_relocate_functions::base_abs): New function.
10859 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10860 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
10861 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10862 R_ARM_BASE_ABS.
10863 (Scan::global): Likewise.
10864 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10865 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10866 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10867 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10868 R_ARM_BASE_ABS.
10869
10870 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10871
10872 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10873 (Arm_relocate_functions::movt_prel): New function.
10874 (Arm_relocate_functions::thm_movw_prel_nc): New function.
10875 (Arm_relocate_functions::thm_movt_prel): New function.
10876 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10877 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10878 (Scan::global, Relocate::relocate): Likewise.
10879 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10880
10881 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10882
10883 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10884 Incremental_checker.
10885 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10886 unsigned int.
10887 (class Incremental_inputs_header): New class.
10888 (Incremental_inputs_header_writer): Edit comment.
10889 (Incremental_inputs_entry): New class.
10890 (Incremental_inputs_entry_writer): Edit comment.
10891 (Sized_incremental_binary::do_find_incremental_inputs_section):
10892 Add *strtab_shndx parameter, fill it.
10893 (Sized_incremental_binary::do_check_inputs): New method.
10894 (Incremental_checker::can_incrementally_link_output_file): Use
10895 Sized_incremental_binary::check_inputs.
10896 (Incremental_inputs::report_command_line): Save command line in
10897 command_line_.
10898 * incremental.h:
10899 (Incremental_binary::find_incremental_inputs_section): New
10900 method.
10901 (Incremental_binary::do_find_incremental_inputs_section): Add
10902 strtab_shndx parameter.
10903 (Incremental_binary::do_check_inputs): New pure virtual method.
10904 (Sized_incremental_binary::do_check_inputs): Declare.
10905 (Incremental_checker::Incremental_checker): Add incremental_inputs
10906 parameter, use it to initialize incremental_inputs_.
10907 (Incremental_checker::incremental_inputs_): New field.
10908 (Incremental_checker::command_line): New method.
10909 (Incremental_checker::inputs): New method.
10910 (Incremental_checker::command_line_): New field.
10911
10912 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10913
10914 * incremental.cc: Include <cstdarg> and "target-select.h".
10915 (vexplain_no_incremental): New function.
10916 (explain_no_incremental): New function.
10917 (Incremental_binary::error): New method.
10918 (Sized_incremental_binary::do_find_incremental_inputs_section): New
10919 method.
10920 (make_sized_incremental_binary): New function.
10921 (open_incremental_binary): New function.
10922 (can_incrementally_link_file): Add checks if output is ELF and has
10923 inputs section.
10924 * incremental.h: Include "elfcpp_file.h" and "output.h".
10925 (Incremental_binary): New class.
10926 (Sized_incremental_binary): New class.
10927 (open_incremental_binary): Declare.
10928 * object.cc (is_elf_object): Use
10929 elfcpp::Elf_recognizer::is_elf_file.
10930 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10931 * output.h (Output_file::filesize): New method.
10932
10933 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10934
10935 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10936 New function.
10937 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10938 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10939 function.
10940 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10941 function.
10942 (Arm_relocate_functions::movw_abs_nc): New function.
10943 (Arm_relocate_functions::movt_abs): New function.
10944 (Arm_relocate_functions::thm_movw_abs_nc): New function.
10945 (Arm_relocate_functions::thm_movt_abs): New function.
10946 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10947 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10948 (Scan::global): Likewise.
10949 (Relocate::relocate): Likewise.
10950 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10951
10952 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10953
10954 * arm.cc (Arm_relocate_functions::got_prel) New function.
10955 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10956 (Relocate::relocate): Likewise.
10957 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10958
10959 2009-10-06 Ian Lance Taylor <iant@google.com>
10960
10961 * options.h (class General_options): Define
10962 split_stack_adjust_size parameter.
10963 * object.h (class Object): Add uses_split_stack_ and
10964 has_no_split_stack_ fields. Add uses_split_stack and
10965 has_no_split_stack accessor functions. Declare
10966 handle_split_stack_section.
10967 (class Reloc_symbol_changes): Define.
10968 (class Sized_relobj): Define Function_offsets. Declare
10969 split_stack_adjust, split_stack_adjust_reltype, and
10970 find_functions.
10971 * object.cc (Object::handle_split_stack_section): New function.
10972 (Sized_relobj::do_layout): Call handle_split_stack_section.
10973 * dynobj.cc (Sized_dynobj::do_layout): Call
10974 handle_split_stack_section.
10975 * reloc.cc (Sized_relobj::relocate_sections): Call
10976 split_stack_adjust for executable sections in split_stack
10977 objects. Pass reloc_map to relocate_section.
10978 (Sized_relobj::split_stack_adjust): New function.
10979 (Sized_relobj::split_stack_adjust_reltype): New function.
10980 (Sized_relobj::find_functions): New function.
10981 * target-reloc.h: Include "object.h".
10982 (relocate_section): Add reloc_symbol_changes parameter. Change
10983 all callers.
10984 * target.h (class Target): Add calls_non_split method. Declare
10985 do_calls_non_split virtual method. Declare match_view and
10986 set_view_to_nop.
10987 * target.cc: Include "elfcpp.h".
10988 (Target::do_calls_non_split): New function.
10989 (Target::match_view): New function.
10990 (Target::set_view_to_nop): New function.
10991 * gold.cc (queue_middle_tasks): Give an error if mixing
10992 split-stack and non-split-stack objects with -r.
10993 * i386.cc (Target_i386::relocate_section): Add
10994 reloc_symbol_changes parameter.
10995 (Target_i386::do_calls_non_split): New function.
10996 * x86_64.cc (Target_x86_64::relocate_section): Add
10997 reloc_symbol_changes parameter.
10998 (Target_x86_64::do_calls_non_split): New function.
10999 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11000 parameter.
11001 * powerpc.cc (Target_powerpc::relocate_section): Add
11002 reloc_symbol_changes parameter.
11003 * sparc.cc (Target_sparc::relocate_section): Add
11004 reloc_symbol_changes parameter.
11005 * configure.ac: Call AM_CONDITIONAL for the default target.
11006 * configure: Rebuild.
11007 * testsuite/Makefile.am (TEST_AS): New variable.
11008 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11009 (check_DATA): Add split_i386 and split_x86_64 files.
11010 (SPLIT_DEFSYMS): Define.
11011 (split_i386_[1234n].o): New targets.
11012 (split_i386_[124]): New targets.
11013 (split_i386_[1234r].stdout): New targets.
11014 (split_x86_64_[1234n].o): New targets.
11015 (split_x86_64_[124]): New targets.
11016 (split_x86_64_[1234r].stdout): New targets.
11017 (MOSTLYCLEANFILES): Add new executables.
11018 * testsuite/split_i386.sh: New file.
11019 * testsuite/split_x86_64.sh: New file.
11020 * testsuite/split_i386_1.s: New file.
11021 * testsuite/split_i386_2.s: New file.
11022 * testsuite/split_i386_3.s: New file.
11023 * testsuite/split_i386_4.s: New file.
11024 * testsuite/split_i386_n.s: New file.
11025 * testsuite/split_x86_64_1.s: New file.
11026 * testsuite/split_x86_64_2.s: New file.
11027 * testsuite/split_x86_64_3.s: New file.
11028 * testsuite/split_x86_64_4.s: New file.
11029 * testsuite/split_x86_64_n.s: New file.
11030 * testsuite/testfile.cc (Target_test): Update relocation_section
11031 function.
11032 * testsuite/Makefile.in: Rebuild.
11033
11034 2009-10-06 Ian Lance Taylor <iant@google.com>
11035
11036 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11037 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11038 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
11039 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11040 the address on ldo_addrs_.
11041 (Target_i386::Relocate::fix_up_ldo): New function.
11042
11043 2009-10-06 Rafael Espindola <espindola@google.com>
11044
11045 * plugin.cc (add_input_library): New.
11046 (Plugin::load): Add add_input_library to tv.
11047 (Plugin_manager::add_input_file): Add the is_lib argument.
11048 (add_input_file): Update call to Plugin_manager::add_input_file.
11049 (add_input_library): New.
11050 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11051
11052 2009-09-30 Doug Kwan <dougkwan@google.com>
11053
11054 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11055 symbol and call Symbol::may_need_copy_reloc to determine if
11056 a copy reloc is needed.
11057 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11058 nocopyreloc is given in command line.
11059 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11060 given in command line.
11061 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11062 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11063 of the removed Target_i386::may_need_copy_reloc.
11064 * options.h (copyreloc): New option with default value false.
11065 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11066 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11067 instead of the removed Target_powerpc::may_need_copy_reloc.
11068 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11069 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11070 instead of the removed Target_sparc::may_need_copy_reloc.
11071 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11072 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11073 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11074 instead of the removed Target_x86_64::may_need_copy_reloc.
11075
11076 2009-09-30 Ian Lance Taylor <iant@google.com>
11077
11078 * object.h (class Object): Remove target_ field, and target,
11079 sized_target, and set_target methods.
11080 (Object::sized_target): Remove.
11081 (class Sized_relobj): Update declarations. Remove sized_target.
11082 * object.cc (Sized_relobj::setup): Remove target parameter.
11083 Change all callers.
11084 (Input_objects::add_object): Don't do anything with the target.
11085 (make_elf_sized_object): Add punconfigured parameter. Change all
11086 callers. Set or test parameter target.
11087 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11088 Change all callers.
11089 * parameters.cc (Parameters::set_target): Change parameter type to
11090 be non-const.
11091 (Parameters::default_target): Remove.
11092 (set_parameters_target): Change parameter type to be non-const.
11093 (parameters_force_valid_target): New function.
11094 (parameters_clear_target): New function.
11095 * parameters.h (class Parameters): Update declarations. Remove
11096 default_target method. Add sized_target and clear_target
11097 methods. Change target_ to be non-const.
11098 (set_parameters_target): Update declaration.
11099 (parameters_force_valid_target): Declare.
11100 (parameters_clear_target): Declare.
11101 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11102 as NULL if we aren't searching.
11103 (Add_symbols::run): Don't check for compatible target.
11104 * fileread.cc (Input_file::open_binary): Call
11105 parameters_force_valid_target.
11106 * gold.cc (queue_middle_tasks): Likewise.
11107 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
11108 set_target on object.
11109 * dynobj.h (class Sized_dynobj): Update declarations.
11110 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11111 make_elf_object returns NULL.
11112 (Archive::include_member): Don't check whether object target is
11113 compatible.
11114 * output.cc (Output_section::add_input_section): Get target from
11115 parameters.
11116 (Output_section::relax_input_section): Likewise.
11117 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11118 parameters.
11119 (Sized_relobj::do_scan_relocs): Likewise.
11120 (Sized_relobj::relocate_sections): Likewise.
11121 * resolve.cc (Symbol_table::resolve): Likewise.
11122 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
11123 parameter. Change all callers.
11124 (Symbol_table::add_from_object): Get target from parameters.
11125 (Symbol_table::add_from_relobj): Don't check object target.
11126 (Symbol_table::add_from_dynobj): Likewise.
11127 (Symbol_table::define_special_symbol): Get target from
11128 parameters.
11129 * symtab.h (class Symbol_table): Update declaration.
11130 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11131 parameter. Change all callers. Clear parameter target.
11132 (Binary_test): Test target here.
11133 * testsuite/object_unittest.cc (gold_testsuite): Remove
11134 target_test_pointer parameter. Change all callers.
11135 (Object_test): Test target here.
11136
11137 2009-09-26 Ian Lance Taylor <iant@google.com>
11138
11139 * testsuite/initpri1.c: Don't try to use constructor priorities if
11140 compiling with gcc before 4.3.
11141
11142 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
11143
11144 * testsuite/retain_symbols_file_test.sh (check_present): Change
11145 output file name to retain_symbols_file_test.stdout.
11146 (check_absent): Likewise.
11147
11148 2009-09-18 Craig Silverstein <csilvers@google.com>
11149
11150 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11151 * options.cc: Include <cerrno> and <fstream>.
11152 (General_options::finalize): Parse -retain-symbols-file tag.
11153 * options.h: New flag.
11154 (General_options): New method should_retain_symbol, new
11155 variable symbols_to_retain.
11156 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11157 should_retain_symbol map.
11158 * testsuite/Makefile.am (retain_symbols_file_test): New test.
11159 * testsuite/Makefile.in: Regenerate.
11160 * testsuite/retain_symbols_file_test.sh: New file.
11161
11162 2009-09-18 Nick Clifton <nickc@redhat.com>
11163
11164 * po/es.po: Updated Spanish translation.
11165
11166 2009-09-17 Doug Kwan <dougkwan@google.com>
11167
11168 * debug.h (DEBUG_RELAXATION): New constant.
11169 (DEBUG_ALL): Add DEBUG_RELAXATION.
11170 (debug_string_to_enum): Add relaxation debug option.
11171 * layout.cc
11172 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11173 Layout::Relaxation_debug_check::read_sections,
11174 Layout::Relaxation_debug_check::read_sections): New method definitions.
11175 (Layout::Layout): Initialize data members
11176 record_output_section_data_from_scrips_,
11177 script_output_section_data_list_ and relaxation_debug_check_.
11178 (Layout::save_segments, Layout::restore_segments,
11179 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11180 Layout::relaxation_loop_body): New method definitions.
11181 (Layout::finalize): Support relaxation. Move section layout code to
11182 Layout::relaxation_loop_body.
11183 (Layout::set_asection_address_from_script): Move code for orphan
11184 section placement out.
11185 (Layout::place_orphan_sections_in_script): New method definition.
11186 * layout.h (Output_segment_headers, Output_file_header):
11187 New forward class declarations.
11188 (Layout::~Layout): Define.
11189 (Layout::new_output_section_data_from_script): New method definition.
11190 (Layout::place_orphan_sections_in_script): New method declaration.
11191 (Layout::Segment_states): New type declaration.
11192 (Layout::save_segments, Layout::restore_segments,
11193 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11194 Layout::relaxation_loop_body): New method declarations.
11195 (Layout::Output_section_data_list): New type declaration.
11196 (Layout::Relaxation_debug_check): New class definition.
11197 (Layout::record_output_section_data_from_script_,
11198 Layout::script_output_section_data_list_, Layout::segment_states_,
11199 Layout::relaxation_debug_check_): New data members.
11200 * output.cc: (Output_section_headers::do_size): New method definition.
11201 (Output_section_headers::Output_section_headers): Move size
11202 computation to Output_section_headers::do_size.
11203 (Output_segment_headers::do_size): New method definition.
11204 (Output_file_header::Output_file_header): Move size computation to
11205 Output_file_header::do_size and call it.
11206 (Output_file_header::do_size): New method definition.
11207 (Output_data_group::Output_data_group): Adjust call to
11208 Output_section_data.
11209 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11210 (Output_symtab_xindex::do_write): Add array bound check.
11211 (Output_section::Input_section::print_to_mapfile): Handle
11212 RELAXED_INPUT_SECTION_CODE.
11213 (Output_section::Output_section): Initialize data member checkpoint_.
11214 (Output_section::~Output_section): Delete checkpoint object pointed
11215 by checkpoint_.
11216 (Output_section::add_input_section): Always add an Input_section if
11217 relaxing.
11218 (Output_section::add_merge_input_section): Add assert.
11219 (Output_section::relax_input_section): New method definition.
11220 (Output_section::set_final_data_size): Set load address to zero for
11221 an unallocated section.
11222 (Output_section::do_address_and_file_offset_have_reset_values):
11223 New method definition.
11224 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11225 Handle relaxed input section.
11226 (Output_section::sort_attached_input_sections): Checkpoint input
11227 section list lazily.
11228 (Output_section::get_input_sections): Change type of input_sections to
11229 list of Simple_input_section pointers. Checkpoint input section list
11230 lazily. Also handle relaxed input sections.
11231 (Output_section::add_input_section_for_script): Take a reference to
11232 a Simple_input_section object instead of Relobj pointer and section
11233 index as parameter. Handle relaxed input sections.
11234 (Output_section::save_states, Output_section::restore_states): New
11235 method definitions.
11236 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11237 (Output_data::is_data_size_fixed): New method definition.
11238 (Output_data::reset_addresss_and_file_offset): Do not reset data size
11239 if it is fixed.
11240 (Output_data::address_and_file_offset_have_reset_values): New method
11241 definition.
11242 (Output_data::do_address_and_file_offset_have_reset_values): New method
11243 definition.
11244 (Output_data::set_data_size): Check that data size is not fixed.
11245 (Output_data::fix_data_size): New method definition.
11246 (Output_data::is_data_size_fixed_): New data member.
11247 (Output_section_headers::set_final_data_size): New method definition.
11248 (Output_section_headers::do_size): New method declaration.
11249 (Output_segment_headers::set_final_data_size): New method definition.
11250 (Output_segment_headers::do_size): New method declaration.
11251 (Output_file_header::set_final_data_size)::New method definition.
11252 (Output_file_header::do_size)::New method declaration.
11253 (Output_section_data::Output_section_data): Add new parameter
11254 is_data_size_fixed and use it to fix data size.
11255 (Output_data_const::Output_data_const): Adjust call to base class
11256 constructor and fix data size.
11257 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11258 base class constructor and fix data size.
11259 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11260 base class constructor and fix data size.
11261 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11262 class constructor and fix data size.
11263 (Output_data_group::set_final_data_size): New method definition.
11264 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11265 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11266 class constructor and fix data size.
11267 (Output_relaxed_input_section): New class definition.
11268 (Output_section::Simple_input_section): New class definition.
11269 (Output_section::get_input_sections): Adjust parameter list.
11270 (Output_section::add_input_section_for_script): Same.
11271 (Output_section::save_states, Output_section::restore_states,
11272 Output_section::do_address_and_file_offset_have_reset_values,
11273 (Output_section::Input_section::Input_section): Handle
11274 RELAXED_INPUT_SECTION_CODE. Add new overload for
11275 Output_relaxed_input_section.
11276 (Output_section::Input_section::is_input_section,
11277 Output_section::Input_section::set_output_section): Handle relaxed
11278 input section.
11279 (Output_section::Input_section::is_relaxed_input_section,
11280 Output_section::Input_section::output_section_data,
11281 Output_section::Input_section::relaxed_input_section): New method
11282 definitions.
11283 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11284 value.
11285 (Output_section::Input_section::u1_): Update comments.
11286 (Output_section::Input_section::u2_): Add new union member poris.
11287 (Output_section::Checkpoint_output_section): New classs definition.
11288 (Output_section::relax_input_section): New method declaration.
11289 (Output_section::checkpoint_): New data member.
11290 (Output_segment): Update comments.
11291 (Output_segment::Output_segment): Un-privatize copy constructor.
11292 (Output_segment::operator=): Un-privatize.
11293 * script-sections.cc (Output_section_element::Input_section_list):
11294 Change element type to Output_section::Simple_input_section.
11295 (Output_section_element_dot_assignment::set_section_addresses):
11296 Register output section data for relaxation clean up.
11297 (Output_data_exression::Output_data_expression): Adjust call to base
11298 constructor to fix data size.
11299 (Output_section_element_data::set_section_addresses): Register
11300 Output_data_expression object for relaxation clean up.
11301 (struct Input_section_info): Replace Relobj pointer and section index
11302 pair with Output_section::Simple_input_section and Convert struct to a
11303 class.
11304 (Input_section_sorter::operator()): Adjust access to
11305 Input_section_info data member to use accessors.
11306 (Output_section_element_input::set_section_addresses): Use layout
11307 parameter. Adjust code to use Output_section::Simple_input_section
11308 and Input_secction_info classes. Register filler for relaxation
11309 clean up.
11310 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11311 and section index pair with Output_section::Simple_input_section
11312 class. Adjust code accordingly.
11313 (Phdrs_element::release_segment): New method definition.
11314 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11315 segment list.
11316 (Script_sections::release_segments): New method definition.
11317 * gold/script-sections.h (Script_sections::release_segments): New
11318 method declaration.
11319 * gold/target.h (Target::may_relax, Target::relax,
11320 Target::do_may_relax, Target::do_relax): New method definitions.
11321
11322 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11323
11324 * arm.cc (has_signed_unsigned_overflow): New function.
11325 (Arm_relocate_functions::abs8): New function.
11326 (Target_arm::Scan::local): Handle R_ARM_ABS8.
11327 (Target_arm::Scan::global): Likewise.
11328 (Target_arm::relocate::relocate): Likewise.
11329 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11330 Likewise.
11331
11332 2009-09-16 Cary Coutant <ccoutant@google.com>
11333
11334 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11335 * testsuite/Makefile.in: Regenerate.
11336
11337 2009-09-11 Nick Clifton <nickc@redhat.com>
11338
11339 * po/gold.pot: Updated by the Translation project.
11340
11341 2009-09-08 Cary Coutant <ccoutant@google.com>
11342
11343 * output.cc (Output_file::open): Add execute permission to empty file.
11344 * testsuite/Makefile.am (permission_test): New test.
11345 * testsuite/Makefile.in: Regenerate.
11346
11347 2009-09-02 Ian Lance Taylor <iant@google.com>
11348
11349 * output.cc (Output_file::resize): Call map_no_anonymous rather
11350 than map.
11351
11352 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
11353
11354 * gold.cc: Include "incremental.h".
11355 (queue_initial_tasks): Call Incremental_checker methods.
11356 * incremental.cc: Include "output.h".
11357 (Incremental_checker::can_incrementally_link_output_file): New
11358 method.
11359 * incremental.h (Incremental_checker): New class.
11360
11361 * output.cc (Output_file::open_for_modification): New method.
11362 (Output_file::map_anonymous): Changed return type to bool. Record
11363 map in base_ field.
11364 (Output_file::map_no_anonymous): New method, broken out of map.
11365 (Output_file::map): Use map_no_anonymous and map_anonymous.
11366 * output.h (class Output_file): Update declarations.
11367
11368 2009-08-24 Cary Coutant <ccoutant@google.com>
11369
11370 * options.h (Command_line::Pre_options): New class.
11371 (Command_line::pre_options): New member.
11372 * options.cc (gold::options::ready_to_register): New variable.
11373 (One_option::register_option): Do nothing if not registering options.
11374 Assert if same short option registered twice.
11375 (General_options::General_options): Turn off option registration when
11376 done constructing.
11377 (Command_line::Pre_options::Pre_options): New constructor.
11378
11379 2009-08-24 Cary Coutant <ccoutant@google.com>
11380
11381 * options.h (General_options::no_keep_memory): Remove incorrect
11382 short option.
11383
11384 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
11385
11386 * Makefile.am (am__skiplex, am__skipyacc): New.
11387 * Makefile.in: Regenerate.
11388
11389 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
11390
11391 * Makefile.am (AM_CPPFLAGS): Renamed from ...
11392 (INCLUDES): ... this.
11393 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11394 (AM_CPPFLAGS): Renamed from ...
11395 (INCLUDE): ... this.
11396 * Makefile.in, testsuite/Makefile.in: Regenerate.
11397
11398 * Makefile.in: Regenerate.
11399 * aclocal.m4: Likewise.
11400 * config.in: Likewise.
11401 * configure: Likewise.
11402 * testsuite/Makefile.in: Likewise.
11403
11404 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11405 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11406 * Makefile.in: Regenerate.
11407 * testsuite/Makefile.in: Regenerate.
11408
11409 2009-08-19 Cary Coutant <ccoutant@google.com>
11410
11411 * resolve.cc (Symbol_table::resolve): Don't complain about defined
11412 symbols in shared libraries overridden by hidden or internal symbols
11413 in the main program.
11414
11415 2009-08-19 Chris Demetriou <cgd@google.com>
11416
11417 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11418 checking source file names in error messages.
11419
11420 2009-08-18 Doug Kwan <dougkwan@google.com>
11421
11422 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11423 an elcpp::Ehdr as parameter. Adjust call to set_target.
11424 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11425 an elfcpp::Ehdr as parameter.
11426 * object.cc (Object::set_target): Remove the version that looks up
11427 a target and sets it.
11428 (Sized_relobj::setup): Take a Target object instead of
11429 an elfcpp::Ehdr as parameter. Adjust call to set_target.
11430 (make_elf_sized_object): Find target and ask target to
11431 make an ELF object.
11432 * object.h: (Object::set_target): Remove the version that looks up
11433 a target and sets it.
11434 (Sized_relobj::setup): Take a Target object instead of
11435 an elfcpp:Ehdr as parameter.
11436 * target.cc: Include dynobj.h.
11437 (Target::do_make_elf_object_implementation): New.
11438 (Target::do_make_elf_object): New.
11439 * target.h (Target::make_elf_object): New template declaration.
11440 (Target::do_make_elf_object): New method declarations.
11441 (Target::do_make_elf_object_implementation): New template declaration.
11442
11443 2009-08-14 Ian Lance Taylor <iant@google.com>
11444
11445 * gold.h (FUNCTION_NAME): Define.
11446 (gold_unreachable): Use FUNCTION_NAME.
11447
11448 2009-08-12 Sriraman Tallam <tmsriram@google.com>
11449
11450 * icf.cc (Icf::find_identical_sections): Issue a warning when a
11451 symbol in the --keep-unique list is not found.
11452
11453 2009-08-12 Sriraman Tallam <tmsriram@google.com>
11454
11455 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11456 been maked as --keep-unique.
11457 (Icf::unfold_section): New function.
11458 * icf.h (Icf::unfold_section): New function.
11459 * options.h (General_options::keep_unique): New option.
11460 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11461 * testsuite/Makefile.in: Regenerate.
11462 * testsuite/icf_keep_unique_test.sh: New file.
11463 * testsuite/icf_keep_unique_test.cc: New file.
11464
11465 2009-08-12 Cary Coutant <ccoutant@google.com>
11466
11467 PR 10471
11468 * resolve.cc (Symbol_table::resolve): Check for references from
11469 dynamic objects to hidden and internal symbols.
11470 * testsuite/Makefile.am (hidden_test.sh): New test.
11471 * testsuite/Makefile.in: Regenerate.
11472 * testsuite/hidden_test.sh: New script.
11473 * testsuite/hidden_test_1.c: New test source.
11474 * testsuite/hidden_test_main.c: New test source.
11475
11476 2009-08-11 Doug Kwan <dougkwan@google.com>
11477
11478 * arm.cc: Update comments.
11479 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11480 segment to locate the .ARM.exidx section if present.
11481
11482 2009-08-09 Doug Kwan <dougkwan@google.com>
11483
11484 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11485 patch.
11486
11487 2009-08-07 Sriraman Tallam <tmsriram@google.com>
11488 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11489 compiler warnings.
11490
11491 2009-08-06 Sriraman Tallam <tmsriram@google.com>
11492
11493 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11494 valid tls_segment only for non-debug-section relocations.
11495 * testsuite/Makefile.am: Add gc_tls_test.
11496 * testsuite/Makefile.in: Regenerate.
11497 * testsuite/gc_tls_test.cc: New file.
11498 * testsuite/gc_tls_test.sh: New file.
11499
11500 2009-08-05 Sriraman Tallam <tmsriram@google.com>
11501
11502 * icf.cc: New file.
11503 * icf.h: New file.
11504 * Makefile.am (CCFILES): Add icf.cc.
11505 (HFILES): Add icf.h
11506 * Makefile.in: Regenerate.
11507 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11508 * gc.h (gc_process_relocs): Populate lists used by icf to contain
11509 section, symbol and addend information for the relocs.
11510 * gold.cc (queue_middle_tasks): Call identical code folding.
11511 * gold.h: Add defines for multimap.
11512 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11513 to the call of finalize_local_symbols.
11514 * main.cc (main): Create object of class Icf.
11515 * object.cc (Sized_relobj::do_layout): Allow this function to be
11516 called twice during icf.
11517 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11518 to sections marked as identical by icf.
11519 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11520 when available.
11521 (Sized_relobj::do_section_entsize): New function.
11522 * object.h (Object::section_entsize): New function.
11523 (Object::do_section_entsize): New pure virtual function.
11524 (Relobj::finalize_local_symbols): Add new parameter.
11525 (Relobj::do_section_entsize): New function.
11526 * options.h (General_options::icf): New option.
11527 (General_options::icf_iterations): New option.
11528 (General_options::print_icf_sections): New option.
11529 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11530 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11531 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11532 icf.
11533 * symtab.cc (Symbol_table::is_section_folded): New function.
11534 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
11535 to sections marked as identical by icf.
11536 * symtab.h (Symbol_table::set_icf): New function.
11537 (Symbol_table::icf): New function.
11538 (Symbol_table::is_section_folded): New function.
11539 (Symbol_table::icf_): New data member.
11540 * target-reloc.h (relocate_section): Ignore sections folded by icf.
11541 * testsuite/Makefile.am: Add commands to build icf_test.
11542 * testsuite/Makefile.in: Regenerate.
11543 * testsuite/icf_test.sh: New file.
11544 * testsuite/icf_test.cc: New file.
11545
11546 2009-07-24 Chris Demetriou <cgd@google.com>
11547
11548 * layout.cc (is_compressible_debug_section): Fix incorrect
11549 comment about compressed section names.
11550
11551 2009-07-20 Ian Lance Taylor <ian@airs.com>
11552
11553 PR 10419
11554 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11555
11556 2009-07-16 Ian Lance Taylor <iant@google.com>
11557
11558 PR 10400
11559 * layout.h: #include <map>.
11560 (class Kept_section): Change from struct to class. Add accessors
11561 and setters. Add section size to Comdat_group mapping. Change
11562 Comdat_group to std::map. Add is_comdat_ field. Add
11563 linkonce_size field in union.
11564 (class Layout): Update declaration of find_or_add_kept_section.
11565 Don't declare find_kept_object.
11566 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11567 parameter. Add object, shndx, is_comdat, and is_group_name
11568 parameters. Change all callers. Adjust for new Kept_section.
11569 (Layout::find_kept_object): Remove.
11570 * object.cc (Sized_relobj::include_section_group): Update use of
11571 Kept_section. Rename secnum to shndx. Only record
11572 Kept_comdat_section if sections are the same size.
11573 (Sized_relobj::include_linkonce_section): Update use of
11574 Kept_section. Only record Kept_comdat_section if sections are the
11575 same size. Set size of linkonce section.
11576 (Sized_relobj::map_to_kept_section): Update call to
11577 get_kept_comdat_section.
11578 * object.h (class Sized_relobj): Rename fields in
11579 Kept_comdat_section to drop trailing underscores; change object
11580 field to Relobj*. Change Kept_comdat_section_table to store
11581 struct rather than pointer.
11582 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11583 Add kept_object and kept_shndx parameters. Change all callers.
11584 (Sized_relobj::get_kept_comdat_section): Change return type to
11585 bool. Add kept_object and kept_shndx parameters. Change all
11586 callers.
11587 * plugin.cc (Pluginobj::include_comdat_group): Update call to
11588 Layout::find_or_add_kept_section.
11589
11590 2009-07-09 Ian Lance Taylor <iant@google.com>
11591
11592 * merge.cc (Object_merge_map::initialize_input_to_output_map):
11593 Reserve space in the hash table.
11594
11595 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
11596
11597 * fileread.cc (File_read::get_mtime): New method.
11598 * fileread.h (Timespec): New structure.
11599 (File_read::get_mtime): New method.
11600 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11601 Renamed from timestamp_nsec.
11602 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11603 Elf_Xword.
11604 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11605 timestamp_nsec.
11606 (Incremental_inputs::report_archive): Save mtime; style fix.
11607 (Incremental_inputs::report_obejct): Save mtime; style fix.
11608 (Incremental_inputs::report_script): Save mtime; style fix.
11609 (Incremental_inputs::finalize_inputs): Style fix.
11610 (Incremental_inputs::finalize): Style fix.
11611 (Incremental_inputs::create_input_section_data): Store inputs
11612 mtime.
11613 * incremental.h (Incremental_inputs::report_script): Add mtime
11614 argument.
11615 (Incremental_inputs::Input_info::Input_info): Intialize only one
11616 union member.
11617 (Incremental_inputs::Input_info::archive): Move to nameless
11618 union.
11619 (Incremental_inputs::Input_info::obejct): Move to nameless union.
11620 (Incremental_inputs::Input_info::script): Move to nameless union.
11621 (Incremental_inputs::mtime): New field.
11622 * script.cc (read_input_script): Pass file mtime to
11623 Incremental_input.
11624 * script.h (Script_info::inputs): Style fix.
11625
11626 2009-07-01 Ian Lance Taylor <ian@airs.com>
11627
11628 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11629 instead of 32.
11630
11631 2009-06-24 Ian Lance Taylor <iant@google.com>
11632
11633 PR 10156
11634 * layout.cc (Layout::choose_output_section): If we find an
11635 existing section, update the flags.
11636 (Layout::create_notes): New function, broken out of
11637 Layout::finalize.
11638 (Layout::finalize): Don't create note sections.
11639 (Layout::create_note): Don't crash if linker script discards
11640 section.
11641 (Layout::create_gold_note): Likewise.
11642 (Layout::create_build_id): Likewise. Don't set
11643 after_input_sections on the section.
11644 (Layout::create_executable_stack_info): Remove target parameter.
11645 Change caller.
11646 * layout.h (class Layout): Declare create_notes. Update
11647 declaration of create_executable_stack_info.
11648 * gold.cc (queue_middle_tasks): Call create_notes.
11649 * output.cc (Output_section::update_flags_for_input_section): Move
11650 here from output.h. If SHF_ALLOC flag is newly set, mark address
11651 invalid.
11652 * output.h (Output_data::mark_address_invalid): New function.
11653 (class Output_section): Only declare, not define,
11654 update_flags_for_input_section. Remove set_flags.
11655
11656 2009-06-24 Ian Lance Taylor <iant@google.com>
11657
11658 * script-sections.cc (Output_section_definition::
11659 set_section_addresses): Rename shadowing local load_address to
11660 laddr.
11661
11662 2009-06-24 Ian Lance Taylor <iant@google.com>
11663
11664 PR 10244
11665 * reloc.cc (relocate_sections): Skip empty relocation sections.
11666
11667 2009-06-23 Ian Lance Taylor <iant@google.com>
11668
11669 PR 10156
11670 * layout.cc (Layout::create_note): Use choose_output_section
11671 rather than make_output_section.
11672
11673 2009-06-23 Ian Lance Taylor <iant@google.com>
11674
11675 PR 10237
11676 * options.cc (General_options::parse_V): Set printed_version_.
11677 (General_options::General_options): Initialize printed_version_.
11678 * options.h (class General_options): Add printed_version_ field.
11679 * gold.cc (queue_initial_tasks): If there are no input files,
11680 don't give a fatal error if we printed the version information.
11681 (queue_middle_tasks): If using -r with a shared object, give a
11682 fatal error rather than an ordinary error.
11683
11684 2009-06-23 Ian Lance Taylor <iant@google.com>
11685
11686 PR 10219
11687 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11688 (Layout::make_output_section): Set have_stabstr_section_ if we see
11689 a .stab*str section.
11690 (Layout::finalize): Call link_stabs_sections.
11691 (Layout::link_stabs_sections): New file.
11692 * layout.h (class Layout): Add have_stabstr_section_ field.
11693 Declare link_stabs_sections.
11694
11695 2009-06-23 Doug Kwan <dougkwan@google.com>
11696
11697 * Makefile.am (libgold_a_LIBADD): New.
11698 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11699 * Makefile.in: Regenerate.
11700 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11701 * configure: Regenerate.
11702 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11703 * fileread.cc: Include sys/state.h
11704 * gold.h: Declare memmem and strndup if found missing.
11705 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11706
11707 2009-06-23 Ian Lance Taylor <iant@google.com>
11708
11709 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11710 * configure: Rebuild.
11711
11712 2009-06-23 Ian Lance Taylor <iant@google.com>
11713
11714 PR 10147
11715 * object.cc (Object::section_contents): Don't try to get a view if
11716 the section has length zero.
11717 (Object::handle_gnu_warning_section): If the section is empty, use
11718 the name of the section as the warning.
11719
11720 2009-06-23 Ian Lance Taylor <iant@google.com>
11721
11722 PR 10133
11723 * stringpool.h (class Stringpool_template): Add optimize_ field.
11724 (Stringpool_template::set_optimize): New function.
11725 * stringpool.cc (Stringpool_template::Stringpool_template):
11726 Initialize optimize_ field.
11727 (Stringpool_template::set_string_offsets): Test local optimize
11728 fild rather than parameter.
11729 * layout.cc (Layout::Layout): Call set_optimize on the section
11730 name stringpool.
11731
11732 2009-06-22 Ian Lance Taylor <iant@google.com>
11733
11734 PR 10030
11735 * yyscript.y: Parse TARGET.
11736 * script.cc (script_set_target): New function.
11737 * script-c.h (script_set_target): Declare.
11738 * options.cc (General_options::string_to_object_format): Rename
11739 from string_to_object_format in anonymous namespace. Change
11740 callers.
11741 * options.h (class General_options): Declare
11742 string_to_object_format.
11743
11744 2009-06-22 Ian Lance Taylor <iant@google.com>
11745
11746 * script-sections.cc (Script_sections::create_segments): Don't put
11747 program headers in a PT_LOAD segment if -n or -N.
11748
11749 2009-06-22 Ian Lance Taylor <iant@google.com>
11750
11751 PR 10141
11752 * options.h (class General_options): Add -z lazy and -z now. Sort
11753 -z options into alphabetical order.
11754 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11755
11756 2009-06-21 Ian Lance Taylor <iant@google.com>
11757
11758 * layout.cc (Layout::make_output_section): Call
11759 Target::new_output_section.
11760 (Layout::attach_allocated_section_to_segment): Put large section
11761 sections in a separate load segment with the large segment flag
11762 set.
11763 (Layout::segment_precedes): Sort large data segments after other
11764 load segments.
11765 (align_file_offset): New static function.
11766 (Layout::set_segment_offsets): Use align_file_offset.
11767 * output.h (class Output_section): Add is_small_section_ and
11768 is_large_section_ fields.
11769 (Output_section::is_small_section): New function.
11770 (Output_section::set_is_small_section): New function.
11771 (Output_section::is_large_section): New function.
11772 (Output_section::set_is_large_section): New function.
11773 (Output_section::is_large_data_section): New function.
11774 (class Output_segment): Add is_large_data_segment_ field.
11775 (Output_segment::is_large_data_segment): New function.
11776 (Output_segment::set_is_large_data_segment): New function.
11777 * output.cc (Output_section::Output_section): Initialize new
11778 fields.
11779 (Output_segment::Output_segment): Likewise.
11780 (Output_segment::add_output_section): Add assertion that large
11781 data sections always go in large data segments. Force small data
11782 sections to the end of the list of data sections. Force small BSS
11783 sections to the start of the list of BSS sections. For large BSS
11784 sections to the end of the list of BSS sections.
11785 * symtab.h (class Symbol): Declare is_common_shndx.
11786 (Symbol::is_defined): Check Symbol::is_common_shndx.
11787 (Symbol::is_common): Likewise.
11788 (class Symbol_table): Define enum Commons_section_type. Update
11789 declarations. Add small_commons_ and large_commons_ fields.
11790 * symtab.cc (Symbol::is_common_shndx): New function.
11791 (Symbol_table::Symbol_table): Initialize new fields.
11792 (Symbol_table::add_from_object): Put small and large common
11793 symbols in the right list.
11794 (Symbol_table::sized_finalized_symbol): Check
11795 Symbol::is_common_shndx.
11796 (Symbol_table::sized_write_globals): Likewise.
11797 * common.cc (Symbol_table::do_allocate_commons): Allocate new
11798 common symbol lists. Don't call do_allocate_commons_list if the
11799 list is empty.
11800 (Symbol_table::do_allocate_commons_list): Remove is_tls
11801 parameter. Add comons_section_type parameter. Change all
11802 callers. Handle small and large common symbols.
11803 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11804 Symbol::is_common_shndx.
11805 * resolve.cc (symbol_to_bits): Likewise.
11806 * target.h (Target::small_common_shndx): New function.
11807 (Target::small_common_section_flags): New function.
11808 (Target::large_common_shndx): New function.
11809 (Target::large_common_section_flags): New function.
11810 (Target::new_output_section): New function.
11811 (Target::Target_info): Add small_common_shndx, large_common_shndx,
11812 small_common_section_flags, and large_common_section_flags
11813 fields.
11814 (Target::do_new_output_section): New virtual function.
11815 * arm.cc (Target_arm::arm_info): Initialize new fields.
11816 * i386.cc (Target_i386::i386_info): Likewise.
11817 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11818 Likewise.
11819 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11820 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11821 (Target_x86_64::do_new_output_section): New function.
11822 * configure.ac: Define conditional MCMODEL_MEDIUM.
11823 * testsuite/Makefile.am (check_PROGRAMS): Add large.
11824 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11825 (large_LDFLAGS): Define.
11826 * testsuite/large.c: New file.
11827 * testsuite/testfile.cc (Target_test::test_target_info):
11828 Initialize new fields.
11829 * configure, testsuite/Makefile.in: Rebuild.
11830
11831 2009-06-05 Doug Kwan <dougkwan@google.com>
11832
11833 * Makefile.am (CCFILES): Add target.cc.
11834 * Makefile.in: Regenerate.
11835 * i386.cc (class Target_i386): Define new virtual method to
11836 override do_is_local_label_name in parent.
11837 * object.cc (Sized_relobj::do_count_local_symbols): Discard
11838 local symbols if --discard-locals or -X is given.
11839 * options.h (class General_options): Declare new options
11840 '--discard-locals' and '-X' for discarding locals.
11841 * target.h (class Target): Define new methods is_local_label_name.
11842 Declare new virtual method do_is_local_label_name.
11843 * target.cc: New file.
11844 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11845 (check_SCRIPTS): Add discard_locals_test.sh.
11846 (check_DATA): Add discard_local_tests.syms.
11847 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11848 (discard_local_tests.syms, discard_locals_test.o): New make rules.
11849 * testsuite/Makefile.in: Regenerate.
11850 * testsuite/discard_locals_test.c: New file.
11851 * testsuite/discard_locals_test.sh: Same.
11852
11853 2009-06-05 Doug Kwan <dougkwan@google.com>
11854
11855 * object.cc (Sized_relobj::Sized_relobj): Initialize
11856 discarded_eh_frame_shndx_ to -1U.
11857 (Sized_relobj::do_layout): Record index of a discard .eh_frame
11858 section.
11859 (Sized_relobj::do_count_local_symbols): Skip local symbols in
11860 a discarded .eh_frame section.
11861 (Sized_relobj::do_finalize_local_symbols): Ditto.
11862 * object.h (class Sized_relobj): Declare new member
11863 discarded_eh_frame_shndx_.
11864 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11865 (local_labels_test.o, local_labels_test): New rules.
11866 * testsuite/Makefile.in: Regenerate.
11867
11868 2009-06-04 Doug Kwan <dougkwan@google.com>
11869
11870 * layout.cc (Layout::section_name_mapping): Add mapping for
11871 special ARM sections.
11872
11873 2009-06-03 Doug Kwan <dougkwan@google.com>
11874
11875 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11876 (utils::has_overflow): Same.
11877
11878 2009-06-03 Ian Lance Taylor <iant@google.com>
11879
11880 * layout.cc (Layout::section_name_mapping): New array, replacing
11881 Layout::linkonce_mapping.
11882 (Layout::section_name_mapping_count): New variable, replacing
11883 Layout::linkonce_mapping_count.
11884 (Layout::linkonce_output_name): Remove.
11885 (Layout::output_section_name): Rewrite.
11886 * layout.h (class Layout): Rename Linkonce_mapping to
11887 Section_name_mapping, linkonce_mapping to section_name_mapping,
11888 linkonce_mapping_count to section_name_mapping_count. Don't
11889 declare linkonce_output_name.
11890
11891 2009-06-03 Doug Kwan <dougkwan@google.com>
11892
11893 * gold/arm.cc (namespace utils): New.
11894 (Target_arm::reloc_is_non_pic): Define new method.
11895 (class Arm_relocate_functions): New.
11896 (Target_arm::Relocate::relocate): Handle relocation types used by
11897 Android.
11898
11899 2009-06-03 Ian Lance Taylor <iant@google.com>
11900
11901 * arm.cc (Target_arm::scan::global): Use || instead of |.
11902
11903 2009-06-02 Doug Kwan <dougkwan@google.com>
11904
11905 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
11906 issued_non_pic_error_.
11907 (class Target_arm::Scan): Declare new method check_non_pic.
11908 Define new method symbol_needs_plt_entry.
11909 Declare new data member issued_non_pic_error_.
11910 (class Target_arm::Relocate): Declare new method
11911 should_apply_static_reloc.
11912 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11913 (Target_arm::Scan::check_non_pic): Define new method.
11914 (Target_arm::Scan::local): Handle a small subset of reloc types used
11915 by Android.
11916 (Target_arm::Scan::local): Same.
11917 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11918
11919 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
11920
11921 * incremental.cc (Incremental_inputs::report_command_line): Filter
11922 out --incremental-* options.
11923
11924 2009-05-29 Doug Kwan <dougkwan@google.com>
11925
11926 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11927 template class.
11928 (class Target_arm): Update comment.
11929 (Target_arm::Target_arm): Initialize new data members GOT_,
11930 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11931 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11932 and Target_arm::rel_dyn_section.
11933 Declare new_enum Target_arm::Got_type.
11934 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11935 and DYNBSS_.
11936 Update commments for member do_dynsym_value.
11937 (Target_arm::got_size, Target_arm::plt_section,
11938 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11939 new methods inside class defintion.
11940 (Target_arm::got_section): Define new method.
11941 (Target_arm::rel_dyn_section): Same.
11942 (Output_data_plt_arm): New template class.
11943 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11944 (Output_data_plt_arm:do_adjust_output_section): Define new method.
11945 (Output_data_plt_arm::add_entry): Same.
11946 (Output_data_plt_arm::first_plt_entry): Define new
11947 static data member for PLT instruction template.
11948 (Output_data_plt_arm::plt_entry): Same.
11949 (Output_data_plt_arm::do_write): Define new method.
11950 (Target_arm::make_plt_entry): Same.
11951 (Target_arm::do_finalize_sections): Same.
11952 (Target_arm::do_dynsym_value): Same.
11953
11954 2009-05-28 Doug Kwan <dougkwan@google.com>
11955
11956 * Makefile.am (TARGETSOURCES): Add arm.cc.
11957 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11958 * Makefile.in: Regenerate.
11959 * arm.cc: New file.
11960 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11961
11962 2009-05-26 Doug Kwan <dougkwan@google.com>
11963
11964 * options.cc (General_options::parse_exclude_libs). Fix a comment.
11965 (General_options::check_excluded_libs): Strip off directories in
11966 archive name before matching like GNU ld does.
11967 * testsuite/Makefile.am (MOSTLYCLEANFILES,
11968 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11969 (exclude_libs_test_LDFLAGS): Add linker option
11970 -Wl,--exclude-libs,libexclude_libs_test_3
11971 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11972 an explicit archive without using -l.
11973 (alt/libexclude_libs_test_3.a): New make rule.
11974 * testsuite/Makefile.in: Regenerate.
11975 * testsuite/exclude_libs_test.c : Declare lib3_default().
11976 (main): Call it.
11977 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11978 * exclude_libs_test_3.c: New file.
11979
11980 2009-05-26 Nick Clifton <nickc@redhat.com>
11981
11982 * po/id.po: New Indonesian translation.
11983 * po/gold.pot: Updated template file.
11984
11985 2009-05-22 Sriraman Tallam <tmsriram@google.com>
11986
11987 * testsuite/Makefile.am: Add -ffunction-sections to compile
11988 gc_comdat_test files. Add -Wl,--gc-sections to build
11989 gc_comdat_test.
11990 * testsuite/Makefile.in: Regenerate.
11991 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11992
11993 2009-05-21 Sriraman Tallam <tmsriram@google.com>
11994
11995 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11996 kept comdat section was garbage collected.
11997 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11998 * testsuite/Makefile.in: Regenerate.
11999 * testsuite/gc_comdat_test.sh: New file.
12000 * testsuite/gc_comdat_test_1.cc: New file.
12001 * testsuite/gc_comdat_test_2.cc: New file.
12002
12003 2009-05-19 Doug Kwan <dougkwan@google.com>
12004
12005 * archive.cc (Archive::Archive): Move constructor from archive.h
12006 to here. Initialize no_export_.
12007 (Archive::get_elf_object_for_member): Set no_export flag of object.
12008 * archive.h (Archive::Archive): Move constructor body to
12009 archive.cc.
12010 (Archive::no_export): New method.
12011 (Archive::no_export_): New field.
12012 * object.h (Object::Object): Initialize no_export_ to false.
12013 (Object::no_export, Object::set_no_export): New methods.
12014 (Object::no_export_): New field.
12015 * options.cc (General_options::parse_exclude_libs): New method.
12016 (General_options::check_excluded_libs) Same.
12017 * options.h (exclude_libs): New option.
12018 (General_options::check_excluded_libs): New method declaration.
12019 (General_options::excluded_libs_): New field.
12020 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12021 default or protected visibility if an object has no-export flag set.
12022 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12023 (check_SCRIPTS): Add exclude_libs_test.sh.
12024 (check_DATA): Add exclude_libs_test.syms.
12025 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12026 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12027 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12028 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12029 (exclude_libs_test.syms, libexclude_libs_test_1.a,
12030 libexclude_libs_test_2.a): New rules.
12031 * testsuite/Makefile.in: Regenerate.
12032 * testsuite/exclude_libs_test.c: New file.
12033 * testsuite/exclude_libs_test.sh: Ditto.
12034 * testsuite/exclude_libs_test_1.c: Ditto.
12035 * testsuite/exclude_libs_test_2.c: Ditto.
12036
12037 2009-05-15 Ian Lance Taylor <iant@google.com>
12038
12039 * configure.ac: Check for declarations for cases where libiberty.h
12040 checks HAVE_DECL_xxx.
12041 * configure, config.in: Rebuild.
12042
12043 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
12044
12045 * gold.h (Incremental_argument_list): Remove (invalid) forward
12046 declaration.
12047 * incremental.cc (Incremental_inputs::report_achive): New method.
12048 (Incremental_inputs::report_object): New method.
12049 (Incremental_inputs::report_script): New method.
12050 (Incremental_inputs::finalize_inputs): New method.
12051 (Incremental_inputs::finalize): Call finalize_inputs().
12052 (Incremental_inputs::sized_create_incremental_inputs_section_data):
12053 Create inputs entries.
12054 * incremental.h (Incremental_input_type): New enum.
12055 (Incremental_inputs::Incremental_input): Initialize new fields.
12056 (Incremental_inputs::report_inputs): New method.
12057 (Incremental_inputs::report_achive): New method.
12058 (Incremental_inputs::report_object): New method.
12059 (Incremental_inputs::report_script): New method.
12060 (Incremental_inputs::finalize_inputs): New method.
12061 (Incremental_inputs::Input_info): New struct.
12062 (Incremental_inputs::Input_info_map): New typedef.
12063 (Incremental_inputs::lock_): New field.
12064 (Incremental_inputs::Inputs_): New field.
12065 (Incremental_inputs::Inputs_map): New field.
12066 * main.cc (main): Call Incremental_input::report_inputs.
12067 * options.h (Input_argument_list): Typedef moved from
12068 Input_arguments.
12069 (Input_file_group::Files): Remove, use ::Input_argument_list.
12070 (Input_file_group::Input_argument_list): Remove, use
12071 ::Input_argument_list.
12072 * plugin.cc (Plugin_manager::add_input_file): Add error in
12073 incremental build.
12074 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12075 functions.
12076 * script.cc (read_input_script): Call
12077 Incremental_input::report_script.
12078 * script.h (Script_info): New class.
12079
12080 2009-04-27 Ian Lance Taylor <iant@google.com>
12081
12082 * x86_64.cc (do_adjust_output_section): Set entsize to
12083 plt_entry_size.
12084
12085 2009-04-23 Elliott Hughes <enh@google.com>
12086
12087 * output.cc (Output_file::close): After short writes, continue
12088 writing from the correct offset in the buffer being written.
12089
12090 2009-04-23 Chris Demetriou <cgd@google.com>
12091
12092 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12093 * configure: Regenerate.
12094 * config.in: Regenerate.
12095 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12096 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12097
12098 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
12099
12100 * incremental.cc (Incremental_inputs_header_data): Renamed from
12101 Incremental_input_header_data.
12102 (Incremental_inputs_header_data::data_size): New field.
12103 (Incremental_inputs_header_data::put_input_file_count): Renamed
12104 from input_file_count.
12105 (Incremental_inputs_header_data::put_command_line_offset): Renamed
12106 from command_line_offset.
12107 (Incremental_inputs_header_data::put_reserved): Renamed from
12108 put_reserved.
12109 (Incremental_inputs_entry_data): Renamed from
12110 Incremental_input_entry_data.
12111 (Incremental_inputs_entry_data::data_size): New field.
12112 (Incremental_inputs::report_command_line): New method.
12113 (Incremental_inputs::finalize): New method.
12114 (Incremental_inputs::create_incremental_inputs_data): New method.
12115 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12116 * incremental.h: New file.
12117 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12118 (Layout::finalize): Create incremental inputs section in
12119 incremental builds.
12120 (Layout::create_incremental_info_sections): New method.
12121 * layout.h (Layout::incremental_inputs): New method.
12122 (Layout::create_incremental_info_sections): New method.
12123 (Layout::incremental_inputs_): New field.
12124 * main.cc (main): Notify Incremental_input of the command line.
12125
12126 2009-04-01 Ian Lance Taylor <iant@google.com>
12127 Mikolaj Zalewski <mikolajz@google.com>
12128
12129 * gold.h (reserve_unordered_map): Define, three versions, one for
12130 each version of Unordered_map.
12131 * layout.cc (Layout::Layout): Remove options parameter. Add
12132 number_of_input_files parameter. Don't initialize options_.
12133 Initialize number_of_input_files_ and resized_signatures_. Move
12134 sections_are_attached_.
12135 (Layout::layout_group): Reserve space for group_signatures_.
12136 (Layout::find_or_add_kept_section): Change name parameter to be a
12137 reference. Resize signatures_ map when it gets large enough.
12138 (Layout::layout_eh_frame): Use parameters->options() instead of
12139 this->options_.
12140 (Layout::make_output_section): Likewise.
12141 (Layout::attach_allocated_section_to_segment): Likewise.
12142 (Layout::finalize, Layout::create_executable_stack): Likewise.
12143 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12144 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12145 * layout.h (class Layout): Update declarations. Remove options_
12146 field. Add number_of_input_files_ and resized_signatures_
12147 fields. Move sections_are_attached_ field.
12148 * main.cc (main): Pass number of input files to Layout
12149 constructor. Don't pass options.
12150
12151 2009-03-30 Ian Lance Taylor <iant@google.com>
12152
12153 * ffsll.c (ffsll): Correct implementation.
12154
12155 2009-03-27 Ian Lance Taylor <iant@google.com>
12156
12157 * ffsll.c: New file.
12158 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12159 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12160 * ftruncate.c (ftruncate): Declare before definition.
12161 * mremap.c (mremap): Likewise.
12162 * pread.c (pread): Likewise.
12163 * configure, Makefile.in, config.in: Rebuild.
12164
12165 * mremap.c: New file.
12166 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12167 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12168 (mremap): Declare if HAVE_MREMAP is not defined.
12169 * configure, Makefile.in, config.in: Rebuild.
12170
12171 2009-03-27 Cary Coutant <ccoutant@google.com>
12172
12173 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12174 position independent.
12175 * sparc.cc (Target_sparc::check_non_pic): Likewise.
12176 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12177
12178 2009-03-24 Cary Coutant <ccoutant@google.com>
12179
12180 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12181 an executable.
12182 (needs_dynamic_reloc): Likewise.
12183
12184 2009-03-24 Ian Lance Taylor <iant@google.com>
12185
12186 * yyscript.y (file_cmd): Recognize EXTERN.
12187 (extern_name_list, extern_name_list_body): New nonterminals.
12188 * script.cc (script_add_extern): Define.
12189 * script-c.h (script_add_extern): Declare.
12190
12191 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
12192
12193 * object.cc (is_elf_object): Define.
12194 * object.h (is_elf_object): Declare.
12195 * archive.cc (Archive::get_elf_object_for_member): Call
12196 is_elf_object.
12197 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12198
12199 2009-03-24 Elliott Hughes <enh@google.com>
12200
12201 * output.cc (Output_file::map_anonymous): Define.
12202 (Output_file::map): Use map_anonymous. If the regular mmap fails,
12203 try an anonymous one. Report the size if the mmap fails.
12204 * output.h (class Output_file): Declare map_anonymous.
12205
12206 2009-03-24 Ian Lance Taylor <iant@google.com>
12207
12208 * target-select.cc (instantiate_target): Don't acquire the lock if
12209 the instantiated_target_ field has already been set.
12210
12211 2009-03-23 Ian Lance Taylor <iant@google.com>
12212
12213 * gold-threads.h (class Initialize_lock): Define.
12214 * gold-threads.cc (class Initialize_lock_once): Define.
12215 (initialize_lock_control): New static variable.
12216 (initialize_lock_pointer): New static variable.
12217 (initialize_lock_once): New static function.
12218 (Initialize_lock::Initialize_lock): Define.
12219 (Initialize_lock::initialize): Define.
12220 * target-select.h: Include "gold-threads.h".
12221 (class Target_selector): Add lock_ and initialize_lock_ fields.
12222 Don't define instantiate_target, just declare it.
12223 * target-select.cc (Target_selector::Target_selector): Initialize
12224 new fields.
12225 (Target_selector::instantiate_target): Define.
12226 * descriptors.h: Include "gold-threads.h".
12227 (class Descriptors): Add initialize_lock_ field.
12228 * descriptors.cc (Descriptors::Descriptors): Initialize new
12229 field.
12230 (Descriptors::open): Use initialize_lock_ field
12231 * errors.h (class Errors): Add initialize_lock_ field.
12232 * errors.cc (Errors::Errors): Initialize new field.
12233 (Errors::initialize_lock): Use initialize_lock_ field.
12234 * powerpc.cc (class Target_selector_powerpc): Remove
12235 instantiated_target_ field. In do_recognize call
12236 instantiate_target rather than do_instantiate_target. In
12237 do_instantiate_target just allocate a new target.
12238 * sparc.cc (class Target_selector_sparc): Likewise.
12239
12240 * freebsd.h: New file.
12241 * i386.cc: Include "freebsd.h".
12242 (Target_i386): Derive from Target_freebsd rather than
12243 Sized_target.
12244 (Target_selector_i386): Derive from Target_selector_freebsd rather
12245 than Target_selector.
12246 * x86_64.cc: Include "freebsd.h".
12247 (Target_x86_64): Derive from Target_freebsd rather than
12248 Sized_target.
12249 (Target_selector_x86_64): Derive from Target_selector_freebsd
12250 rather than Target_selector.
12251 * target.h (class Target): Add adjust_elf_header and
12252 do_adjust_elf_header.
12253 * output.cc (Output_file_header:: do_sized_write): Call target
12254 adjust_elf_header routine.
12255 * configure.tgt: Set targ_osabi.
12256 * configure.ac: Define GOLD_DEFAULT_OSABI.
12257 * parameters.cc (Parameters::default_target): Pass
12258 GOLD_DEFAULT_OSABI to select_target.
12259 * target-select.h (class Target_selector): Make instantiate_target
12260 protected rather than private.
12261 * Makefile.am (HFILES): Add freebsd.h.
12262 * configure, Makefile.in, config.in: Rebuild.
12263
12264 * merge.cc (do_add_input_section): Correct pend value. Change
12265 message about last entry not being null terminated from error to
12266 warning.
12267
12268 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
12269
12270 * incremental.cc: New file.
12271 * Makefile.am (CCFILES): Add incremental.cc.
12272 * Makefile.in: Rebuild.
12273
12274 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
12275
12276 * layout.cc (Layout::output_section_name): Preserve names
12277 of '.note.' sections.
12278
12279 2009-03-19 Ian Lance Taylor <iant@google.com>
12280
12281 * descriptors.cc (Descriptors::open): Check that the options are
12282 valid before using them.
12283
12284 2009-03-18 Ian Lance Taylor <iant@google.com>
12285
12286 * script-sections.h: Include <list>.
12287 (class Script_sections): Change Sections_elements from std::vector
12288 to std::list. Typedef public Elements_iterator. Add
12289 orphan_section_placement_, data_segment_align_start_, and
12290 saw_data_segment_align_ fields. Remove data_segment_align_index_
12291 field.
12292 * script-sections.cc (class Orphan_section_placement): New class.
12293 (class Sections_element): Add virtual functions is_relro and
12294 orphan_section_init. Remove virtual function place_orphan_here.
12295 (class Output_section_definition): Add is_relro and
12296 orphan_section_init. Remove place_orphan_here.
12297 (class Orphan_output_section): Likewise.
12298 (Script_sections::Script_sections): Update for field changes.
12299 (Script_sections::data_segment_align): Set saw_data_segment_align_
12300 and data_segment_align_start_, not data_segment_align_index.
12301 (Script_sections::data_segment_relro_end): Check
12302 saw_data_segment_align_. Use data_segment_align_start_ rather
12303 than data_segment_align_index_.
12304 (Script_sections::place_orphan): Rewrite to use
12305 Orphan_section_placement.
12306
12307 2009-03-17 Ian Lance Taylor <iant@google.com>
12308
12309 * archive.cc (Archive::add_symbols): Check for a version attached
12310 to the symbol name in the archive map.
12311 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12312 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12313 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12314 (ver_test_11.a): New target.
12315 * testsuite/Makefile.in: Rebuild.
12316
12317 * configure.ac: Check for chsize and posix_fallocate. Replace
12318 ftruncate.
12319 * ftruncate.c: New file, from gnulib.
12320 * output.cc (posix_fallocate): Define dummy version if not
12321 HAVE_POSIX_FALLOCATE.
12322 (Output_file::map): Call posix_fallocate rather than lseek and
12323 write.
12324 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12325 * configure, Makefile.in, config.in: Rebuild.
12326
12327 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
12328
12329 * layout.h (Layout::create_note): Add section_name parameter.
12330 * layout.cc (Layout::create_note): Likewise.
12331 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12332
12333 2009-03-17 Ian Lance Taylor <iant@google.com>
12334
12335 * descriptors.cc: Include "options.h".
12336 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12337 (Descriptors::open): Always use O_CLOEXEC when opening a new
12338 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
12339 then set FD_CLOEXEC.
12340
12341 * sparc.cc (class Target_sparc): Add has_got_section.
12342 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12343 make sure we have a GOT section.
12344
12345 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12346 (Target_sparc::Scan::local): Likewise.
12347 (Target_sparc::Scan::global): Likewise.
12348 (Target_sparc::Relocate::relocate): Likewise.
12349 (Target_sparc::Relocate::relocate_tls): Likewise.
12350
12351 * symtab.cc (Symbol_table::define_default_version): New function,
12352 broken out of add_from_object.
12353 (Symbol_table::add_from_object): Call define_default_version.
12354 (Symbol_table::define_special_symbol): Add resolve_oldsym
12355 parameter. Change all callers. If the version for a symbol comes
12356 from a version script, resolve it with the symbol with the same
12357 name with no version. Also add the symbol without a version if
12358 appropriate.
12359 (do_define_in_output_data): If resolving with oldsym, don't delete
12360 sym.
12361 (do_define_in_output_segment): Likewise.
12362 (do_define_as_constant): Likewise.
12363 * symtab.h (class Symbol_table): Update declarations.
12364
12365 2009-03-13 Ian Lance Taylor <iant@google.com>
12366
12367 * readsyms.cc (Read_symbols::incompatible_warning): New function.
12368 (Read_symbols::requeue): New function.
12369 (Read_symbols::do_read_symbols): If make_elf_object fails because
12370 the target type is not configured, and the file was searched for,
12371 issue a warning and retry with the next directory.
12372 (Add_symbols::run): If the file has an incompatible format, and
12373 it was searched for, requeue the Read_symbols task. On error,
12374 release the object.
12375 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
12376 dirindex parameter to constructor. Change all callers. Declare
12377 incompatible_warning and requeue.
12378 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12379 input_argument_ and input_group_ fields. Add them to
12380 constructor. Change all callers.
12381 (class Read_script): Add dirindex_ field. Add it to constructor.
12382 Change all callers.
12383 * archive.cc (Archive::setup): Remove input_objects parameter.
12384 Change all callers.
12385 (Archive::get_file_and_offset): Likewise.
12386 (Archive::read_all_symbols): Likewise.
12387 (Archive::read_symbols): Likewise.
12388 (Archive::get_elf_object_for_member): Remove input_objects
12389 parameter. Add punconfigured parameter. Change all callers.
12390 (Archive::add_symbols): Change return type to bool. Check return
12391 value of include_member.
12392 (Archive::include_all_members): Likewise.
12393 (Archive::include_member): Change return type to bool. Return
12394 false if first included object has incompatible target. Set
12395 included_member_ field.
12396 (Add_archive_symbols::run): If add_symbols returns false, requeue
12397 Read_symbols task.
12398 * archive.h (class Archive): Add included_member_ field.
12399 Initialize it in constructor. Add input_file and searched_for
12400 methods. Update declarations.
12401 (class Add_archive_symbols): Add dirpath_, dirindex_, and
12402 input_argument_ fields. Add them to constructor. Change all
12403 callers.
12404 * script.cc: Include "target-select.h".
12405 (class Parser_closure): Add skip_on_incompatible_target_ and
12406 found_incompatible_target_ fields. Add
12407 skip_on_incompatible_target parameter to constructor. Change all
12408 callers. Add methods skip_on_incompatible_target,
12409 clear_skip_on_incompatible_target, found_incompatible_target, and
12410 set_found_incompatible_target.
12411 (read_input_script): Add dirindex parameter. Change all callers.
12412 If parser finds an incompatible target, requeue Read_symbols
12413 task.
12414 (script_set_symbol): Clear skip_on_incompatible_target in
12415 closure.
12416 (script_add_assertion, script_parse_option): Likewise.
12417 (script_start_sections, script_add_phdr): Likewise.
12418 (script_check_output_format): New function.
12419 * script.h (read_input_script): Update declaration.
12420 * script-c.h (script_check_output_format): Declare.
12421 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12422 (ignore_cmd): Remove OUTPUT_FORMAT.
12423 * fileread.cc (Input_file::Input_file): Add explicit this.
12424 (Input_file::will_search_for): New function.
12425 (Input_file::open): Add pindex parameter. Change all callers.
12426 * fileread.h (class Input_file): Add input_file_argument method.
12427 Declare will_search_for. Update declarations.
12428 * object.cc (make_elf_object): Add punconfigured parameter.
12429 Change all callers.
12430 * object.h (class Object): Make input_file public. Add
12431 searched_for method.
12432 (make_elf_object): Update declaration.
12433 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
12434 restart search.
12435 * dirsearch.h (class Dirsearch): Update declaration.
12436 * options.h (class General_options): Add --warn-search-mismatch.
12437 * parameters.cc (Parameters::is_compatible_target): New function.
12438 * parameters.h (class Parameters): Declare is_compatible_target.
12439 * workqueue.cc (Workqueue::add_blocker): New function.
12440 * workqueue.h (class Workqueue): Declare add_blocker.
12441
12442 * fileread.cc (Input_file::open): Remove options parameter.
12443 Change all callers.
12444 (Input_file::open_binary): Likewise.
12445 * script.cc (read_input_script): Likewise.
12446 * readsyms.h (class Read_symbols): Remove options_ field. Remove
12447 options parameter from constructor. Change all callers.
12448 (class Read_script): Likewise.
12449 * fileread.h (class Input_file): Update declarations.
12450 * script.h (read_input_script): Update declaration.
12451
12452 2009-03-10 Nick Clifton <nickc@redhat.com>
12453
12454 * po/es.po: New Spanish translation.
12455
12456 2009-03-06 Cary Coutant <ccoutant@google.com>
12457
12458 * options.cc (parse_short_option): Keep dash_z from registering itself.
12459
12460 2009-03-03 Ian Lance Taylor <iant@google.com>
12461
12462 PR 9918
12463 * target-reloc.h (relocate_section): Pass output_section to
12464 relocate.
12465 * i386.cc (Target_i386::should_apply_static_reloc): Add
12466 output_section parameter. Change all callers.
12467 (Target_i386::Relocate::relocate): Add output_section parameter.
12468 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12469 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12470 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12471 * testsuite/two_file_shared.sh: New script.
12472 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12473 (check_DATA): Add two_file_shared.dbg.
12474 (two_file_shared.dbg): New target.
12475 * testsuite/Makefile.in: Rebuild.
12476
12477 2009-03-01 Ian Lance Taylor <iant@google.com>
12478
12479 * configure.ac: Check for byteswap.h.
12480 * configure: Rebuild.
12481 * config.in: Rebuild.
12482
12483 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
12484
12485 * layout.cc (Layout::find_or_add_kept_section): New function.
12486 (Layout::add_comdat): Removed.
12487 * layout.h (struct Kept_section): Move out of class Layout.
12488 Remove trailing underscores from field names. Add group_sections
12489 field. Rename group_ field to is_group. Change all uses.
12490 (class Layout): Declare find_or_add_kept_section, not add_comdat.
12491 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12492 comdat_groups_ field.
12493 (Sized_relobj::include_section_group): Use
12494 find_or_add_kept_section and Kept_section::group_sections.
12495 (Sized_relobj::include_linkonce_section): Likewise.
12496 * object.cc (class Sized_relobj): Don't define Comdat_group or
12497 Comdat_group_table. Remove find_comdat_group and
12498 add_comdat_group. Remove comdat_groups_ field.
12499 * plugin.cc (include_comdat_group): Use
12500 Layout::find_or_add_kept_section.
12501
12502 2009-02-28 Ian Lance Taylor <iant@google.com>
12503
12504 * README: --gc-sections and map files are now supported. Document
12505 some build requirements.
12506
12507 PR 6992
12508 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12509 relocatable link set the value of the section symbol to zero.
12510 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12511 relocatable link don't include the section address in the local
12512 symbol value.
12513
12514 2009-02-27 Ian Lance Taylor <iant@google.com>
12515
12516 PR 6811
12517 * options.h (class Search_directory): Add is_system_directory.
12518 (class General_options): Declare is_in_system_directory.
12519 * options.cc (get_relative_sysroot): Make static.
12520 (get_default_sysroot): Make static.
12521 (General_optoins::is_in_system_directory): New function.
12522 * fileread.cc (Input_file::is_in_system_directory): New function.
12523 * fileread.h (class Input_file): Declare is_in_system_directory.
12524 * object.h (class Object): Add is_in_system_directory.
12525 (class Input_objects): Remove system_library_directory_ field.
12526 * object.cc (Input_objects::add_object): Don't set
12527 system_library_directory_.
12528 (input_objects::found_in_system_library_directory): Remove.
12529 * symtab.cc (Symbol_table::write_globals): Remove input_objects
12530 parameter. Change all callers.
12531 (Symbol_table::sized_write_globals): Likewise.
12532 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12533 Call Object::is_in_system_directory.
12534 * symtab.h (class Symbol_table): Update declarations.
12535
12536 PR 5990
12537 * descriptors.h (Open_descriptor): Add is_on_stack field.
12538 * descriptors.cc (Descriptors::open): If the descriptor is on the
12539 top of the stack, remove it. Initialize is_on_stack field.
12540 (Descriptors::release): Only add pod to stack if it is not on the
12541 stack already.
12542 (Descriptors::close_some_descriptor): Clear stack_next and
12543 is_on_stack fields.
12544
12545 PR 7091
12546 * output.cc (Output_section::find_starting_output_address): Rename
12547 from starting_output_address; add PADDR parameter; change return
12548 type.
12549 * output.h (class Output_section): Declare
12550 find_starting_output_address instead of starting_output_address.
12551 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12552 section symbol for which we can't find a merge section.
12553
12554 PR 9836
12555 * symtab.cc (Symbol_table::add_from_object): If the visibility is
12556 hidden or internal, force the symbol to be local.
12557 * resolve.cc (Symbol::override_visibility): Define.
12558 (Symbol::override_base): Use override_visibility.
12559 (Symbol_table::resolve): Likewise.
12560 (Symbol::override_base_with_special): Likewise.
12561 (Symbol_table::override_with_special): If the visibility is hidden
12562 or internal, force the symbol to be local.
12563 * symtab.h (class Symbol): Add set_visibility and
12564 override_visibility.
12565 * testsuite/ver_test_1.sh: New file.
12566 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12567 (check_DATA): Add ver_test_1.syms.
12568 (ver_test_1.syms): New target.
12569 * testsuite/Makefile.in: Rebuild.
12570
12571 2009-02-25 Cary Coutant <ccoutant@google.com>
12572
12573 * layout.cc (Layout::choose_output_section): Don't rename sections
12574 when using a linker script that has a SECTIONS clause.
12575 * Makefile.in: Regenerate.
12576
12577 * testsuite/Makefile.am (script_test_5.sh): New test case.
12578 * testsuite/Makefile.in: Regenerate.
12579 * testsuite/script_test_5.cc: New file.
12580 * testsuite/script_test_5.sh: New file.
12581 * testsuite/script_test_5.t: New file.
12582
12583 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
12584
12585 * archive.cc (Archive::include_member): Update calls to add_symbols.
12586 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12587 the Layout argument.
12588 * dynobj.h (do_add_symbols): Add the Layout argument.
12589 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12590 Layout argument.
12591 * object.h (Object::add_symbols): Add the Layout argument.
12592 (Object::do_add_symbols): Add the Layout argument.
12593 (Sized_relobj::do_add_symbols): Add the Layout argument.
12594 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12595 Unify the two versions.
12596 (Add_plugin_symbols): Remove.
12597 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12598 (Sized_pluginobj::do_add_symbols): Unify the two versions.
12599 (Add_plugin_symbols): Remove.
12600 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12601 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12602 (Add_symbols::run): Make it work with Pulginobj.
12603
12604 2009-02-06 Ian Lance Taylor <iant@google.com>
12605
12606 * object.cc (Sized_relobj::do_layout): Make info message start
12607 with lower case letter.
12608
12609 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
12610
12611 * binary.cc: Fix file comment.
12612
12613 * options.h (enum Incremental_disposition): Define.
12614 (class General_options): Add new options: --incremental,
12615 --incremental_changed, --incremental_unchanged,
12616 --incremental_unknown. Add incremental_disposition_ and
12617 implicit_incremental_ fields.
12618 (General_options::incremental_disposition): New function.
12619 (class Position_dependent_options): Add incremental_disposition
12620 option.
12621 (Position_dependent_options::copy_from_options): Set incremental
12622 dispositions.
12623 * options.cc (General_options::parse_incremental_changed): New
12624 function.
12625 (General_options::parse_incremental_unchanged): New function.
12626 (General_options::parse_incremental_unknown): New function.
12627 (General_options::General_options): Initialize new fields
12628 incremental_disposition_ and implicit_incremental_.
12629 (General_options::finalize): Check for uasge of --incremental-*
12630 without --incremental.
12631
12632 2009-02-06 Chris Demetriou <cgd@google.com>
12633
12634 * gold.h (gold_undefined_symbol): Change to take only a Symbol
12635 pointer and to report location as the file name associated with
12636 the symbol.
12637 (gold_undefined_symbol_at_location): New function to replace the
12638 old gold_undefined_symbol functionality.
12639 * target-reloc.h (relocate_section): Update to use
12640 gold_undefined_symbol_at_location.
12641 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12642 Call gold_undefined_symbol function rather than gold_error.
12643 * errors.h (Errors::undefined_symbol): Take location as a
12644 string, rather than calculating it from a relocation.
12645 * errors.cc (Errors::fatal): Print "fatal error:" before the
12646 formatted message.
12647 (Errors::error, Errors::error_at_location): Print "error: "
12648 before the formatted message.
12649 (Errors::undefined_symbol): Take location as a string, rather
12650 than calculating it from a relocation.
12651 (gold_undefined_symbol_at_location): New function akin to
12652 old gold_undefined_symbol, calculates location from relocation.
12653 (gold_undefined_symbol): Change to take only a Symbol pointer
12654 and to report location as the file name associated with the symbol.
12655 * testsuite/debug_msg.sh: Update for changed error messages.
12656 * testsuite/undef_symbol.sh: Likewise.
12657
12658 2009-02-04 Duncan Sands <baldrick@free.fr>
12659
12660 PR 9812
12661 * reduced_debug_output.h
12662 (Output_reduced_debug_abbrev_section::failed): Use format for
12663 gold_warning.
12664 (Output_reduced_debug_info_section::faild): Likewise.
12665
12666 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
12667
12668 * script.cc (Lazy_demangler): New class.
12669 (Version_script_info::get_symbol_version_helper): Demangle a
12670 symbol only once.
12671
12672 2009-01-29 Cary Coutant <ccoutant@google.com>
12673
12674 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12675 to __tls_get_addr.
12676 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12677
12678 2009-01-28 Ian Lance Taylor <iant@google.com>
12679
12680 * version.cc (version_string): Bump to 1.9.
12681
12682 * gold.h: Include <cstring> and <stdint.h>.
12683 * version.cc: Include <cstdio>.
12684 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12685 warning.
12686 * reduced_debug_output.cc (insert_into_vector): Rename from
12687 Insert_into_vector; change all callers. Use Swap_unaligned to
12688 avoid aliasing issue; remove union since it is unnecessary.
12689
12690 2009-01-27 Sriraman Tallam <tmsriram@google.com>
12691
12692 * Makefile.am (CCFILES): Add gc.cc.
12693 (HFILES): Add gc.h.
12694 * Makefile.in: Regenerate.
12695 * gold.cc (Gc_runner): New class.
12696 (queue_initial_tasks): Call garbage collection related tasks
12697 when corresponding options are invoked.
12698 (queue_middle_gc_tasks): New function.
12699 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12700 processed early before laying out sections during garbage collection.
12701 * gold.h (queue_middle_gc_tasks): New function.
12702 (is_prefix_of): Move from "layout.cc".
12703 * i386.cc (Target_i386::gc_process_relocs): New function.
12704 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12705 * main.cc (main): Create object of class "Garbage_collection".
12706 * object.cc (Relobj::copy_symbols_data): New function.
12707 (Relobj::is_section_name_included): New function.
12708 (Sized_relobj::do_layout): Allow this function to be called twice
12709 during garbage collection and defer layout of section during the
12710 first call.
12711 * object.h (Relobj::get_symbols_data): New function.
12712 (Relobj::is_section_name_included): New function.
12713 (Relobj::copy_symbols_data): New function.
12714 (Relobj::set_symbols_data): New function.
12715 (Relobj::get_relocs_data): New function.
12716 (Relobj::set_relocs_data): New function.
12717 (Relobj::is_output_section_offset_invalid): New pure virtual function.
12718 (Relobj::gc_process_relocs): New function.
12719 (Relobj::do_gc_process_relocs): New pure virtual function.
12720 (Relobj::sd_): New data member.
12721 (Sized_relobj::is_output_section_offset_invalid): New function.
12722 (Sized_relobj::do_gc_process_relocs): New function.
12723 * options.h (General_options::gc_sections): Modify to not be a no-op.
12724 (General_options::print_gc_sections): New option.
12725 * plugin.cc (Plugin_finish::run): Remove function call to
12726 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
12727 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12728 * reloc.cc (Read_relocs::run): Add task to process relocs and
12729 determine unreferenced sections when doing garbage collection.
12730 (Gc_process_relocs): New class.
12731 (Sized_relobj::do_gc_process_relocs): New function.
12732 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12733 sections that are garbage collected.
12734 * reloc.h (Gc_process_relocs): New class.
12735 * sparc.cc (Target_sparc::gc_process_relocs): New function.
12736 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12737 symbols whose corresponding sections are garbage collected.
12738 (Symbol_table::Symbol_table): Add new parameter for the garbage
12739 collection object.
12740 (Symbol_table::gc_mark_undef_symbols): New function.
12741 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12742 (Symbol_table::gc_mark_dyn_syms): New function.
12743 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12744 as garbage.
12745 (Symbol_table::add_from_object): Likewise.
12746 (Symbol_table::add_from_relobj): When building shared objects, do not
12747 treat externally visible symbols as garbage.
12748 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12749 table information for static and relocatable links.
12750 * symtab.h (Symbol_table::set_gc): New function.
12751 (Symbol_table::gc): New function.
12752 (Symbol_table::gc_mark_undef_symbols): New function.
12753 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12754 (Symbol_table::gc_mark_dyn_syms): New function.
12755 (Symbol_table::gc_): New data member.
12756 * target.h (Sized_target::gc_process_relocs): New pure virtual
12757 function.
12758 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12759 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12760
12761 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
12762
12763 * options.h (General_options::gc_sections): Define as a no-op for now.
12764 (General_options::no_keep_memory): Ditto.
12765 (General_options::Bshareable): Define.
12766 * options.cc (General_options::finalize): Honor -Bshareable.
12767
12768 2009-01-20 Andreas Schwab <schwab@suse.de>
12769
12770 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12771 read the value in the contents, since we don't use it. Use the
12772 template endianness when writing.
12773 (Relocate::relocate): Use it for R_PPC_REL16_HA.
12774
12775 2009-01-19 Andreas Schwab <schwab@suse.de>
12776
12777 * configure.tgt (powerpc64-*): Fix targ_obj.
12778
12779 2009-01-15 Ian Lance Taylor <iant@google.com>
12780
12781 * object.cc (Sized_relobj::write_local_symbols): Don't write out
12782 local symbols when stripping all symbols.
12783
12784 2009-01-14 Cary Coutant <ccoutant@google.com>
12785
12786 * output.cc (Output_reloc): Add explicit instantiations.
12787
12788 2009-01-14 Cary Coutant <ccoutant@google.com>
12789
12790 * archive.cc (Archive::get_elf_object_for_member): Remove call
12791 to File_read::claim_for_plugin.
12792 * descriptors.cc (Descriptors::open): Remove reference to
12793 is_claimed.
12794 (Descriptors::claim_for_plugin): Remove.
12795 * descriptors.h (Descriptors::claim_for_plugin): Remove.
12796 (Descriptors::is_claimed): Remove.
12797 (claim_descriptor_for_plugin): Remove.
12798 * fileread.cc (File_read::claim_for_plugin): Remove.
12799 * fileread.h (File_read::claim_for_plugin): Remove.
12800 (File_read::descriptor): Reopen descriptor if necessary.
12801 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
12802 (Plugin_manager::all_symbols_read): Add task parameter. Change
12803 all callers.
12804 (Plugin_manager::get_input_file): New function.
12805 (Plugin_manager::release_input_file): New function.
12806 (Pluginobj::Pluginobj): Add filesize parameter and initialize
12807 corresponding data member.
12808 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12809 and pass to base constructor. Change all callers.
12810 (get_input_file, release_input_file): New functions.
12811 (make_sized_plugin_object): Add filesize parameter. Change all callers.
12812 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12813 (Plugin_manager::all_symbols_read): Add task parameter.
12814 (Plugin_manager::get_input_file): New function.
12815 (Plugin_manager::release_input_file): New function.
12816 (Plugin_manager::task_): New data member.
12817 (Pluginobj::Pluginobj): Add filesize parameter.
12818 (Pluginobj::filename): New function.
12819 (Pluginobj::descriptor): New function.
12820 (Pluginobj::filesize): New function.
12821 (Pluginobj::filesize_): New data member.
12822 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12823 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12824 File_read::claim_for_plugin; use Object::unlock to unlock the file.
12825
12826 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12827 with archive libraries.
12828 * testsuite/Makefile.in: Regenerate.
12829 * testsuite/plugin_test.c (struct sym_info): New type.
12830 (get_input_file, release_input_file): New static variables.
12831 (onload): Capture new transfer vector entries.
12832 (claim_file_hook): Stop reading at end of file according to filesize.
12833 Factor out parsing of readelf output into separate function.
12834 (all_symbols_read_hook): Exercise get_input_file and release_input_file
12835 APIs and get the source file name from the symbol table. Convert
12836 source file name to corresponding object file name. Print info
12837 message when adding new input files.
12838 (parse_readelf_line): New function.
12839 * testsuite/plugin_test_1.sh: Add checks for new info messages.
12840 * testsuite/plugin_test_2.sh: Likewise.
12841 * testsuite/plugin_test_3.sh: Likewise.
12842 * testsuite/plugin_test_4.sh: New test case.
12843
12844 2009-01-07 Ian Lance Taylor <iant@google.com>
12845
12846 * version.cc (version_string): Bump to 1.8.
12847
12848 2008-12-23 Cary Coutant <ccoutant@google.com>
12849
12850 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12851 * plugin.cc (Plugin_manager::finish): Rename as
12852 layout_deferred_objects. Move cleanup to separate function.
12853 (Plugin_manager::cleanup): New function.
12854 (Plugin_finish::run): Call layout_deferred_objects and cleanup
12855 separately.
12856 * plugin.h (Plugin_manager::finish): Rename as
12857 layout_deferred_objects.
12858 (Plugin_manager::cleanup): New function.
12859 (Plugin_manager::cleanup_done): New field.
12860
12861 2008-12-23 Cary Coutant <ccoutant@google.com>
12862
12863 * plugin.cc (is_visible_from_outside): New function.
12864 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12865 so we don't return "IR only" status for exported symbols or -r links.
12866
12867 * testsuite/Makefile.am (plugin_test_3): New test case.
12868 * testsuite/Makefile.in: Regenerate.
12869 * testsuite/plugin_test_3.sh: New file.
12870
12871 2008-12-22 Cary Coutant <ccoutant@google.com>
12872
12873 * object.cc (Sized_relobj::layout_section): New function.
12874 (Sized_relobj::do_layout): Defer layout of input sections until after
12875 plugin has provided replacement files.
12876 (Sized_relobj::do_layout_deferred_sections): New function.
12877 * object.h (Relobj::set_section_offset): Remove virtual keyword.
12878 (Relobj::layout_deferred_sections): New function.
12879 (Relobj::do_layout_deferred_sections): New function.
12880 (Sized_relobj::do_layout_deferred_sections): New function.
12881 (Sized_relobj::layout_section): New function.
12882 (Sized_relobj::Deferred_layout): New structure.
12883 (Sized_relobj::deferred_layout_): New field.
12884 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12885 Change all callers. Layout deferred sections.
12886 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
12887 references.
12888 (Plugin_hook::run): Move code from do_plugin_hook inline.
12889 (Plugin_hook::do_plugin_hook): Remove.
12890 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12891 (Plugin_manager::finish): Renamed, was cleanup.
12892 (Plugin_manager::should_defer_layout): New function.
12893 (Plugin_manager::add_deferred_layout_object): New function.
12894 (Plugin_manager::Deferred_layout_list): New type.
12895 (Plugin_manager::deferred_layout_objects_): New field.
12896 (Plugin_hook::do_plugin_hook): Remove.
12897
12898 2008-12-17 Ian Lance Taylor <iant@google.com>
12899
12900 * options.h (class General_options): Add --no case for
12901 --export-dynamic.
12902
12903 2008-12-16 Cary Coutant <ccoutant@google.com>
12904
12905 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12906 vector.
12907 (Plugin_manager::claim_file): Create plugin object even if
12908 plugin did not call the add_symbols callback.
12909 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12910 asking for more symbols than were added.
12911 * testsuite/Makefile.am (plugin_test_1): Add test case with
12912 no global symbols.
12913 (empty.syms): New target.
12914 * testsuite/Makefile.in: Regenerate.
12915 * testsuite/plugin_test.c (claim_file_hook): Add new debug
12916 message. Don't call add_symbols if no globals.
12917 (all_symbols_read_hook): Don't provide replacement for empty
12918 claimed file.
12919
12920 2008-12-12 Ian Lance Taylor <iant@google.com>
12921
12922 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12923 r_type == 0 for a local symbol with r_sym == 0.
12924 (scan_relocatable_relocs): Pass r_sym to
12925 local_non_section_strategy.
12926 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12927 r_sym parameter.
12928
12929 * configure.ac: Update test for TLS descriptors: they are
12930 supported as of glibc 2.9.
12931 * configure: Rebuild.
12932
12933 2008-12-11 Ian Lance Taylor <iant@google.com>
12934
12935 PR 7091
12936 * target-reloc.h (Default_scan_relocatable_relocs): For each
12937 function, map r_type == 0 to RELOC_DISCARD.
12938
12939 2008-12-10 Cary Coutant <ccoutant@google.com>
12940
12941 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12942 object to override a kept COMDAT group from a plugin object.
12943
12944 2008-12-09 Ian Lance Taylor <iant@google.com>
12945
12946 PR 7088
12947 * yyscript.y (file_cmd): Handle INPUT.
12948
12949 * testsuite/initpri1.c: Change all declarations to be full
12950 prototypes by adding void, to avoid compiler warnings.
12951
12952 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
12953
12954 * options.cc (General_options::parse_plugin_opt): New.
12955 (General_options::add_plugin): The argument now is just the filename.
12956 (General_options::add_plugin_option): New.
12957 * options.h (plugin_opt): New.
12958 (add_plugin): Change argument name.
12959 (add_plugin_option): New.
12960 * plugin.cc (Plugin::load): Don't parse the plugin option.
12961 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12962 (Plugin::add_option): New.
12963 (Plugin::args_): Change type.
12964 (Plugin::filename_): New.
12965 (Plugin_manager::add_plugin_option): New.
12966 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12967 * testsuite/Makefile.in: Regenerate.
12968
12969 2008-12-05 Cary Coutant <ccoutant@google.com>
12970
12971 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12972 Handle --strip-lto-sections option.
12973 * options.h (strip_lto_sections): New option.
12974
12975 2008-12-01 Cary Coutant <ccoutant@google.com>
12976
12977 * plugin.cc (ld_plugin_message): Change format parameter to const.
12978 Fix mismatch between new[] and delete.
12979
12980 2008-11-14 Cary Coutant <ccoutant@google.com>
12981
12982 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12983 instead of -1U.
12984
12985 2008-11-05 Craig Silverstein <csilvers@google.com>
12986
12987 * options.cc (General_options::parse_dynamic_list): New function.
12988 * options.h (General_options): New flags dynamic_list,
12989 dynamic_list_data, dynamic_list_cpp_new, and
12990 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
12991 (General_options::in_dynamic_list): New function.
12992 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12993 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12994 (Lex::can_continue_name): Likewise.
12995 (yylex): Likewise.
12996 (read_script_file): New parameter script_options.
12997 (read_dynamic_list): New function.
12998 (Script_options::define_dynamic_list): New function.
12999 (dynamic_list_keyword_parsecodes): New variable.
13000 (dynamic_list_keywords): New variable.
13001 * script.h (Script_options::define_dynamic_list): New function
13002 prototype.
13003 (read_dynamic_list): New function prototype.
13004 * symtab.cc (strprefix): New macro.
13005 (Symbol::should_add_dynsym_entry): Support dynamic_list,
13006 dynamic_list_data, dynamic_list_cpp_new, and
13007 dynamic_list_cpp_typeinfo.
13008 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13009 (dynamic_list_expr): New rule.
13010 (dynamic_list_nodes): Likewise.
13011 (dynamic_list_node): Likewise.
13012 * testsuite/Makefile.am (dynamic_list): New test.
13013 * testsuite/Makefile.in: Regenerated.
13014 * testsuite/dynamic_list.t: New file.
13015 * testsuite/dynamic_list.sh: New file.
13016
13017 2008-11-05 Craig Silverstein <csilvers@google.com>
13018
13019 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13020 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13021 (t11_last): Likewise.
13022 * testsuite/ver_test_6.c (main): Likewise.
13023
13024 2008-10-07 Cary Coutant <ccoutant@google.com>
13025
13026 * options.c (General_options::finalize): Add check for -static and
13027 -shared.
13028 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13029 is not empty.
13030
13031 2008-10-02 Cary Coutant <ccoutant@google.com>
13032
13033 * plugin.cc (make_sized_plugin_object): Fix conditional
13034 compilation to work when not all targets are enabled.
13035
13036 2008-09-29 Cary Coutant <ccoutant@google.com>
13037
13038 * archive.cc (Archive::get_file_and_offset): Use filename instead
13039 of name to get library path.
13040 (Archive::include_member): Unlock external member of a thin archive.
13041
13042 * testsuite/Makefile.am (TEST_AR): New variable.
13043 (thin_archive_test_1): New test.
13044 (thin_archive_test_2): New test.
13045 * testsuite/Makefile.in: Regenerate.
13046 * testsuite/thin_archive_main.cc: New file.
13047 * testsuite/thin_archive_test_1.cc: New file.
13048 * testsuite/thin_archive_test_2.cc: New file.
13049 * testsuite/thin_archive_test_3.cc: New file.
13050 * testsuite/thin_archive_test_4.cc: New file.
13051
13052 2008-09-29 Cary Coutant <ccoutant@google.com>
13053
13054 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13055 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13056 instead of -1U.
13057 (Sized_relobj::do_finalize_local_symbols): Likewise.
13058 (Sized_relobj::map_to_kept_section): Likewise.
13059 * object.h (Sized_relobj::invalid_address): New constant.
13060 (Sized_relobj::do_output_section_offset): Check for invalid_address
13061 and return -1ULL.
13062 * output.cc (Output_reloc::local_section_offset): Use constant
13063 invalid_address instead of -1U.
13064 (Output_reloc::get_address): Likewise.
13065 (Output_section::output_address): Change -1U to -1ULL.
13066 * output.h (Output_reloc::invalid_address): New constant.
13067 * reloc.cc (Sized_relobj::write_sections): Use constant
13068 invalid_address instead of -1U.
13069 (Sized_relobj::relocate_sections): Likewise.
13070 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13071 values for merge sections.
13072 * target-reloc.h (relocate_for_relocatable): Use constant
13073 invalid_address instead of -1U.
13074
13075 2008-09-19 Cary Coutant <ccoutant@google.com>
13076
13077 Add plugin functionality for link-time optimization (LTO).
13078 * configure.ac (plugins): Add --enable-plugins option.
13079 * configure: Regenerate.
13080 * config.in: Regenerate.
13081 * Makefile.am (LIBDL): New variable.
13082 (CCFILES): Add plugin.cc.
13083 (HFILES): Add plugin.h.
13084 (ldadd_var): Add LIBDL.
13085 * Makefile.in: Regenerate.
13086
13087 * archive.cc: Include "plugin.h".
13088 (Archive::setup): Don't preread archive symbols when using a plugin.
13089 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
13090 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13091 files.
13092 (Archive::include_member): Add symbols from plugin objects.
13093 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13094 * descriptors.cc (Descriptors::open): Check for file descriptors
13095 abandoned by plugins.
13096 (Descriptors::claim_for_plugin): New function.
13097 * descriptors.h (Descriptors::claim_for_plugin): New function.
13098 (Open_descriptor::is_claimed): New field.
13099 (claim_descriptor_for_plugin): New function.
13100 * fileread.cc (File_read::claim_for_plugin): New function.
13101 * fileread.h (File_read::claim_for_plugin): New function.
13102 (File_read::descriptor): New function.
13103 * gold.cc: Include "plugin.h".
13104 (queue_initial_tasks): Add task to call plugin hooks for generating
13105 new object files.
13106 * main.cc: Include "plugin.h".
13107 (main): Load plugin libraries.
13108 * object.h (Pluginobj): Declare.
13109 (Object::pluginobj): New function.
13110 (Object::do_pluginobj): New function.
13111 (Object::set_target): New function.
13112 * options.cc: Include "plugin.h".
13113 (General_options::parse_plugin): New function.
13114 (General_options::General_options): Initialize plugins_ field.
13115 (General_options::add_plugin): New function.
13116 * options.h (Plugin_manager): Declare.
13117 (General_options): Add --plugin option.
13118 (General_options::has_plugins): New function.
13119 (General_options::plugins): New function.
13120 (General_options::add_plugin): New function.
13121 (General_options::plugins_): New field.
13122 * plugin.cc: New file.
13123 * plugin.h: New file.
13124 * readsyms.cc: Include "plugin.h".
13125 (Read_symbols::do_read_symbols): Check for archive before checking
13126 for ELF file. Call plugin hooks to claim files.
13127 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13128 from a real object file; force override when processing replacement
13129 files.
13130 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13131 (Symbol::init_base_object): Likewise.
13132 (Symbol::init_base_output_data): Likewise.
13133 (Symbol::init_base_output_segment): Likewise.
13134 (Symbol::init_base_constant): Likewise.
13135 (Symbol::init_base_undefined): Likewise.
13136 (Symbol::output_section): Assert that object is not a plugin.
13137 (Symbol_table::add_from_pluginobj): New function.
13138 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13139 undefined.
13140 (Symbol_table::sized_write_globals): Likewise.
13141 (Symbol_table::add_from_pluginobj): Instantiate template.
13142 * symtab.h (Sized_pluginobj): Declare.
13143 (Symbol::in_real_elf): New function.
13144 (Symbol::set_in_real_elf): New function.
13145 (Symbol::in_real_elf_): New field.
13146 (Symbol_table::add_from_pluginobj): New function.
13147
13148 * testsuite/Makefile.am (AM_CFLAGS): New variable.
13149 (LIBDL): New variable.
13150 (LDADD): Add LIBDL.
13151 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13152 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13153 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13154 (MOSTLYCLEANFILES): Likewise.
13155 * testsuite/Makefile.in: Regenerate.
13156 * testsuite/plugin_test.c: New file.
13157 * testsuite/plugin_test_1.sh: New file.
13158 * testsuite/plugin_test_2.sh: New file.
13159
13160 2008-09-16 Ian Lance Taylor <iant@google.com>
13161
13162 * target-reloc.h (relocate_section): Check whether a symbol is
13163 defined by the ABI before reporting an undefined symbol error.
13164 * target.h (Target::is_defined_by_abi): Make parameter const.
13165 (Target::do_is_defined_by_abi): Likewise.
13166 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13167 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13168 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13169 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13170 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13171 * testsuite/Makefile.in: Rebuild.
13172
13173 * fileread.cc (make_view): Add casts to avoid warning.
13174
13175 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13176
13177 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13178 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13179
13180 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13181
13182 * options.h (General_options::output_is_executable): New.
13183 (General_options::output_is_pie): New.
13184 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13185 for shared libraries.
13186 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13187
13188 2008-09-11 Chris Demetriou <cgd@google.com>
13189
13190 * options.h (origin): New -z option.
13191 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13192 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13193 in DT_FLAGS_1.
13194
13195 2008-09-05 Cary Coutant <ccoutant@google.com>
13196
13197 * fileread.cc (File_read::make_view): Add check for attempt to map
13198 beyond end of file.
13199
13200 2008-09-05 Cary Coutant <ccoutant@google.com>
13201
13202 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13203 explicit instantiations.
13204
13205 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
13206
13207 PR gold/6858
13208 * options.cc (General_options::finalize): Allow undefined symbols
13209 in shlibs if linking -shared.
13210
13211 PR gold/6859
13212 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13213 symbols as not needing a dynsym entry.
13214
13215 2008-08-20 Craig Silverstein <csilvers@google.com>
13216
13217 * fileread.cc (File_read::open): Do not lock the file unless it
13218 was successfully opened.
13219
13220 2008-08-14 Cary Coutant <ccoutant@google.com>
13221
13222 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13223 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13224 * testsuite/tls_test.cc (struct int128): 128-bit struct
13225 for testing TLS relocs with non-zero addend.
13226 (v12): New TLS variable.
13227 (t12): New test.
13228 (t_last): Add check for v12.
13229 * testsuite/tls_test.h (t12): New function.
13230 * testsuite/tls_test_main.cc (thread_routine): Call new test.
13231
13232 2008-08-13 Ian Lance Taylor <iant@google.com>
13233
13234 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13235 set tls_segment_ or relro_segment_.
13236 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13237 when appropriate.
13238 * output.h (Output_section::clear_is_relro): New function.
13239 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13240 sections specially even when output_data_ is empty.
13241 (Output_segment::maximum_alignment): When first section is relro,
13242 only force alignment for PT_LOAD segments.
13243 * script.cc (script_data_segment_align): New function.
13244 (script_data_segment_relro_end): New function.
13245 * script-c.h (script_data_segment_align): Declare.
13246 (script_data_segment_relro_end): Declare.
13247 * script-sections.h (class Script_sections): Declare
13248 data_segment_align and data_segment_relro_end. Add fields
13249 segment_align_index_ and saw_relro_end_.
13250 * script-sections.cc (class Sections_element): Add set_is_relro
13251 virtual function. Add new bool* parameter to place_orphan_here.
13252 Add get_output_section virtual function.
13253 (class Output_section_definition): Add set_is_relro. Add new
13254 bool* parameter to place_orphan_here. Add get_output_section.
13255 Add is_relro_ field.
13256 (Output_section_definition::Output_section_definition): Initialize
13257 evaluated_address_, evaluated_load_address, evaluated_addralign_,
13258 and is_relro_ fields.
13259 (Output_section_definition::place_orphan_here): Add is_relro
13260 parameter.
13261 (Output_section_definition::set_section_addresses): Set relro for
13262 output section.
13263 (Output_section_definition::alternate_constraint): Likewise.
13264 (class Orphan_output_section): Add new bool* parameter to
13265 place_orphan_here. Add get_output_section.
13266 (Orphan_output_section::place_orphan_here): Add is_relro
13267 parameter.
13268 (Script_sections::Script_sections): Initialize
13269 data_segment_align_index_ and saw_relro_end_.
13270 (Script_sections::data_segment_align): New function.
13271 (Script_sections::data_segment_relro_end): New function.
13272 (Script_sections::place_orphan): Set or clear is_relro.
13273 (Script_sections::set_section_addresses): Force alignment of first
13274 TLS section.
13275 * yyscript.y (exp): Call script_data_segment_align and
13276 script_data_segment_relro_end.
13277 * testsuite/relro_script_test.t: New file.
13278 * testsuite/relro_test.cc (using_script): Declare.
13279 (t1, t2): Test using_script.
13280 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13281 (relro_script_test_SOURCES): Define.
13282 (relro_script_test_DEPENDENCIES): Define.
13283 (relro_script_test_LDFLAGS): Define.
13284 (relro_script_test_LDADD): Define.
13285 (relro_script_test.so): New target.
13286 * testsuite/Makefile.in: Rebuild.
13287
13288 2008-08-06 Cary Coutant <ccoutant@google.com>
13289
13290 * archive.cc (Archive::total_archives, Archive::total_members)
13291 (Archive::total_members_loaded): New variables.
13292 (Archive::setup): Add parameter. Add option to preread
13293 archive symbols.
13294 (Archive::read_armap): Add counter.
13295 (Archive::get_file_and_offset): New function.
13296 (Archive::get_elf_object_for_member): New function.
13297 (Archive::read_all_symbols): New function.
13298 (Archive::read_symbols): New function.
13299 (Archive::add_symbols): Add counters.
13300 (Archive::include_all_members): Use armap to find members if it's
13301 already built.
13302 (Archive::include_member): Skip reading symbols if already read.
13303 Factored code into Archive::get_file_and_offset and
13304 Archive::get_elf_object_for_member. Changed call to
13305 Mapfile::report_include_archive_member.
13306 (Archive::print_stats): New function.
13307 * archive.h: Declare Object and Read_symbols_data classes.
13308 (Archive::Archive): Add initializers for new members.
13309 (Archive::setup): Add parameter.
13310 (Archive::print_stats): New function.
13311 (Archive::total_archives, Archive::total_members)
13312 (Archive::total_members_loaded): New variables.
13313 (Archive::get_file_and_offset): New function.
13314 (Archive::get_elf_object_for_member): New function.
13315 (Archive::read_all_symbols): New function.
13316 (Archive::read_symbols): New function.
13317 (Archive::Archive_member): New class.
13318 (Archive::members_): New member.
13319 (Archive::num_members_): New member.
13320 * main.cc: Include archive.h.
13321 (main): Call Archive::print_stats.
13322 * mapfile.cc (Mapfile::report_include_archive_member): Delete
13323 archive parameter; member_name is now the fully-decorated name.
13324 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13325 * options.h: (General_options): Add --preread-archive-symbols option.
13326 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13327 Archive::setup.
13328
13329 2008-08-04 Ian Lance Taylor <iant@google.com>
13330
13331 * symtab.h (Symbol::use_plt_offset): New function.
13332 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13333 * powerpc.cc (Relocate::relocate): Likewise.
13334 * sparc.cc (Relocate::relocate): Likewise.
13335 * x86_64.cc (Relocate::relocate): Likewise.
13336 * testsuite/weak_plt.sh: New test.
13337 * testsuite/weak_plt_main.cc: New test.
13338 * testsuite/weak_plt_shared.cc: New test.
13339 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13340 (check_PROGRAMS): Add weak_plt.
13341 (check_DATA): Add weak_plt_shared.so.
13342 (weak_plt_main_pic.o, weak_plt): New targets.
13343 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13344 * testsuite/Makefile.in: Rebuild.
13345
13346 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13347 gcctestdir/ld.
13348 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13349 * testsuite/Makefile.in: Rebuild.
13350
13351 2008-08-04 Alan Modra <amodra@bigpond.net.au>
13352
13353 * Makefile.am (POTFILES.in): Set LC_ALL=C.
13354 * Makefile.in: Regenerate.
13355 * po/POTFILES.in: Regenerate.
13356
13357 2008-07-29 Ian Lance Taylor <iant@google.com>
13358
13359 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13360 symbols before other symbols.
13361 * testsuite/script_test_2.cc (test_addr): Declare.
13362 (test_addr_alias): Declare.
13363 (main): Check that test_addr and test_addr_alias have the right
13364 values.
13365 * testsuite/script_test_2.t: Define test_addr_alias and
13366 test_addr.
13367
13368 2008-07-24 Ian Lance Taylor <iant@google.com>
13369
13370 PR 5990
13371 * descriptors.cc: New file.
13372 * descriptors.h: New file.
13373 * gold-threads.h (class Hold_optional_lock): New class.
13374 * fileread.cc: Include "descriptors.h".
13375 (File_read::~File_read): Release descriptor rather than closing
13376 it.
13377 (File_read::open) [file]: Call open_descriptor rather than open.
13378 Set is_descriptor_opened_.
13379 (File_read::open) [memory]: Assert that descriptor is not open.
13380 (File_read::reopen_descriptor): New function.
13381 (File_read::release): Release descriptor.
13382 (File_read::do_read): Make non-const. Reopen descriptor.
13383 (File_read::read): Make non-const.
13384 (File_read::make_view): Reopen descriptor.
13385 (File_read::do_readv): Likewise.
13386 * fileread.h (class File_read): Add is_descriptor_opened_ field.
13387 Update declarations.
13388 * layout.cc: Include "descriptors.h".
13389 (Layout::create_build_id): Use open_descriptor rather than open.
13390 * output.cc: Include "descriptors.h".
13391 (Output_file::open): Use open_descriptor rather than open.
13392 * archive.cc (Archive::const_iterator): Change Archive to be
13393 non-const.
13394 (Archive::begin, Archive::end): Make non-const.
13395 (Archive::count_members): Likewise.
13396 * archive.h (class Archive): Update declarations.
13397 * object.h (Object::read): Make non-const.
13398 * Makefile.am (CCFILES): Add descriptors.cc.
13399 (HFILES): Add descriptors.h.
13400 * Makefile.in: Rebuild.
13401
13402 PR 6716
13403 * gold.h: Always include <clocale>. Add Solaris workarounds
13404 following code in binutils/sysdep.h.
13405
13406 PR 6048
13407 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13408 this->eh_frame_hdr_ is NULL before using it.
13409
13410 * dynobj.cc (Versions::Versions): Update comment.
13411
13412 * dynobj.cc (Versions::Versions): If there is an soname, use it as
13413 the base version name.
13414
13415 * stringpool.cc (Stringpool_template::add_with_length): Set key to
13416 array size plus one.
13417 (Stringpool_template::set_string_offsets): Subtract one from key
13418 before using it as an array index.
13419 (Stringpool_template::get_offset_with_length): Likewise.
13420 (Stringpool_template::write_to_buffer): Likewise.
13421 * stringpool.h (Stringpool_template::get_offset_from_key):
13422 Likewise.
13423
13424 2008-07-23 Ian Lance Taylor <iant@google.com>
13425
13426 PR 6658
13427 * object.h (Merged_symbol_value::value): Do our best to handle a
13428 negative addend.
13429
13430 PR 6647
13431 * script.cc (Version_script_info::get_versions): Don't add empty
13432 version tag to return value.
13433 (Version_script_info::get_symbol_version_helper): Change return
13434 type to bool. Add pversion parameter. Change all callers.
13435 (script_register_vers_node): Don't require a non-NULL tag.
13436 * script.h (class Version_script_info): Update declarations.
13437 (Version_script_info::get_symbol_version): Change return type to
13438 bool. Add version parameter. Change all callers.
13439 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13440 handling. Handle an empty version from a version script.
13441 (Symbol_table::define_special_symbol): Likewise.
13442 * testsuite/ver_test_10.script: New file.
13443 * testsuite/ver_test_10.sh: New file.
13444 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13445 (check_DATA): Add ver_test_10.syms.
13446 (ver_test_10.syms, ver_test_10.so): New target.
13447 * testsuite/Makefile.in: Rebuild.
13448
13449 2008-07-23 Simon Baldwin <simonb@google.com>
13450
13451 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13452 to zero for undefined symbols from dynamic libraries.
13453
13454 2008-07-23 Ian Lance Taylor <iant@google.com>
13455
13456 * symtab.cc (Symbol_table::resolve): Remove version parameter.
13457 Change all callers.
13458 * symtab.h (class Symbol_table): Update declaration.
13459 * testsuite/ver_test_9.cc: New file.
13460 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13461 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13462 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13463 (ver_test_9.so, ver_test_9.o): New targets.
13464 * testsuite/Makefile.in: Rebuild.
13465
13466 2008-07-22 Ian Lance Taylor <iant@google.com>
13467
13468 * options.h (class General_options): Define --check-sections.
13469 * layout.cc (Layout::set_segment_offsets): Handle
13470 --check-sections.
13471
13472 * options.h (class General_options): Define -n/--nmagic and
13473 -N/--omagic.
13474 * options.cc (General_options::finalize): For -n/--nmagic or
13475 -N/--omagic, set -static.
13476 * layout.cc (Layout::attach_allocated_section_to_segment): If
13477 -N/--omagic, don't put read-only and read-write sections in
13478 different segments.
13479 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13480 finding a read-only segment.
13481 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13482 don't set the minimum segment alignment to the common page size,
13483 and don't set the file offset to the address modulo the page size.
13484 * script-sections.cc (Script_sections::create_segments): If
13485 -n/--omagic, don't put read-only and read-write sections in
13486 different segments.
13487
13488 * cref.cc: New file.
13489 * cref.h: New file.
13490 * options.h (class General_options): Add --print-symbol-counts.
13491 * main.cc (main): Issue defined symbol report if requested.
13492 * archive.cc (Archive::interpret_header): Make into a const member
13493 function.
13494 (Archive::add_symbols): Call Input_objects::archive_start and
13495 archive_stop.
13496 (Archive::const_iterator): Define new class.
13497 (Archive::begin, Archive::end): New functions.
13498 (Archive::include_all_members): Rewrite to use iterator.
13499 (Archive::count_members): New function.
13500 * archive.h (class Archive): Update declarations.
13501 (Archive::filename): New function.
13502 * object.cc: Include "cref.h".
13503 (Sized_relobj::Sized_relobj): Initialize defined_count_.
13504 (Sized_relobj::do_get_global_symbol_counts): New function.
13505 (Input_objects::add_object): Add object to cross-referencer.
13506 (Input_objects::archive_start): New function.
13507 (Input_objects::archive_stop): New function.
13508 (Input_objects::print_symbol_counts): New function.
13509 * object.h: Declare Cref and Archive.
13510 (Object::get_global_symbol_counts): New function.
13511 (Object::do_get_global_symbol_counts): New pure virtual function.
13512 (class Sized_relobj): Add defined_count_ field. Update
13513 declarations.
13514 (class Input_objects): Add cref_ field. Update constructor.
13515 Update declarations.
13516 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13517 defined_count_.
13518 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13519 symbol counts.
13520 (Sized_dynobj::do_get_global_symbol_counts): New function.
13521 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13522 defined_count_. Update declarations. Define Symbols typedef.
13523 * symtab.cc (Symbol_table::add_from_relobj): Add defined
13524 parameter. Change all callers.
13525 (Symbol_table::add_from_dynobj): Add sympointers and defined
13526 parameters. Change all callers.
13527 * symtab.h (class Symbol_table): Update declarations.
13528 * Makefile.am (CCFILES): Add cref.cc.
13529 (HFILES): Add cref.h.
13530 * Makefile.in: Rebuild.
13531
13532 2008-07-22 Simon Baldwin <simonb@google.com>
13533
13534 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13535 to zero when writing undefined symbols.
13536
13537 2008-07-22 Ian Lance Taylor <iant@google.com>
13538
13539 * output.cc (Output_section::add_input_section): Don't try to
13540 merge empty merge sections.
13541
13542 2008-07-21 Craig Silverstein <csilvers@google.com>
13543
13544 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13545 Include symbol version in error message.
13546
13547 2008-07-20 Chris Demetriou <cgd@google.com>
13548
13549 * configure.ac (gold_cv_c_random_seed): New configured variable.
13550 (RANDOM_SEED_CFLAGS): New substituted variable.
13551 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13552 * configure: Rebuild.
13553 * Makefile.in: Likewise.
13554 * testsuite/Makefile.in: Likewise.
13555
13556 2008-07-18 Ian Lance Taylor <iant@google.com>
13557
13558 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13559 where we see NAME/NULL and NAME/VERSION as separate symbols.
13560 * testsuite/ver_test_main.cc (main): Call t4.
13561 (t4, t4_2a): Define.
13562 * testsuite/ver_test_2.cc (t4_2): Define.
13563 * testsuite/ver_test_2.script: Put t4_2a in VER2.
13564 * testsuite/ver_test_4.cc (t4_2a): Define.
13565 * testsuite/ver_test_4.script: Put t4_2a in VER2.
13566 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13567
13568 2008-07-17 Ian Lance Taylor <iant@google.com>
13569
13570 * dynobj.cc (Versions::add_def): If we give an error about a
13571 missing version, go ahead and create the version anyhow.
13572
13573 2008-07-10 Ian Lance Taylor <iant@google.com>
13574
13575 Handle output sections with more than 0x7fffffff bytes.
13576 * object.h (class Relobj): Change map_to_output_ to
13577 output_sections_, and just keep a section pointer. Change all
13578 uses. Move comdat group support to Sized_relobj.
13579 (Relobj::is_section_specially_mapped): Remove.
13580 (Relobj::output_section): Remove poff parameter. Change all
13581 callers.
13582 (Relobj::output_section_offset): New function.
13583 (Relobj::set_section_offset): Rewrite.
13584 (Relobj::map_to_output): Remove.
13585 (Relobj::output_sections): New function.
13586 (Relobj::do_output_section_offset): New pure virtual function.
13587 (Relobj::do_set_section_offset): Likewise.
13588 (class Sized_relobj): Add section_offsets_ field. Add comdat
13589 group support from Relobj. Update declarations.
13590 (Sized_relobj::get_output_section_offset): New function.
13591 (Sized_relobj::do_output_section_offset): New function.
13592 (Sized_relobj::do_set_section_offset): New function.
13593 * object.cc (Relobj::output_section_address): Remove.
13594 (Sized_relobj::Sized_relobj): Initialize new fields.
13595 (Sized_relobj::include_section_group): Cast find_kept_object to
13596 Sized_relobj.
13597 (Sized_relobj::include_linkonce_section): Likewise.
13598 (Sized_relobj::do_layout): Use separate arrays for output section
13599 and output offset.
13600 (Sized_relobj::do_count_local_symbols): Change map_to_output to
13601 output_sections.
13602 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13603 output_sections and section_offsets.
13604 (Sized_relobj::write_local_symbols): Likewise.
13605 (map_to_kept_section): Compute output address directly.
13606 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13607 output_sections and section_offsets.
13608 (Sized_relobj::write_sections): Likewise.
13609 (Sized_relobj::relocate_sections): Likewise.
13610 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13611 * output.h (class Output_reloc): Update declarations. Change
13612 u2_.relobj to Sized_relobj*.
13613 (class Output_data_reloc): Change add functions to use
13614 Sized_relobj*.
13615 * output.cc (Output_reloc::Output_reloc): Change relobj to
13616 Sized_relobj*.
13617 (Output_reloc::local_section_offset): Change return type to
13618 Elf_Addr. Use get_output_section_offset.
13619 (Output_reloc::get_address): Likewise.
13620 (Output_section::is_input_address_mapped): Don't call
13621 is_section_specially_mapped.
13622 (Output_section::output_offset): Likewise.
13623 (Output_section::output_address): Likewise.
13624 (Output_section::starting_output_address): Likewise.
13625 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13626 parameter to Sized_relobj*.
13627 (Copy_relocs::need_copy_reloc): Likewise.
13628 (Copy_relocs::save): Likewise.
13629 * copy-relocs.h (class Copy_relocs): Update declarations.
13630 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13631 Sized_relobj*. Change relobj_ field to Sized_relobj*.
13632 * target-reloc.h (relocate_for_relocatable): Change
13633 offset_in_output_section type to Elf_Addr. Change code that uses
13634 it as well.
13635 * layout.cc (Layout::layout): Always set *off.
13636 * mapfile.cc (Mapfile::print_input_section): Use
13637 output_section_offset.
13638 * i386.cc (Target_i386::copy_reloc): Change object parameter to
13639 Sized_relobj*.
13640 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13641 * sparc.cc (Target_sparc::copy_reloc): Likewise.
13642 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13643
13644 2008-07-03 Ian Lance Taylor <iant@google.com>
13645
13646 * layout.cc (Layout::include_section): Do not discard unrecognized
13647 SHT_STRTAB sections.
13648
13649 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
13650
13651 * script.cc (Lex::can_continue_name): Make '?' allowable in
13652 version-script names.
13653 * testsuite/version_script.map: Change glob pattern to use '?'
13654
13655 2008-06-30 Manish Singh <yosh@gimp.org>
13656
13657 PR 6585
13658 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13659 Correct typo.
13660
13661 2008-06-30 Ian Lance Taylor <iant@google.com>
13662
13663 PR 6660
13664 PR 6682
13665 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13666 versions]: Don't try to read the value in the contents, since we
13667 don't use it. Use the template endianness when writing.
13668
13669 2008-06-25 Cary Coutant <ccoutant@google.com>
13670
13671 * fileread.cc (File_read::make_view): Assert on zero-length view.
13672 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13673 symbol table when there are no symbols to read.
13674
13675 2008-06-23 Craig Silverstein <csilvers@google.com>
13676
13677 * version.cc (version_string): Bump to 1.7
13678
13679 2008-06-18 Craig Silverstein <csilvers@google.com>
13680
13681 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13682 constant 0xFFFF to type Valtype.
13683 (Powerpc_relocate_functions::rel16_ha): Likewise.
13684
13685 2008-06-17 Ian Lance Taylor <iant@google.com>
13686
13687 * output.h (Output_section::Input_section): Initialize p2align_ to
13688 zero for Output_section_data constructors.
13689 (Output_section::Input_section::addralign): If not an input
13690 section, return the alignment of the Output_section_data.
13691 * testsuite/copy_test.cc: New file.
13692 * testsuite/copy_test_1.cc: New file.
13693 * testsuite/copy_test_2.cc: New file.
13694 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13695 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13696 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13697 (copy_test_1_pic.o, copy_test_1.so): New targets.
13698 (copy_test_2_pic.o, copy_test_2.so): New targets.
13699 * testsuite/Makefile.in: Rebuild.
13700
13701 * script-sections.cc (Script_sections::place_orphan): Initialize
13702 local variable exact.
13703
13704 2008-06-13 David Edelsohn <edelsohn@gnu.org>
13705
13706 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13707
13708 2008-06-12 David Edelsohn <edelsohn@gnu.org>
13709 David S. Miller <davem@davemloft.net>
13710
13711 * powerpc.cc: New file.
13712 * Makefile.am (TARGETSOURCES): Add powerpc.cc
13713 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13714 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13715 * Makefile.in: Rebuild.
13716
13717 2008-06-09 Ian Lance Taylor <iant@google.com>
13718
13719 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13720 <exception>.
13721 (throwing, orig_terminate): New static variables.
13722 (terminate_handler): New static function.
13723 (t2): Set terminate handler.
13724
13725 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
13726
13727 PR 6584
13728 * binary.cc (Binary_to_elf::sized_convert): Fix .data
13729 alignment.
13730
13731 2008-05-30 Cary Coutant <ccoutant@google.com>
13732
13733 * archive.cc (Archive::include_all_members) Correct to step
13734 over symbol table and extended name table in thin archives.
13735
13736 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
13737
13738 PR 6407
13739 * target-reloc.h (relocate_for_relocatable): Fix new_offset
13740 calculation.
13741
13742 2008-05-28 Caleb Howe <cshowe@google.com>
13743
13744 * reduced_debug_output.cc: New file.
13745 * reduced_debug_output.h: New file.
13746 * options.h (class General_options): Add --strip-debug-non-line.
13747 * options.cc (General_options::finalize): Add strip_debug_non_line
13748 to the strip heirarchy.
13749 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13750 fields.
13751 * layout.cc: Include "reduced_debug_output.h".
13752 (Layout::Layout): Initialize new fields.
13753 (line_only_debug_sections): New static array.
13754 (is_lines_only_debug_sections): New static inline function.
13755 (Layout::include_section): Handle --strip-debug-non-line.
13756 (Layout::make_output_section): If --strip-debug-non-line, build
13757 new output sections for .debug_abbrev and .debug_info.
13758 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13759 gold. Warn about possible overflow.
13760 (read_signed_LEB_128): Likewise.
13761 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13762 (read_signed_LEB_128): Declare.
13763 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13764 (HFILES): Add reduced_debug_output.h.
13765 * Makefile.in: Rebuild.
13766
13767 2008-05-21 Ian Lance Taylor <iant@google.com>
13768
13769 * mapfile.cc: New file.
13770 * mapfile.h: New file.
13771 * options.h (class General_options): Add -M/--print-map and -Map.
13772 * options.cc (General_options::finalize): Make -M equivalent to
13773 -Map -.
13774 * main.cc: Include <cstdio> and "mapfile.h".
13775 (main): Open mapfile if requested.
13776 * gold.cc (class Middle_runner): Add mapfile_ field. Update
13777 constructor. Change caller.
13778 (queue_initial_tasks): Add mapfile parameter. Change caller.
13779 (queue_middle_tasks): Likewise.
13780 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13781 declarations.
13782 * archive.cc: Include "mapfile.h".
13783 (Archive::add_symbols): Add mapfile parameter. Change all
13784 callers. Pass mapfile, symbol, and reason to include_member.
13785 (Archive::include_all_members): Add mapfile parameter. Change all
13786 callers.
13787 (Archive::include_member): Add mapfile, sym, and why parameters.
13788 Change all callers. Report inclusion to map file.
13789 * archive.h: Include "fileread.h".
13790 (class Archive): Update declarations.
13791 (Archive::file): New const method.
13792 (class Add_archive_symbols): Add mapfile_ field. Update
13793 constructor. Change all callers.
13794 * readsyms.h (class Read_symbols): Likewise.
13795 (class Finish_group): Likewise.
13796 (class Read_script): Likewise.
13797 * common.cc: Include "mapfile.h".
13798 (Symbol_table::allocate_commons): Add mapfile parameter. Change
13799 all callers.
13800 (Symbol_table::do_allocate_commons): Likewise.
13801 (Symbol_table::do_allocate_commons_list): Likewise. Report common
13802 symbol allocation to mapfile.
13803 * common.h (class Allocate_commons_task): Add mapfile_ field.
13804 Update constructor. Change all callers.
13805 * symtab.h (class Symbol_table): Update declarations.
13806 * layout.cc: Include "mapfile.h".
13807 (Layout_task_runner::run): Print information to mapfile.
13808 (Layout::create_gold_note): Change Output_data_fixed_space to
13809 Output_data_zero_fill.
13810 (Layout::create_build_id): Likewise.
13811 (Layout::print_to_mapfile): New function.
13812 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
13813 constructor. Change caller.
13814 (class Layout): Declare print_to_mapfile.
13815 * output.cc (Output_section::Input_section::print_to_mapfile): New
13816 function.
13817 (Output_section::add_input_section): If producing a map, always
13818 add to input_sections_ list.
13819 (Output_section::do_print_to_mapfile): New function.
13820 (Output_segment::print_sections_to_mapfile): New function.
13821 (Output_segment::print_section_list_to_mapfile): New function.
13822 * output.h: Include "mapfile.h".
13823 (Output_data::print_to_mapfile): New function.
13824 (Output_data::do_print_to_mapfile): New virtual function.
13825 (Output_segment_headers::do_print_to_mapfile): New function.
13826 (Output_file_header::do_print_to_mapfile): New function.
13827 (Output_data_const::do_print_to_mapfile): New function.
13828 (class Output_data_const_buffer): Add map_name_ field. Update
13829 constructor. Change all callers. Add do_print_to_mapfile
13830 function.
13831 (class Output_data_fixed_space): Likewise.
13832 (class Output_data_space): Likewise.
13833 (class Output_data_zero_fill): New class.
13834 (Output_data_strtab::do_print_to_mapfile): New function.
13835 (Output_data_reloc_base::do_print_to_mapfile): New function.
13836 (Output_relocatable_relocs::do_print_to_mapfile): New function.
13837 (Output_data_group::do_print_to_mapfile): New function.
13838 (Output_data_got::do_print_to_mapfile): New function.
13839 (Output_data_dynamic::do_print_to_mapfile): New function.
13840 (Output_symtab_xindex::do_print_to_mapfile): New function.
13841 (class Output_section): Declare do_print_to_mapflie. Declare
13842 print_to_mapfile in Input_section.
13843 (class Output_segment): Declare new functions.
13844 * object.h (Sized_relobj::symbol_count): New function.
13845 * script-sections.cc
13846 (Output_section_element_dot_assignment::set_section_addresses):
13847 Change Output_data_fixed_space to Output_data_zero_fill.
13848 (Output_data_expression::do_print_to_mapfile): New function.
13849 * script.cc (read_input_script): Add mapfile parameter. Change
13850 all callers.
13851 * script.h (read_input_script): Update declaration.
13852 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13853 (Eh_frame::do_print_to_mapfile): New function.
13854 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13855 (Output_merge_string::do_print_to_mapfile): New function.
13856 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13857 function.
13858 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13859 function.
13860 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13861 function.
13862 * Makefile.am (CCFILES): Add mapfile.cc.
13863 (HFILES): Add mapfile.h.
13864 * Makefile.in: Rebuild.
13865
13866 2008-05-19 Ian Lance Taylor <iant@google.com>
13867
13868 * options.h (class General_options): Add -z relro.
13869 * layout.cc (Layout::Layout): Initialize relro_segment_.
13870 (Layout::add_output_section_data): Return the output section.
13871 (Layout::make_output_section): Rcognize relro sections and mark
13872 them appropriately.
13873 (Layout::attach_allocated_section_to_segment): Put relro sections
13874 in a PT_GNU_RELRO segment.
13875 (Layout::create_initial_dynamic_sections): Mark the .dynamic
13876 section as relro.
13877 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13878 PT_TLS segments.
13879 (Layout::linkonce_mapping): Map d.rel.ro.local to
13880 .data.rel.ro.local.
13881 (Layout::output_section_name): Us .data.rel.ro.local for any
13882 section which begins with that.
13883 * layout.h (class Layout): Update add_output_section_data
13884 declaration. Add relro_segment_ field.
13885 * output.cc (Output_section::Output_section): Initialize is_relro_
13886 and is_relro_local_ fields.
13887 (Output_segment::add_output_section): Group relro sections.
13888 (Output_segment::is_first_section_relro): New function.
13889 (Output_segment::maximum_alignment): If there is a relro section,
13890 align the segment to the common page size.
13891 (Output_segment::set_section_addresses): Track whether we are
13892 looking at relro sections. If the last section is a relro
13893 section, align to the common page size.
13894 (Output_segment::set_section_list_addresses): Add in_relro
13895 parameter. Change all callers. Align to the page size when
13896 moving from relro to non-relro section.
13897 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13898 segment.
13899 * output.h (class Output_section): Add is_relro_ and
13900 is_relro_local_ fields.
13901 (Output_section::is_relro): New function.
13902 (Output_section::set_is_relro): New function.
13903 (Output_section::is_relro_local): New function.
13904 (Output_section::set_is_relro_local): New function.
13905 (class Output_segment): Update declarations.
13906 * i386.cc (Target_i386::got_section): Mark .got section as relro.
13907 * sparc.cc (Target_sparc::got_section): Likewise.
13908 * x86_64.cc (Target_x86_64::got_section): Likewise.
13909 * testsuite/relro_test_main.cc: New file.
13910 * testsuite/relro_test.cc: New file.
13911 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13912 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13913 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13914 (relro_test.so, relro_test_pic.o): New targets.
13915 * testsuite/Makefile.in: Rebuild.
13916
13917 2008-05-16 Ian Lance Taylor <iant@google.com>
13918
13919 * output.cc (Output_segment::add_output_section): Remove front
13920 parameter.
13921 * output.h (class Output_segment): Remove
13922 add_initial_output_section and overloaded add_output_section.
13923 Update declaration of remaining add_output_section.
13924 * layout.cc (Layout::create_interp): Call add_output_section
13925 rather than add_initial_output_section.
13926 (Layout::finish_dynamic_section): Likewise.
13927
13928 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13929 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
13930 know the dynamic type.
13931 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13932 field. Initialize it in constructor.
13933 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13934 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13935 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13936 reloc.
13937
13938 * output.cc (Output_reloc::get_address): Change return type to
13939 Elf_Addr.
13940 * output.h (class Output_reloc): Update get_address declaration.
13941 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13942 for section addresses.
13943
13944 2008-05-09 Ian Lance Taylor <iant@google.com>
13945
13946 PR 6493
13947 * gold.cc (gold_nomem): Use return value of write.
13948
13949 2008-05-08 Ian Lance Taylor <iant@google.com>
13950
13951 * symtab.c (Symbol::init_base_output_data): Add version
13952 parameter. Change all callers.
13953 (Symbol::init_base_output_segment): Likewise.
13954 (Symbol::init_base_constant): Likewise.
13955 (Symbol::init_base_undefined): Likewise.
13956 (Sized_symbol::init_output_data): Likewise.
13957 (Sized_symbol::init_output_segment): Likewise.
13958 (Sized_symbol::init_constant): Likewise.
13959 (Sized_symbol::init_undefined): Likewise.
13960 (Symbol_table::do_define_in_output_data): If the new symbol has a
13961 version, mark it as the default.
13962 (Symbol_table::do_define_in_output_segment): Likewise.
13963 (Symbol_table::do_define_as_constant): Likewise.
13964 * symtab.h (class Symbol): Update declarations.
13965 (class Sized_symbol): Likewise.
13966 * resolve.cc (Symbol::override_version): New function.
13967 (Symbol::override_base): Call override_version.
13968 (Symbol::override_base_with_special): Likewise.
13969 * testsuite/ver_script_8.script: New file.
13970 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13971 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13972 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13973 (ver_test_8_1.so, ver_test_8_2.so): New targets.
13974
13975 2008-05-06 Ian Lance Taylor <iant@google.com>
13976
13977 PR 6049
13978 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13979 functions.
13980 (class General_options): Remove existing --undefined, and add
13981 --no-undefined instead. Add new --undefined as synonym for -u.
13982 * archive.cc (Archive::add_symbols): Check whether symbol was
13983 named with -u.
13984 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13985 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13986 all uses. Add IS_UNDEFINED. Update declarations to split
13987 different versions of init_base. Declare init_base_undefined.
13988 (Symbol::is_defined): Handle IS_UNDEFINED.
13989 (Symbol::is_undefined): Likewise.
13990 (Symbol::is_weak_undefined): Call is_undefined.
13991 (Symbol::is_absolute): Handle IS_CONSTANT.
13992 (class Sized_symbol): Update declarations to split different
13993 versions of init. Declare init_undefined.
13994 (class Symbol_table): Declare new functions.
13995 * symtab.cc (Symbol::init_base_object): Rename from init_base.
13996 Change all callers.
13997 (Symbol::init_base_output_data): Likewise.
13998 (Symbol::init_base_output_segment): Likewise.
13999 (Symbol::init_base_constant): Likewise.
14000 (Symbol::init_base_undefined): New function.
14001 (Sized_symbol::init_object): Rename from init. Change all
14002 callers.
14003 (Sized_symbol::init_output_data): Likewise.
14004 (Sized_symbol::init_output_segment): Likewise.
14005 (Sized_symbol::init_constant): Likewise.
14006 (Sized_symbol::init_undefined): New function.
14007 (Symbol_table::add_undefined_symbols_from_command_line): New
14008 function.
14009 (Symbol_table::do_add_undefined_symbols_from_command_line): New
14010 function.
14011 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14012 (Symbol::output_section): Likewise.
14013 (Symbol::set_output_section): Likewise.
14014 (Symbol_table::sized_finalize_symbol): Likewise.
14015 (Symbol_table::sized_write_globals): Likewise.
14016 * resolve.cc (Symbol_table::should_override): Likewise.
14017 (Symbol::override_base_with_special): Likewise.
14018
14019 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14020 symbol, change it to have default visibility.
14021 * testsuite/protected_1.cc: New file.
14022 * testsuite/protected_2.cc: New file.
14023 * testsuite/protected_3.cc: New file.
14024 * testsuite/protected_main_1.cc: New file.
14025 * testsuite/protected_main_2.cc: New file.
14026 * testsuite/protected_main_3.cc: New file.
14027 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14028 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14029 (protected_1_LDFLAGS, protected_1_LDADD): Define.
14030 (protected_1.so): New target.
14031 (protected_1_pic.o, protected_2_pic.o): New targets.
14032 (protected_3_pic.o): New target.
14033 (check_PROGRAMS): Add protected_2.
14034 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14035 (protected_2_LDFLAGS, protected_2_LDADD): Define.
14036 * testsuite/Makefile.in: Rebuild.
14037
14038 * options.h (DEFINE_var): Add set_user_set_##varname__.
14039 (DEFINE_bool_alias): New macro.
14040 (class General_options): Define -Bstatic using DEFINE_bool_alias
14041 rather than DEFINE_special. Add --undefined as an alias for -z
14042 defs.
14043 * options.cc (General_options::parse_Bstatic): Remove.
14044
14045 * options.h (class General_options): Add --fatal-warnings.
14046 * main.cc (main): Implement --fatal-warnings.
14047 * errors.h (Errors::warning_count): New function.
14048
14049 * options.h (class General_options): Add -Bsymbolic-functions.
14050 * symtab.h (Symbol::is_preemptible): Check for
14051 -Bsymbolic-functions.
14052
14053 2008-05-05 Ian Lance Taylor <iant@google.com>
14054
14055 * options.h (DEFINE_bool): For DASH_Z, create the negative option
14056 as noVARNAME rather than no-VARNAME.
14057 (class General_options): Add option -z combreloc.
14058 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14059 get_address.
14060 (Output_reloc::sort_before) [SHT_REL]: New function.
14061 (Output_reloc::sort_before) [SHT_RELA]: New function.
14062 (class Output_data_reloc_base): Add sort_relocs_ field. Define
14063 Sort_relocs_comparison.
14064 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14065 parameter. Change all callers.
14066 (Output_data_reloc::Output_data_reloc) [both versions]: Add
14067 sort_relocs parameter. Change all callers.
14068 * output.cc (Output_reloc::get_address): New function, broken out
14069 of write_rel.
14070 (Output_reloc::write_rel): Call it.
14071 (Output_reloc::compare): New function.
14072 (Output_data_reloc_base::do_write): Optionally sort relocs.
14073
14074 * configure.ac: If targ_extra_obj is set, link it in.
14075 * configure.tgt: Initialize all variables.
14076 (x86_64*): Set targ_extra_obj and targ_extra_size.
14077 * configure: Rebuild.
14078
14079 * object.cc (Sized_relobj::include_section_group): Adjust section
14080 indexes read from group data. Build vector to pass to
14081 layout_group.
14082 * layout.cc (Layout::layout_group): Add flags and shndxes
14083 parameters. Remove contents parameter. Change caller. Update
14084 explicit instantiations.
14085 * layout.h (class Layout): Update layout_group declaration.
14086 * output.cc (Output_data_group::Output_data_group): Add flags and
14087 input_shndxes parameters. Remove contents parameter. Change
14088 caller.
14089 (Output_data_group::do_write): Change input_sections_ to
14090 input_shndxes_.
14091 * output.h (class Output_data_group): Update constructor
14092 declaration. Rename input_sections_ to input_shndxes_.
14093 * testsuite/many_sections_test.cc: Add template.
14094
14095 2008-04-30 Cary Coutant <ccoutant@google.com>
14096
14097 * target-reloc.h (relocate_section): Fix dead-pointer bug.
14098
14099 * layout.cc (Layout::include_section): Refactored check for debug
14100 info section.
14101 (Layout::add_comdat): Add new parameters. Change type
14102 of signature parameter. Add object and shndx to signatures table.
14103 (Layout::find_kept_object): New function.
14104 * layout.h: Include <cstring>.
14105 (Layout::is_debug_info_section): New function.
14106 (Layout::add_comdat): Add new parameters.
14107 (Layout::find_kept_object): New function.
14108 (Layout::Kept_section): New struct.
14109 (Layout::Signatures): Change type of map range.
14110 * object.cc (Relobj::output_section_address): New function.
14111 (Sized_relobj::include_section_group): Add new parameters. Change
14112 calls to Layout::add_comdat. Change to build table of kept comdat
14113 groups and table mapping discarded sections to kept sections.
14114 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
14115 (Sized_relobj::do_layout): Change calls to include_section_group and
14116 include_linkonce_section.
14117 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14118 value to zero when section is discarded.
14119 (Sized_relobj::map_to_kept_section): New function.
14120 * object.h (Relobj::output_section_address): New function.
14121 (Relobj::Comdat_group): New type.
14122 (Relobj::find_comdat_group): New function.
14123 (Relobj::Comdat_group_table): New type.
14124 (Relobj::Kept_comdat_section): New type.
14125 (Relobj::Kept_comdat_section_table): New type.
14126 (Relobj::add_comdat_group): New function.
14127 (Relobj::set_kept_comdat_section): New function.
14128 (Relobj::get_kept_comdat_section): New function.
14129 (Relobj::comdat_groups_): New field.
14130 (Relobj::kept_comdat_sections_): New field.
14131 (Symbol_value::input_value): Update comment.
14132 (Sized_relobj::map_to_kept_section) New function.
14133 (Sized_relobj::include_linkonce_section): Add new parameter.
14134 * target-reloc.h (Comdat_behavior): New type.
14135 (get_comdat_behavior): New function.
14136 (relocate_section): Add code to map a discarded section to the
14137 corresponding kept section when applying a relocation.
14138
14139 2008-04-30 Craig Silverstein <csilvers@google.com>
14140
14141 * dwarf_reader.cc (next_generation_count): New static var.
14142 (Addr2line_cache_entry): New struct.
14143 (addr2line_cache): New static var.
14144 (Dwarf_line_info::one_addr2line): Added caching.
14145 (Dwarf_line_info::clear_addr2line_cache): New function.
14146 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14147 cache-size parameter.
14148 (Dwarf_line_info::one_addr2line_cache): New function.
14149 * symtab.cc (Symbol_table::detect_odr_violations): Pass
14150 new cache-size argument to one_addr2line(), and clear cache.
14151
14152 2008-04-28 Cary Coutant <ccoutant@google.com>
14153
14154 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14155 R_386_PC8 relocations.
14156
14157 2008-04-23 Ian Lance Taylor <iant@google.com>
14158
14159 * object.cc (Sized_relobj::include_section_group): Check for
14160 invalid section group.
14161
14162 * object.cc (make_elf_object): Correct test for 64-bit ELF file
14163 header size.
14164
14165 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14166 than read for file header.
14167 * archive.cc (Archive::include_member): Likewise.
14168
14169 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
14170
14171 * aclocal.m4: Regenerate.
14172 * configure: Regenerate.
14173
14174 2008-04-19 Ian Lance Taylor <iant@google.com>
14175
14176 * version.cc (version_string): Bump to 1.6.
14177
14178 * testsuite/Makefile.am (many_sections_r_test): New target.
14179 (many_sections_r_test_SOURCES): Remove.
14180 (many_sections_r_test_DEPENDENCIES): Remove.
14181 (many_sections_r_test_LDFLAGS): Remove.
14182 (many_sections_r_test_LDADD): Remove.
14183
14184 * object.cc (Sized_relobj::do_add_symbols): Always pass
14185 local_symbol_count_ to add_from_relobj.
14186
14187 * testsuite/Makefile.am (many_sections_check.h): Only check one in
14188 every thousand variables.
14189 * testsuite/Makefile.in: Rebuild.
14190
14191 * object.cc (Xindex::initialize_symtab_xindex): New function.
14192 (Xindex::read_symtab_xindex): New function.
14193 (Xindex::sym_xindex_to_shndx): New function.
14194 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14195 available.
14196 (Sized_relobj::do_initialize_xindex): New function.
14197 (Sized_relobj::do_read_symbols): Adjust section links.
14198 (Sized_relobj::symbol_section_and_value): Add is_ordinary
14199 parameter. Change all callers.
14200 (Sized_relobj::include_section_group): Adjust section links and
14201 symbol section indexes.
14202 (Sized_relobj::do_layout): Adjust section links.
14203 (Sized_relobj::do_count_local_symbols): Adjust section links and
14204 symbol section indexes.
14205 (Sized_relobj::do_finalize_local_symbols): Distinguish between
14206 ordinary and special symbols.
14207 (Sized_relobj::write_local_symbols): Add symtab_xindex and
14208 dynsym_xindex parameters. Change all callers. Adjust section
14209 links. Use SHN_XINDEX when needed.
14210 (Sized_relobj::get_symbol_location_info): Adjust section links.
14211 Don't get fooled by special symbols.
14212 * object.h (class Xindex): Define.
14213 (class Object): Add xindex_ parameter. Declare virtual functoin
14214 do_initialize_xindex.
14215 (Object::adjust_sym_shndx): New function.
14216 (Object::set_xindex): New protected function.
14217 (class Symbol_value): Add is_ordinary_shndx_ field.
14218 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14219 (Symbol_value::value): Assert ordinary section.
14220 (Symbol_value::initialize_input_to_output_map): Likewise.
14221 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14222 Change all callers.
14223 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
14224 all callers.
14225 (class Sized_relobj): Update declarations.
14226 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14227 parameter. Change all callers.
14228 (Sized_relobj::adjust_shndx): New function.
14229 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14230 field.
14231 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14232 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
14233 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
14234 (Sized_dynobj::read_dynsym_section): Adjust section links.
14235 (Sized_dynobj::read_dynamic): Likewise.
14236 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
14237 section links.
14238 (Sized_dynobj::do_initialize_xindex): New function.
14239 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
14240 do_initialize_xindex.
14241 (Sized_dynobj::adjust_shndx): New function.
14242 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14243 dynsym_xindex_ fields.
14244 (Layout::finalize): Add a call to set_section_indexes before
14245 creating the symtab sections.
14246 (Layout::set_section_indexes): Don't do anything if the section
14247 already has a section index.
14248 (Layout::create_symtab_sections): Add shnum parameter. Change
14249 caller. Create .symtab_shndx section if needed.
14250 (Layout::create_shdrs): Add shstrtab_section parameter. Change
14251 caller.
14252 (Layout::allocated_output_section_count): New function.
14253 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14254 needed.
14255 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14256 fields. Update declarations.
14257 (Layout::symtab_xindex): New function.
14258 (Layout::dynsym_xindex): New function.
14259 (class Write_symbols_task): Add layout_ field.
14260 (Write_symbols_task::Write_symbols_task): Add layout parameter.
14261 Change caller.
14262 * output.cc (Output_section_headers::Output_section_headers): Add
14263 shstrtab_section parameter. Change all callers.
14264 (Output_section_headers::do_sized_write): Store overflow values
14265 for section count and section string table section index in
14266 section header zero.
14267 (Output_file_header::do_sized_write): Check for overflow of
14268 section count and section string table section index.
14269 (Output_symtab_xindex::do_write): New function.
14270 (Output_symtab_xindex::endian_do_write): New function.
14271 * output.h (class Output_section_headers): Add shstrtab_section_.
14272 Update declarations.
14273 (class Output_symtab_xindex): Define.
14274 (Output_section::has_out_shndx): New function.
14275 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14276 field.
14277 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14278 Change all callers.
14279 (Sized_symbol::init): Likewise.
14280 (Symbol::output_section): Check for ordinary symbol.
14281 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
14282 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
14283 callers.
14284 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14285 Change all callers. Simplify handling of symbols from sections
14286 not included in the link.
14287 (Symbol_table::add_from_dynobj): Handle ordinary symbol
14288 distinction.
14289 (Weak_alias_sorter::operator()): Assert that symbols are
14290 ordinary.
14291 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14292 distinction.
14293 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14294 parameters. Change all callers.
14295 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
14296 symbol distinction. Use SHN_XINDEX when needed.
14297 (Symbol_table::write_section_symbol): Add symtab_xindex
14298 parameter. Change all callers.
14299 (Symbol_table::sized_write_section_symbol): Likewise. Use
14300 SHN_XINDEX when needed.
14301 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
14302 declarations.
14303 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
14304 (Symbol::is_defined): Check is_ordinary.
14305 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14306 (Symbol::is_absolute, Symbol::is_common): Likewise.
14307 (class Sized_symbol): Update declarations.
14308 (class Symbol_table): Update declarations.
14309 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14310 parameters. Change all callers.
14311 (Sized_symbol::override): Likewise.
14312 (Symbol_table::override): Likewise.
14313 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
14314 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
14315 is_ordinary, and orig_st_shndx parameters. Change all callers.
14316 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14317 to be in an ordinary section.
14318 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14319 object and is_ordinary parameters. Change all callers.
14320 (Sized_dwarf_line_info::read_relocs): Add object parameter.
14321 Change all callers. Don't add undefined or non-ordinary symbols
14322 to reloc_map_.
14323 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14324 Change all callers.
14325 * dwarf_reader.h (class Sized_dwarf_line_info): Update
14326 declarations.
14327 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14328 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14329 (Sized_relobj::relocate_sections): Likewise.
14330 * target-reloc.h (scan_relocs): Adjust section symbol index.
14331 (scan_relocatable_relocs): Likewise.
14332 * i386.cc (Scan::local): Check for ordinary symbols.
14333 * sparc.cc (Scan::local): Likewise.
14334 * x86_64.cc (Scan::local): Likewise.
14335 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14336 to symbol_section_and_value.
14337 * testsuite/many_sections_test.cc: New file.
14338 * testsuite/Makefile.am (BUILT_SOURCES): Define.
14339 (check_PROGRAMS): Add many_sections_test.
14340 (many_sections_test_SOURCES): Define.
14341 (many_sections_test_DEPENDENCIES): Define.
14342 (many_sections_test_LDFLAGS): Define.
14343 (BUILT_SOURCES): Add many_sections_define.h.
14344 (many_sections_define.h): New target.
14345 (BUILT_SOURCES): Add many_sections_check.h.
14346 (many_sections_check.h): New target.
14347 (check_PROGRAMS): Add many_sections_r_test.
14348 (many_sections_r_test_SOURCES): Define.
14349 (many_sections_r_test_DEPENDENCIES): Define.
14350 (many_sections_r_test_LDFLAGS): Define.
14351 (many_sections_r_test_LDADD): Define.
14352 (many_sections_r_test.o): New target.
14353 * testsuite/Makefile.in: Rebuild.
14354
14355 2008-04-17 Cary Coutant <ccoutant@google.com>
14356
14357 * errors.cc (Errors::info): New function.
14358 (gold_info): New function.
14359 * errors.h (Errors::info): New function.
14360 * gold.h (gold_info): New function.
14361 * object.cc (Input_objects::add_object): Print trace output.
14362 * options.cc (options::parse_set): New function.
14363 (General_options::parse_wrap): Deleted.
14364 (General_options::General_options): Deleted initializer.
14365 * options.h (options::String_set): New typedef.
14366 (options::parse_set): New function.
14367 (DEFINE_set): New macro.
14368 (General_options::wrap): Changed to use DEFINE_set. Changed
14369 callers of any_wrap_symbols and is_wrap_symbol.
14370 (General_options::trace, General_options::trace_symbol):
14371 New options.
14372 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14373 (General_options::wrap_symbols_): Deleted.
14374 * symtab.cc (Symbol_table::add_from_object): Print trace output.
14375
14376 2008-04-17 David S. Miller <davem@davemloft.net>
14377
14378 * options.cc (General_options::parse_V): New function.
14379 * options.h: Add entries for -V and -Qy.
14380
14381 2008-04-17 Ian Lance Taylor <iant@google.com>
14382
14383 * common.cc (Symbol_table::allocate_commons): Remove options
14384 parameter. Change caller.
14385 (Symbol_table::do_allocate_commons): Remove options parameter.
14386 Change caller. Just call do_allocate_commons_list twice.
14387 (Symbol_table::do_allocate_commons_list): New function, broken out
14388 of do_allocate_commons.
14389 * common.h (class Allocate_commons_task): Remove options_ field.
14390 Update constructor.
14391 * symtab.cc (Symbol_table::Symbol_table): Initialize
14392 tls_commons_.
14393 (Symbol_table::add_from_object): Put TLS common symbols on
14394 tls_commons_ list.
14395 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14396 which are IN_OUTPUT_DATA.
14397 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
14398 allocate_commons and do_allocate_commons declarations. Declare
14399 do_allocate_commons_list.
14400 * gold.cc (queue_middle_tasks): Update creation of
14401 Allocate_commons_task to not pass options.
14402 * testsuite/Makefile.am (INCLUDES): Add -I.. .
14403 (TLS_TEST_C_FLAGS): New variable.
14404 (tls_test_c_pic.o): New target.
14405 (tls_test_shared.so): Link in tls_test_c_pic.o.
14406 (tls_test_c_pic_ie.o): New target.
14407 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14408 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14409 (tls_test_c.o): New target.
14410 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14411 (tls_pic_test_LDADD): Likewise.
14412 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14413 (tls_shared_gd_to_ie_test_LDADD): Likewise.
14414 (tls_test_c_gnu2.o): New target.
14415 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14416 tls_test_c_gnu2.o.
14417 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14418 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14419 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14420 * testsuite/tls_test.cc: Include "config.h".
14421 (t_last): Call t11_last.
14422 * testsuite/tls_test.h (t11, t11_last): Declare.
14423 * testsuite/tls_test_c.c: New file.
14424 * testsuite/tls_test_main.cc (thread_routine): Call t11.
14425 * configure.ac: Check for OpenMP support.
14426 * configure, config.in, Makefile.in: Rebuild.
14427 * testsuite/Makefile.in: Rebuild.
14428
14429 2008-04-16 Cary Coutant <ccoutant@google.com>
14430
14431 * i386.cc (Target_i386::define_tls_base_symbol): New function.
14432 (Target_i386::tls_base_symbol_defined_): New field.
14433 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14434 (Target_i386::Scan::global): Likewise.
14435 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14436 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14437 (Target_x86_64::tls_base_symbol_defined_): New field.
14438 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14439 (Target_x86_64::Scan::global): Likewise.
14440
14441 2008-04-16 Cary Coutant <ccoutant@google.com>
14442
14443 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14444 (Symbol::needs_plt_entry): Allow weak undefined symbols.
14445 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14446 building shared libraries.
14447 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14448 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14449 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14450 * testsuite/Makefile.in: Rebuild.
14451 * testsuite/weak_undef.h: New file.
14452 * testsuite/weak_undef_file1.cc: Add extra test cases.
14453 * testsuite/weak_undef_file2.cc: Likewise.
14454 * testsuite/weak_undef_test.cc: Likewise.
14455
14456 2008-04-16 David S. Miller <davem@davemloft.net>
14457
14458 * sparc.cc (Target_sparc::Scan): Change from struct to class.
14459 Add issued_non_pic_error_ field. Declare check_non_pic.
14460 (Target_sparc::Scan::check_non_pic): New function.
14461 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14462 (Target_sparc::Scan::global): Likewise.
14463
14464 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14465 * configure: Rebuild.
14466
14467 * options.h (DEFINE_enable): New macro.
14468 (new_dtags): New enable option.
14469 (initfirst, interpose, loadfltr, nodefaultlib,
14470 nodelete, nodlopen, nodump): New -z options.
14471 * layout.cc (Layout:finish_dynamic_section): If new
14472 dtags enabled, emit DT_RUNPATH. Also, emit a
14473 DT_FLAGS_1 containing any specified -z flags.
14474
14475 2008-04-16 Ian Lance Taylor <iant@google.com>
14476
14477 * copy-relocs.cc: New file.
14478 * copy-relocs.h: New file.
14479 * reloc.cc: Remove Copy_relocs code.
14480 * reloc.h: Likewise.
14481 * reloc-types.h (struct Reloc_types) [both versions]: Add
14482 get_reloc_addend_noerror.
14483 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14484 variants of add_global which take an addend which must be zero.
14485 * i386.cc: Include "copy-relocs.h".
14486 (class Target_i386): Change type of copy_relocs_ to variable,
14487 update initializer.
14488 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14489 Change all callers.
14490 (Target_i386::do_finalize_sections): Change handling of
14491 copy_relocs_.
14492 * sparc.cc: Include "copy-relocs.h".
14493 (class Target_sparc): Change type of copy_relocs_ to variable,
14494 update initializer.
14495 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14496 Change all callers.
14497 (Target_sparc::do_finalize_sections): Change handling of
14498 copy_relocs_.
14499 * x86_64.cc: Include "copy-relocs.h".
14500 (class Target_x86_64): Change type of copy_relocs_ to variable,
14501 update initializer.
14502 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14503 class. Change all callers.
14504 (Target_x86_64::do_finalize_sections): Change handling of
14505 copy_relocs_.
14506 * Makefile.am (CCFILES): Add copy-relocs.cc.
14507 (HFILES): Add copy-relocs.h.
14508
14509 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14510
14511 * testsuite/script_test_4.sh: Permit leading zeroes.
14512
14513 2008-04-15 Ian Lance Taylor <iant@google.com>
14514
14515 * script-sections.cc (Script_sections::create_segments): Use
14516 header_size_adjustment even when there is enough room for the
14517 headers.
14518 * testsuite/script_test_4.sh: New file.
14519 * testsuite/script_test_4.t: New file.
14520 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14521 (check_DATA): Add script_test_4.stdout.
14522 (MOSTLYCLEANFILES): Likewise.
14523 (script_test_4): New target.
14524 (script_test_4.stdout): New target.
14525 * testsuite/Makefile.in: Rebuild.
14526
14527 * sparc.cc: Add definitions for Output_data_plt_sparc class
14528 constants.
14529
14530 2008-04-14 David S. Miller <davem@davemloft.net>
14531
14532 * sparc.cc: New file.
14533 * Makefile.am (TARGETSOURCES): Add sparc.cc
14534 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14535 * configure.tgt: Document targ_extra_size and
14536 targ_extra_big_endian. Add entries for sparc-* and
14537 sparc64-*.
14538 * configure.ac: Handle targ_extra_size and
14539 targ_extra_big_endian.
14540 * Makefile.in: Rebuild.
14541 * configure: Likewise.
14542 * po/POTFILES.in: Likewise.
14543 * po/gold.pot: Likewise.
14544
14545 2008-04-14 Ian Lance Taylor <iant@google.com>
14546
14547 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14548 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14549 in the name/type/flags to section mapping. Don't call
14550 allocate_output_section.
14551 (Layout::choose_output_section): Change parameter from adjust_name
14552 to is_input_section. Don't permit input sections after sections
14553 are attached to segments. Don't call allocate_output_section.
14554 (Layout::layout_eh_frame): Call update_flags_for_input_section,
14555 not write_enable_output_section.
14556 (Layout::make_output_section): Don't push to
14557 unattached_section_list_ nor call attach_to_segment. Call
14558 attach_section_to_segment if sections are attached.
14559 (Layout::attach_sections_to_segments): New function.
14560 (Layout::attach_section_to_segment): New function.
14561 (Layout::attach_allocated_section_to_segment): Rename from
14562 attach_to_segment. Remove flags parameter.
14563 (Layout::allocate_output_section): Remove function.
14564 (Layout::write_enable_output_section): Remove function.
14565 * layout.h (class Layout): Update for above changes. Add new
14566 field sections_are_attached_.
14567 * output.h (Output_section::update_flags_for_input_section): New
14568 function.
14569 * output.cc (Output_section::add_input_section): Call
14570 update_flags_for_input_section.
14571 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14572
14573 2008-04-11 Cary Coutant <ccoutant@google.com>
14574
14575 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14576 thought unnecessary.
14577 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14578
14579 2008-04-11 Ian Lance Taylor <iant@google.com>
14580
14581 * output.h (class Output_section_data): Remove inline definition
14582 of set_addralign.
14583 * output.cc (Output_section_data::set_addralign): New function.
14584
14585 2008-04-11 Cary Coutant <ccoutant@google.com>
14586
14587 Add support for TLS descriptors for i386 and x86_64.
14588 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14589 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14590 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14591 GOT_TYPE_TLS_DESC.
14592 (Target_i386::got_mod_index_entry): Remove unnecessary code.
14593 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14594 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
14595 relocations.
14596 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14597 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14598 Fix problem with initial-exec relocations.
14599 (Target_i386::Relocate::relocate_tls): Likewise.
14600 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14601 relaxation.
14602 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14603 support for section-plus-offset dynamic table entries.
14604 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14605 (Output_data_dynamic::Dynamic_entry): Add support for
14606 section-plus-offset dynamic table entries.
14607 (Output_data_dynamic::Classification): Likewise.
14608 (Output_data_dynamic::classification_): Renamed offset_.
14609 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14610 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14611 (Target_x86_64::make_plt_section): New function.
14612 (Target_x86_64::reserve_tlsdesc_entries): New function.
14613 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14614 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14615 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14616 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14617 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14618 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14619 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14620 add extra PLT entry for TLS descriptors.
14621 (Output_data_plt_x86_64::got_): New field.
14622 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14623 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14624 fields.
14625 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14626 descriptors.
14627 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14628 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14629 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14630 R_386_TLS_DESC_CALL relocations.
14631 (Target_x86_64::Scan::global): Likewise.
14632 (Target_x86_64::do_finalize_sections): Add dynamic table entries
14633 for TLS descriptors.
14634 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14635 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14636 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14637 GD-to-IE relaxation.
14638 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14639 and TLS_DESCRIPTORS.
14640 * Makefile.in: Rebuild.
14641 * configure: Rebuild.
14642 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14643 (tls_test_shared2.so): New target.
14644 (tls_shared_gd_to_ie_test_SOURCES): New variable.
14645 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14646 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14647 (tls_shared_gd_to_ie_test_LDADD): New variable.
14648 (tls_shared_gnu2_gd_to_ie_test): New target.
14649 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14650 New targets.
14651 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14652 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14653 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14654 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14655 (tls_shared_gnu2_test): New target.
14656 (tls_test_gnu2_shared.so): New target.
14657 (tls_shared_gnu2_test_SOURCES): New variable.
14658 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14659 (tls_shared_gnu2_test_LDFLAGS): New variable.
14660 (tls_shared_gnu2_test_LDADD): New variable.
14661 * testsuite/Makefile.in: Rebuild.
14662 * testsuite/Makefile.
14663
14664 2008-04-11 Ian Lance Taylor <iant@google.com>
14665
14666 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14667 justsyms.t.
14668 * testsuite/Makefile.in: Rebuild.
14669
14670 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14671 long.
14672 * testsuite/script_test_2.cc (main): Adjust test.
14673
14674 2008-04-11 David S. Miller <davem@davemloft.net>
14675 Ian Lance Taylor <iant@google.com>
14676
14677 * options.h (General_options): Add entries for '-Y' and
14678 '-relax'.
14679 * options.cc (General_options:finalize): If -Y was used, add those
14680 entries to the library path instead of the default "/lib" and
14681 "/usr/lib".
14682
14683 2008-04-11 David S. Miller <davem@davemloft.net>
14684
14685 * testsuite/justsyms.t: Start at 0x100.
14686 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14687 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14688 long.
14689 * testsuite/script_test_2.cc: Adjust string and section length
14690 checks.
14691
14692 2008-04-09 Ian Lance Taylor <iant@google.com>
14693
14694 PR gold/5996
14695 * script-sections.cc (Sections_element::allocate_to_segment): Add
14696 orphan parameter.
14697 (Output_section_definition::allocate_to_segment): Likewise.
14698 (Orphan_output_section::allocate_to_segment): Likewise.
14699 (Script_sections::attach_sections_using_phdrs_clause): Don't
14700 propagate non-PT_LOAD segments to orphan sections.
14701 * testsuite/Makefile.am (script_test_3.stdout): Generate using
14702 readelf rather than objdump.
14703 * testsuite/script_test_3.sh: Adjust accordingly. Test that
14704 .interp section and PT_INTERP segment are the same size.
14705 * testsuite/Makefile.in: Rebuild.
14706
14707 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14708 aliases for symbols defined in the same object.
14709 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14710 (weak_alias_test_SOURCES): New variable.
14711 (weak_alias_test_DEPENDENCIES): New variable.
14712 (weak_alias_test_LDFLAGS): New variable.
14713 (weak_alias_test_LDADD): New variable.
14714 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14715 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14716 (weak_alias_test_3.o): New target.
14717 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14718 * testsuite/weak_alias_test_main.cc: New file.
14719 * testsuite/weak_alias_test_1.cc: New file.
14720 * testsuite/weak_alias_test_2.cc: New file.
14721 * testsuite/weak_alias_test_3.cc: New file.
14722
14723 2008-04-08 Ian Lance Taylor <iant@google.com>
14724
14725 * options.h (class General_options): Add --noinhibit-exec option.
14726 * main.cc (main): Check --noinhibit-exec.
14727
14728 * options.h (class General_options): Define --wrap as a special
14729 option. Add wrap_symbols_ field.
14730 (General_options::any_wrap_symbols): New function.
14731 (General_options::is_wrap_symbol): New function.
14732 * options.cc (General_options::parse_wrap): New function.
14733 (General_options::General_options): Initialize wrap_symbols_.
14734 * symtab.cc (Symbol_table::wrap_symbol): New function.
14735 (Symbol_table::add_from_object): Handle --wrap.
14736 * symtab.h (class Symbol_table): Declare wrap_symbol.
14737 * target.h (Target::wrap_char): New function.
14738 (Target::Target_info): Add wrap_char field.
14739 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14740 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14741 * testsuite/testfile.cc (Target_test::test_target_info):
14742 Likewise.
14743
14744 * errors.cc (Errors::undefined_symbol): Mention symbol version if
14745 there is one.
14746
14747 * layout.h (class Layout): Add added_eh_frame_data_ field.
14748 * layout.cc (Layout::Layout): Initialize new field.
14749 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14750 output section until we find a section we merged successfully.
14751 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14752 that the size be non-zero.
14753
14754 * merge.cc (Object_merge_map::get_output_offset): Remove inline
14755 qualifier.
14756
14757 2008-04-08 Craig Silverstein <csilvers@google.com>
14758
14759 * configure.ac: Export new conditional variable HAVE_ZLIB.
14760 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14761 on HAVE_ZLIB.
14762 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14763 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14764
14765 2008-04-07 Ian Lance Taylor <iant@google.com>
14766
14767 * version.cc (version_string): Set to "1.5".
14768
14769 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14770 Add issued_non_pic_error_ field. Declare check_non_pic.
14771 (Target_x86_64::Scan::check_non_pic): New function.
14772 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14773 (Target_x86_64::Scan::global): Likewise.
14774
14775 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14776 addend parameter. Change caller. Handle merge sections.
14777 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14778 Address to Addend. Don't add in the result of
14779 local_section_offset, pass down the addend and use the returned
14780 value.
14781 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14782 Update declarations of local_section_offset and symbol_value.
14783 * testsuite/two_file_test_1.cc (t18): New function.
14784 * testsuite/two_file_test_2.cc (f18): New function.
14785 * testsuite/two_file_test_main.cc (main): Call t18.
14786 * testsuite/two_file_test.h (t18, f18): Declare.
14787
14788 * configure.ac: Don't test for objdump, c++filt, or readelf.
14789 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14790 conditionals.
14791 (TEST_READELF): New variable.
14792 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14793 (check_PROGRAMS): Add two_file_strip_test.
14794 (two_file_strip_test): New target.
14795 (check_PROGRAMS): Add two_file_same_shared_strip_test.
14796 (two_file_same_shared_strip_test_SOURCES): New variable.
14797 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14798 (two_file_same_shared_strip_test_LDFLAGS): New variable.
14799 (two_file_same_shared_strip_test_LDADD): New variable.
14800 (two_file_shared_strip.so): New target.
14801 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14802 (ver_test_5.syms, ver_test_7.syms): Likewise.
14803 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14804 (strip_test_3.stdout): Use TEST_OBJDUMP.
14805 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14806
14807 2008-04-04 Cary Coutant <ccoutant@google.com>
14808
14809 * symtab.h (Symbol::is_weak_undefined): New function.
14810 (Symbol::is_strong_undefined): New function.
14811 (Symbol::is_absolute): New function.
14812 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14813 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14814 absolute symbols.
14815 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14816 (weak_undef_test): New target.
14817 * testsuite/Makefile.in: Rebuild.
14818 * testsuite/weak_undef_file1.cc: New file.
14819 * testsuite/weak_undef_file2.cc: New file.
14820 * testsuite/weak_undef_test.cc: New file.
14821
14822 2008-04-03 Craig Silverstein <csilvers@google.com>
14823
14824 * compressed_output.h (class Output_compressed_section): Use
14825 unsigned buffer.
14826 * compressed_output.cc (zlib_compress): Use unsigned buffers,
14827 add zlib header.
14828 (zlib_compressed_suffix): Removed.
14829 (Output_compressed_section::set_final_data_size): Use unsigned
14830 buffers.
14831 * testsuite/Makefile.am (flagstest_compress_debug_sections):
14832 Fix linker invocation.
14833 (flagstest_o_specialfile_and_compress_debug_sections):
14834 Likewise.
14835 * testsuite/Makefile.in: Regenerated.
14836
14837 2008-04-02 David S. Miller <davem@davemloft.net>
14838
14839 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14840 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14841
14842 2008-04-02 Craig Silverstein <csilvers@google.com>
14843
14844 * TODO: New file.
14845
14846 2008-04-02 Ian Lance Taylor <iant@google.com>
14847
14848 * fileread.cc (File_read::find_view): Add byteshift and vshifted
14849 parameters. Update for new key type to views_. Change all
14850 callers.
14851 (File_read::read): Adjust for byteshift in returned view.
14852 (File_read::add_view): New function, broken out of
14853 find_and_make_view.
14854 (File_read::make_view): New function, broken out of
14855 find_and_make_view.
14856 (File_read::find_or_make_view): Add offset and aligned
14857 parameters. Rewrite accordingly. Change all callers.
14858 (File_read::get_view): Add offset and aligned parameters. Adjust
14859 for byteshift in return value.
14860 (File_read::get_lasting_view): Likewise.
14861 * fileread.h (class File_read): Update declarations.
14862 (class File_read::View): Add byteshift_ field. Add byteshift to
14863 constructor. Add byteshift method.
14864 * archive.h (Archive::clear_uncached_views): New function.
14865 (Archive::get_view): Add aligned parameter. Change all callers.
14866 * object.h (Object::get_view): Add aligned parameter. Change all
14867 callers.
14868 (Object::get_lasting_view): Likewise.
14869
14870 * fileread.cc (File_read::release): Don't call clear_views if
14871 there are multiple objects.
14872 * fileread.h (File_read::clear_uncached_views): New function.
14873 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14874 on the archive.
14875
14876 2008-03-31 Cary Coutant <ccoutant@google.com>
14877
14878 Add thin archive support.
14879 * archive.cc (Archive::armagt): New const.
14880 (Archive::setup): Remove task parameter and calls to unlock.
14881 (Archive::unlock_nested_archives): New function.
14882 (Archive::read_header): Add nested_off parameter. Change
14883 all callers.
14884 (Archive::interpret_header): Likewise.
14885 (Archive::include_all_members): Change to handle thin
14886 archives.
14887 (Archive::include_member): Likewise.
14888 * archive.h (Archive::Archive): Add new parameters and
14889 initializers.
14890 (Archive::armagt): New const.
14891 (Archive::setup): Remove task parameter.
14892 (Archive::unlock_nested_archives): New function.
14893 (Archive::read_header): Add nested_off parameter.
14894 (Archive::interpret_header): Likewise.
14895 (Archive::Nested_archive_table): New typedef.
14896 (Archive::is_thin_archive_): New field.
14897 (Archive::nested_archives_): New field.
14898 (Archive::options_): New field.
14899 (Archive::dirpath_): New field.
14900 (Archive::task_): New field.
14901 * readsyms.cc (Read_symbols::do_read_symbols): Add check
14902 for thin archives. Pass additional parameters to
14903 Archive::Archive. Unlock the archive file after calling
14904 Archive::setup.
14905
14906 2008-03-29 Ian Lance Taylor <iant@google.com>
14907
14908 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14909 version symbol to be local.
14910 * testsuite/ver_test_4.sh: New file.
14911 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14912 (check_DATA): Add ver_test_4.syms.
14913 (ver_test_4.syms): New target.
14914 * testsuite/Makefile.in: Rebuild.
14915
14916 * output.cc
14917 (Output_section::Input_section_sort_entry::has_priority): New
14918 function.
14919 (Output_section::Input_section_sort_entry::match_file_name): New
14920 function.
14921 (Output_section::Input_section_sort_entry::match_section_name):
14922 Remove.
14923 (Output_section::Input_section_sort_entry::match_section_name_prefix):
14924 Remove.
14925 (Output_section::Input_section_sort_entry::match_section_file):
14926 Remove.
14927 (Output_section::Input_section_sort_compare::operator()): Rewrite
14928 using new Input_section_sort_entry functions. Sort crtbegin and
14929 crtend first. Sort sections with no priority before sections with
14930 a priority.
14931 * testsuite/initpri1.c (d3): Check j != 4.
14932 (cd5): New constructor/destructor function.
14933 (main): Check j != 2.
14934
14935 * symtab.cc (Symbol_table::add_from_object): If we don't use the
14936 new symbol when resolving, don't call set_is_default.
14937 * testsuite/ver_test_7.cc: New file.
14938 * testsuite/ver_test_7.sh: New file.
14939 * testsuite/Makefile.am (ver_test_7.so): New target.
14940 (ver_test_7.o): New target.
14941 (check_SCRIPTS): Add ver_test_7.sh.
14942 (check_DATA): Add ver_test_7.syms.
14943 (ver_test_7.syms): New target.
14944
14945 2008-03-28 Ian Lance Taylor <iant@google.com>
14946
14947 * layout.cc (Layout::layout): If we see an input section with a
14948 name that needs sorting, set the must_sort flag for the output
14949 section.
14950 (Layout::make_output_section): If the name of the output section
14951 indicates that it might require sorting, set the may_sort flag.
14952 * output.h (Output_section::may_sort_attached_input_sections): New
14953 function.
14954 (Output_section::set_may_sort_attached_input_sections): New
14955 function.
14956 (Output_section::must_sort_attached_input_sections): New
14957 function.
14958 (Output_section::set_must_sort_attached_input_sections): New
14959 function.
14960 (class Output_section): Declare Input_section_sort_entry. Define
14961 Input_section_sort_compare. Declare
14962 sort_attached_input_sections. Add new fields:
14963 may_sort_attached_input_sections_,
14964 must_sort_attached_input_sections_,
14965 attached_input_sections_are_sorted_.
14966 * output.cc (Output_section::Output_section): Initialize new
14967 fields.
14968 (Output_section::add_input_section): Add an entry to
14969 input_sections_ if may_sort or must_sort are true.
14970 (Output_section::set_final_data_size): Call
14971 sort_attached_input_sections if necessary.
14972 (Output_section::Input_section_sort_entry): Define new class.
14973 (Output_section::Input_section_sort_compare::operator()): New
14974 function.
14975 (Output_section::sort_attached_input_sections): New function.
14976 * configure.ac: Check whether the compiler supports constructor
14977 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
14978 * testsuite/initpri1.c: New file.
14979 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14980 CONSTRUCTOR_PRIORITY.
14981 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14982 (initpri1_LDFLAGS): New variable.
14983 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14984
14985 2008-03-27 Ian Lance Taylor <iant@google.com>
14986
14987 * common.cc (Sort_commons::operator): Correct sorting algorithm.
14988 * testsuite/common_test_1.c: New file.
14989 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14990 (common_test_1_SOURCES): New variable.
14991 (common_test_1_DEPENDENCIES): New variable.
14992 (common_test_1_LDFLAGS): New variable.
14993
14994 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14995 and commons_ correctly when NAME/VERSION does not override
14996 NAME/NULL.
14997 * testsuite/ver_test_6.c: New file.
14998 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14999 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15000 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15001
15002 2008-03-26 Ian Lance Taylor <iant@google.com>
15003
15004 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15005 of an undefined symbol from a version script.
15006 * testsuite/Makefile.am (ver_test_5.so): New target.
15007 (ver_test_5.o): New target.
15008 (check_SCRIPTS): Add ver_test_5.sh.
15009 (check_DATA): Add ver_test_5.syms.
15010 (ver_test_5.syms): New target.
15011 * testsuite/ver_test_5.cc: New file.
15012 * testsuite/ver_test_5.script: New file.
15013 * testsuite/ver_test_5.sh: New file.
15014 * Makefile.in, testsuite/Makefile.in: Rebuild.
15015
15016 PR gold/5986
15017 Fix problems building gold with gcc 4.3.0.
15018 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15019 (gold_error_at_location, gold_warning_at_location): Use it.
15020 * configure.ac: Check whether we can compile and use a template
15021 function with a printf attribute.
15022 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15023 when jumping over bytes.
15024 * object.cc: Instantiate Object::read_section_data.
15025 * debug.h: Include <cstring>
15026 * dwarf_reader.cc: Include <algorithm>
15027 * main.cc: Include <cstring>.
15028 * options.cc: Include <cstring>.
15029 * output.cc: Include <cstring>.
15030 * script.cc: Include <cstring>.
15031 * script.h: Include <string>.
15032 * symtab.cc: Include <cstring> and <algorithm>.
15033 * target-select.cc: Include <cstring>.
15034 * version.cc: Include <string>.
15035 * testsuite/testmain.cc: Include <cstdlib>.
15036 * configure, config.in: Rebuild.
15037
15038 2008-03-25 Ian Lance Taylor <iant@google.com>
15039
15040 * options.cc: Include "../bfd/bfdver.h".
15041 (options::help): Print bug reporting address.
15042
15043 * version.cc (print_version): Adjust output for current value of
15044 BFD_VERSION_STRING.
15045
15046 * NEWS: New file.
15047
15048 * options.cc (options::help): Print list of supported targets.
15049 * target-select.h: Include <vector>.
15050 (class Target_selector): Make machine_, size_, and is_big_endian_
15051 fields const. Add bfd_name_ and instantiated_target_ fields.
15052 (Target_selector::Target_selector): Add bfd_name parameter.
15053 (Target_selector::recognize): Make non-virtual, call
15054 do_recognize.
15055 (Target_selector::recognize_by_name): Make non-virtual, call
15056 do_recognize_by_name.
15057 (Target_selector::supported_names): New function.
15058 (Target_selector::bfd_name): New function.
15059 (Target_selector::do_instantiate_target): New pure virtual
15060 function.
15061 (Target_selector::do_recognize): New virtual function.
15062 (Target_selector::do_recognize_by_name): New virtual function.
15063 (Target_selector::instantiate_target): New private function.
15064 (supported_target_names): Declare.
15065 * target-select.cc (Target_selector::Target_selector): Update for
15066 new parameter and fields.
15067 (select_target_by_name): Check that the name matches before
15068 calling recognize_by_name.
15069 (supported_target_names): New function.
15070 * i386.cc (class Target_selector_i386): Update Target_selector
15071 constructor call. Remove recognize and recognize_by_name. Add
15072 do_instantiate_target.
15073 * x86_64.cc (class Target_selector_x86_64): Likewise.
15074 * testsuite/testfile.cc (class Target_selector_test): Update for
15075 changes to Target_selector.
15076
15077 * README: Rewrite, with some notes on unsupported features.
15078
15079 2008-03-24 Cary Coutant <ccoutant@google.com>
15080
15081 * i386.cc (Target_i386::Got_type): New enum declaration.
15082 (Target_i386::Scan::local): Updated callers of Output_data_got
15083 member functions.
15084 (Target_i386::Scan::global): Likewise.
15085 (Target_i386::Relocate::relocate): Likewise.
15086 (Target_i386::Relocate::relocate_tls): Likewise.
15087 * object.h (Got_offset_list): New class.
15088 (Sized_relobj::local_has_got_offset): Added got_type parameter.
15089 (Sized_relobj::local_got_offset): Likewise.
15090 (Sized_relobj::set_local_got_offset): Likewise.
15091 (Sized_relobj::local_has_tls_got_offset): Removed.
15092 (Sized_relobj::local_tls_got_offset): Removed.
15093 (Sized_relobj::set_local_tls_got_offset): Removed.
15094 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15095 * output.cc (Output_data_got::add_global): Added got_type parameter.
15096 (Output_data_got::add_global_with_rel): Likewise.
15097 (Output_data_got::add_global_with_rela): Likewise.
15098 (Output_data_got::add_global_pair_with_rel): New function.
15099 (Output_data_got::add_global_pair_with_rela): New function.
15100 (Output_data_got::add_local): Added got_type parameter.
15101 (Output_data_got::add_local_with_rel): Likewise.
15102 (Output_data_got::add_local_with_rela): Likewise.
15103 (Output_data_got::add_local_pair_with_rel): New function.
15104 (Output_data_got::add_local_pair_with_rela): New function.
15105 (Output_data_got::add_global_tls): Removed.
15106 (Output_data_got::add_global_tls_with_rel): Removed.
15107 (Output_data_got::add_global_tls_with_rela): Removed.
15108 (Output_data_got::add_local_tls): Removed.
15109 (Output_data_got::add_local_tls_with_rel): Removed.
15110 (Output_data_got::add_local_tls_with_rela): Removed.
15111 * output.h (Output_data_got::add_global): Added got_type parameter.
15112 (Output_data_got::add_global_with_rel): Likewise.
15113 (Output_data_got::add_global_with_rela): Likewise.
15114 (Output_data_got::add_global_pair_with_rel): New function.
15115 (Output_data_got::add_global_pair_with_rela): New function.
15116 (Output_data_got::add_local): Added got_type parameter.
15117 (Output_data_got::add_local_with_rel): Likewise.
15118 (Output_data_got::add_local_with_rela): Likewise.
15119 (Output_data_got::add_local_pair_with_rel): New function.
15120 (Output_data_got::add_local_pair_with_rela): New function.
15121 (Output_data_got::add_global_tls): Removed.
15122 (Output_data_got::add_global_tls_with_rel): Removed.
15123 (Output_data_got::add_global_tls_with_rela): Removed.
15124 (Output_data_got::add_local_tls): Removed.
15125 (Output_data_got::add_local_tls_with_rel): Removed.
15126 (Output_data_got::add_local_tls_with_rela): Removed.
15127 * resolve.cc (Symbol::override_base_with_special): Removed
15128 reference to has_got_offset_ field.
15129 * symtab.cc (Symbol::init_fields): Replaced initialization
15130 of got_offset_ with got_offsets_. Removed initialization
15131 of has_got_offset_
15132 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15133 (Symbol::got_offset): Likewise.
15134 (Symbol::set_got_offset): Likewise.
15135 (Symbol::has_tls_got_offset): Removed.
15136 (Symbol::tls_got_offset): Removed.
15137 (Symbol::set_tls_got_offset): Removed.
15138 (Symbol::got_offset_): Removed.
15139 (Symbol::tls_mod_got_offset_): Removed.
15140 (Symbol::tls_pair_got_offset_): Removed.
15141 (Symbol::got_offsets_): New field.
15142 (Symbol::has_got_offset): Removed.
15143 (Symbol::has_tls_mod_got_offset): Removed.
15144 (Symbol::has_tls_pair_got_offset): Removed.
15145 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15146 (Target_x86_64::Scan::local): Updated callers of Output_data_got
15147 member functions.
15148 (Target_x86_64::Scan::global): Likewise.
15149 (Target_x86_64::Relocate::relocate): Likewise.
15150 (Target_x86_64::Relocate::relocate_tls): Likewise.
15151
15152 2008-03-25 Ben Elliston <bje@au.ibm.com>
15153
15154 * yyscript.y: Fix spelling error in comment.
15155
15156 2008-03-24 Ian Lance Taylor <iant@google.com>
15157
15158 * options.h (class General_options): Define build_id option.
15159 * layout.h (class Layout): Declare write_build_id, create_note,
15160 create_build_id. Add build_id_note_ member.
15161 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15162 "libiberty.h", "md5.h", "sha1.h".
15163 (Layout::Layout): Initialize eh_frame_data_,
15164 eh_frame_hdr_section_, and build_id_note_.
15165 (Layout::finalize): Call create_build_id.
15166 (Layout::create_note): New function, broken out of
15167 Layout::create_gold_note.
15168 (Layout::create_gold_note): Call create_note.
15169 (Layout::create_build_id): New function.
15170 (Layout::write_build_id): New function.
15171 (Close_task_runner::run): Call write_build_id.
15172
15173 * x86_64.cc: Correct license to GPLv3.
15174
15175 2008-03-23 Ian Lance Taylor <iant@google.com>
15176
15177 * options.cc: Include "demangle.h".
15178 (parse_optional_string): New function.
15179 (parse_long_option): Handle takes_optional_argument.
15180 (parse_short_option): Update dash_z initializer. Handle
15181 takes_optional_argument.
15182 (General_options::General_options): Initialize do_demangle_.
15183 (General_options::finalize): Set do_demangle_. Handle demangling
15184 style.
15185 * options.h (parse_optional_string): Declare.
15186 (struct One_option): Add optional_arg field. Update constructor.
15187 Update call constructor calls. Add takes_optional_argument
15188 function.
15189 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
15190 (DEFINE_optional_string): Define.
15191 (General_options::demangle): Change from DEFINE_bool to
15192 DEFINE_optional_string.
15193 (General_options::no_demangle): New function.
15194 (General_options::do_demangle): New function.
15195 (General_options::set_do_demangle): New function.
15196 (General_options::execstack_status_): Move definition to end of
15197 class definition.
15198 (General_options::static_): Likewise.
15199 (General_options::do_demangle_): New field.
15200 * object.cc (big_endian>::get_symbol_location_info): Call
15201 Options::do_demangle, not Options::demangle.
15202 * symtab.cc (demangle): Likewise.
15203
15204 2008-03-22 Ian Lance Taylor <iant@google.com>
15205
15206 * gold.h: Include <cstddef> and <sys/types.h>
15207 * options.h: Include <cstring>.
15208
15209 2008-03-21 Ian Lance Taylor <iant@google.com>
15210
15211 * Added source code to GNU binutils.
15212 \f
15213 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15214
15215 Copying and distribution of this file, with or without modification,
15216 are permitted in any medium without royalty provided the copyright
15217 notice and this notice are preserved.
15218
15219 Local Variables:
15220 mode: change-log
15221 left-margin: 8
15222 fill-column: 74
15223 version-control: never
15224 End:
This page took 0.3808 seconds and 4 git commands to generate.