b7f0a33500b9a06642dc57d89d46b753a3619bf2
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2015-07-21 Cary Coutant <ccoutant@gmail.com>
2
3 PR gold/18696
4 * archive.cc (Library_base::should_include_member): Don't use entry
5 point for relocatable links, or if target is not yet valid.
6 * parameters.cc (Parameters::entry): Check target_valid().
7
8 2015-07-20 Han Shen <shenhan@google.com>
9
10 Optimize erratum 843419 fix.
11
12 * aarch64.cc (AArch64_insn_utilities::is_adr): New method.
13 (AArch64_insn_utilities::aarch64_adr_encode_imm): New method.
14 (AArch64_insn_utilities::aarch64_adrp_decode_imm): New method.
15 (E843419_stub): New sub-class of Erratum_stub.
16 (AArch64_relobj::try_fix_erratum_843419_optimized): New method.
17 (AArch64_relobj::section_needs_reloc_stub_scanning): Try optimized fix.
18 (AArch64_relobj::create_erratum_stub): Add 1 argument.
19 (Target_aarch64::scan_erratum_843419_span): Pass in adrp insn offset.
20
21 2015-07-20 Han Shen <shenhan@google.com>
22
23 Fix arm elf header flags wrt hardfp bit.
24
25 * arm.cc (Target_arm::do_adjust_elf_header): Set flags into view.
26
27 2015-07-20 H.J. Lu <hongjiu.lu@intel.com>
28
29 PR gold/18689
30 * layout.cc (Layout::layout): Clear the SHF_COMPRESSED flag bit
31 from input group section for relocatable link.
32 * testsuite/Makefile.am (check_SCRIPTS): Add pr18689.sh.
33 (check_DATA): Add pr18689.stdout.
34 (MOSTLYCLEANFILES): Add pr18689a.o pr18689b.o.
35 (pr18689.stdout): New rule.
36 (pr18689a.o): Likewise.
37 (pr18689b.o): Likewise.
38 (pr18689.o): Likewise.
39 * testsuite/pr18689.c: New file.
40 * testsuite/pr18689.sh: Likewise.
41 * testsuite/Makefile.in: Regenerated.
42
43 2015-07-20 Yiran Wang <yiran@google.com>
44 Cary Coutant <ccoutant@gmail.com>
45
46 PR gold/15574
47 * resolve.cc (Symbol_table): Remove warning about references
48 from shared objects to hidden symbols.
49 * testsuite/Makefile.am (hidden_test): Add hidden_test.syms.
50 * testsuite/Makefile.in: Regenerate.
51 * testsuite/hidden_test.sh: Check dynamic symbol table; update
52 expected error messages.
53
54 2015-07-14 H.J. Lu <hongjiu.lu@intel.com>
55
56 * compressed_output.cc (Output_compressed_section::set_final_data_size):
57 Make --compress-debug-sections=zlib the same as
58 --compress-debug-sections=zlib-gabi.
59 * testsuite/Makefile.am (flagstest_compress_debug_sections.check):
60 Expect ".debug_.*" with the SHF_COMPRESSED bit, instead of
61 ".zdebug_".
62 * testsuite/Makefile.in: Regenerated.
63
64 2015-07-12 H.J. Lu <hongjiu.lu@intel.com>
65
66 PR gold/18322
67 * compressed_output.cc (zlib_compress): Add argument for
68 compression header size. Set header size to compression header
69 size if it isn't 0. Don't write out the zlib header here.
70 (Output_compressed_section::set_final_data_size): Support
71 zlib-gnu and zlib-gabi compressions. Pass compression header
72 size to zlib_compress and write out compression header. Set
73 the SHF_COMPRESSED bit for zlib-gabi compression. Otherwise
74 clear the SHF_COMPRESSED bit
75 * options.h (compress_debug_sections): Add zlib-gnu and
76 zlib-gabi.
77 * output.h (Output_section::set_flags): New.
78 * testsuite/Makefile.am (check_PROGRAMS): Add
79 flagstest_compress_debug_sections_none,
80 flagstest_compress_debug_sections_gnu and
81 flagstest_compress_debug_sections_gabi.
82 (check_DATA): Add flagstest_compress_debug_sections_none.stdout.
83 flagstest_compress_debug_sections.stdout,
84 flagstest_compress_debug_sections.cmp,
85 flagstest_compress_debug_sections.check,
86 flagstest_compress_debug_sections_gnu.stdout,
87 flagstest_compress_debug_sections_gnu.cmp,
88 flagstest_compress_debug_sections_gnu.check,
89 flagstest_compress_debug_sections_gabi.stdout,
90 flagstest_compress_debug_sections_gabi.cmp and
91 flagstest_compress_debug_sections_gabi.check.
92 (flagstest_compress_debug_sections_none): New.
93 (flagstest_compress_debug_sections_none.stdout): Likewise.
94 (flagstest_compress_debug_sections.stdout): Likewise.
95 (flagstest_compress_debug_sections.check): Likewise.
96 (flagstest_compress_debug_sections.cmp): Likewise.
97 (flagstest_compress_debug_sections_gnu): Likewise.
98 (flagstest_compress_debug_sections_gnu.stdout): Likewise.
99 (flagstest_compress_debug_sections_gnu.check): Likewise.
100 (flagstest_compress_debug_sections_gnu.cmp): Likewise.
101 (flagstest_compress_debug_sections_gabi): Likewise.
102 (flagstest_compress_debug_sections_gabi.stdout): Likewise.
103 (flagstest_compress_debug_sections_gnu.check): Likewise.
104 (flagstest_compress_debug_sections_gnu.cmp): Likewise.
105 * testsuite/Makefile.in: Regenerated.
106
107 2015-07-12 H.J. Lu <hongjiu.lu@intel.com>
108
109 PR gold/18321
110 * compressed_output.h (decompress_input_section): Add arguments
111 for ELF class, big endian and sh_flags.
112 * compressed_output.cc (decompress_input_section): Likewise.
113 Support the SHF_COMPRESSED section.
114 * dynobj.h (Dynobj): Add elfsize and is_big_endian member
115 functions.
116 * plugin.h (Pluginobj): Likewise.
117 * layout.cc (Layout::get_output_section_flags): Also clear the
118 SHF_COMPRESSED bit.
119 * object.h (Compressed_section_info): Add flag to store sh_flags.
120 (Object): Add pure virtual elfsize and is_big_endian member
121 functions.
122 * object.cc (need_decompressed_section): Don't skip the ".zdebug"
123 prefix here.
124 (build_compressed_section_map): Check SHF_COMPRESSED for
125 uncompressed size. Store sh_flags in Compressed_section_info.
126 Pass size, big_endian and sh_flags to decompress_input_section.
127 Skip the ".debug"/".zdebug" prefix when passing section name to
128 need_decompressed_section.
129 (Sized_relobj_file<size, big_endian>::do_find_special_section):
130 Don't check ".zdebug_*" sections.
131 (Object::decompressed_section_contents): Pass ELF class, big
132 endian and sh_flags to decompress_input_section.
133 * reloc.cc (Sized_relobj_file<size, big_endian>::write_sections):
134 Likewise.
135 * testsuite/Makefile.am (check_DATA): Add
136 debug_msg_cdebug_gabi.err and gdb_index_test_2_gabi.stdout.
137 (MOSTLYCLEANFILES): Add debug_msg_cdebug_gabi.err and
138 gdb_index_test_2_gabi.stdout.
139 (debug_msg_cdebug_gabi.o): New.
140 (odr_violation1_cdebug_gabi.o): Likewise.
141 (odr_violation2_cdebug_gabi.o): Likewise.
142 (debug_msg_cdebug_gabi.err): Likewise.
143 (check_SCRIPTS): Add gdb_index_test_2_gabi.sh.
144 (gdb_index_test_cdebug_gabi.o): Likewise.
145 (gdb_index_test_2_gabi): Likewise.
146 (gdb_index_test_2_gabi.stdout): Likewise.
147 * testsuite/gdb_index_test_2_gabi.sh: New file.
148 * testsuite/Makefile.in: Regenerated.
149
150 2015-07-09 Han Shen <shenhan@google.com>
151
152 Use "gold_info" instead of "gold_warning" for erratum fix.
153
154 * aarch64.cc (Target_aarch64::scan_erratum_843419_span): Use
155 'gold_info'.
156 (Target_aarch64::scan_erratum_835769_span): USe 'gold_info'.
157
158 2015-07-09 Han Shen <shenhan@google.com>
159
160 Drop missing symbol warning for arm/aarch64.
161
162 * aarch64.cc (AArch64_relobj::scan_errata): Drop missing symbol warning.
163 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Drop missing
164 symbol warning.
165
166 2015-07-07 Han Shen <shenhan@google.com>
167
168 Make gold aarch64 accept long form of mapping symbols.
169
170 * aarch64.cc (AArch64_relobj::do_count_local_symbols): Make legal
171 of mapping symbols.
172
173 2015-06-29 Doug Kwan <dougkwan@google.com>
174
175 * testsuite/arm_bl_out_of_range.s: Align stub table so that it appears
176 at address expected by test.
177 * testsuite/arm_cortex_a8_b.s: Ditto.
178 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
179 * testsuite/arm_cortex_a8_bl.s: Ditto.
180 * testsuite/arm_cortex_a8_blx.s: Ditto.
181 * testsuite/arm_cortex_a8_local.s: Ditto.
182 * testsuite/arm_fix_v4bx.s: Ditto.
183 * testsuite/arm_unaligned_reloc.s: Ditto.
184 * testsuite/thumb_bl_out_of_range.s: Ditto.
185 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
186 * testsuite/thumb_blx_out_of_range.s: Ditto.
187
188 2015-06-29 Han Shen <shenhan@google.com>
189
190 Patch for erratum 843419 internal error.
191
192 * aarch64.cc (Erratum_stub::Insn_utilities): New typedef.
193 (Erratum_stub::update_erratum_insn): New method.
194 (Stub_table::relocate_stubs): Modified to place relocated insn.
195 (AArch64_relobj::fix_errata): Modified gold_assert.
196
197 2015-06-12 Han Shen <shenhan@google.com>
198
199 Fix erratum 835769.
200
201 * aarch64.cc (AArch64_insn_utilities::BYTES_PER_INSN): Move
202 defintion outside class definition.
203 (AArch64_insn_utilities::AARCH64_ZR): New static constant.
204 (AArch64_insn_utilities::aarch64_op31): New member.
205 (AArch64_insn_utilities::aarch64_ra): New member.
206 (AArch64_insn_utilities::aarch64_mac): New member.
207 (AArch64_insn_utilities::aarch64_mlxl): New member.
208 (ST_E_835769): New global enum member.
209 (Stub_table::relocate_stubs): Add 835769 handler.
210 (Stub_template_repertoire::Stub_template_repertoire): Install new
211 stub type.
212 (AArch64_relobj::scan_errata): This func is renamed from
213 scan_erratum_843419.
214 (AArch64_relobj::do_count_local_symbols): Add 835769 handler.
215 (AArch64_relobj::do_relocate_sections): Add 835769 handler.
216 (AArch64_relobj::scan_sections_for_stubs): Add 835769 handler.
217 (Target_aarch64::scan_erratum_835769_span): New method.
218 (Target_aarch64::create_erratum_stub): New method.
219 (Target_aarch64::is_erratum_835769_sequence): New method.
220 (Target_aarch64::scan_erratum_843419_sequence): Move part of the
221 code into create_erratum_stub.
222 * options.h (fix_cortex_a53_835769): New option.
223
224 2015-06-11 Cary Coutant <ccoutant@gmail.com>
225
226 * aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization
227 outside class body.
228 (Reloc_stub::STUB_ADDR_ALIGN): Likewise.
229
230 2015-06-11 Cary Coutant <ccoutant@gmail.com>
231
232 PR gold/17731
233 * layout.cc (corresponding_uncompressed_section_name): New function.
234 (Layout::choose_output_section): Call it.
235 * layout.h (corresponding_uncompressed_section_name): New function.
236 * script-sections.cc (Input_section_info::set_section_name): Check
237 for compressed debug section (.zdebug style).
238
239 2015-06-11 Jing Yu <jingyu@google.com>
240
241 * testsuite/Makefile.am: Add -O0 for script_test_12 test.
242 * testsuite/Makefile.in: Regenerate.
243
244 2015-06-11 Davide Italiano <dccitaliano@gmail.com>
245
246 * gold.h (is_cident): Correct typo.
247
248 2015-06-10 Han Shen <shenhan@google.com>
249 Patch for erratum-843419 (2 of 2 - fix erratum occurrences).
250
251 Now fixing for 843419 is fully functional.
252
253 The first part of the erratum fix CL is here -
254 https://sourceware.org/ml/binutils/2015-04/msg00229.html
255
256 * aarch64.cc(global enum): New constants representing stub types.
257 (Stub_template): New POD struct.
258 (Stub_template_repertoire): New class.
259 (Stub_base): New class.
260 (Erratum_stub): New class.
261 (Reloc_stub): Refactored to be a subclass of Stub_base.
262 (Reloc_stub::Stub_type): Removed.
263 (Reloc_stub::offset): Moved to Stub_base.
264 (Reloc_stub::set_offset): Moved to Stub_base.
265 (Reloc_stub::destination_address): Moved to Stub_base.
266 (Reloc_stub::set_destination_address): Moved to Stub_base.
267 (Reloc_stub::reset_destination_address): Moved to Stub_base.
268 (Reloc_stub::stub_type): Renamed and moved to Stub_base.
269 (Reloc_stub::stub_size): Renamed and moved to Stub_base.
270 (Reloc_stub::stub_insns): Renamed and moved to Stub_base.
271 (Reloc_stub::write): Moved to Stub_base.
272 (Reloc_stub::invalid_offset): Moved to Stub_base.
273 (Reloc_stub::invalid_address): Moved to Stub_base.
274 (Reloc_stub::stub_type_): Renamed and moved to Stub_base.
275 (Reloc_stub::stub_insns_): Moved to Stub_base.
276 (Reloc_stub::offset_): Moved to Stub_base.
277 (Reloc_stub::destination_address_): Moved to Stub_base.
278 (Stub_table::The_aarch64_relobj): New typedef.
279 (Stub_table::The_erratum_stub): New typedef.
280 (Stub_table::The_erratum_stub_less): New typedef.
281 (Stub_table::The_erratum_stub_set): New typedef.
282 (Stub_table::The_erratum_stub_set_iter): New typedef.
283 (Stub_table::empty): Added emptiness testing for erratum stubs.
284 (Stub_table::add_erratum_stub): New method to add an erratum stub.
285 (Stub_table::find_erratum_stub): New method.
286 (Stub_table::find_erratum_stubs_for_input_section): New method.
287 (Stub_table::erratum_stub_address): New method.
288 (Stub_table::update_date_size_changed_p): Modified to handle erratum stubs.
289 (Stub_table::do_addralign): Modified to handle erratum stubs.
290 (Stub_table::erratum_stubs_): New member.
291 (Stub_table::erratum_stub_size_): New member.
292 (Stub_table::relocate_stubs): Modified to handle erratum stubs.
293 (Stub_table::do_write): Modified to handle erratum stubs.
294 (AArch64_relobj::The_erratum_stub): New typedef.
295 (AArch64_relobj::Erratum_stub_set_iter): New typedef.
296 (AArch64_relobj::fix_errata): New method.
297 (Target_aarch64::The_reloc_stub_type): Removed.
298 (Target_aarch64::The_erratum_stub): New typede.
299 (AArch64_relocate_functions::construct_b): New method.
300
301 2015-06-08 Nick Clifton <nickc@redhat.com>
302
303 * po/fr.po: New French Translation.
304
305 2015-06-07 Cary Coutant <ccoutant@gmail.com>
306
307 PR gold/18288
308 * resolve.cc (symbol_to_bits): Remove type parameter; adjust all
309 callers. Don't use STT_COMMON to check for common symbols.
310 (Symbol_table::resolve): Warn if relocatable object has STT_COMMON
311 symbol that's not in a common section.
312 * symtab.h (Symbol::is_common): Don't use STT_COMMON to check for
313 common symbols.
314
315 2015-06-04 Cary Coutant <ccoutant@gmail.com>
316
317 PR gold/18200
318 * Makefile.am (diststuff): Add target.
319 * Makefile.in: Regenerate.
320
321 2015-06-04 Cary Coutant <ccoutant@gmail.com>
322
323 PR gold/17498
324 * object.cc (Sized_relobj_file::do_count_local_symbols): Discard
325 temporary locals in merge sections.
326 * options.cc (General_options::parse_discard_all): New method.
327 (General_options::parse_discard_locals): New method.
328 (General_options::parse_discard_none): New method.
329 (General_options::General_options): Initialize discard_locals_.
330 * options.h (--discard-all): Convert to special option.
331 (--discard-locals): Likewise.
332 (--discard-none): New option.
333 (General_options::discard_all): New method.
334 (General_options::discard_locals): New method.
335 (General_options::discard_sec_merge): New method.
336 (General_options::Discard_locals): New enum.
337 (General_options::discard_locals_): New data member.
338
339 2015-06-03 Cary Coutant <cary@google.com>
340
341 * script-sections.cc (Script_sections::Script_sections): Initialize
342 segments_created_.
343 (Script_sections::create_note_and_tls_segments): Set flag when
344 segments are created.
345 (Script_sections::expected_segment_count): Count PT_INTERP.
346 (Script_sections::attach_sections_using_phdrs_clause): Set flag when
347 segments are created.
348 * script-sections.h (Script_sections::segments_created_): New data
349 member.
350
351 2015-06-03 Cary Coutant <ccoutant@gmail.com>
352
353 PR gold/15370
354 * script-sections.cc
355 (Output_section_element_input::set_section_addresses): When there
356 are several patterns with no sort spec, put all sections in the same
357 bin.
358 * testsuite/Makefile.am (script_test_12): New testcase.
359 (script_test_12i): New testcase.
360 * testsuite/Makefile.in: Regenerate.
361 * testsuite/script_test_12.t: New test linker script.
362 * testsuite/script_test_12i.t: New test linker script.
363 * testsuite/script_test_12a.c: New test source file.
364 * testsuite/script_test_12b.c: New test source file.
365
366 2015-06-02 Cary Coutant <ccoutant@gmail.com>
367
368 * nacl.h (Sniff_file): Switch parameters to get_view to get an
369 aligned view.
370
371 2015-06-03 Cary Coutant <ccoutant@gmail.com>
372
373 PR gold/17819
374 * gold.cc (queue_final_tasks): When --build-id=tree, queue a
375 separate task to schedule the build id computation.
376 * layout.cc (Hash_task::Hash_task): Remove build_id_blocker,
377 add Output_file and offset.
378 (Hash_task::run): Get and release the input views.
379 (Hash_task::is_runnable): Always return NULL (always runnable).
380 (Layout::queue_build_id_tasks): Remove.
381 (Layout::write_build_id): Add array_of_hashes and size_of_hashes
382 parameters; use them instead of class members.
383 (Build_id_task_runner::run): New function.
384 (Close_task_runner::run): Pass array_of_hashes and size_of_hashes
385 to write_build_id.
386 * layout.h (Layout::queue_build_id_tasks): Remove.
387 (Layout::write_build_id): Add array_of_hashes and size_of_hashes
388 parameters.
389 (Layout::array_of_hashes_): Remove.
390 (Layout::size_of_array_of_hashes_): Remove.
391 (Layout::input_view_): Remove.
392 (Build_id_task_runner): New class.
393 (Close_task_runner::Close_task_runner): Add array_of_hashes and
394 size_of_hashes parameters.
395 (Close_task_runner::array_of_hashes_): New data member.
396 (Close_task_runner::size_of_hashes_): New data member.
397 * testsuite/Makefile.am
398 (flagstest_compress_debug_sections_and_build_id_tree): New test.
399 * testsuite/Makefile.in: Regenerate.
400
401 2015-06-01 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
402
403 * merge.cc (get_input_merge_map): Update for data structure change.
404 (get_or_make_input_merge_map): Update for data structure change.
405 * merge.h (Object_merge_map): Use a std::vector<std::pair>> instead of
406 a std::map. Remove first_shnum_, first_map_, second_shnum_, second_map_.
407
408 2015-05-16 Alan Modra <amodra@gmail.com>
409
410 * reloc.cc (Sized_relobj_file::find_functions): Use function_location.
411 * powerpc.cc (Target_powerpc::do_calls_non_split): New function.
412 (addi_12_1, addis_2_12, addis_12_1, cmpld_7_12_0): New constants.
413 (lis_0): Rename from lis_0_0.
414
415 2015-04-29 Cary Coutant <cary@google.com>
416 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
417
418 * gc.h (Garbage_collection::is_section_garbage): Change Object*
419 to Relobj*.
420 (Garbage_collection::add_reference): Likewise.
421 (Garbage_collection::gc_process_relocs): Likewise. Don't push
422 object/shndx pair onto *secvec for dynamic objects. Don't follow
423 relocations pointing to dynamic objects for GC.
424 * icf.cc (Icf::find_identical_sections): Change Object* to Relobj*.
425 (Icf::unfold_section): Likewise.
426 (Icf::is_section_folded): Likewise.
427 (Icf::get_folded_section): Likewise.
428 * icf.h: (Icf::get_folded_section): Likewise.
429 (Icf::unfold_section): Likewise.
430 (Icf::is_section_folded): Likewise.
431 (Icf::section_has_function_pointers): Likewise.
432 (Icf::set_section_has_function_pointers): Likewise.
433 * object.h (Section_id): Likewise.
434 (Const_section_id): Likewise.
435 * output.cc (Output_section::update_section_layout): Likewise.
436 * output.h: (Output_section_lookup_maps::find_relaxed_input_section):
437 Likewise.
438 * plugin.cc (update_section_order): Likewise.
439 (unique_segment_for_sections): Likewise.
440 * powerpc.cc (Powerpc_relobj::add_reference): Likewise.
441 (Target_powerpc::do_gc_add_reference): Likewise.
442 (Target_powerpc::gc_process_relocs): Likewise.
443 (Target_powerpc::do_gc_add_reference): Likewise.
444 * symtab.cc (Symbol_table::is_section_folded): Likewise.
445 (Symbol_table::gc_mark_symbol): Likewise.
446 * symtab.h: (Symbol_table::is_section_folded): Likewise.
447 * target.h: (Sized_target::gc_add_reference): Likewise.
448 (Sized_target::do_gc_add_reference): Likewise.
449
450 2015-04-29 Nick Clifton <nickc@redhat.com>
451
452 * po/fi.po: Updated Finnish translation.
453
454 2015-04-28 Alan Modra <amodra@gmail.com>
455
456 * powerpc.cc (Target_powerpc::do_dynsym_value): Use Address rather
457 than unsigned int for find_global_entry result temp. Compare
458 against invalid_address.
459 (Target_powerpc::do_plt_address_for_global): Likewise.
460 (Target_powerpc::Relocate::relocate): Likewise. Don't assert
461 on plt call stub existence for debug info. Do assert for plt
462 and global entry stub existence if an alloc section.
463
464 2015-04-28 Alan Modra <amodra@gmail.com>
465
466 * powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert
467 on missing global entry stub due to bogus debug info.
468
469 2015-04-27 Han Shen <shenhan@google.com>
470
471 * options.h (--fix-cortex-a53-843419): Rename option.
472 * aarch64.cc (AArch64_relobj::do_count_local_symbols): Use renamed
473 option.
474 (AArch64_relobj::scan_sections_for_stubs): Use renamed option.
475
476 2015-04-27 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
477
478 PR gold/18327
479 * output.cc (Output_section::is_input_address_mapped): Assume a missing
480 entry is mapped.
481 * testsuite/Makefile.am: Add the eh_test test.
482 * testsuite/Makefile.in: Regenerate.
483 * testsuite/eh_test_a.cc: New test.
484 * testsuite/eh_test_b.cc: New test.
485
486 2015-04-23 Sriraman Tallam <tmsriram@google.com>
487
488 * options.h (--weak-unresolved-symbols): New option.
489 * symtab.cc (Symbol_table::sized_write_globals): Change symbol
490 binding to weak with new option.
491 * symtab.h (is_weak_undefined): Check for new option.
492 (is_strong_undefined): Check for new option.
493 * testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
494 * testsuite/Makefile.in: Regenerate.
495 * testsuite/weak_unresolved_symbols_test.cc: New file.
496
497 2015-04-20 Ian Coolidge <icoolidge@google.com>
498
499 * symtab.cc (Symbol::should_add_dynsym_entry): Return true for
500 GNU_UNIQUE.
501
502 2015-04-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
503
504 * gc.cc (Garbage_collection::do_transitive_closure): Use back and
505 push_back.
506 * gc.h (Garbage_collection): Use a std::vector instead of a std::queue.
507 * object.cc (Sized_relobj_file::do_layout): Use push_back.
508 * powerpc.cc (process_gc_mark): Use push_back.
509 (Target_powerpc::do_gc_mark_symbol): Use push_back.
510 * symtab.cc (Symbol_table::gc_mark_symbol): Use push_back.
511
512 2015-04-16 Han Shen <shenhan@google.com>
513
514 * aarch64.cc (AArch64_insn_utilities): New utility class.
515 (AArch64_relobj::Mapping_symbol_position): New struct.
516 (AArch64_relobj::Mapping_symbol_info): New typedef.
517 (AArch64_relobj::do_count_local_symbols): New function overriding
518 parent's implementation.
519 (AArch64_relobj::mapping_symbol_info_): New member
520 (AArch64_relobj::scan_erratum_843419): New method.
521 (Target_aarch64::scan_erratum_843419_span): New method.
522 (Target_aarch64::is_erratum_843419_sequence): New method.
523 * options.h (fix_cortex_a53): New option.
524
525 2015-04-09 Cary Coutant <ccoutant@google.com>
526
527 * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
528 in a PIE link.
529 * testsuite/Makefile.am (tls_pie_test.sh): New test.
530 * testsuite/Makefile.in: Regenerate.
531 * testsuite/tls_pie_test.sh: New.
532
533 2015-04-09 Cary Coutant <ccoutant@google.com>
534
535 * debug.h (DEBUG_LOCATION): New.
536 (DEBUG_ALL): Include DEBUG_LOCATION.
537 (debug_string_to_enum): Add DEBUG_LOCATION.
538 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
539 output to print correct context.
540 (Sized_dwarf_line_info::do_addr2line): Add debug output. Return
541 up to 4 more locations at the beginning of the function.
542 * symtab.cc (Symbol_table::detect_odr_violations): Get canonical
543 result before sorting list of line numbers.
544 * testsuite/debug_msg.sh: Allow range of line numbers for
545 canonical results on optimized code.
546
547 2015-04-07 HC Yen <hc.yen@mediatek.com>
548
549 Add AArch32 support for gold linker.
550 gold/
551 * arm.cc: Add V8 arch combine table.
552
553 2015-04-06 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
554
555 * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
556
557 2015-04-06 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
558
559 * gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
560 to find by using the return value of insert.
561
562 2015-04-06 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
563
564 * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
565 constructor call.
566
567 2015-04-06 Ilya Tocar <ilya.tocar@intel.com>
568
569 PR gold/17641
570 * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
571 (Target_x86_64::Scan::local): Don't create GOT entry, when we
572 can convert mov to lea.
573 (Target_x86_64::Scan::global): Ditto.
574 (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
575 %reg to lea foo(%rip), %reg if possible.
576 * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
577 * testsuite/x86_64_mov_to_lea1.s: New.
578 * testsuite/x86_64_mov_to_lea2.s: Ditto.
579 * testsuite/x86_64_mov_to_lea3.s: Ditto.
580 * testsuite/x86_64_mov_to_lea4.s: Ditto.
581 * testsuite/x86_64_mov_to_lea.sh: Ditto.
582
583 2015-04-02 H.J. Lu <hongjiu.lu@intel.com>
584
585 * configure: Regenerated.
586
587 2015-04-01 Ilya Tocar <ilya.tocar@intel.com>
588
589 PR gold/17640
590 * i386.cc (Target_i386::can_convert_mov_to_lea): New.
591 (Target_i386::Scan::local): Don't create GOT entry, when we
592 can convert GOT to GOTOFF.
593 (Target_i386::Scan::global): Ditto.
594 (Target_i386::Relocate::relocate): Convert mov foo@GOT(%reg), %reg to
595 lea foo@GOTOFF(%reg), %reg if possible.
596 * testsuite/Makefile.am (i386_mov_to_lea): New test.
597 * testsuite/i386_mov_to_lea1.s: New.
598 * testsuite/i386_mov_to_lea2.s: Ditto.
599 * testsuite/i386_mov_to_lea3.s: Ditto.
600 * testsuite/i386_mov_to_lea4.s: Ditto.
601 * testsuite/i386_mov_to_lea5.s: Ditto.
602 * testsuite/i386_mov_to_lea.sh: Ditto.
603
604 2015-04-01 H.J. Lu <hongjiu.lu@intel.com>
605
606 * Makefile.am (ZLIB): New.
607 (ZLIBINC): Likewise.
608 (AM_CFLAGS): Add $(ZLIBINC).
609 (AM_CXXFLAGS): Likewise.
610 (ldadd_varldadd_var): Add $(ZLIB).
611 (incremental_dump_LDADD): Likewise.
612 (dwp_LDADD): Likewise.
613 * compressed_output.cc: Don't check HAVE_ZLIB_H to include
614 <zlib.h>.
615 (zlib_compress): Don't check HAVE_ZLIB_H.
616 (zlib_decompress): Likewise.
617 * options.h (compress_debug_sections): Likewise.
618 * configure.ac (AM_CONDITIONAL): Removed.
619 * testsuite/Makefile.am (ZLIB): New.
620 (LDADD): Add $(ZLIB).
621 Don't check HAVE_ZLIB.
622 * Makefile.in: Regenerated.
623 * config.in: Likewise.
624 * configure: Likewise.
625 * testsuite/Makefile.in: Likewise.
626
627 2015-03-30 Jing Yu <jingyu@google.com>
628
629 * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
630 TLSLD_ADD_DTPREL_LO12_NC.
631 * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
632 _TLS_MODULE_BASE_ point to the start of tls segment.
633 (Target_aarch64::optimize_tls_reloc): Add cases for
634 R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
635 R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
636 (Target_aarch64::Scan::local): Likewise.
637 (Target_aarch64::Scan::global): Likewise.
638 (Target_aarch64::Relocate::relocate): Likewise.
639 (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
640 subtracting tls segment size from symbol value for TLSLD_*_DTPREL
641 relocations.
642
643 2015-03-27 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
644
645 * merge.cc (Object_merge_map::add_mapping): call
646 Object_merge_map::Input_merge_map::add_mapping.
647 (Object_merge_map::Input_merge_map::add_mapping): New.
648 (Output_merge_data::do_add_input_section): Call
649 get_or_make_input_merge_map before a loop.
650 (Output_merge_string<Char_type>::finalize_merged_data): Call
651 get_or_make_input_merge_map before a loop.
652 * merge.h (Object_merge_map): Make Input_merge_map public.
653 * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
654 (Relobj::get_or_create_merge_map): New.
655 * object.h (Relobj::get_or_create_merge_map): New.
656
657 2015-03-24 Alan Modra <amodra@gmail.com>
658
659 PR 18147
660 * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
661 relocation errors for branches to strong undefined symbols.
662
663 2015-03-23 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
664
665 * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
666 (Object_merge_map::is_merge_section_for): Remove.
667 (Object_merge_map::find_merge_section): New.
668 * merge.h (Object_merge_map::is_merge_section_for): Remove.
669 (Object_merge_map::find_merge_section): New.
670 (Object_merge_map::get_input_merge_map): Add a const version.
671 * object.cc (Relobj::is_merge_section_for): Remove.
672 (Relobj::find_merge_section): New.
673 * object.h (Relobj::is_merge_section_for): Remove.
674 (Relobj::find_merge_section): New.
675 * output.cc
676 (Output_section::Input_section::is_merge_section_for): Remove.
677 (Output_section::add_merge_input_section): Don't call
678 add_merge_input_section.
679 (Output_section::find_merge_section): Return const. Use
680 object->find_merge_section.
681 (Output_section::build_lookup_maps): Don't build a map for
682 merge sections.
683 (Output_section::is_input_address_mapped): Return false if
684 section is not found.
685 (Output_section::find_starting_output_address): Use
686 find_merge_section instead of is_merge_section_for.
687 (Output_section::add_script_input_section): Don't build a map for
688 merge sections.
689 * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
690 (Output_section_lookup_maps::find_merge_section): Remove.
691 (Output_section_lookup_maps::add_merge_input_section) Remove.
692 (Output_section::find_merge_section): Return const.
693
694 2015-03-22 Cary Coutant <cary@google.com>
695
696 PR gold/18106
697 * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
698 non-SIB form of lea, with nop after the call.
699
700 2015-03-21 Cary Coutant <cary@google.com>
701
702 PR gold/14217
703 * output.cc (Output_segment::is_first_section_relro): Don't ignore
704 .tdata section.
705 (Output_segment::set_section_addresses): Don't align size of relro
706 segment for .tbss.
707
708 2015-03-21 Cary Coutant <cary@google.com>
709
710 PR gold/18010
711 * stringpool.cc (Stringpool_template): Don't optimize if section
712 alignment is greater than sizeof(char).
713
714 2015-03-21 Cary Coutant <cary@google.com>
715
716 PR gold/18048
717 * script-c.h (script_include_directive): Add first_token parameter.
718 * script.cc (script_include_directive): Add first_token parameter, and
719 pass it to read_script_file.
720 * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
721 (PARSING_MEMORY_DEF): New tokens.
722 (top): Add new productions for INCLUDE files.
723 (file_cmd): Replace file_or_sections_cmd with copy of its productions.
724 Pass PARSING_LINKER_SCRIPT to script_include_directive.
725 (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
726 (section_cmd): Pass PARSING_SECTION_CMDS.
727 (file_or_sections_cmd): Remove.
728 (memory_def): Pass PARSING_MEMORY_DEF.
729 * testsuite/Makefile.am (memory_test_2): New test.
730 * testsuite/Makefile.in: Regenerate.
731 * testsuite/memory_test_inc.t: New script file.
732 * testsuite/memory_test_inc_1.t.src: New script file.
733 * testsuite/memory_test_inc_2.t.src: New script file.
734 * testsuite/memory_test_inc_3.t.src: New script file.
735
736 2015-03-21 Cary Coutant <cary@google.com>
737
738 * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
739 (Sized_relobj_dwo::setup): Build compressed section map.
740 (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
741 * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
742 section map.
743 * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
744 compressed_sections_ field.
745 (build_compressed_section_map): Take Object instead of
746 Sized_relobj_file parameter; add decompress_if_needed parameter.
747 (Sized_relobj_file::do_find_special_sections): Store compressed
748 section map in parent Object.
749 (Sized_relobj_file::do_decompressed_section_contents): Move
750 implementation to Object::decompressed_section_contents.
751 (Sized_relobj_file::do_discard_decompressed_sections): Move
752 implementation to Object::discard_decompressed_sections.
753 * object.h (build_compressed_section_map): Declare.
754 (Object::Object): Add compressed_sections_ field.
755 (Object::section_is_compressed): Move implementation here.
756 (Object::decompressed_section_contents): De-virtualize.
757 (Object::discard_decompressed_sections): De-virtualize.
758 (Object::do_section_is_compressed): Delete.
759 (Object::do_decompressed_section_contents): Delete.
760 (Object::set_compressed_sections): New method.
761 (Object::compressed_sections): New method.
762 (Object::compressed_sections_): New data member.
763 (Compressed_section_info, Compressed_section_map): Move to top of file.
764 (Sized_relobj_file::do_section_is_compressed): Delete.
765 (Sized_relobj_file::do_decompressed_section_contents): Delete.
766 (Sized_relobj_file::do_discard_decompressed_sections): Delete.
767 (Sized_relobj_file::compressed_sections_): Move to Object class.
768
769 2015-03-21 Cary Coutant <ccoutant@google.com>
770
771 PR gold/18152
772 * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
773 deferred objects.
774
775 2015-03-11 Cary Coutant <ccoutant@google.com>
776
777 * options.cc (General_options::finalize): Don't allow -z relro
778 with incremental linking.
779 * testsuite/Makefile.am (incremental_test): Add -z norelro.
780 (incremental_test_2): Likewise.
781 (incremental_test_3): Likewise.
782 (incremental_test_4): Likewise.
783 (incremental_test_5): Likewise.
784 (incremental_test_6): Likewise.
785 (incremental_copy_test): Likewise.
786 (incremental_common_test_1): Likewise.
787 (incremental_comdat_test_1): Likewise.
788 * testsuite/Makefile.in: Regenerate.
789
790 2015-03-09 Cary Coutant <ccoutant@google.com>
791
792 PR gold/14675
793 * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
794 return enum indicating whether .eh_frame section is empty, optimizable,
795 unrecognized, or an end marker. Adjust explicit instantiations.
796 * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
797 (Eh_frame::add_ehframe_input_section): Change return type.
798 * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
799 * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
800 to the .eh_frame output section until we see the end marker.
801 (Layout::finalize_eh_frame_section): New.
802 * layout.h: (Layout::finalize_eh_frame_section): New.
803
804 2015-03-05 H.J. Lu <hongjiu.lu@intel.com>
805
806 * output.cc (Relobj::initialize_input_to_output_map<size>):
807 Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
808
809 2015-03-04 Cary Coutant <ccoutant@google.com>
810
811 * parameters.cc (Parameters::set_target_once): Call
812 Target::select_as_default_target just once from here...
813 (set_parameters_target): ...instead of from here.
814
815 2015-03-04 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
816
817 * ehframe.cc (Cie::set_output_offset): Pass in and use a
818 Output_section_data instead of a Merge_map.
819 (Eh_frame::Eh_frame): Don't initialize merge_map_.
820 (Eh_frame::read_cie): Use add_merge_mapping instead of
821 Merge_map::add_mapping.
822 (Eh_frame::read_fde): Ditto.
823 (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
824 (Eh_frame::do_output_offset): Use merge_output_offset istead of
825 merge_map_->get_output_offset.
826 (Eh_frame::do_is_merge_section_for): Delete.
827 * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
828 instead of a Merge_map.
829 (Cie::set_output_offset): Pass in a Output_section_data instead of a
830 Merge_map.
831 (Eh_frame::do_is_merge_section_for): Delete.
832 (Eh_frame::merge_map_): Delete.
833 * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
834 and use a Output_section_data instead of a Merge_map.
835 (Object_merge_map::add_mapping): Ditto.
836 (Object_merge_map::get_output_offset): Remove the merge_map argument.
837 (Object_merge_map::is_merge_section_for): Pass in and use a
838 Output_section_data instead of a Merge_map.
839 (Merge_map): Delete.
840 (Output_merge_base::do_output_offset): Use merge_output_offset instead
841 of merge_map_.get_output_offset.
842 (Output_merge_base::do_is_merge_section_for): Delete.
843 (Output_merge_data::do_add_input_section): Use
844 object->add_merge_mapping instead of add_mapping.
845 (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
846 * merge.h (Merge_map): Delete forward declaration.
847 (Object_merge_map::add_mapping): Pass in and use a Output_section_data
848 instead of a Merge_map.
849 (Object_merge_map::get_output_offset): Remove the merge_map argument.
850 (Object_merge_map::is_merge_section_for): Pass in and use a
851 Output_section_data instead of a Merge_map.
852 (Input_merge_map::Object_merge_map::merge_map): Replace with
853 output_data.
854 (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
855 Output_section_data instead of a Merge_map.
856 (Merge_map): Delete.
857 (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
858 (Output_merge_base::do_is_merge_section_for): Delete.
859 (Output_merge_base::add_mapping): Delete.
860 (Output_merge_base::merge_map_): Delete.
861 * object.cc (Relobj::initialize_input_to_output_map): New.
862 (Relobj::initialize_input_to_output_map): New.
863 (Relobj::merge_output_offset): New.
864 (Relobj::is_merge_section_for): New.
865 (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
866 bits.
867 * object.h (Relobj::merge_map): Delete.
868 (initialize_input_to_output_map): New.
869 (set_merge_map): Delete.
870 (add_merge_mapping): New.
871 (merge_output_offset): New.
872 (is_merge_section_for): New.
873 * output.cc (Output_section::Input_section::is_merge_section_for):
874 Use object->is_merge_section_for.
875 * output.h (Output_section_data::is_merge_section_for): Delete.
876 (Output_section_data::do_is_merge_section_for): Delete.
877 * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
878 Use object->initialize_input_to_output_map.
879 (Merged_symbol_value<size>::value_from_output_section): Use
880 object->merge_output_offset.
881
882 2015-03-02 Peter Collingbourne <pcc@google.com>
883 Cary Coutant <ccoutant@google.com>
884
885 * output.cc (Output_section::add_merge_input_section): Do not
886 attempt to merge sections with an entsize of 0.
887
888 2015-03-02 Khem Raj <raj.khem@gmail.com>
889
890 * attributes.h (class Output_attributes_section_data ): Add
891 do_print_to_mapfile function.
892
893 2015-02-24 Alan Modra <amodra@gmail.com>
894
895 PR 18010
896 * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
897 complain if value is not a multiple of four.
898 (Target_powerpc::Relocate::relocate): Correct handling of
899 R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
900
901 2015-02-21 H.J. Lu <hongjiu.lu@intel.com>
902
903 * configure.ac (default_size): Set to 32 for x32.
904 * configure: Regenerated.
905
906 2015-02-18 Alan Modra <amodra@gmail.com>
907
908 PR 17954
909 * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
910 visibility.
911
912 2015-02-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
913
914 * gc.h (Garbage_collection::add_reference): Don't use find.
915
916 2015-02-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
917
918 * object.cc (write_local_symbols): avoid std::vector copy.
919
920 2015-02-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
921
922 * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
923
924 2015-02-09 Mark Wielaard <mjw@redhat.com>
925
926 * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
927 DW_LANG_Fortran03 and DW_LANG_Fortran08.
928
929 2015-02-16 Cary Coutant <ccoutant@google.com>
930
931 PR gold/13577
932 PR gold/16992
933 * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
934 DF_SYMBOLIC if --dynamic-list option is used.
935 * options.cc (General_options::finalize): --dynamic-list is not
936 mutually exclusive with -Bsymbolic.
937 * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
938 listed in --dynamic-list.
939 * testsuite/Makefile.am (dynamic_list_lib2.so): Add
940 -Bsymbolic-functions.
941 * testsuite/Makefile.in: Regenerate.
942
943 2015-02-16 Cary Coutant <ccoutant@google.com>
944
945 PR gold/17971
946 * incremental.cc: Remove redundant include of "output.h".
947
948 2015-02-12 Jing Yu <jingyu@google.com>
949
950 * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
951 TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
952 New relocation.
953 * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
954 TLSLE_MOVW_* relocations.
955 (Target_aarch64::Scan::global): Likewise.
956 (Target_aarch64::Relocate::relocate): Likewise.
957 (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
958 for new TLSLE_MOVW_* relocations.
959
960 2015-02-11 Will Newton <will.newton@linaro.org>
961
962 PR gold/13321
963 * arm.cc (Target_arm::make_plt_section): Create an ARM
964 state mapping symbol at the start of the PLT.
965
966 2015-02-09 H.J. Lu <hongjiu.lu@intel.com>
967
968 * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
969 Replace two_file_shared_2.so with two_file_shared_1.so.
970 * testsuite/Makefile.in: Regenerated.
971
972 2015-02-09 Alan Modra <amodra@gmail.com>
973
974 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
975 plugin_test_thin.a and defsym_test.
976 * testsuite/Makefile.in: Regenerate.
977
978 2015-02-04 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
979
980 * merge.cc (do_add_input_section): Combine loop epilogue into main loop
981 body.
982
983 2015-02-04 Peter Collingbourne <pcc@google.com>
984
985 * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
986 forwarding symbols when computing symbol resolution info for plugins.
987 * plugin.h (Plugin_manager::symtab): New method.
988 (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
989
990 2015-02-03 Cary Coutant <ccoutant@google.com>
991 Peter Collingbourne <pcc@google.com>
992
993 PR gold/15660
994 * archive.cc (Thin_archive_object_unlocker): New class.
995 (Archive::include_member): Unlock external members of thin archives.
996 * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
997 (plugin_test_2): Likewise.
998 (plugin_test_3): Likewise.
999 (plugin_test_4): Likewise.
1000 (plugin_test_5): Likewise.
1001 (plugin_test_6): Likewise.
1002 (plugin_test_7): Likewise.
1003 (plugin_test_8): Likewise.
1004 (plugin_test_9): Likewise.
1005 (plugin_test_10): Likewise.
1006 (plugin_test_11): New test case.
1007 * testsuite/Makefile.in: Regenerate.
1008 * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
1009 file to decide whether to claim file.
1010 (all_symbols_read_hook): Likewise.
1011 * testsuite/plugin_test_1.sh: Adjust expected output.
1012 * testsuite/plugin_test_2.sh: Likewise.
1013 * testsuite/plugin_test_3.sh: Likewise.
1014 * testsuite/plugin_test_6.sh: Likewise.
1015 * testsuite/plugin_test_tls.sh: Likewise.
1016 * testsuite/plugin_test_11.sh: New testcase.
1017
1018 2015-02-03 Cary Coutant <ccoutant@google.com>
1019
1020 * descriptors.cc (Descriptors::open): Set artificially-low limit for
1021 file descriptors when debugging enabled. Add debug output.
1022 (Descriptors::release): Add debug output.
1023 (Descriptors::close_some_descriptor): Likewise.
1024 (Descriptors::close_all): Likewise.
1025 * fileread.cc (File_read::lock): Likewise.
1026 (File_read::unlock): Likewise.
1027
1028 2015-02-02 Cary Coutant <ccoutant@google.com>
1029
1030 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
1031 executable output file.
1032
1033 2015-01-22 Han Shen <shenhan@google.com>
1034
1035 * arm.cc (Target_arm::Target_arm): Add initialization for new members.
1036 (Target_arm::do_plt_address_for_global): New method.
1037 (Target_arm::do_plt_address_for_local): New method.
1038 (Target_arm::rel_irelative_section): New method.
1039 (Target_arm::make_data_plt): Add more parameters for plt ctor.
1040 (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
1041 (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
1042 (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
1043 (Target_arm::Scan::check_non_pic): Add ifunc support.
1044 (Target_arm::Scan::local): Add ifunc support.
1045 (Target_arm::Scan::global): Add ifunc support.
1046 (Target_arm::make_plt_section): New method.
1047 (Target_arm::make_plt_entry): Change to call to make_plt_section.
1048 (Target_arm::make_local_ifunc_plt_entry): New method.
1049 (Target_arm::got_irelative_): New member.
1050 (Target_arm::rel_irelative_): New member.
1051 (Target_arm::got_section): Add creation for got_irelative_.
1052 (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
1053 (Target_arm::Relocate::relocate): Properly set local ifunc address.
1054 (Target_arm::do_dynsym_value): Properly set global ifunc address.
1055 (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
1056 (Output_data_plt_arm::IRelative_data): New type.
1057 (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
1058 (Output_data_plt_arm::add_entry): Add more parameters.
1059 (Output_data_plt_arm::add_relocation): New method.
1060 (Output_data_plt_arm::add_local_ifunc_entry): New method.
1061 (Output_data_plt_arm::rel_irelative): New method.
1062 (Output_data_plt_arm::entry_count): Modified.
1063 (Output_data_plt_arm::address_for_global): New method.
1064 (Output_data_plt_arm::address_for_local): New method.
1065 gold/
1066 (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
1067 (Output_data_plt_arm::insert_irelative_data): New method.
1068 (Output_data_plt_arm::irelative_rel_): New member.
1069 (Output_data_plt_arm::got_): New member.
1070 (Output_data_plt_arm::got_irelative_): New member.
1071 (Output_data_plt_arm::irelative_count_): New member.
1072 (Output_data_plt_arm::IRelative_data_vec): New typedef.
1073 (Output_data_plt_arm::irelative_data_vec_): New member.
1074 (Output_data_plt_arm::do_write): Write out irelative entries.
1075 (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
1076 more parameters to ctor.
1077 (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
1078 more parameters to ctor.
1079 * output.h (Output_data_reloc::add_local_relative): New method.
1080 * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
1081
1082 2015-01-29 Alan Modra <amodra@gmail.com>
1083
1084 * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
1085 and GOT_TLSGD to LE optimization.
1086
1087 2015-01-28 Cary Coutant <ccoutant@google.com>
1088
1089 * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
1090 for undef TLS symbols.
1091 (Target_x86_64::Relocate::relocate_tls): Likewise.
1092 (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
1093
1094 2015-01-25 Cary Coutant <ccoutant@google.com>
1095
1096 * output.cc (Output_segment::set_section_addresses): Fix calculation
1097 of size of relro segment.
1098
1099 2015-01-22 Alan Modra <amodra@gmail.com>
1100
1101 * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
1102 condition for need of ifunc plt entry.
1103 (Target_powerpc::Scan::global <got relocs>): Likewise.
1104
1105 2015-01-14 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1106
1107 * mips.cc (reloc_high): Add r_sym.
1108 (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
1109 reloc_high constructor.
1110 (Mips_relocate_functions::relgot16_local): Likewise.
1111 (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
1112 r_type to decide whether LO16 matches HI16.
1113 (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
1114 rello16 and relgot16_local.
1115
1116 2015-01-09 Cary Coutant <ccoutant@google.com>
1117
1118 * layout.cc (Layout::set_segment_offsets): Don't align start of segment
1119 unless alignment is larger than page size.
1120
1121 2015-01-06 H.J. Lu <hongjiu.lu@intel.com>
1122 Cary Coutant <ccoutant@google.com>
1123
1124 PR gold/17729
1125 * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
1126 (DEFAULT_TARGET_X32): Set for x32.
1127 * x86_64.cc (cmp_insn_32): New.
1128 (lea_r10_insn_32): Likewise.
1129 (lea_r11_insn_32): Likewise.
1130 (cmp_insn_64): Likewise.
1131 (lea_r10_insn_64): Likewise.
1132 (lea_r11_insn_64): Likewise.
1133 (Target_x86_64<size>::do_calls_non_split): Handle x32.
1134 * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
1135 (check_DATA): Add split_x32 files.
1136 (split_x32_[1234n].o): New targets.
1137 (split_x32_[124]): New targets.
1138 (split_x32_[1234r].stdout): New targets.
1139 * testsuite/split_x32.sh: New file.
1140 * testsuite/split_x32_1.s: Likewise.
1141 * testsuite/split_x32_2.s: Likewise.
1142 * testsuite/split_x32_3.s: Likewise.
1143 * testsuite/split_x32_4.s: Likewise.
1144 * testsuite/split_x32_n.s: Likewise.
1145 * configure: Regenerated.
1146 * testsuite/Makefile.in: Likewise.
1147
1148 2015-01-06 H.J. Lu <hongjiu.lu@intel.com>
1149
1150 PR gold/17809
1151 * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
1152 x32.
1153
1154 2015-01-02 Alan Modra <amodra@gmail.com>
1155
1156 * version.cc (print_version): Just print current year.
1157 * dwp.cc (print_version): Likewise.
1158
1159 2015-01-01 Alan Modra <amodra@gmail.com>
1160
1161 Update year range in copyright notice of all files.
1162
1163 2014-12-25 Alan Modra <amodra@gmail.com>
1164
1165 * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
1166 new enums.
1167 (Target_arm::merge_object_attributes, ): Likewise.
1168
1169 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com>
1170
1171 * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
1172 as hard float only when Tag_ABI_VFP_args is 1, using new enum value
1173 AEABI_VFP_args_vfp to check that.
1174 (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
1175 value and replace hardcoded values by enum values.
1176
1177 2014-12-22 Cary Coutant <ccoutant@google.com>
1178
1179 * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
1180
1181 2014-12-20 H.J. Lu <hongjiu.lu@intel.com>
1182
1183 PR gold/14608
1184 * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
1185 to "return i * i * 3;".
1186
1187 2014-12-16 Cary Coutant <ccoutant@google.com>
1188
1189 * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
1190 (Mapfile::print_output_data): Use current_data_size() to avoid
1191 assert for sections requiring postprocessing; if address is not valid,
1192 print 0.
1193 (Mapfile::print_output_section): Use current_data_size(); print note
1194 that addresses and sizes are before compression.
1195
1196 2014-12-14 H.J. Lu <hongjiu.lu@intel.com>
1197
1198 * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1199 Cast current_group_size to unsigned long when reporting error.
1200
1201 2014-12-10 Jing Yu <jingyu@google.com>
1202
1203 * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
1204 (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
1205 Update error message.
1206 (Target_aarch64::do_relax): Use absolute value of option
1207 stub_group_size. Replace local variable with class member
1208 stub_group_size_.
1209
1210 2014-12-04 Alan Modra <amodra@gmail.com>
1211
1212 * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
1213 addend of PLTREL24 reloc when not generating a plt stub. Make
1214 max_branch_offset an "Address".
1215 (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
1216 (Target_powerpc::Relocate::relocate): Likewise.
1217
1218 2014-12-04 Alan Modra <amodra@gmail.com>
1219
1220 PR 17670
1221 * symtab.cc (Symbol::set_undefined): Remove assertion.
1222 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1223 on symbols defined in discarded sections, instead return false.
1224 Rearrange params, update all callers.
1225 (Target_powerpc::Branch_info::make_stub): Don't make stubs for
1226 branches to syms in discarded sections.
1227 (Global_symbol_visitor_opd::operator()): Set discarded opd syms
1228 undefined and flag as discarded.
1229 (Target_powerpc::Relocate::relocate): Localize variable.
1230
1231 2014-12-03 H.J. Lu <hongjiu.lu@intel.com>
1232
1233 PR gold/17675
1234 * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
1235 * testsuite/Makefile.in: Regenerated.
1236
1237 2014-12-03 Alan Modra <amodra@gmail.com>
1238
1239 PR 17566
1240 * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
1241 when adding dynamic relocations against section symbols.
1242
1243 2014-12-01 Dimitry Ivanov <dimitry@google.com>
1244
1245 * layout.cc (Layout::finish_dynamic_section): When '-z global'
1246 is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
1247 * options.h (General_options): New -z option (global).
1248
1249 2014-12-01 Cary Coutant <ccoutant@google.com>
1250
1251 PR gold/17578
1252 * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
1253 is given.
1254 (Layout::create_executable_stack_info): Warn when -z noexecstack is
1255 given but some inputs require executable stack.
1256
1257 2014-11-26 Cary Coutant <ccoutant@google.com>
1258
1259 * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
1260 .debug_str_offsets; strip .debug_gnu_pubnames and
1261 .debug_gnu_pubtypes.
1262 (lines_only_debug_sections): Strip all four new sections.
1263
1264 2014-11-26 Jing Yu <jingyu@google.com>
1265
1266 * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
1267 register to be x0 when to relax TLSDESC_LD64_LO12.
1268
1269 2014-11-26 Alan Modra <amodra@gmail.com>
1270
1271 * powerpc.cc (struct Stub_table_owner): New.
1272 (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
1273 unsigned int vector. Update all references.
1274 (powerpc_relobj::set_stub_table): Take an unsigned int param
1275 rather than a Stub_table. Update callers.
1276 (Powerpc_relobj::clear_stub_table): New function.
1277 (Target_powerpc): Add relax_failed_, relax_fail_count_ and
1278 stub_group_size_ vars.
1279 (Target_powerpc::new_stub_table): Delete.
1280 (max_branch_delta): New function, extracted from..
1281 (Target_powerpc::Relocate::relocate): ..here..
1282 (Target_powerpc::Branch_info::make_stub): ..and here. Return
1283 status on whether stub created successfully.
1284 (Stub_control::Stub_control): Add "no_size_errors" param. Move
1285 default sizing to..
1286 (Target_powerpc::do_relax): ..here. Init stub_group_size_ and
1287 reduce on relax failure.
1288 (Target_powerpc::group_sections): Add "no_size_errors" param.
1289 Use stub_group_size_. Set up group info in a temp vector,
1290 before building Stub_table vector. Account for input sections
1291 possibly already converted to relaxed sections.
1292 (Stub_table::init): Delete. Merge into..
1293 (Stub_table::Stub_table): ..here.
1294 (Stub_table::can_reach_stub): New function.
1295 (Stub_table::add_plt_call_entry): Add "from" parameter and
1296 return true iff stub could be reached.
1297 (Stub_table::add_long_branch_entry): Similarly. Add "r_type"
1298 param too.
1299 (Stub_table::clear_stubs): Add "all" param.
1300
1301 2014-11-26 Alan Modra <amodra@gmail.com>
1302
1303 * powerpc.cc (Stub_control::set_output_and_owner): New function.
1304 (Target_powerpc::group_sections): Use it.
1305
1306 2014-11-25 Cary Coutant <ccoutant@google.com>
1307
1308 * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
1309 (Binary_to_elf::write_symbol): Add st_size parameter.
1310 * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
1311
1312 2014-11-25 Cary Coutant <ccoutant@google.com>
1313
1314 PR gold/17639
1315 * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
1316 (Sized_relobj_file::do_layout): Handle deferred sections properly
1317 during GC pass 1. Don't add reloc sections to deferred list twice.
1318 * object.h (Sized_relobj_file::is_deferred_layout): New function.
1319 (Sized_relobj_file::is_deferred_layout_): New data member.
1320
1321 2014-11-21 H.J. Lu <hongjiu.lu@intel.com>
1322
1323 PR gold/17619
1324 * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
1325 Check PC-relative offset overflow in PLT entry.
1326
1327 2014-11-21 Alan Modra <amodra@gmail.com>
1328
1329 * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
1330 for undefined weaks.
1331
1332 2014-11-20 Alan Modra <amodra@gmail.com>
1333
1334 * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
1335 from --stub-group-size parameter divided by 1024.
1336 (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
1337 template parameter. Update all uses.
1338 (Target_powerpc::Relocate::relocate): Rename has_plt_value to
1339 has_stub_value. Set for long branches. Don't report overflow for
1340 branch to undefined weak symbols. Print info message on
1341 overflowing branch to stub.
1342
1343 2014-11-20 Alan Modra <amodra@gmail.com>
1344
1345 * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
1346
1347 2014-11-13 H.J. Lu <hongjiu.lu@intel.com>
1348
1349 * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
1350 entry for R_X86_64_GOTPLT64.
1351 (Target_x86_64<size>::Relocate::relocate): Update comments for
1352 R_X86_64_GOTPLT64.
1353
1354 2014-11-06 Evgeniy Dushistov <dushistov@mail.ru>
1355
1356 * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
1357 * plugin.h: add lock definition
1358
1359 2014-10-29 Han Shen <shenhan@google.com>
1360 Jing Yu <jingyu@google.com>
1361
1362 * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
1363 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1364 TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
1365 Symbol::TLS_REF.
1366 * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
1367 method.
1368 (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
1369 (Target_aarch64::tls_ld_to_le): New method.
1370 (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
1371 for 64bit targets.
1372 (Output_data_plt_aarch64::irelative_rel_): New data member.
1373 (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
1374 (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
1375 (Output_data_plt_aarch64::add_relocation): New method.
1376 (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
1377 offset. Add got_irelative size to got size.
1378 (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
1379 type string with the new typename.
1380 (AArch64_relocate_functions::update_adr): Replace parameter x with
1381 immed.
1382 (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
1383 (AArch64_relocate_functions::reloc_common): New method.
1384 (AArch64_relocate_funcsions::rela_general): Extract common part out
1385 into reloc_common method.
1386 (AArch64_relocate_functions::rela_general): Likewise.
1387 (AArch64_relocate_functions::pcrela_general): Likewise.
1388 (AArch64_relocate_functions::adr): New method.
1389 (AArch64_relocate_functions::adrp): Calculate immed before calling
1390 update_adr.
1391 (AArch64_relocate_functions::adrp): Likewise.
1392 (AArch64_relocate_functions::movnz): Cast x to SignedW type when
1393 comparing x to 0. Calculate immed from ~x when x < 0.
1394 (Target_aarch64::optimize_tls_reloc): Add new cases for
1395 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1396 TLSLD_MOVW_DTPREL_G0_NC.
1397 (Target_aarch64::possible_function_pointer_reloc): Implement this
1398 method.
1399 (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
1400 comment.
1401 (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
1402 symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1403 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1404 (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
1405 symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1406 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1407 (Target_aarch64::make_plt_entry): Call add_entry with two more
1408 parameters.
1409 (Target_aarch64::make_local_ifunc_plt_entry): New method.
1410 (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
1411 ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1412 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1413 (Target_aarch64::Relocate::relocate_tls): Add cases for
1414 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1415 TLSLD_MOVW_DTPREL_G0_NC.
1416 * testsuite/icf_safe_so_test.cc: Correct test comment.
1417 * testsuite/icf_safe_test.sh: Add AArch64 arch.
1418
1419 2014-10-22 Alan Modra <amodra@gmail.com>
1420
1421 * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
1422 thread_starter.
1423
1424 2014-10-18 Andreas Schwab <schwab@linux-m68k.org>
1425
1426 * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
1427
1428 2014-10-17 Cary Coutant <ccoutant@google.com>
1429
1430 * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1431 Add "typename" keyword.
1432
1433 2014-10-15 Han Shen <shenhan@google.com>
1434 Jing Yu <jingyu@google.com>
1435
1436 Patch for gold aarch64 backend to support relaxation.
1437 * aarch64-reloc.def: Change format.
1438 * aarch64.cc (class Reloc_stub): New class.
1439 (class Stub_table): New class.
1440 (class AArch64_relobj): New class.
1441 (class AArch64_input_section): New class.
1442 (class AArch64_output_section): New class.
1443 (Target_aarch64::new_stub_table): New method.
1444 (Target_aarch64::new_aarch64_input_section): New method.
1445 (Target_aarch64::find_aarch64_input_section): New method.
1446 (Target_aarch64::scan_section_for_stubs): New method.
1447 (Target_aarch64::scan_reloc_section_for_stubs): New method.
1448 (Target_aarch64::relocate_stub): New method.
1449 (Target_aarch64::current_target): New method.
1450 (Target_aarch64::do_make_elf_object): New method.
1451 (Target_aarch64::do_may_relax): New method.
1452 (Target_aarch64::do_relax): New method.
1453 (Target_aarch64::group_sections): New method.
1454 (Target_aarch64::scan_reloc_for_stub): New method.
1455 (Target_aarch64::do_make_output_section): New method.
1456 (Target_aarch64::stub_tables_): New data member.
1457 (Target_aarch64::aarch64_input_section_map_): New data member.
1458 (AArch64_relocate_functions::maybe_apply_stub): New method.
1459
1460 2014-09-30 Cary Coutant <ccoutant@google.com>
1461
1462 PR gold/17432
1463 * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
1464
1465 2014-09-30 Kito Cheng <kito@0xlab.org>
1466
1467 PR gold/13597
1468 * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
1469 hash table before sysv-style hash table.
1470
1471 2014-09-29 Sriraman Tallam <tmsriram@google.com>
1472
1473 * options.h (--pic-executable): Add negative to alias to -no-pie.
1474
1475 2014-09-26 Cary Coutant <ccoutant@google.com>
1476
1477 PR gold/16773
1478 * object.cc (Sized_relobj_file): Compute value of section symbols
1479 for TLS sections the same as TLS symbols.
1480
1481 2014-09-25 Cary Coutant <ccoutant@google.com>
1482
1483 PR gold/17432
1484 * resolve.cc (Symbol_table::resolve): Override common placeholder
1485 symbols, but adjust sizes.
1486 * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
1487 symbols to common lists.
1488
1489 2014-09-24 Alan Modra <amodra@gmail.com>
1490
1491 * po/POTFILES.in: Regenerate.
1492
1493 2014-09-23 Taiju Tsuiki <tzik@google.com>
1494 Cary Coutant <ccoutant@google.com>
1495
1496 PR gold/14860
1497 * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
1498 on input_sections_blocker.
1499 * layout.cc (Write_sections_task::locks): Unblock
1500 input_sections_blocker_.
1501 * layout.h (Write_sections_task::Write_sections_task): Add
1502 input_sections_blocker.
1503 * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
1504 to DEPENDENCIES.
1505 * testsuite/Makefile.in: Regenerate.
1506
1507 2014-09-18 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1508
1509 * testsuite/Makefile.am (plugin_test_10): New test.
1510 * testsuite/Makefile.in: Regenerate
1511 * testsuite/plugin_common_test_2.c (c1): Align to 8.
1512 * testsuite/plugin_test_10.sh: New file.
1513
1514 2014-09-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1515
1516 * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
1517 * resolve.cc (Symbol_table::resolve): Don't override common symbols
1518 during the replacement phase.
1519
1520 2014-09-17 Han Shen <shenhan@google.com>
1521 Jing Yu <jingyu@google.com>
1522
1523 * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
1524 TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
1525 * aarch64.cc (Target_aarch64): Add data members
1526 got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
1527 tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
1528 constructor.
1529 (Target_aarch64::do_reloc_symbol_index): New method.
1530 (Target_aarch64::do_reloc_addend): New method.
1531 (Target_aarch64::add_tlsdesc_info): New method.
1532 (Target_aarch64::do_dynsym_value): New method.
1533 (Target_aarch64::do_make_data_plt): Add new parameters: got,
1534 got_irelative. Pass them to Output_data_plt_aarch64_standard.
1535 (Target_aarch64::make_data_plt): Add new parameters: got,
1536 got_irelative. Pass them to do_make_data_plt.
1537 (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
1538 (Target_aarch64::Relocate:tls_gd_to_le): New method.
1539 (Target_aarch64::Relocate:tls_ie_to_le): New method.
1540 (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
1541 (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
1542 (Target_aarch64::got_tlsdesc_section): New method.
1543 (Target_aarch64::make_local_ifunc_plt_entry): New method.
1544 (Target_aarch64::define_tls_base_symbol): New method.
1545 (Target_aarch64::reserve_tlsdesc_entries): New method.
1546 (Target_aarch64::got_mod_index_entry): New method.
1547 (Target_aarch64::rela_tlsdesc_section): New method.
1548 (Target_aarch64::rela_irelative_section): New method.
1549 (Target_aarch64::Tlsdesc_info): New struct.
1550 (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
1551 relocations and tlsdesc relocations.
1552 (Target_aarch64::optimize_tls_reloc): Implement method.
1553 (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
1554 got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
1555 in constructor.
1556 (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
1557 (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
1558 (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
1559 (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
1560 (Output_data_plt_aarch64::rela_tlsdesc): New method.
1561 (Output_data_plt_aarch64::rela_irelative): New method.
1562 (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
1563 (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
1564 (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
1565 (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
1566 (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
1567 (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
1568 (Output_data_plt_aarch64_standard): New member variables:
1569 plt_tlsdesc_entry_size, tlsdesc_plt_entry.
1570 (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
1571 New parameter: got, got_irelative.
1572 (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
1573 (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
1574 (Output_data_plt_aarch64::do_write): Replace got_address with
1575 gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
1576 (AArch64_relocate_functions::update_movnz): New method.
1577 (AArch64_relocate_functions): Correct format.
1578 (AArch64_relocate_functions::movnz): New method.
1579 (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
1580 before the switch. Add new cases to switch.
1581 Check ie_to_le relaxation on tlsie relocations. Add code handling
1582 tlsgd tlsdesc cases.
1583 (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
1584 needed. Add new cases to switch. Insert dynamic RELATIVE relocation
1585 when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
1586 Call reloc_name_in_error_message to print unsupported reloc.
1587 (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
1588 make_data_plt.
1589 (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
1590 relocs. Fill in some more dynamic tags.
1591 (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
1592 Skip call tls_get_addr when tlsgd is relaxed.
1593 (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
1594 handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
1595 tlsdesc->ie relaxation.
1596
1597 2014-09-03 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1598
1599 * mips.cc (Target_mips_nacl): New class.
1600 (Target_selector_mips_nacl): New class.
1601 (target_selector_mips32): Rename from target_selector_mips32be and use
1602 Target_selector_mips_nacl instead of Target_selector_mips.
1603 (target_selector_mips32el): Rename from target_selector_mips32 and use
1604 Target_selector_mips_nacl instead of Target_selector_mips.
1605 (target_selector_mips64): Rename from target_selector_mips64be and use
1606 Target_selector_mips_nacl instead of Target_selector_mips.
1607 (target_selector_mips64el): Rename from target_selector_mips64 and use
1608 Target_selector_mips_nacl instead of Target_selector_mips.
1609 (Target_mips::mips_info): Add const attribute.
1610
1611 2014-09-02 Cary Coutant <ccoutant@google.com>
1612
1613 * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
1614 * dynobj.h (Sized_dynobj::do_section_name): Likewise.
1615 * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
1616 (Sized_incr_dynobj::do_section_name): Likewise.
1617 * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
1618 (Sized_incr_dynobj::do_section_name): Likewise.
1619 * object.h (Object::section_name): Likewise.
1620 (Object::do_section_name): Likewise.
1621 (Sized_relobj_file::do_section_name): Likewise.
1622 * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
1623 * plugin.h (Sized_pluginobj::do_section_name): Likewise.
1624
1625 2014-09-02 Cary Coutant <ccoutant@google.com>
1626
1627 PR gold/17005
1628 * ehframe.cc (Fde::write): Add output_offset parameter.
1629 (Cie::write): Likewise.
1630 (Eh_frame::set_final_data_size): Account for offset within output
1631 section.
1632 (Eh_frame::do_sized_write): Likewise.
1633 * ehframe.h (Fde::write): Add output_offset parameter.
1634 (Cie::write): Likewise.
1635 * output.cc (Output_section::Input_section_sort_entry): Remove
1636 section_has_name_; add output_section_name parameter. Use
1637 output section name for non-input sections.
1638 (Output_section::Input_section_sort_entry::section_has_name): Remove.
1639 (Output_section::Input_section_sort_entry::section_has_name_): Remove.
1640 (Output_section::Input_section_sort_compare): Remove logic for
1641 sections without names.
1642 (Output_section::Input_section_sort_init_fini_compare): Likewise.
1643 (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
1644 Likewise.
1645 (Output_section::Input_section_sort_section_name_compare): Likewise.
1646
1647 2014-08-29 Han Shen <shenhan@google.com>
1648 Jing Yu <jingyu@google.com>
1649
1650 * aarch64-reloc-property.cc
1651 (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
1652 reference reloc property in the table.
1653 * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
1654 3 other entries.
1655 * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
1656 2 new overloaded methods.
1657 (Output_data_got_aarch64::do_write): Add code to write out
1658 static relocs.
1659 (class Output_data_got_aarch64::Static_reloc): New class to wrap
1660 static relocs.
1661 (Output_data_got_aarch64::static_relocs): New vector to
1662 hold static relocs.
1663 (Target_aarch64::TCB_SIZE): New const static memeber.
1664 (Target_aarch64::tcb_size): New method.
1665 (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
1666 (Target_aarch64::Relocate::relocate_tls): New method.
1667 (Target_aarch64::Scan::local): Add code handling new reloc types.
1668 (Target_aarch64::Scan::global): Add code handling new reloc types.
1669
1670 2014-08-13 Sriraman Tallam <tmsriram@google.com>
1671
1672 * options.h (-no-pie): Add option.
1673
1674 2014-08-08 Jing Yu <jingyu@google.com>
1675 Han Shen <shenhan@google.com>
1676
1677 * Makefile.am (HFILES): Add aarch64-reloc-property.h.
1678 (DEFFILES): add aarch64-reloc.def.
1679 (TARGETSOURCES): Add aarch64-reloc-property.cc.
1680 (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
1681 * Makefile.in: Regenerate.
1682 * aarch64-reloc-property.cc: New file.
1683 * aarch64-reloc-property.h: New file.
1684 * aarch64-reloc.def: New file.
1685 * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
1686 with tab to make the format consistent.
1687 (Output_data_got_aarch64::symbol_table_): New method.
1688 (Target_aarch64::do_plt_address_for_global): New method.
1689 (Target_aarch64::do_plt_address_for_local): New method.
1690 (Target_aarch64::do_select_as_default_target): New method.
1691 (Target_aarch64::do_make_data_plt): New method.
1692 (Target_aarch64::make_data_plt): New method.
1693 (Output_data_plt_aarch64::has_irelative_section): New method.
1694 (Output_data_plt_aarch64::address_for_global): New method.
1695 (Output_data_plt_aarch64::address_for_local): New method.
1696 (Output_data_plt_aarch64::irelative_rel_): New parameter.
1697 (Output_data_plt_aarch64::add_entry): Implement contents.
1698 (Output_data_plt_aarch64::set_final_data_size): Fix typo.
1699 (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
1700 the got_pov entry to plt0.
1701 (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
1702 Implement contents.
1703 (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
1704 (AArch64_howto): New struct.
1705 (aarch64_howto[]): New static const array.
1706 (AArch64_relocate_functions): New class.
1707 (Target_aarch64::Scan::get_reference_flags): Remove method.
1708 (Target_aarch64::Scan::local): Implement to support a few relocations.
1709 (Target_aarch64::Scan::global): Implement to support a few relocations.
1710 (Target_aarch64::make_plt_section): Implement contents.
1711 (Target_aarch64::make_plt_entry): Implement contents.
1712 (Target_aarch64::do_finalize_sections): Implement contents.
1713 (Target_aarch64::Relocate::relocate): Implement a few relocations.
1714 (Target_aarch64::relocate_section): Implement contents.
1715
1716 2014-08-06 Alan Modra <amodra@gmail.com>
1717
1718 * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
1719
1720 2014-08-06 Alan Modra <amodra@gmail.com>
1721
1722 PR 13227
1723 * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
1724
1725 2014-07-21 Sriraman Tallam <tmsriram@google.com>
1726
1727 * object.cc (Relobj::is_section_name_included): Add
1728 ".rodata.nptl_version" to not garbage collect this section.
1729
1730 2014-07-08 Cary Coutant <ccoutant@google.com>
1731
1732 * expression.cc (struct Expression::Expression_eval_info): Add
1733 new fields type_pointer, vis_pointer, and nonvis_pointer.
1734 (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
1735 nonvis_pointer parameters. Adjust all calls.
1736 (Symbol_expression::value): Update type, visibility, and nonvis bits
1737 in caller.
1738 * script.cc (Symbol_assignment::sized_finalize): Update type,
1739 visibility, and remaining st_other bits for new symbol.
1740 * script.h: (Expression::eval_maybe_dot): Add type_pointer,
1741 vis_pointer, and nonvis_pointer parameters.
1742 * symtab.h (Symbol::set_type): New method.
1743
1744 * testsuite/Makefile.am (defsym_test): New test.
1745 * testsuite/Makefile.in: Regenerate.
1746 * testsuite/defsym_test.c: New file.
1747 * testsuite/defsym_test.sh: New file.
1748
1749 2014-07-08 Cary Coutant <ccoutant@google.com>
1750
1751 PR gold/15639
1752 * dynobj.h (Sized_dynobj::base_read_symbols): New method.
1753 * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
1754 (Sized_dynobj::base_read_symbols): ...new method.
1755 * object.h (Sized_relobj_file::base_read_symbols): New method.
1756 * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
1757 (Sized_relobj_file::base_read_symbols): ...new method.
1758 * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
1759 * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
1760 * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
1761
1762 2014-07-04 Alan Modra <amodra@gmail.com>
1763
1764 * po/POTFILES.in: Regenerate.
1765
1766 2014-07-02 Jing Yu <jingyu@google.com>
1767
1768 * aarch64.cc: New file
1769 * Makefile.am (TARGETSOURCES): Add aarch64.cc
1770 (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
1771 * Makefile.in: Regenerate.
1772 * configure.tgt: Add entries for aarch64*.
1773 * configure.ac: Likewise.
1774 * configure: Likewise.
1775
1776 2014-06-27 Alan Modra <amodra@gmail.com>
1777
1778 * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
1779
1780 2014-06-24 Cary Coutant <ccoutant@google.com>
1781
1782 * dwp.cc (Dwo_file::read): Allow files with no .debug_types
1783 sections.
1784 (Dwo_file::sized_read_unit_index): Likewise.
1785
1786 2014-06-23 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1787
1788 * mips.cc: New file.
1789 * Makefile.am (TARGETSOURCES): Add mips.cc
1790 (ALL_TARGETOBJS): Add mips.$(OBJEXT)
1791 * configure.tgt: Add entries for mips*.
1792 * configure.ac: Likewise.
1793 * Makefile.in: Regenerate.
1794 * configure: Likewise.
1795
1796 2014-06-09 Cary Coutant <ccoutant@google.com>
1797
1798 * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
1799 unit_length is within section bounds.
1800
1801 2014-06-09 Cary Coutant <ccoutant@google.com>
1802
1803 PR gold/16980
1804 * layout.cc (Layout::print_to_mapfile): Print unattached sections in
1805 map.
1806
1807 2014-06-07 Alan Modra <amodra@gmail.com>
1808
1809 * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
1810
1811 2014-06-06 Cary Coutant <ccoutant@google.com>
1812
1813 * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
1814 * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
1815 (Dwarf_pubnames_table::read_header): Likewise.
1816 * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
1817 .debug_gnu_pubtypes.
1818
1819 2014-06-05 Joel Brobecker <brobecker@adacore.com>
1820
1821 * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
1822 * Makefile.in, configure: Regenerate.
1823
1824 2014-06-03 Alan Modra <amodra@gmail.com>
1825
1826 * powerpc.cc (addis_12_2): Define.
1827 (Stub_table::do_write): Support fusion on ELFv2 stubs.
1828
1829 2014-06-03 Alan Modra <amodra@gmail.com>
1830
1831 * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
1832 st_other output.
1833
1834 2014-06-02 Alan Modra <amodra@gmail.com>
1835
1836 * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
1837 Only ignore relocs on ELFv1.
1838 (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
1839
1840 2014-05-30 Cary Coutant <ccoutant@google.com>
1841
1842 * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
1843 * testsuite/Makefile.in: Regenerate.
1844 * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
1845
1846 2014-05-27 H.J. Lu <hongjiu.lu@intel.com>
1847
1848 PR gold/16945
1849 * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
1850 for got_offset. Properly get GOT address for R_X86_64_PLTOFF64.
1851
1852 2014-05-15 Alan Modra <amodra@gmail.com>
1853
1854 * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
1855 Compare FDE contents with DW_CFA_nop rather than 0.
1856
1857 2014-05-13 Sriraman Tallam <tmsriram@google.com>
1858
1859 * symtab.h (may_need_copy_reloc): Remove check for position independent
1860 code.
1861 * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
1862 position independence before pc absolute may_need_copy_reloc call.
1863 Add check for executable output befor pc relative may_need_copy_reloc
1864 call.
1865 * i386.cc: Ditto.
1866 * arm.cc: Ditto.
1867 * sparc.cc: Ditto.
1868 * tilegx.cc: Ditto.
1869 * powerpc.cc: Add check for no position independence before
1870 may_need_copy_reloc calls.
1871 * testsuite/pie_copyrelocs_test.cc: New file.
1872 * testsuite/pie_copyrelocs_shared_test.cc: New file.
1873 * Makefile.am (pie_copyrelocs_test): New test.
1874 * Makefile.in: Regenerate.
1875
1876 2014-05-08 Martin Liška <mliska@suse.cz>
1877
1878 * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
1879
1880 2014-05-06 Cary Coutant <ccoutant@google.com>
1881
1882 PR gold/16900
1883 * i386.cc (Output_data_got_plt_i386): New class.
1884 (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
1885 parameter. Change all callers.
1886 (Output_data_plt_i386::layout_): Remove.
1887 (Output_data_plt_i386::got_plt_): Change type.
1888 (Target_i386::got_plt_): Change type. Change all references.
1889 (Target_i386::got_section): Create instance of new class.
1890 (Output_data_got_plt_i386::do_write): New function.
1891 * x86_64.cc (Output_data_got_plt_x86_64): New class.
1892 (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
1893 parameter. Change all callers.
1894 (Output_data_plt_x86_64::layout_): Remove.
1895 (Output_data_plt_x86_64::got_plt_): Change type.
1896 (Target_x86_64::got_plt_): Change type. Change all references.
1897 (Target_x86_64::got_section): Create instance of new class.
1898 (Output_data_got_plt_x86_64::do_write): New function.
1899 (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
1900 (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
1901 class.
1902
1903 2014-05-05 Cary Coutant <ccoutant@google.com>
1904
1905 * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
1906 if we have pubnames/pubtypes.
1907
1908 2014-05-02 Cary Coutant <ccoutant@google.com>
1909
1910 * defstd.cc (in_segment): Define __ehdr_start here...
1911 * layout.cc (Layout::finalize): ...Instead of here. Set the
1912 output segment when known.
1913 * resolve.cc (Symbol::override_base_with_special): Remember
1914 the original binding.
1915 * symtab.cc (Symbol::set_output_segment): New function.
1916 (Symbol::set_undefined): New function.
1917 * symtab.h (Symbol::is_weak_undefined): Check original undef
1918 binding.
1919 (Symbol::is_strong_undefined): New function.
1920 (Symbol::set_output_segment): New function.
1921 (Symbol::set_undefined): New function.
1922 * target-reloc.h (is_strong_undefined): Remove.
1923 (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
1924 Check for hidden undefs.
1925 (relocate_section): Call Symbol::is_strong_undefined.
1926
1927 * testsuite/Makefile.am (ehdr_start_test_1)
1928 (ehdr_start_test_2, ehdr_start_test_3)
1929 (ehdr_start_test_4, ehdr_start_test_5): New test cases.
1930 * testsuite/Makefile.in: Regenerate.
1931 * testsuite/ehdr_start_def.cc: New source file.
1932 * testsuite/ehdr_start_test.cc: New source file.
1933 * testsuite/ehdr_start_test.t: New linker script.
1934 * testsuite/ehdr_start_test_4.sh: New shell script.
1935
1936 2014-04-23 Cary Coutant <ccoutant@google.com>
1937
1938 PR gold/16870
1939 * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
1940
1941 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1942
1943 * layout.cc (Layout::include_section): Allow a target to decide
1944 whether to include a section.
1945 * target.h (Target::should_include_section): New function.
1946 (Target::do_should_include_section): New function.
1947
1948 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1949
1950 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
1951 inline into ...
1952 (Copy_relocs::emit): ... here.
1953 * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
1954 (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
1955 (Copy_reloc_entry::entries_): Change from private to protected.
1956
1957 2014-04-02 Sriraman Tallam <tmsriram@google.com>
1958
1959 * icf.cc (get_section_contents): Replace copies of reloc
1960 vectors with const references.
1961
1962 2014-04-02 Cary Coutant <ccoutant@google.com>
1963
1964 * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
1965 (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
1966 * configure: Regenerate.
1967 * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
1968 -fno-use-linker-plugin.
1969 (LINK1, CXXLINK1): Add it to the link command.
1970 * testsuite/Makefile.in: Regenerate.
1971
1972 2014-03-12 Alan Modra <amodra@gmail.com>
1973
1974 * Makefile.in: Regenerate.
1975
1976 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1977
1978 * symtab.h (Symbol::set_nonvis): New function.
1979
1980 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1981
1982 * symtab.cc (Sized_symbol<32>::init_output_data):
1983 Instantiate the template.
1984 (Sized_symbol<64>::init_output_data): Likewise.
1985
1986 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1987
1988 * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
1989 adjust dynamic symbol value.
1990 * target.h (Target::adjust_dyn_symbol): New function.
1991 (Target::do_adjust_dyn_symbol): New function.
1992
1993 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1994
1995 * output.cc (Output_data_dynamic::Dynamic_entry::write):
1996 Get the value of DYNAMIC_CUSTOM dynamic entry.
1997 * output.h (Output_data_dynamic::add_custom): New function.
1998 (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
1999 dynamic entry.
2000 (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
2001 * target.h (Target::dynamic_tag_custom_value): New function.
2002 (Target::do_dynamic_tag_custom_value): New function.
2003
2004 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
2005
2006 * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
2007 dynsym indexes.
2008 * target.h (Target::has_custom_set_dynsym_indexes): New function.
2009 (Target::do_has_custom_set_dynsym_indexes): New function.
2010 (Target::set_dynsym_indexes): New function.
2011 (Target::do_set_dynsym_indexes): New function.
2012
2013 2014-03-07 Alan Modra <amodra@gmail.com>
2014
2015 * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
2016 CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
2017 (Powerpc_relocate_functions::has_overflow_unsigned): New function.
2018 (Powerpc_relocate_functions::has_overflow_bitfield,
2019 overflowed): Use the above.
2020 (Target_powerpc::Relocate::relocate): Correct overflow checking
2021 for a number of relocations. Modify overflow test for 16-bit
2022 fields in instructions to signed/unsigned according to whether
2023 the field takes a signed or unsigned value.
2024
2025 2014-03-05 Alan Modra <amodra@gmail.com>
2026
2027 Update copyright years.
2028
2029 2014-03-05 Alan Modra <amodra@gmail.com>
2030
2031 * powerpc.cc (Target_powerpc::Scan::local, global): Support
2032 R_PPC64_ADDR64_LOCAL.
2033 (Target_powerpc::Relocate::relocate): Likewise.
2034
2035 2014-03-03 Alan Modra <amodra@gmail.com>
2036
2037 * dwp.cc (print_version): Update copyright year to current.
2038
2039 2014-02-10 Alan Modra <amodra@gmail.com>
2040
2041 * po/gold.pot: Regenerate.
2042
2043 2014-02-06 Cary Coutant <ccoutant@google.com>
2044
2045 Fix problem where -u is ignored when a weak undef is seen.
2046
2047 * archive.cc (Library_base::should_include_member): Reorder
2048 code to check for -u option if a weak undef has already been seen.
2049 * testsuite/Makefile.am (weak_undef_test_2): New test case.
2050 * testsuite/Makefile.in: Regenerate.
2051 * testsuite/weak_undef_file3.cc: New file.
2052 * testsuite/weak_undef_file4.cc: New file.
2053 * testsuite/weak_undef_test_2.cc: New file.
2054
2055 2014-02-05 Cary Coutant <ccoutant@google.com>
2056
2057 Fix issues with gold undefined symbol diagnostics.
2058
2059 PR binutils/15435
2060 * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
2061 check to here.
2062 * target-reloc.h (is_strong_undefined): New function.
2063 (relocate_section): Move undef vtable symbol check from here.
2064 Check for is_strong_undefined.
2065
2066 2014-02-05 Cary Coutant <ccoutant@google.com>
2067
2068 Fix problems with the --dynamic-list option.
2069
2070 PR gold/13577
2071 * options.cc (General_options::parse_dynamic_list):
2072 Set have_dynamic_list_.
2073 (General_options::General_options): Initialize have_dynamic_list_.
2074 (General_options::finalize): Turn off -Bsymbolic and
2075 -Bsymbolic-functions if --dynamic-list provided.
2076 * options.h (General_options::have_dynamic_list): New function.
2077 (General_options::have_dynamic_list_): New data member.
2078 * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
2079 correctly.
2080
2081 PR gold/16530
2082 * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
2083 in --dynamic-list, mark it.
2084
2085 * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
2086 (dynamic_list_2): New test case.
2087 * testsuite/Makefile.in: Regenerate.
2088 * testsuite/dynamic_list_2.cc: New file.
2089 * testsuite/dynamic_list_2.t: New file.
2090 * testsuite/dynamic_list_lib1.cc: New file.
2091 * testsuite/dynamic_list_lib2.cc: New file.
2092 * testsuite/gc_dynamic_list_test.c: New file.
2093 * testsuite/gc_dynamic_list_test.sh: New file.
2094 * testsuite/gc_dynamic_list_test.t: New file.
2095
2096 2014-01-28 Cary Coutant <ccoutant@google.com>
2097
2098 Add .gdb_index version 7 support.
2099
2100 * gold/dwarf_reader.cc: include <utility> (for make_pair).
2101 (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
2102 debug sections.
2103 (Dwarf_ranges_table::read_ranges_table): Likewise.
2104 (Dwarf_pubnames_table::read_section): Check for GNU-style
2105 sections, and for compressed debug sections.
2106 (Dwarf_pubnames_table::read_header): Compute end address of table.
2107 (Dwarf_pubnames_table::next_name): Return flag_byte. Check
2108 for end of list by offset, not by offset == 0.
2109 (Dwarf_info_reader::do_read_string_table): Check for compressed
2110 debug sections.
2111 * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2112 Initialize new data members.
2113 (Dwarf_pubnames_table::next_name): return flag_byte.
2114 (Dwarf_pubnames_table::end_of_table_): New data member.
2115 (Dwarf_pubnames_table::is_gnu_style_): New data member.
2116 * gold/gdb-index.cc (gdb_index_version): Update to version 7.
2117 (Gdb_index_info_reader::read_pubtable): Read flag_byte.
2118 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
2119 read skeleton type unit DIEs.
2120 (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
2121 (Gdb_index::do_write): Write flag_byte.
2122 * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
2123 (Gdb_index::Cu_vector): Store flags along with cu indexes.
2124 * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
2125 * gold/testsuite/gdb_index_test_comm.sh: Likewise.
2126
2127 2014-01-08 H.J. Lu <hongjiu.lu@intel.com>
2128
2129 * version.cc (print_version): Update copyright year to 2014.
2130
2131 2013-12-19 Dimitry Andric <dimitry@andric.com>
2132
2133 * stringpool.cc (Stringpool_template::reserve): Add
2134 HAVE_UNORDERED_MAP case.
2135 * stringpool.cc (Stringpool_template::print_stats): Likewise.
2136
2137 2013-12-18 Cary Coutant <ccoutant@google.com>
2138
2139 * configure.ac: Check for <unordered_set> and <unordered_map>.
2140 * config.in: Regenerate.
2141 * configure: Regenerate.
2142 * system.h: Use <unordered_set> and <unordered_map> if available.
2143
2144 2013-12-10 Roland McGrath <mcgrathr@google.com>
2145
2146 * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
2147 with $(INSTALL_PROGRAM_ENV).
2148 * Makefile.in: Regenerate.
2149
2150 2013-11-22 Cary Coutant <ccoutant@google.com>
2151
2152 * configure.ac: Add check for which library is needed for
2153 dlopen.
2154 * configure: Regenerate.
2155
2156 2013-11-22 Cary Coutant <ccoutant@google.com>
2157
2158 * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
2159 assembler.
2160 * testsuite/Makefile.in: Regenerate.
2161
2162 2013-11-17 H.J. Lu <hongjiu.lu@intel.com>
2163
2164 * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
2165 Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
2166 R_X86_64_PC32 and R_X86_64_PLT32, respectively.
2167 (Target_x86_64<size>::Scan::local): Likewise.
2168 (Target_x86_64<size>::Scan::global): Likewise.
2169 (Target_x86_64<size>::Relocate::relocate): Likewise.
2170 (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
2171 Likewise.
2172 (Target_x86_64<size>::Scan::check_non_pic(): Handle
2173 R_X86_64_PC32_BND.
2174
2175 * testsuite/Makefile.am (check_PROGRAMS): Add
2176 exception_x86_64_bnd_test.
2177 (exception_x86_64_bnd_test_SOURCES): New macro.
2178 (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
2179 (exception_x86_64_bnd_test_LDFLAGS): Likewise.
2180 (exception_x86_64_bnd_test_LDADD): Likewise.
2181 (exception_x86_64_bnd_1.o): New rule.
2182 (exception_x86_64_bnd_2.o): Likewise.
2183 * testsuite/Makefile.in: Regenerated.
2184
2185 2013-11-15 Alan Modra <amodra@gmail.com>
2186
2187 * powerpc.cc (Target_powerpc::glink_section): Provide non-const
2188 accessor.
2189 (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
2190 Only call ppc64_local_entry_offset for 64-bit. Restrict
2191 symval_for_branch lookup to ELFv1.
2192 (Stub_table::add_plt_call_entry): Use unsigned int off.
2193 (Output_data_glink::Address, invalid_address): New.
2194 (Output_data_glink::add_eh_frame): Move out of line. Add
2195 support for ELFv2.
2196 (Output_data_glink::add_global_entry, find_global_entry,
2197 global_entry_address): New functions.
2198 (Output_data_glink::global_entry_stubs_, end_branch_table_,
2199 ge_size): New variables.
2200 (Output_data_glink::set_final_data_size): Add global entry
2201 stub sizing.
2202 (Output_data_glink::do_write): Write global entry stubs.
2203 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
2204 parameter. Return true for ELFv2. Adjust callers.
2205 (Target_powerpc::Scan::local, global): Restrict opd lookup to
2206 ELFv1. Similarly for ifunc and dynamic relocation processing
2207 specific to ELFv1. Recognize that symbols are defined on
2208 their plt entries for ELFv2.
2209 (Target_powerpc::symval_for_branch): Assert if called for
2210 ELFv2 or ppc32.
2211 (Target_powerpc::Relocate::relocate): Use global entry plt
2212 stub for symbol value if such exists on ELFv2.
2213 (Target_powerpc::Relocate::relocate): Don't call
2214 symval_for_branch when ELFv2. Do adjust for local entry
2215 offset when ELFv2.
2216 (Target_powerpc::do_dynsym_value): Set symbols to global entry
2217 plt stub for ELFv2.
2218 (Target_powerpc::do_plt_address_for_global): Similarly.
2219
2220 2013-11-14 Cary Coutant <ccoutant@google.com>
2221
2222 Revert patch -- this did not fix the problem, and there is
2223 no race there.
2224
2225 2013-11-14 Cary Coutant <ccoutant@google.com>
2226
2227 PR gold/14860
2228 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2229 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2230 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2231 updating fde_offsets_.
2232 (Eh_frame_hdr::lock_): New data member.
2233
2234 2013-11-14 Cary Coutant <ccoutant@google.com>
2235
2236 * dwp.cc (Dwo_file_entry): New type.
2237 (File_list): Use Dwo_file_entry.
2238 (Dwo_file::verify): New function.
2239 (Dwo_file::verify_dwo_list): New function.
2240 (Dwo_file::sized_verify_dwo_list): New function.
2241 (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
2242 list.
2243 (Dwp_options): New enum type.
2244 (dwp_options): Add --verify-only.
2245 (usage): Likewise.
2246 (main): Likewise.
2247 * dwp.h (gold_info): Add declaration.
2248
2249 2013-11-14 Cary Coutant <ccoutant@google.com>
2250
2251 PR gold/14860
2252 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2253 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2254 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2255 updating fde_offsets_.
2256 (Eh_frame_hdr::lock_): New data member.
2257
2258 2013-11-06 Cary Coutant <ccoutant@google.com>
2259
2260 PR gold/15758
2261 * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
2262 before reloc sections.
2263
2264 2013-11-04 Alan Modra <amodra@gmail.com>
2265
2266 * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
2267 (Symbol::needs_dynamic_reloc): Test new flag.
2268 * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
2269 (Target_powerpc::Scan::get_reference_flags): Add target param.
2270 Return FUNC_DESC_ABI for 64-bit ELFv1.
2271 (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
2272 call.
2273 (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
2274 (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
2275
2276 2013-10-31 Cary Coutant <ccoutant@google.com>
2277
2278 Restore support for dwp v2 DWARF package file format.
2279
2280 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2281 tu_length parameter. Adjust all callers.
2282 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2283 * dwp.cc: Include dwarf.h.
2284 (Section_bounds): New struct type.
2285 (Unit_set): New struct type.
2286 (Dwo_file::Dwo_file): Initialize new data member.
2287 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2288 Combine and rename to...
2289 (Dwo_file::read_unit_index): ...this.
2290 (Dwo_file::sized_read_compunit_index)
2291 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2292 (Dwo_file::sized_read_unit_index): ...this.
2293 (Dwo_file::copy_section): Remove section_name, is_str_offsets
2294 parameters; add section_id parameter.
2295 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2296 (Dwo_file::add_unit_set): ...this.
2297 (Dwo_file::shndx_map_): Remove.
2298 (Dwo_file::sect_offsets_): New data member.
2299 (Dwp_output_file::Dwp_output_file): Initialize new data members.
2300 (Dwp_output_file::add_section): Rename to...
2301 (Dwp_output_file::add_contribution): ...this.
2302 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2303 (Dwp_output_file::add_tu_set): Likewise.
2304 (Dwp_output_file::Contribution): New type.
2305 (Dwp_output_file::Section::contributions): New data member.
2306 (Dwp_output_file::Cu_or_tu_set): Remove.
2307 (Dwp_output_file::Section::Section): New ctor.
2308 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2309 (Dwp_output_file::Dwp_index::Section_table): New type.
2310 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2311 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2312 parameter.
2313 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2314 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2315 (Dwp_output_file::Dwp_index::section_table): New member function.
2316 (Dwp_output_file::Dwp_index::section_table_end): New member function.
2317 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2318 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2319 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2320 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2321 (Dwp_output_file::Dwp_index::section_table_): New data member.
2322 (Dwp_output_file::Dwp_index::section_mask_): New data member.
2323 (Dwp_output_file::add_output_section): New member function.
2324 (Dwp_output_file::write_new_section): New member function.
2325 (Dwp_output_file::write_contributions): New member function.
2326 (Dwp_output_file::section_id_map_): New data member.
2327 (class Dwo_id_info_reader): Remove.
2328 (class Unit_reader): New class.
2329 (get_dwarf_section_name): New function.
2330 (Dwo_file::read_executable): Adjust initializations of class data.
2331 (Dwo_file::read): Add support for v2 package file format.
2332 (Dwo_file::read_unit_index): Likewise.
2333 (Dwo_file::sized_read_unit_index): Likewise.
2334 (Dwo_file::copy_section): Likewise.
2335 (Dwo_file::add_unit_set): Likewise.
2336 (Dwp_output_file::add_output_section): Likewise.
2337 (Dwp_output_file::add_contribution): Likewise.
2338 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2339 for empty slot.
2340 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2341 file format.
2342 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2343 slot.
2344 (Dwp_output_file::initialize): Remove unused function.
2345 (Dwp_output_file::finalize): Add support for v2 package file format.
2346 (Dwp_output_file::write_index): Likewise.
2347 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2348 function prototype.
2349
2350 2013-10-31 Cary Coutant <ccoutant@google.com>
2351
2352 * configure.ac: Fix check for -fmerge-constants.
2353 * configure.ac: Regenerate.
2354
2355 2013-10-30 Roland McGrath <mcgrathr@google.com>
2356
2357 * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
2358 Correct 9-byte nop sequence to match what the assembler generates.
2359
2360 2013-10-30 Alan Modra <amodra@gmail.com>
2361
2362 * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
2363 ppc64_local_entry_offset, ppc64_local_entry_offset,
2364 do_read_symbols): New functions.
2365 (Powerpc_relobj::e_flags_, st_other_): New vars.
2366 (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
2367 (Powerpc_dynobj::abiversion, set_abiversion): New functions.
2368 (Powerpc_relobj::e_flags_): New var.
2369 (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
2370 and adjust for ELFv2.
2371 (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
2372 (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
2373 (Powerpc_dynobj::do_find_special_sections): Likewise.
2374 (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
2375 (Target_powerpc::Branch_info::make_stub): Adjust stub destination
2376 to ELFv2 local entry.
2377 (Target_powerpc::do_relax): No thread safe barriers needed for
2378 ELFv2.
2379 (Output_data_plt_powerpc::initial_plt_entry_size_,
2380 plt_entry_size): Delete. Replace all uses with
2381 first_plt_entry_offset() and plt_entry_size().
2382 (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
2383 reserved_size parm. Update callers.
2384 (Output_data_plt_powerpc::entry_count): Update.
2385 (Output_data_plt_powerpc::first_plt_entry_offset): Make private
2386 and use Target_powerpc::first_plt_entry_offset().
2387 (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
2388 rename to plt_entry_size.
2389 (Output_data_plt_powerpc::add_ifunc_entry,
2390 add_local_ifunc_entry): Adjust reloc for ELFv2.
2391 (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
2392 (glink_eh_frame_fde_64v2): New.
2393 (Stub_table::plt_call_size): Support ELFv2 sizing.
2394 (Output_data_glink::add_eh_frame): Use the new FDE.
2395 (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
2396 (Stub_table::do_write): Write ELFv2 stubs and glink.
2397 (Target_powerpc::Relocate::relocate): Replaces nop after call
2398 with ld 2,24(1) and adjust local offset destination for ELFv2.
2399
2400 2013-10-30 Alan Modra <amodra@gmail.com>
2401
2402 * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
2403 (Target_powerpc::Scan::global, local): Likewise.
2404 (Target_powerpc::Relocate::relocate): Likewise. Check for overflow
2405 on all ppc64 @h and @ha relocs.
2406
2407 2013-10-14 Alan Modra <amodra@gmail.com>
2408
2409 * output.h (Output_data_got::add_constant): Tidy.
2410 (Output_data_got::add_constant_pair): New function.
2411 * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
2412 methods used so as to first call reserve_ent().
2413
2414 2013-10-11 Roland McGrath <mcgrathr@google.com>
2415
2416 * powerpc.cc (Output_data_got_powerpc): Remove unused methods
2417 add_got_entry and add_got_entry_pair.
2418
2419 * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
2420 (HAVE_PUBNAMES): Likewise.
2421 * configure: Regenerate.
2422
2423 * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
2424 * testsuite/Makefile.in: Regenerate.
2425
2426 * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
2427 Remove const from declaration.
2428 * target.cc (Sized_target::do_adjust_elf_header): Update definition.
2429 * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
2430 * output.h (Output_file_header): Remove const from member target_
2431 and corresponding constructor argument.
2432 * output.cc (Output_file_header::Output_file_header): Update prototype.
2433 (Output_file_header::do_sized_write): Use this->target_ in place
2434 of parameters()->target().
2435
2436 * testsuite/undef_symbol.cc (Foo::get_a): New method.
2437
2438 * configure.ac (MERGE_CONSTANTS_FLAG): New check.
2439 * configure: Regenerate.
2440 * Makefile.in: Regenerate.
2441 * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
2442 * testsuite/merge_string_literals_2.c: Likewise.
2443 * testsuite/Makefile.am
2444 (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
2445 (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
2446 literal -fmerge-constants.
2447 * testsuite/Makefile.in: Regenerate.
2448
2449 * i386.cc (Target_i386): Remove unused member dynbss_.
2450 * arm.cc (Target_arm): Likewise.
2451 * powerpc.cc (Target_powerpc): Likewise.
2452 * sparc.cc (Target_sparc): Likewise.
2453 * tilegx.cc (Target_tilegx): Likewise.
2454 * x86_64.cc (Target_x86_64): Likewise.
2455 * dwarf_reader.h (Dwarf_info_reader): Remove unused members
2456 type_signature_, type_offset_.
2457 * plugin.h (Plugin_hook): Remove unused member layout_.
2458 * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
2459 mapfile_.
2460 (Read_member): Remove unused members input_objects_, symtab_,
2461 mapfile_, layout_.
2462 (Check_library): Remove unused member symtab_.
2463 * archive.h (Lib_group): Remove unused member lib_.
2464 * archive.cc (Lib_group::Lib_group): Update initializer.
2465 * incremental.h (Incremental_binary): Remove unused member target_.
2466 (Incremental_script_entry): Removed unused member script_.
2467 * layout.h (Write_symbols_task): Remove unused member input_objects_.
2468 * icf.h (Icf): Remove unused member num_tracked_relocs.
2469
2470 * gold-threads.h (Once): Conditionalize member was_run_lock_ on
2471 [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
2472 its only use.
2473 * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
2474
2475 * archive.h: Use struct rather than class for forward declaration
2476 of Read_symbols_data.
2477
2478 2013-10-07 Cary Coutant <ccoutant@google.com>
2479
2480 PR gold/16010
2481 * testsuite/Makefile.am (icf_test): Fix dependencies.
2482 (icf_safe_test): Likewise.
2483 (icf_safe_so_test): Likewise.
2484 (large_symbol_alignment): Add empty _LDADD rule.
2485 * testsuite/Makefile.in: Regenerate.
2486
2487 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
2488
2489 PR gold/15927
2490 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
2491 relocation for R_X86_64_32 on x32.
2492
2493 2013-08-27 Roland McGrath <mcgrathr@google.com>
2494
2495 * output.cc (Output_segment::set_section_addresses): Take new
2496 Target* argument. If target->isolate_execinstr() and the segment
2497 is executable and starts at a target->abi_pagesize() boundary,
2498 pad its end out to a target->abi_pagesize() boundary with code fill.
2499 * output.h (Output_segment::set_section_addresses): Update decl.
2500 * layout.h (Layout::check_output_data_for_reset_values): Take new
2501 argument RELAX_OUTPUTS.
2502 (Layout): New member relax_output_list_.
2503 (Layout::add_relax_output): New method.
2504 * layout.cc (Layout::Layout): Update constructor.
2505 (Layout::reset_relax_output): New method.
2506 (Layout::clean_up_after_relaxation): Call it.
2507 (Layout::prepare_for_relaxation): Update caller.
2508 (Layout::set_segment_offsets): Update callers of set_section_addresses.
2509 Call reset_relax_output before re-processing segments for
2510 isolate_execinstr case.
2511 (Layout::write_data): Handle relax_output_list_.
2512 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
2513 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
2514
2515 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
2516
2517 PR binutils/15834
2518 * object.h: Fix typos.
2519
2520 2013-08-16 Roland McGrath <mcgrathr@google.com>
2521
2522 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
2523 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
2524
2525 2013-08-07 Cary Coutant <ccoutant@google.com>
2526
2527 Revert support for v2 DWP files:
2528
2529 2013-03-01 Cary Coutant <ccoutant@google.com>
2530
2531 Add dwp support for v2 DWARF package file format.
2532 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2533 tu_length parameter. Adjust all callers.
2534 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2535 * dwp.cc: Include dwarf.h.
2536 (Section_bounds): New struct type.
2537 (Unit_set): New struct type.
2538 (Dwo_file::Dwo_file): Initialize new data member.
2539 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2540 Combine and rename to...
2541 (Dwo_file::read_unit_index): ...this.
2542 (Dwo_file::sized_read_compunit_index)
2543 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2544 (Dwo_file::sized_read_unit_index): ...this.
2545 (Dwo_file::copy_section): Remove section_name, is_str_offsets
2546 parameters; add section_id parameter.
2547 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2548 (Dwo_file::add_unit_set): ...this.
2549 (Dwo_file::shndx_map_): Remove.
2550 (Dwo_file::sect_offsets_): New data member.
2551 (Dwp_output_file::Dwp_output_file): Initialize new data members.
2552 (Dwp_output_file::add_section): Rename to...
2553 (Dwp_output_file::add_contribution): ...this.
2554 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2555 (Dwp_output_file::add_tu_set): Likewise.
2556 (Dwp_output_file::Contribution): New type.
2557 (Dwp_output_file::Section::contributions): New data member.
2558 (Dwp_output_file::Cu_or_tu_set): Remove.
2559 (Dwp_output_file::Section::Section): New ctor.
2560 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2561 (Dwp_output_file::Dwp_index::Section_table): New type.
2562 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2563 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2564 parameter.
2565 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2566 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2567 (Dwp_output_file::Dwp_index::section_table): New member function.
2568 (Dwp_output_file::Dwp_index::section_table_end): New member function.
2569 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2570 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2571 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2572 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2573 (Dwp_output_file::Dwp_index::section_table_): New data member.
2574 (Dwp_output_file::Dwp_index::section_mask_): New data member.
2575 (Dwp_output_file::add_output_section): New member function.
2576 (Dwp_output_file::write_new_section): New member function.
2577 (Dwp_output_file::write_contributions): New member function.
2578 (Dwp_output_file::section_id_map_): New data member.
2579 (class Dwo_id_info_reader): Remove.
2580 (class Unit_reader): New class.
2581 (get_dwarf_section_name): New function.
2582 (Dwo_file::read_executable): Adjust initializations of class data.
2583 (Dwo_file::read): Add support for v2 package file format.
2584 (Dwo_file::read_unit_index): Likewise.
2585 (Dwo_file::sized_read_unit_index): Likewise.
2586 (Dwo_file::copy_section): Likewise.
2587 (Dwo_file::add_unit_set): Likewise.
2588 (Dwp_output_file::add_output_section): Likewise.
2589 (Dwp_output_file::add_contribution): Likewise.
2590 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2591 for empty slot.
2592 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2593 file format.
2594 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2595 slot.
2596 (Dwp_output_file::initialize): Remove unused function.
2597 (Dwp_output_file::finalize): Add support for v2 package file format.
2598 (Dwp_output_file::write_index): Likewise.
2599 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2600 function prototype.
2601
2602 2013-07-31 Cary Coutant <ccoutant@google.com>
2603
2604 * object.cc (Sized_relobj::do_output_section_address): New function.
2605 (Sized_relobj): Instantiate explicitly.
2606 * object.h (Object::output_section_address): New function.
2607 (Object::do_output_section_address): New function.
2608 (Sized_relobj::do_output_section_address): New function.
2609 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
2610
2611 2013-07-30 Cary Coutant <ccoutant@google.com>
2612 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
2613
2614 * parameters.cc (Parameters::entry): Return target-specific entry
2615 symbol name.
2616 * target.h (Target::entry_symbol_name): New function.
2617 (Target_info::entry_symbol_name): New data member.
2618
2619 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
2620 * i386.cc (Target_i386::i386_info): Likewise.
2621 (Target_i386_nacl::i386_nacl_info): Likewise.
2622 * sparc.cc (Target_sparc::sparc_info): Likewise.
2623 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
2624 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
2625 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
2626 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2627
2628 2013-07-22 Sterling Augustine <saugustine@google.com>
2629
2630 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
2631 Convert parameter shndx to local variable. Add parameters symtab
2632 and symtab_size. Scan over section names. Find relocation
2633 section corresponding to current section. Create and initialize
2634 reloc_mapper_ and reloc_type_.
2635 (Dwarf_pubnames_table::read_header): Add assertion. Change
2636 unit_length to off_t. Initialize member unit_length_. Fill in field
2637 cu_offset_.
2638 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2639 Initialize new fields unit_length_ and cu_offset_.
2640 (Dwarf_pubnames_table::read_section): Update prototype.
2641 (Dwarf_pubnames_table::cu_offset): New member function.
2642 (Dwarf_pubnames_table::subsection_size): Likewise.
2643 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
2644 New fields.
2645 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
2646 member functions public.
2647 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
2648 Update comment. Rework logic. Move repeated parts to...
2649 (Gdb_index_info_reader::read_pubtable): ...here. New function.
2650 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
2651 pubtypes_table_, and stmt_list_offset.
2652 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2653 Gdb_index::find_pubtype_offset,
2654 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
2655 (Gdb_index::pubnames_read): Update prototype and rework logic.
2656 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
2657 Forward declare.
2658 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2659 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
2660 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
2661 Gdb_index::map_pubtable_to_dies):
2662 Declare functions.
2663 (Gdb_index::pubnames_read): Update declaration.
2664 (Gdb_index::Pubname_offset_map): New type.
2665 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
2666 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
2667 Gdb_index::stmt_list_offset): Declare.
2668 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
2669 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
2670 Gdb_index::pubtypes_offset_): Remove.
2671
2672 2013-07-19 Roland McGrath <mcgrathr@google.com>
2673
2674 * options.h (General_options): Add -Trodata-segment option.
2675 * parameters.cc (Parameters::check_rodata_segment): New function.
2676 (Parameters::set_target_once): Call it.
2677 * parameters.h (Parameters): Declare it (private member function).
2678 * layout.cc (load_seg_unusable_for_headers): New function, broken
2679 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
2680 then validate rodata segment rather than text segment.
2681 (relaxation_loop_body): Call that.
2682 (is_text_segment): New function. Don't admit a non-executable
2683 segment if TARGET->isolate_execinstr().
2684 (set_segment_offsets): Call it. Honor -Trodata-segment option.
2685
2686 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
2687
2688 PR gold/15070
2689 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
2690 * nacl.h (Sniff_file::View::View): Request aligned view.
2691
2692 2013-07-11 Cary Coutant <ccoutant@google.com>
2693
2694 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
2695 correct BRLT entry size.
2696
2697 2013-07-03 Alan Modra <amodra@gmail.com>
2698
2699 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
2700 comment.
2701
2702 2013-07-01 Cary Coutant <ccoutant@google.com>
2703
2704 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
2705 reloc_type_.
2706 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
2707 (Dwarf_ranges_table::lookup_reloc): New function.
2708 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
2709 reloc_type_.
2710 (Dwarf_ranges_table::lookup_reloc): New function.
2711 (Dwarf_ranges_table::reloc_type_): New data member.
2712
2713 2013-06-27 Jing Yu <jingyu@google.com>
2714
2715 PR gold/15662
2716 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
2717 function.
2718 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
2719 (Target_powerpc::do_relax): Call the above.
2720
2721 2013-06-27 Cary Coutant <ccoutant@google.com>
2722
2723 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
2724 on garbage collected .opd section.
2725
2726 2013-06-27 Alan Modra <amodra@gmail.com>
2727
2728 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
2729 is non-zero.
2730 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
2731 (Target_powerpc::do_function_location): Likewise for loc->shndx.
2732
2733 2013-06-14 Cary Coutant <ccoutant@google.com>
2734
2735 * resolve.cc (Symbol::override_base): Don't override st_type
2736 from plugin placeholder symbols.
2737 (Symbol_table::resolve): Likewise.
2738 (Symbol_table::should_override): Don't complain about TLS mismatch
2739 if the TO symbol is a plugin placeholder.
2740 * testsuite/Makefile.am (plugin_test_tls): New test.
2741 * testsuite/Makefile.in: Regenerate.
2742 * testsuite/plugin_test_tls.sh: New test script.
2743 * testsuite/two_file_test_2_tls.cc: New test source.
2744 * testsuite/two_file_test_tls.cc: New test source.
2745
2746 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
2747
2748 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
2749 the maximum segment alignment is larger than the page size.
2750 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
2751 correctly aligns the symbols with large alignemnt.
2752 * testsuite/Makefile.in: Regenerate.
2753 * testsuite/large_symbol_alignment.cc: New file.
2754
2755 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
2756 Sriraman Tallam <tmsriram@google.com>
2757
2758 * options.h (sort_section): New option.
2759 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
2760 Rename from Input_section_sort_section_name_special_ordering_compare.
2761 (Input_section_sort_section_name_compare): New struct.
2762 * output.cc (Output_section::Input_section_sort_section_name_compare::
2763 operator()): New function.
2764 (Output_section::sort_attached_input_sections): Use new sort function
2765 for .text if --sort-section=name is specified.
2766 * layout.cc (Layout::make_output_section):
2767 Add sorting by name when --sort-section=name is specified.
2768 * testsuite/Makefile.am (text_section_grouping): Test option
2769 --sort-section=name.
2770 * testsuite/Makefile.in: Regenerate.
2771 * testsuite/section_sorting_name.cc: New file.
2772 * testsuite/section_sorting_name.sh: New file.
2773
2774 2013-05-21 Cary Coutant <ccoutant@google.com>
2775
2776 * symtab.h (Symbol::is_cxx_vtable): New function.
2777 * target-reloc.h (relocate_section): Check for vtable symbol.
2778 * testsuite/Makefile.am (missing_key_func.sh): New test case.
2779 * testsuite/Makefile.in: Regenerate.
2780 * testsuite/missing_key_func.cc: New test source.
2781 * testsuite/missing_key_func.sh: New test script.
2782
2783 2013-05-21 Cary Coutant <ccoutant@google.com>
2784
2785 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
2786 type of enclosing symbol.
2787 (Relocate_info::location): Check symbol type when describing symbol.
2788 * object.h (Symbol_location_info): Remove unused line_number;
2789 add enclosing_symbol_type.
2790 * testsuite/debug_msg.sh: Adjust expected output.
2791
2792 2013-05-13 Cary Coutant <ccoutant@google.com>
2793
2794 * configure.ac: Export DEFAULT_TARGET.
2795 * configure: Regenerate.
2796 * Makefile.in: Regenerate.
2797 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
2798 * testsuite/Makefile.in: Regenerate.
2799 * testsuite/debug_msg.sh: Delete duplicate tests.
2800 Don't check undef_int error message match for powerpc where the
2801 source file and line number aren't available.
2802
2803 2013-05-10 Roland McGrath <mcgrathr@google.com>
2804
2805 * options.h (General_options): Add --rosegment-gap option.
2806 * options.cc (finalize): --rosegment-gap implies --rosegment.
2807 * layout.cc (set_segment_offsets): Let user option override
2808 target->rosegment_gap().
2809
2810 2013-05-10 Roland McGrath <mcgrathr@google.com>
2811
2812 * options.h (General_options): Remove leading space from help
2813 messages for -nostdlib and --rosegment.
2814
2815 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
2816
2817 PR ld/15365
2818 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
2819
2820 2013-05-03 Alan Modra <amodra@gmail.com>
2821
2822 * merge.cc (Output_merge_string::do_add_input_section): Correct
2823 scan for number of strings. Rename vars to avoid shadowing.
2824 Include missing terminator in input_size_.
2825
2826 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
2827
2828 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
2829 Restore empty string handling.
2830
2831 2013-05-01 Cary Coutant <ccoutant@google.com>
2832
2833 * stringpool.cc (Stringpool_template::new_key_offset): Fix
2834 uninitialized warning.
2835
2836 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
2837
2838 * output.cc (Output_section::add_merge_input_section): Allow
2839 to merge sections if the alignment is more than character size.
2840 * merge.h (Output_merge_string::Output_merge_string): Remove
2841 assert.
2842 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
2843 only not-null strings. Check the alignment of strings.
2844 * stringpool.h
2845 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
2846 alignment as the argument.
2847 (Stringpool_template<Stringpool_char>::addralign_): New class member.
2848 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
2849 Align non-zero length strings according to the addralign_.
2850 (Stringpool_template<Stringpool_char>::set_string_offsets):
2851 Updating offsets according to the given alignment.
2852 * testsuite/Makefile.am (text_section_grouping): Test if string
2853 literals are getting merged.
2854 * testsuite/Makefile.in: Regenerate.
2855 * testsuite/merge_string_literals_1.c: New file.
2856 * testsuite/merge_string_literals_2.c: Ditto.
2857 * testsuite/merge_string_literals.sh: Ditto.
2858
2859 2013-04-26 Ian Lance Taylor <iant@google.com>
2860
2861 * target-reloc.h (relocate_section): If the reloc offset is out of
2862 range, pass VIEW as NULL to relocate.relocate.
2863 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
2864 * i386.cc (Target_i386::Relocate::relocate): Likewise.
2865 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2866 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2867 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
2868 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2869
2870 2013-04-26 Geoff Pike <gpike@chromium.org>
2871
2872 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
2873 * layout.cc (Hash_task): New class.
2874 (Layout::queue_build_id_tasks): New function.
2875 (Layout::write_build_id): Handle single-thread portion of build ID
2876 computation. (In some cases, all of it is single-threaded.) Replace
2877 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
2878 functionality in fewer lines of code.
2879 * layout.h (Layout::queue_build_id_tasks): New function declaration.
2880 * options.h (General_options): make "--build-id" default to tree
2881 rather than sha1. Add two new options related to --build-id=tree:
2882 --build-id-chunk-size-for-treehash and
2883 --build-id-min-file-size-for-treehash.
2884 * Makefile.am: add testing of --build-id=tree and related new options
2885 (these tests will be invoked by "make check").
2886 * Makefile.in: Regenerate.
2887
2888 2013-04-25 Alan Modra <amodra@gmail.com>
2889
2890 * configure.tgt: Add powerpcle and powerpc64le.
2891
2892 2013-04-22 Alan Modra <amodra@gmail.com>
2893
2894 PR gold/15355
2895 * layout.cc (Layout::segment_precedes): Allow more than one
2896 segment with the same type and flags.
2897
2898 2013-04-15 Cary Coutant <ccoutant@google.com>
2899
2900 * layout.cc (Layout::set_relocatable_section_offsets): Don't
2901 allocate space in file for BSS sections.
2902
2903 2013-04-15 Cary Coutant <ccoutant@google.com>
2904
2905 * script-sections.cc (Orphan_output_section): Reset address
2906 to zero after each orphaned section for relocatable links.
2907
2908 2013-04-15 Cary Coutant <ccoutant@google.com>
2909
2910 * symtab.cc (Symbol_table::sized_write_globals): Subtract
2911 section starting address for relocatable link.
2912 * testsuite/Makefile.am (script_test_11): New test.
2913 * testsuite/Makefile.in: Regenerate.
2914 * testsuite/script_test_11.c: New source file.
2915 * testsuite/script_test_11.t: New linker script.
2916
2917 2013-04-13 Alan Modra <amodra@gmail.com>
2918
2919 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
2920 owner when sections are not adjacent and exceed group size.
2921 (Target_powerpc::group_sections): Handle corner case.
2922 (Target_powerpc::Branch_info::make_stub): Handle case where
2923 stub table doesn't exist due to branches in non-exec sections.
2924 (Target_powerpc::Relocate::relocate): Likewise.
2925
2926 2013-04-11 Alan Modra <amodra@gmail.com>
2927
2928 PR gold/15354
2929 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
2930 .branch_lt to match bfd ld. Adjust comments throughout file.
2931
2932 2013-04-04 Ian Lance Taylor <iant@google.com>
2933
2934 GCC PR c++/56840
2935 * object.cc (do_layout_deferred_sections): Handle .eh_frame
2936 sections before checking whether they are included in the link.
2937
2938 2013-03-29 Sriraman Tallam <tmsriram@google.com>
2939
2940 * archive.cc (Archive::get_elf_object_for_member): Create the elf
2941 object before calling the plugin claim_file handler. Pass the elf
2942 object of the archive to the plugin. Delete the elf object if the
2943 plugin claims the file.
2944
2945 2013-03-21 Alan Modra <amodra@gmail.com>
2946
2947 * layout.cc (Layout::set_segment_offsets): Accept writable .text
2948 segment when omagic.
2949
2950 2013-03-21 Alan Modra <amodra@gmail.com>
2951
2952 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
2953 comparison warning.
2954 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
2955 uninitialized" warning.
2956
2957 2013-03-20 Alan Modra <amodra@gmail.com>
2958
2959 * symtab.h (Symbol::clear_version): New function.
2960 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
2961 is_needed by weak references. Clear version for symbols defined
2962 in as-needed objects that are not needed.
2963
2964 2013-03-15 Alan Modra <amodra@gmail.com>
2965
2966 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
2967 static and public. Add report_err param. Return false for data refs.
2968 (Target_powerpc::rela_dyn_section): New overloaded function.
2969 (Target_powerpc::plt_, iplt_): Elucidate.
2970 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
2971 (Output_data_plt_powerpc::do_write): Don't write .iplt.
2972 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
2973 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
2974 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
2975 push_branch and make_plt_entry for ifunc syms when
2976 reloc_needs_plt_for_ifunc.
2977 (Target_powerpc::Relocate::relocate): Don't use plt entry value
2978 for ifunc unless reloc_needs_plt_for_ifunc.
2979
2980 2013-03-15 Alan Modra <amodra@gmail.com>
2981
2982 * gc.h (gc_process_relocs): Don't look through function descriptors.
2983 * icf.cc (get_section_contents): Do so here instead.
2984
2985 2013-03-13 Alan Modra <amodra@gmail.com>
2986
2987 * powerpc.cc (is_branch_reloc): Forward declare.
2988 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
2989 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
2990 false for 64-bit, true for 32-bit non-branch relocs.
2991 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
2992 * testsuite/Makefile.am (icf_test): Use linker map file instead of
2993 nm output.
2994 (icf_safe_test): Generate linker map file as well as nm output.
2995 (icf_safe_so_test): Likewise.
2996 * testsuite/Makefile.in: Regenerate.
2997 * testsuite/icf_test.sh: Parse linker map file to determine
2998 section folding.
2999 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
3000 * testsuite/icf_safe_so_test.sh: Likewise.
3001 (X86_32_or_ARM_specific_safe_fold): Merge into..
3002 (arch_specific_safe_fold): ..this.
3003 (X86_64_specific_safe_fold): Delete unused function.
3004
3005 2013-03-12 Alan Modra <amodra@gmail.com>
3006
3007 * gc.h (gc_process_relocs): Look through function descriptors
3008 to determine shndx, symvalue and addend used by ICF. Tidy
3009 variable duplication.
3010
3011 2013-03-11 Alan Modra <amodra@gmail.com>
3012
3013 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
3014 * layout.cc (Layout_task_runner::run): ..to here.
3015 * symtab.h (struct Symbol_location): Extract from..
3016 (class Symbol_table): ..here.
3017 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
3018 * target.h (class Target): Add function_location and
3019 do_function_location functions.
3020 (class Sized_target): Add do_function_location.
3021 * object.h (class Sized_relobj_file): Move find_shdr..
3022 (class Object): ..to here.
3023 * object.cc: Likewise. Update to suit. Instantiate.
3024 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
3025 * powerpc.cc (class Powerpc_dynobj): New.
3026 (Target_powerpc::do_function_location): New function.
3027 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
3028 (Powerpc_dynobj::do_read_symbols): New function.
3029 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
3030
3031 2013-03-08 Ian Lance Taylor <iant@google.com>
3032
3033 * options.cc (General_options::string_to_object_format): Accept
3034 "default".
3035
3036 2013-03-08 Alan Modra <amodra@gmail.com>
3037
3038 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
3039 pointer to Post_fde.
3040 (struct Post_fde): Move definition to here..
3041 * ehframe.cc (struct Post_fde): ..from here.
3042 (Cie::write): Don't alloc Post_fde.
3043 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
3044
3045 2013-03-07 Alan Modra <amodra@gmail.com>
3046
3047 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
3048 relocation referencing .LC0.
3049 * testsuite/discard_locals_test.sh: Remove FIXMEs.
3050
3051 2013-03-07 Alan Modra <amodra@gmail.com>
3052
3053 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
3054 always_inline. Add assembly for powerpc to avoid GOT.
3055
3056 2013-03-07 Alan Modra <amodra@gmail.com>
3057
3058 * testsuite/script_test_10.sh: Don't test .bss section
3059 header number.
3060
3061 2013-03-06 Alan Modra <amodra@gmail.com>
3062
3063 * powerpc.cc (class Powerpc_relobj): Move some member functions.
3064 (Target_powerpc::symval_for_branch): Add symtab param. Update
3065 all callers. Handle folded sections.
3066 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
3067 to Powerpc_relobj.
3068 (Global_symbol_visitor_opd::operator()): Likewise.
3069
3070 2013-03-04 Alan Modra <amodra@gmail.com>
3071
3072 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
3073 * testsuite/Makefile.in: Regenerate.
3074
3075 2013-03-01 Cary Coutant <ccoutant@google.com>
3076
3077 Add dwp support for v2 DWARF package file format.
3078 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
3079 tu_length parameter. Adjust all callers.
3080 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
3081 * dwp.cc: Include dwarf.h.
3082 (Section_bounds): New struct type.
3083 (Unit_set): New struct type.
3084 (Dwo_file::Dwo_file): Initialize new data member.
3085 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
3086 Combine and rename to...
3087 (Dwo_file::read_unit_index): ...this.
3088 (Dwo_file::sized_read_compunit_index)
3089 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
3090 (Dwo_file::sized_read_unit_index): ...this.
3091 (Dwo_file::copy_section): Remove section_name, is_str_offsets
3092 parameters; add section_id parameter.
3093 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
3094 (Dwo_file::add_unit_set): ...this.
3095 (Dwo_file::shndx_map_): Remove.
3096 (Dwo_file::sect_offsets_): New data member.
3097 (Dwp_output_file::Dwp_output_file): Initialize new data members.
3098 (Dwp_output_file::add_section): Rename to...
3099 (Dwp_output_file::add_contribution): ...this.
3100 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
3101 (Dwp_output_file::add_tu_set): Likewise.
3102 (Dwp_output_file::Contribution): New type.
3103 (Dwp_output_file::Section::contributions): New data member.
3104 (Dwp_output_file::Cu_or_tu_set): Remove.
3105 (Dwp_output_file::Section::Section): New ctor.
3106 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
3107 (Dwp_output_file::Dwp_index::Section_table): New type.
3108 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
3109 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
3110 parameter.
3111 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
3112 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
3113 (Dwp_output_file::Dwp_index::section_table): New member function.
3114 (Dwp_output_file::Dwp_index::section_table_end): New member function.
3115 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
3116 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
3117 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
3118 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
3119 (Dwp_output_file::Dwp_index::section_table_): New data member.
3120 (Dwp_output_file::Dwp_index::section_mask_): New data member.
3121 (Dwp_output_file::add_output_section): New member function.
3122 (Dwp_output_file::write_new_section): New member function.
3123 (Dwp_output_file::write_contributions): New member function.
3124 (Dwp_output_file::section_id_map_): New data member.
3125 (class Dwo_id_info_reader): Remove.
3126 (class Unit_reader): New class.
3127 (get_dwarf_section_name): New function.
3128 (Dwo_file::read_executable): Adjust initializations of class data.
3129 (Dwo_file::read): Add support for v2 package file format.
3130 (Dwo_file::read_unit_index): Likewise.
3131 (Dwo_file::sized_read_unit_index): Likewise.
3132 (Dwo_file::copy_section): Likewise.
3133 (Dwo_file::add_unit_set): Likewise.
3134 (Dwp_output_file::add_output_section): Likewise.
3135 (Dwp_output_file::add_contribution): Likewise.
3136 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
3137 for empty slot.
3138 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
3139 file format.
3140 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
3141 slot.
3142 (Dwp_output_file::initialize): Remove unused function.
3143 (Dwp_output_file::finalize): Add support for v2 package file format.
3144 (Dwp_output_file::write_index): Likewise.
3145 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
3146 function prototype.
3147
3148 2013-03-01 Cary Coutant <ccoutant@google.com>
3149
3150 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
3151 function into class definition in header file.
3152 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
3153 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
3154 New function.
3155 (Dwarf_info_reader::check_buffer): Move here from .cc file.
3156
3157 2013-02-28 Alan Modra <amodra@gmail.com>
3158
3159 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
3160 * target.cc (Target::do_plt_fde_location): New function.
3161 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
3162 accessor function, and constructor param.
3163 (struct Post_fde, Post_fdes): Declare.
3164 (Cie::write): Add post_fdes param.
3165 * ehframe.cc (Fde::write): Use plt_fde_location.
3166 (struct Post_fde): Define.
3167 (Cie::write): Stash FDEs added post merge mapping.
3168 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
3169 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
3170 (Eh_frame::do_sized_write): Arrange to write post map FDES after
3171 other FDEs.
3172 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
3173 (Target_powerpc::has_glink): New function.
3174 (Target_powerpc::do_relax): Add eh_frame info for stubs.
3175 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
3176 glink_eh_frame_fde_32, default_fde): New data.
3177 (Stub_table::eh_frame_added_): New var.
3178 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
3179 Make const.
3180 (Stub_table::add_eh_frame): New function.
3181 (Output_data_glink::add_eh_frame): New function.
3182 (Target_powerpc::make_glink_section): Call add_eh_frame.
3183
3184 2013-02-15 Ian Lance Taylor <iant@google.com>
3185
3186 * options.h (DEFINE_uint64_alias): Define.
3187 (class General_options): Add -Ttext-segment as an alias for
3188 -Ttext.
3189
3190 2013-02-15 Alan Modra <amodra@gmail.com>
3191
3192 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
3193 (Stub_table::do_write): ..here, two places.
3194 (Stub_table::plt_call_size): Use it here too.
3195
3196 2013-02-11 Ian Lance Taylor <iant@google.com>
3197
3198 * descriptors.cc (Descriptors::close_all): New function.
3199 * descriptors.h (class Descriptors): Declare close_all.
3200 (close_all_descriptors): New inline function.
3201 * plugin.cc: Include "descriptors.h".
3202 (Plugin_manager::cleanup): Call close_all_descriptors.
3203
3204 2013-02-06 Alan Modra <amodra@gmail.com>
3205
3206 * README: Update coding style link.
3207
3208 2013-01-28 Cary Coutant <ccoutant@google.com>
3209
3210 * dwp.cc (File_list): New typedef.
3211 (Dwo_name_info_reader): New class.
3212 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
3213 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
3214 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
3215 (Dwo_file::read_executable): New function.
3216 (Dwo_file::read): Move common setup code to ...
3217 (Dwo_file::make_object): ... here.
3218 (dwp_options): Add --exec/-e.
3219 (usage): Likewise.
3220 (main): Likewise.
3221
3222 2013-01-24 Sriraman Tallam <tmsriram@google.com>
3223
3224 * layout.cc (Layout::layout): Check for option text_reorder.
3225 (Layout::make_output_section): Ditto.
3226 * options.h (text_reorder): New option.
3227 * output.cc (Input_section_sort_compare): Remove special ordering
3228 of section names.
3229 (Output_section::
3230 Input_section_sort_section_name_special_ordering_compare::
3231 operator()): New function.
3232 (Output_section::sort_attached_input_sections): Use new sort function
3233 for .text.
3234 * output.h (Input_section_sort_section_name_special_ordering_compare):
3235 New struct.
3236 * testsuite/Makefile.am (text_section_grouping): Test option
3237 --no-text-reorder
3238 * testsuite/Makefile.in: Regenerate.
3239 * testsuite/text_section_grouping.sh: Check order of functions without
3240 default text reordering.
3241
3242 2013-01-18 Mike Frysinger <vapier@gentoo.org>
3243
3244 * options.h (General_options): Change default to true for new_dtags.
3245
3246 2013-01-18 Mike Frysinger <vapier@gentoo.org>
3247
3248 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
3249 when enable_new_dtags is false. Only add DT_RUNPATH when
3250 enable_new_dtags is true.
3251
3252 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
3253
3254 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
3255 used in declaration and definition consistent.
3256 (Target_powerpc::symval_for_branch): Ditto.
3257
3258 2013-01-16 Sriraman Tallam <tmsriram@google.com>
3259
3260 * testsuite/plugin_final_layout.cc: Fix comment.
3261
3262 2013-01-16 Sriraman Tallam <tmsriram@google.com>
3263
3264 * layout.cc (Layout::layout): Do not do default sorting for
3265 text sections when section ordering is specified.
3266 (make_output_section): Ditto.
3267 * testsuite/plugin_final_layout.cc: Name the function sections
3268 to catch reordering issues.
3269
3270 2013-01-15 Alan Modra <amodra@gmail.com>
3271
3272 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
3273 plt-thread-safe.
3274
3275 2013-01-15 Alan Modra <amodra@gmail.com>
3276
3277 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
3278 * testsuite/Makefile.in: Regenerate.
3279
3280 2013-01-14 Alan Modra <amodra@gmail.com>
3281
3282 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
3283 * testsuite/Makefile.in: Regenerate.
3284
3285 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
3286
3287 PR bfd/14430
3288 Fix mingw gold build with plugins enabled
3289 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
3290 * configure.ac: Export DLOPEN_LIBS and add headers check.
3291 * plugin.cc: Handle non-dlfcn case.
3292 * Makefile.in: Regenerate.
3293 * config.in: Regenerate.
3294 * configure: Regenerate.
3295 * testsuite/Makefile.in: Regenerate.
3296
3297 2013-01-09 Sriraman Tallam <tmsriram@google.com>
3298
3299 * output.h (sort_attached_input_sections): Change to be public.
3300 * script-sections.cc
3301 (Output_section_definition::set_section_addresses): Sort
3302 attached input sections according to section order before linker
3303 script assigns section addresses.
3304 (Orphan_output_section::set_section_addresses): Sort
3305 attached input sections according to section order before linker
3306 script assigns section addresses.
3307 * Makefile.am (final_layout.sh): Use a simple linker script to
3308 check if section ordering still works.
3309 * Makefile.in: Regenerate.
3310
3311 2013-01-09 Ben Cheng <bccheng@google.com>
3312
3313 * arm.cc (Target_arm::attributes_accept_div): New function.
3314 (Target_arm::attributes_forbid_div): New function.
3315 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
3316 attribute using the same new functions as what bfd/elf32_arm.c
3317 does.
3318
3319 2013-01-07 Cary Coutant <ccoutant@google.com>
3320
3321 PR gold/14993
3322 * output.cc (Output_section::add_input_section): For incremental
3323 updates, don't track input sections that are allocated from patch
3324 space.
3325
3326 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
3327 Ian Lance Taylor <iant@google.com>
3328
3329 PR gold/14897
3330 * configure.ac (--enable-ld): Removed.
3331 (install_as_default): Set to yes only for --enable-gold=default
3332 or --disable-ld.
3333 * configure: Regenerated.
3334
3335 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
3336
3337 * options.h (General_options): Add -fuse-ld= for GCC linker
3338 option compatibility.
3339
3340 2013-01-04 Cary Coutant <ccoutant@google.com>
3341
3342 * configure.ac: Fix typo restoring CXXFLAGS.
3343 * configure: Regenerate.
3344
3345 2013-01-04 Cary Coutant <ccoutant@google.com>
3346
3347 * testsuite/Makefile.am (CXXLINK_S): New macro.
3348 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
3349 * testsuite/Makefile.in: Regenerate.
3350
3351 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
3352
3353 * version.cc (print_version): Update copyright year to 2013.
3354
3355 2012-12-20 Ian Lance Taylor <iant@google.com>
3356
3357 * layout.cc (Layout::special_ordering_of_input_section): New
3358 function.
3359 (Layout::layout): If input section requires special ordering, must
3360 sort input sections.
3361 (Layout::make_output_section): May sort .text input sections.
3362 (Layout::is_section_name_prefix_grouped): Remove.
3363 * layout.h (class Layout): Declare
3364 special_ordering_of_input_section. Don't declare
3365 is_section_name_prefix_grouped.
3366 * output.cc (Output_section::add_input_section): Revert last
3367 change.
3368 (Output_section::Input_section_sort::match_file_name): Don't crash
3369 if called on output section data.
3370 (Output_section::Input_section_sort_compare): Sort based on
3371 special ordering.
3372 (Output_section::Input_section_sort_section_order_index_compare):
3373 Revert last patch.
3374 (Output_section::sort_attached_input_sections): Likewise.
3375
3376 2012-12-18 Sriraman Tallam <tmsriram@google.com>
3377
3378 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
3379 * layout.h (Layout::is_section_name_prefix_grouped): New function.
3380 * output.cc (Output_section::add_input_section): Check if section
3381 name contains special prefix. Keep input sections to sort such
3382 sections.
3383 (Output_section::Input_section_sort_section_order_index_compare
3384 ::operator()): Group sections according to prefixes.
3385 (Output_section::sort_attached_input_sections): Add condition to
3386 Input_section_entry constructor call.
3387 * testsuite/Makefile.am (text_section_grouping): New test.
3388 * testsuite/Makefile.in: Regenerate.
3389 * testsuite/text_section_grouping.cc: New file.
3390 * testsuite/text_section_grouping.sh: New file.
3391
3392 2012-12-17 Nick Clifton <nickc@redhat.com>
3393
3394 * Makefile.am: Add copyright notice.
3395 * NEWS: Likewise.
3396 * README: Likewise.
3397 * configure.ac: Likewise.
3398 * ftruncate.c: Likewise.
3399 * Makefile.in: Regenerate.
3400
3401 2012-12-14 Cary Coutant <ccoutant@google.com>
3402
3403 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
3404 --no-as-needed flag.
3405 (exception_separate_shared_12_test): Likewise.
3406 (incremental_copy_test): Likewise.
3407 * testsuite/Makefile.in: Regenerate.
3408
3409 2012-12-14 Cary Coutant <ccoutant@google.com>
3410
3411 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
3412 (Dwp_output_file::Dwp_index::enter_set): Add assert.
3413
3414 2012-12-12 Alan Modra <amodra@gmail.com>
3415
3416 * powerpc.cc (class Track_tls): New.
3417 (class Relocate, class Scan): Inherit Track_tls.
3418 (Target_powerpc::Scan::local, global): Track tls optimization
3419 and avoid creating plt entry for __tls_get_addr if all uses
3420 are optimized away.
3421 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
3422
3423 2012-12-12 Alan Modra <amodra@gmail.com>
3424
3425 * options.h (General_options): Add --toc-sort/--no-toc-sort.
3426 Replace no_toc_optimize with toc_optimize.
3427 * output.h (Output_section::input_sections): Provide non-const variant.
3428 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
3429 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
3430 accessors.
3431 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
3432 (class Sort_toc_sections): New.
3433 (Target_powerpc::do_finalize_sections): Sort toc sections.
3434 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
3435
3436 2012-12-10 Roland McGrath <mcgrathr@google.com>
3437
3438 * testsuite/binary_unittest.cc (read_all): New function.
3439 (Sized_binary_test): Use it instead of ::read.
3440 * fileread.cc (do_read): Don't assume pread always reads the whole
3441 amount in a single call.
3442
3443 2012-12-10 Alan Modra <amodra@gmail.com>
3444
3445 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
3446 Set EM_PPC64 or EM_PPC here.
3447 (Target_selector_powerpc::do_recognize): Delete.
3448
3449 2012-12-10 Alan Modra <amodra@gmail.com>
3450
3451 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
3452 stub_table_.
3453 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
3454
3455 2012-12-07 Roland McGrath <mcgrathr@google.com>
3456
3457 * testsuite/binary_unittest.cc (Sized_binary_test):
3458 Use open_descriptor rather than ::open.
3459
3460 2012-12-07 Alan Modra <amodra@gmail.com>
3461
3462 * powerpc.cc (Stub_table::do_write): Delete redundant Address
3463 typedef and invalid_address constant.
3464 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
3465 instantiate constants.
3466
3467 2012-12-06 Roland McGrath <mcgrathr@google.com>
3468
3469 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
3470 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
3471 * aclocal.m4: Regenerate.
3472 * configure: Regenerate.
3473 * Makefile.in: Regenerate.
3474 * testsuite/Makefile.in: Regenerate.
3475
3476 2012-12-07 Alan Modra <amodra@gmail.com>
3477
3478 * options.h (General_options): Add no_toc_optimize.
3479 * powerpc.cc (ok_lo_toc_insn): New function.
3480 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
3481
3482 2012-12-06 Alan Modra <amodra@gmail.com>
3483
3484 * options.h (General_options): Add plt_align, plt_static_chain,
3485 plt_thread_safe. Update stub_group_size help text.
3486 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
3487 for new plt_thread_safe_ var.
3488 (use_plt_offset): Correct comments.
3489 (Target_powerpc::do_relax): Look for thread creation symbols to
3490 determine default plt_thread_safe value. Clear plt call stubs
3491 as well as branch stubs each iteration.
3492 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
3493 insn constants.
3494 (l, hi, ha, write_insn): Move earlier.
3495 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
3496 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
3497 plt stubs too.
3498 (Stub_table::update_size): Adjust.
3499 (Stub_table::prev_size, set_prev_size): Delete.
3500 (Stub_table::stub_align): Let --plt-align affect result.
3501 (Stub_table::plt_call_size): Calculate sizes for various stubs.
3502 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
3503 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
3504 (Stub_table::do_write): Support more stub variants.
3505
3506 2012-12-04 Alan Modra <amodra@gmail.com>
3507
3508 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
3509 (Target_powerpc::do_define_standard_symbols): New function.
3510
3511 2012-12-03 Alan Modra <amodra@gmail.com>
3512
3513 * output.h: Formatting, whitespace.
3514
3515 2012-12-03 Alan Modra <amodra@gmail.com>
3516
3517 * layout.h (Layout::get_executable_sections): Declare.
3518 * layout.cc (Layout::get_executable_sections): New function.
3519 * arm.cc (Target_arm::group_sections): Use it.
3520 (Arm_output_section::group_sections): Delete now redundant test.
3521 * output.cc (Output_reloc::Output_reloc): Add is_relative.
3522 param to handle relative relocs.
3523 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
3524 (Output_data_reloc::add_absolute): Adjust.
3525 (Output_data_reloc::add_relative): New function.
3526 (Output_data::reset_data_size): New function.
3527 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
3528 (Output_section::set_addralign): New function.
3529 (Output_section::checkpoint_set_addralign): New function.
3530 (Output_section::clear_section_offsets_need_adjustment): New function.
3531 (Output_section::input_sections): Make public.
3532 * powerpc.cc (class Output_data_brlt_powerpc): New.
3533 (class Stub_table, class Stub_control): New.
3534 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
3535 stub_table_, set_stub_table, stub_table): New vectors and accessor
3536 functions.
3537 (Target_powerpc::do_may_relax, do_relax, push_branch,
3538 new_stub_table, stub_tables, brlt_section, group_sections,
3539 add_branch_lookup_table, find_branch_lookup_table,
3540 write_branch_lookup_table, make_brlt_section): New functions.
3541 (Target_powerpc::struct Sort_sections, class Branch_info): New.
3542 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
3543 branch_info_): New vars.
3544 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
3545 make call stubs here.
3546 (Output_data_glink): Remove all call stub handling from this class.
3547 (Target_powerpc::Scan::local, global): Save interesting branch
3548 relocs and relocs for ifunc. Adjust calls to plt entry functions.
3549 (Target_powerpc::do_finalize_sections): Only make reg save/restore
3550 functions on final link.
3551 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
3552 Handle long branch destinations too.
3553 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
3554 do_plt_address_for_local): Adjust lookup of plt call stubs.
3555
3556 2012-11-30 Alan Modra <amodra@gmail.com>
3557
3558 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
3559 relocs against protected symbols when building 32-bit shared libs.
3560
3561 2012-11-30 Alan Modra <amodra@gmail.com>
3562
3563 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
3564 param. Call got_section() to make .got. Update all callers
3565 and their callers and so on.
3566
3567 2012-11-30 Alan Modra <amodra@gmail.com>
3568
3569 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
3570 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
3571 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
3572 value if it already exists.
3573
3574 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
3575
3576 PR gold/14858
3577 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
3578
3579 2012-11-14 Roland McGrath <mcgrathr@google.com>
3580
3581 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
3582 than bfc instruction for data sandboxing.
3583
3584 2012-11-08 Alan Modra <amodra@gmail.com>
3585
3586 * po/POTFILES.in: Regenerate.
3587
3588 2012-11-05 Alan Modra <amodra@gmail.com>
3589
3590 * configure.ac: Apply 2012-09-10 change to config.in here.
3591 * configure: Regenerate.
3592
3593 2012-11-05 Alan Modra <amodra@gmail.com>
3594
3595 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
3596 (struct Opd_ent): Use "Address" rather than "Offset".
3597 (Output_data_got_powerpc::got_base_offset): Return Valtype.
3598 (Target_powerpc::got_section): Make public.
3599 (Target_powerpc::scan_relocs): Move code setting symbols..
3600 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
3601 Create _SDA_BASE_ only when referenced.
3602
3603 2012-11-02 Roland McGrath <mcgrathr@google.com>
3604
3605 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
3606 from last change.
3607
3608 2012-11-01 Roland McGrath <mcgrathr@google.com>
3609
3610 * target.h (Sized_target::relocate_relocs): Use Elf_Off
3611 for offset_in_output_section parameter.
3612 (Sized_target::relocate_special_relocatable): Likewise.
3613 * arm.cc (Target_arm::relocate_relocs): Likewise.
3614 (Target_arm::relocate_special_relocatable): Likewise.
3615 * i386.cc (Target_i386::relocate_relocs): Likewise.
3616 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
3617 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
3618 * target-reloc.h (relocate_relocs): Likewise.
3619 * testsuite/testfile.cc (Target_test): Likewise.
3620 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
3621 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
3622
3623 * system.h: Move inclusion of <clocale> to after <libintl.h> in
3624 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
3625
3626 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
3627 parameter, which is unused in the [!F_SETFD] case.
3628
3629 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
3630 SYMNDX to off_t before comparing it to this->data_size().
3631 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
3632 * incremental.cc (Output_section_incremental_inputs::do_write):
3633 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
3634
3635 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
3636
3637 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
3638
3639 * gold.cc (Target_arm::do_adjust_elf_header): Add the
3640 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
3641 in EABI_VER5.
3642
3643 2012-10-29 Cary Coutant <ccoutant@google.com>
3644
3645 * dwp.cc (usage): Add file and exit status parameters;
3646 add --help and --version options.
3647 (print_version): New function.
3648 (main): Add --help and --version options.
3649
3650 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
3651
3652 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
3653 final_layout_sequence.txt.
3654 * testsuite/Makefile.in: Regenerated.
3655
3656 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
3657
3658 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
3659 COMPILE generated by automake.
3660 (LINK1): Likewise.
3661 (CXXCOMPILE1): Likewise.
3662 (CXXLINK1): Likewise.
3663 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
3664 (LINK): Likewise.
3665 (CXXCOMPILE): Likewise.
3666 (CXXLINK): Likewise.
3667 * testsuite/Makefile.in: Regenerated.
3668
3669 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
3670
3671 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
3672 on bad fwrite return.
3673
3674 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
3675
3676 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
3677 on val.
3678
3679 2012-10-23 Cary Coutant <ccoutant@google.com>
3680
3681 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
3682 * testsuite/Makefile.in: Regenerate.
3683 * testsuite/dwp_test.h: New source file.
3684 * testsuite/dwp_test_1.cc: New source file.
3685 * testsuite/dwp_test_1.s: New source file.
3686 * testsuite/dwp_test_1.sh: New source file.
3687 * testsuite/dwp_test_1b.cc: New source file.
3688 * testsuite/dwp_test_1b.s: New source file.
3689 * testsuite/dwp_test_2.cc: New source file.
3690 * testsuite/dwp_test_2.s: New source file.
3691 * testsuite/dwp_test_2.sh: New source file.
3692 * testsuite/dwp_test_main.cc: New source file.
3693 * testsuite/dwp_test_main.s: New source file.
3694
3695 2012-10-23 Cary Coutant <ccoutant@google.com>
3696
3697 * dwp.h: New header file.
3698 * dwp.cc: New source file.
3699 * gold.h: Move shared declarations to system.h.
3700 * system.h: New header file.
3701 * Makefile.am: Add dwp.
3702 * Makefile.in: Regenerate.
3703
3704 2012-10-23 Cary Coutant <ccoutant@google.com>
3705
3706 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
3707 Dwarf_info_reader::read_from_pointer.
3708 (Dwarf_pubnames_table::read_header): Likewise.
3709 (Dwarf_pubnames_table::next_name): Likewise.
3710 (Dwarf_die::read_attributes): Likewise.
3711 (Dwarf_die::skip_attributes): Likewise.
3712 (Dwarf_info_reader::read_from_pointer): New function template.
3713 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
3714 (Dwarf_pubnames_table): Likewise.
3715 (Dwarf_info_reader::read_from_pointer): New function template.
3716 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
3717 Dwarf_pubnames_table ctor.
3718
3719 2012-10-23 Cary Coutant <ccoutant@google.com>
3720
3721 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
3722 abbrev_shndx.
3723 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
3724 abbrev_shndx_.
3725 (Dwarf_info_reader::set_abbrev_shndx): New method.
3726 (Dwarf_info_reader::abbrev_shndx_): New data member.
3727
3728 2012-10-23 Cary Coutant <ccoutant@google.com>
3729
3730 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
3731 from object, not parameters.
3732 (Dwarf_info_reader::parse): Likewise.
3733 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
3734 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
3735 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
3736 methods.
3737
3738 2012-10-23 Cary Coutant <ccoutant@google.com>
3739
3740 * fileread.cc (Input_file::Input_file): New constructor.
3741 * fileread.h (class Input_file): Add new constructor.
3742
3743 2012-10-18 Alan Modra <amodra@gmail.com>
3744
3745 PR gold/14727
3746 * object.cc (Relobj::is_section_name_included): Also match
3747 .sdata personality section.
3748
3749 2012-10-18 Alan Modra <amodra@gmail.com>
3750
3751 * target-reloc.h (class Default_comdat_behavior): New, package up..
3752 (get_comdat_behaviour): ..this.
3753 (relocate_section): Add Relocate_comdat_behavior template arg,
3754 adjust code to suit.
3755 * arm.cc (Target_arm::relocate_section): Adjust to suit.
3756 (Target_arm::scan_reloc_section): Likewise.
3757 * i386.cc (Target_i386::relocate_section): Likewise.
3758 * sparc.cc (Target_sparc::relocate_section): Likewise.
3759 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
3760 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
3761 * powerpc.cc (class Relocate_comdat_behavior): New.
3762 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
3763 gold::relocate_section with new template arg.
3764
3765 2012-10-18 Alan Modra <amodra@gmail.com>
3766
3767 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
3768 dynamic relocs for GOT_TPREL got entries, without symbol if
3769 resolving locally.
3770 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
3771 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
3772 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
3773
3774 2012-10-17 Alan Modra <amodra@gmail.com>
3775
3776 PR gold/14726
3777 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
3778
3779 2012-10-16 Sriraman Tallam <tmsriram@google.com>
3780
3781 * layout.cc (Layout::include_section): Keep sections marked
3782 SHF_EXCLUDE when doing relocatable links.
3783
3784 2012-10-16 Alan Modra <amodra@gmail.com>
3785
3786 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
3787 (Target_powerpc::do_finalize_sections): Call it.
3788 (Output_data_save_res): New class and supporting functions.
3789 (Target_powerpc::symval_for_branch): Only look up .opd entry for
3790 normal symbols defined in object files.
3791
3792 2012-10-12 Alan Modra <amodra@gmail.com>
3793
3794 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
3795 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
3796 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
3797 section if scan_opd_relocs not yet called.
3798 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
3799
3800 2012-10-12 Alan Modra <amodra@gmail.com>
3801
3802 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3803 add_local_ifunc_entry): Revert last change.
3804 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
3805
3806 2012-10-05 Alan Modra <amodra@gmail.com>
3807
3808 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
3809 do_plt_address_for_global): New functions.
3810 (Output_data_got_powerpc::do_write): Don't segfault when linking
3811 statically.
3812 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3813 add_local_ifunc_entry): Return true on adding entry..
3814 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
3815 glink->add_entry call. Remove unused symtab param. Adjust calls.
3816 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
3817 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
3818 set up symbols here.
3819 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
3820 syms here. Do so even when no .iplt. Don't segfault when linking
3821 statically.
3822 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
3823 new variants without reloc param.
3824 (Glink_sym_ent::Glink_sym_ent): Likewise.
3825 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
3826 reloc when refs will resolve to plt call stub.
3827 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
3828 R_PPC_PLTREL24 to resolve locally.
3829 (Target_powerpc::Scan::global): Correct ifunc handling.
3830 (Target_powerpc::Relocate::relocate): Correct local sym glink
3831 lookup. Don't destroy "value" when we have a plt call stub,
3832 and when checking plt call validity.
3833 (Target_powerpc::do_dynsym_value): Simplify.
3834
3835 2012-10-05 Alan Modra <amodra@gmail.com>
3836
3837 * i386.cc (Output_data_plt_i386::address_for_global,
3838 address_for_local): Add plt offset to returned value. Adjust uses.
3839 * sparc.cc (Output_data_plt_sparc::address_for_global,
3840 address_for_local): Likewise.
3841 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
3842 address_for_local): Likewise.
3843 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
3844 address_for_local): Likewise.
3845 * target.h (Target::plt_address_for_global, plt_address_for_local):
3846 Update comment.
3847 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
3848 (Output_data_got::Got_entry::write): Nor here.
3849 * output.h: Comment fix.
3850
3851 2012-10-02 Jiong Wang <jiwang@tilera.com>
3852
3853 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
3854 global_offset_table_ value for larget got.
3855 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
3856
3857 2012-09-29 Alan Modra <amodra@gmail.com>
3858
3859 * powerpc.cc (Target_powerpc::iplt_): New output section.
3860 (Target_powerpc::iplt_section, make_iplt_section,
3861 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
3862 (Target_powerpc::make_plt_entry): Handle ifunc syms.
3863 Target_powerpc::plt_entry_count): Count iplt entries too.
3864 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
3865 reloc section in constructor. New params.
3866 (Target_powerpc::make_plt_section): Create reloc section here instead.
3867 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
3868 functions.
3869 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
3870 (Output_data_glink::add_entry, find_entry): New functions to
3871 deal with local syms.
3872 (Glink_sym_ent): Add support for local syms.
3873 (Output_data_glink::do_write): Handle ifunc plt entries.
3874 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3875 (Target_powerpc::Scan::local, global): Handle ifunc syms.
3876 (Target_powerpc::Relocate::relocate): Likewise.
3877 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
3878
3879 2012-09-25 Alan Modra <amodra@gmail.com>
3880
3881 * object.h (Sized_relobj_file::adjust_local_symbol,
3882 do_adjust_local_symbol): New functions.
3883 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
3884 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
3885 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
3886 and irregular opd entry spacing.
3887 (Powerpc_relobj::do_read_relocs): Add opd size checks.
3888 (Global_symbol_visitor_opd): New functor.
3889 (Target_powerpc::do_finalize_sections): Omit global symbols defined
3890 on deleted opd entries.
3891
3892 2012-09-15 Jiong Wang <jiwang@tilera.com>
3893
3894 * tilegx.cc: New file.
3895 * Makefile.am (TARGETSOURCES): Add tilegx.cc
3896 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
3897 * configure.tgt: Add entries for tilegx*.
3898 * configure.ac: Likewise.
3899 * Makefile.in: Rebuild.
3900 * configure: Likewise.
3901 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
3902 tilegx.
3903
3904 2012-09-13 Alan Modra <amodra@gmail.com>
3905
3906 * target-reloc.h (scan_relocs): Call scan.local for relocs
3907 against symbols in discarded sections. Pass is_discarded
3908 param.
3909 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
3910 Add is_discarded param.
3911 * powerpc (Target_powerpc::Scan::local): Likewise. Use
3912 is_discarded to flag opd entry as discarded. Don't emit dyn
3913 relocs on such entries.
3914 (Target_powerpc::Scan::global): Similarly detect and handle
3915 such opd entries.
3916 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
3917 opd_ent_. Update all uses.
3918 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
3919 (Target_powerpc::relocate_section): Zero out discarded opd
3920 entry relocs.
3921
3922 2012-09-12 Ian Lance Taylor <iant@google.com>
3923
3924 PR gold/14570
3925 * output.cc: Rename Output_data_got template parameter from size
3926 to got_size for all functions. Compile all variants of
3927 Output_data_got.
3928 (Output_data_got::Got_entry::write): Correct use of size for
3929 symbol value. Use local_is_tls rather than casting to
3930 Sized_relobj_file.
3931 * object.h (class Object): Add local_is_tls and do_local_is_tls.
3932 (class Sized_relobj_file): Add do_local_is_tls.
3933 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
3934
3935 2012-09-11 Alan Modra <amodra@gmail.com>
3936
3937 PR gold/14566
3938 * layout.cc (Layout::set_segment_offsets): When using
3939 common-page-size alignment, ensure we are on a new max-page-size
3940 page.
3941 * output.cc (Output_segment::set_section_addresses): Use
3942 abi_pagesize, not common_pagesize for relro boundary.
3943 (Output_segment::set_offset): Likewise.
3944
3945 2012-09-11 Alan Modra <amodra@gmail.com>
3946
3947 * output.h (Output_data_got::add_global_tls, add_local_tls,
3948 add_local_tls_pair): New functions.
3949 (Output_data_got::add_local_pair_with_rel): Remove second
3950 reloc param. Expand comment.
3951 (Output_data_got::Got_entry): Rename use_plt_offset_ to
3952 use_plt_or_tls_offset_, similarly for constructor param.
3953 (Output_data_got::Got_entry::write): Add got_index param.
3954 * output.cc (Output_data_got::add_global_tls, add_local_tls,
3955 add_local_tls_pair): New functions.
3956 (Output_data_got::Got_entry::write): Handle tls symbols
3957 with use_plt_or_tls_offset_ set specially.
3958 (Output_data_got::add_local_pair_with_rel): Only one reloc.
3959 (Output_data_got::do_write): Replace iterator with index, pass
3960 index to entry write function.
3961 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
3962 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
3963 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
3964 call.
3965 * i386.cc (Target_i386::Scan::local): Likewise.
3966 * sparc.cc (Target_sparc::Scan::local): Likewise.
3967 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
3968 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
3969 do_tls_offset_for_global): New functions.
3970 (Target_powerpc::Scan::local): Correct TLS relocations and got
3971 entry values.
3972 (Target_powerpc::Scan::global): Don't emit unnecessary
3973 dynamic relocations on TLS GOT entries.
3974
3975 2012-09-10 Matthias Klose <doko@ubuntu.com>
3976
3977 * config.in: Disable sanity check for kfreebsd.
3978
3979 2012-09-10 Sterling Augustine <saugustine@google.com>
3980
3981 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
3982 (Gdb_index::pubtypes_read): New parameter.
3983 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
3984 to calls.
3985 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
3986 pubtypes_object_.
3987
3988 2012-09-09 Alan Modra <amodra@gmail.com>
3989
3990 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
3991 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
3992 * gc.h (gc_process_relocs): Call target gc_add_reference.
3993 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
3994 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
3995 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
3996 unnecessary cast.
3997 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
3998 to cater for when we don't need code offset. Update use.
3999 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
4000 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
4001 set_opd_valid): New functions.
4002 (Target_powerpc::do_gc_add_reference): New function.
4003 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
4004 stashed refs.
4005 (Target_powerpc::do_gc_mark_symbol): New function.
4006
4007 2012-09-06 Cary Coutant <ccoutant@google.com>
4008
4009 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
4010 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
4011 (Dwarf_die::skip_attributes): Likewise.
4012 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
4013 * testsuite/gdb_index_test.cc (inline_func_1): New function.
4014 (main): Call it.
4015 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
4016
4017 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
4018
4019 * testsuite/script_test_3.t: Add .got.plt output section
4020 statement.
4021 * testsuite/script_test_4.t: Likewise.
4022
4023 2012-09-05 Alan Modra <amodra@gmail.com>
4024
4025 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
4026 update all uses and lose "enum" when using type.
4027
4028 2012-09-05 Alan Modra <amodra@gmail.com>
4029
4030 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
4031 * configure: Regenerate.
4032 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
4033 (plugin_final_layout.stdout): Likewise.
4034 (memory_test): Set page sizes to 0x1000.
4035 * testsuite/Makefile.in: Regenerate.
4036 * testsuite/discard_locals_test.sh: Add FIXME comment.
4037 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
4038 * testsuite/pr14265.t: Add .got output section statement.
4039 * testsuite/script_test_2.t: Likewise.
4040 * testsuite/script_test_3.t: Likewise.
4041 * testsuite/script_test_4.t: Likewise.
4042 * testsuite/script_test_5.t: Likewise.
4043 * testsuite/script_test_6.t: Likewise.
4044 * testsuite/script_test_7.t: Likewise.
4045 * testsuite/script_test_9.t: Likewise.
4046
4047 2012-09-05 Alan Modra <amodra@gmail.com>
4048
4049 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
4050 (Powerpc_relocate_functions::Status): New typedef.
4051 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4052 (Target_powerpc::Scan::local): Handle REL64.
4053 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
4054 for REL32 and REL64.
4055 (Target_powerpc::symval_for_branch): New function, extracted from..
4056 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
4057 checks. Report overflow errors.
4058
4059 2012-09-05 Alan Modra <amodra@gmail.com>
4060
4061 * object.h (Sized_relobj_file::emit_relocs): Delete.
4062 (Sized_relobj_file::emit_relocs_reltype): Delete.
4063 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
4064 relocate_relocs for --emit-relocs.
4065 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
4066 * output.h: Update comment.
4067 (Output_segment::first_section): New function.
4068 (Output_segment::first_section_load_address): Use first_section.
4069 * output.cc (Output_segment::first_section): New function extracted..
4070 (Output_segment::first_section_load_address): ..from here. Delete.
4071 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
4072 * target.h (Sized_target::relocate_for_relocatable): Likewise.
4073 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
4074 adjust call to target.h function.
4075 * i386.cc (Target_i386): Likewise.
4076 * sparc.cc (Target_sparc): Likewise.
4077 * x86_64.cc (Target_x86_64): Likewise.
4078 * powerpc.cc (Target_powerpc): Likewise.
4079 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
4080 first tls section has section symbol for optimised local dynamic
4081 output relocs.
4082 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
4083 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
4084 optimised tls code.
4085 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
4086 Rename to relocate_relocs. Update error message.
4087
4088 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
4089
4090 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
4091 --just-symbols.
4092
4093 2012-08-31 Alan Modra <amodra@gmail.com>
4094
4095 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
4096 (Powerpc_relobj::toc_base_offset): New stub function.
4097 (Target_powerpc): Add tp_offset, dtp_offset. Rename
4098 got_mod_index_offset to tlsld_got_offset. Update all refs.
4099 (Target_powerpc::Relocate::enum skip_tls): New.
4100 (Target_powerpc::call_tls_get_addr_): New var.
4101 (Target_powerpc::is_branch_reloc): Move to file scope.
4102 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
4103 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
4104 New functions.
4105 (Target_powerpc::enum Got_type): Delete old values, add new ones.
4106 (powerpc_info): Correct common_pagesize for ppc64.
4107 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
4108 (Powerpc_relocate_functions): Add overflow check enums and functions.
4109 Add non-shift version of rela, rela_ua. Delete all rel public
4110 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
4111 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
4112 addr16_ha3, addr14 functions.
4113 (Output_data_got_powerpc::add_constant_pair): New function.
4114 (Output_data_got_powerpc::got_base_offset): Likewise.
4115 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
4116 (instruction constants): Sort, add some more.
4117 (Output_data_glink::do_write): Add and use Address typedef. Use
4118 object->toc_base_offset() stub for 64-bit.
4119 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
4120 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4121 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
4122 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
4123 Always treat .opd relocs as against locally defined symbol.
4124 Correct condition for RELATIVE relocs.
4125 (Target_powerpc::do_finalize_sections): Test for NULL sections.
4126 (Target_powerpc::Relocate::relocate): Use plt call stub as value
4127 for 32-bit syms with a plt entry. Correct ppc64 toc base
4128 calculations. Handle TLS relocs, and more. Add overflow
4129 checking and adjust for Powerpc_relocate_functions changes.
4130 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
4131 Reinstate --emit-relocs code with FIXME.
4132
4133 2012-08-30 Alan Modra <amodra@gmail.com>
4134
4135 * layout.cc (Layout::set_segment_offsets): Set p_align to
4136 abi_pagesize, not common_pagesize.
4137 (Layout::relaxation_loop_body): Similarly use abi_pagesize
4138 to determine whether file header can go in segment.
4139
4140 2012-08-30 Alan Modra <amodra@gmail.com>
4141
4142 * output.h (Output_reloc::Output_reloc <output section>): Add
4143 is_relative param. Adjust calls.
4144 (Output_reloc::add_output_section_relative): New functions.
4145 * output.cc (Output_reloc::Output_reloc <output section>): Handle
4146 is_relative.
4147 (Output_reloc::symbol_value): Handle SECTION_CODE.
4148
4149 2012-08-24 Sriraman Tallam <tmsriram@google.com>
4150
4151 * gold.cc (queue_middle_tasks): Call layout again when unique
4152 segments for sections is desired.
4153 * layout.cc (Layout::Layout): Initialize new members.
4154 (Layout::get_output_section_flags): New function.
4155 (Layout::choose_output_section): Call get_output_section_flags.
4156 (Layout::layout): Make output section for mapping to a unique segment.
4157 (Layout::insert_section_segment_map): New function.
4158 (Layout::attach_allocated_section_to_segment): Make unique segment for
4159 output sections marked so.
4160 (Layout::segment_precedes): Check for unique segments when sorting.
4161 * layout.h (Layout::Unique_segment_info): New struct.
4162 (Layout::Section_segment_map): New typedef.
4163 (Layout::insert_section_segment_map): New function.
4164 (Layout::get_output_section_flags): New function.
4165 (Layout::is_unique_segment_for_sections_specified): New function.
4166 (Layout::set_unique_segment_for_sections_specified): New function.
4167 (Layout::unique_segment_for_sections_specified_): New member.
4168 (Layout::section_segment_map_): New member.
4169 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
4170 Rename is_gc_pass_one to is_pass_one.
4171 Rename is_gc_pass_two to is_pass_two.
4172 Rename is_gc_or_icf to is_two_pass.
4173 Check for which pass based on whether symbols data is present.
4174 Make it two pass when unique segments for sections is desired.
4175 * output.cc (Output_section::Output_section): Initialize new
4176 members.
4177 * output.h (Output_section::is_unique_segment): New function.
4178 (Output_section::set_is_unique_segment): New function.
4179 (Output_section::is_unique_segment_): New member.
4180 (Output_section::extra_segment_flags): New function.
4181 (Output_section::set_extra_segment_flags): New function.
4182 (Output_section::extra_segment_flags_): New member.
4183 (Output_section::segment_alignment): New function.
4184 (Output_section::set_segment_alignment): New function.
4185 (Output_section::segment_alignment_): New member.
4186 (Output_segment::Output_segment): Initialize is_unique_segment_.
4187 (Output_segment::is_unique_segment): New function.
4188 (Output_segment::set_is_unique_segment): New function.
4189 (Output_segment::is_unique_segment_): New member.
4190 * plugin.cc (allow_unique_segment_for_sections): New function.
4191 (unique_segment_for_sections): New function.
4192 (Plugin::load): Add new functions to transfer vector.
4193 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
4194 * Makefile.in: Regenerate.
4195 * testsuite/plugin_final_layout.sh: Check if unique segment
4196 functionality works.
4197 * testsuite/plugin_section_order.c (onload): Check if new interfaces
4198 are available.
4199 (allow_unique_segment_for_sections): New global.
4200 (unique_segment_for_sections): New global.
4201 (claim_file_hook): Call allow_unique_segment_for_sections.
4202 (all_symbols_read_hook): Call unique_segment_for_sections.
4203
4204 2012-08-22 Cary Coutant <ccoutant@google.com>
4205
4206 * layout.cc (Layout::include_section): Don't assert on GROUP
4207 sections with --emit-relocs.
4208
4209 2012-08-21 Cary Coutant <ccoutant@google.com>
4210
4211 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
4212 if --export-dynamic-symbol names an undef symbol.
4213
4214 2012-08-18 Alan Modra <amodra@gmail.com>
4215
4216 * powerpc.cc: Formatting and white space.
4217 (Powerpc_relobj): Rename got2_section_ to special_.
4218 Add opd_ent_shndx_ and opd_ent_off_ vectors.
4219 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
4220 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
4221 (Target_powerpc): Add Address typedef and invalid_address. Use
4222 throughout.
4223 (Target_powerpc::is_branch_reloc): New function.
4224 (Powerpc_relocate_functions): Add Address typedef, use throughout.
4225 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
4226 for dst_mask, value and addend.
4227 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
4228 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
4229 (Output_data_glink::do_write): Correct toc base. Don't try to use
4230 uint16_t for 24-bit offset. Use get_output_section_offset and
4231 check return.
4232 (Target_powerpc::Scan::local): Handle more relocs.
4233 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
4234 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
4235 Plug in toc restoring insn after plt calls. Translate branches
4236 to function descriptor symbols to corresponding entry point.
4237 (Target_powerpc::relocate_for_relocatable): Check return from
4238 get_output_section_offset.
4239 * symtab.h: Comment typo.
4240
4241 2012-08-14 Ian Lance Taylor <iant@google.com>
4242
4243 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
4244 unsupported_relocal_local to call unsupported_reloc_global.
4245
4246 2012-08-14 Nick Clifton <nickc@redhat.com>
4247
4248 PR ld/14265
4249 * script-sections.cc (Sections_element::output_section_name): Add
4250 keep return parameter.
4251 (Output_section_element::match_name): Add keep return parameter.
4252 Return the value of the keep_ member.
4253 * script-sections.h (class Output_section): Update
4254 output_section_name prototype.
4255 * layout.cc (Layout::keep_input_section): New public member
4256 function.
4257 (Layout::choose_output_section): Pass keep parameter to
4258 output_section_name.
4259 * layout.h (class Layout): Add keep_input_section.
4260 * object.cc (Sized_relobj_file::do_layout): Check for kept input
4261 sections.
4262 * testsuite/Makefile.am: Add a test.
4263 * testsuite/Makefile.in: Regenerate.
4264 * testsuite/pr14265.c: Source file for the test.
4265 * testsuite/pr14265.t: Linker script for the test.
4266 * testsuite/pr14265.sh: Shell script for the test.
4267
4268 2012-08-14 Alan Modra <amodra@gmail.com>
4269
4270 * target.h (Target::output_section_name): New function.
4271 (Target::do_output_section_name): New function.
4272 * layout.cc (Layout::choose_output_section): Call the above.
4273 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
4274
4275 2012-08-14 Alan Modra <amodra@gmail.com>
4276
4277 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
4278 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
4279 for replace_constant call.
4280 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
4281 (Output_data_glink::do_print_to_mapfile): New function.
4282 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
4283 (Target_powerpc::Relocate::relocate): Likewise.
4284
4285 2012-08-14 Alan Modra <amodra@gmail.com>
4286
4287 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
4288 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
4289 (Output_data_glink::add_entry,find_entry): Remove shndx param.
4290 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
4291 all references to shndx_. Handle special case for R_PPC_PLTREL24
4292 here.
4293 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
4294 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
4295 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
4296 here.
4297 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
4298 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
4299
4300 2012-08-12 Alan Modra <amodra@gmail.com>
4301
4302 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
4303 (glink insn constants): Use uint32_t.
4304 (Output_data_glink::add_entry): Use insert, not [] operator.
4305
4306 2012-08-11 Alan Modra <amodra@gmail.com>
4307
4308 * object.h (Sized_relobj_file::find_shdr): New function.
4309 (Sized_relobj_file::find_special_sections): New function.
4310 * object.cc (Sized_relobj_file::find_shdr): New function.
4311 (Sized_relobj_file::find_eh_frame): Use find_shdr.
4312 (Sized_relobj_file::find_special_sections): New function, split out..
4313 (Sized_relobj_file::do_read_symbols): ..from here.
4314 * output.h (Output_data_got::replace_constant): New function.
4315 (Output_data_got::num_entries): New function.
4316 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
4317 (Output_data_got::got_offset): Protected rather than private.
4318 (Output_data_got::replace_got_entry): New function.
4319 * output.cc (Output_data_got::replace_got_entry): New function.
4320 * powerpc.cc (class Powerpc_relobj): New.
4321 (class Powerpc_relocate_functions): Delete all psymval variants or
4322 convert to value,addend type. Delete pcrela, pcrela_unaligned.
4323 Implement _ha functions using corresponding _hi function.
4324 (Powerpc_relobj::find_special_sections): New function.
4325 (Target_powerpc::do_make_elf_object): New function.
4326 (class Output_data_got_powerpc): New.
4327 (class Output_data_glink): New.
4328 (class Powerpc_scan_relocatable_reloc): New.
4329 Many more changes througout file.
4330
4331 2012-08-09 Nick Clifton <nickc@redhat.com>
4332
4333 * po/vi.po: Updated Vietnamese translation.
4334
4335 2012-08-07 Ian Lance Taylor <iant@google.com>
4336
4337 * layout.cc (Layout::add_target_dynamic_tags): If
4338 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
4339 plt_rel.
4340
4341 2012-07-30 Nick Clifton <nickc@redhat.com>
4342
4343 * po/gold.pot: Updated template.
4344 * po/es.po: Updated Spanish translation.
4345
4346 2012-07-18 Cary Coutant <ccoutant@google.com>
4347
4348 PR gold/14344
4349 * configure.ac: Add check for -gpubnames support.
4350 * configure: Regenerate.
4351 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
4352 support; force -gno-pubnames.
4353 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
4354 support.
4355 (gdb_index_test_4): New test.
4356 * testsuite/Makefile.in: Regenerate.
4357 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
4358 * testsuite/gdb_index_test_2.sh: Likewise.
4359 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
4360 * testsuite/gdb_index_test_4.sh: New script.
4361 * testsuite/gdb_index_test_comm.sh: New script with common code;
4362 don't look for space after colon.
4363
4364 2012-07-16 Sriraman Tallam <tmsriram@google.com>
4365
4366 * gold.cc (queue_middle_tasks): Update function order only after
4367 deferred objects due to plugins are processed.
4368
4369 2012-07-11 Ian Lance Taylor <iant@google.com>
4370
4371 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
4372 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
4373 (Target_arm::scan_reloc_for_stub): Likewise.
4374 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
4375 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
4376 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
4377 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
4378 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
4379
4380 2012-07-10 Dodji Seketeli <dodji@redhat.com>
4381 Ian Lance Taylor <iant@google.com>
4382
4383 PR gold/14309
4384 * configure.ac: Test whether std::tr1::hash<off_t> works.
4385 * gold.h: Add a specialization for std::tr1::hash<off_t> if
4386 needed.
4387 * output.h (class Output_fill): Add virtual destructor.
4388 * configure, config.in: Rebuild.
4389
4390 2012-06-22 Roland McGrath <mcgrathr@google.com>
4391
4392 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
4393
4394 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
4395
4396 * plugin.cc (Plugin::load): Handle position independent executables.
4397
4398 2012-06-06 Cary Coutant <ccoutant@google.com>
4399
4400 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
4401 add .debug_macro.
4402 (lines_only_debug_sections): Likewise.
4403 (gdb_fast_lookup_sections): New static array.
4404 (is_gdb_debug_section): Rename formal parameter.
4405 (is_lines_only_debug_section): Likewise.
4406 (is_gdb_fast_lookup_section): New function.
4407 (Layout::include_section): Check for ".zdebug_" prefix; pass
4408 section name suffix to is_gdb_debug_section, et al.; check for
4409 fast-lookup sections when building .gdb_index.
4410 * options.h (--strip-debug-gdb): Update GDB version number.
4411
4412 2012-06-06 Cary Coutant <ccoutant@google.com>
4413
4414 * configure.ac: Add check for fallocate.
4415 * configure: Regenerate.
4416 * config.in: Regenerate.
4417
4418 * options.h (class General_options): Add --mmap-output-file and
4419 --posix-fallocate options.
4420 * output.cc: (posix_fallocate): Remove; replace with...
4421 (gold_fallocate): New function.
4422 (Output_file::map_no_anonymous): Call gold_fallocate.
4423 (Output_file::map): Check --mmap-output-file option.
4424
4425 2012-06-05 Jing Yu <jingyu@google.com>
4426
4427 * gold.h (textdomain): Add do {} to empty while(0).
4428 (bindtextdomain): Likewise.
4429
4430 2012-06-04 Cary Coutant <ccoutant@google.com>
4431
4432 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
4433 has_dynsym_index.
4434
4435 2012-05-25 Sriraman Tallam <tmsriram@google.com>
4436
4437 * symtab.cc (Symbol_table::define_special_symbol):
4438 Initialize *poldsym to prevent uninitialized variable errors.
4439
4440 2012-05-23 Cary Coutant <ccoutant@google.com>
4441
4442 * layout.cc (Layout::section_name_mapping): Add rules to handle
4443 exact match on .data.rel.ro.local or .data.rel.ro.
4444 (Layout::output_section_name): Check for exact matches.
4445
4446 2012-05-23 Cary Coutant <ccoutant@google.com>
4447
4448 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
4449 more carefully.
4450
4451 2012-05-22 Cary Coutant <ccoutant@google.com>
4452
4453 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
4454 object before exporting symbol.
4455
4456 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
4457
4458 * testsuite/tls_test.cc: Include "config.h" first.
4459 * testsuite/tls_test_c.c: Likewise.
4460
4461 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
4462 Nick Clifton <nickc@redhat.com>
4463
4464 PR 14072
4465 * configure.in: Add check that sysdep.h has been included before
4466 any system header files.
4467 * configure: Regenerate.
4468 * config.in: Regenerate.
4469
4470 2012-05-14 Cary Coutant <ccoutant@google.com>
4471
4472 * layout.cc (Layout::make_output_section): Mark .tdata section
4473 as RELRO.
4474 * testsuite/relro_test.cc: Add a TLS variable.
4475
4476 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
4477
4478 PR gold/14091
4479 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
4480 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
4481 R_X86_64_64.
4482
4483 2012-05-08 Cary Coutant <ccoutant@google.com>
4484
4485 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
4486 (lines_only_debug_sections): Likewise.
4487
4488 2012-05-02 Roland McGrath <mcgrathr@google.com>
4489
4490 * nacl.cc: New file.
4491 * nacl.h: New file.
4492 * Makefile.am (CCFILES, HFILES): Add them.
4493 * Makefile.in: Regenerate.
4494 * i386.cc (Output_data_plt_i386_nacl): New class.
4495 (Output_data_plt_i386_nacl_exec): New class.
4496 (Output_data_plt_i386_nacl_dyn): New class.
4497 (Target_i386_nacl): New class.
4498 (Target_selector_i386_nacl): New class.
4499 (target_selector_i386): Use it instead of Target_selector_i386.
4500 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
4501 (Target_x86_64_nacl): New class.
4502 (Target_selector_x86_64_nacl): New class.
4503 (target_selector_x86_64, target_selector_x32): Use it instead of
4504 Target_selector_x86_64.
4505 * arm.cc (Output_data_plt_arm_nacl): New class.
4506 (Target_arm_nacl): New class.
4507 (Target_selector_arm_nacl): New class.
4508 (target_selector_arm, target_selector_armbe): Use it instead of
4509 Target_selector_arm.
4510
4511 * target-select.cc (select_target): Take new Input_file* and off_t
4512 arguments, pass them on to recognize method of selector.
4513 * object.cc (make_elf_sized_object): Update caller.
4514 * parameters.cc (parameters_force_valid_target): Likewise.
4515 * incremental.cc (make_sized_incremental_binary): Likewise.
4516 * target-select.h: Update decl.
4517 (Target_selector::recognize): Take new Input_file* argument,
4518 pass it on to do_recognize.
4519 (Target_selector::do_recognize): Take new Input_file* argument.
4520 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
4521 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
4522 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
4523 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
4524
4525 * target.h (Target::Target_info): New members isolate_execinstr
4526 and rosegment_gap.
4527 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
4528 * arm.cc (Target_arm::arm_info): Update initializer.
4529 * i386.cc (Target_i386::i386_info): Likewise.
4530 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
4531 * sparc.cc (Target_sparc::sparc_info): Likewise.
4532 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4533 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
4534 * layout.cc (Layout::attach_allocated_section_to_segment):
4535 Take new const Target* argument. If target->isolate_execinstr(), act
4536 like --rosegment.
4537 (Layout::find_first_load_seg): Take new const Target* argument;
4538 if target->isolate_execinstr(), reject PF_X segments.
4539 (Layout::relaxation_loop_body): Update caller.
4540 (Layout::set_segment_offsets): If target->isolate_execinstr(),
4541 reset file offset to zero when we hit LOAD_SEG, and then do a second
4542 loop over the segments before LOAD_SEG to reassign offsets after
4543 addresses have been determined. Handle target->rosegment_gap().
4544 (Layout::attach_section_to_segment): Take new const Target* argument;
4545 pass it to attach_allocated_section_to_segment.
4546 (Layout::make_output_section): Update caller.
4547 (Layout::attach_sections_to_segments): Take new const Target* argument;
4548 pass it to attach_section_to_segment.
4549 * gold.cc (queue_middle_tasks): Update caller.
4550 * layout.h (Layout): Update method decls with new arguments.
4551
4552 * arm.cc (Target_arm::Target_arm): Take optional argument for the
4553 Target_info pointer to use.
4554 (Target_arm::do_make_data_plt): New virtual method.
4555 (Target_arm::make_data_plt): New method that calls it.
4556 (Target_arm::make_plt_entry): Use it.
4557 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
4558 for the section alignment.
4559 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
4560 method.
4561 (Output_data_plt_arm::first_plt_entry_offset): Call it.
4562 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
4563 method.
4564 (Output_data_plt_arm::get_plt_entry_size): Call it.
4565 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
4566 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
4567 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
4568 method.
4569 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
4570 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
4571 method instead of sizeof(plt_entry).
4572 (Output_data_plt_arm::add_entry): Likewise.
4573 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
4574 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
4575 than static method.
4576 (Target_arm::plt_entry_size): Likewise.
4577 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
4578 Move to ...
4579 (Output_data_plt_arm_standard): ... here, new class.
4580 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
4581 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
4582 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
4583
4584 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4585 Take additional argument for the PLT entry size.
4586 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
4587 Use get_plt_entry_size method rather than plt_entry_size variable.
4588 (Output_data_plt_x86_64::reserve_slot): Likewise.
4589 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
4590 (Output_data_plt_x86_64::add_entry): Likewise.
4591 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
4592 (Output_data_plt_x86_64::address_for_global): Likewise.
4593 (Output_data_plt_x86_64::address_for_local): Likewise.
4594 (Output_data_plt_x86_64::set_final_data_size): Likewise.
4595 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
4596 Make method non-static.
4597 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
4598 method.
4599 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
4600 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
4601 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
4602 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
4603 virtual method.
4604 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
4605 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
4606 virtual method.
4607 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
4608 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
4609 virtual method.
4610 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
4611 (Output_data_plt_x86_64::plt_entry_size)
4612 (Output_data_plt_x86_64::first_plt_entry)
4613 (Output_data_plt_x86_64::plt_entry)
4614 (Output_data_plt_x86_64::tlsdesc_plt_entry)
4615 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
4616 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
4617 (Output_data_plt_x86_64_standard): ... here, new class.
4618 (Target_x86_64::Target_x86_64): Take optional argument for the
4619 Target_info pointer to use.
4620 (Target_x86_64::do_make_data_plt): New virtual method.
4621 (Target_x86_64::make_data_plt): New method to call it.
4622 (Target_x86_64::init_got_plt_for_update): Use that.
4623 Call this->plt_->add_eh_frame method here.
4624 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
4625 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
4626 rather than static method.
4627 (Target_x86_64::plt_entry_size): Likewise.
4628 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
4629 rather than plt_entry_size variable. Move guts of PLT filling to...
4630 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
4631 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
4632 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
4633
4634 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
4635 additional argument for the section alignment.
4636 Don't do add_eh_frame_for_plt here.
4637 (Output_data_plt_i386::first_plt_entry_offset): Make the method
4638 non-static. Use get_plt_entry_size method rather than plt_entry_size
4639 variable.
4640 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
4641 method.
4642 (Output_data_plt_i386::get_plt_entry_size): Call it.
4643 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
4644 (Output_data_plt_i386::add_eh_frame): New method to call it.
4645 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
4646 method.
4647 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
4648 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
4649 method.
4650 (Output_data_plt_i386::fill_plt_entry): New method to call it.
4651 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
4652 method instead of plt_entry_size.
4653 (Output_data_plt_i386::plt_entry_size)
4654 (Output_data_plt_i386::plt_eh_frame_fde_size)
4655 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
4656 (Output_data_plt_i386_standard): ... here, new class.
4657 (Output_data_plt_i386_exec): New class.
4658 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
4659 (Output_data_plt_i386_exec::first_plt_entry): ... here.
4660 (Output_data_plt_i386::exec_plt_entry): Move to ...
4661 (Output_data_plt_i386_exec::plt_entry): ... here.
4662 (Output_data_plt_i386_dyn): New class.
4663 (Output_data_plt_i386::first_plt_entry): Move to ...
4664 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
4665 (Output_data_plt_i386::dyn_plt_entry): Move to ...
4666 (Output_data_plt_i386_dyn::plt_entry): ... here.
4667 (Target_i386::Target_i386): Take optional argument for the Target_info
4668 pointer to use.
4669 (Target_i386::do_make_data_plt): New virtual method.
4670 (Target_i386::make_data_plt): New method to call it.
4671 (Target_i386::make_plt_section): Use that.
4672 Call this->plt_->add_eh_frame method here.
4673 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
4674 rather than plt_entry_size variable.
4675 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
4676 (Output_data_plt_i386::address_for_local): Likewise.
4677 (Output_data_plt_i386::do_write): Likewise.
4678 Move guts of PLT filling to...
4679 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
4680 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
4681 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
4682 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
4683
4684 2012-05-01 Cary Coutant <ccoutant@google.com>
4685
4686 * dwarf_reader.cc (Dwarf_die::read_attributes)
4687 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
4688 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
4689 * reduced_debug_output.cc
4690 (Output_reduced_debug_info_section::get_die_end): Remove
4691 DW_FORM_GNU_ref_index. Add default case.
4692
4693 2012-04-26 Mark Wielaard <mjw@redhat.com>
4694
4695 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
4696 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
4697 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
4698 DW_AT_high_pc as offset from DW_AT_low_pc.
4699
4700 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
4701 * testsuite/Makefile.in: Regenerate.
4702 * testsuite/gdb_index_test_3.c: New test source file.
4703 * testsuite/gdb_index_test_3.sh: New test source file.
4704
4705 2012-04-25 Ian Lance Taylor <iant@google.com>
4706
4707 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
4708 pointer.
4709 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
4710 as a class, not a struct.
4711 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
4712 (Target_arm::apply_cortex_a8_workaround): Likewise.
4713 * gc.h: Declare Reloc_types as a struct, not a class.
4714 * object.h: Declare Symbols_data as a struct.
4715 * reloc.h: Declare Read_relocs_data as a struct.
4716 * target.h: Declare Relocate_info as a struct.
4717
4718 2012-04-24 David S. Miller <davem@davemloft.net>
4719
4720 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
4721 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
4722 and R_SPARC_WPLT30.
4723
4724 2012-04-24 Cary Coutant <ccoutant@google.com>
4725
4726 * incremental-dump.cc (find_input_containing_global): Replace
4727 magic number with symbolic constant.
4728 (dump_incremental_inputs): Update version number.
4729 * incremental.cc (Output_section_incremental_inputs): Update version
4730 number; import symbolic constants from Incremental_inputs_reader.
4731 (Incremental_inputs::create_data_sections): Align relocations
4732 section correctly for 64-bit targets.
4733 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
4734 constants; add padding.
4735 (Output_section_incremental_inputs::write_header): Add assert for
4736 header_size.
4737 (Output_section_incremental_inputs::write_input_files): Add assert
4738 for input_entry_size.
4739 (Output_section_incremental_inputs::write_info_blocks): Add padding;
4740 add assert for object_info_size, input_section_entry_size,
4741 global_sym_entry_size.
4742 * incremental.h (Incremental_inputs_reader): Add symbolic constants
4743 for data structure sizes; use them.
4744 (Incremental_input_entry_reader): Import symbolic constants from
4745 Incremental_inputs_reader; use them.
4746
4747 2012-04-23 David S. Miller <davem@davemloft.net>
4748
4749 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
4750 and elf_flags_set_.
4751 (Target_sparc::Target_sparc): Initialize new fields.
4752 (Target_sparc::do_make_elf_object): New function.
4753 (Target_sparc::do_adjust_elf_header): New function.
4754
4755 2012-04-23 Cary Coutant <ccoutant@google.com>
4756
4757 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
4758 CU range table of gdb index.
4759
4760 2012-04-20 David S. Miller <davem@davemloft.net>
4761
4762 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
4763 instead of false.
4764
4765 2012-04-16 David S. Miller <davem@davemloft.net>
4766
4767 * sparc.cc (Target_sparc::got_address): New function.
4768 (Sparc_relocate_functions::gdop_hix22): New function.
4769 (Sparc_relocate_functions::gdop_lox10): New function.
4770 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
4771 relocs.
4772 (Target_sparc::Scan::local): Likewise if the global symbol is not
4773 preemptible and is not IFUNC.
4774 (Target_sparc::Relocate::relocate): Perform GOTDATA code
4775 transformations for local and non-preemptible non-IFUNC global
4776 symbols.
4777
4778 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
4779 writing out 64-bit part of ranges.
4780
4781 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
4782 -fpic and -fpie respectively.
4783 * Makefile.in: Regenerate.
4784
4785 * sparc.cc (class Target_sparc): Add rela_ifunc_.
4786 (Target_sparc::Target_sparc): Initialize new field.
4787 (Target_sparc::do_plt_section_for_global): New function.
4788 (Target_sparc::do_plt_section_for_local): New function.
4789 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
4790 (Target_sparc::make_plt_section): New function, broken out of
4791 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
4792 (Target_sparc::make_plt_entry): Call make_plt_section.
4793 (Target_sparc::make_local_ifunc_plt_entry): New function.
4794 (Target_sparc::rela_ifunc_section): New function.
4795 (Target_sparc::plt_section): Remove const.
4796 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
4797 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
4798 and ifunc_count_ fields.
4799 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
4800 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
4801 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
4802 (Output_data_plt_sparc::rela_ifunc): New function.
4803 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
4804 (Output_data_plt_sparc::has_ifunc_section): New function.
4805 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
4806 (Output_data_plt_sparc::address_for_global): New function.
4807 (Output_data_plt_sparc::address_for_local): New function.
4808 (Output_data_plt_sparc::plt_index_to_offset): New function.
4809 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
4810 and entry_count.
4811 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
4812 entry_count.
4813 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
4814 R_SPARC_JMP_IREL to switch.
4815 (Target_sparc::Scan::check_non_pic): Likewise.
4816 (Target_sparc::Scan::local): Handle IFUNC symbols.
4817 (Target_sparc::Scan::local): Likewise.
4818 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
4819 and plt_address_for_local.
4820 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
4821 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
4822
4823 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
4824 (class Output_data_reloc): Adjust calls to Output_reloc_type.
4825 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
4826 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
4827 global relocs too.
4828 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
4829 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
4830 calls.
4831 * sparc.cc (Target_sparc::Scan::global): Likewise.
4832 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4833
4834 2012-04-16 Cary Coutant <ccoutant@google.com>
4835
4836 * archive.cc (Library_base::should_include_member): Check for
4837 --export-dynamic-symbol.
4838 * options.h (class General_options): Add --export-dynamic-symbol.
4839 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
4840 --export-dynamic-symbol.
4841 (Symbol_table::gc_mark_undef_symbols): Likewise.
4842 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
4843
4844 2012-04-12 David S. Miller <davem@davemloft.net>
4845
4846 * sparc.cc (Reloc::wdisp10): New relocation method.
4847 (Reloc::h34): Likewise.
4848 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
4849 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
4850 R_SPARC_WDISP10.
4851 (Target_sparc::Scan::local): Likewise.
4852 (Target_sparc::Scan::global): Likewise.
4853 (Target_sparc::Relocate::relocate): Likewise.
4854
4855 2012-04-09 Cary Coutant <ccoutant@google.com>
4856
4857 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
4858 low_pc == 0.
4859
4860 2012-04-06 Ian Lance Taylor <iant@google.com>
4861
4862 * timer.cc: #include <unistd.h>.
4863
4864 2012-04-06 Roland McGrath <mcgrathr@google.com>
4865
4866 * configure.in (AC_CHECK_HEADERS): Add locale.h.
4867 * config.in: Regenerate.
4868 * configure: Regenerate.
4869
4870 2012-04-05 Nick Clifton <nickc@redhat.com>
4871
4872 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
4873 (AM_LC_MESSAGES): Add.
4874 * aclocal.m4: Regenerate.
4875 * config.in: Regenerate.
4876 * configure: Regenerate.
4877
4878 2012-03-21 Cary Coutant <ccoutant@google.com>
4879
4880 * Makefile.am: Add gdb-index.cc, gdb-index.h.
4881 * Makefile.in: Regenerate.
4882 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
4883 (Sized_elf_reloc_mapper::symbol_section): New function.
4884 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
4885 (make_elf_reloc_mapper): New function.
4886 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
4887 (Dwarf_abbrev_table::do_read_abbrevs): New function.
4888 (Dwarf_abbrev_table::do_get_abbrev): New function.
4889 (Dwarf_ranges_table::read_ranges_table): New function.
4890 (Dwarf_ranges_table::read_range_list): New function.
4891 (Dwarf_pubnames_table::read_section): New function.
4892 (Dwarf_pubnames_table::read_header): New function.
4893 (Dwarf_pubnames_table::next_name): New function.
4894 (Dwarf_die::Dwarf_die): New function.
4895 (Dwarf_die::read_attributes): New function.
4896 (Dwarf_die::skip_attributes): New function.
4897 (Dwarf_die::set_name): New function.
4898 (Dwarf_die::set_linkage_name): New function.
4899 (Dwarf_die::attribute): New function.
4900 (Dwarf_die::string_attribute): New function.
4901 (Dwarf_die::int_attribute): New function.
4902 (Dwarf_die::uint_attribute): New function.
4903 (Dwarf_die::ref_attribute): New function.
4904 (Dwarf_die::child_offset): New function.
4905 (Dwarf_die::sibling_offset): New function.
4906 (Dwarf_info_reader::check_buffer): New function.
4907 (Dwarf_info_reader::parse): New function.
4908 (Dwarf_info_reader::do_parse): New function.
4909 (Dwarf_info_reader::do_read_string_table): New function.
4910 (Dwarf_info_reader::lookup_reloc): New function.
4911 (Dwarf_info_reader::get_string): New function.
4912 (Dwarf_info_reader::visit_compilation_unit): New function.
4913 (Dwarf_info_reader::visit_type_unit): New function.
4914 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
4915 Sized_elf_reloc_mapper.
4916 (Sized_dwarf_line_info::symbol_section): Remove function.
4917 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
4918 (Sized_dwarf_line_info::read_line_mappings): Remove object
4919 parameter, adjust callers.
4920 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
4921 * dwarf_reader.h: Include <sys/types.h>.
4922 (class Track_relocs): Remove forward declaration.
4923 (class Elf_reloc_mapper): New class.
4924 (class Sized_elf_reloc_mapper): New class.
4925 (class Dwarf_abbrev_table): New class.
4926 (class Dwarf_range_list): New class.
4927 (class Dwarf_ranges_table): New class.
4928 (class Dwarf_pubnames_table): New class.
4929 (class Dwarf_die): New class.
4930 (class Dwarf_info_reader): New class.
4931 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
4932 (Sized_dwarf_line_info::symbol_section): Remove member function.
4933 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
4934 base class.
4935 * gdb-index.cc: New source file.
4936 * gdb-index.h: New source file.
4937 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
4938 and .debug_types sections, call Layout::add_to_gdb_index.
4939 (Sized_relobj_incr::do_section_name): Implement.
4940 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
4941 return type; Implement.
4942 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
4943 return type.
4944 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
4945 parameter list and return type.
4946 (Sized_incr_dynobj::do_section_contents): Likewise.
4947 * layout.cc: Include gdb-index.h.
4948 (Layout::Layout): Initialize gdb_index_data_.
4949 (Layout::init_fixed_output_section): Check for .gdb_index section.
4950 (Layout::add_to_gdb_index): New function. Instantiate.
4951 * layout.h: Add forward declaration for class Gdb_index.
4952 (Layout::add_to_gdb_index): New member function.
4953 (Layout::gdb_index_data_): New data member.
4954 * main.cc: Include gdb-index.h.
4955 (main): Print statistics for gdb index.
4956 * object.cc (Object::section_contents): Move code into
4957 do_section_contents.
4958 (need_decompressed_section): Check for sections needed when building
4959 gdb index.
4960 (build_compressed_section_map): Likewise.
4961 (Sized_relobj_file::do_read_symbols): Need local symbols when building
4962 gdb index.
4963 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
4964 sections; call Layout::add_to_gdb_index.
4965 (Sized_relobj_file::do_decompressed_section_contents): Call
4966 do_section_contents directly.
4967 * object.h (Object::do_section_contents): Adjust parameter list and
4968 return type.
4969 (Object::do_decompressed_section_contents): Call do_section_contents
4970 directly.
4971 (Sized_relobj_file::do_section_contents): Adjust parameter list and
4972 return type.
4973 * options.h (class General_options): Add --gdb-index option.
4974 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
4975 list and return type.
4976 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
4977 * reloc.h (Track_relocs::checkpoint): New function.
4978 (Track_relocs::reset): New function.
4979
4980 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
4981 New test cases.
4982 * testsuite/Makefile.in: Regenerate.
4983 * testsuite/gdb_index_test.cc: New test source file.
4984 * testsuite/gdb_index_test_1.sh: New test source file.
4985 * testsuite/gdb_index_test_2.sh: New test source file.
4986
4987 2012-03-19 Doug Kwan <dougkwan@google.com>
4988
4989 * arm.cc (Target_arm::do_define_standard_symbols): New method.
4990 (Target_arm::do_finalize_sections): Remove code which defines
4991 __exidx_start and __exidx_end. Make symbol table parameter
4992 anonymous as it is not used.
4993 * gold.cc (queue_middle_tasks): Call target hook to define any
4994 target-specific symbols.
4995 * target.h (Target::define_standard_symbols): New method.
4996 (Target::do_define_standard_symbols): Same.
4997 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
4998 * testsuite/Makefile.in: Regenerate.
4999 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
5000 and __exidx_end.
5001 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
5002 relocations are generated for __exidx_start and __exidx_end.
5003
5004 2012-03-16 Doug Kwan <dougkwan@google.com>
5005
5006 * testsuite/Makefile.am: Disable test initpri3b.
5007 * testsuite/Makefile.in: Regenerate.
5008
5009 2012-03-15 Doug Kwan <dougkwan@google.com>
5010
5011 * arm.cc (Target_arm::got_section): Make .got section read-only
5012 if -z now is given.
5013
5014 2012-03-15 Ian Lance Taylor <iant@google.com>
5015
5016 PR gold/13850
5017 * layout.cc (Layout::make_output_section): Correctly mark
5018 SHT_INIT_ARRAY, et. al., as relro.
5019
5020 2012-03-14 Doug Kwan <dougkwan@google.com>
5021
5022 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
5023 dynamic relocations for protected symbols in shared objects.
5024
5025 2012-03-13 Ian Lance Taylor <iant@google.com>
5026
5027 * resolve.cc (Symbol_table::resolve): When merging common symbols,
5028 keep the larger alignment.
5029
5030 2012-03-12 Cary Coutant <ccoutant@google.com>
5031
5032 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
5033 handling of DW_LNE_define_file.
5034
5035 2012-03-12 Cary Coutant <ccoutant@google.com>
5036
5037 * reduced_debug_output.cc
5038 (Output_reduced_debug_info_section::get_die_end): Add new FORM
5039 codes to switch.
5040
5041 2012-02-29 Cary Coutant <ccoutant@google.com>
5042
5043 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
5044
5045 2012-02-29 Cary Coutant <ccoutant@google.com>
5046
5047 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5048 Call Object::decompressed_section_contents.
5049 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
5050 New dtor.
5051 (Sized_dwarf_line_info::buffer_start_): New data member.
5052 * merge.cc (Output_merge_data::do_add_input_section): Call
5053 Object::decompressed_section_contents.
5054 (Output_merge_string::do_add_input_section): Likewise.
5055 * object.cc (need_decompressed_section): New function.
5056 (build_compressed_section_map): Decompress sections needed later.
5057 (Sized_relobj_file::do_decompressed_section_contents): New function.
5058 (Sized_relobj_file::do_discard_decompressed_sections): New function.
5059 * object.h (Object::decompressed_section_contents): New function.
5060 (Object::discard_decompressed_sections): New function.
5061 (Object::do_decompressed_section_contents): New function.
5062 (Object::do_discard_decompressed_sections): New function.
5063 (Compressed_section_info): New type.
5064 (Compressed_section_map): Include decompressed section contents.
5065 (Sized_relobj_file::do_decompressed_section_contents): New function.
5066 (Sized_relobj_file::do_discard_decompressed_sections): New function.
5067
5068 2012-02-16 Cary Coutant <ccoutant@google.com>
5069
5070 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
5071 * testsuite/Makefile.in: Regenerate.
5072
5073 2012-02-14 Cary Coutant <ccoutant@google.com>
5074
5075 * options.cc (General_options::finalize): Disallow -pie and -static.
5076
5077 2012-02-03 Doug Kwan <dougkwan@google.com>
5078
5079 * arm.cc (Arm_relocate_functions::abs8,
5080 Arm_relocate_functions::abs16): Use
5081 Bits::has_signed_unsigned_overflow32.
5082 (Arm_relocate_functions::thm_abs8): Correct range of
5083 overflow check.
5084 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
5085 in assertions.
5086
5087 2012-02-02 Doug Kwan <dougkwan@google.com>
5088
5089 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
5090 position independent outputs, not just shared objects.
5091
5092 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
5093
5094 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
5095 * configure: Regenerated.
5096
5097 2012-01-27 Ian Lance Taylor <iant@google.com>
5098
5099 * reloc.h (Bits): New class with static functions, copied from
5100 namespace utils in arm.cc.
5101 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
5102 instead.
5103
5104 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
5105
5106 * incremental.cc (write_info_blocks): Correct relocation offset.
5107
5108 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
5109
5110 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
5111 (Relocate::tls_gd_to_le): Likewise.
5112
5113 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
5114
5115 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
5116
5117 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
5118
5119 * configure.ac: Check if -mcmodel=medium works.
5120 * configure: Regenerated.
5121
5122 2012-01-24 Cary Coutant <ccoutant@google.com>
5123
5124 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
5125 definition and ...
5126 (read_unsigned_LEB_128_x): ... this new function.
5127 (read_signed_LEB_128): Replaced with inline definition and ...
5128 (read_signed_LEB_128_x): ... this new function.
5129 * int_encoding.h (read_unsigned_LEB_128_x): New function.
5130 (read_unsigned_LEB_128): Add inline definition.
5131 (read_signed_LEB_128_x): New function.
5132 (read_signed_LEB_128): Add inline definition.
5133 * testsuite/Makefile.am (leb128_unittest): New unit test.
5134 * testsuite/Makefile.in: Regenerate.
5135 * testsuite/leb128_unittest.cc: New unit test.
5136
5137 2012-01-23 Ian Lance Taylor <iant@google.com>
5138
5139 PR gold/13617
5140 * i386.cc (Target_i386::do_code_fill): When using a jmp
5141 instruction, pad with nop instructions.
5142 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5143
5144 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
5145
5146 * x86_64.cc (gc_process_relocs): Add typename on types used in
5147 template.
5148 (scan_relocs): Likewise.
5149 (relocate_section): Likewise.
5150 (apply_relocation): Likewise.
5151
5152 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
5153
5154 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
5155 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
5156 under x32.
5157
5158 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
5159
5160 * x86_64.cc: Initial support for x32.
5161
5162 2012-01-03 Cary Coutant <ccoutant@google.com>
5163
5164 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
5165 Use abstract base class for GOT.
5166 * gold/output.h (class Output_data_got_base): New abstract base class.
5167 (class Output_data_got): Derive from new base class, adjust ctors.
5168 (Output_data_got::reserve_slot): Make virtual; rename to
5169 do_reserve_slot; Adjust callers.
5170 * gold/target.h (Sized_target::init_got_plt_for_update): Return
5171 pointer to abstract base class.
5172 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
5173
5174 2011-12-18 Ian Lance Taylor <iant@google.com>
5175
5176 * object.h (Relobj::local_symbol_value): New function.
5177 (Relobj::local_plt_offset): New function.
5178 (Relobj::local_has_got_offset): New function.
5179 (Relobj::local_got_offset): New function.
5180 (Relobj::set_local_got_offset): New function.
5181 (Relobj::do_local_symbol_value): New pure virtual function.
5182 (Relobj::do_local_plt_offset): Likewise.
5183 (Relobj::do_local_has_got_offset): Likewise.
5184 (Relobj::do_local_got_offset): Likewise.
5185 (Relobj::do_set_local_got_offset): Likewise.
5186 (Sized_relobj::do_local_has_got_offset): Rename from
5187 local_has_got_offset.
5188 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
5189 (Sized_relobj::do_set_local_got_offset): Rename from
5190 set_local_got_offset.
5191 (Sized_relobj_file::do_local_plt_offset): Rename from
5192 local_plt_offset.
5193 (Sized_relobj_file::do_local_symbol_value): New function.
5194 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
5195 local_plt_offset.
5196 * output.cc (Output_data_got::Got_entry::write): Change object to
5197 Relobj. Use local_symbol_value.
5198 (Output_data_got::add_global_with_rel): Change rel_dyn to
5199 Output_data_reloc_generic*. Use add_global_generic.
5200 (Output_data_got::add_global_with_rela): Remove. Change all
5201 callers to use add_global_with_rel.
5202 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
5203 Output_data_reloc_generic*. Use add_global_generic.
5204 (Output_data_got::add_global_pair_with_rela): Remove. Change all
5205 callers to use add_global_pair_with_rel.
5206 (Output_data_got::add_local): Change object to Relobj*.
5207 (Output_data_got::add_local_plt): Likewise.
5208 (Output_data_got::add_local_with_rel): Change object to Relobj*,
5209 change rel_dyn to Output_data_reloc_generic*. Use
5210 add_local_generic.
5211 (Output_data_got::add_local_with_rela): Remove. Change all
5212 callers to use all_local_with_rel.
5213 (Output_data_got::add_local_pair_with_rel): Change object to
5214 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
5215 add_output_section_generic.
5216 (Output_data_got::add_local_pair_with_rela): Remove. Change all
5217 callers to use add_local_pair_with_rel.
5218 (Output_data_got::reserve_local): Change object to Relobj*.
5219 * output.h: (class Output_data_reloc_generic): Add pure virtual
5220 declarations for add_global_generic, add_local_generic,
5221 add_output_section_generic.
5222 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
5223 functions for Output_data_reloc_generic. Update declarations for
5224 changes listed in output.cc.
5225 (class Output_data_got): Change template parameter to got_size.
5226 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
5227 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
5228 function.
5229 (Sized_relobj_incr::do_local_plt_offset): New function.
5230 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
5231 add_global_generic.
5232
5233 2011-12-17 Cary Coutant <ccoutant@google.com>
5234
5235 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
5236 * resolve.cc (Symbol_table::resolve): Likewise.
5237 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
5238 arrays.
5239 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5240
5241 2011-12-16 Ian Lance Taylor <iant@google.com>
5242
5243 * output.h (Output_data_reloc_generic::add): Only call
5244 add_dynamic_reloc if this is a dynamic reloc section.
5245
5246 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
5247
5248 PR gold/13505
5249 * target-reloc.h (apply_relocation): Replace <64, false> with
5250 <size, big_endian>.
5251
5252 2011-11-25 Nick Clifton <nickc@redhat.com>
5253
5254 * po/it.po: New Italian translation.
5255
5256 2011-11-17 Sterling Augustine <saugustine@google.com>
5257
5258 * script.cc (script_include_directive): Implement.
5259 (read_script_file): New local variables name and search_path. Update
5260 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
5261 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
5262 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
5263
5264 2011-11-11 Sterling Augustine <saugustine@google.com>
5265
5266 * yyscript.y (section_cmd): Add support for INCLUDE directive.
5267 (file_or_sections_cmd): Likewise.
5268
5269 2011-11-11 Doug Kwan <dougkwan@google.com>
5270
5271 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
5272 if --just-symbols is given.
5273
5274 2011-11-10 Doug Kwan <dougkwan@google.com>
5275
5276 PR gold/13362
5277 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
5278 when processing data relocs.
5279 * reloc.h (Relocate_functions::rel_unaligned): New method.
5280 (Relocate_functions::pcrel_unaligned): Ditto.
5281 (Relocate_functions::rel32_unaligned): Ditto.
5282 (Relocate_functions::pcrel32_unaligned): Ditto.
5283
5284 2011-11-09 Doug Kwan <dougkwan@google.com>
5285
5286 PR gold/13362
5287 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
5288 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
5289 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
5290 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5291 (Relocate_functions::rel_unaligned): New.
5292 (Relocate_functions::rel32_unaligned): New.
5293 * target-reloc.h (relocate_for_relocatable): Add code to handle
5294 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5295 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
5296 arm_unaligned_reloc_r): New targets.
5297 * testsuite/Makefile.in: Regenerate.
5298 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
5299 linking.
5300
5301 2011-11-02 Ian Lance Taylor <iant@google.com>
5302
5303 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
5304 NATIVE_LINKER.
5305 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
5306 * options.cc (General_options::finalize): Use library search path
5307 from configure script if specified. If not native and no sysroot,
5308 only search TOOLLIBDIR.
5309 * options.h (Search_directory::Search_directory): Change name to
5310 const std::string&.
5311 (General_options::add_to_library_path_with_sysroot): Change arg to
5312 const std::string&.
5313 * configure, Makefile.in, config.in: Rebuild.
5314
5315 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
5316
5317 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
5318 we are working around the ARM1176 Erratum.
5319 * options.h (General_options::fix_arm1176): Add option.
5320 * testsuite/Makefile.am: Add testcases, and keep current ones
5321 working.
5322 * testsuite/Makefile.in: Regenerate.
5323 * testsuite/arm_fix_1176.s: New file.
5324 * testsuite/arm_fix_1176.sh: Likewise.
5325
5326 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
5327
5328 * arm.cc (Target_arm::Target_arm): Remove initialisation of
5329 may_use_blx_.
5330 (Target_arm::may_use_blx): Remove method.
5331 (Target_arm::set_may_use_blx): Likewise.
5332 (Target_arm::may_use_v4t_interworking): New method.
5333 (Target_arm::may_use_v5t_interworking): Likewise.
5334 (Target_arm::may_use_blx_): Remove member variable.
5335 (Arm_relocate_functions::arm_branch_common): Check for v5T
5336 interworking.
5337 (Arm_relocate_functions::thumb_branch_common): Likewise.
5338 (Reloc_stub::stub_type_for_reloc): Likewise.
5339 (Target_arm::do_finalize_sections): Correct interworking checks.
5340 * testsuite/Makefile.am: Add new tests.
5341 * testsuite/Makefile.in: Regenerate.
5342 * testsuite/arm_farcall_arm_arm.s: New test.
5343 * testsuite/arm_farcall_arm_arm.sh: Likewise.
5344 * testsuite/arm_farcall_arm_thumb.s: Likewise.
5345 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
5346 * testsuite/arm_farcall_thumb_arm.s: Likewise.
5347 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
5348 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
5349 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
5350
5351 2011-10-31 Cary Coutant <ccoutant@google.com>
5352
5353 PR gold/13023
5354 * expression.cc (Expression::eval_with_dot): Add
5355 is_section_dot_assignment parameter.
5356 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
5357 absolute and assigning to dot within a section.
5358 * script-sections.cc
5359 (Output_section_element_assignment::set_section_addresses): Pass
5360 dot_section to set_if_absolute.
5361 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
5362 as is_section_dot_assignment flag to eval_with_dot.
5363 (Output_section_element_dot_assignment::set_section_addresses):
5364 Likewise.
5365 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
5366 parameter. Also set value if relative to dot_section; set the
5367 symbol's output_section.
5368 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
5369 parameter. Adjust all callers.
5370 (Expression::eval_maybe_dot): Likewise.
5371 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
5372 Adjust all callers.
5373 * testsuite/script_test_2.t: Test assignment of an absolute value
5374 to dot within an output section element.
5375
5376 2011-10-31 Cary Coutant <ccoutant@google.com>
5377
5378 * options.h (class General_options): Add --[no-]gnu-unique options.
5379 * symtab.cc (Symbol_table::sized_write_globals): Convert
5380 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
5381
5382 2011-10-31 Cary Coutant <ccoutant@google.com>
5383
5384 PR gold/13359
5385 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
5386 unnecessary assertion.
5387 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
5388
5389 2011-10-31 Sriraman Tallam <tmsriram@google.com>
5390
5391 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5392 gc_mark_symbol.
5393 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5394 gc_mark_symbol.
5395 Change to just keep the section associated with symbol.
5396 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
5397 they are externally visible and --export-dynamic is turned on.
5398 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
5399
5400 2011-10-19 Ian Lance Taylor <iant@google.com>
5401
5402 PR gold/13163
5403 * script-sections.cc
5404 (Output_section_element_dot_assignment::needs_output_section): New
5405 function.
5406
5407 2011-10-19 Ian Lance Taylor <iant@google.com>
5408
5409 PR gold/13204
5410 * layout.cc (Layout::segment_precedes): Don't assert failure if a
5411 --section-start option was seen.
5412 * options.h (General_options::any_section_start): New function.
5413
5414 2011-10-18 David S. Miller <davem@davemloft.net>
5415
5416 PR binutils/13301
5417 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
5418 member to track relocation locations that have moved during TLS
5419 reloc optimizations.
5420 (Target_sparc::Relocate::Relocate): Initialize to NULL.
5421 (Target_sparc::Relocate::relocate): Adjust view down by 4
5422 bytes if it matches reloc_adjust_addr_.
5423 (Target_sparc::Relocate::relocate_tls): Always move the
5424 __tls_get_addr call delay slot instruction forward 4 bytes when
5425 performing relaxation.
5426
5427 2011-10-18 Cary Coutant <ccoutant@google.com>
5428
5429 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
5430 (Output_file::map_no_anonymous): Check for non-zero
5431 return code from posix_fallocate.
5432
5433 2011-10-17 Cary Coutant <ccoutant@google.com>
5434
5435 PR gold/13245
5436 * plugin.cc (is_visible_from_outside): Check for symbols
5437 referenced from dynamic objects.
5438 * resolve.cc (Symbol_table::resolve): Don't count references
5439 from dynamic objects as references from real ELF files.
5440 * testsuite/plugin_test_2.sh: Adjust expected result.
5441
5442 2011-10-17 Cary Coutant <ccoutant@google.com>
5443
5444 * gold.cc: Include timer.h.
5445 (queue_middle_tasks): Stamp time.
5446 (queue_final_tasks): Likewise.
5447 * main.cc (main): Store timer in parameters. Print timers
5448 for each pass.
5449 * parameters.cc (Parameters::Parameters): Initialize timer_.
5450 (Parameters::set_timer): New function.
5451 (set_parameters_timer): New function.
5452 * parameters.h (Parameters::set_timer): New function.
5453 (Parameters::timer): New function.
5454 (Parameters::timer_): New data member.
5455 (set_parameters_timer): New function.
5456 * timer.cc (Timer::stamp): New function.
5457 (Timer::get_pass_time): New function.
5458 * timer.h (Timer::stamp): New function.
5459 (Timer::get_pass_time): New function.
5460 (Timer::pass_times_): New data member.
5461
5462 2011-10-17 Cary Coutant <ccoutant@google.com>
5463
5464 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
5465 task for members of lib groups.
5466
5467 2011-10-17 Cary Coutant <ccoutant@google.com>
5468
5469 PR gold/13288
5470 * fileread.cc (File_read::find_view): Add assert.
5471 (File_read::make_view): Move bounds check (replace with assert)...
5472 (File_read::find_or_make_view): ... to here.
5473
5474 2011-10-12 Cary Coutant <ccoutant@google.com>
5475
5476 * output.cc (Output_file::open_base_file): Handle case where
5477 ::read returns less than requested size.
5478
5479 2011-10-10 Cary Coutant <ccoutant@google.com>
5480
5481 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
5482 Initialize defined_count_.
5483 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
5484 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
5485 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
5486 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
5487 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
5488 * incremental.h (Sized_relobj_incr::defined_count_): New data
5489 member.
5490 (Sized_incr_dynobj::defined_count_): New data member.
5491 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
5492 Return zeroes instead of internal error.
5493
5494 2011-10-10 Cary Coutant <ccoutant@google.com>
5495
5496 PR gold/13249
5497 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
5498 (Output_reloc::symbol_value): Return PLT offset if flag is set.
5499 * output.h (class Output_reloc): Add use_plt_offset flag.
5500 (Output_reloc::type_): Adjust size of bit field.
5501 (Output_reloc::use_plt_offset_): New bit field.
5502 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
5503 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
5504 flag. Adjust all callers.
5505 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
5506 creating RELATIVE relocations.
5507
5508 2011-10-10 Nick Clifton <nickc@redhat.com>
5509
5510 * po/es.po: Updated Spanish translation.
5511 * po/fi.po: Updated Finnish translation.
5512
5513 2011-10-03 Diego Novillo <dnovillo@google.com>
5514
5515 * options.cc (parse_uint): Fix dereference of RETVAL.
5516
5517 2011-09-29 Sriraman Tallam <tmsriram@google.com>
5518
5519 * layout.h (section_order_map_): New member.
5520 (get_section_order_map): New member function.
5521 * output.cc (Output_section::add_input_section): Check for patterns
5522 only when --section-ordering-file is specified.
5523 * gold.cc (queue_middle_tasks): Delay updating order of sections till
5524 output_sections have been formed.
5525 * layout.cc (Layout_Layout): Initialize section_order_map_.
5526 * plugin.cc (update_section_order): Store order in order_map. Do not
5527 update the order.
5528 * testsuite/Makefile.am: Add test case for plugin_final_layout.
5529 * testsuite/Makefile.in: Regenerate.
5530 * testsuite/plugin_section_order.c: New file.
5531 * testsuite/plugin_final_layout.cc: New file.
5532 * testsuite/plugin_final_layout.sh: New file.
5533
5534 2011-09-29 Cary Coutant <ccoutant@google.com>
5535
5536 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5537 Check for NULL.
5538 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
5539 symbols during incremental update.
5540 (Symbol_table::add_from_dynobj): Likewise.
5541
5542 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5543 Ian Lance Taylor <iant@google.com>
5544
5545 * symtab.cc (Symbol_table::define_special_symbol): Always
5546 canonicalize version string.
5547
5548 2011-09-26 Cary Coutant <ccoutant@google.com>
5549
5550 * gold.cc (queue_initial_tasks): Move option checks ...
5551 * options.cc (General_options::finalize): ... to here. Disable
5552 some options; make others fatal.
5553
5554 2011-09-26 Cary Coutant <ccoutant@google.com>
5555
5556 gcc PR lto/47247
5557 * plugin.cc (get_symbols_v2): New function.
5558 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
5559 (is_referenced_from_outside): New function.
5560 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
5561 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
5562 (get_symbols): Pass version parameter.
5563 (get_symbols_v2): New function.
5564 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
5565 parameter.
5566 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
5567 (onload): Add LDPT_GET_SYMBOLS_V2.
5568 (all_symbols_read_hook): Use get_symbols_v2; check for
5569 LDPR_PREVAILING_DEF_IRONLY_EXP.
5570 * testsuite/plugin_test_3.sh: Update expected results.
5571
5572 2011-09-23 Simon Baldwin <simonb@google.com>
5573
5574 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
5575 configuration options.
5576 * configure: Regenerate.
5577 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
5578 * Makefile.in: Regenerate.
5579 * testsuite/Makefile.in: Regenerate.
5580
5581 2011-09-19 Sriraman Tallam <tmsriram@google.com>
5582
5583 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
5584
5585 2011-09-19 Cary Coutant <ccoutant@google.com>
5586
5587 * incremental.cc (can_incremental_update): Fix typo in comment.
5588 * incremental.h (can_incremental_update): Likewise.
5589
5590 2011-09-18 Cary Coutant <ccoutant@google.com>
5591
5592 * incremental.cc (can_incremental_update): New function.
5593 * incremental.h (can_incremental_update): New function.
5594 * layout.cc (Layout::init_fixed_output_section): Call it.
5595 (Layout::make_output_section): Don't allow patch space in .eh_frame.
5596 * object.cc (Sized_relobj_file::do_layout): Call
5597 can_incremental_update.
5598
5599 2011-09-13 Cary Coutant <ccoutant@google.com>
5600
5601 * configure.ac: Check for glibc support for gnu_indirect_function
5602 support with static linking, setting automake conditional
5603 IFUNC_STATIC.
5604 * Makefile.in: Regenerate.
5605 * configure: Regenerate.
5606
5607 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
5608 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
5609 for IFUNC_STATIC.
5610 * testsuite/Makefile.in: Regenerate.
5611
5612 2011-09-13 Cary Coutant <ccoutant@google.com>
5613
5614 * incremental.cc (Sized_relobj_incr::do_layout): Call
5615 report_comdat_group for kept comdat sections.
5616 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
5617 * testsuite/Makefile.in: Regenerate.
5618 * testsuite/incr_comdat_test_1.cc: New source file.
5619 * testsuite/incr_comdat_test_2_v1.cc: New source file.
5620 * testsuite/incr_comdat_test_2_v2.cc: New source file.
5621 * testsuite/incr_comdat_test_2_v3.cc: New source file.
5622
5623 2011-09-13 Ian Lance Taylor <iant@google.com>
5624
5625 * object.cc (Sized_relobj_file::do_layout): Remove unused local
5626 variable external_symbols_offset.
5627
5628 2011-09-12 Ian Lance Taylor <iant@google.com>
5629
5630 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
5631 triggered if object has no symbols.
5632
5633 2011-09-09 David S. Miller <davem@davemloft.net>
5634
5635 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
5636 (Output_fill_debug_line::do_write): Likewise.
5637
5638 2011-08-29 Cary Coutant <ccoutant@google.com>
5639
5640 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
5641 casts to match formatting specs.
5642 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
5643
5644 2011-08-26 Cary Coutant <ccoutant@google.com>
5645
5646 * layout.cc (Free_list::allocate): Provide guarantee of minimum
5647 remaining hole size when allocating.
5648 (Layout::make_output_section): Set fill methods for debug sections.
5649 * layout.h (Free_list::Free_list_node): Move from private to
5650 public.
5651 (Free_list::set_min_hole_size): New function.
5652 (Free_list::begin, Free_list::end): New functions.
5653 (Free_list::min_hole_): New data member.
5654 * output.cc: Include dwarf.h.
5655 (Output_fill_debug_info::do_minimum_hole_size): New function.
5656 (Output_fill_debug_info::do_write): New function.
5657 (Output_fill_debug_line::do_minimum_hole_size): New function.
5658 (Output_fill_debug_line::do_write): New function.
5659 (Output_section::Output_section): Initialize new data member.
5660 (Output_section::set_final_data_size): Ensure patch space is larger
5661 than minimum hole size.
5662 (Output_section::do_write): Fill holes in debug sections.
5663 * output.h (Output_fill): New class.
5664 (Output_fill_debug_info): New class.
5665 (Output_fill_debug_line): New class.
5666 (Output_section::set_free_space_fill): New function.
5667 (Output_section::free_space_fill_): New data member.
5668 * testsuite/Makefile.am (incremental_test_3): Add
5669 --incremental-patch option.
5670 (incremental_test_4): Likewise.
5671 (incremental_test_5): Likewise.
5672 (incremental_test_6): Likewise.
5673 (incremental_copy_test): Likewise.
5674 (incremental_common_test_1): Likewise.
5675 * testsuite/Makefile.in: Regenerate.
5676
5677 2011-08-26 Nick Clifton <nickc@redhat.com>
5678
5679 * po/es.po: Updated Spanish translation.
5680
5681 2011-08-01 Cary Coutant <ccoutant@google.com>
5682
5683 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
5684 * gold/testsuite/Makefile.in: Regenerate.
5685 * gold/testsuite/justsyms_exec.c: New source file.
5686 * gold/testsuite/justsyms_lib.c: New source file.
5687
5688 2011-08-01 Cary Coutant <ccoutant@google.com>
5689
5690 * layout.cc (Layout::set_segment_offsets): Don't realign text
5691 segment if -Ttext was specified.
5692 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
5693 file type.
5694 * object.h (Sized_relobj_file::e_type): New function.
5695 (Sized_relobj_file::e_type_): New data member.
5696 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
5697 base address for ET_EXEC files.
5698 * target.cc (Target::do_make_elf_object_implementation): Allow
5699 ET_EXEC files with --just-symbols option.
5700
5701 2011-07-28 Cary Coutant <ccoutant@google.com>
5702
5703 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
5704 Add thread_number parameter.
5705 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
5706 * workqueue-threads.cc
5707 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
5708 current thread if its thread number is greater than desired thread
5709 count.
5710 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
5711 Add thread_number parameter.
5712 (Workqueue::should_cancel_thread): Likewise.
5713 (Workqueue::find_runnable_or_wait): Pass thread_number to
5714 should_cancel_thread.
5715 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
5716 parameter.
5717
5718 2011-07-22 Sriraman Tallam <tmsriram@google.com>
5719
5720 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
5721 only after checking if it cannot be forced local.
5722 * symtab.h (is_externally_visible): Check if the symbol is not forced
5723 local.
5724
5725 2011-07-15 Ian Lance Taylor <iant@google.com>
5726
5727 * options.h (class General_options): Add --print-output-format.
5728 Move -EL next to -EB, for better --help output.
5729 * target-select.cc: Include <cstdio>, "options.h", and
5730 "parameters.h".
5731 (Target_selector::do_target_bfd_name): New function.
5732 (print_output_format): New function.
5733 * target-select.h (class Target_selector): Update declarations.
5734 (Target_selector::target_bfd_name): New function.
5735 (print_output_format): Declare.
5736 * main.cc: Include "target-select.h".
5737 (main): Handle --print-output-format.
5738 * gold.cc: Include "target-select.h".
5739 (queue_initial_tasks): Handle --print-output-format when there are
5740 no input files.
5741 * parameters.cc (parameters_force_valid_target): Give a better
5742 error message if -EB/-EL does not match target.
5743 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
5744 function.
5745
5746 2011-07-15 Ian Lance Taylor <iant@google.com>
5747
5748 * i386.cc (class Output_data_plt_i386): Add layout_ field.
5749 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
5750 (Output_data_plt_i386::do_write): Write address of .dynamic
5751 section to first entry in .got.plt section.
5752 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
5753 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5754 Initialize layout_.
5755 (Output_data_plt_x86_64::do_write): Write address of .dynamic
5756 section to first entry in .got.plt section.
5757 * layout.h (Layout::dynamic_section): New function.
5758
5759 2011-07-13 Sriraman Tallam <tmsriram@google.com>
5760
5761 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
5762 to claim_file call.
5763 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
5764 input_section_position_, and input_section_glob_.
5765 (read_layout_from_file): Call function section_ordering_specified.
5766 * layout.h (is_section_ordering_specified): New function.
5767 (section_ordering_specified): New function.
5768 (section_ordering_specified_): New boolean member.
5769 * main.cc(main): Call load_plugins after layout object is defined.
5770 * output.cc (Output_section::add_input_section): Use
5771 function section_ordering_specified to check if section ordering is
5772 needed.
5773 * output.cc (Output_section::add_relaxed_input_section): Use
5774 function section_ordering_specified to check if section ordering is
5775 needed.
5776 (Output_section::update_section_layout): New function.
5777 (Output_section::sort_attached_input_sections): Check if input section
5778 must be reordered.
5779 * output.h (Output_section::update_section_layout): New function.
5780 * plugin.cc (get_section_count): New function.
5781 (get_section_type): New function.
5782 (get_section_name): New function.
5783 (get_section_contents): New function.
5784 (update_section_order): New function.
5785 (allow_section_ordering): New function.
5786 (Plugin::load): Add the new interfaces to the transfer vector.
5787 (Plugin_manager::load_plugins): New parameter.
5788 (Plugin_manager::all_symbols_read): New parameter.
5789 (Plugin_manager::claim_file): New parameter. Save the elf object for
5790 unclaimed objects.
5791 (Plugin_manager::get_elf_object): New function.
5792 (Plugin_manager::get_view): Change to directly use the bool to check
5793 if get_view is called from claim_file_hook.
5794 * plugin.h (input_objects): New function
5795 (Plugin__manager::load_plugins): New parameter.
5796 (Plugin_manager::claim_file): New parameter.
5797 (Plugin_manager::get_elf_object): New function.
5798 (Plugin_manager::in_claim_file_handler): New function.
5799 (Plugin_manager::in_claim_file_handler_): New member.
5800 (layout): New function.
5801 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
5802 handler with an extra parameter. Make the elf object before calling
5803 claim_file handler.
5804 * testsuite/plugin_test.c (get_section_count): New function pointer.
5805 (get_section_type): New function pointer.
5806 (get_section_name): New function pointer.
5807 (get_section_contents): New function pointer.
5808 (update_section_order): New function pointer.
5809 (allow_section_ordering): New function pointer.
5810 (onload): Check if the new interfaces exist.
5811
5812 2011-07-13 Ian Lance Taylor <iant@google.com>
5813
5814 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
5815 relro section.
5816 * x86_64.cc (Target_x86_64::got_section): Likewise.
5817 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
5818 (relro_now_test_SOURCES): New variable.
5819 (relro_now_test_DEPENDENCIES): New variable.
5820 (relro_now_test_LDFLAGS): New variable.
5821 (relro_now_test_LDADD): New variable.
5822 (relro_now_test.so): New target.
5823 * testsuite/Makefile.in: Rebuild.
5824
5825 2011-07-12 Ian Lance Taylor <iant@google.com>
5826
5827 PR gold/12980
5828 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
5829 GLOB_DAT relocation rather than a RELATIVE relocation for a
5830 protected symbol when creating a shared library.
5831 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5832 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
5833 * testsuite/protected_main_1.cc (main): Test that protected
5834 function has same address.
5835
5836 2011-07-11 Ian Lance Taylor <iant@google.com>
5837
5838 PR gold/12979
5839 * options.h (class General_options): Add -Bgroup.
5840 * options.cc (General_options::finalize): If -Bgroup is set,
5841 default to --unresolved-symbols=report-all.
5842 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
5843 * target-reloc.h (issue_undefined_symbol_error): Handle
5844 --unresolved-symbols=report-all.
5845
5846 2011-07-08 Ian Lance Taylor <iant@google.com>
5847
5848 PR gold/11985
5849 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
5850 if linker script discards key sections.
5851 (Layout::create_dynamic_symtab): Likewise.
5852 (Layout::assign_local_dynsym_offsets): Likewise.
5853 (Layout::sized_create_version_sections): Likewise.
5854 (Layout::create_interp): Likewise.
5855 (Layout::finish_dynamic_section): Likewise.
5856 (Layout::set_dynamic_symbol_size): Likewise.
5857
5858 2011-07-08 Ian Lance Taylor <iant@google.com>
5859
5860 PR gold/12386
5861 * options.h (class General_options): Add --unresolved-symbols.
5862 * target-reloc.h (issue_undefined_symbol_error): Check
5863 --unresolved-symbols. Add comments.
5864
5865 2011-07-08 Ian Lance Taylor <iant@google.com>
5866
5867 * testsuite/odr_violation2.cc (Ordering::operator()): Make
5868 expression more complex.
5869
5870 2011-07-08 Ian Lance Taylor <iant@google.com>
5871
5872 PR gold/11317
5873 * target-reloc.h (issue_undefined_symbol_error): New inline
5874 function, broken out of relocate_section.
5875 (relocate_section): Call issue_undefined_symbol_error.
5876 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5877 there is no TLS segment if we are about to issue an undefined
5878 symbol error.
5879 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5880
5881 2011-07-08 Ian Lance Taylor <iant@google.com>
5882
5883 PR gold/12279
5884 * resolve.cc (Symbol_table::should_override): Add fromtype
5885 parameter. Change all callers. Give error when linking together
5886 TLS and non-TLS symbol.
5887 (Symbol_table::should_override_with_special): Add fromtype
5888 parameter. Change all callers.
5889 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5890 there is no TLS segment if we have reported some errors.
5891 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5892
5893 2011-07-08 Ian Lance Taylor <iant@google.com>
5894
5895 PR gold/12372
5896 * target.h (Target::plt_address_for_global): New function.
5897 (Target::plt_address_for_local): New function.
5898 (Target::plt_section_for_global): Remove.
5899 (Target::plt_section_for_local): Remove.
5900 (Target::do_plt_address_for_global): New virtual function.
5901 (Target::do_plt_address_for_local): New virtual function.
5902 (Target::do_plt_section_for_global): Remove.
5903 (Target::do_plt_section_for_local): Remove.
5904 (Target::register_global_plt_entry): Add Symbol_table and Layout
5905 parameters.
5906 * output.cc (Output_data_got::Got_entry::write): Use
5907 plt_address_for_global and plt_address_for_local.
5908 * layout.cc (Layout::add_target_dynamic_tags): Use size and
5909 address of output section.
5910 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
5911 got_irelative_, and irelative_count_ fields. Update
5912 declarations.
5913 (Output_data_plt_i386::has_irelative_section): New function.
5914 (Output_data_plt_i386::entry_count): Add irelative_count_.
5915 (Output_data_plt_i386::set_final_data_size): Likewise.
5916 (class Target_i386): Add got_irelative_ and rel_irelative_
5917 fields. Update declarations.
5918 (Target_i386::Target_i386): Initialize new fields.
5919 (Target_i386::do_plt_address_for_global): New function replacing
5920 do_plt_section_for_global.
5921 (Target_i386::do_plt_address_for_local): New function replacing
5922 do_plt_section_for_local.
5923 (Target_i386::got_section): Create got_irelative_.
5924 (Target_i386::rel_irelative_section): New function.
5925 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
5926 fields. Don't define __rel_iplt_{start,end}.
5927 (Output_data_plt_i386::add_entry): Add symtab and layout
5928 parameters. Change all callers. Use different PLT and GOT for
5929 IFUNC symbols.
5930 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
5931 layout parameters. Change all callers. Use different PLT and
5932 GOT.
5933 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
5934 (Output_data_plt_i386::rel_irelative): New function.
5935 (Output_data_plt_i386::address_for_global): New function.
5936 (Output_data_plt_i386::address_for_local): New function.
5937 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
5938 IRELATIVE GOT when changing IFUNC GOT entries.
5939 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
5940 reloc.
5941 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
5942 if we didn't create an IRELATIVE GOT.
5943 (Target_i386::Relocate::relocate): Use plt_address_for_global and
5944 plt_address_for_local.
5945 (Target_i386::do_dynsym_value): Use plt_address_for_global.
5946 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
5947 got_irelative_, and irelative_count_ fields. Update
5948 declarations.
5949 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5950 Initialize new fields. Remove symtab parameter. Change all
5951 callers.
5952 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
5953 irelative_count_.
5954 (Output_data_plt_x86_64::has_irelative_section): New function.
5955 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
5956 (class Target_x86_64): Add got_irelative_ and rel_irelative_
5957 fields. Update declarations.
5958 (Target_x86_64::Target_x86_64): Initialize new fields.
5959 (Target_x86_64::do_plt_address_for_global): New function replacing
5960 do_plt_section_for_global.
5961 (Target_x86_64::do_plt_address_for_local): New function replacing
5962 do_plt_section_for_local.
5963 (Target_x86_64::got_section): Create got_irelative_.
5964 (Target_x86_64::rela_irelative_section): New function.
5965 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
5966 all callers. Don't create __rel_iplt_{start,end}.
5967 (Output_data_plt_x86_64::add_entry): Add symtab and layout
5968 parameters. Change all callers. Use different PLT and GOT for
5969 IFUNC symbols.
5970 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
5971 layout parameters. Change all callers. Use different PLT and
5972 GOT.
5973 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
5974 parameters. Change all callers. Use different PLT and GOT for
5975 IFUNC symbols.
5976 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
5977 (Output_data_plt_x86_64::rela_irelative): New function.
5978 (Output_data_plt_x86_64::address_for_global): New function.
5979 (Output_data_plt_x86_64::address_for_local): New function.
5980 (Output_data_plt_x86_64::set_final_data_size): Likewise.
5981 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
5982 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
5983 (Target_x86_64::register_global_plt_entry): Add symtab and layout
5984 parameters.
5985 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
5986 reloc.
5987 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
5988 symbols if we didn't create an IRELATIVE GOT.
5989 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
5990 plt_address_for_local.
5991 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
5992 * testsuite/ifuncvar1.c: New test file.
5993 * testsuite/ifuncvar2.c: New test file.
5994 * testsuite/ifuncvar3.c: New test file.
5995 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
5996 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
5997 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
5998 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
5999 * testsuite/Makefile.in: Rebuild.
6000
6001 2011-07-07 Cary Coutant <ccoutant@google.com>
6002
6003 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
6004 (two_file_test_1_ndebug.o): Likewise.
6005 (two_file_test_1b_ndebug.o): Likewise.
6006 (two_file_test_2_ndebug.o): Likewise.
6007 (two_file_test_main_ndebug.o): Likewise.
6008 (incremental_test_2): Link with no-debug versions.
6009
6010 2011-07-06 Cary Coutant <ccoutant@google.com>
6011
6012 * gold/incremental.cc
6013 (Output_section_incremental_inputs::write_info_blocks): Check for
6014 hidden and internal symbols.
6015
6016 2011-07-06 Cary Coutant <ccoutant@google.com>
6017
6018 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
6019 Check disposition for startup file.
6020 (Incremental_inputs::report_command_line): Ignore
6021 --incremental-startup-unchanged option.
6022 * options.cc (General_options::parse_incremental_startup_unchanged):
6023 New function.
6024 (General_options::General_options): Initialize new data member.
6025 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
6026 (General_options): Add --incremental-startup-unchanged option.
6027 (General_options::incremental_startup_disposition): New function.
6028 (General_options::incremental_startup_disposition_): New data member.
6029
6030 2011-07-06 Cary Coutant <ccoutant@google.com>
6031
6032 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
6033 input file index to Script_info ctor.
6034 (Sized_incremental_binary::do_file_has_changed): Find the
6035 command-line argument for files named in scripts.
6036 * incremental.h (Script_info::Script_info): New ctor
6037 with input file index.
6038 (Script_info::input_file_index): New function.
6039 (Script_info::input_file_index_): New data member.
6040 (Incremental_binary::get_library): Add const.
6041 (Incremental_binary::get_script_info): Add const.
6042 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
6043 * testsuite/Makefile.am (incremental_test_5): New test case.
6044 (incremental_test_6): New test case.
6045 * testsuite/Makefile.in: Regenerate.
6046
6047 2011-07-06 Cary Coutant <ccoutant@google.com>
6048
6049 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
6050 debug output when command lines differ.
6051
6052 2011-07-06 Cary Coutant <ccoutant@google.com>
6053
6054 * incremental.cc (Incremental_inputs::report_command_line): Ignore
6055 --incremental-patch option.
6056 * layout.cc (Free_list::allocate): Extend allocation beyond original
6057 end if enabled.
6058 (Layout::make_output_section): Mark sections that should get
6059 patch space.
6060 * options.cc (parse_percent): New function.
6061 * options.h (parse_percent): New function.
6062 (DEFINE_percent): New macro.
6063 (General_options): Add --incremental-patch option.
6064 * output.cc (Output_section::Output_section): Initialize new data
6065 members.
6066 (Output_section::add_input_section): Print section name when out
6067 of patch space.
6068 (Output_section::add_output_section_data): Likewise.
6069 (Output_section::set_final_data_size): Add patch space when
6070 doing --incremental-full.
6071 (Output_section::do_reset_address_and_file_offset): Remove patch
6072 space.
6073 (Output_segment::set_section_list_addresses): Print debug output
6074 only if --incremental-update.
6075 * output.h (Output_section::set_is_patch_space_allowed): New function.
6076 (Output_section::is_patch_space_allowed_): New data member.
6077 (Output_section::patch_space_): New data member.
6078 * parameters.cc (Parameters::incremental_full): New function.
6079 * parameters.h (Parameters::incremental_full): New function
6080 * testsuite/Makefile.am (incremental_test_2): Add test for
6081 --incremental-patch option.
6082 * testsuite/Makefile.in: Regenerate.
6083 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
6084 (t18): Remove function body.
6085
6086 2011-07-05 Doug Kwan <dougkwan@google.com>
6087
6088 PR gold/12771
6089 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
6090 Arm_Address type for relocation result.
6091 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
6092 overflow check.
6093 (Arm_relocate_functions::abs32): Use unaligned access.
6094 (Arm_relocate_functions::rel32): Ditto.
6095 (Arm_relocate_functions::prel31): Ditto.
6096 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
6097 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
6098 static data relocations.
6099 * testsuite/Makefile.in: Regnerate.
6100 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
6101
6102 2011-07-05 Ian Lance Taylor <iant@google.com>
6103
6104 PR gold/12392
6105 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
6106 symbols if necessary.
6107 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6108
6109 2011-07-05 Ian Lance Taylor <iant@google.com>
6110
6111 PR gold/12952
6112 * resolve.cc (Symbol::override_base_with_special): Simply override
6113 version with special symbol version, ignoring previous version.
6114
6115 2011-07-05 Ian Lance Taylor <iant@google.com>
6116
6117 * object.cc (Sized_relobj_file::include_section_group): Add
6118 information to comment about signature location.
6119
6120 2011-07-02 Ian Lance Taylor <iant@google.com>
6121
6122 PR gold/12957
6123 * options.h (class General_options): Add -f and -F.
6124 * options.cc (General_options::finalize): Fatal error if -f/-F
6125 are used without -shared.
6126 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
6127
6128 2011-07-02 Ian Lance Taylor <iant@google.com>
6129
6130 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
6131
6132 2011-07-01 Ian Lance Taylor <iant@google.com>
6133
6134 PR gold/12525
6135 PR gold/12952
6136 * resolve.cc (Symbol::override_base_with_special): Don't override
6137 the version if the overriding symbol has a different name.
6138 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
6139 all callers. If we give an error about an undefined version,
6140 define the base version if necessary.
6141 * dynobj.h (class Versions): Update declaration.
6142 * testsuite/weak_alias_test_5.cc: New file.
6143 * testsuite/weak_alias_test.script: New file.
6144 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
6145 and versioned_alias have the right value, and call t2.
6146 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
6147 weak_alias_test_5.so.
6148 (weak_alias_test_LDADD): Likewise.
6149 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
6150 * testsuite/Makefile.in: Rebuild.
6151
6152 2011-07-01 Ian Lance Taylor <iant@google.com>
6153
6154 PR gold/12525
6155 * options.h (class General_options): Support -z notext.
6156 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
6157 -Wl,-z,notext.
6158 (two_file_shared_nonpic.so): Likewise.
6159 (two_file_shared_mixed.so): Likewise.
6160 (two_file_shared_mixed_1.so): Likewise.
6161 (weak_undef_lib_nonpic.so): Likewise.
6162 (alt/weak_undef_lib_nonpic.so): Likewise.
6163 (tls_test_shared_nonpic.so): Likewise.
6164 * testsuite/Makefile.in: Rebuild.
6165
6166 2011-07-01 Ian Lance Taylor <iant@google.com>
6167
6168 PR gold/12525
6169 * configure.ac: Test whether static linking works, setting
6170 the automake conditional HAVE_STATIC.
6171 * testsuite/Makefile.am: Disable tests using -static if
6172 HAVE_STATIC is not true.
6173 * configure, testsuite/Makefile.in: Rebuild.
6174
6175 2011-07-01 Ian Lance Taylor <iant@google.com>
6176
6177 PR gold/12525
6178 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
6179 Assert if we see DW_EH_PE_indirect.
6180 * target.h (Target::ehframe_datarel_base): New function.
6181 (Target::do_ehframe_datarel_base): New target function.
6182 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
6183 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
6184 function.
6185
6186 2011-07-01 Ian Lance Taylor <iant@google.com>
6187
6188 PR gold/12571
6189 * options.h (class General_options): Add
6190 --ld-generated-unwind-info.
6191 * ehframe.cc (Fde::write): Add address parameter. Change all
6192 callers. If associated with PLT, fill in address and size.
6193 (Cie::set_output_offset): Only add merge mapping if there is an
6194 object.
6195 (Cie::write): Add address parameter. Change all callers.
6196 (Eh_frame::add_ehframe_for_plt): New function.
6197 * ehframe.h (class Fde): Update declarations. Move shndx_ and
6198 input_offset_ fields into union u_, with new plt field.
6199 (Fde::Fde): Adjust for new union field.
6200 (Fde::Fde) [Output_data version]: New constructor.
6201 (Fde::add_mapping): Only add merge mapping if there is an object.
6202 (class Cie): Update declarations.
6203 (class Eh_frame): Declare add_ehframe_for_plt.
6204 * layout.cc (Layout::layout_eh_frame): Break out code into
6205 make_eh_frame_section, and call it.
6206 (Layout::make_eh_frame_section): New function.
6207 (Layout::add_eh_frame_for_plt): New function.
6208 * layout.h (class Layout): Update declarations.
6209 * merge.cc (Merge_map::add_mapping): Add assertion.
6210 * i386.cc: Include "dwarf.h".
6211 (class Output_data_plt_i386): Make first_plt_entry,
6212 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
6213 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6214 and plt_eh_frame_fde.
6215 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
6216 boundary. Call add_eh_frame_for_plt if appropriate.
6217 * x86_64.cc: Include "dwarf.h".
6218 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
6219 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
6220 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6221 and plt_eh_frame_fde.
6222 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
6223 appropriate.
6224
6225 2011-06-29 Ian Lance Taylor <iant@google.com>
6226
6227 PR gold/12629
6228 * object.cc (Sized_relobj_file::layout_section): Change shdr
6229 parameter to be const.
6230 (Sized_relobj_file::layout_eh_frame_section): New function, broken
6231 out of do_layout.
6232 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
6233 appropriate. Call layout_eh_frame_section.
6234 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
6235 sections.
6236 * object.h (class Sized_relobj_file): Update declarations.
6237
6238 2011-06-29 Ian Lance Taylor <iant@google.com>
6239
6240 PR gold/12652
6241 * script.cc (Token::integer_value): Accept trailing M/m/K/k
6242 modifier.
6243 (Lex::gather_token): Accept trailing M/m/K/k for integers.
6244
6245 2011-06-29 Ian Lance Taylor <iant@google.com>
6246
6247 PR gold/12675
6248 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
6249 SHT_X86_64_UNWIND.
6250 * layout.cc (Layout::layout_eh_frame): Likewise.
6251
6252 2011-06-29 Ian Lance Taylor <iant@google.com>
6253
6254 PR gold/12695
6255 * layout.cc (Layout::symtab_section_shndx): New function.
6256 * layout.h (class Layout): Declare symtab_section_shndx.
6257 * output.cc (Output_section::write_header): Call it.
6258
6259 2011-06-29 Ian Lance Taylor <iant@google.com>
6260
6261 PR gold/12818
6262 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
6263 symbols which are not used in a relocation.
6264
6265 2011-06-28 Ian Lance Taylor <iant@google.com>
6266
6267 PR gold/12898
6268 * layout.cc (Layout::segment_precedes): Don't crash if a linker
6269 script create indistinguishable segments.
6270 (Layout::set_segment_offsets): Use stable_sort when sorting
6271 segments. Pass this to Compare_segments constructor.
6272 * layout.h (class Layout): Make segment_precedes non-static.
6273 (class Compare_segments): Change from struct to class. Add
6274 layout_ field. Add constructor.
6275 * script-sections.cc
6276 (Script_sections::attach_sections_using_phdrs_clause): Rename
6277 local orphan to is_orphan. Don't report failure to put empty
6278 section in segment. On attachment failure, report name of
6279 section, and attach to first PT_LOAD segment.
6280
6281 2011-06-28 Ian Lance Taylor <iant@google.com>
6282
6283 PR gold/12934
6284 * target-select.cc (Target_selector::Target_selector): Add
6285 emulation parameter. Change all callers.
6286 (select_target_by_bfd_name): Rename from select_target_by_name.
6287 Change all callers.
6288 (select_target_by_emulation): New function.
6289 (supported_emulation_names): New function.
6290 * target-select.h (class Target_selector): Add emulation_ field.
6291 Update declarations.
6292 (Target_selector::recognize_by_bfd_name): Rename from
6293 recognize_by_name. Change all callers.
6294 (Target_selector::supported_bfd_names): Rename from
6295 supported_names. Change all callers.
6296 (Target_selector::recognize_by_emulation): New function.
6297 (Target_selector::supported_emulations): New function.
6298 (Target_selector::emulation): New function.
6299 (Target_selector::do_recognize_by_bfd_name): Rename from
6300 do_recognize_by_name. Change all callers.
6301 (Target_selector::do_supported_bfd_names): Rename from
6302 do_supported_names. Change all callers.
6303 (Target_selector::do_recognize_by_emulation): New function.
6304 (Target_selector::do_supported_emulations): New function.
6305 (select_target_by_bfd_name): Change name in declaration.
6306 (select_target_by_emulation): Declare.
6307 (supported_emulation_names): Declare.
6308 * parameters.cc (parameters_force_valid_target): Try to find
6309 target based on emulation from -m option.
6310 * options.h (class General_options): Change doc string for -m.
6311 * options.cc (help): Print emulations.
6312 (General_options::parse_V): Likewise.
6313 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
6314 Add emulation parameter. Change all callers.
6315
6316 2011-06-28 Ian Lance Taylor <iant@google.com>
6317
6318 * target.h (class Target): Add osabi_ field.
6319 (Target::osabi): New function.
6320 (Target::set_osabi): New function.
6321 (Target::Target): Initialize osabi_.
6322 (Target::do_adjust_elf_header): Make pure virtual.
6323 (Sized_target::do_adjust_elf_header): Declare.
6324 * target.cc (Sized_target::do_adjust_elf_header): New function.
6325 (class Sized_target): Instantiate all versions.
6326 * freebsd.h (class Target_freebsd): Remove.
6327 (Target_selector_freebsd::do_recognize): Call set_osabi on
6328 Target.
6329 (Target_selector_freebsd::do_recognize_by_name): Likewise.
6330 (Target_selector_freebsd::set_osabi): Remove.
6331 * i386.cc (class Target_i386): Inherit from Sized_target rather
6332 than Target_freebsd.
6333 * x86_64.cc (class Target_x86_64): Likewise.
6334
6335 2011-06-28 Ian Lance Taylor <iant@google.com>
6336
6337 * target.h (Target::can_check_for_function_pointers): Rewrite.
6338 Make non-virtual.
6339 (Target::can_icf_inline_merge_sections): Likewise.
6340 (Target::section_may_have_icf_unsafe_poineters): Likewise.
6341 (Target::Target_info): Add can_icf_inline_merge_sections field.
6342 (Target::do_can_check_for_function_pointers): New virtual
6343 function.
6344 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
6345 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
6346 from can_check_for_function_pointers, move in file.
6347 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
6348 section_may_have_icf_unsafe_poineters, move in file.
6349 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
6350 * i386.cc (Target_i386::do_can_check_for_function_pointers):
6351 Rename from can_check_for_function_pointers, move in file.
6352 (Target_i386::can_icf_inline_merge_sections): Remove.
6353 (Target_i386::i386_info): Initialize
6354 can_icf_inline_merge_sections.
6355 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6356 Initialize can_icf_inline_merge_sections.
6357 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
6358 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
6359 Rename from can_check_for_function_pointers, move in file.
6360 (Target_x86_64::can_icf_inline_merge_sections): Remove.
6361 (Target_x86_64::x86_64_info): Initialize
6362 can_icf_inline_merge_sections.
6363 * testsuite/testfile.cc (Target_test::test_target_info):
6364 Likewise.
6365 * icf.cc (get_section_contents): Correct formatting.
6366
6367 2011-06-27 Ian Lance Taylor <iant@google.com>
6368
6369 * symtab.cc (Symbol::versioned_name): New function.
6370 (Symbol_table::add_to_final_symtab): Use versioned_name when
6371 appropriate.
6372 (Symbol_table::sized_write_symbol): Likewise.
6373 * symtab.h (class Symbol): Declare versioned_name.
6374 * stringpool.h (class Stringpool_template): Add variant of add
6375 which takes a std::basic_string.
6376 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
6377 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
6378 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
6379 (ver_test_12.o): New target.
6380 * testsuite/Makefile.in: Rebuild.
6381
6382 2011-06-27 Doug Kwan <dougkwan@google.com>
6383
6384 * arm.cc (Arm_relocate_functions::thm_jump8,
6385 Arm_relocate_functions::thm_jump11): Use a wider signed
6386 type to compute offset.
6387 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
6388 arm_thm_jump8.
6389 * testsuite/Makefile.in: Regenerate.
6390 * testsuite/arm_branch_in_range.sh: Check test results of
6391 arm_thm_jump11 and arm_thm_jump8.
6392 * testsuite/arm_thm_jump11.s: New test source file.
6393 * testsuite/arm_thm_jump11.t: New linker script.
6394 * testsuite/arm_thm_jump8.s: New test source file.
6395 * testsuite/arm_thm_jump8.t: New linker script.
6396
6397 2011-06-24 Ian Lance Taylor <iant@google.com>
6398
6399 * layout.cc: Include "object.h".
6400 (ctors_sections_in_init_array): New static variable.
6401 (Layout::is_ctors_in_init_array): New function.
6402 (Layout::layout): Add entry to ctors_sections_in_init_array if
6403 appropriate.
6404 * layout.h (class Layout): Declare is_ctors_in_init_array.
6405 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
6406 is_ctors_reverse_view is set.
6407 (Sized_relobj_file::write_sections): Add layout parameter. Change
6408 all callers. Set is_ctors_reverse_view field of View_size.
6409 (Sized_relobj_file::reverse_words): New function.
6410 * object.h (Sized_relobj_file::View_size): Add
6411 is_ctors_reverse_view field.
6412 (class Sized_relobj_file): Update declarations.
6413 * testsuite/initpri3.c: New test.
6414 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
6415 initpri3b.
6416 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
6417 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
6418 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
6419 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
6420 * testsuite/Makefile.in: Rebuild.
6421
6422 2011-06-24 Cary Coutant <ccoutant@google.com>
6423
6424 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
6425 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
6426 (debug_msg_cdebug.err): New targets.
6427 * testsuite/Makefile.in: Regenerate.
6428 * testsuite/debug_msg.sh: Check output of link with compressed debug.
6429 Fix checks for link with shared library.
6430
6431 2011-06-24 Doug Kwan <dougkwan@google.com>
6432
6433 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
6434 skip empty text sections.
6435 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
6436
6437 2011-06-22 Ian Lance Taylor <iant@google.com>
6438
6439 PR gold/12910
6440 * options.h (class General_options): Add --ctors-in-init-array.
6441 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
6442 friends as SHT_PROGBITS for merging sections.
6443 (Layout::layout): Remove special handling of .init_array and
6444 friends. Don't sort if doing relocatable link. Sort for .ctors
6445 and .dtors if ctors_in_init_array.
6446 (Layout::make_output_section): Force correct section types for
6447 .init_array and friends. Don't sort if doing relocatable link,
6448 Don't sort .ctors and .dtors if ctors_in_init_array.
6449 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
6450 (Layout::output_section_name): Add relobj parameter. Change all
6451 callers. Handle .ctors. and .dtors. in code rather than table.
6452 Handle .ctors and .dtors if ctors_in_init_array.
6453 (Layout::match_file_name): New function, moved from output.cc.
6454 * layout.h (class Layout): Update declarations.
6455 * output.cc: Include "layout.h".
6456 (Input_section_sort_entry::get_priority): New function.
6457 (Input_section_sort_entry::match_file_name): Just call
6458 Layout::match_file_name.
6459 (Output_section::Input_section_sort_init_fini_compare::operator()):
6460 Handle .ctors and .dtors. Sort by explicit priority rather than
6461 by name.
6462 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
6463 * testsuite/initpri2.c: New test.
6464 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
6465 (check_PROGRAMS): Add initpri2.
6466 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
6467 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
6468 * configure, testsuite/Makefile.in: Rebuild.
6469
6470 2011-06-19 Ian Lance Taylor <iant@google.com>
6471
6472 PR gold/12880
6473 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
6474 .interp section to a PT_INTERP segment even if we have seen a
6475 --dynamic-linker option. Don't do it if we have seen a PHDRS
6476 clause in a linker script.
6477 (Layout::finalize): Don't create a .interp section if we've
6478 already create a PT_INTERP segment.
6479 (Layout::create_interp): Always call choose_output_section (revert
6480 patch of 2011-06-17). Don't create PT_INTERP segment.
6481 * script-sections.cc
6482 (Script_sections::create_note_and_tls_segments): Add a .interp
6483 section to a PT_INTERP segment even if we have seen a
6484 --dynamic-linker option.
6485
6486 2011-06-18 Ian Lance Taylor <iant@google.com>
6487
6488 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
6489 merely because a non-PT_LOAD segment has a dynamic reloc.
6490
6491 2011-06-18 Ian Lance Taylor <iant@google.com>
6492
6493 * layout.cc (Layout::finish_dynamic_section): Don't create
6494 DT_FLAGS entry if not needed.
6495
6496 2011-06-18 Ian Lance Taylor <iant@google.com>
6497
6498 PR gold/12745
6499 * layout.cc (Layout::layout_eh_frame): Correct handling of
6500 writable .eh_frame section.
6501
6502 2011-06-17 Ian Lance Taylor <iant@google.com>
6503
6504 PR gold/12893
6505 * resolve.cc (Symbol_table::resolve): Don't give an error if a
6506 symbol is redefined with the exact same object and value.
6507
6508 2011-06-17 Ian Lance Taylor <iant@google.com>
6509
6510 PR gold/12880
6511 * layout.h (class Layout): Add interp_segment_ field.
6512 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
6513 (Layout::attach_allocated_section_to_segment): If making shared
6514 library, put .interp section in PT_INTERP segment.
6515 (Layout::finalize): Also call create_interp if -dynamic-linker
6516 option was used.
6517 (Layout::create_interp): Assert that there is no PT_INTERP
6518 segment. If not using a SECTIONS clause, use make_output_section.
6519 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
6520 * script-sections.cc
6521 (Script_sections::create_note_and_tls_segments): If making shared
6522 library, put .interp section in PT_INTERP segment.
6523
6524 2011-06-17 Ian Lance Taylor <iant@google.com>
6525
6526 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
6527 when making a shared library.
6528
6529 2011-06-17 Ian Lance Taylor <iant@google.com>
6530
6531 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
6532 parameter. Change all callers. Don't issue warning about PC32
6533 against locally defined symbol.
6534
6535 2011-06-16 Ian Lance Taylor <iant@google.com>
6536
6537 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
6538 occurs in same object.
6539
6540 2011-06-14 Alan Modra <amodra@gmail.com>
6541
6542 * po/POTFILES.in: Regenerate.
6543
6544 2011-06-09 Ian Lance Taylor <iant@google.com>
6545
6546 * script-sections.cc
6547 (Orphan_output_section::set_section_addresses): For a relocatable
6548 link set address to 0.
6549
6550 2011-06-09 Cary Coutant <ccoutant@google.com>
6551
6552 PR gold/12804
6553 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
6554 used with --compress-debug-sections.
6555 * gold/object.cc (Sized_relobj_file::do_layout): Report
6556 uncompressed size of compressed input sections.
6557
6558 2011-06-08 Cary Coutant <ccoutant@google.com>
6559
6560 PR gold/12804
6561 * testsuite/two_file_test_2_v1.cc: Change initialization of
6562 v2 to keep it in .data.
6563
6564 2011-06-07 Cary Coutant <ccoutant@google.com>
6565
6566 * common.cc (Symbol_table::do_allocate_commons_list): Call
6567 gold_fallback.
6568 * errors.cc (Errors::fatal): Adjust call to gold_exit.
6569 (Errors::fallback): New function.
6570 (gold_fallback): New function.
6571 * errors.h (Errors::fallback): New function.
6572 * gold.cc (gold_exit): Change status parameter to enum; adjust
6573 all callers.
6574 (queue_initial_tasks): Call gold_fallback.
6575 * gold.h: Include cstdlib.
6576 (Exit_status): New enum type.
6577 (gold_exit): Change status parameter to enum.
6578 (gold_fallback): New function.
6579 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
6580 (Layout::create_symtab_sections): Likewise.
6581 (Layout::create_shdrs): Likewise.
6582 * main.cc (main): Adjust call to gold_exit.
6583 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
6584 (Output_data_got::add_got_entry_pair): Likewise.
6585 (Output_section::add_input_section): Likewise.
6586 (Output_section::add_output_section_data): Likewise.
6587 (Output_segment::set_section_list_addresses): Likewise.
6588 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
6589
6590 2011-06-07 Cary Coutant <ccoutant@google.com>
6591
6592 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
6593 for incremental links.
6594 * output.cc (Output_segment::set_section_list_addresses): Remove
6595 FIXME and test for TLS or BSS.
6596
6597 2011-06-07 Cary Coutant <ccoutant@google.com>
6598
6599 * testsuite/Makefile.am: Add incremental_copy_test,
6600 incremental_common_test_1.
6601 * testsuite/Makefile.in: Regenerate.
6602 * testsuite/common_test_1_v1.c: New source file.
6603 * testsuite/common_test_1_v2.c: New source file.
6604 * testsuite/copy_test_v1.cc: New source file.
6605
6606 2011-06-07 Cary Coutant <ccoutant@google.com>
6607
6608 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
6609 update, allocate common from bss section's free list.
6610 * incremental-dump.cc (dump_incremental_inputs): Print flag for
6611 linker-defined symbols.
6612 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
6613 Skip GOT and PLT entries that are no longer referenced.
6614 (Output_section_incremental_inputs::write_info_blocks): Mark
6615 linker-defined symbols.
6616 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
6617 * output.cc (Output_section::allocate): New function.
6618 * output.h (Output_section::allocate): New function.
6619 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
6620 linker-defined symbols.
6621 (Symbol::override_base_with_special): Copy is_predefined_ flag.
6622 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
6623 (Symbol::init_base_output_data): Likewise.
6624 (Symbol::init_base_output_segment): Likewise.
6625 (Symbol::init_base_constant): Likewise.
6626 (Sized_symbol::init_output_data): Likewise.
6627 (Sized_symbol::init_output_segment): Likewise.
6628 (Sized_symbol::init_constant): Likewise.
6629 (Symbol_table::do_define_in_output_data): Likewise.
6630 (Symbol_table::do_define_in_output_segment): Likewise.
6631 (Symbol_table::do_define_as_constant): Likewise.
6632 * symtab.h (Symbol::is_predefined): New function.
6633 (Symbol::init_base_output_data): Add is_predefined parameter.
6634 (Symbol::init_base_output_segment): Likewise.
6635 (Symbol::init_base_constant): Likewise.
6636 (Symbol::is_predefined_): New data member.
6637 (Sized_symbol::init_output_data): Add is_predefined parameter.
6638 (Sized_symbol::init_output_segment): Likewise.
6639 (Sized_symbol::init_constant): Likewise.
6640 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
6641
6642 2011-06-07 Cary Coutant <ccoutant@google.com>
6643
6644 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
6645 instead of emit_copy_reloc.
6646 (Copy_relocs::emit_copy_reloc): Refactor.
6647 (Copy_relocs::make_copy_reloc): New function.
6648 (Copy_relocs::add_copy_reloc): Remove.
6649 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
6650 section.
6651 (Copy_relocs::make_copy_reloc): New function.
6652 (Copy_relocs::add_copy_reloc): Remove.
6653 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
6654 unchanged input files.
6655 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
6656 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
6657 Reserve BSS space for COPY relocations.
6658 (Sized_incremental_binary::do_emit_copy_relocs): New function.
6659 (Output_section_incremental_inputs::write_info_blocks): Record
6660 whether a symbol is copied from a shared object.
6661 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
6662 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
6663 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
6664 (Incremental_input_entry_reader::get_output_symbol_index): Add
6665 is_copy parameter.
6666 (Incremental_binary::emit_copy_relocs): New function.
6667 (Incremental_binary::do_emit_copy_relocs): New function.
6668 (Sized_incremental_binary::Sized_incremental_binary): Initialize
6669 new data member.
6670 (Sized_incremental_binary::add_copy_reloc): New function.
6671 (Sized_incremental_binary::do_emit_copy_relocs): New function.
6672 (Sized_incremental_binary::Copy_reloc): New struct.
6673 (Sized_incremental_binary::Copy_relocs): New typedef.
6674 (Sized_incremental_binary::copy_relocs_): New data member.
6675 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
6676 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
6677 * target.h (Sized_target::emit_copy_reloc): New function.
6678 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
6679
6680 2011-06-02 Cary Coutant <ccoutant@google.com>
6681
6682 PR gold/12163
6683 * gold/archive.cc (Archive::Archive): Initialize new data member.
6684 (Archive::include_all_members): Return if archive has already been
6685 included.
6686 * gold/archive.h (Archive::include_all_members_): New data member.
6687
6688 2011-06-02 Nick Clifton <nickc@redhat.com>
6689
6690 * dynobj.h: Fix spelling mistake in comment.
6691 * output.cc: Likewise.
6692
6693 2011-05-31 Doug Kwan <dougkwan@google.com>
6694 Asier Llano
6695
6696 PR gold/12826
6697 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
6698 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
6699 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
6700 redundant arm_exidx_test.so.
6701 * testsuite/Makefile.in: Regenerate.
6702 (check_SCRIPTS): Add pr12826.sh
6703 (check_DATA): Add pr12826.stdout
6704 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
6705 * testsuite/pr12826.sh: New file.
6706 * testsuite/pr12826_1.s: Ditto.
6707 * testsuite/pr12826_1.s: Ditto.
6708
6709 2011-05-30 Ian Lance Taylor <iant@google.com>
6710
6711 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
6712 sections.
6713
6714 2011-05-29 Ian Lance Taylor <iant@google.com>
6715
6716 PR gold/12804
6717 * testsuite/Makefile.am: Use different file name for two_file_test
6718 temporary file for each incremental test.
6719 * testsuite/Makefile.in: Rebuild.
6720
6721 2011-05-29 Ian Lance Taylor <iant@google.com>
6722
6723 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
6724 binary input file is empty.
6725
6726 2011-05-27 Ian Lance Taylor <iant@google.com>
6727
6728 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
6729 (ver_test_9.so): Likewise.
6730 * testsuite/Makefile.in: Rebuild.
6731
6732 2011-05-26 Cary Coutant <ccoutant@google.com>
6733
6734 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
6735 * incremental.cc (Incremental_inputs::report_input_section): Fix
6736 comment, indentation.
6737 (Incremental_inputs::report_comdat_group): New function.
6738 (Output_section_incremental_inputs::set_final_data_size): Adjust size
6739 of data for incremental input file entry.
6740 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
6741 group count, COMDAT group signatures.
6742 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
6743 an unchanged input file.
6744 * incremental.h (Incremental_object_entry::Incremental_object_entry):
6745 Initialize new data member.
6746 (Incremental_object_entry::add_comdat_group): New function.
6747 (Incremental_object_entry::get_comdat_group_count): New function.
6748 (Incremental_object_entry::get_comdat_signature_key): New function.
6749 (Incremental_object_entry::groups_): New data member.
6750 (Incremental_inputs::report_comdat_group): New function.
6751 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
6752 data for incremental input file entry.
6753 (Incremental_input_entry_reader::get_comdat_group_count): New function.
6754 (Incremental_input_entry_reader::get_input_section): Adjust size of
6755 data for incremental input file entry.
6756 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
6757 (Incremental_input_entry_reader::get_comdat_group_signature): New
6758 function.
6759 * object.cc (Sized_relobj::include_section_group): Report kept
6760 COMDAT groups for incremental links.
6761
6762 2011-05-24 David Meyer <pdox@google.com>
6763
6764 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
6765 with name parameter. Add found_name parameter.
6766 * fileread.cc (Input_file::find_file): Adjust code accordingly.
6767 * dirsearch.h (class Dirsearch): Update declaration.
6768
6769 2011-05-24 Ian Lance Taylor <iant@google.com>
6770
6771 * archive.cc (Library_base::should_include_member): Pull in object
6772 from archive if it defines the entry symbol.
6773 * parameters.cc (Parameters::entry): New function.
6774 * parameters.h (class Parameters): Declare entry.
6775 * output.h (class Output_file_header): Remove entry_ field.
6776 * output.cc (Output_file_header::Output_file_header): Remove entry
6777 parameter. Change all callers.
6778 (Output_file_header::entry): Use parameters->entry.
6779 * gold.cc (queue_middle_tasks): Likewise.
6780 * plugin.cc (Plugin_hook::run): Likewise.
6781
6782 2011-05-24 Cary Coutant <ccoutant@google.com>
6783
6784 * gold.cc (queue_initial_tasks): Pass incremental base filename
6785 to Output_file::open_base_file; don't print error message.
6786 * incremental-dump.cc (main): Adjust call to
6787 Output_file::open_for_modification.
6788 * incremental-dump.cc (main): Likewise.
6789 * incremental.cc (Incremental_inputs::report_command_line):
6790 Ignore --incremental-base option when comparing command lines.
6791 Ignore parameter when given as separate argument.
6792 * options.h (class General_options): Add --incremental-base.
6793 * output.cc (Output_file::Output_file):
6794 (Output_file::open_base_file): Add base_name and writable parameters;
6795 read base file into new file; print error message here.
6796 (Output_file::map_no_anonymous): Add writable parameter; adjust all
6797 callers.
6798 * output.h (Output_file::open_for_modification): Rename to...
6799 (Output_file::open_base_file): ...this; add base_name and
6800 writable parameters; adjust all callers.
6801 (Output_file::map_no_anonymous): Add writable parameter; adjust all
6802 callers.
6803 * testsuite/Makefile.am (incremental_test_4): Test
6804 --incremental-base.
6805 * testsuite/Makefile.in: Regenerate.
6806
6807 2011-05-24 Cary Coutant <ccoutant@google.com>
6808
6809 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
6810 incremental_test_4.
6811 * testsuite/Makefile.in: Regenerate.
6812 * testsuite/two_file_test_1_v1.cc: New test source file.
6813 * testsuite/two_file_test_1b_v1.cc: New test source file.
6814 * testsuite/two_file_test_2_v1.cc: New test source file.
6815
6816 2011-05-24 Cary Coutant <ccoutant@google.com>
6817
6818 * dynobj.h (Dynobj::do_dynobj): New function.
6819 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
6820 flag and soname for shared objects.
6821 * incremental.cc (Incremental_inputs::report_object): Make
6822 either Incremental_object_entry or Incremental_dynobj_entry; add
6823 soname to string table.
6824 (Incremental_inputs::report_input_section): Add assertion.
6825 (Output_section_incremental_inputs::set_final_data_size): Adjust
6826 type of input file entry for shared libraries; adjust size of
6827 shared library info entry.
6828 (Output_section_incremental_inputs::write_input_files): Write
6829 as_needed flag for shared libraries.
6830 (Output_section_incremental_inputs::write_info_blocks): Adjust type
6831 of input file entry for shared libraries; write soname.
6832 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
6833 soname from incremental info.
6834 * incremental.h (enum Incremental_input_flags): Add
6835 INCREMENTAL_INPUT_AS_NEEDED.
6836 (Incremental_input_entry::Incremental_input_entry): Initialize new
6837 data member.
6838 (Incremental_input_entry::set_as_needed): New function.
6839 (Incremental_input_entry::as_needed): New function.
6840 (Incremental_input_entry::do_dynobj_entry): New function.
6841 (Incremental_input_entry::as_needed_): New data member.
6842 (Incremental_object_entry::Incremental_object_entry): Don't check
6843 for shared library.
6844 (Incremental_object_entry::do_type): Likewise.
6845 (class Incremental_dynobj_entry): New class.
6846 (Incremental_input_entry_reader::as_needed): New function.
6847 (Incremental_input_entry_reader::get_soname): New function.
6848 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
6849 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
6850 size of shared library info entry.
6851 * layout.cc (Layout::finish_dynamic_section): Don't test for
6852 incremental link when adding DT_NEEDED entries.
6853 * object.h (Object::Object): Initialize new data member.
6854 (Object::dynobj): New function.
6855 (Object::set_as_needed): New function.
6856 (Object::as_needed): New function.
6857 (Object::do_dynobj): New function.
6858 (Object::as_needed_): New data member.
6859
6860 2011-05-24 Cary Coutant <ccoutant@google.com>
6861
6862 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
6863 info; adjust display of GOT entries.
6864 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6865 vector of input objects; remove file_status_.
6866 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
6867 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
6868 got_plt reader; call target hooks to reserve GOT entries.
6869 (Output_section_incremental_inputs::set_final_data_size): Adjust size
6870 of input file info header and GOT info entry.
6871 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
6872 relocation info.
6873 (Got_plt_view_info::got_descriptor): Remove.
6874 (Got_plt_view_info::sym_index): New data member.
6875 (Got_plt_view_info::input_index): New data member.
6876 (Local_got_offset_visitor::visit): Write input file index.
6877 (Global_got_offset_visitor::visit): Write 0 for input file index.
6878 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
6879 with sym_index and input_index.
6880 (Output_section_incremental_inputs::write_got_plt): Adjust size of
6881 incremental info GOT entry; replace got_descriptor with input_index.
6882 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
6883 map from input file index to object.
6884 (Sized_relobj_incr::do_layout): Replace direct data member reference
6885 with accessor function.
6886 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
6887 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
6888 Adjust size of input file info header.
6889 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
6890 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
6891 (Incremental_input_entry_reader::get_input_section): Adjust size of
6892 input file info header.
6893 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
6894 of incremental info GOT entry.
6895 (Incremental_got_plt_reader::get_got_desc): Remove.
6896 (Incremental_got_plt_reader::get_got_symndx): New function.
6897 (Incremental_got_plt_reader::get_got_input_index): New function.
6898 (Sized_incremental_binary::Sized_incremental_binary): Remove
6899 file_status_; add input_objects_.
6900 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
6901 (Sized_incremental_binary::set_file_is_unchanged): Remove.
6902 (Sized_incremental_binary::file_is_unchanged): Remove.
6903 (Sized_incremental_binary::set_input_object): New function.
6904 (Sized_incremental_binary::input_object): New function.
6905 (Sized_incremental_binary::file_status_): Remove.
6906 (Sized_incremental_binary::input_objects_): New data member.
6907 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
6908 references.
6909 (Sized_relobj_incr::invalid_address): Move to base class.
6910 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
6911 class.
6912 (Sized_relobj_incr::do_output_section_offset): Likewise.
6913 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
6914 (Sized_relobj_incr::section_offsets_): Likewise.
6915 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
6916 function.
6917 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
6918 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
6919 with accessor function.
6920 (Sized_relobj_file::do_layout): Likewise.
6921 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
6922 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
6923 (Sized_relobj_file::compute_final_local_value): Replace refs to
6924 section_offsets_ with accessor function.
6925 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
6926 * object.h (Relobj::Relobj): Initialize new data members.
6927 (Relobj::add_dyn_reloc): New function.
6928 (Relobj::first_dyn_reloc): New function.
6929 (Relobj::dyn_reloc_count): New function.
6930 (Relobj::first_dyn_reloc_): New data member.
6931 (Relobj::dyn_reloc_count_): New data member.
6932 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
6933 references.
6934 (Sized_relobj::Address): New typedef.
6935 (Sized_relobj::invalid_address): Move here from child class.
6936 (Sized_relobj::Sized_relobj): Initialize new data members.
6937 (Sized_relobj::sized_relobj): New function.
6938 (Sized_relobj::is_output_section_offset_invalid): Move here from
6939 child class.
6940 (Sized_relobj::get_output_section_offset): Likewise.
6941 (Sized_relobj::local_has_got_offset): Likewise.
6942 (Sized_relobj::local_got_offset): Likewise.
6943 (Sized_relobj::set_local_got_offset): Likewise.
6944 (Sized_relobj::do_for_all_local_got_entries): Likewise.
6945 (Sized_relobj::clear_got_offsets): New function.
6946 (Sized_relobj::section_offsets): Move here from child class.
6947 (Sized_relobj::do_output_section_offset): Likewise.
6948 (Sized_relobj::do_set_section_offset): Likewise.
6949 (Sized_relobj::Local_got_offsets): Likewise.
6950 (Sized_relobj::local_got_offsets_): Likewise.
6951 (Sized_relobj::section_offsets_): Likewise.
6952 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
6953 references.
6954 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
6955 class.
6956 (Sized_relobj_file::sized_relobj): New function
6957 (Sized_relobj_file::local_has_got_offset): Move to base class.
6958 (Sized_relobj_file::local_got_offset): Likewise.
6959 (Sized_relobj_file::set_local_got_offset): Likewise.
6960 (Sized_relobj_file::get_output_section_offset): Likewise.
6961 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
6962 (Sized_relobj_file::do_output_section_offset): Likewise.
6963 (Sized_relobj_file::do_set_section_offset): Likewise.
6964 (Sized_relobj_file::Local_got_offsets): Likewise.
6965 (Sized_relobj_file::local_got_offsets_): Likewise.
6966 (Sized_relobj_file::section_offsets_): Likewise.
6967 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
6968 (all constructors).
6969 (set_needs_dynsym_index): Convert relobj to derived class pointer.
6970 (Output_reloc::get_symbol_index): Likewise.
6971 (Output_reloc::local_section_offset): Likewise.
6972 (Output_reloc::get_address): Likewise.
6973 (Output_reloc::symbol_value): Likewise.
6974 (Output_data_got::reserve_slot): Move to class definition.
6975 (Output_data_got::reserve_local): New function.
6976 (Output_data_got::reserve_slot_for_global): Remove.
6977 (Output_data_got::reserve_global): New function.
6978 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
6979 (all constructors, two instantiations).
6980 (Output_reloc::get_relobj): New function (two instantiations).
6981 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
6982 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
6983 (Output_data_reloc::add_global): Adjust type of relobj.
6984 (Output_data_reloc::add_global_relative): Likewise.
6985 (Output_data_reloc::add_symbolless_global_addend): Likewise.
6986 (Output_data_reloc::add_local): Likewise.
6987 (Output_data_reloc::add_local_relative): Likewise.
6988 (Output_data_reloc::add_symbolless_local_addend): Likewise.
6989 (Output_data_reloc::add_local_section): Likewise.
6990 (Output_data_reloc::add_output_section): Likewise.
6991 (Output_data_reloc::add_absolute): Likewise.
6992 (Output_data_reloc::add_target_specific): Likewise.
6993 (Output_data_got::reserve_slot): Move definition here.
6994 (Output_data_got::reserve_local): New function.
6995 (Output_data_got::reserve_global): New function.
6996 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
6997 section_offsets_ with accessor function.
6998 (Sized_relobj_file::write_sections): Likewise.
6999 (Sized_relobj_file::do_relocate_sections): Likewise.
7000 * target.h (Sized_target::reserve_local_got_entry): New function.
7001 (Sized_target::reserve_global_got_entry): New function.
7002 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
7003 (Target_x86_64::reserve_global_got_entry): New function.
7004 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
7005
7006 2011-05-23 Cary Coutant <ccoutant@google.com>
7007
7008 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
7009 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
7010 bit when checking got_type.
7011 * incremental.cc (Sized_incremental_binary::setup_readers):
7012 Store symbol table and string table locations; initialize bit vector
7013 of file status flags.
7014 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
7015 unchanged files.
7016 (Sized_incremental_binary::do_process_got_plt): New function.
7017 (Sized_incremental_binary::get_symtab_view): Use stored locations.
7018 (Output_section_incremental_inputs::set_final_data_size): Record
7019 file index for each input file.
7020 (Output_section_incremental_inputs::write_got_plt): Store file index
7021 instead of input entry offset for each GOT entry.
7022 * incremental.h
7023 (Incremental_input_entry::Incremental_input_entry): Initialize new
7024 data member.
7025 (Incremental_input_entry::set_offset): Store file index.
7026 (Incremental_input_entry::get_file_index): New function.
7027 (Incremental_input_entry::file_index_): New data member.
7028 (Incremental_binary::process_got_plt): New function.
7029 (Incremental_binary::do_process_got_plt): New function.
7030 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7031 data members.
7032 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
7033 (Sized_incremental_binary::set_file_is_unchanged): New function.
7034 (Sized_incremental_binary::file_is_unchanged): New function.
7035 (Sized_incremental_binary::do_process_got_plt): New function.
7036 (Sized_incremental_binary::file_status_): New data member.
7037 (Sized_incremental_binary::main_symtab_loc_): New data member.
7038 (Sized_incremental_binary::main_strtab_loc_): New data member.
7039 * output.cc (Output_data_got::Got_entry::write): Add case
7040 RESERVED_CODE.
7041 (Output_data_got::add_global): Call add_got_entry.
7042 (Output_data_got::add_global_plt): Likewise.
7043 (Output_data_got::add_global_with_rel): Likewise.
7044 (Output_data_got::add_global_with_rela): Likewise.
7045 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
7046 (Output_data_got::add_global_pair_with_rela): Likewise.
7047 (Output_data_got::add_local): Call add_got_entry.
7048 (Output_data_got::add_local_plt): Likewise.
7049 (Output_data_got::add_local_with_rel): Likewise.
7050 (Output_data_got::add_local_with_rela): Likewise.
7051 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
7052 (Output_data_got::add_local_pair_with_rela): Likewise.
7053 (Output_data_got::reserve_slot): New function.
7054 (Output_data_got::reserve_slot_for_global): New function.
7055 (Output_data_got::add_got_entry): New function.
7056 (Output_data_got::add_got_entry_pair): New function.
7057 (Output_section::add_output_section_data): Edit FIXME.
7058 * output.h
7059 (Output_section_data_build::Output_section_data_build): New
7060 constructor with size parameter.
7061 (Output_data_space::Output_data_space): Likewise.
7062 (Output_data_got::Output_data_got): Initialize new data member; new
7063 constructor with size parameter.
7064 (Output_data_got::add_constant): Call add_got_entry.
7065 (Output_data_got::reserve_slot): New function.
7066 (Output_data_got::reserve_slot_for_global): New function.
7067 (class Output_data_got::Got_entry): Add RESERVED_CODE.
7068 (Output_data_got::add_got_entry): New function.
7069 (Output_data_got::add_got_entry_pair): New function.
7070 (Output_data_got::free_list_): New data member.
7071 * target.h (Sized_target::init_got_plt_for_update): New function.
7072 (Sized_target::register_global_plt_entry): New function.
7073 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
7074 Initialize new data member; call init; add constructor with PLT count.
7075 (Output_data_plt_x86_64::init): New function.
7076 (Output_data_plt_x86_64::add_relocation): New function.
7077 (Output_data_plt_x86_64::reserve_slot): New function.
7078 (Output_data_plt_x86_64::free_list_): New data member.
7079 (Target_x86_64::init_got_plt_for_update): New function.
7080 (Target_x86_64::register_global_plt_entry): New function.
7081 (Output_data_plt_x86_64::add_entry): Allocate from free list for
7082 incremental updates.
7083 (Output_data_plt_x86_64::add_relocation): New function.
7084 * testsuite/object_unittest.cc (Object_test): Set default options.
7085
7086 2011-05-16 Ian Lance Taylor <iant@google.com>
7087
7088 * options.h (class General_options): Make -i a synonym for -r.
7089
7090 2011-05-16 Ian Lance Taylor <iant@google.com>
7091
7092 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
7093
7094 2011-05-10 Cary Coutant <ccoutant@google.com>
7095
7096 * object.cc (Sized_relobj::do_count_local_symbols): Check for
7097 strip_all (-s).
7098
7099 2011-05-06 Ian Lance Taylor <iant@google.com>
7100
7101 * layout.cc (Layout::layout): If the output section flags change,
7102 update the ordering.
7103
7104 2011-04-25 Cary Coutant <ccoutant@google.com>
7105
7106 * incremental-dump.cc (dump_incremental_inputs): Print local
7107 symbol info for each input file.
7108 * incremental.cc
7109 (Output_section_incremental_inputs::set_final_data_size): Add local
7110 symbol info to input file entries in incremental info.
7111 (Output_section_incremental_inputs::write_info_blocks): Likewise.
7112 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
7113 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
7114 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
7115 implementation.
7116 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
7117 (Sized_incr_relobj::do_relocate): Write the local symbols.
7118 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
7119 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
7120 Adjust size of input file header.
7121 (Incremental_inputs_reader::get_local_symbol_offset): New function.
7122 (Incremental_inputs_reader::get_local_symbol_count): New function.
7123 (Incremental_inputs_reader::get_input_section): Adjust size of input
7124 file header.
7125 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
7126 (Sized_incr_relobj::This): New typedef.
7127 (Sized_incr_relobj::sym_size): New const data member.
7128 (Sized_incr_relobj::Local_symbol): New struct.
7129 (Sized_incr_relobj::do_output_local_symbol_count): New function.
7130 (Sized_incr_relobj::do_local_symbol_offset): New function.
7131 (Sized_incr_relobj::local_symbol_count_): New data member.
7132 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
7133 (Sized_incr_relobj::local_symbol_index_): New data member.
7134 (Sized_incr_relobj::local_symbol_offset_): New data member.
7135 (Sized_incr_relobj::local_dynsym_offset_): New data member.
7136 (Sized_incr_relobj::local_symbols_): New data member.
7137 * object.h (Relobj::output_local_symbol_count): New function.
7138 (Relobj::local_symbol_offset): New function.
7139 (Relobj::do_output_local_symbol_count): New function.
7140 (Relobj::do_local_symbol_offset): New function.
7141 (Sized_relobj::do_output_local_symbol_count): New function.
7142 (Sized_relobj::do_local_symbol_offset): New function.
7143
7144 2011-04-22 Vladimir Simonov <sv@sw.ru>
7145
7146 * descriptors.cc (set_close_on_exec): New function.
7147 (Descriptors::open): Use set_close_on_exec.
7148 * output.cc (S_ISLNK): Define if not defined.
7149
7150 2011-04-22 Cary Coutant <ccoutant@google.com>
7151
7152 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7153 global symbol map.
7154 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7155 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
7156 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
7157 relocations.
7158 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
7159 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
7160 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
7161 * incremental.h
7162 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
7163 function.
7164 (Incremental_binary::apply_incremental_relocs): New function.
7165 (Incremental_binary::do_apply_incremental_relocs): New function.
7166 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7167 data member.
7168 (Sized_incremental_binary::add_global_symbol): New function.
7169 (Sized_incremental_binary::global_symbol): New function.
7170 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7171 (Sized_incremental_binary::symbol_map_): New data member.
7172 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
7173 * target.h (Sized_target::apply_relocation): New function.
7174 * target-reloc.h (apply_relocation): New function.
7175 * x86_64.cc (Target_x86_64::apply_relocation): New function.
7176
7177 2011-04-22 Doug Kwan <dougkwan@google.com>
7178
7179 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
7180 flag of a SHT_ARM_EXIDX section.
7181 * testsuite/Makefile.am (arm_exidx_test): New test rules.
7182 * testsuite/Makefile.in: Regenerate.
7183 * testsuite/arm_exidx_test.s: New file.
7184 * testsuite/arm_exidx_test.sh: Same.
7185
7186 2011-04-20 Cary Coutant <ccoutant@google.com>
7187
7188 PR gold/12689
7189 * archive.h (Incremental_archive_entry::Archive_member):
7190 Initialize arg_serial_ (second constructor).
7191
7192 2011-04-17 Ian Lance Taylor <iant@google.com>
7193
7194 * object.cc (Relocate_info::location): Simplify location string.
7195 * errors.cc (Errors::error_at_location): Don't print program
7196 name.
7197 (Errors::warning_at_location): Likewise.
7198 (Errors::undefined_symbol): Likewise.
7199 * testsuite/debug_msg.sh: Update accordingly.
7200
7201 2011-04-14 Cary Coutant <ccoutant@google.com>
7202
7203 * gold/layout.cc (Layout::symtab_section_offset): New function.
7204 * gold/layout.h (Layout::symtab_section_offset): New function.
7205 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
7206
7207 2011-04-12 Ian Lance Taylor <iant@google.com>
7208
7209 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
7210 with MREMAP_MAYMOVE.
7211 * output.h (class Output_file): Add map_is_allocated_ field.
7212 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
7213 not available, provide stubs. If mremap is not available, #define
7214 it to gold_mremap.
7215 (MREMAP_MAYMOVE): Define if not defined.
7216 (Output_file::Output_file): Initialize map_is_allocated_.
7217 (Output_file::resize): Check map_is_allocated_.
7218 (Output_file::map_anonymous): If mmap fails, use malloc.
7219 (Output_file::unmap): Don't do anything for an anonymous map.
7220 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
7221 is not available, provide stubs.
7222 (File_read::View::~View): Use free rather than delete[].
7223 (File_read::make_view): Use malloc rather than new[]. If mmap
7224 fails, use malloc.
7225 (File_read::find_or_make_view): Use malloc rather than new[].
7226 * gold.h: Remove HAVE_REMAP code.
7227 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
7228 exists. Rename mremap to gold_mremap. If mmap is not available
7229 don't do anything.
7230 * configure, config.in: Rebuild.
7231
7232 2011-04-11 Ian Lance Taylor <iant@google.com>
7233
7234 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
7235 initialize local variable v.
7236
7237 2011-04-11 Cary Coutant <ccoutant@google.com>
7238
7239 * archive.cc (Archive::include_member): Adjust call to
7240 report_object.
7241 (Add_archive_symbols::run): Track argument serial numbers.
7242 (Lib_group::include_member): Likewise.
7243 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
7244 * archive.h (Incremental_archive_entry::Archive_member):
7245 Initialize arg_serial_.
7246 (Archive_member::arg_serial_): New data member.
7247 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
7248 (Sized_dynobj::do_add_symbols): Track symbols when doing an
7249 incremental link.
7250 (Sized_dynobj::do_for_all_local_got_entries): New function.
7251 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
7252 function.
7253 * fileread.cc (get_mtime): New function.
7254 * fileread.h (get_mtime): New function.
7255 * gold.cc (queue_initial_tasks): Check for incremental update.
7256 (process_incremental_input): New function.
7257 (queue_middle_tasks): Don't force valid target for incremental
7258 update.
7259 * incremental-dump.cc (find_input_containing_global): Adjust
7260 size of symbol info entry.
7261 (dump_incremental_inputs): Dump argument serial number and
7262 in_system_directory flag; bias shndx by 1; print symbol names
7263 when dumping per-file symbol lists; use new symbol info readers.
7264 * incremental.cc
7265 (Output_section_incremental_inputs:update_data_size): New function.
7266 (Sized_incremental_binary::setup_readers): Setup input readers
7267 for each input file; build maps for files added from libraries
7268 and scripts.
7269 (Sized_incremental_binary::check_input_args): New function.
7270 (Sized_incremental_binary::do_check_inputs): Build map of argument
7271 serial numbers to input arguments.
7272 (Sized_incremental_binary::do_file_has_changed): Rename
7273 do_file_is_unchanged to this; compare file modification times.
7274 (Sized_incremental_binary::do_init_layout): New function.
7275 (Sized_incremental_binary::do_reserve_layout): New function.
7276 (Sized_incremental_binary::do_get_input_reader): Remove.
7277 (Sized_incremental_binary::get_symtab_view): New function.
7278 (Incremental_checker::can_incrementally_link_output_file): Remove.
7279 (Incremental_inputs::report_command_line): Exclude --debug options.
7280 (Incremental_inputs::report_archive_begin): Add parameter; track
7281 argument serial numbers; don't put input file entry for archive
7282 before archive members.
7283 (Incremental_inputs::report_archive_end): Put input file entry
7284 for archive after archive members.
7285 (Incremental_inputs::report_object): Add parameter; track argument
7286 serial numbers and in_system_directory flag.
7287 (Incremental_inputs::report_script): Add parameter; track argument
7288 serial numbers.
7289 (Output_section_incremental_inputs::set_final_data_size): Adjust
7290 size of symbol info entry; check for forwarding symbols.
7291 (Output_section_incremental_inputs::write_input_files): Write
7292 in_system_directory flag and argument serial number.
7293 (Output_section_incremental_inputs::write_info_blocks): Map section
7294 indices between incremental info and original input file; store
7295 input section index for each symbol.
7296 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
7297 change operator() to visit().
7298 (class Global_got_offset_visitor): Likewise.
7299 (class Global_symbol_visitor_got_plt):
7300 (Output_section_incremental_inputs::write_got_plt): Use new visitor
7301 classes.
7302 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
7303 (Sized_incr_relobj::do_read_symbols): New function.
7304 (Sized_incr_relobj::do_layout): New function.
7305 (Sized_incr_relobj::do_layout_deferred_sections): New function.
7306 (Sized_incr_relobj::do_add_symbols): New function.
7307 (Sized_incr_relobj::do_should_include_member): New function.
7308 (Sized_incr_relobj::do_for_all_global_symbols): New function.
7309 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
7310 (Sized_incr_relobj::do_section_size): New function.
7311 (Sized_incr_relobj::do_section_name): New function.
7312 (Sized_incr_relobj::do_section_contents): New function.
7313 (Sized_incr_relobj::do_section_flags): New function.
7314 (Sized_incr_relobj::do_section_entsize): New function.
7315 (Sized_incr_relobj::do_section_address): New function.
7316 (Sized_incr_relobj::do_section_type): New function.
7317 (Sized_incr_relobj::do_section_link): New function.
7318 (Sized_incr_relobj::do_section_info): New function.
7319 (Sized_incr_relobj::do_section_addralign): New function.
7320 (Sized_incr_relobj::do_initialize_xindex): New function.
7321 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
7322 (Sized_incr_relobj::do_read_relocs): New function.
7323 (Sized_incr_relobj::do_gc_process_relocs): New function.
7324 (Sized_incr_relobj::do_scan_relocs): New function.
7325 (Sized_incr_relobj::do_count_local_symbols): New function.
7326 (Sized_incr_relobj::do_finalize_local_symbols): New function.
7327 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
7328 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
7329 (Sized_incr_relobj::do_relocate): New function.
7330 (Sized_incr_relobj::do_set_section_offset): New function.
7331 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
7332 (Sized_incr_dynobj::do_read_symbols): New function.
7333 (Sized_incr_dynobj::do_layout): New function.
7334 (Sized_incr_dynobj::do_add_symbols): New function.
7335 (Sized_incr_dynobj::do_should_include_member): New function.
7336 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
7337 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
7338 (Sized_incr_dynobj::do_section_size): New function.
7339 (Sized_incr_dynobj::do_section_name): New function.
7340 (Sized_incr_dynobj::do_section_contents): New function.
7341 (Sized_incr_dynobj::do_section_flags): New function.
7342 (Sized_incr_dynobj::do_section_entsize): New function.
7343 (Sized_incr_dynobj::do_section_address): New function.
7344 (Sized_incr_dynobj::do_section_type): New function.
7345 (Sized_incr_dynobj::do_section_link): New function.
7346 (Sized_incr_dynobj::do_section_info): New function.
7347 (Sized_incr_dynobj::do_section_addralign): New function.
7348 (Sized_incr_dynobj::do_initialize_xindex): New function.
7349 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
7350 (make_sized_incremental_object): New function.
7351 (Incremental_library::copy_unused_symbols): New function.
7352 (Incremental_library::do_for_all_unused_symbols): New function.
7353 * incremental.h (enum Incremental_input_flags): New type.
7354 (class Incremental_checker): Remove.
7355 (Incremental_input_entry::Incremental_input_entry): Add argument
7356 serial number.
7357 (Incremental_input_entry::arg_serial): New function.
7358 (Incremental_input_entry::set_is_in_system_directory): New function.
7359 (Incremental_input_entry::is_in_system_directory): New function.
7360 (Incremental_input_entry::arg_serial_): New data member.
7361 (Incremental_input_entry::is_in_system_directory_): New data member.
7362 (class Script_info): Move here from script.h.
7363 (Script_info::Script_info): Add filename parameter.
7364 (Script_info::filename): New function.
7365 (Script_info::filename_): New data member.
7366 (Incremental_script_entry::Incremental_script_entry): Add argument
7367 serial number.
7368 (Incremental_object_entry::Incremental_object_entry): Likewise.
7369 (Incremental_object_entry::add_input_section): Build list of input
7370 sections with map to original shndx.
7371 (Incremental_object_entry::get_input_section_index): New function.
7372 (Incremental_object_entry::shndx_): New data member.
7373 (Incremental_object_entry::name_key_): Rename; adjust all refs.
7374 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
7375 (Incremental_archive_entry::Incremental_archive_entry): Add argument
7376 serial number.
7377 (Incremental_inputs::report_archive_begin): Likewise.
7378 (Incremental_inputs::report_object): Likewise.
7379 (Incremental_inputs::report_script): Likewise.
7380 (class Incremental_global_symbol_reader): New class.
7381 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
7382 and store flags and input file type.
7383 (Incremental_input_entry_reader::arg_serial): New function.
7384 (Incremental_input_entry_reader::type): Extract type from flags.
7385 (Incremental_input_entry_reader::is_in_system_directory): New function.
7386 (Incremental_input_entry_reader::get_input_section_count): Call
7387 accessor function for type.
7388 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
7389 function for type; adjust size of global symbol entry.
7390 (Incremental_input_entry_reader::get_global_symbol_count): Call
7391 accessor function for type.
7392 (Incremental_input_entry_reader::get_object_count): Likewise.
7393 (Incremental_input_entry_reader::get_object_offset): Likewise.
7394 (Incremental_input_entry_reader::get_member_count): Likewise.
7395 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
7396 (Incremental_input_entry_reader::get_member_offset): Likewise.
7397 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
7398 (Incremental_input_entry_reader::Global_symbol_info): Remove.
7399 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
7400 (Incremental_input_entry_reader::get_global_symbol_reader): New
7401 function.
7402 (Incremental_input_entry_reader::get_output_symbol_index): New
7403 function.
7404 (Incremental_input_entry_reader::type_): Remove.
7405 (Incremental_input_entry_reader::flags_): New data member.
7406 (Incremental_inputs_reader::input_file_offset): New function.
7407 (Incremental_inputs_reader::input_file_index): New function.
7408 (Incremental_inputs_reader::input_file): Call input_file_offset.
7409 (Incremental_inputs_reader::input_file_at_offset): New function.
7410 (Incremental_relocs_reader::get_r_type): Reformat.
7411 (Incremental_relocs_reader::get_r_shndx): Reformat.
7412 (Incremental_relocs_reader::get_r_offset): Reformat.
7413 (Incremental_relocs_reader::data): New function.
7414 (Incremental_binary::Incremental_binary): Initialize new data members.
7415 (Incremental_binary::check_inputs): Add cmdline parameter.
7416 (Incremental_binary::file_is_unchanged): Remove.
7417 (Input_reader::arg_serial): New function.
7418 (Input_reader::get_unused_symbol_count): New function.
7419 (Input_reader::get_unused_symbol): New function.
7420 (Input_reader::do_arg_serial): New function.
7421 (Input_reader::do_get_unused_symbol_count): New function.
7422 (Input_reader::do_get_unused_symbol): New function.
7423 (Incremental_binary::input_file_count): New function.
7424 (Incremental_binary::get_input_reader): Change signature to use
7425 index instead of filename.
7426 (Incremental_binary::file_has_changed): New function.
7427 (Incremental_binary::get_input_argument): New function.
7428 (Incremental_binary::get_library): New function.
7429 (Incremental_binary::get_script_info): New function.
7430 (Incremental_binary::init_layout): New function.
7431 (Incremental_binary::reserve_layout): New function.
7432 (Incremental_binary::output_file): New function.
7433 (Incremental_binary::do_check_inputs): New function.
7434 (Incremental_binary::do_file_is_unchanged): Remove.
7435 (Incremental_binary::do_file_has_changed): New function.
7436 (Incremental_binary::do_init_layout): New function.
7437 (Incremental_binary::do_reserve_layout): New function.
7438 (Incremental_binary::do_input_file_count): New function.
7439 (Incremental_binary::do_get_input_reader): Change signature.
7440 (Incremental_binary::input_args_map_): New data member.
7441 (Incremental_binary::library_map_): New data member.
7442 (Incremental_binary::script_map_): New data member.
7443 (Sized_incremental_binary::Sized_incremental_binary): Initialize
7444 new data members.
7445 (Sized_incremental_binary::output_section): New function.
7446 (Sized_incremental_binary::inputs_reader): Add const.
7447 (Sized_incremental_binary::symtab_reader): Add const.
7448 (Sized_incremental_binary::relocs_reader): Add const.
7449 (Sized_incremental_binary::got_plt_reader): Add const.
7450 (Sized_incremental_binary::get_symtab_view): New function.
7451 (Sized_incremental_binary::Inputs_reader): New typedef.
7452 (Sized_incremental_binary::Input_entry_reader): New typedef.
7453 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
7454 (Sized_incremental_binary::do_file_is_unchanged): Remove.
7455 (Sized_incremental_binary::do_file_has_changed): New function.
7456 (Sized_incremental_binary::do_init_layout): New function.
7457 (Sized_incremental_binary::do_reserve_layout): New function.
7458 (Sized_input_reader::Inputs_reader): Remove.
7459 (Sized_input_reader::Input_entry_reader): Remove.
7460 (Sized_input_reader::do_arg_serial): New function.
7461 (Sized_input_reader::do_get_unused_symbol_count): New function.
7462 (Sized_input_reader::do_get_unused_symbol): New function.
7463 (Sized_incremental_binary::do_input_file_count): New function.
7464 (Sized_incremental_binary::do_get_input_reader): Change signature;
7465 use index instead of filename.
7466 (Sized_incremental_binary::section_map_): New data member.
7467 (Sized_incremental_binary::input_entry_readers_): New data member.
7468 (class Sized_incr_relobj): New class.
7469 (class Sized_incr_dynobj): New class.
7470 (make_sized_incremental_object): New function.
7471 (class Incremental_library): New class.
7472 * layout.cc (Free_list::num_lists): New static data member.
7473 (Free_list::num_nodes): New static data member.
7474 (Free_list::num_removes): New static data member.
7475 (Free_list::num_remove_visits): New static data member.
7476 (Free_list::num_allocates): New static data member.
7477 (Free_list::num_allocate_visits): New static data member.
7478 (Free_list::init): New function.
7479 (Free_list::remove): New function.
7480 (Free_list::allocate): New function.
7481 (Free_list::dump): New function.
7482 (Free_list::print_stats): New function.
7483 (Layout_task_runner::run): Resize output file for incremental updates.
7484 (Layout::Layout): Initialize new data members.
7485 (Layout::set_incremental_base): New function.
7486 (Layout::init_fixed_output_section): New function.
7487 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
7488 incremental updates.
7489 (Layout::create_gold_note): Do not create gold note section for
7490 incremental updates.
7491 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
7492 for incremental updates.
7493 (Layout::set_section_offsets): For incremental updates, allocate space
7494 from free list.
7495 (Layout::create_symtab_sections): Layout with offsets relative to
7496 start of section; for incremental updates, allocate space from free
7497 list.
7498 (Layout::create_shdrs): For incremental updates, allocate space from
7499 free list.
7500 (Layout::finish_dynamic_section): For incremental updates, do not
7501 check --as-needed (fixed in subsequent patch).
7502 * layout.h (class Free_list): New class.
7503 (Layout::set_incremental_base): New function.
7504 (Layout::incremental_base): New function.
7505 (Layout::init_fixed_output_section): New function.
7506 (Layout::allocate): New function.
7507 (Layout::incremental_base_): New data member.
7508 (Layout::free_list_): New data member.
7509 * main.cc (main): Print Free_list statistics.
7510 * object.cc (Relobj::finalize_incremental_relocs): Add
7511 clear_counts parameter; clear counts only when clear_counts is set.
7512 (Sized_relobj::Sized_relobj): Initialize new base class.
7513 (Sized_relobj::do_layout): Don't report special sections.
7514 (Sized_relobj::do_for_all_local_got_entries): New function.
7515 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
7516 symtab_off to all symbol table offsets.
7517 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
7518 * object.h (class Got_offset_list): Move to top of file.
7519 (Object::Object): Allow case where input_file == NULL.
7520 (Object::~Object): Likewise.
7521 (Object::input_file): Assert that input_file != NULL.
7522 (Object::lock): Allow case where input_file == NULL.
7523 (Object::unlock): Likewise.
7524 (Object::is_locked): Likewise.
7525 (Object::token): Likewise.
7526 (Object::release): Likewise.
7527 (Object::is_incremental): New function.
7528 (Object::get_mtime): New function.
7529 (Object::for_all_local_got_entries): New function.
7530 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
7531 (Object::set_is_in_system_directory): New function.
7532 (Object::is_in_system_directory): New function.
7533 (Object::do_is_incremental): New function.
7534 (Object::do_get_mtime): New function.
7535 (Object::do_for_all_local_got_entries): New function.
7536 (Object::is_in_system_directory_): New data member.
7537 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
7538 (class Sized_relobj_base): New class.
7539 (class Sized_relobj): Derive from Sized_relobj_base.
7540 (class Sized_relobj::Symbols): Redeclare from base class.
7541 (class Sized_relobj::local_got_offset_list): Remove.
7542 (class Sized_relobj::Output_sections): Redeclare from base class.
7543 (class Sized_relobj::do_for_all_local_got_entries): New function.
7544 (class Sized_relobj::write_local_symbols): Add offset parameter.
7545 (class Sized_relobj::local_symbol_offset_): Update comment.
7546 (class Sized_relobj::local_dynsym_offset_): Update comment.
7547 * options.cc (Input_arguments::add_file): Remove const.
7548 * options.h (Input_file_argument::Input_file_argument):
7549 Initialize arg_serial_ (all constructors).
7550 (Input_file_argument::set_arg_serial): New function.
7551 (Input_file_argument::arg_serial): New function.
7552 (Input_file_argument::arg_serial_): New data member.
7553 (Input_arguments::Input_arguments): Initialize file_count_.
7554 (Input_arguments::add_file): Remove const.
7555 (Input_arguments::number_of_input_files): New function.
7556 (Input_arguments::file_count_): New data member.
7557 (Command_line::number_of_input_files): Call
7558 Input_arguments::number_of_input_files.
7559 * output.cc (Output_segment_headers::Output_segment_headers):
7560 Set current size.
7561 (Output_section::Input_section::current_data_size): New function.
7562 (Output_section::Output_section): Initialize new data members.
7563 (Output_section::add_input_section): Don't do merge sections for
7564 an incremental link; allocate space from free list for an
7565 incremental update.
7566 (Output_section::add_output_section_data): Allocate space from
7567 free list for an incremental update.
7568 (Output_section::update_data_size): New function.
7569 (Output_section::set_fixed_layout): New function.
7570 (Output_section::reserve): New function.
7571 (Output_segment::set_section_addresses): Remove const.
7572 (Output_segment::set_section_list_addresses): Remove const; allocate
7573 space from free list for an incremental update.
7574 (Output_segment::set_offset): Adjust size of RELRO segment for an
7575 incremental update.
7576 * output.h (Output_data::current_data_size): Move here from
7577 child classes.
7578 (Output_data::pre_finalize_data_size): New function.
7579 (Output_data::update_data_size): New function.
7580 (Output_section_headers::update_data_size): new function.
7581 (Output_section_data_build::current_data_size): Move to Output_data.
7582 (Output_data_strtab::update_data_size): New function.
7583 (Output_section::current_data_size): Move to Output_data.
7584 (Output_section::set_fixed_layout): New function.
7585 (Output_section::has_fixed_layout): New function.
7586 (Output_section::reserve): New function.
7587 (Output_section::update_data_size): New function.
7588 (Output_section::has_fixed_layout_): New data member.
7589 (Output_section::free_list_): New data member.
7590 (Output_segment::set_section_addresses): Remove const.
7591 (Output_segment::set_section_list_addresses): Remove const.
7592 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
7593 New function.
7594 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
7595 New function.
7596 * readsyms.cc (Read_symbols::do_read_symbols): Add library
7597 parameter when calling Add_symbols constructor; store argument
7598 serial number for members of a lib group.
7599 (Add_symbols::locks): Allow case where token == NULL.
7600 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
7601 (Read_member::~Read_member): New function.
7602 (Read_member::is_runnable): New function.
7603 (Read_member::locks): New function.
7604 (Read_member::run): New function.
7605 (Check_script::~Check_script): New function.
7606 (Check_script::is_runnable): New function.
7607 (Check_script::locks): New function.
7608 (Check_script::run): New function.
7609 (Check_library::~Check_library): New function.
7610 (Check_library::is_runnable): New function.
7611 (Check_library::locks): New function.
7612 (Check_library::run): New function.
7613 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
7614 (Add_symbols::library_): New data member.
7615 (class Read_member): New class.
7616 (class Check_script): New class.
7617 (class Check_library): New class.
7618 * reloc.cc (Read_relocs::is_runnable): Allow case where
7619 token == NULL.
7620 (Read_relocs::locks): Likewise.
7621 (Scan_relocs::locks): Likewise.
7622 (Relocate_task::locks): Likewise.
7623 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
7624 to clear counters.
7625 (Sized_relobj::incremental_relocs_scan): Fix comment.
7626 (Sized_relobj::do_relocate): Pass output file offset to
7627 write_local_symbols.
7628 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
7629 from class declaration.
7630 * script.cc (read_input_script): Allocate Script_info; pass
7631 argument serial number to report_script.
7632 * script.h (class Script_info): Move to incremental.h.
7633 * symtab.cc (Symbol_table::add_from_incrobj): New function.
7634 * symtab.h (Symbol_table::add_from_incrobj): New function.
7635 (Symbol_table::set_file_offset): New function.
7636
7637 2011-04-05 Cary Coutant <ccoutant@google.com>
7638
7639 * incremental-dump.cc (dump_incremental_inputs): Change signature
7640 to take a Sized_incremental_binary; change caller. Use readers
7641 in Sized_incremental_binary.
7642 * incremental.cc
7643 (Sized_incremental_binary::find_incremental_inputs_sections):
7644 Rename do_find_incremental_inputs_sections to this.
7645 (Sized_incremental_binary::setup_readers): New function.
7646 (Sized_incremental_binary::do_check_inputs): Check
7647 has_incremental_info_ flag; move setup code to setup_readers;
7648 use input readers.
7649 (Sized_incremental_binary::do_file_is_unchanged): New function.
7650 (Sized_incremental_binary::do_get_input_reader): New function.
7651 * incremental.h (class Incremental_binary): Move to end of file.
7652 (Incremental_binary::file_is_unchanged): New function.
7653 (Incremental_binary::do_file_is_unchanged): New function.
7654 (Incremental_binary::Input_reader): New class.
7655 (Incremental_binary::get_input_reader): New function.
7656 (class Sized_incremental_binary): Move to end of file.
7657 (Sized_incremental_binary::Sized_incremental_binary): Setup the
7658 input section reader classes.
7659 (Sized_incremental_binary::has_incremental_info): New function.
7660 (Sized_incremental_binary::inputs_reader): New function.
7661 (Sized_incremental_binary::symtab_reader): New function.
7662 (Sized_incremental_binary::relocs_reader): New function.
7663 (Sized_incremental_binary::got_plt_reader): New function.
7664 (Sized_incremental_binary::do_file_is_unchanged): New function.
7665 (Sized_incremental_binary::Sized_input_reader): New class.
7666 (Sized_incremental_binary::get_input_reader): New function.
7667 (Sized_incremental_binary::find_incremental_inputs_sections):
7668 Rename do_find_incremental_inputs_sections to this.
7669 (Sized_incremental_binary::setup_readers): New function.
7670 (Sized_incremental_binary::has_incremental_info_): New data member.
7671 (Sized_incremental_binary::inputs_reader_): New data member.
7672 (Sized_incremental_binary::symtab_reader_): New data member.
7673 (Sized_incremental_binary::relocs_reader_): New data member.
7674 (Sized_incremental_binary::got_plt_reader_): New data member.
7675 (Sized_incremental_binary::current_input_file_): New data member.
7676
7677 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
7678
7679 PR gold/12640
7680 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
7681 violation.
7682
7683 2011-03-30 Cary Coutant <ccoutant@google.com>
7684
7685 * archive.cc (Archive::include_member): Adjust call to report_object.
7686 (Add_archive_symbols::run): Add script_info to call to
7687 report_archive_begin.
7688 (Lib_group::include_member): Adjust call to report_object.
7689 (Add_lib_group_symbols::run): Adjust call to report_object.
7690 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
7691 blocks. Add object count for script input files.
7692 * incremental.cc (Incremental_inputs::report_archive_begin): Add
7693 script_info parameter; change all callers.
7694 (Incremental_inputs::report_object): Add script_info parameter;
7695 change all callers.
7696 (Incremental_inputs::report_script): Store backpointer to
7697 incremental info entry.
7698 (Output_section_incremental_inputs::set_final_data_size): Record
7699 additional information for scripts.
7700 (Output_section_incremental_inputs::write_info_blocks): Likewise.
7701 * incremental.h (Incremental_script_entry::add_object): New function.
7702 (Incremental_script_entry::get_object_count): New function.
7703 (Incremental_script_entry::get_object): New function.
7704 (Incremental_script_entry::objects_): New data member; adjust
7705 constructor.
7706 (Incremental_inputs::report_archive_begin): Add script_info parameter.
7707 (Incremental_inputs::report_object): Add script_info parameter.
7708 (Incremental_inputs_reader::get_object_count): New function.
7709 (Incremental_inputs_reader::get_object_offset): New function.
7710 * options.cc (Input_arguments::add_file): Return reference to
7711 new input argument.
7712 * options.h (Input_argument::set_script_info): New function.
7713 (Input_argument::script_info): New function.
7714 (Input_argument::script_info_): New data member; adjust all
7715 constructors.
7716 (Input_file_group::add_file): Return reference to new input argument.
7717 (Input_file_lib::add_file): Likewise.
7718 (Input_arguments::add_file): Likewise.
7719 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
7720 * script.cc (Parser_closure::Parser_closure): Add script_info
7721 parameter; adjust all callers.
7722 (Parser_closure::script_info): New function.
7723 (Parser_closure::script_info_): New data member.
7724 (read_input_script): Report scripts earlier to incremental info.
7725 (script_add_file): Set script_info in Input_argument.
7726 (script_add_library): Likewise.
7727 * script.h (Script_options::Script_info): Rewrite class.
7728
7729 2011-03-29 Cary Coutant <ccoutant@google.com>
7730
7731 * archive.cc (Library_base::should_include_member): Move
7732 method here from class Archive.
7733 (Archive::Archive): Initialize base class.
7734 (Archive::should_include_member): Move to base class.
7735 (Archive::do_for_all_unused_symbols): New function.
7736 (Add_archive_symbols::run): Remove redundant access to
7737 incremental_inputs.
7738 (Lib_group::Lib_group): Initialize base class.
7739 (Lib_group::do_filename): New function.
7740 (Lib_group::include_member): Pass pointer to Lib_group to
7741 report_object.
7742 (Lib_group::do_for_all_unused_symbols): New function.
7743 (Add_lib_group_symbols::run): Report archive information for
7744 incremental links.
7745 * archive.h (class Library_base): New base class.
7746 (class Archive): Derive from Library_base.
7747 (Archive::filename): Move to base class.
7748 (Archive::set_incremental_info): Likewise.
7749 (Archive::incremental_info): Likewise.
7750 (Archive::Should_include): Likewise.
7751 (Archive::should_include_member): Likewise.
7752 (Archive::Armap_entry): Remove.
7753 (Archive::Unused_symbol_iterator): Remove.
7754 (Archive::unused_symbols_begin): Remove.
7755 (Archive::unused_symbols_end): Remove.
7756 (Archive::do_filename): New function.
7757 (Archive::do_get_mtime): New function.
7758 (Archive::do_for_all_unused_symbols): New function.
7759 (Archive::task_): Move to base class.
7760 (Archive::incremental_info_): Likewise.
7761 (class Lib_group): Derive from Library_base.
7762 (Lib_group::do_filename): New function.
7763 (Lib_group::do_get_mtime): New function.
7764 (Lib_group::do_for_all_unused_symbols): New function.
7765 (Lib_group::task_): Move to base class.
7766 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
7767 function.
7768 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
7769 function.
7770 * incremental.cc (Incremental_inputs::report_archive_begin):
7771 Use Library_base; call library's get_mtime; add incremental inputs
7772 entry before members.
7773 (class Unused_symbol_visitor): New class.
7774 (Incremental_inputs::report_archive_end): Use Library_base; use
7775 visitor class to record unused symbols; don't add incremental inputs
7776 entry after members.
7777 (Incremental_inputs::report_object): Use Library_base.
7778 * incremental.h
7779 (Incremental_archive_entry::Incremental_archive_entry): Remove
7780 unused Archive parameter.
7781 (Incremental_inputs::report_archive_begin): Use Library_base.
7782 (Incremental_inputs::report_archive_end): Likewise.
7783 (Incremental_inputs::report_object): Likewise.
7784 * object.cc (Sized_relobj::do_for_all_global_symbols): New
7785 function.
7786 * object.h (Object::for_all_global_symbols): New function.
7787 (Object::do_for_all_global_symbols): New function.
7788 (Sized_relobj::do_for_all_global_symbols): New function.
7789 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
7790 function.
7791 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
7792 function.
7793
7794 2011-03-27 Ian Lance Taylor <iant@google.com>
7795
7796 * archive.cc (Archive::interpret_header): Return -1 if something
7797 goes wrong. Change callers accordingly.
7798
7799 2011-03-25 Cary Coutant <ccoutant@google.com>
7800
7801 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
7802 * testsuite/Makefile.in: Regenerate.
7803
7804 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
7805
7806 * plugin.cc (get_view): New.
7807 (Plugin::load): Pass get_view to the plugin.
7808 (Plugin_manager::get_view): New.
7809
7810 2011-03-21 Ian Lance Taylor <iant@google.com>
7811
7812 * testsuite/final_layout.sh: Rewrite to not use dc.
7813 * testsuite/relro_test.sh: Fail if dc is not present.
7814
7815 2011-03-21 Sriraman Tallam <tmsriram@google.com>
7816
7817 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
7818 Change == to -eq.
7819 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
7820 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
7821 Change == to -eq.
7822 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
7823 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
7824
7825 2011-03-14 Ian Lance Taylor <iant@google.com>
7826
7827 * script-sections.cc (Sort_output_sections::script_compare):
7828 Rename from is_before, change return type.
7829 (Sort_output_sections::operator()): Adjust accordingly.
7830
7831 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
7832
7833 PR gold/12572
7834 * testsuite/odr_violation2.cc: Add comment to make all error line
7835 numbers double digits.
7836 * testsuite/debug_msg.sh: Adjust expected errors.
7837
7838 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
7839
7840 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
7841 but mark earlier ones as non-canonical
7842 (offset_to_iterator): Update search target and example
7843 (do_addr2line): Return extra lines in a vector*
7844 (format_file_lineno): Extract from do_addr2line
7845 (one_addr2line): Add vector* out-param
7846 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
7847 when a lineno entry appeared last for its instruction
7848 (Dwarf_line_info): Add vector* out-param
7849 * object.cc (Relocate_info): Pass NULL for the vector* out-param
7850 * symtab.cc (Odr_violation_compare): Include the lineno in the
7851 comparison again.
7852 (linenos_from_loc): New. Combine the canonical line for an
7853 address with its other lines.
7854 (True_if_intersect): New. Helper functor to make
7855 std::set_intersection a query.
7856 (detect_odr_violations): Compare sets of lines instead of just
7857 one line for each function. This became less deterministic, but
7858 has fewer false positives.
7859 * symtab.h: Declarations.
7860 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
7861 mix an optimized and non-optimized object in the same binary
7862 (odr_violation2.so): Same.
7863 * testsuite/Makefile.in: Regenerate from Makefile.am.
7864 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
7865 * testsuite/debug_msg.sh: Update line numbers and add
7866 assertions.
7867 * testsuite/odr_violation1.cc: Use OdrDerived, in a
7868 non-optimized context.
7869 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
7870 isn't inlined, and use OdrDerived in an optimized context.
7871 * testsuite/odr_header1.h: Defines OdrDerived, where
7872 optimization will change the
7873 first-instruction-in-the-destructor's file and line number.
7874 * testsuite/odr_header2.h: Defines OdrBase.
7875
7876 2011-03-09 Ian Lance Taylor <iant@google.com>
7877
7878 * fileread.cc (File_read::clear_views): Don't delete the whole
7879 file view.
7880
7881 2011-03-08 Ian Lance Taylor <iant@google.com>
7882
7883 PR gold/12525
7884 * fileread.cc: #include <climits>.
7885 (GOLD_IOV_MAX): Define.
7886 (File_read::read_multiple): Limit number of entries by iov_max.
7887 * fileread.h (class File_read): Always set max_readv_entries to
7888 128.
7889
7890 2011-03-07 Ian Lance Taylor <iant@google.com>
7891
7892 PR gold/12525
7893 * options.h (class General_options): Add -dy and -dn.
7894
7895 2011-03-02 Cary Coutant <ccoutant@google.com>
7896
7897 * testsuite/script_test_9.t: Add TLS segment.
7898
7899 2011-03-02 Simon Baldwin <simonb@google.com>
7900
7901 * configure.ac: Add check for gnu_indirect_function support in
7902 the toolchain building binutils.
7903 * configure: Rebuild.
7904
7905 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
7906
7907 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
7908 plugin only symbols.
7909 (Symbol_table::sized_finalize_symbol) Mark symbol only present
7910 in plugin files as not needed in the symbol table.
7911
7912 2011-02-11 Sriraman Tallam <tmsriram@google.com>
7913
7914 * output.cc (Output_section::add_input_section): Delay fill
7915 generation for section ordering.
7916
7917 2011-02-09 Ian Lance Taylor <iant@google.com>
7918
7919 PR gold/12316
7920 * object.h (class Sized_relobj): Remove clear_local_symbols.
7921 * reloc.cc (Sized_relobj::do_relocate): Don't call
7922 clear_local_symbols.
7923
7924 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
7925
7926 * plugin.cc (is_visible_from_outside): Return true for symbols
7927 in the -u option.
7928
7929 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
7930
7931 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
7932 filename.
7933
7934 2011-02-02 Sriraman Tallam <tmsriram@google.com>
7935
7936 * icf.h (is_section_foldable_candidate): Change type of parameter
7937 to std::string.
7938 * icf.cc (Icf::find_identical_sections): Change type of local variable
7939 section_name to be std::string.
7940 (is_function_ctor_or_dtor): Change type of parameter to std::string.
7941
7942 2011-01-25 Ian Lance Taylor <iant@google.com>
7943
7944 * script.cc (script_add_extern): Rewrite to use
7945 add_symbol_reference.
7946
7947 2011-01-25 Doug Kwan <dougkwan@google.com>
7948
7949 * icf.cc (get_section_contents): Always lock section's object.
7950
7951 2011-01-24 Ian Lance Taylor <iant@google.com>
7952
7953 * options.h (class General_options): Accept
7954 --no-detect-odr-violations.
7955
7956 2011-01-24 Ian Lance Taylor <iant@google.com>
7957
7958 * version.cc (version_string): Bump to 1.11.
7959
7960 2011-01-24 Ian Lance Taylor <iant@google.com>
7961
7962 * plugin.cc (class Plugin_rescan): Define new class.
7963 (Plugin_manager::claim_file): Set any_claimed_.
7964 (Plugin_manager::save_archive): New function.
7965 (Plugin_manager::save_input_group): New function.
7966 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
7967 necessary.
7968 (Plugin_manager::new_undefined_symbol): New function.
7969 (Plugin_manager::rescan): New function.
7970 (Plugin_manager::rescannable_defines): New function.
7971 (Plugin_manager::add_input_file): Set any_added_.
7972 * plugin.h (class Plugin_manager): define new fields rescannable_,
7973 undefined_symbols_, any_claimed_, and any_added_. Declare
7974 Plugin_rescan as friend. Declare new functions.
7975 (Plugin_manager::Rescannable): Define type.
7976 (Plugin_manager::Rescannable_list): Define type.
7977 (Plugin_manager::Undefined_symbol_list): Define type.
7978 (Plugin_manager::Plugin_manager): Initialize new fields.
7979 * archive.cc (Archive::defines_symbol): New function.
7980 (Add_archive_symbols::run): Pass archive to plugins if any.
7981 * archive.h (class Archive): Declare defines_symbol.
7982 * readsyms.cc (Input_group::~Input_group): New function.
7983 (Finish_group::run): Pass input_group to plugins if any.
7984 * readsyms.h (class Input_group): Declare destructor.
7985 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
7986 any.
7987
7988 2011-01-10 Ian Lance Taylor <iant@google.com>
7989
7990 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
7991 section as relro.
7992 (Layout::set_segment_offsets): Reset increase_relro before calling
7993 set_section_addresses a second time.
7994
7995 2011-01-04 Cary Coutant <ccoutant@google.com>
7996
7997 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
7998 sections before NOBITS sections.
7999
8000 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
8001
8002 * version.cc (print_version): Update copyright to 2011.
8003
8004 2010-12-23 Cary Coutant <ccoutant@google.com>
8005
8006 * output.h (Output_data_reloc::add_output_section): Pass OD instead
8007 of OS to this->add. Add OD parameter to second form of the function.
8008
8009 2010-12-20 Ian Lance Taylor <iant@google.com>
8010
8011 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
8012 second of two consecutive entries with same offset.
8013
8014 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8015
8016 * testsuite/Makefile.am (ifuncmain2static_LDADD)
8017 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
8018 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
8019 to avoid unneeded links against $(LDADD).
8020 * testsuite/Makefile.in: Regenerate.
8021
8022 2010-12-15 Ian Lance Taylor <iant@google.com>
8023
8024 PR gold/12324
8025 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
8026 for R_X86_64_32 and R_X86_64_PC32.
8027 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
8028 ver_matching_def_pic.o.
8029 (ver_matching_def_pic.o): New target.
8030
8031 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8032
8033 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
8034 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
8035 Move definition before File_read::View member definitions.
8036 (File_read::View::~View): Initialize and hold lock before
8037 updating current_mapped_bytes.
8038
8039 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8040
8041 * dwarf_reader.cc: Remove outdated comment.
8042 * gold-threads.cc: Fix typo in error message.
8043 * archive.cc: Fix typos in comments.
8044 * archive.h: Likewise.
8045 * arm-reloc-property.cc: Likewise.
8046 * arm-reloc-property.h: Likewise.
8047 * arm-reloc.def: Likewise.
8048 * arm.cc: Likewise.
8049 * attributes.h: Likewise.
8050 * cref.cc: Likewise.
8051 * ehframe.cc: Likewise.
8052 * fileread.h: Likewise.
8053 * gold.h: Likewise.
8054 * i386.cc: Likewise.
8055 * icf.cc: Likewise.
8056 * incremental.h: Likewise.
8057 * int_encoding.cc: Likewise.
8058 * layout.h: Likewise.
8059 * main.cc: Likewise.
8060 * merge.h: Likewise.
8061 * object.cc: Likewise.
8062 * object.h: Likewise.
8063 * options.cc: Likewise.
8064 * readsyms.cc: Likewise.
8065 * reduced_debug_output.cc: Likewise.
8066 * reloc.cc: Likewise.
8067 * script-sections.cc: Likewise.
8068 * sparc.cc: Likewise.
8069 * symtab.h: Likewise.
8070 * target-reloc.h: Likewise.
8071 * target.cc: Likewise.
8072 * target.h: Likewise.
8073 * timer.cc: Likewise.
8074 * timer.h: Likewise.
8075 * x86_64.cc: Likewise.
8076
8077 2010-12-09 Cary Coutant <ccoutant@google.com>
8078
8079 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
8080 stack.
8081 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
8082 parameter; change all callers.
8083 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
8084 * options.h (warn_execstack): New option.
8085
8086 2010-12-07 Doug Kwan <dougkwan@google.com>
8087
8088 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
8089 like function call relocations.
8090
8091 2010-12-07 Ian Lance Taylor <iant@google.com>
8092
8093 * archive.cc (Archive::get_elf_object_for_member): Permit
8094 punconfigured to be NULL.
8095 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
8096 (Archive::include_member): Pass NULL to get_elf_object_for_member
8097 if we searched for the archive and this is the first included
8098 object.
8099
8100 2010-12-01 Ian Lance Taylor <iant@google.com>
8101
8102 * dwarf_reader.h (class Sized_dwarf_line_info): Add
8103 track_relocs_type_ field.
8104 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8105 Set track_relocs_type_.
8106 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
8107 contents when using RELA relocs.
8108 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
8109 reloc_map_.
8110 * reloc.cc (Track_relocs::next_addend): New function.
8111 * reloc.h (class Track_relocs): Declare next_addend.
8112
8113 2010-12-01 Ian Lance Taylor <iant@google.com>
8114
8115 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
8116 virtual destructor.
8117
8118 2010-12-01 Ian Lance Taylor <iant@google.com>
8119
8120 * README: Update compilers known to work and fail.
8121
8122 2010-11-23 Matthias Klose <doko@ubuntu.com>
8123
8124 * configure.in: For --enable-gold, handle value `default' instead of
8125 `both*'. Always install ld as ld.bfd, install as ld if gold is
8126 not the default.
8127 * configure: Regenerate.
8128
8129 2010-11-18 Doug Kwan <dougkwan@google.com>
8130
8131 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
8132 and right_alignment to be zero. Store result alignment only if it is
8133 greater than existing alignment.
8134
8135 2010-11-16 Cary Coutant <ccoutant@google.com>
8136
8137 PR gold/12220
8138 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8139 Check for ".zdebug_line".
8140
8141 2010-11-16 Doug Kwan <dougkwan@google.com>
8142 Cary Coutant <ccoutant@google.com>
8143
8144 * output.h (Output_segment::set_section_addresses): Pass increase_relro
8145 by reference; adjust all callers.
8146 * output.cc (Output_segment::set_section_addresses): Adjust references
8147 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
8148 list is empty.
8149 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
8150 end at page boundary.
8151
8152 2010-11-16 Cary Coutant <ccoutant@google.com>
8153
8154 PR gold/12220
8155 * layout.cc (Layout::choose_output_section): Transform names of
8156 compressed sections even when using a script with a SECTIONS clause.
8157 (Layout::output_section_name): Remove code to transform
8158 compressed debug section names.
8159 * output.cc (Output_section::add_input_section): Use uncompressed
8160 section size when tracking input sections.
8161
8162 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
8163
8164 * symtab.h (Symbol::NON_PIC_REF): Remove.
8165 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
8166 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
8167 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
8168 (Symbol::use_plt_offset): Take a flags argument and pass it
8169 directly to needs_dynamic_reloc. Restrict check for undefined
8170 weak symbols to function calls.
8171 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
8172 (Target_arm::Scan::global): Use it.
8173 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
8174 (Target_arm::Relocate::relocate): Likewise.
8175 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
8176 parameter with an r_type parameter. Use get_reference_flags
8177 to get the flags.
8178 (Target_arm::Relocate::relocate): Update accordingly.
8179 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
8180 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
8181 (Target_i386::Scan::global): Likewise.
8182 (Target_i386::Relocate::relocate): Likewise.
8183 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
8184 parameter with an r_type parameter. Use get_reference_flags
8185 to get the flags.
8186 (Target_i386::Relocate::relocate): Update accordingly.
8187 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
8188 (Target_powerpc::Scan::global): Use it.
8189 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
8190 (Target_powerpc::Relocate::relocate): Likewise.
8191 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
8192 (Target_sparc::Scan::global): Use it.
8193 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
8194 (Target_sparc::Relocate::relocate): Likewise.
8195 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
8196 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
8197 (Target_x86_64::Scan::global): Likewise.
8198 (Target_x86_64::Relocate::relocate): Likewise.
8199
8200 2010-11-08 Doug Kwan <dougkwan@google.com>
8201 Cary Coutant <ccoutant@google.com>
8202
8203 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
8204 (Arm_exidx_merge_section::section_contents_): New data member.
8205 (Arm_input_section::Arm_input_section): Initialize original_contents_.
8206 (Arm_input_section::~Arm_input_section): De-allocate memory.
8207 (Arm_input_section::original_contents_): New data member.
8208 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
8209 in parameters instead of calling Object::section_contents without
8210 locking.
8211 (Arm_output_section::group_section): New parameter TASK. Pass it
8212 to callees that need locking objects.
8213 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
8214 to lock EXIDX input sections. Fix a formatting issue. Call
8215 Arm_exidx_merged_section::build_contents to create merged section
8216 contents.
8217 (Arm_output_section::create_stub_group): New parameter TASK. Use it
8218 to lock object of stub table owner.
8219 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
8220 TEXT_SIZE to initialize data member TEXT_SIZE_.
8221 (Arm_exidx_input_section::addralign): Fix typo in comment.
8222 (Arm_exidx_input_section::text_size): New method.
8223 (Target_arm::do_relax): New parameter TASK. Pass it to callees
8224 that require locking objects. Lock objects before scanning for stubs
8225 and updating local symbols.
8226 (Arm_input_section<big_endian>::init): Copy contents of original
8227 input section.
8228 (Arm_input_section<big_endian>::do_write): Use saved contents of
8229 original input section instead of calling Object::section_contents
8230 without locking.
8231 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
8232 size without calling Object::section_size().
8233 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
8234 for size. Allocate a buffer for merged EXIDX entries.
8235 (Arm_exidx_merged_section::build_contents): New method.
8236 (Arm_exidx_merged_section::do_write): Move merge section contents
8237 building code to Arm_exidx_merged_section::build_contetns. Write
8238 out contetns in buffer instead of building it on the fly.
8239 (Arm_relobj::make_exidx_input_section): Also pass text section size
8240 to Arm_exidx_input_section constructor.
8241 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
8242 (Arm_dynobj::do_read_symbols): Fix memory leak.
8243 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
8244 * target.h: (class Task): Add forward declaration.
8245 (Target::relax): Add new parameter TASK and pass it to
8246 Target::do_relax().
8247 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
8248
8249 2010-11-05 Cary Coutant <ccoutant@google.com>
8250
8251 PR gold/10708
8252 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
8253 object when reading from the file.
8254 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
8255 second layout pass.
8256 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
8257 when reading section contents.
8258 (get_section_contents): Likewise.
8259 (icf::find_identical_sections): Likewise.
8260 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
8261 object when reading from the file.
8262 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
8263 the object when doing deferred section layout.
8264
8265 2010-11-03 Nick Clifton <nickc@redhat.com>
8266
8267 PR gold/12001
8268 * script.h (class Symbol_assignment: name): New member. Returns
8269 the name of the symbol.
8270 * scrfipt.cc (Script_options::is_pending_assignment): New member.
8271 Returns true if the given symbol name is on the list of
8272 assignments wating to be processed.
8273 * archive.cc (should_incldue_member): If the symbol is undefined,
8274 check to see if it is on the list of symbols pending assignment.
8275
8276 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
8277
8278 * script-sections.cc (Script_sections::find_memory_region): Check
8279 for a NULL output section pointer.
8280
8281 2010-10-29 Doug Kwan <dougkwan@google.com>
8282
8283 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
8284 Output_section::add_relaxed_input_section.
8285 * output.cc (Output_section::add_relaxed_input_section): Add new
8286 arguments LAYOUT and NAME. Set section order index.
8287 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8288 Copy section order index.
8289 * output.h (Output_section::add_relaxed_input_section): Add new
8290 arguments LAYOUT and NAME.
8291
8292 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8293
8294 * testsuite/Makefile.am: Move gcctestdir/ld rule to
8295 NATIVE_OR_CROSS_LINKER.
8296 * testsuite/Makefile.in: Regenerate.
8297
8298 2010-10-20 Doug Kwan <dougkwan@google.com>
8299
8300 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
8301 without SHF_LINK_ORDER flags.
8302 * layout.cc (Layout::choose_output_section): Do not filter
8303 SHF_LINK_ORDER flag in a relocatable link.
8304
8305 2010-10-17 Cary Coutant <ccoutant@google.com>
8306
8307 * output.h (Output_segment::set_section_addresses): Change function
8308 signature. Update all callers.
8309 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
8310 sections.
8311 (Output_segment::set_section_addresses): Align after last TLS
8312 section. Add padding before last relro section instead of after.
8313
8314 2010-10-17 Doug Kwan <dougkwan@google.com>
8315
8316 * gold/arm.cc (Target_arm::got_section): Use correct order and set
8317 GOT output section to be writable.
8318
8319 2010-10-14 Cary Coutant <ccoutant@google.com>
8320
8321 * debug.h (DEBUG_INCREMENTAL): New flag.
8322 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
8323 * gold.cc (queue_initial_tasks): Check parameters for incremental link
8324 mode.
8325 * incremental.cc (report_command_line): Ignore all forms of
8326 --incremental.
8327 * layout.cc (Layout::Layout): Check parameters for incremental link
8328 mode.
8329 * options.cc (General_options::parse_incremental): New function.
8330 (General_options::parse_no_incremental): New function.
8331 (General_options::parse_incremental_full): New function.
8332 (General_options::parse_incremental_update): New function.
8333 (General_options::incremental_mode_): New data member.
8334 (General_options::finalize): Check incremental_mode_.
8335 * options.h (General_options): Update help text for --incremental.
8336 Add --no-incremental, --incremental-full, --incremental-update.
8337 (General_options::Incremental_mode): New enum type.
8338 (General_options::incremental_mode): New function.
8339 (General_options::incremental_mode_): New data member.
8340 * parameters.cc (Parameters::incremental_mode_): New data member.
8341 (Parameters::set_options): Set incremental_mode_.
8342 (Parameters::set_incremental_full): New function.
8343 (Parameters::incremental): New function.
8344 (Parameters::incremental_update): New function.
8345 (set_parameters_incremental_full): New function.
8346 * parameters.h (Parameters::set_incremental_full): New function.
8347 (Parameters::incremental): New function.
8348 (Parameters::incremental_update): New function.
8349 (Parameters::incremental_mode_): New data member.
8350 (set_parameters_incremental_full): New function.
8351 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
8352 incremental link mode.
8353 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
8354 (Sized_relobj::do_relocate_sections): Likewise.
8355 * testsuite/Makefile.am (incremental_test): Use --incremental-full
8356 option.
8357 * testsuite/Makefile.in: Regenerate.
8358 * testsuite/incremental_test.sh: Filter all forms of --incremental.
8359
8360 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8361
8362 * script-sections.h (class Script_sections): Make
8363 Sections_elements typedef public.
8364 * script-sections.cc (class Sort_output_sections): Add elements_
8365 field. Add constructor which sets it; change all callers.
8366 (Sort_output_sections::is_before): New function.
8367 (Sort_output_sections::operator()): Call is_before.
8368 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
8369 conditional.
8370 * testsuite/script_test_10.sh: New test. Test script section
8371 order.
8372 * testsuite/script_test_10.t: Likewise.
8373 * testsuite/script_test_10.s: Likewise.
8374 * testsuite/Makefile.am: Wrap the cross linker tests and the
8375 common tests into NATIVE_OR_CROSS_LINKER.
8376 (check_SCRIPTS): Add script_test_10.sh.
8377 (check_DATA): Add script_test_10.stdout.
8378 (script_test_10.o, script_test_10): New targets.
8379 (script_test_10.stdout): New target.
8380 * configure, testsuite/Makefile.in: Regenerate.
8381
8382 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8383
8384 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
8385 error for the deprecated relocations.
8386 (Target_arm::Scan::global): Likewise.
8387 (Target_arm::Relocate::relocate): Likewise.
8388
8389 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
8390
8391 * fileread.cc (Input_file::find_file): Initialize *found_name
8392 and *namep when using the fallback search for case 4.
8393
8394 2010-10-11 Cary Coutant <ccoutant@google.com>
8395
8396 * options.h (class General_options): Redefine -z lazy as an alias for
8397 the negation of -z now.
8398
8399 2010-10-11 Ian Lance Taylor <iant@google.com>
8400
8401 * resolve.cc (symbol_to_bits): Report the value of the unsupported
8402 binding.
8403
8404 2010-10-06 Nick Clifton <nickc@redhat.com>
8405
8406 * script-sections.cc(class Memory_region): Remove
8407 current_lma_offset_ field. Rename current_vma_offset_ to
8408 current_offset_. Add last_section_ field.
8409 (Memory_region::get_current_vma_address): Rename to
8410 get_current_address.
8411 (Memory_region::get_current_lma_address): Delete.
8412 (Memory_region::increment_vma_offset): Rename to
8413 increment_offset.
8414 (Memory_region::increment_lma_offset): Delete.
8415 (Memory_region::attributes_compatible): New method. Returns
8416 true if the provided section is compatible with the region.
8417 (Memory_region::get_last_section): New method. Returns the last
8418 section to use the region.
8419 (Memory_region::set_last_section): New method. Stores the last
8420 section to use the region.
8421 (Script_sections::block_in_region): New method. Returns true if
8422 a block of memory is contained within a region.
8423 (Script_sections::find_memory_region): New method. Locates a
8424 memory region to be used to set a VMA or LMA address.
8425 (Output_section_definition::set_section_addresses): Add code to
8426 check for addresses set by memory regions.
8427 (Output_segment::set_section_addresses): Remove memory region
8428 walking code.
8429 (Script_sections::create_segment): Add a warning if a header
8430 segment is created outside of any region.
8431 * script-sections.h (class Script_sections): Add prototypes for
8432 find_memory_region and block_in_region methods.
8433 * testsuite/memory_test.s: Use .long instead of .word.
8434 * testsuite/memory_test.t: Add some more output sections.
8435 * testsuite/memory_test.sh: Update expected output.
8436
8437 2010-10-02 Doug Kwan <dougkwan@google.com>
8438
8439 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
8440 defintion to symtab.h
8441 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
8442 declaration to defintion.
8443
8444 2010-10-01 Nick Clifton <nickc@redhat.com>
8445
8446 * expression.cc (eval): Replace dummy argument with NULL.
8447 (eval_maybe_dot): Check for a NULL result section pointer.
8448 (Symbol_expression::value): Likewise.
8449 (Dot_expression::value): Likewise.
8450 (BINARY_EXPRESSION): Likewise.
8451 (Max_expression::value): Likewise.
8452 (Min_expression::value): Likewise.
8453 (Absolute_expression::value): Likewise.
8454 (Addr_expression::value_from_output_section): Likewise.
8455 (Loaddddr_expression::value_from_output_section): Likewise.
8456 (Segment_start_expression::value): Likewise.
8457 * script-sections.cc
8458 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
8459 argument with NULL.
8460 (Sections_elememt_dot_assignment::set_section_addresses):
8461 Likewise.
8462 (Output_data_expression::do_write_to_buffer): Likewise.
8463 (Output_section_definition::finalize_symbols): Likewise.
8464 (Output_section_definition::set_section_addresses): Likewise.
8465
8466 2010-09-30 Doug Kwan <dougkwan@google.com>
8467
8468 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
8469
8470 2010-09-28 Sriraman Tallam <tmsriram@google.com>
8471
8472 * target.h (Target::can_icf_inline_merge_sections): New virtual
8473 function.
8474 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
8475 virtual function.
8476 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
8477 virtual function.
8478 * icf.cc (get_section_contents): Inline merge sections only when
8479 target allows it.
8480
8481 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8482
8483 * configure: Regenerate.
8484
8485 2010-09-17 Ian Lance Taylor <iant@google.com>
8486
8487 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
8488 * testsuite/Makefile.am (memory_test.o): New target.
8489 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
8490 memory_test.t.
8491 * testsuite/Makefile.in: Rebuild.
8492
8493 2010-09-17 Doug Kwan <dougkwan@google.com>
8494
8495 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
8496 defintion if relocation uses GOT entries of the symbol.
8497 * testsuite/icf_safe_test.sh: Fix test.
8498 * testsuite/icf_safe_so_test.sh: Fix test.
8499
8500 2010-09-16 Cary Coutant <ccoutant@google.com>
8501
8502 * script_sections.cc (class Memory_region): Remove "NULL" from
8503 vector initializations.
8504
8505 2010-09-15 Cary Coutant <ccoutant@google.com>
8506
8507 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
8508 Resolve forwarding symbols.
8509
8510 2010-09-15 Doug Kwan <dougkwan@google.com>
8511
8512 * gold/testsuite/script_test_3.t: Add ARM special sections.
8513 * gold/testsuite/script_test_4.t: Same.
8514 * gold/testsuite/script_test_5.t: Same.
8515 * gold/testsuite/script_test_6.t: Same.
8516 * gold/testsuite/script_test_7.t: Same.
8517 * gold/testsuite/script_test_7.t: Same.
8518 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
8519
8520 2010-09-14 Cary Coutant <ccoutant@google.com>
8521
8522 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
8523 (Target_x86_64::Relocate::relocate_tls): Replace check for
8524 saw_tls_block_reloc_ with test for executable section.
8525
8526 2010-09-12 Cary Coutant <ccoutant@google.com>
8527
8528 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
8529 position-independent executables to shared libraries need dynamic
8530 relocations.
8531 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
8532 position-independent executables.
8533 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
8534 * testsuite/Makefile.in: Regenerate.
8535
8536 2010-09-10 Nick Clifton <nickc@redhat.com>
8537
8538 PR gold/11997
8539 * testsuite/memory_test.t: Discard any sections that are not
8540 needed.
8541
8542 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
8543
8544 PR gold/11996
8545 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
8546 "This::" to work around a bug in gcc 4.2.
8547
8548 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
8549
8550 2010-09-09 Rafael Espindola <espindola@google.com>
8551
8552 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
8553 sections with different PF_X flags in the same segment.
8554 (Layout::find_first_load_seg): Search all segments to find the first
8555 one.
8556 * options.h (rosegment): New.
8557
8558 2010-09-08 Rafael Espindola <espindola@google.com>
8559
8560 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
8561
8562 2010-09-08 Doug Kwan <dougkwan@google.com>
8563
8564 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
8565 (Arm_relobj::do_relocate_sections): Add new parameter for output
8566 file to match the parent.
8567 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
8568 of local symbols instead of input values. Update code to track
8569 changes in gold::relocate_section.
8570 * object.cc (Sized_relobj::compute_final_local_value): New methods.
8571 (Sized_relobj::compute_final_local_value_internal): New methods.
8572 (Sized_relobj::do_finalize_local_symbols): Move code from loop
8573 body into private version of Sized_relobj::compute_final_local_value.
8574 Call the inline method.
8575 * object.h (Symbol_value::Symbol_value): Define destructor. Free
8576 merged symbol value if there is one.
8577 (Symbol_value::has_output_value): New method defintiion.
8578 (Sized_relobj::Compute_final_local_value_status): New enum type.
8579 (Sized_relobj::compute_final_local_value): New methods.
8580 (Sized_relobj::compute_final_local_value_internal): New methods.
8581 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
8582 and arm_cortex_a8.sh.
8583 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
8584 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
8585 New tests.
8586 * Makefile.in: Regenerate.
8587 * testsuite/arm_bl_out_of_range.s: Update test.
8588 * testsuite/thumb_bl_out_of_range.s: Ditto.
8589 * testsuite/thumb_blx_out_of_range.s: Ditto.
8590 * testsuite/arm_branch_out_of_range.sh: New file.
8591 * testsuite/arm_cortex_a8.sh: Ditto.
8592 * testsuite/arm_cortex_a8_b.s: Ditto.
8593 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
8594 * testsuite/arm_cortex_a8_b_local.s: Ditto.
8595 * testsuite/arm_cortex_a8_bl.s: Ditto.
8596 * testsuite/arm_cortex_a8_blx.s: Ditto.
8597 * testsuite/arm_cortex_a8_local.s: Ditto.
8598 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
8599 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
8600
8601 2010-09-08 Rafael Espindola <espindola@google.com>
8602
8603 * Makefile.am (memory_test.stdout): Run readelf with -W.
8604 * Makefile.in: Regenerate.
8605 * testsuite/memory_test.sh: Make the regexps accept both 32 and
8606 64 bit output.
8607
8608 2010-09-08 Rafael Espindola <espindola@google.com>
8609
8610 * script-sections.cc (Script_sections::add_memory_region): Convert
8611 field precision to int.
8612 * script.cc (script_set_section_region, script_set_section_region):
8613 Convert field precision to int.
8614
8615 2010-09-08 Rafael Espindola <espindola@google.com>
8616
8617 * arm.cc (do_finalize_sections): Create the __exidx_start and
8618 __exdix_end symbols even when the section is missing.
8619
8620 2010-09-08 Nick Clifton <nickc@redhat.com>
8621
8622 * README: Remove claim that MEMORY is not supported.
8623 * expression.cc (script_exp_function_origin)
8624 (script_exp_function_length): Move from here to ...
8625 * script.cc: ... here.
8626 (script_set_section_region, script_add_memory)
8627 (script_parse_memory_attr, script_include_directive): New
8628 functions.
8629 * script-sections.cc
8630 (class Memory_region): New class.
8631 (class Output_section_definition): Add set_memory_region,
8632 set_section_vma, set_section_lma and get_section_name methods.
8633 (class Script_Sections): Add add_memory_region,
8634 find_memory_region, find_memory_region_origin,
8635 find_memory_region_length and set_memory_region methods.
8636 Have set_section_addresses method walk the list of set memory
8637 regions.
8638 Extend the print methos to display memory regions.
8639 * script-sections.h: Add prototypes for new methods.
8640 Add enum for MEMORY region attributes.
8641 * yyscript.y: Add support for parsing MEMORY regions.
8642 * script-c.h: Add prototypes for new functions.
8643 * testsuite/Makefile.am: Add test of MEMORY region functionality.
8644 * testsuite/Makefile.in: Regenerate.
8645 * testsuite/memory_test.sh: New script.
8646 * testsuite/memory_test.s: New assembler source file.
8647 * testsuite/memory_test.t: New linker script.
8648
8649 2010-08-27 Doug Kwan <dougkwan@google.com>
8650
8651 * gold/resolve.cc (Symbol_table::should_override): Let a weak
8652 reference override an existing dynamic weak reference.
8653 * testsuite/Makefile.am: Add new test dyn_weak_ref.
8654 * testsuite/Makefile.in: Regenerate.
8655 * testsuite/dyn_weak_ref.sh: New file.
8656 * testsuite/dyn_weak_ref_1.c: Ditto.
8657 * testsuite/dyn_weak_ref_2.c: Ditto.
8658
8659 2010-08-27 Ian Lance Taylor <iant@google.com>
8660
8661 * incremental.h (class Incremental_input_entry): Add virtual
8662 destructor.
8663
8664 2010-08-27 Ian Lance Taylor <iant@google.com>
8665
8666 * testsuite/start_lib_test_3.c: Mark t3 as used.
8667
8668 2010-08-27 Nick Clifton <nickc@redhat.com>
8669
8670 * options.cc (version_script): Fix small typo in previous
8671 whitespace tidyup.
8672
8673 2010-08-25 Nick Clifton <nickc@redhat.com>
8674
8675 * archive.cc: Formatting fixes: Remove whitespace between
8676 typename and following asterisk. Remove whitespace between
8677 function name and opening parenthesis.
8678 * archive.h: Likewise.
8679 * arm.cc: Likewise.
8680 * attributes.cc: Likewise.
8681 * attributes.h: Likewise.
8682 * common.cc: Likewise.
8683 * copy-relocs.cc: Likewise.
8684 * dirsearch.h: Likewise.
8685 * dynobj.cc: Likewise.
8686 * ehframe.cc: Likewise.
8687 * ehframe.h: Likewise.
8688 * expression.cc: Likewise.
8689 * fileread.cc: Likewise.
8690 * fileread.h: Likewise.
8691 * gc.h: Likewise.
8692 * gold-threads.cc: Likewise.
8693 * gold.cc: Likewise.
8694 * i386.cc: Likewise.
8695 * icf.h: Likewise.
8696 * incremental-dump.cc: Likewise.
8697 * incremental.cc: Likewise.
8698 * layout.cc: Likewise.
8699 * layout.h: Likewise.
8700 * main.cc: Likewise.
8701 * merge.cc: Likewise.
8702 * merge.h: Likewise.
8703 * object.cc: Likewise.
8704 * object.h: Likewise.
8705 * options.cc: Likewise.
8706 * options.h: Likewise.
8707 * output.cc: Likewise.
8708 * output.h: Likewise.
8709 * plugin.cc: Likewise.
8710 * plugin.h: Likewise.
8711 * powerpc.cc: Likewise.
8712 * reloc.cc: Likewise.
8713 * script-c.h: Likewise.
8714 * script-sections.cc: Likewise.
8715 * script.cc: Likewise.
8716 * stringpool.cc: Likewise.
8717 * symtab.cc: Likewise.
8718 * symtab.h: Likewise.
8719 * target.cc: Likewise.
8720 * timer.cc: Likewise.
8721 * timer.h: Likewise.
8722 * version.cc: Likewise.
8723 * x86_64.cc: Likewise.
8724
8725 2010-08-24 Nick Clifton <nickc@redhat.com>
8726
8727 PR 11899
8728 * layout.cc (segment_precedes): Sort segments by their physical
8729 addresses, if they have been set.
8730
8731 2010-08-23 Cary Coutant <ccoutant@google.com>
8732
8733 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
8734 symbols data.
8735 (Lib_group::include_member): Unlock object after deleting its
8736 symbols data.
8737 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
8738 the bug fixed here.
8739
8740 2010-08-19 Neil Vachharajani <nvachhar@google.com>
8741 Cary Coutant <ccoutant@google.com>
8742
8743 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
8744 constructor, and set_blocker.
8745 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
8746 readsyms_blocker_.
8747 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
8748 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
8749 * testsuite/Makefile.am (start_lib_test): New test case.
8750 * testsuite/Makefile.in: Regenerate.
8751 * testsuite/start_lib_test_main.c: New file.
8752 * testsuite/start_lib_test_1.c: New file.
8753 * testsuite/start_lib_test_2.c: New file.
8754 * testsuite/start_lib_test_3.c: New file.
8755
8756 2010-08-19 Ian Lance Taylor <iant@google.com>
8757
8758 * Makefile.in: Rebuild with automake 1.11.1.
8759 * aclocal.m4: Likewise.
8760 * testsuite/Makefile.in: Likewise.
8761
8762 2010-08-19 Ian Lance Taylor <iant@google.com>
8763
8764 PR 10893
8765 * i386.cc (class Output_data_plt_i386): Update declarations.
8766 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
8767 local_ifuncs_ fields.
8768 (Target_i386::do_plt_section_for_global): New function.
8769 (Target_i386::do_plt_section_for_local): New function.
8770 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
8771 parameter; change all callers. Initialize global_ifuncs_ and
8772 local_ifuncs_. If doing a static link define __rel_iplt_start and
8773 __rel_iplt_end.
8774 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
8775 (Output_data_plt_i386::add_local_ifunc_entry): New function.
8776 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
8777 symbols.
8778 (Target_i386::make_plt_section): New function, broken out of
8779 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
8780 (Target_i386::make_plt_entry): Call make_plt_section.
8781 (Target_i386::make_local_ifunc_plt_entry): New function.
8782 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
8783 (Target_i386::Scan::local): Handle IFUNC symbols. Add
8784 R_386_IRELATIVE to switch.
8785 (Target_i386::Scan::global): Likewise.
8786 (Target_i386::Relocate::relocate): Likewise.
8787 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
8788 switch.
8789 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
8790 (Target_x86_64::do_plt_section_for_global): New function.
8791 (Target_x86_64::do_plt_section_for_local): New function.
8792 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
8793 parameter; change all callers. If doing a static link define
8794 __rela_iplt_start and __rela_iplt_end.
8795 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
8796 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
8797 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
8798 to point to .plt.
8799 (Target_x86_64::make_local_ifunc_plt_entry): New function.
8800 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
8801 switch.
8802 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
8803 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
8804 R_X86_64_IRELATIVE to switch.
8805 (Target_x86_64::Scan::global): Likewise.
8806 (Target_x86_64::Relocate::relocate): Likewise.
8807 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
8808 switch.
8809 * target.h (class Target): Add plt_section_for_global and
8810 plt_section_for_local functions. Add do_plt_section_for_global
8811 and do_plt_section_for_local virtual functions.
8812 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
8813 clarifying comments.
8814 (Symbol::use_plt_offset): Handle IFUNC symbol.
8815 * object.cc (Sized_relobj::Sized_relobj): Initialize
8816 local_plt_offsets_.
8817 (Sized_relobj::local_has_plt_offset): New function.
8818 (Sized_relobj::local_plt_offset): New function.
8819 (Sized_relobj::set_local_plt_offset): New function.
8820 (Sized_relobj::do_count): Handle IFUNC symbol.
8821 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
8822 a bit away from input_shndx_ field. Add set_is_func_symbol and
8823 is_ifunc_symbol functions.
8824 (class Sized_relobj): Update declarations. Remove Tls_got_entry
8825 and Local_tls_got_offsets. Define Local_plt_offsets. Add
8826 local_plt_offsets_ field.
8827 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
8828 * output.h (class Output_section_data): Add non-const
8829 output_section function.
8830 (class Output_data_got): Update declarations.
8831 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
8832 Add use_plt_offset parameter to global and local constructors.
8833 Change all callers. Change local_sym_index_ field to 31 bits.
8834 Change GSYM_CODE and CONSTANT_CODE accordingly.
8835 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
8836 doing a static link don't set sh_link field.
8837 (Output_data_got::Got_entry::write): Use PLT offset if
8838 appropriate.
8839 (Output_data_got::add_global_plt): New function.
8840 (Output_data_got::add_local_plt): New function.
8841 * target-reloc.h (relocate_section): Handle IFUNC symbol.
8842 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
8843 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
8844 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
8845 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
8846 IFUNC conditional.
8847 * testsuite/ifunc-sel.h: New file.
8848 * testsuite/ifuncmain1.c: New file.
8849 * testsuite/ifuncmain1vis.c: New file.
8850 * testsuite/ifuncmod1.c: New file.
8851 * testsuite/ifuncdep2.c: New file.
8852 * testsuite/ifuncmain2.c: New file.
8853 * testsuite/ifuncmain3.c: New file.
8854 * testsuite/ifuncmod3.c: New file.
8855 * testsuite/ifuncmain4.c: New file.
8856 * testsuite/ifuncmain5.c: New file.
8857 * testsuite/ifuncmod5.c: New file.
8858 * testsuite/ifuncmain6pie.c: New file.
8859 * testsuite/ifuncmod6.c: New file.
8860 * testsuite/ifuncmain7.c: New file.
8861 * configure, testsuite/Makefile.in: Rebuild.
8862
8863 2010-08-18 Ian Lance Taylor <iant@google.com>
8864
8865 * incremental.cc
8866 (Output_section_incremental_inputs::write_input_files): Add cast
8867 to avoid signed/unsigned comparison warning.
8868 (Output_section_incremental_inputs::write_info_blocks): Likewise.
8869
8870 2010-08-12 Cary Coutant <ccoutant@google.com>
8871
8872 * common.cc (Sort_commons::operator()): Remove unnecessary code.
8873
8874 2010-08-13 Ian Lance Taylor <iant@google.com>
8875
8876 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
8877
8878 2010-08-12 Cary Coutant <ccoutant@google.com>
8879 Doug Kwan <dougkwan@google.com>
8880
8881 * resolve.cc (Symbol_table::should_override): When a weak dynamic
8882 defintion overrides non-weak undef, remember that the original undef
8883 is not weak.
8884 * symtab.cc (Symbol_table::sized_write_global): For undef without
8885 an original weak binding, set binding to global in output.
8886 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
8887 * testsuite/Makefile.in: Regenerate.
8888 * testsuite/strong_ref_weak_def.sh: New file.
8889 * testsuite/strong_ref_weak_def_1.c: Ditto.
8890 * testsuite/strong_ref_weak_def_2.c: Ditto.
8891
8892 2010-08-12 Cary Coutant <ccoutant@google.com>
8893
8894 * testsuite/incremental_test.sh: Rewrite.
8895 * testsuite/incremental_test_1.c: Rewrite.
8896 * testsuite/incremental_test_2.c: Rewrite.
8897
8898 2010-08-12 Cary Coutant <ccoutant@google.com>
8899
8900 * arm.cc (Target_arm::got_size): Add const.
8901 (Target_arm::got_entry_count): New function.
8902 (Target_arm::plt_entry_count): New function.
8903 (Target_arm::first_plt_entry_offset): New function.
8904 (Target_arm::plt_entry_size): New function.
8905 (Output_data_plt_arm::entry_count): New function.
8906 (Output_data_plt_arm::first_plt_entry_offset): New function.
8907 (Output_data_plt_arm::get_plt_entry_size): New function.
8908 * i386.cc (Target_i386::got_size): Add const.
8909 (Target_i386::got_entry_count): New function.
8910 (Target_i386::plt_entry_count): New function.
8911 (Target_i386::first_plt_entry_offset): New function.
8912 (Target_i386::plt_entry_size): New function.
8913 (Output_data_plt_i386::entry_count): New function.
8914 (Output_data_plt_i386::first_plt_entry_offset): New function.
8915 (Output_data_plt_i386::get_plt_entry_size): New function.
8916 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
8917 find_incremental_inputs_sections. Dump incremental_got_plt section.
8918 * incremental.cc: Include target.h.
8919 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
8920 parameter. Adjust all callers. Find incremental_got_plt section.
8921 (Incremental_inputs::create_data_sections): Create incremental_got_plt
8922 section.
8923 (Output_section_incremental_inputs::set_final_data_size): Calculate
8924 size of incremental_got_plt section.
8925 (Output_section_incremental_inputs::do_write): Write the
8926 incremental_got_plt section.
8927 (Got_plt_view_info): New struct.
8928 (Local_got_offset_visitor): New class.
8929 (Global_got_offset_visitor): New class.
8930 (Global_symbol_visitor_got_plt): New class.
8931 (Output_section_incremental_inputs::write_got_plt): New function.
8932 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
8933 Add parameter. Adjust all callers.
8934 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8935 (Incremental_inputs::got_plt_section): New function.
8936 (Incremental_inputs::got_plt_section_): New data member.
8937 (Incremental_got_plt_reader): New class.
8938 * layout.cc (Layout::create_incremental_info_sections): Add the
8939 incremental_got_plt section.
8940 * object.h (Got_offset_list::get_list): New function.
8941 (Got offset_list::for_all_got_offsets): New function.
8942 (Sized_relobj::local_got_offset_list): New function.
8943 * powerpc.cc (Target_powerpc::got_size): Add const.
8944 (Target_powerpc::got_entry_count): New function.
8945 (Target_powerpc::plt_entry_count): New function.
8946 (Target_powerpc::first_plt_entry_offset): New function.
8947 (Target_powerpc::plt_entry_size): New function.
8948 (Output_data_plt_powerpc::entry_count): New function.
8949 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
8950 (Output_data_plt_powerpc::get_plt_entry_size): New function.
8951 * sparc.cc (Target_sparc::got_size): Add const.
8952 (Target_sparc::got_entry_count): New function.
8953 (Target_sparc::plt_entry_count): New function.
8954 (Target_sparc::first_plt_entry_offset): New function.
8955 (Target_sparc::plt_entry_size): New function.
8956 (Output_data_plt_sparc::entry_count): New function.
8957 (Output_data_plt_sparc::first_plt_entry_offset): New function.
8958 (Output_data_plt_sparc::get_plt_entry_size): New function.
8959 * symtab.h (Symbol::got_offset_list): New function.
8960 (Symbol_table::for_all_symbols): New function.
8961 * target.h (Sized_target::got_entry_count): New function.
8962 (Sized_target::plt_entry_count): New function.
8963 (Sized_target::plt_entry_size): New function.
8964 * x86_64.cc (Target_x86_64::got_size): Add const.
8965 (Target_x86_64::got_entry_count): New function.
8966 (Target_x86_64::plt_entry_count): New function.
8967 (Target_x86_64::first_plt_entry_offset): New function.
8968 (Target_x86_64::plt_entry_size): New function.
8969 (Output_data_plt_x86_64::entry_count): New function.
8970 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
8971 (Output_data_plt_x86_64::get_plt_entry_size): New function.
8972
8973 2010-08-12 Cary Coutant <ccoutant@google.com>
8974
8975 * archive.cc: Include incremental.h.
8976 (Archive::Archive): Initialize incremental_info_.
8977 (Archive::include_member): Record archive members in incremental info.
8978 (Add_archive_symbols::run): Record begin and end of an archive in
8979 incremental info.
8980 (Lib_group::include_member): Record objects in incremental info.
8981 * archive.h (Incremental_archive_entry): Forward declaration.
8982 (Archive::set_incremental_info): New member function.
8983 (Archive::incremental_info): New member function.
8984 (Archive::Unused_symbol_iterator): New class.
8985 (Archive::unused_symbols_begin): New member function.
8986 (Archive::unused_symbols_end): New member function.
8987 (Archive::incremental_info_): New data member.
8988 * incremental-dump.cc (find_input_containing_global): New function.
8989 (dump_incremental_inputs): Dump new incremental info sections.
8990 * incremental.cc: Include symtab.h.
8991 (Output_section_incremental_inputs): New class.
8992 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
8993 new incremental info sections.
8994 (Sized_incremental_binary::do_check_inputs): Likewise.
8995 (Incremental_inputs::report_archive): Remove.
8996 (Incremental_inputs::report_archive_begin): New function.
8997 (Incremental_inputs::report_archive_end): New function.
8998 (Incremental_inputs::report_object): New function.
8999 (Incremental_inputs::finalize_inputs): Remove.
9000 (Incremental_inputs::report_input_section): New function.
9001 (Incremental_inputs::report_script): Rewrite.
9002 (Incremental_inputs::finalize): Do nothing but finalize string table.
9003 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9004 (Incremental_inputs::sized_create_inputs_section_data): Remove.
9005 (Incremental_inputs::create_data_sections): New function.
9006 (Incremental_inputs::relocs_entsize): New function.
9007 (Output_section_incremental_inputs::set_final_data_size): New function.
9008 (Output_section_incremental_inputs::do_write): New function.
9009 (Output_section_incremental_inputs::write_header): New function.
9010 (Output_section_incremental_inputs::write_input_files): New function.
9011 (Output_section_incremental_inputs::write_info_blocks): New function.
9012 (Output_section_incremental_inputs::write_symtab): New function.
9013 * incremental.h (Incremental_script_entry): Forward declaration.
9014 (Incremental_object_entry): Forward declaration.
9015 (Incremental_archive_entry): Forward declaration.
9016 (Incremental_inputs): Forward declaration.
9017 (Incremental_inputs_header_data): Remove.
9018 (Incremental_inputs_header): Remove.
9019 (Incremental_inputs_header_write): Remove.
9020 (Incremental_inputs_entry_data): Remove.
9021 (Incremental_inputs_entry): Remove.
9022 (Incremental_inputs_entry_write): Remove.
9023 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
9024 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
9025 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9026 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
9027 Likewise.
9028 (Incremental_input_entry): New class.
9029 (Incremental_script_entry): New class.
9030 (Incremental_object_entry): New class.
9031 (Incremental_archive_entry): New class.
9032 (Incremental_inputs::Incremental_inputs): Initialize new data members.
9033 (Incremental_inputs::report_inputs): Remove.
9034 (Incremental_inputs::report_archive): Remove.
9035 (Incremental_inputs::report_archive_begin): New function.
9036 (Incremental_inputs::report_archive_end): New function.
9037 (Incremental_inputs::report_object): Change prototype.
9038 (Incremental_inputs::report_input_section): New function.
9039 (Incremental_inputs::report_script): Change prototype.
9040 (Incremental_inputs::get_reloc_count): New function.
9041 (Incremental_inputs::set_reloc_count): New function.
9042 (Incremental_inputs::create_data_sections): New function.
9043 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9044 (Incremental_inputs::inputs_section): New function.
9045 (Incremental_inputs::symtab_section): New function.
9046 (Incremental_inputs::relocs_section): New function.
9047 (Incremental_inputs::get_stringpool): Add const.
9048 (Incremental_inputs::command_line): Add const.
9049 (Incremental_inputs::inputs): Remove.
9050 (Incremental_inputs::command_line_key): New function.
9051 (Incremental_inputs::input_file_count): New function.
9052 (Incremental_inputs::input_files): New function.
9053 (Incremental_inputs::relocs_entsize): New function.
9054 (Incremental_inputs::sized_create_inputs_section_data): Remove.
9055 (Incremental_inputs::finalize_inputs): Remove.
9056 (Incremental_inputs::Input_info): Remove.
9057 (Incremental_inputs::lock_): Remove.
9058 (Incremental_inputs::inputs_): Change type.
9059 (Incremental_inputs::inputs_map_): Remove.
9060 (Incremental_inputs::current_object_entry_): New data member.
9061 (Incremental_inputs::inputs_section_): New data member.
9062 (Incremental_inputs::symtab_section_): New data member.
9063 (Incremental_inputs::relocs_section_): New data member.
9064 (Incremental_inputs::reloc_count_): New data member.
9065 (Incremental_inputs_reader): New class.
9066 (Incremental_symtab_reader): New class.
9067 (Incremental_relocs_reader): New class.
9068 * layout.cc (Layout::finalize): Move finalization of incremental info
9069 and creation of incremental info sections to follow finalization of
9070 symbol table. Set offsets for postprocessing sections.
9071 (Layout::create_incremental_info_sections): Call
9072 Incremental_inputs::create_data_sections. Add incremental symtab
9073 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
9074 sections to layout after input sections.
9075 * layout.h (struct Timespec): Forward declaration.
9076 (Layout::incremental_inputs): Add const.
9077 (Layout::create_incremental_info_sections): Add parameter.
9078 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
9079 * object.cc: Include incremental.h.
9080 (Relobj::finalize_incremental_relocs): New function.
9081 (Sized_relobj::do_layout): Record input sections in incremental info.
9082 * object.h (Object::output_section): New function.
9083 (Object::output_section_offset): Moved from Relobj.
9084 (Object::get_incremental_reloc_base): New function.
9085 (Object::get_incremental_reloc_count): New function.
9086 (Object::do_output_section): New function.
9087 (Object::do_output_section_offset): Moved from Relobj.
9088 (Object::do_get_incremental_reloc_base): New function.
9089 (Object::do_get_incremental_reloc_count): New function.
9090 (Object::Object): Initialize new data members.
9091 (Relobj::output_section): Renamed do_output_section and moved to
9092 protected.
9093 (Relobj::output_section_offset): Moved to Object.
9094 (Relobj::do_get_incremental_reloc_base): New function.
9095 (Relobj::do_get_incremental_reloc_count): New function.
9096 (Relobj::allocate_incremental_reloc_counts): New function.
9097 (Relobj::count_incremental_reloc): New function.
9098 (Relobj::finalize_incremental_relocs): New function.
9099 (Relobj::next_incremental_reloc_index): New function.
9100 (Relobj::reloc_counts_): New data member.
9101 (Relobj::reloc_bases_): New data member.
9102 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
9103 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
9104 (Sized_relobj::incremental_relocs_scan): New function.
9105 (Sized_relobj::incremental_relocs_scan_reltype): New function.
9106 (Sized_relobj::incremental_relocs_write): New function.
9107 (Sized_relobj::incremental_relocs_write_reltype): New function.
9108 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
9109 incremental link.
9110 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
9111 archives and object files elsewhere.
9112 (Add_symbols::run): Report object files here.
9113 (Finish_group::run): Report end of archive at end of group.
9114 * reloc.cc: Include layout.h, incremental.h.
9115 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
9116 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
9117 (Sized_relobj::incremental_relocs_scan): New function.
9118 (Sized_relobj::incremental_relocs_scan_reltype): New function.
9119 (Sized_relobj::do_relocate_sections): Write incremental relocations.
9120 (Sized_relobj::incremental_relocs_write): New function.
9121 (Sized_relobj::incremental_relocs_write_reltype): New function.
9122 * script.cc (read_input_script): Rewrite test for incremental link.
9123 Change call to Incremental_inputs::report_script.
9124 * symtab.h (Symbol_table::first_global_index): New function.
9125 (Symbol_table::output_count): New function.
9126
9127 2010-08-12 Doug Kwan <dougkwan@google.com>
9128
9129 * arm.cc (Target_arm::merge_object_attributes): Check command line
9130 options --no-wchar-size-warning and --no-enum-size-warning.
9131 * options.h (General_options): Add ld-compatible options
9132 --no-enum-size-warning and --no-wchar-size-warning.
9133
9134 2010-08-04 Ian Lance Taylor <iant@google.com>
9135
9136 * x86_64.cc (Target_x86_64::Scan::local): Use
9137 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
9138 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
9139 (Target_x86_64::Scan::global): Likewise.
9140 (Target_x86_64::Relocate::relocate): Likewise.
9141 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
9142 Likewise.
9143
9144 2010-08-03 Cary Coutant <ccoutant@google.com>
9145
9146 * merge.cc (Output_merge_string::do_add_input_section): Count strings
9147 to reserve space in merged_strings vector. Keep total input size
9148 for stats.
9149 (Output_merge_string::do_print_merge_stats): Print total input size.
9150 * merge.h (Output_merge_string): Add input_size_ field.
9151 * stringpool.cc (Stringpool_template::string_length): Move
9152 implementations out of Stringpool_template class and place in
9153 stringpool.h.
9154 * stringpool.h (string_length): Move out of Stringpool_template.
9155
9156 2010-08-03 Ian Lance Taylor <iant@google.com>
9157
9158 PR 11712
9159 * layout.cc (relaxation_loop_body): If address of load segment is
9160 set, adjust address to include headers if possible.
9161
9162 2010-08-03 Ian Lance Taylor <iant@google.com>
9163
9164 * version.cc (version_string): Bump to 1.10.
9165
9166 2010-08-03 Ian Lance Taylor <iant@google.com>
9167
9168 PR 11805
9169 * layout.h (enum Output_section_order): Define.
9170 (class Layout): Update declarations.
9171 * layout.cc (Layout::get_output_section): Add order parameter.
9172 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
9173 is_first_non_relro parameters. Change all callers.
9174 (Layout::choose_output_section): Likewise.
9175 (Layout::add_output_section_data): Likewise.
9176 (Layout::make_output_section): Likewise. Set order.
9177 (Layout::default_section_order): New function.
9178 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
9179 * output.cc (Output_section::Output_section): Initialize order_.
9180 Don't initialize deleted fields.
9181 (Output_segment::Output_segment): Don't initialize deleted
9182 fields.
9183 (Output_segment::add_output_section_to_load): New function
9184 replacing add_output_section. Change all callers to call this or
9185 add_output_section_to_nonload.
9186 (Output_segment::add_output_section_to_nonload): New function.
9187 (Output_segment::remove_output_section): Rewrite.
9188 (Output_segment::add_initial_output_data): Likewise.
9189 (Output_segment::has_any_data_sections): Likewise.
9190 (Output_segment::is_first_section_relro): Likewise.
9191 (Output_segment::maximum_alignment): Likewise.
9192 (Output_segment::has_dynamic_reloc): New function replacing
9193 dynamic_reloc_count. Change all callers.
9194 (Output_segment::has_dynamic_reloc_list): New function replacing
9195 dynamic_reloc_count_list. Change all callers.
9196 (Output_segment::set_section_addresses): Rewrite.
9197 (Output_segment::set_offset): Rewrite.
9198 (Output_segment::find_first_and_last_list): Remove.
9199 (Output_segment::set_tls_offsets): Rewrite.
9200 (Output_segment::first_section_load_address): Likewise.
9201 (Output_segment::output_section_count): Likewise.
9202 (Output_segment::section_with_lowest_load_address): Likewise.
9203 (Output_segment::write_section_headers): Likewise.
9204 (Output_segment::print_sections_to_map): Likewise.
9205 * output.h (class Output_data): Remove dynamic_reloc_count_
9206 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
9207 (Output_data::add_dynamic_reloc): Rewrite.
9208 (Output_data::has_dynamic_reloc): New function.
9209 (Output_data::dynamic_reloc_count): Remove.
9210 (class Output_section): Add order_ field. Remvoe is_relro_local_,
9211 is_last_relro_, is_first_non_relro_, is_interp_,
9212 is_dynamic_linker_section_ fields. Add order and set_order
9213 functions. Remove is_relro_local, set_is_relro_local,
9214 is_last_relro, set_is_last_relro, is_first_non_relro,
9215 set_is_first_non_relro functions, is_interp, set_is_interp,
9216 is_dynamic_linker_section, and set_is_dynamic_linker_section
9217 functions.
9218 (class Output_segment): Change Output_data_list from std::list to
9219 std:;vector. Add output_lists_ field. Remove output_data_ and
9220 output_bss_ fields. Update declarations.
9221
9222 2010-08-02 Ian Lance Taylor <iant@google.com>
9223
9224 * arm.cc (Target_arm::gc_process_relocs): Use typename.
9225 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
9226 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
9227
9228 2010-08-02 Ian Lance Taylor <iant@google.com>
9229
9230 PR 11855
9231 * script.cc (Script_options::Script_options): Initialize
9232 symbol_definitions_ and symbol_references_.
9233 (Script_options::add_symbol_assignment): Update
9234 symbol_definitions_ and symbol_references_.
9235 (Script_options::add_symbol_reference): New function.
9236 (script_symbol): New function.
9237 * script.h (class Script_options): Add symbol_definitions_ and
9238 symbol_references_ fields.
9239 (Script_options::referenced_const_iterator): New type.
9240 (Script_options::referenced_begin): New function.
9241 (Script_options::referenced_end): New function.
9242 (Script_options::is_referenced): New function.
9243 (Script_options::any_unreferenced): New function.
9244 * script-c.h (script_symbol): Declare.
9245 * yyscript.y (exp): Call script_symbol.
9246 * symtab.cc: Include "script.h".
9247 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
9248 Change all callers. Check symbols referenced by scripts.
9249 (Symbol_table::add_undefined_symbols_from_command_line): Add
9250 layout parameter. Change all callers.
9251 (Symbol_table::do_add_undefined_symbols_from_command_line):
9252 Likewise. Break out loop body. Check symbols referenced by
9253 scripts.
9254 (Symbol_table::add_undefined_symbol_from_command_line): New
9255 function broken out of
9256 do_add_undefined_symbols_from_command_line.
9257 * symtab.h (class Symbol_table): Update declarations.
9258 * archive.cc: Include "layout.h".
9259 (Archive::should_include_member): Add layout parameter. Change
9260 all callers. Check for symbol mentioned in expression.
9261 * archive.h (class Archive): Update declaration.
9262 * object.cc (Sized_relobj::do_should_include_member): Add layout
9263 parameter.
9264 * object.h (Object::should_include_member): Add layout parameter.
9265 Change all callers.
9266 (Object::do_should_include_member): Add layout parameter.
9267 (class Sized_relobj): Update declaration.
9268 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
9269 parameter.
9270 * dynobj.h (class Sized_dynobj): Update declaration.
9271 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
9272 layout parameter.
9273 * plugin.h (class Sized_pluginobj): Update declaration.
9274
9275 2010-08-02 Ian Lance Taylor <iant@google.com>
9276
9277 PR 11866
9278 * output.cc (Output_segment::set_offset): Search for the first and
9279 last sections rather than assuming that the list is in order.
9280 (Output_segment::find_first_and_last_list): New function.
9281 * output.h (class Output_segment): Update declarations.
9282 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
9283 (relro_strip_test_SOURCES): New variable.
9284 (relro_strip_test_DEPENDENCIES): New variable.
9285 (relro_strip_test_LDFLAGS): New variable.
9286 (relro_strip_test_LDADD): New variable.
9287 (relro_strip_test.so): New target.
9288
9289 2010-08-02 Ian Lance Taylor <iant@google.com>
9290
9291 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
9292 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
9293 (Target_i386::got_tlsdesc_section): New function.
9294 (Target_i386::got_section): Create space for GOT entries for
9295 TLSDESC relocations.
9296 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
9297 R_386_TLS_GOTDESC.
9298 (Target_i386::Scan::global): Likewise.
9299 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
9300 using TLSDESC GOT.
9301 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
9302 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
9303 (Target_x86_64::got_tlsdesc_section): New function.
9304 (Target_x86_64::got_section): Create space for GOT entries for
9305 TLSDESC relocations.
9306 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
9307 R_386_TLS_GOTDESC.
9308 (Target_x86_64::Scan::global): Likewise.
9309 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
9310 using TLSDESC GOT.
9311
9312 2010-08-02 Ian Lance Taylor <iant@google.com>
9313
9314 * testsuite/final_layout.sh: Use dc to convert from hex to
9315 decimal.
9316
9317 2010-07-29 Sriraman Tallam <tmsriram@google.com>
9318
9319 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
9320 paramter to the call to gold::gc_process_relocs.
9321 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
9322 paramter to the call to gold::gc_process_relocs.
9323 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
9324 parameter to the call to gold::gc_process_relocs.
9325 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
9326 template parameter to the call to gold::gc_process_relocs.
9327 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
9328 paramter to the call to gold::gc_process_relocs.
9329 * gc.h (get_embedded_addend_size): New function.
9330 (gc_process_relocs): Save the size of the reloc for use by ICF.
9331 * icf.cc (get_section_contents): Get the addend from the text section
9332 for SHT_REL relocation sections.
9333 * icf.h (Icf::Reloc_addend_size_info): New typedef.
9334 (Icf::Reloc_info): Add new member reloc_addend_size_info.
9335 * int_encoding.h (read_from_pointer): New overloaded function.
9336 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
9337 * testsuite/icf_sht_rel_addend_test.sh: New file.
9338 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
9339 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
9340
9341 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9342
9343 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
9344 * Makefile.in: Regenerate.
9345 * testsuite/Makefile.in: Regenerate.
9346
9347 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
9348
9349 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
9350 * gold/testsuite/debug_msg.cc: Likewise.
9351 * gold/testsuite/odr_violation1.cc
9352 * gold/testsuite/odr_violation2.cc
9353
9354 2010-07-21 Cary Coutant <ccoutant@google.com>
9355
9356 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
9357 string, and length fields.
9358 (Output_merge_string::Merged_strings_list): New type.
9359 (Output_merge_string::Merged_strings_lists): New typedef.
9360 (Output_merge_string): Replace merged_strings_ with
9361 merged_strings_lists_.
9362 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
9363 Merged_strings_list per input object and section. Don't store pointer
9364 to the string. Don't store length with each merged string entry.
9365 (Output_merge_string::finalize_merged_data): Loop over list of merged
9366 strings lists. Recompute length of each merged string.
9367
9368 2010-07-15 Cary Coutant <ccoutant@google.com>
9369
9370 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
9371 here.
9372
9373 2010-07-14 Ian Lance Taylor <iant@google.com>
9374
9375 * descriptors.cc (Descriptors::open): Report correct name in error
9376 message.
9377
9378 2010-07-13 Doug Kwan <dougkwan@google.com>
9379
9380 * arm.cc (Arm_input_section::Arm_input_section): For a
9381 SHT_ARM_EXIDX section, always keeps the input sections.
9382 (Arm_input_section::set_exidx_section_link): New method.
9383 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
9384 has_errors_ to false.
9385 (Arm_exidx_input_section::has_errors,
9386 Arm_exidx_input_section::set_has_errors): New methods.
9387 (Arm_exidx_input_section::has_errors_): New data member.
9388 (Arm_relobj::get_exidx_shndx_list): New method.
9389 (Arm_output_section::append_text_sections_to_list): Do not skip
9390 section without SHF_EXECINSTR.
9391 (Arm_output_section::fix_exidx_coverage): Skip input sections with
9392 errors.
9393 (Arm_relobj::make_exidx_input_section): Add new parameter for text
9394 section header. Make error messages more verbose. Check for
9395 a non-executable section linked to an EXIDX section.
9396 (Arm_relobj::do_read_symbols): Remove error checking, which has been
9397 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
9398 check that there is no deferred EXIDX section if we exit early.
9399 Instead of not making an EXIDX section in case of an error, make one
9400 and set the has_errors flag of it.
9401 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
9402 in a relocatable link.
9403 (Target_arm::do_relax): Look for the EXIDX output section instead of
9404 assuming that it is called .ARM.exidx.
9405 (Target_arm::fix_exidx_coverage): Add a new parameter for input
9406 section list. Do not check for SHF_EXECINSTR section flags but
9407 skip any input section with errors.
9408 * output.cc (Output_section::Output_section): Initialize
9409 always_keeps_input_sections_ to false.
9410 (Output_section::add_input_section): Check for
9411 always_keeps_input_sections_.
9412 * output.h (Output_section::always_keeps_input_sections,
9413 Output_section::set_always_keeps_input_sections): New methods.
9414 (Output_section::always_keeps_input_sections): New data member.
9415
9416 2010-07-13 Rafael Espindola <espindola@google.com>
9417
9418 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
9419 * fileread.h (Input_file): Add try_extra_search_path and find_file.
9420
9421 2010-07-13 Philip Herron <herron.philip@googlemail.com>
9422 Ian Lance Taylor <iant@google.com>
9423
9424 * output.h (Output_section_lookup_maps::add_merge_section):
9425 Correct check of whether value was inserted.
9426 (Output_section_lookup_maps::add_merge_input_section): Likewise.
9427 (Output_section_lookup_maps::add_relaxed_input_section):
9428 Likewise.
9429 * arm.cc (Target_arm::got_section): Remove used local os.
9430 * i386.cc (Target_i386::got_section): Likewise.
9431 * x86_64.cc (Target_x86_64::got_section): Likewise.
9432 * sparc.cc (Target_sparc::got_section): Likewise.
9433 (Target_sparc::relocate): Remove unused local have_got_offset.
9434 * powerpc.cc (Target_powerpc::relocate): Likewise.
9435
9436 2010-07-13 Ian Lance Taylor <iant@google.com>
9437
9438 * compressed_output.cc (zlib_decompress): Fix signature in
9439 !HAVE_ZLIB_H case.
9440
9441 * archive.cc (Archive::include_member): Unlock an external member
9442 of a thin archive. Don't bother to delete an object we know is
9443 NULL.
9444
9445 2010-07-12 Cary Coutant <ccoutant@google.com>
9446
9447 * compressed_output.cc (zlib_decompress): New function.
9448 (get_uncompressed_size): New function.
9449 (decompress_input_section): New function.
9450 * compressed_output.h (get_uncompressed_size): New function.
9451 (decompress_input_section): New function.
9452 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
9453 Handle compressed debug sections.
9454 * layout.cc (is_compressed_debug_section): New function.
9455 (Layout::output_section_name): Map compressed section names to
9456 canonical names.
9457 * layout.h (is_compressed_debug_section): New function.
9458 (is_debug_info_section): Recognize compressed debug sections.
9459 * merge.cc: Include compressed_output.h.
9460 (Output_merge_data::do_add_input_section): Handle compressed
9461 debug sections.
9462 (Output_merge_string::do_add_input_section): Handle compressed
9463 debug sections.
9464 * object.cc: Include compressed_output.h.
9465 (Sized_relobj::Sized_relobj): Initialize new data members.
9466 (build_compressed_section_map): New function.
9467 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
9468 * object.h (Object::section_is_compressed): New method.
9469 (Object::do_section_is_compressed): New method.
9470 (Sized_relobj::Compressed_section_map): New type.
9471 (Sized_relobj::do_section_is_compressed): New method.
9472 (Sized_relobj::compressed_sections_): New data member.
9473 * output.cc (Output_section::add_input_section): Handle compressed
9474 debug sections.
9475 * reloc.cc: Include compressed_output.h.
9476 (Sized_relobj::write_sections): Handle compressed debug sections.
9477
9478 2010-07-08 Cary Coutant <ccoutant@google.com>
9479
9480 * resolve.cc (Symbol_table::resolve): Remember whether undef was
9481 weak when resolving to a dynamic def.
9482 (Symbol_table::should_override): Add adjust_dyndef flag; set it
9483 for weak undef/dynamic def cases. Adjust callers.
9484 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
9485 undef_binding_weak_.
9486 (Symbol_table::sized_write_globals): Adjust symbol binding.
9487 (Symbol_table::sized_write_symbol): Add binding parameter.
9488 * symtab.h (Symbol::set_undef_binding): New method.
9489 (Symbol::is_undef_binding_weak): New method.
9490 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
9491 (Symbol_table::should_override): Add new parameter.
9492 (Symbol_table::sized_write_symbol): Add new parameter.
9493
9494 * testsuite/weak_undef_file1.cc: Add new test case.
9495 * testsuite/weak_undef_file2.cc: Fix header comment.
9496 * testsuite/weak_undef_test.cc: Add new test case.
9497
9498 2010-06-29 Doug Kwan <dougkwan@google.com>
9499
9500 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
9501 Initialize USE_SYMBOL_.
9502 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
9503 definition.
9504 (Arm_reloc_property::uses_symbol_): New data member declaration.
9505 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
9506 uses symbol value and symbol is undefined but not weakly undefined.
9507
9508 2010-06-28 Rafael Espindola <espindola@google.com>
9509
9510 * plugin.cc (Plugin::load): Use dlerror.
9511
9512 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
9513
9514 * symtab.cc (detect_odr_violations): When reporting an ODR
9515 violation, report an object where the symbol is defined.
9516
9517 2010-06-25 Doug Kwan <dougkwan@google.com>
9518
9519 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
9520 (Target_arm::section_may_have_icf_unsafe_pointers): New method
9521 definition.
9522 (Target_arm::Scan::local_reloc_may_be_function_pointer,
9523 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
9524 target hook to detect function points.
9525 (Target_arm::Scan::possible_function_pointer_reloc): New method.
9526 * icf.h (Icf::check_section_for_function_pointers): Change type of
9527 parameter SECTION_NAME to const reference to std::string. Use
9528 target hook to determine if section may have unsafe pointers.
9529 * target.h (Target::section_may_have_icf_unsafe_pointers): New
9530 method definition.
9531
9532 2010-06-21 Rafael Espindola <espindola@google.com>
9533
9534 * fileread.cc (Input_file::find_fie): New
9535 (Input_file::open): Use Input_file::find_fie.
9536 * fileread.h (Input_file::find_fie): New
9537 * plugin.cc (set_extra_library_path): New.
9538 (Plugin::load): Add set_extra_library_path to the transfer vector.
9539 (Plugin_manager::set_extra_library_path): New.
9540 (Plugin_manager::add_input_file): Use the extra search path if set.
9541 (set_extra_library_path(): New.
9542 * plugin.h (Plugin_manager): Add set_extra_library_path and
9543 extra_search_path_.
9544
9545 2010-06-19 Cary Coutant <ccoutant@google.com>
9546
9547 * layout.cc (gdb_sections): Add .debug_types.
9548 (lines_only_debug_sections): Likewise.
9549
9550 2010-06-18 Rafael Espindola <espindola@google.com>
9551
9552 * plugin.cc (add_input_file,add_input_library)
9553 (Plugin_manager::add_input_file): Make filename arguments const.
9554 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
9555 const.
9556
9557 2010-06-16 Doug Kwan <dougkwan@google.com>
9558
9559 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
9560 .ARM.attributes section if we have not merged any input
9561 attributes sections.
9562
9563 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9564
9565 * arm.cc: Allow combining objects with no EABI version
9566 information.
9567
9568 2010-06-15 Rafael Espindola <espindola@google.com>
9569
9570 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
9571
9572 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9573
9574 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
9575 (struct iovec): Correct !HAVE_READV definition.
9576
9577 2010-06-10 Cary Coutant <ccoutant@google.com>
9578
9579 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
9580 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
9581 reloc sections.
9582 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
9583
9584 PR 11683
9585 * symtab.h (Symbol::is_placeholder): New member function.
9586 * target-reloc.h (relocate_section): Check for placeholder symbols.
9587
9588 * testsuite/Makefile.am (plugin_test_8): New test.
9589 (plugin_test_9): New test.
9590 * testsuite/Makefile.in: Regenerate.
9591
9592 2010-06-09 Nick Clifton <nickc@redhat.com>
9593
9594 * yyscript.y (input_list_element): Allow strings prefixed with
9595 the '-' character. Treat these as libraries.
9596 * script.cc (script_add_library): New function. Adds a library
9597 specified by "-l<name>" found in an input script.
9598 * script-c.h: Add prototype for script_add_library.
9599
9600 2010-06-07 Doug Kwan <dougkwan@google.com>
9601
9602 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
9603 Restrict stub-group size to be within long conditional branch
9604 range when working around cortex-A8 erratum.
9605
9606 2010-06-07 Damien Diederen <dd@crosstwine.com>
9607
9608 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
9609 #ifdef typo.
9610
9611 2010-06-03 Sriraman Tallam <tmsriram@google.com>
9612
9613 PR gold/11658
9614 * output.cc
9615 (Output_section::Input_section_sort_entry::compare_section_ordering):
9616 Change to return non-zero correctly.
9617 (Output_section::Input_section_sort_section_order_index_compare
9618 ::operator()): Change to fix ambiguity in comparisons.
9619
9620 2010-06-01 Sriraman Tallam <tmsriram@google.com>
9621
9622 * gold.h (is_wildcard_string): New function.
9623 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
9624 (Layout::layout_eh_frame): Ditto.
9625 (Layout::find_section_order_index): New method.
9626 (Layout::read_layout_from_file): New method.
9627 * layout.h (Layout::find_section_order_index): New method.
9628 (Layout::read_layout_from_file): New method.
9629 (Layout::input_section_position_): New private member.
9630 (Layout::input_section_glob_): New private member.
9631 * main.cc (main): Call read_layout_from_file here.
9632 * options.h (--section-ordering-file): New option.
9633 * output.cc (Output_section::input_section_order_specified_): New
9634 member.
9635 (Output_section::Output_section): Initialize new member.
9636 (Output_section::add_input_section): Add new parameter.
9637 Keep input sections when --section-ordering-file is used.
9638 (Output_section::set_final_data_size): Sort input sections when
9639 section ordering file is specified.
9640 (Output_section::Input_section_sort_entry): Add new parameter.
9641 Check sorting type.
9642 (Output_section::Input_section_sort_entry::compare_section_ordering):
9643 New method.
9644 (Output_section::Input_section_sort_compare::operator()): Change to
9645 consider section_order_index.
9646 (Output_section::Input_section_sort_init_fini_compare::operator()):
9647 Change to consider section_order_index.
9648 (Output_section::Input_section_sort_section_order_index_compare
9649 ::operator()): New method.
9650 (Output_section::sort_attached_input_sections): Change to sort
9651 according to section order when specified.
9652 (Output_section::add_input_section<32, true>): Add new parameter.
9653 (Output_section::add_input_section<64, true>): Add new parameter.
9654 (Output_section::add_input_section<32, false>): Add new parameter.
9655 (Output_section::add_input_section<64, false>): Add new parameter.
9656 * output.h (Output_section::add_input_section): Add new parameter.
9657 (Output_section::input_section_order_specified): New
9658 method.
9659 (Output_section::set_input_section_order_specified): New method.
9660 (Input_section::Input_section): Initialize section_order_index_.
9661 (Input_section::section_order_index): New method.
9662 (Input_section::set_section_order_index): New method.
9663 (Input_section::section_order_index_): New member.
9664 (Input_section::Input_section_sort_section_order_index_compare): New
9665 struct.
9666 (Output_section::input_section_order_specified_): New member.
9667 * script-sections.cc (is_wildcard_string): Delete and move modified
9668 method to gold.h.
9669 (Output_section_element_input::Output_section_element_input): Modify
9670 call to is_wildcard_string.
9671 (Output_section_element_input::Input_section_pattern
9672 ::Input_section_pattern): Ditto.
9673 (Output_section_element_input::Output_section_element_input): Ditto.
9674 * testsuite/Makefile.am (final_layout): New test case.
9675 * testsuite/Makefile.in: Regenerate.
9676 * testsuite/final_layout.cc: New file.
9677 * testsuite/final_layout.sh: New file.
9678
9679 2010-06-01 Rafael Espindola <espindola@google.com>
9680
9681 * plugin.cc (Plugin::load): Pass the output name to the plugin.
9682
9683 2010-06-01 Rafael Espindola <espindola@google.com>
9684
9685 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
9686 visibility of symbols.
9687
9688 2010-05-27 Doug Kwan <dougkwan@google.com>
9689
9690 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
9691 from start of output section instead of address for a local symbol
9692 in a merged or relaxed section when doing a relocatable link.
9693
9694 2010-05-26 Rafael Espindola <espindola@google.com>
9695
9696 PR 11604
9697 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
9698 adding sections the garbage collector removed.
9699 * gold/testsuite/Makefile.am: Add test.
9700 * gold/testsuite/Makefile.in: Regenerate.
9701 * gold/testsuite/plugin_test_7.sh: New.
9702 * gold/testsuite/plugin_test_7_1.c: New.
9703 * gold/testsuite/plugin_test_7_2.c: New.
9704
9705 2010-05-26 Rafael Espindola <espindola@google.com>
9706
9707 * script-sections.cc (Output_section_definition::set_section_addresses):
9708 Check for --section-start.
9709
9710 2010-05-26 Doug Kwan <dougkwan@google.com>
9711
9712 * arm.cc (Arm_scan_relocatable_relocs): New class.
9713 (Target_arm::relocate_special_relocatable): New method.
9714 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
9715 (Arm_relocate_functions::thumb_branch_common): Same.
9716 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
9717 instead of Default_scan_relocatable_relocs.
9718 * target-reloc.h (relocate_for_relocatable): Let target handle
9719 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
9720 * target.h (Sized_target::relocate_special_relocatable): New method.
9721
9722 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9723
9724 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
9725
9726 2010-05-23 Doug Kwan <dougkwan@google.com>
9727
9728 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
9729 instead of a cast.
9730 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
9731 with a direct branch, not a conditional branch, to a stub.
9732 * merge.cc (Output_merge_base::record_input_section): New method
9733 defintion.
9734 (Output_merge_data::do_add_input_section): Record input section if
9735 keeps-input-sections flag is set.
9736 (Output_merge_string::do_add_input_section): Ditto.
9737 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
9738 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
9739 INPUT_SECTIONS_.
9740 (Output_merge_base::keeps_input_sections,
9741 Output_merge_base::set_keeps_input_sections,
9742 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
9743 method definitions.
9744 (Output_merge_base::Input_sections): New type declaration.
9745 (Output_merge_base::input_sections_begin,
9746 Output_merge_base::input_sections_end,
9747 Output_merge_base::do_set_keeps_input_sections): New method definitions.
9748 (Output_merge_base::bool keeps_input_sections_,
9749 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
9750 Output_merge_base::input_sections_): New data members.
9751 (Output_merge_data::do_set_keeps_input_sections): New method
9752 defintion.
9753 (Output_merge_string::do_set_keeps_input_sections): Ditto.
9754 * output.cc (Output_section::Input_section::relobj): Move method
9755 defintion from class declaration to here and handle merge sections.
9756 (Output_section::Input_section::shndx): Ditto.
9757 (Output_section::Output_section): Remove initializations of removed
9758 data members and initialize new data member LOOKUP_MAPS_.
9759 (Output_section::add_input_section): Set keeps-input-sections flag
9760 for a newly created merge output section as appropriate. Adjust code
9761 to use Output_section_lookup_maps class.
9762 (Output_section::add_relaxed_input_section): Adjst code for lookup
9763 maps code refactoring.
9764 (Output_section::add_merge_input_section): Add a new parameter
9765 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
9766 class. If adding input section to a newly created merge output
9767 section fails, remove the new merge section.
9768 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
9769 Adjust code for use of the Output_section_lookup_maps class.
9770 (Output_section::find_merge_section): Ditto.
9771 (Output_section::build_lookup_maps): New method defintion.
9772 (Output_section::find_relaxed_input_section): Adjust code to use
9773 Output_section_lookup_maps class.
9774 (Output_section::get_input_sections): Export merge sections. Adjust
9775 code to use Output_section_lookup_maps class.
9776 (Output_section:::add_script_input_section): Adjust code to use
9777 Output_section_lookup_maps class. Update lookup maps for merge
9778 sections also.
9779 (Output_section::discard_states): Use Output_section_lookup_maps.
9780 (Output_section::restore_states): Same.
9781 * output.h (Merge_section_properties): Move class defintion out of
9782 Output_section.
9783 (Output_section_lookup_maps): New class.
9784 (Output_section::Input_section::is_merge_section): New method
9785 defintion.
9786 (Output_section::Input_section::relobj): Move defintion out of class
9787 defintion. Declare method only.
9788 (Output_section::Input_section::shndx): Ditto.
9789 (Output_section::Input_section::output_merge_base): New method defintion.
9790 (Output_section::Input_section::u2_.pomb): New union field.
9791 (Output_section::Merge_section_by_properties_map,
9792 Output_section::Output_section_data_by_input_section_map,
9793 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
9794 Remove types.
9795 (Output_section::add_merge_input_section): Add new parameter
9796 KEEPS_INPUT_SECTIONS.
9797 (Output_section::build_lookup_maps): New method declaration.
9798 (Output_section::merge_section_map_,
9799 Output_section::merge_section_by_properties_map_,
9800 Output_section::relaxed_input_section_map_,
9801 Output_section::is_relaxed_input_section_map_valid_): Remove data
9802 members.
9803 (Output_section::lookup_maps_): New data member.
9804
9805 2010-05-21 Doug Kwan <dougkwan@google.com>
9806
9807 PR gold/11619
9808 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
9809 avoid a compilation error.
9810
9811 2010-05-19 Rafael Espindola <espindola@google.com>
9812
9813 * script-sections.cc (Output_section_definition::allocate_to_segment):
9814 Update the phdrs_list even when the output section is NULL.
9815 * testsuite/Makefile.am: Add test.
9816 * testsuite/Makefile.in: Regenerate.
9817 * testsuite/script_test_9.cc: New.
9818 * testsuite/script_test_9.sh: New.
9819 * testsuite/script_test_9.t: New.
9820
9821 2010-05-19 Doug Kwan <dougkwan@google.com>
9822
9823 * arm.cc (Arm_input_section::original_size): New method.
9824 (Arm_input_section::do_addralign): Add a cast.
9825 (Arm_input_section::do_output_offset): Remove static cast.
9826 (Arm_input_section::original_addralign,
9827 Arm_input_section::original_size_): Change type to uint32_t.
9828 (Arm_input_section::init): Add safe casts for section alignment
9829 and size.
9830 (Arm_input_section::set_final_data_size): Do not set address and
9831 offset of stub table.
9832 (Arm_output_section::fix_exidx_coverage): Change use of of
9833 Output_section::Simple_input_section to that of
9834 Output_section::Input_section.
9835 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
9836 except for the first pass.
9837 * output.cc (Output_section::get_input_sections): Change type of
9838 input_sections to std::list<Input_section>.
9839 (Output_section::add_script_input_section): Rename from
9840 Output_section::add_simple_input_section. Change type of SIS
9841 parameter from Simple_input_section to Input_section.
9842 * output.h (Output_section::Simple_input_section): Remove class.
9843 (Output_section::Input_section): Change class visibility to public.
9844 (Output_section::Input_section::addralign): Use stored alignments
9845 for special input sections if set.
9846 (Output_section::Input_section::set_addralign): New method.
9847 (Output_section::get_input_sections): Change parameter type from
9848 list of Simple_input_section to list of Input_section.
9849 (Output_section::add_script_input_section): Rename from
9850 Output_section::add_simple_input_section. Change first parameter's
9851 type from Simple_input_section to Input_section and remove the
9852 second and third parameters.
9853 * script-sections.cc (Input_section::Input_section_list): Change
9854 type to list of Output_section::Input_section/
9855 (Input_section_info::Input_section_info): Change parameter type of
9856 INPUT_SECTION to Output_section::Input_section.
9857 (Input_section_info::input_section): Change return type.
9858 (Input_section_info::input_section_): Change type to
9859 Output_section::Input_section.
9860 (Output_section_element_input::set_section_addresses): Adjust code
9861 to use Output_section::Input_section instead of
9862 Output_section::Simple_input_section. Adjust code for renaming
9863 of Output_section::add_simple_input_section.
9864 (Orphan_output_section::set_section_addresses): Ditto.
9865
9866 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9867
9868 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
9869 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
9870
9871 2010-05-18 Rafael Espindola <espindola@google.com>
9872
9873 * options.cc (General_options::finalize): Handle -nostdlib.
9874 * options.h (nostdlib): New option.
9875 * script.cc (script_add_search_dir): Handle -nostdlib.
9876
9877 2010-05-12 Doug Kwan <dougkwan@google.com>
9878
9879 * arm.cc (Target_arm::do_finalize_sections): Create an empty
9880 attributes section only if there no attributes section after merging.
9881 (Target_arm::merge_object_attributes): Move value of
9882 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
9883 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
9884 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
9885 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
9886 and arm_attr_merge_7.stdout.
9887 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
9888 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
9889 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
9890 arm_attr_merge_7b.o): New rules.
9891 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
9892 arm_attr_merge_7
9893 * testsuite/Makefile.in: Regenerate.
9894 * testsuite/arm_attr_merge.sh: New file.
9895 * testsuite/arm_attr_merge_[67][ab].s: Same.
9896
9897 2010-05-05 Nick Clifton <nickc@redhat.com>
9898
9899 * po/es.po: Updated Spanish translation.
9900
9901 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
9902
9903 * Makefile.am (install-exec-local): Properly install gold as
9904 default cross linker.
9905 * Makefile.in: Regenerated.
9906
9907 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
9908 Nick Clifton <nickc@redhat.com>
9909
9910 * configure.ac (install_as_default): Define and set to false
9911 unless --enable-gold or --enable-gold=both/gold has been
9912 specified.
9913 * configure: Regenerate.
9914
9915 * Makefile.am (install-exec-local): Install the executable as
9916 'ld.gold'. If install_as_default is true then also install it as
9917 'ld'.
9918 * Makefile.in: Regenerated.
9919
9920 2010-04-24 Ian Lance Taylor <iant@google.com>
9921
9922 * layout.cc (Layout::layout_reloc): In relocatable link don't
9923 combine reloc sections for grouped sections.
9924
9925 2010-04-23 Sriraman Tallam <tmsriram@google.com>
9926
9927 * gc.h (gc_process_relocs): Pass information on relocs pointing to
9928 sections that are not ordinary to icf.
9929 * icf.cc (get_section_contents): Handle relocation pointing to section
9930 with no object or shndx information.
9931 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
9932 * testsuite/Makefile.in: Regenerate.
9933 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
9934 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
9935
9936 2010-04-22 Ian Lance Taylor <iant@google.com>
9937
9938 * expression.cc (Expression::Expression_eval_info): Add
9939 result_alignment_pointer field.
9940 (Expression::eval_with_dot): Add result_alignment_pointer
9941 parameter. Change all callers.
9942 (Expression::eval_maybe_dot): Likewise.
9943 (class Binary_expression): Add alignment_pointer parameter to
9944 left_value and right_value. Change all callers.
9945 (BINARY_EXPRESSION): Set result alignment.
9946 (class Trinary_expression): Add alignment_pointer parameter to
9947 arg2_value and arg3_value. Change all callers.
9948 (Trinary_cond::value): Set result alignment.
9949 (Max_expression::value, Min_expression::value): Likewise.
9950 (Align_expression::value): Likewise.
9951 * script-sections.cc (class Sections_element): Add dot_alignment
9952 parameter to set_section_addresses virtual function. Update
9953 instantiations.
9954 (class Output_section_element): Likewise.
9955 (Script_sections::create_segments): Add dot_alignment parameter.
9956 Change all callers.
9957 (Script_sections::create_segments_from_phdrs_clause): Likewise.
9958 (Script_sections::set_phdrs_clause_addresses): Likewise.
9959 * script-sections.h: Update declarations.
9960 * script.h: Update declarations.
9961 * output.h (Output_segment::set_minimum_p_align): Don't decrease
9962 min_p_align.
9963 * testsuite/script_test_3.t: Set large alignment.
9964 * testsuite/script_test_3.sh: Make sure that at least one LOAD
9965 segment has expected alignment.
9966
9967 2010-04-22 Nick Clifton <nickc@redhat.com>
9968
9969 * po/gold.pot: Updated by the Translation project.
9970 * po/vi.po: Updated Vietnamese translation.
9971
9972 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
9973
9974 * testsuite/Makefile.am (check_PROGRAMS): Add
9975 icf_virtual_function_folding_test.
9976 * testsuite/Makefile.in: Regenerated.
9977
9978 2010-04-15 Andrew Haley <aph@redhat.com>
9979
9980 * options.h (merge_exidx_entries): New option.
9981 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
9982 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
9983 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
9984 (Target_arm::merge_exidx_entries): New function.
9985 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
9986 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
9987 to Arm_exidx_fixup constructor.
9988 Add new arg, merge_exidx_entries.
9989 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
9990 Arm_output_section::fix_exidx_coverage.
9991
9992 2010-04-18 Sriraman Tallam <tmsriram@google.com>
9993
9994 * icf.cc (get_section_contents): Check for preemptible functions.
9995 Ignore addend when appropriate.
9996 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
9997 section folded.
9998 (add_from_relobj): Check for section folded.
9999 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
10000 * symtab.h (should_add_dynsym_entry): Add new parameter.
10001 * target-reloc.h (scan_relocs): Check for section folded.
10002 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
10003 Check reloc types for function pointers in shared objects.
10004 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
10005 case.
10006 (icf_preemptible_functions_test): New test case.
10007 (icf_string_merge_test): New test case.
10008 * testsuite.Makefile.in: Regenerate.
10009 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
10010 bar_glob. Refactor code.
10011 * testsuite/icf_preemptible_functions_test.cc: New file.
10012 * testsuite/icf_preemptible_functions_test.sh: New file.
10013 * testsuite/icf_string_merge_test.cc: New file.
10014 * testsuite/icf_string_merge_test.sh: New file.
10015 * testsuite/icf_virtual_function_folding_test.cc: New file.
10016 * testsuite/icf_virtual_function_folding_test.sh: New file.
10017
10018 2010-04-14 Doug Kwan <dougkwan@google.com>
10019
10020 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
10021 for local symbol recounting if we remove a section due to ICF.
10022 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
10023 there are no regular objects in input.
10024
10025 2010-04-13 Doug Kwan <dougkwan@google.com>
10026
10027 * arm.cc (Arm_input_section::set_final_data_size): Compute
10028 accurate final data size instead of using current data size.
10029
10030 2010-04-09 Doug Kwan <dougkwan@google.com>
10031
10032 * layout.cc (Layout::choose_output_section): Handle script section
10033 types.
10034 (Layout::make_output_section_for_script): Add section type parameter.
10035 Handle script section types.
10036 * layout.h (Layout::make_output_section_for_script): Add section
10037 type parameter.
10038 * output.cc (Output_section::Output_section): Initialize data member
10039 is_noload_.
10040 (Output_section::do_reset_address_and_file_offset): Do not set address
10041 to 0 if section is a NOLOAD section.
10042 * output.h (Output_section::is_noload): New method.
10043 (Output_section::set_is_noload): Ditto.
10044 (Output_section::is_noload_): New data member.
10045 * script-c.h (Script_section_type): New enum type.
10046 (struct Parser_output_section_header): Add new file section_type.
10047 * script-sections.cc (Sections_element::output_section_name): Add
10048 parameter for returning script section type.
10049 (Output_section_definition::output_section_name): Ditto.
10050 (Output_section_definition::section_type)P; New method.
10051 (Output_section_definiton::script_section_type_name): Ditto.
10052 (Output_section_definition::script_section_type_): New data member.
10053 (Output_section_definition::Output_section_definition): Initialize
10054 data member Output_section_definition::script_section_type_.
10055 (Output_section_definition::create_sections): Pass script section type
10056 to Layout::make_output_section_for_script.
10057 (Output_section_definition::output_section_name): Return script
10058 section type to caller.
10059 (Output_section_definition::set_section_address): Do not advance
10060 dot value and load address if section type is NOLOAD. Set address
10061 of NOLOAD sections regardless of section flags.
10062 (Output_section_definition::print): Print section type if it is
10063 not SCRIPT_SECTION_TYPE_NONE.
10064 (Output_section_definition::section_type): New method.
10065 (Output_section_definition::script_section_type_name): Ditto.
10066 (Script_sections::output_section_name): Add new parameter
10067 PSECTION_TYPE for returning script section type. Pass it to
10068 section elements. Handle discard sections.
10069 (Sort_output_sections::operator()): Handle NOLOAD sections.
10070 * script-sections.h (Script_sections::Section_type): New enum type.
10071 (Script_sections::output_section_name): Add a new parameter for
10072 returning script section type.
10073 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
10074 INFO and NOLOAD.
10075 * yyscript.y (union): Add new field SECTION_TYPE.
10076 (COPY, DSECT, INFO, NOLOAD): New tokens.
10077 (opt_address_and_section_type): Change type to output_section_header.
10078 (section_type): New non-terminal
10079 (section_header): Handle section type.
10080 (opt_address_and_section_type): Return section type value.
10081
10082 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
10083
10084 * testsuite/plugin_common_test_1.c (foo): Add prototype.
10085 * testsuite/plugin_common_test_2.c (foo): Likewise.
10086
10087 2010-04-08 Doug Kwan <dougkwan@google.com>
10088
10089 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
10090 Output_merge_data.
10091 * output.cc (Output_section::add_merge_input_section): Simplify
10092 code and return status of Output_merge_base::add_input_section.
10093 Update merge section map only if Output_merge_base::add_input_section
10094 returns true.
10095
10096 2010-04-07 Doug Kwan <dougkwan@google.com>
10097
10098 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
10099 if section is marked as containing instructions but has no mapping
10100 symbols.
10101 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
10102 correct section index.
10103 (Arm_relobj::find_linked_text_section): Ditto.
10104
10105 2010-04-07 Cary Coutant <ccoutant@google.com>
10106
10107 * archive.cc (include_member): Destroy Read_symbols_data object before
10108 releasing file.
10109 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
10110 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
10111 (Read_symbols_data::~Read_symbols_data) New destructor.
10112 (Section_relocs::Section_relocs) New constructor.
10113 (Section_relocs::~Section_relocs) New destructor.
10114 (Read_relocs_data::Read_relocs_data) New constructor.
10115 (Read_relocs_data::~Read_relocs_data) New destructor.
10116 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
10117 pointers to NULL after deleting.
10118
10119 2010-04-07 Doug Kwan <dougkwan@google.com>
10120
10121 * arm.cc: Replace "endianity" with "endianness" in comments.
10122 (Arm_exidx_cantunwind): Ditto.
10123 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
10124 (Arm_relobj::merge_flags_and_attributes): New method.
10125 (Arm_relobj::merge_flags_and_attributes_): New data member.
10126 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
10127 (Arm_relobj::scan_sections_for_stubs): Ditto.
10128 (Arm_relobj::do_read_symbols): Check to see if we really want to
10129 merge processor-specific flags and attributes. Exit early if
10130 an object is empty except for section names and the undefined symbol.
10131 (Target_arm::do_finalize_sections): Move check for ELF format to
10132 Arm_relobj::do_read_symbols. Merge processor specific flags and
10133 attributes from a regular object only when we have determined that
10134 it is aapropriate. Do not create an .ARM.attributes section in
10135 output if there is no regular input object.
10136 (Target_arm::merge_processor_specific_flags): Check
10137 --warn-mismatch before printing any error.
10138 (Target_arm::merge_object_attributes): Ditto.
10139 * gold.cc (queue_middle_tasks): Handle the case in which there is
10140 no regular object in input.
10141 * options.cc (General_options::parse_EB): New method.
10142 (General_options::parse_EL): Same.
10143 (General_options::General_options): Initialize endianness_.
10144 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
10145 New options.
10146 (General_options::Endianness): New enum.
10147 (General_options::endianness): New method.
10148 (General_options::endianness_): New data member.
10149 * parameters.cc (Parameters::set_options): Check target endianness.
10150 (Parameters::set_target_once): Ditto.
10151 (Parameters::check_target_endianness): New method.
10152 (parameters_force_valid_target): If either -EL or -EB is specified,
10153 use it to define endianness of default target.
10154 * parameters.h (Parameters::check_target_endianness): New method
10155 declaration.
10156 * target.h (class Target): Change "endianity" to "endianness"
10157 in comments.
10158
10159 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10160
10161 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
10162 * configure: Regenerate.
10163 * Makefile.in: Regenerate.
10164 * testsuite/Makefile.in: Regenerate.
10165
10166 2010-04-06 Cary Coutant <ccoutant@google.com>
10167
10168 gcc PR lto/42757
10169 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
10170 prevailing definitions of common symbols.
10171 * testsuite/plugin_test_6.sh: New test case.
10172 * testsuite/plugin_common_test_1.c: New test case.
10173 * testsuite/plugin_common_test_2.c: New test case.
10174 * testsuite/Makefile.am (plugin_test_6): New test case.
10175 * testsuite/Makefile.in: Regenerate.
10176
10177 2010-04-06 Nick Clifton <nickc@redhat.com>
10178
10179 * po/vi.po: New Vietnamese translation.
10180
10181 2010-03-30 Doug Kwan <dougkwan@google.com>
10182
10183 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
10184
10185 2010-03-25 Doug Kwan <dougkwan@google.com>
10186
10187 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
10188 to avoid a conversion warning on a 32-bit host.
10189
10190 2010-03-24 Ian Lance Taylor <iant@google.com>
10191
10192 * testsuite/script_test_3.t: Add a TLS segment.
10193 * testsuite/Makefile.am (check_PROGRAMS): Add
10194 tls_phdrs_script_test.
10195 (tls_phdrs_script_test_SOURCES): Define.
10196 (tls_phdrs_script_test_DEPENDENCIES): Define.
10197 (tls_phdrs_script_test_LDFLAGS): Define.
10198 (tls_phdrs_script_test_LDADD): Define.
10199 * testsuite/Makefile.in: Rebuild.
10200
10201 2010-03-23 Cary Coutant <ccoutant@google.com>
10202
10203 * fileread.cc (find_or_make_view): Fix comment.
10204
10205 2010-03-23 Ian Lance Taylor <iant@google.com>
10206
10207 * script-sections.cc (class Orphan_section_placement): Define
10208 PLACE_TLS and PLACE_TLS_BSS.
10209 (Orphan_section_placement::Orphan_section_placement): Initialize
10210 new places.
10211 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
10212 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
10213 (tls_script_test_SOURCES): Define.
10214 (tls_script_test_DEPENDENCIES): Define.
10215 (tls_script_test_LDFLAGS): Define.
10216 (tls_script_test_LDADD): Define.
10217 * testsuite/Makefile.in: Rebuild.
10218
10219 2010-03-22 Doug Kwan <dougkwan@google.com>
10220
10221 * arm.cc (Arm_relocate_functions::abs8,
10222 Arm_relocate_functions::abs16): Use correct check for overflow
10223 specified in the ARM ELF specs.
10224 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
10225 target of a BLX instruction specially.
10226 (Reloc_stub::stub_type_for_reloc): Ditto.
10227 (Relocate::relocate): Use symbolic names instead of numeric relocation
10228 codes to report error.
10229 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
10230 workaround.
10231 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
10232 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
10233 thumb2_blx_out_of_range.stdout
10234 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
10235 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
10236 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
10237 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
10238 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
10239 thumb2_blx_in_range, thumb2_blx_in_range.o,
10240 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
10241 thumb2_blx_out_of_range.o): New rules.
10242 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
10243 thumb2_blx_in_range and thumb2_blx_out_of_range.
10244 * testsuite/Makefile.in: Regenerate.
10245 * arm_branch_in_range.sh: Add tests for THUMB BLX.
10246 * testsuite/thumb_blx_in_range.s: New file.
10247 * testsuite/thumb_blx_out_of_range.s: New file.
10248
10249 2010-03-22 Rafael Espindola <espindola@google.com>
10250
10251 * archive.cc (Should_include): Move to archive.h.
10252 (should_include_member): Make it a member of Archive.
10253 (Lib_group): New.
10254 (Add_lib_group_symbols): New.
10255 * archive.h: Include options.h.
10256 (Archive_member): Moved from Archive.
10257 (Should_include): Moved from archive.cc.
10258 (Lib_group): New.
10259 (Add_lib_group_symbols): New.
10260 * dynobj.cc (do_should_include_member): New.
10261 * dynobj.h (do_should_include_member): New.
10262 * gold.cc (queue_initial_tasks): Update call to queue.
10263 * main.cc (main): Print lib group stats.
10264 * object.cc (do_should_include_member): New.
10265 * object.h: Include archive.h.
10266 (Object::should_include_member): New.
10267 (Object::do_should_include_member): New.
10268 (Sized_relobj::do_should_include_member): New.
10269 * options.cc (General_options::parse_start_lib): New.
10270 (General_options::parse_end_lib): New.
10271 (Input_arguments::add_file): Handle lib groups.
10272 (Input_arguments::start_group): Check we are not in a lib.
10273 (Input_arguments::start_lib): New.
10274 (Input_arguments::end_lib): New.
10275 * options.h (General_options): Add start_lib and end_lib.
10276 (Input_argument::lib_): New.
10277 (Input_argument::lib): New.
10278 (Input_argument::is_lib): New.
10279 (Input_file_lib): New.
10280 (Input_arguments::in_lib_): New.
10281 (Input_arguments::in_lib): New.
10282 (Input_arguments::start_lib): New.
10283 (Input_arguments::end_lib_): New.
10284 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
10285 in unused members as preempted.
10286 (Sized_pluginobj::do_should_include_member): New.
10287 * plugin.h (Sized_pluginobj::do_should_include_member): New.
10288 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
10289 return the blocker.
10290 (Read_symbols::do_whole_lib_group): New.
10291 (Read_symbols::do_lib_group): New.
10292 (Read_symbols::do_read_symbols): Handle lib groups.
10293 (Read_symbols::get_name): Handle lib groups.
10294 * readsyms.h (Read_symbols): Add an archive member pointer.
10295 (Read_symbols::do_whole_lib_group): New.
10296 (Read_symbols::do_lib_group): New.
10297 (Read_symbols::member_): New.
10298 * script.cc (read_input_script): Update call to queue_soon.
10299
10300 2010-03-19 Doug Kwan <dougkwan@google.com>
10301
10302 * arm.cc (Stub_table::Stub_table): Initialize new data members
10303 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10304 (Stub_table::add_reloc_stub): Assign stub offset and update
10305 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10306 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
10307 New data members.
10308 (Stub_table::update_data_size_and_addralign): Use
10309 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
10310 instead of going over all reloc stubs.
10311 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
10312 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10313 Stringpool_template::offset_ to size of Stringpool_char.
10314 (Stringpool_template::new_key_offset): Remove code to initialize
10315 Stringpool_template::offset_.
10316 * stringpool.h (Stringpool_template::set_no_zero_null): Set
10317 Stringpool_template::offset_ to zero.
10318
10319 2010-03-15 Doug Kwan <dougkwan@google.com>
10320
10321 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10322 offset_.
10323 (Stringpool_template::new_key_offset): New method.
10324 (Stringpool_template::add_string): Assign offsets when adding new
10325 strings.
10326 (Stringpool_template::set_string_offsets): Do not set string offsets
10327 when not optimizing.
10328 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
10329 member size_.
10330 (Chunked_vector::clear): Clear size_.
10331 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
10332 (Chunked_vector::size): Return size_.
10333 (Chunked_vector::push_back): Use size_ to find insert position.
10334 (Chunked_vector::size_): New data member.
10335 (Stringpool_template::set_no_zero_null): Assert string set is empty.
10336 (Stringpool_template::new_key_offset): New method declaration.
10337 (Stringpool_template::offset_): New data member.
10338
10339 2010-03-15 Rafael Espindola <espindola@google.com>
10340
10341 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
10342 Add_symbols' constructor.
10343 * readsyms.h (Add_symbols): Remove the input_group member.
10344
10345 2010-03-10 Ian Lance Taylor <iant@google.com>
10346
10347 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
10348 target to ask whether a reference to a symbol requires a stack
10349 split.
10350 * target.h (Target::is_call_to_non_split): New function.
10351 (Target::do_is_call_to_non_split): Declare virtual function.
10352 * target.cc: Include "symtab.h".
10353 (Target::do_is_call_to_non_split): New function.
10354 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
10355
10356 2010-03-10 Cary Coutant <ccoutant@google.com>
10357
10358 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
10359 (File_read::open[1]): Remove initial mapping of whole_file_view_.
10360 (File_read::open[2]): Add whole_file_view_ to list of views.
10361 (File_read::make_view): Remove test of whole_file_view_.
10362 (File_read::find_or_make_view): Create whole_file_view_ if
10363 necessary.
10364 (File_read::clear_views): Replace bool parameter with enum;
10365 adjust all callers. Don't delete views with permanent data;
10366 do delete cached views and views from archives if
10367 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
10368 if clearing the corresponding view.
10369 * fileread.h (File_read::Clear_views_mode): New enum.
10370 (File_read::View::is_permanent_view): New method.
10371 (File_read::clear_views): Replace bool parameter
10372 with enum; adjust all callers.
10373 * options.h (General_options): Change keep_files_mapped option;
10374 add map_whole_files.
10375 * readsyms.cc (Add_symbols::run): Delete sd_ object before
10376 releasing the file.
10377 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
10378 the file.
10379
10380 2010-03-10 David S. Miller <davem@davemloft.net>
10381
10382 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
10383
10384 2010-03-09 Sriraman Tallam <tmsriram@google.com>
10385
10386 * icf.cc (get_section_contents): Add '@' marker after processing the
10387 merge reloc.
10388
10389 2010-03-08 Doug Kwan <dougkwan@google.com>
10390
10391 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
10392 due to a conversion warning.
10393 (Arm_relobj::update_output_local_symbol_count): Check for local
10394 symbol with unset output index.
10395
10396 2010-03-05 Ian Lance Taylor <iant@google.com>
10397
10398 * options.h (class General_options): Add --spare-dynamic-tags.
10399 * output.cc (Output_data_dynamic::set_final_data_size): Implement
10400 --spare-dynamic-tags.
10401
10402 2010-03-05 Ian Lance Taylor <iant@google.com>
10403
10404 * incremental.cc: Include "libiberty.h".
10405
10406 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
10407
10408 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
10409 function, is_info_ member.
10410 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
10411 (Versions::Versions): Update caller.
10412 (Versions::define_base_version): Likewise.
10413 (Versions::add_def): Likewise.
10414
10415 2010-03-03 Sriraman Tallam <tmsriram@google.com>
10416
10417 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
10418 (Scan::possible_function_pointer_reloc): New function.
10419 (Scan::local_reloc_may_be_function_pointer): Change to call
10420 possible_function_pointer_reloc.
10421 (Scan::global_reloc_may_be_function_pointer): Ditto.
10422 * icf.h (Icf::check_section_for_function_pointers): Change to reject
10423 relocations in ".data.rel.ro._ZTV" section.
10424 * testsuite/icf_safe_so_test.sh: Change to pass i386.
10425 * testsuite/icf_safe_so_test.cc: Ditto.
10426 * testsuite/icf_safe_test.cc: Ditto.
10427 * testsuite/icf_safe_test.sh: Ditto.
10428
10429 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10430 Ian Lance Taylor <iant@google.com>
10431
10432 * target-reloc.h (relocate_section): Check the symbol table index
10433 for -1U before setting the local symbol index.
10434 (scan_relocatable_relocs): If copying the relocation, record that
10435 the local symbol is required.
10436 * object.h (Symbol_value::is_output_symtab_index_set): New
10437 function.
10438 (Symbol_value::may_be_discarded_from_output_symtab): New
10439 function.
10440 (Symbol_value::has_output_symtab_entry): New function.
10441 (Symbol_value::needs_output_symtab_entry): Remove.
10442 (Symbol_value::output_symtab_index): Make sure the symbol index is
10443 set.
10444 (Symbol_value::set_output_symtab_index): Make sure the symbol
10445 index is not set. Make sure the new index is valid.
10446 (Symbol_value::set_must_have_output_symtab_entry): New function.
10447 (Symbol_value::has_output_dynsym_entry): New function.
10448 (Symbol_value::set_output_dynsym_index): Make sure the new index
10449 is valid.
10450 (Sized_relobj::set_must_have_output_symtab_entry): New function.
10451 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
10452 local symbol if permitted.
10453 (Sized_relobj::do_finalize_local_symbols): Call
10454 is_output_symtab_index_set rather than needs_output_symtab_entry.
10455 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
10456 rather than needs_output_symtab_entry. Call
10457 has_output_dynsym_entry rather than needs_output_dynsym_entry.
10458 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
10459 is_output_symtab_index_set rather than needs_output_symtab_entry.
10460 * testsuite/discard_locals_relocatable_test.c: New file.
10461 * testsuite/discard_locals_test.sh: Test -r.
10462 * testsuite/Makefile.am (check_DATA): Add
10463 discard_locals_relocatable_test1.syms,
10464 discard_local_relocatable_test2.syms.
10465 (MOSTLYCLEANFILES): Likewise. Also add
10466 discard_locals_relocatable_test1.lout and
10467 discard_locals_relocatable_test2.out.
10468 (discard_locals_relocatable_test1.syms): New target.
10469 (discard_locals_relocatable_test.o): New target.
10470 (discard_locals_relocatable_test1.out): New target.
10471 (discard_locals_relocatable_test2.syms): New target.
10472 (discard_locals_relocatable_test2.out): New target.
10473 (various): Add missing ../ld-new dependencies.
10474 * testsuite/Makefile.in: Rebuild.
10475
10476 2010-03-03 Nick Clifton <nickc@redhat.com>
10477
10478 * po/fi.po: New Finnish translation.
10479
10480 2010-03-01 Doug Kwan <dougkwan@google.com>
10481
10482 * layout.cc (Layout::Layout): Force section types of .init_array*,
10483 .preinit_array* and .fini_array* sections.
10484 * output.cc (Output_section::Input_section_sort_entry::has_priority):
10485 Fix check of return value of std::string::find.().
10486 (Output_section::Input_section_sort_compare::operator()): Remove
10487 comment about .init_array.
10488 (Output_section::Input_section_sort_init_fini_compare::operator()):
10489 New method.
10490 (Output_section::sort_attached_input_sections): Handle .init_array
10491 and .fini_array specially.
10492 * output.h (Output_section::Inut_section_sort_compare): Update
10493 comment.
10494 (Output_section::Input_section_sort_init_fini_compare): New struct.
10495
10496 2010-02-26 Doug Kwan <dougkwan@google.com>
10497
10498 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
10499 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
10500 * testsuite/debug_msg.sh: Avoid matching source line number for
10501 use of global variable undef_int.
10502
10503 2010-02-26 Doug Kwan <dougkwan@google.com>
10504
10505 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
10506 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
10507 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
10508 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
10509 * options.cc (General_options::General_options): Initialize member
10510 fix_v4bx_.
10511 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
10512 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
10513 and rm_no_fix_v4bx.stdout
10514 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
10515 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
10516 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
10517 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
10518 and arm_no_fix_v4bx.
10519 * Makefile.in: Regenerate.
10520 * testsuite/arm_fix_v4bx.s: New file.
10521 * testsuite/arm_fix_v4bx.sh: Ditto.
10522
10523 2010-02-24 Doug Kwan <dougkwan@google.com>
10524
10525 * arm.cc (Target_arm::got_section): Make the .got section the first
10526 non RELRO section in the data segment.
10527 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
10528 suffixes of section names.
10529
10530 2010-02-24 Doug Kwan <dougkwan@google.com>
10531
10532 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
10533 flags and attributes merging if an input file is a binary file.
10534 * fileread.cc (Input_file::open): Record format of original file.
10535 * fileread.h (Input_file::Format): New enum type.
10536 (Input_file::Input_file): Initialize data member format_.
10537 (Input_file::format): New method definition.
10538 (Input_file::format_):: New data member.
10539
10540 2010-02-24 Doug Kwan <dougkwan@google.com>
10541
10542 * arm.cc (Arm_output_data_got): New class.
10543 (ARM_TCB_SIZE): New constant
10544 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
10545 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
10546 If user uses a script with a SECTIONS clause, issue only a warning
10547 for a misplaced EXIDX input section. Otherwise, issue an error.
10548 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
10549 garbage collection.
10550 (Target_arm::got_mode_index_entry): Handle static linking.
10551 (Target_arm::Scan::local): Ditto.
10552 (Target_arm::Scan::global): Ditto.
10553 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
10554 all incorrectly implemented relocations.
10555 (Target_arm::fix_exidx_coverage): Pass layout to
10556 Arm_output_section::fix_exidx_coverage.
10557 * layout.cc (Layout::section_name_mapping): Remove trailing dots
10558 from ".ARM.exidx." and ".ARM.extab.".
10559
10560 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10561
10562 * arm.cc (Target_arm::do_finalize_sections): Create attribute
10563 section if it does not already exist.
10564 * attributes.cc (Attributes_section_data::Attributes_section_data):
10565 Don't crash if size is zero.
10566
10567 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10568 Ian Lance Taylor <iant@google.com>
10569
10570 * gold.cc (queue_middle_tasks): If no input files were opened,
10571 exit.
10572 * workqueue.h (Task_function::Task_function): Assert that there is
10573 a blocker.
10574
10575 2010-02-22 Doug Kwan <dougkwan@google.com>
10576
10577 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
10578 * icf.cc (get_section_contents): Cast snprintf arguments to long long
10579 types to avoid warnings due to different uint64_t implementations
10580 on different hosts.
10581
10582 2010-02-21 Doug Kwan <dougkwan@google.com>
10583
10584 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
10585 handling of the maximum backward branch offset.
10586 (Arm_relocate_functions::thumb_branch_common): Ditto.
10587 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
10588 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
10589 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
10590 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
10591 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
10592 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
10593 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
10594 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
10595 thumb_bl_out_of_range thumb_bl_out_of_range.o,
10596 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
10597 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
10598 thumb2_bl_out_of_range.o): New rules.
10599 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
10600 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
10601 thumb2_bl_out_of_range
10602 * testsuite/Makefile.in: Regenerate.
10603 * testsuite/arm_bl_in_range.s: New file.
10604 * testsuite/arm_bl_out_of_range.s: Ditto.
10605 * testsuite/arm_branch_in_range.sh: Ditto.
10606 * testsuite/arm_branch_range.t: Ditto.
10607 * testsuite/thumb2_branch_range.t: Ditto.
10608 * testsuite/thumb_bl_in_range.s: Ditto.
10609 * testsuite/thumb_bl_out_of_range.s: Ditto.
10610 * testsuite/thumb_branch_range.t: Ditto.
10611
10612 2010-02-20 Sriraman Tallam <tmsriram@google.com>
10613
10614 * gc.h (gc_process_relocs): Change vectors to point to the new list.
10615 Add reloc offset information.
10616 * icf.cc (get_section_contents): Change iterators to point to the new
10617 vectors. Add reloc offset information to the contents.
10618 * icf.h (Icf::Sections_reachable_info): New typedef.
10619 (Icf::Sections_reachable_list): New typedef.
10620 (Icf::Offset_info): New typedef.
10621 (Icf::Reloc_info): New struct typedef.
10622 (Icf::Reloc_info_list): New typedef.
10623 (Icf::symbol_reloc_list): Delete method.
10624 (Icf::addend_reloc_list): Delete method.
10625 (Icf::section_reloc_list): Delete method.
10626 (Icf::reloc_info_list): New method.
10627 (Icf::reloc_info_list_): New member.
10628
10629 2010-02-19 Doug Kwan <dougkwan@google.com>
10630
10631 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
10632 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
10633 * arm.cc (Arm_relocation_functions): New forward declaration.
10634 (Target_arm::Target_arm): Initialize new data members
10635 got_mod_index_offset_ and tls_base_symbol_defined_.
10636 (Target_arm::Relocate::relocate_tls): New method.
10637 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
10638 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
10639 New methods.
10640 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
10641 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
10642 (Target_arm::got_mod_index_offset_,
10643 Target_arm::tls_base_symbol_defined_): New data members.
10644 (Target_arm::Scan::local, Target::Scan::global,
10645 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
10646 relocations.
10647
10648 2010-02-18 Doug Kwan <dougkwan@google.com>
10649
10650 * arm.cc (Arm_relobj::find_linked_text_section): New method.
10651 (Arm_relobj::make_exidx_input_section): Pass section index of linked
10652 text section as a parameter becuase some broken tools may not set
10653 the link in section header.
10654 (Target_arm::has_got_section): New method.
10655 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
10656 without any mapping symbol as data only. Remove warning.
10657 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
10658 link in its section header, try to discover the link by inspecting the
10659 REL31 relocation at the beginning of the section.
10660 (Target_arm::Scan::check_non_pic): Report name of offending relocation
10661 in error message.
10662 (Target_arm::Scan::global): Treat any reference to the symbol
10663 _GLOBAL_OFFSET_TABLE_ as a GOT access.
10664
10665 2010-02-12 Sriraman Tallam <tmsriram@google.com>
10666
10667 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
10668 (Scan::global_reloc_may_be_function_pointer): New function.
10669 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10670 (Scan::global_reloc_may_be_function_pointer): New function.
10671 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10672 (Scan::global_reloc_may_be_function_pointer): New function.
10673 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
10674 (Scan::global_reloc_may_be_function_pointer): New function.
10675 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
10676 (Scan::global_reloc_may_be_function_pointer): New function.
10677 (Scan::possible_function_pointer_reloc): New function.
10678 (Target_x86_64::can_check_for_function_pointers): New function.
10679 * gc.h (gc_process_relocs): Scan relocation types to determine if
10680 function pointers were taken for targets that support it.
10681 * icf.cc (Icf::find_identical_sections): Include functions for
10682 folding in safe ICF whose pointer is not taken.
10683 * icf.h (Secn_fptr_taken_set): New typedef.
10684 (fptr_section_id_): New member.
10685 (section_has_function_pointers): New function.
10686 (set_section_has_function_pointers): New function.
10687 (check_section_for_function_pointers): New function.
10688 * options.h: Fix comment for safe ICF option.
10689 * target.h (can_check_for_function_pointers): New function.
10690 * testsuite/Makefile.am: Add icf_safe_so_test test case.
10691 Modify icf_safe_test for X86-64.
10692 * testsuite/Makefile.in: Regenerate.
10693 * testsuite/icf_safe_so_test.cc: New file.
10694 * testsuite/icf_safe_so_test.sh: New file.
10695 * testsuite/icf_safe_test.cc (kept_func_3): New function.
10696 (main): Change to take pointer to function kept_func_3.
10697 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
10698 folding is done correctly for X86-64.
10699
10700 2010-02-12 David S. Miller <davem@davemloft.net>
10701
10702 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
10703 is_symbolless parameter.
10704 (Output_reloc<SHT_REL>::is_symbolless): New.
10705 (Output_reloc<SHT_REL>::is_symbolless_): New.
10706 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
10707 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
10708 (Output_reloc<SHT_RELA>::is_symbolless): New.
10709 (Output_data_reloc::add_global): Handle is_symbolless.
10710 (Output_data_reloc::add_global_relative): Likewise.
10711 (Output_data_reloc::add_local): Likewise.
10712 (Output_data_reloc::add_local_relative): Likewise.
10713 (Output_data_reloc::add_symbolless_global_addend): New.
10714 (Output_data_reloc::add_symbolless_local_addend): New.
10715 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
10716 is_symbolless.
10717 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
10718 instead of ->is_relative_
10719 (Output_reloc::write): Likewise.
10720 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
10721 (Output_reloc::write_rel): Simplify.
10722
10723 * sparc.cc (Target_sparc::Scan::local): Use
10724 ->add_symbolless_local_addend as needed.
10725 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
10726 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
10727 based upon relocation offset.
10728
10729 2010-02-11 Doug Kwan <dougkwan@google.com>
10730
10731 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
10732 (Target_arm::Scan::global): Ditto. Also remove a comment before the
10733 beginning of function.
10734 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
10735 and MOVT_ABS relocations. Those are non issued in scanning. Fix
10736 parameter is_32bit in calls to should_apply_static_reloc.
10737 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
10738 (check_DATA): Add arm_abs_global.stdout.
10739 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
10740 arm_abs_global.stdout): New rules.
10741 (MOSTLLYCLEANFILES): Add arm_abs_global
10742 * Makefile.in: Regenerate.
10743 * testsuite/arm_abs_global.s: New file.
10744 * testsuite/arm_abs_global.sh: Ditto.
10745 * testsuite/arm_abs_lib.s: Ditto.
10746
10747 2010-02-11 Ian Lance Taylor <iant@google.com>
10748
10749 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
10750 Read_relocs task.
10751 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
10752 Allocate_commons_task first.
10753 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
10754 task, rather than symtab_lock_.
10755 (Gc_process_relocs::~Gc_process_relocs): New function.
10756 (Gc_process_relocs::is_runnable): Check this_blocker_.
10757 (Gc_process_relocs::locks): Use next_blocker_ rather than
10758 blocker_.
10759 (Scan_relocs::~Scan_relocs): New function.
10760 (Scan_relocs::is_runnable): Check this_blocker_ rather than
10761 symtab_lock_.
10762 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
10763 next_blocker_.
10764 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
10765 fields. Add this_blocker_ and next_blocker_ fields. Adjust
10766 constructor accordingly.
10767 (class Gc_process_relocs): Likewise.
10768 (class Scan_relocs): Likewise.
10769 * common.h (class Allocate_commons_task): Remove symtab_lock_
10770 field, and corresponding constructor parameter.
10771 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
10772 symtab_lock_.
10773 (Allocate_commons_task::locks): Likewise.
10774
10775 2010-02-11 Ian Lance Taylor <iant@google.com>
10776
10777 * gold-threads.h (class Once): Define.
10778 (class Initialize_lock): Rewrite as child of Once.
10779 * gold-threads.cc (class Once_initialize): Define.
10780 (once_pointer_control): New static variable.
10781 (once_pointer, once_arg): New static variables.
10782 (c_run_once): New static function.
10783 (Once::Once, Once::run_once, Once::internal_run): New functions.
10784 (class Initialize_lock_once): Remove.
10785 (initialize_lock_control): Remove.
10786 (initialize_lock_pointer): Remove.
10787 (initialize_lock_once): Remove.
10788 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
10789 (Initialize_lock::initialize): Rewrite.
10790 (Initialize_lock::do_run_once): New function.
10791 * archive.cc (Archive::interpret_header): Only clear name if it is
10792 not already empty.
10793 * fileread.cc: Include "gold-threads.h"
10794 (file_counts_lock): New static variable.
10795 (file_counts_initialize_lock): Likewise.
10796 (File_read::release): Only increment counts when using --stats.
10797 Use a lock around the increment.
10798 * parameters.cc (class Set_parameters_target_once): Define.
10799 (set_parameters_target_once): New static variable.
10800 (Parameters::Parameters): Move here from parameters.h.
10801 (Parameters::set_target): Rewrite.
10802 (Parameters::set_target_once): New function.
10803 (Parameters::clear_target): Move here and rewrite.
10804 * parameters.h (class Parameters): Update declarations. Add
10805 set_parameters_target_once_ field.
10806 (Parameters::Parameters): Move to parameters.cc.
10807 (Parameters::clear_target): Likewise.
10808 * readsyms.cc (Read_symbols::do_group): Create a Start_group
10809 task.
10810 (Start_group::~Start_group): New function.
10811 (Start_group::is_runnable): New function.
10812 (Start_group::locks, Start_group::run): New functions.
10813 (Finish_group::run): Change saw_undefined to size_t.
10814 * readsyms.h (class Start_group): Define.
10815 (class Finish_group): Change saw_undefined_ field to size_t.
10816 (Finish_group::Finish_group): Remove saw_undefined and
10817 this_blocker parameters. Change all callers.
10818 (Finish_group::set_saw_undefined): New function.
10819 (Finish_group::set_blocker): New function.
10820 * symtab.h (class Symbol_table): Change saw_undefined to return
10821 size_t. Change saw_undefined_ field to size_t.
10822 * target-select.cc (Set_target_once::do_run_once): New function.
10823 (Target_selector::Target_selector): Initialize set_target_once_
10824 field. Don't initialize lock_ and initialize_lock_ fields.
10825 (Target_selector::instantiate_target): Rewrite.
10826 (Target_selector::set_target): New function.
10827 * target-select.h (class Set_target_once): Define.
10828 (class Target_selector): Update declarations. Make
10829 Set_target_once a friend. Remove lock_ and initialize_lock_
10830 fields. Add set_target_once_ field.
10831
10832 2010-02-10 Ian Lance Taylor <iant@google.com>
10833
10834 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
10835 queueing any tasks.
10836 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
10837 (queue_middle_tasks): Add all blockers before queueing any tasks.
10838 (queue_final_tasks): Likewise.
10839 * token.h (Task_token::add_blockers): New function.
10840 * object.h (Input_objects::number_of_relobjs): New function.
10841
10842 2010-02-10 Ian Lance Taylor <iant@google.com>
10843
10844 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
10845 shared, not if not position independent.
10846 * x86_64.cc (Relocate::relocate_tls): Likewise.
10847 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
10848 (tls_pie_pic_test): New target.
10849 * testsuite/Makefile.in: Rebuild.
10850
10851 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
10852 (tls_test_main_pie.o, tls_test_pie.o): New targets.
10853 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
10854 * testsuite/Makefile.in: Rebuild.
10855
10856 2010-02-09 David S. Miller <davem@davemloft.net>
10857
10858 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
10859 R_SPARC_RELATIVE using ->add_local_relative().
10860 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
10861
10862 * output.h (Output_data_dynamic::add_section_size): New method
10863 that takes two Output_data objects.
10864 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
10865 entry param. Handle it in initializers.
10866 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
10867 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
10868 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
10869 arg.
10870 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
10871 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
10872 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
10873 for dynrel_includes_plt.
10874 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10875 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10876 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
10877 before .rela.plt
10878 (Target_sparc::do_finalize_sections): Update to pass true for
10879 dynrel_includes_plt.
10880 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
10881 output before .rela.plt
10882 (Target_powerpc::do_finalize_sections): Update to pass true for
10883 dynrel_includes_plt when 32-bit.
10884
10885 2010-02-08 Doug Kwan <dougkwan@google.com>
10886
10887 * arm.cc (Arm_relobj::simple_input_section_output_address): New
10888 method.
10889 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
10890 Arm_relobj::scan_section_for_cortex_a8_stubs,
10891 Arm_relobj::do_relocation_section): Instead of calling
10892 Output_section::output_address, use faster
10893 Arm_relobj::simple_input_section_output_address.
10894
10895 2010-02-08 David S. Miller <davem@davemloft.net>
10896
10897 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
10898 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
10899 relocation helper function.
10900
10901 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
10902 just like R_SPARC_GOT{10,13,22}.
10903 (Target_sparc::Scan::local): Likewise.
10904 (Target_sparc::Relocate:relocate): Likewise.
10905
10906 2010-02-06 Ian Lance Taylor <iant@google.com>
10907
10908 * configure.ac: Rewrite targetobjs duplicate removal code to use
10909 only shell constructs.
10910 * configure: Rebuild.
10911
10912 2010-02-05 Doug Kwan <dougkwan@google.com>
10913
10914 PR 11247
10915 * arm.cc (Arm_relobj::section_is_scannable): New method.
10916 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
10917 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
10918
10919 2010-02-04 Doug Kwan <dougkwan@google.com>
10920
10921 PR 11247
10922 * arm-reloc-property.cc (cstdio): Include.
10923 * configure.ac (targetobjs): Remove duplicates.
10924 * configure: Regenerate.
10925 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
10926 big and little endian version for a given address size.
10927
10928 2010-02-03 Doug Kwan <dougkwan@google.com>
10929
10930 * arm-reloc-property.cc
10931 (Arm_reloc_property_table::reloc_name_in_error_message): New method
10932 definition.
10933 * arm-reloc-property.h
10934 (Arm_reloc_property_table::get_implemented_static_reloc_property):
10935 New method definition.
10936 (Arm_reloc_property_table::reloc_name_in_error_message): New method
10937 declaration.
10938 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
10939 overflow to N.
10940 (GOT_PREL): Change implemented to Y.
10941 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
10942 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
10943 (Arm_relocate_functions::movw_abs_nc): Remove method.
10944 (Arm_relocate_functions::movt_abs): Ditto.
10945 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
10946 (Arm_relocate_functions::thm_movt_abs): Ditto.
10947 (Arm_relocate_functions::movw_rel_nc): Ditto.
10948 (Arm_relocate_functions::movw_rel): Ditto.
10949 (Arm_relocate_functions::movt_rel): Ditto.
10950 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
10951 (Arm_relocate_functions:thm_movw_rel): Ditto.
10952 (Arm_relocate_functions:thm_movt_rel): Ditto.
10953 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
10954 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
10955 New method definitions.
10956 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
10957 (Arm_relocation_functions::arm_grp_ldr): Ditto.
10958 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
10959 (Arm_relocation_functions::arm_grp_ldc): Ditto.
10960 (Target_arm::Relocate::relocate): Check for non-static or
10961 unimplemented relocation code and exit early. Change calls to
10962 Target_arm::reloc_uses_thumb_bit and
10963 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
10964 instead. Refactor code to handle similar relocations to increase
10965 code sharing. Remove check for unsupported relocation code in switch
10966 statement.
10967 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
10968 relocation property table to find out size. Change error message to
10969 print out the name of a relocation code instead of the numeric value.
10970 (Target_arm::scan_reloc_for_stub): Use relocation property table
10971 instead of calling Target_arm::reloc_uses_thumb_bit().
10972
10973 2010-02-02 Doug Kwan <dougkwan@google.com>
10974
10975 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
10976 types of relaxed input section.
10977
10978 2010-02-02 Doug Kwan <dougkwan@google.com>
10979
10980 * Makefile.am (HFILES): Add arm-reloc-property.h.
10981 (DEFFILES): New.
10982 (TARGETSOURCES): Add arm-reloc-property.cc
10983 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
10984 (libgold_a_SOURCES): $(DEFFILES)
10985 * Makefile.in: Regenerate.
10986 * arm-reloc-property.cc: New file.
10987 * arm-reloc-property.h: New file.
10988 * arm-reloc.def: New file.
10989 * arm.cc: Update comments.
10990 (arm-reloc-property.h): New included header.
10991 (arm_reloc_property_table): New global variable.
10992 (Target_arm::do_select_as_default_target): New method definition.
10993 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
10994 arm-reloc-property to targ_extra_obj.
10995 * parameters.cc (set_parameters_target): Call
10996 Target::select_as_default_target().
10997 * target.h (Target::select_as_default_target): New method definition.
10998 (Target::do_select_as_default_target): Same.
10999
11000 2010-02-01 Doug Kwan <dougkwan@google.com>
11001
11002 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
11003 first_output_text_section_.
11004 (Arm_exidx_fixup::first_output_text_section): New method definition.
11005 (Arm_exidx_fixup::first_output_text_section_): New data member.
11006 (Arm_exidx_fixup::process_exidx_section): Record the first text
11007 output section seen.
11008 (Arm_output_section::fix_exidx_coverage): Set correct linked section
11009 and entsize in output section header.
11010
11011 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11012
11013 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
11014 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
11015 (Arm_relocate_functions::thm_alu11): New Method.
11016 (Arm_relocate_functions::thm_pc8): New Method.
11017 (Arm_relocate_functions::thm_pc12): New Method.
11018 (Target_arm::Scan::local): Handle the relocations.
11019 (Target_arm::Scan::global): Likewise.
11020 (Target_arm::Relocate::relocate): Likewise.
11021 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11022
11023 2010-01-29 Doug Kwan <dougkwan@google.com>
11024
11025 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
11026 of relocation types as ld.
11027
11028 2010-01-29 Doug Kwan <dougkwan@google.com>
11029
11030 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
11031 to public.
11032 (Arm_relocate_functions::thumb_branch_common): Ditto.
11033 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
11034 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
11035 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
11036 Arm_relocate_functions::jump24): Remove.
11037 (Target_arm::Relocate::relocate): Adjust code to call
11038 Arm_relocation_functions::arm_branch_common and
11039 Arm_relocation_functions::thumb_branch_common instead of their removed
11040 wrappers. Merge switch-cases together to reduce source code size.
11041
11042 2010-01-29 Doug Kwan <dougkwan@google.com>
11043
11044 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
11045 output_local_symbol_count_needs_update_.
11046 (Arm_relobj::output_local_symbol_count_needs_update,
11047 Arm_relobj::set_output_local_symbol_count_needs_update,
11048 Arm_relobj::update_output_local_symbol_count): New methods.
11049 (Arm_relobj::output_local_symbol_count_needs_update_): New data
11050 member.
11051 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
11052 of pointed function as in a R_ARM_PREL31 relocation.
11053 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
11054 for output local symbol count updating.
11055 (Target_arm::do_relax): Update output local symbol counts in objects
11056 if necessary.
11057 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
11058
11059 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11060
11061 * arm.cc: Added support for the ARM relocations:
11062 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
11063 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
11064 (Arm_relocate_functions::movw_rel_nc): Renamed (was
11065 movw_prel_nc).
11066 (Arm_relocate_functions::movw_rel): New method.
11067 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
11068 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
11069 thm_movw_prel_nc).
11070 (Arm_relocate_functions::thm_movw_rel): New method.
11071 (Arm_relocate_functions::thm_movt_rel): Renamed (was
11072 thm_movt_prel).
11073 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
11074 relocations.
11075 (Target_arm::Scan::global): Likewise.
11076 (Target_arm::Relocate::relocate): Likewise.
11077 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11078 Likewise.
11079
11080 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11081
11082 * arm.cc: Added support for ARM group relocations.
11083 (Target_arm::reloc_needs_sym_origin): New method.
11084 (Arm_relocate_functions::calc_grp_kn): New method.
11085 (Arm_relocate_functions::calc_grp_residual): New method.
11086 (Arm_relocate_functions::calc_grp_gn): New method.
11087 (Arm_relocate_functions::arm_grp_alu): New Method.
11088 (Arm_relocate_functions::arm_grp_ldr): New Method.
11089 (Arm_relocate_functions::arm_grp_ldrs): New Method.
11090 (Arm_relocate_functions::arm_grp_ldc): New Method.
11091 (Target_arm::Scan::local): Handle the ARM group relocations.
11092 (Target_arm::Scan::global): Likewise.
11093 (Target_arm::Relocate::relocate): Likewise.
11094 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11095 Likewise.
11096
11097 2010-01-26 Doug Kwan <dougkwan@google.com>
11098
11099 * arm.cc (set): Include.
11100 (class Arm_exidx_fixup): Change type of last_input_section_ to const
11101 pointer type.
11102 (Arm_output_section::Text_section_list): New type.
11103 (Arm_output_section::append_text_sections_to_list): New method.
11104 (Arm_output_section::fix_exidx_coverage): Ditto.
11105 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
11106 (Arm_relobj::convert_input_section_to_relaxed_section): Use
11107 Relobj::set_section_offset() instead of
11108 Sized_relobj::invalidate_section_offset().
11109 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
11110 parameter for section headers. Ignore relocation sections for
11111 unallocated sections and EXIDX sections.
11112 (Target_arm::fix_exidx_coverage): New method.
11113 (Target_arm::output_section_address_less_than): New type.
11114 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
11115 linked text section instead of the EXIDX section.
11116 (Arm_output_section::create_stub_group): Add an assertion to check
11117 that this is not an EXIDX output section.
11118 (Arm_output_section::append_text_sections_to_list): New method.
11119 (Arm_output_section::fix_exidx_coverage): Ditto.
11120 (Arm_relobj::scan_sections_for_stubs): Adjust call to
11121 Arm_relobj::section_needs_reloc_stub_scanning.
11122 (Target_arm::do_relax): Fix EXIDX output section coverage in the
11123 first pass.
11124 (Target_arm::fix_exidx_coverage): New method.
11125 * object.h (Relobj::set_output_section): New method.
11126 (Sized_relobj::invalidate_section_offset): Remove method.
11127 (Sized_relobj::do_invalidate_section_offset): Remove method.
11128 (Sized_relobj::do_set_section_offset): Handle offset value -1.
11129
11130 2010-01-25 Doug Kwan <dougkwan@google.com>
11131
11132 * arm.cc (Arm_exidx_merged_section::do_output_offset):
11133 Fix warning due to signed and unsigned comparison on a 32-bit host.
11134
11135 2010-01-22 Doug Kwan <dougkwan@google.com>
11136
11137 * arm.cc (Target_arm::do_relax): Record an output section for section
11138 offset adjustment it contains any stub table that has changed.
11139 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
11140 offsets in an output section if necessary.
11141 * output.cc (Output_section::Output_section): Initialize
11142 section_offsets_need_adjustments_.
11143 (Output_section::add_input_section_for_script): Renamed to
11144 Output_section::add_simple_input_section.
11145 (Output_section::save_states): Add a comment.
11146 (Output_section::discard_states): New method defintion.
11147 (Output_section::adjust_section_offsets): Same.
11148 * output.h (Output_section::add_input_section_for_script): Renamed to
11149 Output_section::add_simple_input_section.
11150 (Output_section::discard_states): New method declaration.
11151 (Output_section::adjust_section_offsets): Same.
11152 (Output_section::section_offsets_need_adjustment,
11153 Output_section::set_section_offsets_need_adjustment): New method
11154 definitions.
11155 (Output_section::section_offsets_need_adjustment_): New data member.
11156 * script-sections.cc
11157 (Output_section_element_input::set_section_address): Adjust code for
11158 renaming of Output_section::add_input_section_for_script.
11159 (Orphan_output_section::set_section_address): Same.
11160
11161 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11162
11163 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
11164 Fix_v4bx enum values .
11165 * gold/options.h (General_options): New option definitions.
11166 (General_options::fix_v4bx): New method.
11167 (General_options::Fix_v4bx): New enum.
11168 * gold/options.cc (General_options::parse_fix_v4bx): New method.
11169 (General_options::parse_fix_v4bx_interworking): New method.
11170
11171 2010-01-22 Doug Kwan <dougkwan@google.com>
11172
11173 * arm.cc (Arm_exidx_fixup): New class.
11174
11175 2010-01-21 Doug Kwan <dougkwan@google.com>
11176
11177 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
11178 classes.
11179 (Arm_exidx_section_offset_map): New type.
11180
11181 2010-01-21 Doug Kwan <dougkwan@google.com>
11182
11183 * arm.cc (Arm_exidx_input_section): New class.
11184 (Arm_relobj::exidx_input_section_by_link,
11185 Arm_relobj::exidx_input_section_by_shndx,
11186 Arm_relobj::make_exidx_input_section): New methods.
11187 (read_arm_attributes_section): Remove.
11188 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
11189 information about them.
11190 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
11191 to here.
11192
11193 2010-01-20 Doug Kwan <dougkwan@google.com>
11194
11195 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
11196 Input_section_specifier to Section_id.
11197 (Target_arm::new_arm_input_section: Adjust code for change of key
11198 type.
11199 (Target_arm::find_arm_input_section): Ditto.
11200 * gc.h (object.h): Include for Section_id nand Section_id_hash.
11201 (Section_id): Remove.
11202 (Garbage_collection::Section_id_hash): Remove.
11203 * icf.h (object.h): Include for Section_id nand Section_id_hash.
11204 (Section_id): Remove.
11205 (Icf::Section_id_hash): Remove.
11206 * object.h (Section_id, Const_section_id, Section_id_hash,
11207 Const_section_id_hash): New type definitions.
11208 * output.cc (Output_section::add_relaxed_input_section): Change to
11209 use Const_section_id instead of Input_section_specifier as key type.
11210 (Output_section::add_merge_input_section): Ditto.
11211 (Output_section::build_relaxation_map): Change to use Section_id
11212 instead of Input_section_specifier as key type.
11213 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11214 Ditto.
11215 (Output_section::convert_input_sections_to_relaxed_sections): Change
11216 to use Const_section_id instead of Input_section_specifier as key type.
11217 (Output_section::find_merge_section): Ditto.
11218 (Output_section::find_relaxed_input_section): Ditto.
11219 * output.h (Input_section_specifier): Remove class.
11220 (Output_section::Output_section_data_by_input_section_map): Change
11221 key type to Const_section_id.
11222 (Output_section::Output_relaxed_input_section_by_input_section_map):
11223 Ditto.
11224 (Output_section::Relaxation_map): Change key type to Section_id.
11225
11226 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11227
11228 * gold/arm.cc: Added support for R_ARM_V4BX relocation
11229 (class Arm_v4bx_stub): New class.
11230 (DEF_STUBS): Updated definition to support v4_veneer_bx.
11231 (Stub_factory::make_arm_v4bx_stub): New method.
11232 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
11233 (Stub_table::empty): Handle v4bx stubs.
11234 (Stub_table::add_arm_v4bx_stub): New method.
11235 (Stub_table::find_arm_v4bx_stub): New method.
11236 (Arm_relocate_functions::v4bx): New method.
11237 (Target_arm::fix_v4bx): New method.
11238 (Target_arm::Target_arm): Handle R_ARM_V4BX.
11239 (Stub_table::relocate_stubs): Likewise.
11240 (Stub_table::do_write): Likewise.
11241 (Stub_table::update_data_size_and_addralign): Likewise.
11242 (Stub_table::finalize_stubs): Likewise.
11243 (Target_arm::Scan::local): Likewise.
11244 (Target_arm::Scan::global): Likewise.
11245 (Target_arm::do_finalize_sections): Likewise.
11246 (Target_arm::Relocate::relocate): Likewise.
11247 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11248 Likewise.
11249 (Target_arm::scan_reloc_for_stub): Likewise.
11250 (Target_arm::scan_reloc_section_for_stubs): Likewise.
11251
11252 2010-01-19 Ian Lance Taylor <iant@google.com>
11253
11254 * output.cc (Output_section_headers::do_sized_write): Write large
11255 segment count to sh_info field.
11256 (Output_file_header::do_sized_write): For large segment count,
11257 write PN_XNUM to e_phnum field.
11258
11259 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11260
11261 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
11262 (Arm_relocate_functions::thm_jump8): New function.
11263 (Arm_relocate_functions::thm_jump11): New function.
11264 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
11265 R_ARM_THM_JUMP11.
11266 (Target_arm::Scan::global): Likewise.
11267 (Target_arm::Relocate::relocate): Likewise.
11268 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11269 Likewise.
11270
11271 2010-01-14 Doug Kwan <dougkwan@google.com>
11272
11273 * arm.cc (map, utility): Include headers.
11274 (Target_arm::apply_cortex_a8_workaround): New method.
11275 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
11276 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
11277 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
11278 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
11279 the --[no-]fix-cortex-a8 command line options.
11280 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
11281 (Target_arm::relocate_stub): Use addend in instruction template.
11282 * options.h (DEFINE_bool): Set the user-set flag.
11283 (General_options): Add --[no-]-fix-cortex options.
11284 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
11285 : Update fast look-up map after conversion.
11286
11287 2010-01-14 Sriraman Tallam <tmsriram@google.com>
11288
11289 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
11290 in the first pass of do_layout.
11291
11292 2010-01-13 Doug Kwan <dougkwan@google.com>
11293
11294 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11295 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
11296 apparent compiler problem of not folding static constant integral
11297 data members of elfcpp::Elf_sizes<32>.
11298
11299 2010-01-13 Doug Kwan <dougkwan@google.com>
11300
11301 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11302 Arm_relobj::section_needs_cortex_a8_stub_scanning,
11303 Arm_relobj::scan_section_for_cortex_a8_erratum,
11304 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
11305 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
11306 sections to scan for relocation stubs into a new method
11307 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
11308 relocation and Cortex-A8 stub scanning.
11309 (Target_arm::do_relax): Force stubs to be after stubbed sections
11310 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
11311 the beginning of a new relaxation pass. Update a comment.
11312 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
11313
11314 2010-01-12 Ian Lance Taylor <iant@google.com>
11315
11316 * target-reloc.h (visibility_error): New inline function.
11317 (relocate_section): Call visibility_error.
11318 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
11319 (MOSTLYCLEANFILES): Likewise.
11320 (protected_4_pic.o, protected_3.err): New targets.
11321 * testsuite/protected_4.cc: New file.
11322
11323 2010-01-12 Doug Kwan <dougkwan@google.com>
11324
11325 * arm.cc (Cortex_a8_reloc): New class.
11326 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
11327 and cortex_a8_relocs_info_.
11328 (Target_arm::fix_cortex_a8): New method definition.
11329 (Target_arm::Cortex_a8_relocs_info): New type.
11330 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
11331 New data member declarations.
11332 (Target_arm::scan_reloc_for_stub): Record information about
11333 relocations for THUMB branches that might be exempted from the
11334 Cortex-A8 workaround.
11335 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
11336 at the beginning of a relaxation pass.
11337
11338 2010-01-12 Doug Kwan <dougkwan@google.com>
11339
11340 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
11341 (Arm_relobj::Mapping_symbol_position,
11342 Arm_reloj::Mapping_symbol_position_less,
11343 Arm_relobj::Mapping_symbols_info): New types.
11344 (Target_arm::is_mapping_symbol_name): New method definition.
11345 (Arm_relobj::do_count_local_symbols): Save information about mapping
11346 symbols.
11347
11348 2010-01-11 Doug Kwan <dougkwan@google.com>
11349
11350 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
11351 Arm_relocate_functions::thumb32_branch_upper,
11352 Arm_relocate_functions::thumb32_branch_lower,
11353 Arm_relocate_functions::thumb32_cond_branch_offset,
11354 Arm_relocate_functions::thumb32_cond_branch_upper,
11355 Arm_relocate_functions::thumb32_cond_branch_lower,
11356 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
11357 branch offset encoding.
11358 (Arm_relocate_functions::thumb_branch_common): Use new branch
11359 offset encoding methods to avoid code duplication.
11360 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
11361 (Stub_addend_reader::operator()): Use new branch encoding method
11362 to avoid code duplication.
11363
11364 2010-01-11 Doug Kwan <dougkwan@google.com>
11365
11366 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
11367 (Target_arm::do_finalize_sections): Define special EXIDX section
11368 symbols only if referenced.
11369 * gc.h (Garbage_collection::add_reference): New method.
11370 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
11371 code duplication.
11372
11373 2010-01-11 Ian Lance Taylor <iant@google.com>
11374
11375 * script.cc (Version_script_info::build_expression_list_lookup):
11376 Change complaing about duplicate wildcard match from error to
11377 warning.
11378
11379 * script.cc (class Lazy_demangler): Recreate--revert part of patch
11380 of 2009-12-30.
11381 (Version_script_info::Version_script_info): Initialize globs_,
11382 default_version_, default_is_global_, and exact_. Don't
11383 initialize globals_ or locals_.
11384 (Version_script_info::build_lookup_tables): Build local symbols
11385 first.
11386 (Version_script_info::unquote): New function.
11387 (Version_script_info::add_exact_match): New function.
11388 (Version_script_info::build_expression_list_lookup): Remove lookup
11389 parameter. Add is_global parameter. Change all callers. Handle
11390 wildcard pattern specially. Unquote pattern. Call
11391 add_exact_match.
11392 (Version_script_info::get_name_to_match): New function.
11393 (Version_script_info::get_symbol_version): New function.
11394 (Version_script_info::get_symbol_version_helper): Remove.
11395 (Version_script_info::check_unmatched_names): Call unquote.
11396 * script.h (class Version_script_info): Change get_symbol_version
11397 to be non-inline and add is_global parameter; change all callers.
11398 Rewrite symbol_is_local. Update declarations. Define struct
11399 Version_tree_match, Exact, Globs. Don't define struct Lookup.
11400 Remove globals_ and locals_ members. Add exact_, globs_,
11401 default_version_, is_global_.
11402 (Version_script_info::Glob): Remove pattern, add expression and
11403 is_global. Update constructor. Change all callers.
11404 * dynobj.cc (Versions::finalize): Mark the version symbol as the
11405 default version.
11406 (Versions::symbol_section_contents): If a symbol is undefined, or
11407 defined in a dynamic object, set the version index to
11408 VER_NDX_LOCAL.
11409 * symtab.cc (Symbol_table::add_from_relobj): Don't call
11410 symbol_is_local.
11411 (Symbol_table::add_from_pluginobj): Likewise.
11412 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
11413
11414 2010-01-11 Doug Kwan <dougkwan@google.com>
11415
11416 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
11417 (incremental_dump_LDADD): Add linking option for libintl.
11418 * Makefile.in: Regenerate.
11419
11420 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
11421
11422 PR gold/11144
11423 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
11424 instead of -Ds.
11425 * testsuite/Makefile.in: Regenerated.
11426
11427 2010-01-10 Doug Kwan <dougkwan@google.com>
11428
11429 * options.h (DEFINE_var): Use parentheses around argument varname__
11430 in macro body to avoid any unintended subsequent substitutions.
11431
11432 2010-01-10 Ian Lance Taylor <iant@google.com>
11433
11434 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
11435 candidates before doing symbol resolution.
11436
11437 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
11438 ODR candidates if only one is weak.
11439
11440 2010-01-08 Ian Lance Taylor <iant@google.com>
11441
11442 * script.cc (Version_script_info::build_expression_list_lookup):
11443 Don't warn about ambiguous version, just record the ambiguity.
11444 (Version_script_info::get_symbol_version_helper): Give error if
11445 version is ambiguous.
11446
11447 2010-01-08 Doug Kwan <dougkwan@google.com>
11448
11449 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
11450 prev_data_size_ and prev_addralign_. Remove initializer for
11451 deleted data member has_been_changed_.
11452 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
11453 to determine if the table is empty.
11454 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
11455 Remove.
11456 (Stub_table::add_reloc_stub): Define method in class definition
11457 instead of just declaring it there.
11458 (Stub_table::add_cortex_a8_stub): New method definition.
11459 (Stub_table::update_data_size_and_addralign): Ditto.
11460 (Stub_table::finalize_stubs): Ditto.
11461 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
11462 (Stub_table::do_addralign_): Return address alignment in the
11463 (Stub_table::do_reset_address_and_file_offset): Define method in
11464 class definition instead of declaring it there. Set current data
11465 size to be the data size of the previous pass.
11466 (Stub_table::set_final_data_size): Use current data size as the
11467 final data size.
11468 (Stub_table::relocate_stub): Change parameter type of stub from
11469 Reloc_stub pointer to Stub pointer.
11470 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
11471 (Stub_table::Cortex_a8_stub_list): New typedef.
11472 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
11473 Stub_table::prev_addralign_): New data member.
11474 (Arm_relobj::Arm_relobj): Initialize data member
11475 section_has_cortex_a8_workaround_.
11476 (Arm_relobj::section_has_cortex_a8_workaround,
11477 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
11478 definitions.
11479 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
11480 declarations.
11481 (Target_arm::relocate_stub): Change parameter type of stub from
11482 Reloc_stub pointer to Stub pointer.
11483 (Insn_template::size, Insn_template::alignment): Handle
11484 THUMB16_SPECIAL_TYPE.
11485 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
11486 Stub_table::update_data_size_and_addralign,
11487 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
11488 definitions.
11489 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
11490 (Stub_table::do_write): Ditto.
11491 (Target_arm::do_relax): Adjust code for changes in Stub_table.
11492
11493 2010-01-08 Ian Lance Taylor <iant@google.com>
11494
11495 PR 11108
11496 * symtab.h (class Symbol): Remove fields is_target_special_ and
11497 has_plt_offset_. Add field is_defined_in_discarded_section_.
11498 (Symbol::is_defined_in_discarded_section): New function.
11499 (Symbol::set_is_defined_in_discarded_section): New function.
11500 (Symbol::has_plt_offset): Rewrite.
11501 (Symbol::set_plt_offset): Verify that new offset is not -1U.
11502 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
11503 Don't initialize is_target_special_ or has_plt_offset_.
11504 Initialize is_defined_in_discarded_section_.
11505 (Symbol_table::add_from_relobj): If appropriate, set
11506 is_defined_in_discarded_section.
11507 * resolve.cc (Symbol::override_base_with_special): Don't test
11508 is_target_special_. Change has_plt_offset_ to has_plt_offset().
11509 * target-reloc.h (relocate_section): Do special handling for
11510 symbols defined in discarded sections for global symbols as well
11511 as local symbols.
11512
11513 2010-01-08 Ian Lance Taylor <iant@google.com>
11514
11515 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
11516 the SHT_SYMTAB case.
11517
11518 2010-01-08 Ian Lance Taylor <iant@google.com>
11519
11520 * object.cc (Sized_relobj::do_layout): Don't get confused if
11521 layout_eh_frame returns NULL.
11522
11523 2010-01-08 Ian Lance Taylor <iant@google.com>
11524
11525 PR 11084
11526 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
11527 dynamic symbol table, use the normal symbol table.
11528 (Sized_dynobj::do_read_symbols): Remove assertion about type of
11529 symbol table.
11530
11531 2010-01-08 Ian Lance Taylor <iant@google.com>
11532
11533 PR 11072
11534 * layout.cc (Layout::include_section): Remove .gnu_debuglink
11535 sections.
11536
11537 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
11538
11539 * version.cc (print_version): Change to "Copyright 2010".
11540
11541 2010-01-08 Ian Lance Taylor <iant@google.com>
11542
11543 PR 10287
11544 PR 11063
11545 * i386.cc (class Target_i386): Change return type of plt_section
11546 to be non-const.
11547 (class Output_data_plt_i386): Add tls_desc_rel_ field.
11548 (Output_data_plt_i386::Output_data_plt_i386): Initialize
11549 tls_desc_rel_ field.
11550 (Output_data_plt_i386::rel_tls_desc): New function.
11551 (Target_i386::rel_tls_desc_section): New function.
11552 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
11553 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
11554 R_386_TLS_DESC reloc in rel_tls_desc_section.
11555 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
11556 Define struct Tlsdesc_info.
11557 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
11558 (Target_x86_64::do_reloc_symbol_index): New function.
11559 (Target_x86_64::add_tlsdesc_info): New function.
11560 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
11561 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
11562 tlsdesc_rel_ field.
11563 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
11564 all callers.
11565 (Output_data_plt_x86_64::rela_tlsdesc): New function.
11566 (Target_x86_64::rela_tlsdesc_section): New function.
11567 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
11568 handling.
11569 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
11570 (Target_x86_64::do_reloc_addend): New function.
11571 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
11572 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
11573 declarations. Define TARGET_CODE. Add arg field to u1_ union.
11574 (Output_reloc::type): New function.
11575 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
11576 (Output_reloc::is_target_specific): New function.
11577 (Output_reloc::target_arg): New function.
11578 (class Output_reloc) [SHT_RELA]: Add four new constructors for
11579 absolute relocs and target specific relocs.
11580 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
11581 add_target_specific.
11582 (class Output_data_reloc) [SHT_RELA]: Likewise.
11583 * output.cc (Output_reloc::Output_reloc): Add four new versions
11584 for absolute relocs and target specific relocs.
11585 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
11586 (Output_reloc::get_symbol_index): Likewise.
11587 (Output_reloc::local_section_offset): Check that local_sym_index_
11588 is not TARGET_CODE or 0.
11589 (Output_reloc::symbol_value): Likewise.
11590 (Output_reloc::write) [SHT_RELA]: Call target for target specific
11591 reloc.
11592 * target.h (class Target): Add reloc_symbol_index and reloc_addend
11593 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
11594 functions.
11595 * layout.cc (add_target_dynamic_tags): Use output section for
11596 DT_PLTRELSZ and DT_JMPREL.
11597
11598 2010-01-07 Ian Lance Taylor <iant@google.com>
11599
11600 PR 11061
11601 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
11602 function.
11603 (class Output_data_reloc_generic): Define.
11604 (class Output_data_reloc_base): Change base class to
11605 Output_data_reloc_generic. Change add() method to call
11606 bump_relative_reloc_count for a relative reloc. Remove
11607 sort_relocs_ field.
11608 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
11609 to sort_relocs().
11610 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
11611 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
11612 appropriate.
11613 * layout.h (class Layout): Update declaration.
11614
11615 2010-01-07 Ian Lance Taylor <iant@google.com>
11616
11617 * output.h (class Output_data): Add const version of
11618 output_section and do_output_section.
11619 (class Output_section_data): Add const version of
11620 do_output_section.
11621 (class Output_section): Likewise.
11622 * layout.cc (Layout::add_target_dynamic_tags): New function.
11623 * layout.h (class Layout): Update declarations.
11624 * arm.cc (Target_arm::do_finalize_sections): Use
11625 add_target_dynamic_tags.
11626 * i386.cc (Target_i386::do_finalize_sections): Likewise.
11627 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11628 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11629 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11630
11631 2010-01-07 Ian Lance Taylor <iant@google.com>
11632
11633 PR 11042
11634 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
11635 object as needed.
11636
11637 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
11638 Ian Lance Taylor <iant@google.com>
11639
11640 PR 11019
11641 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
11642 Xindex::read_symtab_xindex.
11643
11644 2010-01-07 Doug Kwan <dougkwan@google.com>
11645
11646 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
11647 (Insn_template::thumb16_bcond_insn): New method declaration.
11648 (Insn_template): Fix spelling.
11649 (Stub::thumb16_special): New method declaration.
11650 (Stub::do_write): Define virtual method which was previously pure
11651 virtual.
11652 (Stub::do_thumb16_special): New method declaration.
11653 (Stub::do_fixed_endian_write): New template member.
11654 (Reloc_stub::do_write): Remove.
11655 (Reloc_stub::do_fixed_endian_write): Remove.
11656 (Cortex_a8_stub): New class definition.
11657 (Stub_factory::make_cortex_a8_stub): New method definition.
11658 (Stub_factory::Stub_factory): Add missing static storage class
11659 qualifier for elf32_arm_stub_a8_veneer_blx.
11660
11661 2010-01-07 Ian Lance Taylor <iant@google.com>
11662
11663 PR 10980
11664 * options.h (class General_options): Add --warn-unresolved-symbols
11665 and --error-unresolved-symbols.
11666 * errors.cc (Errors::undefined_symbol): Implement
11667 --warn-unresolved-symbols.
11668
11669 * options.h (class General_options): Add -z text and -z textoff.
11670 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
11671
11672 2010-01-06 Sriraman Tallam <tmsriram@google.com>
11673
11674 * gc.h (Garbage_collection::Cident_section_map): New typedef.
11675 (Garbage_collection::cident_sections): New function.
11676 (Garbage_collection::add_cident_section): New function.
11677 (Garbage_collection::cident_sections_): New member.
11678 (gc_process_relocs): Add references to sections whose names are C
11679 identifiers.
11680 * gold.h (cident_section_start_prefix): New constant.
11681 (cident_section_stop_prefix): New constant.
11682 (is_cident): New function.
11683 * layout.cc (Layout::define_section_symbols): Replace string constants
11684 with the newly defined constants.
11685 * object.cc (Sized_relobj::do_layout): Track sections whose names are
11686 C identifiers.
11687 * testsuite/Makefile.am: Add gc_orphan_section_test.
11688 * testsuite/Makefile.in: Regenerate.
11689 * testsuite/gc_orphan_section_test.cc: New file.
11690 * testsuite/gc_orphan_section_test.sh: New file.
11691
11692 2010-01-06 Ian Lance Taylor <iant@google.com>
11693
11694 PR 10980
11695 * options.h (class General_options): Add --warn-shared-textrel.
11696 * layout.cc (Layout::finish_dynamic_section): Implement
11697 --warn-shared-textrel.
11698
11699 PR 10980
11700 * options.h (class General_options): Add --warn-multiple-gp.
11701
11702 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11703
11704 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
11705 $(THREADSLIB) and $(LIBDL).
11706 * Makefile.in: Rebuild.
11707
11708 2010-01-06 Ian Lance Taylor <iant@google.com>
11709
11710 PR 10980
11711 * options.cc (General_options::parse_section_start): New function.
11712 (General_options::section_start): New function.
11713 (General_options::General_options): Initialize all members.
11714 * options.h: Include <map>
11715 (class General_options): Add --section-start. Add section_starts_
11716 member.
11717 * layout.cc (Layout::attach_allocated_section_to_segment): If
11718 --section-start was used, set the address of the segment. Remove
11719 local sort_sections.
11720 (Layout::relaxation_loop_body): If the address of the load segment
11721 has been set by --section-start, don't use it.
11722 * output.h (Output_segment::update_flags_for_output_section): New
11723 function.
11724 * output.cc (Output_segment::add_output_section): Call
11725 update_flags_for_output_section.
11726
11727 2010-01-05 Ian Lance Taylor <iant@google.com>
11728
11729 PR 10980
11730 * options.h (class General_options): Add --undefined-version.
11731 * script.cc (struct Version_expression): Add was_matched_by_symbol
11732 field.
11733 (Version_script_info::matched_symbol): New function.
11734 (Version_script_info::get_symbol_version_helper): Call
11735 matched_symbol.
11736 (Version_script_info::check_unmatched_names): New function.
11737 * script.h (class Version_script_info): Update declarations.
11738 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
11739
11740 * options.h (class General_options): Use DEFINE_bool_alias for
11741 allow_multiple_definition.
11742 * resolve.cc (Symbol_table::should_override): Don't test
11743 allow_multiple_definition.
11744
11745 PR 10980
11746 * options.h (class General_options): Add --cref.
11747 * main.cc (main): Print cref table if --cref. Don't close mapfile
11748 until after printing cref table.
11749 * cref.cc: Include "symtab.h".
11750 (class Cref_inputs): Define Cref_table_compare and Cref_table.
11751 (Cref_table_compare::operator()): New function.
11752 (Cref_inputs::gather_cref): New function.
11753 (filecol): New static const.
11754 (Cref_inputs::print_cref): New function.
11755 (Cref::print_cref): New function.
11756 * cref.h: Include <cstdio>.
11757 (class Cref): Update declarations.
11758 * mapfile.h (Mapfile::file): New function.
11759 * object.h (class Object): Define Symbols. Declare virtual
11760 do_get_global_symbols.
11761 (Object::get_global_symbols): New function.
11762 * object.cc (Input_objects::add_object): Pass object to cref_ if
11763 --cref.
11764 (Input_objects::archive_start): Likewise.
11765 (Input_objects::archive_stop): Likewise.
11766 (Input_objects::print_cref): New function.
11767 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
11768 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
11769 --cref.
11770 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
11771 function.
11772 * plugin.h (class Sized_pluginobj): Update declarations.
11773
11774 2010-01-05 Ian Lance Taylor <iant@google.com>
11775
11776 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
11777 to is_default_version. Rename insdef to insdefault.
11778 (Symbol_table::add_from_relobj): Rename def to is_default_version
11779 and local to is_forced_local.
11780 (Symbol_table::add_from_pluginobj): Likewise.
11781 (Symbol_table::add_from_dynobj): Likewise.
11782 (Symbol_table::define_special_symbol): Rename insdef to
11783 insdefault.
11784
11785 2010-01-04 Ian Lance Taylor <iant@google.com>
11786
11787 PR 10980
11788 * options.h (class General_options): Add
11789 --allow-multiple-definition and -z muldefs.
11790 * resolve.cc (Symbol_table::should_override): Don't warn about a
11791 multiple symbol definition if --allow-multiple-definition or -z
11792 muldefs.
11793
11794 PR 10980
11795 * options.h (class General_options): Add --add-needed and
11796 --copy-dt-needed-entries. Tweak --as-needed help entry.
11797 * object.cc (Input_objects::check_dynamic_dependencies): Give an
11798 error if --copy-dt-needed-entries aka --add-needed is used and
11799 would cause a change in behaviour.
11800
11801 PR 10980
11802 * options.h (class General_options): Add -G as a short version of
11803 --shared. Add no-op options -assert, -g, and -i.
11804
11805 2010-01-04 Sriraman Tallam <tmsriram@google.com>
11806
11807 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
11808 check for .text or .gnu.linkonce.t sections.
11809 * icf.cc (Icf::find_identical_sections): Ditto.
11810 Change the detection for mangled function name within the section
11811 name.
11812 * icf.h (is_section_foldable_candidate): New function.
11813
11814 2009-12-30 Ian Lance Taylor <iant@google.com>
11815
11816 PR 10980
11817 * options.h (class General_options): Permit two dashes with
11818 --retain-symbols-file.
11819
11820 2009-12-30 Ian Lance Taylor <iant@google.com>
11821
11822 PR 10979
11823 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
11824 don't put the file header and segment headers in the text
11825 segment.
11826
11827 PR 10979
11828 * common.cc (Sort_commons::operator()): Stabilize sort when both
11829 entries are NULL.
11830 (Symbol_table::do_allocate_commons_list): When allocating common
11831 symbols, skip a symbol which is no longer common.
11832 * symtab.h (Symbol::is_common): Test whether the symbol comes from
11833 an object before checking its type.
11834 * testsuite/common_test_2.c: New file.
11835 * testsuite/common_test_3.c: New file.
11836 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
11837 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
11838 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
11839 (common_test_2_pic.o, common_test_2.so): New targets.
11840 (common_test_3_pic.o, common_test_3.so): New targets.
11841 * testsuite/Makefile.in: Rebuild.
11842
11843 PR 10979
11844 * script.cc (read_input_script): If we see a new SECTIONS clause,
11845 and we have added an input section, give an error.
11846 * layout.h (class Layout): Add have_added_input_section function.
11847 Add have_added_input_section_ field.
11848 * layout.cc (Layout::Layout): Initialize
11849 have_added_input_section_.
11850 (Layout::layout): Set have_added_input_section_.
11851 (Layout::layout_eh_frame): Likewise.
11852
11853 2009-12-30 Ian Lance Taylor <iant@google.com>
11854
11855 PR 10931
11856 * options.h (class General_options): Add --sort-common option.
11857 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
11858 * common.cc (Sort_common): Add sort_order parameter to
11859 constructor. Add sort_order_ field.
11860 (Sort_commons::operator): Check sort_order_.
11861 (Symbol_table::allocate_commons): Determine the sort order.
11862 (Symbol_table::do_allocate_commons): Add sort_order parameter.
11863 Change all callers.
11864 (Symbol_table::do_allocate_commons_list): Likewise.
11865
11866 2009-12-30 Ian Lance Taylor <iant@google.com>
11867
11868 PR 10916
11869 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
11870 symbols from this object, don't change the visibility of an
11871 undefined symbol.
11872 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
11873
11874 2009-12-30 Ian Lance Taylor <iant@google.com>
11875
11876 PR 10861
11877 * script.h (class Version_script_info): Define Language enum.
11878 Update declarations. Define Glob, Exact, and Lookup types. Add
11879 new fields globals_, locals_, and is_finalized_.
11880 * script.cc: Various formatting fixes.
11881 (class Parser_closure): Change language_stack_ from a vector of
11882 std::string to one of Version_script_info::Language. Adjust all
11883 uses accordingly.
11884 (class Lazy_demangler): Remove.
11885 (struct Version_expression): Change language from std::string to
11886 Version_script_info::Language.
11887 (Version_script_info::Version_script_info): New function.
11888 (Version_script_info::~Version_script_info): Don't call clear.
11889 (Version_script_info::finalize): New function.
11890 (Version_script_info::build_lookup_tables): New function.
11891 (Version_script_info::build_expression_list_lookup): New
11892 function.
11893 (Version_script_info::get_symbol_version_helper): Rewrite to use
11894 lookup tables.
11895 (Version_script_info::print_expression_list): Adjust to use
11896 Version_script_info::Language.
11897 (script_push_lex_into_version_mode): Check that the version script
11898 has not been finalized.
11899 (version_script_push_lang): Change language string to
11900 Version_script_info::Language.
11901 * options.cc (Command_line::version_script): New function.
11902 * options.h (class General_options): Add finalize_dynamic_list
11903 function. Change version_script from declaration to definition.
11904 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
11905 * testsuite/version_script.map: Remove duplicate def of foo.
11906 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
11907 version_script.map.
11908 * testsuite/Makefile.in: Rebuild.
11909
11910 2009-12-30 Ian Lance Taylor <iant@google.com>
11911
11912 PR 10843
11913 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
11914 if the input symbol index is 0, make the output symbol index 0.
11915
11916 2009-12-30 Ian Lance Taylor <iant@google.com>
11917
11918 PR 10670
11919 * options.h (class General_options): Add -x/--discard-all.
11920 * object.cc (Sized_relobj::do_count_local_symbols): Handle
11921 --discard-all. If the local symbol needs a dynamic entry, check
11922 that before handling --discard-locals.
11923
11924 2009-12-30 Ian Lance Taylor <iant@google.com>
11925
11926 PR 10450
11927 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
11928 flags to PF_R.
11929 (Output_segment::add_output_section): Don't change the flags if
11930 the type is PT_TLS.
11931
11932 PR 10450
11933 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
11934 GNU hash table if they need a dynamic value. Otherwise, don't add
11935 them if they are defined in a dynamic object or are forced local.
11936
11937 2009-12-29 Ian Lance Taylor <iant@google.com>
11938
11939 PR 10450
11940 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
11941 .gnu.hash table for a 32-bit target.
11942
11943 PR 10450
11944 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
11945 regular and a dynamic object only needs a dynamic symbol table
11946 entry if it is externally visible.
11947
11948 PR 10450
11949 * i386.cc (class Target_i386): Initialize global_offset_table_ in
11950 constructor. Add global_offset_table_ field.
11951 (Target_i386::got_section): Set global_offset_table_.
11952 (Target_i386::do_finalize_sections): Set global_offset_table_
11953 size.
11954 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
11955 in constructor. Add global_offset_table_ field.
11956 (Target_x86_64::got_section): Set global_offset_table_.
11957 (Target_x86_64::do_finalize_sections): Set global_offset_table_
11958 size.
11959
11960 * layout.cc (Layout::Layout): Initialize increase_relro_.
11961 (Layout::get_output_section): Add is_relro, is_last_relro, and
11962 is_first_non_relro parameters. Change all callers.
11963 (Layout::choose_output_section): Likewise.
11964 (Layout::add_output_section_data): Likewise.
11965 (Layout::make_output_section): Likewise.
11966 (Layout::set_segment_offsets): Clear increase_relro when using a
11967 linker script.
11968 * layout.h (class Layout): Add increase_relro method. Add
11969 increase_relro_ field. Update declarations.
11970 * output.cc (Output_section::Output_section): Initialize
11971 is_last_relro_ and is_first_non_relro_.
11972 (Output_segment::add_output_section): Group relro sections is
11973 do_sort is true. Handle is_last_relro and is_first_non_relro.
11974 (Output_segment::maximum_alignment): Remove relro handling.
11975 (Output_segment::set_section_addresses): Add increase_relro
11976 parameter. Change all callers. Add initial alignment to align
11977 relro sections on separate page. Remove old relro handling.
11978 (Output_segment::set_section_list_addresses): Remove in_relro
11979 parameter. Change all callers.
11980 (Output_segment::set_offset): Add increase parameter. Change all
11981 callers. Remove old relro handling.
11982 * output.h (class Output_section): Add new methods: is_last_relro,
11983 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
11984 Add is_last_relro_ and is_first_non_relro_ fields.
11985 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
11986 Create separate .got.plt section. Call increase_relro.
11987 * x86_64.cc (Target_x86_64::got_section): Likewise.
11988 * testsuite/relro_script_test.t: Add .got.plt.
11989
11990 PR 10450
11991 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
11992 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
11993 (Layout::finalize): Call set_dynamic_symbol_size.
11994 (Layout::set_dynamic_symbol_size): New function.
11995 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
11996 set_dynamic_symbol_size.
11997
11998 PR 10450
11999 * output.h (class Output_section): Add is_entsize_zero_ field.
12000 * output.cc (Output_section::Output_section): Initialize
12001 is_entsize_zero_.
12002 (Output_section::set_entsize): If two different entsizes are
12003 requested, force it to zero.
12004 (Output_section::add_input_section): Set flags for .debug_str
12005 before updating section flags. Set entsize.
12006 (Output_section::update_flags_for_input_section): Set SHF_MERGE
12007 and SHF_STRING if all input sections have those flags.
12008
12009 2009-12-29 Rafael Espindola <espindola@google.com>
12010
12011 * main.cc (main): Fix the sys time reporting.
12012 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
12013 reporting.
12014
12015 2009-12-29 Sriraman Tallam <tmsriram@google.com>
12016
12017 * options.cc (General_options::parse_version): Allow -v to exit
12018 without an error if there is nothing to link.
12019
12020 2009-12-29 Ian Lance Taylor <iant@google.com>
12021
12022 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
12023 using a version of gcc before 4.1.
12024 * configure: Rebuild.
12025
12026 2009-12-28 Chris Demetriou <cgd@google.com>
12027
12028 * attributes.cc (Output_attributes_section_data::do_write): Use
12029 std::vector::front rather than std::vector::data.
12030
12031 2009-12-28 Ian Lance Taylor <iant@google.com>
12032
12033 * symtab.h (class Symbol_table): Add enum Defined.
12034 * resolve.cc (Symbol_table::should_override): Add defined
12035 parameter. Change all callers. Test whether object is NULL
12036 before calling a method on it.
12037 (Symbol_table::report_resolve_problem): Add defined parameter.
12038 Change all callers.
12039 (Symbol_table::should_override_with_special): Likewise.
12040 * symtab.cc (Symbol_table::define_in_output_data): Add defined
12041 parameter. Change all callers.
12042 (Symbol_table::do_define_in_output_data): Likewise.
12043 (Symbol_table::define_in_output_segment): Likewise.
12044 (Symbol_table::do_define_in_output_segment): Likewise.
12045 (Symbol_table::define_as_constant): Likewise.
12046 (Symbol_table::do_define_as_constant): Likewise.
12047 * script.h (class Symbol_assignment): Add is_defsym parameter to
12048 constructor; change all callers.
12049 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
12050 parameter. Change all callers. Add is_defsym_ field.
12051 (class Parser_closure): Add parsing_defsym parameter to
12052 constructor; change all callers. Add parsing_defsym accessor
12053 function. Add parsing_defsym_ field.
12054
12055 2009-12-28 Ian Lance Taylor <iant@google.com>
12056
12057 * gold.cc (queue_middle_tasks): Fix formatting.
12058 * object.cc (Relobj::is_section_name_included): Likewise.
12059
12060 2009-12-23 Ian Lance Taylor <iant@google.com>
12061
12062 * i386.cc (Target_i386::do_calls_non_split): Recognize
12063 -fsplit-stack prologue for a function with a static chain.
12064 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
12065 -fsplit-stack prologue when using %r11.
12066
12067 2009-12-21 Sriraman Tallam <tmsriram@google.com>
12068
12069 * options.cc (General_options::parse_version): Make -v continue and do
12070 the link like GNU ld does.
12071
12072 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
12073
12074 * Makefile.am (CCFILES): Add timer.cc.
12075 (HFILES): Add timer.h.
12076 * configure.ac: Check for sysconf and times.
12077 * main.cc: include timer.h.
12078 (main): Use Timer instead of get_run_time.
12079 * timer.cc: New.
12080 * timer.h: New.
12081 * workqueue.cc: include timer.h.
12082 (Workqueue::find_and_run_task):
12083 Report user, sys and wall time.
12084 * Makefile.in: Regenerate.
12085 * config.in: Regenerate.
12086 * configure: Regenerate.
12087
12088 2009-12-16 Doug Kwan <dougkwan@google.com>
12089
12090 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
12091 sections.
12092 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
12093 relaxed input sections.
12094 * output.cc (Output_section::find_relaxed_input_section): Change
12095 return type to Output_relaxed_input_section pointer. Adjust code
12096 for new type of relaxed_input_section_map_.
12097 * output.h (Output_section::find_relaxed_input_section): Change
12098 return type to Output_relaxed_input_section pointer.
12099 (Output_section::Output_relaxed_input_section_by_input_section_map):
12100 New type.
12101 (Output_section::relaxed_input_section_map_): Change type to
12102 Output_section::Output_relaxed_input_section_by_input_section_map.
12103 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
12104 input section.
12105
12106 2009-12-15 Ian Lance Taylor <iant@google.com>
12107
12108 * layout.cc (Layout::create_shstrtab): Only write out after input
12109 sections if we are compressing debug sections.
12110
12111 2009-12-15 Ian Lance Taylor <iant@google.com>
12112
12113 * archive.cc (Archive::add_symbols): Only look up a symbol without
12114 a version if there is, in fact, a version.
12115
12116 2009-12-14 Ian Lance Taylor <iant@google.com>
12117
12118 Revert -Wshadow changes, all changes from:
12119 2009-12-11 Doug Kwan <dougkwan@google.com>
12120 2009-12-11 Nick Clifton <nickc@redhat.com>
12121 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
12122
12123 2009-12-11 Doug Kwan <dougkwan@google.com>
12124
12125 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
12126 due to -Wshadow.
12127 * attributes.cc (Object_attribute::size): Ditto.
12128 (Attributes_section_data::size): Ditto.
12129 (Attributes_section_data::Attributes_section_data): Ditto.
12130 (Output_attributes_section_data::do_write): Ditto.
12131 * attributes.h (Object_attribute::set_type): Ditto.
12132 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
12133
12134 2009-12-11 Nick Clifton <nickc@redhat.com>
12135
12136 * archive.cc: Fix shadowed variable warnings.
12137 * arm.cc: Likewise.
12138 * compressed_output.cc: Likewise.
12139 * compressed_output.h: Likewise.
12140 * configure: Likewise.
12141 * dwarf_reader.cc: Likewise.
12142 * dynobj.cc: Likewise.
12143 * dynobj.h: Likewise.
12144 * ehframe.cc: Likewise.
12145 * ehframe.h: Likewise.
12146 * errors.cc: Likewise.
12147 * expression.cc: Likewise.
12148 * fileread.cc: Likewise.
12149 * fileread.h: Likewise.
12150 * freebsd.h: Likewise.
12151 * i386.cc: Likewise.
12152 * icf.cc: Likewise.
12153 * incremental.h: Likewise.
12154 * layout.cc: Likewise.
12155 * layout.h: Likewise.
12156 * mapfile.cc: Likewise.
12157 * merge.cc: Likewise.
12158 * merge.h: Likewise.
12159 * object.cc: Likewise.
12160 * object.h: Likewise.
12161 * options.h: Likewise.
12162 * output.cc: Likewise.
12163 * output.h: Likewise.
12164 * parameters.cc: Likewise.
12165 * plugin.cc: Likewise.
12166 * powerpc.cc: Likewise.
12167 * reduced_debug_output.cc: Likewise.
12168 * reduced_debug_output.h: Likewise.
12169 * reloc.cc: Likewise.
12170 * reloc.h: Likewise.
12171 * resolve.cc: Likewise.
12172 * script-sections.cc: Likewise.
12173 * script.cc: Likewise.
12174 * script.h: Likewise.
12175 * sparc.cc: Likewise.
12176 * symtab.cc: Likewise.
12177 * symtab.h: Likewise.
12178 * target-select.cc: Likewise.
12179 * target-select.h: Likewise.
12180 * token.h: Likewise.
12181 * workqueue.cc: Likewise.
12182 * workqueue.h: Likewise.
12183 * x86_64.cc: Likewise.
12184
12185 2009-12-10 Doug Kwan <dougkwan@google.com>
12186
12187 * arm.cc (attributes.h): New include.
12188 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
12189 (Arm_relobj::~Arm_relobj): Delete object pointed by
12190 attributes_section_data_.
12191 (Arm_relobj::attributes_section_data): New method definition.
12192 (Arm_relobj::attributes_section_data_): New data member declaration.
12193 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
12194 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
12195 attributes_section_data_.
12196 (Arm_dynobj::attributes_section_data): New method definition.
12197 (Arm_dynobj::attributes_section_data_): New data member declaration.
12198 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
12199 initialization value of may_use_blx_ to false.
12200 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
12201 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
12202 object attributes to compute results instead of hard-coding.
12203 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
12204 Target_arm::get_secondary_compatible_arch,
12205 Target_arm::set_secondary_compatible_arch
12206 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12207 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
12208 New method declarations.
12209 (Target_arm::get_aeabi_object_attribute): New method definition.
12210 (Target_arm::attributes_section_data_): New data member declaration.
12211 (read_arm_attributes_section): New template definition.
12212 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
12213 (Arm_dynobj::do_read_symbols): Ditto.
12214 (Target_arm::do_finalize_sections): Merge attributes sections from
12215 input. Check for BLX use after attributes section merging.
12216 Fix __exidx_start and __exidx_end visibility. Create an
12217 .ARM.attributes section if necessary.
12218 (Target_arm::get_secondary_compatible_arch,
12219 Target_arm::set_secondary_compatible_arch,
12220 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12221 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
12222 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
12223 New method definitions.
12224
12225 2009-12-09 Ian Lance Taylor <iant@google.com>
12226
12227 * plugin.cc (Plugin::load): Don't cast from void* to a function
12228 pointer.
12229
12230 2009-12-09 Ian Lance Taylor <iant@google.com>
12231
12232 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
12233 information fields.
12234
12235 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
12236
12237 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
12238 Replace two_file_shared_1.so with two_file_shared_2.so.
12239 * testsuite/Makefile.in: Regenerated.
12240
12241 2009-12-08 Doug Kwan <dougkwan@google.com>
12242
12243 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
12244 (HFILES): Add attributes.h and int_encoding.h.
12245 * Makefile.in: Regenerate.
12246 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
12247 function definitions to int_encoding.cc
12248 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
12249 prototypes to int_encoding.h
12250 * reduced_debug_output.cc (int_encoding.h): New include.
12251 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
12252 function definitions to int_encoding.cc
12253 (insert_into_vector, read_from_pointer): Move template definitions to
12254 int_encoding.h
12255 * attributes.cc: New file.
12256 * attributes.h: New file.
12257 * int_encoding.cc: New file.
12258 * int_encoding.h: New file.
12259
12260 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
12261
12262 PR gold/11055
12263 * incremental-dump.cc (dump_incremental_inputs): New.
12264 (main): Use dump_incremental_inputs.
12265
12266 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
12267
12268 PR gold/10893
12269 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
12270 checking elfcpp::STT_FUNC.
12271 (Target_i386::Relocate::relocate): Likewise.
12272 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
12273
12274 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
12275 symbols from shared libraries into normal FUNC symbols.
12276
12277 * symtab.h (Symbol): Add is_func and use it.
12278
12279 2009-12-05 Doug Kwan <dougkwan@google.com>
12280
12281 * arm.cc (Target_arm::arm_info): Initialize new fields
12282 attributes_section and attributes_vendor.
12283 * i386.cc (Target_i386::i386_info): Same.
12284 * object.cc (Sized_relobj::do_layout): Skip attribute section.
12285 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
12286 fields attributes_section and attributes_vendor.
12287 * sparc.cc (Target_sparc::sparc_info): Same.
12288 * target.h (Target::attributes_section, Target::attributes_vendor,
12289 Target::is_attributes_section, Target::attribute_arg_type,
12290 Target::attributes_order): New method definitions.
12291 (Target::Target_info::attributes_section,
12292 Target::Target_info::attributes_vendor): New fields.
12293 (Target::do_attribute_arg_type, Target::do_attributes_order): New
12294 virtual method definitions.
12295 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
12296 attributes_section and attributes_vendor.
12297 * testsuite/testfile.cc (Target_test::test_target_info): Same.
12298
12299 2009-12-05 Doug Kwan <dougkwan@google.com>
12300
12301 * arm.cc: Update comments about interworking and stub generation.
12302 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
12303 considered as non-PIC.
12304 (Arm_relocate_functions::base_abs): Fix formatting.
12305 (Arm_relocate_functions::got_prel): Fix comment. Change interface
12306 of function to use GOT entry address instead of offset.
12307 (Target_arm::Scan::global): Issue an error if a symbol would need a
12308 PLT does not get one because it is untyped. Remove code to create
12309 dynamic symbols for relative branches.
12310 (Target_arm::Relocate::relocate: Use 0 instead of false since function
12311 takes unsigned integer instead of boolean.
12312
12313 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
12314
12315 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
12316 (two_file_test_LDADD): Likewise.
12317 (common_test_1_LDADD): Likewise.
12318 (exception_test_LDADD) Likewise.
12319 (weak_test_LDADD): Likewise.
12320 (many_sections_test_LDADD): Likewise.
12321 (initpri1_LDADD): Likewise.
12322 (script_test_1_LDADD): Likewise.
12323 (script_test_2_LDADD): Likewise.
12324 (justsyms_LDADD): Likewise.
12325 (binary_test_LDADD): Likewise.
12326 (large_LDADD): Likewise.
12327 * testsuite/Makefile.in: Regenerated.
12328
12329 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
12330
12331 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
12332 (Symbol_table::override_with_special): Likewise.
12333 (Symbol_table::add_from_object): Likewise.
12334
12335 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
12336
12337 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12338 Don't set the data_offset twice.
12339
12340 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
12341
12342 * testsuite/Makefile.in: Regenerate.
12343
12344 2009-12-03 Doug Kwan <dougkwan@google.com>
12345
12346 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
12347 (Target_arm::do_finalize_sections): Add parameter for symbol table
12348 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
12349 * i386.cc (Target_i386::do_finalize_sections): Add an additional
12350 parameter for symbol table pointer.
12351 * layout.cc (Layout::finalize): Call Target::finalize_sections with
12352 an additional parameter for a pointer to symbol table.
12353 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
12354 parameter for a symbol table pointer.
12355 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
12356 * target.h (Target::finalize_sections, Target::do_finalize_sections):
12357 Ditto.
12358 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
12359 parameter for a symbol table pointer.
12360
12361 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
12362
12363 * incremental.cc (Incremental_inputs_header)
12364 (Incremental_inputs_header_write, Incremental_inputs_entry)
12365 (Incremental_inputs_entry_write): Move ...
12366 * incremental.h (Incremental_inputs_header)
12367 (Incremental_inputs_header_write, Incremental_inputs_entry)
12368 (Incremental_inputs_entry_write): here.
12369
12370 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
12371
12372 * incremental.cc (make_sized_incremental_binary): Set the target.
12373 Error if it is incompatible.
12374 * output.h (Output_file): Add filename method.
12375
12376 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
12377
12378 * incremental.cc (Incremental_inputs_entry): Remove unused argument
12379 from the get_* methods.
12380
12381 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
12382
12383 * incremental-dump.cc (main): Check that the offeset of a script is 0.
12384 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12385 Write 0 for the data_offset of scripts.
12386
12387 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
12388
12389 * testsuite/Makefile.am: Add the incremental_test.sh test.
12390 * testsuite/incremental_test.sh: New.
12391 * testsuite/incremental_test_1.c: New.
12392 * testsuite/incremental_test_2.c: New.
12393
12394 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
12395
12396 * incremental-dump.cc (main): Fix typos.
12397
12398 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
12399
12400 PR gold/11025
12401 * incremental-dump.cc (main): Use llu to print 64 bit values.
12402
12403 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
12404 H.J. Lu <hongjiu.lu@intel.com>
12405
12406 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
12407 $(LIBDL).
12408 (incremental_dump_LDADD): Likewise.
12409 * Makefile.in: Regenerated.
12410
12411 2009-11-25 Doug Kwan <dougkwan@google.com>
12412
12413 Revert:
12414
12415 2009-11-25 Doug Kwan <dougkwan@google.com>
12416
12417 * arm.cc (Target_arm::Target_arm): Move method definition
12418 outside of class definition. Add code to handle
12419 --target1-rel, --target1-abs and --target2= options.
12420 (Target_arm::get_reloc_reloc_type): Change method to be
12421 non-static and const.
12422 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
12423 New data member declaration.
12424 (Target_arm::Scan::local, Target_arm::Scan::global,
12425 Target_arm::Relocate::relocate,
12426 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12427 Adjust call to Target_arm::get_real_reloc_type.
12428 (Target_arm::get_real_reloc_type): Use command line options
12429 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12430 * options.h (--target1-rel, --target1-abs, --target2): New
12431 ARM-only options.
12432
12433 2009-11-25 Doug Kwan <dougkwan@google.com>
12434
12435 * arm.cc (Target_arm::Target_arm): Move method definition outside of
12436 class definition. Add code to handle --target1-rel, --target1-abs
12437 and --target2= options.
12438 (Target_arm::get_reloc_reloc_type): Change method to be non-static
12439 and const.
12440 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
12441 member declaration.
12442 (Target_arm::Scan::local, Target_arm::Scan::global,
12443 Target_arm::Relocate::relocate,
12444 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
12445 call to Target_arm::get_real_reloc_type.
12446 (Target_arm::get_real_reloc_type): Use command line options to
12447 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12448 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
12449 options.
12450
12451 2009-11-25 Doug Kwan <dougkwan@google.com>
12452
12453 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
12454 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
12455 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
12456 formatting.
12457 (Arm_relocate_functions::thm_call): Replace body with a call to
12458 Arm_relocate_functions::thumb_branch_common.
12459 (Arm_relocate_functions::thm_jump24,
12460 Arm_relocate_functions::thm_xpc22): New method definitions.
12461 (Arm_relocate_functions::thumb_branch_common): New method definition.
12462 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
12463 operator.
12464 (Target_arm::Relocate::relocate): Adjust call to thm_call.
12465 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
12466
12467 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
12468
12469 * Makefile.am: Build incremental-dump
12470 * Makefile.in: Regenerate.
12471 * incremental-dump.cc: New.
12472 * incremental.cc (Incremental_inputs_header_data,
12473 Incremental_inputs_entry_data): Move to incremental.h
12474 * incremental.h: (Incremental_inputs_header_data,
12475 Incremental_inputs_entry_data): Move from incremental.cc
12476
12477 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
12478
12479 * incremental.cc (Incremental_inputs_header,
12480 Incremental_inputs_header_write, Incremental_inputs_entry,
12481 Incremental_inputs_entry_write): Add a typedef with the data type.
12482
12483 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
12484
12485 * incremental.cc (Incremental_inputs_header,
12486 Incremental_inputs_header_write, Incremental_inputs_entry,
12487 Incremental_inputs_entry_write): Update comment about which
12488 type has the filed descriptions.
12489
12490 2009-11-15 Doug Kwan <dougkwan@google.com>
12491
12492 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
12493 (Arm_relocate_functions::arm_branch_common): Change method defintion
12494 in class definition to a method declaration and update list of formal
12495 parameters.
12496 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
12497 Arm_relocation_functions::jump24): Adjust call to
12498 Arm_relocate_functions::arm_branch_common. Update list of formal
12499 parameters.
12500 (Arm_relocate_functions::xpc25): New method definition.
12501 (Arm_relocate_functions::arm_branch_common): Move method defintion
12502 out from class definition. Use stubs for mode-switching and extending
12503 branch ranges.
12504 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
12505 specially. Change code to enable use of stubs in ARM branches.
12506
12507 2009-11-10 Doug Kwan <dougkwan@google.com>
12508
12509 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
12510 in method declaration.
12511 (Target_arm::relocate_stub): New method declaration.
12512 (Target_arm::default_target): Change to return a pointer instead of
12513 a const reference.
12514 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
12515 Target_arm::default_target.
12516 (Arm_Relobj::do_relocate_sections): Remove options paramater in
12517 method definition.
12518 (Target_arm::relocate_section): Adjust view.
12519 (Target_arm::relocate_stub): New method definition.
12520
12521 2009-11-10 Doug Kwan <dougkwan@google.com>
12522
12523 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
12524 a format warning.
12525 * incremental.cc (open_incremental_binary): Initialized local
12526 variables to avoid warnings.
12527 * object.cc (make_elf_object): Ditto.
12528 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
12529 a format warning.
12530
12531 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
12532
12533 PR gold/10930
12534 * testsuite/plugin_test.c: Include "config.h".
12535
12536 2009-11-09 Doug Kwan <dougkwan@google.com>
12537
12538 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
12539 (arm_symbol_value): Remove.
12540 (Arm_relocate_functions::arm_branch_common,
12541 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
12542 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
12543 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
12544 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
12545 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
12546 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
12547 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
12548 Arm_relocate_functions::thm_mobw_abs_nc,
12549 Arm_relocate_functions::thm_mov_abs,
12550 Arm_relocate_functions::movw_prel_nc,
12551 Arm_relocate_functions::thm_movt_abs,
12552 Arm_relocate_functions::movt_prel,
12553 Arm_relocate_functions::thm_movw_prel_nc,
12554 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
12555 (Target_arm::Relocate::relocate): Only decompose address into two
12556 parts if relocation type uses the thumb-bit and pass the actual
12557 bit instead of a flag indicating that the thumb-bit is used. Adjust
12558 calls to methods in Arm_relocate_functions for this change.
12559
12560 2009-11-08 Ian Lance Taylor <iant@google.com>
12561
12562 PR 10925
12563 * reloc.cc: Instantiate
12564 Sized_relobj::initialize_input_to_output_maps and
12565 Sized_relobj:free_input_to_output_maps.
12566
12567 2009-11-06 Ian Lance Taylor <iant@google.com>
12568
12569 PR 10876
12570 * defstd.cc (in_segment): Set only_if_ref true for "end".
12571
12572 2009-11-06 Doug Kwan <dougkwan@google.com>
12573
12574 * arm.cc (class Reloc_stub): Correct a comment.
12575 (Target_arm::Target_arm): Initialize arm_input_section_map_.
12576 (Target_arm::scan_section_for_stubs): New method declaration.
12577 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
12578 Change methods from private to protected.
12579 (Target_arm::do_may_relax): New method definition.
12580 (Target_arm::do_relax, Target_arm::group_sections,
12581 Target_arm::scan_reloc_for_stub,
12582 Target_arm::scan_reloc_section_for_stubs): New method declarations.
12583 (Target_arm::arm_input_section_map_): New data member declaration.
12584 (Target_arm::scan_reloc_for_stub,
12585 Target_arm::scan_reloc_section_for_stubs,
12586 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
12587 Target_arm::do_relax): New method definitions.
12588
12589 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
12590
12591 * configure.ac: Check for (struct stat)::st_mtim
12592 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
12593 * config.in: Regenerate.
12594 * configure: Regenerate.
12595
12596 2009-11-05 Ian Lance Taylor <iant@google.com>
12597
12598 PR 10910
12599 * output.cc (Output_segment::add_output_section): Add missing
12600 return statement.
12601
12602 2009-11-04 Ian Lance Taylor <iant@google.com>
12603
12604 PR 10880
12605 * object.h (class Object): Add is_needed and set_is_needed
12606 methods. Add is_needed_ field. Make bool fields into bitfields.
12607 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
12608 defined in a dynamic object and referenced by a regular object,
12609 set is_needed for the dynamic object.
12610 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
12611 if the file is marked with as_needed and it is not needed.
12612
12613 2009-11-04 Ian Lance Taylor <iant@google.com>
12614
12615 PR 10887
12616 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
12617 tags if data is discarded by linker script.
12618 * i386.cc (Target_i386::do_finalize_sections): Likewise.
12619 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12620 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12621 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12622
12623 2009-11-04 Ian Lance Taylor <iant@google.com>
12624
12625 * layout.cc (Layout::get_output_section): Add is_interp and
12626 is_dynamic_linker_section parameters. Change all callers.
12627 (Layout::choose_output_section): Likewise.
12628 (Layout::make_output_section): Likewise.
12629 (Layout::add_output_section_data): Add is_dynamic_linker_section
12630 parameter. Change all callers.
12631 * layout.h (class Layout): Update declarations.
12632 * output.h (class Output_section): Add is_interp, set_is_interp,
12633 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
12634 Add is_interp_, is_dynamic_linker_section_ fields. Change
12635 generate_code_fills_at_write_ to a bitfield.
12636 * output.cc (Output_section::Output_sections): Initialize new
12637 fields.
12638 (Output_segment::add_output_section): Add do_sort parameter.
12639 Change all callers.
12640
12641 2009-11-03 Ian Lance Taylor <iant@google.com>
12642
12643 PR 10860
12644 * options.h (class General_options): Add --warn-common.
12645 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
12646 merging two common symbols.
12647 (Symbol_table::should_override): Handle --warn-common when merging
12648 a common symbol with a defined symbol. Use report_resolve_problem
12649 for multiple definitions.
12650 (Symbol_table::report_resolve_problem): New function.
12651 * symtab.h (class Symbol_table): Declare report_resolve_problem.
12652
12653 2009-11-03 Doug Kwan <dougkwan@google.com>
12654
12655 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
12656 stub_factory_.
12657 (Target_arm::stub_factory): New method definition.
12658 (Target_arm::new_arm_input_section,
12659 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
12660 Target_arm::reloc_uses_thumb_bit): New method declarations.
12661 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
12662 New type definitions.
12663 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
12664 member declarations.
12665 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
12666 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
12667 New method definitions.
12668
12669 2009-11-03 Ian Lance Taylor <iant@google.com>
12670
12671 * options.h (class General_options): Add --warn_constructors.
12672
12673 2009-11-03 Ian Lance Taylor <iant@google.com>
12674
12675 PR 10893
12676 * defstd.cc (in_section): Add entries for __rel_iplt_start,
12677 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
12678
12679 2009-11-03 Ian Lance Taylor <iant@google.com>
12680
12681 PR 10895
12682 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
12683 --msgid-bugs-address.
12684 (install-pdf): New target.
12685 (install-data_yes): Look up one directory to find mkinstalldirs.
12686
12687 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
12688
12689 * po/Make-in (.po.gmo): Don't generate .gmo files in source
12690 tree.
12691
12692 2009-10-30 Doug Kwan <dougkwan@google.com>
12693
12694 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
12695
12696 2009-10-30 Doug Kwan <dougkwan@google.com>
12697
12698 * arm.cc (Stub_addend_reader): New struct template definition
12699 and partial specializations.
12700 (Stub_addend_reader::operator()): New method definition for a
12701 partially specialized template.
12702
12703 2009-10-30 Doug Kwan <dougkwan@google.com>
12704
12705 * arm.cc (Arm_relobj::processor_specific_flags): New method
12706 definition.
12707 (Arm_relobj::do_read_symbols): New method declaration.
12708 (Arm_relobj::processor_specific_flags_): New data member declaration.
12709 (Arm_dynobj): New class definition.
12710 (Target_arm::do_finalize_sections): Add input_objects parameter.
12711 (Target_arm::do_adjust_elf_header): New method declaration.
12712 (Target_arm::are_eabi_versions_compatible,
12713 (Target_arm::merge_processor_specific_flags): New method declaration.
12714 (Target_arm::do_make_elf_object): New overloaded method definitions
12715 and declaration.
12716 (Arm_relobj::do_read_symbols): New method definition.
12717 (Arm_dynobj::do_read_symbols): Ditto.
12718 (Target_arm::do_finalize_sections): Add input_objects parameters.
12719 Merge processor-specific flags from all input objects.
12720 (Target_arm::are_eabi_versions_compatible,
12721 Target_arm::merge_processor_specific_flags,
12722 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
12723 New method definitions.
12724 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
12725 Input_objects pointer type parameter.
12726 * layout.cc (Layout::finalize): Pass input objects to target's.
12727 finalize_sections function.
12728 * output.cc (Output_file_header::do_sized_write): Set ELF file
12729 header's processor-specific flags.
12730 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
12731 Input_objects pointer type parameter.
12732 * sparc.cc (Target_sparc::do_finalize_sections): Same.
12733 * target.h (Input_objects): New forward class declaration.
12734 (Target::processor_specific_flags,
12735 Target::are_processor_specific_flags_sect): New method definitions.
12736 (Target::finalize_sections): Add input_objects parameter.
12737 (Target::Target): Initialize processor_specific_flags_ and
12738 are_processor_specific_flags_set_.
12739 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
12740 parameter.
12741 (Target::set_processor_specific_flags): New method definition.
12742 (Target::processor_specific_flags_,
12743 Target::are_processor_specific_flags_set_): New data member
12744 declarations.
12745 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
12746 Input_objects pointer type parameter.
12747
12748 2009-10-30 Doug Kwan <dougkwan@google.com>
12749
12750 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
12751
12752 2009-10-28 Ian Lance Taylor <iant@google.com>
12753
12754 * object.h (class Relobj): Drop options parameter from
12755 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
12756 do_scan_relocs, do_relocate. Change all callers.
12757 (class Sized_relobj): Drop options parameters from
12758 do_gc_process_relocs, do_scan_relocs, do_relocate,
12759 do_relocate_sections, relocate_sections, emit_relocs_scan,
12760 emit_relocs_scan_reltype. Change all callers.
12761 (struct Relocate_info): Remove options field and all references to
12762 it.
12763 * reloc.h (class Read_relocs): Remove options constructor
12764 parameter and options_ field. Change all callers.
12765 (class Gc_process_relocs, class Scan_relocs): Likewise.
12766 (class Relocate_task): Likewise.
12767 * target-reloc.h (scan_relocs): Remove options parameter. Change
12768 all callers.
12769 (scan_relocatable_relocs): Likewise.
12770 * target.h (class Sized_target): Remove options parameter from
12771 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
12772 all callers.
12773 * gc.h (gc_process_relocs): Remove options parameter. Change all
12774 callers.
12775 * arm.cc: Update functions to remove options parameters.
12776 * i386.cc: Likewise.
12777 * powerpc.cc: Likewise.
12778 * sparc.cc: Likewise.
12779 * x86_64.cc: Likewise.
12780 * testsuite/testfile.cc: Likewise.
12781
12782 2009-10-28 Doug Kwan <dougkwan@google.com>
12783
12784 * arm.cc (Arm_relobj): New class definition.
12785 (Arm_relobj::scan_sections_for_stubs,
12786 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
12787 New method definitions.
12788
12789 2009-10-28 Cary Coutant <ccoutant@google.com>
12790
12791 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
12792 (Plugin::cleanup_done_): New member.
12793 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
12794 (Plugin_manager::cleanup_done_): Remove.
12795 (Plugin_manager::add_input_file): Edit error message.
12796 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
12797 (Plugin_manager::cleanup): Remove use of cleanup_done_.
12798
12799 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
12800
12801 * fileread.cc: (File_read::View::~View): Use the new
12802 data_ownership_ filed.
12803 (File_read::~File_read): Dispose the new whole_file_view_.
12804 (File_read::open): Mmap the whole file if needed.
12805 (File_read::open): Use whole_file_view_ instead of contents_.
12806 (File_read::find_view): Use whole_file_view_ if applicable.
12807 (File_read::do_read): Use whole_file_view_ instead of contents_.
12808 (File_read::make_view): Use whole_file_view_ instead of contents_,
12809 update File_read::View::View call.
12810 (File_read::find_or_make_view): Update File_read::View::View
12811 call.
12812 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
12813 remove contents_
12814 (File_read::View::Data_ownership): New enum.
12815 (File_read::View::View): Replace bool mapped_ with Data_ownership
12816 argument.
12817 (File_read::View::mapped_): Remove (replaced by data_ownership_).
12818 (File_read::View::data_ownership_): New field.
12819 (File_read::contents_): Remove (replaced by whole_file_view_).
12820 (File_read::whole_file_view_): New field.
12821 * options.h (class General_options): Add --keep-files-mapped.
12822
12823 2009-10-27 Cary Coutant <ccoutant@google.com>
12824
12825 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
12826 * testsuite/Makefile.am (plugin_test_5): New test case.
12827 * testsuite/Makefile.in: Regenerate.
12828
12829 2009-10-25 Doug Kwan <dougkwan@google.com>
12830
12831 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
12832 from private to protected to allow access by child class.
12833 (Sized_relobj::do_relocate_sections): New method declaration.
12834 (Sized_relobj::relocate_sections): Virtualize.
12835 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
12836 Sized_relobj::relocate_sections. Instantiate template explicitly
12837 for different target sizes and endianity.
12838
12839 2009-10-24 Doug Kwan <dougkwan@google.com>
12840
12841 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
12842 (Arm_input_section::as_arm_input_section): New method.
12843 (Arm_output_section): New class definition.
12844 (Arm_output_section::create_stub_group,
12845 Arm_output_section::group_sections): New method definitions.
12846
12847 2009-10-22 Doug Kwan <dougkwan@google.com>
12848
12849 * arm.cc (Arm_input_section): New class definition.
12850 (Arm_input_section::init, Arm_input_section:do_write,
12851 Arm_input_section::set_final_data_size,
12852 Arm_input_section::do_reset_address_and_file_offset): New method
12853 definitions.
12854
12855 2009-10-21 Doug Kwan <dougkwan@google.com>
12856
12857 * arm.cc (Stub_table, Arm_input_section): New forward class
12858 declarations.
12859 (Stub_table): New class defintion.
12860 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
12861 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
12862 New method definition.
12863
12864 2009-10-21 Doug Kwan <dougkwan@google.com>
12865
12866 * arm.cc: Update copyright comments.
12867 (Target_arm): New forward class template declaration.
12868 (Arm_address): New type.
12869 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
12870 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
12871 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
12872 constants.
12873 (Insn_template): Same.
12874 (DEF_STUBS): New macro.
12875 (Stub_type): New enum type.
12876 (Stub_template): New class definition.
12877 (Stub): Same.
12878 (Reloc_stub): Same.
12879 (Stub_factory): Same.
12880 (Target_arm::Target_arm): Initialize may_use_blx_ and
12881 should_force_pic_veneer_.
12882 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
12883 Target_arm::should_force_pic_veneer,
12884 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
12885 Target_arm::using_thumb_only, Target_arm:;default_target): New
12886 method defintions.
12887 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
12888 New data member declarations.
12889 (Insn_template::size, Insn_template::alignment): New method defintions.
12890 (Stub_template::Stub_template): New method definition.
12891 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
12892 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
12893 (Stub_factory::Stub_factory): New method definition.
12894 * gold.h (string_hash): New template.
12895 * output.h (Input_section_specifier::hash_value): Use
12896 gold::string_hash.
12897 (Input_section_specifier::string_hash): Remove.
12898 * stringpool.cc (Stringpool_template::string_hash): Use
12899 gold::string_hash.
12900
12901 2009-10-20 Doug Kwan <dougkwan@google.com>
12902
12903 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
12904 symbols of relaxed input sections.
12905 * output.h (Output_section::find_relaxed_input_section): Make
12906 method public.
12907
12908 2009-10-16 Doug Kwan <dougkwan@google.com>
12909
12910 * dynobj.cc (Versions::Versions): Initialize version_script_.
12911 Only insert base version symbol definition for a shared object
12912 if version script defines any version versions.
12913 (Versions::define_base_version): New method definition.
12914 (Versions::add_def): Check that base version is not needed.
12915 (Versions::add_need): Define base version lazily.
12916 * dynobj.h (Versions::define_base_version): New method declaration.
12917 (Versions::needs_base_version_): New data member declaration.
12918 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
12919 (check_DATA): Add no_version_test.stdout.
12920 (libno_version_test.so, no_version_test.o no_version_test.stdout):
12921 New make rules.
12922 * testsuite/Makefile.in: Regenerate.
12923 * testsuite/no_version_test.c: New file.
12924 * testsuite/no_version_test.sh: Ditto.
12925
12926 2009-10-16 Doug Kwan <dougkwan@google.com>
12927
12928 * expression.cc (class Segment_start_expression): New class definition.
12929 (Segment_start_expression::value): New method definition.
12930 (script_exp_function_segment_start): Return a new
12931 Segment_start_expression.
12932 * gold/script-c.h (script_saw_segment_start_expression): New function
12933 prototype.
12934 * script-sections.cc (Script_sections::Script_sections): Initialize
12935 SAW_SEGMENT_START_EXPRESSION_ to false.
12936 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
12937 and -Tbbs options to specify section addresses if given in
12938 command line and no SEGMENT_START expression is seen in a script.
12939 * script-sections.h (Script_sections::saw_segment_start_expression,
12940 Script_sections::set_saw_segment_start_expression): New method
12941 definition.
12942 (Script_sections::saw_segment_start_expression_): New data member
12943 declaration.
12944 * script.cc (script_saw_segment_start_expression): New function.
12945 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
12946 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
12947 script_test_7.sh and script_test_8.sh.
12948 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
12949 script_test_8.stdout.
12950 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
12951 (script_test_6, script_test_6.stdout, script_test_7,
12952 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
12953 * Makefile.in: Regenerate.
12954 * testsuite/script_test_6.sh: New file.
12955 * testsuite/script_test_6.t: Same.
12956 * testsuite/script_test_7.sh: Same.
12957 * testsuite/script_test_7.t: Same.
12958 * testsuite/script_test_8.sh: Same.
12959
12960 2009-10-16 Doug Kwan <dougkwan@google.com>
12961
12962 * output.cc (Output_segment::set_section_list_address): Cast
12963 expressions to unsigned long long type to avoid format warnings.
12964
12965 2009-10-15 Ian Lance Taylor <iant@google.com>
12966
12967 * script.cc (Script_options::add_symbol_assignment): Always add a
12968 dot assignment to script_sections_.
12969 * script-sections.cc (Script_sections::add_dot_assignment):
12970 Initialize if necessary.
12971
12972 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
12973 program headers with no load segment if there is a linker script.
12974
12975 * layout.cc (Layout::set_segment_offsets): Align the file offset
12976 to the segment aligment for -N or -n with no load segment.
12977 * output.cc (Output_segment::add_output_section): Don't crash if
12978 the first section is a TLS section.
12979 (Output_segment::set_section_list_addresses): Print an error
12980 message if the address moves backward in a linker script.
12981 * script-sections.cc
12982 (Output_section_element_input::set_section_addresses): Don't
12983 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
12984 (Orphan_output_section::set_section_addresses): Likewise.
12985
12986 2009-10-15 Doug Kwan <dougkwan@google.com>
12987
12988 * layout.cc (Layout::finish_dynamic_section): Generate tags
12989 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
12990 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
12991 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
12992
12993 2009-10-14 Ian Lance Taylor <iant@google.com>
12994
12995 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
12996 fields.
12997 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
12998 data_shdr fields of relinfo.
12999 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
13000 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
13001 R_386_TLS_LDO_32, adjust based on section flags.
13002 (Target_i386::Relocate::fix_up_ldo): Remove.
13003
13004 2009-10-13 Ian Lance Taylor <iant@google.com>
13005
13006 Add support for -pie.
13007 * options.h (class General_options): Add -pie and
13008 --pic-executable.
13009 (General_options::output_is_position_independent): Test -pie.
13010 (General_options::output_is_executable): Return true if not shared
13011 and not relocatable.
13012 (General_options::output_is_pie): Remove.
13013 * options.cc (General_options::finalize): Reject incompatible uses
13014 of -pie.
13015 * gold.cc (queue_middle_tasks): A -pie link is not static.
13016 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
13017 * symtab.cc (Symbol::final_value_is_known): Return false if
13018 output_is_position_independent.
13019 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
13020 output_is_position_independent.
13021 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
13022 output_is_position_independent.
13023 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
13024 output_is_position_independent.
13025 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
13026 two_file_pie_test.
13027 (basic_pie_test.o, basic_pie_test): New targets.
13028 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
13029 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
13030 (two_file_pie_test): New target.
13031 * testsuite/Makefile.in: Rebuild.
13032 * README: Remove note saying that -pie is not supported.
13033
13034 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
13035
13036 * options.h (class General_options): Add -init and -fini.
13037 * layout.cc (Layout::finish_dynamic_section): Emit
13038 given init and fini functions.
13039
13040 2009-10-13 Sriraman Tallam <tmsriram@google.com>
13041
13042 * gc.h (gc_process_relocs): Check if icf is enabled using new
13043 function.
13044 * gold.cc (queue_initial_tasks): Likewise.
13045 (queue_middle_tasks): Likewise.
13046 * object.cc (do_layout): Likewise.
13047 * symtab.cc (is_section_folded): Likewise.
13048 * main.cc (main): Likewise.
13049 * reloc.cc (Read_relocs::run): Likewise.
13050 (Sized_relobj::do_scan_relocs): Likewise.
13051 * icf.cc (is_function_ctor_or_dtor): New function.
13052 (Icf::find_identical_sections): Check if function is ctor or dtor when
13053 safe icf is chosen.
13054 * options.h (General_options::icf): Change option to be an enum.
13055 (Icf_status): New enum.
13056 (icf_enabled): New method.
13057 (icf_safe_folding): New method.
13058 (set_icf_status): New method.
13059 (icf_status_): New variable.
13060 * (options.cc) (General_options::finalize): Set icf_status_.
13061 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
13062 icf_test and icf_keep_unique_test to use the --icf enum flag.
13063 * testsuite/icf_safe_test.sh: New file.
13064 * testsuite/icf_safe_test.cc: New file.
13065
13066 2009-10-12 Sriraman Tallam <tmsriram@google.com>
13067
13068 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
13069 includes to gc.h and icf.h.
13070 * arm.cc: Include gc.h.
13071 * gold.cc: Likewise.
13072 * i386.cc: Likewise.
13073 * powerpc.cc: Likewise.
13074 * sparc.cc: Likewise.
13075 * x86_64.cc: Likewise.
13076 * gc.h: Include icf.h.
13077
13078 2009-10-11 Ian Lance Taylor <iant@google.com>
13079
13080 * plugin.cc: Include "gold.h" before other header files.
13081
13082 2009-10-10 Chris Demetriou <cgd@google.com>
13083
13084 * options.h (Input_file_argument::Input_file_type): New enum.
13085 (Input_file_argument::is_lib_): Replace with...
13086 (Input_file_argument::type_): New member.
13087 (Input_file_argument::Input_file_argument): Take Input_file_type
13088 'type' rather than boolean 'is_lib' as second argument.
13089 (Input_file_argument::is_lib): Use type_.
13090 (Input_file_argument::is_searched_file): New function.
13091 (Input_file_argument::may_need_search): Handle is_searched_file.
13092 * options.cc (General_options::parse_library): Support -l:filename.
13093 (General_options::parse_just_symbols): Update for Input_file_argument
13094 changes.
13095 (Command_line::process): Likewise.
13096 * archive.cc (Archive::get_file_and_offset): Likewise.
13097 * plugin.cc (Plugin_manager::release_input_file): Likewise.
13098 * script.cc (read_script_file, script_add_file): Likewise.
13099 * fileread.cc (Input_file::Input_file): Likewise.
13100 (Input_file::will_search_for): Handle is_searched_file.
13101 (Input_file::open): Likewise.
13102 * readsyms.cc (Read_symbols::get_name): Likewise.
13103 * testsuite/Makefile.am (searched_file_test): New test.
13104 * testsuite/Makefile.in: Regenerate.
13105 * testsuite/searched_file_test.cc: New file.
13106 * testsuite/searched_file_test_lib.cc: New file.
13107
13108 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
13109 Ian Lance Taylor <iant@google.com>
13110
13111 * descriptor.cc: Include <cstdio> and "binary-io.h".
13112 (Descriptors::open): Open the files in binary mode always.
13113 * script.cc (Lex::get_token): Treat \r as whitespace.
13114
13115 2009-10-09 Ian Lance Taylor <iant@google.com>
13116
13117 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
13118
13119 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
13120 Ian Lance Taylor <iant@google.com>
13121
13122 * configure.ac: Check for readv function also.
13123 * fileread.cc (readv): Define if not HAVE_READV.
13124 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
13125 does not exist.
13126 * config.in: Regenerate.
13127 * configure: Regenerate.
13128
13129 2009-10-09 Doug Kwan <dougkwan@google.com>
13130
13131 * layout.cc (Layout::make_output_section): Call target hook to make
13132 ordinary output section.
13133 (Layout::finalize): Adjust parameter list of call the
13134 Target::may_relax().
13135 * layout.h (class Layout::section_list): New method.
13136 * merge.h (Output_merge_base::entsize): Change visibility to public.
13137 (Output_merge_base::is_string, Output_merge_base::do_is_string):
13138 New methods.
13139 (Output_merge_string::do_is_string): New method.
13140 * object.cc (Sized_relobj::do_setup): renamed from
13141 Sized_relobj::set_up.
13142 * object.h (Sized_relobj::adjust_shndx,
13143 Sized_relobj::initializ_input_to_output_maps,
13144 Sized_relobj::free_input_to_output_maps): Change visibilities to
13145 protected.
13146 (Sized_relobj::setup): Virtualize.
13147 (Sized_relobj::do_setup): New method declaration.
13148 (Sized_relobj::invalidate_section_offset,
13149 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
13150 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
13151 * options.cc (parse_int): New function.
13152 * options.h (parse_int): New declaration.
13153 (DEFINE_int): New macro.
13154 (stub_group_size): New option.
13155 * output.cc (Output_section::Output_section): Initialize memebers
13156 merge_section_map_, merge_section_by_properties_map_,
13157 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
13158 (Output_section::add_input_section): Handled deferred code-fill
13159 generation and remove an old comment.
13160 (Output_section::add_relaxed_input_section): New method definition.
13161 (Output_section::add_merge_input_section): Use merge section by
13162 properties map to speed to search. Update merge section maps
13163 as appropriate.
13164 (Output_section::build_relaxation_map): New method definition.
13165 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
13166 Same.
13167 (Output_section::relax_input_section): Renamed to
13168 Output_section::convert_input_sections_to_relaxed_sections and change
13169 interface to take a vector of pointers to relaxed sections.
13170 (Output_section::find_merge_section,
13171 Output_section::find_relaxed_input_section): New method definitions.
13172 (Output_section::is_input_address_mapped,
13173 Output_section::output_offset, Output_section::output_address):
13174 Use output section data maps to speed up searching.
13175 (Output_section::find_starting_output_address): Add comments.
13176 (Output_section::do_write,
13177 Output_section::write_to_postprocessing_buffer): Do code-fill
13178 generation as appropriate.
13179 (Output_section::get_input_sections): Invalidate relaxed input section
13180 map.
13181 (Output_section::restore_states): Adjust type of checkpoint .
13182 Invalidate relaxed input section map.
13183 * output.h (Output_merge_base): New class declaration.
13184 (Input_section_specifier): New class defintion.
13185 (class Output_relaxed_input_section) Change base class to
13186 Output_section_data_build.
13187 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
13188 base class initializer.
13189 (Output_section::add_relaxed_input_section): New method declaration.
13190 (Output_section::Input_section): Change visibility to protected.
13191 (Output_section::Input_section::relobj,
13192 Output_section::Input_section::shndx): Handle relaxed input sections.
13193 Output_section::input_sections) Change visibility to protected. Also
13194 define overload to return a non-const pointer.
13195 (Output_section::Merge_section_properties): New class defintion.
13196 (Output_section::Merge_section_by_properties_map,
13197 Output_section::Output_section_data_by_input_section_map,
13198 Output_section::Relaxation_map): New types.
13199 (Output_section::relax_input_section): Rename method to
13200 Output_section::convert_input_sections_to_relaxed_sections and change
13201 interface to take a vector of relaxed section pointers.
13202 (Output_section::find_merge_section,
13203 Output_section::find_relaxed_input_section,
13204 Output_section::build_relaxation_map,
13205 Output_section::convert_input_sections_in_list_to_relaxed_sections):
13206 New method declarations.
13207 (Output_section::merge_section_map_
13208 Output_section::merge_section_by_properties_map_,
13209 Output_section::relaxed_input_section_map_,
13210 Output_section::is_relaxed_input_section_map_valid_,
13211 Output_section::generate_code_fills_at_write_): New data members.
13212 * script-sections.cc
13213 (Output_section_element_input::set_section_addresses): Call
13214 current_data_size and addralign methods of relaxed input sections.
13215 (Orphan_output_section::set_section_addresses): Call current_data_size
13216 and addralign methods of relaxed input sections.
13217 * symtab.cc (Symbol_table::compute_final_value): Extract template
13218 from the body of Symbol_table::sized_finalize_symbol.
13219 (Symbol_table::sized_finalized_symbol): Call
13220 Symbol_table::compute_final_value.
13221 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
13222 (Symbol_table::compute_final_value): New templated method declaration.
13223 * target.cc (Target::do_make_output_section): New method defintion.
13224 * target.h (Target::make_output_section): New method declaration.
13225 (Target::relax): Add more parameters for input objects, symbol table
13226 and layout. Adjust call to do_relax.
13227 (Target::do_make_output_section): New method declaration.
13228 (Target::do_relax): Add parameters for input objects, symbol table
13229 and layout.
13230
13231 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
13232
13233 * pread.c: Include stdio.h.
13234
13235 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
13236
13237 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
13238 defined.
13239
13240 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
13241
13242 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
13243 Change read_shndx type to unsigned int.
13244 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13245 int.
13246 (Sized_dwarf_line_info::read_line_mappings): Likewise.
13247 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
13248 Change read_shndx type to unsigned int.
13249 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13250 int.
13251 (Sized_dwarf_line_info::read_line_mappings): Likewise.
13252 * layout.cc (Layout::create_symtab_sections): Cast the result of
13253 local_symcount * symsize to off_t in the gold_assert.
13254
13255 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
13256
13257 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
13258 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
13259 R_ARM_BASE_ABS.
13260 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
13261 (Arm_relocate_functions::thm_abs5): New function.
13262 (Arm_relocate_functions::abs12): New function.
13263 (Arm_relocate_functions::abs16): New function.
13264 (Arm_relocate_functions::base_abs): New function.
13265 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
13266 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
13267 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
13268 R_ARM_BASE_ABS.
13269 (Scan::global): Likewise.
13270 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
13271 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
13272 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
13273 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
13274 R_ARM_BASE_ABS.
13275
13276 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
13277
13278 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
13279 (Arm_relocate_functions::movt_prel): New function.
13280 (Arm_relocate_functions::thm_movw_prel_nc): New function.
13281 (Arm_relocate_functions::thm_movt_prel): New function.
13282 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
13283 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
13284 (Scan::global, Relocate::relocate): Likewise.
13285 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13286
13287 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
13288
13289 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
13290 Incremental_checker.
13291 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
13292 unsigned int.
13293 (class Incremental_inputs_header): New class.
13294 (Incremental_inputs_header_writer): Edit comment.
13295 (Incremental_inputs_entry): New class.
13296 (Incremental_inputs_entry_writer): Edit comment.
13297 (Sized_incremental_binary::do_find_incremental_inputs_section):
13298 Add *strtab_shndx parameter, fill it.
13299 (Sized_incremental_binary::do_check_inputs): New method.
13300 (Incremental_checker::can_incrementally_link_output_file): Use
13301 Sized_incremental_binary::check_inputs.
13302 (Incremental_inputs::report_command_line): Save command line in
13303 command_line_.
13304 * incremental.h:
13305 (Incremental_binary::find_incremental_inputs_section): New
13306 method.
13307 (Incremental_binary::do_find_incremental_inputs_section): Add
13308 strtab_shndx parameter.
13309 (Incremental_binary::do_check_inputs): New pure virtual method.
13310 (Sized_incremental_binary::do_check_inputs): Declare.
13311 (Incremental_checker::Incremental_checker): Add incremental_inputs
13312 parameter, use it to initialize incremental_inputs_.
13313 (Incremental_checker::incremental_inputs_): New field.
13314 (Incremental_checker::command_line): New method.
13315 (Incremental_checker::inputs): New method.
13316 (Incremental_checker::command_line_): New field.
13317
13318 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
13319
13320 * incremental.cc: Include <cstdarg> and "target-select.h".
13321 (vexplain_no_incremental): New function.
13322 (explain_no_incremental): New function.
13323 (Incremental_binary::error): New method.
13324 (Sized_incremental_binary::do_find_incremental_inputs_section): New
13325 method.
13326 (make_sized_incremental_binary): New function.
13327 (open_incremental_binary): New function.
13328 (can_incrementally_link_file): Add checks if output is ELF and has
13329 inputs section.
13330 * incremental.h: Include "elfcpp_file.h" and "output.h".
13331 (Incremental_binary): New class.
13332 (Sized_incremental_binary): New class.
13333 (open_incremental_binary): Declare.
13334 * object.cc (is_elf_object): Use
13335 elfcpp::Elf_recognizer::is_elf_file.
13336 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
13337 * output.h (Output_file::filesize): New method.
13338
13339 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
13340
13341 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
13342 New function.
13343 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
13344 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
13345 function.
13346 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
13347 function.
13348 (Arm_relocate_functions::movw_abs_nc): New function.
13349 (Arm_relocate_functions::movt_abs): New function.
13350 (Arm_relocate_functions::thm_movw_abs_nc): New function.
13351 (Arm_relocate_functions::thm_movt_abs): New function.
13352 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
13353 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
13354 (Scan::global): Likewise.
13355 (Relocate::relocate): Likewise.
13356 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13357
13358 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
13359
13360 * arm.cc (Arm_relocate_functions::got_prel) New function.
13361 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
13362 (Relocate::relocate): Likewise.
13363 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13364
13365 2009-10-06 Ian Lance Taylor <iant@google.com>
13366
13367 * options.h (class General_options): Define
13368 split_stack_adjust_size parameter.
13369 * object.h (class Object): Add uses_split_stack_ and
13370 has_no_split_stack_ fields. Add uses_split_stack and
13371 has_no_split_stack accessor functions. Declare
13372 handle_split_stack_section.
13373 (class Reloc_symbol_changes): Define.
13374 (class Sized_relobj): Define Function_offsets. Declare
13375 split_stack_adjust, split_stack_adjust_reltype, and
13376 find_functions.
13377 * object.cc (Object::handle_split_stack_section): New function.
13378 (Sized_relobj::do_layout): Call handle_split_stack_section.
13379 * dynobj.cc (Sized_dynobj::do_layout): Call
13380 handle_split_stack_section.
13381 * reloc.cc (Sized_relobj::relocate_sections): Call
13382 split_stack_adjust for executable sections in split_stack
13383 objects. Pass reloc_map to relocate_section.
13384 (Sized_relobj::split_stack_adjust): New function.
13385 (Sized_relobj::split_stack_adjust_reltype): New function.
13386 (Sized_relobj::find_functions): New function.
13387 * target-reloc.h: Include "object.h".
13388 (relocate_section): Add reloc_symbol_changes parameter. Change
13389 all callers.
13390 * target.h (class Target): Add calls_non_split method. Declare
13391 do_calls_non_split virtual method. Declare match_view and
13392 set_view_to_nop.
13393 * target.cc: Include "elfcpp.h".
13394 (Target::do_calls_non_split): New function.
13395 (Target::match_view): New function.
13396 (Target::set_view_to_nop): New function.
13397 * gold.cc (queue_middle_tasks): Give an error if mixing
13398 split-stack and non-split-stack objects with -r.
13399 * i386.cc (Target_i386::relocate_section): Add
13400 reloc_symbol_changes parameter.
13401 (Target_i386::do_calls_non_split): New function.
13402 * x86_64.cc (Target_x86_64::relocate_section): Add
13403 reloc_symbol_changes parameter.
13404 (Target_x86_64::do_calls_non_split): New function.
13405 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
13406 parameter.
13407 * powerpc.cc (Target_powerpc::relocate_section): Add
13408 reloc_symbol_changes parameter.
13409 * sparc.cc (Target_sparc::relocate_section): Add
13410 reloc_symbol_changes parameter.
13411 * configure.ac: Call AM_CONDITIONAL for the default target.
13412 * configure: Rebuild.
13413 * testsuite/Makefile.am (TEST_AS): New variable.
13414 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
13415 (check_DATA): Add split_i386 and split_x86_64 files.
13416 (SPLIT_DEFSYMS): Define.
13417 (split_i386_[1234n].o): New targets.
13418 (split_i386_[124]): New targets.
13419 (split_i386_[1234r].stdout): New targets.
13420 (split_x86_64_[1234n].o): New targets.
13421 (split_x86_64_[124]): New targets.
13422 (split_x86_64_[1234r].stdout): New targets.
13423 (MOSTLYCLEANFILES): Add new executables.
13424 * testsuite/split_i386.sh: New file.
13425 * testsuite/split_x86_64.sh: New file.
13426 * testsuite/split_i386_1.s: New file.
13427 * testsuite/split_i386_2.s: New file.
13428 * testsuite/split_i386_3.s: New file.
13429 * testsuite/split_i386_4.s: New file.
13430 * testsuite/split_i386_n.s: New file.
13431 * testsuite/split_x86_64_1.s: New file.
13432 * testsuite/split_x86_64_2.s: New file.
13433 * testsuite/split_x86_64_3.s: New file.
13434 * testsuite/split_x86_64_4.s: New file.
13435 * testsuite/split_x86_64_n.s: New file.
13436 * testsuite/testfile.cc (Target_test): Update relocation_section
13437 function.
13438 * testsuite/Makefile.in: Rebuild.
13439
13440 2009-10-06 Ian Lance Taylor <iant@google.com>
13441
13442 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
13443 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
13444 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
13445 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
13446 the address on ldo_addrs_.
13447 (Target_i386::Relocate::fix_up_ldo): New function.
13448
13449 2009-10-06 Rafael Espindola <espindola@google.com>
13450
13451 * plugin.cc (add_input_library): New.
13452 (Plugin::load): Add add_input_library to tv.
13453 (Plugin_manager::add_input_file): Add the is_lib argument.
13454 (add_input_file): Update call to Plugin_manager::add_input_file.
13455 (add_input_library): New.
13456 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
13457
13458 2009-09-30 Doug Kwan <dougkwan@google.com>
13459
13460 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
13461 symbol and call Symbol::may_need_copy_reloc to determine if
13462 a copy reloc is needed.
13463 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
13464 nocopyreloc is given in command line.
13465 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
13466 given in command line.
13467 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
13468 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
13469 of the removed Target_i386::may_need_copy_reloc.
13470 * options.h (copyreloc): New option with default value false.
13471 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13472 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
13473 instead of the removed Target_powerpc::may_need_copy_reloc.
13474 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13475 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
13476 instead of the removed Target_sparc::may_need_copy_reloc.
13477 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
13478 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
13479 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
13480 instead of the removed Target_x86_64::may_need_copy_reloc.
13481
13482 2009-09-30 Ian Lance Taylor <iant@google.com>
13483
13484 * object.h (class Object): Remove target_ field, and target,
13485 sized_target, and set_target methods.
13486 (Object::sized_target): Remove.
13487 (class Sized_relobj): Update declarations. Remove sized_target.
13488 * object.cc (Sized_relobj::setup): Remove target parameter.
13489 Change all callers.
13490 (Input_objects::add_object): Don't do anything with the target.
13491 (make_elf_sized_object): Add punconfigured parameter. Change all
13492 callers. Set or test parameter target.
13493 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
13494 Change all callers.
13495 * parameters.cc (Parameters::set_target): Change parameter type to
13496 be non-const.
13497 (Parameters::default_target): Remove.
13498 (set_parameters_target): Change parameter type to be non-const.
13499 (parameters_force_valid_target): New function.
13500 (parameters_clear_target): New function.
13501 * parameters.h (class Parameters): Update declarations. Remove
13502 default_target method. Add sized_target and clear_target
13503 methods. Change target_ to be non-const.
13504 (set_parameters_target): Update declaration.
13505 (parameters_force_valid_target): Declare.
13506 (parameters_clear_target): Declare.
13507 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
13508 as NULL if we aren't searching.
13509 (Add_symbols::run): Don't check for compatible target.
13510 * fileread.cc (Input_file::open_binary): Call
13511 parameters_force_valid_target.
13512 * gold.cc (queue_middle_tasks): Likewise.
13513 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
13514 set_target on object.
13515 * dynobj.h (class Sized_dynobj): Update declarations.
13516 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
13517 make_elf_object returns NULL.
13518 (Archive::include_member): Don't check whether object target is
13519 compatible.
13520 * output.cc (Output_section::add_input_section): Get target from
13521 parameters.
13522 (Output_section::relax_input_section): Likewise.
13523 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
13524 parameters.
13525 (Sized_relobj::do_scan_relocs): Likewise.
13526 (Sized_relobj::relocate_sections): Likewise.
13527 * resolve.cc (Symbol_table::resolve): Likewise.
13528 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
13529 parameter. Change all callers.
13530 (Symbol_table::add_from_object): Get target from parameters.
13531 (Symbol_table::add_from_relobj): Don't check object target.
13532 (Symbol_table::add_from_dynobj): Likewise.
13533 (Symbol_table::define_special_symbol): Get target from
13534 parameters.
13535 * symtab.h (class Symbol_table): Update declaration.
13536 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
13537 parameter. Change all callers. Clear parameter target.
13538 (Binary_test): Test target here.
13539 * testsuite/object_unittest.cc (gold_testsuite): Remove
13540 target_test_pointer parameter. Change all callers.
13541 (Object_test): Test target here.
13542
13543 2009-09-26 Ian Lance Taylor <iant@google.com>
13544
13545 * testsuite/initpri1.c: Don't try to use constructor priorities if
13546 compiling with gcc before 4.3.
13547
13548 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
13549
13550 * testsuite/retain_symbols_file_test.sh (check_present): Change
13551 output file name to retain_symbols_file_test.stdout.
13552 (check_absent): Likewise.
13553
13554 2009-09-18 Craig Silverstein <csilvers@google.com>
13555
13556 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
13557 * options.cc: Include <cerrno> and <fstream>.
13558 (General_options::finalize): Parse -retain-symbols-file tag.
13559 * options.h: New flag.
13560 (General_options): New method should_retain_symbol, new
13561 variable symbols_to_retain.
13562 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
13563 should_retain_symbol map.
13564 * testsuite/Makefile.am (retain_symbols_file_test): New test.
13565 * testsuite/Makefile.in: Regenerate.
13566 * testsuite/retain_symbols_file_test.sh: New file.
13567
13568 2009-09-18 Nick Clifton <nickc@redhat.com>
13569
13570 * po/es.po: Updated Spanish translation.
13571
13572 2009-09-17 Doug Kwan <dougkwan@google.com>
13573
13574 * debug.h (DEBUG_RELAXATION): New constant.
13575 (DEBUG_ALL): Add DEBUG_RELAXATION.
13576 (debug_string_to_enum): Add relaxation debug option.
13577 * layout.cc
13578 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
13579 Layout::Relaxation_debug_check::read_sections,
13580 Layout::Relaxation_debug_check::read_sections): New method definitions.
13581 (Layout::Layout): Initialize data members
13582 record_output_section_data_from_scrips_,
13583 script_output_section_data_list_ and relaxation_debug_check_.
13584 (Layout::save_segments, Layout::restore_segments,
13585 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13586 Layout::relaxation_loop_body): New method definitions.
13587 (Layout::finalize): Support relaxation. Move section layout code to
13588 Layout::relaxation_loop_body.
13589 (Layout::set_asection_address_from_script): Move code for orphan
13590 section placement out.
13591 (Layout::place_orphan_sections_in_script): New method definition.
13592 * layout.h (Output_segment_headers, Output_file_header):
13593 New forward class declarations.
13594 (Layout::~Layout): Define.
13595 (Layout::new_output_section_data_from_script): New method definition.
13596 (Layout::place_orphan_sections_in_script): New method declaration.
13597 (Layout::Segment_states): New type declaration.
13598 (Layout::save_segments, Layout::restore_segments,
13599 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13600 Layout::relaxation_loop_body): New method declarations.
13601 (Layout::Output_section_data_list): New type declaration.
13602 (Layout::Relaxation_debug_check): New class definition.
13603 (Layout::record_output_section_data_from_script_,
13604 Layout::script_output_section_data_list_, Layout::segment_states_,
13605 Layout::relaxation_debug_check_): New data members.
13606 * output.cc: (Output_section_headers::do_size): New method definition.
13607 (Output_section_headers::Output_section_headers): Move size
13608 computation to Output_section_headers::do_size.
13609 (Output_segment_headers::do_size): New method definition.
13610 (Output_file_header::Output_file_header): Move size computation to
13611 Output_file_header::do_size and call it.
13612 (Output_file_header::do_size): New method definition.
13613 (Output_data_group::Output_data_group): Adjust call to
13614 Output_section_data.
13615 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
13616 (Output_symtab_xindex::do_write): Add array bound check.
13617 (Output_section::Input_section::print_to_mapfile): Handle
13618 RELAXED_INPUT_SECTION_CODE.
13619 (Output_section::Output_section): Initialize data member checkpoint_.
13620 (Output_section::~Output_section): Delete checkpoint object pointed
13621 by checkpoint_.
13622 (Output_section::add_input_section): Always add an Input_section if
13623 relaxing.
13624 (Output_section::add_merge_input_section): Add assert.
13625 (Output_section::relax_input_section): New method definition.
13626 (Output_section::set_final_data_size): Set load address to zero for
13627 an unallocated section.
13628 (Output_section::do_address_and_file_offset_have_reset_values):
13629 New method definition.
13630 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
13631 Handle relaxed input section.
13632 (Output_section::sort_attached_input_sections): Checkpoint input
13633 section list lazily.
13634 (Output_section::get_input_sections): Change type of input_sections to
13635 list of Simple_input_section pointers. Checkpoint input section list
13636 lazily. Also handle relaxed input sections.
13637 (Output_section::add_input_section_for_script): Take a reference to
13638 a Simple_input_section object instead of Relobj pointer and section
13639 index as parameter. Handle relaxed input sections.
13640 (Output_section::save_states, Output_section::restore_states): New
13641 method definitions.
13642 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
13643 (Output_data::is_data_size_fixed): New method definition.
13644 (Output_data::reset_addresss_and_file_offset): Do not reset data size
13645 if it is fixed.
13646 (Output_data::address_and_file_offset_have_reset_values): New method
13647 definition.
13648 (Output_data::do_address_and_file_offset_have_reset_values): New method
13649 definition.
13650 (Output_data::set_data_size): Check that data size is not fixed.
13651 (Output_data::fix_data_size): New method definition.
13652 (Output_data::is_data_size_fixed_): New data member.
13653 (Output_section_headers::set_final_data_size): New method definition.
13654 (Output_section_headers::do_size): New method declaration.
13655 (Output_segment_headers::set_final_data_size): New method definition.
13656 (Output_segment_headers::do_size): New method declaration.
13657 (Output_file_header::set_final_data_size)::New method definition.
13658 (Output_file_header::do_size)::New method declaration.
13659 (Output_section_data::Output_section_data): Add new parameter
13660 is_data_size_fixed and use it to fix data size.
13661 (Output_data_const::Output_data_const): Adjust call to base class
13662 constructor and fix data size.
13663 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
13664 base class constructor and fix data size.
13665 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
13666 base class constructor and fix data size.
13667 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
13668 class constructor and fix data size.
13669 (Output_data_group::set_final_data_size): New method definition.
13670 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
13671 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
13672 class constructor and fix data size.
13673 (Output_relaxed_input_section): New class definition.
13674 (Output_section::Simple_input_section): New class definition.
13675 (Output_section::get_input_sections): Adjust parameter list.
13676 (Output_section::add_input_section_for_script): Same.
13677 (Output_section::save_states, Output_section::restore_states,
13678 Output_section::do_address_and_file_offset_have_reset_values,
13679 (Output_section::Input_section::Input_section): Handle
13680 RELAXED_INPUT_SECTION_CODE. Add new overload for
13681 Output_relaxed_input_section.
13682 (Output_section::Input_section::is_input_section,
13683 Output_section::Input_section::set_output_section): Handle relaxed
13684 input section.
13685 (Output_section::Input_section::is_relaxed_input_section,
13686 Output_section::Input_section::output_section_data,
13687 Output_section::Input_section::relaxed_input_section): New method
13688 definitions.
13689 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
13690 value.
13691 (Output_section::Input_section::u1_): Update comments.
13692 (Output_section::Input_section::u2_): Add new union member poris.
13693 (Output_section::Checkpoint_output_section): New classs definition.
13694 (Output_section::relax_input_section): New method declaration.
13695 (Output_section::checkpoint_): New data member.
13696 (Output_segment): Update comments.
13697 (Output_segment::Output_segment): Un-privatize copy constructor.
13698 (Output_segment::operator=): Un-privatize.
13699 * script-sections.cc (Output_section_element::Input_section_list):
13700 Change element type to Output_section::Simple_input_section.
13701 (Output_section_element_dot_assignment::set_section_addresses):
13702 Register output section data for relaxation clean up.
13703 (Output_data_exression::Output_data_expression): Adjust call to base
13704 constructor to fix data size.
13705 (Output_section_element_data::set_section_addresses): Register
13706 Output_data_expression object for relaxation clean up.
13707 (struct Input_section_info): Replace Relobj pointer and section index
13708 pair with Output_section::Simple_input_section and Convert struct to a
13709 class.
13710 (Input_section_sorter::operator()): Adjust access to
13711 Input_section_info data member to use accessors.
13712 (Output_section_element_input::set_section_addresses): Use layout
13713 parameter. Adjust code to use Output_section::Simple_input_section
13714 and Input_secction_info classes. Register filler for relaxation
13715 clean up.
13716 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
13717 and section index pair with Output_section::Simple_input_section
13718 class. Adjust code accordingly.
13719 (Phdrs_element::release_segment): New method definition.
13720 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
13721 segment list.
13722 (Script_sections::release_segments): New method definition.
13723 * gold/script-sections.h (Script_sections::release_segments): New
13724 method declaration.
13725 * gold/target.h (Target::may_relax, Target::relax,
13726 Target::do_may_relax, Target::do_relax): New method definitions.
13727
13728 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
13729
13730 * arm.cc (has_signed_unsigned_overflow): New function.
13731 (Arm_relocate_functions::abs8): New function.
13732 (Target_arm::Scan::local): Handle R_ARM_ABS8.
13733 (Target_arm::Scan::global): Likewise.
13734 (Target_arm::relocate::relocate): Likewise.
13735 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
13736 Likewise.
13737
13738 2009-09-16 Cary Coutant <ccoutant@google.com>
13739
13740 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
13741 * testsuite/Makefile.in: Regenerate.
13742
13743 2009-09-11 Nick Clifton <nickc@redhat.com>
13744
13745 * po/gold.pot: Updated by the Translation project.
13746
13747 2009-09-08 Cary Coutant <ccoutant@google.com>
13748
13749 * output.cc (Output_file::open): Add execute permission to empty file.
13750 * testsuite/Makefile.am (permission_test): New test.
13751 * testsuite/Makefile.in: Regenerate.
13752
13753 2009-09-02 Ian Lance Taylor <iant@google.com>
13754
13755 * output.cc (Output_file::resize): Call map_no_anonymous rather
13756 than map.
13757
13758 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
13759
13760 * gold.cc: Include "incremental.h".
13761 (queue_initial_tasks): Call Incremental_checker methods.
13762 * incremental.cc: Include "output.h".
13763 (Incremental_checker::can_incrementally_link_output_file): New
13764 method.
13765 * incremental.h (Incremental_checker): New class.
13766
13767 * output.cc (Output_file::open_for_modification): New method.
13768 (Output_file::map_anonymous): Changed return type to bool. Record
13769 map in base_ field.
13770 (Output_file::map_no_anonymous): New method, broken out of map.
13771 (Output_file::map): Use map_no_anonymous and map_anonymous.
13772 * output.h (class Output_file): Update declarations.
13773
13774 2009-08-24 Cary Coutant <ccoutant@google.com>
13775
13776 * options.h (Command_line::Pre_options): New class.
13777 (Command_line::pre_options): New member.
13778 * options.cc (gold::options::ready_to_register): New variable.
13779 (One_option::register_option): Do nothing if not registering options.
13780 Assert if same short option registered twice.
13781 (General_options::General_options): Turn off option registration when
13782 done constructing.
13783 (Command_line::Pre_options::Pre_options): New constructor.
13784
13785 2009-08-24 Cary Coutant <ccoutant@google.com>
13786
13787 * options.h (General_options::no_keep_memory): Remove incorrect
13788 short option.
13789
13790 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
13791
13792 * Makefile.am (am__skiplex, am__skipyacc): New.
13793 * Makefile.in: Regenerate.
13794
13795 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
13796
13797 * Makefile.am (AM_CPPFLAGS): Renamed from ...
13798 (INCLUDES): ... this.
13799 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
13800 (AM_CPPFLAGS): Renamed from ...
13801 (INCLUDE): ... this.
13802 * Makefile.in, testsuite/Makefile.in: Regenerate.
13803
13804 * Makefile.in: Regenerate.
13805 * aclocal.m4: Likewise.
13806 * config.in: Likewise.
13807 * configure: Likewise.
13808 * testsuite/Makefile.in: Likewise.
13809
13810 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13811 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13812 * Makefile.in: Regenerate.
13813 * testsuite/Makefile.in: Regenerate.
13814
13815 2009-08-19 Cary Coutant <ccoutant@google.com>
13816
13817 * resolve.cc (Symbol_table::resolve): Don't complain about defined
13818 symbols in shared libraries overridden by hidden or internal symbols
13819 in the main program.
13820
13821 2009-08-19 Chris Demetriou <cgd@google.com>
13822
13823 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
13824 checking source file names in error messages.
13825
13826 2009-08-18 Doug Kwan <dougkwan@google.com>
13827
13828 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
13829 an elcpp::Ehdr as parameter. Adjust call to set_target.
13830 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
13831 an elfcpp::Ehdr as parameter.
13832 * object.cc (Object::set_target): Remove the version that looks up
13833 a target and sets it.
13834 (Sized_relobj::setup): Take a Target object instead of
13835 an elfcpp::Ehdr as parameter. Adjust call to set_target.
13836 (make_elf_sized_object): Find target and ask target to
13837 make an ELF object.
13838 * object.h: (Object::set_target): Remove the version that looks up
13839 a target and sets it.
13840 (Sized_relobj::setup): Take a Target object instead of
13841 an elfcpp:Ehdr as parameter.
13842 * target.cc: Include dynobj.h.
13843 (Target::do_make_elf_object_implementation): New.
13844 (Target::do_make_elf_object): New.
13845 * target.h (Target::make_elf_object): New template declaration.
13846 (Target::do_make_elf_object): New method declarations.
13847 (Target::do_make_elf_object_implementation): New template declaration.
13848
13849 2009-08-14 Ian Lance Taylor <iant@google.com>
13850
13851 * gold.h (FUNCTION_NAME): Define.
13852 (gold_unreachable): Use FUNCTION_NAME.
13853
13854 2009-08-12 Sriraman Tallam <tmsriram@google.com>
13855
13856 * icf.cc (Icf::find_identical_sections): Issue a warning when a
13857 symbol in the --keep-unique list is not found.
13858
13859 2009-08-12 Sriraman Tallam <tmsriram@google.com>
13860
13861 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
13862 been maked as --keep-unique.
13863 (Icf::unfold_section): New function.
13864 * icf.h (Icf::unfold_section): New function.
13865 * options.h (General_options::keep_unique): New option.
13866 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
13867 * testsuite/Makefile.in: Regenerate.
13868 * testsuite/icf_keep_unique_test.sh: New file.
13869 * testsuite/icf_keep_unique_test.cc: New file.
13870
13871 2009-08-12 Cary Coutant <ccoutant@google.com>
13872
13873 PR 10471
13874 * resolve.cc (Symbol_table::resolve): Check for references from
13875 dynamic objects to hidden and internal symbols.
13876 * testsuite/Makefile.am (hidden_test.sh): New test.
13877 * testsuite/Makefile.in: Regenerate.
13878 * testsuite/hidden_test.sh: New script.
13879 * testsuite/hidden_test_1.c: New test source.
13880 * testsuite/hidden_test_main.c: New test source.
13881
13882 2009-08-11 Doug Kwan <dougkwan@google.com>
13883
13884 * arm.cc: Update comments.
13885 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
13886 segment to locate the .ARM.exidx section if present.
13887
13888 2009-08-09 Doug Kwan <dougkwan@google.com>
13889
13890 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
13891 patch.
13892
13893 2009-08-07 Sriraman Tallam <tmsriram@google.com>
13894 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
13895 compiler warnings.
13896
13897 2009-08-06 Sriraman Tallam <tmsriram@google.com>
13898
13899 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
13900 valid tls_segment only for non-debug-section relocations.
13901 * testsuite/Makefile.am: Add gc_tls_test.
13902 * testsuite/Makefile.in: Regenerate.
13903 * testsuite/gc_tls_test.cc: New file.
13904 * testsuite/gc_tls_test.sh: New file.
13905
13906 2009-08-05 Sriraman Tallam <tmsriram@google.com>
13907
13908 * icf.cc: New file.
13909 * icf.h: New file.
13910 * Makefile.am (CCFILES): Add icf.cc.
13911 (HFILES): Add icf.h
13912 * Makefile.in: Regenerate.
13913 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
13914 * gc.h (gc_process_relocs): Populate lists used by icf to contain
13915 section, symbol and addend information for the relocs.
13916 * gold.cc (queue_middle_tasks): Call identical code folding.
13917 * gold.h: Add defines for multimap.
13918 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
13919 to the call of finalize_local_symbols.
13920 * main.cc (main): Create object of class Icf.
13921 * object.cc (Sized_relobj::do_layout): Allow this function to be
13922 called twice during icf.
13923 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
13924 to sections marked as identical by icf.
13925 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
13926 when available.
13927 (Sized_relobj::do_section_entsize): New function.
13928 * object.h (Object::section_entsize): New function.
13929 (Object::do_section_entsize): New pure virtual function.
13930 (Relobj::finalize_local_symbols): Add new parameter.
13931 (Relobj::do_section_entsize): New function.
13932 * options.h (General_options::icf): New option.
13933 (General_options::icf_iterations): New option.
13934 (General_options::print_icf_sections): New option.
13935 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
13936 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
13937 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
13938 icf.
13939 * symtab.cc (Symbol_table::is_section_folded): New function.
13940 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
13941 to sections marked as identical by icf.
13942 * symtab.h (Symbol_table::set_icf): New function.
13943 (Symbol_table::icf): New function.
13944 (Symbol_table::is_section_folded): New function.
13945 (Symbol_table::icf_): New data member.
13946 * target-reloc.h (relocate_section): Ignore sections folded by icf.
13947 * testsuite/Makefile.am: Add commands to build icf_test.
13948 * testsuite/Makefile.in: Regenerate.
13949 * testsuite/icf_test.sh: New file.
13950 * testsuite/icf_test.cc: New file.
13951
13952 2009-07-24 Chris Demetriou <cgd@google.com>
13953
13954 * layout.cc (is_compressible_debug_section): Fix incorrect
13955 comment about compressed section names.
13956
13957 2009-07-20 Ian Lance Taylor <ian@airs.com>
13958
13959 PR 10419
13960 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
13961
13962 2009-07-16 Ian Lance Taylor <iant@google.com>
13963
13964 PR 10400
13965 * layout.h: #include <map>.
13966 (class Kept_section): Change from struct to class. Add accessors
13967 and setters. Add section size to Comdat_group mapping. Change
13968 Comdat_group to std::map. Add is_comdat_ field. Add
13969 linkonce_size field in union.
13970 (class Layout): Update declaration of find_or_add_kept_section.
13971 Don't declare find_kept_object.
13972 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
13973 parameter. Add object, shndx, is_comdat, and is_group_name
13974 parameters. Change all callers. Adjust for new Kept_section.
13975 (Layout::find_kept_object): Remove.
13976 * object.cc (Sized_relobj::include_section_group): Update use of
13977 Kept_section. Rename secnum to shndx. Only record
13978 Kept_comdat_section if sections are the same size.
13979 (Sized_relobj::include_linkonce_section): Update use of
13980 Kept_section. Only record Kept_comdat_section if sections are the
13981 same size. Set size of linkonce section.
13982 (Sized_relobj::map_to_kept_section): Update call to
13983 get_kept_comdat_section.
13984 * object.h (class Sized_relobj): Rename fields in
13985 Kept_comdat_section to drop trailing underscores; change object
13986 field to Relobj*. Change Kept_comdat_section_table to store
13987 struct rather than pointer.
13988 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
13989 Add kept_object and kept_shndx parameters. Change all callers.
13990 (Sized_relobj::get_kept_comdat_section): Change return type to
13991 bool. Add kept_object and kept_shndx parameters. Change all
13992 callers.
13993 * plugin.cc (Pluginobj::include_comdat_group): Update call to
13994 Layout::find_or_add_kept_section.
13995
13996 2009-07-09 Ian Lance Taylor <iant@google.com>
13997
13998 * merge.cc (Object_merge_map::initialize_input_to_output_map):
13999 Reserve space in the hash table.
14000
14001 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
14002
14003 * fileread.cc (File_read::get_mtime): New method.
14004 * fileread.h (Timespec): New structure.
14005 (File_read::get_mtime): New method.
14006 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
14007 Renamed from timestamp_nsec.
14008 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
14009 Elf_Xword.
14010 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
14011 timestamp_nsec.
14012 (Incremental_inputs::report_archive): Save mtime; style fix.
14013 (Incremental_inputs::report_obejct): Save mtime; style fix.
14014 (Incremental_inputs::report_script): Save mtime; style fix.
14015 (Incremental_inputs::finalize_inputs): Style fix.
14016 (Incremental_inputs::finalize): Style fix.
14017 (Incremental_inputs::create_input_section_data): Store inputs
14018 mtime.
14019 * incremental.h (Incremental_inputs::report_script): Add mtime
14020 argument.
14021 (Incremental_inputs::Input_info::Input_info): Intialize only one
14022 union member.
14023 (Incremental_inputs::Input_info::archive): Move to nameless
14024 union.
14025 (Incremental_inputs::Input_info::obejct): Move to nameless union.
14026 (Incremental_inputs::Input_info::script): Move to nameless union.
14027 (Incremental_inputs::mtime): New field.
14028 * script.cc (read_input_script): Pass file mtime to
14029 Incremental_input.
14030 * script.h (Script_info::inputs): Style fix.
14031
14032 2009-07-01 Ian Lance Taylor <ian@airs.com>
14033
14034 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
14035 instead of 32.
14036
14037 2009-06-24 Ian Lance Taylor <iant@google.com>
14038
14039 PR 10156
14040 * layout.cc (Layout::choose_output_section): If we find an
14041 existing section, update the flags.
14042 (Layout::create_notes): New function, broken out of
14043 Layout::finalize.
14044 (Layout::finalize): Don't create note sections.
14045 (Layout::create_note): Don't crash if linker script discards
14046 section.
14047 (Layout::create_gold_note): Likewise.
14048 (Layout::create_build_id): Likewise. Don't set
14049 after_input_sections on the section.
14050 (Layout::create_executable_stack_info): Remove target parameter.
14051 Change caller.
14052 * layout.h (class Layout): Declare create_notes. Update
14053 declaration of create_executable_stack_info.
14054 * gold.cc (queue_middle_tasks): Call create_notes.
14055 * output.cc (Output_section::update_flags_for_input_section): Move
14056 here from output.h. If SHF_ALLOC flag is newly set, mark address
14057 invalid.
14058 * output.h (Output_data::mark_address_invalid): New function.
14059 (class Output_section): Only declare, not define,
14060 update_flags_for_input_section. Remove set_flags.
14061
14062 2009-06-24 Ian Lance Taylor <iant@google.com>
14063
14064 * script-sections.cc (Output_section_definition::
14065 set_section_addresses): Rename shadowing local load_address to
14066 laddr.
14067
14068 2009-06-24 Ian Lance Taylor <iant@google.com>
14069
14070 PR 10244
14071 * reloc.cc (relocate_sections): Skip empty relocation sections.
14072
14073 2009-06-23 Ian Lance Taylor <iant@google.com>
14074
14075 PR 10156
14076 * layout.cc (Layout::create_note): Use choose_output_section
14077 rather than make_output_section.
14078
14079 2009-06-23 Ian Lance Taylor <iant@google.com>
14080
14081 PR 10237
14082 * options.cc (General_options::parse_V): Set printed_version_.
14083 (General_options::General_options): Initialize printed_version_.
14084 * options.h (class General_options): Add printed_version_ field.
14085 * gold.cc (queue_initial_tasks): If there are no input files,
14086 don't give a fatal error if we printed the version information.
14087 (queue_middle_tasks): If using -r with a shared object, give a
14088 fatal error rather than an ordinary error.
14089
14090 2009-06-23 Ian Lance Taylor <iant@google.com>
14091
14092 PR 10219
14093 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
14094 (Layout::make_output_section): Set have_stabstr_section_ if we see
14095 a .stab*str section.
14096 (Layout::finalize): Call link_stabs_sections.
14097 (Layout::link_stabs_sections): New file.
14098 * layout.h (class Layout): Add have_stabstr_section_ field.
14099 Declare link_stabs_sections.
14100
14101 2009-06-23 Doug Kwan <dougkwan@google.com>
14102
14103 * Makefile.am (libgold_a_LIBADD): New.
14104 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
14105 * Makefile.in: Regenerate.
14106 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
14107 * configure: Regenerate.
14108 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
14109 * fileread.cc: Include sys/state.h
14110 * gold.h: Declare memmem and strndup if found missing.
14111 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
14112
14113 2009-06-23 Ian Lance Taylor <iant@google.com>
14114
14115 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
14116 * configure: Rebuild.
14117
14118 2009-06-23 Ian Lance Taylor <iant@google.com>
14119
14120 PR 10147
14121 * object.cc (Object::section_contents): Don't try to get a view if
14122 the section has length zero.
14123 (Object::handle_gnu_warning_section): If the section is empty, use
14124 the name of the section as the warning.
14125
14126 2009-06-23 Ian Lance Taylor <iant@google.com>
14127
14128 PR 10133
14129 * stringpool.h (class Stringpool_template): Add optimize_ field.
14130 (Stringpool_template::set_optimize): New function.
14131 * stringpool.cc (Stringpool_template::Stringpool_template):
14132 Initialize optimize_ field.
14133 (Stringpool_template::set_string_offsets): Test local optimize
14134 fild rather than parameter.
14135 * layout.cc (Layout::Layout): Call set_optimize on the section
14136 name stringpool.
14137
14138 2009-06-22 Ian Lance Taylor <iant@google.com>
14139
14140 PR 10030
14141 * yyscript.y: Parse TARGET.
14142 * script.cc (script_set_target): New function.
14143 * script-c.h (script_set_target): Declare.
14144 * options.cc (General_options::string_to_object_format): Rename
14145 from string_to_object_format in anonymous namespace. Change
14146 callers.
14147 * options.h (class General_options): Declare
14148 string_to_object_format.
14149
14150 2009-06-22 Ian Lance Taylor <iant@google.com>
14151
14152 * script-sections.cc (Script_sections::create_segments): Don't put
14153 program headers in a PT_LOAD segment if -n or -N.
14154
14155 2009-06-22 Ian Lance Taylor <iant@google.com>
14156
14157 PR 10141
14158 * options.h (class General_options): Add -z lazy and -z now. Sort
14159 -z options into alphabetical order.
14160 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
14161
14162 2009-06-21 Ian Lance Taylor <iant@google.com>
14163
14164 * layout.cc (Layout::make_output_section): Call
14165 Target::new_output_section.
14166 (Layout::attach_allocated_section_to_segment): Put large section
14167 sections in a separate load segment with the large segment flag
14168 set.
14169 (Layout::segment_precedes): Sort large data segments after other
14170 load segments.
14171 (align_file_offset): New static function.
14172 (Layout::set_segment_offsets): Use align_file_offset.
14173 * output.h (class Output_section): Add is_small_section_ and
14174 is_large_section_ fields.
14175 (Output_section::is_small_section): New function.
14176 (Output_section::set_is_small_section): New function.
14177 (Output_section::is_large_section): New function.
14178 (Output_section::set_is_large_section): New function.
14179 (Output_section::is_large_data_section): New function.
14180 (class Output_segment): Add is_large_data_segment_ field.
14181 (Output_segment::is_large_data_segment): New function.
14182 (Output_segment::set_is_large_data_segment): New function.
14183 * output.cc (Output_section::Output_section): Initialize new
14184 fields.
14185 (Output_segment::Output_segment): Likewise.
14186 (Output_segment::add_output_section): Add assertion that large
14187 data sections always go in large data segments. Force small data
14188 sections to the end of the list of data sections. Force small BSS
14189 sections to the start of the list of BSS sections. For large BSS
14190 sections to the end of the list of BSS sections.
14191 * symtab.h (class Symbol): Declare is_common_shndx.
14192 (Symbol::is_defined): Check Symbol::is_common_shndx.
14193 (Symbol::is_common): Likewise.
14194 (class Symbol_table): Define enum Commons_section_type. Update
14195 declarations. Add small_commons_ and large_commons_ fields.
14196 * symtab.cc (Symbol::is_common_shndx): New function.
14197 (Symbol_table::Symbol_table): Initialize new fields.
14198 (Symbol_table::add_from_object): Put small and large common
14199 symbols in the right list.
14200 (Symbol_table::sized_finalized_symbol): Check
14201 Symbol::is_common_shndx.
14202 (Symbol_table::sized_write_globals): Likewise.
14203 * common.cc (Symbol_table::do_allocate_commons): Allocate new
14204 common symbol lists. Don't call do_allocate_commons_list if the
14205 list is empty.
14206 (Symbol_table::do_allocate_commons_list): Remove is_tls
14207 parameter. Add comons_section_type parameter. Change all
14208 callers. Handle small and large common symbols.
14209 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
14210 Symbol::is_common_shndx.
14211 * resolve.cc (symbol_to_bits): Likewise.
14212 * target.h (Target::small_common_shndx): New function.
14213 (Target::small_common_section_flags): New function.
14214 (Target::large_common_shndx): New function.
14215 (Target::large_common_section_flags): New function.
14216 (Target::new_output_section): New function.
14217 (Target::Target_info): Add small_common_shndx, large_common_shndx,
14218 small_common_section_flags, and large_common_section_flags
14219 fields.
14220 (Target::do_new_output_section): New virtual function.
14221 * arm.cc (Target_arm::arm_info): Initialize new fields.
14222 * i386.cc (Target_i386::i386_info): Likewise.
14223 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
14224 Likewise.
14225 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
14226 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14227 (Target_x86_64::do_new_output_section): New function.
14228 * configure.ac: Define conditional MCMODEL_MEDIUM.
14229 * testsuite/Makefile.am (check_PROGRAMS): Add large.
14230 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
14231 (large_LDFLAGS): Define.
14232 * testsuite/large.c: New file.
14233 * testsuite/testfile.cc (Target_test::test_target_info):
14234 Initialize new fields.
14235 * configure, testsuite/Makefile.in: Rebuild.
14236
14237 2009-06-05 Doug Kwan <dougkwan@google.com>
14238
14239 * Makefile.am (CCFILES): Add target.cc.
14240 * Makefile.in: Regenerate.
14241 * i386.cc (class Target_i386): Define new virtual method to
14242 override do_is_local_label_name in parent.
14243 * object.cc (Sized_relobj::do_count_local_symbols): Discard
14244 local symbols if --discard-locals or -X is given.
14245 * options.h (class General_options): Declare new options
14246 '--discard-locals' and '-X' for discarding locals.
14247 * target.h (class Target): Define new methods is_local_label_name.
14248 Declare new virtual method do_is_local_label_name.
14249 * target.cc: New file.
14250 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
14251 (check_SCRIPTS): Add discard_locals_test.sh.
14252 (check_DATA): Add discard_local_tests.syms.
14253 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
14254 (discard_local_tests.syms, discard_locals_test.o): New make rules.
14255 * testsuite/Makefile.in: Regenerate.
14256 * testsuite/discard_locals_test.c: New file.
14257 * testsuite/discard_locals_test.sh: Same.
14258
14259 2009-06-05 Doug Kwan <dougkwan@google.com>
14260
14261 * object.cc (Sized_relobj::Sized_relobj): Initialize
14262 discarded_eh_frame_shndx_ to -1U.
14263 (Sized_relobj::do_layout): Record index of a discard .eh_frame
14264 section.
14265 (Sized_relobj::do_count_local_symbols): Skip local symbols in
14266 a discarded .eh_frame section.
14267 (Sized_relobj::do_finalize_local_symbols): Ditto.
14268 * object.h (class Sized_relobj): Declare new member
14269 discarded_eh_frame_shndx_.
14270 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
14271 (local_labels_test.o, local_labels_test): New rules.
14272 * testsuite/Makefile.in: Regenerate.
14273
14274 2009-06-04 Doug Kwan <dougkwan@google.com>
14275
14276 * layout.cc (Layout::section_name_mapping): Add mapping for
14277 special ARM sections.
14278
14279 2009-06-03 Doug Kwan <dougkwan@google.com>
14280
14281 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
14282 (utils::has_overflow): Same.
14283
14284 2009-06-03 Ian Lance Taylor <iant@google.com>
14285
14286 * layout.cc (Layout::section_name_mapping): New array, replacing
14287 Layout::linkonce_mapping.
14288 (Layout::section_name_mapping_count): New variable, replacing
14289 Layout::linkonce_mapping_count.
14290 (Layout::linkonce_output_name): Remove.
14291 (Layout::output_section_name): Rewrite.
14292 * layout.h (class Layout): Rename Linkonce_mapping to
14293 Section_name_mapping, linkonce_mapping to section_name_mapping,
14294 linkonce_mapping_count to section_name_mapping_count. Don't
14295 declare linkonce_output_name.
14296
14297 2009-06-03 Doug Kwan <dougkwan@google.com>
14298
14299 * gold/arm.cc (namespace utils): New.
14300 (Target_arm::reloc_is_non_pic): Define new method.
14301 (class Arm_relocate_functions): New.
14302 (Target_arm::Relocate::relocate): Handle relocation types used by
14303 Android.
14304
14305 2009-06-03 Ian Lance Taylor <iant@google.com>
14306
14307 * arm.cc (Target_arm::scan::global): Use || instead of |.
14308
14309 2009-06-02 Doug Kwan <dougkwan@google.com>
14310
14311 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
14312 issued_non_pic_error_.
14313 (class Target_arm::Scan): Declare new method check_non_pic.
14314 Define new method symbol_needs_plt_entry.
14315 Declare new data member issued_non_pic_error_.
14316 (class Target_arm::Relocate): Declare new method
14317 should_apply_static_reloc.
14318 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
14319 (Target_arm::Scan::check_non_pic): Define new method.
14320 (Target_arm::Scan::local): Handle a small subset of reloc types used
14321 by Android.
14322 (Target_arm::Scan::local): Same.
14323 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
14324
14325 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
14326
14327 * incremental.cc (Incremental_inputs::report_command_line): Filter
14328 out --incremental-* options.
14329
14330 2009-05-29 Doug Kwan <dougkwan@google.com>
14331
14332 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
14333 template class.
14334 (class Target_arm): Update comment.
14335 (Target_arm::Target_arm): Initialize new data members GOT_,
14336 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
14337 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
14338 and Target_arm::rel_dyn_section.
14339 Declare new_enum Target_arm::Got_type.
14340 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
14341 and DYNBSS_.
14342 Update commments for member do_dynsym_value.
14343 (Target_arm::got_size, Target_arm::plt_section,
14344 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
14345 new methods inside class defintion.
14346 (Target_arm::got_section): Define new method.
14347 (Target_arm::rel_dyn_section): Same.
14348 (Output_data_plt_arm): New template class.
14349 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
14350 (Output_data_plt_arm:do_adjust_output_section): Define new method.
14351 (Output_data_plt_arm::add_entry): Same.
14352 (Output_data_plt_arm::first_plt_entry): Define new
14353 static data member for PLT instruction template.
14354 (Output_data_plt_arm::plt_entry): Same.
14355 (Output_data_plt_arm::do_write): Define new method.
14356 (Target_arm::make_plt_entry): Same.
14357 (Target_arm::do_finalize_sections): Same.
14358 (Target_arm::do_dynsym_value): Same.
14359
14360 2009-05-28 Doug Kwan <dougkwan@google.com>
14361
14362 * Makefile.am (TARGETSOURCES): Add arm.cc.
14363 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
14364 * Makefile.in: Regenerate.
14365 * arm.cc: New file.
14366 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
14367
14368 2009-05-26 Doug Kwan <dougkwan@google.com>
14369
14370 * options.cc (General_options::parse_exclude_libs). Fix a comment.
14371 (General_options::check_excluded_libs): Strip off directories in
14372 archive name before matching like GNU ld does.
14373 * testsuite/Makefile.am (MOSTLYCLEANFILES,
14374 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
14375 (exclude_libs_test_LDFLAGS): Add linker option
14376 -Wl,--exclude-libs,libexclude_libs_test_3
14377 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
14378 an explicit archive without using -l.
14379 (alt/libexclude_libs_test_3.a): New make rule.
14380 * testsuite/Makefile.in: Regenerate.
14381 * testsuite/exclude_libs_test.c : Declare lib3_default().
14382 (main): Call it.
14383 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
14384 * exclude_libs_test_3.c: New file.
14385
14386 2009-05-26 Nick Clifton <nickc@redhat.com>
14387
14388 * po/id.po: New Indonesian translation.
14389 * po/gold.pot: Updated template file.
14390
14391 2009-05-22 Sriraman Tallam <tmsriram@google.com>
14392
14393 * testsuite/Makefile.am: Add -ffunction-sections to compile
14394 gc_comdat_test files. Add -Wl,--gc-sections to build
14395 gc_comdat_test.
14396 * testsuite/Makefile.in: Regenerate.
14397 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
14398
14399 2009-05-21 Sriraman Tallam <tmsriram@google.com>
14400
14401 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
14402 kept comdat section was garbage collected.
14403 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
14404 * testsuite/Makefile.in: Regenerate.
14405 * testsuite/gc_comdat_test.sh: New file.
14406 * testsuite/gc_comdat_test_1.cc: New file.
14407 * testsuite/gc_comdat_test_2.cc: New file.
14408
14409 2009-05-19 Doug Kwan <dougkwan@google.com>
14410
14411 * archive.cc (Archive::Archive): Move constructor from archive.h
14412 to here. Initialize no_export_.
14413 (Archive::get_elf_object_for_member): Set no_export flag of object.
14414 * archive.h (Archive::Archive): Move constructor body to
14415 archive.cc.
14416 (Archive::no_export): New method.
14417 (Archive::no_export_): New field.
14418 * object.h (Object::Object): Initialize no_export_ to false.
14419 (Object::no_export, Object::set_no_export): New methods.
14420 (Object::no_export_): New field.
14421 * options.cc (General_options::parse_exclude_libs): New method.
14422 (General_options::check_excluded_libs) Same.
14423 * options.h (exclude_libs): New option.
14424 (General_options::check_excluded_libs): New method declaration.
14425 (General_options::excluded_libs_): New field.
14426 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
14427 default or protected visibility if an object has no-export flag set.
14428 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
14429 (check_SCRIPTS): Add exclude_libs_test.sh.
14430 (check_DATA): Add exclude_libs_test.syms.
14431 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
14432 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
14433 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
14434 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
14435 (exclude_libs_test.syms, libexclude_libs_test_1.a,
14436 libexclude_libs_test_2.a): New rules.
14437 * testsuite/Makefile.in: Regenerate.
14438 * testsuite/exclude_libs_test.c: New file.
14439 * testsuite/exclude_libs_test.sh: Ditto.
14440 * testsuite/exclude_libs_test_1.c: Ditto.
14441 * testsuite/exclude_libs_test_2.c: Ditto.
14442
14443 2009-05-15 Ian Lance Taylor <iant@google.com>
14444
14445 * configure.ac: Check for declarations for cases where libiberty.h
14446 checks HAVE_DECL_xxx.
14447 * configure, config.in: Rebuild.
14448
14449 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
14450
14451 * gold.h (Incremental_argument_list): Remove (invalid) forward
14452 declaration.
14453 * incremental.cc (Incremental_inputs::report_achive): New method.
14454 (Incremental_inputs::report_object): New method.
14455 (Incremental_inputs::report_script): New method.
14456 (Incremental_inputs::finalize_inputs): New method.
14457 (Incremental_inputs::finalize): Call finalize_inputs().
14458 (Incremental_inputs::sized_create_incremental_inputs_section_data):
14459 Create inputs entries.
14460 * incremental.h (Incremental_input_type): New enum.
14461 (Incremental_inputs::Incremental_input): Initialize new fields.
14462 (Incremental_inputs::report_inputs): New method.
14463 (Incremental_inputs::report_achive): New method.
14464 (Incremental_inputs::report_object): New method.
14465 (Incremental_inputs::report_script): New method.
14466 (Incremental_inputs::finalize_inputs): New method.
14467 (Incremental_inputs::Input_info): New struct.
14468 (Incremental_inputs::Input_info_map): New typedef.
14469 (Incremental_inputs::lock_): New field.
14470 (Incremental_inputs::Inputs_): New field.
14471 (Incremental_inputs::Inputs_map): New field.
14472 * main.cc (main): Call Incremental_input::report_inputs.
14473 * options.h (Input_argument_list): Typedef moved from
14474 Input_arguments.
14475 (Input_file_group::Files): Remove, use ::Input_argument_list.
14476 (Input_file_group::Input_argument_list): Remove, use
14477 ::Input_argument_list.
14478 * plugin.cc (Plugin_manager::add_input_file): Add error in
14479 incremental build.
14480 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
14481 functions.
14482 * script.cc (read_input_script): Call
14483 Incremental_input::report_script.
14484 * script.h (Script_info): New class.
14485
14486 2009-04-27 Ian Lance Taylor <iant@google.com>
14487
14488 * x86_64.cc (do_adjust_output_section): Set entsize to
14489 plt_entry_size.
14490
14491 2009-04-23 Elliott Hughes <enh@google.com>
14492
14493 * output.cc (Output_file::close): After short writes, continue
14494 writing from the correct offset in the buffer being written.
14495
14496 2009-04-23 Chris Demetriou <cgd@google.com>
14497
14498 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
14499 * configure: Regenerate.
14500 * config.in: Regenerate.
14501 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
14502 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
14503
14504 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
14505
14506 * incremental.cc (Incremental_inputs_header_data): Renamed from
14507 Incremental_input_header_data.
14508 (Incremental_inputs_header_data::data_size): New field.
14509 (Incremental_inputs_header_data::put_input_file_count): Renamed
14510 from input_file_count.
14511 (Incremental_inputs_header_data::put_command_line_offset): Renamed
14512 from command_line_offset.
14513 (Incremental_inputs_header_data::put_reserved): Renamed from
14514 put_reserved.
14515 (Incremental_inputs_entry_data): Renamed from
14516 Incremental_input_entry_data.
14517 (Incremental_inputs_entry_data::data_size): New field.
14518 (Incremental_inputs::report_command_line): New method.
14519 (Incremental_inputs::finalize): New method.
14520 (Incremental_inputs::create_incremental_inputs_data): New method.
14521 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
14522 * incremental.h: New file.
14523 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
14524 (Layout::finalize): Create incremental inputs section in
14525 incremental builds.
14526 (Layout::create_incremental_info_sections): New method.
14527 * layout.h (Layout::incremental_inputs): New method.
14528 (Layout::create_incremental_info_sections): New method.
14529 (Layout::incremental_inputs_): New field.
14530 * main.cc (main): Notify Incremental_input of the command line.
14531
14532 2009-04-01 Ian Lance Taylor <iant@google.com>
14533 Mikolaj Zalewski <mikolajz@google.com>
14534
14535 * gold.h (reserve_unordered_map): Define, three versions, one for
14536 each version of Unordered_map.
14537 * layout.cc (Layout::Layout): Remove options parameter. Add
14538 number_of_input_files parameter. Don't initialize options_.
14539 Initialize number_of_input_files_ and resized_signatures_. Move
14540 sections_are_attached_.
14541 (Layout::layout_group): Reserve space for group_signatures_.
14542 (Layout::find_or_add_kept_section): Change name parameter to be a
14543 reference. Resize signatures_ map when it gets large enough.
14544 (Layout::layout_eh_frame): Use parameters->options() instead of
14545 this->options_.
14546 (Layout::make_output_section): Likewise.
14547 (Layout::attach_allocated_section_to_segment): Likewise.
14548 (Layout::finalize, Layout::create_executable_stack): Likewise.
14549 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
14550 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
14551 * layout.h (class Layout): Update declarations. Remove options_
14552 field. Add number_of_input_files_ and resized_signatures_
14553 fields. Move sections_are_attached_ field.
14554 * main.cc (main): Pass number of input files to Layout
14555 constructor. Don't pass options.
14556
14557 2009-03-30 Ian Lance Taylor <iant@google.com>
14558
14559 * ffsll.c (ffsll): Correct implementation.
14560
14561 2009-03-27 Ian Lance Taylor <iant@google.com>
14562
14563 * ffsll.c: New file.
14564 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
14565 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
14566 * ftruncate.c (ftruncate): Declare before definition.
14567 * mremap.c (mremap): Likewise.
14568 * pread.c (pread): Likewise.
14569 * configure, Makefile.in, config.in: Rebuild.
14570
14571 * mremap.c: New file.
14572 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
14573 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
14574 (mremap): Declare if HAVE_MREMAP is not defined.
14575 * configure, Makefile.in, config.in: Rebuild.
14576
14577 2009-03-27 Cary Coutant <ccoutant@google.com>
14578
14579 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
14580 position independent.
14581 * sparc.cc (Target_sparc::check_non_pic): Likewise.
14582 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
14583
14584 2009-03-24 Cary Coutant <ccoutant@google.com>
14585
14586 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
14587 an executable.
14588 (needs_dynamic_reloc): Likewise.
14589
14590 2009-03-24 Ian Lance Taylor <iant@google.com>
14591
14592 * yyscript.y (file_cmd): Recognize EXTERN.
14593 (extern_name_list, extern_name_list_body): New nonterminals.
14594 * script.cc (script_add_extern): Define.
14595 * script-c.h (script_add_extern): Declare.
14596
14597 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
14598
14599 * object.cc (is_elf_object): Define.
14600 * object.h (is_elf_object): Declare.
14601 * archive.cc (Archive::get_elf_object_for_member): Call
14602 is_elf_object.
14603 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
14604
14605 2009-03-24 Elliott Hughes <enh@google.com>
14606
14607 * output.cc (Output_file::map_anonymous): Define.
14608 (Output_file::map): Use map_anonymous. If the regular mmap fails,
14609 try an anonymous one. Report the size if the mmap fails.
14610 * output.h (class Output_file): Declare map_anonymous.
14611
14612 2009-03-24 Ian Lance Taylor <iant@google.com>
14613
14614 * target-select.cc (instantiate_target): Don't acquire the lock if
14615 the instantiated_target_ field has already been set.
14616
14617 2009-03-23 Ian Lance Taylor <iant@google.com>
14618
14619 * gold-threads.h (class Initialize_lock): Define.
14620 * gold-threads.cc (class Initialize_lock_once): Define.
14621 (initialize_lock_control): New static variable.
14622 (initialize_lock_pointer): New static variable.
14623 (initialize_lock_once): New static function.
14624 (Initialize_lock::Initialize_lock): Define.
14625 (Initialize_lock::initialize): Define.
14626 * target-select.h: Include "gold-threads.h".
14627 (class Target_selector): Add lock_ and initialize_lock_ fields.
14628 Don't define instantiate_target, just declare it.
14629 * target-select.cc (Target_selector::Target_selector): Initialize
14630 new fields.
14631 (Target_selector::instantiate_target): Define.
14632 * descriptors.h: Include "gold-threads.h".
14633 (class Descriptors): Add initialize_lock_ field.
14634 * descriptors.cc (Descriptors::Descriptors): Initialize new
14635 field.
14636 (Descriptors::open): Use initialize_lock_ field
14637 * errors.h (class Errors): Add initialize_lock_ field.
14638 * errors.cc (Errors::Errors): Initialize new field.
14639 (Errors::initialize_lock): Use initialize_lock_ field.
14640 * powerpc.cc (class Target_selector_powerpc): Remove
14641 instantiated_target_ field. In do_recognize call
14642 instantiate_target rather than do_instantiate_target. In
14643 do_instantiate_target just allocate a new target.
14644 * sparc.cc (class Target_selector_sparc): Likewise.
14645
14646 * freebsd.h: New file.
14647 * i386.cc: Include "freebsd.h".
14648 (Target_i386): Derive from Target_freebsd rather than
14649 Sized_target.
14650 (Target_selector_i386): Derive from Target_selector_freebsd rather
14651 than Target_selector.
14652 * x86_64.cc: Include "freebsd.h".
14653 (Target_x86_64): Derive from Target_freebsd rather than
14654 Sized_target.
14655 (Target_selector_x86_64): Derive from Target_selector_freebsd
14656 rather than Target_selector.
14657 * target.h (class Target): Add adjust_elf_header and
14658 do_adjust_elf_header.
14659 * output.cc (Output_file_header:: do_sized_write): Call target
14660 adjust_elf_header routine.
14661 * configure.tgt: Set targ_osabi.
14662 * configure.ac: Define GOLD_DEFAULT_OSABI.
14663 * parameters.cc (Parameters::default_target): Pass
14664 GOLD_DEFAULT_OSABI to select_target.
14665 * target-select.h (class Target_selector): Make instantiate_target
14666 protected rather than private.
14667 * Makefile.am (HFILES): Add freebsd.h.
14668 * configure, Makefile.in, config.in: Rebuild.
14669
14670 * merge.cc (do_add_input_section): Correct pend value. Change
14671 message about last entry not being null terminated from error to
14672 warning.
14673
14674 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
14675
14676 * incremental.cc: New file.
14677 * Makefile.am (CCFILES): Add incremental.cc.
14678 * Makefile.in: Rebuild.
14679
14680 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
14681
14682 * layout.cc (Layout::output_section_name): Preserve names
14683 of '.note.' sections.
14684
14685 2009-03-19 Ian Lance Taylor <iant@google.com>
14686
14687 * descriptors.cc (Descriptors::open): Check that the options are
14688 valid before using them.
14689
14690 2009-03-18 Ian Lance Taylor <iant@google.com>
14691
14692 * script-sections.h: Include <list>.
14693 (class Script_sections): Change Sections_elements from std::vector
14694 to std::list. Typedef public Elements_iterator. Add
14695 orphan_section_placement_, data_segment_align_start_, and
14696 saw_data_segment_align_ fields. Remove data_segment_align_index_
14697 field.
14698 * script-sections.cc (class Orphan_section_placement): New class.
14699 (class Sections_element): Add virtual functions is_relro and
14700 orphan_section_init. Remove virtual function place_orphan_here.
14701 (class Output_section_definition): Add is_relro and
14702 orphan_section_init. Remove place_orphan_here.
14703 (class Orphan_output_section): Likewise.
14704 (Script_sections::Script_sections): Update for field changes.
14705 (Script_sections::data_segment_align): Set saw_data_segment_align_
14706 and data_segment_align_start_, not data_segment_align_index.
14707 (Script_sections::data_segment_relro_end): Check
14708 saw_data_segment_align_. Use data_segment_align_start_ rather
14709 than data_segment_align_index_.
14710 (Script_sections::place_orphan): Rewrite to use
14711 Orphan_section_placement.
14712
14713 2009-03-17 Ian Lance Taylor <iant@google.com>
14714
14715 * archive.cc (Archive::add_symbols): Check for a version attached
14716 to the symbol name in the archive map.
14717 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
14718 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
14719 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
14720 (ver_test_11.a): New target.
14721 * testsuite/Makefile.in: Rebuild.
14722
14723 * configure.ac: Check for chsize and posix_fallocate. Replace
14724 ftruncate.
14725 * ftruncate.c: New file, from gnulib.
14726 * output.cc (posix_fallocate): Define dummy version if not
14727 HAVE_POSIX_FALLOCATE.
14728 (Output_file::map): Call posix_fallocate rather than lseek and
14729 write.
14730 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
14731 * configure, Makefile.in, config.in: Rebuild.
14732
14733 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
14734
14735 * layout.h (Layout::create_note): Add section_name parameter.
14736 * layout.cc (Layout::create_note): Likewise.
14737 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
14738
14739 2009-03-17 Ian Lance Taylor <iant@google.com>
14740
14741 * descriptors.cc: Include "options.h".
14742 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
14743 (Descriptors::open): Always use O_CLOEXEC when opening a new
14744 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
14745 then set FD_CLOEXEC.
14746
14747 * sparc.cc (class Target_sparc): Add has_got_section.
14748 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
14749 make sure we have a GOT section.
14750
14751 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
14752 (Target_sparc::Scan::local): Likewise.
14753 (Target_sparc::Scan::global): Likewise.
14754 (Target_sparc::Relocate::relocate): Likewise.
14755 (Target_sparc::Relocate::relocate_tls): Likewise.
14756
14757 * symtab.cc (Symbol_table::define_default_version): New function,
14758 broken out of add_from_object.
14759 (Symbol_table::add_from_object): Call define_default_version.
14760 (Symbol_table::define_special_symbol): Add resolve_oldsym
14761 parameter. Change all callers. If the version for a symbol comes
14762 from a version script, resolve it with the symbol with the same
14763 name with no version. Also add the symbol without a version if
14764 appropriate.
14765 (do_define_in_output_data): If resolving with oldsym, don't delete
14766 sym.
14767 (do_define_in_output_segment): Likewise.
14768 (do_define_as_constant): Likewise.
14769 * symtab.h (class Symbol_table): Update declarations.
14770
14771 2009-03-13 Ian Lance Taylor <iant@google.com>
14772
14773 * readsyms.cc (Read_symbols::incompatible_warning): New function.
14774 (Read_symbols::requeue): New function.
14775 (Read_symbols::do_read_symbols): If make_elf_object fails because
14776 the target type is not configured, and the file was searched for,
14777 issue a warning and retry with the next directory.
14778 (Add_symbols::run): If the file has an incompatible format, and
14779 it was searched for, requeue the Read_symbols task. On error,
14780 release the object.
14781 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
14782 dirindex parameter to constructor. Change all callers. Declare
14783 incompatible_warning and requeue.
14784 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
14785 input_argument_ and input_group_ fields. Add them to
14786 constructor. Change all callers.
14787 (class Read_script): Add dirindex_ field. Add it to constructor.
14788 Change all callers.
14789 * archive.cc (Archive::setup): Remove input_objects parameter.
14790 Change all callers.
14791 (Archive::get_file_and_offset): Likewise.
14792 (Archive::read_all_symbols): Likewise.
14793 (Archive::read_symbols): Likewise.
14794 (Archive::get_elf_object_for_member): Remove input_objects
14795 parameter. Add punconfigured parameter. Change all callers.
14796 (Archive::add_symbols): Change return type to bool. Check return
14797 value of include_member.
14798 (Archive::include_all_members): Likewise.
14799 (Archive::include_member): Change return type to bool. Return
14800 false if first included object has incompatible target. Set
14801 included_member_ field.
14802 (Add_archive_symbols::run): If add_symbols returns false, requeue
14803 Read_symbols task.
14804 * archive.h (class Archive): Add included_member_ field.
14805 Initialize it in constructor. Add input_file and searched_for
14806 methods. Update declarations.
14807 (class Add_archive_symbols): Add dirpath_, dirindex_, and
14808 input_argument_ fields. Add them to constructor. Change all
14809 callers.
14810 * script.cc: Include "target-select.h".
14811 (class Parser_closure): Add skip_on_incompatible_target_ and
14812 found_incompatible_target_ fields. Add
14813 skip_on_incompatible_target parameter to constructor. Change all
14814 callers. Add methods skip_on_incompatible_target,
14815 clear_skip_on_incompatible_target, found_incompatible_target, and
14816 set_found_incompatible_target.
14817 (read_input_script): Add dirindex parameter. Change all callers.
14818 If parser finds an incompatible target, requeue Read_symbols
14819 task.
14820 (script_set_symbol): Clear skip_on_incompatible_target in
14821 closure.
14822 (script_add_assertion, script_parse_option): Likewise.
14823 (script_start_sections, script_add_phdr): Likewise.
14824 (script_check_output_format): New function.
14825 * script.h (read_input_script): Update declaration.
14826 * script-c.h (script_check_output_format): Declare.
14827 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
14828 (ignore_cmd): Remove OUTPUT_FORMAT.
14829 * fileread.cc (Input_file::Input_file): Add explicit this.
14830 (Input_file::will_search_for): New function.
14831 (Input_file::open): Add pindex parameter. Change all callers.
14832 * fileread.h (class Input_file): Add input_file_argument method.
14833 Declare will_search_for. Update declarations.
14834 * object.cc (make_elf_object): Add punconfigured parameter.
14835 Change all callers.
14836 * object.h (class Object): Make input_file public. Add
14837 searched_for method.
14838 (make_elf_object): Update declaration.
14839 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
14840 restart search.
14841 * dirsearch.h (class Dirsearch): Update declaration.
14842 * options.h (class General_options): Add --warn-search-mismatch.
14843 * parameters.cc (Parameters::is_compatible_target): New function.
14844 * parameters.h (class Parameters): Declare is_compatible_target.
14845 * workqueue.cc (Workqueue::add_blocker): New function.
14846 * workqueue.h (class Workqueue): Declare add_blocker.
14847
14848 * fileread.cc (Input_file::open): Remove options parameter.
14849 Change all callers.
14850 (Input_file::open_binary): Likewise.
14851 * script.cc (read_input_script): Likewise.
14852 * readsyms.h (class Read_symbols): Remove options_ field. Remove
14853 options parameter from constructor. Change all callers.
14854 (class Read_script): Likewise.
14855 * fileread.h (class Input_file): Update declarations.
14856 * script.h (read_input_script): Update declaration.
14857
14858 2009-03-10 Nick Clifton <nickc@redhat.com>
14859
14860 * po/es.po: New Spanish translation.
14861
14862 2009-03-06 Cary Coutant <ccoutant@google.com>
14863
14864 * options.cc (parse_short_option): Keep dash_z from registering itself.
14865
14866 2009-03-03 Ian Lance Taylor <iant@google.com>
14867
14868 PR 9918
14869 * target-reloc.h (relocate_section): Pass output_section to
14870 relocate.
14871 * i386.cc (Target_i386::should_apply_static_reloc): Add
14872 output_section parameter. Change all callers.
14873 (Target_i386::Relocate::relocate): Add output_section parameter.
14874 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14875 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
14876 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
14877 * testsuite/two_file_shared.sh: New script.
14878 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
14879 (check_DATA): Add two_file_shared.dbg.
14880 (two_file_shared.dbg): New target.
14881 * testsuite/Makefile.in: Rebuild.
14882
14883 2009-03-01 Ian Lance Taylor <iant@google.com>
14884
14885 * configure.ac: Check for byteswap.h.
14886 * configure: Rebuild.
14887 * config.in: Rebuild.
14888
14889 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
14890
14891 * layout.cc (Layout::find_or_add_kept_section): New function.
14892 (Layout::add_comdat): Removed.
14893 * layout.h (struct Kept_section): Move out of class Layout.
14894 Remove trailing underscores from field names. Add group_sections
14895 field. Rename group_ field to is_group. Change all uses.
14896 (class Layout): Declare find_or_add_kept_section, not add_comdat.
14897 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
14898 comdat_groups_ field.
14899 (Sized_relobj::include_section_group): Use
14900 find_or_add_kept_section and Kept_section::group_sections.
14901 (Sized_relobj::include_linkonce_section): Likewise.
14902 * object.cc (class Sized_relobj): Don't define Comdat_group or
14903 Comdat_group_table. Remove find_comdat_group and
14904 add_comdat_group. Remove comdat_groups_ field.
14905 * plugin.cc (include_comdat_group): Use
14906 Layout::find_or_add_kept_section.
14907
14908 2009-02-28 Ian Lance Taylor <iant@google.com>
14909
14910 * README: --gc-sections and map files are now supported. Document
14911 some build requirements.
14912
14913 PR 6992
14914 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
14915 relocatable link set the value of the section symbol to zero.
14916 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
14917 relocatable link don't include the section address in the local
14918 symbol value.
14919
14920 2009-02-27 Ian Lance Taylor <iant@google.com>
14921
14922 PR 6811
14923 * options.h (class Search_directory): Add is_system_directory.
14924 (class General_options): Declare is_in_system_directory.
14925 * options.cc (get_relative_sysroot): Make static.
14926 (get_default_sysroot): Make static.
14927 (General_optoins::is_in_system_directory): New function.
14928 * fileread.cc (Input_file::is_in_system_directory): New function.
14929 * fileread.h (class Input_file): Declare is_in_system_directory.
14930 * object.h (class Object): Add is_in_system_directory.
14931 (class Input_objects): Remove system_library_directory_ field.
14932 * object.cc (Input_objects::add_object): Don't set
14933 system_library_directory_.
14934 (input_objects::found_in_system_library_directory): Remove.
14935 * symtab.cc (Symbol_table::write_globals): Remove input_objects
14936 parameter. Change all callers.
14937 (Symbol_table::sized_write_globals): Likewise.
14938 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
14939 Call Object::is_in_system_directory.
14940 * symtab.h (class Symbol_table): Update declarations.
14941
14942 PR 5990
14943 * descriptors.h (Open_descriptor): Add is_on_stack field.
14944 * descriptors.cc (Descriptors::open): If the descriptor is on the
14945 top of the stack, remove it. Initialize is_on_stack field.
14946 (Descriptors::release): Only add pod to stack if it is not on the
14947 stack already.
14948 (Descriptors::close_some_descriptor): Clear stack_next and
14949 is_on_stack fields.
14950
14951 PR 7091
14952 * output.cc (Output_section::find_starting_output_address): Rename
14953 from starting_output_address; add PADDR parameter; change return
14954 type.
14955 * output.h (class Output_section): Declare
14956 find_starting_output_address instead of starting_output_address.
14957 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
14958 section symbol for which we can't find a merge section.
14959
14960 PR 9836
14961 * symtab.cc (Symbol_table::add_from_object): If the visibility is
14962 hidden or internal, force the symbol to be local.
14963 * resolve.cc (Symbol::override_visibility): Define.
14964 (Symbol::override_base): Use override_visibility.
14965 (Symbol_table::resolve): Likewise.
14966 (Symbol::override_base_with_special): Likewise.
14967 (Symbol_table::override_with_special): If the visibility is hidden
14968 or internal, force the symbol to be local.
14969 * symtab.h (class Symbol): Add set_visibility and
14970 override_visibility.
14971 * testsuite/ver_test_1.sh: New file.
14972 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
14973 (check_DATA): Add ver_test_1.syms.
14974 (ver_test_1.syms): New target.
14975 * testsuite/Makefile.in: Rebuild.
14976
14977 2009-02-25 Cary Coutant <ccoutant@google.com>
14978
14979 * layout.cc (Layout::choose_output_section): Don't rename sections
14980 when using a linker script that has a SECTIONS clause.
14981 * Makefile.in: Regenerate.
14982
14983 * testsuite/Makefile.am (script_test_5.sh): New test case.
14984 * testsuite/Makefile.in: Regenerate.
14985 * testsuite/script_test_5.cc: New file.
14986 * testsuite/script_test_5.sh: New file.
14987 * testsuite/script_test_5.t: New file.
14988
14989 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
14990
14991 * archive.cc (Archive::include_member): Update calls to add_symbols.
14992 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
14993 the Layout argument.
14994 * dynobj.h (do_add_symbols): Add the Layout argument.
14995 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
14996 Layout argument.
14997 * object.h (Object::add_symbols): Add the Layout argument.
14998 (Object::do_add_symbols): Add the Layout argument.
14999 (Sized_relobj::do_add_symbols): Add the Layout argument.
15000 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
15001 Unify the two versions.
15002 (Add_plugin_symbols): Remove.
15003 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
15004 (Sized_pluginobj::do_add_symbols): Unify the two versions.
15005 (Add_plugin_symbols): Remove.
15006 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
15007 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
15008 (Add_symbols::run): Make it work with Pulginobj.
15009
15010 2009-02-06 Ian Lance Taylor <iant@google.com>
15011
15012 * object.cc (Sized_relobj::do_layout): Make info message start
15013 with lower case letter.
15014
15015 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
15016
15017 * binary.cc: Fix file comment.
15018
15019 * options.h (enum Incremental_disposition): Define.
15020 (class General_options): Add new options: --incremental,
15021 --incremental_changed, --incremental_unchanged,
15022 --incremental_unknown. Add incremental_disposition_ and
15023 implicit_incremental_ fields.
15024 (General_options::incremental_disposition): New function.
15025 (class Position_dependent_options): Add incremental_disposition
15026 option.
15027 (Position_dependent_options::copy_from_options): Set incremental
15028 dispositions.
15029 * options.cc (General_options::parse_incremental_changed): New
15030 function.
15031 (General_options::parse_incremental_unchanged): New function.
15032 (General_options::parse_incremental_unknown): New function.
15033 (General_options::General_options): Initialize new fields
15034 incremental_disposition_ and implicit_incremental_.
15035 (General_options::finalize): Check for uasge of --incremental-*
15036 without --incremental.
15037
15038 2009-02-06 Chris Demetriou <cgd@google.com>
15039
15040 * gold.h (gold_undefined_symbol): Change to take only a Symbol
15041 pointer and to report location as the file name associated with
15042 the symbol.
15043 (gold_undefined_symbol_at_location): New function to replace the
15044 old gold_undefined_symbol functionality.
15045 * target-reloc.h (relocate_section): Update to use
15046 gold_undefined_symbol_at_location.
15047 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15048 Call gold_undefined_symbol function rather than gold_error.
15049 * errors.h (Errors::undefined_symbol): Take location as a
15050 string, rather than calculating it from a relocation.
15051 * errors.cc (Errors::fatal): Print "fatal error:" before the
15052 formatted message.
15053 (Errors::error, Errors::error_at_location): Print "error: "
15054 before the formatted message.
15055 (Errors::undefined_symbol): Take location as a string, rather
15056 than calculating it from a relocation.
15057 (gold_undefined_symbol_at_location): New function akin to
15058 old gold_undefined_symbol, calculates location from relocation.
15059 (gold_undefined_symbol): Change to take only a Symbol pointer
15060 and to report location as the file name associated with the symbol.
15061 * testsuite/debug_msg.sh: Update for changed error messages.
15062 * testsuite/undef_symbol.sh: Likewise.
15063
15064 2009-02-04 Duncan Sands <baldrick@free.fr>
15065
15066 PR 9812
15067 * reduced_debug_output.h
15068 (Output_reduced_debug_abbrev_section::failed): Use format for
15069 gold_warning.
15070 (Output_reduced_debug_info_section::faild): Likewise.
15071
15072 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
15073
15074 * script.cc (Lazy_demangler): New class.
15075 (Version_script_info::get_symbol_version_helper): Demangle a
15076 symbol only once.
15077
15078 2009-01-29 Cary Coutant <ccoutant@google.com>
15079
15080 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
15081 to __tls_get_addr.
15082 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15083
15084 2009-01-28 Ian Lance Taylor <iant@google.com>
15085
15086 * version.cc (version_string): Bump to 1.9.
15087
15088 * gold.h: Include <cstring> and <stdint.h>.
15089 * version.cc: Include <cstdio>.
15090 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
15091 warning.
15092 * reduced_debug_output.cc (insert_into_vector): Rename from
15093 Insert_into_vector; change all callers. Use Swap_unaligned to
15094 avoid aliasing issue; remove union since it is unnecessary.
15095
15096 2009-01-27 Sriraman Tallam <tmsriram@google.com>
15097
15098 * Makefile.am (CCFILES): Add gc.cc.
15099 (HFILES): Add gc.h.
15100 * Makefile.in: Regenerate.
15101 * gold.cc (Gc_runner): New class.
15102 (queue_initial_tasks): Call garbage collection related tasks
15103 when corresponding options are invoked.
15104 (queue_middle_gc_tasks): New function.
15105 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
15106 processed early before laying out sections during garbage collection.
15107 * gold.h (queue_middle_gc_tasks): New function.
15108 (is_prefix_of): Move from "layout.cc".
15109 * i386.cc (Target_i386::gc_process_relocs): New function.
15110 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
15111 * main.cc (main): Create object of class "Garbage_collection".
15112 * object.cc (Relobj::copy_symbols_data): New function.
15113 (Relobj::is_section_name_included): New function.
15114 (Sized_relobj::do_layout): Allow this function to be called twice
15115 during garbage collection and defer layout of section during the
15116 first call.
15117 * object.h (Relobj::get_symbols_data): New function.
15118 (Relobj::is_section_name_included): New function.
15119 (Relobj::copy_symbols_data): New function.
15120 (Relobj::set_symbols_data): New function.
15121 (Relobj::get_relocs_data): New function.
15122 (Relobj::set_relocs_data): New function.
15123 (Relobj::is_output_section_offset_invalid): New pure virtual function.
15124 (Relobj::gc_process_relocs): New function.
15125 (Relobj::do_gc_process_relocs): New pure virtual function.
15126 (Relobj::sd_): New data member.
15127 (Sized_relobj::is_output_section_offset_invalid): New function.
15128 (Sized_relobj::do_gc_process_relocs): New function.
15129 * options.h (General_options::gc_sections): Modify to not be a no-op.
15130 (General_options::print_gc_sections): New option.
15131 * plugin.cc (Plugin_finish::run): Remove function call to
15132 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
15133 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
15134 * reloc.cc (Read_relocs::run): Add task to process relocs and
15135 determine unreferenced sections when doing garbage collection.
15136 (Gc_process_relocs): New class.
15137 (Sized_relobj::do_gc_process_relocs): New function.
15138 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
15139 sections that are garbage collected.
15140 * reloc.h (Gc_process_relocs): New class.
15141 * sparc.cc (Target_sparc::gc_process_relocs): New function.
15142 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
15143 symbols whose corresponding sections are garbage collected.
15144 (Symbol_table::Symbol_table): Add new parameter for the garbage
15145 collection object.
15146 (Symbol_table::gc_mark_undef_symbols): New function.
15147 (Symbol_table::gc_mark_symbol_for_shlib): New function.
15148 (Symbol_table::gc_mark_dyn_syms): New function.
15149 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
15150 as garbage.
15151 (Symbol_table::add_from_object): Likewise.
15152 (Symbol_table::add_from_relobj): When building shared objects, do not
15153 treat externally visible symbols as garbage.
15154 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
15155 table information for static and relocatable links.
15156 * symtab.h (Symbol_table::set_gc): New function.
15157 (Symbol_table::gc): New function.
15158 (Symbol_table::gc_mark_undef_symbols): New function.
15159 (Symbol_table::gc_mark_symbol_for_shlib): New function.
15160 (Symbol_table::gc_mark_dyn_syms): New function.
15161 (Symbol_table::gc_): New data member.
15162 * target.h (Sized_target::gc_process_relocs): New pure virtual
15163 function.
15164 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
15165 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
15166
15167 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
15168
15169 * options.h (General_options::gc_sections): Define as a no-op for now.
15170 (General_options::no_keep_memory): Ditto.
15171 (General_options::Bshareable): Define.
15172 * options.cc (General_options::finalize): Honor -Bshareable.
15173
15174 2009-01-20 Andreas Schwab <schwab@suse.de>
15175
15176 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
15177 read the value in the contents, since we don't use it. Use the
15178 template endianness when writing.
15179 (Relocate::relocate): Use it for R_PPC_REL16_HA.
15180
15181 2009-01-19 Andreas Schwab <schwab@suse.de>
15182
15183 * configure.tgt (powerpc64-*): Fix targ_obj.
15184
15185 2009-01-15 Ian Lance Taylor <iant@google.com>
15186
15187 * object.cc (Sized_relobj::write_local_symbols): Don't write out
15188 local symbols when stripping all symbols.
15189
15190 2009-01-14 Cary Coutant <ccoutant@google.com>
15191
15192 * output.cc (Output_reloc): Add explicit instantiations.
15193
15194 2009-01-14 Cary Coutant <ccoutant@google.com>
15195
15196 * archive.cc (Archive::get_elf_object_for_member): Remove call
15197 to File_read::claim_for_plugin.
15198 * descriptors.cc (Descriptors::open): Remove reference to
15199 is_claimed.
15200 (Descriptors::claim_for_plugin): Remove.
15201 * descriptors.h (Descriptors::claim_for_plugin): Remove.
15202 (Descriptors::is_claimed): Remove.
15203 (claim_descriptor_for_plugin): Remove.
15204 * fileread.cc (File_read::claim_for_plugin): Remove.
15205 * fileread.h (File_read::claim_for_plugin): Remove.
15206 (File_read::descriptor): Reopen descriptor if necessary.
15207 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
15208 (Plugin_manager::all_symbols_read): Add task parameter. Change
15209 all callers.
15210 (Plugin_manager::get_input_file): New function.
15211 (Plugin_manager::release_input_file): New function.
15212 (Pluginobj::Pluginobj): Add filesize parameter and initialize
15213 corresponding data member.
15214 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
15215 and pass to base constructor. Change all callers.
15216 (get_input_file, release_input_file): New functions.
15217 (make_sized_plugin_object): Add filesize parameter. Change all callers.
15218 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
15219 (Plugin_manager::all_symbols_read): Add task parameter.
15220 (Plugin_manager::get_input_file): New function.
15221 (Plugin_manager::release_input_file): New function.
15222 (Plugin_manager::task_): New data member.
15223 (Pluginobj::Pluginobj): Add filesize parameter.
15224 (Pluginobj::filename): New function.
15225 (Pluginobj::descriptor): New function.
15226 (Pluginobj::filesize): New function.
15227 (Pluginobj::filesize_): New data member.
15228 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
15229 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
15230 File_read::claim_for_plugin; use Object::unlock to unlock the file.
15231
15232 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
15233 with archive libraries.
15234 * testsuite/Makefile.in: Regenerate.
15235 * testsuite/plugin_test.c (struct sym_info): New type.
15236 (get_input_file, release_input_file): New static variables.
15237 (onload): Capture new transfer vector entries.
15238 (claim_file_hook): Stop reading at end of file according to filesize.
15239 Factor out parsing of readelf output into separate function.
15240 (all_symbols_read_hook): Exercise get_input_file and release_input_file
15241 APIs and get the source file name from the symbol table. Convert
15242 source file name to corresponding object file name. Print info
15243 message when adding new input files.
15244 (parse_readelf_line): New function.
15245 * testsuite/plugin_test_1.sh: Add checks for new info messages.
15246 * testsuite/plugin_test_2.sh: Likewise.
15247 * testsuite/plugin_test_3.sh: Likewise.
15248 * testsuite/plugin_test_4.sh: New test case.
15249
15250 2009-01-07 Ian Lance Taylor <iant@google.com>
15251
15252 * version.cc (version_string): Bump to 1.8.
15253
15254 2008-12-23 Cary Coutant <ccoutant@google.com>
15255
15256 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
15257 * plugin.cc (Plugin_manager::finish): Rename as
15258 layout_deferred_objects. Move cleanup to separate function.
15259 (Plugin_manager::cleanup): New function.
15260 (Plugin_finish::run): Call layout_deferred_objects and cleanup
15261 separately.
15262 * plugin.h (Plugin_manager::finish): Rename as
15263 layout_deferred_objects.
15264 (Plugin_manager::cleanup): New function.
15265 (Plugin_manager::cleanup_done): New field.
15266
15267 2008-12-23 Cary Coutant <ccoutant@google.com>
15268
15269 * plugin.cc (is_visible_from_outside): New function.
15270 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
15271 so we don't return "IR only" status for exported symbols or -r links.
15272
15273 * testsuite/Makefile.am (plugin_test_3): New test case.
15274 * testsuite/Makefile.in: Regenerate.
15275 * testsuite/plugin_test_3.sh: New file.
15276
15277 2008-12-22 Cary Coutant <ccoutant@google.com>
15278
15279 * object.cc (Sized_relobj::layout_section): New function.
15280 (Sized_relobj::do_layout): Defer layout of input sections until after
15281 plugin has provided replacement files.
15282 (Sized_relobj::do_layout_deferred_sections): New function.
15283 * object.h (Relobj::set_section_offset): Remove virtual keyword.
15284 (Relobj::layout_deferred_sections): New function.
15285 (Relobj::do_layout_deferred_sections): New function.
15286 (Sized_relobj::do_layout_deferred_sections): New function.
15287 (Sized_relobj::layout_section): New function.
15288 (Sized_relobj::Deferred_layout): New structure.
15289 (Sized_relobj::deferred_layout_): New field.
15290 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
15291 Change all callers. Layout deferred sections.
15292 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
15293 references.
15294 (Plugin_hook::run): Move code from do_plugin_hook inline.
15295 (Plugin_hook::do_plugin_hook): Remove.
15296 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
15297 (Plugin_manager::finish): Renamed, was cleanup.
15298 (Plugin_manager::should_defer_layout): New function.
15299 (Plugin_manager::add_deferred_layout_object): New function.
15300 (Plugin_manager::Deferred_layout_list): New type.
15301 (Plugin_manager::deferred_layout_objects_): New field.
15302 (Plugin_hook::do_plugin_hook): Remove.
15303
15304 2008-12-17 Ian Lance Taylor <iant@google.com>
15305
15306 * options.h (class General_options): Add --no case for
15307 --export-dynamic.
15308
15309 2008-12-16 Cary Coutant <ccoutant@google.com>
15310
15311 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
15312 vector.
15313 (Plugin_manager::claim_file): Create plugin object even if
15314 plugin did not call the add_symbols callback.
15315 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
15316 asking for more symbols than were added.
15317 * testsuite/Makefile.am (plugin_test_1): Add test case with
15318 no global symbols.
15319 (empty.syms): New target.
15320 * testsuite/Makefile.in: Regenerate.
15321 * testsuite/plugin_test.c (claim_file_hook): Add new debug
15322 message. Don't call add_symbols if no globals.
15323 (all_symbols_read_hook): Don't provide replacement for empty
15324 claimed file.
15325
15326 2008-12-12 Ian Lance Taylor <iant@google.com>
15327
15328 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
15329 r_type == 0 for a local symbol with r_sym == 0.
15330 (scan_relocatable_relocs): Pass r_sym to
15331 local_non_section_strategy.
15332 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
15333 r_sym parameter.
15334
15335 * configure.ac: Update test for TLS descriptors: they are
15336 supported as of glibc 2.9.
15337 * configure: Rebuild.
15338
15339 2008-12-11 Ian Lance Taylor <iant@google.com>
15340
15341 PR 7091
15342 * target-reloc.h (Default_scan_relocatable_relocs): For each
15343 function, map r_type == 0 to RELOC_DISCARD.
15344
15345 2008-12-10 Cary Coutant <ccoutant@google.com>
15346
15347 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
15348 object to override a kept COMDAT group from a plugin object.
15349
15350 2008-12-09 Ian Lance Taylor <iant@google.com>
15351
15352 PR 7088
15353 * yyscript.y (file_cmd): Handle INPUT.
15354
15355 * testsuite/initpri1.c: Change all declarations to be full
15356 prototypes by adding void, to avoid compiler warnings.
15357
15358 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
15359
15360 * options.cc (General_options::parse_plugin_opt): New.
15361 (General_options::add_plugin): The argument now is just the filename.
15362 (General_options::add_plugin_option): New.
15363 * options.h (plugin_opt): New.
15364 (add_plugin): Change argument name.
15365 (add_plugin_option): New.
15366 * plugin.cc (Plugin::load): Don't parse the plugin option.
15367 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
15368 (Plugin::add_option): New.
15369 (Plugin::args_): Change type.
15370 (Plugin::filename_): New.
15371 (Plugin_manager::add_plugin_option): New.
15372 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
15373 * testsuite/Makefile.in: Regenerate.
15374
15375 2008-12-05 Cary Coutant <ccoutant@google.com>
15376
15377 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
15378 Handle --strip-lto-sections option.
15379 * options.h (strip_lto_sections): New option.
15380
15381 2008-12-01 Cary Coutant <ccoutant@google.com>
15382
15383 * plugin.cc (ld_plugin_message): Change format parameter to const.
15384 Fix mismatch between new[] and delete.
15385
15386 2008-11-14 Cary Coutant <ccoutant@google.com>
15387
15388 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
15389 instead of -1U.
15390
15391 2008-11-05 Craig Silverstein <csilvers@google.com>
15392
15393 * options.cc (General_options::parse_dynamic_list): New function.
15394 * options.h (General_options): New flags dynamic_list,
15395 dynamic_list_data, dynamic_list_cpp_new, and
15396 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
15397 (General_options::in_dynamic_list): New function.
15398 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
15399 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
15400 (Lex::can_continue_name): Likewise.
15401 (yylex): Likewise.
15402 (read_script_file): New parameter script_options.
15403 (read_dynamic_list): New function.
15404 (Script_options::define_dynamic_list): New function.
15405 (dynamic_list_keyword_parsecodes): New variable.
15406 (dynamic_list_keywords): New variable.
15407 * script.h (Script_options::define_dynamic_list): New function
15408 prototype.
15409 (read_dynamic_list): New function prototype.
15410 * symtab.cc (strprefix): New macro.
15411 (Symbol::should_add_dynsym_entry): Support dynamic_list,
15412 dynamic_list_data, dynamic_list_cpp_new, and
15413 dynamic_list_cpp_typeinfo.
15414 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
15415 (dynamic_list_expr): New rule.
15416 (dynamic_list_nodes): Likewise.
15417 (dynamic_list_node): Likewise.
15418 * testsuite/Makefile.am (dynamic_list): New test.
15419 * testsuite/Makefile.in: Regenerated.
15420 * testsuite/dynamic_list.t: New file.
15421 * testsuite/dynamic_list.sh: New file.
15422
15423 2008-11-05 Craig Silverstein <csilvers@google.com>
15424
15425 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
15426 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
15427 (t11_last): Likewise.
15428 * testsuite/ver_test_6.c (main): Likewise.
15429
15430 2008-10-07 Cary Coutant <ccoutant@google.com>
15431
15432 * options.c (General_options::finalize): Add check for -static and
15433 -shared.
15434 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
15435 is not empty.
15436
15437 2008-10-02 Cary Coutant <ccoutant@google.com>
15438
15439 * plugin.cc (make_sized_plugin_object): Fix conditional
15440 compilation to work when not all targets are enabled.
15441
15442 2008-09-29 Cary Coutant <ccoutant@google.com>
15443
15444 * archive.cc (Archive::get_file_and_offset): Use filename instead
15445 of name to get library path.
15446 (Archive::include_member): Unlock external member of a thin archive.
15447
15448 * testsuite/Makefile.am (TEST_AR): New variable.
15449 (thin_archive_test_1): New test.
15450 (thin_archive_test_2): New test.
15451 * testsuite/Makefile.in: Regenerate.
15452 * testsuite/thin_archive_main.cc: New file.
15453 * testsuite/thin_archive_test_1.cc: New file.
15454 * testsuite/thin_archive_test_2.cc: New file.
15455 * testsuite/thin_archive_test_3.cc: New file.
15456 * testsuite/thin_archive_test_4.cc: New file.
15457
15458 2008-09-29 Cary Coutant <ccoutant@google.com>
15459
15460 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
15461 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
15462 instead of -1U.
15463 (Sized_relobj::do_finalize_local_symbols): Likewise.
15464 (Sized_relobj::map_to_kept_section): Likewise.
15465 * object.h (Sized_relobj::invalid_address): New constant.
15466 (Sized_relobj::do_output_section_offset): Check for invalid_address
15467 and return -1ULL.
15468 * output.cc (Output_reloc::local_section_offset): Use constant
15469 invalid_address instead of -1U.
15470 (Output_reloc::get_address): Likewise.
15471 (Output_section::output_address): Change -1U to -1ULL.
15472 * output.h (Output_reloc::invalid_address): New constant.
15473 * reloc.cc (Sized_relobj::write_sections): Use constant
15474 invalid_address instead of -1U.
15475 (Sized_relobj::relocate_sections): Likewise.
15476 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
15477 values for merge sections.
15478 * target-reloc.h (relocate_for_relocatable): Use constant
15479 invalid_address instead of -1U.
15480
15481 2008-09-19 Cary Coutant <ccoutant@google.com>
15482
15483 Add plugin functionality for link-time optimization (LTO).
15484 * configure.ac (plugins): Add --enable-plugins option.
15485 * configure: Regenerate.
15486 * config.in: Regenerate.
15487 * Makefile.am (LIBDL): New variable.
15488 (CCFILES): Add plugin.cc.
15489 (HFILES): Add plugin.h.
15490 (ldadd_var): Add LIBDL.
15491 * Makefile.in: Regenerate.
15492
15493 * archive.cc: Include "plugin.h".
15494 (Archive::setup): Don't preread archive symbols when using a plugin.
15495 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
15496 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
15497 files.
15498 (Archive::include_member): Add symbols from plugin objects.
15499 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
15500 * descriptors.cc (Descriptors::open): Check for file descriptors
15501 abandoned by plugins.
15502 (Descriptors::claim_for_plugin): New function.
15503 * descriptors.h (Descriptors::claim_for_plugin): New function.
15504 (Open_descriptor::is_claimed): New field.
15505 (claim_descriptor_for_plugin): New function.
15506 * fileread.cc (File_read::claim_for_plugin): New function.
15507 * fileread.h (File_read::claim_for_plugin): New function.
15508 (File_read::descriptor): New function.
15509 * gold.cc: Include "plugin.h".
15510 (queue_initial_tasks): Add task to call plugin hooks for generating
15511 new object files.
15512 * main.cc: Include "plugin.h".
15513 (main): Load plugin libraries.
15514 * object.h (Pluginobj): Declare.
15515 (Object::pluginobj): New function.
15516 (Object::do_pluginobj): New function.
15517 (Object::set_target): New function.
15518 * options.cc: Include "plugin.h".
15519 (General_options::parse_plugin): New function.
15520 (General_options::General_options): Initialize plugins_ field.
15521 (General_options::add_plugin): New function.
15522 * options.h (Plugin_manager): Declare.
15523 (General_options): Add --plugin option.
15524 (General_options::has_plugins): New function.
15525 (General_options::plugins): New function.
15526 (General_options::add_plugin): New function.
15527 (General_options::plugins_): New field.
15528 * plugin.cc: New file.
15529 * plugin.h: New file.
15530 * readsyms.cc: Include "plugin.h".
15531 (Read_symbols::do_read_symbols): Check for archive before checking
15532 for ELF file. Call plugin hooks to claim files.
15533 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
15534 from a real object file; force override when processing replacement
15535 files.
15536 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
15537 (Symbol::init_base_object): Likewise.
15538 (Symbol::init_base_output_data): Likewise.
15539 (Symbol::init_base_output_segment): Likewise.
15540 (Symbol::init_base_constant): Likewise.
15541 (Symbol::init_base_undefined): Likewise.
15542 (Symbol::output_section): Assert that object is not a plugin.
15543 (Symbol_table::add_from_pluginobj): New function.
15544 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
15545 undefined.
15546 (Symbol_table::sized_write_globals): Likewise.
15547 (Symbol_table::add_from_pluginobj): Instantiate template.
15548 * symtab.h (Sized_pluginobj): Declare.
15549 (Symbol::in_real_elf): New function.
15550 (Symbol::set_in_real_elf): New function.
15551 (Symbol::in_real_elf_): New field.
15552 (Symbol_table::add_from_pluginobj): New function.
15553
15554 * testsuite/Makefile.am (AM_CFLAGS): New variable.
15555 (LIBDL): New variable.
15556 (LDADD): Add LIBDL.
15557 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
15558 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
15559 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
15560 (MOSTLYCLEANFILES): Likewise.
15561 * testsuite/Makefile.in: Regenerate.
15562 * testsuite/plugin_test.c: New file.
15563 * testsuite/plugin_test_1.sh: New file.
15564 * testsuite/plugin_test_2.sh: New file.
15565
15566 2008-09-16 Ian Lance Taylor <iant@google.com>
15567
15568 * target-reloc.h (relocate_section): Check whether a symbol is
15569 defined by the ABI before reporting an undefined symbol error.
15570 * target.h (Target::is_defined_by_abi): Make parameter const.
15571 (Target::do_is_defined_by_abi): Likewise.
15572 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
15573 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
15574 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
15575 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
15576 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
15577 * testsuite/Makefile.in: Rebuild.
15578
15579 * fileread.cc (make_view): Add casts to avoid warning.
15580
15581 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
15582
15583 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
15584 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15585
15586 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
15587
15588 * options.h (General_options::output_is_executable): New.
15589 (General_options::output_is_pie): New.
15590 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
15591 for shared libraries.
15592 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15593
15594 2008-09-11 Chris Demetriou <cgd@google.com>
15595
15596 * options.h (origin): New -z option.
15597 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
15598 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
15599 in DT_FLAGS_1.
15600
15601 2008-09-05 Cary Coutant <ccoutant@google.com>
15602
15603 * fileread.cc (File_read::make_view): Add check for attempt to map
15604 beyond end of file.
15605
15606 2008-09-05 Cary Coutant <ccoutant@google.com>
15607
15608 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
15609 explicit instantiations.
15610
15611 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
15612
15613 PR gold/6858
15614 * options.cc (General_options::finalize): Allow undefined symbols
15615 in shlibs if linking -shared.
15616
15617 PR gold/6859
15618 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
15619 symbols as not needing a dynsym entry.
15620
15621 2008-08-20 Craig Silverstein <csilvers@google.com>
15622
15623 * fileread.cc (File_read::open): Do not lock the file unless it
15624 was successfully opened.
15625
15626 2008-08-14 Cary Coutant <ccoutant@google.com>
15627
15628 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
15629 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
15630 * testsuite/tls_test.cc (struct int128): 128-bit struct
15631 for testing TLS relocs with non-zero addend.
15632 (v12): New TLS variable.
15633 (t12): New test.
15634 (t_last): Add check for v12.
15635 * testsuite/tls_test.h (t12): New function.
15636 * testsuite/tls_test_main.cc (thread_routine): Call new test.
15637
15638 2008-08-13 Ian Lance Taylor <iant@google.com>
15639
15640 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
15641 set tls_segment_ or relro_segment_.
15642 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
15643 when appropriate.
15644 * output.h (Output_section::clear_is_relro): New function.
15645 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
15646 sections specially even when output_data_ is empty.
15647 (Output_segment::maximum_alignment): When first section is relro,
15648 only force alignment for PT_LOAD segments.
15649 * script.cc (script_data_segment_align): New function.
15650 (script_data_segment_relro_end): New function.
15651 * script-c.h (script_data_segment_align): Declare.
15652 (script_data_segment_relro_end): Declare.
15653 * script-sections.h (class Script_sections): Declare
15654 data_segment_align and data_segment_relro_end. Add fields
15655 segment_align_index_ and saw_relro_end_.
15656 * script-sections.cc (class Sections_element): Add set_is_relro
15657 virtual function. Add new bool* parameter to place_orphan_here.
15658 Add get_output_section virtual function.
15659 (class Output_section_definition): Add set_is_relro. Add new
15660 bool* parameter to place_orphan_here. Add get_output_section.
15661 Add is_relro_ field.
15662 (Output_section_definition::Output_section_definition): Initialize
15663 evaluated_address_, evaluated_load_address, evaluated_addralign_,
15664 and is_relro_ fields.
15665 (Output_section_definition::place_orphan_here): Add is_relro
15666 parameter.
15667 (Output_section_definition::set_section_addresses): Set relro for
15668 output section.
15669 (Output_section_definition::alternate_constraint): Likewise.
15670 (class Orphan_output_section): Add new bool* parameter to
15671 place_orphan_here. Add get_output_section.
15672 (Orphan_output_section::place_orphan_here): Add is_relro
15673 parameter.
15674 (Script_sections::Script_sections): Initialize
15675 data_segment_align_index_ and saw_relro_end_.
15676 (Script_sections::data_segment_align): New function.
15677 (Script_sections::data_segment_relro_end): New function.
15678 (Script_sections::place_orphan): Set or clear is_relro.
15679 (Script_sections::set_section_addresses): Force alignment of first
15680 TLS section.
15681 * yyscript.y (exp): Call script_data_segment_align and
15682 script_data_segment_relro_end.
15683 * testsuite/relro_script_test.t: New file.
15684 * testsuite/relro_test.cc (using_script): Declare.
15685 (t1, t2): Test using_script.
15686 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
15687 (relro_script_test_SOURCES): Define.
15688 (relro_script_test_DEPENDENCIES): Define.
15689 (relro_script_test_LDFLAGS): Define.
15690 (relro_script_test_LDADD): Define.
15691 (relro_script_test.so): New target.
15692 * testsuite/Makefile.in: Rebuild.
15693
15694 2008-08-06 Cary Coutant <ccoutant@google.com>
15695
15696 * archive.cc (Archive::total_archives, Archive::total_members)
15697 (Archive::total_members_loaded): New variables.
15698 (Archive::setup): Add parameter. Add option to preread
15699 archive symbols.
15700 (Archive::read_armap): Add counter.
15701 (Archive::get_file_and_offset): New function.
15702 (Archive::get_elf_object_for_member): New function.
15703 (Archive::read_all_symbols): New function.
15704 (Archive::read_symbols): New function.
15705 (Archive::add_symbols): Add counters.
15706 (Archive::include_all_members): Use armap to find members if it's
15707 already built.
15708 (Archive::include_member): Skip reading symbols if already read.
15709 Factored code into Archive::get_file_and_offset and
15710 Archive::get_elf_object_for_member. Changed call to
15711 Mapfile::report_include_archive_member.
15712 (Archive::print_stats): New function.
15713 * archive.h: Declare Object and Read_symbols_data classes.
15714 (Archive::Archive): Add initializers for new members.
15715 (Archive::setup): Add parameter.
15716 (Archive::print_stats): New function.
15717 (Archive::total_archives, Archive::total_members)
15718 (Archive::total_members_loaded): New variables.
15719 (Archive::get_file_and_offset): New function.
15720 (Archive::get_elf_object_for_member): New function.
15721 (Archive::read_all_symbols): New function.
15722 (Archive::read_symbols): New function.
15723 (Archive::Archive_member): New class.
15724 (Archive::members_): New member.
15725 (Archive::num_members_): New member.
15726 * main.cc: Include archive.h.
15727 (main): Call Archive::print_stats.
15728 * mapfile.cc (Mapfile::report_include_archive_member): Delete
15729 archive parameter; member_name is now the fully-decorated name.
15730 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
15731 * options.h: (General_options): Add --preread-archive-symbols option.
15732 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
15733 Archive::setup.
15734
15735 2008-08-04 Ian Lance Taylor <iant@google.com>
15736
15737 * symtab.h (Symbol::use_plt_offset): New function.
15738 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
15739 * powerpc.cc (Relocate::relocate): Likewise.
15740 * sparc.cc (Relocate::relocate): Likewise.
15741 * x86_64.cc (Relocate::relocate): Likewise.
15742 * testsuite/weak_plt.sh: New test.
15743 * testsuite/weak_plt_main.cc: New test.
15744 * testsuite/weak_plt_shared.cc: New test.
15745 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
15746 (check_PROGRAMS): Add weak_plt.
15747 (check_DATA): Add weak_plt_shared.so.
15748 (weak_plt_main_pic.o, weak_plt): New targets.
15749 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
15750 * testsuite/Makefile.in: Rebuild.
15751
15752 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
15753 gcctestdir/ld.
15754 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
15755 * testsuite/Makefile.in: Rebuild.
15756
15757 2008-08-04 Alan Modra <amodra@bigpond.net.au>
15758
15759 * Makefile.am (POTFILES.in): Set LC_ALL=C.
15760 * Makefile.in: Regenerate.
15761 * po/POTFILES.in: Regenerate.
15762
15763 2008-07-29 Ian Lance Taylor <iant@google.com>
15764
15765 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
15766 symbols before other symbols.
15767 * testsuite/script_test_2.cc (test_addr): Declare.
15768 (test_addr_alias): Declare.
15769 (main): Check that test_addr and test_addr_alias have the right
15770 values.
15771 * testsuite/script_test_2.t: Define test_addr_alias and
15772 test_addr.
15773
15774 2008-07-24 Ian Lance Taylor <iant@google.com>
15775
15776 PR 5990
15777 * descriptors.cc: New file.
15778 * descriptors.h: New file.
15779 * gold-threads.h (class Hold_optional_lock): New class.
15780 * fileread.cc: Include "descriptors.h".
15781 (File_read::~File_read): Release descriptor rather than closing
15782 it.
15783 (File_read::open) [file]: Call open_descriptor rather than open.
15784 Set is_descriptor_opened_.
15785 (File_read::open) [memory]: Assert that descriptor is not open.
15786 (File_read::reopen_descriptor): New function.
15787 (File_read::release): Release descriptor.
15788 (File_read::do_read): Make non-const. Reopen descriptor.
15789 (File_read::read): Make non-const.
15790 (File_read::make_view): Reopen descriptor.
15791 (File_read::do_readv): Likewise.
15792 * fileread.h (class File_read): Add is_descriptor_opened_ field.
15793 Update declarations.
15794 * layout.cc: Include "descriptors.h".
15795 (Layout::create_build_id): Use open_descriptor rather than open.
15796 * output.cc: Include "descriptors.h".
15797 (Output_file::open): Use open_descriptor rather than open.
15798 * archive.cc (Archive::const_iterator): Change Archive to be
15799 non-const.
15800 (Archive::begin, Archive::end): Make non-const.
15801 (Archive::count_members): Likewise.
15802 * archive.h (class Archive): Update declarations.
15803 * object.h (Object::read): Make non-const.
15804 * Makefile.am (CCFILES): Add descriptors.cc.
15805 (HFILES): Add descriptors.h.
15806 * Makefile.in: Rebuild.
15807
15808 PR 6716
15809 * gold.h: Always include <clocale>. Add Solaris workarounds
15810 following code in binutils/sysdep.h.
15811
15812 PR 6048
15813 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
15814 this->eh_frame_hdr_ is NULL before using it.
15815
15816 * dynobj.cc (Versions::Versions): Update comment.
15817
15818 * dynobj.cc (Versions::Versions): If there is an soname, use it as
15819 the base version name.
15820
15821 * stringpool.cc (Stringpool_template::add_with_length): Set key to
15822 array size plus one.
15823 (Stringpool_template::set_string_offsets): Subtract one from key
15824 before using it as an array index.
15825 (Stringpool_template::get_offset_with_length): Likewise.
15826 (Stringpool_template::write_to_buffer): Likewise.
15827 * stringpool.h (Stringpool_template::get_offset_from_key):
15828 Likewise.
15829
15830 2008-07-23 Ian Lance Taylor <iant@google.com>
15831
15832 PR 6658
15833 * object.h (Merged_symbol_value::value): Do our best to handle a
15834 negative addend.
15835
15836 PR 6647
15837 * script.cc (Version_script_info::get_versions): Don't add empty
15838 version tag to return value.
15839 (Version_script_info::get_symbol_version_helper): Change return
15840 type to bool. Add pversion parameter. Change all callers.
15841 (script_register_vers_node): Don't require a non-NULL tag.
15842 * script.h (class Version_script_info): Update declarations.
15843 (Version_script_info::get_symbol_version): Change return type to
15844 bool. Add version parameter. Change all callers.
15845 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
15846 handling. Handle an empty version from a version script.
15847 (Symbol_table::define_special_symbol): Likewise.
15848 * testsuite/ver_test_10.script: New file.
15849 * testsuite/ver_test_10.sh: New file.
15850 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
15851 (check_DATA): Add ver_test_10.syms.
15852 (ver_test_10.syms, ver_test_10.so): New target.
15853 * testsuite/Makefile.in: Rebuild.
15854
15855 2008-07-23 Simon Baldwin <simonb@google.com>
15856
15857 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
15858 to zero for undefined symbols from dynamic libraries.
15859
15860 2008-07-23 Ian Lance Taylor <iant@google.com>
15861
15862 * symtab.cc (Symbol_table::resolve): Remove version parameter.
15863 Change all callers.
15864 * symtab.h (class Symbol_table): Update declaration.
15865 * testsuite/ver_test_9.cc: New file.
15866 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
15867 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
15868 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
15869 (ver_test_9.so, ver_test_9.o): New targets.
15870 * testsuite/Makefile.in: Rebuild.
15871
15872 2008-07-22 Ian Lance Taylor <iant@google.com>
15873
15874 * options.h (class General_options): Define --check-sections.
15875 * layout.cc (Layout::set_segment_offsets): Handle
15876 --check-sections.
15877
15878 * options.h (class General_options): Define -n/--nmagic and
15879 -N/--omagic.
15880 * options.cc (General_options::finalize): For -n/--nmagic or
15881 -N/--omagic, set -static.
15882 * layout.cc (Layout::attach_allocated_section_to_segment): If
15883 -N/--omagic, don't put read-only and read-write sections in
15884 different segments.
15885 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
15886 finding a read-only segment.
15887 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
15888 don't set the minimum segment alignment to the common page size,
15889 and don't set the file offset to the address modulo the page size.
15890 * script-sections.cc (Script_sections::create_segments): If
15891 -n/--omagic, don't put read-only and read-write sections in
15892 different segments.
15893
15894 * cref.cc: New file.
15895 * cref.h: New file.
15896 * options.h (class General_options): Add --print-symbol-counts.
15897 * main.cc (main): Issue defined symbol report if requested.
15898 * archive.cc (Archive::interpret_header): Make into a const member
15899 function.
15900 (Archive::add_symbols): Call Input_objects::archive_start and
15901 archive_stop.
15902 (Archive::const_iterator): Define new class.
15903 (Archive::begin, Archive::end): New functions.
15904 (Archive::include_all_members): Rewrite to use iterator.
15905 (Archive::count_members): New function.
15906 * archive.h (class Archive): Update declarations.
15907 (Archive::filename): New function.
15908 * object.cc: Include "cref.h".
15909 (Sized_relobj::Sized_relobj): Initialize defined_count_.
15910 (Sized_relobj::do_get_global_symbol_counts): New function.
15911 (Input_objects::add_object): Add object to cross-referencer.
15912 (Input_objects::archive_start): New function.
15913 (Input_objects::archive_stop): New function.
15914 (Input_objects::print_symbol_counts): New function.
15915 * object.h: Declare Cref and Archive.
15916 (Object::get_global_symbol_counts): New function.
15917 (Object::do_get_global_symbol_counts): New pure virtual function.
15918 (class Sized_relobj): Add defined_count_ field. Update
15919 declarations.
15920 (class Input_objects): Add cref_ field. Update constructor.
15921 Update declarations.
15922 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
15923 defined_count_.
15924 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
15925 symbol counts.
15926 (Sized_dynobj::do_get_global_symbol_counts): New function.
15927 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
15928 defined_count_. Update declarations. Define Symbols typedef.
15929 * symtab.cc (Symbol_table::add_from_relobj): Add defined
15930 parameter. Change all callers.
15931 (Symbol_table::add_from_dynobj): Add sympointers and defined
15932 parameters. Change all callers.
15933 * symtab.h (class Symbol_table): Update declarations.
15934 * Makefile.am (CCFILES): Add cref.cc.
15935 (HFILES): Add cref.h.
15936 * Makefile.in: Rebuild.
15937
15938 2008-07-22 Simon Baldwin <simonb@google.com>
15939
15940 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
15941 to zero when writing undefined symbols.
15942
15943 2008-07-22 Ian Lance Taylor <iant@google.com>
15944
15945 * output.cc (Output_section::add_input_section): Don't try to
15946 merge empty merge sections.
15947
15948 2008-07-21 Craig Silverstein <csilvers@google.com>
15949
15950 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15951 Include symbol version in error message.
15952
15953 2008-07-20 Chris Demetriou <cgd@google.com>
15954
15955 * configure.ac (gold_cv_c_random_seed): New configured variable.
15956 (RANDOM_SEED_CFLAGS): New substituted variable.
15957 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
15958 * configure: Rebuild.
15959 * Makefile.in: Likewise.
15960 * testsuite/Makefile.in: Likewise.
15961
15962 2008-07-18 Ian Lance Taylor <iant@google.com>
15963
15964 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
15965 where we see NAME/NULL and NAME/VERSION as separate symbols.
15966 * testsuite/ver_test_main.cc (main): Call t4.
15967 (t4, t4_2a): Define.
15968 * testsuite/ver_test_2.cc (t4_2): Define.
15969 * testsuite/ver_test_2.script: Put t4_2a in VER2.
15970 * testsuite/ver_test_4.cc (t4_2a): Define.
15971 * testsuite/ver_test_4.script: Put t4_2a in VER2.
15972 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
15973
15974 2008-07-17 Ian Lance Taylor <iant@google.com>
15975
15976 * dynobj.cc (Versions::add_def): If we give an error about a
15977 missing version, go ahead and create the version anyhow.
15978
15979 2008-07-10 Ian Lance Taylor <iant@google.com>
15980
15981 Handle output sections with more than 0x7fffffff bytes.
15982 * object.h (class Relobj): Change map_to_output_ to
15983 output_sections_, and just keep a section pointer. Change all
15984 uses. Move comdat group support to Sized_relobj.
15985 (Relobj::is_section_specially_mapped): Remove.
15986 (Relobj::output_section): Remove poff parameter. Change all
15987 callers.
15988 (Relobj::output_section_offset): New function.
15989 (Relobj::set_section_offset): Rewrite.
15990 (Relobj::map_to_output): Remove.
15991 (Relobj::output_sections): New function.
15992 (Relobj::do_output_section_offset): New pure virtual function.
15993 (Relobj::do_set_section_offset): Likewise.
15994 (class Sized_relobj): Add section_offsets_ field. Add comdat
15995 group support from Relobj. Update declarations.
15996 (Sized_relobj::get_output_section_offset): New function.
15997 (Sized_relobj::do_output_section_offset): New function.
15998 (Sized_relobj::do_set_section_offset): New function.
15999 * object.cc (Relobj::output_section_address): Remove.
16000 (Sized_relobj::Sized_relobj): Initialize new fields.
16001 (Sized_relobj::include_section_group): Cast find_kept_object to
16002 Sized_relobj.
16003 (Sized_relobj::include_linkonce_section): Likewise.
16004 (Sized_relobj::do_layout): Use separate arrays for output section
16005 and output offset.
16006 (Sized_relobj::do_count_local_symbols): Change map_to_output to
16007 output_sections.
16008 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
16009 output_sections and section_offsets.
16010 (Sized_relobj::write_local_symbols): Likewise.
16011 (map_to_kept_section): Compute output address directly.
16012 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
16013 output_sections and section_offsets.
16014 (Sized_relobj::write_sections): Likewise.
16015 (Sized_relobj::relocate_sections): Likewise.
16016 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
16017 * output.h (class Output_reloc): Update declarations. Change
16018 u2_.relobj to Sized_relobj*.
16019 (class Output_data_reloc): Change add functions to use
16020 Sized_relobj*.
16021 * output.cc (Output_reloc::Output_reloc): Change relobj to
16022 Sized_relobj*.
16023 (Output_reloc::local_section_offset): Change return type to
16024 Elf_Addr. Use get_output_section_offset.
16025 (Output_reloc::get_address): Likewise.
16026 (Output_section::is_input_address_mapped): Don't call
16027 is_section_specially_mapped.
16028 (Output_section::output_offset): Likewise.
16029 (Output_section::output_address): Likewise.
16030 (Output_section::starting_output_address): Likewise.
16031 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
16032 parameter to Sized_relobj*.
16033 (Copy_relocs::need_copy_reloc): Likewise.
16034 (Copy_relocs::save): Likewise.
16035 * copy-relocs.h (class Copy_relocs): Update declarations.
16036 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
16037 Sized_relobj*. Change relobj_ field to Sized_relobj*.
16038 * target-reloc.h (relocate_for_relocatable): Change
16039 offset_in_output_section type to Elf_Addr. Change code that uses
16040 it as well.
16041 * layout.cc (Layout::layout): Always set *off.
16042 * mapfile.cc (Mapfile::print_input_section): Use
16043 output_section_offset.
16044 * i386.cc (Target_i386::copy_reloc): Change object parameter to
16045 Sized_relobj*.
16046 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
16047 * sparc.cc (Target_sparc::copy_reloc): Likewise.
16048 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
16049
16050 2008-07-03 Ian Lance Taylor <iant@google.com>
16051
16052 * layout.cc (Layout::include_section): Do not discard unrecognized
16053 SHT_STRTAB sections.
16054
16055 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
16056
16057 * script.cc (Lex::can_continue_name): Make '?' allowable in
16058 version-script names.
16059 * testsuite/version_script.map: Change glob pattern to use '?'
16060
16061 2008-06-30 Manish Singh <yosh@gimp.org>
16062
16063 PR 6585
16064 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
16065 Correct typo.
16066
16067 2008-06-30 Ian Lance Taylor <iant@google.com>
16068
16069 PR 6660
16070 PR 6682
16071 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
16072 versions]: Don't try to read the value in the contents, since we
16073 don't use it. Use the template endianness when writing.
16074
16075 2008-06-25 Cary Coutant <ccoutant@google.com>
16076
16077 * fileread.cc (File_read::make_view): Assert on zero-length view.
16078 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
16079 symbol table when there are no symbols to read.
16080
16081 2008-06-23 Craig Silverstein <csilvers@google.com>
16082
16083 * version.cc (version_string): Bump to 1.7
16084
16085 2008-06-18 Craig Silverstein <csilvers@google.com>
16086
16087 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
16088 constant 0xFFFF to type Valtype.
16089 (Powerpc_relocate_functions::rel16_ha): Likewise.
16090
16091 2008-06-17 Ian Lance Taylor <iant@google.com>
16092
16093 * output.h (Output_section::Input_section): Initialize p2align_ to
16094 zero for Output_section_data constructors.
16095 (Output_section::Input_section::addralign): If not an input
16096 section, return the alignment of the Output_section_data.
16097 * testsuite/copy_test.cc: New file.
16098 * testsuite/copy_test_1.cc: New file.
16099 * testsuite/copy_test_2.cc: New file.
16100 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
16101 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
16102 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
16103 (copy_test_1_pic.o, copy_test_1.so): New targets.
16104 (copy_test_2_pic.o, copy_test_2.so): New targets.
16105 * testsuite/Makefile.in: Rebuild.
16106
16107 * script-sections.cc (Script_sections::place_orphan): Initialize
16108 local variable exact.
16109
16110 2008-06-13 David Edelsohn <edelsohn@gnu.org>
16111
16112 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
16113
16114 2008-06-12 David Edelsohn <edelsohn@gnu.org>
16115 David S. Miller <davem@davemloft.net>
16116
16117 * powerpc.cc: New file.
16118 * Makefile.am (TARGETSOURCES): Add powerpc.cc
16119 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
16120 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
16121 * Makefile.in: Rebuild.
16122
16123 2008-06-09 Ian Lance Taylor <iant@google.com>
16124
16125 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
16126 <exception>.
16127 (throwing, orig_terminate): New static variables.
16128 (terminate_handler): New static function.
16129 (t2): Set terminate handler.
16130
16131 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
16132
16133 PR 6584
16134 * binary.cc (Binary_to_elf::sized_convert): Fix .data
16135 alignment.
16136
16137 2008-05-30 Cary Coutant <ccoutant@google.com>
16138
16139 * archive.cc (Archive::include_all_members) Correct to step
16140 over symbol table and extended name table in thin archives.
16141
16142 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
16143
16144 PR 6407
16145 * target-reloc.h (relocate_for_relocatable): Fix new_offset
16146 calculation.
16147
16148 2008-05-28 Caleb Howe <cshowe@google.com>
16149
16150 * reduced_debug_output.cc: New file.
16151 * reduced_debug_output.h: New file.
16152 * options.h (class General_options): Add --strip-debug-non-line.
16153 * options.cc (General_options::finalize): Add strip_debug_non_line
16154 to the strip heirarchy.
16155 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
16156 fields.
16157 * layout.cc: Include "reduced_debug_output.h".
16158 (Layout::Layout): Initialize new fields.
16159 (line_only_debug_sections): New static array.
16160 (is_lines_only_debug_sections): New static inline function.
16161 (Layout::include_section): Handle --strip-debug-non-line.
16162 (Layout::make_output_section): If --strip-debug-non-line, build
16163 new output sections for .debug_abbrev and .debug_info.
16164 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
16165 gold. Warn about possible overflow.
16166 (read_signed_LEB_128): Likewise.
16167 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
16168 (read_signed_LEB_128): Declare.
16169 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
16170 (HFILES): Add reduced_debug_output.h.
16171 * Makefile.in: Rebuild.
16172
16173 2008-05-21 Ian Lance Taylor <iant@google.com>
16174
16175 * mapfile.cc: New file.
16176 * mapfile.h: New file.
16177 * options.h (class General_options): Add -M/--print-map and -Map.
16178 * options.cc (General_options::finalize): Make -M equivalent to
16179 -Map -.
16180 * main.cc: Include <cstdio> and "mapfile.h".
16181 (main): Open mapfile if requested.
16182 * gold.cc (class Middle_runner): Add mapfile_ field. Update
16183 constructor. Change caller.
16184 (queue_initial_tasks): Add mapfile parameter. Change caller.
16185 (queue_middle_tasks): Likewise.
16186 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
16187 declarations.
16188 * archive.cc: Include "mapfile.h".
16189 (Archive::add_symbols): Add mapfile parameter. Change all
16190 callers. Pass mapfile, symbol, and reason to include_member.
16191 (Archive::include_all_members): Add mapfile parameter. Change all
16192 callers.
16193 (Archive::include_member): Add mapfile, sym, and why parameters.
16194 Change all callers. Report inclusion to map file.
16195 * archive.h: Include "fileread.h".
16196 (class Archive): Update declarations.
16197 (Archive::file): New const method.
16198 (class Add_archive_symbols): Add mapfile_ field. Update
16199 constructor. Change all callers.
16200 * readsyms.h (class Read_symbols): Likewise.
16201 (class Finish_group): Likewise.
16202 (class Read_script): Likewise.
16203 * common.cc: Include "mapfile.h".
16204 (Symbol_table::allocate_commons): Add mapfile parameter. Change
16205 all callers.
16206 (Symbol_table::do_allocate_commons): Likewise.
16207 (Symbol_table::do_allocate_commons_list): Likewise. Report common
16208 symbol allocation to mapfile.
16209 * common.h (class Allocate_commons_task): Add mapfile_ field.
16210 Update constructor. Change all callers.
16211 * symtab.h (class Symbol_table): Update declarations.
16212 * layout.cc: Include "mapfile.h".
16213 (Layout_task_runner::run): Print information to mapfile.
16214 (Layout::create_gold_note): Change Output_data_fixed_space to
16215 Output_data_zero_fill.
16216 (Layout::create_build_id): Likewise.
16217 (Layout::print_to_mapfile): New function.
16218 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
16219 constructor. Change caller.
16220 (class Layout): Declare print_to_mapfile.
16221 * output.cc (Output_section::Input_section::print_to_mapfile): New
16222 function.
16223 (Output_section::add_input_section): If producing a map, always
16224 add to input_sections_ list.
16225 (Output_section::do_print_to_mapfile): New function.
16226 (Output_segment::print_sections_to_mapfile): New function.
16227 (Output_segment::print_section_list_to_mapfile): New function.
16228 * output.h: Include "mapfile.h".
16229 (Output_data::print_to_mapfile): New function.
16230 (Output_data::do_print_to_mapfile): New virtual function.
16231 (Output_segment_headers::do_print_to_mapfile): New function.
16232 (Output_file_header::do_print_to_mapfile): New function.
16233 (Output_data_const::do_print_to_mapfile): New function.
16234 (class Output_data_const_buffer): Add map_name_ field. Update
16235 constructor. Change all callers. Add do_print_to_mapfile
16236 function.
16237 (class Output_data_fixed_space): Likewise.
16238 (class Output_data_space): Likewise.
16239 (class Output_data_zero_fill): New class.
16240 (Output_data_strtab::do_print_to_mapfile): New function.
16241 (Output_data_reloc_base::do_print_to_mapfile): New function.
16242 (Output_relocatable_relocs::do_print_to_mapfile): New function.
16243 (Output_data_group::do_print_to_mapfile): New function.
16244 (Output_data_got::do_print_to_mapfile): New function.
16245 (Output_data_dynamic::do_print_to_mapfile): New function.
16246 (Output_symtab_xindex::do_print_to_mapfile): New function.
16247 (class Output_section): Declare do_print_to_mapflie. Declare
16248 print_to_mapfile in Input_section.
16249 (class Output_segment): Declare new functions.
16250 * object.h (Sized_relobj::symbol_count): New function.
16251 * script-sections.cc
16252 (Output_section_element_dot_assignment::set_section_addresses):
16253 Change Output_data_fixed_space to Output_data_zero_fill.
16254 (Output_data_expression::do_print_to_mapfile): New function.
16255 * script.cc (read_input_script): Add mapfile parameter. Change
16256 all callers.
16257 * script.h (read_input_script): Update declaration.
16258 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
16259 (Eh_frame::do_print_to_mapfile): New function.
16260 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
16261 (Output_merge_string::do_print_to_mapfile): New function.
16262 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
16263 function.
16264 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
16265 function.
16266 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
16267 function.
16268 * Makefile.am (CCFILES): Add mapfile.cc.
16269 (HFILES): Add mapfile.h.
16270 * Makefile.in: Rebuild.
16271
16272 2008-05-19 Ian Lance Taylor <iant@google.com>
16273
16274 * options.h (class General_options): Add -z relro.
16275 * layout.cc (Layout::Layout): Initialize relro_segment_.
16276 (Layout::add_output_section_data): Return the output section.
16277 (Layout::make_output_section): Rcognize relro sections and mark
16278 them appropriately.
16279 (Layout::attach_allocated_section_to_segment): Put relro sections
16280 in a PT_GNU_RELRO segment.
16281 (Layout::create_initial_dynamic_sections): Mark the .dynamic
16282 section as relro.
16283 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
16284 PT_TLS segments.
16285 (Layout::linkonce_mapping): Map d.rel.ro.local to
16286 .data.rel.ro.local.
16287 (Layout::output_section_name): Us .data.rel.ro.local for any
16288 section which begins with that.
16289 * layout.h (class Layout): Update add_output_section_data
16290 declaration. Add relro_segment_ field.
16291 * output.cc (Output_section::Output_section): Initialize is_relro_
16292 and is_relro_local_ fields.
16293 (Output_segment::add_output_section): Group relro sections.
16294 (Output_segment::is_first_section_relro): New function.
16295 (Output_segment::maximum_alignment): If there is a relro section,
16296 align the segment to the common page size.
16297 (Output_segment::set_section_addresses): Track whether we are
16298 looking at relro sections. If the last section is a relro
16299 section, align to the common page size.
16300 (Output_segment::set_section_list_addresses): Add in_relro
16301 parameter. Change all callers. Align to the page size when
16302 moving from relro to non-relro section.
16303 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
16304 segment.
16305 * output.h (class Output_section): Add is_relro_ and
16306 is_relro_local_ fields.
16307 (Output_section::is_relro): New function.
16308 (Output_section::set_is_relro): New function.
16309 (Output_section::is_relro_local): New function.
16310 (Output_section::set_is_relro_local): New function.
16311 (class Output_segment): Update declarations.
16312 * i386.cc (Target_i386::got_section): Mark .got section as relro.
16313 * sparc.cc (Target_sparc::got_section): Likewise.
16314 * x86_64.cc (Target_x86_64::got_section): Likewise.
16315 * testsuite/relro_test_main.cc: New file.
16316 * testsuite/relro_test.cc: New file.
16317 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
16318 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
16319 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
16320 (relro_test.so, relro_test_pic.o): New targets.
16321 * testsuite/Makefile.in: Rebuild.
16322
16323 2008-05-16 Ian Lance Taylor <iant@google.com>
16324
16325 * output.cc (Output_segment::add_output_section): Remove front
16326 parameter.
16327 * output.h (class Output_segment): Remove
16328 add_initial_output_section and overloaded add_output_section.
16329 Update declaration of remaining add_output_section.
16330 * layout.cc (Layout::create_interp): Call add_output_section
16331 rather than add_initial_output_section.
16332 (Layout::finish_dynamic_section): Likewise.
16333
16334 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
16335 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
16336 know the dynamic type.
16337 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
16338 field. Initialize it in constructor.
16339 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
16340 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
16341 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
16342 reloc.
16343
16344 * output.cc (Output_reloc::get_address): Change return type to
16345 Elf_Addr.
16346 * output.h (class Output_reloc): Update get_address declaration.
16347 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
16348 for section addresses.
16349
16350 2008-05-09 Ian Lance Taylor <iant@google.com>
16351
16352 PR 6493
16353 * gold.cc (gold_nomem): Use return value of write.
16354
16355 2008-05-08 Ian Lance Taylor <iant@google.com>
16356
16357 * symtab.c (Symbol::init_base_output_data): Add version
16358 parameter. Change all callers.
16359 (Symbol::init_base_output_segment): Likewise.
16360 (Symbol::init_base_constant): Likewise.
16361 (Symbol::init_base_undefined): Likewise.
16362 (Sized_symbol::init_output_data): Likewise.
16363 (Sized_symbol::init_output_segment): Likewise.
16364 (Sized_symbol::init_constant): Likewise.
16365 (Sized_symbol::init_undefined): Likewise.
16366 (Symbol_table::do_define_in_output_data): If the new symbol has a
16367 version, mark it as the default.
16368 (Symbol_table::do_define_in_output_segment): Likewise.
16369 (Symbol_table::do_define_as_constant): Likewise.
16370 * symtab.h (class Symbol): Update declarations.
16371 (class Sized_symbol): Likewise.
16372 * resolve.cc (Symbol::override_version): New function.
16373 (Symbol::override_base): Call override_version.
16374 (Symbol::override_base_with_special): Likewise.
16375 * testsuite/ver_script_8.script: New file.
16376 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
16377 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
16378 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
16379 (ver_test_8_1.so, ver_test_8_2.so): New targets.
16380
16381 2008-05-06 Ian Lance Taylor <iant@google.com>
16382
16383 PR 6049
16384 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
16385 functions.
16386 (class General_options): Remove existing --undefined, and add
16387 --no-undefined instead. Add new --undefined as synonym for -u.
16388 * archive.cc (Archive::add_symbols): Check whether symbol was
16389 named with -u.
16390 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
16391 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
16392 all uses. Add IS_UNDEFINED. Update declarations to split
16393 different versions of init_base. Declare init_base_undefined.
16394 (Symbol::is_defined): Handle IS_UNDEFINED.
16395 (Symbol::is_undefined): Likewise.
16396 (Symbol::is_weak_undefined): Call is_undefined.
16397 (Symbol::is_absolute): Handle IS_CONSTANT.
16398 (class Sized_symbol): Update declarations to split different
16399 versions of init. Declare init_undefined.
16400 (class Symbol_table): Declare new functions.
16401 * symtab.cc (Symbol::init_base_object): Rename from init_base.
16402 Change all callers.
16403 (Symbol::init_base_output_data): Likewise.
16404 (Symbol::init_base_output_segment): Likewise.
16405 (Symbol::init_base_constant): Likewise.
16406 (Symbol::init_base_undefined): New function.
16407 (Sized_symbol::init_object): Rename from init. Change all
16408 callers.
16409 (Sized_symbol::init_output_data): Likewise.
16410 (Sized_symbol::init_output_segment): Likewise.
16411 (Sized_symbol::init_constant): Likewise.
16412 (Sized_symbol::init_undefined): New function.
16413 (Symbol_table::add_undefined_symbols_from_command_line): New
16414 function.
16415 (Symbol_table::do_add_undefined_symbols_from_command_line): New
16416 function.
16417 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
16418 (Symbol::output_section): Likewise.
16419 (Symbol::set_output_section): Likewise.
16420 (Symbol_table::sized_finalize_symbol): Likewise.
16421 (Symbol_table::sized_write_globals): Likewise.
16422 * resolve.cc (Symbol_table::should_override): Likewise.
16423 (Symbol::override_base_with_special): Likewise.
16424
16425 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
16426 symbol, change it to have default visibility.
16427 * testsuite/protected_1.cc: New file.
16428 * testsuite/protected_2.cc: New file.
16429 * testsuite/protected_3.cc: New file.
16430 * testsuite/protected_main_1.cc: New file.
16431 * testsuite/protected_main_2.cc: New file.
16432 * testsuite/protected_main_3.cc: New file.
16433 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
16434 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
16435 (protected_1_LDFLAGS, protected_1_LDADD): Define.
16436 (protected_1.so): New target.
16437 (protected_1_pic.o, protected_2_pic.o): New targets.
16438 (protected_3_pic.o): New target.
16439 (check_PROGRAMS): Add protected_2.
16440 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
16441 (protected_2_LDFLAGS, protected_2_LDADD): Define.
16442 * testsuite/Makefile.in: Rebuild.
16443
16444 * options.h (DEFINE_var): Add set_user_set_##varname__.
16445 (DEFINE_bool_alias): New macro.
16446 (class General_options): Define -Bstatic using DEFINE_bool_alias
16447 rather than DEFINE_special. Add --undefined as an alias for -z
16448 defs.
16449 * options.cc (General_options::parse_Bstatic): Remove.
16450
16451 * options.h (class General_options): Add --fatal-warnings.
16452 * main.cc (main): Implement --fatal-warnings.
16453 * errors.h (Errors::warning_count): New function.
16454
16455 * options.h (class General_options): Add -Bsymbolic-functions.
16456 * symtab.h (Symbol::is_preemptible): Check for
16457 -Bsymbolic-functions.
16458
16459 2008-05-05 Ian Lance Taylor <iant@google.com>
16460
16461 * options.h (DEFINE_bool): For DASH_Z, create the negative option
16462 as noVARNAME rather than no-VARNAME.
16463 (class General_options): Add option -z combreloc.
16464 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
16465 get_address.
16466 (Output_reloc::sort_before) [SHT_REL]: New function.
16467 (Output_reloc::sort_before) [SHT_RELA]: New function.
16468 (class Output_data_reloc_base): Add sort_relocs_ field. Define
16469 Sort_relocs_comparison.
16470 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
16471 parameter. Change all callers.
16472 (Output_data_reloc::Output_data_reloc) [both versions]: Add
16473 sort_relocs parameter. Change all callers.
16474 * output.cc (Output_reloc::get_address): New function, broken out
16475 of write_rel.
16476 (Output_reloc::write_rel): Call it.
16477 (Output_reloc::compare): New function.
16478 (Output_data_reloc_base::do_write): Optionally sort relocs.
16479
16480 * configure.ac: If targ_extra_obj is set, link it in.
16481 * configure.tgt: Initialize all variables.
16482 (x86_64*): Set targ_extra_obj and targ_extra_size.
16483 * configure: Rebuild.
16484
16485 * object.cc (Sized_relobj::include_section_group): Adjust section
16486 indexes read from group data. Build vector to pass to
16487 layout_group.
16488 * layout.cc (Layout::layout_group): Add flags and shndxes
16489 parameters. Remove contents parameter. Change caller. Update
16490 explicit instantiations.
16491 * layout.h (class Layout): Update layout_group declaration.
16492 * output.cc (Output_data_group::Output_data_group): Add flags and
16493 input_shndxes parameters. Remove contents parameter. Change
16494 caller.
16495 (Output_data_group::do_write): Change input_sections_ to
16496 input_shndxes_.
16497 * output.h (class Output_data_group): Update constructor
16498 declaration. Rename input_sections_ to input_shndxes_.
16499 * testsuite/many_sections_test.cc: Add template.
16500
16501 2008-04-30 Cary Coutant <ccoutant@google.com>
16502
16503 * target-reloc.h (relocate_section): Fix dead-pointer bug.
16504
16505 * layout.cc (Layout::include_section): Refactored check for debug
16506 info section.
16507 (Layout::add_comdat): Add new parameters. Change type
16508 of signature parameter. Add object and shndx to signatures table.
16509 (Layout::find_kept_object): New function.
16510 * layout.h: Include <cstring>.
16511 (Layout::is_debug_info_section): New function.
16512 (Layout::add_comdat): Add new parameters.
16513 (Layout::find_kept_object): New function.
16514 (Layout::Kept_section): New struct.
16515 (Layout::Signatures): Change type of map range.
16516 * object.cc (Relobj::output_section_address): New function.
16517 (Sized_relobj::include_section_group): Add new parameters. Change
16518 calls to Layout::add_comdat. Change to build table of kept comdat
16519 groups and table mapping discarded sections to kept sections.
16520 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
16521 (Sized_relobj::do_layout): Change calls to include_section_group and
16522 include_linkonce_section.
16523 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
16524 value to zero when section is discarded.
16525 (Sized_relobj::map_to_kept_section): New function.
16526 * object.h (Relobj::output_section_address): New function.
16527 (Relobj::Comdat_group): New type.
16528 (Relobj::find_comdat_group): New function.
16529 (Relobj::Comdat_group_table): New type.
16530 (Relobj::Kept_comdat_section): New type.
16531 (Relobj::Kept_comdat_section_table): New type.
16532 (Relobj::add_comdat_group): New function.
16533 (Relobj::set_kept_comdat_section): New function.
16534 (Relobj::get_kept_comdat_section): New function.
16535 (Relobj::comdat_groups_): New field.
16536 (Relobj::kept_comdat_sections_): New field.
16537 (Symbol_value::input_value): Update comment.
16538 (Sized_relobj::map_to_kept_section) New function.
16539 (Sized_relobj::include_linkonce_section): Add new parameter.
16540 * target-reloc.h (Comdat_behavior): New type.
16541 (get_comdat_behavior): New function.
16542 (relocate_section): Add code to map a discarded section to the
16543 corresponding kept section when applying a relocation.
16544
16545 2008-04-30 Craig Silverstein <csilvers@google.com>
16546
16547 * dwarf_reader.cc (next_generation_count): New static var.
16548 (Addr2line_cache_entry): New struct.
16549 (addr2line_cache): New static var.
16550 (Dwarf_line_info::one_addr2line): Added caching.
16551 (Dwarf_line_info::clear_addr2line_cache): New function.
16552 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
16553 cache-size parameter.
16554 (Dwarf_line_info::one_addr2line_cache): New function.
16555 * symtab.cc (Symbol_table::detect_odr_violations): Pass
16556 new cache-size argument to one_addr2line(), and clear cache.
16557
16558 2008-04-28 Cary Coutant <ccoutant@google.com>
16559
16560 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
16561 R_386_PC8 relocations.
16562
16563 2008-04-23 Ian Lance Taylor <iant@google.com>
16564
16565 * object.cc (Sized_relobj::include_section_group): Check for
16566 invalid section group.
16567
16568 * object.cc (make_elf_object): Correct test for 64-bit ELF file
16569 header size.
16570
16571 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
16572 than read for file header.
16573 * archive.cc (Archive::include_member): Likewise.
16574
16575 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
16576
16577 * aclocal.m4: Regenerate.
16578 * configure: Regenerate.
16579
16580 2008-04-19 Ian Lance Taylor <iant@google.com>
16581
16582 * version.cc (version_string): Bump to 1.6.
16583
16584 * testsuite/Makefile.am (many_sections_r_test): New target.
16585 (many_sections_r_test_SOURCES): Remove.
16586 (many_sections_r_test_DEPENDENCIES): Remove.
16587 (many_sections_r_test_LDFLAGS): Remove.
16588 (many_sections_r_test_LDADD): Remove.
16589
16590 * object.cc (Sized_relobj::do_add_symbols): Always pass
16591 local_symbol_count_ to add_from_relobj.
16592
16593 * testsuite/Makefile.am (many_sections_check.h): Only check one in
16594 every thousand variables.
16595 * testsuite/Makefile.in: Rebuild.
16596
16597 * object.cc (Xindex::initialize_symtab_xindex): New function.
16598 (Xindex::read_symtab_xindex): New function.
16599 (Xindex::sym_xindex_to_shndx): New function.
16600 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
16601 available.
16602 (Sized_relobj::do_initialize_xindex): New function.
16603 (Sized_relobj::do_read_symbols): Adjust section links.
16604 (Sized_relobj::symbol_section_and_value): Add is_ordinary
16605 parameter. Change all callers.
16606 (Sized_relobj::include_section_group): Adjust section links and
16607 symbol section indexes.
16608 (Sized_relobj::do_layout): Adjust section links.
16609 (Sized_relobj::do_count_local_symbols): Adjust section links and
16610 symbol section indexes.
16611 (Sized_relobj::do_finalize_local_symbols): Distinguish between
16612 ordinary and special symbols.
16613 (Sized_relobj::write_local_symbols): Add symtab_xindex and
16614 dynsym_xindex parameters. Change all callers. Adjust section
16615 links. Use SHN_XINDEX when needed.
16616 (Sized_relobj::get_symbol_location_info): Adjust section links.
16617 Don't get fooled by special symbols.
16618 * object.h (class Xindex): Define.
16619 (class Object): Add xindex_ parameter. Declare virtual functoin
16620 do_initialize_xindex.
16621 (Object::adjust_sym_shndx): New function.
16622 (Object::set_xindex): New protected function.
16623 (class Symbol_value): Add is_ordinary_shndx_ field.
16624 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
16625 (Symbol_value::value): Assert ordinary section.
16626 (Symbol_value::initialize_input_to_output_map): Likewise.
16627 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
16628 Change all callers.
16629 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
16630 all callers.
16631 (class Sized_relobj): Update declarations.
16632 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
16633 parameter. Change all callers.
16634 (Sized_relobj::adjust_shndx): New function.
16635 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
16636 field.
16637 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
16638 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
16639 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
16640 (Sized_dynobj::read_dynsym_section): Adjust section links.
16641 (Sized_dynobj::read_dynamic): Likewise.
16642 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
16643 section links.
16644 (Sized_dynobj::do_initialize_xindex): New function.
16645 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
16646 do_initialize_xindex.
16647 (Sized_dynobj::adjust_shndx): New function.
16648 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
16649 dynsym_xindex_ fields.
16650 (Layout::finalize): Add a call to set_section_indexes before
16651 creating the symtab sections.
16652 (Layout::set_section_indexes): Don't do anything if the section
16653 already has a section index.
16654 (Layout::create_symtab_sections): Add shnum parameter. Change
16655 caller. Create .symtab_shndx section if needed.
16656 (Layout::create_shdrs): Add shstrtab_section parameter. Change
16657 caller.
16658 (Layout::allocated_output_section_count): New function.
16659 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
16660 needed.
16661 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
16662 fields. Update declarations.
16663 (Layout::symtab_xindex): New function.
16664 (Layout::dynsym_xindex): New function.
16665 (class Write_symbols_task): Add layout_ field.
16666 (Write_symbols_task::Write_symbols_task): Add layout parameter.
16667 Change caller.
16668 * output.cc (Output_section_headers::Output_section_headers): Add
16669 shstrtab_section parameter. Change all callers.
16670 (Output_section_headers::do_sized_write): Store overflow values
16671 for section count and section string table section index in
16672 section header zero.
16673 (Output_file_header::do_sized_write): Check for overflow of
16674 section count and section string table section index.
16675 (Output_symtab_xindex::do_write): New function.
16676 (Output_symtab_xindex::endian_do_write): New function.
16677 * output.h (class Output_section_headers): Add shstrtab_section_.
16678 Update declarations.
16679 (class Output_symtab_xindex): Define.
16680 (Output_section::has_out_shndx): New function.
16681 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
16682 field.
16683 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
16684 Change all callers.
16685 (Sized_symbol::init): Likewise.
16686 (Symbol::output_section): Check for ordinary symbol.
16687 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
16688 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
16689 callers.
16690 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
16691 Change all callers. Simplify handling of symbols from sections
16692 not included in the link.
16693 (Symbol_table::add_from_dynobj): Handle ordinary symbol
16694 distinction.
16695 (Weak_alias_sorter::operator()): Assert that symbols are
16696 ordinary.
16697 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
16698 distinction.
16699 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
16700 parameters. Change all callers.
16701 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
16702 symbol distinction. Use SHN_XINDEX when needed.
16703 (Symbol_table::write_section_symbol): Add symtab_xindex
16704 parameter. Change all callers.
16705 (Symbol_table::sized_write_section_symbol): Likewise. Use
16706 SHN_XINDEX when needed.
16707 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
16708 declarations.
16709 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
16710 (Symbol::is_defined): Check is_ordinary.
16711 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
16712 (Symbol::is_absolute, Symbol::is_common): Likewise.
16713 (class Sized_symbol): Update declarations.
16714 (class Symbol_table): Update declarations.
16715 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
16716 parameters. Change all callers.
16717 (Sized_symbol::override): Likewise.
16718 (Symbol_table::override): Likewise.
16719 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
16720 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
16721 is_ordinary, and orig_st_shndx parameters. Change all callers.
16722 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
16723 to be in an ordinary section.
16724 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
16725 object and is_ordinary parameters. Change all callers.
16726 (Sized_dwarf_line_info::read_relocs): Add object parameter.
16727 Change all callers. Don't add undefined or non-ordinary symbols
16728 to reloc_map_.
16729 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
16730 Change all callers.
16731 * dwarf_reader.h (class Sized_dwarf_line_info): Update
16732 declarations.
16733 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
16734 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
16735 (Sized_relobj::relocate_sections): Likewise.
16736 * target-reloc.h (scan_relocs): Adjust section symbol index.
16737 (scan_relocatable_relocs): Likewise.
16738 * i386.cc (Scan::local): Check for ordinary symbols.
16739 * sparc.cc (Scan::local): Likewise.
16740 * x86_64.cc (Scan::local): Likewise.
16741 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
16742 to symbol_section_and_value.
16743 * testsuite/many_sections_test.cc: New file.
16744 * testsuite/Makefile.am (BUILT_SOURCES): Define.
16745 (check_PROGRAMS): Add many_sections_test.
16746 (many_sections_test_SOURCES): Define.
16747 (many_sections_test_DEPENDENCIES): Define.
16748 (many_sections_test_LDFLAGS): Define.
16749 (BUILT_SOURCES): Add many_sections_define.h.
16750 (many_sections_define.h): New target.
16751 (BUILT_SOURCES): Add many_sections_check.h.
16752 (many_sections_check.h): New target.
16753 (check_PROGRAMS): Add many_sections_r_test.
16754 (many_sections_r_test_SOURCES): Define.
16755 (many_sections_r_test_DEPENDENCIES): Define.
16756 (many_sections_r_test_LDFLAGS): Define.
16757 (many_sections_r_test_LDADD): Define.
16758 (many_sections_r_test.o): New target.
16759 * testsuite/Makefile.in: Rebuild.
16760
16761 2008-04-17 Cary Coutant <ccoutant@google.com>
16762
16763 * errors.cc (Errors::info): New function.
16764 (gold_info): New function.
16765 * errors.h (Errors::info): New function.
16766 * gold.h (gold_info): New function.
16767 * object.cc (Input_objects::add_object): Print trace output.
16768 * options.cc (options::parse_set): New function.
16769 (General_options::parse_wrap): Deleted.
16770 (General_options::General_options): Deleted initializer.
16771 * options.h (options::String_set): New typedef.
16772 (options::parse_set): New function.
16773 (DEFINE_set): New macro.
16774 (General_options::wrap): Changed to use DEFINE_set. Changed
16775 callers of any_wrap_symbols and is_wrap_symbol.
16776 (General_options::trace, General_options::trace_symbol):
16777 New options.
16778 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
16779 (General_options::wrap_symbols_): Deleted.
16780 * symtab.cc (Symbol_table::add_from_object): Print trace output.
16781
16782 2008-04-17 David S. Miller <davem@davemloft.net>
16783
16784 * options.cc (General_options::parse_V): New function.
16785 * options.h: Add entries for -V and -Qy.
16786
16787 2008-04-17 Ian Lance Taylor <iant@google.com>
16788
16789 * common.cc (Symbol_table::allocate_commons): Remove options
16790 parameter. Change caller.
16791 (Symbol_table::do_allocate_commons): Remove options parameter.
16792 Change caller. Just call do_allocate_commons_list twice.
16793 (Symbol_table::do_allocate_commons_list): New function, broken out
16794 of do_allocate_commons.
16795 * common.h (class Allocate_commons_task): Remove options_ field.
16796 Update constructor.
16797 * symtab.cc (Symbol_table::Symbol_table): Initialize
16798 tls_commons_.
16799 (Symbol_table::add_from_object): Put TLS common symbols on
16800 tls_commons_ list.
16801 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
16802 which are IN_OUTPUT_DATA.
16803 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
16804 allocate_commons and do_allocate_commons declarations. Declare
16805 do_allocate_commons_list.
16806 * gold.cc (queue_middle_tasks): Update creation of
16807 Allocate_commons_task to not pass options.
16808 * testsuite/Makefile.am (INCLUDES): Add -I.. .
16809 (TLS_TEST_C_FLAGS): New variable.
16810 (tls_test_c_pic.o): New target.
16811 (tls_test_shared.so): Link in tls_test_c_pic.o.
16812 (tls_test_c_pic_ie.o): New target.
16813 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
16814 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
16815 (tls_test_c.o): New target.
16816 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
16817 (tls_pic_test_LDADD): Likewise.
16818 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
16819 (tls_shared_gd_to_ie_test_LDADD): Likewise.
16820 (tls_test_c_gnu2.o): New target.
16821 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
16822 tls_test_c_gnu2.o.
16823 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
16824 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
16825 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
16826 * testsuite/tls_test.cc: Include "config.h".
16827 (t_last): Call t11_last.
16828 * testsuite/tls_test.h (t11, t11_last): Declare.
16829 * testsuite/tls_test_c.c: New file.
16830 * testsuite/tls_test_main.cc (thread_routine): Call t11.
16831 * configure.ac: Check for OpenMP support.
16832 * configure, config.in, Makefile.in: Rebuild.
16833 * testsuite/Makefile.in: Rebuild.
16834
16835 2008-04-16 Cary Coutant <ccoutant@google.com>
16836
16837 * i386.cc (Target_i386::define_tls_base_symbol): New function.
16838 (Target_i386::tls_base_symbol_defined_): New field.
16839 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16840 (Target_i386::Scan::global): Likewise.
16841 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
16842 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
16843 (Target_x86_64::tls_base_symbol_defined_): New field.
16844 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16845 (Target_x86_64::Scan::global): Likewise.
16846
16847 2008-04-16 Cary Coutant <ccoutant@google.com>
16848
16849 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
16850 (Symbol::needs_plt_entry): Allow weak undefined symbols.
16851 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
16852 building shared libraries.
16853 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
16854 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
16855 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
16856 * testsuite/Makefile.in: Rebuild.
16857 * testsuite/weak_undef.h: New file.
16858 * testsuite/weak_undef_file1.cc: Add extra test cases.
16859 * testsuite/weak_undef_file2.cc: Likewise.
16860 * testsuite/weak_undef_test.cc: Likewise.
16861
16862 2008-04-16 David S. Miller <davem@davemloft.net>
16863
16864 * sparc.cc (Target_sparc::Scan): Change from struct to class.
16865 Add issued_non_pic_error_ field. Declare check_non_pic.
16866 (Target_sparc::Scan::check_non_pic): New function.
16867 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
16868 (Target_sparc::Scan::global): Likewise.
16869
16870 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
16871 * configure: Rebuild.
16872
16873 * options.h (DEFINE_enable): New macro.
16874 (new_dtags): New enable option.
16875 (initfirst, interpose, loadfltr, nodefaultlib,
16876 nodelete, nodlopen, nodump): New -z options.
16877 * layout.cc (Layout:finish_dynamic_section): If new
16878 dtags enabled, emit DT_RUNPATH. Also, emit a
16879 DT_FLAGS_1 containing any specified -z flags.
16880
16881 2008-04-16 Ian Lance Taylor <iant@google.com>
16882
16883 * copy-relocs.cc: New file.
16884 * copy-relocs.h: New file.
16885 * reloc.cc: Remove Copy_relocs code.
16886 * reloc.h: Likewise.
16887 * reloc-types.h (struct Reloc_types) [both versions]: Add
16888 get_reloc_addend_noerror.
16889 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
16890 variants of add_global which take an addend which must be zero.
16891 * i386.cc: Include "copy-relocs.h".
16892 (class Target_i386): Change type of copy_relocs_ to variable,
16893 update initializer.
16894 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
16895 Change all callers.
16896 (Target_i386::do_finalize_sections): Change handling of
16897 copy_relocs_.
16898 * sparc.cc: Include "copy-relocs.h".
16899 (class Target_sparc): Change type of copy_relocs_ to variable,
16900 update initializer.
16901 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
16902 Change all callers.
16903 (Target_sparc::do_finalize_sections): Change handling of
16904 copy_relocs_.
16905 * x86_64.cc: Include "copy-relocs.h".
16906 (class Target_x86_64): Change type of copy_relocs_ to variable,
16907 update initializer.
16908 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
16909 class. Change all callers.
16910 (Target_x86_64::do_finalize_sections): Change handling of
16911 copy_relocs_.
16912 * Makefile.am (CCFILES): Add copy-relocs.cc.
16913 (HFILES): Add copy-relocs.h.
16914
16915 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
16916
16917 * testsuite/script_test_4.sh: Permit leading zeroes.
16918
16919 2008-04-15 Ian Lance Taylor <iant@google.com>
16920
16921 * script-sections.cc (Script_sections::create_segments): Use
16922 header_size_adjustment even when there is enough room for the
16923 headers.
16924 * testsuite/script_test_4.sh: New file.
16925 * testsuite/script_test_4.t: New file.
16926 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
16927 (check_DATA): Add script_test_4.stdout.
16928 (MOSTLYCLEANFILES): Likewise.
16929 (script_test_4): New target.
16930 (script_test_4.stdout): New target.
16931 * testsuite/Makefile.in: Rebuild.
16932
16933 * sparc.cc: Add definitions for Output_data_plt_sparc class
16934 constants.
16935
16936 2008-04-14 David S. Miller <davem@davemloft.net>
16937
16938 * sparc.cc: New file.
16939 * Makefile.am (TARGETSOURCES): Add sparc.cc
16940 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
16941 * configure.tgt: Document targ_extra_size and
16942 targ_extra_big_endian. Add entries for sparc-* and
16943 sparc64-*.
16944 * configure.ac: Handle targ_extra_size and
16945 targ_extra_big_endian.
16946 * Makefile.in: Rebuild.
16947 * configure: Likewise.
16948 * po/POTFILES.in: Likewise.
16949 * po/gold.pot: Likewise.
16950
16951 2008-04-14 Ian Lance Taylor <iant@google.com>
16952
16953 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
16954 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
16955 in the name/type/flags to section mapping. Don't call
16956 allocate_output_section.
16957 (Layout::choose_output_section): Change parameter from adjust_name
16958 to is_input_section. Don't permit input sections after sections
16959 are attached to segments. Don't call allocate_output_section.
16960 (Layout::layout_eh_frame): Call update_flags_for_input_section,
16961 not write_enable_output_section.
16962 (Layout::make_output_section): Don't push to
16963 unattached_section_list_ nor call attach_to_segment. Call
16964 attach_section_to_segment if sections are attached.
16965 (Layout::attach_sections_to_segments): New function.
16966 (Layout::attach_section_to_segment): New function.
16967 (Layout::attach_allocated_section_to_segment): Rename from
16968 attach_to_segment. Remove flags parameter.
16969 (Layout::allocate_output_section): Remove function.
16970 (Layout::write_enable_output_section): Remove function.
16971 * layout.h (class Layout): Update for above changes. Add new
16972 field sections_are_attached_.
16973 * output.h (Output_section::update_flags_for_input_section): New
16974 function.
16975 * output.cc (Output_section::add_input_section): Call
16976 update_flags_for_input_section.
16977 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
16978
16979 2008-04-11 Cary Coutant <ccoutant@google.com>
16980
16981 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
16982 thought unnecessary.
16983 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
16984
16985 2008-04-11 Ian Lance Taylor <iant@google.com>
16986
16987 * output.h (class Output_section_data): Remove inline definition
16988 of set_addralign.
16989 * output.cc (Output_section_data::set_addralign): New function.
16990
16991 2008-04-11 Cary Coutant <ccoutant@google.com>
16992
16993 Add support for TLS descriptors for i386 and x86_64.
16994 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
16995 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
16996 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
16997 GOT_TYPE_TLS_DESC.
16998 (Target_i386::got_mod_index_entry): Remove unnecessary code.
16999 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
17000 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
17001 relocations.
17002 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
17003 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
17004 Fix problem with initial-exec relocations.
17005 (Target_i386::Relocate::relocate_tls): Likewise.
17006 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
17007 relaxation.
17008 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
17009 support for section-plus-offset dynamic table entries.
17010 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
17011 (Output_data_dynamic::Dynamic_entry): Add support for
17012 section-plus-offset dynamic table entries.
17013 (Output_data_dynamic::Classification): Likewise.
17014 (Output_data_dynamic::classification_): Renamed offset_.
17015 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
17016 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
17017 (Target_x86_64::make_plt_section): New function.
17018 (Target_x86_64::reserve_tlsdesc_entries): New function.
17019 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
17020 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
17021 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
17022 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
17023 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
17024 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
17025 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
17026 add extra PLT entry for TLS descriptors.
17027 (Output_data_plt_x86_64::got_): New field.
17028 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
17029 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
17030 fields.
17031 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
17032 descriptors.
17033 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
17034 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
17035 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
17036 R_386_TLS_DESC_CALL relocations.
17037 (Target_x86_64::Scan::global): Likewise.
17038 (Target_x86_64::do_finalize_sections): Add dynamic table entries
17039 for TLS descriptors.
17040 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
17041 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
17042 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
17043 GD-to-IE relaxation.
17044 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
17045 and TLS_DESCRIPTORS.
17046 * Makefile.in: Rebuild.
17047 * configure: Rebuild.
17048 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
17049 (tls_test_shared2.so): New target.
17050 (tls_shared_gd_to_ie_test_SOURCES): New variable.
17051 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
17052 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
17053 (tls_shared_gd_to_ie_test_LDADD): New variable.
17054 (tls_shared_gnu2_gd_to_ie_test): New target.
17055 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
17056 New targets.
17057 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
17058 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
17059 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
17060 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
17061 (tls_shared_gnu2_test): New target.
17062 (tls_test_gnu2_shared.so): New target.
17063 (tls_shared_gnu2_test_SOURCES): New variable.
17064 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
17065 (tls_shared_gnu2_test_LDFLAGS): New variable.
17066 (tls_shared_gnu2_test_LDADD): New variable.
17067 * testsuite/Makefile.in: Rebuild.
17068 * testsuite/Makefile.
17069
17070 2008-04-11 Ian Lance Taylor <iant@google.com>
17071
17072 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
17073 justsyms.t.
17074 * testsuite/Makefile.in: Rebuild.
17075
17076 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
17077 long.
17078 * testsuite/script_test_2.cc (main): Adjust test.
17079
17080 2008-04-11 David S. Miller <davem@davemloft.net>
17081 Ian Lance Taylor <iant@google.com>
17082
17083 * options.h (General_options): Add entries for '-Y' and
17084 '-relax'.
17085 * options.cc (General_options:finalize): If -Y was used, add those
17086 entries to the library path instead of the default "/lib" and
17087 "/usr/lib".
17088
17089 2008-04-11 David S. Miller <davem@davemloft.net>
17090
17091 * testsuite/justsyms.t: Start at 0x100.
17092 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
17093 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
17094 long.
17095 * testsuite/script_test_2.cc: Adjust string and section length
17096 checks.
17097
17098 2008-04-09 Ian Lance Taylor <iant@google.com>
17099
17100 PR gold/5996
17101 * script-sections.cc (Sections_element::allocate_to_segment): Add
17102 orphan parameter.
17103 (Output_section_definition::allocate_to_segment): Likewise.
17104 (Orphan_output_section::allocate_to_segment): Likewise.
17105 (Script_sections::attach_sections_using_phdrs_clause): Don't
17106 propagate non-PT_LOAD segments to orphan sections.
17107 * testsuite/Makefile.am (script_test_3.stdout): Generate using
17108 readelf rather than objdump.
17109 * testsuite/script_test_3.sh: Adjust accordingly. Test that
17110 .interp section and PT_INTERP segment are the same size.
17111 * testsuite/Makefile.in: Rebuild.
17112
17113 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
17114 aliases for symbols defined in the same object.
17115 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
17116 (weak_alias_test_SOURCES): New variable.
17117 (weak_alias_test_DEPENDENCIES): New variable.
17118 (weak_alias_test_LDFLAGS): New variable.
17119 (weak_alias_test_LDADD): New variable.
17120 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
17121 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
17122 (weak_alias_test_3.o): New target.
17123 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
17124 * testsuite/weak_alias_test_main.cc: New file.
17125 * testsuite/weak_alias_test_1.cc: New file.
17126 * testsuite/weak_alias_test_2.cc: New file.
17127 * testsuite/weak_alias_test_3.cc: New file.
17128
17129 2008-04-08 Ian Lance Taylor <iant@google.com>
17130
17131 * options.h (class General_options): Add --noinhibit-exec option.
17132 * main.cc (main): Check --noinhibit-exec.
17133
17134 * options.h (class General_options): Define --wrap as a special
17135 option. Add wrap_symbols_ field.
17136 (General_options::any_wrap_symbols): New function.
17137 (General_options::is_wrap_symbol): New function.
17138 * options.cc (General_options::parse_wrap): New function.
17139 (General_options::General_options): Initialize wrap_symbols_.
17140 * symtab.cc (Symbol_table::wrap_symbol): New function.
17141 (Symbol_table::add_from_object): Handle --wrap.
17142 * symtab.h (class Symbol_table): Declare wrap_symbol.
17143 * target.h (Target::wrap_char): New function.
17144 (Target::Target_info): Add wrap_char field.
17145 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
17146 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
17147 * testsuite/testfile.cc (Target_test::test_target_info):
17148 Likewise.
17149
17150 * errors.cc (Errors::undefined_symbol): Mention symbol version if
17151 there is one.
17152
17153 * layout.h (class Layout): Add added_eh_frame_data_ field.
17154 * layout.cc (Layout::Layout): Initialize new field.
17155 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
17156 output section until we find a section we merged successfully.
17157 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
17158 that the size be non-zero.
17159
17160 * merge.cc (Object_merge_map::get_output_offset): Remove inline
17161 qualifier.
17162
17163 2008-04-08 Craig Silverstein <csilvers@google.com>
17164
17165 * configure.ac: Export new conditional variable HAVE_ZLIB.
17166 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
17167 on HAVE_ZLIB.
17168 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
17169 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17170
17171 2008-04-07 Ian Lance Taylor <iant@google.com>
17172
17173 * version.cc (version_string): Set to "1.5".
17174
17175 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
17176 Add issued_non_pic_error_ field. Declare check_non_pic.
17177 (Target_x86_64::Scan::check_non_pic): New function.
17178 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
17179 (Target_x86_64::Scan::global): Likewise.
17180
17181 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
17182 addend parameter. Change caller. Handle merge sections.
17183 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
17184 Address to Addend. Don't add in the result of
17185 local_section_offset, pass down the addend and use the returned
17186 value.
17187 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
17188 Update declarations of local_section_offset and symbol_value.
17189 * testsuite/two_file_test_1.cc (t18): New function.
17190 * testsuite/two_file_test_2.cc (f18): New function.
17191 * testsuite/two_file_test_main.cc (main): Call t18.
17192 * testsuite/two_file_test.h (t18, f18): Declare.
17193
17194 * configure.ac: Don't test for objdump, c++filt, or readelf.
17195 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
17196 conditionals.
17197 (TEST_READELF): New variable.
17198 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
17199 (check_PROGRAMS): Add two_file_strip_test.
17200 (two_file_strip_test): New target.
17201 (check_PROGRAMS): Add two_file_same_shared_strip_test.
17202 (two_file_same_shared_strip_test_SOURCES): New variable.
17203 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
17204 (two_file_same_shared_strip_test_LDFLAGS): New variable.
17205 (two_file_same_shared_strip_test_LDADD): New variable.
17206 (two_file_shared_strip.so): New target.
17207 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
17208 (ver_test_5.syms, ver_test_7.syms): Likewise.
17209 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
17210 (strip_test_3.stdout): Use TEST_OBJDUMP.
17211 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17212
17213 2008-04-04 Cary Coutant <ccoutant@google.com>
17214
17215 * symtab.h (Symbol::is_weak_undefined): New function.
17216 (Symbol::is_strong_undefined): New function.
17217 (Symbol::is_absolute): New function.
17218 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
17219 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
17220 absolute symbols.
17221 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
17222 (weak_undef_test): New target.
17223 * testsuite/Makefile.in: Rebuild.
17224 * testsuite/weak_undef_file1.cc: New file.
17225 * testsuite/weak_undef_file2.cc: New file.
17226 * testsuite/weak_undef_test.cc: New file.
17227
17228 2008-04-03 Craig Silverstein <csilvers@google.com>
17229
17230 * compressed_output.h (class Output_compressed_section): Use
17231 unsigned buffer.
17232 * compressed_output.cc (zlib_compress): Use unsigned buffers,
17233 add zlib header.
17234 (zlib_compressed_suffix): Removed.
17235 (Output_compressed_section::set_final_data_size): Use unsigned
17236 buffers.
17237 * testsuite/Makefile.am (flagstest_compress_debug_sections):
17238 Fix linker invocation.
17239 (flagstest_o_specialfile_and_compress_debug_sections):
17240 Likewise.
17241 * testsuite/Makefile.in: Regenerated.
17242
17243 2008-04-02 David S. Miller <davem@davemloft.net>
17244
17245 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
17246 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
17247
17248 2008-04-02 Craig Silverstein <csilvers@google.com>
17249
17250 * TODO: New file.
17251
17252 2008-04-02 Ian Lance Taylor <iant@google.com>
17253
17254 * fileread.cc (File_read::find_view): Add byteshift and vshifted
17255 parameters. Update for new key type to views_. Change all
17256 callers.
17257 (File_read::read): Adjust for byteshift in returned view.
17258 (File_read::add_view): New function, broken out of
17259 find_and_make_view.
17260 (File_read::make_view): New function, broken out of
17261 find_and_make_view.
17262 (File_read::find_or_make_view): Add offset and aligned
17263 parameters. Rewrite accordingly. Change all callers.
17264 (File_read::get_view): Add offset and aligned parameters. Adjust
17265 for byteshift in return value.
17266 (File_read::get_lasting_view): Likewise.
17267 * fileread.h (class File_read): Update declarations.
17268 (class File_read::View): Add byteshift_ field. Add byteshift to
17269 constructor. Add byteshift method.
17270 * archive.h (Archive::clear_uncached_views): New function.
17271 (Archive::get_view): Add aligned parameter. Change all callers.
17272 * object.h (Object::get_view): Add aligned parameter. Change all
17273 callers.
17274 (Object::get_lasting_view): Likewise.
17275
17276 * fileread.cc (File_read::release): Don't call clear_views if
17277 there are multiple objects.
17278 * fileread.h (File_read::clear_uncached_views): New function.
17279 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
17280 on the archive.
17281
17282 2008-03-31 Cary Coutant <ccoutant@google.com>
17283
17284 Add thin archive support.
17285 * archive.cc (Archive::armagt): New const.
17286 (Archive::setup): Remove task parameter and calls to unlock.
17287 (Archive::unlock_nested_archives): New function.
17288 (Archive::read_header): Add nested_off parameter. Change
17289 all callers.
17290 (Archive::interpret_header): Likewise.
17291 (Archive::include_all_members): Change to handle thin
17292 archives.
17293 (Archive::include_member): Likewise.
17294 * archive.h (Archive::Archive): Add new parameters and
17295 initializers.
17296 (Archive::armagt): New const.
17297 (Archive::setup): Remove task parameter.
17298 (Archive::unlock_nested_archives): New function.
17299 (Archive::read_header): Add nested_off parameter.
17300 (Archive::interpret_header): Likewise.
17301 (Archive::Nested_archive_table): New typedef.
17302 (Archive::is_thin_archive_): New field.
17303 (Archive::nested_archives_): New field.
17304 (Archive::options_): New field.
17305 (Archive::dirpath_): New field.
17306 (Archive::task_): New field.
17307 * readsyms.cc (Read_symbols::do_read_symbols): Add check
17308 for thin archives. Pass additional parameters to
17309 Archive::Archive. Unlock the archive file after calling
17310 Archive::setup.
17311
17312 2008-03-29 Ian Lance Taylor <iant@google.com>
17313
17314 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
17315 version symbol to be local.
17316 * testsuite/ver_test_4.sh: New file.
17317 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
17318 (check_DATA): Add ver_test_4.syms.
17319 (ver_test_4.syms): New target.
17320 * testsuite/Makefile.in: Rebuild.
17321
17322 * output.cc
17323 (Output_section::Input_section_sort_entry::has_priority): New
17324 function.
17325 (Output_section::Input_section_sort_entry::match_file_name): New
17326 function.
17327 (Output_section::Input_section_sort_entry::match_section_name):
17328 Remove.
17329 (Output_section::Input_section_sort_entry::match_section_name_prefix):
17330 Remove.
17331 (Output_section::Input_section_sort_entry::match_section_file):
17332 Remove.
17333 (Output_section::Input_section_sort_compare::operator()): Rewrite
17334 using new Input_section_sort_entry functions. Sort crtbegin and
17335 crtend first. Sort sections with no priority before sections with
17336 a priority.
17337 * testsuite/initpri1.c (d3): Check j != 4.
17338 (cd5): New constructor/destructor function.
17339 (main): Check j != 2.
17340
17341 * symtab.cc (Symbol_table::add_from_object): If we don't use the
17342 new symbol when resolving, don't call set_is_default.
17343 * testsuite/ver_test_7.cc: New file.
17344 * testsuite/ver_test_7.sh: New file.
17345 * testsuite/Makefile.am (ver_test_7.so): New target.
17346 (ver_test_7.o): New target.
17347 (check_SCRIPTS): Add ver_test_7.sh.
17348 (check_DATA): Add ver_test_7.syms.
17349 (ver_test_7.syms): New target.
17350
17351 2008-03-28 Ian Lance Taylor <iant@google.com>
17352
17353 * layout.cc (Layout::layout): If we see an input section with a
17354 name that needs sorting, set the must_sort flag for the output
17355 section.
17356 (Layout::make_output_section): If the name of the output section
17357 indicates that it might require sorting, set the may_sort flag.
17358 * output.h (Output_section::may_sort_attached_input_sections): New
17359 function.
17360 (Output_section::set_may_sort_attached_input_sections): New
17361 function.
17362 (Output_section::must_sort_attached_input_sections): New
17363 function.
17364 (Output_section::set_must_sort_attached_input_sections): New
17365 function.
17366 (class Output_section): Declare Input_section_sort_entry. Define
17367 Input_section_sort_compare. Declare
17368 sort_attached_input_sections. Add new fields:
17369 may_sort_attached_input_sections_,
17370 must_sort_attached_input_sections_,
17371 attached_input_sections_are_sorted_.
17372 * output.cc (Output_section::Output_section): Initialize new
17373 fields.
17374 (Output_section::add_input_section): Add an entry to
17375 input_sections_ if may_sort or must_sort are true.
17376 (Output_section::set_final_data_size): Call
17377 sort_attached_input_sections if necessary.
17378 (Output_section::Input_section_sort_entry): Define new class.
17379 (Output_section::Input_section_sort_compare::operator()): New
17380 function.
17381 (Output_section::sort_attached_input_sections): New function.
17382 * configure.ac: Check whether the compiler supports constructor
17383 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
17384 * testsuite/initpri1.c: New file.
17385 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
17386 CONSTRUCTOR_PRIORITY.
17387 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
17388 (initpri1_LDFLAGS): New variable.
17389 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17390
17391 2008-03-27 Ian Lance Taylor <iant@google.com>
17392
17393 * common.cc (Sort_commons::operator): Correct sorting algorithm.
17394 * testsuite/common_test_1.c: New file.
17395 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
17396 (common_test_1_SOURCES): New variable.
17397 (common_test_1_DEPENDENCIES): New variable.
17398 (common_test_1_LDFLAGS): New variable.
17399
17400 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
17401 and commons_ correctly when NAME/VERSION does not override
17402 NAME/NULL.
17403 * testsuite/ver_test_6.c: New file.
17404 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
17405 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
17406 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
17407
17408 2008-03-26 Ian Lance Taylor <iant@google.com>
17409
17410 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
17411 of an undefined symbol from a version script.
17412 * testsuite/Makefile.am (ver_test_5.so): New target.
17413 (ver_test_5.o): New target.
17414 (check_SCRIPTS): Add ver_test_5.sh.
17415 (check_DATA): Add ver_test_5.syms.
17416 (ver_test_5.syms): New target.
17417 * testsuite/ver_test_5.cc: New file.
17418 * testsuite/ver_test_5.script: New file.
17419 * testsuite/ver_test_5.sh: New file.
17420 * Makefile.in, testsuite/Makefile.in: Rebuild.
17421
17422 PR gold/5986
17423 Fix problems building gold with gcc 4.3.0.
17424 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
17425 (gold_error_at_location, gold_warning_at_location): Use it.
17426 * configure.ac: Check whether we can compile and use a template
17427 function with a printf attribute.
17428 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
17429 when jumping over bytes.
17430 * object.cc: Instantiate Object::read_section_data.
17431 * debug.h: Include <cstring>
17432 * dwarf_reader.cc: Include <algorithm>
17433 * main.cc: Include <cstring>.
17434 * options.cc: Include <cstring>.
17435 * output.cc: Include <cstring>.
17436 * script.cc: Include <cstring>.
17437 * script.h: Include <string>.
17438 * symtab.cc: Include <cstring> and <algorithm>.
17439 * target-select.cc: Include <cstring>.
17440 * version.cc: Include <string>.
17441 * testsuite/testmain.cc: Include <cstdlib>.
17442 * configure, config.in: Rebuild.
17443
17444 2008-03-25 Ian Lance Taylor <iant@google.com>
17445
17446 * options.cc: Include "../bfd/bfdver.h".
17447 (options::help): Print bug reporting address.
17448
17449 * version.cc (print_version): Adjust output for current value of
17450 BFD_VERSION_STRING.
17451
17452 * NEWS: New file.
17453
17454 * options.cc (options::help): Print list of supported targets.
17455 * target-select.h: Include <vector>.
17456 (class Target_selector): Make machine_, size_, and is_big_endian_
17457 fields const. Add bfd_name_ and instantiated_target_ fields.
17458 (Target_selector::Target_selector): Add bfd_name parameter.
17459 (Target_selector::recognize): Make non-virtual, call
17460 do_recognize.
17461 (Target_selector::recognize_by_name): Make non-virtual, call
17462 do_recognize_by_name.
17463 (Target_selector::supported_names): New function.
17464 (Target_selector::bfd_name): New function.
17465 (Target_selector::do_instantiate_target): New pure virtual
17466 function.
17467 (Target_selector::do_recognize): New virtual function.
17468 (Target_selector::do_recognize_by_name): New virtual function.
17469 (Target_selector::instantiate_target): New private function.
17470 (supported_target_names): Declare.
17471 * target-select.cc (Target_selector::Target_selector): Update for
17472 new parameter and fields.
17473 (select_target_by_name): Check that the name matches before
17474 calling recognize_by_name.
17475 (supported_target_names): New function.
17476 * i386.cc (class Target_selector_i386): Update Target_selector
17477 constructor call. Remove recognize and recognize_by_name. Add
17478 do_instantiate_target.
17479 * x86_64.cc (class Target_selector_x86_64): Likewise.
17480 * testsuite/testfile.cc (class Target_selector_test): Update for
17481 changes to Target_selector.
17482
17483 * README: Rewrite, with some notes on unsupported features.
17484
17485 2008-03-24 Cary Coutant <ccoutant@google.com>
17486
17487 * i386.cc (Target_i386::Got_type): New enum declaration.
17488 (Target_i386::Scan::local): Updated callers of Output_data_got
17489 member functions.
17490 (Target_i386::Scan::global): Likewise.
17491 (Target_i386::Relocate::relocate): Likewise.
17492 (Target_i386::Relocate::relocate_tls): Likewise.
17493 * object.h (Got_offset_list): New class.
17494 (Sized_relobj::local_has_got_offset): Added got_type parameter.
17495 (Sized_relobj::local_got_offset): Likewise.
17496 (Sized_relobj::set_local_got_offset): Likewise.
17497 (Sized_relobj::local_has_tls_got_offset): Removed.
17498 (Sized_relobj::local_tls_got_offset): Removed.
17499 (Sized_relobj::set_local_tls_got_offset): Removed.
17500 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
17501 * output.cc (Output_data_got::add_global): Added got_type parameter.
17502 (Output_data_got::add_global_with_rel): Likewise.
17503 (Output_data_got::add_global_with_rela): Likewise.
17504 (Output_data_got::add_global_pair_with_rel): New function.
17505 (Output_data_got::add_global_pair_with_rela): New function.
17506 (Output_data_got::add_local): Added got_type parameter.
17507 (Output_data_got::add_local_with_rel): Likewise.
17508 (Output_data_got::add_local_with_rela): Likewise.
17509 (Output_data_got::add_local_pair_with_rel): New function.
17510 (Output_data_got::add_local_pair_with_rela): New function.
17511 (Output_data_got::add_global_tls): Removed.
17512 (Output_data_got::add_global_tls_with_rel): Removed.
17513 (Output_data_got::add_global_tls_with_rela): Removed.
17514 (Output_data_got::add_local_tls): Removed.
17515 (Output_data_got::add_local_tls_with_rel): Removed.
17516 (Output_data_got::add_local_tls_with_rela): Removed.
17517 * output.h (Output_data_got::add_global): Added got_type parameter.
17518 (Output_data_got::add_global_with_rel): Likewise.
17519 (Output_data_got::add_global_with_rela): Likewise.
17520 (Output_data_got::add_global_pair_with_rel): New function.
17521 (Output_data_got::add_global_pair_with_rela): New function.
17522 (Output_data_got::add_local): Added got_type parameter.
17523 (Output_data_got::add_local_with_rel): Likewise.
17524 (Output_data_got::add_local_with_rela): Likewise.
17525 (Output_data_got::add_local_pair_with_rel): New function.
17526 (Output_data_got::add_local_pair_with_rela): New function.
17527 (Output_data_got::add_global_tls): Removed.
17528 (Output_data_got::add_global_tls_with_rel): Removed.
17529 (Output_data_got::add_global_tls_with_rela): Removed.
17530 (Output_data_got::add_local_tls): Removed.
17531 (Output_data_got::add_local_tls_with_rel): Removed.
17532 (Output_data_got::add_local_tls_with_rela): Removed.
17533 * resolve.cc (Symbol::override_base_with_special): Removed
17534 reference to has_got_offset_ field.
17535 * symtab.cc (Symbol::init_fields): Replaced initialization
17536 of got_offset_ with got_offsets_. Removed initialization
17537 of has_got_offset_
17538 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
17539 (Symbol::got_offset): Likewise.
17540 (Symbol::set_got_offset): Likewise.
17541 (Symbol::has_tls_got_offset): Removed.
17542 (Symbol::tls_got_offset): Removed.
17543 (Symbol::set_tls_got_offset): Removed.
17544 (Symbol::got_offset_): Removed.
17545 (Symbol::tls_mod_got_offset_): Removed.
17546 (Symbol::tls_pair_got_offset_): Removed.
17547 (Symbol::got_offsets_): New field.
17548 (Symbol::has_got_offset): Removed.
17549 (Symbol::has_tls_mod_got_offset): Removed.
17550 (Symbol::has_tls_pair_got_offset): Removed.
17551 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
17552 (Target_x86_64::Scan::local): Updated callers of Output_data_got
17553 member functions.
17554 (Target_x86_64::Scan::global): Likewise.
17555 (Target_x86_64::Relocate::relocate): Likewise.
17556 (Target_x86_64::Relocate::relocate_tls): Likewise.
17557
17558 2008-03-25 Ben Elliston <bje@au.ibm.com>
17559
17560 * yyscript.y: Fix spelling error in comment.
17561
17562 2008-03-24 Ian Lance Taylor <iant@google.com>
17563
17564 * options.h (class General_options): Define build_id option.
17565 * layout.h (class Layout): Declare write_build_id, create_note,
17566 create_build_id. Add build_id_note_ member.
17567 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
17568 "libiberty.h", "md5.h", "sha1.h".
17569 (Layout::Layout): Initialize eh_frame_data_,
17570 eh_frame_hdr_section_, and build_id_note_.
17571 (Layout::finalize): Call create_build_id.
17572 (Layout::create_note): New function, broken out of
17573 Layout::create_gold_note.
17574 (Layout::create_gold_note): Call create_note.
17575 (Layout::create_build_id): New function.
17576 (Layout::write_build_id): New function.
17577 (Close_task_runner::run): Call write_build_id.
17578
17579 * x86_64.cc: Correct license to GPLv3.
17580
17581 2008-03-23 Ian Lance Taylor <iant@google.com>
17582
17583 * options.cc: Include "demangle.h".
17584 (parse_optional_string): New function.
17585 (parse_long_option): Handle takes_optional_argument.
17586 (parse_short_option): Update dash_z initializer. Handle
17587 takes_optional_argument.
17588 (General_options::General_options): Initialize do_demangle_.
17589 (General_options::finalize): Set do_demangle_. Handle demangling
17590 style.
17591 * options.h (parse_optional_string): Declare.
17592 (struct One_option): Add optional_arg field. Update constructor.
17593 Update call constructor calls. Add takes_optional_argument
17594 function.
17595 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
17596 (DEFINE_optional_string): Define.
17597 (General_options::demangle): Change from DEFINE_bool to
17598 DEFINE_optional_string.
17599 (General_options::no_demangle): New function.
17600 (General_options::do_demangle): New function.
17601 (General_options::set_do_demangle): New function.
17602 (General_options::execstack_status_): Move definition to end of
17603 class definition.
17604 (General_options::static_): Likewise.
17605 (General_options::do_demangle_): New field.
17606 * object.cc (big_endian>::get_symbol_location_info): Call
17607 Options::do_demangle, not Options::demangle.
17608 * symtab.cc (demangle): Likewise.
17609
17610 2008-03-22 Ian Lance Taylor <iant@google.com>
17611
17612 * gold.h: Include <cstddef> and <sys/types.h>
17613 * options.h: Include <cstring>.
17614
17615 2008-03-21 Ian Lance Taylor <iant@google.com>
17616
17617 * Added source code to GNU binutils.
17618 \f
17619 Copyright (C) 2008-2015 Free Software Foundation, Inc.
17620
17621 Copying and distribution of this file, with or without modification,
17622 are permitted in any medium without royalty provided the copyright
17623 notice and this notice are preserved.
17624
17625 Local Variables:
17626 mode: change-log
17627 left-margin: 8
17628 fill-column: 74
17629 version-control: never
17630 End:
This page took 0.414328 seconds and 4 git commands to generate.