Optimize erratum 843419 fix.
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2015-07-20 Han Shen <shenhan@google.com>
2
3 Optimize erratum 843419 fix.
4
5 * aarch64.cc (AArch64_insn_utilities::is_adr): New method.
6 (AArch64_insn_utilities::aarch64_adr_encode_imm): New method.
7 (AArch64_insn_utilities::aarch64_adrp_decode_imm): New method.
8 (E843419_stub): New sub-class of Erratum_stub.
9 (AArch64_relobj::try_fix_erratum_843419_optimized): New method.
10 (AArch64_relobj::section_needs_reloc_stub_scanning): Try optimized fix.
11 (AArch64_relobj::create_erratum_stub): Add 1 argument.
12 (Target_aarch64::scan_erratum_843419_span): Pass in adrp insn offset.
13
14 2015-07-20 Han Shen <shenhan@google.com>
15
16 Fix arm elf header flags wrt hardfp bit.
17
18 * arm.cc (Target_arm::do_adjust_elf_header): Set flags into view.
19
20 2015-07-20 H.J. Lu <hongjiu.lu@intel.com>
21
22 PR gold/18689
23 * layout.cc (Layout::layout): Clear the SHF_COMPRESSED flag bit
24 from input group section for relocatable link.
25 * testsuite/Makefile.am (check_SCRIPTS): Add pr18689.sh.
26 (check_DATA): Add pr18689.stdout.
27 (MOSTLYCLEANFILES): Add pr18689a.o pr18689b.o.
28 (pr18689.stdout): New rule.
29 (pr18689a.o): Likewise.
30 (pr18689b.o): Likewise.
31 (pr18689.o): Likewise.
32 * testsuite/pr18689.c: New file.
33 * testsuite/pr18689.sh: Likewise.
34 * testsuite/Makefile.in: Regenerated.
35
36 2015-07-20 Yiran Wang <yiran@google.com>
37 Cary Coutant <ccoutant@gmail.com>
38
39 PR gold/15574
40 * resolve.cc (Symbol_table): Remove warning about references
41 from shared objects to hidden symbols.
42 * testsuite/Makefile.am (hidden_test): Add hidden_test.syms.
43 * testsuite/Makefile.in: Regenerate.
44 * testsuite/hidden_test.sh: Check dynamic symbol table; update
45 expected error messages.
46
47 2015-07-14 H.J. Lu <hongjiu.lu@intel.com>
48
49 * compressed_output.cc (Output_compressed_section::set_final_data_size):
50 Make --compress-debug-sections=zlib the same as
51 --compress-debug-sections=zlib-gabi.
52 * testsuite/Makefile.am (flagstest_compress_debug_sections.check):
53 Expect ".debug_.*" with the SHF_COMPRESSED bit, instead of
54 ".zdebug_".
55 * testsuite/Makefile.in: Regenerated.
56
57 2015-07-12 H.J. Lu <hongjiu.lu@intel.com>
58
59 PR gold/18322
60 * compressed_output.cc (zlib_compress): Add argument for
61 compression header size. Set header size to compression header
62 size if it isn't 0. Don't write out the zlib header here.
63 (Output_compressed_section::set_final_data_size): Support
64 zlib-gnu and zlib-gabi compressions. Pass compression header
65 size to zlib_compress and write out compression header. Set
66 the SHF_COMPRESSED bit for zlib-gabi compression. Otherwise
67 clear the SHF_COMPRESSED bit
68 * options.h (compress_debug_sections): Add zlib-gnu and
69 zlib-gabi.
70 * output.h (Output_section::set_flags): New.
71 * testsuite/Makefile.am (check_PROGRAMS): Add
72 flagstest_compress_debug_sections_none,
73 flagstest_compress_debug_sections_gnu and
74 flagstest_compress_debug_sections_gabi.
75 (check_DATA): Add flagstest_compress_debug_sections_none.stdout.
76 flagstest_compress_debug_sections.stdout,
77 flagstest_compress_debug_sections.cmp,
78 flagstest_compress_debug_sections.check,
79 flagstest_compress_debug_sections_gnu.stdout,
80 flagstest_compress_debug_sections_gnu.cmp,
81 flagstest_compress_debug_sections_gnu.check,
82 flagstest_compress_debug_sections_gabi.stdout,
83 flagstest_compress_debug_sections_gabi.cmp and
84 flagstest_compress_debug_sections_gabi.check.
85 (flagstest_compress_debug_sections_none): New.
86 (flagstest_compress_debug_sections_none.stdout): Likewise.
87 (flagstest_compress_debug_sections.stdout): Likewise.
88 (flagstest_compress_debug_sections.check): Likewise.
89 (flagstest_compress_debug_sections.cmp): Likewise.
90 (flagstest_compress_debug_sections_gnu): Likewise.
91 (flagstest_compress_debug_sections_gnu.stdout): Likewise.
92 (flagstest_compress_debug_sections_gnu.check): Likewise.
93 (flagstest_compress_debug_sections_gnu.cmp): Likewise.
94 (flagstest_compress_debug_sections_gabi): Likewise.
95 (flagstest_compress_debug_sections_gabi.stdout): Likewise.
96 (flagstest_compress_debug_sections_gnu.check): Likewise.
97 (flagstest_compress_debug_sections_gnu.cmp): Likewise.
98 * testsuite/Makefile.in: Regenerated.
99
100 2015-07-12 H.J. Lu <hongjiu.lu@intel.com>
101
102 PR gold/18321
103 * compressed_output.h (decompress_input_section): Add arguments
104 for ELF class, big endian and sh_flags.
105 * compressed_output.cc (decompress_input_section): Likewise.
106 Support the SHF_COMPRESSED section.
107 * dynobj.h (Dynobj): Add elfsize and is_big_endian member
108 functions.
109 * plugin.h (Pluginobj): Likewise.
110 * layout.cc (Layout::get_output_section_flags): Also clear the
111 SHF_COMPRESSED bit.
112 * object.h (Compressed_section_info): Add flag to store sh_flags.
113 (Object): Add pure virtual elfsize and is_big_endian member
114 functions.
115 * object.cc (need_decompressed_section): Don't skip the ".zdebug"
116 prefix here.
117 (build_compressed_section_map): Check SHF_COMPRESSED for
118 uncompressed size. Store sh_flags in Compressed_section_info.
119 Pass size, big_endian and sh_flags to decompress_input_section.
120 Skip the ".debug"/".zdebug" prefix when passing section name to
121 need_decompressed_section.
122 (Sized_relobj_file<size, big_endian>::do_find_special_section):
123 Don't check ".zdebug_*" sections.
124 (Object::decompressed_section_contents): Pass ELF class, big
125 endian and sh_flags to decompress_input_section.
126 * reloc.cc (Sized_relobj_file<size, big_endian>::write_sections):
127 Likewise.
128 * testsuite/Makefile.am (check_DATA): Add
129 debug_msg_cdebug_gabi.err and gdb_index_test_2_gabi.stdout.
130 (MOSTLYCLEANFILES): Add debug_msg_cdebug_gabi.err and
131 gdb_index_test_2_gabi.stdout.
132 (debug_msg_cdebug_gabi.o): New.
133 (odr_violation1_cdebug_gabi.o): Likewise.
134 (odr_violation2_cdebug_gabi.o): Likewise.
135 (debug_msg_cdebug_gabi.err): Likewise.
136 (check_SCRIPTS): Add gdb_index_test_2_gabi.sh.
137 (gdb_index_test_cdebug_gabi.o): Likewise.
138 (gdb_index_test_2_gabi): Likewise.
139 (gdb_index_test_2_gabi.stdout): Likewise.
140 * testsuite/gdb_index_test_2_gabi.sh: New file.
141 * testsuite/Makefile.in: Regenerated.
142
143 2015-07-09 Han Shen <shenhan@google.com>
144
145 Use "gold_info" instead of "gold_warning" for erratum fix.
146
147 * aarch64.cc (Target_aarch64::scan_erratum_843419_span): Use
148 'gold_info'.
149 (Target_aarch64::scan_erratum_835769_span): USe 'gold_info'.
150
151 2015-07-09 Han Shen <shenhan@google.com>
152
153 Drop missing symbol warning for arm/aarch64.
154
155 * aarch64.cc (AArch64_relobj::scan_errata): Drop missing symbol warning.
156 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Drop missing
157 symbol warning.
158
159 2015-07-07 Han Shen <shenhan@google.com>
160
161 Make gold aarch64 accept long form of mapping symbols.
162
163 * aarch64.cc (AArch64_relobj::do_count_local_symbols): Make legal
164 of mapping symbols.
165
166 2015-06-29 Doug Kwan <dougkwan@google.com>
167
168 * testsuite/arm_bl_out_of_range.s: Align stub table so that it appears
169 at address expected by test.
170 * testsuite/arm_cortex_a8_b.s: Ditto.
171 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
172 * testsuite/arm_cortex_a8_bl.s: Ditto.
173 * testsuite/arm_cortex_a8_blx.s: Ditto.
174 * testsuite/arm_cortex_a8_local.s: Ditto.
175 * testsuite/arm_fix_v4bx.s: Ditto.
176 * testsuite/arm_unaligned_reloc.s: Ditto.
177 * testsuite/thumb_bl_out_of_range.s: Ditto.
178 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
179 * testsuite/thumb_blx_out_of_range.s: Ditto.
180
181 2015-06-29 Han Shen <shenhan@google.com>
182
183 Patch for erratum 843419 internal error.
184
185 * aarch64.cc (Erratum_stub::Insn_utilities): New typedef.
186 (Erratum_stub::update_erratum_insn): New method.
187 (Stub_table::relocate_stubs): Modified to place relocated insn.
188 (AArch64_relobj::fix_errata): Modified gold_assert.
189
190 2015-06-12 Han Shen <shenhan@google.com>
191
192 Fix erratum 835769.
193
194 * aarch64.cc (AArch64_insn_utilities::BYTES_PER_INSN): Move
195 defintion outside class definition.
196 (AArch64_insn_utilities::AARCH64_ZR): New static constant.
197 (AArch64_insn_utilities::aarch64_op31): New member.
198 (AArch64_insn_utilities::aarch64_ra): New member.
199 (AArch64_insn_utilities::aarch64_mac): New member.
200 (AArch64_insn_utilities::aarch64_mlxl): New member.
201 (ST_E_835769): New global enum member.
202 (Stub_table::relocate_stubs): Add 835769 handler.
203 (Stub_template_repertoire::Stub_template_repertoire): Install new
204 stub type.
205 (AArch64_relobj::scan_errata): This func is renamed from
206 scan_erratum_843419.
207 (AArch64_relobj::do_count_local_symbols): Add 835769 handler.
208 (AArch64_relobj::do_relocate_sections): Add 835769 handler.
209 (AArch64_relobj::scan_sections_for_stubs): Add 835769 handler.
210 (Target_aarch64::scan_erratum_835769_span): New method.
211 (Target_aarch64::create_erratum_stub): New method.
212 (Target_aarch64::is_erratum_835769_sequence): New method.
213 (Target_aarch64::scan_erratum_843419_sequence): Move part of the
214 code into create_erratum_stub.
215 * options.h (fix_cortex_a53_835769): New option.
216
217 2015-06-11 Cary Coutant <ccoutant@gmail.com>
218
219 * aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization
220 outside class body.
221 (Reloc_stub::STUB_ADDR_ALIGN): Likewise.
222
223 2015-06-11 Cary Coutant <ccoutant@gmail.com>
224
225 PR gold/17731
226 * layout.cc (corresponding_uncompressed_section_name): New function.
227 (Layout::choose_output_section): Call it.
228 * layout.h (corresponding_uncompressed_section_name): New function.
229 * script-sections.cc (Input_section_info::set_section_name): Check
230 for compressed debug section (.zdebug style).
231
232 2015-06-11 Jing Yu <jingyu@google.com>
233
234 * testsuite/Makefile.am: Add -O0 for script_test_12 test.
235 * testsuite/Makefile.in: Regenerate.
236
237 2015-06-11 Davide Italiano <dccitaliano@gmail.com>
238
239 * gold.h (is_cident): Correct typo.
240
241 2015-06-10 Han Shen <shenhan@google.com>
242 Patch for erratum-843419 (2 of 2 - fix erratum occurrences).
243
244 Now fixing for 843419 is fully functional.
245
246 The first part of the erratum fix CL is here -
247 https://sourceware.org/ml/binutils/2015-04/msg00229.html
248
249 * aarch64.cc(global enum): New constants representing stub types.
250 (Stub_template): New POD struct.
251 (Stub_template_repertoire): New class.
252 (Stub_base): New class.
253 (Erratum_stub): New class.
254 (Reloc_stub): Refactored to be a subclass of Stub_base.
255 (Reloc_stub::Stub_type): Removed.
256 (Reloc_stub::offset): Moved to Stub_base.
257 (Reloc_stub::set_offset): Moved to Stub_base.
258 (Reloc_stub::destination_address): Moved to Stub_base.
259 (Reloc_stub::set_destination_address): Moved to Stub_base.
260 (Reloc_stub::reset_destination_address): Moved to Stub_base.
261 (Reloc_stub::stub_type): Renamed and moved to Stub_base.
262 (Reloc_stub::stub_size): Renamed and moved to Stub_base.
263 (Reloc_stub::stub_insns): Renamed and moved to Stub_base.
264 (Reloc_stub::write): Moved to Stub_base.
265 (Reloc_stub::invalid_offset): Moved to Stub_base.
266 (Reloc_stub::invalid_address): Moved to Stub_base.
267 (Reloc_stub::stub_type_): Renamed and moved to Stub_base.
268 (Reloc_stub::stub_insns_): Moved to Stub_base.
269 (Reloc_stub::offset_): Moved to Stub_base.
270 (Reloc_stub::destination_address_): Moved to Stub_base.
271 (Stub_table::The_aarch64_relobj): New typedef.
272 (Stub_table::The_erratum_stub): New typedef.
273 (Stub_table::The_erratum_stub_less): New typedef.
274 (Stub_table::The_erratum_stub_set): New typedef.
275 (Stub_table::The_erratum_stub_set_iter): New typedef.
276 (Stub_table::empty): Added emptiness testing for erratum stubs.
277 (Stub_table::add_erratum_stub): New method to add an erratum stub.
278 (Stub_table::find_erratum_stub): New method.
279 (Stub_table::find_erratum_stubs_for_input_section): New method.
280 (Stub_table::erratum_stub_address): New method.
281 (Stub_table::update_date_size_changed_p): Modified to handle erratum stubs.
282 (Stub_table::do_addralign): Modified to handle erratum stubs.
283 (Stub_table::erratum_stubs_): New member.
284 (Stub_table::erratum_stub_size_): New member.
285 (Stub_table::relocate_stubs): Modified to handle erratum stubs.
286 (Stub_table::do_write): Modified to handle erratum stubs.
287 (AArch64_relobj::The_erratum_stub): New typedef.
288 (AArch64_relobj::Erratum_stub_set_iter): New typedef.
289 (AArch64_relobj::fix_errata): New method.
290 (Target_aarch64::The_reloc_stub_type): Removed.
291 (Target_aarch64::The_erratum_stub): New typede.
292 (AArch64_relocate_functions::construct_b): New method.
293
294 2015-06-08 Nick Clifton <nickc@redhat.com>
295
296 * po/fr.po: New French Translation.
297
298 2015-06-07 Cary Coutant <ccoutant@gmail.com>
299
300 PR gold/18288
301 * resolve.cc (symbol_to_bits): Remove type parameter; adjust all
302 callers. Don't use STT_COMMON to check for common symbols.
303 (Symbol_table::resolve): Warn if relocatable object has STT_COMMON
304 symbol that's not in a common section.
305 * symtab.h (Symbol::is_common): Don't use STT_COMMON to check for
306 common symbols.
307
308 2015-06-04 Cary Coutant <ccoutant@gmail.com>
309
310 PR gold/18200
311 * Makefile.am (diststuff): Add target.
312 * Makefile.in: Regenerate.
313
314 2015-06-04 Cary Coutant <ccoutant@gmail.com>
315
316 PR gold/17498
317 * object.cc (Sized_relobj_file::do_count_local_symbols): Discard
318 temporary locals in merge sections.
319 * options.cc (General_options::parse_discard_all): New method.
320 (General_options::parse_discard_locals): New method.
321 (General_options::parse_discard_none): New method.
322 (General_options::General_options): Initialize discard_locals_.
323 * options.h (--discard-all): Convert to special option.
324 (--discard-locals): Likewise.
325 (--discard-none): New option.
326 (General_options::discard_all): New method.
327 (General_options::discard_locals): New method.
328 (General_options::discard_sec_merge): New method.
329 (General_options::Discard_locals): New enum.
330 (General_options::discard_locals_): New data member.
331
332 2015-06-03 Cary Coutant <cary@google.com>
333
334 * script-sections.cc (Script_sections::Script_sections): Initialize
335 segments_created_.
336 (Script_sections::create_note_and_tls_segments): Set flag when
337 segments are created.
338 (Script_sections::expected_segment_count): Count PT_INTERP.
339 (Script_sections::attach_sections_using_phdrs_clause): Set flag when
340 segments are created.
341 * script-sections.h (Script_sections::segments_created_): New data
342 member.
343
344 2015-06-03 Cary Coutant <ccoutant@gmail.com>
345
346 PR gold/15370
347 * script-sections.cc
348 (Output_section_element_input::set_section_addresses): When there
349 are several patterns with no sort spec, put all sections in the same
350 bin.
351 * testsuite/Makefile.am (script_test_12): New testcase.
352 (script_test_12i): New testcase.
353 * testsuite/Makefile.in: Regenerate.
354 * testsuite/script_test_12.t: New test linker script.
355 * testsuite/script_test_12i.t: New test linker script.
356 * testsuite/script_test_12a.c: New test source file.
357 * testsuite/script_test_12b.c: New test source file.
358
359 2015-06-02 Cary Coutant <ccoutant@gmail.com>
360
361 * nacl.h (Sniff_file): Switch parameters to get_view to get an
362 aligned view.
363
364 2015-06-03 Cary Coutant <ccoutant@gmail.com>
365
366 PR gold/17819
367 * gold.cc (queue_final_tasks): When --build-id=tree, queue a
368 separate task to schedule the build id computation.
369 * layout.cc (Hash_task::Hash_task): Remove build_id_blocker,
370 add Output_file and offset.
371 (Hash_task::run): Get and release the input views.
372 (Hash_task::is_runnable): Always return NULL (always runnable).
373 (Layout::queue_build_id_tasks): Remove.
374 (Layout::write_build_id): Add array_of_hashes and size_of_hashes
375 parameters; use them instead of class members.
376 (Build_id_task_runner::run): New function.
377 (Close_task_runner::run): Pass array_of_hashes and size_of_hashes
378 to write_build_id.
379 * layout.h (Layout::queue_build_id_tasks): Remove.
380 (Layout::write_build_id): Add array_of_hashes and size_of_hashes
381 parameters.
382 (Layout::array_of_hashes_): Remove.
383 (Layout::size_of_array_of_hashes_): Remove.
384 (Layout::input_view_): Remove.
385 (Build_id_task_runner): New class.
386 (Close_task_runner::Close_task_runner): Add array_of_hashes and
387 size_of_hashes parameters.
388 (Close_task_runner::array_of_hashes_): New data member.
389 (Close_task_runner::size_of_hashes_): New data member.
390 * testsuite/Makefile.am
391 (flagstest_compress_debug_sections_and_build_id_tree): New test.
392 * testsuite/Makefile.in: Regenerate.
393
394 2015-06-01 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
395
396 * merge.cc (get_input_merge_map): Update for data structure change.
397 (get_or_make_input_merge_map): Update for data structure change.
398 * merge.h (Object_merge_map): Use a std::vector<std::pair>> instead of
399 a std::map. Remove first_shnum_, first_map_, second_shnum_, second_map_.
400
401 2015-05-16 Alan Modra <amodra@gmail.com>
402
403 * reloc.cc (Sized_relobj_file::find_functions): Use function_location.
404 * powerpc.cc (Target_powerpc::do_calls_non_split): New function.
405 (addi_12_1, addis_2_12, addis_12_1, cmpld_7_12_0): New constants.
406 (lis_0): Rename from lis_0_0.
407
408 2015-04-29 Cary Coutant <cary@google.com>
409 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
410
411 * gc.h (Garbage_collection::is_section_garbage): Change Object*
412 to Relobj*.
413 (Garbage_collection::add_reference): Likewise.
414 (Garbage_collection::gc_process_relocs): Likewise. Don't push
415 object/shndx pair onto *secvec for dynamic objects. Don't follow
416 relocations pointing to dynamic objects for GC.
417 * icf.cc (Icf::find_identical_sections): Change Object* to Relobj*.
418 (Icf::unfold_section): Likewise.
419 (Icf::is_section_folded): Likewise.
420 (Icf::get_folded_section): Likewise.
421 * icf.h: (Icf::get_folded_section): Likewise.
422 (Icf::unfold_section): Likewise.
423 (Icf::is_section_folded): Likewise.
424 (Icf::section_has_function_pointers): Likewise.
425 (Icf::set_section_has_function_pointers): Likewise.
426 * object.h (Section_id): Likewise.
427 (Const_section_id): Likewise.
428 * output.cc (Output_section::update_section_layout): Likewise.
429 * output.h: (Output_section_lookup_maps::find_relaxed_input_section):
430 Likewise.
431 * plugin.cc (update_section_order): Likewise.
432 (unique_segment_for_sections): Likewise.
433 * powerpc.cc (Powerpc_relobj::add_reference): Likewise.
434 (Target_powerpc::do_gc_add_reference): Likewise.
435 (Target_powerpc::gc_process_relocs): Likewise.
436 (Target_powerpc::do_gc_add_reference): Likewise.
437 * symtab.cc (Symbol_table::is_section_folded): Likewise.
438 (Symbol_table::gc_mark_symbol): Likewise.
439 * symtab.h: (Symbol_table::is_section_folded): Likewise.
440 * target.h: (Sized_target::gc_add_reference): Likewise.
441 (Sized_target::do_gc_add_reference): Likewise.
442
443 2015-04-29 Nick Clifton <nickc@redhat.com>
444
445 * po/fi.po: Updated Finnish translation.
446
447 2015-04-28 Alan Modra <amodra@gmail.com>
448
449 * powerpc.cc (Target_powerpc::do_dynsym_value): Use Address rather
450 than unsigned int for find_global_entry result temp. Compare
451 against invalid_address.
452 (Target_powerpc::do_plt_address_for_global): Likewise.
453 (Target_powerpc::Relocate::relocate): Likewise. Don't assert
454 on plt call stub existence for debug info. Do assert for plt
455 and global entry stub existence if an alloc section.
456
457 2015-04-28 Alan Modra <amodra@gmail.com>
458
459 * powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert
460 on missing global entry stub due to bogus debug info.
461
462 2015-04-27 Han Shen <shenhan@google.com>
463
464 * options.h (--fix-cortex-a53-843419): Rename option.
465 * aarch64.cc (AArch64_relobj::do_count_local_symbols): Use renamed
466 option.
467 (AArch64_relobj::scan_sections_for_stubs): Use renamed option.
468
469 2015-04-27 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
470
471 PR gold/18327
472 * output.cc (Output_section::is_input_address_mapped): Assume a missing
473 entry is mapped.
474 * testsuite/Makefile.am: Add the eh_test test.
475 * testsuite/Makefile.in: Regenerate.
476 * testsuite/eh_test_a.cc: New test.
477 * testsuite/eh_test_b.cc: New test.
478
479 2015-04-23 Sriraman Tallam <tmsriram@google.com>
480
481 * options.h (--weak-unresolved-symbols): New option.
482 * symtab.cc (Symbol_table::sized_write_globals): Change symbol
483 binding to weak with new option.
484 * symtab.h (is_weak_undefined): Check for new option.
485 (is_strong_undefined): Check for new option.
486 * testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
487 * testsuite/Makefile.in: Regenerate.
488 * testsuite/weak_unresolved_symbols_test.cc: New file.
489
490 2015-04-20 Ian Coolidge <icoolidge@google.com>
491
492 * symtab.cc (Symbol::should_add_dynsym_entry): Return true for
493 GNU_UNIQUE.
494
495 2015-04-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
496
497 * gc.cc (Garbage_collection::do_transitive_closure): Use back and
498 push_back.
499 * gc.h (Garbage_collection): Use a std::vector instead of a std::queue.
500 * object.cc (Sized_relobj_file::do_layout): Use push_back.
501 * powerpc.cc (process_gc_mark): Use push_back.
502 (Target_powerpc::do_gc_mark_symbol): Use push_back.
503 * symtab.cc (Symbol_table::gc_mark_symbol): Use push_back.
504
505 2015-04-16 Han Shen <shenhan@google.com>
506
507 * aarch64.cc (AArch64_insn_utilities): New utility class.
508 (AArch64_relobj::Mapping_symbol_position): New struct.
509 (AArch64_relobj::Mapping_symbol_info): New typedef.
510 (AArch64_relobj::do_count_local_symbols): New function overriding
511 parent's implementation.
512 (AArch64_relobj::mapping_symbol_info_): New member
513 (AArch64_relobj::scan_erratum_843419): New method.
514 (Target_aarch64::scan_erratum_843419_span): New method.
515 (Target_aarch64::is_erratum_843419_sequence): New method.
516 * options.h (fix_cortex_a53): New option.
517
518 2015-04-09 Cary Coutant <ccoutant@google.com>
519
520 * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
521 in a PIE link.
522 * testsuite/Makefile.am (tls_pie_test.sh): New test.
523 * testsuite/Makefile.in: Regenerate.
524 * testsuite/tls_pie_test.sh: New.
525
526 2015-04-09 Cary Coutant <ccoutant@google.com>
527
528 * debug.h (DEBUG_LOCATION): New.
529 (DEBUG_ALL): Include DEBUG_LOCATION.
530 (debug_string_to_enum): Add DEBUG_LOCATION.
531 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
532 output to print correct context.
533 (Sized_dwarf_line_info::do_addr2line): Add debug output. Return
534 up to 4 more locations at the beginning of the function.
535 * symtab.cc (Symbol_table::detect_odr_violations): Get canonical
536 result before sorting list of line numbers.
537 * testsuite/debug_msg.sh: Allow range of line numbers for
538 canonical results on optimized code.
539
540 2015-04-07 HC Yen <hc.yen@mediatek.com>
541
542 Add AArch32 support for gold linker.
543 gold/
544 * arm.cc: Add V8 arch combine table.
545
546 2015-04-06 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
547
548 * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
549
550 2015-04-06 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
551
552 * gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
553 to find by using the return value of insert.
554
555 2015-04-06 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
556
557 * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
558 constructor call.
559
560 2015-04-06 Ilya Tocar <ilya.tocar@intel.com>
561
562 PR gold/17641
563 * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
564 (Target_x86_64::Scan::local): Don't create GOT entry, when we
565 can convert mov to lea.
566 (Target_x86_64::Scan::global): Ditto.
567 (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
568 %reg to lea foo(%rip), %reg if possible.
569 * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
570 * testsuite/x86_64_mov_to_lea1.s: New.
571 * testsuite/x86_64_mov_to_lea2.s: Ditto.
572 * testsuite/x86_64_mov_to_lea3.s: Ditto.
573 * testsuite/x86_64_mov_to_lea4.s: Ditto.
574 * testsuite/x86_64_mov_to_lea.sh: Ditto.
575
576 2015-04-02 H.J. Lu <hongjiu.lu@intel.com>
577
578 * configure: Regenerated.
579
580 2015-04-01 Ilya Tocar <ilya.tocar@intel.com>
581
582 PR gold/17640
583 * i386.cc (Target_i386::can_convert_mov_to_lea): New.
584 (Target_i386::Scan::local): Don't create GOT entry, when we
585 can convert GOT to GOTOFF.
586 (Target_i386::Scan::global): Ditto.
587 (Target_i386::Relocate::relocate): Convert mov foo@GOT(%reg), %reg to
588 lea foo@GOTOFF(%reg), %reg if possible.
589 * testsuite/Makefile.am (i386_mov_to_lea): New test.
590 * testsuite/i386_mov_to_lea1.s: New.
591 * testsuite/i386_mov_to_lea2.s: Ditto.
592 * testsuite/i386_mov_to_lea3.s: Ditto.
593 * testsuite/i386_mov_to_lea4.s: Ditto.
594 * testsuite/i386_mov_to_lea5.s: Ditto.
595 * testsuite/i386_mov_to_lea.sh: Ditto.
596
597 2015-04-01 H.J. Lu <hongjiu.lu@intel.com>
598
599 * Makefile.am (ZLIB): New.
600 (ZLIBINC): Likewise.
601 (AM_CFLAGS): Add $(ZLIBINC).
602 (AM_CXXFLAGS): Likewise.
603 (ldadd_varldadd_var): Add $(ZLIB).
604 (incremental_dump_LDADD): Likewise.
605 (dwp_LDADD): Likewise.
606 * compressed_output.cc: Don't check HAVE_ZLIB_H to include
607 <zlib.h>.
608 (zlib_compress): Don't check HAVE_ZLIB_H.
609 (zlib_decompress): Likewise.
610 * options.h (compress_debug_sections): Likewise.
611 * configure.ac (AM_CONDITIONAL): Removed.
612 * testsuite/Makefile.am (ZLIB): New.
613 (LDADD): Add $(ZLIB).
614 Don't check HAVE_ZLIB.
615 * Makefile.in: Regenerated.
616 * config.in: Likewise.
617 * configure: Likewise.
618 * testsuite/Makefile.in: Likewise.
619
620 2015-03-30 Jing Yu <jingyu@google.com>
621
622 * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
623 TLSLD_ADD_DTPREL_LO12_NC.
624 * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
625 _TLS_MODULE_BASE_ point to the start of tls segment.
626 (Target_aarch64::optimize_tls_reloc): Add cases for
627 R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
628 R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
629 (Target_aarch64::Scan::local): Likewise.
630 (Target_aarch64::Scan::global): Likewise.
631 (Target_aarch64::Relocate::relocate): Likewise.
632 (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
633 subtracting tls segment size from symbol value for TLSLD_*_DTPREL
634 relocations.
635
636 2015-03-27 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
637
638 * merge.cc (Object_merge_map::add_mapping): call
639 Object_merge_map::Input_merge_map::add_mapping.
640 (Object_merge_map::Input_merge_map::add_mapping): New.
641 (Output_merge_data::do_add_input_section): Call
642 get_or_make_input_merge_map before a loop.
643 (Output_merge_string<Char_type>::finalize_merged_data): Call
644 get_or_make_input_merge_map before a loop.
645 * merge.h (Object_merge_map): Make Input_merge_map public.
646 * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
647 (Relobj::get_or_create_merge_map): New.
648 * object.h (Relobj::get_or_create_merge_map): New.
649
650 2015-03-24 Alan Modra <amodra@gmail.com>
651
652 PR 18147
653 * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
654 relocation errors for branches to strong undefined symbols.
655
656 2015-03-23 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
657
658 * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
659 (Object_merge_map::is_merge_section_for): Remove.
660 (Object_merge_map::find_merge_section): New.
661 * merge.h (Object_merge_map::is_merge_section_for): Remove.
662 (Object_merge_map::find_merge_section): New.
663 (Object_merge_map::get_input_merge_map): Add a const version.
664 * object.cc (Relobj::is_merge_section_for): Remove.
665 (Relobj::find_merge_section): New.
666 * object.h (Relobj::is_merge_section_for): Remove.
667 (Relobj::find_merge_section): New.
668 * output.cc
669 (Output_section::Input_section::is_merge_section_for): Remove.
670 (Output_section::add_merge_input_section): Don't call
671 add_merge_input_section.
672 (Output_section::find_merge_section): Return const. Use
673 object->find_merge_section.
674 (Output_section::build_lookup_maps): Don't build a map for
675 merge sections.
676 (Output_section::is_input_address_mapped): Return false if
677 section is not found.
678 (Output_section::find_starting_output_address): Use
679 find_merge_section instead of is_merge_section_for.
680 (Output_section::add_script_input_section): Don't build a map for
681 merge sections.
682 * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
683 (Output_section_lookup_maps::find_merge_section): Remove.
684 (Output_section_lookup_maps::add_merge_input_section) Remove.
685 (Output_section::find_merge_section): Return const.
686
687 2015-03-22 Cary Coutant <cary@google.com>
688
689 PR gold/18106
690 * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
691 non-SIB form of lea, with nop after the call.
692
693 2015-03-21 Cary Coutant <cary@google.com>
694
695 PR gold/14217
696 * output.cc (Output_segment::is_first_section_relro): Don't ignore
697 .tdata section.
698 (Output_segment::set_section_addresses): Don't align size of relro
699 segment for .tbss.
700
701 2015-03-21 Cary Coutant <cary@google.com>
702
703 PR gold/18010
704 * stringpool.cc (Stringpool_template): Don't optimize if section
705 alignment is greater than sizeof(char).
706
707 2015-03-21 Cary Coutant <cary@google.com>
708
709 PR gold/18048
710 * script-c.h (script_include_directive): Add first_token parameter.
711 * script.cc (script_include_directive): Add first_token parameter, and
712 pass it to read_script_file.
713 * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
714 (PARSING_MEMORY_DEF): New tokens.
715 (top): Add new productions for INCLUDE files.
716 (file_cmd): Replace file_or_sections_cmd with copy of its productions.
717 Pass PARSING_LINKER_SCRIPT to script_include_directive.
718 (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
719 (section_cmd): Pass PARSING_SECTION_CMDS.
720 (file_or_sections_cmd): Remove.
721 (memory_def): Pass PARSING_MEMORY_DEF.
722 * testsuite/Makefile.am (memory_test_2): New test.
723 * testsuite/Makefile.in: Regenerate.
724 * testsuite/memory_test_inc.t: New script file.
725 * testsuite/memory_test_inc_1.t.src: New script file.
726 * testsuite/memory_test_inc_2.t.src: New script file.
727 * testsuite/memory_test_inc_3.t.src: New script file.
728
729 2015-03-21 Cary Coutant <cary@google.com>
730
731 * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
732 (Sized_relobj_dwo::setup): Build compressed section map.
733 (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
734 * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
735 section map.
736 * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
737 compressed_sections_ field.
738 (build_compressed_section_map): Take Object instead of
739 Sized_relobj_file parameter; add decompress_if_needed parameter.
740 (Sized_relobj_file::do_find_special_sections): Store compressed
741 section map in parent Object.
742 (Sized_relobj_file::do_decompressed_section_contents): Move
743 implementation to Object::decompressed_section_contents.
744 (Sized_relobj_file::do_discard_decompressed_sections): Move
745 implementation to Object::discard_decompressed_sections.
746 * object.h (build_compressed_section_map): Declare.
747 (Object::Object): Add compressed_sections_ field.
748 (Object::section_is_compressed): Move implementation here.
749 (Object::decompressed_section_contents): De-virtualize.
750 (Object::discard_decompressed_sections): De-virtualize.
751 (Object::do_section_is_compressed): Delete.
752 (Object::do_decompressed_section_contents): Delete.
753 (Object::set_compressed_sections): New method.
754 (Object::compressed_sections): New method.
755 (Object::compressed_sections_): New data member.
756 (Compressed_section_info, Compressed_section_map): Move to top of file.
757 (Sized_relobj_file::do_section_is_compressed): Delete.
758 (Sized_relobj_file::do_decompressed_section_contents): Delete.
759 (Sized_relobj_file::do_discard_decompressed_sections): Delete.
760 (Sized_relobj_file::compressed_sections_): Move to Object class.
761
762 2015-03-21 Cary Coutant <ccoutant@google.com>
763
764 PR gold/18152
765 * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
766 deferred objects.
767
768 2015-03-11 Cary Coutant <ccoutant@google.com>
769
770 * options.cc (General_options::finalize): Don't allow -z relro
771 with incremental linking.
772 * testsuite/Makefile.am (incremental_test): Add -z norelro.
773 (incremental_test_2): Likewise.
774 (incremental_test_3): Likewise.
775 (incremental_test_4): Likewise.
776 (incremental_test_5): Likewise.
777 (incremental_test_6): Likewise.
778 (incremental_copy_test): Likewise.
779 (incremental_common_test_1): Likewise.
780 (incremental_comdat_test_1): Likewise.
781 * testsuite/Makefile.in: Regenerate.
782
783 2015-03-09 Cary Coutant <ccoutant@google.com>
784
785 PR gold/14675
786 * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
787 return enum indicating whether .eh_frame section is empty, optimizable,
788 unrecognized, or an end marker. Adjust explicit instantiations.
789 * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
790 (Eh_frame::add_ehframe_input_section): Change return type.
791 * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
792 * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
793 to the .eh_frame output section until we see the end marker.
794 (Layout::finalize_eh_frame_section): New.
795 * layout.h: (Layout::finalize_eh_frame_section): New.
796
797 2015-03-05 H.J. Lu <hongjiu.lu@intel.com>
798
799 * output.cc (Relobj::initialize_input_to_output_map<size>):
800 Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
801
802 2015-03-04 Cary Coutant <ccoutant@google.com>
803
804 * parameters.cc (Parameters::set_target_once): Call
805 Target::select_as_default_target just once from here...
806 (set_parameters_target): ...instead of from here.
807
808 2015-03-04 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
809
810 * ehframe.cc (Cie::set_output_offset): Pass in and use a
811 Output_section_data instead of a Merge_map.
812 (Eh_frame::Eh_frame): Don't initialize merge_map_.
813 (Eh_frame::read_cie): Use add_merge_mapping instead of
814 Merge_map::add_mapping.
815 (Eh_frame::read_fde): Ditto.
816 (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
817 (Eh_frame::do_output_offset): Use merge_output_offset istead of
818 merge_map_->get_output_offset.
819 (Eh_frame::do_is_merge_section_for): Delete.
820 * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
821 instead of a Merge_map.
822 (Cie::set_output_offset): Pass in a Output_section_data instead of a
823 Merge_map.
824 (Eh_frame::do_is_merge_section_for): Delete.
825 (Eh_frame::merge_map_): Delete.
826 * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
827 and use a Output_section_data instead of a Merge_map.
828 (Object_merge_map::add_mapping): Ditto.
829 (Object_merge_map::get_output_offset): Remove the merge_map argument.
830 (Object_merge_map::is_merge_section_for): Pass in and use a
831 Output_section_data instead of a Merge_map.
832 (Merge_map): Delete.
833 (Output_merge_base::do_output_offset): Use merge_output_offset instead
834 of merge_map_.get_output_offset.
835 (Output_merge_base::do_is_merge_section_for): Delete.
836 (Output_merge_data::do_add_input_section): Use
837 object->add_merge_mapping instead of add_mapping.
838 (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
839 * merge.h (Merge_map): Delete forward declaration.
840 (Object_merge_map::add_mapping): Pass in and use a Output_section_data
841 instead of a Merge_map.
842 (Object_merge_map::get_output_offset): Remove the merge_map argument.
843 (Object_merge_map::is_merge_section_for): Pass in and use a
844 Output_section_data instead of a Merge_map.
845 (Input_merge_map::Object_merge_map::merge_map): Replace with
846 output_data.
847 (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
848 Output_section_data instead of a Merge_map.
849 (Merge_map): Delete.
850 (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
851 (Output_merge_base::do_is_merge_section_for): Delete.
852 (Output_merge_base::add_mapping): Delete.
853 (Output_merge_base::merge_map_): Delete.
854 * object.cc (Relobj::initialize_input_to_output_map): New.
855 (Relobj::initialize_input_to_output_map): New.
856 (Relobj::merge_output_offset): New.
857 (Relobj::is_merge_section_for): New.
858 (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
859 bits.
860 * object.h (Relobj::merge_map): Delete.
861 (initialize_input_to_output_map): New.
862 (set_merge_map): Delete.
863 (add_merge_mapping): New.
864 (merge_output_offset): New.
865 (is_merge_section_for): New.
866 * output.cc (Output_section::Input_section::is_merge_section_for):
867 Use object->is_merge_section_for.
868 * output.h (Output_section_data::is_merge_section_for): Delete.
869 (Output_section_data::do_is_merge_section_for): Delete.
870 * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
871 Use object->initialize_input_to_output_map.
872 (Merged_symbol_value<size>::value_from_output_section): Use
873 object->merge_output_offset.
874
875 2015-03-02 Peter Collingbourne <pcc@google.com>
876 Cary Coutant <ccoutant@google.com>
877
878 * output.cc (Output_section::add_merge_input_section): Do not
879 attempt to merge sections with an entsize of 0.
880
881 2015-03-02 Khem Raj <raj.khem@gmail.com>
882
883 * attributes.h (class Output_attributes_section_data ): Add
884 do_print_to_mapfile function.
885
886 2015-02-24 Alan Modra <amodra@gmail.com>
887
888 PR 18010
889 * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
890 complain if value is not a multiple of four.
891 (Target_powerpc::Relocate::relocate): Correct handling of
892 R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
893
894 2015-02-21 H.J. Lu <hongjiu.lu@intel.com>
895
896 * configure.ac (default_size): Set to 32 for x32.
897 * configure: Regenerated.
898
899 2015-02-18 Alan Modra <amodra@gmail.com>
900
901 PR 17954
902 * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
903 visibility.
904
905 2015-02-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
906
907 * gc.h (Garbage_collection::add_reference): Don't use find.
908
909 2015-02-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
910
911 * object.cc (write_local_symbols): avoid std::vector copy.
912
913 2015-02-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
914
915 * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
916
917 2015-02-09 Mark Wielaard <mjw@redhat.com>
918
919 * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
920 DW_LANG_Fortran03 and DW_LANG_Fortran08.
921
922 2015-02-16 Cary Coutant <ccoutant@google.com>
923
924 PR gold/13577
925 PR gold/16992
926 * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
927 DF_SYMBOLIC if --dynamic-list option is used.
928 * options.cc (General_options::finalize): --dynamic-list is not
929 mutually exclusive with -Bsymbolic.
930 * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
931 listed in --dynamic-list.
932 * testsuite/Makefile.am (dynamic_list_lib2.so): Add
933 -Bsymbolic-functions.
934 * testsuite/Makefile.in: Regenerate.
935
936 2015-02-16 Cary Coutant <ccoutant@google.com>
937
938 PR gold/17971
939 * incremental.cc: Remove redundant include of "output.h".
940
941 2015-02-12 Jing Yu <jingyu@google.com>
942
943 * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
944 TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
945 New relocation.
946 * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
947 TLSLE_MOVW_* relocations.
948 (Target_aarch64::Scan::global): Likewise.
949 (Target_aarch64::Relocate::relocate): Likewise.
950 (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
951 for new TLSLE_MOVW_* relocations.
952
953 2015-02-11 Will Newton <will.newton@linaro.org>
954
955 PR gold/13321
956 * arm.cc (Target_arm::make_plt_section): Create an ARM
957 state mapping symbol at the start of the PLT.
958
959 2015-02-09 H.J. Lu <hongjiu.lu@intel.com>
960
961 * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
962 Replace two_file_shared_2.so with two_file_shared_1.so.
963 * testsuite/Makefile.in: Regenerated.
964
965 2015-02-09 Alan Modra <amodra@gmail.com>
966
967 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
968 plugin_test_thin.a and defsym_test.
969 * testsuite/Makefile.in: Regenerate.
970
971 2015-02-04 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
972
973 * merge.cc (do_add_input_section): Combine loop epilogue into main loop
974 body.
975
976 2015-02-04 Peter Collingbourne <pcc@google.com>
977
978 * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
979 forwarding symbols when computing symbol resolution info for plugins.
980 * plugin.h (Plugin_manager::symtab): New method.
981 (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
982
983 2015-02-03 Cary Coutant <ccoutant@google.com>
984 Peter Collingbourne <pcc@google.com>
985
986 PR gold/15660
987 * archive.cc (Thin_archive_object_unlocker): New class.
988 (Archive::include_member): Unlock external members of thin archives.
989 * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
990 (plugin_test_2): Likewise.
991 (plugin_test_3): Likewise.
992 (plugin_test_4): Likewise.
993 (plugin_test_5): Likewise.
994 (plugin_test_6): Likewise.
995 (plugin_test_7): Likewise.
996 (plugin_test_8): Likewise.
997 (plugin_test_9): Likewise.
998 (plugin_test_10): Likewise.
999 (plugin_test_11): New test case.
1000 * testsuite/Makefile.in: Regenerate.
1001 * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
1002 file to decide whether to claim file.
1003 (all_symbols_read_hook): Likewise.
1004 * testsuite/plugin_test_1.sh: Adjust expected output.
1005 * testsuite/plugin_test_2.sh: Likewise.
1006 * testsuite/plugin_test_3.sh: Likewise.
1007 * testsuite/plugin_test_6.sh: Likewise.
1008 * testsuite/plugin_test_tls.sh: Likewise.
1009 * testsuite/plugin_test_11.sh: New testcase.
1010
1011 2015-02-03 Cary Coutant <ccoutant@google.com>
1012
1013 * descriptors.cc (Descriptors::open): Set artificially-low limit for
1014 file descriptors when debugging enabled. Add debug output.
1015 (Descriptors::release): Add debug output.
1016 (Descriptors::close_some_descriptor): Likewise.
1017 (Descriptors::close_all): Likewise.
1018 * fileread.cc (File_read::lock): Likewise.
1019 (File_read::unlock): Likewise.
1020
1021 2015-02-02 Cary Coutant <ccoutant@google.com>
1022
1023 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
1024 executable output file.
1025
1026 2015-01-22 Han Shen <shenhan@google.com>
1027
1028 * arm.cc (Target_arm::Target_arm): Add initialization for new members.
1029 (Target_arm::do_plt_address_for_global): New method.
1030 (Target_arm::do_plt_address_for_local): New method.
1031 (Target_arm::rel_irelative_section): New method.
1032 (Target_arm::make_data_plt): Add more parameters for plt ctor.
1033 (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
1034 (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
1035 (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
1036 (Target_arm::Scan::check_non_pic): Add ifunc support.
1037 (Target_arm::Scan::local): Add ifunc support.
1038 (Target_arm::Scan::global): Add ifunc support.
1039 (Target_arm::make_plt_section): New method.
1040 (Target_arm::make_plt_entry): Change to call to make_plt_section.
1041 (Target_arm::make_local_ifunc_plt_entry): New method.
1042 (Target_arm::got_irelative_): New member.
1043 (Target_arm::rel_irelative_): New member.
1044 (Target_arm::got_section): Add creation for got_irelative_.
1045 (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
1046 (Target_arm::Relocate::relocate): Properly set local ifunc address.
1047 (Target_arm::do_dynsym_value): Properly set global ifunc address.
1048 (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
1049 (Output_data_plt_arm::IRelative_data): New type.
1050 (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
1051 (Output_data_plt_arm::add_entry): Add more parameters.
1052 (Output_data_plt_arm::add_relocation): New method.
1053 (Output_data_plt_arm::add_local_ifunc_entry): New method.
1054 (Output_data_plt_arm::rel_irelative): New method.
1055 (Output_data_plt_arm::entry_count): Modified.
1056 (Output_data_plt_arm::address_for_global): New method.
1057 (Output_data_plt_arm::address_for_local): New method.
1058 gold/
1059 (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
1060 (Output_data_plt_arm::insert_irelative_data): New method.
1061 (Output_data_plt_arm::irelative_rel_): New member.
1062 (Output_data_plt_arm::got_): New member.
1063 (Output_data_plt_arm::got_irelative_): New member.
1064 (Output_data_plt_arm::irelative_count_): New member.
1065 (Output_data_plt_arm::IRelative_data_vec): New typedef.
1066 (Output_data_plt_arm::irelative_data_vec_): New member.
1067 (Output_data_plt_arm::do_write): Write out irelative entries.
1068 (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
1069 more parameters to ctor.
1070 (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
1071 more parameters to ctor.
1072 * output.h (Output_data_reloc::add_local_relative): New method.
1073 * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
1074
1075 2015-01-29 Alan Modra <amodra@gmail.com>
1076
1077 * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
1078 and GOT_TLSGD to LE optimization.
1079
1080 2015-01-28 Cary Coutant <ccoutant@google.com>
1081
1082 * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
1083 for undef TLS symbols.
1084 (Target_x86_64::Relocate::relocate_tls): Likewise.
1085 (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
1086
1087 2015-01-25 Cary Coutant <ccoutant@google.com>
1088
1089 * output.cc (Output_segment::set_section_addresses): Fix calculation
1090 of size of relro segment.
1091
1092 2015-01-22 Alan Modra <amodra@gmail.com>
1093
1094 * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
1095 condition for need of ifunc plt entry.
1096 (Target_powerpc::Scan::global <got relocs>): Likewise.
1097
1098 2015-01-14 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1099
1100 * mips.cc (reloc_high): Add r_sym.
1101 (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
1102 reloc_high constructor.
1103 (Mips_relocate_functions::relgot16_local): Likewise.
1104 (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
1105 r_type to decide whether LO16 matches HI16.
1106 (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
1107 rello16 and relgot16_local.
1108
1109 2015-01-09 Cary Coutant <ccoutant@google.com>
1110
1111 * layout.cc (Layout::set_segment_offsets): Don't align start of segment
1112 unless alignment is larger than page size.
1113
1114 2015-01-06 H.J. Lu <hongjiu.lu@intel.com>
1115 Cary Coutant <ccoutant@google.com>
1116
1117 PR gold/17729
1118 * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
1119 (DEFAULT_TARGET_X32): Set for x32.
1120 * x86_64.cc (cmp_insn_32): New.
1121 (lea_r10_insn_32): Likewise.
1122 (lea_r11_insn_32): Likewise.
1123 (cmp_insn_64): Likewise.
1124 (lea_r10_insn_64): Likewise.
1125 (lea_r11_insn_64): Likewise.
1126 (Target_x86_64<size>::do_calls_non_split): Handle x32.
1127 * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
1128 (check_DATA): Add split_x32 files.
1129 (split_x32_[1234n].o): New targets.
1130 (split_x32_[124]): New targets.
1131 (split_x32_[1234r].stdout): New targets.
1132 * testsuite/split_x32.sh: New file.
1133 * testsuite/split_x32_1.s: Likewise.
1134 * testsuite/split_x32_2.s: Likewise.
1135 * testsuite/split_x32_3.s: Likewise.
1136 * testsuite/split_x32_4.s: Likewise.
1137 * testsuite/split_x32_n.s: Likewise.
1138 * configure: Regenerated.
1139 * testsuite/Makefile.in: Likewise.
1140
1141 2015-01-06 H.J. Lu <hongjiu.lu@intel.com>
1142
1143 PR gold/17809
1144 * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
1145 x32.
1146
1147 2015-01-02 Alan Modra <amodra@gmail.com>
1148
1149 * version.cc (print_version): Just print current year.
1150 * dwp.cc (print_version): Likewise.
1151
1152 2015-01-01 Alan Modra <amodra@gmail.com>
1153
1154 Update year range in copyright notice of all files.
1155
1156 2014-12-25 Alan Modra <amodra@gmail.com>
1157
1158 * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
1159 new enums.
1160 (Target_arm::merge_object_attributes, ): Likewise.
1161
1162 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com>
1163
1164 * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
1165 as hard float only when Tag_ABI_VFP_args is 1, using new enum value
1166 AEABI_VFP_args_vfp to check that.
1167 (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
1168 value and replace hardcoded values by enum values.
1169
1170 2014-12-22 Cary Coutant <ccoutant@google.com>
1171
1172 * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
1173
1174 2014-12-20 H.J. Lu <hongjiu.lu@intel.com>
1175
1176 PR gold/14608
1177 * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
1178 to "return i * i * 3;".
1179
1180 2014-12-16 Cary Coutant <ccoutant@google.com>
1181
1182 * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
1183 (Mapfile::print_output_data): Use current_data_size() to avoid
1184 assert for sections requiring postprocessing; if address is not valid,
1185 print 0.
1186 (Mapfile::print_output_section): Use current_data_size(); print note
1187 that addresses and sizes are before compression.
1188
1189 2014-12-14 H.J. Lu <hongjiu.lu@intel.com>
1190
1191 * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1192 Cast current_group_size to unsigned long when reporting error.
1193
1194 2014-12-10 Jing Yu <jingyu@google.com>
1195
1196 * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
1197 (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
1198 Update error message.
1199 (Target_aarch64::do_relax): Use absolute value of option
1200 stub_group_size. Replace local variable with class member
1201 stub_group_size_.
1202
1203 2014-12-04 Alan Modra <amodra@gmail.com>
1204
1205 * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
1206 addend of PLTREL24 reloc when not generating a plt stub. Make
1207 max_branch_offset an "Address".
1208 (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
1209 (Target_powerpc::Relocate::relocate): Likewise.
1210
1211 2014-12-04 Alan Modra <amodra@gmail.com>
1212
1213 PR 17670
1214 * symtab.cc (Symbol::set_undefined): Remove assertion.
1215 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1216 on symbols defined in discarded sections, instead return false.
1217 Rearrange params, update all callers.
1218 (Target_powerpc::Branch_info::make_stub): Don't make stubs for
1219 branches to syms in discarded sections.
1220 (Global_symbol_visitor_opd::operator()): Set discarded opd syms
1221 undefined and flag as discarded.
1222 (Target_powerpc::Relocate::relocate): Localize variable.
1223
1224 2014-12-03 H.J. Lu <hongjiu.lu@intel.com>
1225
1226 PR gold/17675
1227 * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
1228 * testsuite/Makefile.in: Regenerated.
1229
1230 2014-12-03 Alan Modra <amodra@gmail.com>
1231
1232 PR 17566
1233 * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
1234 when adding dynamic relocations against section symbols.
1235
1236 2014-12-01 Dimitry Ivanov <dimitry@google.com>
1237
1238 * layout.cc (Layout::finish_dynamic_section): When '-z global'
1239 is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
1240 * options.h (General_options): New -z option (global).
1241
1242 2014-12-01 Cary Coutant <ccoutant@google.com>
1243
1244 PR gold/17578
1245 * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
1246 is given.
1247 (Layout::create_executable_stack_info): Warn when -z noexecstack is
1248 given but some inputs require executable stack.
1249
1250 2014-11-26 Cary Coutant <ccoutant@google.com>
1251
1252 * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
1253 .debug_str_offsets; strip .debug_gnu_pubnames and
1254 .debug_gnu_pubtypes.
1255 (lines_only_debug_sections): Strip all four new sections.
1256
1257 2014-11-26 Jing Yu <jingyu@google.com>
1258
1259 * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
1260 register to be x0 when to relax TLSDESC_LD64_LO12.
1261
1262 2014-11-26 Alan Modra <amodra@gmail.com>
1263
1264 * powerpc.cc (struct Stub_table_owner): New.
1265 (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
1266 unsigned int vector. Update all references.
1267 (powerpc_relobj::set_stub_table): Take an unsigned int param
1268 rather than a Stub_table. Update callers.
1269 (Powerpc_relobj::clear_stub_table): New function.
1270 (Target_powerpc): Add relax_failed_, relax_fail_count_ and
1271 stub_group_size_ vars.
1272 (Target_powerpc::new_stub_table): Delete.
1273 (max_branch_delta): New function, extracted from..
1274 (Target_powerpc::Relocate::relocate): ..here..
1275 (Target_powerpc::Branch_info::make_stub): ..and here. Return
1276 status on whether stub created successfully.
1277 (Stub_control::Stub_control): Add "no_size_errors" param. Move
1278 default sizing to..
1279 (Target_powerpc::do_relax): ..here. Init stub_group_size_ and
1280 reduce on relax failure.
1281 (Target_powerpc::group_sections): Add "no_size_errors" param.
1282 Use stub_group_size_. Set up group info in a temp vector,
1283 before building Stub_table vector. Account for input sections
1284 possibly already converted to relaxed sections.
1285 (Stub_table::init): Delete. Merge into..
1286 (Stub_table::Stub_table): ..here.
1287 (Stub_table::can_reach_stub): New function.
1288 (Stub_table::add_plt_call_entry): Add "from" parameter and
1289 return true iff stub could be reached.
1290 (Stub_table::add_long_branch_entry): Similarly. Add "r_type"
1291 param too.
1292 (Stub_table::clear_stubs): Add "all" param.
1293
1294 2014-11-26 Alan Modra <amodra@gmail.com>
1295
1296 * powerpc.cc (Stub_control::set_output_and_owner): New function.
1297 (Target_powerpc::group_sections): Use it.
1298
1299 2014-11-25 Cary Coutant <ccoutant@google.com>
1300
1301 * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
1302 (Binary_to_elf::write_symbol): Add st_size parameter.
1303 * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
1304
1305 2014-11-25 Cary Coutant <ccoutant@google.com>
1306
1307 PR gold/17639
1308 * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
1309 (Sized_relobj_file::do_layout): Handle deferred sections properly
1310 during GC pass 1. Don't add reloc sections to deferred list twice.
1311 * object.h (Sized_relobj_file::is_deferred_layout): New function.
1312 (Sized_relobj_file::is_deferred_layout_): New data member.
1313
1314 2014-11-21 H.J. Lu <hongjiu.lu@intel.com>
1315
1316 PR gold/17619
1317 * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
1318 Check PC-relative offset overflow in PLT entry.
1319
1320 2014-11-21 Alan Modra <amodra@gmail.com>
1321
1322 * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
1323 for undefined weaks.
1324
1325 2014-11-20 Alan Modra <amodra@gmail.com>
1326
1327 * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
1328 from --stub-group-size parameter divided by 1024.
1329 (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
1330 template parameter. Update all uses.
1331 (Target_powerpc::Relocate::relocate): Rename has_plt_value to
1332 has_stub_value. Set for long branches. Don't report overflow for
1333 branch to undefined weak symbols. Print info message on
1334 overflowing branch to stub.
1335
1336 2014-11-20 Alan Modra <amodra@gmail.com>
1337
1338 * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
1339
1340 2014-11-13 H.J. Lu <hongjiu.lu@intel.com>
1341
1342 * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
1343 entry for R_X86_64_GOTPLT64.
1344 (Target_x86_64<size>::Relocate::relocate): Update comments for
1345 R_X86_64_GOTPLT64.
1346
1347 2014-11-06 Evgeniy Dushistov <dushistov@mail.ru>
1348
1349 * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
1350 * plugin.h: add lock definition
1351
1352 2014-10-29 Han Shen <shenhan@google.com>
1353 Jing Yu <jingyu@google.com>
1354
1355 * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
1356 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1357 TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
1358 Symbol::TLS_REF.
1359 * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
1360 method.
1361 (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
1362 (Target_aarch64::tls_ld_to_le): New method.
1363 (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
1364 for 64bit targets.
1365 (Output_data_plt_aarch64::irelative_rel_): New data member.
1366 (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
1367 (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
1368 (Output_data_plt_aarch64::add_relocation): New method.
1369 (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
1370 offset. Add got_irelative size to got size.
1371 (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
1372 type string with the new typename.
1373 (AArch64_relocate_functions::update_adr): Replace parameter x with
1374 immed.
1375 (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
1376 (AArch64_relocate_functions::reloc_common): New method.
1377 (AArch64_relocate_funcsions::rela_general): Extract common part out
1378 into reloc_common method.
1379 (AArch64_relocate_functions::rela_general): Likewise.
1380 (AArch64_relocate_functions::pcrela_general): Likewise.
1381 (AArch64_relocate_functions::adr): New method.
1382 (AArch64_relocate_functions::adrp): Calculate immed before calling
1383 update_adr.
1384 (AArch64_relocate_functions::adrp): Likewise.
1385 (AArch64_relocate_functions::movnz): Cast x to SignedW type when
1386 comparing x to 0. Calculate immed from ~x when x < 0.
1387 (Target_aarch64::optimize_tls_reloc): Add new cases for
1388 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1389 TLSLD_MOVW_DTPREL_G0_NC.
1390 (Target_aarch64::possible_function_pointer_reloc): Implement this
1391 method.
1392 (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
1393 comment.
1394 (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
1395 symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1396 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1397 (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
1398 symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1399 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1400 (Target_aarch64::make_plt_entry): Call add_entry with two more
1401 parameters.
1402 (Target_aarch64::make_local_ifunc_plt_entry): New method.
1403 (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
1404 ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1405 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1406 (Target_aarch64::Relocate::relocate_tls): Add cases for
1407 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1408 TLSLD_MOVW_DTPREL_G0_NC.
1409 * testsuite/icf_safe_so_test.cc: Correct test comment.
1410 * testsuite/icf_safe_test.sh: Add AArch64 arch.
1411
1412 2014-10-22 Alan Modra <amodra@gmail.com>
1413
1414 * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
1415 thread_starter.
1416
1417 2014-10-18 Andreas Schwab <schwab@linux-m68k.org>
1418
1419 * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
1420
1421 2014-10-17 Cary Coutant <ccoutant@google.com>
1422
1423 * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1424 Add "typename" keyword.
1425
1426 2014-10-15 Han Shen <shenhan@google.com>
1427 Jing Yu <jingyu@google.com>
1428
1429 Patch for gold aarch64 backend to support relaxation.
1430 * aarch64-reloc.def: Change format.
1431 * aarch64.cc (class Reloc_stub): New class.
1432 (class Stub_table): New class.
1433 (class AArch64_relobj): New class.
1434 (class AArch64_input_section): New class.
1435 (class AArch64_output_section): New class.
1436 (Target_aarch64::new_stub_table): New method.
1437 (Target_aarch64::new_aarch64_input_section): New method.
1438 (Target_aarch64::find_aarch64_input_section): New method.
1439 (Target_aarch64::scan_section_for_stubs): New method.
1440 (Target_aarch64::scan_reloc_section_for_stubs): New method.
1441 (Target_aarch64::relocate_stub): New method.
1442 (Target_aarch64::current_target): New method.
1443 (Target_aarch64::do_make_elf_object): New method.
1444 (Target_aarch64::do_may_relax): New method.
1445 (Target_aarch64::do_relax): New method.
1446 (Target_aarch64::group_sections): New method.
1447 (Target_aarch64::scan_reloc_for_stub): New method.
1448 (Target_aarch64::do_make_output_section): New method.
1449 (Target_aarch64::stub_tables_): New data member.
1450 (Target_aarch64::aarch64_input_section_map_): New data member.
1451 (AArch64_relocate_functions::maybe_apply_stub): New method.
1452
1453 2014-09-30 Cary Coutant <ccoutant@google.com>
1454
1455 PR gold/17432
1456 * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
1457
1458 2014-09-30 Kito Cheng <kito@0xlab.org>
1459
1460 PR gold/13597
1461 * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
1462 hash table before sysv-style hash table.
1463
1464 2014-09-29 Sriraman Tallam <tmsriram@google.com>
1465
1466 * options.h (--pic-executable): Add negative to alias to -no-pie.
1467
1468 2014-09-26 Cary Coutant <ccoutant@google.com>
1469
1470 PR gold/16773
1471 * object.cc (Sized_relobj_file): Compute value of section symbols
1472 for TLS sections the same as TLS symbols.
1473
1474 2014-09-25 Cary Coutant <ccoutant@google.com>
1475
1476 PR gold/17432
1477 * resolve.cc (Symbol_table::resolve): Override common placeholder
1478 symbols, but adjust sizes.
1479 * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
1480 symbols to common lists.
1481
1482 2014-09-24 Alan Modra <amodra@gmail.com>
1483
1484 * po/POTFILES.in: Regenerate.
1485
1486 2014-09-23 Taiju Tsuiki <tzik@google.com>
1487 Cary Coutant <ccoutant@google.com>
1488
1489 PR gold/14860
1490 * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
1491 on input_sections_blocker.
1492 * layout.cc (Write_sections_task::locks): Unblock
1493 input_sections_blocker_.
1494 * layout.h (Write_sections_task::Write_sections_task): Add
1495 input_sections_blocker.
1496 * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
1497 to DEPENDENCIES.
1498 * testsuite/Makefile.in: Regenerate.
1499
1500 2014-09-18 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1501
1502 * testsuite/Makefile.am (plugin_test_10): New test.
1503 * testsuite/Makefile.in: Regenerate
1504 * testsuite/plugin_common_test_2.c (c1): Align to 8.
1505 * testsuite/plugin_test_10.sh: New file.
1506
1507 2014-09-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1508
1509 * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
1510 * resolve.cc (Symbol_table::resolve): Don't override common symbols
1511 during the replacement phase.
1512
1513 2014-09-17 Han Shen <shenhan@google.com>
1514 Jing Yu <jingyu@google.com>
1515
1516 * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
1517 TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
1518 * aarch64.cc (Target_aarch64): Add data members
1519 got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
1520 tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
1521 constructor.
1522 (Target_aarch64::do_reloc_symbol_index): New method.
1523 (Target_aarch64::do_reloc_addend): New method.
1524 (Target_aarch64::add_tlsdesc_info): New method.
1525 (Target_aarch64::do_dynsym_value): New method.
1526 (Target_aarch64::do_make_data_plt): Add new parameters: got,
1527 got_irelative. Pass them to Output_data_plt_aarch64_standard.
1528 (Target_aarch64::make_data_plt): Add new parameters: got,
1529 got_irelative. Pass them to do_make_data_plt.
1530 (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
1531 (Target_aarch64::Relocate:tls_gd_to_le): New method.
1532 (Target_aarch64::Relocate:tls_ie_to_le): New method.
1533 (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
1534 (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
1535 (Target_aarch64::got_tlsdesc_section): New method.
1536 (Target_aarch64::make_local_ifunc_plt_entry): New method.
1537 (Target_aarch64::define_tls_base_symbol): New method.
1538 (Target_aarch64::reserve_tlsdesc_entries): New method.
1539 (Target_aarch64::got_mod_index_entry): New method.
1540 (Target_aarch64::rela_tlsdesc_section): New method.
1541 (Target_aarch64::rela_irelative_section): New method.
1542 (Target_aarch64::Tlsdesc_info): New struct.
1543 (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
1544 relocations and tlsdesc relocations.
1545 (Target_aarch64::optimize_tls_reloc): Implement method.
1546 (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
1547 got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
1548 in constructor.
1549 (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
1550 (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
1551 (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
1552 (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
1553 (Output_data_plt_aarch64::rela_tlsdesc): New method.
1554 (Output_data_plt_aarch64::rela_irelative): New method.
1555 (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
1556 (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
1557 (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
1558 (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
1559 (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
1560 (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
1561 (Output_data_plt_aarch64_standard): New member variables:
1562 plt_tlsdesc_entry_size, tlsdesc_plt_entry.
1563 (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
1564 New parameter: got, got_irelative.
1565 (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
1566 (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
1567 (Output_data_plt_aarch64::do_write): Replace got_address with
1568 gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
1569 (AArch64_relocate_functions::update_movnz): New method.
1570 (AArch64_relocate_functions): Correct format.
1571 (AArch64_relocate_functions::movnz): New method.
1572 (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
1573 before the switch. Add new cases to switch.
1574 Check ie_to_le relaxation on tlsie relocations. Add code handling
1575 tlsgd tlsdesc cases.
1576 (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
1577 needed. Add new cases to switch. Insert dynamic RELATIVE relocation
1578 when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
1579 Call reloc_name_in_error_message to print unsupported reloc.
1580 (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
1581 make_data_plt.
1582 (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
1583 relocs. Fill in some more dynamic tags.
1584 (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
1585 Skip call tls_get_addr when tlsgd is relaxed.
1586 (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
1587 handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
1588 tlsdesc->ie relaxation.
1589
1590 2014-09-03 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1591
1592 * mips.cc (Target_mips_nacl): New class.
1593 (Target_selector_mips_nacl): New class.
1594 (target_selector_mips32): Rename from target_selector_mips32be and use
1595 Target_selector_mips_nacl instead of Target_selector_mips.
1596 (target_selector_mips32el): Rename from target_selector_mips32 and use
1597 Target_selector_mips_nacl instead of Target_selector_mips.
1598 (target_selector_mips64): Rename from target_selector_mips64be and use
1599 Target_selector_mips_nacl instead of Target_selector_mips.
1600 (target_selector_mips64el): Rename from target_selector_mips64 and use
1601 Target_selector_mips_nacl instead of Target_selector_mips.
1602 (Target_mips::mips_info): Add const attribute.
1603
1604 2014-09-02 Cary Coutant <ccoutant@google.com>
1605
1606 * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
1607 * dynobj.h (Sized_dynobj::do_section_name): Likewise.
1608 * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
1609 (Sized_incr_dynobj::do_section_name): Likewise.
1610 * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
1611 (Sized_incr_dynobj::do_section_name): Likewise.
1612 * object.h (Object::section_name): Likewise.
1613 (Object::do_section_name): Likewise.
1614 (Sized_relobj_file::do_section_name): Likewise.
1615 * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
1616 * plugin.h (Sized_pluginobj::do_section_name): Likewise.
1617
1618 2014-09-02 Cary Coutant <ccoutant@google.com>
1619
1620 PR gold/17005
1621 * ehframe.cc (Fde::write): Add output_offset parameter.
1622 (Cie::write): Likewise.
1623 (Eh_frame::set_final_data_size): Account for offset within output
1624 section.
1625 (Eh_frame::do_sized_write): Likewise.
1626 * ehframe.h (Fde::write): Add output_offset parameter.
1627 (Cie::write): Likewise.
1628 * output.cc (Output_section::Input_section_sort_entry): Remove
1629 section_has_name_; add output_section_name parameter. Use
1630 output section name for non-input sections.
1631 (Output_section::Input_section_sort_entry::section_has_name): Remove.
1632 (Output_section::Input_section_sort_entry::section_has_name_): Remove.
1633 (Output_section::Input_section_sort_compare): Remove logic for
1634 sections without names.
1635 (Output_section::Input_section_sort_init_fini_compare): Likewise.
1636 (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
1637 Likewise.
1638 (Output_section::Input_section_sort_section_name_compare): Likewise.
1639
1640 2014-08-29 Han Shen <shenhan@google.com>
1641 Jing Yu <jingyu@google.com>
1642
1643 * aarch64-reloc-property.cc
1644 (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
1645 reference reloc property in the table.
1646 * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
1647 3 other entries.
1648 * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
1649 2 new overloaded methods.
1650 (Output_data_got_aarch64::do_write): Add code to write out
1651 static relocs.
1652 (class Output_data_got_aarch64::Static_reloc): New class to wrap
1653 static relocs.
1654 (Output_data_got_aarch64::static_relocs): New vector to
1655 hold static relocs.
1656 (Target_aarch64::TCB_SIZE): New const static memeber.
1657 (Target_aarch64::tcb_size): New method.
1658 (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
1659 (Target_aarch64::Relocate::relocate_tls): New method.
1660 (Target_aarch64::Scan::local): Add code handling new reloc types.
1661 (Target_aarch64::Scan::global): Add code handling new reloc types.
1662
1663 2014-08-13 Sriraman Tallam <tmsriram@google.com>
1664
1665 * options.h (-no-pie): Add option.
1666
1667 2014-08-08 Jing Yu <jingyu@google.com>
1668 Han Shen <shenhan@google.com>
1669
1670 * Makefile.am (HFILES): Add aarch64-reloc-property.h.
1671 (DEFFILES): add aarch64-reloc.def.
1672 (TARGETSOURCES): Add aarch64-reloc-property.cc.
1673 (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
1674 * Makefile.in: Regenerate.
1675 * aarch64-reloc-property.cc: New file.
1676 * aarch64-reloc-property.h: New file.
1677 * aarch64-reloc.def: New file.
1678 * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
1679 with tab to make the format consistent.
1680 (Output_data_got_aarch64::symbol_table_): New method.
1681 (Target_aarch64::do_plt_address_for_global): New method.
1682 (Target_aarch64::do_plt_address_for_local): New method.
1683 (Target_aarch64::do_select_as_default_target): New method.
1684 (Target_aarch64::do_make_data_plt): New method.
1685 (Target_aarch64::make_data_plt): New method.
1686 (Output_data_plt_aarch64::has_irelative_section): New method.
1687 (Output_data_plt_aarch64::address_for_global): New method.
1688 (Output_data_plt_aarch64::address_for_local): New method.
1689 (Output_data_plt_aarch64::irelative_rel_): New parameter.
1690 (Output_data_plt_aarch64::add_entry): Implement contents.
1691 (Output_data_plt_aarch64::set_final_data_size): Fix typo.
1692 (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
1693 the got_pov entry to plt0.
1694 (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
1695 Implement contents.
1696 (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
1697 (AArch64_howto): New struct.
1698 (aarch64_howto[]): New static const array.
1699 (AArch64_relocate_functions): New class.
1700 (Target_aarch64::Scan::get_reference_flags): Remove method.
1701 (Target_aarch64::Scan::local): Implement to support a few relocations.
1702 (Target_aarch64::Scan::global): Implement to support a few relocations.
1703 (Target_aarch64::make_plt_section): Implement contents.
1704 (Target_aarch64::make_plt_entry): Implement contents.
1705 (Target_aarch64::do_finalize_sections): Implement contents.
1706 (Target_aarch64::Relocate::relocate): Implement a few relocations.
1707 (Target_aarch64::relocate_section): Implement contents.
1708
1709 2014-08-06 Alan Modra <amodra@gmail.com>
1710
1711 * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
1712
1713 2014-08-06 Alan Modra <amodra@gmail.com>
1714
1715 PR 13227
1716 * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
1717
1718 2014-07-21 Sriraman Tallam <tmsriram@google.com>
1719
1720 * object.cc (Relobj::is_section_name_included): Add
1721 ".rodata.nptl_version" to not garbage collect this section.
1722
1723 2014-07-08 Cary Coutant <ccoutant@google.com>
1724
1725 * expression.cc (struct Expression::Expression_eval_info): Add
1726 new fields type_pointer, vis_pointer, and nonvis_pointer.
1727 (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
1728 nonvis_pointer parameters. Adjust all calls.
1729 (Symbol_expression::value): Update type, visibility, and nonvis bits
1730 in caller.
1731 * script.cc (Symbol_assignment::sized_finalize): Update type,
1732 visibility, and remaining st_other bits for new symbol.
1733 * script.h: (Expression::eval_maybe_dot): Add type_pointer,
1734 vis_pointer, and nonvis_pointer parameters.
1735 * symtab.h (Symbol::set_type): New method.
1736
1737 * testsuite/Makefile.am (defsym_test): New test.
1738 * testsuite/Makefile.in: Regenerate.
1739 * testsuite/defsym_test.c: New file.
1740 * testsuite/defsym_test.sh: New file.
1741
1742 2014-07-08 Cary Coutant <ccoutant@google.com>
1743
1744 PR gold/15639
1745 * dynobj.h (Sized_dynobj::base_read_symbols): New method.
1746 * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
1747 (Sized_dynobj::base_read_symbols): ...new method.
1748 * object.h (Sized_relobj_file::base_read_symbols): New method.
1749 * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
1750 (Sized_relobj_file::base_read_symbols): ...new method.
1751 * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
1752 * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
1753 * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
1754
1755 2014-07-04 Alan Modra <amodra@gmail.com>
1756
1757 * po/POTFILES.in: Regenerate.
1758
1759 2014-07-02 Jing Yu <jingyu@google.com>
1760
1761 * aarch64.cc: New file
1762 * Makefile.am (TARGETSOURCES): Add aarch64.cc
1763 (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
1764 * Makefile.in: Regenerate.
1765 * configure.tgt: Add entries for aarch64*.
1766 * configure.ac: Likewise.
1767 * configure: Likewise.
1768
1769 2014-06-27 Alan Modra <amodra@gmail.com>
1770
1771 * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
1772
1773 2014-06-24 Cary Coutant <ccoutant@google.com>
1774
1775 * dwp.cc (Dwo_file::read): Allow files with no .debug_types
1776 sections.
1777 (Dwo_file::sized_read_unit_index): Likewise.
1778
1779 2014-06-23 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1780
1781 * mips.cc: New file.
1782 * Makefile.am (TARGETSOURCES): Add mips.cc
1783 (ALL_TARGETOBJS): Add mips.$(OBJEXT)
1784 * configure.tgt: Add entries for mips*.
1785 * configure.ac: Likewise.
1786 * Makefile.in: Regenerate.
1787 * configure: Likewise.
1788
1789 2014-06-09 Cary Coutant <ccoutant@google.com>
1790
1791 * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
1792 unit_length is within section bounds.
1793
1794 2014-06-09 Cary Coutant <ccoutant@google.com>
1795
1796 PR gold/16980
1797 * layout.cc (Layout::print_to_mapfile): Print unattached sections in
1798 map.
1799
1800 2014-06-07 Alan Modra <amodra@gmail.com>
1801
1802 * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
1803
1804 2014-06-06 Cary Coutant <ccoutant@google.com>
1805
1806 * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
1807 * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
1808 (Dwarf_pubnames_table::read_header): Likewise.
1809 * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
1810 .debug_gnu_pubtypes.
1811
1812 2014-06-05 Joel Brobecker <brobecker@adacore.com>
1813
1814 * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
1815 * Makefile.in, configure: Regenerate.
1816
1817 2014-06-03 Alan Modra <amodra@gmail.com>
1818
1819 * powerpc.cc (addis_12_2): Define.
1820 (Stub_table::do_write): Support fusion on ELFv2 stubs.
1821
1822 2014-06-03 Alan Modra <amodra@gmail.com>
1823
1824 * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
1825 st_other output.
1826
1827 2014-06-02 Alan Modra <amodra@gmail.com>
1828
1829 * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
1830 Only ignore relocs on ELFv1.
1831 (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
1832
1833 2014-05-30 Cary Coutant <ccoutant@google.com>
1834
1835 * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
1836 * testsuite/Makefile.in: Regenerate.
1837 * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
1838
1839 2014-05-27 H.J. Lu <hongjiu.lu@intel.com>
1840
1841 PR gold/16945
1842 * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
1843 for got_offset. Properly get GOT address for R_X86_64_PLTOFF64.
1844
1845 2014-05-15 Alan Modra <amodra@gmail.com>
1846
1847 * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
1848 Compare FDE contents with DW_CFA_nop rather than 0.
1849
1850 2014-05-13 Sriraman Tallam <tmsriram@google.com>
1851
1852 * symtab.h (may_need_copy_reloc): Remove check for position independent
1853 code.
1854 * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
1855 position independence before pc absolute may_need_copy_reloc call.
1856 Add check for executable output befor pc relative may_need_copy_reloc
1857 call.
1858 * i386.cc: Ditto.
1859 * arm.cc: Ditto.
1860 * sparc.cc: Ditto.
1861 * tilegx.cc: Ditto.
1862 * powerpc.cc: Add check for no position independence before
1863 may_need_copy_reloc calls.
1864 * testsuite/pie_copyrelocs_test.cc: New file.
1865 * testsuite/pie_copyrelocs_shared_test.cc: New file.
1866 * Makefile.am (pie_copyrelocs_test): New test.
1867 * Makefile.in: Regenerate.
1868
1869 2014-05-08 Martin Liška <mliska@suse.cz>
1870
1871 * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
1872
1873 2014-05-06 Cary Coutant <ccoutant@google.com>
1874
1875 PR gold/16900
1876 * i386.cc (Output_data_got_plt_i386): New class.
1877 (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
1878 parameter. Change all callers.
1879 (Output_data_plt_i386::layout_): Remove.
1880 (Output_data_plt_i386::got_plt_): Change type.
1881 (Target_i386::got_plt_): Change type. Change all references.
1882 (Target_i386::got_section): Create instance of new class.
1883 (Output_data_got_plt_i386::do_write): New function.
1884 * x86_64.cc (Output_data_got_plt_x86_64): New class.
1885 (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
1886 parameter. Change all callers.
1887 (Output_data_plt_x86_64::layout_): Remove.
1888 (Output_data_plt_x86_64::got_plt_): Change type.
1889 (Target_x86_64::got_plt_): Change type. Change all references.
1890 (Target_x86_64::got_section): Create instance of new class.
1891 (Output_data_got_plt_x86_64::do_write): New function.
1892 (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
1893 (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
1894 class.
1895
1896 2014-05-05 Cary Coutant <ccoutant@google.com>
1897
1898 * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
1899 if we have pubnames/pubtypes.
1900
1901 2014-05-02 Cary Coutant <ccoutant@google.com>
1902
1903 * defstd.cc (in_segment): Define __ehdr_start here...
1904 * layout.cc (Layout::finalize): ...Instead of here. Set the
1905 output segment when known.
1906 * resolve.cc (Symbol::override_base_with_special): Remember
1907 the original binding.
1908 * symtab.cc (Symbol::set_output_segment): New function.
1909 (Symbol::set_undefined): New function.
1910 * symtab.h (Symbol::is_weak_undefined): Check original undef
1911 binding.
1912 (Symbol::is_strong_undefined): New function.
1913 (Symbol::set_output_segment): New function.
1914 (Symbol::set_undefined): New function.
1915 * target-reloc.h (is_strong_undefined): Remove.
1916 (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
1917 Check for hidden undefs.
1918 (relocate_section): Call Symbol::is_strong_undefined.
1919
1920 * testsuite/Makefile.am (ehdr_start_test_1)
1921 (ehdr_start_test_2, ehdr_start_test_3)
1922 (ehdr_start_test_4, ehdr_start_test_5): New test cases.
1923 * testsuite/Makefile.in: Regenerate.
1924 * testsuite/ehdr_start_def.cc: New source file.
1925 * testsuite/ehdr_start_test.cc: New source file.
1926 * testsuite/ehdr_start_test.t: New linker script.
1927 * testsuite/ehdr_start_test_4.sh: New shell script.
1928
1929 2014-04-23 Cary Coutant <ccoutant@google.com>
1930
1931 PR gold/16870
1932 * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
1933
1934 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1935
1936 * layout.cc (Layout::include_section): Allow a target to decide
1937 whether to include a section.
1938 * target.h (Target::should_include_section): New function.
1939 (Target::do_should_include_section): New function.
1940
1941 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1942
1943 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
1944 inline into ...
1945 (Copy_relocs::emit): ... here.
1946 * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
1947 (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
1948 (Copy_reloc_entry::entries_): Change from private to protected.
1949
1950 2014-04-02 Sriraman Tallam <tmsriram@google.com>
1951
1952 * icf.cc (get_section_contents): Replace copies of reloc
1953 vectors with const references.
1954
1955 2014-04-02 Cary Coutant <ccoutant@google.com>
1956
1957 * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
1958 (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
1959 * configure: Regenerate.
1960 * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
1961 -fno-use-linker-plugin.
1962 (LINK1, CXXLINK1): Add it to the link command.
1963 * testsuite/Makefile.in: Regenerate.
1964
1965 2014-03-12 Alan Modra <amodra@gmail.com>
1966
1967 * Makefile.in: Regenerate.
1968
1969 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1970
1971 * symtab.h (Symbol::set_nonvis): New function.
1972
1973 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1974
1975 * symtab.cc (Sized_symbol<32>::init_output_data):
1976 Instantiate the template.
1977 (Sized_symbol<64>::init_output_data): Likewise.
1978
1979 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1980
1981 * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
1982 adjust dynamic symbol value.
1983 * target.h (Target::adjust_dyn_symbol): New function.
1984 (Target::do_adjust_dyn_symbol): New function.
1985
1986 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1987
1988 * output.cc (Output_data_dynamic::Dynamic_entry::write):
1989 Get the value of DYNAMIC_CUSTOM dynamic entry.
1990 * output.h (Output_data_dynamic::add_custom): New function.
1991 (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
1992 dynamic entry.
1993 (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
1994 * target.h (Target::dynamic_tag_custom_value): New function.
1995 (Target::do_dynamic_tag_custom_value): New function.
1996
1997 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1998
1999 * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
2000 dynsym indexes.
2001 * target.h (Target::has_custom_set_dynsym_indexes): New function.
2002 (Target::do_has_custom_set_dynsym_indexes): New function.
2003 (Target::set_dynsym_indexes): New function.
2004 (Target::do_set_dynsym_indexes): New function.
2005
2006 2014-03-07 Alan Modra <amodra@gmail.com>
2007
2008 * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
2009 CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
2010 (Powerpc_relocate_functions::has_overflow_unsigned): New function.
2011 (Powerpc_relocate_functions::has_overflow_bitfield,
2012 overflowed): Use the above.
2013 (Target_powerpc::Relocate::relocate): Correct overflow checking
2014 for a number of relocations. Modify overflow test for 16-bit
2015 fields in instructions to signed/unsigned according to whether
2016 the field takes a signed or unsigned value.
2017
2018 2014-03-05 Alan Modra <amodra@gmail.com>
2019
2020 Update copyright years.
2021
2022 2014-03-05 Alan Modra <amodra@gmail.com>
2023
2024 * powerpc.cc (Target_powerpc::Scan::local, global): Support
2025 R_PPC64_ADDR64_LOCAL.
2026 (Target_powerpc::Relocate::relocate): Likewise.
2027
2028 2014-03-03 Alan Modra <amodra@gmail.com>
2029
2030 * dwp.cc (print_version): Update copyright year to current.
2031
2032 2014-02-10 Alan Modra <amodra@gmail.com>
2033
2034 * po/gold.pot: Regenerate.
2035
2036 2014-02-06 Cary Coutant <ccoutant@google.com>
2037
2038 Fix problem where -u is ignored when a weak undef is seen.
2039
2040 * archive.cc (Library_base::should_include_member): Reorder
2041 code to check for -u option if a weak undef has already been seen.
2042 * testsuite/Makefile.am (weak_undef_test_2): New test case.
2043 * testsuite/Makefile.in: Regenerate.
2044 * testsuite/weak_undef_file3.cc: New file.
2045 * testsuite/weak_undef_file4.cc: New file.
2046 * testsuite/weak_undef_test_2.cc: New file.
2047
2048 2014-02-05 Cary Coutant <ccoutant@google.com>
2049
2050 Fix issues with gold undefined symbol diagnostics.
2051
2052 PR binutils/15435
2053 * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
2054 check to here.
2055 * target-reloc.h (is_strong_undefined): New function.
2056 (relocate_section): Move undef vtable symbol check from here.
2057 Check for is_strong_undefined.
2058
2059 2014-02-05 Cary Coutant <ccoutant@google.com>
2060
2061 Fix problems with the --dynamic-list option.
2062
2063 PR gold/13577
2064 * options.cc (General_options::parse_dynamic_list):
2065 Set have_dynamic_list_.
2066 (General_options::General_options): Initialize have_dynamic_list_.
2067 (General_options::finalize): Turn off -Bsymbolic and
2068 -Bsymbolic-functions if --dynamic-list provided.
2069 * options.h (General_options::have_dynamic_list): New function.
2070 (General_options::have_dynamic_list_): New data member.
2071 * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
2072 correctly.
2073
2074 PR gold/16530
2075 * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
2076 in --dynamic-list, mark it.
2077
2078 * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
2079 (dynamic_list_2): New test case.
2080 * testsuite/Makefile.in: Regenerate.
2081 * testsuite/dynamic_list_2.cc: New file.
2082 * testsuite/dynamic_list_2.t: New file.
2083 * testsuite/dynamic_list_lib1.cc: New file.
2084 * testsuite/dynamic_list_lib2.cc: New file.
2085 * testsuite/gc_dynamic_list_test.c: New file.
2086 * testsuite/gc_dynamic_list_test.sh: New file.
2087 * testsuite/gc_dynamic_list_test.t: New file.
2088
2089 2014-01-28 Cary Coutant <ccoutant@google.com>
2090
2091 Add .gdb_index version 7 support.
2092
2093 * gold/dwarf_reader.cc: include <utility> (for make_pair).
2094 (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
2095 debug sections.
2096 (Dwarf_ranges_table::read_ranges_table): Likewise.
2097 (Dwarf_pubnames_table::read_section): Check for GNU-style
2098 sections, and for compressed debug sections.
2099 (Dwarf_pubnames_table::read_header): Compute end address of table.
2100 (Dwarf_pubnames_table::next_name): Return flag_byte. Check
2101 for end of list by offset, not by offset == 0.
2102 (Dwarf_info_reader::do_read_string_table): Check for compressed
2103 debug sections.
2104 * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2105 Initialize new data members.
2106 (Dwarf_pubnames_table::next_name): return flag_byte.
2107 (Dwarf_pubnames_table::end_of_table_): New data member.
2108 (Dwarf_pubnames_table::is_gnu_style_): New data member.
2109 * gold/gdb-index.cc (gdb_index_version): Update to version 7.
2110 (Gdb_index_info_reader::read_pubtable): Read flag_byte.
2111 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
2112 read skeleton type unit DIEs.
2113 (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
2114 (Gdb_index::do_write): Write flag_byte.
2115 * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
2116 (Gdb_index::Cu_vector): Store flags along with cu indexes.
2117 * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
2118 * gold/testsuite/gdb_index_test_comm.sh: Likewise.
2119
2120 2014-01-08 H.J. Lu <hongjiu.lu@intel.com>
2121
2122 * version.cc (print_version): Update copyright year to 2014.
2123
2124 2013-12-19 Dimitry Andric <dimitry@andric.com>
2125
2126 * stringpool.cc (Stringpool_template::reserve): Add
2127 HAVE_UNORDERED_MAP case.
2128 * stringpool.cc (Stringpool_template::print_stats): Likewise.
2129
2130 2013-12-18 Cary Coutant <ccoutant@google.com>
2131
2132 * configure.ac: Check for <unordered_set> and <unordered_map>.
2133 * config.in: Regenerate.
2134 * configure: Regenerate.
2135 * system.h: Use <unordered_set> and <unordered_map> if available.
2136
2137 2013-12-10 Roland McGrath <mcgrathr@google.com>
2138
2139 * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
2140 with $(INSTALL_PROGRAM_ENV).
2141 * Makefile.in: Regenerate.
2142
2143 2013-11-22 Cary Coutant <ccoutant@google.com>
2144
2145 * configure.ac: Add check for which library is needed for
2146 dlopen.
2147 * configure: Regenerate.
2148
2149 2013-11-22 Cary Coutant <ccoutant@google.com>
2150
2151 * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
2152 assembler.
2153 * testsuite/Makefile.in: Regenerate.
2154
2155 2013-11-17 H.J. Lu <hongjiu.lu@intel.com>
2156
2157 * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
2158 Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
2159 R_X86_64_PC32 and R_X86_64_PLT32, respectively.
2160 (Target_x86_64<size>::Scan::local): Likewise.
2161 (Target_x86_64<size>::Scan::global): Likewise.
2162 (Target_x86_64<size>::Relocate::relocate): Likewise.
2163 (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
2164 Likewise.
2165 (Target_x86_64<size>::Scan::check_non_pic(): Handle
2166 R_X86_64_PC32_BND.
2167
2168 * testsuite/Makefile.am (check_PROGRAMS): Add
2169 exception_x86_64_bnd_test.
2170 (exception_x86_64_bnd_test_SOURCES): New macro.
2171 (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
2172 (exception_x86_64_bnd_test_LDFLAGS): Likewise.
2173 (exception_x86_64_bnd_test_LDADD): Likewise.
2174 (exception_x86_64_bnd_1.o): New rule.
2175 (exception_x86_64_bnd_2.o): Likewise.
2176 * testsuite/Makefile.in: Regenerated.
2177
2178 2013-11-15 Alan Modra <amodra@gmail.com>
2179
2180 * powerpc.cc (Target_powerpc::glink_section): Provide non-const
2181 accessor.
2182 (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
2183 Only call ppc64_local_entry_offset for 64-bit. Restrict
2184 symval_for_branch lookup to ELFv1.
2185 (Stub_table::add_plt_call_entry): Use unsigned int off.
2186 (Output_data_glink::Address, invalid_address): New.
2187 (Output_data_glink::add_eh_frame): Move out of line. Add
2188 support for ELFv2.
2189 (Output_data_glink::add_global_entry, find_global_entry,
2190 global_entry_address): New functions.
2191 (Output_data_glink::global_entry_stubs_, end_branch_table_,
2192 ge_size): New variables.
2193 (Output_data_glink::set_final_data_size): Add global entry
2194 stub sizing.
2195 (Output_data_glink::do_write): Write global entry stubs.
2196 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
2197 parameter. Return true for ELFv2. Adjust callers.
2198 (Target_powerpc::Scan::local, global): Restrict opd lookup to
2199 ELFv1. Similarly for ifunc and dynamic relocation processing
2200 specific to ELFv1. Recognize that symbols are defined on
2201 their plt entries for ELFv2.
2202 (Target_powerpc::symval_for_branch): Assert if called for
2203 ELFv2 or ppc32.
2204 (Target_powerpc::Relocate::relocate): Use global entry plt
2205 stub for symbol value if such exists on ELFv2.
2206 (Target_powerpc::Relocate::relocate): Don't call
2207 symval_for_branch when ELFv2. Do adjust for local entry
2208 offset when ELFv2.
2209 (Target_powerpc::do_dynsym_value): Set symbols to global entry
2210 plt stub for ELFv2.
2211 (Target_powerpc::do_plt_address_for_global): Similarly.
2212
2213 2013-11-14 Cary Coutant <ccoutant@google.com>
2214
2215 Revert patch -- this did not fix the problem, and there is
2216 no race there.
2217
2218 2013-11-14 Cary Coutant <ccoutant@google.com>
2219
2220 PR gold/14860
2221 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2222 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2223 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2224 updating fde_offsets_.
2225 (Eh_frame_hdr::lock_): New data member.
2226
2227 2013-11-14 Cary Coutant <ccoutant@google.com>
2228
2229 * dwp.cc (Dwo_file_entry): New type.
2230 (File_list): Use Dwo_file_entry.
2231 (Dwo_file::verify): New function.
2232 (Dwo_file::verify_dwo_list): New function.
2233 (Dwo_file::sized_verify_dwo_list): New function.
2234 (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
2235 list.
2236 (Dwp_options): New enum type.
2237 (dwp_options): Add --verify-only.
2238 (usage): Likewise.
2239 (main): Likewise.
2240 * dwp.h (gold_info): Add declaration.
2241
2242 2013-11-14 Cary Coutant <ccoutant@google.com>
2243
2244 PR gold/14860
2245 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2246 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2247 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2248 updating fde_offsets_.
2249 (Eh_frame_hdr::lock_): New data member.
2250
2251 2013-11-06 Cary Coutant <ccoutant@google.com>
2252
2253 PR gold/15758
2254 * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
2255 before reloc sections.
2256
2257 2013-11-04 Alan Modra <amodra@gmail.com>
2258
2259 * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
2260 (Symbol::needs_dynamic_reloc): Test new flag.
2261 * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
2262 (Target_powerpc::Scan::get_reference_flags): Add target param.
2263 Return FUNC_DESC_ABI for 64-bit ELFv1.
2264 (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
2265 call.
2266 (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
2267 (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
2268
2269 2013-10-31 Cary Coutant <ccoutant@google.com>
2270
2271 Restore support for dwp v2 DWARF package file format.
2272
2273 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2274 tu_length parameter. Adjust all callers.
2275 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2276 * dwp.cc: Include dwarf.h.
2277 (Section_bounds): New struct type.
2278 (Unit_set): New struct type.
2279 (Dwo_file::Dwo_file): Initialize new data member.
2280 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2281 Combine and rename to...
2282 (Dwo_file::read_unit_index): ...this.
2283 (Dwo_file::sized_read_compunit_index)
2284 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2285 (Dwo_file::sized_read_unit_index): ...this.
2286 (Dwo_file::copy_section): Remove section_name, is_str_offsets
2287 parameters; add section_id parameter.
2288 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2289 (Dwo_file::add_unit_set): ...this.
2290 (Dwo_file::shndx_map_): Remove.
2291 (Dwo_file::sect_offsets_): New data member.
2292 (Dwp_output_file::Dwp_output_file): Initialize new data members.
2293 (Dwp_output_file::add_section): Rename to...
2294 (Dwp_output_file::add_contribution): ...this.
2295 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2296 (Dwp_output_file::add_tu_set): Likewise.
2297 (Dwp_output_file::Contribution): New type.
2298 (Dwp_output_file::Section::contributions): New data member.
2299 (Dwp_output_file::Cu_or_tu_set): Remove.
2300 (Dwp_output_file::Section::Section): New ctor.
2301 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2302 (Dwp_output_file::Dwp_index::Section_table): New type.
2303 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2304 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2305 parameter.
2306 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2307 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2308 (Dwp_output_file::Dwp_index::section_table): New member function.
2309 (Dwp_output_file::Dwp_index::section_table_end): New member function.
2310 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2311 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2312 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2313 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2314 (Dwp_output_file::Dwp_index::section_table_): New data member.
2315 (Dwp_output_file::Dwp_index::section_mask_): New data member.
2316 (Dwp_output_file::add_output_section): New member function.
2317 (Dwp_output_file::write_new_section): New member function.
2318 (Dwp_output_file::write_contributions): New member function.
2319 (Dwp_output_file::section_id_map_): New data member.
2320 (class Dwo_id_info_reader): Remove.
2321 (class Unit_reader): New class.
2322 (get_dwarf_section_name): New function.
2323 (Dwo_file::read_executable): Adjust initializations of class data.
2324 (Dwo_file::read): Add support for v2 package file format.
2325 (Dwo_file::read_unit_index): Likewise.
2326 (Dwo_file::sized_read_unit_index): Likewise.
2327 (Dwo_file::copy_section): Likewise.
2328 (Dwo_file::add_unit_set): Likewise.
2329 (Dwp_output_file::add_output_section): Likewise.
2330 (Dwp_output_file::add_contribution): Likewise.
2331 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2332 for empty slot.
2333 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2334 file format.
2335 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2336 slot.
2337 (Dwp_output_file::initialize): Remove unused function.
2338 (Dwp_output_file::finalize): Add support for v2 package file format.
2339 (Dwp_output_file::write_index): Likewise.
2340 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2341 function prototype.
2342
2343 2013-10-31 Cary Coutant <ccoutant@google.com>
2344
2345 * configure.ac: Fix check for -fmerge-constants.
2346 * configure.ac: Regenerate.
2347
2348 2013-10-30 Roland McGrath <mcgrathr@google.com>
2349
2350 * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
2351 Correct 9-byte nop sequence to match what the assembler generates.
2352
2353 2013-10-30 Alan Modra <amodra@gmail.com>
2354
2355 * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
2356 ppc64_local_entry_offset, ppc64_local_entry_offset,
2357 do_read_symbols): New functions.
2358 (Powerpc_relobj::e_flags_, st_other_): New vars.
2359 (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
2360 (Powerpc_dynobj::abiversion, set_abiversion): New functions.
2361 (Powerpc_relobj::e_flags_): New var.
2362 (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
2363 and adjust for ELFv2.
2364 (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
2365 (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
2366 (Powerpc_dynobj::do_find_special_sections): Likewise.
2367 (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
2368 (Target_powerpc::Branch_info::make_stub): Adjust stub destination
2369 to ELFv2 local entry.
2370 (Target_powerpc::do_relax): No thread safe barriers needed for
2371 ELFv2.
2372 (Output_data_plt_powerpc::initial_plt_entry_size_,
2373 plt_entry_size): Delete. Replace all uses with
2374 first_plt_entry_offset() and plt_entry_size().
2375 (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
2376 reserved_size parm. Update callers.
2377 (Output_data_plt_powerpc::entry_count): Update.
2378 (Output_data_plt_powerpc::first_plt_entry_offset): Make private
2379 and use Target_powerpc::first_plt_entry_offset().
2380 (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
2381 rename to plt_entry_size.
2382 (Output_data_plt_powerpc::add_ifunc_entry,
2383 add_local_ifunc_entry): Adjust reloc for ELFv2.
2384 (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
2385 (glink_eh_frame_fde_64v2): New.
2386 (Stub_table::plt_call_size): Support ELFv2 sizing.
2387 (Output_data_glink::add_eh_frame): Use the new FDE.
2388 (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
2389 (Stub_table::do_write): Write ELFv2 stubs and glink.
2390 (Target_powerpc::Relocate::relocate): Replaces nop after call
2391 with ld 2,24(1) and adjust local offset destination for ELFv2.
2392
2393 2013-10-30 Alan Modra <amodra@gmail.com>
2394
2395 * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
2396 (Target_powerpc::Scan::global, local): Likewise.
2397 (Target_powerpc::Relocate::relocate): Likewise. Check for overflow
2398 on all ppc64 @h and @ha relocs.
2399
2400 2013-10-14 Alan Modra <amodra@gmail.com>
2401
2402 * output.h (Output_data_got::add_constant): Tidy.
2403 (Output_data_got::add_constant_pair): New function.
2404 * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
2405 methods used so as to first call reserve_ent().
2406
2407 2013-10-11 Roland McGrath <mcgrathr@google.com>
2408
2409 * powerpc.cc (Output_data_got_powerpc): Remove unused methods
2410 add_got_entry and add_got_entry_pair.
2411
2412 * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
2413 (HAVE_PUBNAMES): Likewise.
2414 * configure: Regenerate.
2415
2416 * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
2417 * testsuite/Makefile.in: Regenerate.
2418
2419 * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
2420 Remove const from declaration.
2421 * target.cc (Sized_target::do_adjust_elf_header): Update definition.
2422 * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
2423 * output.h (Output_file_header): Remove const from member target_
2424 and corresponding constructor argument.
2425 * output.cc (Output_file_header::Output_file_header): Update prototype.
2426 (Output_file_header::do_sized_write): Use this->target_ in place
2427 of parameters()->target().
2428
2429 * testsuite/undef_symbol.cc (Foo::get_a): New method.
2430
2431 * configure.ac (MERGE_CONSTANTS_FLAG): New check.
2432 * configure: Regenerate.
2433 * Makefile.in: Regenerate.
2434 * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
2435 * testsuite/merge_string_literals_2.c: Likewise.
2436 * testsuite/Makefile.am
2437 (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
2438 (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
2439 literal -fmerge-constants.
2440 * testsuite/Makefile.in: Regenerate.
2441
2442 * i386.cc (Target_i386): Remove unused member dynbss_.
2443 * arm.cc (Target_arm): Likewise.
2444 * powerpc.cc (Target_powerpc): Likewise.
2445 * sparc.cc (Target_sparc): Likewise.
2446 * tilegx.cc (Target_tilegx): Likewise.
2447 * x86_64.cc (Target_x86_64): Likewise.
2448 * dwarf_reader.h (Dwarf_info_reader): Remove unused members
2449 type_signature_, type_offset_.
2450 * plugin.h (Plugin_hook): Remove unused member layout_.
2451 * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
2452 mapfile_.
2453 (Read_member): Remove unused members input_objects_, symtab_,
2454 mapfile_, layout_.
2455 (Check_library): Remove unused member symtab_.
2456 * archive.h (Lib_group): Remove unused member lib_.
2457 * archive.cc (Lib_group::Lib_group): Update initializer.
2458 * incremental.h (Incremental_binary): Remove unused member target_.
2459 (Incremental_script_entry): Removed unused member script_.
2460 * layout.h (Write_symbols_task): Remove unused member input_objects_.
2461 * icf.h (Icf): Remove unused member num_tracked_relocs.
2462
2463 * gold-threads.h (Once): Conditionalize member was_run_lock_ on
2464 [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
2465 its only use.
2466 * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
2467
2468 * archive.h: Use struct rather than class for forward declaration
2469 of Read_symbols_data.
2470
2471 2013-10-07 Cary Coutant <ccoutant@google.com>
2472
2473 PR gold/16010
2474 * testsuite/Makefile.am (icf_test): Fix dependencies.
2475 (icf_safe_test): Likewise.
2476 (icf_safe_so_test): Likewise.
2477 (large_symbol_alignment): Add empty _LDADD rule.
2478 * testsuite/Makefile.in: Regenerate.
2479
2480 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
2481
2482 PR gold/15927
2483 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
2484 relocation for R_X86_64_32 on x32.
2485
2486 2013-08-27 Roland McGrath <mcgrathr@google.com>
2487
2488 * output.cc (Output_segment::set_section_addresses): Take new
2489 Target* argument. If target->isolate_execinstr() and the segment
2490 is executable and starts at a target->abi_pagesize() boundary,
2491 pad its end out to a target->abi_pagesize() boundary with code fill.
2492 * output.h (Output_segment::set_section_addresses): Update decl.
2493 * layout.h (Layout::check_output_data_for_reset_values): Take new
2494 argument RELAX_OUTPUTS.
2495 (Layout): New member relax_output_list_.
2496 (Layout::add_relax_output): New method.
2497 * layout.cc (Layout::Layout): Update constructor.
2498 (Layout::reset_relax_output): New method.
2499 (Layout::clean_up_after_relaxation): Call it.
2500 (Layout::prepare_for_relaxation): Update caller.
2501 (Layout::set_segment_offsets): Update callers of set_section_addresses.
2502 Call reset_relax_output before re-processing segments for
2503 isolate_execinstr case.
2504 (Layout::write_data): Handle relax_output_list_.
2505 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
2506 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
2507
2508 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
2509
2510 PR binutils/15834
2511 * object.h: Fix typos.
2512
2513 2013-08-16 Roland McGrath <mcgrathr@google.com>
2514
2515 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
2516 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
2517
2518 2013-08-07 Cary Coutant <ccoutant@google.com>
2519
2520 Revert support for v2 DWP files:
2521
2522 2013-03-01 Cary Coutant <ccoutant@google.com>
2523
2524 Add dwp support for v2 DWARF package file format.
2525 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2526 tu_length parameter. Adjust all callers.
2527 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2528 * dwp.cc: Include dwarf.h.
2529 (Section_bounds): New struct type.
2530 (Unit_set): New struct type.
2531 (Dwo_file::Dwo_file): Initialize new data member.
2532 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2533 Combine and rename to...
2534 (Dwo_file::read_unit_index): ...this.
2535 (Dwo_file::sized_read_compunit_index)
2536 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2537 (Dwo_file::sized_read_unit_index): ...this.
2538 (Dwo_file::copy_section): Remove section_name, is_str_offsets
2539 parameters; add section_id parameter.
2540 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2541 (Dwo_file::add_unit_set): ...this.
2542 (Dwo_file::shndx_map_): Remove.
2543 (Dwo_file::sect_offsets_): New data member.
2544 (Dwp_output_file::Dwp_output_file): Initialize new data members.
2545 (Dwp_output_file::add_section): Rename to...
2546 (Dwp_output_file::add_contribution): ...this.
2547 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2548 (Dwp_output_file::add_tu_set): Likewise.
2549 (Dwp_output_file::Contribution): New type.
2550 (Dwp_output_file::Section::contributions): New data member.
2551 (Dwp_output_file::Cu_or_tu_set): Remove.
2552 (Dwp_output_file::Section::Section): New ctor.
2553 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2554 (Dwp_output_file::Dwp_index::Section_table): New type.
2555 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2556 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2557 parameter.
2558 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2559 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2560 (Dwp_output_file::Dwp_index::section_table): New member function.
2561 (Dwp_output_file::Dwp_index::section_table_end): New member function.
2562 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2563 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2564 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2565 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2566 (Dwp_output_file::Dwp_index::section_table_): New data member.
2567 (Dwp_output_file::Dwp_index::section_mask_): New data member.
2568 (Dwp_output_file::add_output_section): New member function.
2569 (Dwp_output_file::write_new_section): New member function.
2570 (Dwp_output_file::write_contributions): New member function.
2571 (Dwp_output_file::section_id_map_): New data member.
2572 (class Dwo_id_info_reader): Remove.
2573 (class Unit_reader): New class.
2574 (get_dwarf_section_name): New function.
2575 (Dwo_file::read_executable): Adjust initializations of class data.
2576 (Dwo_file::read): Add support for v2 package file format.
2577 (Dwo_file::read_unit_index): Likewise.
2578 (Dwo_file::sized_read_unit_index): Likewise.
2579 (Dwo_file::copy_section): Likewise.
2580 (Dwo_file::add_unit_set): Likewise.
2581 (Dwp_output_file::add_output_section): Likewise.
2582 (Dwp_output_file::add_contribution): Likewise.
2583 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2584 for empty slot.
2585 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2586 file format.
2587 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2588 slot.
2589 (Dwp_output_file::initialize): Remove unused function.
2590 (Dwp_output_file::finalize): Add support for v2 package file format.
2591 (Dwp_output_file::write_index): Likewise.
2592 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2593 function prototype.
2594
2595 2013-07-31 Cary Coutant <ccoutant@google.com>
2596
2597 * object.cc (Sized_relobj::do_output_section_address): New function.
2598 (Sized_relobj): Instantiate explicitly.
2599 * object.h (Object::output_section_address): New function.
2600 (Object::do_output_section_address): New function.
2601 (Sized_relobj::do_output_section_address): New function.
2602 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
2603
2604 2013-07-30 Cary Coutant <ccoutant@google.com>
2605 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
2606
2607 * parameters.cc (Parameters::entry): Return target-specific entry
2608 symbol name.
2609 * target.h (Target::entry_symbol_name): New function.
2610 (Target_info::entry_symbol_name): New data member.
2611
2612 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
2613 * i386.cc (Target_i386::i386_info): Likewise.
2614 (Target_i386_nacl::i386_nacl_info): Likewise.
2615 * sparc.cc (Target_sparc::sparc_info): Likewise.
2616 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
2617 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
2618 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
2619 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2620
2621 2013-07-22 Sterling Augustine <saugustine@google.com>
2622
2623 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
2624 Convert parameter shndx to local variable. Add parameters symtab
2625 and symtab_size. Scan over section names. Find relocation
2626 section corresponding to current section. Create and initialize
2627 reloc_mapper_ and reloc_type_.
2628 (Dwarf_pubnames_table::read_header): Add assertion. Change
2629 unit_length to off_t. Initialize member unit_length_. Fill in field
2630 cu_offset_.
2631 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2632 Initialize new fields unit_length_ and cu_offset_.
2633 (Dwarf_pubnames_table::read_section): Update prototype.
2634 (Dwarf_pubnames_table::cu_offset): New member function.
2635 (Dwarf_pubnames_table::subsection_size): Likewise.
2636 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
2637 New fields.
2638 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
2639 member functions public.
2640 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
2641 Update comment. Rework logic. Move repeated parts to...
2642 (Gdb_index_info_reader::read_pubtable): ...here. New function.
2643 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
2644 pubtypes_table_, and stmt_list_offset.
2645 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2646 Gdb_index::find_pubtype_offset,
2647 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
2648 (Gdb_index::pubnames_read): Update prototype and rework logic.
2649 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
2650 Forward declare.
2651 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2652 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
2653 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
2654 Gdb_index::map_pubtable_to_dies):
2655 Declare functions.
2656 (Gdb_index::pubnames_read): Update declaration.
2657 (Gdb_index::Pubname_offset_map): New type.
2658 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
2659 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
2660 Gdb_index::stmt_list_offset): Declare.
2661 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
2662 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
2663 Gdb_index::pubtypes_offset_): Remove.
2664
2665 2013-07-19 Roland McGrath <mcgrathr@google.com>
2666
2667 * options.h (General_options): Add -Trodata-segment option.
2668 * parameters.cc (Parameters::check_rodata_segment): New function.
2669 (Parameters::set_target_once): Call it.
2670 * parameters.h (Parameters): Declare it (private member function).
2671 * layout.cc (load_seg_unusable_for_headers): New function, broken
2672 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
2673 then validate rodata segment rather than text segment.
2674 (relaxation_loop_body): Call that.
2675 (is_text_segment): New function. Don't admit a non-executable
2676 segment if TARGET->isolate_execinstr().
2677 (set_segment_offsets): Call it. Honor -Trodata-segment option.
2678
2679 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
2680
2681 PR gold/15070
2682 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
2683 * nacl.h (Sniff_file::View::View): Request aligned view.
2684
2685 2013-07-11 Cary Coutant <ccoutant@google.com>
2686
2687 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
2688 correct BRLT entry size.
2689
2690 2013-07-03 Alan Modra <amodra@gmail.com>
2691
2692 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
2693 comment.
2694
2695 2013-07-01 Cary Coutant <ccoutant@google.com>
2696
2697 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
2698 reloc_type_.
2699 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
2700 (Dwarf_ranges_table::lookup_reloc): New function.
2701 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
2702 reloc_type_.
2703 (Dwarf_ranges_table::lookup_reloc): New function.
2704 (Dwarf_ranges_table::reloc_type_): New data member.
2705
2706 2013-06-27 Jing Yu <jingyu@google.com>
2707
2708 PR gold/15662
2709 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
2710 function.
2711 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
2712 (Target_powerpc::do_relax): Call the above.
2713
2714 2013-06-27 Cary Coutant <ccoutant@google.com>
2715
2716 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
2717 on garbage collected .opd section.
2718
2719 2013-06-27 Alan Modra <amodra@gmail.com>
2720
2721 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
2722 is non-zero.
2723 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
2724 (Target_powerpc::do_function_location): Likewise for loc->shndx.
2725
2726 2013-06-14 Cary Coutant <ccoutant@google.com>
2727
2728 * resolve.cc (Symbol::override_base): Don't override st_type
2729 from plugin placeholder symbols.
2730 (Symbol_table::resolve): Likewise.
2731 (Symbol_table::should_override): Don't complain about TLS mismatch
2732 if the TO symbol is a plugin placeholder.
2733 * testsuite/Makefile.am (plugin_test_tls): New test.
2734 * testsuite/Makefile.in: Regenerate.
2735 * testsuite/plugin_test_tls.sh: New test script.
2736 * testsuite/two_file_test_2_tls.cc: New test source.
2737 * testsuite/two_file_test_tls.cc: New test source.
2738
2739 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
2740
2741 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
2742 the maximum segment alignment is larger than the page size.
2743 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
2744 correctly aligns the symbols with large alignemnt.
2745 * testsuite/Makefile.in: Regenerate.
2746 * testsuite/large_symbol_alignment.cc: New file.
2747
2748 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
2749 Sriraman Tallam <tmsriram@google.com>
2750
2751 * options.h (sort_section): New option.
2752 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
2753 Rename from Input_section_sort_section_name_special_ordering_compare.
2754 (Input_section_sort_section_name_compare): New struct.
2755 * output.cc (Output_section::Input_section_sort_section_name_compare::
2756 operator()): New function.
2757 (Output_section::sort_attached_input_sections): Use new sort function
2758 for .text if --sort-section=name is specified.
2759 * layout.cc (Layout::make_output_section):
2760 Add sorting by name when --sort-section=name is specified.
2761 * testsuite/Makefile.am (text_section_grouping): Test option
2762 --sort-section=name.
2763 * testsuite/Makefile.in: Regenerate.
2764 * testsuite/section_sorting_name.cc: New file.
2765 * testsuite/section_sorting_name.sh: New file.
2766
2767 2013-05-21 Cary Coutant <ccoutant@google.com>
2768
2769 * symtab.h (Symbol::is_cxx_vtable): New function.
2770 * target-reloc.h (relocate_section): Check for vtable symbol.
2771 * testsuite/Makefile.am (missing_key_func.sh): New test case.
2772 * testsuite/Makefile.in: Regenerate.
2773 * testsuite/missing_key_func.cc: New test source.
2774 * testsuite/missing_key_func.sh: New test script.
2775
2776 2013-05-21 Cary Coutant <ccoutant@google.com>
2777
2778 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
2779 type of enclosing symbol.
2780 (Relocate_info::location): Check symbol type when describing symbol.
2781 * object.h (Symbol_location_info): Remove unused line_number;
2782 add enclosing_symbol_type.
2783 * testsuite/debug_msg.sh: Adjust expected output.
2784
2785 2013-05-13 Cary Coutant <ccoutant@google.com>
2786
2787 * configure.ac: Export DEFAULT_TARGET.
2788 * configure: Regenerate.
2789 * Makefile.in: Regenerate.
2790 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
2791 * testsuite/Makefile.in: Regenerate.
2792 * testsuite/debug_msg.sh: Delete duplicate tests.
2793 Don't check undef_int error message match for powerpc where the
2794 source file and line number aren't available.
2795
2796 2013-05-10 Roland McGrath <mcgrathr@google.com>
2797
2798 * options.h (General_options): Add --rosegment-gap option.
2799 * options.cc (finalize): --rosegment-gap implies --rosegment.
2800 * layout.cc (set_segment_offsets): Let user option override
2801 target->rosegment_gap().
2802
2803 2013-05-10 Roland McGrath <mcgrathr@google.com>
2804
2805 * options.h (General_options): Remove leading space from help
2806 messages for -nostdlib and --rosegment.
2807
2808 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
2809
2810 PR ld/15365
2811 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
2812
2813 2013-05-03 Alan Modra <amodra@gmail.com>
2814
2815 * merge.cc (Output_merge_string::do_add_input_section): Correct
2816 scan for number of strings. Rename vars to avoid shadowing.
2817 Include missing terminator in input_size_.
2818
2819 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
2820
2821 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
2822 Restore empty string handling.
2823
2824 2013-05-01 Cary Coutant <ccoutant@google.com>
2825
2826 * stringpool.cc (Stringpool_template::new_key_offset): Fix
2827 uninitialized warning.
2828
2829 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
2830
2831 * output.cc (Output_section::add_merge_input_section): Allow
2832 to merge sections if the alignment is more than character size.
2833 * merge.h (Output_merge_string::Output_merge_string): Remove
2834 assert.
2835 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
2836 only not-null strings. Check the alignment of strings.
2837 * stringpool.h
2838 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
2839 alignment as the argument.
2840 (Stringpool_template<Stringpool_char>::addralign_): New class member.
2841 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
2842 Align non-zero length strings according to the addralign_.
2843 (Stringpool_template<Stringpool_char>::set_string_offsets):
2844 Updating offsets according to the given alignment.
2845 * testsuite/Makefile.am (text_section_grouping): Test if string
2846 literals are getting merged.
2847 * testsuite/Makefile.in: Regenerate.
2848 * testsuite/merge_string_literals_1.c: New file.
2849 * testsuite/merge_string_literals_2.c: Ditto.
2850 * testsuite/merge_string_literals.sh: Ditto.
2851
2852 2013-04-26 Ian Lance Taylor <iant@google.com>
2853
2854 * target-reloc.h (relocate_section): If the reloc offset is out of
2855 range, pass VIEW as NULL to relocate.relocate.
2856 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
2857 * i386.cc (Target_i386::Relocate::relocate): Likewise.
2858 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2859 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2860 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
2861 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2862
2863 2013-04-26 Geoff Pike <gpike@chromium.org>
2864
2865 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
2866 * layout.cc (Hash_task): New class.
2867 (Layout::queue_build_id_tasks): New function.
2868 (Layout::write_build_id): Handle single-thread portion of build ID
2869 computation. (In some cases, all of it is single-threaded.) Replace
2870 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
2871 functionality in fewer lines of code.
2872 * layout.h (Layout::queue_build_id_tasks): New function declaration.
2873 * options.h (General_options): make "--build-id" default to tree
2874 rather than sha1. Add two new options related to --build-id=tree:
2875 --build-id-chunk-size-for-treehash and
2876 --build-id-min-file-size-for-treehash.
2877 * Makefile.am: add testing of --build-id=tree and related new options
2878 (these tests will be invoked by "make check").
2879 * Makefile.in: Regenerate.
2880
2881 2013-04-25 Alan Modra <amodra@gmail.com>
2882
2883 * configure.tgt: Add powerpcle and powerpc64le.
2884
2885 2013-04-22 Alan Modra <amodra@gmail.com>
2886
2887 PR gold/15355
2888 * layout.cc (Layout::segment_precedes): Allow more than one
2889 segment with the same type and flags.
2890
2891 2013-04-15 Cary Coutant <ccoutant@google.com>
2892
2893 * layout.cc (Layout::set_relocatable_section_offsets): Don't
2894 allocate space in file for BSS sections.
2895
2896 2013-04-15 Cary Coutant <ccoutant@google.com>
2897
2898 * script-sections.cc (Orphan_output_section): Reset address
2899 to zero after each orphaned section for relocatable links.
2900
2901 2013-04-15 Cary Coutant <ccoutant@google.com>
2902
2903 * symtab.cc (Symbol_table::sized_write_globals): Subtract
2904 section starting address for relocatable link.
2905 * testsuite/Makefile.am (script_test_11): New test.
2906 * testsuite/Makefile.in: Regenerate.
2907 * testsuite/script_test_11.c: New source file.
2908 * testsuite/script_test_11.t: New linker script.
2909
2910 2013-04-13 Alan Modra <amodra@gmail.com>
2911
2912 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
2913 owner when sections are not adjacent and exceed group size.
2914 (Target_powerpc::group_sections): Handle corner case.
2915 (Target_powerpc::Branch_info::make_stub): Handle case where
2916 stub table doesn't exist due to branches in non-exec sections.
2917 (Target_powerpc::Relocate::relocate): Likewise.
2918
2919 2013-04-11 Alan Modra <amodra@gmail.com>
2920
2921 PR gold/15354
2922 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
2923 .branch_lt to match bfd ld. Adjust comments throughout file.
2924
2925 2013-04-04 Ian Lance Taylor <iant@google.com>
2926
2927 GCC PR c++/56840
2928 * object.cc (do_layout_deferred_sections): Handle .eh_frame
2929 sections before checking whether they are included in the link.
2930
2931 2013-03-29 Sriraman Tallam <tmsriram@google.com>
2932
2933 * archive.cc (Archive::get_elf_object_for_member): Create the elf
2934 object before calling the plugin claim_file handler. Pass the elf
2935 object of the archive to the plugin. Delete the elf object if the
2936 plugin claims the file.
2937
2938 2013-03-21 Alan Modra <amodra@gmail.com>
2939
2940 * layout.cc (Layout::set_segment_offsets): Accept writable .text
2941 segment when omagic.
2942
2943 2013-03-21 Alan Modra <amodra@gmail.com>
2944
2945 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
2946 comparison warning.
2947 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
2948 uninitialized" warning.
2949
2950 2013-03-20 Alan Modra <amodra@gmail.com>
2951
2952 * symtab.h (Symbol::clear_version): New function.
2953 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
2954 is_needed by weak references. Clear version for symbols defined
2955 in as-needed objects that are not needed.
2956
2957 2013-03-15 Alan Modra <amodra@gmail.com>
2958
2959 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
2960 static and public. Add report_err param. Return false for data refs.
2961 (Target_powerpc::rela_dyn_section): New overloaded function.
2962 (Target_powerpc::plt_, iplt_): Elucidate.
2963 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
2964 (Output_data_plt_powerpc::do_write): Don't write .iplt.
2965 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
2966 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
2967 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
2968 push_branch and make_plt_entry for ifunc syms when
2969 reloc_needs_plt_for_ifunc.
2970 (Target_powerpc::Relocate::relocate): Don't use plt entry value
2971 for ifunc unless reloc_needs_plt_for_ifunc.
2972
2973 2013-03-15 Alan Modra <amodra@gmail.com>
2974
2975 * gc.h (gc_process_relocs): Don't look through function descriptors.
2976 * icf.cc (get_section_contents): Do so here instead.
2977
2978 2013-03-13 Alan Modra <amodra@gmail.com>
2979
2980 * powerpc.cc (is_branch_reloc): Forward declare.
2981 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
2982 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
2983 false for 64-bit, true for 32-bit non-branch relocs.
2984 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
2985 * testsuite/Makefile.am (icf_test): Use linker map file instead of
2986 nm output.
2987 (icf_safe_test): Generate linker map file as well as nm output.
2988 (icf_safe_so_test): Likewise.
2989 * testsuite/Makefile.in: Regenerate.
2990 * testsuite/icf_test.sh: Parse linker map file to determine
2991 section folding.
2992 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
2993 * testsuite/icf_safe_so_test.sh: Likewise.
2994 (X86_32_or_ARM_specific_safe_fold): Merge into..
2995 (arch_specific_safe_fold): ..this.
2996 (X86_64_specific_safe_fold): Delete unused function.
2997
2998 2013-03-12 Alan Modra <amodra@gmail.com>
2999
3000 * gc.h (gc_process_relocs): Look through function descriptors
3001 to determine shndx, symvalue and addend used by ICF. Tidy
3002 variable duplication.
3003
3004 2013-03-11 Alan Modra <amodra@gmail.com>
3005
3006 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
3007 * layout.cc (Layout_task_runner::run): ..to here.
3008 * symtab.h (struct Symbol_location): Extract from..
3009 (class Symbol_table): ..here.
3010 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
3011 * target.h (class Target): Add function_location and
3012 do_function_location functions.
3013 (class Sized_target): Add do_function_location.
3014 * object.h (class Sized_relobj_file): Move find_shdr..
3015 (class Object): ..to here.
3016 * object.cc: Likewise. Update to suit. Instantiate.
3017 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
3018 * powerpc.cc (class Powerpc_dynobj): New.
3019 (Target_powerpc::do_function_location): New function.
3020 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
3021 (Powerpc_dynobj::do_read_symbols): New function.
3022 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
3023
3024 2013-03-08 Ian Lance Taylor <iant@google.com>
3025
3026 * options.cc (General_options::string_to_object_format): Accept
3027 "default".
3028
3029 2013-03-08 Alan Modra <amodra@gmail.com>
3030
3031 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
3032 pointer to Post_fde.
3033 (struct Post_fde): Move definition to here..
3034 * ehframe.cc (struct Post_fde): ..from here.
3035 (Cie::write): Don't alloc Post_fde.
3036 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
3037
3038 2013-03-07 Alan Modra <amodra@gmail.com>
3039
3040 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
3041 relocation referencing .LC0.
3042 * testsuite/discard_locals_test.sh: Remove FIXMEs.
3043
3044 2013-03-07 Alan Modra <amodra@gmail.com>
3045
3046 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
3047 always_inline. Add assembly for powerpc to avoid GOT.
3048
3049 2013-03-07 Alan Modra <amodra@gmail.com>
3050
3051 * testsuite/script_test_10.sh: Don't test .bss section
3052 header number.
3053
3054 2013-03-06 Alan Modra <amodra@gmail.com>
3055
3056 * powerpc.cc (class Powerpc_relobj): Move some member functions.
3057 (Target_powerpc::symval_for_branch): Add symtab param. Update
3058 all callers. Handle folded sections.
3059 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
3060 to Powerpc_relobj.
3061 (Global_symbol_visitor_opd::operator()): Likewise.
3062
3063 2013-03-04 Alan Modra <amodra@gmail.com>
3064
3065 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
3066 * testsuite/Makefile.in: Regenerate.
3067
3068 2013-03-01 Cary Coutant <ccoutant@google.com>
3069
3070 Add dwp support for v2 DWARF package file format.
3071 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
3072 tu_length parameter. Adjust all callers.
3073 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
3074 * dwp.cc: Include dwarf.h.
3075 (Section_bounds): New struct type.
3076 (Unit_set): New struct type.
3077 (Dwo_file::Dwo_file): Initialize new data member.
3078 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
3079 Combine and rename to...
3080 (Dwo_file::read_unit_index): ...this.
3081 (Dwo_file::sized_read_compunit_index)
3082 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
3083 (Dwo_file::sized_read_unit_index): ...this.
3084 (Dwo_file::copy_section): Remove section_name, is_str_offsets
3085 parameters; add section_id parameter.
3086 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
3087 (Dwo_file::add_unit_set): ...this.
3088 (Dwo_file::shndx_map_): Remove.
3089 (Dwo_file::sect_offsets_): New data member.
3090 (Dwp_output_file::Dwp_output_file): Initialize new data members.
3091 (Dwp_output_file::add_section): Rename to...
3092 (Dwp_output_file::add_contribution): ...this.
3093 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
3094 (Dwp_output_file::add_tu_set): Likewise.
3095 (Dwp_output_file::Contribution): New type.
3096 (Dwp_output_file::Section::contributions): New data member.
3097 (Dwp_output_file::Cu_or_tu_set): Remove.
3098 (Dwp_output_file::Section::Section): New ctor.
3099 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
3100 (Dwp_output_file::Dwp_index::Section_table): New type.
3101 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
3102 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
3103 parameter.
3104 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
3105 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
3106 (Dwp_output_file::Dwp_index::section_table): New member function.
3107 (Dwp_output_file::Dwp_index::section_table_end): New member function.
3108 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
3109 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
3110 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
3111 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
3112 (Dwp_output_file::Dwp_index::section_table_): New data member.
3113 (Dwp_output_file::Dwp_index::section_mask_): New data member.
3114 (Dwp_output_file::add_output_section): New member function.
3115 (Dwp_output_file::write_new_section): New member function.
3116 (Dwp_output_file::write_contributions): New member function.
3117 (Dwp_output_file::section_id_map_): New data member.
3118 (class Dwo_id_info_reader): Remove.
3119 (class Unit_reader): New class.
3120 (get_dwarf_section_name): New function.
3121 (Dwo_file::read_executable): Adjust initializations of class data.
3122 (Dwo_file::read): Add support for v2 package file format.
3123 (Dwo_file::read_unit_index): Likewise.
3124 (Dwo_file::sized_read_unit_index): Likewise.
3125 (Dwo_file::copy_section): Likewise.
3126 (Dwo_file::add_unit_set): Likewise.
3127 (Dwp_output_file::add_output_section): Likewise.
3128 (Dwp_output_file::add_contribution): Likewise.
3129 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
3130 for empty slot.
3131 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
3132 file format.
3133 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
3134 slot.
3135 (Dwp_output_file::initialize): Remove unused function.
3136 (Dwp_output_file::finalize): Add support for v2 package file format.
3137 (Dwp_output_file::write_index): Likewise.
3138 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
3139 function prototype.
3140
3141 2013-03-01 Cary Coutant <ccoutant@google.com>
3142
3143 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
3144 function into class definition in header file.
3145 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
3146 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
3147 New function.
3148 (Dwarf_info_reader::check_buffer): Move here from .cc file.
3149
3150 2013-02-28 Alan Modra <amodra@gmail.com>
3151
3152 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
3153 * target.cc (Target::do_plt_fde_location): New function.
3154 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
3155 accessor function, and constructor param.
3156 (struct Post_fde, Post_fdes): Declare.
3157 (Cie::write): Add post_fdes param.
3158 * ehframe.cc (Fde::write): Use plt_fde_location.
3159 (struct Post_fde): Define.
3160 (Cie::write): Stash FDEs added post merge mapping.
3161 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
3162 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
3163 (Eh_frame::do_sized_write): Arrange to write post map FDES after
3164 other FDEs.
3165 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
3166 (Target_powerpc::has_glink): New function.
3167 (Target_powerpc::do_relax): Add eh_frame info for stubs.
3168 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
3169 glink_eh_frame_fde_32, default_fde): New data.
3170 (Stub_table::eh_frame_added_): New var.
3171 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
3172 Make const.
3173 (Stub_table::add_eh_frame): New function.
3174 (Output_data_glink::add_eh_frame): New function.
3175 (Target_powerpc::make_glink_section): Call add_eh_frame.
3176
3177 2013-02-15 Ian Lance Taylor <iant@google.com>
3178
3179 * options.h (DEFINE_uint64_alias): Define.
3180 (class General_options): Add -Ttext-segment as an alias for
3181 -Ttext.
3182
3183 2013-02-15 Alan Modra <amodra@gmail.com>
3184
3185 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
3186 (Stub_table::do_write): ..here, two places.
3187 (Stub_table::plt_call_size): Use it here too.
3188
3189 2013-02-11 Ian Lance Taylor <iant@google.com>
3190
3191 * descriptors.cc (Descriptors::close_all): New function.
3192 * descriptors.h (class Descriptors): Declare close_all.
3193 (close_all_descriptors): New inline function.
3194 * plugin.cc: Include "descriptors.h".
3195 (Plugin_manager::cleanup): Call close_all_descriptors.
3196
3197 2013-02-06 Alan Modra <amodra@gmail.com>
3198
3199 * README: Update coding style link.
3200
3201 2013-01-28 Cary Coutant <ccoutant@google.com>
3202
3203 * dwp.cc (File_list): New typedef.
3204 (Dwo_name_info_reader): New class.
3205 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
3206 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
3207 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
3208 (Dwo_file::read_executable): New function.
3209 (Dwo_file::read): Move common setup code to ...
3210 (Dwo_file::make_object): ... here.
3211 (dwp_options): Add --exec/-e.
3212 (usage): Likewise.
3213 (main): Likewise.
3214
3215 2013-01-24 Sriraman Tallam <tmsriram@google.com>
3216
3217 * layout.cc (Layout::layout): Check for option text_reorder.
3218 (Layout::make_output_section): Ditto.
3219 * options.h (text_reorder): New option.
3220 * output.cc (Input_section_sort_compare): Remove special ordering
3221 of section names.
3222 (Output_section::
3223 Input_section_sort_section_name_special_ordering_compare::
3224 operator()): New function.
3225 (Output_section::sort_attached_input_sections): Use new sort function
3226 for .text.
3227 * output.h (Input_section_sort_section_name_special_ordering_compare):
3228 New struct.
3229 * testsuite/Makefile.am (text_section_grouping): Test option
3230 --no-text-reorder
3231 * testsuite/Makefile.in: Regenerate.
3232 * testsuite/text_section_grouping.sh: Check order of functions without
3233 default text reordering.
3234
3235 2013-01-18 Mike Frysinger <vapier@gentoo.org>
3236
3237 * options.h (General_options): Change default to true for new_dtags.
3238
3239 2013-01-18 Mike Frysinger <vapier@gentoo.org>
3240
3241 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
3242 when enable_new_dtags is false. Only add DT_RUNPATH when
3243 enable_new_dtags is true.
3244
3245 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
3246
3247 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
3248 used in declaration and definition consistent.
3249 (Target_powerpc::symval_for_branch): Ditto.
3250
3251 2013-01-16 Sriraman Tallam <tmsriram@google.com>
3252
3253 * testsuite/plugin_final_layout.cc: Fix comment.
3254
3255 2013-01-16 Sriraman Tallam <tmsriram@google.com>
3256
3257 * layout.cc (Layout::layout): Do not do default sorting for
3258 text sections when section ordering is specified.
3259 (make_output_section): Ditto.
3260 * testsuite/plugin_final_layout.cc: Name the function sections
3261 to catch reordering issues.
3262
3263 2013-01-15 Alan Modra <amodra@gmail.com>
3264
3265 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
3266 plt-thread-safe.
3267
3268 2013-01-15 Alan Modra <amodra@gmail.com>
3269
3270 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
3271 * testsuite/Makefile.in: Regenerate.
3272
3273 2013-01-14 Alan Modra <amodra@gmail.com>
3274
3275 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
3276 * testsuite/Makefile.in: Regenerate.
3277
3278 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
3279
3280 PR bfd/14430
3281 Fix mingw gold build with plugins enabled
3282 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
3283 * configure.ac: Export DLOPEN_LIBS and add headers check.
3284 * plugin.cc: Handle non-dlfcn case.
3285 * Makefile.in: Regenerate.
3286 * config.in: Regenerate.
3287 * configure: Regenerate.
3288 * testsuite/Makefile.in: Regenerate.
3289
3290 2013-01-09 Sriraman Tallam <tmsriram@google.com>
3291
3292 * output.h (sort_attached_input_sections): Change to be public.
3293 * script-sections.cc
3294 (Output_section_definition::set_section_addresses): Sort
3295 attached input sections according to section order before linker
3296 script assigns section addresses.
3297 (Orphan_output_section::set_section_addresses): Sort
3298 attached input sections according to section order before linker
3299 script assigns section addresses.
3300 * Makefile.am (final_layout.sh): Use a simple linker script to
3301 check if section ordering still works.
3302 * Makefile.in: Regenerate.
3303
3304 2013-01-09 Ben Cheng <bccheng@google.com>
3305
3306 * arm.cc (Target_arm::attributes_accept_div): New function.
3307 (Target_arm::attributes_forbid_div): New function.
3308 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
3309 attribute using the same new functions as what bfd/elf32_arm.c
3310 does.
3311
3312 2013-01-07 Cary Coutant <ccoutant@google.com>
3313
3314 PR gold/14993
3315 * output.cc (Output_section::add_input_section): For incremental
3316 updates, don't track input sections that are allocated from patch
3317 space.
3318
3319 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
3320 Ian Lance Taylor <iant@google.com>
3321
3322 PR gold/14897
3323 * configure.ac (--enable-ld): Removed.
3324 (install_as_default): Set to yes only for --enable-gold=default
3325 or --disable-ld.
3326 * configure: Regenerated.
3327
3328 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
3329
3330 * options.h (General_options): Add -fuse-ld= for GCC linker
3331 option compatibility.
3332
3333 2013-01-04 Cary Coutant <ccoutant@google.com>
3334
3335 * configure.ac: Fix typo restoring CXXFLAGS.
3336 * configure: Regenerate.
3337
3338 2013-01-04 Cary Coutant <ccoutant@google.com>
3339
3340 * testsuite/Makefile.am (CXXLINK_S): New macro.
3341 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
3342 * testsuite/Makefile.in: Regenerate.
3343
3344 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
3345
3346 * version.cc (print_version): Update copyright year to 2013.
3347
3348 2012-12-20 Ian Lance Taylor <iant@google.com>
3349
3350 * layout.cc (Layout::special_ordering_of_input_section): New
3351 function.
3352 (Layout::layout): If input section requires special ordering, must
3353 sort input sections.
3354 (Layout::make_output_section): May sort .text input sections.
3355 (Layout::is_section_name_prefix_grouped): Remove.
3356 * layout.h (class Layout): Declare
3357 special_ordering_of_input_section. Don't declare
3358 is_section_name_prefix_grouped.
3359 * output.cc (Output_section::add_input_section): Revert last
3360 change.
3361 (Output_section::Input_section_sort::match_file_name): Don't crash
3362 if called on output section data.
3363 (Output_section::Input_section_sort_compare): Sort based on
3364 special ordering.
3365 (Output_section::Input_section_sort_section_order_index_compare):
3366 Revert last patch.
3367 (Output_section::sort_attached_input_sections): Likewise.
3368
3369 2012-12-18 Sriraman Tallam <tmsriram@google.com>
3370
3371 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
3372 * layout.h (Layout::is_section_name_prefix_grouped): New function.
3373 * output.cc (Output_section::add_input_section): Check if section
3374 name contains special prefix. Keep input sections to sort such
3375 sections.
3376 (Output_section::Input_section_sort_section_order_index_compare
3377 ::operator()): Group sections according to prefixes.
3378 (Output_section::sort_attached_input_sections): Add condition to
3379 Input_section_entry constructor call.
3380 * testsuite/Makefile.am (text_section_grouping): New test.
3381 * testsuite/Makefile.in: Regenerate.
3382 * testsuite/text_section_grouping.cc: New file.
3383 * testsuite/text_section_grouping.sh: New file.
3384
3385 2012-12-17 Nick Clifton <nickc@redhat.com>
3386
3387 * Makefile.am: Add copyright notice.
3388 * NEWS: Likewise.
3389 * README: Likewise.
3390 * configure.ac: Likewise.
3391 * ftruncate.c: Likewise.
3392 * Makefile.in: Regenerate.
3393
3394 2012-12-14 Cary Coutant <ccoutant@google.com>
3395
3396 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
3397 --no-as-needed flag.
3398 (exception_separate_shared_12_test): Likewise.
3399 (incremental_copy_test): Likewise.
3400 * testsuite/Makefile.in: Regenerate.
3401
3402 2012-12-14 Cary Coutant <ccoutant@google.com>
3403
3404 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
3405 (Dwp_output_file::Dwp_index::enter_set): Add assert.
3406
3407 2012-12-12 Alan Modra <amodra@gmail.com>
3408
3409 * powerpc.cc (class Track_tls): New.
3410 (class Relocate, class Scan): Inherit Track_tls.
3411 (Target_powerpc::Scan::local, global): Track tls optimization
3412 and avoid creating plt entry for __tls_get_addr if all uses
3413 are optimized away.
3414 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
3415
3416 2012-12-12 Alan Modra <amodra@gmail.com>
3417
3418 * options.h (General_options): Add --toc-sort/--no-toc-sort.
3419 Replace no_toc_optimize with toc_optimize.
3420 * output.h (Output_section::input_sections): Provide non-const variant.
3421 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
3422 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
3423 accessors.
3424 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
3425 (class Sort_toc_sections): New.
3426 (Target_powerpc::do_finalize_sections): Sort toc sections.
3427 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
3428
3429 2012-12-10 Roland McGrath <mcgrathr@google.com>
3430
3431 * testsuite/binary_unittest.cc (read_all): New function.
3432 (Sized_binary_test): Use it instead of ::read.
3433 * fileread.cc (do_read): Don't assume pread always reads the whole
3434 amount in a single call.
3435
3436 2012-12-10 Alan Modra <amodra@gmail.com>
3437
3438 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
3439 Set EM_PPC64 or EM_PPC here.
3440 (Target_selector_powerpc::do_recognize): Delete.
3441
3442 2012-12-10 Alan Modra <amodra@gmail.com>
3443
3444 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
3445 stub_table_.
3446 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
3447
3448 2012-12-07 Roland McGrath <mcgrathr@google.com>
3449
3450 * testsuite/binary_unittest.cc (Sized_binary_test):
3451 Use open_descriptor rather than ::open.
3452
3453 2012-12-07 Alan Modra <amodra@gmail.com>
3454
3455 * powerpc.cc (Stub_table::do_write): Delete redundant Address
3456 typedef and invalid_address constant.
3457 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
3458 instantiate constants.
3459
3460 2012-12-06 Roland McGrath <mcgrathr@google.com>
3461
3462 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
3463 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
3464 * aclocal.m4: Regenerate.
3465 * configure: Regenerate.
3466 * Makefile.in: Regenerate.
3467 * testsuite/Makefile.in: Regenerate.
3468
3469 2012-12-07 Alan Modra <amodra@gmail.com>
3470
3471 * options.h (General_options): Add no_toc_optimize.
3472 * powerpc.cc (ok_lo_toc_insn): New function.
3473 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
3474
3475 2012-12-06 Alan Modra <amodra@gmail.com>
3476
3477 * options.h (General_options): Add plt_align, plt_static_chain,
3478 plt_thread_safe. Update stub_group_size help text.
3479 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
3480 for new plt_thread_safe_ var.
3481 (use_plt_offset): Correct comments.
3482 (Target_powerpc::do_relax): Look for thread creation symbols to
3483 determine default plt_thread_safe value. Clear plt call stubs
3484 as well as branch stubs each iteration.
3485 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
3486 insn constants.
3487 (l, hi, ha, write_insn): Move earlier.
3488 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
3489 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
3490 plt stubs too.
3491 (Stub_table::update_size): Adjust.
3492 (Stub_table::prev_size, set_prev_size): Delete.
3493 (Stub_table::stub_align): Let --plt-align affect result.
3494 (Stub_table::plt_call_size): Calculate sizes for various stubs.
3495 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
3496 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
3497 (Stub_table::do_write): Support more stub variants.
3498
3499 2012-12-04 Alan Modra <amodra@gmail.com>
3500
3501 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
3502 (Target_powerpc::do_define_standard_symbols): New function.
3503
3504 2012-12-03 Alan Modra <amodra@gmail.com>
3505
3506 * output.h: Formatting, whitespace.
3507
3508 2012-12-03 Alan Modra <amodra@gmail.com>
3509
3510 * layout.h (Layout::get_executable_sections): Declare.
3511 * layout.cc (Layout::get_executable_sections): New function.
3512 * arm.cc (Target_arm::group_sections): Use it.
3513 (Arm_output_section::group_sections): Delete now redundant test.
3514 * output.cc (Output_reloc::Output_reloc): Add is_relative.
3515 param to handle relative relocs.
3516 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
3517 (Output_data_reloc::add_absolute): Adjust.
3518 (Output_data_reloc::add_relative): New function.
3519 (Output_data::reset_data_size): New function.
3520 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
3521 (Output_section::set_addralign): New function.
3522 (Output_section::checkpoint_set_addralign): New function.
3523 (Output_section::clear_section_offsets_need_adjustment): New function.
3524 (Output_section::input_sections): Make public.
3525 * powerpc.cc (class Output_data_brlt_powerpc): New.
3526 (class Stub_table, class Stub_control): New.
3527 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
3528 stub_table_, set_stub_table, stub_table): New vectors and accessor
3529 functions.
3530 (Target_powerpc::do_may_relax, do_relax, push_branch,
3531 new_stub_table, stub_tables, brlt_section, group_sections,
3532 add_branch_lookup_table, find_branch_lookup_table,
3533 write_branch_lookup_table, make_brlt_section): New functions.
3534 (Target_powerpc::struct Sort_sections, class Branch_info): New.
3535 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
3536 branch_info_): New vars.
3537 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
3538 make call stubs here.
3539 (Output_data_glink): Remove all call stub handling from this class.
3540 (Target_powerpc::Scan::local, global): Save interesting branch
3541 relocs and relocs for ifunc. Adjust calls to plt entry functions.
3542 (Target_powerpc::do_finalize_sections): Only make reg save/restore
3543 functions on final link.
3544 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
3545 Handle long branch destinations too.
3546 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
3547 do_plt_address_for_local): Adjust lookup of plt call stubs.
3548
3549 2012-11-30 Alan Modra <amodra@gmail.com>
3550
3551 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
3552 relocs against protected symbols when building 32-bit shared libs.
3553
3554 2012-11-30 Alan Modra <amodra@gmail.com>
3555
3556 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
3557 param. Call got_section() to make .got. Update all callers
3558 and their callers and so on.
3559
3560 2012-11-30 Alan Modra <amodra@gmail.com>
3561
3562 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
3563 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
3564 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
3565 value if it already exists.
3566
3567 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
3568
3569 PR gold/14858
3570 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
3571
3572 2012-11-14 Roland McGrath <mcgrathr@google.com>
3573
3574 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
3575 than bfc instruction for data sandboxing.
3576
3577 2012-11-08 Alan Modra <amodra@gmail.com>
3578
3579 * po/POTFILES.in: Regenerate.
3580
3581 2012-11-05 Alan Modra <amodra@gmail.com>
3582
3583 * configure.ac: Apply 2012-09-10 change to config.in here.
3584 * configure: Regenerate.
3585
3586 2012-11-05 Alan Modra <amodra@gmail.com>
3587
3588 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
3589 (struct Opd_ent): Use "Address" rather than "Offset".
3590 (Output_data_got_powerpc::got_base_offset): Return Valtype.
3591 (Target_powerpc::got_section): Make public.
3592 (Target_powerpc::scan_relocs): Move code setting symbols..
3593 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
3594 Create _SDA_BASE_ only when referenced.
3595
3596 2012-11-02 Roland McGrath <mcgrathr@google.com>
3597
3598 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
3599 from last change.
3600
3601 2012-11-01 Roland McGrath <mcgrathr@google.com>
3602
3603 * target.h (Sized_target::relocate_relocs): Use Elf_Off
3604 for offset_in_output_section parameter.
3605 (Sized_target::relocate_special_relocatable): Likewise.
3606 * arm.cc (Target_arm::relocate_relocs): Likewise.
3607 (Target_arm::relocate_special_relocatable): Likewise.
3608 * i386.cc (Target_i386::relocate_relocs): Likewise.
3609 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
3610 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
3611 * target-reloc.h (relocate_relocs): Likewise.
3612 * testsuite/testfile.cc (Target_test): Likewise.
3613 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
3614 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
3615
3616 * system.h: Move inclusion of <clocale> to after <libintl.h> in
3617 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
3618
3619 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
3620 parameter, which is unused in the [!F_SETFD] case.
3621
3622 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
3623 SYMNDX to off_t before comparing it to this->data_size().
3624 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
3625 * incremental.cc (Output_section_incremental_inputs::do_write):
3626 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
3627
3628 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
3629
3630 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
3631
3632 * gold.cc (Target_arm::do_adjust_elf_header): Add the
3633 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
3634 in EABI_VER5.
3635
3636 2012-10-29 Cary Coutant <ccoutant@google.com>
3637
3638 * dwp.cc (usage): Add file and exit status parameters;
3639 add --help and --version options.
3640 (print_version): New function.
3641 (main): Add --help and --version options.
3642
3643 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
3644
3645 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
3646 final_layout_sequence.txt.
3647 * testsuite/Makefile.in: Regenerated.
3648
3649 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
3650
3651 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
3652 COMPILE generated by automake.
3653 (LINK1): Likewise.
3654 (CXXCOMPILE1): Likewise.
3655 (CXXLINK1): Likewise.
3656 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
3657 (LINK): Likewise.
3658 (CXXCOMPILE): Likewise.
3659 (CXXLINK): Likewise.
3660 * testsuite/Makefile.in: Regenerated.
3661
3662 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
3663
3664 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
3665 on bad fwrite return.
3666
3667 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
3668
3669 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
3670 on val.
3671
3672 2012-10-23 Cary Coutant <ccoutant@google.com>
3673
3674 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
3675 * testsuite/Makefile.in: Regenerate.
3676 * testsuite/dwp_test.h: New source file.
3677 * testsuite/dwp_test_1.cc: New source file.
3678 * testsuite/dwp_test_1.s: New source file.
3679 * testsuite/dwp_test_1.sh: New source file.
3680 * testsuite/dwp_test_1b.cc: New source file.
3681 * testsuite/dwp_test_1b.s: New source file.
3682 * testsuite/dwp_test_2.cc: New source file.
3683 * testsuite/dwp_test_2.s: New source file.
3684 * testsuite/dwp_test_2.sh: New source file.
3685 * testsuite/dwp_test_main.cc: New source file.
3686 * testsuite/dwp_test_main.s: New source file.
3687
3688 2012-10-23 Cary Coutant <ccoutant@google.com>
3689
3690 * dwp.h: New header file.
3691 * dwp.cc: New source file.
3692 * gold.h: Move shared declarations to system.h.
3693 * system.h: New header file.
3694 * Makefile.am: Add dwp.
3695 * Makefile.in: Regenerate.
3696
3697 2012-10-23 Cary Coutant <ccoutant@google.com>
3698
3699 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
3700 Dwarf_info_reader::read_from_pointer.
3701 (Dwarf_pubnames_table::read_header): Likewise.
3702 (Dwarf_pubnames_table::next_name): Likewise.
3703 (Dwarf_die::read_attributes): Likewise.
3704 (Dwarf_die::skip_attributes): Likewise.
3705 (Dwarf_info_reader::read_from_pointer): New function template.
3706 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
3707 (Dwarf_pubnames_table): Likewise.
3708 (Dwarf_info_reader::read_from_pointer): New function template.
3709 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
3710 Dwarf_pubnames_table ctor.
3711
3712 2012-10-23 Cary Coutant <ccoutant@google.com>
3713
3714 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
3715 abbrev_shndx.
3716 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
3717 abbrev_shndx_.
3718 (Dwarf_info_reader::set_abbrev_shndx): New method.
3719 (Dwarf_info_reader::abbrev_shndx_): New data member.
3720
3721 2012-10-23 Cary Coutant <ccoutant@google.com>
3722
3723 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
3724 from object, not parameters.
3725 (Dwarf_info_reader::parse): Likewise.
3726 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
3727 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
3728 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
3729 methods.
3730
3731 2012-10-23 Cary Coutant <ccoutant@google.com>
3732
3733 * fileread.cc (Input_file::Input_file): New constructor.
3734 * fileread.h (class Input_file): Add new constructor.
3735
3736 2012-10-18 Alan Modra <amodra@gmail.com>
3737
3738 PR gold/14727
3739 * object.cc (Relobj::is_section_name_included): Also match
3740 .sdata personality section.
3741
3742 2012-10-18 Alan Modra <amodra@gmail.com>
3743
3744 * target-reloc.h (class Default_comdat_behavior): New, package up..
3745 (get_comdat_behaviour): ..this.
3746 (relocate_section): Add Relocate_comdat_behavior template arg,
3747 adjust code to suit.
3748 * arm.cc (Target_arm::relocate_section): Adjust to suit.
3749 (Target_arm::scan_reloc_section): Likewise.
3750 * i386.cc (Target_i386::relocate_section): Likewise.
3751 * sparc.cc (Target_sparc::relocate_section): Likewise.
3752 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
3753 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
3754 * powerpc.cc (class Relocate_comdat_behavior): New.
3755 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
3756 gold::relocate_section with new template arg.
3757
3758 2012-10-18 Alan Modra <amodra@gmail.com>
3759
3760 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
3761 dynamic relocs for GOT_TPREL got entries, without symbol if
3762 resolving locally.
3763 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
3764 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
3765 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
3766
3767 2012-10-17 Alan Modra <amodra@gmail.com>
3768
3769 PR gold/14726
3770 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
3771
3772 2012-10-16 Sriraman Tallam <tmsriram@google.com>
3773
3774 * layout.cc (Layout::include_section): Keep sections marked
3775 SHF_EXCLUDE when doing relocatable links.
3776
3777 2012-10-16 Alan Modra <amodra@gmail.com>
3778
3779 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
3780 (Target_powerpc::do_finalize_sections): Call it.
3781 (Output_data_save_res): New class and supporting functions.
3782 (Target_powerpc::symval_for_branch): Only look up .opd entry for
3783 normal symbols defined in object files.
3784
3785 2012-10-12 Alan Modra <amodra@gmail.com>
3786
3787 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
3788 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
3789 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
3790 section if scan_opd_relocs not yet called.
3791 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
3792
3793 2012-10-12 Alan Modra <amodra@gmail.com>
3794
3795 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3796 add_local_ifunc_entry): Revert last change.
3797 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
3798
3799 2012-10-05 Alan Modra <amodra@gmail.com>
3800
3801 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
3802 do_plt_address_for_global): New functions.
3803 (Output_data_got_powerpc::do_write): Don't segfault when linking
3804 statically.
3805 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3806 add_local_ifunc_entry): Return true on adding entry..
3807 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
3808 glink->add_entry call. Remove unused symtab param. Adjust calls.
3809 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
3810 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
3811 set up symbols here.
3812 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
3813 syms here. Do so even when no .iplt. Don't segfault when linking
3814 statically.
3815 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
3816 new variants without reloc param.
3817 (Glink_sym_ent::Glink_sym_ent): Likewise.
3818 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
3819 reloc when refs will resolve to plt call stub.
3820 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
3821 R_PPC_PLTREL24 to resolve locally.
3822 (Target_powerpc::Scan::global): Correct ifunc handling.
3823 (Target_powerpc::Relocate::relocate): Correct local sym glink
3824 lookup. Don't destroy "value" when we have a plt call stub,
3825 and when checking plt call validity.
3826 (Target_powerpc::do_dynsym_value): Simplify.
3827
3828 2012-10-05 Alan Modra <amodra@gmail.com>
3829
3830 * i386.cc (Output_data_plt_i386::address_for_global,
3831 address_for_local): Add plt offset to returned value. Adjust uses.
3832 * sparc.cc (Output_data_plt_sparc::address_for_global,
3833 address_for_local): Likewise.
3834 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
3835 address_for_local): Likewise.
3836 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
3837 address_for_local): Likewise.
3838 * target.h (Target::plt_address_for_global, plt_address_for_local):
3839 Update comment.
3840 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
3841 (Output_data_got::Got_entry::write): Nor here.
3842 * output.h: Comment fix.
3843
3844 2012-10-02 Jiong Wang <jiwang@tilera.com>
3845
3846 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
3847 global_offset_table_ value for larget got.
3848 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
3849
3850 2012-09-29 Alan Modra <amodra@gmail.com>
3851
3852 * powerpc.cc (Target_powerpc::iplt_): New output section.
3853 (Target_powerpc::iplt_section, make_iplt_section,
3854 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
3855 (Target_powerpc::make_plt_entry): Handle ifunc syms.
3856 Target_powerpc::plt_entry_count): Count iplt entries too.
3857 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
3858 reloc section in constructor. New params.
3859 (Target_powerpc::make_plt_section): Create reloc section here instead.
3860 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
3861 functions.
3862 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
3863 (Output_data_glink::add_entry, find_entry): New functions to
3864 deal with local syms.
3865 (Glink_sym_ent): Add support for local syms.
3866 (Output_data_glink::do_write): Handle ifunc plt entries.
3867 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3868 (Target_powerpc::Scan::local, global): Handle ifunc syms.
3869 (Target_powerpc::Relocate::relocate): Likewise.
3870 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
3871
3872 2012-09-25 Alan Modra <amodra@gmail.com>
3873
3874 * object.h (Sized_relobj_file::adjust_local_symbol,
3875 do_adjust_local_symbol): New functions.
3876 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
3877 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
3878 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
3879 and irregular opd entry spacing.
3880 (Powerpc_relobj::do_read_relocs): Add opd size checks.
3881 (Global_symbol_visitor_opd): New functor.
3882 (Target_powerpc::do_finalize_sections): Omit global symbols defined
3883 on deleted opd entries.
3884
3885 2012-09-15 Jiong Wang <jiwang@tilera.com>
3886
3887 * tilegx.cc: New file.
3888 * Makefile.am (TARGETSOURCES): Add tilegx.cc
3889 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
3890 * configure.tgt: Add entries for tilegx*.
3891 * configure.ac: Likewise.
3892 * Makefile.in: Rebuild.
3893 * configure: Likewise.
3894 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
3895 tilegx.
3896
3897 2012-09-13 Alan Modra <amodra@gmail.com>
3898
3899 * target-reloc.h (scan_relocs): Call scan.local for relocs
3900 against symbols in discarded sections. Pass is_discarded
3901 param.
3902 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
3903 Add is_discarded param.
3904 * powerpc (Target_powerpc::Scan::local): Likewise. Use
3905 is_discarded to flag opd entry as discarded. Don't emit dyn
3906 relocs on such entries.
3907 (Target_powerpc::Scan::global): Similarly detect and handle
3908 such opd entries.
3909 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
3910 opd_ent_. Update all uses.
3911 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
3912 (Target_powerpc::relocate_section): Zero out discarded opd
3913 entry relocs.
3914
3915 2012-09-12 Ian Lance Taylor <iant@google.com>
3916
3917 PR gold/14570
3918 * output.cc: Rename Output_data_got template parameter from size
3919 to got_size for all functions. Compile all variants of
3920 Output_data_got.
3921 (Output_data_got::Got_entry::write): Correct use of size for
3922 symbol value. Use local_is_tls rather than casting to
3923 Sized_relobj_file.
3924 * object.h (class Object): Add local_is_tls and do_local_is_tls.
3925 (class Sized_relobj_file): Add do_local_is_tls.
3926 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
3927
3928 2012-09-11 Alan Modra <amodra@gmail.com>
3929
3930 PR gold/14566
3931 * layout.cc (Layout::set_segment_offsets): When using
3932 common-page-size alignment, ensure we are on a new max-page-size
3933 page.
3934 * output.cc (Output_segment::set_section_addresses): Use
3935 abi_pagesize, not common_pagesize for relro boundary.
3936 (Output_segment::set_offset): Likewise.
3937
3938 2012-09-11 Alan Modra <amodra@gmail.com>
3939
3940 * output.h (Output_data_got::add_global_tls, add_local_tls,
3941 add_local_tls_pair): New functions.
3942 (Output_data_got::add_local_pair_with_rel): Remove second
3943 reloc param. Expand comment.
3944 (Output_data_got::Got_entry): Rename use_plt_offset_ to
3945 use_plt_or_tls_offset_, similarly for constructor param.
3946 (Output_data_got::Got_entry::write): Add got_index param.
3947 * output.cc (Output_data_got::add_global_tls, add_local_tls,
3948 add_local_tls_pair): New functions.
3949 (Output_data_got::Got_entry::write): Handle tls symbols
3950 with use_plt_or_tls_offset_ set specially.
3951 (Output_data_got::add_local_pair_with_rel): Only one reloc.
3952 (Output_data_got::do_write): Replace iterator with index, pass
3953 index to entry write function.
3954 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
3955 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
3956 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
3957 call.
3958 * i386.cc (Target_i386::Scan::local): Likewise.
3959 * sparc.cc (Target_sparc::Scan::local): Likewise.
3960 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
3961 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
3962 do_tls_offset_for_global): New functions.
3963 (Target_powerpc::Scan::local): Correct TLS relocations and got
3964 entry values.
3965 (Target_powerpc::Scan::global): Don't emit unnecessary
3966 dynamic relocations on TLS GOT entries.
3967
3968 2012-09-10 Matthias Klose <doko@ubuntu.com>
3969
3970 * config.in: Disable sanity check for kfreebsd.
3971
3972 2012-09-10 Sterling Augustine <saugustine@google.com>
3973
3974 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
3975 (Gdb_index::pubtypes_read): New parameter.
3976 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
3977 to calls.
3978 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
3979 pubtypes_object_.
3980
3981 2012-09-09 Alan Modra <amodra@gmail.com>
3982
3983 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
3984 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
3985 * gc.h (gc_process_relocs): Call target gc_add_reference.
3986 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
3987 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
3988 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
3989 unnecessary cast.
3990 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
3991 to cater for when we don't need code offset. Update use.
3992 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
3993 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
3994 set_opd_valid): New functions.
3995 (Target_powerpc::do_gc_add_reference): New function.
3996 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
3997 stashed refs.
3998 (Target_powerpc::do_gc_mark_symbol): New function.
3999
4000 2012-09-06 Cary Coutant <ccoutant@google.com>
4001
4002 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
4003 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
4004 (Dwarf_die::skip_attributes): Likewise.
4005 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
4006 * testsuite/gdb_index_test.cc (inline_func_1): New function.
4007 (main): Call it.
4008 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
4009
4010 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
4011
4012 * testsuite/script_test_3.t: Add .got.plt output section
4013 statement.
4014 * testsuite/script_test_4.t: Likewise.
4015
4016 2012-09-05 Alan Modra <amodra@gmail.com>
4017
4018 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
4019 update all uses and lose "enum" when using type.
4020
4021 2012-09-05 Alan Modra <amodra@gmail.com>
4022
4023 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
4024 * configure: Regenerate.
4025 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
4026 (plugin_final_layout.stdout): Likewise.
4027 (memory_test): Set page sizes to 0x1000.
4028 * testsuite/Makefile.in: Regenerate.
4029 * testsuite/discard_locals_test.sh: Add FIXME comment.
4030 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
4031 * testsuite/pr14265.t: Add .got output section statement.
4032 * testsuite/script_test_2.t: Likewise.
4033 * testsuite/script_test_3.t: Likewise.
4034 * testsuite/script_test_4.t: Likewise.
4035 * testsuite/script_test_5.t: Likewise.
4036 * testsuite/script_test_6.t: Likewise.
4037 * testsuite/script_test_7.t: Likewise.
4038 * testsuite/script_test_9.t: Likewise.
4039
4040 2012-09-05 Alan Modra <amodra@gmail.com>
4041
4042 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
4043 (Powerpc_relocate_functions::Status): New typedef.
4044 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4045 (Target_powerpc::Scan::local): Handle REL64.
4046 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
4047 for REL32 and REL64.
4048 (Target_powerpc::symval_for_branch): New function, extracted from..
4049 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
4050 checks. Report overflow errors.
4051
4052 2012-09-05 Alan Modra <amodra@gmail.com>
4053
4054 * object.h (Sized_relobj_file::emit_relocs): Delete.
4055 (Sized_relobj_file::emit_relocs_reltype): Delete.
4056 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
4057 relocate_relocs for --emit-relocs.
4058 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
4059 * output.h: Update comment.
4060 (Output_segment::first_section): New function.
4061 (Output_segment::first_section_load_address): Use first_section.
4062 * output.cc (Output_segment::first_section): New function extracted..
4063 (Output_segment::first_section_load_address): ..from here. Delete.
4064 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
4065 * target.h (Sized_target::relocate_for_relocatable): Likewise.
4066 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
4067 adjust call to target.h function.
4068 * i386.cc (Target_i386): Likewise.
4069 * sparc.cc (Target_sparc): Likewise.
4070 * x86_64.cc (Target_x86_64): Likewise.
4071 * powerpc.cc (Target_powerpc): Likewise.
4072 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
4073 first tls section has section symbol for optimised local dynamic
4074 output relocs.
4075 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
4076 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
4077 optimised tls code.
4078 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
4079 Rename to relocate_relocs. Update error message.
4080
4081 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
4082
4083 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
4084 --just-symbols.
4085
4086 2012-08-31 Alan Modra <amodra@gmail.com>
4087
4088 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
4089 (Powerpc_relobj::toc_base_offset): New stub function.
4090 (Target_powerpc): Add tp_offset, dtp_offset. Rename
4091 got_mod_index_offset to tlsld_got_offset. Update all refs.
4092 (Target_powerpc::Relocate::enum skip_tls): New.
4093 (Target_powerpc::call_tls_get_addr_): New var.
4094 (Target_powerpc::is_branch_reloc): Move to file scope.
4095 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
4096 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
4097 New functions.
4098 (Target_powerpc::enum Got_type): Delete old values, add new ones.
4099 (powerpc_info): Correct common_pagesize for ppc64.
4100 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
4101 (Powerpc_relocate_functions): Add overflow check enums and functions.
4102 Add non-shift version of rela, rela_ua. Delete all rel public
4103 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
4104 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
4105 addr16_ha3, addr14 functions.
4106 (Output_data_got_powerpc::add_constant_pair): New function.
4107 (Output_data_got_powerpc::got_base_offset): Likewise.
4108 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
4109 (instruction constants): Sort, add some more.
4110 (Output_data_glink::do_write): Add and use Address typedef. Use
4111 object->toc_base_offset() stub for 64-bit.
4112 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
4113 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4114 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
4115 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
4116 Always treat .opd relocs as against locally defined symbol.
4117 Correct condition for RELATIVE relocs.
4118 (Target_powerpc::do_finalize_sections): Test for NULL sections.
4119 (Target_powerpc::Relocate::relocate): Use plt call stub as value
4120 for 32-bit syms with a plt entry. Correct ppc64 toc base
4121 calculations. Handle TLS relocs, and more. Add overflow
4122 checking and adjust for Powerpc_relocate_functions changes.
4123 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
4124 Reinstate --emit-relocs code with FIXME.
4125
4126 2012-08-30 Alan Modra <amodra@gmail.com>
4127
4128 * layout.cc (Layout::set_segment_offsets): Set p_align to
4129 abi_pagesize, not common_pagesize.
4130 (Layout::relaxation_loop_body): Similarly use abi_pagesize
4131 to determine whether file header can go in segment.
4132
4133 2012-08-30 Alan Modra <amodra@gmail.com>
4134
4135 * output.h (Output_reloc::Output_reloc <output section>): Add
4136 is_relative param. Adjust calls.
4137 (Output_reloc::add_output_section_relative): New functions.
4138 * output.cc (Output_reloc::Output_reloc <output section>): Handle
4139 is_relative.
4140 (Output_reloc::symbol_value): Handle SECTION_CODE.
4141
4142 2012-08-24 Sriraman Tallam <tmsriram@google.com>
4143
4144 * gold.cc (queue_middle_tasks): Call layout again when unique
4145 segments for sections is desired.
4146 * layout.cc (Layout::Layout): Initialize new members.
4147 (Layout::get_output_section_flags): New function.
4148 (Layout::choose_output_section): Call get_output_section_flags.
4149 (Layout::layout): Make output section for mapping to a unique segment.
4150 (Layout::insert_section_segment_map): New function.
4151 (Layout::attach_allocated_section_to_segment): Make unique segment for
4152 output sections marked so.
4153 (Layout::segment_precedes): Check for unique segments when sorting.
4154 * layout.h (Layout::Unique_segment_info): New struct.
4155 (Layout::Section_segment_map): New typedef.
4156 (Layout::insert_section_segment_map): New function.
4157 (Layout::get_output_section_flags): New function.
4158 (Layout::is_unique_segment_for_sections_specified): New function.
4159 (Layout::set_unique_segment_for_sections_specified): New function.
4160 (Layout::unique_segment_for_sections_specified_): New member.
4161 (Layout::section_segment_map_): New member.
4162 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
4163 Rename is_gc_pass_one to is_pass_one.
4164 Rename is_gc_pass_two to is_pass_two.
4165 Rename is_gc_or_icf to is_two_pass.
4166 Check for which pass based on whether symbols data is present.
4167 Make it two pass when unique segments for sections is desired.
4168 * output.cc (Output_section::Output_section): Initialize new
4169 members.
4170 * output.h (Output_section::is_unique_segment): New function.
4171 (Output_section::set_is_unique_segment): New function.
4172 (Output_section::is_unique_segment_): New member.
4173 (Output_section::extra_segment_flags): New function.
4174 (Output_section::set_extra_segment_flags): New function.
4175 (Output_section::extra_segment_flags_): New member.
4176 (Output_section::segment_alignment): New function.
4177 (Output_section::set_segment_alignment): New function.
4178 (Output_section::segment_alignment_): New member.
4179 (Output_segment::Output_segment): Initialize is_unique_segment_.
4180 (Output_segment::is_unique_segment): New function.
4181 (Output_segment::set_is_unique_segment): New function.
4182 (Output_segment::is_unique_segment_): New member.
4183 * plugin.cc (allow_unique_segment_for_sections): New function.
4184 (unique_segment_for_sections): New function.
4185 (Plugin::load): Add new functions to transfer vector.
4186 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
4187 * Makefile.in: Regenerate.
4188 * testsuite/plugin_final_layout.sh: Check if unique segment
4189 functionality works.
4190 * testsuite/plugin_section_order.c (onload): Check if new interfaces
4191 are available.
4192 (allow_unique_segment_for_sections): New global.
4193 (unique_segment_for_sections): New global.
4194 (claim_file_hook): Call allow_unique_segment_for_sections.
4195 (all_symbols_read_hook): Call unique_segment_for_sections.
4196
4197 2012-08-22 Cary Coutant <ccoutant@google.com>
4198
4199 * layout.cc (Layout::include_section): Don't assert on GROUP
4200 sections with --emit-relocs.
4201
4202 2012-08-21 Cary Coutant <ccoutant@google.com>
4203
4204 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
4205 if --export-dynamic-symbol names an undef symbol.
4206
4207 2012-08-18 Alan Modra <amodra@gmail.com>
4208
4209 * powerpc.cc: Formatting and white space.
4210 (Powerpc_relobj): Rename got2_section_ to special_.
4211 Add opd_ent_shndx_ and opd_ent_off_ vectors.
4212 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
4213 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
4214 (Target_powerpc): Add Address typedef and invalid_address. Use
4215 throughout.
4216 (Target_powerpc::is_branch_reloc): New function.
4217 (Powerpc_relocate_functions): Add Address typedef, use throughout.
4218 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
4219 for dst_mask, value and addend.
4220 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
4221 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
4222 (Output_data_glink::do_write): Correct toc base. Don't try to use
4223 uint16_t for 24-bit offset. Use get_output_section_offset and
4224 check return.
4225 (Target_powerpc::Scan::local): Handle more relocs.
4226 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
4227 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
4228 Plug in toc restoring insn after plt calls. Translate branches
4229 to function descriptor symbols to corresponding entry point.
4230 (Target_powerpc::relocate_for_relocatable): Check return from
4231 get_output_section_offset.
4232 * symtab.h: Comment typo.
4233
4234 2012-08-14 Ian Lance Taylor <iant@google.com>
4235
4236 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
4237 unsupported_relocal_local to call unsupported_reloc_global.
4238
4239 2012-08-14 Nick Clifton <nickc@redhat.com>
4240
4241 PR ld/14265
4242 * script-sections.cc (Sections_element::output_section_name): Add
4243 keep return parameter.
4244 (Output_section_element::match_name): Add keep return parameter.
4245 Return the value of the keep_ member.
4246 * script-sections.h (class Output_section): Update
4247 output_section_name prototype.
4248 * layout.cc (Layout::keep_input_section): New public member
4249 function.
4250 (Layout::choose_output_section): Pass keep parameter to
4251 output_section_name.
4252 * layout.h (class Layout): Add keep_input_section.
4253 * object.cc (Sized_relobj_file::do_layout): Check for kept input
4254 sections.
4255 * testsuite/Makefile.am: Add a test.
4256 * testsuite/Makefile.in: Regenerate.
4257 * testsuite/pr14265.c: Source file for the test.
4258 * testsuite/pr14265.t: Linker script for the test.
4259 * testsuite/pr14265.sh: Shell script for the test.
4260
4261 2012-08-14 Alan Modra <amodra@gmail.com>
4262
4263 * target.h (Target::output_section_name): New function.
4264 (Target::do_output_section_name): New function.
4265 * layout.cc (Layout::choose_output_section): Call the above.
4266 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
4267
4268 2012-08-14 Alan Modra <amodra@gmail.com>
4269
4270 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
4271 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
4272 for replace_constant call.
4273 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
4274 (Output_data_glink::do_print_to_mapfile): New function.
4275 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
4276 (Target_powerpc::Relocate::relocate): Likewise.
4277
4278 2012-08-14 Alan Modra <amodra@gmail.com>
4279
4280 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
4281 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
4282 (Output_data_glink::add_entry,find_entry): Remove shndx param.
4283 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
4284 all references to shndx_. Handle special case for R_PPC_PLTREL24
4285 here.
4286 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
4287 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
4288 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
4289 here.
4290 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
4291 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
4292
4293 2012-08-12 Alan Modra <amodra@gmail.com>
4294
4295 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
4296 (glink insn constants): Use uint32_t.
4297 (Output_data_glink::add_entry): Use insert, not [] operator.
4298
4299 2012-08-11 Alan Modra <amodra@gmail.com>
4300
4301 * object.h (Sized_relobj_file::find_shdr): New function.
4302 (Sized_relobj_file::find_special_sections): New function.
4303 * object.cc (Sized_relobj_file::find_shdr): New function.
4304 (Sized_relobj_file::find_eh_frame): Use find_shdr.
4305 (Sized_relobj_file::find_special_sections): New function, split out..
4306 (Sized_relobj_file::do_read_symbols): ..from here.
4307 * output.h (Output_data_got::replace_constant): New function.
4308 (Output_data_got::num_entries): New function.
4309 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
4310 (Output_data_got::got_offset): Protected rather than private.
4311 (Output_data_got::replace_got_entry): New function.
4312 * output.cc (Output_data_got::replace_got_entry): New function.
4313 * powerpc.cc (class Powerpc_relobj): New.
4314 (class Powerpc_relocate_functions): Delete all psymval variants or
4315 convert to value,addend type. Delete pcrela, pcrela_unaligned.
4316 Implement _ha functions using corresponding _hi function.
4317 (Powerpc_relobj::find_special_sections): New function.
4318 (Target_powerpc::do_make_elf_object): New function.
4319 (class Output_data_got_powerpc): New.
4320 (class Output_data_glink): New.
4321 (class Powerpc_scan_relocatable_reloc): New.
4322 Many more changes througout file.
4323
4324 2012-08-09 Nick Clifton <nickc@redhat.com>
4325
4326 * po/vi.po: Updated Vietnamese translation.
4327
4328 2012-08-07 Ian Lance Taylor <iant@google.com>
4329
4330 * layout.cc (Layout::add_target_dynamic_tags): If
4331 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
4332 plt_rel.
4333
4334 2012-07-30 Nick Clifton <nickc@redhat.com>
4335
4336 * po/gold.pot: Updated template.
4337 * po/es.po: Updated Spanish translation.
4338
4339 2012-07-18 Cary Coutant <ccoutant@google.com>
4340
4341 PR gold/14344
4342 * configure.ac: Add check for -gpubnames support.
4343 * configure: Regenerate.
4344 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
4345 support; force -gno-pubnames.
4346 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
4347 support.
4348 (gdb_index_test_4): New test.
4349 * testsuite/Makefile.in: Regenerate.
4350 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
4351 * testsuite/gdb_index_test_2.sh: Likewise.
4352 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
4353 * testsuite/gdb_index_test_4.sh: New script.
4354 * testsuite/gdb_index_test_comm.sh: New script with common code;
4355 don't look for space after colon.
4356
4357 2012-07-16 Sriraman Tallam <tmsriram@google.com>
4358
4359 * gold.cc (queue_middle_tasks): Update function order only after
4360 deferred objects due to plugins are processed.
4361
4362 2012-07-11 Ian Lance Taylor <iant@google.com>
4363
4364 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
4365 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
4366 (Target_arm::scan_reloc_for_stub): Likewise.
4367 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
4368 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
4369 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
4370 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
4371 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
4372
4373 2012-07-10 Dodji Seketeli <dodji@redhat.com>
4374 Ian Lance Taylor <iant@google.com>
4375
4376 PR gold/14309
4377 * configure.ac: Test whether std::tr1::hash<off_t> works.
4378 * gold.h: Add a specialization for std::tr1::hash<off_t> if
4379 needed.
4380 * output.h (class Output_fill): Add virtual destructor.
4381 * configure, config.in: Rebuild.
4382
4383 2012-06-22 Roland McGrath <mcgrathr@google.com>
4384
4385 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
4386
4387 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
4388
4389 * plugin.cc (Plugin::load): Handle position independent executables.
4390
4391 2012-06-06 Cary Coutant <ccoutant@google.com>
4392
4393 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
4394 add .debug_macro.
4395 (lines_only_debug_sections): Likewise.
4396 (gdb_fast_lookup_sections): New static array.
4397 (is_gdb_debug_section): Rename formal parameter.
4398 (is_lines_only_debug_section): Likewise.
4399 (is_gdb_fast_lookup_section): New function.
4400 (Layout::include_section): Check for ".zdebug_" prefix; pass
4401 section name suffix to is_gdb_debug_section, et al.; check for
4402 fast-lookup sections when building .gdb_index.
4403 * options.h (--strip-debug-gdb): Update GDB version number.
4404
4405 2012-06-06 Cary Coutant <ccoutant@google.com>
4406
4407 * configure.ac: Add check for fallocate.
4408 * configure: Regenerate.
4409 * config.in: Regenerate.
4410
4411 * options.h (class General_options): Add --mmap-output-file and
4412 --posix-fallocate options.
4413 * output.cc: (posix_fallocate): Remove; replace with...
4414 (gold_fallocate): New function.
4415 (Output_file::map_no_anonymous): Call gold_fallocate.
4416 (Output_file::map): Check --mmap-output-file option.
4417
4418 2012-06-05 Jing Yu <jingyu@google.com>
4419
4420 * gold.h (textdomain): Add do {} to empty while(0).
4421 (bindtextdomain): Likewise.
4422
4423 2012-06-04 Cary Coutant <ccoutant@google.com>
4424
4425 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
4426 has_dynsym_index.
4427
4428 2012-05-25 Sriraman Tallam <tmsriram@google.com>
4429
4430 * symtab.cc (Symbol_table::define_special_symbol):
4431 Initialize *poldsym to prevent uninitialized variable errors.
4432
4433 2012-05-23 Cary Coutant <ccoutant@google.com>
4434
4435 * layout.cc (Layout::section_name_mapping): Add rules to handle
4436 exact match on .data.rel.ro.local or .data.rel.ro.
4437 (Layout::output_section_name): Check for exact matches.
4438
4439 2012-05-23 Cary Coutant <ccoutant@google.com>
4440
4441 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
4442 more carefully.
4443
4444 2012-05-22 Cary Coutant <ccoutant@google.com>
4445
4446 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
4447 object before exporting symbol.
4448
4449 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
4450
4451 * testsuite/tls_test.cc: Include "config.h" first.
4452 * testsuite/tls_test_c.c: Likewise.
4453
4454 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
4455 Nick Clifton <nickc@redhat.com>
4456
4457 PR 14072
4458 * configure.in: Add check that sysdep.h has been included before
4459 any system header files.
4460 * configure: Regenerate.
4461 * config.in: Regenerate.
4462
4463 2012-05-14 Cary Coutant <ccoutant@google.com>
4464
4465 * layout.cc (Layout::make_output_section): Mark .tdata section
4466 as RELRO.
4467 * testsuite/relro_test.cc: Add a TLS variable.
4468
4469 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
4470
4471 PR gold/14091
4472 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
4473 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
4474 R_X86_64_64.
4475
4476 2012-05-08 Cary Coutant <ccoutant@google.com>
4477
4478 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
4479 (lines_only_debug_sections): Likewise.
4480
4481 2012-05-02 Roland McGrath <mcgrathr@google.com>
4482
4483 * nacl.cc: New file.
4484 * nacl.h: New file.
4485 * Makefile.am (CCFILES, HFILES): Add them.
4486 * Makefile.in: Regenerate.
4487 * i386.cc (Output_data_plt_i386_nacl): New class.
4488 (Output_data_plt_i386_nacl_exec): New class.
4489 (Output_data_plt_i386_nacl_dyn): New class.
4490 (Target_i386_nacl): New class.
4491 (Target_selector_i386_nacl): New class.
4492 (target_selector_i386): Use it instead of Target_selector_i386.
4493 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
4494 (Target_x86_64_nacl): New class.
4495 (Target_selector_x86_64_nacl): New class.
4496 (target_selector_x86_64, target_selector_x32): Use it instead of
4497 Target_selector_x86_64.
4498 * arm.cc (Output_data_plt_arm_nacl): New class.
4499 (Target_arm_nacl): New class.
4500 (Target_selector_arm_nacl): New class.
4501 (target_selector_arm, target_selector_armbe): Use it instead of
4502 Target_selector_arm.
4503
4504 * target-select.cc (select_target): Take new Input_file* and off_t
4505 arguments, pass them on to recognize method of selector.
4506 * object.cc (make_elf_sized_object): Update caller.
4507 * parameters.cc (parameters_force_valid_target): Likewise.
4508 * incremental.cc (make_sized_incremental_binary): Likewise.
4509 * target-select.h: Update decl.
4510 (Target_selector::recognize): Take new Input_file* argument,
4511 pass it on to do_recognize.
4512 (Target_selector::do_recognize): Take new Input_file* argument.
4513 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
4514 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
4515 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
4516 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
4517
4518 * target.h (Target::Target_info): New members isolate_execinstr
4519 and rosegment_gap.
4520 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
4521 * arm.cc (Target_arm::arm_info): Update initializer.
4522 * i386.cc (Target_i386::i386_info): Likewise.
4523 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
4524 * sparc.cc (Target_sparc::sparc_info): Likewise.
4525 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4526 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
4527 * layout.cc (Layout::attach_allocated_section_to_segment):
4528 Take new const Target* argument. If target->isolate_execinstr(), act
4529 like --rosegment.
4530 (Layout::find_first_load_seg): Take new const Target* argument;
4531 if target->isolate_execinstr(), reject PF_X segments.
4532 (Layout::relaxation_loop_body): Update caller.
4533 (Layout::set_segment_offsets): If target->isolate_execinstr(),
4534 reset file offset to zero when we hit LOAD_SEG, and then do a second
4535 loop over the segments before LOAD_SEG to reassign offsets after
4536 addresses have been determined. Handle target->rosegment_gap().
4537 (Layout::attach_section_to_segment): Take new const Target* argument;
4538 pass it to attach_allocated_section_to_segment.
4539 (Layout::make_output_section): Update caller.
4540 (Layout::attach_sections_to_segments): Take new const Target* argument;
4541 pass it to attach_section_to_segment.
4542 * gold.cc (queue_middle_tasks): Update caller.
4543 * layout.h (Layout): Update method decls with new arguments.
4544
4545 * arm.cc (Target_arm::Target_arm): Take optional argument for the
4546 Target_info pointer to use.
4547 (Target_arm::do_make_data_plt): New virtual method.
4548 (Target_arm::make_data_plt): New method that calls it.
4549 (Target_arm::make_plt_entry): Use it.
4550 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
4551 for the section alignment.
4552 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
4553 method.
4554 (Output_data_plt_arm::first_plt_entry_offset): Call it.
4555 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
4556 method.
4557 (Output_data_plt_arm::get_plt_entry_size): Call it.
4558 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
4559 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
4560 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
4561 method.
4562 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
4563 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
4564 method instead of sizeof(plt_entry).
4565 (Output_data_plt_arm::add_entry): Likewise.
4566 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
4567 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
4568 than static method.
4569 (Target_arm::plt_entry_size): Likewise.
4570 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
4571 Move to ...
4572 (Output_data_plt_arm_standard): ... here, new class.
4573 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
4574 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
4575 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
4576
4577 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4578 Take additional argument for the PLT entry size.
4579 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
4580 Use get_plt_entry_size method rather than plt_entry_size variable.
4581 (Output_data_plt_x86_64::reserve_slot): Likewise.
4582 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
4583 (Output_data_plt_x86_64::add_entry): Likewise.
4584 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
4585 (Output_data_plt_x86_64::address_for_global): Likewise.
4586 (Output_data_plt_x86_64::address_for_local): Likewise.
4587 (Output_data_plt_x86_64::set_final_data_size): Likewise.
4588 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
4589 Make method non-static.
4590 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
4591 method.
4592 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
4593 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
4594 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
4595 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
4596 virtual method.
4597 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
4598 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
4599 virtual method.
4600 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
4601 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
4602 virtual method.
4603 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
4604 (Output_data_plt_x86_64::plt_entry_size)
4605 (Output_data_plt_x86_64::first_plt_entry)
4606 (Output_data_plt_x86_64::plt_entry)
4607 (Output_data_plt_x86_64::tlsdesc_plt_entry)
4608 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
4609 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
4610 (Output_data_plt_x86_64_standard): ... here, new class.
4611 (Target_x86_64::Target_x86_64): Take optional argument for the
4612 Target_info pointer to use.
4613 (Target_x86_64::do_make_data_plt): New virtual method.
4614 (Target_x86_64::make_data_plt): New method to call it.
4615 (Target_x86_64::init_got_plt_for_update): Use that.
4616 Call this->plt_->add_eh_frame method here.
4617 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
4618 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
4619 rather than static method.
4620 (Target_x86_64::plt_entry_size): Likewise.
4621 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
4622 rather than plt_entry_size variable. Move guts of PLT filling to...
4623 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
4624 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
4625 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
4626
4627 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
4628 additional argument for the section alignment.
4629 Don't do add_eh_frame_for_plt here.
4630 (Output_data_plt_i386::first_plt_entry_offset): Make the method
4631 non-static. Use get_plt_entry_size method rather than plt_entry_size
4632 variable.
4633 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
4634 method.
4635 (Output_data_plt_i386::get_plt_entry_size): Call it.
4636 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
4637 (Output_data_plt_i386::add_eh_frame): New method to call it.
4638 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
4639 method.
4640 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
4641 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
4642 method.
4643 (Output_data_plt_i386::fill_plt_entry): New method to call it.
4644 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
4645 method instead of plt_entry_size.
4646 (Output_data_plt_i386::plt_entry_size)
4647 (Output_data_plt_i386::plt_eh_frame_fde_size)
4648 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
4649 (Output_data_plt_i386_standard): ... here, new class.
4650 (Output_data_plt_i386_exec): New class.
4651 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
4652 (Output_data_plt_i386_exec::first_plt_entry): ... here.
4653 (Output_data_plt_i386::exec_plt_entry): Move to ...
4654 (Output_data_plt_i386_exec::plt_entry): ... here.
4655 (Output_data_plt_i386_dyn): New class.
4656 (Output_data_plt_i386::first_plt_entry): Move to ...
4657 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
4658 (Output_data_plt_i386::dyn_plt_entry): Move to ...
4659 (Output_data_plt_i386_dyn::plt_entry): ... here.
4660 (Target_i386::Target_i386): Take optional argument for the Target_info
4661 pointer to use.
4662 (Target_i386::do_make_data_plt): New virtual method.
4663 (Target_i386::make_data_plt): New method to call it.
4664 (Target_i386::make_plt_section): Use that.
4665 Call this->plt_->add_eh_frame method here.
4666 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
4667 rather than plt_entry_size variable.
4668 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
4669 (Output_data_plt_i386::address_for_local): Likewise.
4670 (Output_data_plt_i386::do_write): Likewise.
4671 Move guts of PLT filling to...
4672 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
4673 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
4674 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
4675 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
4676
4677 2012-05-01 Cary Coutant <ccoutant@google.com>
4678
4679 * dwarf_reader.cc (Dwarf_die::read_attributes)
4680 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
4681 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
4682 * reduced_debug_output.cc
4683 (Output_reduced_debug_info_section::get_die_end): Remove
4684 DW_FORM_GNU_ref_index. Add default case.
4685
4686 2012-04-26 Mark Wielaard <mjw@redhat.com>
4687
4688 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
4689 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
4690 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
4691 DW_AT_high_pc as offset from DW_AT_low_pc.
4692
4693 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
4694 * testsuite/Makefile.in: Regenerate.
4695 * testsuite/gdb_index_test_3.c: New test source file.
4696 * testsuite/gdb_index_test_3.sh: New test source file.
4697
4698 2012-04-25 Ian Lance Taylor <iant@google.com>
4699
4700 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
4701 pointer.
4702 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
4703 as a class, not a struct.
4704 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
4705 (Target_arm::apply_cortex_a8_workaround): Likewise.
4706 * gc.h: Declare Reloc_types as a struct, not a class.
4707 * object.h: Declare Symbols_data as a struct.
4708 * reloc.h: Declare Read_relocs_data as a struct.
4709 * target.h: Declare Relocate_info as a struct.
4710
4711 2012-04-24 David S. Miller <davem@davemloft.net>
4712
4713 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
4714 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
4715 and R_SPARC_WPLT30.
4716
4717 2012-04-24 Cary Coutant <ccoutant@google.com>
4718
4719 * incremental-dump.cc (find_input_containing_global): Replace
4720 magic number with symbolic constant.
4721 (dump_incremental_inputs): Update version number.
4722 * incremental.cc (Output_section_incremental_inputs): Update version
4723 number; import symbolic constants from Incremental_inputs_reader.
4724 (Incremental_inputs::create_data_sections): Align relocations
4725 section correctly for 64-bit targets.
4726 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
4727 constants; add padding.
4728 (Output_section_incremental_inputs::write_header): Add assert for
4729 header_size.
4730 (Output_section_incremental_inputs::write_input_files): Add assert
4731 for input_entry_size.
4732 (Output_section_incremental_inputs::write_info_blocks): Add padding;
4733 add assert for object_info_size, input_section_entry_size,
4734 global_sym_entry_size.
4735 * incremental.h (Incremental_inputs_reader): Add symbolic constants
4736 for data structure sizes; use them.
4737 (Incremental_input_entry_reader): Import symbolic constants from
4738 Incremental_inputs_reader; use them.
4739
4740 2012-04-23 David S. Miller <davem@davemloft.net>
4741
4742 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
4743 and elf_flags_set_.
4744 (Target_sparc::Target_sparc): Initialize new fields.
4745 (Target_sparc::do_make_elf_object): New function.
4746 (Target_sparc::do_adjust_elf_header): New function.
4747
4748 2012-04-23 Cary Coutant <ccoutant@google.com>
4749
4750 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
4751 CU range table of gdb index.
4752
4753 2012-04-20 David S. Miller <davem@davemloft.net>
4754
4755 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
4756 instead of false.
4757
4758 2012-04-16 David S. Miller <davem@davemloft.net>
4759
4760 * sparc.cc (Target_sparc::got_address): New function.
4761 (Sparc_relocate_functions::gdop_hix22): New function.
4762 (Sparc_relocate_functions::gdop_lox10): New function.
4763 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
4764 relocs.
4765 (Target_sparc::Scan::local): Likewise if the global symbol is not
4766 preemptible and is not IFUNC.
4767 (Target_sparc::Relocate::relocate): Perform GOTDATA code
4768 transformations for local and non-preemptible non-IFUNC global
4769 symbols.
4770
4771 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
4772 writing out 64-bit part of ranges.
4773
4774 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
4775 -fpic and -fpie respectively.
4776 * Makefile.in: Regenerate.
4777
4778 * sparc.cc (class Target_sparc): Add rela_ifunc_.
4779 (Target_sparc::Target_sparc): Initialize new field.
4780 (Target_sparc::do_plt_section_for_global): New function.
4781 (Target_sparc::do_plt_section_for_local): New function.
4782 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
4783 (Target_sparc::make_plt_section): New function, broken out of
4784 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
4785 (Target_sparc::make_plt_entry): Call make_plt_section.
4786 (Target_sparc::make_local_ifunc_plt_entry): New function.
4787 (Target_sparc::rela_ifunc_section): New function.
4788 (Target_sparc::plt_section): Remove const.
4789 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
4790 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
4791 and ifunc_count_ fields.
4792 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
4793 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
4794 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
4795 (Output_data_plt_sparc::rela_ifunc): New function.
4796 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
4797 (Output_data_plt_sparc::has_ifunc_section): New function.
4798 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
4799 (Output_data_plt_sparc::address_for_global): New function.
4800 (Output_data_plt_sparc::address_for_local): New function.
4801 (Output_data_plt_sparc::plt_index_to_offset): New function.
4802 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
4803 and entry_count.
4804 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
4805 entry_count.
4806 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
4807 R_SPARC_JMP_IREL to switch.
4808 (Target_sparc::Scan::check_non_pic): Likewise.
4809 (Target_sparc::Scan::local): Handle IFUNC symbols.
4810 (Target_sparc::Scan::local): Likewise.
4811 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
4812 and plt_address_for_local.
4813 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
4814 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
4815
4816 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
4817 (class Output_data_reloc): Adjust calls to Output_reloc_type.
4818 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
4819 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
4820 global relocs too.
4821 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
4822 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
4823 calls.
4824 * sparc.cc (Target_sparc::Scan::global): Likewise.
4825 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4826
4827 2012-04-16 Cary Coutant <ccoutant@google.com>
4828
4829 * archive.cc (Library_base::should_include_member): Check for
4830 --export-dynamic-symbol.
4831 * options.h (class General_options): Add --export-dynamic-symbol.
4832 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
4833 --export-dynamic-symbol.
4834 (Symbol_table::gc_mark_undef_symbols): Likewise.
4835 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
4836
4837 2012-04-12 David S. Miller <davem@davemloft.net>
4838
4839 * sparc.cc (Reloc::wdisp10): New relocation method.
4840 (Reloc::h34): Likewise.
4841 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
4842 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
4843 R_SPARC_WDISP10.
4844 (Target_sparc::Scan::local): Likewise.
4845 (Target_sparc::Scan::global): Likewise.
4846 (Target_sparc::Relocate::relocate): Likewise.
4847
4848 2012-04-09 Cary Coutant <ccoutant@google.com>
4849
4850 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
4851 low_pc == 0.
4852
4853 2012-04-06 Ian Lance Taylor <iant@google.com>
4854
4855 * timer.cc: #include <unistd.h>.
4856
4857 2012-04-06 Roland McGrath <mcgrathr@google.com>
4858
4859 * configure.in (AC_CHECK_HEADERS): Add locale.h.
4860 * config.in: Regenerate.
4861 * configure: Regenerate.
4862
4863 2012-04-05 Nick Clifton <nickc@redhat.com>
4864
4865 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
4866 (AM_LC_MESSAGES): Add.
4867 * aclocal.m4: Regenerate.
4868 * config.in: Regenerate.
4869 * configure: Regenerate.
4870
4871 2012-03-21 Cary Coutant <ccoutant@google.com>
4872
4873 * Makefile.am: Add gdb-index.cc, gdb-index.h.
4874 * Makefile.in: Regenerate.
4875 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
4876 (Sized_elf_reloc_mapper::symbol_section): New function.
4877 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
4878 (make_elf_reloc_mapper): New function.
4879 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
4880 (Dwarf_abbrev_table::do_read_abbrevs): New function.
4881 (Dwarf_abbrev_table::do_get_abbrev): New function.
4882 (Dwarf_ranges_table::read_ranges_table): New function.
4883 (Dwarf_ranges_table::read_range_list): New function.
4884 (Dwarf_pubnames_table::read_section): New function.
4885 (Dwarf_pubnames_table::read_header): New function.
4886 (Dwarf_pubnames_table::next_name): New function.
4887 (Dwarf_die::Dwarf_die): New function.
4888 (Dwarf_die::read_attributes): New function.
4889 (Dwarf_die::skip_attributes): New function.
4890 (Dwarf_die::set_name): New function.
4891 (Dwarf_die::set_linkage_name): New function.
4892 (Dwarf_die::attribute): New function.
4893 (Dwarf_die::string_attribute): New function.
4894 (Dwarf_die::int_attribute): New function.
4895 (Dwarf_die::uint_attribute): New function.
4896 (Dwarf_die::ref_attribute): New function.
4897 (Dwarf_die::child_offset): New function.
4898 (Dwarf_die::sibling_offset): New function.
4899 (Dwarf_info_reader::check_buffer): New function.
4900 (Dwarf_info_reader::parse): New function.
4901 (Dwarf_info_reader::do_parse): New function.
4902 (Dwarf_info_reader::do_read_string_table): New function.
4903 (Dwarf_info_reader::lookup_reloc): New function.
4904 (Dwarf_info_reader::get_string): New function.
4905 (Dwarf_info_reader::visit_compilation_unit): New function.
4906 (Dwarf_info_reader::visit_type_unit): New function.
4907 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
4908 Sized_elf_reloc_mapper.
4909 (Sized_dwarf_line_info::symbol_section): Remove function.
4910 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
4911 (Sized_dwarf_line_info::read_line_mappings): Remove object
4912 parameter, adjust callers.
4913 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
4914 * dwarf_reader.h: Include <sys/types.h>.
4915 (class Track_relocs): Remove forward declaration.
4916 (class Elf_reloc_mapper): New class.
4917 (class Sized_elf_reloc_mapper): New class.
4918 (class Dwarf_abbrev_table): New class.
4919 (class Dwarf_range_list): New class.
4920 (class Dwarf_ranges_table): New class.
4921 (class Dwarf_pubnames_table): New class.
4922 (class Dwarf_die): New class.
4923 (class Dwarf_info_reader): New class.
4924 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
4925 (Sized_dwarf_line_info::symbol_section): Remove member function.
4926 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
4927 base class.
4928 * gdb-index.cc: New source file.
4929 * gdb-index.h: New source file.
4930 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
4931 and .debug_types sections, call Layout::add_to_gdb_index.
4932 (Sized_relobj_incr::do_section_name): Implement.
4933 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
4934 return type; Implement.
4935 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
4936 return type.
4937 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
4938 parameter list and return type.
4939 (Sized_incr_dynobj::do_section_contents): Likewise.
4940 * layout.cc: Include gdb-index.h.
4941 (Layout::Layout): Initialize gdb_index_data_.
4942 (Layout::init_fixed_output_section): Check for .gdb_index section.
4943 (Layout::add_to_gdb_index): New function. Instantiate.
4944 * layout.h: Add forward declaration for class Gdb_index.
4945 (Layout::add_to_gdb_index): New member function.
4946 (Layout::gdb_index_data_): New data member.
4947 * main.cc: Include gdb-index.h.
4948 (main): Print statistics for gdb index.
4949 * object.cc (Object::section_contents): Move code into
4950 do_section_contents.
4951 (need_decompressed_section): Check for sections needed when building
4952 gdb index.
4953 (build_compressed_section_map): Likewise.
4954 (Sized_relobj_file::do_read_symbols): Need local symbols when building
4955 gdb index.
4956 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
4957 sections; call Layout::add_to_gdb_index.
4958 (Sized_relobj_file::do_decompressed_section_contents): Call
4959 do_section_contents directly.
4960 * object.h (Object::do_section_contents): Adjust parameter list and
4961 return type.
4962 (Object::do_decompressed_section_contents): Call do_section_contents
4963 directly.
4964 (Sized_relobj_file::do_section_contents): Adjust parameter list and
4965 return type.
4966 * options.h (class General_options): Add --gdb-index option.
4967 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
4968 list and return type.
4969 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
4970 * reloc.h (Track_relocs::checkpoint): New function.
4971 (Track_relocs::reset): New function.
4972
4973 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
4974 New test cases.
4975 * testsuite/Makefile.in: Regenerate.
4976 * testsuite/gdb_index_test.cc: New test source file.
4977 * testsuite/gdb_index_test_1.sh: New test source file.
4978 * testsuite/gdb_index_test_2.sh: New test source file.
4979
4980 2012-03-19 Doug Kwan <dougkwan@google.com>
4981
4982 * arm.cc (Target_arm::do_define_standard_symbols): New method.
4983 (Target_arm::do_finalize_sections): Remove code which defines
4984 __exidx_start and __exidx_end. Make symbol table parameter
4985 anonymous as it is not used.
4986 * gold.cc (queue_middle_tasks): Call target hook to define any
4987 target-specific symbols.
4988 * target.h (Target::define_standard_symbols): New method.
4989 (Target::do_define_standard_symbols): Same.
4990 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
4991 * testsuite/Makefile.in: Regenerate.
4992 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
4993 and __exidx_end.
4994 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
4995 relocations are generated for __exidx_start and __exidx_end.
4996
4997 2012-03-16 Doug Kwan <dougkwan@google.com>
4998
4999 * testsuite/Makefile.am: Disable test initpri3b.
5000 * testsuite/Makefile.in: Regenerate.
5001
5002 2012-03-15 Doug Kwan <dougkwan@google.com>
5003
5004 * arm.cc (Target_arm::got_section): Make .got section read-only
5005 if -z now is given.
5006
5007 2012-03-15 Ian Lance Taylor <iant@google.com>
5008
5009 PR gold/13850
5010 * layout.cc (Layout::make_output_section): Correctly mark
5011 SHT_INIT_ARRAY, et. al., as relro.
5012
5013 2012-03-14 Doug Kwan <dougkwan@google.com>
5014
5015 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
5016 dynamic relocations for protected symbols in shared objects.
5017
5018 2012-03-13 Ian Lance Taylor <iant@google.com>
5019
5020 * resolve.cc (Symbol_table::resolve): When merging common symbols,
5021 keep the larger alignment.
5022
5023 2012-03-12 Cary Coutant <ccoutant@google.com>
5024
5025 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
5026 handling of DW_LNE_define_file.
5027
5028 2012-03-12 Cary Coutant <ccoutant@google.com>
5029
5030 * reduced_debug_output.cc
5031 (Output_reduced_debug_info_section::get_die_end): Add new FORM
5032 codes to switch.
5033
5034 2012-02-29 Cary Coutant <ccoutant@google.com>
5035
5036 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
5037
5038 2012-02-29 Cary Coutant <ccoutant@google.com>
5039
5040 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5041 Call Object::decompressed_section_contents.
5042 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
5043 New dtor.
5044 (Sized_dwarf_line_info::buffer_start_): New data member.
5045 * merge.cc (Output_merge_data::do_add_input_section): Call
5046 Object::decompressed_section_contents.
5047 (Output_merge_string::do_add_input_section): Likewise.
5048 * object.cc (need_decompressed_section): New function.
5049 (build_compressed_section_map): Decompress sections needed later.
5050 (Sized_relobj_file::do_decompressed_section_contents): New function.
5051 (Sized_relobj_file::do_discard_decompressed_sections): New function.
5052 * object.h (Object::decompressed_section_contents): New function.
5053 (Object::discard_decompressed_sections): New function.
5054 (Object::do_decompressed_section_contents): New function.
5055 (Object::do_discard_decompressed_sections): New function.
5056 (Compressed_section_info): New type.
5057 (Compressed_section_map): Include decompressed section contents.
5058 (Sized_relobj_file::do_decompressed_section_contents): New function.
5059 (Sized_relobj_file::do_discard_decompressed_sections): New function.
5060
5061 2012-02-16 Cary Coutant <ccoutant@google.com>
5062
5063 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
5064 * testsuite/Makefile.in: Regenerate.
5065
5066 2012-02-14 Cary Coutant <ccoutant@google.com>
5067
5068 * options.cc (General_options::finalize): Disallow -pie and -static.
5069
5070 2012-02-03 Doug Kwan <dougkwan@google.com>
5071
5072 * arm.cc (Arm_relocate_functions::abs8,
5073 Arm_relocate_functions::abs16): Use
5074 Bits::has_signed_unsigned_overflow32.
5075 (Arm_relocate_functions::thm_abs8): Correct range of
5076 overflow check.
5077 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
5078 in assertions.
5079
5080 2012-02-02 Doug Kwan <dougkwan@google.com>
5081
5082 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
5083 position independent outputs, not just shared objects.
5084
5085 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
5086
5087 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
5088 * configure: Regenerated.
5089
5090 2012-01-27 Ian Lance Taylor <iant@google.com>
5091
5092 * reloc.h (Bits): New class with static functions, copied from
5093 namespace utils in arm.cc.
5094 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
5095 instead.
5096
5097 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
5098
5099 * incremental.cc (write_info_blocks): Correct relocation offset.
5100
5101 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
5102
5103 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
5104 (Relocate::tls_gd_to_le): Likewise.
5105
5106 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
5107
5108 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
5109
5110 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
5111
5112 * configure.ac: Check if -mcmodel=medium works.
5113 * configure: Regenerated.
5114
5115 2012-01-24 Cary Coutant <ccoutant@google.com>
5116
5117 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
5118 definition and ...
5119 (read_unsigned_LEB_128_x): ... this new function.
5120 (read_signed_LEB_128): Replaced with inline definition and ...
5121 (read_signed_LEB_128_x): ... this new function.
5122 * int_encoding.h (read_unsigned_LEB_128_x): New function.
5123 (read_unsigned_LEB_128): Add inline definition.
5124 (read_signed_LEB_128_x): New function.
5125 (read_signed_LEB_128): Add inline definition.
5126 * testsuite/Makefile.am (leb128_unittest): New unit test.
5127 * testsuite/Makefile.in: Regenerate.
5128 * testsuite/leb128_unittest.cc: New unit test.
5129
5130 2012-01-23 Ian Lance Taylor <iant@google.com>
5131
5132 PR gold/13617
5133 * i386.cc (Target_i386::do_code_fill): When using a jmp
5134 instruction, pad with nop instructions.
5135 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5136
5137 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
5138
5139 * x86_64.cc (gc_process_relocs): Add typename on types used in
5140 template.
5141 (scan_relocs): Likewise.
5142 (relocate_section): Likewise.
5143 (apply_relocation): Likewise.
5144
5145 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
5146
5147 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
5148 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
5149 under x32.
5150
5151 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
5152
5153 * x86_64.cc: Initial support for x32.
5154
5155 2012-01-03 Cary Coutant <ccoutant@google.com>
5156
5157 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
5158 Use abstract base class for GOT.
5159 * gold/output.h (class Output_data_got_base): New abstract base class.
5160 (class Output_data_got): Derive from new base class, adjust ctors.
5161 (Output_data_got::reserve_slot): Make virtual; rename to
5162 do_reserve_slot; Adjust callers.
5163 * gold/target.h (Sized_target::init_got_plt_for_update): Return
5164 pointer to abstract base class.
5165 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
5166
5167 2011-12-18 Ian Lance Taylor <iant@google.com>
5168
5169 * object.h (Relobj::local_symbol_value): New function.
5170 (Relobj::local_plt_offset): New function.
5171 (Relobj::local_has_got_offset): New function.
5172 (Relobj::local_got_offset): New function.
5173 (Relobj::set_local_got_offset): New function.
5174 (Relobj::do_local_symbol_value): New pure virtual function.
5175 (Relobj::do_local_plt_offset): Likewise.
5176 (Relobj::do_local_has_got_offset): Likewise.
5177 (Relobj::do_local_got_offset): Likewise.
5178 (Relobj::do_set_local_got_offset): Likewise.
5179 (Sized_relobj::do_local_has_got_offset): Rename from
5180 local_has_got_offset.
5181 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
5182 (Sized_relobj::do_set_local_got_offset): Rename from
5183 set_local_got_offset.
5184 (Sized_relobj_file::do_local_plt_offset): Rename from
5185 local_plt_offset.
5186 (Sized_relobj_file::do_local_symbol_value): New function.
5187 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
5188 local_plt_offset.
5189 * output.cc (Output_data_got::Got_entry::write): Change object to
5190 Relobj. Use local_symbol_value.
5191 (Output_data_got::add_global_with_rel): Change rel_dyn to
5192 Output_data_reloc_generic*. Use add_global_generic.
5193 (Output_data_got::add_global_with_rela): Remove. Change all
5194 callers to use add_global_with_rel.
5195 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
5196 Output_data_reloc_generic*. Use add_global_generic.
5197 (Output_data_got::add_global_pair_with_rela): Remove. Change all
5198 callers to use add_global_pair_with_rel.
5199 (Output_data_got::add_local): Change object to Relobj*.
5200 (Output_data_got::add_local_plt): Likewise.
5201 (Output_data_got::add_local_with_rel): Change object to Relobj*,
5202 change rel_dyn to Output_data_reloc_generic*. Use
5203 add_local_generic.
5204 (Output_data_got::add_local_with_rela): Remove. Change all
5205 callers to use all_local_with_rel.
5206 (Output_data_got::add_local_pair_with_rel): Change object to
5207 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
5208 add_output_section_generic.
5209 (Output_data_got::add_local_pair_with_rela): Remove. Change all
5210 callers to use add_local_pair_with_rel.
5211 (Output_data_got::reserve_local): Change object to Relobj*.
5212 * output.h: (class Output_data_reloc_generic): Add pure virtual
5213 declarations for add_global_generic, add_local_generic,
5214 add_output_section_generic.
5215 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
5216 functions for Output_data_reloc_generic. Update declarations for
5217 changes listed in output.cc.
5218 (class Output_data_got): Change template parameter to got_size.
5219 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
5220 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
5221 function.
5222 (Sized_relobj_incr::do_local_plt_offset): New function.
5223 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
5224 add_global_generic.
5225
5226 2011-12-17 Cary Coutant <ccoutant@google.com>
5227
5228 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
5229 * resolve.cc (Symbol_table::resolve): Likewise.
5230 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
5231 arrays.
5232 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5233
5234 2011-12-16 Ian Lance Taylor <iant@google.com>
5235
5236 * output.h (Output_data_reloc_generic::add): Only call
5237 add_dynamic_reloc if this is a dynamic reloc section.
5238
5239 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
5240
5241 PR gold/13505
5242 * target-reloc.h (apply_relocation): Replace <64, false> with
5243 <size, big_endian>.
5244
5245 2011-11-25 Nick Clifton <nickc@redhat.com>
5246
5247 * po/it.po: New Italian translation.
5248
5249 2011-11-17 Sterling Augustine <saugustine@google.com>
5250
5251 * script.cc (script_include_directive): Implement.
5252 (read_script_file): New local variables name and search_path. Update
5253 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
5254 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
5255 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
5256
5257 2011-11-11 Sterling Augustine <saugustine@google.com>
5258
5259 * yyscript.y (section_cmd): Add support for INCLUDE directive.
5260 (file_or_sections_cmd): Likewise.
5261
5262 2011-11-11 Doug Kwan <dougkwan@google.com>
5263
5264 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
5265 if --just-symbols is given.
5266
5267 2011-11-10 Doug Kwan <dougkwan@google.com>
5268
5269 PR gold/13362
5270 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
5271 when processing data relocs.
5272 * reloc.h (Relocate_functions::rel_unaligned): New method.
5273 (Relocate_functions::pcrel_unaligned): Ditto.
5274 (Relocate_functions::rel32_unaligned): Ditto.
5275 (Relocate_functions::pcrel32_unaligned): Ditto.
5276
5277 2011-11-09 Doug Kwan <dougkwan@google.com>
5278
5279 PR gold/13362
5280 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
5281 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
5282 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
5283 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5284 (Relocate_functions::rel_unaligned): New.
5285 (Relocate_functions::rel32_unaligned): New.
5286 * target-reloc.h (relocate_for_relocatable): Add code to handle
5287 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5288 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
5289 arm_unaligned_reloc_r): New targets.
5290 * testsuite/Makefile.in: Regenerate.
5291 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
5292 linking.
5293
5294 2011-11-02 Ian Lance Taylor <iant@google.com>
5295
5296 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
5297 NATIVE_LINKER.
5298 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
5299 * options.cc (General_options::finalize): Use library search path
5300 from configure script if specified. If not native and no sysroot,
5301 only search TOOLLIBDIR.
5302 * options.h (Search_directory::Search_directory): Change name to
5303 const std::string&.
5304 (General_options::add_to_library_path_with_sysroot): Change arg to
5305 const std::string&.
5306 * configure, Makefile.in, config.in: Rebuild.
5307
5308 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
5309
5310 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
5311 we are working around the ARM1176 Erratum.
5312 * options.h (General_options::fix_arm1176): Add option.
5313 * testsuite/Makefile.am: Add testcases, and keep current ones
5314 working.
5315 * testsuite/Makefile.in: Regenerate.
5316 * testsuite/arm_fix_1176.s: New file.
5317 * testsuite/arm_fix_1176.sh: Likewise.
5318
5319 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
5320
5321 * arm.cc (Target_arm::Target_arm): Remove initialisation of
5322 may_use_blx_.
5323 (Target_arm::may_use_blx): Remove method.
5324 (Target_arm::set_may_use_blx): Likewise.
5325 (Target_arm::may_use_v4t_interworking): New method.
5326 (Target_arm::may_use_v5t_interworking): Likewise.
5327 (Target_arm::may_use_blx_): Remove member variable.
5328 (Arm_relocate_functions::arm_branch_common): Check for v5T
5329 interworking.
5330 (Arm_relocate_functions::thumb_branch_common): Likewise.
5331 (Reloc_stub::stub_type_for_reloc): Likewise.
5332 (Target_arm::do_finalize_sections): Correct interworking checks.
5333 * testsuite/Makefile.am: Add new tests.
5334 * testsuite/Makefile.in: Regenerate.
5335 * testsuite/arm_farcall_arm_arm.s: New test.
5336 * testsuite/arm_farcall_arm_arm.sh: Likewise.
5337 * testsuite/arm_farcall_arm_thumb.s: Likewise.
5338 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
5339 * testsuite/arm_farcall_thumb_arm.s: Likewise.
5340 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
5341 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
5342 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
5343
5344 2011-10-31 Cary Coutant <ccoutant@google.com>
5345
5346 PR gold/13023
5347 * expression.cc (Expression::eval_with_dot): Add
5348 is_section_dot_assignment parameter.
5349 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
5350 absolute and assigning to dot within a section.
5351 * script-sections.cc
5352 (Output_section_element_assignment::set_section_addresses): Pass
5353 dot_section to set_if_absolute.
5354 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
5355 as is_section_dot_assignment flag to eval_with_dot.
5356 (Output_section_element_dot_assignment::set_section_addresses):
5357 Likewise.
5358 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
5359 parameter. Also set value if relative to dot_section; set the
5360 symbol's output_section.
5361 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
5362 parameter. Adjust all callers.
5363 (Expression::eval_maybe_dot): Likewise.
5364 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
5365 Adjust all callers.
5366 * testsuite/script_test_2.t: Test assignment of an absolute value
5367 to dot within an output section element.
5368
5369 2011-10-31 Cary Coutant <ccoutant@google.com>
5370
5371 * options.h (class General_options): Add --[no-]gnu-unique options.
5372 * symtab.cc (Symbol_table::sized_write_globals): Convert
5373 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
5374
5375 2011-10-31 Cary Coutant <ccoutant@google.com>
5376
5377 PR gold/13359
5378 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
5379 unnecessary assertion.
5380 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
5381
5382 2011-10-31 Sriraman Tallam <tmsriram@google.com>
5383
5384 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5385 gc_mark_symbol.
5386 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5387 gc_mark_symbol.
5388 Change to just keep the section associated with symbol.
5389 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
5390 they are externally visible and --export-dynamic is turned on.
5391 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
5392
5393 2011-10-19 Ian Lance Taylor <iant@google.com>
5394
5395 PR gold/13163
5396 * script-sections.cc
5397 (Output_section_element_dot_assignment::needs_output_section): New
5398 function.
5399
5400 2011-10-19 Ian Lance Taylor <iant@google.com>
5401
5402 PR gold/13204
5403 * layout.cc (Layout::segment_precedes): Don't assert failure if a
5404 --section-start option was seen.
5405 * options.h (General_options::any_section_start): New function.
5406
5407 2011-10-18 David S. Miller <davem@davemloft.net>
5408
5409 PR binutils/13301
5410 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
5411 member to track relocation locations that have moved during TLS
5412 reloc optimizations.
5413 (Target_sparc::Relocate::Relocate): Initialize to NULL.
5414 (Target_sparc::Relocate::relocate): Adjust view down by 4
5415 bytes if it matches reloc_adjust_addr_.
5416 (Target_sparc::Relocate::relocate_tls): Always move the
5417 __tls_get_addr call delay slot instruction forward 4 bytes when
5418 performing relaxation.
5419
5420 2011-10-18 Cary Coutant <ccoutant@google.com>
5421
5422 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
5423 (Output_file::map_no_anonymous): Check for non-zero
5424 return code from posix_fallocate.
5425
5426 2011-10-17 Cary Coutant <ccoutant@google.com>
5427
5428 PR gold/13245
5429 * plugin.cc (is_visible_from_outside): Check for symbols
5430 referenced from dynamic objects.
5431 * resolve.cc (Symbol_table::resolve): Don't count references
5432 from dynamic objects as references from real ELF files.
5433 * testsuite/plugin_test_2.sh: Adjust expected result.
5434
5435 2011-10-17 Cary Coutant <ccoutant@google.com>
5436
5437 * gold.cc: Include timer.h.
5438 (queue_middle_tasks): Stamp time.
5439 (queue_final_tasks): Likewise.
5440 * main.cc (main): Store timer in parameters. Print timers
5441 for each pass.
5442 * parameters.cc (Parameters::Parameters): Initialize timer_.
5443 (Parameters::set_timer): New function.
5444 (set_parameters_timer): New function.
5445 * parameters.h (Parameters::set_timer): New function.
5446 (Parameters::timer): New function.
5447 (Parameters::timer_): New data member.
5448 (set_parameters_timer): New function.
5449 * timer.cc (Timer::stamp): New function.
5450 (Timer::get_pass_time): New function.
5451 * timer.h (Timer::stamp): New function.
5452 (Timer::get_pass_time): New function.
5453 (Timer::pass_times_): New data member.
5454
5455 2011-10-17 Cary Coutant <ccoutant@google.com>
5456
5457 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
5458 task for members of lib groups.
5459
5460 2011-10-17 Cary Coutant <ccoutant@google.com>
5461
5462 PR gold/13288
5463 * fileread.cc (File_read::find_view): Add assert.
5464 (File_read::make_view): Move bounds check (replace with assert)...
5465 (File_read::find_or_make_view): ... to here.
5466
5467 2011-10-12 Cary Coutant <ccoutant@google.com>
5468
5469 * output.cc (Output_file::open_base_file): Handle case where
5470 ::read returns less than requested size.
5471
5472 2011-10-10 Cary Coutant <ccoutant@google.com>
5473
5474 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
5475 Initialize defined_count_.
5476 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
5477 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
5478 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
5479 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
5480 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
5481 * incremental.h (Sized_relobj_incr::defined_count_): New data
5482 member.
5483 (Sized_incr_dynobj::defined_count_): New data member.
5484 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
5485 Return zeroes instead of internal error.
5486
5487 2011-10-10 Cary Coutant <ccoutant@google.com>
5488
5489 PR gold/13249
5490 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
5491 (Output_reloc::symbol_value): Return PLT offset if flag is set.
5492 * output.h (class Output_reloc): Add use_plt_offset flag.
5493 (Output_reloc::type_): Adjust size of bit field.
5494 (Output_reloc::use_plt_offset_): New bit field.
5495 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
5496 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
5497 flag. Adjust all callers.
5498 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
5499 creating RELATIVE relocations.
5500
5501 2011-10-10 Nick Clifton <nickc@redhat.com>
5502
5503 * po/es.po: Updated Spanish translation.
5504 * po/fi.po: Updated Finnish translation.
5505
5506 2011-10-03 Diego Novillo <dnovillo@google.com>
5507
5508 * options.cc (parse_uint): Fix dereference of RETVAL.
5509
5510 2011-09-29 Sriraman Tallam <tmsriram@google.com>
5511
5512 * layout.h (section_order_map_): New member.
5513 (get_section_order_map): New member function.
5514 * output.cc (Output_section::add_input_section): Check for patterns
5515 only when --section-ordering-file is specified.
5516 * gold.cc (queue_middle_tasks): Delay updating order of sections till
5517 output_sections have been formed.
5518 * layout.cc (Layout_Layout): Initialize section_order_map_.
5519 * plugin.cc (update_section_order): Store order in order_map. Do not
5520 update the order.
5521 * testsuite/Makefile.am: Add test case for plugin_final_layout.
5522 * testsuite/Makefile.in: Regenerate.
5523 * testsuite/plugin_section_order.c: New file.
5524 * testsuite/plugin_final_layout.cc: New file.
5525 * testsuite/plugin_final_layout.sh: New file.
5526
5527 2011-09-29 Cary Coutant <ccoutant@google.com>
5528
5529 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5530 Check for NULL.
5531 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
5532 symbols during incremental update.
5533 (Symbol_table::add_from_dynobj): Likewise.
5534
5535 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5536 Ian Lance Taylor <iant@google.com>
5537
5538 * symtab.cc (Symbol_table::define_special_symbol): Always
5539 canonicalize version string.
5540
5541 2011-09-26 Cary Coutant <ccoutant@google.com>
5542
5543 * gold.cc (queue_initial_tasks): Move option checks ...
5544 * options.cc (General_options::finalize): ... to here. Disable
5545 some options; make others fatal.
5546
5547 2011-09-26 Cary Coutant <ccoutant@google.com>
5548
5549 gcc PR lto/47247
5550 * plugin.cc (get_symbols_v2): New function.
5551 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
5552 (is_referenced_from_outside): New function.
5553 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
5554 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
5555 (get_symbols): Pass version parameter.
5556 (get_symbols_v2): New function.
5557 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
5558 parameter.
5559 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
5560 (onload): Add LDPT_GET_SYMBOLS_V2.
5561 (all_symbols_read_hook): Use get_symbols_v2; check for
5562 LDPR_PREVAILING_DEF_IRONLY_EXP.
5563 * testsuite/plugin_test_3.sh: Update expected results.
5564
5565 2011-09-23 Simon Baldwin <simonb@google.com>
5566
5567 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
5568 configuration options.
5569 * configure: Regenerate.
5570 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
5571 * Makefile.in: Regenerate.
5572 * testsuite/Makefile.in: Regenerate.
5573
5574 2011-09-19 Sriraman Tallam <tmsriram@google.com>
5575
5576 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
5577
5578 2011-09-19 Cary Coutant <ccoutant@google.com>
5579
5580 * incremental.cc (can_incremental_update): Fix typo in comment.
5581 * incremental.h (can_incremental_update): Likewise.
5582
5583 2011-09-18 Cary Coutant <ccoutant@google.com>
5584
5585 * incremental.cc (can_incremental_update): New function.
5586 * incremental.h (can_incremental_update): New function.
5587 * layout.cc (Layout::init_fixed_output_section): Call it.
5588 (Layout::make_output_section): Don't allow patch space in .eh_frame.
5589 * object.cc (Sized_relobj_file::do_layout): Call
5590 can_incremental_update.
5591
5592 2011-09-13 Cary Coutant <ccoutant@google.com>
5593
5594 * configure.ac: Check for glibc support for gnu_indirect_function
5595 support with static linking, setting automake conditional
5596 IFUNC_STATIC.
5597 * Makefile.in: Regenerate.
5598 * configure: Regenerate.
5599
5600 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
5601 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
5602 for IFUNC_STATIC.
5603 * testsuite/Makefile.in: Regenerate.
5604
5605 2011-09-13 Cary Coutant <ccoutant@google.com>
5606
5607 * incremental.cc (Sized_relobj_incr::do_layout): Call
5608 report_comdat_group for kept comdat sections.
5609 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
5610 * testsuite/Makefile.in: Regenerate.
5611 * testsuite/incr_comdat_test_1.cc: New source file.
5612 * testsuite/incr_comdat_test_2_v1.cc: New source file.
5613 * testsuite/incr_comdat_test_2_v2.cc: New source file.
5614 * testsuite/incr_comdat_test_2_v3.cc: New source file.
5615
5616 2011-09-13 Ian Lance Taylor <iant@google.com>
5617
5618 * object.cc (Sized_relobj_file::do_layout): Remove unused local
5619 variable external_symbols_offset.
5620
5621 2011-09-12 Ian Lance Taylor <iant@google.com>
5622
5623 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
5624 triggered if object has no symbols.
5625
5626 2011-09-09 David S. Miller <davem@davemloft.net>
5627
5628 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
5629 (Output_fill_debug_line::do_write): Likewise.
5630
5631 2011-08-29 Cary Coutant <ccoutant@google.com>
5632
5633 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
5634 casts to match formatting specs.
5635 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
5636
5637 2011-08-26 Cary Coutant <ccoutant@google.com>
5638
5639 * layout.cc (Free_list::allocate): Provide guarantee of minimum
5640 remaining hole size when allocating.
5641 (Layout::make_output_section): Set fill methods for debug sections.
5642 * layout.h (Free_list::Free_list_node): Move from private to
5643 public.
5644 (Free_list::set_min_hole_size): New function.
5645 (Free_list::begin, Free_list::end): New functions.
5646 (Free_list::min_hole_): New data member.
5647 * output.cc: Include dwarf.h.
5648 (Output_fill_debug_info::do_minimum_hole_size): New function.
5649 (Output_fill_debug_info::do_write): New function.
5650 (Output_fill_debug_line::do_minimum_hole_size): New function.
5651 (Output_fill_debug_line::do_write): New function.
5652 (Output_section::Output_section): Initialize new data member.
5653 (Output_section::set_final_data_size): Ensure patch space is larger
5654 than minimum hole size.
5655 (Output_section::do_write): Fill holes in debug sections.
5656 * output.h (Output_fill): New class.
5657 (Output_fill_debug_info): New class.
5658 (Output_fill_debug_line): New class.
5659 (Output_section::set_free_space_fill): New function.
5660 (Output_section::free_space_fill_): New data member.
5661 * testsuite/Makefile.am (incremental_test_3): Add
5662 --incremental-patch option.
5663 (incremental_test_4): Likewise.
5664 (incremental_test_5): Likewise.
5665 (incremental_test_6): Likewise.
5666 (incremental_copy_test): Likewise.
5667 (incremental_common_test_1): Likewise.
5668 * testsuite/Makefile.in: Regenerate.
5669
5670 2011-08-26 Nick Clifton <nickc@redhat.com>
5671
5672 * po/es.po: Updated Spanish translation.
5673
5674 2011-08-01 Cary Coutant <ccoutant@google.com>
5675
5676 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
5677 * gold/testsuite/Makefile.in: Regenerate.
5678 * gold/testsuite/justsyms_exec.c: New source file.
5679 * gold/testsuite/justsyms_lib.c: New source file.
5680
5681 2011-08-01 Cary Coutant <ccoutant@google.com>
5682
5683 * layout.cc (Layout::set_segment_offsets): Don't realign text
5684 segment if -Ttext was specified.
5685 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
5686 file type.
5687 * object.h (Sized_relobj_file::e_type): New function.
5688 (Sized_relobj_file::e_type_): New data member.
5689 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
5690 base address for ET_EXEC files.
5691 * target.cc (Target::do_make_elf_object_implementation): Allow
5692 ET_EXEC files with --just-symbols option.
5693
5694 2011-07-28 Cary Coutant <ccoutant@google.com>
5695
5696 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
5697 Add thread_number parameter.
5698 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
5699 * workqueue-threads.cc
5700 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
5701 current thread if its thread number is greater than desired thread
5702 count.
5703 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
5704 Add thread_number parameter.
5705 (Workqueue::should_cancel_thread): Likewise.
5706 (Workqueue::find_runnable_or_wait): Pass thread_number to
5707 should_cancel_thread.
5708 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
5709 parameter.
5710
5711 2011-07-22 Sriraman Tallam <tmsriram@google.com>
5712
5713 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
5714 only after checking if it cannot be forced local.
5715 * symtab.h (is_externally_visible): Check if the symbol is not forced
5716 local.
5717
5718 2011-07-15 Ian Lance Taylor <iant@google.com>
5719
5720 * options.h (class General_options): Add --print-output-format.
5721 Move -EL next to -EB, for better --help output.
5722 * target-select.cc: Include <cstdio>, "options.h", and
5723 "parameters.h".
5724 (Target_selector::do_target_bfd_name): New function.
5725 (print_output_format): New function.
5726 * target-select.h (class Target_selector): Update declarations.
5727 (Target_selector::target_bfd_name): New function.
5728 (print_output_format): Declare.
5729 * main.cc: Include "target-select.h".
5730 (main): Handle --print-output-format.
5731 * gold.cc: Include "target-select.h".
5732 (queue_initial_tasks): Handle --print-output-format when there are
5733 no input files.
5734 * parameters.cc (parameters_force_valid_target): Give a better
5735 error message if -EB/-EL does not match target.
5736 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
5737 function.
5738
5739 2011-07-15 Ian Lance Taylor <iant@google.com>
5740
5741 * i386.cc (class Output_data_plt_i386): Add layout_ field.
5742 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
5743 (Output_data_plt_i386::do_write): Write address of .dynamic
5744 section to first entry in .got.plt section.
5745 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
5746 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5747 Initialize layout_.
5748 (Output_data_plt_x86_64::do_write): Write address of .dynamic
5749 section to first entry in .got.plt section.
5750 * layout.h (Layout::dynamic_section): New function.
5751
5752 2011-07-13 Sriraman Tallam <tmsriram@google.com>
5753
5754 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
5755 to claim_file call.
5756 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
5757 input_section_position_, and input_section_glob_.
5758 (read_layout_from_file): Call function section_ordering_specified.
5759 * layout.h (is_section_ordering_specified): New function.
5760 (section_ordering_specified): New function.
5761 (section_ordering_specified_): New boolean member.
5762 * main.cc(main): Call load_plugins after layout object is defined.
5763 * output.cc (Output_section::add_input_section): Use
5764 function section_ordering_specified to check if section ordering is
5765 needed.
5766 * output.cc (Output_section::add_relaxed_input_section): Use
5767 function section_ordering_specified to check if section ordering is
5768 needed.
5769 (Output_section::update_section_layout): New function.
5770 (Output_section::sort_attached_input_sections): Check if input section
5771 must be reordered.
5772 * output.h (Output_section::update_section_layout): New function.
5773 * plugin.cc (get_section_count): New function.
5774 (get_section_type): New function.
5775 (get_section_name): New function.
5776 (get_section_contents): New function.
5777 (update_section_order): New function.
5778 (allow_section_ordering): New function.
5779 (Plugin::load): Add the new interfaces to the transfer vector.
5780 (Plugin_manager::load_plugins): New parameter.
5781 (Plugin_manager::all_symbols_read): New parameter.
5782 (Plugin_manager::claim_file): New parameter. Save the elf object for
5783 unclaimed objects.
5784 (Plugin_manager::get_elf_object): New function.
5785 (Plugin_manager::get_view): Change to directly use the bool to check
5786 if get_view is called from claim_file_hook.
5787 * plugin.h (input_objects): New function
5788 (Plugin__manager::load_plugins): New parameter.
5789 (Plugin_manager::claim_file): New parameter.
5790 (Plugin_manager::get_elf_object): New function.
5791 (Plugin_manager::in_claim_file_handler): New function.
5792 (Plugin_manager::in_claim_file_handler_): New member.
5793 (layout): New function.
5794 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
5795 handler with an extra parameter. Make the elf object before calling
5796 claim_file handler.
5797 * testsuite/plugin_test.c (get_section_count): New function pointer.
5798 (get_section_type): New function pointer.
5799 (get_section_name): New function pointer.
5800 (get_section_contents): New function pointer.
5801 (update_section_order): New function pointer.
5802 (allow_section_ordering): New function pointer.
5803 (onload): Check if the new interfaces exist.
5804
5805 2011-07-13 Ian Lance Taylor <iant@google.com>
5806
5807 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
5808 relro section.
5809 * x86_64.cc (Target_x86_64::got_section): Likewise.
5810 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
5811 (relro_now_test_SOURCES): New variable.
5812 (relro_now_test_DEPENDENCIES): New variable.
5813 (relro_now_test_LDFLAGS): New variable.
5814 (relro_now_test_LDADD): New variable.
5815 (relro_now_test.so): New target.
5816 * testsuite/Makefile.in: Rebuild.
5817
5818 2011-07-12 Ian Lance Taylor <iant@google.com>
5819
5820 PR gold/12980
5821 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
5822 GLOB_DAT relocation rather than a RELATIVE relocation for a
5823 protected symbol when creating a shared library.
5824 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5825 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
5826 * testsuite/protected_main_1.cc (main): Test that protected
5827 function has same address.
5828
5829 2011-07-11 Ian Lance Taylor <iant@google.com>
5830
5831 PR gold/12979
5832 * options.h (class General_options): Add -Bgroup.
5833 * options.cc (General_options::finalize): If -Bgroup is set,
5834 default to --unresolved-symbols=report-all.
5835 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
5836 * target-reloc.h (issue_undefined_symbol_error): Handle
5837 --unresolved-symbols=report-all.
5838
5839 2011-07-08 Ian Lance Taylor <iant@google.com>
5840
5841 PR gold/11985
5842 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
5843 if linker script discards key sections.
5844 (Layout::create_dynamic_symtab): Likewise.
5845 (Layout::assign_local_dynsym_offsets): Likewise.
5846 (Layout::sized_create_version_sections): Likewise.
5847 (Layout::create_interp): Likewise.
5848 (Layout::finish_dynamic_section): Likewise.
5849 (Layout::set_dynamic_symbol_size): Likewise.
5850
5851 2011-07-08 Ian Lance Taylor <iant@google.com>
5852
5853 PR gold/12386
5854 * options.h (class General_options): Add --unresolved-symbols.
5855 * target-reloc.h (issue_undefined_symbol_error): Check
5856 --unresolved-symbols. Add comments.
5857
5858 2011-07-08 Ian Lance Taylor <iant@google.com>
5859
5860 * testsuite/odr_violation2.cc (Ordering::operator()): Make
5861 expression more complex.
5862
5863 2011-07-08 Ian Lance Taylor <iant@google.com>
5864
5865 PR gold/11317
5866 * target-reloc.h (issue_undefined_symbol_error): New inline
5867 function, broken out of relocate_section.
5868 (relocate_section): Call issue_undefined_symbol_error.
5869 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5870 there is no TLS segment if we are about to issue an undefined
5871 symbol error.
5872 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5873
5874 2011-07-08 Ian Lance Taylor <iant@google.com>
5875
5876 PR gold/12279
5877 * resolve.cc (Symbol_table::should_override): Add fromtype
5878 parameter. Change all callers. Give error when linking together
5879 TLS and non-TLS symbol.
5880 (Symbol_table::should_override_with_special): Add fromtype
5881 parameter. Change all callers.
5882 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5883 there is no TLS segment if we have reported some errors.
5884 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5885
5886 2011-07-08 Ian Lance Taylor <iant@google.com>
5887
5888 PR gold/12372
5889 * target.h (Target::plt_address_for_global): New function.
5890 (Target::plt_address_for_local): New function.
5891 (Target::plt_section_for_global): Remove.
5892 (Target::plt_section_for_local): Remove.
5893 (Target::do_plt_address_for_global): New virtual function.
5894 (Target::do_plt_address_for_local): New virtual function.
5895 (Target::do_plt_section_for_global): Remove.
5896 (Target::do_plt_section_for_local): Remove.
5897 (Target::register_global_plt_entry): Add Symbol_table and Layout
5898 parameters.
5899 * output.cc (Output_data_got::Got_entry::write): Use
5900 plt_address_for_global and plt_address_for_local.
5901 * layout.cc (Layout::add_target_dynamic_tags): Use size and
5902 address of output section.
5903 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
5904 got_irelative_, and irelative_count_ fields. Update
5905 declarations.
5906 (Output_data_plt_i386::has_irelative_section): New function.
5907 (Output_data_plt_i386::entry_count): Add irelative_count_.
5908 (Output_data_plt_i386::set_final_data_size): Likewise.
5909 (class Target_i386): Add got_irelative_ and rel_irelative_
5910 fields. Update declarations.
5911 (Target_i386::Target_i386): Initialize new fields.
5912 (Target_i386::do_plt_address_for_global): New function replacing
5913 do_plt_section_for_global.
5914 (Target_i386::do_plt_address_for_local): New function replacing
5915 do_plt_section_for_local.
5916 (Target_i386::got_section): Create got_irelative_.
5917 (Target_i386::rel_irelative_section): New function.
5918 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
5919 fields. Don't define __rel_iplt_{start,end}.
5920 (Output_data_plt_i386::add_entry): Add symtab and layout
5921 parameters. Change all callers. Use different PLT and GOT for
5922 IFUNC symbols.
5923 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
5924 layout parameters. Change all callers. Use different PLT and
5925 GOT.
5926 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
5927 (Output_data_plt_i386::rel_irelative): New function.
5928 (Output_data_plt_i386::address_for_global): New function.
5929 (Output_data_plt_i386::address_for_local): New function.
5930 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
5931 IRELATIVE GOT when changing IFUNC GOT entries.
5932 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
5933 reloc.
5934 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
5935 if we didn't create an IRELATIVE GOT.
5936 (Target_i386::Relocate::relocate): Use plt_address_for_global and
5937 plt_address_for_local.
5938 (Target_i386::do_dynsym_value): Use plt_address_for_global.
5939 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
5940 got_irelative_, and irelative_count_ fields. Update
5941 declarations.
5942 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5943 Initialize new fields. Remove symtab parameter. Change all
5944 callers.
5945 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
5946 irelative_count_.
5947 (Output_data_plt_x86_64::has_irelative_section): New function.
5948 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
5949 (class Target_x86_64): Add got_irelative_ and rel_irelative_
5950 fields. Update declarations.
5951 (Target_x86_64::Target_x86_64): Initialize new fields.
5952 (Target_x86_64::do_plt_address_for_global): New function replacing
5953 do_plt_section_for_global.
5954 (Target_x86_64::do_plt_address_for_local): New function replacing
5955 do_plt_section_for_local.
5956 (Target_x86_64::got_section): Create got_irelative_.
5957 (Target_x86_64::rela_irelative_section): New function.
5958 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
5959 all callers. Don't create __rel_iplt_{start,end}.
5960 (Output_data_plt_x86_64::add_entry): Add symtab and layout
5961 parameters. Change all callers. Use different PLT and GOT for
5962 IFUNC symbols.
5963 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
5964 layout parameters. Change all callers. Use different PLT and
5965 GOT.
5966 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
5967 parameters. Change all callers. Use different PLT and GOT for
5968 IFUNC symbols.
5969 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
5970 (Output_data_plt_x86_64::rela_irelative): New function.
5971 (Output_data_plt_x86_64::address_for_global): New function.
5972 (Output_data_plt_x86_64::address_for_local): New function.
5973 (Output_data_plt_x86_64::set_final_data_size): Likewise.
5974 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
5975 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
5976 (Target_x86_64::register_global_plt_entry): Add symtab and layout
5977 parameters.
5978 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
5979 reloc.
5980 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
5981 symbols if we didn't create an IRELATIVE GOT.
5982 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
5983 plt_address_for_local.
5984 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
5985 * testsuite/ifuncvar1.c: New test file.
5986 * testsuite/ifuncvar2.c: New test file.
5987 * testsuite/ifuncvar3.c: New test file.
5988 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
5989 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
5990 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
5991 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
5992 * testsuite/Makefile.in: Rebuild.
5993
5994 2011-07-07 Cary Coutant <ccoutant@google.com>
5995
5996 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
5997 (two_file_test_1_ndebug.o): Likewise.
5998 (two_file_test_1b_ndebug.o): Likewise.
5999 (two_file_test_2_ndebug.o): Likewise.
6000 (two_file_test_main_ndebug.o): Likewise.
6001 (incremental_test_2): Link with no-debug versions.
6002
6003 2011-07-06 Cary Coutant <ccoutant@google.com>
6004
6005 * gold/incremental.cc
6006 (Output_section_incremental_inputs::write_info_blocks): Check for
6007 hidden and internal symbols.
6008
6009 2011-07-06 Cary Coutant <ccoutant@google.com>
6010
6011 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
6012 Check disposition for startup file.
6013 (Incremental_inputs::report_command_line): Ignore
6014 --incremental-startup-unchanged option.
6015 * options.cc (General_options::parse_incremental_startup_unchanged):
6016 New function.
6017 (General_options::General_options): Initialize new data member.
6018 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
6019 (General_options): Add --incremental-startup-unchanged option.
6020 (General_options::incremental_startup_disposition): New function.
6021 (General_options::incremental_startup_disposition_): New data member.
6022
6023 2011-07-06 Cary Coutant <ccoutant@google.com>
6024
6025 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
6026 input file index to Script_info ctor.
6027 (Sized_incremental_binary::do_file_has_changed): Find the
6028 command-line argument for files named in scripts.
6029 * incremental.h (Script_info::Script_info): New ctor
6030 with input file index.
6031 (Script_info::input_file_index): New function.
6032 (Script_info::input_file_index_): New data member.
6033 (Incremental_binary::get_library): Add const.
6034 (Incremental_binary::get_script_info): Add const.
6035 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
6036 * testsuite/Makefile.am (incremental_test_5): New test case.
6037 (incremental_test_6): New test case.
6038 * testsuite/Makefile.in: Regenerate.
6039
6040 2011-07-06 Cary Coutant <ccoutant@google.com>
6041
6042 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
6043 debug output when command lines differ.
6044
6045 2011-07-06 Cary Coutant <ccoutant@google.com>
6046
6047 * incremental.cc (Incremental_inputs::report_command_line): Ignore
6048 --incremental-patch option.
6049 * layout.cc (Free_list::allocate): Extend allocation beyond original
6050 end if enabled.
6051 (Layout::make_output_section): Mark sections that should get
6052 patch space.
6053 * options.cc (parse_percent): New function.
6054 * options.h (parse_percent): New function.
6055 (DEFINE_percent): New macro.
6056 (General_options): Add --incremental-patch option.
6057 * output.cc (Output_section::Output_section): Initialize new data
6058 members.
6059 (Output_section::add_input_section): Print section name when out
6060 of patch space.
6061 (Output_section::add_output_section_data): Likewise.
6062 (Output_section::set_final_data_size): Add patch space when
6063 doing --incremental-full.
6064 (Output_section::do_reset_address_and_file_offset): Remove patch
6065 space.
6066 (Output_segment::set_section_list_addresses): Print debug output
6067 only if --incremental-update.
6068 * output.h (Output_section::set_is_patch_space_allowed): New function.
6069 (Output_section::is_patch_space_allowed_): New data member.
6070 (Output_section::patch_space_): New data member.
6071 * parameters.cc (Parameters::incremental_full): New function.
6072 * parameters.h (Parameters::incremental_full): New function
6073 * testsuite/Makefile.am (incremental_test_2): Add test for
6074 --incremental-patch option.
6075 * testsuite/Makefile.in: Regenerate.
6076 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
6077 (t18): Remove function body.
6078
6079 2011-07-05 Doug Kwan <dougkwan@google.com>
6080
6081 PR gold/12771
6082 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
6083 Arm_Address type for relocation result.
6084 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
6085 overflow check.
6086 (Arm_relocate_functions::abs32): Use unaligned access.
6087 (Arm_relocate_functions::rel32): Ditto.
6088 (Arm_relocate_functions::prel31): Ditto.
6089 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
6090 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
6091 static data relocations.
6092 * testsuite/Makefile.in: Regnerate.
6093 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
6094
6095 2011-07-05 Ian Lance Taylor <iant@google.com>
6096
6097 PR gold/12392
6098 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
6099 symbols if necessary.
6100 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6101
6102 2011-07-05 Ian Lance Taylor <iant@google.com>
6103
6104 PR gold/12952
6105 * resolve.cc (Symbol::override_base_with_special): Simply override
6106 version with special symbol version, ignoring previous version.
6107
6108 2011-07-05 Ian Lance Taylor <iant@google.com>
6109
6110 * object.cc (Sized_relobj_file::include_section_group): Add
6111 information to comment about signature location.
6112
6113 2011-07-02 Ian Lance Taylor <iant@google.com>
6114
6115 PR gold/12957
6116 * options.h (class General_options): Add -f and -F.
6117 * options.cc (General_options::finalize): Fatal error if -f/-F
6118 are used without -shared.
6119 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
6120
6121 2011-07-02 Ian Lance Taylor <iant@google.com>
6122
6123 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
6124
6125 2011-07-01 Ian Lance Taylor <iant@google.com>
6126
6127 PR gold/12525
6128 PR gold/12952
6129 * resolve.cc (Symbol::override_base_with_special): Don't override
6130 the version if the overriding symbol has a different name.
6131 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
6132 all callers. If we give an error about an undefined version,
6133 define the base version if necessary.
6134 * dynobj.h (class Versions): Update declaration.
6135 * testsuite/weak_alias_test_5.cc: New file.
6136 * testsuite/weak_alias_test.script: New file.
6137 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
6138 and versioned_alias have the right value, and call t2.
6139 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
6140 weak_alias_test_5.so.
6141 (weak_alias_test_LDADD): Likewise.
6142 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
6143 * testsuite/Makefile.in: Rebuild.
6144
6145 2011-07-01 Ian Lance Taylor <iant@google.com>
6146
6147 PR gold/12525
6148 * options.h (class General_options): Support -z notext.
6149 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
6150 -Wl,-z,notext.
6151 (two_file_shared_nonpic.so): Likewise.
6152 (two_file_shared_mixed.so): Likewise.
6153 (two_file_shared_mixed_1.so): Likewise.
6154 (weak_undef_lib_nonpic.so): Likewise.
6155 (alt/weak_undef_lib_nonpic.so): Likewise.
6156 (tls_test_shared_nonpic.so): Likewise.
6157 * testsuite/Makefile.in: Rebuild.
6158
6159 2011-07-01 Ian Lance Taylor <iant@google.com>
6160
6161 PR gold/12525
6162 * configure.ac: Test whether static linking works, setting
6163 the automake conditional HAVE_STATIC.
6164 * testsuite/Makefile.am: Disable tests using -static if
6165 HAVE_STATIC is not true.
6166 * configure, testsuite/Makefile.in: Rebuild.
6167
6168 2011-07-01 Ian Lance Taylor <iant@google.com>
6169
6170 PR gold/12525
6171 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
6172 Assert if we see DW_EH_PE_indirect.
6173 * target.h (Target::ehframe_datarel_base): New function.
6174 (Target::do_ehframe_datarel_base): New target function.
6175 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
6176 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
6177 function.
6178
6179 2011-07-01 Ian Lance Taylor <iant@google.com>
6180
6181 PR gold/12571
6182 * options.h (class General_options): Add
6183 --ld-generated-unwind-info.
6184 * ehframe.cc (Fde::write): Add address parameter. Change all
6185 callers. If associated with PLT, fill in address and size.
6186 (Cie::set_output_offset): Only add merge mapping if there is an
6187 object.
6188 (Cie::write): Add address parameter. Change all callers.
6189 (Eh_frame::add_ehframe_for_plt): New function.
6190 * ehframe.h (class Fde): Update declarations. Move shndx_ and
6191 input_offset_ fields into union u_, with new plt field.
6192 (Fde::Fde): Adjust for new union field.
6193 (Fde::Fde) [Output_data version]: New constructor.
6194 (Fde::add_mapping): Only add merge mapping if there is an object.
6195 (class Cie): Update declarations.
6196 (class Eh_frame): Declare add_ehframe_for_plt.
6197 * layout.cc (Layout::layout_eh_frame): Break out code into
6198 make_eh_frame_section, and call it.
6199 (Layout::make_eh_frame_section): New function.
6200 (Layout::add_eh_frame_for_plt): New function.
6201 * layout.h (class Layout): Update declarations.
6202 * merge.cc (Merge_map::add_mapping): Add assertion.
6203 * i386.cc: Include "dwarf.h".
6204 (class Output_data_plt_i386): Make first_plt_entry,
6205 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
6206 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6207 and plt_eh_frame_fde.
6208 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
6209 boundary. Call add_eh_frame_for_plt if appropriate.
6210 * x86_64.cc: Include "dwarf.h".
6211 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
6212 first_plt_entry, plt_entry and tlsdesc_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_x86_64::init): Call add_eh_frame_for_plt if
6216 appropriate.
6217
6218 2011-06-29 Ian Lance Taylor <iant@google.com>
6219
6220 PR gold/12629
6221 * object.cc (Sized_relobj_file::layout_section): Change shdr
6222 parameter to be const.
6223 (Sized_relobj_file::layout_eh_frame_section): New function, broken
6224 out of do_layout.
6225 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
6226 appropriate. Call layout_eh_frame_section.
6227 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
6228 sections.
6229 * object.h (class Sized_relobj_file): Update declarations.
6230
6231 2011-06-29 Ian Lance Taylor <iant@google.com>
6232
6233 PR gold/12652
6234 * script.cc (Token::integer_value): Accept trailing M/m/K/k
6235 modifier.
6236 (Lex::gather_token): Accept trailing M/m/K/k for integers.
6237
6238 2011-06-29 Ian Lance Taylor <iant@google.com>
6239
6240 PR gold/12675
6241 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
6242 SHT_X86_64_UNWIND.
6243 * layout.cc (Layout::layout_eh_frame): Likewise.
6244
6245 2011-06-29 Ian Lance Taylor <iant@google.com>
6246
6247 PR gold/12695
6248 * layout.cc (Layout::symtab_section_shndx): New function.
6249 * layout.h (class Layout): Declare symtab_section_shndx.
6250 * output.cc (Output_section::write_header): Call it.
6251
6252 2011-06-29 Ian Lance Taylor <iant@google.com>
6253
6254 PR gold/12818
6255 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
6256 symbols which are not used in a relocation.
6257
6258 2011-06-28 Ian Lance Taylor <iant@google.com>
6259
6260 PR gold/12898
6261 * layout.cc (Layout::segment_precedes): Don't crash if a linker
6262 script create indistinguishable segments.
6263 (Layout::set_segment_offsets): Use stable_sort when sorting
6264 segments. Pass this to Compare_segments constructor.
6265 * layout.h (class Layout): Make segment_precedes non-static.
6266 (class Compare_segments): Change from struct to class. Add
6267 layout_ field. Add constructor.
6268 * script-sections.cc
6269 (Script_sections::attach_sections_using_phdrs_clause): Rename
6270 local orphan to is_orphan. Don't report failure to put empty
6271 section in segment. On attachment failure, report name of
6272 section, and attach to first PT_LOAD segment.
6273
6274 2011-06-28 Ian Lance Taylor <iant@google.com>
6275
6276 PR gold/12934
6277 * target-select.cc (Target_selector::Target_selector): Add
6278 emulation parameter. Change all callers.
6279 (select_target_by_bfd_name): Rename from select_target_by_name.
6280 Change all callers.
6281 (select_target_by_emulation): New function.
6282 (supported_emulation_names): New function.
6283 * target-select.h (class Target_selector): Add emulation_ field.
6284 Update declarations.
6285 (Target_selector::recognize_by_bfd_name): Rename from
6286 recognize_by_name. Change all callers.
6287 (Target_selector::supported_bfd_names): Rename from
6288 supported_names. Change all callers.
6289 (Target_selector::recognize_by_emulation): New function.
6290 (Target_selector::supported_emulations): New function.
6291 (Target_selector::emulation): New function.
6292 (Target_selector::do_recognize_by_bfd_name): Rename from
6293 do_recognize_by_name. Change all callers.
6294 (Target_selector::do_supported_bfd_names): Rename from
6295 do_supported_names. Change all callers.
6296 (Target_selector::do_recognize_by_emulation): New function.
6297 (Target_selector::do_supported_emulations): New function.
6298 (select_target_by_bfd_name): Change name in declaration.
6299 (select_target_by_emulation): Declare.
6300 (supported_emulation_names): Declare.
6301 * parameters.cc (parameters_force_valid_target): Try to find
6302 target based on emulation from -m option.
6303 * options.h (class General_options): Change doc string for -m.
6304 * options.cc (help): Print emulations.
6305 (General_options::parse_V): Likewise.
6306 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
6307 Add emulation parameter. Change all callers.
6308
6309 2011-06-28 Ian Lance Taylor <iant@google.com>
6310
6311 * target.h (class Target): Add osabi_ field.
6312 (Target::osabi): New function.
6313 (Target::set_osabi): New function.
6314 (Target::Target): Initialize osabi_.
6315 (Target::do_adjust_elf_header): Make pure virtual.
6316 (Sized_target::do_adjust_elf_header): Declare.
6317 * target.cc (Sized_target::do_adjust_elf_header): New function.
6318 (class Sized_target): Instantiate all versions.
6319 * freebsd.h (class Target_freebsd): Remove.
6320 (Target_selector_freebsd::do_recognize): Call set_osabi on
6321 Target.
6322 (Target_selector_freebsd::do_recognize_by_name): Likewise.
6323 (Target_selector_freebsd::set_osabi): Remove.
6324 * i386.cc (class Target_i386): Inherit from Sized_target rather
6325 than Target_freebsd.
6326 * x86_64.cc (class Target_x86_64): Likewise.
6327
6328 2011-06-28 Ian Lance Taylor <iant@google.com>
6329
6330 * target.h (Target::can_check_for_function_pointers): Rewrite.
6331 Make non-virtual.
6332 (Target::can_icf_inline_merge_sections): Likewise.
6333 (Target::section_may_have_icf_unsafe_poineters): Likewise.
6334 (Target::Target_info): Add can_icf_inline_merge_sections field.
6335 (Target::do_can_check_for_function_pointers): New virtual
6336 function.
6337 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
6338 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
6339 from can_check_for_function_pointers, move in file.
6340 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
6341 section_may_have_icf_unsafe_poineters, move in file.
6342 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
6343 * i386.cc (Target_i386::do_can_check_for_function_pointers):
6344 Rename from can_check_for_function_pointers, move in file.
6345 (Target_i386::can_icf_inline_merge_sections): Remove.
6346 (Target_i386::i386_info): Initialize
6347 can_icf_inline_merge_sections.
6348 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6349 Initialize can_icf_inline_merge_sections.
6350 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
6351 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
6352 Rename from can_check_for_function_pointers, move in file.
6353 (Target_x86_64::can_icf_inline_merge_sections): Remove.
6354 (Target_x86_64::x86_64_info): Initialize
6355 can_icf_inline_merge_sections.
6356 * testsuite/testfile.cc (Target_test::test_target_info):
6357 Likewise.
6358 * icf.cc (get_section_contents): Correct formatting.
6359
6360 2011-06-27 Ian Lance Taylor <iant@google.com>
6361
6362 * symtab.cc (Symbol::versioned_name): New function.
6363 (Symbol_table::add_to_final_symtab): Use versioned_name when
6364 appropriate.
6365 (Symbol_table::sized_write_symbol): Likewise.
6366 * symtab.h (class Symbol): Declare versioned_name.
6367 * stringpool.h (class Stringpool_template): Add variant of add
6368 which takes a std::basic_string.
6369 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
6370 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
6371 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
6372 (ver_test_12.o): New target.
6373 * testsuite/Makefile.in: Rebuild.
6374
6375 2011-06-27 Doug Kwan <dougkwan@google.com>
6376
6377 * arm.cc (Arm_relocate_functions::thm_jump8,
6378 Arm_relocate_functions::thm_jump11): Use a wider signed
6379 type to compute offset.
6380 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
6381 arm_thm_jump8.
6382 * testsuite/Makefile.in: Regenerate.
6383 * testsuite/arm_branch_in_range.sh: Check test results of
6384 arm_thm_jump11 and arm_thm_jump8.
6385 * testsuite/arm_thm_jump11.s: New test source file.
6386 * testsuite/arm_thm_jump11.t: New linker script.
6387 * testsuite/arm_thm_jump8.s: New test source file.
6388 * testsuite/arm_thm_jump8.t: New linker script.
6389
6390 2011-06-24 Ian Lance Taylor <iant@google.com>
6391
6392 * layout.cc: Include "object.h".
6393 (ctors_sections_in_init_array): New static variable.
6394 (Layout::is_ctors_in_init_array): New function.
6395 (Layout::layout): Add entry to ctors_sections_in_init_array if
6396 appropriate.
6397 * layout.h (class Layout): Declare is_ctors_in_init_array.
6398 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
6399 is_ctors_reverse_view is set.
6400 (Sized_relobj_file::write_sections): Add layout parameter. Change
6401 all callers. Set is_ctors_reverse_view field of View_size.
6402 (Sized_relobj_file::reverse_words): New function.
6403 * object.h (Sized_relobj_file::View_size): Add
6404 is_ctors_reverse_view field.
6405 (class Sized_relobj_file): Update declarations.
6406 * testsuite/initpri3.c: New test.
6407 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
6408 initpri3b.
6409 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
6410 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
6411 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
6412 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
6413 * testsuite/Makefile.in: Rebuild.
6414
6415 2011-06-24 Cary Coutant <ccoutant@google.com>
6416
6417 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
6418 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
6419 (debug_msg_cdebug.err): New targets.
6420 * testsuite/Makefile.in: Regenerate.
6421 * testsuite/debug_msg.sh: Check output of link with compressed debug.
6422 Fix checks for link with shared library.
6423
6424 2011-06-24 Doug Kwan <dougkwan@google.com>
6425
6426 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
6427 skip empty text sections.
6428 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
6429
6430 2011-06-22 Ian Lance Taylor <iant@google.com>
6431
6432 PR gold/12910
6433 * options.h (class General_options): Add --ctors-in-init-array.
6434 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
6435 friends as SHT_PROGBITS for merging sections.
6436 (Layout::layout): Remove special handling of .init_array and
6437 friends. Don't sort if doing relocatable link. Sort for .ctors
6438 and .dtors if ctors_in_init_array.
6439 (Layout::make_output_section): Force correct section types for
6440 .init_array and friends. Don't sort if doing relocatable link,
6441 Don't sort .ctors and .dtors if ctors_in_init_array.
6442 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
6443 (Layout::output_section_name): Add relobj parameter. Change all
6444 callers. Handle .ctors. and .dtors. in code rather than table.
6445 Handle .ctors and .dtors if ctors_in_init_array.
6446 (Layout::match_file_name): New function, moved from output.cc.
6447 * layout.h (class Layout): Update declarations.
6448 * output.cc: Include "layout.h".
6449 (Input_section_sort_entry::get_priority): New function.
6450 (Input_section_sort_entry::match_file_name): Just call
6451 Layout::match_file_name.
6452 (Output_section::Input_section_sort_init_fini_compare::operator()):
6453 Handle .ctors and .dtors. Sort by explicit priority rather than
6454 by name.
6455 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
6456 * testsuite/initpri2.c: New test.
6457 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
6458 (check_PROGRAMS): Add initpri2.
6459 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
6460 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
6461 * configure, testsuite/Makefile.in: Rebuild.
6462
6463 2011-06-19 Ian Lance Taylor <iant@google.com>
6464
6465 PR gold/12880
6466 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
6467 .interp section to a PT_INTERP segment even if we have seen a
6468 --dynamic-linker option. Don't do it if we have seen a PHDRS
6469 clause in a linker script.
6470 (Layout::finalize): Don't create a .interp section if we've
6471 already create a PT_INTERP segment.
6472 (Layout::create_interp): Always call choose_output_section (revert
6473 patch of 2011-06-17). Don't create PT_INTERP segment.
6474 * script-sections.cc
6475 (Script_sections::create_note_and_tls_segments): Add a .interp
6476 section to a PT_INTERP segment even if we have seen a
6477 --dynamic-linker option.
6478
6479 2011-06-18 Ian Lance Taylor <iant@google.com>
6480
6481 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
6482 merely because a non-PT_LOAD segment has a dynamic reloc.
6483
6484 2011-06-18 Ian Lance Taylor <iant@google.com>
6485
6486 * layout.cc (Layout::finish_dynamic_section): Don't create
6487 DT_FLAGS entry if not needed.
6488
6489 2011-06-18 Ian Lance Taylor <iant@google.com>
6490
6491 PR gold/12745
6492 * layout.cc (Layout::layout_eh_frame): Correct handling of
6493 writable .eh_frame section.
6494
6495 2011-06-17 Ian Lance Taylor <iant@google.com>
6496
6497 PR gold/12893
6498 * resolve.cc (Symbol_table::resolve): Don't give an error if a
6499 symbol is redefined with the exact same object and value.
6500
6501 2011-06-17 Ian Lance Taylor <iant@google.com>
6502
6503 PR gold/12880
6504 * layout.h (class Layout): Add interp_segment_ field.
6505 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
6506 (Layout::attach_allocated_section_to_segment): If making shared
6507 library, put .interp section in PT_INTERP segment.
6508 (Layout::finalize): Also call create_interp if -dynamic-linker
6509 option was used.
6510 (Layout::create_interp): Assert that there is no PT_INTERP
6511 segment. If not using a SECTIONS clause, use make_output_section.
6512 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
6513 * script-sections.cc
6514 (Script_sections::create_note_and_tls_segments): If making shared
6515 library, put .interp section in PT_INTERP segment.
6516
6517 2011-06-17 Ian Lance Taylor <iant@google.com>
6518
6519 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
6520 when making a shared library.
6521
6522 2011-06-17 Ian Lance Taylor <iant@google.com>
6523
6524 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
6525 parameter. Change all callers. Don't issue warning about PC32
6526 against locally defined symbol.
6527
6528 2011-06-16 Ian Lance Taylor <iant@google.com>
6529
6530 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
6531 occurs in same object.
6532
6533 2011-06-14 Alan Modra <amodra@gmail.com>
6534
6535 * po/POTFILES.in: Regenerate.
6536
6537 2011-06-09 Ian Lance Taylor <iant@google.com>
6538
6539 * script-sections.cc
6540 (Orphan_output_section::set_section_addresses): For a relocatable
6541 link set address to 0.
6542
6543 2011-06-09 Cary Coutant <ccoutant@google.com>
6544
6545 PR gold/12804
6546 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
6547 used with --compress-debug-sections.
6548 * gold/object.cc (Sized_relobj_file::do_layout): Report
6549 uncompressed size of compressed input sections.
6550
6551 2011-06-08 Cary Coutant <ccoutant@google.com>
6552
6553 PR gold/12804
6554 * testsuite/two_file_test_2_v1.cc: Change initialization of
6555 v2 to keep it in .data.
6556
6557 2011-06-07 Cary Coutant <ccoutant@google.com>
6558
6559 * common.cc (Symbol_table::do_allocate_commons_list): Call
6560 gold_fallback.
6561 * errors.cc (Errors::fatal): Adjust call to gold_exit.
6562 (Errors::fallback): New function.
6563 (gold_fallback): New function.
6564 * errors.h (Errors::fallback): New function.
6565 * gold.cc (gold_exit): Change status parameter to enum; adjust
6566 all callers.
6567 (queue_initial_tasks): Call gold_fallback.
6568 * gold.h: Include cstdlib.
6569 (Exit_status): New enum type.
6570 (gold_exit): Change status parameter to enum.
6571 (gold_fallback): New function.
6572 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
6573 (Layout::create_symtab_sections): Likewise.
6574 (Layout::create_shdrs): Likewise.
6575 * main.cc (main): Adjust call to gold_exit.
6576 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
6577 (Output_data_got::add_got_entry_pair): Likewise.
6578 (Output_section::add_input_section): Likewise.
6579 (Output_section::add_output_section_data): Likewise.
6580 (Output_segment::set_section_list_addresses): Likewise.
6581 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
6582
6583 2011-06-07 Cary Coutant <ccoutant@google.com>
6584
6585 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
6586 for incremental links.
6587 * output.cc (Output_segment::set_section_list_addresses): Remove
6588 FIXME and test for TLS or BSS.
6589
6590 2011-06-07 Cary Coutant <ccoutant@google.com>
6591
6592 * testsuite/Makefile.am: Add incremental_copy_test,
6593 incremental_common_test_1.
6594 * testsuite/Makefile.in: Regenerate.
6595 * testsuite/common_test_1_v1.c: New source file.
6596 * testsuite/common_test_1_v2.c: New source file.
6597 * testsuite/copy_test_v1.cc: New source file.
6598
6599 2011-06-07 Cary Coutant <ccoutant@google.com>
6600
6601 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
6602 update, allocate common from bss section's free list.
6603 * incremental-dump.cc (dump_incremental_inputs): Print flag for
6604 linker-defined symbols.
6605 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
6606 Skip GOT and PLT entries that are no longer referenced.
6607 (Output_section_incremental_inputs::write_info_blocks): Mark
6608 linker-defined symbols.
6609 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
6610 * output.cc (Output_section::allocate): New function.
6611 * output.h (Output_section::allocate): New function.
6612 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
6613 linker-defined symbols.
6614 (Symbol::override_base_with_special): Copy is_predefined_ flag.
6615 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
6616 (Symbol::init_base_output_data): Likewise.
6617 (Symbol::init_base_output_segment): Likewise.
6618 (Symbol::init_base_constant): Likewise.
6619 (Sized_symbol::init_output_data): Likewise.
6620 (Sized_symbol::init_output_segment): Likewise.
6621 (Sized_symbol::init_constant): Likewise.
6622 (Symbol_table::do_define_in_output_data): Likewise.
6623 (Symbol_table::do_define_in_output_segment): Likewise.
6624 (Symbol_table::do_define_as_constant): Likewise.
6625 * symtab.h (Symbol::is_predefined): New function.
6626 (Symbol::init_base_output_data): Add is_predefined parameter.
6627 (Symbol::init_base_output_segment): Likewise.
6628 (Symbol::init_base_constant): Likewise.
6629 (Symbol::is_predefined_): New data member.
6630 (Sized_symbol::init_output_data): Add is_predefined parameter.
6631 (Sized_symbol::init_output_segment): Likewise.
6632 (Sized_symbol::init_constant): Likewise.
6633 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
6634
6635 2011-06-07 Cary Coutant <ccoutant@google.com>
6636
6637 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
6638 instead of emit_copy_reloc.
6639 (Copy_relocs::emit_copy_reloc): Refactor.
6640 (Copy_relocs::make_copy_reloc): New function.
6641 (Copy_relocs::add_copy_reloc): Remove.
6642 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
6643 section.
6644 (Copy_relocs::make_copy_reloc): New function.
6645 (Copy_relocs::add_copy_reloc): Remove.
6646 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
6647 unchanged input files.
6648 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
6649 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
6650 Reserve BSS space for COPY relocations.
6651 (Sized_incremental_binary::do_emit_copy_relocs): New function.
6652 (Output_section_incremental_inputs::write_info_blocks): Record
6653 whether a symbol is copied from a shared object.
6654 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
6655 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
6656 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
6657 (Incremental_input_entry_reader::get_output_symbol_index): Add
6658 is_copy parameter.
6659 (Incremental_binary::emit_copy_relocs): New function.
6660 (Incremental_binary::do_emit_copy_relocs): New function.
6661 (Sized_incremental_binary::Sized_incremental_binary): Initialize
6662 new data member.
6663 (Sized_incremental_binary::add_copy_reloc): New function.
6664 (Sized_incremental_binary::do_emit_copy_relocs): New function.
6665 (Sized_incremental_binary::Copy_reloc): New struct.
6666 (Sized_incremental_binary::Copy_relocs): New typedef.
6667 (Sized_incremental_binary::copy_relocs_): New data member.
6668 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
6669 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
6670 * target.h (Sized_target::emit_copy_reloc): New function.
6671 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
6672
6673 2011-06-02 Cary Coutant <ccoutant@google.com>
6674
6675 PR gold/12163
6676 * gold/archive.cc (Archive::Archive): Initialize new data member.
6677 (Archive::include_all_members): Return if archive has already been
6678 included.
6679 * gold/archive.h (Archive::include_all_members_): New data member.
6680
6681 2011-06-02 Nick Clifton <nickc@redhat.com>
6682
6683 * dynobj.h: Fix spelling mistake in comment.
6684 * output.cc: Likewise.
6685
6686 2011-05-31 Doug Kwan <dougkwan@google.com>
6687 Asier Llano
6688
6689 PR gold/12826
6690 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
6691 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
6692 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
6693 redundant arm_exidx_test.so.
6694 * testsuite/Makefile.in: Regenerate.
6695 (check_SCRIPTS): Add pr12826.sh
6696 (check_DATA): Add pr12826.stdout
6697 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
6698 * testsuite/pr12826.sh: New file.
6699 * testsuite/pr12826_1.s: Ditto.
6700 * testsuite/pr12826_1.s: Ditto.
6701
6702 2011-05-30 Ian Lance Taylor <iant@google.com>
6703
6704 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
6705 sections.
6706
6707 2011-05-29 Ian Lance Taylor <iant@google.com>
6708
6709 PR gold/12804
6710 * testsuite/Makefile.am: Use different file name for two_file_test
6711 temporary file for each incremental test.
6712 * testsuite/Makefile.in: Rebuild.
6713
6714 2011-05-29 Ian Lance Taylor <iant@google.com>
6715
6716 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
6717 binary input file is empty.
6718
6719 2011-05-27 Ian Lance Taylor <iant@google.com>
6720
6721 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
6722 (ver_test_9.so): Likewise.
6723 * testsuite/Makefile.in: Rebuild.
6724
6725 2011-05-26 Cary Coutant <ccoutant@google.com>
6726
6727 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
6728 * incremental.cc (Incremental_inputs::report_input_section): Fix
6729 comment, indentation.
6730 (Incremental_inputs::report_comdat_group): New function.
6731 (Output_section_incremental_inputs::set_final_data_size): Adjust size
6732 of data for incremental input file entry.
6733 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
6734 group count, COMDAT group signatures.
6735 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
6736 an unchanged input file.
6737 * incremental.h (Incremental_object_entry::Incremental_object_entry):
6738 Initialize new data member.
6739 (Incremental_object_entry::add_comdat_group): New function.
6740 (Incremental_object_entry::get_comdat_group_count): New function.
6741 (Incremental_object_entry::get_comdat_signature_key): New function.
6742 (Incremental_object_entry::groups_): New data member.
6743 (Incremental_inputs::report_comdat_group): New function.
6744 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
6745 data for incremental input file entry.
6746 (Incremental_input_entry_reader::get_comdat_group_count): New function.
6747 (Incremental_input_entry_reader::get_input_section): Adjust size of
6748 data for incremental input file entry.
6749 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
6750 (Incremental_input_entry_reader::get_comdat_group_signature): New
6751 function.
6752 * object.cc (Sized_relobj::include_section_group): Report kept
6753 COMDAT groups for incremental links.
6754
6755 2011-05-24 David Meyer <pdox@google.com>
6756
6757 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
6758 with name parameter. Add found_name parameter.
6759 * fileread.cc (Input_file::find_file): Adjust code accordingly.
6760 * dirsearch.h (class Dirsearch): Update declaration.
6761
6762 2011-05-24 Ian Lance Taylor <iant@google.com>
6763
6764 * archive.cc (Library_base::should_include_member): Pull in object
6765 from archive if it defines the entry symbol.
6766 * parameters.cc (Parameters::entry): New function.
6767 * parameters.h (class Parameters): Declare entry.
6768 * output.h (class Output_file_header): Remove entry_ field.
6769 * output.cc (Output_file_header::Output_file_header): Remove entry
6770 parameter. Change all callers.
6771 (Output_file_header::entry): Use parameters->entry.
6772 * gold.cc (queue_middle_tasks): Likewise.
6773 * plugin.cc (Plugin_hook::run): Likewise.
6774
6775 2011-05-24 Cary Coutant <ccoutant@google.com>
6776
6777 * gold.cc (queue_initial_tasks): Pass incremental base filename
6778 to Output_file::open_base_file; don't print error message.
6779 * incremental-dump.cc (main): Adjust call to
6780 Output_file::open_for_modification.
6781 * incremental-dump.cc (main): Likewise.
6782 * incremental.cc (Incremental_inputs::report_command_line):
6783 Ignore --incremental-base option when comparing command lines.
6784 Ignore parameter when given as separate argument.
6785 * options.h (class General_options): Add --incremental-base.
6786 * output.cc (Output_file::Output_file):
6787 (Output_file::open_base_file): Add base_name and writable parameters;
6788 read base file into new file; print error message here.
6789 (Output_file::map_no_anonymous): Add writable parameter; adjust all
6790 callers.
6791 * output.h (Output_file::open_for_modification): Rename to...
6792 (Output_file::open_base_file): ...this; add base_name and
6793 writable parameters; adjust all callers.
6794 (Output_file::map_no_anonymous): Add writable parameter; adjust all
6795 callers.
6796 * testsuite/Makefile.am (incremental_test_4): Test
6797 --incremental-base.
6798 * testsuite/Makefile.in: Regenerate.
6799
6800 2011-05-24 Cary Coutant <ccoutant@google.com>
6801
6802 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
6803 incremental_test_4.
6804 * testsuite/Makefile.in: Regenerate.
6805 * testsuite/two_file_test_1_v1.cc: New test source file.
6806 * testsuite/two_file_test_1b_v1.cc: New test source file.
6807 * testsuite/two_file_test_2_v1.cc: New test source file.
6808
6809 2011-05-24 Cary Coutant <ccoutant@google.com>
6810
6811 * dynobj.h (Dynobj::do_dynobj): New function.
6812 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
6813 flag and soname for shared objects.
6814 * incremental.cc (Incremental_inputs::report_object): Make
6815 either Incremental_object_entry or Incremental_dynobj_entry; add
6816 soname to string table.
6817 (Incremental_inputs::report_input_section): Add assertion.
6818 (Output_section_incremental_inputs::set_final_data_size): Adjust
6819 type of input file entry for shared libraries; adjust size of
6820 shared library info entry.
6821 (Output_section_incremental_inputs::write_input_files): Write
6822 as_needed flag for shared libraries.
6823 (Output_section_incremental_inputs::write_info_blocks): Adjust type
6824 of input file entry for shared libraries; write soname.
6825 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
6826 soname from incremental info.
6827 * incremental.h (enum Incremental_input_flags): Add
6828 INCREMENTAL_INPUT_AS_NEEDED.
6829 (Incremental_input_entry::Incremental_input_entry): Initialize new
6830 data member.
6831 (Incremental_input_entry::set_as_needed): New function.
6832 (Incremental_input_entry::as_needed): New function.
6833 (Incremental_input_entry::do_dynobj_entry): New function.
6834 (Incremental_input_entry::as_needed_): New data member.
6835 (Incremental_object_entry::Incremental_object_entry): Don't check
6836 for shared library.
6837 (Incremental_object_entry::do_type): Likewise.
6838 (class Incremental_dynobj_entry): New class.
6839 (Incremental_input_entry_reader::as_needed): New function.
6840 (Incremental_input_entry_reader::get_soname): New function.
6841 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
6842 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
6843 size of shared library info entry.
6844 * layout.cc (Layout::finish_dynamic_section): Don't test for
6845 incremental link when adding DT_NEEDED entries.
6846 * object.h (Object::Object): Initialize new data member.
6847 (Object::dynobj): New function.
6848 (Object::set_as_needed): New function.
6849 (Object::as_needed): New function.
6850 (Object::do_dynobj): New function.
6851 (Object::as_needed_): New data member.
6852
6853 2011-05-24 Cary Coutant <ccoutant@google.com>
6854
6855 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
6856 info; adjust display of GOT entries.
6857 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6858 vector of input objects; remove file_status_.
6859 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
6860 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
6861 got_plt reader; call target hooks to reserve GOT entries.
6862 (Output_section_incremental_inputs::set_final_data_size): Adjust size
6863 of input file info header and GOT info entry.
6864 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
6865 relocation info.
6866 (Got_plt_view_info::got_descriptor): Remove.
6867 (Got_plt_view_info::sym_index): New data member.
6868 (Got_plt_view_info::input_index): New data member.
6869 (Local_got_offset_visitor::visit): Write input file index.
6870 (Global_got_offset_visitor::visit): Write 0 for input file index.
6871 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
6872 with sym_index and input_index.
6873 (Output_section_incremental_inputs::write_got_plt): Adjust size of
6874 incremental info GOT entry; replace got_descriptor with input_index.
6875 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
6876 map from input file index to object.
6877 (Sized_relobj_incr::do_layout): Replace direct data member reference
6878 with accessor function.
6879 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
6880 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
6881 Adjust size of input file info header.
6882 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
6883 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
6884 (Incremental_input_entry_reader::get_input_section): Adjust size of
6885 input file info header.
6886 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
6887 of incremental info GOT entry.
6888 (Incremental_got_plt_reader::get_got_desc): Remove.
6889 (Incremental_got_plt_reader::get_got_symndx): New function.
6890 (Incremental_got_plt_reader::get_got_input_index): New function.
6891 (Sized_incremental_binary::Sized_incremental_binary): Remove
6892 file_status_; add input_objects_.
6893 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
6894 (Sized_incremental_binary::set_file_is_unchanged): Remove.
6895 (Sized_incremental_binary::file_is_unchanged): Remove.
6896 (Sized_incremental_binary::set_input_object): New function.
6897 (Sized_incremental_binary::input_object): New function.
6898 (Sized_incremental_binary::file_status_): Remove.
6899 (Sized_incremental_binary::input_objects_): New data member.
6900 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
6901 references.
6902 (Sized_relobj_incr::invalid_address): Move to base class.
6903 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
6904 class.
6905 (Sized_relobj_incr::do_output_section_offset): Likewise.
6906 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
6907 (Sized_relobj_incr::section_offsets_): Likewise.
6908 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
6909 function.
6910 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
6911 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
6912 with accessor function.
6913 (Sized_relobj_file::do_layout): Likewise.
6914 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
6915 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
6916 (Sized_relobj_file::compute_final_local_value): Replace refs to
6917 section_offsets_ with accessor function.
6918 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
6919 * object.h (Relobj::Relobj): Initialize new data members.
6920 (Relobj::add_dyn_reloc): New function.
6921 (Relobj::first_dyn_reloc): New function.
6922 (Relobj::dyn_reloc_count): New function.
6923 (Relobj::first_dyn_reloc_): New data member.
6924 (Relobj::dyn_reloc_count_): New data member.
6925 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
6926 references.
6927 (Sized_relobj::Address): New typedef.
6928 (Sized_relobj::invalid_address): Move here from child class.
6929 (Sized_relobj::Sized_relobj): Initialize new data members.
6930 (Sized_relobj::sized_relobj): New function.
6931 (Sized_relobj::is_output_section_offset_invalid): Move here from
6932 child class.
6933 (Sized_relobj::get_output_section_offset): Likewise.
6934 (Sized_relobj::local_has_got_offset): Likewise.
6935 (Sized_relobj::local_got_offset): Likewise.
6936 (Sized_relobj::set_local_got_offset): Likewise.
6937 (Sized_relobj::do_for_all_local_got_entries): Likewise.
6938 (Sized_relobj::clear_got_offsets): New function.
6939 (Sized_relobj::section_offsets): Move here from child class.
6940 (Sized_relobj::do_output_section_offset): Likewise.
6941 (Sized_relobj::do_set_section_offset): Likewise.
6942 (Sized_relobj::Local_got_offsets): Likewise.
6943 (Sized_relobj::local_got_offsets_): Likewise.
6944 (Sized_relobj::section_offsets_): Likewise.
6945 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
6946 references.
6947 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
6948 class.
6949 (Sized_relobj_file::sized_relobj): New function
6950 (Sized_relobj_file::local_has_got_offset): Move to base class.
6951 (Sized_relobj_file::local_got_offset): Likewise.
6952 (Sized_relobj_file::set_local_got_offset): Likewise.
6953 (Sized_relobj_file::get_output_section_offset): Likewise.
6954 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
6955 (Sized_relobj_file::do_output_section_offset): Likewise.
6956 (Sized_relobj_file::do_set_section_offset): Likewise.
6957 (Sized_relobj_file::Local_got_offsets): Likewise.
6958 (Sized_relobj_file::local_got_offsets_): Likewise.
6959 (Sized_relobj_file::section_offsets_): Likewise.
6960 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
6961 (all constructors).
6962 (set_needs_dynsym_index): Convert relobj to derived class pointer.
6963 (Output_reloc::get_symbol_index): Likewise.
6964 (Output_reloc::local_section_offset): Likewise.
6965 (Output_reloc::get_address): Likewise.
6966 (Output_reloc::symbol_value): Likewise.
6967 (Output_data_got::reserve_slot): Move to class definition.
6968 (Output_data_got::reserve_local): New function.
6969 (Output_data_got::reserve_slot_for_global): Remove.
6970 (Output_data_got::reserve_global): New function.
6971 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
6972 (all constructors, two instantiations).
6973 (Output_reloc::get_relobj): New function (two instantiations).
6974 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
6975 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
6976 (Output_data_reloc::add_global): Adjust type of relobj.
6977 (Output_data_reloc::add_global_relative): Likewise.
6978 (Output_data_reloc::add_symbolless_global_addend): Likewise.
6979 (Output_data_reloc::add_local): Likewise.
6980 (Output_data_reloc::add_local_relative): Likewise.
6981 (Output_data_reloc::add_symbolless_local_addend): Likewise.
6982 (Output_data_reloc::add_local_section): Likewise.
6983 (Output_data_reloc::add_output_section): Likewise.
6984 (Output_data_reloc::add_absolute): Likewise.
6985 (Output_data_reloc::add_target_specific): Likewise.
6986 (Output_data_got::reserve_slot): Move definition here.
6987 (Output_data_got::reserve_local): New function.
6988 (Output_data_got::reserve_global): New function.
6989 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
6990 section_offsets_ with accessor function.
6991 (Sized_relobj_file::write_sections): Likewise.
6992 (Sized_relobj_file::do_relocate_sections): Likewise.
6993 * target.h (Sized_target::reserve_local_got_entry): New function.
6994 (Sized_target::reserve_global_got_entry): New function.
6995 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
6996 (Target_x86_64::reserve_global_got_entry): New function.
6997 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
6998
6999 2011-05-23 Cary Coutant <ccoutant@google.com>
7000
7001 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
7002 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
7003 bit when checking got_type.
7004 * incremental.cc (Sized_incremental_binary::setup_readers):
7005 Store symbol table and string table locations; initialize bit vector
7006 of file status flags.
7007 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
7008 unchanged files.
7009 (Sized_incremental_binary::do_process_got_plt): New function.
7010 (Sized_incremental_binary::get_symtab_view): Use stored locations.
7011 (Output_section_incremental_inputs::set_final_data_size): Record
7012 file index for each input file.
7013 (Output_section_incremental_inputs::write_got_plt): Store file index
7014 instead of input entry offset for each GOT entry.
7015 * incremental.h
7016 (Incremental_input_entry::Incremental_input_entry): Initialize new
7017 data member.
7018 (Incremental_input_entry::set_offset): Store file index.
7019 (Incremental_input_entry::get_file_index): New function.
7020 (Incremental_input_entry::file_index_): New data member.
7021 (Incremental_binary::process_got_plt): New function.
7022 (Incremental_binary::do_process_got_plt): New function.
7023 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7024 data members.
7025 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
7026 (Sized_incremental_binary::set_file_is_unchanged): New function.
7027 (Sized_incremental_binary::file_is_unchanged): New function.
7028 (Sized_incremental_binary::do_process_got_plt): New function.
7029 (Sized_incremental_binary::file_status_): New data member.
7030 (Sized_incremental_binary::main_symtab_loc_): New data member.
7031 (Sized_incremental_binary::main_strtab_loc_): New data member.
7032 * output.cc (Output_data_got::Got_entry::write): Add case
7033 RESERVED_CODE.
7034 (Output_data_got::add_global): Call add_got_entry.
7035 (Output_data_got::add_global_plt): Likewise.
7036 (Output_data_got::add_global_with_rel): Likewise.
7037 (Output_data_got::add_global_with_rela): Likewise.
7038 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
7039 (Output_data_got::add_global_pair_with_rela): Likewise.
7040 (Output_data_got::add_local): Call add_got_entry.
7041 (Output_data_got::add_local_plt): Likewise.
7042 (Output_data_got::add_local_with_rel): Likewise.
7043 (Output_data_got::add_local_with_rela): Likewise.
7044 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
7045 (Output_data_got::add_local_pair_with_rela): Likewise.
7046 (Output_data_got::reserve_slot): New function.
7047 (Output_data_got::reserve_slot_for_global): New function.
7048 (Output_data_got::add_got_entry): New function.
7049 (Output_data_got::add_got_entry_pair): New function.
7050 (Output_section::add_output_section_data): Edit FIXME.
7051 * output.h
7052 (Output_section_data_build::Output_section_data_build): New
7053 constructor with size parameter.
7054 (Output_data_space::Output_data_space): Likewise.
7055 (Output_data_got::Output_data_got): Initialize new data member; new
7056 constructor with size parameter.
7057 (Output_data_got::add_constant): Call add_got_entry.
7058 (Output_data_got::reserve_slot): New function.
7059 (Output_data_got::reserve_slot_for_global): New function.
7060 (class Output_data_got::Got_entry): Add RESERVED_CODE.
7061 (Output_data_got::add_got_entry): New function.
7062 (Output_data_got::add_got_entry_pair): New function.
7063 (Output_data_got::free_list_): New data member.
7064 * target.h (Sized_target::init_got_plt_for_update): New function.
7065 (Sized_target::register_global_plt_entry): New function.
7066 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
7067 Initialize new data member; call init; add constructor with PLT count.
7068 (Output_data_plt_x86_64::init): New function.
7069 (Output_data_plt_x86_64::add_relocation): New function.
7070 (Output_data_plt_x86_64::reserve_slot): New function.
7071 (Output_data_plt_x86_64::free_list_): New data member.
7072 (Target_x86_64::init_got_plt_for_update): New function.
7073 (Target_x86_64::register_global_plt_entry): New function.
7074 (Output_data_plt_x86_64::add_entry): Allocate from free list for
7075 incremental updates.
7076 (Output_data_plt_x86_64::add_relocation): New function.
7077 * testsuite/object_unittest.cc (Object_test): Set default options.
7078
7079 2011-05-16 Ian Lance Taylor <iant@google.com>
7080
7081 * options.h (class General_options): Make -i a synonym for -r.
7082
7083 2011-05-16 Ian Lance Taylor <iant@google.com>
7084
7085 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
7086
7087 2011-05-10 Cary Coutant <ccoutant@google.com>
7088
7089 * object.cc (Sized_relobj::do_count_local_symbols): Check for
7090 strip_all (-s).
7091
7092 2011-05-06 Ian Lance Taylor <iant@google.com>
7093
7094 * layout.cc (Layout::layout): If the output section flags change,
7095 update the ordering.
7096
7097 2011-04-25 Cary Coutant <ccoutant@google.com>
7098
7099 * incremental-dump.cc (dump_incremental_inputs): Print local
7100 symbol info for each input file.
7101 * incremental.cc
7102 (Output_section_incremental_inputs::set_final_data_size): Add local
7103 symbol info to input file entries in incremental info.
7104 (Output_section_incremental_inputs::write_info_blocks): Likewise.
7105 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
7106 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
7107 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
7108 implementation.
7109 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
7110 (Sized_incr_relobj::do_relocate): Write the local symbols.
7111 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
7112 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
7113 Adjust size of input file header.
7114 (Incremental_inputs_reader::get_local_symbol_offset): New function.
7115 (Incremental_inputs_reader::get_local_symbol_count): New function.
7116 (Incremental_inputs_reader::get_input_section): Adjust size of input
7117 file header.
7118 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
7119 (Sized_incr_relobj::This): New typedef.
7120 (Sized_incr_relobj::sym_size): New const data member.
7121 (Sized_incr_relobj::Local_symbol): New struct.
7122 (Sized_incr_relobj::do_output_local_symbol_count): New function.
7123 (Sized_incr_relobj::do_local_symbol_offset): New function.
7124 (Sized_incr_relobj::local_symbol_count_): New data member.
7125 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
7126 (Sized_incr_relobj::local_symbol_index_): New data member.
7127 (Sized_incr_relobj::local_symbol_offset_): New data member.
7128 (Sized_incr_relobj::local_dynsym_offset_): New data member.
7129 (Sized_incr_relobj::local_symbols_): New data member.
7130 * object.h (Relobj::output_local_symbol_count): New function.
7131 (Relobj::local_symbol_offset): New function.
7132 (Relobj::do_output_local_symbol_count): New function.
7133 (Relobj::do_local_symbol_offset): New function.
7134 (Sized_relobj::do_output_local_symbol_count): New function.
7135 (Sized_relobj::do_local_symbol_offset): New function.
7136
7137 2011-04-22 Vladimir Simonov <sv@sw.ru>
7138
7139 * descriptors.cc (set_close_on_exec): New function.
7140 (Descriptors::open): Use set_close_on_exec.
7141 * output.cc (S_ISLNK): Define if not defined.
7142
7143 2011-04-22 Cary Coutant <ccoutant@google.com>
7144
7145 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7146 global symbol map.
7147 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7148 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
7149 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
7150 relocations.
7151 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
7152 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
7153 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
7154 * incremental.h
7155 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
7156 function.
7157 (Incremental_binary::apply_incremental_relocs): New function.
7158 (Incremental_binary::do_apply_incremental_relocs): New function.
7159 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7160 data member.
7161 (Sized_incremental_binary::add_global_symbol): New function.
7162 (Sized_incremental_binary::global_symbol): New function.
7163 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7164 (Sized_incremental_binary::symbol_map_): New data member.
7165 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
7166 * target.h (Sized_target::apply_relocation): New function.
7167 * target-reloc.h (apply_relocation): New function.
7168 * x86_64.cc (Target_x86_64::apply_relocation): New function.
7169
7170 2011-04-22 Doug Kwan <dougkwan@google.com>
7171
7172 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
7173 flag of a SHT_ARM_EXIDX section.
7174 * testsuite/Makefile.am (arm_exidx_test): New test rules.
7175 * testsuite/Makefile.in: Regenerate.
7176 * testsuite/arm_exidx_test.s: New file.
7177 * testsuite/arm_exidx_test.sh: Same.
7178
7179 2011-04-20 Cary Coutant <ccoutant@google.com>
7180
7181 PR gold/12689
7182 * archive.h (Incremental_archive_entry::Archive_member):
7183 Initialize arg_serial_ (second constructor).
7184
7185 2011-04-17 Ian Lance Taylor <iant@google.com>
7186
7187 * object.cc (Relocate_info::location): Simplify location string.
7188 * errors.cc (Errors::error_at_location): Don't print program
7189 name.
7190 (Errors::warning_at_location): Likewise.
7191 (Errors::undefined_symbol): Likewise.
7192 * testsuite/debug_msg.sh: Update accordingly.
7193
7194 2011-04-14 Cary Coutant <ccoutant@google.com>
7195
7196 * gold/layout.cc (Layout::symtab_section_offset): New function.
7197 * gold/layout.h (Layout::symtab_section_offset): New function.
7198 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
7199
7200 2011-04-12 Ian Lance Taylor <iant@google.com>
7201
7202 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
7203 with MREMAP_MAYMOVE.
7204 * output.h (class Output_file): Add map_is_allocated_ field.
7205 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
7206 not available, provide stubs. If mremap is not available, #define
7207 it to gold_mremap.
7208 (MREMAP_MAYMOVE): Define if not defined.
7209 (Output_file::Output_file): Initialize map_is_allocated_.
7210 (Output_file::resize): Check map_is_allocated_.
7211 (Output_file::map_anonymous): If mmap fails, use malloc.
7212 (Output_file::unmap): Don't do anything for an anonymous map.
7213 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
7214 is not available, provide stubs.
7215 (File_read::View::~View): Use free rather than delete[].
7216 (File_read::make_view): Use malloc rather than new[]. If mmap
7217 fails, use malloc.
7218 (File_read::find_or_make_view): Use malloc rather than new[].
7219 * gold.h: Remove HAVE_REMAP code.
7220 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
7221 exists. Rename mremap to gold_mremap. If mmap is not available
7222 don't do anything.
7223 * configure, config.in: Rebuild.
7224
7225 2011-04-11 Ian Lance Taylor <iant@google.com>
7226
7227 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
7228 initialize local variable v.
7229
7230 2011-04-11 Cary Coutant <ccoutant@google.com>
7231
7232 * archive.cc (Archive::include_member): Adjust call to
7233 report_object.
7234 (Add_archive_symbols::run): Track argument serial numbers.
7235 (Lib_group::include_member): Likewise.
7236 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
7237 * archive.h (Incremental_archive_entry::Archive_member):
7238 Initialize arg_serial_.
7239 (Archive_member::arg_serial_): New data member.
7240 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
7241 (Sized_dynobj::do_add_symbols): Track symbols when doing an
7242 incremental link.
7243 (Sized_dynobj::do_for_all_local_got_entries): New function.
7244 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
7245 function.
7246 * fileread.cc (get_mtime): New function.
7247 * fileread.h (get_mtime): New function.
7248 * gold.cc (queue_initial_tasks): Check for incremental update.
7249 (process_incremental_input): New function.
7250 (queue_middle_tasks): Don't force valid target for incremental
7251 update.
7252 * incremental-dump.cc (find_input_containing_global): Adjust
7253 size of symbol info entry.
7254 (dump_incremental_inputs): Dump argument serial number and
7255 in_system_directory flag; bias shndx by 1; print symbol names
7256 when dumping per-file symbol lists; use new symbol info readers.
7257 * incremental.cc
7258 (Output_section_incremental_inputs:update_data_size): New function.
7259 (Sized_incremental_binary::setup_readers): Setup input readers
7260 for each input file; build maps for files added from libraries
7261 and scripts.
7262 (Sized_incremental_binary::check_input_args): New function.
7263 (Sized_incremental_binary::do_check_inputs): Build map of argument
7264 serial numbers to input arguments.
7265 (Sized_incremental_binary::do_file_has_changed): Rename
7266 do_file_is_unchanged to this; compare file modification times.
7267 (Sized_incremental_binary::do_init_layout): New function.
7268 (Sized_incremental_binary::do_reserve_layout): New function.
7269 (Sized_incremental_binary::do_get_input_reader): Remove.
7270 (Sized_incremental_binary::get_symtab_view): New function.
7271 (Incremental_checker::can_incrementally_link_output_file): Remove.
7272 (Incremental_inputs::report_command_line): Exclude --debug options.
7273 (Incremental_inputs::report_archive_begin): Add parameter; track
7274 argument serial numbers; don't put input file entry for archive
7275 before archive members.
7276 (Incremental_inputs::report_archive_end): Put input file entry
7277 for archive after archive members.
7278 (Incremental_inputs::report_object): Add parameter; track argument
7279 serial numbers and in_system_directory flag.
7280 (Incremental_inputs::report_script): Add parameter; track argument
7281 serial numbers.
7282 (Output_section_incremental_inputs::set_final_data_size): Adjust
7283 size of symbol info entry; check for forwarding symbols.
7284 (Output_section_incremental_inputs::write_input_files): Write
7285 in_system_directory flag and argument serial number.
7286 (Output_section_incremental_inputs::write_info_blocks): Map section
7287 indices between incremental info and original input file; store
7288 input section index for each symbol.
7289 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
7290 change operator() to visit().
7291 (class Global_got_offset_visitor): Likewise.
7292 (class Global_symbol_visitor_got_plt):
7293 (Output_section_incremental_inputs::write_got_plt): Use new visitor
7294 classes.
7295 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
7296 (Sized_incr_relobj::do_read_symbols): New function.
7297 (Sized_incr_relobj::do_layout): New function.
7298 (Sized_incr_relobj::do_layout_deferred_sections): New function.
7299 (Sized_incr_relobj::do_add_symbols): New function.
7300 (Sized_incr_relobj::do_should_include_member): New function.
7301 (Sized_incr_relobj::do_for_all_global_symbols): New function.
7302 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
7303 (Sized_incr_relobj::do_section_size): New function.
7304 (Sized_incr_relobj::do_section_name): New function.
7305 (Sized_incr_relobj::do_section_contents): New function.
7306 (Sized_incr_relobj::do_section_flags): New function.
7307 (Sized_incr_relobj::do_section_entsize): New function.
7308 (Sized_incr_relobj::do_section_address): New function.
7309 (Sized_incr_relobj::do_section_type): New function.
7310 (Sized_incr_relobj::do_section_link): New function.
7311 (Sized_incr_relobj::do_section_info): New function.
7312 (Sized_incr_relobj::do_section_addralign): New function.
7313 (Sized_incr_relobj::do_initialize_xindex): New function.
7314 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
7315 (Sized_incr_relobj::do_read_relocs): New function.
7316 (Sized_incr_relobj::do_gc_process_relocs): New function.
7317 (Sized_incr_relobj::do_scan_relocs): New function.
7318 (Sized_incr_relobj::do_count_local_symbols): New function.
7319 (Sized_incr_relobj::do_finalize_local_symbols): New function.
7320 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
7321 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
7322 (Sized_incr_relobj::do_relocate): New function.
7323 (Sized_incr_relobj::do_set_section_offset): New function.
7324 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
7325 (Sized_incr_dynobj::do_read_symbols): New function.
7326 (Sized_incr_dynobj::do_layout): New function.
7327 (Sized_incr_dynobj::do_add_symbols): New function.
7328 (Sized_incr_dynobj::do_should_include_member): New function.
7329 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
7330 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
7331 (Sized_incr_dynobj::do_section_size): New function.
7332 (Sized_incr_dynobj::do_section_name): New function.
7333 (Sized_incr_dynobj::do_section_contents): New function.
7334 (Sized_incr_dynobj::do_section_flags): New function.
7335 (Sized_incr_dynobj::do_section_entsize): New function.
7336 (Sized_incr_dynobj::do_section_address): New function.
7337 (Sized_incr_dynobj::do_section_type): New function.
7338 (Sized_incr_dynobj::do_section_link): New function.
7339 (Sized_incr_dynobj::do_section_info): New function.
7340 (Sized_incr_dynobj::do_section_addralign): New function.
7341 (Sized_incr_dynobj::do_initialize_xindex): New function.
7342 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
7343 (make_sized_incremental_object): New function.
7344 (Incremental_library::copy_unused_symbols): New function.
7345 (Incremental_library::do_for_all_unused_symbols): New function.
7346 * incremental.h (enum Incremental_input_flags): New type.
7347 (class Incremental_checker): Remove.
7348 (Incremental_input_entry::Incremental_input_entry): Add argument
7349 serial number.
7350 (Incremental_input_entry::arg_serial): New function.
7351 (Incremental_input_entry::set_is_in_system_directory): New function.
7352 (Incremental_input_entry::is_in_system_directory): New function.
7353 (Incremental_input_entry::arg_serial_): New data member.
7354 (Incremental_input_entry::is_in_system_directory_): New data member.
7355 (class Script_info): Move here from script.h.
7356 (Script_info::Script_info): Add filename parameter.
7357 (Script_info::filename): New function.
7358 (Script_info::filename_): New data member.
7359 (Incremental_script_entry::Incremental_script_entry): Add argument
7360 serial number.
7361 (Incremental_object_entry::Incremental_object_entry): Likewise.
7362 (Incremental_object_entry::add_input_section): Build list of input
7363 sections with map to original shndx.
7364 (Incremental_object_entry::get_input_section_index): New function.
7365 (Incremental_object_entry::shndx_): New data member.
7366 (Incremental_object_entry::name_key_): Rename; adjust all refs.
7367 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
7368 (Incremental_archive_entry::Incremental_archive_entry): Add argument
7369 serial number.
7370 (Incremental_inputs::report_archive_begin): Likewise.
7371 (Incremental_inputs::report_object): Likewise.
7372 (Incremental_inputs::report_script): Likewise.
7373 (class Incremental_global_symbol_reader): New class.
7374 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
7375 and store flags and input file type.
7376 (Incremental_input_entry_reader::arg_serial): New function.
7377 (Incremental_input_entry_reader::type): Extract type from flags.
7378 (Incremental_input_entry_reader::is_in_system_directory): New function.
7379 (Incremental_input_entry_reader::get_input_section_count): Call
7380 accessor function for type.
7381 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
7382 function for type; adjust size of global symbol entry.
7383 (Incremental_input_entry_reader::get_global_symbol_count): Call
7384 accessor function for type.
7385 (Incremental_input_entry_reader::get_object_count): Likewise.
7386 (Incremental_input_entry_reader::get_object_offset): Likewise.
7387 (Incremental_input_entry_reader::get_member_count): Likewise.
7388 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
7389 (Incremental_input_entry_reader::get_member_offset): Likewise.
7390 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
7391 (Incremental_input_entry_reader::Global_symbol_info): Remove.
7392 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
7393 (Incremental_input_entry_reader::get_global_symbol_reader): New
7394 function.
7395 (Incremental_input_entry_reader::get_output_symbol_index): New
7396 function.
7397 (Incremental_input_entry_reader::type_): Remove.
7398 (Incremental_input_entry_reader::flags_): New data member.
7399 (Incremental_inputs_reader::input_file_offset): New function.
7400 (Incremental_inputs_reader::input_file_index): New function.
7401 (Incremental_inputs_reader::input_file): Call input_file_offset.
7402 (Incremental_inputs_reader::input_file_at_offset): New function.
7403 (Incremental_relocs_reader::get_r_type): Reformat.
7404 (Incremental_relocs_reader::get_r_shndx): Reformat.
7405 (Incremental_relocs_reader::get_r_offset): Reformat.
7406 (Incremental_relocs_reader::data): New function.
7407 (Incremental_binary::Incremental_binary): Initialize new data members.
7408 (Incremental_binary::check_inputs): Add cmdline parameter.
7409 (Incremental_binary::file_is_unchanged): Remove.
7410 (Input_reader::arg_serial): New function.
7411 (Input_reader::get_unused_symbol_count): New function.
7412 (Input_reader::get_unused_symbol): New function.
7413 (Input_reader::do_arg_serial): New function.
7414 (Input_reader::do_get_unused_symbol_count): New function.
7415 (Input_reader::do_get_unused_symbol): New function.
7416 (Incremental_binary::input_file_count): New function.
7417 (Incremental_binary::get_input_reader): Change signature to use
7418 index instead of filename.
7419 (Incremental_binary::file_has_changed): New function.
7420 (Incremental_binary::get_input_argument): New function.
7421 (Incremental_binary::get_library): New function.
7422 (Incremental_binary::get_script_info): New function.
7423 (Incremental_binary::init_layout): New function.
7424 (Incremental_binary::reserve_layout): New function.
7425 (Incremental_binary::output_file): New function.
7426 (Incremental_binary::do_check_inputs): New function.
7427 (Incremental_binary::do_file_is_unchanged): Remove.
7428 (Incremental_binary::do_file_has_changed): New function.
7429 (Incremental_binary::do_init_layout): New function.
7430 (Incremental_binary::do_reserve_layout): New function.
7431 (Incremental_binary::do_input_file_count): New function.
7432 (Incremental_binary::do_get_input_reader): Change signature.
7433 (Incremental_binary::input_args_map_): New data member.
7434 (Incremental_binary::library_map_): New data member.
7435 (Incremental_binary::script_map_): New data member.
7436 (Sized_incremental_binary::Sized_incremental_binary): Initialize
7437 new data members.
7438 (Sized_incremental_binary::output_section): New function.
7439 (Sized_incremental_binary::inputs_reader): Add const.
7440 (Sized_incremental_binary::symtab_reader): Add const.
7441 (Sized_incremental_binary::relocs_reader): Add const.
7442 (Sized_incremental_binary::got_plt_reader): Add const.
7443 (Sized_incremental_binary::get_symtab_view): New function.
7444 (Sized_incremental_binary::Inputs_reader): New typedef.
7445 (Sized_incremental_binary::Input_entry_reader): New typedef.
7446 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
7447 (Sized_incremental_binary::do_file_is_unchanged): Remove.
7448 (Sized_incremental_binary::do_file_has_changed): New function.
7449 (Sized_incremental_binary::do_init_layout): New function.
7450 (Sized_incremental_binary::do_reserve_layout): New function.
7451 (Sized_input_reader::Inputs_reader): Remove.
7452 (Sized_input_reader::Input_entry_reader): Remove.
7453 (Sized_input_reader::do_arg_serial): New function.
7454 (Sized_input_reader::do_get_unused_symbol_count): New function.
7455 (Sized_input_reader::do_get_unused_symbol): New function.
7456 (Sized_incremental_binary::do_input_file_count): New function.
7457 (Sized_incremental_binary::do_get_input_reader): Change signature;
7458 use index instead of filename.
7459 (Sized_incremental_binary::section_map_): New data member.
7460 (Sized_incremental_binary::input_entry_readers_): New data member.
7461 (class Sized_incr_relobj): New class.
7462 (class Sized_incr_dynobj): New class.
7463 (make_sized_incremental_object): New function.
7464 (class Incremental_library): New class.
7465 * layout.cc (Free_list::num_lists): New static data member.
7466 (Free_list::num_nodes): New static data member.
7467 (Free_list::num_removes): New static data member.
7468 (Free_list::num_remove_visits): New static data member.
7469 (Free_list::num_allocates): New static data member.
7470 (Free_list::num_allocate_visits): New static data member.
7471 (Free_list::init): New function.
7472 (Free_list::remove): New function.
7473 (Free_list::allocate): New function.
7474 (Free_list::dump): New function.
7475 (Free_list::print_stats): New function.
7476 (Layout_task_runner::run): Resize output file for incremental updates.
7477 (Layout::Layout): Initialize new data members.
7478 (Layout::set_incremental_base): New function.
7479 (Layout::init_fixed_output_section): New function.
7480 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
7481 incremental updates.
7482 (Layout::create_gold_note): Do not create gold note section for
7483 incremental updates.
7484 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
7485 for incremental updates.
7486 (Layout::set_section_offsets): For incremental updates, allocate space
7487 from free list.
7488 (Layout::create_symtab_sections): Layout with offsets relative to
7489 start of section; for incremental updates, allocate space from free
7490 list.
7491 (Layout::create_shdrs): For incremental updates, allocate space from
7492 free list.
7493 (Layout::finish_dynamic_section): For incremental updates, do not
7494 check --as-needed (fixed in subsequent patch).
7495 * layout.h (class Free_list): New class.
7496 (Layout::set_incremental_base): New function.
7497 (Layout::incremental_base): New function.
7498 (Layout::init_fixed_output_section): New function.
7499 (Layout::allocate): New function.
7500 (Layout::incremental_base_): New data member.
7501 (Layout::free_list_): New data member.
7502 * main.cc (main): Print Free_list statistics.
7503 * object.cc (Relobj::finalize_incremental_relocs): Add
7504 clear_counts parameter; clear counts only when clear_counts is set.
7505 (Sized_relobj::Sized_relobj): Initialize new base class.
7506 (Sized_relobj::do_layout): Don't report special sections.
7507 (Sized_relobj::do_for_all_local_got_entries): New function.
7508 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
7509 symtab_off to all symbol table offsets.
7510 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
7511 * object.h (class Got_offset_list): Move to top of file.
7512 (Object::Object): Allow case where input_file == NULL.
7513 (Object::~Object): Likewise.
7514 (Object::input_file): Assert that input_file != NULL.
7515 (Object::lock): Allow case where input_file == NULL.
7516 (Object::unlock): Likewise.
7517 (Object::is_locked): Likewise.
7518 (Object::token): Likewise.
7519 (Object::release): Likewise.
7520 (Object::is_incremental): New function.
7521 (Object::get_mtime): New function.
7522 (Object::for_all_local_got_entries): New function.
7523 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
7524 (Object::set_is_in_system_directory): New function.
7525 (Object::is_in_system_directory): New function.
7526 (Object::do_is_incremental): New function.
7527 (Object::do_get_mtime): New function.
7528 (Object::do_for_all_local_got_entries): New function.
7529 (Object::is_in_system_directory_): New data member.
7530 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
7531 (class Sized_relobj_base): New class.
7532 (class Sized_relobj): Derive from Sized_relobj_base.
7533 (class Sized_relobj::Symbols): Redeclare from base class.
7534 (class Sized_relobj::local_got_offset_list): Remove.
7535 (class Sized_relobj::Output_sections): Redeclare from base class.
7536 (class Sized_relobj::do_for_all_local_got_entries): New function.
7537 (class Sized_relobj::write_local_symbols): Add offset parameter.
7538 (class Sized_relobj::local_symbol_offset_): Update comment.
7539 (class Sized_relobj::local_dynsym_offset_): Update comment.
7540 * options.cc (Input_arguments::add_file): Remove const.
7541 * options.h (Input_file_argument::Input_file_argument):
7542 Initialize arg_serial_ (all constructors).
7543 (Input_file_argument::set_arg_serial): New function.
7544 (Input_file_argument::arg_serial): New function.
7545 (Input_file_argument::arg_serial_): New data member.
7546 (Input_arguments::Input_arguments): Initialize file_count_.
7547 (Input_arguments::add_file): Remove const.
7548 (Input_arguments::number_of_input_files): New function.
7549 (Input_arguments::file_count_): New data member.
7550 (Command_line::number_of_input_files): Call
7551 Input_arguments::number_of_input_files.
7552 * output.cc (Output_segment_headers::Output_segment_headers):
7553 Set current size.
7554 (Output_section::Input_section::current_data_size): New function.
7555 (Output_section::Output_section): Initialize new data members.
7556 (Output_section::add_input_section): Don't do merge sections for
7557 an incremental link; allocate space from free list for an
7558 incremental update.
7559 (Output_section::add_output_section_data): Allocate space from
7560 free list for an incremental update.
7561 (Output_section::update_data_size): New function.
7562 (Output_section::set_fixed_layout): New function.
7563 (Output_section::reserve): New function.
7564 (Output_segment::set_section_addresses): Remove const.
7565 (Output_segment::set_section_list_addresses): Remove const; allocate
7566 space from free list for an incremental update.
7567 (Output_segment::set_offset): Adjust size of RELRO segment for an
7568 incremental update.
7569 * output.h (Output_data::current_data_size): Move here from
7570 child classes.
7571 (Output_data::pre_finalize_data_size): New function.
7572 (Output_data::update_data_size): New function.
7573 (Output_section_headers::update_data_size): new function.
7574 (Output_section_data_build::current_data_size): Move to Output_data.
7575 (Output_data_strtab::update_data_size): New function.
7576 (Output_section::current_data_size): Move to Output_data.
7577 (Output_section::set_fixed_layout): New function.
7578 (Output_section::has_fixed_layout): New function.
7579 (Output_section::reserve): New function.
7580 (Output_section::update_data_size): New function.
7581 (Output_section::has_fixed_layout_): New data member.
7582 (Output_section::free_list_): New data member.
7583 (Output_segment::set_section_addresses): Remove const.
7584 (Output_segment::set_section_list_addresses): Remove const.
7585 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
7586 New function.
7587 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
7588 New function.
7589 * readsyms.cc (Read_symbols::do_read_symbols): Add library
7590 parameter when calling Add_symbols constructor; store argument
7591 serial number for members of a lib group.
7592 (Add_symbols::locks): Allow case where token == NULL.
7593 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
7594 (Read_member::~Read_member): New function.
7595 (Read_member::is_runnable): New function.
7596 (Read_member::locks): New function.
7597 (Read_member::run): New function.
7598 (Check_script::~Check_script): New function.
7599 (Check_script::is_runnable): New function.
7600 (Check_script::locks): New function.
7601 (Check_script::run): New function.
7602 (Check_library::~Check_library): New function.
7603 (Check_library::is_runnable): New function.
7604 (Check_library::locks): New function.
7605 (Check_library::run): New function.
7606 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
7607 (Add_symbols::library_): New data member.
7608 (class Read_member): New class.
7609 (class Check_script): New class.
7610 (class Check_library): New class.
7611 * reloc.cc (Read_relocs::is_runnable): Allow case where
7612 token == NULL.
7613 (Read_relocs::locks): Likewise.
7614 (Scan_relocs::locks): Likewise.
7615 (Relocate_task::locks): Likewise.
7616 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
7617 to clear counters.
7618 (Sized_relobj::incremental_relocs_scan): Fix comment.
7619 (Sized_relobj::do_relocate): Pass output file offset to
7620 write_local_symbols.
7621 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
7622 from class declaration.
7623 * script.cc (read_input_script): Allocate Script_info; pass
7624 argument serial number to report_script.
7625 * script.h (class Script_info): Move to incremental.h.
7626 * symtab.cc (Symbol_table::add_from_incrobj): New function.
7627 * symtab.h (Symbol_table::add_from_incrobj): New function.
7628 (Symbol_table::set_file_offset): New function.
7629
7630 2011-04-05 Cary Coutant <ccoutant@google.com>
7631
7632 * incremental-dump.cc (dump_incremental_inputs): Change signature
7633 to take a Sized_incremental_binary; change caller. Use readers
7634 in Sized_incremental_binary.
7635 * incremental.cc
7636 (Sized_incremental_binary::find_incremental_inputs_sections):
7637 Rename do_find_incremental_inputs_sections to this.
7638 (Sized_incremental_binary::setup_readers): New function.
7639 (Sized_incremental_binary::do_check_inputs): Check
7640 has_incremental_info_ flag; move setup code to setup_readers;
7641 use input readers.
7642 (Sized_incremental_binary::do_file_is_unchanged): New function.
7643 (Sized_incremental_binary::do_get_input_reader): New function.
7644 * incremental.h (class Incremental_binary): Move to end of file.
7645 (Incremental_binary::file_is_unchanged): New function.
7646 (Incremental_binary::do_file_is_unchanged): New function.
7647 (Incremental_binary::Input_reader): New class.
7648 (Incremental_binary::get_input_reader): New function.
7649 (class Sized_incremental_binary): Move to end of file.
7650 (Sized_incremental_binary::Sized_incremental_binary): Setup the
7651 input section reader classes.
7652 (Sized_incremental_binary::has_incremental_info): New function.
7653 (Sized_incremental_binary::inputs_reader): New function.
7654 (Sized_incremental_binary::symtab_reader): New function.
7655 (Sized_incremental_binary::relocs_reader): New function.
7656 (Sized_incremental_binary::got_plt_reader): New function.
7657 (Sized_incremental_binary::do_file_is_unchanged): New function.
7658 (Sized_incremental_binary::Sized_input_reader): New class.
7659 (Sized_incremental_binary::get_input_reader): New function.
7660 (Sized_incremental_binary::find_incremental_inputs_sections):
7661 Rename do_find_incremental_inputs_sections to this.
7662 (Sized_incremental_binary::setup_readers): New function.
7663 (Sized_incremental_binary::has_incremental_info_): New data member.
7664 (Sized_incremental_binary::inputs_reader_): New data member.
7665 (Sized_incremental_binary::symtab_reader_): New data member.
7666 (Sized_incremental_binary::relocs_reader_): New data member.
7667 (Sized_incremental_binary::got_plt_reader_): New data member.
7668 (Sized_incremental_binary::current_input_file_): New data member.
7669
7670 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
7671
7672 PR gold/12640
7673 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
7674 violation.
7675
7676 2011-03-30 Cary Coutant <ccoutant@google.com>
7677
7678 * archive.cc (Archive::include_member): Adjust call to report_object.
7679 (Add_archive_symbols::run): Add script_info to call to
7680 report_archive_begin.
7681 (Lib_group::include_member): Adjust call to report_object.
7682 (Add_lib_group_symbols::run): Adjust call to report_object.
7683 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
7684 blocks. Add object count for script input files.
7685 * incremental.cc (Incremental_inputs::report_archive_begin): Add
7686 script_info parameter; change all callers.
7687 (Incremental_inputs::report_object): Add script_info parameter;
7688 change all callers.
7689 (Incremental_inputs::report_script): Store backpointer to
7690 incremental info entry.
7691 (Output_section_incremental_inputs::set_final_data_size): Record
7692 additional information for scripts.
7693 (Output_section_incremental_inputs::write_info_blocks): Likewise.
7694 * incremental.h (Incremental_script_entry::add_object): New function.
7695 (Incremental_script_entry::get_object_count): New function.
7696 (Incremental_script_entry::get_object): New function.
7697 (Incremental_script_entry::objects_): New data member; adjust
7698 constructor.
7699 (Incremental_inputs::report_archive_begin): Add script_info parameter.
7700 (Incremental_inputs::report_object): Add script_info parameter.
7701 (Incremental_inputs_reader::get_object_count): New function.
7702 (Incremental_inputs_reader::get_object_offset): New function.
7703 * options.cc (Input_arguments::add_file): Return reference to
7704 new input argument.
7705 * options.h (Input_argument::set_script_info): New function.
7706 (Input_argument::script_info): New function.
7707 (Input_argument::script_info_): New data member; adjust all
7708 constructors.
7709 (Input_file_group::add_file): Return reference to new input argument.
7710 (Input_file_lib::add_file): Likewise.
7711 (Input_arguments::add_file): Likewise.
7712 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
7713 * script.cc (Parser_closure::Parser_closure): Add script_info
7714 parameter; adjust all callers.
7715 (Parser_closure::script_info): New function.
7716 (Parser_closure::script_info_): New data member.
7717 (read_input_script): Report scripts earlier to incremental info.
7718 (script_add_file): Set script_info in Input_argument.
7719 (script_add_library): Likewise.
7720 * script.h (Script_options::Script_info): Rewrite class.
7721
7722 2011-03-29 Cary Coutant <ccoutant@google.com>
7723
7724 * archive.cc (Library_base::should_include_member): Move
7725 method here from class Archive.
7726 (Archive::Archive): Initialize base class.
7727 (Archive::should_include_member): Move to base class.
7728 (Archive::do_for_all_unused_symbols): New function.
7729 (Add_archive_symbols::run): Remove redundant access to
7730 incremental_inputs.
7731 (Lib_group::Lib_group): Initialize base class.
7732 (Lib_group::do_filename): New function.
7733 (Lib_group::include_member): Pass pointer to Lib_group to
7734 report_object.
7735 (Lib_group::do_for_all_unused_symbols): New function.
7736 (Add_lib_group_symbols::run): Report archive information for
7737 incremental links.
7738 * archive.h (class Library_base): New base class.
7739 (class Archive): Derive from Library_base.
7740 (Archive::filename): Move to base class.
7741 (Archive::set_incremental_info): Likewise.
7742 (Archive::incremental_info): Likewise.
7743 (Archive::Should_include): Likewise.
7744 (Archive::should_include_member): Likewise.
7745 (Archive::Armap_entry): Remove.
7746 (Archive::Unused_symbol_iterator): Remove.
7747 (Archive::unused_symbols_begin): Remove.
7748 (Archive::unused_symbols_end): Remove.
7749 (Archive::do_filename): New function.
7750 (Archive::do_get_mtime): New function.
7751 (Archive::do_for_all_unused_symbols): New function.
7752 (Archive::task_): Move to base class.
7753 (Archive::incremental_info_): Likewise.
7754 (class Lib_group): Derive from Library_base.
7755 (Lib_group::do_filename): New function.
7756 (Lib_group::do_get_mtime): New function.
7757 (Lib_group::do_for_all_unused_symbols): New function.
7758 (Lib_group::task_): Move to base class.
7759 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
7760 function.
7761 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
7762 function.
7763 * incremental.cc (Incremental_inputs::report_archive_begin):
7764 Use Library_base; call library's get_mtime; add incremental inputs
7765 entry before members.
7766 (class Unused_symbol_visitor): New class.
7767 (Incremental_inputs::report_archive_end): Use Library_base; use
7768 visitor class to record unused symbols; don't add incremental inputs
7769 entry after members.
7770 (Incremental_inputs::report_object): Use Library_base.
7771 * incremental.h
7772 (Incremental_archive_entry::Incremental_archive_entry): Remove
7773 unused Archive parameter.
7774 (Incremental_inputs::report_archive_begin): Use Library_base.
7775 (Incremental_inputs::report_archive_end): Likewise.
7776 (Incremental_inputs::report_object): Likewise.
7777 * object.cc (Sized_relobj::do_for_all_global_symbols): New
7778 function.
7779 * object.h (Object::for_all_global_symbols): New function.
7780 (Object::do_for_all_global_symbols): New function.
7781 (Sized_relobj::do_for_all_global_symbols): New function.
7782 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
7783 function.
7784 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
7785 function.
7786
7787 2011-03-27 Ian Lance Taylor <iant@google.com>
7788
7789 * archive.cc (Archive::interpret_header): Return -1 if something
7790 goes wrong. Change callers accordingly.
7791
7792 2011-03-25 Cary Coutant <ccoutant@google.com>
7793
7794 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
7795 * testsuite/Makefile.in: Regenerate.
7796
7797 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
7798
7799 * plugin.cc (get_view): New.
7800 (Plugin::load): Pass get_view to the plugin.
7801 (Plugin_manager::get_view): New.
7802
7803 2011-03-21 Ian Lance Taylor <iant@google.com>
7804
7805 * testsuite/final_layout.sh: Rewrite to not use dc.
7806 * testsuite/relro_test.sh: Fail if dc is not present.
7807
7808 2011-03-21 Sriraman Tallam <tmsriram@google.com>
7809
7810 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
7811 Change == to -eq.
7812 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
7813 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
7814 Change == to -eq.
7815 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
7816 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
7817
7818 2011-03-14 Ian Lance Taylor <iant@google.com>
7819
7820 * script-sections.cc (Sort_output_sections::script_compare):
7821 Rename from is_before, change return type.
7822 (Sort_output_sections::operator()): Adjust accordingly.
7823
7824 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
7825
7826 PR gold/12572
7827 * testsuite/odr_violation2.cc: Add comment to make all error line
7828 numbers double digits.
7829 * testsuite/debug_msg.sh: Adjust expected errors.
7830
7831 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
7832
7833 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
7834 but mark earlier ones as non-canonical
7835 (offset_to_iterator): Update search target and example
7836 (do_addr2line): Return extra lines in a vector*
7837 (format_file_lineno): Extract from do_addr2line
7838 (one_addr2line): Add vector* out-param
7839 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
7840 when a lineno entry appeared last for its instruction
7841 (Dwarf_line_info): Add vector* out-param
7842 * object.cc (Relocate_info): Pass NULL for the vector* out-param
7843 * symtab.cc (Odr_violation_compare): Include the lineno in the
7844 comparison again.
7845 (linenos_from_loc): New. Combine the canonical line for an
7846 address with its other lines.
7847 (True_if_intersect): New. Helper functor to make
7848 std::set_intersection a query.
7849 (detect_odr_violations): Compare sets of lines instead of just
7850 one line for each function. This became less deterministic, but
7851 has fewer false positives.
7852 * symtab.h: Declarations.
7853 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
7854 mix an optimized and non-optimized object in the same binary
7855 (odr_violation2.so): Same.
7856 * testsuite/Makefile.in: Regenerate from Makefile.am.
7857 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
7858 * testsuite/debug_msg.sh: Update line numbers and add
7859 assertions.
7860 * testsuite/odr_violation1.cc: Use OdrDerived, in a
7861 non-optimized context.
7862 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
7863 isn't inlined, and use OdrDerived in an optimized context.
7864 * testsuite/odr_header1.h: Defines OdrDerived, where
7865 optimization will change the
7866 first-instruction-in-the-destructor's file and line number.
7867 * testsuite/odr_header2.h: Defines OdrBase.
7868
7869 2011-03-09 Ian Lance Taylor <iant@google.com>
7870
7871 * fileread.cc (File_read::clear_views): Don't delete the whole
7872 file view.
7873
7874 2011-03-08 Ian Lance Taylor <iant@google.com>
7875
7876 PR gold/12525
7877 * fileread.cc: #include <climits>.
7878 (GOLD_IOV_MAX): Define.
7879 (File_read::read_multiple): Limit number of entries by iov_max.
7880 * fileread.h (class File_read): Always set max_readv_entries to
7881 128.
7882
7883 2011-03-07 Ian Lance Taylor <iant@google.com>
7884
7885 PR gold/12525
7886 * options.h (class General_options): Add -dy and -dn.
7887
7888 2011-03-02 Cary Coutant <ccoutant@google.com>
7889
7890 * testsuite/script_test_9.t: Add TLS segment.
7891
7892 2011-03-02 Simon Baldwin <simonb@google.com>
7893
7894 * configure.ac: Add check for gnu_indirect_function support in
7895 the toolchain building binutils.
7896 * configure: Rebuild.
7897
7898 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
7899
7900 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
7901 plugin only symbols.
7902 (Symbol_table::sized_finalize_symbol) Mark symbol only present
7903 in plugin files as not needed in the symbol table.
7904
7905 2011-02-11 Sriraman Tallam <tmsriram@google.com>
7906
7907 * output.cc (Output_section::add_input_section): Delay fill
7908 generation for section ordering.
7909
7910 2011-02-09 Ian Lance Taylor <iant@google.com>
7911
7912 PR gold/12316
7913 * object.h (class Sized_relobj): Remove clear_local_symbols.
7914 * reloc.cc (Sized_relobj::do_relocate): Don't call
7915 clear_local_symbols.
7916
7917 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
7918
7919 * plugin.cc (is_visible_from_outside): Return true for symbols
7920 in the -u option.
7921
7922 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
7923
7924 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
7925 filename.
7926
7927 2011-02-02 Sriraman Tallam <tmsriram@google.com>
7928
7929 * icf.h (is_section_foldable_candidate): Change type of parameter
7930 to std::string.
7931 * icf.cc (Icf::find_identical_sections): Change type of local variable
7932 section_name to be std::string.
7933 (is_function_ctor_or_dtor): Change type of parameter to std::string.
7934
7935 2011-01-25 Ian Lance Taylor <iant@google.com>
7936
7937 * script.cc (script_add_extern): Rewrite to use
7938 add_symbol_reference.
7939
7940 2011-01-25 Doug Kwan <dougkwan@google.com>
7941
7942 * icf.cc (get_section_contents): Always lock section's object.
7943
7944 2011-01-24 Ian Lance Taylor <iant@google.com>
7945
7946 * options.h (class General_options): Accept
7947 --no-detect-odr-violations.
7948
7949 2011-01-24 Ian Lance Taylor <iant@google.com>
7950
7951 * version.cc (version_string): Bump to 1.11.
7952
7953 2011-01-24 Ian Lance Taylor <iant@google.com>
7954
7955 * plugin.cc (class Plugin_rescan): Define new class.
7956 (Plugin_manager::claim_file): Set any_claimed_.
7957 (Plugin_manager::save_archive): New function.
7958 (Plugin_manager::save_input_group): New function.
7959 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
7960 necessary.
7961 (Plugin_manager::new_undefined_symbol): New function.
7962 (Plugin_manager::rescan): New function.
7963 (Plugin_manager::rescannable_defines): New function.
7964 (Plugin_manager::add_input_file): Set any_added_.
7965 * plugin.h (class Plugin_manager): define new fields rescannable_,
7966 undefined_symbols_, any_claimed_, and any_added_. Declare
7967 Plugin_rescan as friend. Declare new functions.
7968 (Plugin_manager::Rescannable): Define type.
7969 (Plugin_manager::Rescannable_list): Define type.
7970 (Plugin_manager::Undefined_symbol_list): Define type.
7971 (Plugin_manager::Plugin_manager): Initialize new fields.
7972 * archive.cc (Archive::defines_symbol): New function.
7973 (Add_archive_symbols::run): Pass archive to plugins if any.
7974 * archive.h (class Archive): Declare defines_symbol.
7975 * readsyms.cc (Input_group::~Input_group): New function.
7976 (Finish_group::run): Pass input_group to plugins if any.
7977 * readsyms.h (class Input_group): Declare destructor.
7978 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
7979 any.
7980
7981 2011-01-10 Ian Lance Taylor <iant@google.com>
7982
7983 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
7984 section as relro.
7985 (Layout::set_segment_offsets): Reset increase_relro before calling
7986 set_section_addresses a second time.
7987
7988 2011-01-04 Cary Coutant <ccoutant@google.com>
7989
7990 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
7991 sections before NOBITS sections.
7992
7993 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
7994
7995 * version.cc (print_version): Update copyright to 2011.
7996
7997 2010-12-23 Cary Coutant <ccoutant@google.com>
7998
7999 * output.h (Output_data_reloc::add_output_section): Pass OD instead
8000 of OS to this->add. Add OD parameter to second form of the function.
8001
8002 2010-12-20 Ian Lance Taylor <iant@google.com>
8003
8004 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
8005 second of two consecutive entries with same offset.
8006
8007 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8008
8009 * testsuite/Makefile.am (ifuncmain2static_LDADD)
8010 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
8011 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
8012 to avoid unneeded links against $(LDADD).
8013 * testsuite/Makefile.in: Regenerate.
8014
8015 2010-12-15 Ian Lance Taylor <iant@google.com>
8016
8017 PR gold/12324
8018 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
8019 for R_X86_64_32 and R_X86_64_PC32.
8020 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
8021 ver_matching_def_pic.o.
8022 (ver_matching_def_pic.o): New target.
8023
8024 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8025
8026 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
8027 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
8028 Move definition before File_read::View member definitions.
8029 (File_read::View::~View): Initialize and hold lock before
8030 updating current_mapped_bytes.
8031
8032 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8033
8034 * dwarf_reader.cc: Remove outdated comment.
8035 * gold-threads.cc: Fix typo in error message.
8036 * archive.cc: Fix typos in comments.
8037 * archive.h: Likewise.
8038 * arm-reloc-property.cc: Likewise.
8039 * arm-reloc-property.h: Likewise.
8040 * arm-reloc.def: Likewise.
8041 * arm.cc: Likewise.
8042 * attributes.h: Likewise.
8043 * cref.cc: Likewise.
8044 * ehframe.cc: Likewise.
8045 * fileread.h: Likewise.
8046 * gold.h: Likewise.
8047 * i386.cc: Likewise.
8048 * icf.cc: Likewise.
8049 * incremental.h: Likewise.
8050 * int_encoding.cc: Likewise.
8051 * layout.h: Likewise.
8052 * main.cc: Likewise.
8053 * merge.h: Likewise.
8054 * object.cc: Likewise.
8055 * object.h: Likewise.
8056 * options.cc: Likewise.
8057 * readsyms.cc: Likewise.
8058 * reduced_debug_output.cc: Likewise.
8059 * reloc.cc: Likewise.
8060 * script-sections.cc: Likewise.
8061 * sparc.cc: Likewise.
8062 * symtab.h: Likewise.
8063 * target-reloc.h: Likewise.
8064 * target.cc: Likewise.
8065 * target.h: Likewise.
8066 * timer.cc: Likewise.
8067 * timer.h: Likewise.
8068 * x86_64.cc: Likewise.
8069
8070 2010-12-09 Cary Coutant <ccoutant@google.com>
8071
8072 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
8073 stack.
8074 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
8075 parameter; change all callers.
8076 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
8077 * options.h (warn_execstack): New option.
8078
8079 2010-12-07 Doug Kwan <dougkwan@google.com>
8080
8081 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
8082 like function call relocations.
8083
8084 2010-12-07 Ian Lance Taylor <iant@google.com>
8085
8086 * archive.cc (Archive::get_elf_object_for_member): Permit
8087 punconfigured to be NULL.
8088 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
8089 (Archive::include_member): Pass NULL to get_elf_object_for_member
8090 if we searched for the archive and this is the first included
8091 object.
8092
8093 2010-12-01 Ian Lance Taylor <iant@google.com>
8094
8095 * dwarf_reader.h (class Sized_dwarf_line_info): Add
8096 track_relocs_type_ field.
8097 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8098 Set track_relocs_type_.
8099 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
8100 contents when using RELA relocs.
8101 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
8102 reloc_map_.
8103 * reloc.cc (Track_relocs::next_addend): New function.
8104 * reloc.h (class Track_relocs): Declare next_addend.
8105
8106 2010-12-01 Ian Lance Taylor <iant@google.com>
8107
8108 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
8109 virtual destructor.
8110
8111 2010-12-01 Ian Lance Taylor <iant@google.com>
8112
8113 * README: Update compilers known to work and fail.
8114
8115 2010-11-23 Matthias Klose <doko@ubuntu.com>
8116
8117 * configure.in: For --enable-gold, handle value `default' instead of
8118 `both*'. Always install ld as ld.bfd, install as ld if gold is
8119 not the default.
8120 * configure: Regenerate.
8121
8122 2010-11-18 Doug Kwan <dougkwan@google.com>
8123
8124 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
8125 and right_alignment to be zero. Store result alignment only if it is
8126 greater than existing alignment.
8127
8128 2010-11-16 Cary Coutant <ccoutant@google.com>
8129
8130 PR gold/12220
8131 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8132 Check for ".zdebug_line".
8133
8134 2010-11-16 Doug Kwan <dougkwan@google.com>
8135 Cary Coutant <ccoutant@google.com>
8136
8137 * output.h (Output_segment::set_section_addresses): Pass increase_relro
8138 by reference; adjust all callers.
8139 * output.cc (Output_segment::set_section_addresses): Adjust references
8140 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
8141 list is empty.
8142 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
8143 end at page boundary.
8144
8145 2010-11-16 Cary Coutant <ccoutant@google.com>
8146
8147 PR gold/12220
8148 * layout.cc (Layout::choose_output_section): Transform names of
8149 compressed sections even when using a script with a SECTIONS clause.
8150 (Layout::output_section_name): Remove code to transform
8151 compressed debug section names.
8152 * output.cc (Output_section::add_input_section): Use uncompressed
8153 section size when tracking input sections.
8154
8155 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
8156
8157 * symtab.h (Symbol::NON_PIC_REF): Remove.
8158 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
8159 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
8160 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
8161 (Symbol::use_plt_offset): Take a flags argument and pass it
8162 directly to needs_dynamic_reloc. Restrict check for undefined
8163 weak symbols to function calls.
8164 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
8165 (Target_arm::Scan::global): Use it.
8166 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
8167 (Target_arm::Relocate::relocate): Likewise.
8168 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
8169 parameter with an r_type parameter. Use get_reference_flags
8170 to get the flags.
8171 (Target_arm::Relocate::relocate): Update accordingly.
8172 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
8173 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
8174 (Target_i386::Scan::global): Likewise.
8175 (Target_i386::Relocate::relocate): Likewise.
8176 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
8177 parameter with an r_type parameter. Use get_reference_flags
8178 to get the flags.
8179 (Target_i386::Relocate::relocate): Update accordingly.
8180 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
8181 (Target_powerpc::Scan::global): Use it.
8182 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
8183 (Target_powerpc::Relocate::relocate): Likewise.
8184 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
8185 (Target_sparc::Scan::global): Use it.
8186 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
8187 (Target_sparc::Relocate::relocate): Likewise.
8188 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
8189 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
8190 (Target_x86_64::Scan::global): Likewise.
8191 (Target_x86_64::Relocate::relocate): Likewise.
8192
8193 2010-11-08 Doug Kwan <dougkwan@google.com>
8194 Cary Coutant <ccoutant@google.com>
8195
8196 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
8197 (Arm_exidx_merge_section::section_contents_): New data member.
8198 (Arm_input_section::Arm_input_section): Initialize original_contents_.
8199 (Arm_input_section::~Arm_input_section): De-allocate memory.
8200 (Arm_input_section::original_contents_): New data member.
8201 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
8202 in parameters instead of calling Object::section_contents without
8203 locking.
8204 (Arm_output_section::group_section): New parameter TASK. Pass it
8205 to callees that need locking objects.
8206 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
8207 to lock EXIDX input sections. Fix a formatting issue. Call
8208 Arm_exidx_merged_section::build_contents to create merged section
8209 contents.
8210 (Arm_output_section::create_stub_group): New parameter TASK. Use it
8211 to lock object of stub table owner.
8212 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
8213 TEXT_SIZE to initialize data member TEXT_SIZE_.
8214 (Arm_exidx_input_section::addralign): Fix typo in comment.
8215 (Arm_exidx_input_section::text_size): New method.
8216 (Target_arm::do_relax): New parameter TASK. Pass it to callees
8217 that require locking objects. Lock objects before scanning for stubs
8218 and updating local symbols.
8219 (Arm_input_section<big_endian>::init): Copy contents of original
8220 input section.
8221 (Arm_input_section<big_endian>::do_write): Use saved contents of
8222 original input section instead of calling Object::section_contents
8223 without locking.
8224 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
8225 size without calling Object::section_size().
8226 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
8227 for size. Allocate a buffer for merged EXIDX entries.
8228 (Arm_exidx_merged_section::build_contents): New method.
8229 (Arm_exidx_merged_section::do_write): Move merge section contents
8230 building code to Arm_exidx_merged_section::build_contetns. Write
8231 out contetns in buffer instead of building it on the fly.
8232 (Arm_relobj::make_exidx_input_section): Also pass text section size
8233 to Arm_exidx_input_section constructor.
8234 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
8235 (Arm_dynobj::do_read_symbols): Fix memory leak.
8236 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
8237 * target.h: (class Task): Add forward declaration.
8238 (Target::relax): Add new parameter TASK and pass it to
8239 Target::do_relax().
8240 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
8241
8242 2010-11-05 Cary Coutant <ccoutant@google.com>
8243
8244 PR gold/10708
8245 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
8246 object when reading from the file.
8247 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
8248 second layout pass.
8249 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
8250 when reading section contents.
8251 (get_section_contents): Likewise.
8252 (icf::find_identical_sections): Likewise.
8253 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
8254 object when reading from the file.
8255 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
8256 the object when doing deferred section layout.
8257
8258 2010-11-03 Nick Clifton <nickc@redhat.com>
8259
8260 PR gold/12001
8261 * script.h (class Symbol_assignment: name): New member. Returns
8262 the name of the symbol.
8263 * scrfipt.cc (Script_options::is_pending_assignment): New member.
8264 Returns true if the given symbol name is on the list of
8265 assignments wating to be processed.
8266 * archive.cc (should_incldue_member): If the symbol is undefined,
8267 check to see if it is on the list of symbols pending assignment.
8268
8269 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
8270
8271 * script-sections.cc (Script_sections::find_memory_region): Check
8272 for a NULL output section pointer.
8273
8274 2010-10-29 Doug Kwan <dougkwan@google.com>
8275
8276 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
8277 Output_section::add_relaxed_input_section.
8278 * output.cc (Output_section::add_relaxed_input_section): Add new
8279 arguments LAYOUT and NAME. Set section order index.
8280 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8281 Copy section order index.
8282 * output.h (Output_section::add_relaxed_input_section): Add new
8283 arguments LAYOUT and NAME.
8284
8285 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8286
8287 * testsuite/Makefile.am: Move gcctestdir/ld rule to
8288 NATIVE_OR_CROSS_LINKER.
8289 * testsuite/Makefile.in: Regenerate.
8290
8291 2010-10-20 Doug Kwan <dougkwan@google.com>
8292
8293 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
8294 without SHF_LINK_ORDER flags.
8295 * layout.cc (Layout::choose_output_section): Do not filter
8296 SHF_LINK_ORDER flag in a relocatable link.
8297
8298 2010-10-17 Cary Coutant <ccoutant@google.com>
8299
8300 * output.h (Output_segment::set_section_addresses): Change function
8301 signature. Update all callers.
8302 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
8303 sections.
8304 (Output_segment::set_section_addresses): Align after last TLS
8305 section. Add padding before last relro section instead of after.
8306
8307 2010-10-17 Doug Kwan <dougkwan@google.com>
8308
8309 * gold/arm.cc (Target_arm::got_section): Use correct order and set
8310 GOT output section to be writable.
8311
8312 2010-10-14 Cary Coutant <ccoutant@google.com>
8313
8314 * debug.h (DEBUG_INCREMENTAL): New flag.
8315 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
8316 * gold.cc (queue_initial_tasks): Check parameters for incremental link
8317 mode.
8318 * incremental.cc (report_command_line): Ignore all forms of
8319 --incremental.
8320 * layout.cc (Layout::Layout): Check parameters for incremental link
8321 mode.
8322 * options.cc (General_options::parse_incremental): New function.
8323 (General_options::parse_no_incremental): New function.
8324 (General_options::parse_incremental_full): New function.
8325 (General_options::parse_incremental_update): New function.
8326 (General_options::incremental_mode_): New data member.
8327 (General_options::finalize): Check incremental_mode_.
8328 * options.h (General_options): Update help text for --incremental.
8329 Add --no-incremental, --incremental-full, --incremental-update.
8330 (General_options::Incremental_mode): New enum type.
8331 (General_options::incremental_mode): New function.
8332 (General_options::incremental_mode_): New data member.
8333 * parameters.cc (Parameters::incremental_mode_): New data member.
8334 (Parameters::set_options): Set incremental_mode_.
8335 (Parameters::set_incremental_full): New function.
8336 (Parameters::incremental): New function.
8337 (Parameters::incremental_update): New function.
8338 (set_parameters_incremental_full): New function.
8339 * parameters.h (Parameters::set_incremental_full): New function.
8340 (Parameters::incremental): New function.
8341 (Parameters::incremental_update): New function.
8342 (Parameters::incremental_mode_): New data member.
8343 (set_parameters_incremental_full): New function.
8344 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
8345 incremental link mode.
8346 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
8347 (Sized_relobj::do_relocate_sections): Likewise.
8348 * testsuite/Makefile.am (incremental_test): Use --incremental-full
8349 option.
8350 * testsuite/Makefile.in: Regenerate.
8351 * testsuite/incremental_test.sh: Filter all forms of --incremental.
8352
8353 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8354
8355 * script-sections.h (class Script_sections): Make
8356 Sections_elements typedef public.
8357 * script-sections.cc (class Sort_output_sections): Add elements_
8358 field. Add constructor which sets it; change all callers.
8359 (Sort_output_sections::is_before): New function.
8360 (Sort_output_sections::operator()): Call is_before.
8361 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
8362 conditional.
8363 * testsuite/script_test_10.sh: New test. Test script section
8364 order.
8365 * testsuite/script_test_10.t: Likewise.
8366 * testsuite/script_test_10.s: Likewise.
8367 * testsuite/Makefile.am: Wrap the cross linker tests and the
8368 common tests into NATIVE_OR_CROSS_LINKER.
8369 (check_SCRIPTS): Add script_test_10.sh.
8370 (check_DATA): Add script_test_10.stdout.
8371 (script_test_10.o, script_test_10): New targets.
8372 (script_test_10.stdout): New target.
8373 * configure, testsuite/Makefile.in: Regenerate.
8374
8375 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8376
8377 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
8378 error for the deprecated relocations.
8379 (Target_arm::Scan::global): Likewise.
8380 (Target_arm::Relocate::relocate): Likewise.
8381
8382 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
8383
8384 * fileread.cc (Input_file::find_file): Initialize *found_name
8385 and *namep when using the fallback search for case 4.
8386
8387 2010-10-11 Cary Coutant <ccoutant@google.com>
8388
8389 * options.h (class General_options): Redefine -z lazy as an alias for
8390 the negation of -z now.
8391
8392 2010-10-11 Ian Lance Taylor <iant@google.com>
8393
8394 * resolve.cc (symbol_to_bits): Report the value of the unsupported
8395 binding.
8396
8397 2010-10-06 Nick Clifton <nickc@redhat.com>
8398
8399 * script-sections.cc(class Memory_region): Remove
8400 current_lma_offset_ field. Rename current_vma_offset_ to
8401 current_offset_. Add last_section_ field.
8402 (Memory_region::get_current_vma_address): Rename to
8403 get_current_address.
8404 (Memory_region::get_current_lma_address): Delete.
8405 (Memory_region::increment_vma_offset): Rename to
8406 increment_offset.
8407 (Memory_region::increment_lma_offset): Delete.
8408 (Memory_region::attributes_compatible): New method. Returns
8409 true if the provided section is compatible with the region.
8410 (Memory_region::get_last_section): New method. Returns the last
8411 section to use the region.
8412 (Memory_region::set_last_section): New method. Stores the last
8413 section to use the region.
8414 (Script_sections::block_in_region): New method. Returns true if
8415 a block of memory is contained within a region.
8416 (Script_sections::find_memory_region): New method. Locates a
8417 memory region to be used to set a VMA or LMA address.
8418 (Output_section_definition::set_section_addresses): Add code to
8419 check for addresses set by memory regions.
8420 (Output_segment::set_section_addresses): Remove memory region
8421 walking code.
8422 (Script_sections::create_segment): Add a warning if a header
8423 segment is created outside of any region.
8424 * script-sections.h (class Script_sections): Add prototypes for
8425 find_memory_region and block_in_region methods.
8426 * testsuite/memory_test.s: Use .long instead of .word.
8427 * testsuite/memory_test.t: Add some more output sections.
8428 * testsuite/memory_test.sh: Update expected output.
8429
8430 2010-10-02 Doug Kwan <dougkwan@google.com>
8431
8432 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
8433 defintion to symtab.h
8434 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
8435 declaration to defintion.
8436
8437 2010-10-01 Nick Clifton <nickc@redhat.com>
8438
8439 * expression.cc (eval): Replace dummy argument with NULL.
8440 (eval_maybe_dot): Check for a NULL result section pointer.
8441 (Symbol_expression::value): Likewise.
8442 (Dot_expression::value): Likewise.
8443 (BINARY_EXPRESSION): Likewise.
8444 (Max_expression::value): Likewise.
8445 (Min_expression::value): Likewise.
8446 (Absolute_expression::value): Likewise.
8447 (Addr_expression::value_from_output_section): Likewise.
8448 (Loaddddr_expression::value_from_output_section): Likewise.
8449 (Segment_start_expression::value): Likewise.
8450 * script-sections.cc
8451 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
8452 argument with NULL.
8453 (Sections_elememt_dot_assignment::set_section_addresses):
8454 Likewise.
8455 (Output_data_expression::do_write_to_buffer): Likewise.
8456 (Output_section_definition::finalize_symbols): Likewise.
8457 (Output_section_definition::set_section_addresses): Likewise.
8458
8459 2010-09-30 Doug Kwan <dougkwan@google.com>
8460
8461 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
8462
8463 2010-09-28 Sriraman Tallam <tmsriram@google.com>
8464
8465 * target.h (Target::can_icf_inline_merge_sections): New virtual
8466 function.
8467 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
8468 virtual function.
8469 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
8470 virtual function.
8471 * icf.cc (get_section_contents): Inline merge sections only when
8472 target allows it.
8473
8474 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8475
8476 * configure: Regenerate.
8477
8478 2010-09-17 Ian Lance Taylor <iant@google.com>
8479
8480 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
8481 * testsuite/Makefile.am (memory_test.o): New target.
8482 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
8483 memory_test.t.
8484 * testsuite/Makefile.in: Rebuild.
8485
8486 2010-09-17 Doug Kwan <dougkwan@google.com>
8487
8488 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
8489 defintion if relocation uses GOT entries of the symbol.
8490 * testsuite/icf_safe_test.sh: Fix test.
8491 * testsuite/icf_safe_so_test.sh: Fix test.
8492
8493 2010-09-16 Cary Coutant <ccoutant@google.com>
8494
8495 * script_sections.cc (class Memory_region): Remove "NULL" from
8496 vector initializations.
8497
8498 2010-09-15 Cary Coutant <ccoutant@google.com>
8499
8500 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
8501 Resolve forwarding symbols.
8502
8503 2010-09-15 Doug Kwan <dougkwan@google.com>
8504
8505 * gold/testsuite/script_test_3.t: Add ARM special sections.
8506 * gold/testsuite/script_test_4.t: Same.
8507 * gold/testsuite/script_test_5.t: Same.
8508 * gold/testsuite/script_test_6.t: Same.
8509 * gold/testsuite/script_test_7.t: Same.
8510 * gold/testsuite/script_test_7.t: Same.
8511 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
8512
8513 2010-09-14 Cary Coutant <ccoutant@google.com>
8514
8515 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
8516 (Target_x86_64::Relocate::relocate_tls): Replace check for
8517 saw_tls_block_reloc_ with test for executable section.
8518
8519 2010-09-12 Cary Coutant <ccoutant@google.com>
8520
8521 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
8522 position-independent executables to shared libraries need dynamic
8523 relocations.
8524 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
8525 position-independent executables.
8526 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
8527 * testsuite/Makefile.in: Regenerate.
8528
8529 2010-09-10 Nick Clifton <nickc@redhat.com>
8530
8531 PR gold/11997
8532 * testsuite/memory_test.t: Discard any sections that are not
8533 needed.
8534
8535 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
8536
8537 PR gold/11996
8538 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
8539 "This::" to work around a bug in gcc 4.2.
8540
8541 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
8542
8543 2010-09-09 Rafael Espindola <espindola@google.com>
8544
8545 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
8546 sections with different PF_X flags in the same segment.
8547 (Layout::find_first_load_seg): Search all segments to find the first
8548 one.
8549 * options.h (rosegment): New.
8550
8551 2010-09-08 Rafael Espindola <espindola@google.com>
8552
8553 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
8554
8555 2010-09-08 Doug Kwan <dougkwan@google.com>
8556
8557 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
8558 (Arm_relobj::do_relocate_sections): Add new parameter for output
8559 file to match the parent.
8560 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
8561 of local symbols instead of input values. Update code to track
8562 changes in gold::relocate_section.
8563 * object.cc (Sized_relobj::compute_final_local_value): New methods.
8564 (Sized_relobj::compute_final_local_value_internal): New methods.
8565 (Sized_relobj::do_finalize_local_symbols): Move code from loop
8566 body into private version of Sized_relobj::compute_final_local_value.
8567 Call the inline method.
8568 * object.h (Symbol_value::Symbol_value): Define destructor. Free
8569 merged symbol value if there is one.
8570 (Symbol_value::has_output_value): New method defintiion.
8571 (Sized_relobj::Compute_final_local_value_status): New enum type.
8572 (Sized_relobj::compute_final_local_value): New methods.
8573 (Sized_relobj::compute_final_local_value_internal): New methods.
8574 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
8575 and arm_cortex_a8.sh.
8576 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
8577 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
8578 New tests.
8579 * Makefile.in: Regenerate.
8580 * testsuite/arm_bl_out_of_range.s: Update test.
8581 * testsuite/thumb_bl_out_of_range.s: Ditto.
8582 * testsuite/thumb_blx_out_of_range.s: Ditto.
8583 * testsuite/arm_branch_out_of_range.sh: New file.
8584 * testsuite/arm_cortex_a8.sh: Ditto.
8585 * testsuite/arm_cortex_a8_b.s: Ditto.
8586 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
8587 * testsuite/arm_cortex_a8_b_local.s: Ditto.
8588 * testsuite/arm_cortex_a8_bl.s: Ditto.
8589 * testsuite/arm_cortex_a8_blx.s: Ditto.
8590 * testsuite/arm_cortex_a8_local.s: Ditto.
8591 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
8592 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
8593
8594 2010-09-08 Rafael Espindola <espindola@google.com>
8595
8596 * Makefile.am (memory_test.stdout): Run readelf with -W.
8597 * Makefile.in: Regenerate.
8598 * testsuite/memory_test.sh: Make the regexps accept both 32 and
8599 64 bit output.
8600
8601 2010-09-08 Rafael Espindola <espindola@google.com>
8602
8603 * script-sections.cc (Script_sections::add_memory_region): Convert
8604 field precision to int.
8605 * script.cc (script_set_section_region, script_set_section_region):
8606 Convert field precision to int.
8607
8608 2010-09-08 Rafael Espindola <espindola@google.com>
8609
8610 * arm.cc (do_finalize_sections): Create the __exidx_start and
8611 __exdix_end symbols even when the section is missing.
8612
8613 2010-09-08 Nick Clifton <nickc@redhat.com>
8614
8615 * README: Remove claim that MEMORY is not supported.
8616 * expression.cc (script_exp_function_origin)
8617 (script_exp_function_length): Move from here to ...
8618 * script.cc: ... here.
8619 (script_set_section_region, script_add_memory)
8620 (script_parse_memory_attr, script_include_directive): New
8621 functions.
8622 * script-sections.cc
8623 (class Memory_region): New class.
8624 (class Output_section_definition): Add set_memory_region,
8625 set_section_vma, set_section_lma and get_section_name methods.
8626 (class Script_Sections): Add add_memory_region,
8627 find_memory_region, find_memory_region_origin,
8628 find_memory_region_length and set_memory_region methods.
8629 Have set_section_addresses method walk the list of set memory
8630 regions.
8631 Extend the print methos to display memory regions.
8632 * script-sections.h: Add prototypes for new methods.
8633 Add enum for MEMORY region attributes.
8634 * yyscript.y: Add support for parsing MEMORY regions.
8635 * script-c.h: Add prototypes for new functions.
8636 * testsuite/Makefile.am: Add test of MEMORY region functionality.
8637 * testsuite/Makefile.in: Regenerate.
8638 * testsuite/memory_test.sh: New script.
8639 * testsuite/memory_test.s: New assembler source file.
8640 * testsuite/memory_test.t: New linker script.
8641
8642 2010-08-27 Doug Kwan <dougkwan@google.com>
8643
8644 * gold/resolve.cc (Symbol_table::should_override): Let a weak
8645 reference override an existing dynamic weak reference.
8646 * testsuite/Makefile.am: Add new test dyn_weak_ref.
8647 * testsuite/Makefile.in: Regenerate.
8648 * testsuite/dyn_weak_ref.sh: New file.
8649 * testsuite/dyn_weak_ref_1.c: Ditto.
8650 * testsuite/dyn_weak_ref_2.c: Ditto.
8651
8652 2010-08-27 Ian Lance Taylor <iant@google.com>
8653
8654 * incremental.h (class Incremental_input_entry): Add virtual
8655 destructor.
8656
8657 2010-08-27 Ian Lance Taylor <iant@google.com>
8658
8659 * testsuite/start_lib_test_3.c: Mark t3 as used.
8660
8661 2010-08-27 Nick Clifton <nickc@redhat.com>
8662
8663 * options.cc (version_script): Fix small typo in previous
8664 whitespace tidyup.
8665
8666 2010-08-25 Nick Clifton <nickc@redhat.com>
8667
8668 * archive.cc: Formatting fixes: Remove whitespace between
8669 typename and following asterisk. Remove whitespace between
8670 function name and opening parenthesis.
8671 * archive.h: Likewise.
8672 * arm.cc: Likewise.
8673 * attributes.cc: Likewise.
8674 * attributes.h: Likewise.
8675 * common.cc: Likewise.
8676 * copy-relocs.cc: Likewise.
8677 * dirsearch.h: Likewise.
8678 * dynobj.cc: Likewise.
8679 * ehframe.cc: Likewise.
8680 * ehframe.h: Likewise.
8681 * expression.cc: Likewise.
8682 * fileread.cc: Likewise.
8683 * fileread.h: Likewise.
8684 * gc.h: Likewise.
8685 * gold-threads.cc: Likewise.
8686 * gold.cc: Likewise.
8687 * i386.cc: Likewise.
8688 * icf.h: Likewise.
8689 * incremental-dump.cc: Likewise.
8690 * incremental.cc: Likewise.
8691 * layout.cc: Likewise.
8692 * layout.h: Likewise.
8693 * main.cc: Likewise.
8694 * merge.cc: Likewise.
8695 * merge.h: Likewise.
8696 * object.cc: Likewise.
8697 * object.h: Likewise.
8698 * options.cc: Likewise.
8699 * options.h: Likewise.
8700 * output.cc: Likewise.
8701 * output.h: Likewise.
8702 * plugin.cc: Likewise.
8703 * plugin.h: Likewise.
8704 * powerpc.cc: Likewise.
8705 * reloc.cc: Likewise.
8706 * script-c.h: Likewise.
8707 * script-sections.cc: Likewise.
8708 * script.cc: Likewise.
8709 * stringpool.cc: Likewise.
8710 * symtab.cc: Likewise.
8711 * symtab.h: Likewise.
8712 * target.cc: Likewise.
8713 * timer.cc: Likewise.
8714 * timer.h: Likewise.
8715 * version.cc: Likewise.
8716 * x86_64.cc: Likewise.
8717
8718 2010-08-24 Nick Clifton <nickc@redhat.com>
8719
8720 PR 11899
8721 * layout.cc (segment_precedes): Sort segments by their physical
8722 addresses, if they have been set.
8723
8724 2010-08-23 Cary Coutant <ccoutant@google.com>
8725
8726 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
8727 symbols data.
8728 (Lib_group::include_member): Unlock object after deleting its
8729 symbols data.
8730 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
8731 the bug fixed here.
8732
8733 2010-08-19 Neil Vachharajani <nvachhar@google.com>
8734 Cary Coutant <ccoutant@google.com>
8735
8736 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
8737 constructor, and set_blocker.
8738 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
8739 readsyms_blocker_.
8740 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
8741 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
8742 * testsuite/Makefile.am (start_lib_test): New test case.
8743 * testsuite/Makefile.in: Regenerate.
8744 * testsuite/start_lib_test_main.c: New file.
8745 * testsuite/start_lib_test_1.c: New file.
8746 * testsuite/start_lib_test_2.c: New file.
8747 * testsuite/start_lib_test_3.c: New file.
8748
8749 2010-08-19 Ian Lance Taylor <iant@google.com>
8750
8751 * Makefile.in: Rebuild with automake 1.11.1.
8752 * aclocal.m4: Likewise.
8753 * testsuite/Makefile.in: Likewise.
8754
8755 2010-08-19 Ian Lance Taylor <iant@google.com>
8756
8757 PR 10893
8758 * i386.cc (class Output_data_plt_i386): Update declarations.
8759 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
8760 local_ifuncs_ fields.
8761 (Target_i386::do_plt_section_for_global): New function.
8762 (Target_i386::do_plt_section_for_local): New function.
8763 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
8764 parameter; change all callers. Initialize global_ifuncs_ and
8765 local_ifuncs_. If doing a static link define __rel_iplt_start and
8766 __rel_iplt_end.
8767 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
8768 (Output_data_plt_i386::add_local_ifunc_entry): New function.
8769 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
8770 symbols.
8771 (Target_i386::make_plt_section): New function, broken out of
8772 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
8773 (Target_i386::make_plt_entry): Call make_plt_section.
8774 (Target_i386::make_local_ifunc_plt_entry): New function.
8775 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
8776 (Target_i386::Scan::local): Handle IFUNC symbols. Add
8777 R_386_IRELATIVE to switch.
8778 (Target_i386::Scan::global): Likewise.
8779 (Target_i386::Relocate::relocate): Likewise.
8780 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
8781 switch.
8782 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
8783 (Target_x86_64::do_plt_section_for_global): New function.
8784 (Target_x86_64::do_plt_section_for_local): New function.
8785 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
8786 parameter; change all callers. If doing a static link define
8787 __rela_iplt_start and __rela_iplt_end.
8788 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
8789 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
8790 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
8791 to point to .plt.
8792 (Target_x86_64::make_local_ifunc_plt_entry): New function.
8793 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
8794 switch.
8795 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
8796 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
8797 R_X86_64_IRELATIVE to switch.
8798 (Target_x86_64::Scan::global): Likewise.
8799 (Target_x86_64::Relocate::relocate): Likewise.
8800 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
8801 switch.
8802 * target.h (class Target): Add plt_section_for_global and
8803 plt_section_for_local functions. Add do_plt_section_for_global
8804 and do_plt_section_for_local virtual functions.
8805 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
8806 clarifying comments.
8807 (Symbol::use_plt_offset): Handle IFUNC symbol.
8808 * object.cc (Sized_relobj::Sized_relobj): Initialize
8809 local_plt_offsets_.
8810 (Sized_relobj::local_has_plt_offset): New function.
8811 (Sized_relobj::local_plt_offset): New function.
8812 (Sized_relobj::set_local_plt_offset): New function.
8813 (Sized_relobj::do_count): Handle IFUNC symbol.
8814 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
8815 a bit away from input_shndx_ field. Add set_is_func_symbol and
8816 is_ifunc_symbol functions.
8817 (class Sized_relobj): Update declarations. Remove Tls_got_entry
8818 and Local_tls_got_offsets. Define Local_plt_offsets. Add
8819 local_plt_offsets_ field.
8820 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
8821 * output.h (class Output_section_data): Add non-const
8822 output_section function.
8823 (class Output_data_got): Update declarations.
8824 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
8825 Add use_plt_offset parameter to global and local constructors.
8826 Change all callers. Change local_sym_index_ field to 31 bits.
8827 Change GSYM_CODE and CONSTANT_CODE accordingly.
8828 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
8829 doing a static link don't set sh_link field.
8830 (Output_data_got::Got_entry::write): Use PLT offset if
8831 appropriate.
8832 (Output_data_got::add_global_plt): New function.
8833 (Output_data_got::add_local_plt): New function.
8834 * target-reloc.h (relocate_section): Handle IFUNC symbol.
8835 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
8836 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
8837 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
8838 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
8839 IFUNC conditional.
8840 * testsuite/ifunc-sel.h: New file.
8841 * testsuite/ifuncmain1.c: New file.
8842 * testsuite/ifuncmain1vis.c: New file.
8843 * testsuite/ifuncmod1.c: New file.
8844 * testsuite/ifuncdep2.c: New file.
8845 * testsuite/ifuncmain2.c: New file.
8846 * testsuite/ifuncmain3.c: New file.
8847 * testsuite/ifuncmod3.c: New file.
8848 * testsuite/ifuncmain4.c: New file.
8849 * testsuite/ifuncmain5.c: New file.
8850 * testsuite/ifuncmod5.c: New file.
8851 * testsuite/ifuncmain6pie.c: New file.
8852 * testsuite/ifuncmod6.c: New file.
8853 * testsuite/ifuncmain7.c: New file.
8854 * configure, testsuite/Makefile.in: Rebuild.
8855
8856 2010-08-18 Ian Lance Taylor <iant@google.com>
8857
8858 * incremental.cc
8859 (Output_section_incremental_inputs::write_input_files): Add cast
8860 to avoid signed/unsigned comparison warning.
8861 (Output_section_incremental_inputs::write_info_blocks): Likewise.
8862
8863 2010-08-12 Cary Coutant <ccoutant@google.com>
8864
8865 * common.cc (Sort_commons::operator()): Remove unnecessary code.
8866
8867 2010-08-13 Ian Lance Taylor <iant@google.com>
8868
8869 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
8870
8871 2010-08-12 Cary Coutant <ccoutant@google.com>
8872 Doug Kwan <dougkwan@google.com>
8873
8874 * resolve.cc (Symbol_table::should_override): When a weak dynamic
8875 defintion overrides non-weak undef, remember that the original undef
8876 is not weak.
8877 * symtab.cc (Symbol_table::sized_write_global): For undef without
8878 an original weak binding, set binding to global in output.
8879 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
8880 * testsuite/Makefile.in: Regenerate.
8881 * testsuite/strong_ref_weak_def.sh: New file.
8882 * testsuite/strong_ref_weak_def_1.c: Ditto.
8883 * testsuite/strong_ref_weak_def_2.c: Ditto.
8884
8885 2010-08-12 Cary Coutant <ccoutant@google.com>
8886
8887 * testsuite/incremental_test.sh: Rewrite.
8888 * testsuite/incremental_test_1.c: Rewrite.
8889 * testsuite/incremental_test_2.c: Rewrite.
8890
8891 2010-08-12 Cary Coutant <ccoutant@google.com>
8892
8893 * arm.cc (Target_arm::got_size): Add const.
8894 (Target_arm::got_entry_count): New function.
8895 (Target_arm::plt_entry_count): New function.
8896 (Target_arm::first_plt_entry_offset): New function.
8897 (Target_arm::plt_entry_size): New function.
8898 (Output_data_plt_arm::entry_count): New function.
8899 (Output_data_plt_arm::first_plt_entry_offset): New function.
8900 (Output_data_plt_arm::get_plt_entry_size): New function.
8901 * i386.cc (Target_i386::got_size): Add const.
8902 (Target_i386::got_entry_count): New function.
8903 (Target_i386::plt_entry_count): New function.
8904 (Target_i386::first_plt_entry_offset): New function.
8905 (Target_i386::plt_entry_size): New function.
8906 (Output_data_plt_i386::entry_count): New function.
8907 (Output_data_plt_i386::first_plt_entry_offset): New function.
8908 (Output_data_plt_i386::get_plt_entry_size): New function.
8909 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
8910 find_incremental_inputs_sections. Dump incremental_got_plt section.
8911 * incremental.cc: Include target.h.
8912 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
8913 parameter. Adjust all callers. Find incremental_got_plt section.
8914 (Incremental_inputs::create_data_sections): Create incremental_got_plt
8915 section.
8916 (Output_section_incremental_inputs::set_final_data_size): Calculate
8917 size of incremental_got_plt section.
8918 (Output_section_incremental_inputs::do_write): Write the
8919 incremental_got_plt section.
8920 (Got_plt_view_info): New struct.
8921 (Local_got_offset_visitor): New class.
8922 (Global_got_offset_visitor): New class.
8923 (Global_symbol_visitor_got_plt): New class.
8924 (Output_section_incremental_inputs::write_got_plt): New function.
8925 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
8926 Add parameter. Adjust all callers.
8927 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8928 (Incremental_inputs::got_plt_section): New function.
8929 (Incremental_inputs::got_plt_section_): New data member.
8930 (Incremental_got_plt_reader): New class.
8931 * layout.cc (Layout::create_incremental_info_sections): Add the
8932 incremental_got_plt section.
8933 * object.h (Got_offset_list::get_list): New function.
8934 (Got offset_list::for_all_got_offsets): New function.
8935 (Sized_relobj::local_got_offset_list): New function.
8936 * powerpc.cc (Target_powerpc::got_size): Add const.
8937 (Target_powerpc::got_entry_count): New function.
8938 (Target_powerpc::plt_entry_count): New function.
8939 (Target_powerpc::first_plt_entry_offset): New function.
8940 (Target_powerpc::plt_entry_size): New function.
8941 (Output_data_plt_powerpc::entry_count): New function.
8942 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
8943 (Output_data_plt_powerpc::get_plt_entry_size): New function.
8944 * sparc.cc (Target_sparc::got_size): Add const.
8945 (Target_sparc::got_entry_count): New function.
8946 (Target_sparc::plt_entry_count): New function.
8947 (Target_sparc::first_plt_entry_offset): New function.
8948 (Target_sparc::plt_entry_size): New function.
8949 (Output_data_plt_sparc::entry_count): New function.
8950 (Output_data_plt_sparc::first_plt_entry_offset): New function.
8951 (Output_data_plt_sparc::get_plt_entry_size): New function.
8952 * symtab.h (Symbol::got_offset_list): New function.
8953 (Symbol_table::for_all_symbols): New function.
8954 * target.h (Sized_target::got_entry_count): New function.
8955 (Sized_target::plt_entry_count): New function.
8956 (Sized_target::plt_entry_size): New function.
8957 * x86_64.cc (Target_x86_64::got_size): Add const.
8958 (Target_x86_64::got_entry_count): New function.
8959 (Target_x86_64::plt_entry_count): New function.
8960 (Target_x86_64::first_plt_entry_offset): New function.
8961 (Target_x86_64::plt_entry_size): New function.
8962 (Output_data_plt_x86_64::entry_count): New function.
8963 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
8964 (Output_data_plt_x86_64::get_plt_entry_size): New function.
8965
8966 2010-08-12 Cary Coutant <ccoutant@google.com>
8967
8968 * archive.cc: Include incremental.h.
8969 (Archive::Archive): Initialize incremental_info_.
8970 (Archive::include_member): Record archive members in incremental info.
8971 (Add_archive_symbols::run): Record begin and end of an archive in
8972 incremental info.
8973 (Lib_group::include_member): Record objects in incremental info.
8974 * archive.h (Incremental_archive_entry): Forward declaration.
8975 (Archive::set_incremental_info): New member function.
8976 (Archive::incremental_info): New member function.
8977 (Archive::Unused_symbol_iterator): New class.
8978 (Archive::unused_symbols_begin): New member function.
8979 (Archive::unused_symbols_end): New member function.
8980 (Archive::incremental_info_): New data member.
8981 * incremental-dump.cc (find_input_containing_global): New function.
8982 (dump_incremental_inputs): Dump new incremental info sections.
8983 * incremental.cc: Include symtab.h.
8984 (Output_section_incremental_inputs): New class.
8985 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
8986 new incremental info sections.
8987 (Sized_incremental_binary::do_check_inputs): Likewise.
8988 (Incremental_inputs::report_archive): Remove.
8989 (Incremental_inputs::report_archive_begin): New function.
8990 (Incremental_inputs::report_archive_end): New function.
8991 (Incremental_inputs::report_object): New function.
8992 (Incremental_inputs::finalize_inputs): Remove.
8993 (Incremental_inputs::report_input_section): New function.
8994 (Incremental_inputs::report_script): Rewrite.
8995 (Incremental_inputs::finalize): Do nothing but finalize string table.
8996 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8997 (Incremental_inputs::sized_create_inputs_section_data): Remove.
8998 (Incremental_inputs::create_data_sections): New function.
8999 (Incremental_inputs::relocs_entsize): New function.
9000 (Output_section_incremental_inputs::set_final_data_size): New function.
9001 (Output_section_incremental_inputs::do_write): New function.
9002 (Output_section_incremental_inputs::write_header): New function.
9003 (Output_section_incremental_inputs::write_input_files): New function.
9004 (Output_section_incremental_inputs::write_info_blocks): New function.
9005 (Output_section_incremental_inputs::write_symtab): New function.
9006 * incremental.h (Incremental_script_entry): Forward declaration.
9007 (Incremental_object_entry): Forward declaration.
9008 (Incremental_archive_entry): Forward declaration.
9009 (Incremental_inputs): Forward declaration.
9010 (Incremental_inputs_header_data): Remove.
9011 (Incremental_inputs_header): Remove.
9012 (Incremental_inputs_header_write): Remove.
9013 (Incremental_inputs_entry_data): Remove.
9014 (Incremental_inputs_entry): Remove.
9015 (Incremental_inputs_entry_write): Remove.
9016 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
9017 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
9018 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9019 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
9020 Likewise.
9021 (Incremental_input_entry): New class.
9022 (Incremental_script_entry): New class.
9023 (Incremental_object_entry): New class.
9024 (Incremental_archive_entry): New class.
9025 (Incremental_inputs::Incremental_inputs): Initialize new data members.
9026 (Incremental_inputs::report_inputs): Remove.
9027 (Incremental_inputs::report_archive): Remove.
9028 (Incremental_inputs::report_archive_begin): New function.
9029 (Incremental_inputs::report_archive_end): New function.
9030 (Incremental_inputs::report_object): Change prototype.
9031 (Incremental_inputs::report_input_section): New function.
9032 (Incremental_inputs::report_script): Change prototype.
9033 (Incremental_inputs::get_reloc_count): New function.
9034 (Incremental_inputs::set_reloc_count): New function.
9035 (Incremental_inputs::create_data_sections): New function.
9036 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9037 (Incremental_inputs::inputs_section): New function.
9038 (Incremental_inputs::symtab_section): New function.
9039 (Incremental_inputs::relocs_section): New function.
9040 (Incremental_inputs::get_stringpool): Add const.
9041 (Incremental_inputs::command_line): Add const.
9042 (Incremental_inputs::inputs): Remove.
9043 (Incremental_inputs::command_line_key): New function.
9044 (Incremental_inputs::input_file_count): New function.
9045 (Incremental_inputs::input_files): New function.
9046 (Incremental_inputs::relocs_entsize): New function.
9047 (Incremental_inputs::sized_create_inputs_section_data): Remove.
9048 (Incremental_inputs::finalize_inputs): Remove.
9049 (Incremental_inputs::Input_info): Remove.
9050 (Incremental_inputs::lock_): Remove.
9051 (Incremental_inputs::inputs_): Change type.
9052 (Incremental_inputs::inputs_map_): Remove.
9053 (Incremental_inputs::current_object_entry_): New data member.
9054 (Incremental_inputs::inputs_section_): New data member.
9055 (Incremental_inputs::symtab_section_): New data member.
9056 (Incremental_inputs::relocs_section_): New data member.
9057 (Incremental_inputs::reloc_count_): New data member.
9058 (Incremental_inputs_reader): New class.
9059 (Incremental_symtab_reader): New class.
9060 (Incremental_relocs_reader): New class.
9061 * layout.cc (Layout::finalize): Move finalization of incremental info
9062 and creation of incremental info sections to follow finalization of
9063 symbol table. Set offsets for postprocessing sections.
9064 (Layout::create_incremental_info_sections): Call
9065 Incremental_inputs::create_data_sections. Add incremental symtab
9066 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
9067 sections to layout after input sections.
9068 * layout.h (struct Timespec): Forward declaration.
9069 (Layout::incremental_inputs): Add const.
9070 (Layout::create_incremental_info_sections): Add parameter.
9071 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
9072 * object.cc: Include incremental.h.
9073 (Relobj::finalize_incremental_relocs): New function.
9074 (Sized_relobj::do_layout): Record input sections in incremental info.
9075 * object.h (Object::output_section): New function.
9076 (Object::output_section_offset): Moved from Relobj.
9077 (Object::get_incremental_reloc_base): New function.
9078 (Object::get_incremental_reloc_count): New function.
9079 (Object::do_output_section): New function.
9080 (Object::do_output_section_offset): Moved from Relobj.
9081 (Object::do_get_incremental_reloc_base): New function.
9082 (Object::do_get_incremental_reloc_count): New function.
9083 (Object::Object): Initialize new data members.
9084 (Relobj::output_section): Renamed do_output_section and moved to
9085 protected.
9086 (Relobj::output_section_offset): Moved to Object.
9087 (Relobj::do_get_incremental_reloc_base): New function.
9088 (Relobj::do_get_incremental_reloc_count): New function.
9089 (Relobj::allocate_incremental_reloc_counts): New function.
9090 (Relobj::count_incremental_reloc): New function.
9091 (Relobj::finalize_incremental_relocs): New function.
9092 (Relobj::next_incremental_reloc_index): New function.
9093 (Relobj::reloc_counts_): New data member.
9094 (Relobj::reloc_bases_): New data member.
9095 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
9096 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
9097 (Sized_relobj::incremental_relocs_scan): New function.
9098 (Sized_relobj::incremental_relocs_scan_reltype): New function.
9099 (Sized_relobj::incremental_relocs_write): New function.
9100 (Sized_relobj::incremental_relocs_write_reltype): New function.
9101 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
9102 incremental link.
9103 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
9104 archives and object files elsewhere.
9105 (Add_symbols::run): Report object files here.
9106 (Finish_group::run): Report end of archive at end of group.
9107 * reloc.cc: Include layout.h, incremental.h.
9108 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
9109 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
9110 (Sized_relobj::incremental_relocs_scan): New function.
9111 (Sized_relobj::incremental_relocs_scan_reltype): New function.
9112 (Sized_relobj::do_relocate_sections): Write incremental relocations.
9113 (Sized_relobj::incremental_relocs_write): New function.
9114 (Sized_relobj::incremental_relocs_write_reltype): New function.
9115 * script.cc (read_input_script): Rewrite test for incremental link.
9116 Change call to Incremental_inputs::report_script.
9117 * symtab.h (Symbol_table::first_global_index): New function.
9118 (Symbol_table::output_count): New function.
9119
9120 2010-08-12 Doug Kwan <dougkwan@google.com>
9121
9122 * arm.cc (Target_arm::merge_object_attributes): Check command line
9123 options --no-wchar-size-warning and --no-enum-size-warning.
9124 * options.h (General_options): Add ld-compatible options
9125 --no-enum-size-warning and --no-wchar-size-warning.
9126
9127 2010-08-04 Ian Lance Taylor <iant@google.com>
9128
9129 * x86_64.cc (Target_x86_64::Scan::local): Use
9130 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
9131 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
9132 (Target_x86_64::Scan::global): Likewise.
9133 (Target_x86_64::Relocate::relocate): Likewise.
9134 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
9135 Likewise.
9136
9137 2010-08-03 Cary Coutant <ccoutant@google.com>
9138
9139 * merge.cc (Output_merge_string::do_add_input_section): Count strings
9140 to reserve space in merged_strings vector. Keep total input size
9141 for stats.
9142 (Output_merge_string::do_print_merge_stats): Print total input size.
9143 * merge.h (Output_merge_string): Add input_size_ field.
9144 * stringpool.cc (Stringpool_template::string_length): Move
9145 implementations out of Stringpool_template class and place in
9146 stringpool.h.
9147 * stringpool.h (string_length): Move out of Stringpool_template.
9148
9149 2010-08-03 Ian Lance Taylor <iant@google.com>
9150
9151 PR 11712
9152 * layout.cc (relaxation_loop_body): If address of load segment is
9153 set, adjust address to include headers if possible.
9154
9155 2010-08-03 Ian Lance Taylor <iant@google.com>
9156
9157 * version.cc (version_string): Bump to 1.10.
9158
9159 2010-08-03 Ian Lance Taylor <iant@google.com>
9160
9161 PR 11805
9162 * layout.h (enum Output_section_order): Define.
9163 (class Layout): Update declarations.
9164 * layout.cc (Layout::get_output_section): Add order parameter.
9165 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
9166 is_first_non_relro parameters. Change all callers.
9167 (Layout::choose_output_section): Likewise.
9168 (Layout::add_output_section_data): Likewise.
9169 (Layout::make_output_section): Likewise. Set order.
9170 (Layout::default_section_order): New function.
9171 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
9172 * output.cc (Output_section::Output_section): Initialize order_.
9173 Don't initialize deleted fields.
9174 (Output_segment::Output_segment): Don't initialize deleted
9175 fields.
9176 (Output_segment::add_output_section_to_load): New function
9177 replacing add_output_section. Change all callers to call this or
9178 add_output_section_to_nonload.
9179 (Output_segment::add_output_section_to_nonload): New function.
9180 (Output_segment::remove_output_section): Rewrite.
9181 (Output_segment::add_initial_output_data): Likewise.
9182 (Output_segment::has_any_data_sections): Likewise.
9183 (Output_segment::is_first_section_relro): Likewise.
9184 (Output_segment::maximum_alignment): Likewise.
9185 (Output_segment::has_dynamic_reloc): New function replacing
9186 dynamic_reloc_count. Change all callers.
9187 (Output_segment::has_dynamic_reloc_list): New function replacing
9188 dynamic_reloc_count_list. Change all callers.
9189 (Output_segment::set_section_addresses): Rewrite.
9190 (Output_segment::set_offset): Rewrite.
9191 (Output_segment::find_first_and_last_list): Remove.
9192 (Output_segment::set_tls_offsets): Rewrite.
9193 (Output_segment::first_section_load_address): Likewise.
9194 (Output_segment::output_section_count): Likewise.
9195 (Output_segment::section_with_lowest_load_address): Likewise.
9196 (Output_segment::write_section_headers): Likewise.
9197 (Output_segment::print_sections_to_map): Likewise.
9198 * output.h (class Output_data): Remove dynamic_reloc_count_
9199 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
9200 (Output_data::add_dynamic_reloc): Rewrite.
9201 (Output_data::has_dynamic_reloc): New function.
9202 (Output_data::dynamic_reloc_count): Remove.
9203 (class Output_section): Add order_ field. Remvoe is_relro_local_,
9204 is_last_relro_, is_first_non_relro_, is_interp_,
9205 is_dynamic_linker_section_ fields. Add order and set_order
9206 functions. Remove is_relro_local, set_is_relro_local,
9207 is_last_relro, set_is_last_relro, is_first_non_relro,
9208 set_is_first_non_relro functions, is_interp, set_is_interp,
9209 is_dynamic_linker_section, and set_is_dynamic_linker_section
9210 functions.
9211 (class Output_segment): Change Output_data_list from std::list to
9212 std:;vector. Add output_lists_ field. Remove output_data_ and
9213 output_bss_ fields. Update declarations.
9214
9215 2010-08-02 Ian Lance Taylor <iant@google.com>
9216
9217 * arm.cc (Target_arm::gc_process_relocs): Use typename.
9218 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
9219 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
9220
9221 2010-08-02 Ian Lance Taylor <iant@google.com>
9222
9223 PR 11855
9224 * script.cc (Script_options::Script_options): Initialize
9225 symbol_definitions_ and symbol_references_.
9226 (Script_options::add_symbol_assignment): Update
9227 symbol_definitions_ and symbol_references_.
9228 (Script_options::add_symbol_reference): New function.
9229 (script_symbol): New function.
9230 * script.h (class Script_options): Add symbol_definitions_ and
9231 symbol_references_ fields.
9232 (Script_options::referenced_const_iterator): New type.
9233 (Script_options::referenced_begin): New function.
9234 (Script_options::referenced_end): New function.
9235 (Script_options::is_referenced): New function.
9236 (Script_options::any_unreferenced): New function.
9237 * script-c.h (script_symbol): Declare.
9238 * yyscript.y (exp): Call script_symbol.
9239 * symtab.cc: Include "script.h".
9240 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
9241 Change all callers. Check symbols referenced by scripts.
9242 (Symbol_table::add_undefined_symbols_from_command_line): Add
9243 layout parameter. Change all callers.
9244 (Symbol_table::do_add_undefined_symbols_from_command_line):
9245 Likewise. Break out loop body. Check symbols referenced by
9246 scripts.
9247 (Symbol_table::add_undefined_symbol_from_command_line): New
9248 function broken out of
9249 do_add_undefined_symbols_from_command_line.
9250 * symtab.h (class Symbol_table): Update declarations.
9251 * archive.cc: Include "layout.h".
9252 (Archive::should_include_member): Add layout parameter. Change
9253 all callers. Check for symbol mentioned in expression.
9254 * archive.h (class Archive): Update declaration.
9255 * object.cc (Sized_relobj::do_should_include_member): Add layout
9256 parameter.
9257 * object.h (Object::should_include_member): Add layout parameter.
9258 Change all callers.
9259 (Object::do_should_include_member): Add layout parameter.
9260 (class Sized_relobj): Update declaration.
9261 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
9262 parameter.
9263 * dynobj.h (class Sized_dynobj): Update declaration.
9264 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
9265 layout parameter.
9266 * plugin.h (class Sized_pluginobj): Update declaration.
9267
9268 2010-08-02 Ian Lance Taylor <iant@google.com>
9269
9270 PR 11866
9271 * output.cc (Output_segment::set_offset): Search for the first and
9272 last sections rather than assuming that the list is in order.
9273 (Output_segment::find_first_and_last_list): New function.
9274 * output.h (class Output_segment): Update declarations.
9275 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
9276 (relro_strip_test_SOURCES): New variable.
9277 (relro_strip_test_DEPENDENCIES): New variable.
9278 (relro_strip_test_LDFLAGS): New variable.
9279 (relro_strip_test_LDADD): New variable.
9280 (relro_strip_test.so): New target.
9281
9282 2010-08-02 Ian Lance Taylor <iant@google.com>
9283
9284 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
9285 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
9286 (Target_i386::got_tlsdesc_section): New function.
9287 (Target_i386::got_section): Create space for GOT entries for
9288 TLSDESC relocations.
9289 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
9290 R_386_TLS_GOTDESC.
9291 (Target_i386::Scan::global): Likewise.
9292 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
9293 using TLSDESC GOT.
9294 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
9295 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
9296 (Target_x86_64::got_tlsdesc_section): New function.
9297 (Target_x86_64::got_section): Create space for GOT entries for
9298 TLSDESC relocations.
9299 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
9300 R_386_TLS_GOTDESC.
9301 (Target_x86_64::Scan::global): Likewise.
9302 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
9303 using TLSDESC GOT.
9304
9305 2010-08-02 Ian Lance Taylor <iant@google.com>
9306
9307 * testsuite/final_layout.sh: Use dc to convert from hex to
9308 decimal.
9309
9310 2010-07-29 Sriraman Tallam <tmsriram@google.com>
9311
9312 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
9313 paramter to the call to gold::gc_process_relocs.
9314 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
9315 paramter to the call to gold::gc_process_relocs.
9316 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
9317 parameter to the call to gold::gc_process_relocs.
9318 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
9319 template parameter to the call to gold::gc_process_relocs.
9320 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
9321 paramter to the call to gold::gc_process_relocs.
9322 * gc.h (get_embedded_addend_size): New function.
9323 (gc_process_relocs): Save the size of the reloc for use by ICF.
9324 * icf.cc (get_section_contents): Get the addend from the text section
9325 for SHT_REL relocation sections.
9326 * icf.h (Icf::Reloc_addend_size_info): New typedef.
9327 (Icf::Reloc_info): Add new member reloc_addend_size_info.
9328 * int_encoding.h (read_from_pointer): New overloaded function.
9329 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
9330 * testsuite/icf_sht_rel_addend_test.sh: New file.
9331 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
9332 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
9333
9334 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9335
9336 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
9337 * Makefile.in: Regenerate.
9338 * testsuite/Makefile.in: Regenerate.
9339
9340 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
9341
9342 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
9343 * gold/testsuite/debug_msg.cc: Likewise.
9344 * gold/testsuite/odr_violation1.cc
9345 * gold/testsuite/odr_violation2.cc
9346
9347 2010-07-21 Cary Coutant <ccoutant@google.com>
9348
9349 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
9350 string, and length fields.
9351 (Output_merge_string::Merged_strings_list): New type.
9352 (Output_merge_string::Merged_strings_lists): New typedef.
9353 (Output_merge_string): Replace merged_strings_ with
9354 merged_strings_lists_.
9355 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
9356 Merged_strings_list per input object and section. Don't store pointer
9357 to the string. Don't store length with each merged string entry.
9358 (Output_merge_string::finalize_merged_data): Loop over list of merged
9359 strings lists. Recompute length of each merged string.
9360
9361 2010-07-15 Cary Coutant <ccoutant@google.com>
9362
9363 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
9364 here.
9365
9366 2010-07-14 Ian Lance Taylor <iant@google.com>
9367
9368 * descriptors.cc (Descriptors::open): Report correct name in error
9369 message.
9370
9371 2010-07-13 Doug Kwan <dougkwan@google.com>
9372
9373 * arm.cc (Arm_input_section::Arm_input_section): For a
9374 SHT_ARM_EXIDX section, always keeps the input sections.
9375 (Arm_input_section::set_exidx_section_link): New method.
9376 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
9377 has_errors_ to false.
9378 (Arm_exidx_input_section::has_errors,
9379 Arm_exidx_input_section::set_has_errors): New methods.
9380 (Arm_exidx_input_section::has_errors_): New data member.
9381 (Arm_relobj::get_exidx_shndx_list): New method.
9382 (Arm_output_section::append_text_sections_to_list): Do not skip
9383 section without SHF_EXECINSTR.
9384 (Arm_output_section::fix_exidx_coverage): Skip input sections with
9385 errors.
9386 (Arm_relobj::make_exidx_input_section): Add new parameter for text
9387 section header. Make error messages more verbose. Check for
9388 a non-executable section linked to an EXIDX section.
9389 (Arm_relobj::do_read_symbols): Remove error checking, which has been
9390 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
9391 check that there is no deferred EXIDX section if we exit early.
9392 Instead of not making an EXIDX section in case of an error, make one
9393 and set the has_errors flag of it.
9394 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
9395 in a relocatable link.
9396 (Target_arm::do_relax): Look for the EXIDX output section instead of
9397 assuming that it is called .ARM.exidx.
9398 (Target_arm::fix_exidx_coverage): Add a new parameter for input
9399 section list. Do not check for SHF_EXECINSTR section flags but
9400 skip any input section with errors.
9401 * output.cc (Output_section::Output_section): Initialize
9402 always_keeps_input_sections_ to false.
9403 (Output_section::add_input_section): Check for
9404 always_keeps_input_sections_.
9405 * output.h (Output_section::always_keeps_input_sections,
9406 Output_section::set_always_keeps_input_sections): New methods.
9407 (Output_section::always_keeps_input_sections): New data member.
9408
9409 2010-07-13 Rafael Espindola <espindola@google.com>
9410
9411 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
9412 * fileread.h (Input_file): Add try_extra_search_path and find_file.
9413
9414 2010-07-13 Philip Herron <herron.philip@googlemail.com>
9415 Ian Lance Taylor <iant@google.com>
9416
9417 * output.h (Output_section_lookup_maps::add_merge_section):
9418 Correct check of whether value was inserted.
9419 (Output_section_lookup_maps::add_merge_input_section): Likewise.
9420 (Output_section_lookup_maps::add_relaxed_input_section):
9421 Likewise.
9422 * arm.cc (Target_arm::got_section): Remove used local os.
9423 * i386.cc (Target_i386::got_section): Likewise.
9424 * x86_64.cc (Target_x86_64::got_section): Likewise.
9425 * sparc.cc (Target_sparc::got_section): Likewise.
9426 (Target_sparc::relocate): Remove unused local have_got_offset.
9427 * powerpc.cc (Target_powerpc::relocate): Likewise.
9428
9429 2010-07-13 Ian Lance Taylor <iant@google.com>
9430
9431 * compressed_output.cc (zlib_decompress): Fix signature in
9432 !HAVE_ZLIB_H case.
9433
9434 * archive.cc (Archive::include_member): Unlock an external member
9435 of a thin archive. Don't bother to delete an object we know is
9436 NULL.
9437
9438 2010-07-12 Cary Coutant <ccoutant@google.com>
9439
9440 * compressed_output.cc (zlib_decompress): New function.
9441 (get_uncompressed_size): New function.
9442 (decompress_input_section): New function.
9443 * compressed_output.h (get_uncompressed_size): New function.
9444 (decompress_input_section): New function.
9445 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
9446 Handle compressed debug sections.
9447 * layout.cc (is_compressed_debug_section): New function.
9448 (Layout::output_section_name): Map compressed section names to
9449 canonical names.
9450 * layout.h (is_compressed_debug_section): New function.
9451 (is_debug_info_section): Recognize compressed debug sections.
9452 * merge.cc: Include compressed_output.h.
9453 (Output_merge_data::do_add_input_section): Handle compressed
9454 debug sections.
9455 (Output_merge_string::do_add_input_section): Handle compressed
9456 debug sections.
9457 * object.cc: Include compressed_output.h.
9458 (Sized_relobj::Sized_relobj): Initialize new data members.
9459 (build_compressed_section_map): New function.
9460 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
9461 * object.h (Object::section_is_compressed): New method.
9462 (Object::do_section_is_compressed): New method.
9463 (Sized_relobj::Compressed_section_map): New type.
9464 (Sized_relobj::do_section_is_compressed): New method.
9465 (Sized_relobj::compressed_sections_): New data member.
9466 * output.cc (Output_section::add_input_section): Handle compressed
9467 debug sections.
9468 * reloc.cc: Include compressed_output.h.
9469 (Sized_relobj::write_sections): Handle compressed debug sections.
9470
9471 2010-07-08 Cary Coutant <ccoutant@google.com>
9472
9473 * resolve.cc (Symbol_table::resolve): Remember whether undef was
9474 weak when resolving to a dynamic def.
9475 (Symbol_table::should_override): Add adjust_dyndef flag; set it
9476 for weak undef/dynamic def cases. Adjust callers.
9477 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
9478 undef_binding_weak_.
9479 (Symbol_table::sized_write_globals): Adjust symbol binding.
9480 (Symbol_table::sized_write_symbol): Add binding parameter.
9481 * symtab.h (Symbol::set_undef_binding): New method.
9482 (Symbol::is_undef_binding_weak): New method.
9483 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
9484 (Symbol_table::should_override): Add new parameter.
9485 (Symbol_table::sized_write_symbol): Add new parameter.
9486
9487 * testsuite/weak_undef_file1.cc: Add new test case.
9488 * testsuite/weak_undef_file2.cc: Fix header comment.
9489 * testsuite/weak_undef_test.cc: Add new test case.
9490
9491 2010-06-29 Doug Kwan <dougkwan@google.com>
9492
9493 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
9494 Initialize USE_SYMBOL_.
9495 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
9496 definition.
9497 (Arm_reloc_property::uses_symbol_): New data member declaration.
9498 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
9499 uses symbol value and symbol is undefined but not weakly undefined.
9500
9501 2010-06-28 Rafael Espindola <espindola@google.com>
9502
9503 * plugin.cc (Plugin::load): Use dlerror.
9504
9505 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
9506
9507 * symtab.cc (detect_odr_violations): When reporting an ODR
9508 violation, report an object where the symbol is defined.
9509
9510 2010-06-25 Doug Kwan <dougkwan@google.com>
9511
9512 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
9513 (Target_arm::section_may_have_icf_unsafe_pointers): New method
9514 definition.
9515 (Target_arm::Scan::local_reloc_may_be_function_pointer,
9516 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
9517 target hook to detect function points.
9518 (Target_arm::Scan::possible_function_pointer_reloc): New method.
9519 * icf.h (Icf::check_section_for_function_pointers): Change type of
9520 parameter SECTION_NAME to const reference to std::string. Use
9521 target hook to determine if section may have unsafe pointers.
9522 * target.h (Target::section_may_have_icf_unsafe_pointers): New
9523 method definition.
9524
9525 2010-06-21 Rafael Espindola <espindola@google.com>
9526
9527 * fileread.cc (Input_file::find_fie): New
9528 (Input_file::open): Use Input_file::find_fie.
9529 * fileread.h (Input_file::find_fie): New
9530 * plugin.cc (set_extra_library_path): New.
9531 (Plugin::load): Add set_extra_library_path to the transfer vector.
9532 (Plugin_manager::set_extra_library_path): New.
9533 (Plugin_manager::add_input_file): Use the extra search path if set.
9534 (set_extra_library_path(): New.
9535 * plugin.h (Plugin_manager): Add set_extra_library_path and
9536 extra_search_path_.
9537
9538 2010-06-19 Cary Coutant <ccoutant@google.com>
9539
9540 * layout.cc (gdb_sections): Add .debug_types.
9541 (lines_only_debug_sections): Likewise.
9542
9543 2010-06-18 Rafael Espindola <espindola@google.com>
9544
9545 * plugin.cc (add_input_file,add_input_library)
9546 (Plugin_manager::add_input_file): Make filename arguments const.
9547 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
9548 const.
9549
9550 2010-06-16 Doug Kwan <dougkwan@google.com>
9551
9552 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
9553 .ARM.attributes section if we have not merged any input
9554 attributes sections.
9555
9556 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9557
9558 * arm.cc: Allow combining objects with no EABI version
9559 information.
9560
9561 2010-06-15 Rafael Espindola <espindola@google.com>
9562
9563 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
9564
9565 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9566
9567 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
9568 (struct iovec): Correct !HAVE_READV definition.
9569
9570 2010-06-10 Cary Coutant <ccoutant@google.com>
9571
9572 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
9573 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
9574 reloc sections.
9575 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
9576
9577 PR 11683
9578 * symtab.h (Symbol::is_placeholder): New member function.
9579 * target-reloc.h (relocate_section): Check for placeholder symbols.
9580
9581 * testsuite/Makefile.am (plugin_test_8): New test.
9582 (plugin_test_9): New test.
9583 * testsuite/Makefile.in: Regenerate.
9584
9585 2010-06-09 Nick Clifton <nickc@redhat.com>
9586
9587 * yyscript.y (input_list_element): Allow strings prefixed with
9588 the '-' character. Treat these as libraries.
9589 * script.cc (script_add_library): New function. Adds a library
9590 specified by "-l<name>" found in an input script.
9591 * script-c.h: Add prototype for script_add_library.
9592
9593 2010-06-07 Doug Kwan <dougkwan@google.com>
9594
9595 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
9596 Restrict stub-group size to be within long conditional branch
9597 range when working around cortex-A8 erratum.
9598
9599 2010-06-07 Damien Diederen <dd@crosstwine.com>
9600
9601 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
9602 #ifdef typo.
9603
9604 2010-06-03 Sriraman Tallam <tmsriram@google.com>
9605
9606 PR gold/11658
9607 * output.cc
9608 (Output_section::Input_section_sort_entry::compare_section_ordering):
9609 Change to return non-zero correctly.
9610 (Output_section::Input_section_sort_section_order_index_compare
9611 ::operator()): Change to fix ambiguity in comparisons.
9612
9613 2010-06-01 Sriraman Tallam <tmsriram@google.com>
9614
9615 * gold.h (is_wildcard_string): New function.
9616 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
9617 (Layout::layout_eh_frame): Ditto.
9618 (Layout::find_section_order_index): New method.
9619 (Layout::read_layout_from_file): New method.
9620 * layout.h (Layout::find_section_order_index): New method.
9621 (Layout::read_layout_from_file): New method.
9622 (Layout::input_section_position_): New private member.
9623 (Layout::input_section_glob_): New private member.
9624 * main.cc (main): Call read_layout_from_file here.
9625 * options.h (--section-ordering-file): New option.
9626 * output.cc (Output_section::input_section_order_specified_): New
9627 member.
9628 (Output_section::Output_section): Initialize new member.
9629 (Output_section::add_input_section): Add new parameter.
9630 Keep input sections when --section-ordering-file is used.
9631 (Output_section::set_final_data_size): Sort input sections when
9632 section ordering file is specified.
9633 (Output_section::Input_section_sort_entry): Add new parameter.
9634 Check sorting type.
9635 (Output_section::Input_section_sort_entry::compare_section_ordering):
9636 New method.
9637 (Output_section::Input_section_sort_compare::operator()): Change to
9638 consider section_order_index.
9639 (Output_section::Input_section_sort_init_fini_compare::operator()):
9640 Change to consider section_order_index.
9641 (Output_section::Input_section_sort_section_order_index_compare
9642 ::operator()): New method.
9643 (Output_section::sort_attached_input_sections): Change to sort
9644 according to section order when specified.
9645 (Output_section::add_input_section<32, true>): Add new parameter.
9646 (Output_section::add_input_section<64, true>): Add new parameter.
9647 (Output_section::add_input_section<32, false>): Add new parameter.
9648 (Output_section::add_input_section<64, false>): Add new parameter.
9649 * output.h (Output_section::add_input_section): Add new parameter.
9650 (Output_section::input_section_order_specified): New
9651 method.
9652 (Output_section::set_input_section_order_specified): New method.
9653 (Input_section::Input_section): Initialize section_order_index_.
9654 (Input_section::section_order_index): New method.
9655 (Input_section::set_section_order_index): New method.
9656 (Input_section::section_order_index_): New member.
9657 (Input_section::Input_section_sort_section_order_index_compare): New
9658 struct.
9659 (Output_section::input_section_order_specified_): New member.
9660 * script-sections.cc (is_wildcard_string): Delete and move modified
9661 method to gold.h.
9662 (Output_section_element_input::Output_section_element_input): Modify
9663 call to is_wildcard_string.
9664 (Output_section_element_input::Input_section_pattern
9665 ::Input_section_pattern): Ditto.
9666 (Output_section_element_input::Output_section_element_input): Ditto.
9667 * testsuite/Makefile.am (final_layout): New test case.
9668 * testsuite/Makefile.in: Regenerate.
9669 * testsuite/final_layout.cc: New file.
9670 * testsuite/final_layout.sh: New file.
9671
9672 2010-06-01 Rafael Espindola <espindola@google.com>
9673
9674 * plugin.cc (Plugin::load): Pass the output name to the plugin.
9675
9676 2010-06-01 Rafael Espindola <espindola@google.com>
9677
9678 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
9679 visibility of symbols.
9680
9681 2010-05-27 Doug Kwan <dougkwan@google.com>
9682
9683 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
9684 from start of output section instead of address for a local symbol
9685 in a merged or relaxed section when doing a relocatable link.
9686
9687 2010-05-26 Rafael Espindola <espindola@google.com>
9688
9689 PR 11604
9690 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
9691 adding sections the garbage collector removed.
9692 * gold/testsuite/Makefile.am: Add test.
9693 * gold/testsuite/Makefile.in: Regenerate.
9694 * gold/testsuite/plugin_test_7.sh: New.
9695 * gold/testsuite/plugin_test_7_1.c: New.
9696 * gold/testsuite/plugin_test_7_2.c: New.
9697
9698 2010-05-26 Rafael Espindola <espindola@google.com>
9699
9700 * script-sections.cc (Output_section_definition::set_section_addresses):
9701 Check for --section-start.
9702
9703 2010-05-26 Doug Kwan <dougkwan@google.com>
9704
9705 * arm.cc (Arm_scan_relocatable_relocs): New class.
9706 (Target_arm::relocate_special_relocatable): New method.
9707 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
9708 (Arm_relocate_functions::thumb_branch_common): Same.
9709 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
9710 instead of Default_scan_relocatable_relocs.
9711 * target-reloc.h (relocate_for_relocatable): Let target handle
9712 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
9713 * target.h (Sized_target::relocate_special_relocatable): New method.
9714
9715 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9716
9717 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
9718
9719 2010-05-23 Doug Kwan <dougkwan@google.com>
9720
9721 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
9722 instead of a cast.
9723 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
9724 with a direct branch, not a conditional branch, to a stub.
9725 * merge.cc (Output_merge_base::record_input_section): New method
9726 defintion.
9727 (Output_merge_data::do_add_input_section): Record input section if
9728 keeps-input-sections flag is set.
9729 (Output_merge_string::do_add_input_section): Ditto.
9730 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
9731 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
9732 INPUT_SECTIONS_.
9733 (Output_merge_base::keeps_input_sections,
9734 Output_merge_base::set_keeps_input_sections,
9735 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
9736 method definitions.
9737 (Output_merge_base::Input_sections): New type declaration.
9738 (Output_merge_base::input_sections_begin,
9739 Output_merge_base::input_sections_end,
9740 Output_merge_base::do_set_keeps_input_sections): New method definitions.
9741 (Output_merge_base::bool keeps_input_sections_,
9742 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
9743 Output_merge_base::input_sections_): New data members.
9744 (Output_merge_data::do_set_keeps_input_sections): New method
9745 defintion.
9746 (Output_merge_string::do_set_keeps_input_sections): Ditto.
9747 * output.cc (Output_section::Input_section::relobj): Move method
9748 defintion from class declaration to here and handle merge sections.
9749 (Output_section::Input_section::shndx): Ditto.
9750 (Output_section::Output_section): Remove initializations of removed
9751 data members and initialize new data member LOOKUP_MAPS_.
9752 (Output_section::add_input_section): Set keeps-input-sections flag
9753 for a newly created merge output section as appropriate. Adjust code
9754 to use Output_section_lookup_maps class.
9755 (Output_section::add_relaxed_input_section): Adjst code for lookup
9756 maps code refactoring.
9757 (Output_section::add_merge_input_section): Add a new parameter
9758 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
9759 class. If adding input section to a newly created merge output
9760 section fails, remove the new merge section.
9761 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
9762 Adjust code for use of the Output_section_lookup_maps class.
9763 (Output_section::find_merge_section): Ditto.
9764 (Output_section::build_lookup_maps): New method defintion.
9765 (Output_section::find_relaxed_input_section): Adjust code to use
9766 Output_section_lookup_maps class.
9767 (Output_section::get_input_sections): Export merge sections. Adjust
9768 code to use Output_section_lookup_maps class.
9769 (Output_section:::add_script_input_section): Adjust code to use
9770 Output_section_lookup_maps class. Update lookup maps for merge
9771 sections also.
9772 (Output_section::discard_states): Use Output_section_lookup_maps.
9773 (Output_section::restore_states): Same.
9774 * output.h (Merge_section_properties): Move class defintion out of
9775 Output_section.
9776 (Output_section_lookup_maps): New class.
9777 (Output_section::Input_section::is_merge_section): New method
9778 defintion.
9779 (Output_section::Input_section::relobj): Move defintion out of class
9780 defintion. Declare method only.
9781 (Output_section::Input_section::shndx): Ditto.
9782 (Output_section::Input_section::output_merge_base): New method defintion.
9783 (Output_section::Input_section::u2_.pomb): New union field.
9784 (Output_section::Merge_section_by_properties_map,
9785 Output_section::Output_section_data_by_input_section_map,
9786 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
9787 Remove types.
9788 (Output_section::add_merge_input_section): Add new parameter
9789 KEEPS_INPUT_SECTIONS.
9790 (Output_section::build_lookup_maps): New method declaration.
9791 (Output_section::merge_section_map_,
9792 Output_section::merge_section_by_properties_map_,
9793 Output_section::relaxed_input_section_map_,
9794 Output_section::is_relaxed_input_section_map_valid_): Remove data
9795 members.
9796 (Output_section::lookup_maps_): New data member.
9797
9798 2010-05-21 Doug Kwan <dougkwan@google.com>
9799
9800 PR gold/11619
9801 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
9802 avoid a compilation error.
9803
9804 2010-05-19 Rafael Espindola <espindola@google.com>
9805
9806 * script-sections.cc (Output_section_definition::allocate_to_segment):
9807 Update the phdrs_list even when the output section is NULL.
9808 * testsuite/Makefile.am: Add test.
9809 * testsuite/Makefile.in: Regenerate.
9810 * testsuite/script_test_9.cc: New.
9811 * testsuite/script_test_9.sh: New.
9812 * testsuite/script_test_9.t: New.
9813
9814 2010-05-19 Doug Kwan <dougkwan@google.com>
9815
9816 * arm.cc (Arm_input_section::original_size): New method.
9817 (Arm_input_section::do_addralign): Add a cast.
9818 (Arm_input_section::do_output_offset): Remove static cast.
9819 (Arm_input_section::original_addralign,
9820 Arm_input_section::original_size_): Change type to uint32_t.
9821 (Arm_input_section::init): Add safe casts for section alignment
9822 and size.
9823 (Arm_input_section::set_final_data_size): Do not set address and
9824 offset of stub table.
9825 (Arm_output_section::fix_exidx_coverage): Change use of of
9826 Output_section::Simple_input_section to that of
9827 Output_section::Input_section.
9828 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
9829 except for the first pass.
9830 * output.cc (Output_section::get_input_sections): Change type of
9831 input_sections to std::list<Input_section>.
9832 (Output_section::add_script_input_section): Rename from
9833 Output_section::add_simple_input_section. Change type of SIS
9834 parameter from Simple_input_section to Input_section.
9835 * output.h (Output_section::Simple_input_section): Remove class.
9836 (Output_section::Input_section): Change class visibility to public.
9837 (Output_section::Input_section::addralign): Use stored alignments
9838 for special input sections if set.
9839 (Output_section::Input_section::set_addralign): New method.
9840 (Output_section::get_input_sections): Change parameter type from
9841 list of Simple_input_section to list of Input_section.
9842 (Output_section::add_script_input_section): Rename from
9843 Output_section::add_simple_input_section. Change first parameter's
9844 type from Simple_input_section to Input_section and remove the
9845 second and third parameters.
9846 * script-sections.cc (Input_section::Input_section_list): Change
9847 type to list of Output_section::Input_section/
9848 (Input_section_info::Input_section_info): Change parameter type of
9849 INPUT_SECTION to Output_section::Input_section.
9850 (Input_section_info::input_section): Change return type.
9851 (Input_section_info::input_section_): Change type to
9852 Output_section::Input_section.
9853 (Output_section_element_input::set_section_addresses): Adjust code
9854 to use Output_section::Input_section instead of
9855 Output_section::Simple_input_section. Adjust code for renaming
9856 of Output_section::add_simple_input_section.
9857 (Orphan_output_section::set_section_addresses): Ditto.
9858
9859 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9860
9861 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
9862 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
9863
9864 2010-05-18 Rafael Espindola <espindola@google.com>
9865
9866 * options.cc (General_options::finalize): Handle -nostdlib.
9867 * options.h (nostdlib): New option.
9868 * script.cc (script_add_search_dir): Handle -nostdlib.
9869
9870 2010-05-12 Doug Kwan <dougkwan@google.com>
9871
9872 * arm.cc (Target_arm::do_finalize_sections): Create an empty
9873 attributes section only if there no attributes section after merging.
9874 (Target_arm::merge_object_attributes): Move value of
9875 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
9876 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
9877 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
9878 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
9879 and arm_attr_merge_7.stdout.
9880 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
9881 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
9882 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
9883 arm_attr_merge_7b.o): New rules.
9884 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
9885 arm_attr_merge_7
9886 * testsuite/Makefile.in: Regenerate.
9887 * testsuite/arm_attr_merge.sh: New file.
9888 * testsuite/arm_attr_merge_[67][ab].s: Same.
9889
9890 2010-05-05 Nick Clifton <nickc@redhat.com>
9891
9892 * po/es.po: Updated Spanish translation.
9893
9894 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
9895
9896 * Makefile.am (install-exec-local): Properly install gold as
9897 default cross linker.
9898 * Makefile.in: Regenerated.
9899
9900 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
9901 Nick Clifton <nickc@redhat.com>
9902
9903 * configure.ac (install_as_default): Define and set to false
9904 unless --enable-gold or --enable-gold=both/gold has been
9905 specified.
9906 * configure: Regenerate.
9907
9908 * Makefile.am (install-exec-local): Install the executable as
9909 'ld.gold'. If install_as_default is true then also install it as
9910 'ld'.
9911 * Makefile.in: Regenerated.
9912
9913 2010-04-24 Ian Lance Taylor <iant@google.com>
9914
9915 * layout.cc (Layout::layout_reloc): In relocatable link don't
9916 combine reloc sections for grouped sections.
9917
9918 2010-04-23 Sriraman Tallam <tmsriram@google.com>
9919
9920 * gc.h (gc_process_relocs): Pass information on relocs pointing to
9921 sections that are not ordinary to icf.
9922 * icf.cc (get_section_contents): Handle relocation pointing to section
9923 with no object or shndx information.
9924 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
9925 * testsuite/Makefile.in: Regenerate.
9926 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
9927 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
9928
9929 2010-04-22 Ian Lance Taylor <iant@google.com>
9930
9931 * expression.cc (Expression::Expression_eval_info): Add
9932 result_alignment_pointer field.
9933 (Expression::eval_with_dot): Add result_alignment_pointer
9934 parameter. Change all callers.
9935 (Expression::eval_maybe_dot): Likewise.
9936 (class Binary_expression): Add alignment_pointer parameter to
9937 left_value and right_value. Change all callers.
9938 (BINARY_EXPRESSION): Set result alignment.
9939 (class Trinary_expression): Add alignment_pointer parameter to
9940 arg2_value and arg3_value. Change all callers.
9941 (Trinary_cond::value): Set result alignment.
9942 (Max_expression::value, Min_expression::value): Likewise.
9943 (Align_expression::value): Likewise.
9944 * script-sections.cc (class Sections_element): Add dot_alignment
9945 parameter to set_section_addresses virtual function. Update
9946 instantiations.
9947 (class Output_section_element): Likewise.
9948 (Script_sections::create_segments): Add dot_alignment parameter.
9949 Change all callers.
9950 (Script_sections::create_segments_from_phdrs_clause): Likewise.
9951 (Script_sections::set_phdrs_clause_addresses): Likewise.
9952 * script-sections.h: Update declarations.
9953 * script.h: Update declarations.
9954 * output.h (Output_segment::set_minimum_p_align): Don't decrease
9955 min_p_align.
9956 * testsuite/script_test_3.t: Set large alignment.
9957 * testsuite/script_test_3.sh: Make sure that at least one LOAD
9958 segment has expected alignment.
9959
9960 2010-04-22 Nick Clifton <nickc@redhat.com>
9961
9962 * po/gold.pot: Updated by the Translation project.
9963 * po/vi.po: Updated Vietnamese translation.
9964
9965 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
9966
9967 * testsuite/Makefile.am (check_PROGRAMS): Add
9968 icf_virtual_function_folding_test.
9969 * testsuite/Makefile.in: Regenerated.
9970
9971 2010-04-15 Andrew Haley <aph@redhat.com>
9972
9973 * options.h (merge_exidx_entries): New option.
9974 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
9975 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
9976 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
9977 (Target_arm::merge_exidx_entries): New function.
9978 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
9979 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
9980 to Arm_exidx_fixup constructor.
9981 Add new arg, merge_exidx_entries.
9982 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
9983 Arm_output_section::fix_exidx_coverage.
9984
9985 2010-04-18 Sriraman Tallam <tmsriram@google.com>
9986
9987 * icf.cc (get_section_contents): Check for preemptible functions.
9988 Ignore addend when appropriate.
9989 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
9990 section folded.
9991 (add_from_relobj): Check for section folded.
9992 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
9993 * symtab.h (should_add_dynsym_entry): Add new parameter.
9994 * target-reloc.h (scan_relocs): Check for section folded.
9995 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
9996 Check reloc types for function pointers in shared objects.
9997 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
9998 case.
9999 (icf_preemptible_functions_test): New test case.
10000 (icf_string_merge_test): New test case.
10001 * testsuite.Makefile.in: Regenerate.
10002 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
10003 bar_glob. Refactor code.
10004 * testsuite/icf_preemptible_functions_test.cc: New file.
10005 * testsuite/icf_preemptible_functions_test.sh: New file.
10006 * testsuite/icf_string_merge_test.cc: New file.
10007 * testsuite/icf_string_merge_test.sh: New file.
10008 * testsuite/icf_virtual_function_folding_test.cc: New file.
10009 * testsuite/icf_virtual_function_folding_test.sh: New file.
10010
10011 2010-04-14 Doug Kwan <dougkwan@google.com>
10012
10013 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
10014 for local symbol recounting if we remove a section due to ICF.
10015 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
10016 there are no regular objects in input.
10017
10018 2010-04-13 Doug Kwan <dougkwan@google.com>
10019
10020 * arm.cc (Arm_input_section::set_final_data_size): Compute
10021 accurate final data size instead of using current data size.
10022
10023 2010-04-09 Doug Kwan <dougkwan@google.com>
10024
10025 * layout.cc (Layout::choose_output_section): Handle script section
10026 types.
10027 (Layout::make_output_section_for_script): Add section type parameter.
10028 Handle script section types.
10029 * layout.h (Layout::make_output_section_for_script): Add section
10030 type parameter.
10031 * output.cc (Output_section::Output_section): Initialize data member
10032 is_noload_.
10033 (Output_section::do_reset_address_and_file_offset): Do not set address
10034 to 0 if section is a NOLOAD section.
10035 * output.h (Output_section::is_noload): New method.
10036 (Output_section::set_is_noload): Ditto.
10037 (Output_section::is_noload_): New data member.
10038 * script-c.h (Script_section_type): New enum type.
10039 (struct Parser_output_section_header): Add new file section_type.
10040 * script-sections.cc (Sections_element::output_section_name): Add
10041 parameter for returning script section type.
10042 (Output_section_definition::output_section_name): Ditto.
10043 (Output_section_definition::section_type)P; New method.
10044 (Output_section_definiton::script_section_type_name): Ditto.
10045 (Output_section_definition::script_section_type_): New data member.
10046 (Output_section_definition::Output_section_definition): Initialize
10047 data member Output_section_definition::script_section_type_.
10048 (Output_section_definition::create_sections): Pass script section type
10049 to Layout::make_output_section_for_script.
10050 (Output_section_definition::output_section_name): Return script
10051 section type to caller.
10052 (Output_section_definition::set_section_address): Do not advance
10053 dot value and load address if section type is NOLOAD. Set address
10054 of NOLOAD sections regardless of section flags.
10055 (Output_section_definition::print): Print section type if it is
10056 not SCRIPT_SECTION_TYPE_NONE.
10057 (Output_section_definition::section_type): New method.
10058 (Output_section_definition::script_section_type_name): Ditto.
10059 (Script_sections::output_section_name): Add new parameter
10060 PSECTION_TYPE for returning script section type. Pass it to
10061 section elements. Handle discard sections.
10062 (Sort_output_sections::operator()): Handle NOLOAD sections.
10063 * script-sections.h (Script_sections::Section_type): New enum type.
10064 (Script_sections::output_section_name): Add a new parameter for
10065 returning script section type.
10066 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
10067 INFO and NOLOAD.
10068 * yyscript.y (union): Add new field SECTION_TYPE.
10069 (COPY, DSECT, INFO, NOLOAD): New tokens.
10070 (opt_address_and_section_type): Change type to output_section_header.
10071 (section_type): New non-terminal
10072 (section_header): Handle section type.
10073 (opt_address_and_section_type): Return section type value.
10074
10075 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
10076
10077 * testsuite/plugin_common_test_1.c (foo): Add prototype.
10078 * testsuite/plugin_common_test_2.c (foo): Likewise.
10079
10080 2010-04-08 Doug Kwan <dougkwan@google.com>
10081
10082 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
10083 Output_merge_data.
10084 * output.cc (Output_section::add_merge_input_section): Simplify
10085 code and return status of Output_merge_base::add_input_section.
10086 Update merge section map only if Output_merge_base::add_input_section
10087 returns true.
10088
10089 2010-04-07 Doug Kwan <dougkwan@google.com>
10090
10091 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
10092 if section is marked as containing instructions but has no mapping
10093 symbols.
10094 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
10095 correct section index.
10096 (Arm_relobj::find_linked_text_section): Ditto.
10097
10098 2010-04-07 Cary Coutant <ccoutant@google.com>
10099
10100 * archive.cc (include_member): Destroy Read_symbols_data object before
10101 releasing file.
10102 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
10103 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
10104 (Read_symbols_data::~Read_symbols_data) New destructor.
10105 (Section_relocs::Section_relocs) New constructor.
10106 (Section_relocs::~Section_relocs) New destructor.
10107 (Read_relocs_data::Read_relocs_data) New constructor.
10108 (Read_relocs_data::~Read_relocs_data) New destructor.
10109 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
10110 pointers to NULL after deleting.
10111
10112 2010-04-07 Doug Kwan <dougkwan@google.com>
10113
10114 * arm.cc: Replace "endianity" with "endianness" in comments.
10115 (Arm_exidx_cantunwind): Ditto.
10116 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
10117 (Arm_relobj::merge_flags_and_attributes): New method.
10118 (Arm_relobj::merge_flags_and_attributes_): New data member.
10119 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
10120 (Arm_relobj::scan_sections_for_stubs): Ditto.
10121 (Arm_relobj::do_read_symbols): Check to see if we really want to
10122 merge processor-specific flags and attributes. Exit early if
10123 an object is empty except for section names and the undefined symbol.
10124 (Target_arm::do_finalize_sections): Move check for ELF format to
10125 Arm_relobj::do_read_symbols. Merge processor specific flags and
10126 attributes from a regular object only when we have determined that
10127 it is aapropriate. Do not create an .ARM.attributes section in
10128 output if there is no regular input object.
10129 (Target_arm::merge_processor_specific_flags): Check
10130 --warn-mismatch before printing any error.
10131 (Target_arm::merge_object_attributes): Ditto.
10132 * gold.cc (queue_middle_tasks): Handle the case in which there is
10133 no regular object in input.
10134 * options.cc (General_options::parse_EB): New method.
10135 (General_options::parse_EL): Same.
10136 (General_options::General_options): Initialize endianness_.
10137 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
10138 New options.
10139 (General_options::Endianness): New enum.
10140 (General_options::endianness): New method.
10141 (General_options::endianness_): New data member.
10142 * parameters.cc (Parameters::set_options): Check target endianness.
10143 (Parameters::set_target_once): Ditto.
10144 (Parameters::check_target_endianness): New method.
10145 (parameters_force_valid_target): If either -EL or -EB is specified,
10146 use it to define endianness of default target.
10147 * parameters.h (Parameters::check_target_endianness): New method
10148 declaration.
10149 * target.h (class Target): Change "endianity" to "endianness"
10150 in comments.
10151
10152 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10153
10154 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
10155 * configure: Regenerate.
10156 * Makefile.in: Regenerate.
10157 * testsuite/Makefile.in: Regenerate.
10158
10159 2010-04-06 Cary Coutant <ccoutant@google.com>
10160
10161 gcc PR lto/42757
10162 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
10163 prevailing definitions of common symbols.
10164 * testsuite/plugin_test_6.sh: New test case.
10165 * testsuite/plugin_common_test_1.c: New test case.
10166 * testsuite/plugin_common_test_2.c: New test case.
10167 * testsuite/Makefile.am (plugin_test_6): New test case.
10168 * testsuite/Makefile.in: Regenerate.
10169
10170 2010-04-06 Nick Clifton <nickc@redhat.com>
10171
10172 * po/vi.po: New Vietnamese translation.
10173
10174 2010-03-30 Doug Kwan <dougkwan@google.com>
10175
10176 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
10177
10178 2010-03-25 Doug Kwan <dougkwan@google.com>
10179
10180 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
10181 to avoid a conversion warning on a 32-bit host.
10182
10183 2010-03-24 Ian Lance Taylor <iant@google.com>
10184
10185 * testsuite/script_test_3.t: Add a TLS segment.
10186 * testsuite/Makefile.am (check_PROGRAMS): Add
10187 tls_phdrs_script_test.
10188 (tls_phdrs_script_test_SOURCES): Define.
10189 (tls_phdrs_script_test_DEPENDENCIES): Define.
10190 (tls_phdrs_script_test_LDFLAGS): Define.
10191 (tls_phdrs_script_test_LDADD): Define.
10192 * testsuite/Makefile.in: Rebuild.
10193
10194 2010-03-23 Cary Coutant <ccoutant@google.com>
10195
10196 * fileread.cc (find_or_make_view): Fix comment.
10197
10198 2010-03-23 Ian Lance Taylor <iant@google.com>
10199
10200 * script-sections.cc (class Orphan_section_placement): Define
10201 PLACE_TLS and PLACE_TLS_BSS.
10202 (Orphan_section_placement::Orphan_section_placement): Initialize
10203 new places.
10204 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
10205 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
10206 (tls_script_test_SOURCES): Define.
10207 (tls_script_test_DEPENDENCIES): Define.
10208 (tls_script_test_LDFLAGS): Define.
10209 (tls_script_test_LDADD): Define.
10210 * testsuite/Makefile.in: Rebuild.
10211
10212 2010-03-22 Doug Kwan <dougkwan@google.com>
10213
10214 * arm.cc (Arm_relocate_functions::abs8,
10215 Arm_relocate_functions::abs16): Use correct check for overflow
10216 specified in the ARM ELF specs.
10217 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
10218 target of a BLX instruction specially.
10219 (Reloc_stub::stub_type_for_reloc): Ditto.
10220 (Relocate::relocate): Use symbolic names instead of numeric relocation
10221 codes to report error.
10222 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
10223 workaround.
10224 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
10225 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
10226 thumb2_blx_out_of_range.stdout
10227 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
10228 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
10229 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
10230 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
10231 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
10232 thumb2_blx_in_range, thumb2_blx_in_range.o,
10233 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
10234 thumb2_blx_out_of_range.o): New rules.
10235 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
10236 thumb2_blx_in_range and thumb2_blx_out_of_range.
10237 * testsuite/Makefile.in: Regenerate.
10238 * arm_branch_in_range.sh: Add tests for THUMB BLX.
10239 * testsuite/thumb_blx_in_range.s: New file.
10240 * testsuite/thumb_blx_out_of_range.s: New file.
10241
10242 2010-03-22 Rafael Espindola <espindola@google.com>
10243
10244 * archive.cc (Should_include): Move to archive.h.
10245 (should_include_member): Make it a member of Archive.
10246 (Lib_group): New.
10247 (Add_lib_group_symbols): New.
10248 * archive.h: Include options.h.
10249 (Archive_member): Moved from Archive.
10250 (Should_include): Moved from archive.cc.
10251 (Lib_group): New.
10252 (Add_lib_group_symbols): New.
10253 * dynobj.cc (do_should_include_member): New.
10254 * dynobj.h (do_should_include_member): New.
10255 * gold.cc (queue_initial_tasks): Update call to queue.
10256 * main.cc (main): Print lib group stats.
10257 * object.cc (do_should_include_member): New.
10258 * object.h: Include archive.h.
10259 (Object::should_include_member): New.
10260 (Object::do_should_include_member): New.
10261 (Sized_relobj::do_should_include_member): New.
10262 * options.cc (General_options::parse_start_lib): New.
10263 (General_options::parse_end_lib): New.
10264 (Input_arguments::add_file): Handle lib groups.
10265 (Input_arguments::start_group): Check we are not in a lib.
10266 (Input_arguments::start_lib): New.
10267 (Input_arguments::end_lib): New.
10268 * options.h (General_options): Add start_lib and end_lib.
10269 (Input_argument::lib_): New.
10270 (Input_argument::lib): New.
10271 (Input_argument::is_lib): New.
10272 (Input_file_lib): New.
10273 (Input_arguments::in_lib_): New.
10274 (Input_arguments::in_lib): New.
10275 (Input_arguments::start_lib): New.
10276 (Input_arguments::end_lib_): New.
10277 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
10278 in unused members as preempted.
10279 (Sized_pluginobj::do_should_include_member): New.
10280 * plugin.h (Sized_pluginobj::do_should_include_member): New.
10281 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
10282 return the blocker.
10283 (Read_symbols::do_whole_lib_group): New.
10284 (Read_symbols::do_lib_group): New.
10285 (Read_symbols::do_read_symbols): Handle lib groups.
10286 (Read_symbols::get_name): Handle lib groups.
10287 * readsyms.h (Read_symbols): Add an archive member pointer.
10288 (Read_symbols::do_whole_lib_group): New.
10289 (Read_symbols::do_lib_group): New.
10290 (Read_symbols::member_): New.
10291 * script.cc (read_input_script): Update call to queue_soon.
10292
10293 2010-03-19 Doug Kwan <dougkwan@google.com>
10294
10295 * arm.cc (Stub_table::Stub_table): Initialize new data members
10296 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10297 (Stub_table::add_reloc_stub): Assign stub offset and update
10298 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10299 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
10300 New data members.
10301 (Stub_table::update_data_size_and_addralign): Use
10302 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
10303 instead of going over all reloc stubs.
10304 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
10305 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10306 Stringpool_template::offset_ to size of Stringpool_char.
10307 (Stringpool_template::new_key_offset): Remove code to initialize
10308 Stringpool_template::offset_.
10309 * stringpool.h (Stringpool_template::set_no_zero_null): Set
10310 Stringpool_template::offset_ to zero.
10311
10312 2010-03-15 Doug Kwan <dougkwan@google.com>
10313
10314 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10315 offset_.
10316 (Stringpool_template::new_key_offset): New method.
10317 (Stringpool_template::add_string): Assign offsets when adding new
10318 strings.
10319 (Stringpool_template::set_string_offsets): Do not set string offsets
10320 when not optimizing.
10321 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
10322 member size_.
10323 (Chunked_vector::clear): Clear size_.
10324 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
10325 (Chunked_vector::size): Return size_.
10326 (Chunked_vector::push_back): Use size_ to find insert position.
10327 (Chunked_vector::size_): New data member.
10328 (Stringpool_template::set_no_zero_null): Assert string set is empty.
10329 (Stringpool_template::new_key_offset): New method declaration.
10330 (Stringpool_template::offset_): New data member.
10331
10332 2010-03-15 Rafael Espindola <espindola@google.com>
10333
10334 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
10335 Add_symbols' constructor.
10336 * readsyms.h (Add_symbols): Remove the input_group member.
10337
10338 2010-03-10 Ian Lance Taylor <iant@google.com>
10339
10340 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
10341 target to ask whether a reference to a symbol requires a stack
10342 split.
10343 * target.h (Target::is_call_to_non_split): New function.
10344 (Target::do_is_call_to_non_split): Declare virtual function.
10345 * target.cc: Include "symtab.h".
10346 (Target::do_is_call_to_non_split): New function.
10347 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
10348
10349 2010-03-10 Cary Coutant <ccoutant@google.com>
10350
10351 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
10352 (File_read::open[1]): Remove initial mapping of whole_file_view_.
10353 (File_read::open[2]): Add whole_file_view_ to list of views.
10354 (File_read::make_view): Remove test of whole_file_view_.
10355 (File_read::find_or_make_view): Create whole_file_view_ if
10356 necessary.
10357 (File_read::clear_views): Replace bool parameter with enum;
10358 adjust all callers. Don't delete views with permanent data;
10359 do delete cached views and views from archives if
10360 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
10361 if clearing the corresponding view.
10362 * fileread.h (File_read::Clear_views_mode): New enum.
10363 (File_read::View::is_permanent_view): New method.
10364 (File_read::clear_views): Replace bool parameter
10365 with enum; adjust all callers.
10366 * options.h (General_options): Change keep_files_mapped option;
10367 add map_whole_files.
10368 * readsyms.cc (Add_symbols::run): Delete sd_ object before
10369 releasing the file.
10370 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
10371 the file.
10372
10373 2010-03-10 David S. Miller <davem@davemloft.net>
10374
10375 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
10376
10377 2010-03-09 Sriraman Tallam <tmsriram@google.com>
10378
10379 * icf.cc (get_section_contents): Add '@' marker after processing the
10380 merge reloc.
10381
10382 2010-03-08 Doug Kwan <dougkwan@google.com>
10383
10384 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
10385 due to a conversion warning.
10386 (Arm_relobj::update_output_local_symbol_count): Check for local
10387 symbol with unset output index.
10388
10389 2010-03-05 Ian Lance Taylor <iant@google.com>
10390
10391 * options.h (class General_options): Add --spare-dynamic-tags.
10392 * output.cc (Output_data_dynamic::set_final_data_size): Implement
10393 --spare-dynamic-tags.
10394
10395 2010-03-05 Ian Lance Taylor <iant@google.com>
10396
10397 * incremental.cc: Include "libiberty.h".
10398
10399 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
10400
10401 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
10402 function, is_info_ member.
10403 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
10404 (Versions::Versions): Update caller.
10405 (Versions::define_base_version): Likewise.
10406 (Versions::add_def): Likewise.
10407
10408 2010-03-03 Sriraman Tallam <tmsriram@google.com>
10409
10410 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
10411 (Scan::possible_function_pointer_reloc): New function.
10412 (Scan::local_reloc_may_be_function_pointer): Change to call
10413 possible_function_pointer_reloc.
10414 (Scan::global_reloc_may_be_function_pointer): Ditto.
10415 * icf.h (Icf::check_section_for_function_pointers): Change to reject
10416 relocations in ".data.rel.ro._ZTV" section.
10417 * testsuite/icf_safe_so_test.sh: Change to pass i386.
10418 * testsuite/icf_safe_so_test.cc: Ditto.
10419 * testsuite/icf_safe_test.cc: Ditto.
10420 * testsuite/icf_safe_test.sh: Ditto.
10421
10422 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10423 Ian Lance Taylor <iant@google.com>
10424
10425 * target-reloc.h (relocate_section): Check the symbol table index
10426 for -1U before setting the local symbol index.
10427 (scan_relocatable_relocs): If copying the relocation, record that
10428 the local symbol is required.
10429 * object.h (Symbol_value::is_output_symtab_index_set): New
10430 function.
10431 (Symbol_value::may_be_discarded_from_output_symtab): New
10432 function.
10433 (Symbol_value::has_output_symtab_entry): New function.
10434 (Symbol_value::needs_output_symtab_entry): Remove.
10435 (Symbol_value::output_symtab_index): Make sure the symbol index is
10436 set.
10437 (Symbol_value::set_output_symtab_index): Make sure the symbol
10438 index is not set. Make sure the new index is valid.
10439 (Symbol_value::set_must_have_output_symtab_entry): New function.
10440 (Symbol_value::has_output_dynsym_entry): New function.
10441 (Symbol_value::set_output_dynsym_index): Make sure the new index
10442 is valid.
10443 (Sized_relobj::set_must_have_output_symtab_entry): New function.
10444 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
10445 local symbol if permitted.
10446 (Sized_relobj::do_finalize_local_symbols): Call
10447 is_output_symtab_index_set rather than needs_output_symtab_entry.
10448 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
10449 rather than needs_output_symtab_entry. Call
10450 has_output_dynsym_entry rather than needs_output_dynsym_entry.
10451 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
10452 is_output_symtab_index_set rather than needs_output_symtab_entry.
10453 * testsuite/discard_locals_relocatable_test.c: New file.
10454 * testsuite/discard_locals_test.sh: Test -r.
10455 * testsuite/Makefile.am (check_DATA): Add
10456 discard_locals_relocatable_test1.syms,
10457 discard_local_relocatable_test2.syms.
10458 (MOSTLYCLEANFILES): Likewise. Also add
10459 discard_locals_relocatable_test1.lout and
10460 discard_locals_relocatable_test2.out.
10461 (discard_locals_relocatable_test1.syms): New target.
10462 (discard_locals_relocatable_test.o): New target.
10463 (discard_locals_relocatable_test1.out): New target.
10464 (discard_locals_relocatable_test2.syms): New target.
10465 (discard_locals_relocatable_test2.out): New target.
10466 (various): Add missing ../ld-new dependencies.
10467 * testsuite/Makefile.in: Rebuild.
10468
10469 2010-03-03 Nick Clifton <nickc@redhat.com>
10470
10471 * po/fi.po: New Finnish translation.
10472
10473 2010-03-01 Doug Kwan <dougkwan@google.com>
10474
10475 * layout.cc (Layout::Layout): Force section types of .init_array*,
10476 .preinit_array* and .fini_array* sections.
10477 * output.cc (Output_section::Input_section_sort_entry::has_priority):
10478 Fix check of return value of std::string::find.().
10479 (Output_section::Input_section_sort_compare::operator()): Remove
10480 comment about .init_array.
10481 (Output_section::Input_section_sort_init_fini_compare::operator()):
10482 New method.
10483 (Output_section::sort_attached_input_sections): Handle .init_array
10484 and .fini_array specially.
10485 * output.h (Output_section::Inut_section_sort_compare): Update
10486 comment.
10487 (Output_section::Input_section_sort_init_fini_compare): New struct.
10488
10489 2010-02-26 Doug Kwan <dougkwan@google.com>
10490
10491 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
10492 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
10493 * testsuite/debug_msg.sh: Avoid matching source line number for
10494 use of global variable undef_int.
10495
10496 2010-02-26 Doug Kwan <dougkwan@google.com>
10497
10498 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
10499 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
10500 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
10501 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
10502 * options.cc (General_options::General_options): Initialize member
10503 fix_v4bx_.
10504 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
10505 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
10506 and rm_no_fix_v4bx.stdout
10507 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
10508 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
10509 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
10510 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
10511 and arm_no_fix_v4bx.
10512 * Makefile.in: Regenerate.
10513 * testsuite/arm_fix_v4bx.s: New file.
10514 * testsuite/arm_fix_v4bx.sh: Ditto.
10515
10516 2010-02-24 Doug Kwan <dougkwan@google.com>
10517
10518 * arm.cc (Target_arm::got_section): Make the .got section the first
10519 non RELRO section in the data segment.
10520 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
10521 suffixes of section names.
10522
10523 2010-02-24 Doug Kwan <dougkwan@google.com>
10524
10525 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
10526 flags and attributes merging if an input file is a binary file.
10527 * fileread.cc (Input_file::open): Record format of original file.
10528 * fileread.h (Input_file::Format): New enum type.
10529 (Input_file::Input_file): Initialize data member format_.
10530 (Input_file::format): New method definition.
10531 (Input_file::format_):: New data member.
10532
10533 2010-02-24 Doug Kwan <dougkwan@google.com>
10534
10535 * arm.cc (Arm_output_data_got): New class.
10536 (ARM_TCB_SIZE): New constant
10537 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
10538 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
10539 If user uses a script with a SECTIONS clause, issue only a warning
10540 for a misplaced EXIDX input section. Otherwise, issue an error.
10541 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
10542 garbage collection.
10543 (Target_arm::got_mode_index_entry): Handle static linking.
10544 (Target_arm::Scan::local): Ditto.
10545 (Target_arm::Scan::global): Ditto.
10546 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
10547 all incorrectly implemented relocations.
10548 (Target_arm::fix_exidx_coverage): Pass layout to
10549 Arm_output_section::fix_exidx_coverage.
10550 * layout.cc (Layout::section_name_mapping): Remove trailing dots
10551 from ".ARM.exidx." and ".ARM.extab.".
10552
10553 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10554
10555 * arm.cc (Target_arm::do_finalize_sections): Create attribute
10556 section if it does not already exist.
10557 * attributes.cc (Attributes_section_data::Attributes_section_data):
10558 Don't crash if size is zero.
10559
10560 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10561 Ian Lance Taylor <iant@google.com>
10562
10563 * gold.cc (queue_middle_tasks): If no input files were opened,
10564 exit.
10565 * workqueue.h (Task_function::Task_function): Assert that there is
10566 a blocker.
10567
10568 2010-02-22 Doug Kwan <dougkwan@google.com>
10569
10570 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
10571 * icf.cc (get_section_contents): Cast snprintf arguments to long long
10572 types to avoid warnings due to different uint64_t implementations
10573 on different hosts.
10574
10575 2010-02-21 Doug Kwan <dougkwan@google.com>
10576
10577 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
10578 handling of the maximum backward branch offset.
10579 (Arm_relocate_functions::thumb_branch_common): Ditto.
10580 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
10581 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
10582 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
10583 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
10584 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
10585 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
10586 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
10587 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
10588 thumb_bl_out_of_range thumb_bl_out_of_range.o,
10589 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
10590 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
10591 thumb2_bl_out_of_range.o): New rules.
10592 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
10593 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
10594 thumb2_bl_out_of_range
10595 * testsuite/Makefile.in: Regenerate.
10596 * testsuite/arm_bl_in_range.s: New file.
10597 * testsuite/arm_bl_out_of_range.s: Ditto.
10598 * testsuite/arm_branch_in_range.sh: Ditto.
10599 * testsuite/arm_branch_range.t: Ditto.
10600 * testsuite/thumb2_branch_range.t: Ditto.
10601 * testsuite/thumb_bl_in_range.s: Ditto.
10602 * testsuite/thumb_bl_out_of_range.s: Ditto.
10603 * testsuite/thumb_branch_range.t: Ditto.
10604
10605 2010-02-20 Sriraman Tallam <tmsriram@google.com>
10606
10607 * gc.h (gc_process_relocs): Change vectors to point to the new list.
10608 Add reloc offset information.
10609 * icf.cc (get_section_contents): Change iterators to point to the new
10610 vectors. Add reloc offset information to the contents.
10611 * icf.h (Icf::Sections_reachable_info): New typedef.
10612 (Icf::Sections_reachable_list): New typedef.
10613 (Icf::Offset_info): New typedef.
10614 (Icf::Reloc_info): New struct typedef.
10615 (Icf::Reloc_info_list): New typedef.
10616 (Icf::symbol_reloc_list): Delete method.
10617 (Icf::addend_reloc_list): Delete method.
10618 (Icf::section_reloc_list): Delete method.
10619 (Icf::reloc_info_list): New method.
10620 (Icf::reloc_info_list_): New member.
10621
10622 2010-02-19 Doug Kwan <dougkwan@google.com>
10623
10624 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
10625 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
10626 * arm.cc (Arm_relocation_functions): New forward declaration.
10627 (Target_arm::Target_arm): Initialize new data members
10628 got_mod_index_offset_ and tls_base_symbol_defined_.
10629 (Target_arm::Relocate::relocate_tls): New method.
10630 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
10631 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
10632 New methods.
10633 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
10634 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
10635 (Target_arm::got_mod_index_offset_,
10636 Target_arm::tls_base_symbol_defined_): New data members.
10637 (Target_arm::Scan::local, Target::Scan::global,
10638 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
10639 relocations.
10640
10641 2010-02-18 Doug Kwan <dougkwan@google.com>
10642
10643 * arm.cc (Arm_relobj::find_linked_text_section): New method.
10644 (Arm_relobj::make_exidx_input_section): Pass section index of linked
10645 text section as a parameter becuase some broken tools may not set
10646 the link in section header.
10647 (Target_arm::has_got_section): New method.
10648 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
10649 without any mapping symbol as data only. Remove warning.
10650 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
10651 link in its section header, try to discover the link by inspecting the
10652 REL31 relocation at the beginning of the section.
10653 (Target_arm::Scan::check_non_pic): Report name of offending relocation
10654 in error message.
10655 (Target_arm::Scan::global): Treat any reference to the symbol
10656 _GLOBAL_OFFSET_TABLE_ as a GOT access.
10657
10658 2010-02-12 Sriraman Tallam <tmsriram@google.com>
10659
10660 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
10661 (Scan::global_reloc_may_be_function_pointer): New function.
10662 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10663 (Scan::global_reloc_may_be_function_pointer): New function.
10664 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10665 (Scan::global_reloc_may_be_function_pointer): New function.
10666 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
10667 (Scan::global_reloc_may_be_function_pointer): New function.
10668 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
10669 (Scan::global_reloc_may_be_function_pointer): New function.
10670 (Scan::possible_function_pointer_reloc): New function.
10671 (Target_x86_64::can_check_for_function_pointers): New function.
10672 * gc.h (gc_process_relocs): Scan relocation types to determine if
10673 function pointers were taken for targets that support it.
10674 * icf.cc (Icf::find_identical_sections): Include functions for
10675 folding in safe ICF whose pointer is not taken.
10676 * icf.h (Secn_fptr_taken_set): New typedef.
10677 (fptr_section_id_): New member.
10678 (section_has_function_pointers): New function.
10679 (set_section_has_function_pointers): New function.
10680 (check_section_for_function_pointers): New function.
10681 * options.h: Fix comment for safe ICF option.
10682 * target.h (can_check_for_function_pointers): New function.
10683 * testsuite/Makefile.am: Add icf_safe_so_test test case.
10684 Modify icf_safe_test for X86-64.
10685 * testsuite/Makefile.in: Regenerate.
10686 * testsuite/icf_safe_so_test.cc: New file.
10687 * testsuite/icf_safe_so_test.sh: New file.
10688 * testsuite/icf_safe_test.cc (kept_func_3): New function.
10689 (main): Change to take pointer to function kept_func_3.
10690 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
10691 folding is done correctly for X86-64.
10692
10693 2010-02-12 David S. Miller <davem@davemloft.net>
10694
10695 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
10696 is_symbolless parameter.
10697 (Output_reloc<SHT_REL>::is_symbolless): New.
10698 (Output_reloc<SHT_REL>::is_symbolless_): New.
10699 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
10700 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
10701 (Output_reloc<SHT_RELA>::is_symbolless): New.
10702 (Output_data_reloc::add_global): Handle is_symbolless.
10703 (Output_data_reloc::add_global_relative): Likewise.
10704 (Output_data_reloc::add_local): Likewise.
10705 (Output_data_reloc::add_local_relative): Likewise.
10706 (Output_data_reloc::add_symbolless_global_addend): New.
10707 (Output_data_reloc::add_symbolless_local_addend): New.
10708 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
10709 is_symbolless.
10710 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
10711 instead of ->is_relative_
10712 (Output_reloc::write): Likewise.
10713 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
10714 (Output_reloc::write_rel): Simplify.
10715
10716 * sparc.cc (Target_sparc::Scan::local): Use
10717 ->add_symbolless_local_addend as needed.
10718 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
10719 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
10720 based upon relocation offset.
10721
10722 2010-02-11 Doug Kwan <dougkwan@google.com>
10723
10724 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
10725 (Target_arm::Scan::global): Ditto. Also remove a comment before the
10726 beginning of function.
10727 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
10728 and MOVT_ABS relocations. Those are non issued in scanning. Fix
10729 parameter is_32bit in calls to should_apply_static_reloc.
10730 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
10731 (check_DATA): Add arm_abs_global.stdout.
10732 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
10733 arm_abs_global.stdout): New rules.
10734 (MOSTLLYCLEANFILES): Add arm_abs_global
10735 * Makefile.in: Regenerate.
10736 * testsuite/arm_abs_global.s: New file.
10737 * testsuite/arm_abs_global.sh: Ditto.
10738 * testsuite/arm_abs_lib.s: Ditto.
10739
10740 2010-02-11 Ian Lance Taylor <iant@google.com>
10741
10742 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
10743 Read_relocs task.
10744 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
10745 Allocate_commons_task first.
10746 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
10747 task, rather than symtab_lock_.
10748 (Gc_process_relocs::~Gc_process_relocs): New function.
10749 (Gc_process_relocs::is_runnable): Check this_blocker_.
10750 (Gc_process_relocs::locks): Use next_blocker_ rather than
10751 blocker_.
10752 (Scan_relocs::~Scan_relocs): New function.
10753 (Scan_relocs::is_runnable): Check this_blocker_ rather than
10754 symtab_lock_.
10755 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
10756 next_blocker_.
10757 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
10758 fields. Add this_blocker_ and next_blocker_ fields. Adjust
10759 constructor accordingly.
10760 (class Gc_process_relocs): Likewise.
10761 (class Scan_relocs): Likewise.
10762 * common.h (class Allocate_commons_task): Remove symtab_lock_
10763 field, and corresponding constructor parameter.
10764 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
10765 symtab_lock_.
10766 (Allocate_commons_task::locks): Likewise.
10767
10768 2010-02-11 Ian Lance Taylor <iant@google.com>
10769
10770 * gold-threads.h (class Once): Define.
10771 (class Initialize_lock): Rewrite as child of Once.
10772 * gold-threads.cc (class Once_initialize): Define.
10773 (once_pointer_control): New static variable.
10774 (once_pointer, once_arg): New static variables.
10775 (c_run_once): New static function.
10776 (Once::Once, Once::run_once, Once::internal_run): New functions.
10777 (class Initialize_lock_once): Remove.
10778 (initialize_lock_control): Remove.
10779 (initialize_lock_pointer): Remove.
10780 (initialize_lock_once): Remove.
10781 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
10782 (Initialize_lock::initialize): Rewrite.
10783 (Initialize_lock::do_run_once): New function.
10784 * archive.cc (Archive::interpret_header): Only clear name if it is
10785 not already empty.
10786 * fileread.cc: Include "gold-threads.h"
10787 (file_counts_lock): New static variable.
10788 (file_counts_initialize_lock): Likewise.
10789 (File_read::release): Only increment counts when using --stats.
10790 Use a lock around the increment.
10791 * parameters.cc (class Set_parameters_target_once): Define.
10792 (set_parameters_target_once): New static variable.
10793 (Parameters::Parameters): Move here from parameters.h.
10794 (Parameters::set_target): Rewrite.
10795 (Parameters::set_target_once): New function.
10796 (Parameters::clear_target): Move here and rewrite.
10797 * parameters.h (class Parameters): Update declarations. Add
10798 set_parameters_target_once_ field.
10799 (Parameters::Parameters): Move to parameters.cc.
10800 (Parameters::clear_target): Likewise.
10801 * readsyms.cc (Read_symbols::do_group): Create a Start_group
10802 task.
10803 (Start_group::~Start_group): New function.
10804 (Start_group::is_runnable): New function.
10805 (Start_group::locks, Start_group::run): New functions.
10806 (Finish_group::run): Change saw_undefined to size_t.
10807 * readsyms.h (class Start_group): Define.
10808 (class Finish_group): Change saw_undefined_ field to size_t.
10809 (Finish_group::Finish_group): Remove saw_undefined and
10810 this_blocker parameters. Change all callers.
10811 (Finish_group::set_saw_undefined): New function.
10812 (Finish_group::set_blocker): New function.
10813 * symtab.h (class Symbol_table): Change saw_undefined to return
10814 size_t. Change saw_undefined_ field to size_t.
10815 * target-select.cc (Set_target_once::do_run_once): New function.
10816 (Target_selector::Target_selector): Initialize set_target_once_
10817 field. Don't initialize lock_ and initialize_lock_ fields.
10818 (Target_selector::instantiate_target): Rewrite.
10819 (Target_selector::set_target): New function.
10820 * target-select.h (class Set_target_once): Define.
10821 (class Target_selector): Update declarations. Make
10822 Set_target_once a friend. Remove lock_ and initialize_lock_
10823 fields. Add set_target_once_ field.
10824
10825 2010-02-10 Ian Lance Taylor <iant@google.com>
10826
10827 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
10828 queueing any tasks.
10829 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
10830 (queue_middle_tasks): Add all blockers before queueing any tasks.
10831 (queue_final_tasks): Likewise.
10832 * token.h (Task_token::add_blockers): New function.
10833 * object.h (Input_objects::number_of_relobjs): New function.
10834
10835 2010-02-10 Ian Lance Taylor <iant@google.com>
10836
10837 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
10838 shared, not if not position independent.
10839 * x86_64.cc (Relocate::relocate_tls): Likewise.
10840 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
10841 (tls_pie_pic_test): New target.
10842 * testsuite/Makefile.in: Rebuild.
10843
10844 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
10845 (tls_test_main_pie.o, tls_test_pie.o): New targets.
10846 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
10847 * testsuite/Makefile.in: Rebuild.
10848
10849 2010-02-09 David S. Miller <davem@davemloft.net>
10850
10851 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
10852 R_SPARC_RELATIVE using ->add_local_relative().
10853 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
10854
10855 * output.h (Output_data_dynamic::add_section_size): New method
10856 that takes two Output_data objects.
10857 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
10858 entry param. Handle it in initializers.
10859 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
10860 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
10861 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
10862 arg.
10863 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
10864 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
10865 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
10866 for dynrel_includes_plt.
10867 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10868 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10869 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
10870 before .rela.plt
10871 (Target_sparc::do_finalize_sections): Update to pass true for
10872 dynrel_includes_plt.
10873 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
10874 output before .rela.plt
10875 (Target_powerpc::do_finalize_sections): Update to pass true for
10876 dynrel_includes_plt when 32-bit.
10877
10878 2010-02-08 Doug Kwan <dougkwan@google.com>
10879
10880 * arm.cc (Arm_relobj::simple_input_section_output_address): New
10881 method.
10882 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
10883 Arm_relobj::scan_section_for_cortex_a8_stubs,
10884 Arm_relobj::do_relocation_section): Instead of calling
10885 Output_section::output_address, use faster
10886 Arm_relobj::simple_input_section_output_address.
10887
10888 2010-02-08 David S. Miller <davem@davemloft.net>
10889
10890 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
10891 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
10892 relocation helper function.
10893
10894 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
10895 just like R_SPARC_GOT{10,13,22}.
10896 (Target_sparc::Scan::local): Likewise.
10897 (Target_sparc::Relocate:relocate): Likewise.
10898
10899 2010-02-06 Ian Lance Taylor <iant@google.com>
10900
10901 * configure.ac: Rewrite targetobjs duplicate removal code to use
10902 only shell constructs.
10903 * configure: Rebuild.
10904
10905 2010-02-05 Doug Kwan <dougkwan@google.com>
10906
10907 PR 11247
10908 * arm.cc (Arm_relobj::section_is_scannable): New method.
10909 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
10910 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
10911
10912 2010-02-04 Doug Kwan <dougkwan@google.com>
10913
10914 PR 11247
10915 * arm-reloc-property.cc (cstdio): Include.
10916 * configure.ac (targetobjs): Remove duplicates.
10917 * configure: Regenerate.
10918 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
10919 big and little endian version for a given address size.
10920
10921 2010-02-03 Doug Kwan <dougkwan@google.com>
10922
10923 * arm-reloc-property.cc
10924 (Arm_reloc_property_table::reloc_name_in_error_message): New method
10925 definition.
10926 * arm-reloc-property.h
10927 (Arm_reloc_property_table::get_implemented_static_reloc_property):
10928 New method definition.
10929 (Arm_reloc_property_table::reloc_name_in_error_message): New method
10930 declaration.
10931 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
10932 overflow to N.
10933 (GOT_PREL): Change implemented to Y.
10934 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
10935 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
10936 (Arm_relocate_functions::movw_abs_nc): Remove method.
10937 (Arm_relocate_functions::movt_abs): Ditto.
10938 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
10939 (Arm_relocate_functions::thm_movt_abs): Ditto.
10940 (Arm_relocate_functions::movw_rel_nc): Ditto.
10941 (Arm_relocate_functions::movw_rel): Ditto.
10942 (Arm_relocate_functions::movt_rel): Ditto.
10943 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
10944 (Arm_relocate_functions:thm_movw_rel): Ditto.
10945 (Arm_relocate_functions:thm_movt_rel): Ditto.
10946 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
10947 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
10948 New method definitions.
10949 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
10950 (Arm_relocation_functions::arm_grp_ldr): Ditto.
10951 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
10952 (Arm_relocation_functions::arm_grp_ldc): Ditto.
10953 (Target_arm::Relocate::relocate): Check for non-static or
10954 unimplemented relocation code and exit early. Change calls to
10955 Target_arm::reloc_uses_thumb_bit and
10956 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
10957 instead. Refactor code to handle similar relocations to increase
10958 code sharing. Remove check for unsupported relocation code in switch
10959 statement.
10960 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
10961 relocation property table to find out size. Change error message to
10962 print out the name of a relocation code instead of the numeric value.
10963 (Target_arm::scan_reloc_for_stub): Use relocation property table
10964 instead of calling Target_arm::reloc_uses_thumb_bit().
10965
10966 2010-02-02 Doug Kwan <dougkwan@google.com>
10967
10968 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
10969 types of relaxed input section.
10970
10971 2010-02-02 Doug Kwan <dougkwan@google.com>
10972
10973 * Makefile.am (HFILES): Add arm-reloc-property.h.
10974 (DEFFILES): New.
10975 (TARGETSOURCES): Add arm-reloc-property.cc
10976 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
10977 (libgold_a_SOURCES): $(DEFFILES)
10978 * Makefile.in: Regenerate.
10979 * arm-reloc-property.cc: New file.
10980 * arm-reloc-property.h: New file.
10981 * arm-reloc.def: New file.
10982 * arm.cc: Update comments.
10983 (arm-reloc-property.h): New included header.
10984 (arm_reloc_property_table): New global variable.
10985 (Target_arm::do_select_as_default_target): New method definition.
10986 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
10987 arm-reloc-property to targ_extra_obj.
10988 * parameters.cc (set_parameters_target): Call
10989 Target::select_as_default_target().
10990 * target.h (Target::select_as_default_target): New method definition.
10991 (Target::do_select_as_default_target): Same.
10992
10993 2010-02-01 Doug Kwan <dougkwan@google.com>
10994
10995 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
10996 first_output_text_section_.
10997 (Arm_exidx_fixup::first_output_text_section): New method definition.
10998 (Arm_exidx_fixup::first_output_text_section_): New data member.
10999 (Arm_exidx_fixup::process_exidx_section): Record the first text
11000 output section seen.
11001 (Arm_output_section::fix_exidx_coverage): Set correct linked section
11002 and entsize in output section header.
11003
11004 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11005
11006 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
11007 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
11008 (Arm_relocate_functions::thm_alu11): New Method.
11009 (Arm_relocate_functions::thm_pc8): New Method.
11010 (Arm_relocate_functions::thm_pc12): New Method.
11011 (Target_arm::Scan::local): Handle the relocations.
11012 (Target_arm::Scan::global): Likewise.
11013 (Target_arm::Relocate::relocate): Likewise.
11014 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11015
11016 2010-01-29 Doug Kwan <dougkwan@google.com>
11017
11018 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
11019 of relocation types as ld.
11020
11021 2010-01-29 Doug Kwan <dougkwan@google.com>
11022
11023 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
11024 to public.
11025 (Arm_relocate_functions::thumb_branch_common): Ditto.
11026 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
11027 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
11028 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
11029 Arm_relocate_functions::jump24): Remove.
11030 (Target_arm::Relocate::relocate): Adjust code to call
11031 Arm_relocation_functions::arm_branch_common and
11032 Arm_relocation_functions::thumb_branch_common instead of their removed
11033 wrappers. Merge switch-cases together to reduce source code size.
11034
11035 2010-01-29 Doug Kwan <dougkwan@google.com>
11036
11037 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
11038 output_local_symbol_count_needs_update_.
11039 (Arm_relobj::output_local_symbol_count_needs_update,
11040 Arm_relobj::set_output_local_symbol_count_needs_update,
11041 Arm_relobj::update_output_local_symbol_count): New methods.
11042 (Arm_relobj::output_local_symbol_count_needs_update_): New data
11043 member.
11044 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
11045 of pointed function as in a R_ARM_PREL31 relocation.
11046 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
11047 for output local symbol count updating.
11048 (Target_arm::do_relax): Update output local symbol counts in objects
11049 if necessary.
11050 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
11051
11052 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11053
11054 * arm.cc: Added support for the ARM relocations:
11055 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
11056 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
11057 (Arm_relocate_functions::movw_rel_nc): Renamed (was
11058 movw_prel_nc).
11059 (Arm_relocate_functions::movw_rel): New method.
11060 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
11061 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
11062 thm_movw_prel_nc).
11063 (Arm_relocate_functions::thm_movw_rel): New method.
11064 (Arm_relocate_functions::thm_movt_rel): Renamed (was
11065 thm_movt_prel).
11066 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
11067 relocations.
11068 (Target_arm::Scan::global): Likewise.
11069 (Target_arm::Relocate::relocate): Likewise.
11070 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11071 Likewise.
11072
11073 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11074
11075 * arm.cc: Added support for ARM group relocations.
11076 (Target_arm::reloc_needs_sym_origin): New method.
11077 (Arm_relocate_functions::calc_grp_kn): New method.
11078 (Arm_relocate_functions::calc_grp_residual): New method.
11079 (Arm_relocate_functions::calc_grp_gn): New method.
11080 (Arm_relocate_functions::arm_grp_alu): New Method.
11081 (Arm_relocate_functions::arm_grp_ldr): New Method.
11082 (Arm_relocate_functions::arm_grp_ldrs): New Method.
11083 (Arm_relocate_functions::arm_grp_ldc): New Method.
11084 (Target_arm::Scan::local): Handle the ARM group relocations.
11085 (Target_arm::Scan::global): Likewise.
11086 (Target_arm::Relocate::relocate): Likewise.
11087 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11088 Likewise.
11089
11090 2010-01-26 Doug Kwan <dougkwan@google.com>
11091
11092 * arm.cc (set): Include.
11093 (class Arm_exidx_fixup): Change type of last_input_section_ to const
11094 pointer type.
11095 (Arm_output_section::Text_section_list): New type.
11096 (Arm_output_section::append_text_sections_to_list): New method.
11097 (Arm_output_section::fix_exidx_coverage): Ditto.
11098 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
11099 (Arm_relobj::convert_input_section_to_relaxed_section): Use
11100 Relobj::set_section_offset() instead of
11101 Sized_relobj::invalidate_section_offset().
11102 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
11103 parameter for section headers. Ignore relocation sections for
11104 unallocated sections and EXIDX sections.
11105 (Target_arm::fix_exidx_coverage): New method.
11106 (Target_arm::output_section_address_less_than): New type.
11107 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
11108 linked text section instead of the EXIDX section.
11109 (Arm_output_section::create_stub_group): Add an assertion to check
11110 that this is not an EXIDX output section.
11111 (Arm_output_section::append_text_sections_to_list): New method.
11112 (Arm_output_section::fix_exidx_coverage): Ditto.
11113 (Arm_relobj::scan_sections_for_stubs): Adjust call to
11114 Arm_relobj::section_needs_reloc_stub_scanning.
11115 (Target_arm::do_relax): Fix EXIDX output section coverage in the
11116 first pass.
11117 (Target_arm::fix_exidx_coverage): New method.
11118 * object.h (Relobj::set_output_section): New method.
11119 (Sized_relobj::invalidate_section_offset): Remove method.
11120 (Sized_relobj::do_invalidate_section_offset): Remove method.
11121 (Sized_relobj::do_set_section_offset): Handle offset value -1.
11122
11123 2010-01-25 Doug Kwan <dougkwan@google.com>
11124
11125 * arm.cc (Arm_exidx_merged_section::do_output_offset):
11126 Fix warning due to signed and unsigned comparison on a 32-bit host.
11127
11128 2010-01-22 Doug Kwan <dougkwan@google.com>
11129
11130 * arm.cc (Target_arm::do_relax): Record an output section for section
11131 offset adjustment it contains any stub table that has changed.
11132 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
11133 offsets in an output section if necessary.
11134 * output.cc (Output_section::Output_section): Initialize
11135 section_offsets_need_adjustments_.
11136 (Output_section::add_input_section_for_script): Renamed to
11137 Output_section::add_simple_input_section.
11138 (Output_section::save_states): Add a comment.
11139 (Output_section::discard_states): New method defintion.
11140 (Output_section::adjust_section_offsets): Same.
11141 * output.h (Output_section::add_input_section_for_script): Renamed to
11142 Output_section::add_simple_input_section.
11143 (Output_section::discard_states): New method declaration.
11144 (Output_section::adjust_section_offsets): Same.
11145 (Output_section::section_offsets_need_adjustment,
11146 Output_section::set_section_offsets_need_adjustment): New method
11147 definitions.
11148 (Output_section::section_offsets_need_adjustment_): New data member.
11149 * script-sections.cc
11150 (Output_section_element_input::set_section_address): Adjust code for
11151 renaming of Output_section::add_input_section_for_script.
11152 (Orphan_output_section::set_section_address): Same.
11153
11154 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11155
11156 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
11157 Fix_v4bx enum values .
11158 * gold/options.h (General_options): New option definitions.
11159 (General_options::fix_v4bx): New method.
11160 (General_options::Fix_v4bx): New enum.
11161 * gold/options.cc (General_options::parse_fix_v4bx): New method.
11162 (General_options::parse_fix_v4bx_interworking): New method.
11163
11164 2010-01-22 Doug Kwan <dougkwan@google.com>
11165
11166 * arm.cc (Arm_exidx_fixup): New class.
11167
11168 2010-01-21 Doug Kwan <dougkwan@google.com>
11169
11170 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
11171 classes.
11172 (Arm_exidx_section_offset_map): New type.
11173
11174 2010-01-21 Doug Kwan <dougkwan@google.com>
11175
11176 * arm.cc (Arm_exidx_input_section): New class.
11177 (Arm_relobj::exidx_input_section_by_link,
11178 Arm_relobj::exidx_input_section_by_shndx,
11179 Arm_relobj::make_exidx_input_section): New methods.
11180 (read_arm_attributes_section): Remove.
11181 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
11182 information about them.
11183 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
11184 to here.
11185
11186 2010-01-20 Doug Kwan <dougkwan@google.com>
11187
11188 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
11189 Input_section_specifier to Section_id.
11190 (Target_arm::new_arm_input_section: Adjust code for change of key
11191 type.
11192 (Target_arm::find_arm_input_section): Ditto.
11193 * gc.h (object.h): Include for Section_id nand Section_id_hash.
11194 (Section_id): Remove.
11195 (Garbage_collection::Section_id_hash): Remove.
11196 * icf.h (object.h): Include for Section_id nand Section_id_hash.
11197 (Section_id): Remove.
11198 (Icf::Section_id_hash): Remove.
11199 * object.h (Section_id, Const_section_id, Section_id_hash,
11200 Const_section_id_hash): New type definitions.
11201 * output.cc (Output_section::add_relaxed_input_section): Change to
11202 use Const_section_id instead of Input_section_specifier as key type.
11203 (Output_section::add_merge_input_section): Ditto.
11204 (Output_section::build_relaxation_map): Change to use Section_id
11205 instead of Input_section_specifier as key type.
11206 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11207 Ditto.
11208 (Output_section::convert_input_sections_to_relaxed_sections): Change
11209 to use Const_section_id instead of Input_section_specifier as key type.
11210 (Output_section::find_merge_section): Ditto.
11211 (Output_section::find_relaxed_input_section): Ditto.
11212 * output.h (Input_section_specifier): Remove class.
11213 (Output_section::Output_section_data_by_input_section_map): Change
11214 key type to Const_section_id.
11215 (Output_section::Output_relaxed_input_section_by_input_section_map):
11216 Ditto.
11217 (Output_section::Relaxation_map): Change key type to Section_id.
11218
11219 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11220
11221 * gold/arm.cc: Added support for R_ARM_V4BX relocation
11222 (class Arm_v4bx_stub): New class.
11223 (DEF_STUBS): Updated definition to support v4_veneer_bx.
11224 (Stub_factory::make_arm_v4bx_stub): New method.
11225 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
11226 (Stub_table::empty): Handle v4bx stubs.
11227 (Stub_table::add_arm_v4bx_stub): New method.
11228 (Stub_table::find_arm_v4bx_stub): New method.
11229 (Arm_relocate_functions::v4bx): New method.
11230 (Target_arm::fix_v4bx): New method.
11231 (Target_arm::Target_arm): Handle R_ARM_V4BX.
11232 (Stub_table::relocate_stubs): Likewise.
11233 (Stub_table::do_write): Likewise.
11234 (Stub_table::update_data_size_and_addralign): Likewise.
11235 (Stub_table::finalize_stubs): Likewise.
11236 (Target_arm::Scan::local): Likewise.
11237 (Target_arm::Scan::global): Likewise.
11238 (Target_arm::do_finalize_sections): Likewise.
11239 (Target_arm::Relocate::relocate): Likewise.
11240 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11241 Likewise.
11242 (Target_arm::scan_reloc_for_stub): Likewise.
11243 (Target_arm::scan_reloc_section_for_stubs): Likewise.
11244
11245 2010-01-19 Ian Lance Taylor <iant@google.com>
11246
11247 * output.cc (Output_section_headers::do_sized_write): Write large
11248 segment count to sh_info field.
11249 (Output_file_header::do_sized_write): For large segment count,
11250 write PN_XNUM to e_phnum field.
11251
11252 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11253
11254 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
11255 (Arm_relocate_functions::thm_jump8): New function.
11256 (Arm_relocate_functions::thm_jump11): New function.
11257 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
11258 R_ARM_THM_JUMP11.
11259 (Target_arm::Scan::global): Likewise.
11260 (Target_arm::Relocate::relocate): Likewise.
11261 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11262 Likewise.
11263
11264 2010-01-14 Doug Kwan <dougkwan@google.com>
11265
11266 * arm.cc (map, utility): Include headers.
11267 (Target_arm::apply_cortex_a8_workaround): New method.
11268 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
11269 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
11270 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
11271 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
11272 the --[no-]fix-cortex-a8 command line options.
11273 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
11274 (Target_arm::relocate_stub): Use addend in instruction template.
11275 * options.h (DEFINE_bool): Set the user-set flag.
11276 (General_options): Add --[no-]-fix-cortex options.
11277 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
11278 : Update fast look-up map after conversion.
11279
11280 2010-01-14 Sriraman Tallam <tmsriram@google.com>
11281
11282 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
11283 in the first pass of do_layout.
11284
11285 2010-01-13 Doug Kwan <dougkwan@google.com>
11286
11287 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11288 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
11289 apparent compiler problem of not folding static constant integral
11290 data members of elfcpp::Elf_sizes<32>.
11291
11292 2010-01-13 Doug Kwan <dougkwan@google.com>
11293
11294 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11295 Arm_relobj::section_needs_cortex_a8_stub_scanning,
11296 Arm_relobj::scan_section_for_cortex_a8_erratum,
11297 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
11298 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
11299 sections to scan for relocation stubs into a new method
11300 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
11301 relocation and Cortex-A8 stub scanning.
11302 (Target_arm::do_relax): Force stubs to be after stubbed sections
11303 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
11304 the beginning of a new relaxation pass. Update a comment.
11305 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
11306
11307 2010-01-12 Ian Lance Taylor <iant@google.com>
11308
11309 * target-reloc.h (visibility_error): New inline function.
11310 (relocate_section): Call visibility_error.
11311 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
11312 (MOSTLYCLEANFILES): Likewise.
11313 (protected_4_pic.o, protected_3.err): New targets.
11314 * testsuite/protected_4.cc: New file.
11315
11316 2010-01-12 Doug Kwan <dougkwan@google.com>
11317
11318 * arm.cc (Cortex_a8_reloc): New class.
11319 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
11320 and cortex_a8_relocs_info_.
11321 (Target_arm::fix_cortex_a8): New method definition.
11322 (Target_arm::Cortex_a8_relocs_info): New type.
11323 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
11324 New data member declarations.
11325 (Target_arm::scan_reloc_for_stub): Record information about
11326 relocations for THUMB branches that might be exempted from the
11327 Cortex-A8 workaround.
11328 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
11329 at the beginning of a relaxation pass.
11330
11331 2010-01-12 Doug Kwan <dougkwan@google.com>
11332
11333 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
11334 (Arm_relobj::Mapping_symbol_position,
11335 Arm_reloj::Mapping_symbol_position_less,
11336 Arm_relobj::Mapping_symbols_info): New types.
11337 (Target_arm::is_mapping_symbol_name): New method definition.
11338 (Arm_relobj::do_count_local_symbols): Save information about mapping
11339 symbols.
11340
11341 2010-01-11 Doug Kwan <dougkwan@google.com>
11342
11343 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
11344 Arm_relocate_functions::thumb32_branch_upper,
11345 Arm_relocate_functions::thumb32_branch_lower,
11346 Arm_relocate_functions::thumb32_cond_branch_offset,
11347 Arm_relocate_functions::thumb32_cond_branch_upper,
11348 Arm_relocate_functions::thumb32_cond_branch_lower,
11349 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
11350 branch offset encoding.
11351 (Arm_relocate_functions::thumb_branch_common): Use new branch
11352 offset encoding methods to avoid code duplication.
11353 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
11354 (Stub_addend_reader::operator()): Use new branch encoding method
11355 to avoid code duplication.
11356
11357 2010-01-11 Doug Kwan <dougkwan@google.com>
11358
11359 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
11360 (Target_arm::do_finalize_sections): Define special EXIDX section
11361 symbols only if referenced.
11362 * gc.h (Garbage_collection::add_reference): New method.
11363 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
11364 code duplication.
11365
11366 2010-01-11 Ian Lance Taylor <iant@google.com>
11367
11368 * script.cc (Version_script_info::build_expression_list_lookup):
11369 Change complaing about duplicate wildcard match from error to
11370 warning.
11371
11372 * script.cc (class Lazy_demangler): Recreate--revert part of patch
11373 of 2009-12-30.
11374 (Version_script_info::Version_script_info): Initialize globs_,
11375 default_version_, default_is_global_, and exact_. Don't
11376 initialize globals_ or locals_.
11377 (Version_script_info::build_lookup_tables): Build local symbols
11378 first.
11379 (Version_script_info::unquote): New function.
11380 (Version_script_info::add_exact_match): New function.
11381 (Version_script_info::build_expression_list_lookup): Remove lookup
11382 parameter. Add is_global parameter. Change all callers. Handle
11383 wildcard pattern specially. Unquote pattern. Call
11384 add_exact_match.
11385 (Version_script_info::get_name_to_match): New function.
11386 (Version_script_info::get_symbol_version): New function.
11387 (Version_script_info::get_symbol_version_helper): Remove.
11388 (Version_script_info::check_unmatched_names): Call unquote.
11389 * script.h (class Version_script_info): Change get_symbol_version
11390 to be non-inline and add is_global parameter; change all callers.
11391 Rewrite symbol_is_local. Update declarations. Define struct
11392 Version_tree_match, Exact, Globs. Don't define struct Lookup.
11393 Remove globals_ and locals_ members. Add exact_, globs_,
11394 default_version_, is_global_.
11395 (Version_script_info::Glob): Remove pattern, add expression and
11396 is_global. Update constructor. Change all callers.
11397 * dynobj.cc (Versions::finalize): Mark the version symbol as the
11398 default version.
11399 (Versions::symbol_section_contents): If a symbol is undefined, or
11400 defined in a dynamic object, set the version index to
11401 VER_NDX_LOCAL.
11402 * symtab.cc (Symbol_table::add_from_relobj): Don't call
11403 symbol_is_local.
11404 (Symbol_table::add_from_pluginobj): Likewise.
11405 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
11406
11407 2010-01-11 Doug Kwan <dougkwan@google.com>
11408
11409 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
11410 (incremental_dump_LDADD): Add linking option for libintl.
11411 * Makefile.in: Regenerate.
11412
11413 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
11414
11415 PR gold/11144
11416 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
11417 instead of -Ds.
11418 * testsuite/Makefile.in: Regenerated.
11419
11420 2010-01-10 Doug Kwan <dougkwan@google.com>
11421
11422 * options.h (DEFINE_var): Use parentheses around argument varname__
11423 in macro body to avoid any unintended subsequent substitutions.
11424
11425 2010-01-10 Ian Lance Taylor <iant@google.com>
11426
11427 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
11428 candidates before doing symbol resolution.
11429
11430 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
11431 ODR candidates if only one is weak.
11432
11433 2010-01-08 Ian Lance Taylor <iant@google.com>
11434
11435 * script.cc (Version_script_info::build_expression_list_lookup):
11436 Don't warn about ambiguous version, just record the ambiguity.
11437 (Version_script_info::get_symbol_version_helper): Give error if
11438 version is ambiguous.
11439
11440 2010-01-08 Doug Kwan <dougkwan@google.com>
11441
11442 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
11443 prev_data_size_ and prev_addralign_. Remove initializer for
11444 deleted data member has_been_changed_.
11445 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
11446 to determine if the table is empty.
11447 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
11448 Remove.
11449 (Stub_table::add_reloc_stub): Define method in class definition
11450 instead of just declaring it there.
11451 (Stub_table::add_cortex_a8_stub): New method definition.
11452 (Stub_table::update_data_size_and_addralign): Ditto.
11453 (Stub_table::finalize_stubs): Ditto.
11454 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
11455 (Stub_table::do_addralign_): Return address alignment in the
11456 (Stub_table::do_reset_address_and_file_offset): Define method in
11457 class definition instead of declaring it there. Set current data
11458 size to be the data size of the previous pass.
11459 (Stub_table::set_final_data_size): Use current data size as the
11460 final data size.
11461 (Stub_table::relocate_stub): Change parameter type of stub from
11462 Reloc_stub pointer to Stub pointer.
11463 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
11464 (Stub_table::Cortex_a8_stub_list): New typedef.
11465 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
11466 Stub_table::prev_addralign_): New data member.
11467 (Arm_relobj::Arm_relobj): Initialize data member
11468 section_has_cortex_a8_workaround_.
11469 (Arm_relobj::section_has_cortex_a8_workaround,
11470 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
11471 definitions.
11472 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
11473 declarations.
11474 (Target_arm::relocate_stub): Change parameter type of stub from
11475 Reloc_stub pointer to Stub pointer.
11476 (Insn_template::size, Insn_template::alignment): Handle
11477 THUMB16_SPECIAL_TYPE.
11478 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
11479 Stub_table::update_data_size_and_addralign,
11480 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
11481 definitions.
11482 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
11483 (Stub_table::do_write): Ditto.
11484 (Target_arm::do_relax): Adjust code for changes in Stub_table.
11485
11486 2010-01-08 Ian Lance Taylor <iant@google.com>
11487
11488 PR 11108
11489 * symtab.h (class Symbol): Remove fields is_target_special_ and
11490 has_plt_offset_. Add field is_defined_in_discarded_section_.
11491 (Symbol::is_defined_in_discarded_section): New function.
11492 (Symbol::set_is_defined_in_discarded_section): New function.
11493 (Symbol::has_plt_offset): Rewrite.
11494 (Symbol::set_plt_offset): Verify that new offset is not -1U.
11495 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
11496 Don't initialize is_target_special_ or has_plt_offset_.
11497 Initialize is_defined_in_discarded_section_.
11498 (Symbol_table::add_from_relobj): If appropriate, set
11499 is_defined_in_discarded_section.
11500 * resolve.cc (Symbol::override_base_with_special): Don't test
11501 is_target_special_. Change has_plt_offset_ to has_plt_offset().
11502 * target-reloc.h (relocate_section): Do special handling for
11503 symbols defined in discarded sections for global symbols as well
11504 as local symbols.
11505
11506 2010-01-08 Ian Lance Taylor <iant@google.com>
11507
11508 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
11509 the SHT_SYMTAB case.
11510
11511 2010-01-08 Ian Lance Taylor <iant@google.com>
11512
11513 * object.cc (Sized_relobj::do_layout): Don't get confused if
11514 layout_eh_frame returns NULL.
11515
11516 2010-01-08 Ian Lance Taylor <iant@google.com>
11517
11518 PR 11084
11519 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
11520 dynamic symbol table, use the normal symbol table.
11521 (Sized_dynobj::do_read_symbols): Remove assertion about type of
11522 symbol table.
11523
11524 2010-01-08 Ian Lance Taylor <iant@google.com>
11525
11526 PR 11072
11527 * layout.cc (Layout::include_section): Remove .gnu_debuglink
11528 sections.
11529
11530 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
11531
11532 * version.cc (print_version): Change to "Copyright 2010".
11533
11534 2010-01-08 Ian Lance Taylor <iant@google.com>
11535
11536 PR 10287
11537 PR 11063
11538 * i386.cc (class Target_i386): Change return type of plt_section
11539 to be non-const.
11540 (class Output_data_plt_i386): Add tls_desc_rel_ field.
11541 (Output_data_plt_i386::Output_data_plt_i386): Initialize
11542 tls_desc_rel_ field.
11543 (Output_data_plt_i386::rel_tls_desc): New function.
11544 (Target_i386::rel_tls_desc_section): New function.
11545 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
11546 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
11547 R_386_TLS_DESC reloc in rel_tls_desc_section.
11548 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
11549 Define struct Tlsdesc_info.
11550 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
11551 (Target_x86_64::do_reloc_symbol_index): New function.
11552 (Target_x86_64::add_tlsdesc_info): New function.
11553 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
11554 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
11555 tlsdesc_rel_ field.
11556 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
11557 all callers.
11558 (Output_data_plt_x86_64::rela_tlsdesc): New function.
11559 (Target_x86_64::rela_tlsdesc_section): New function.
11560 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
11561 handling.
11562 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
11563 (Target_x86_64::do_reloc_addend): New function.
11564 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
11565 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
11566 declarations. Define TARGET_CODE. Add arg field to u1_ union.
11567 (Output_reloc::type): New function.
11568 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
11569 (Output_reloc::is_target_specific): New function.
11570 (Output_reloc::target_arg): New function.
11571 (class Output_reloc) [SHT_RELA]: Add four new constructors for
11572 absolute relocs and target specific relocs.
11573 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
11574 add_target_specific.
11575 (class Output_data_reloc) [SHT_RELA]: Likewise.
11576 * output.cc (Output_reloc::Output_reloc): Add four new versions
11577 for absolute relocs and target specific relocs.
11578 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
11579 (Output_reloc::get_symbol_index): Likewise.
11580 (Output_reloc::local_section_offset): Check that local_sym_index_
11581 is not TARGET_CODE or 0.
11582 (Output_reloc::symbol_value): Likewise.
11583 (Output_reloc::write) [SHT_RELA]: Call target for target specific
11584 reloc.
11585 * target.h (class Target): Add reloc_symbol_index and reloc_addend
11586 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
11587 functions.
11588 * layout.cc (add_target_dynamic_tags): Use output section for
11589 DT_PLTRELSZ and DT_JMPREL.
11590
11591 2010-01-07 Ian Lance Taylor <iant@google.com>
11592
11593 PR 11061
11594 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
11595 function.
11596 (class Output_data_reloc_generic): Define.
11597 (class Output_data_reloc_base): Change base class to
11598 Output_data_reloc_generic. Change add() method to call
11599 bump_relative_reloc_count for a relative reloc. Remove
11600 sort_relocs_ field.
11601 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
11602 to sort_relocs().
11603 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
11604 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
11605 appropriate.
11606 * layout.h (class Layout): Update declaration.
11607
11608 2010-01-07 Ian Lance Taylor <iant@google.com>
11609
11610 * output.h (class Output_data): Add const version of
11611 output_section and do_output_section.
11612 (class Output_section_data): Add const version of
11613 do_output_section.
11614 (class Output_section): Likewise.
11615 * layout.cc (Layout::add_target_dynamic_tags): New function.
11616 * layout.h (class Layout): Update declarations.
11617 * arm.cc (Target_arm::do_finalize_sections): Use
11618 add_target_dynamic_tags.
11619 * i386.cc (Target_i386::do_finalize_sections): Likewise.
11620 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11621 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11622 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11623
11624 2010-01-07 Ian Lance Taylor <iant@google.com>
11625
11626 PR 11042
11627 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
11628 object as needed.
11629
11630 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
11631 Ian Lance Taylor <iant@google.com>
11632
11633 PR 11019
11634 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
11635 Xindex::read_symtab_xindex.
11636
11637 2010-01-07 Doug Kwan <dougkwan@google.com>
11638
11639 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
11640 (Insn_template::thumb16_bcond_insn): New method declaration.
11641 (Insn_template): Fix spelling.
11642 (Stub::thumb16_special): New method declaration.
11643 (Stub::do_write): Define virtual method which was previously pure
11644 virtual.
11645 (Stub::do_thumb16_special): New method declaration.
11646 (Stub::do_fixed_endian_write): New template member.
11647 (Reloc_stub::do_write): Remove.
11648 (Reloc_stub::do_fixed_endian_write): Remove.
11649 (Cortex_a8_stub): New class definition.
11650 (Stub_factory::make_cortex_a8_stub): New method definition.
11651 (Stub_factory::Stub_factory): Add missing static storage class
11652 qualifier for elf32_arm_stub_a8_veneer_blx.
11653
11654 2010-01-07 Ian Lance Taylor <iant@google.com>
11655
11656 PR 10980
11657 * options.h (class General_options): Add --warn-unresolved-symbols
11658 and --error-unresolved-symbols.
11659 * errors.cc (Errors::undefined_symbol): Implement
11660 --warn-unresolved-symbols.
11661
11662 * options.h (class General_options): Add -z text and -z textoff.
11663 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
11664
11665 2010-01-06 Sriraman Tallam <tmsriram@google.com>
11666
11667 * gc.h (Garbage_collection::Cident_section_map): New typedef.
11668 (Garbage_collection::cident_sections): New function.
11669 (Garbage_collection::add_cident_section): New function.
11670 (Garbage_collection::cident_sections_): New member.
11671 (gc_process_relocs): Add references to sections whose names are C
11672 identifiers.
11673 * gold.h (cident_section_start_prefix): New constant.
11674 (cident_section_stop_prefix): New constant.
11675 (is_cident): New function.
11676 * layout.cc (Layout::define_section_symbols): Replace string constants
11677 with the newly defined constants.
11678 * object.cc (Sized_relobj::do_layout): Track sections whose names are
11679 C identifiers.
11680 * testsuite/Makefile.am: Add gc_orphan_section_test.
11681 * testsuite/Makefile.in: Regenerate.
11682 * testsuite/gc_orphan_section_test.cc: New file.
11683 * testsuite/gc_orphan_section_test.sh: New file.
11684
11685 2010-01-06 Ian Lance Taylor <iant@google.com>
11686
11687 PR 10980
11688 * options.h (class General_options): Add --warn-shared-textrel.
11689 * layout.cc (Layout::finish_dynamic_section): Implement
11690 --warn-shared-textrel.
11691
11692 PR 10980
11693 * options.h (class General_options): Add --warn-multiple-gp.
11694
11695 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11696
11697 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
11698 $(THREADSLIB) and $(LIBDL).
11699 * Makefile.in: Rebuild.
11700
11701 2010-01-06 Ian Lance Taylor <iant@google.com>
11702
11703 PR 10980
11704 * options.cc (General_options::parse_section_start): New function.
11705 (General_options::section_start): New function.
11706 (General_options::General_options): Initialize all members.
11707 * options.h: Include <map>
11708 (class General_options): Add --section-start. Add section_starts_
11709 member.
11710 * layout.cc (Layout::attach_allocated_section_to_segment): If
11711 --section-start was used, set the address of the segment. Remove
11712 local sort_sections.
11713 (Layout::relaxation_loop_body): If the address of the load segment
11714 has been set by --section-start, don't use it.
11715 * output.h (Output_segment::update_flags_for_output_section): New
11716 function.
11717 * output.cc (Output_segment::add_output_section): Call
11718 update_flags_for_output_section.
11719
11720 2010-01-05 Ian Lance Taylor <iant@google.com>
11721
11722 PR 10980
11723 * options.h (class General_options): Add --undefined-version.
11724 * script.cc (struct Version_expression): Add was_matched_by_symbol
11725 field.
11726 (Version_script_info::matched_symbol): New function.
11727 (Version_script_info::get_symbol_version_helper): Call
11728 matched_symbol.
11729 (Version_script_info::check_unmatched_names): New function.
11730 * script.h (class Version_script_info): Update declarations.
11731 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
11732
11733 * options.h (class General_options): Use DEFINE_bool_alias for
11734 allow_multiple_definition.
11735 * resolve.cc (Symbol_table::should_override): Don't test
11736 allow_multiple_definition.
11737
11738 PR 10980
11739 * options.h (class General_options): Add --cref.
11740 * main.cc (main): Print cref table if --cref. Don't close mapfile
11741 until after printing cref table.
11742 * cref.cc: Include "symtab.h".
11743 (class Cref_inputs): Define Cref_table_compare and Cref_table.
11744 (Cref_table_compare::operator()): New function.
11745 (Cref_inputs::gather_cref): New function.
11746 (filecol): New static const.
11747 (Cref_inputs::print_cref): New function.
11748 (Cref::print_cref): New function.
11749 * cref.h: Include <cstdio>.
11750 (class Cref): Update declarations.
11751 * mapfile.h (Mapfile::file): New function.
11752 * object.h (class Object): Define Symbols. Declare virtual
11753 do_get_global_symbols.
11754 (Object::get_global_symbols): New function.
11755 * object.cc (Input_objects::add_object): Pass object to cref_ if
11756 --cref.
11757 (Input_objects::archive_start): Likewise.
11758 (Input_objects::archive_stop): Likewise.
11759 (Input_objects::print_cref): New function.
11760 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
11761 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
11762 --cref.
11763 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
11764 function.
11765 * plugin.h (class Sized_pluginobj): Update declarations.
11766
11767 2010-01-05 Ian Lance Taylor <iant@google.com>
11768
11769 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
11770 to is_default_version. Rename insdef to insdefault.
11771 (Symbol_table::add_from_relobj): Rename def to is_default_version
11772 and local to is_forced_local.
11773 (Symbol_table::add_from_pluginobj): Likewise.
11774 (Symbol_table::add_from_dynobj): Likewise.
11775 (Symbol_table::define_special_symbol): Rename insdef to
11776 insdefault.
11777
11778 2010-01-04 Ian Lance Taylor <iant@google.com>
11779
11780 PR 10980
11781 * options.h (class General_options): Add
11782 --allow-multiple-definition and -z muldefs.
11783 * resolve.cc (Symbol_table::should_override): Don't warn about a
11784 multiple symbol definition if --allow-multiple-definition or -z
11785 muldefs.
11786
11787 PR 10980
11788 * options.h (class General_options): Add --add-needed and
11789 --copy-dt-needed-entries. Tweak --as-needed help entry.
11790 * object.cc (Input_objects::check_dynamic_dependencies): Give an
11791 error if --copy-dt-needed-entries aka --add-needed is used and
11792 would cause a change in behaviour.
11793
11794 PR 10980
11795 * options.h (class General_options): Add -G as a short version of
11796 --shared. Add no-op options -assert, -g, and -i.
11797
11798 2010-01-04 Sriraman Tallam <tmsriram@google.com>
11799
11800 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
11801 check for .text or .gnu.linkonce.t sections.
11802 * icf.cc (Icf::find_identical_sections): Ditto.
11803 Change the detection for mangled function name within the section
11804 name.
11805 * icf.h (is_section_foldable_candidate): New function.
11806
11807 2009-12-30 Ian Lance Taylor <iant@google.com>
11808
11809 PR 10980
11810 * options.h (class General_options): Permit two dashes with
11811 --retain-symbols-file.
11812
11813 2009-12-30 Ian Lance Taylor <iant@google.com>
11814
11815 PR 10979
11816 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
11817 don't put the file header and segment headers in the text
11818 segment.
11819
11820 PR 10979
11821 * common.cc (Sort_commons::operator()): Stabilize sort when both
11822 entries are NULL.
11823 (Symbol_table::do_allocate_commons_list): When allocating common
11824 symbols, skip a symbol which is no longer common.
11825 * symtab.h (Symbol::is_common): Test whether the symbol comes from
11826 an object before checking its type.
11827 * testsuite/common_test_2.c: New file.
11828 * testsuite/common_test_3.c: New file.
11829 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
11830 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
11831 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
11832 (common_test_2_pic.o, common_test_2.so): New targets.
11833 (common_test_3_pic.o, common_test_3.so): New targets.
11834 * testsuite/Makefile.in: Rebuild.
11835
11836 PR 10979
11837 * script.cc (read_input_script): If we see a new SECTIONS clause,
11838 and we have added an input section, give an error.
11839 * layout.h (class Layout): Add have_added_input_section function.
11840 Add have_added_input_section_ field.
11841 * layout.cc (Layout::Layout): Initialize
11842 have_added_input_section_.
11843 (Layout::layout): Set have_added_input_section_.
11844 (Layout::layout_eh_frame): Likewise.
11845
11846 2009-12-30 Ian Lance Taylor <iant@google.com>
11847
11848 PR 10931
11849 * options.h (class General_options): Add --sort-common option.
11850 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
11851 * common.cc (Sort_common): Add sort_order parameter to
11852 constructor. Add sort_order_ field.
11853 (Sort_commons::operator): Check sort_order_.
11854 (Symbol_table::allocate_commons): Determine the sort order.
11855 (Symbol_table::do_allocate_commons): Add sort_order parameter.
11856 Change all callers.
11857 (Symbol_table::do_allocate_commons_list): Likewise.
11858
11859 2009-12-30 Ian Lance Taylor <iant@google.com>
11860
11861 PR 10916
11862 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
11863 symbols from this object, don't change the visibility of an
11864 undefined symbol.
11865 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
11866
11867 2009-12-30 Ian Lance Taylor <iant@google.com>
11868
11869 PR 10861
11870 * script.h (class Version_script_info): Define Language enum.
11871 Update declarations. Define Glob, Exact, and Lookup types. Add
11872 new fields globals_, locals_, and is_finalized_.
11873 * script.cc: Various formatting fixes.
11874 (class Parser_closure): Change language_stack_ from a vector of
11875 std::string to one of Version_script_info::Language. Adjust all
11876 uses accordingly.
11877 (class Lazy_demangler): Remove.
11878 (struct Version_expression): Change language from std::string to
11879 Version_script_info::Language.
11880 (Version_script_info::Version_script_info): New function.
11881 (Version_script_info::~Version_script_info): Don't call clear.
11882 (Version_script_info::finalize): New function.
11883 (Version_script_info::build_lookup_tables): New function.
11884 (Version_script_info::build_expression_list_lookup): New
11885 function.
11886 (Version_script_info::get_symbol_version_helper): Rewrite to use
11887 lookup tables.
11888 (Version_script_info::print_expression_list): Adjust to use
11889 Version_script_info::Language.
11890 (script_push_lex_into_version_mode): Check that the version script
11891 has not been finalized.
11892 (version_script_push_lang): Change language string to
11893 Version_script_info::Language.
11894 * options.cc (Command_line::version_script): New function.
11895 * options.h (class General_options): Add finalize_dynamic_list
11896 function. Change version_script from declaration to definition.
11897 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
11898 * testsuite/version_script.map: Remove duplicate def of foo.
11899 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
11900 version_script.map.
11901 * testsuite/Makefile.in: Rebuild.
11902
11903 2009-12-30 Ian Lance Taylor <iant@google.com>
11904
11905 PR 10843
11906 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
11907 if the input symbol index is 0, make the output symbol index 0.
11908
11909 2009-12-30 Ian Lance Taylor <iant@google.com>
11910
11911 PR 10670
11912 * options.h (class General_options): Add -x/--discard-all.
11913 * object.cc (Sized_relobj::do_count_local_symbols): Handle
11914 --discard-all. If the local symbol needs a dynamic entry, check
11915 that before handling --discard-locals.
11916
11917 2009-12-30 Ian Lance Taylor <iant@google.com>
11918
11919 PR 10450
11920 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
11921 flags to PF_R.
11922 (Output_segment::add_output_section): Don't change the flags if
11923 the type is PT_TLS.
11924
11925 PR 10450
11926 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
11927 GNU hash table if they need a dynamic value. Otherwise, don't add
11928 them if they are defined in a dynamic object or are forced local.
11929
11930 2009-12-29 Ian Lance Taylor <iant@google.com>
11931
11932 PR 10450
11933 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
11934 .gnu.hash table for a 32-bit target.
11935
11936 PR 10450
11937 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
11938 regular and a dynamic object only needs a dynamic symbol table
11939 entry if it is externally visible.
11940
11941 PR 10450
11942 * i386.cc (class Target_i386): Initialize global_offset_table_ in
11943 constructor. Add global_offset_table_ field.
11944 (Target_i386::got_section): Set global_offset_table_.
11945 (Target_i386::do_finalize_sections): Set global_offset_table_
11946 size.
11947 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
11948 in constructor. Add global_offset_table_ field.
11949 (Target_x86_64::got_section): Set global_offset_table_.
11950 (Target_x86_64::do_finalize_sections): Set global_offset_table_
11951 size.
11952
11953 * layout.cc (Layout::Layout): Initialize increase_relro_.
11954 (Layout::get_output_section): Add is_relro, is_last_relro, and
11955 is_first_non_relro parameters. Change all callers.
11956 (Layout::choose_output_section): Likewise.
11957 (Layout::add_output_section_data): Likewise.
11958 (Layout::make_output_section): Likewise.
11959 (Layout::set_segment_offsets): Clear increase_relro when using a
11960 linker script.
11961 * layout.h (class Layout): Add increase_relro method. Add
11962 increase_relro_ field. Update declarations.
11963 * output.cc (Output_section::Output_section): Initialize
11964 is_last_relro_ and is_first_non_relro_.
11965 (Output_segment::add_output_section): Group relro sections is
11966 do_sort is true. Handle is_last_relro and is_first_non_relro.
11967 (Output_segment::maximum_alignment): Remove relro handling.
11968 (Output_segment::set_section_addresses): Add increase_relro
11969 parameter. Change all callers. Add initial alignment to align
11970 relro sections on separate page. Remove old relro handling.
11971 (Output_segment::set_section_list_addresses): Remove in_relro
11972 parameter. Change all callers.
11973 (Output_segment::set_offset): Add increase parameter. Change all
11974 callers. Remove old relro handling.
11975 * output.h (class Output_section): Add new methods: is_last_relro,
11976 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
11977 Add is_last_relro_ and is_first_non_relro_ fields.
11978 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
11979 Create separate .got.plt section. Call increase_relro.
11980 * x86_64.cc (Target_x86_64::got_section): Likewise.
11981 * testsuite/relro_script_test.t: Add .got.plt.
11982
11983 PR 10450
11984 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
11985 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
11986 (Layout::finalize): Call set_dynamic_symbol_size.
11987 (Layout::set_dynamic_symbol_size): New function.
11988 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
11989 set_dynamic_symbol_size.
11990
11991 PR 10450
11992 * output.h (class Output_section): Add is_entsize_zero_ field.
11993 * output.cc (Output_section::Output_section): Initialize
11994 is_entsize_zero_.
11995 (Output_section::set_entsize): If two different entsizes are
11996 requested, force it to zero.
11997 (Output_section::add_input_section): Set flags for .debug_str
11998 before updating section flags. Set entsize.
11999 (Output_section::update_flags_for_input_section): Set SHF_MERGE
12000 and SHF_STRING if all input sections have those flags.
12001
12002 2009-12-29 Rafael Espindola <espindola@google.com>
12003
12004 * main.cc (main): Fix the sys time reporting.
12005 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
12006 reporting.
12007
12008 2009-12-29 Sriraman Tallam <tmsriram@google.com>
12009
12010 * options.cc (General_options::parse_version): Allow -v to exit
12011 without an error if there is nothing to link.
12012
12013 2009-12-29 Ian Lance Taylor <iant@google.com>
12014
12015 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
12016 using a version of gcc before 4.1.
12017 * configure: Rebuild.
12018
12019 2009-12-28 Chris Demetriou <cgd@google.com>
12020
12021 * attributes.cc (Output_attributes_section_data::do_write): Use
12022 std::vector::front rather than std::vector::data.
12023
12024 2009-12-28 Ian Lance Taylor <iant@google.com>
12025
12026 * symtab.h (class Symbol_table): Add enum Defined.
12027 * resolve.cc (Symbol_table::should_override): Add defined
12028 parameter. Change all callers. Test whether object is NULL
12029 before calling a method on it.
12030 (Symbol_table::report_resolve_problem): Add defined parameter.
12031 Change all callers.
12032 (Symbol_table::should_override_with_special): Likewise.
12033 * symtab.cc (Symbol_table::define_in_output_data): Add defined
12034 parameter. Change all callers.
12035 (Symbol_table::do_define_in_output_data): Likewise.
12036 (Symbol_table::define_in_output_segment): Likewise.
12037 (Symbol_table::do_define_in_output_segment): Likewise.
12038 (Symbol_table::define_as_constant): Likewise.
12039 (Symbol_table::do_define_as_constant): Likewise.
12040 * script.h (class Symbol_assignment): Add is_defsym parameter to
12041 constructor; change all callers.
12042 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
12043 parameter. Change all callers. Add is_defsym_ field.
12044 (class Parser_closure): Add parsing_defsym parameter to
12045 constructor; change all callers. Add parsing_defsym accessor
12046 function. Add parsing_defsym_ field.
12047
12048 2009-12-28 Ian Lance Taylor <iant@google.com>
12049
12050 * gold.cc (queue_middle_tasks): Fix formatting.
12051 * object.cc (Relobj::is_section_name_included): Likewise.
12052
12053 2009-12-23 Ian Lance Taylor <iant@google.com>
12054
12055 * i386.cc (Target_i386::do_calls_non_split): Recognize
12056 -fsplit-stack prologue for a function with a static chain.
12057 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
12058 -fsplit-stack prologue when using %r11.
12059
12060 2009-12-21 Sriraman Tallam <tmsriram@google.com>
12061
12062 * options.cc (General_options::parse_version): Make -v continue and do
12063 the link like GNU ld does.
12064
12065 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
12066
12067 * Makefile.am (CCFILES): Add timer.cc.
12068 (HFILES): Add timer.h.
12069 * configure.ac: Check for sysconf and times.
12070 * main.cc: include timer.h.
12071 (main): Use Timer instead of get_run_time.
12072 * timer.cc: New.
12073 * timer.h: New.
12074 * workqueue.cc: include timer.h.
12075 (Workqueue::find_and_run_task):
12076 Report user, sys and wall time.
12077 * Makefile.in: Regenerate.
12078 * config.in: Regenerate.
12079 * configure: Regenerate.
12080
12081 2009-12-16 Doug Kwan <dougkwan@google.com>
12082
12083 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
12084 sections.
12085 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
12086 relaxed input sections.
12087 * output.cc (Output_section::find_relaxed_input_section): Change
12088 return type to Output_relaxed_input_section pointer. Adjust code
12089 for new type of relaxed_input_section_map_.
12090 * output.h (Output_section::find_relaxed_input_section): Change
12091 return type to Output_relaxed_input_section pointer.
12092 (Output_section::Output_relaxed_input_section_by_input_section_map):
12093 New type.
12094 (Output_section::relaxed_input_section_map_): Change type to
12095 Output_section::Output_relaxed_input_section_by_input_section_map.
12096 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
12097 input section.
12098
12099 2009-12-15 Ian Lance Taylor <iant@google.com>
12100
12101 * layout.cc (Layout::create_shstrtab): Only write out after input
12102 sections if we are compressing debug sections.
12103
12104 2009-12-15 Ian Lance Taylor <iant@google.com>
12105
12106 * archive.cc (Archive::add_symbols): Only look up a symbol without
12107 a version if there is, in fact, a version.
12108
12109 2009-12-14 Ian Lance Taylor <iant@google.com>
12110
12111 Revert -Wshadow changes, all changes from:
12112 2009-12-11 Doug Kwan <dougkwan@google.com>
12113 2009-12-11 Nick Clifton <nickc@redhat.com>
12114 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
12115
12116 2009-12-11 Doug Kwan <dougkwan@google.com>
12117
12118 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
12119 due to -Wshadow.
12120 * attributes.cc (Object_attribute::size): Ditto.
12121 (Attributes_section_data::size): Ditto.
12122 (Attributes_section_data::Attributes_section_data): Ditto.
12123 (Output_attributes_section_data::do_write): Ditto.
12124 * attributes.h (Object_attribute::set_type): Ditto.
12125 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
12126
12127 2009-12-11 Nick Clifton <nickc@redhat.com>
12128
12129 * archive.cc: Fix shadowed variable warnings.
12130 * arm.cc: Likewise.
12131 * compressed_output.cc: Likewise.
12132 * compressed_output.h: Likewise.
12133 * configure: Likewise.
12134 * dwarf_reader.cc: Likewise.
12135 * dynobj.cc: Likewise.
12136 * dynobj.h: Likewise.
12137 * ehframe.cc: Likewise.
12138 * ehframe.h: Likewise.
12139 * errors.cc: Likewise.
12140 * expression.cc: Likewise.
12141 * fileread.cc: Likewise.
12142 * fileread.h: Likewise.
12143 * freebsd.h: Likewise.
12144 * i386.cc: Likewise.
12145 * icf.cc: Likewise.
12146 * incremental.h: Likewise.
12147 * layout.cc: Likewise.
12148 * layout.h: Likewise.
12149 * mapfile.cc: Likewise.
12150 * merge.cc: Likewise.
12151 * merge.h: Likewise.
12152 * object.cc: Likewise.
12153 * object.h: Likewise.
12154 * options.h: Likewise.
12155 * output.cc: Likewise.
12156 * output.h: Likewise.
12157 * parameters.cc: Likewise.
12158 * plugin.cc: Likewise.
12159 * powerpc.cc: Likewise.
12160 * reduced_debug_output.cc: Likewise.
12161 * reduced_debug_output.h: Likewise.
12162 * reloc.cc: Likewise.
12163 * reloc.h: Likewise.
12164 * resolve.cc: Likewise.
12165 * script-sections.cc: Likewise.
12166 * script.cc: Likewise.
12167 * script.h: Likewise.
12168 * sparc.cc: Likewise.
12169 * symtab.cc: Likewise.
12170 * symtab.h: Likewise.
12171 * target-select.cc: Likewise.
12172 * target-select.h: Likewise.
12173 * token.h: Likewise.
12174 * workqueue.cc: Likewise.
12175 * workqueue.h: Likewise.
12176 * x86_64.cc: Likewise.
12177
12178 2009-12-10 Doug Kwan <dougkwan@google.com>
12179
12180 * arm.cc (attributes.h): New include.
12181 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
12182 (Arm_relobj::~Arm_relobj): Delete object pointed by
12183 attributes_section_data_.
12184 (Arm_relobj::attributes_section_data): New method definition.
12185 (Arm_relobj::attributes_section_data_): New data member declaration.
12186 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
12187 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
12188 attributes_section_data_.
12189 (Arm_dynobj::attributes_section_data): New method definition.
12190 (Arm_dynobj::attributes_section_data_): New data member declaration.
12191 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
12192 initialization value of may_use_blx_ to false.
12193 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
12194 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
12195 object attributes to compute results instead of hard-coding.
12196 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
12197 Target_arm::get_secondary_compatible_arch,
12198 Target_arm::set_secondary_compatible_arch
12199 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12200 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
12201 New method declarations.
12202 (Target_arm::get_aeabi_object_attribute): New method definition.
12203 (Target_arm::attributes_section_data_): New data member declaration.
12204 (read_arm_attributes_section): New template definition.
12205 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
12206 (Arm_dynobj::do_read_symbols): Ditto.
12207 (Target_arm::do_finalize_sections): Merge attributes sections from
12208 input. Check for BLX use after attributes section merging.
12209 Fix __exidx_start and __exidx_end visibility. Create an
12210 .ARM.attributes section if necessary.
12211 (Target_arm::get_secondary_compatible_arch,
12212 Target_arm::set_secondary_compatible_arch,
12213 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12214 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
12215 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
12216 New method definitions.
12217
12218 2009-12-09 Ian Lance Taylor <iant@google.com>
12219
12220 * plugin.cc (Plugin::load): Don't cast from void* to a function
12221 pointer.
12222
12223 2009-12-09 Ian Lance Taylor <iant@google.com>
12224
12225 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
12226 information fields.
12227
12228 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
12229
12230 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
12231 Replace two_file_shared_1.so with two_file_shared_2.so.
12232 * testsuite/Makefile.in: Regenerated.
12233
12234 2009-12-08 Doug Kwan <dougkwan@google.com>
12235
12236 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
12237 (HFILES): Add attributes.h and int_encoding.h.
12238 * Makefile.in: Regenerate.
12239 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
12240 function definitions to int_encoding.cc
12241 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
12242 prototypes to int_encoding.h
12243 * reduced_debug_output.cc (int_encoding.h): New include.
12244 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
12245 function definitions to int_encoding.cc
12246 (insert_into_vector, read_from_pointer): Move template definitions to
12247 int_encoding.h
12248 * attributes.cc: New file.
12249 * attributes.h: New file.
12250 * int_encoding.cc: New file.
12251 * int_encoding.h: New file.
12252
12253 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
12254
12255 PR gold/11055
12256 * incremental-dump.cc (dump_incremental_inputs): New.
12257 (main): Use dump_incremental_inputs.
12258
12259 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
12260
12261 PR gold/10893
12262 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
12263 checking elfcpp::STT_FUNC.
12264 (Target_i386::Relocate::relocate): Likewise.
12265 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
12266
12267 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
12268 symbols from shared libraries into normal FUNC symbols.
12269
12270 * symtab.h (Symbol): Add is_func and use it.
12271
12272 2009-12-05 Doug Kwan <dougkwan@google.com>
12273
12274 * arm.cc (Target_arm::arm_info): Initialize new fields
12275 attributes_section and attributes_vendor.
12276 * i386.cc (Target_i386::i386_info): Same.
12277 * object.cc (Sized_relobj::do_layout): Skip attribute section.
12278 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
12279 fields attributes_section and attributes_vendor.
12280 * sparc.cc (Target_sparc::sparc_info): Same.
12281 * target.h (Target::attributes_section, Target::attributes_vendor,
12282 Target::is_attributes_section, Target::attribute_arg_type,
12283 Target::attributes_order): New method definitions.
12284 (Target::Target_info::attributes_section,
12285 Target::Target_info::attributes_vendor): New fields.
12286 (Target::do_attribute_arg_type, Target::do_attributes_order): New
12287 virtual method definitions.
12288 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
12289 attributes_section and attributes_vendor.
12290 * testsuite/testfile.cc (Target_test::test_target_info): Same.
12291
12292 2009-12-05 Doug Kwan <dougkwan@google.com>
12293
12294 * arm.cc: Update comments about interworking and stub generation.
12295 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
12296 considered as non-PIC.
12297 (Arm_relocate_functions::base_abs): Fix formatting.
12298 (Arm_relocate_functions::got_prel): Fix comment. Change interface
12299 of function to use GOT entry address instead of offset.
12300 (Target_arm::Scan::global): Issue an error if a symbol would need a
12301 PLT does not get one because it is untyped. Remove code to create
12302 dynamic symbols for relative branches.
12303 (Target_arm::Relocate::relocate: Use 0 instead of false since function
12304 takes unsigned integer instead of boolean.
12305
12306 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
12307
12308 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
12309 (two_file_test_LDADD): Likewise.
12310 (common_test_1_LDADD): Likewise.
12311 (exception_test_LDADD) Likewise.
12312 (weak_test_LDADD): Likewise.
12313 (many_sections_test_LDADD): Likewise.
12314 (initpri1_LDADD): Likewise.
12315 (script_test_1_LDADD): Likewise.
12316 (script_test_2_LDADD): Likewise.
12317 (justsyms_LDADD): Likewise.
12318 (binary_test_LDADD): Likewise.
12319 (large_LDADD): Likewise.
12320 * testsuite/Makefile.in: Regenerated.
12321
12322 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
12323
12324 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
12325 (Symbol_table::override_with_special): Likewise.
12326 (Symbol_table::add_from_object): Likewise.
12327
12328 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
12329
12330 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12331 Don't set the data_offset twice.
12332
12333 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
12334
12335 * testsuite/Makefile.in: Regenerate.
12336
12337 2009-12-03 Doug Kwan <dougkwan@google.com>
12338
12339 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
12340 (Target_arm::do_finalize_sections): Add parameter for symbol table
12341 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
12342 * i386.cc (Target_i386::do_finalize_sections): Add an additional
12343 parameter for symbol table pointer.
12344 * layout.cc (Layout::finalize): Call Target::finalize_sections with
12345 an additional parameter for a pointer to symbol table.
12346 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
12347 parameter for a symbol table pointer.
12348 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
12349 * target.h (Target::finalize_sections, Target::do_finalize_sections):
12350 Ditto.
12351 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
12352 parameter for a symbol table pointer.
12353
12354 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
12355
12356 * incremental.cc (Incremental_inputs_header)
12357 (Incremental_inputs_header_write, Incremental_inputs_entry)
12358 (Incremental_inputs_entry_write): Move ...
12359 * incremental.h (Incremental_inputs_header)
12360 (Incremental_inputs_header_write, Incremental_inputs_entry)
12361 (Incremental_inputs_entry_write): here.
12362
12363 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
12364
12365 * incremental.cc (make_sized_incremental_binary): Set the target.
12366 Error if it is incompatible.
12367 * output.h (Output_file): Add filename method.
12368
12369 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
12370
12371 * incremental.cc (Incremental_inputs_entry): Remove unused argument
12372 from the get_* methods.
12373
12374 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
12375
12376 * incremental-dump.cc (main): Check that the offeset of a script is 0.
12377 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12378 Write 0 for the data_offset of scripts.
12379
12380 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
12381
12382 * testsuite/Makefile.am: Add the incremental_test.sh test.
12383 * testsuite/incremental_test.sh: New.
12384 * testsuite/incremental_test_1.c: New.
12385 * testsuite/incremental_test_2.c: New.
12386
12387 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
12388
12389 * incremental-dump.cc (main): Fix typos.
12390
12391 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
12392
12393 PR gold/11025
12394 * incremental-dump.cc (main): Use llu to print 64 bit values.
12395
12396 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
12397 H.J. Lu <hongjiu.lu@intel.com>
12398
12399 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
12400 $(LIBDL).
12401 (incremental_dump_LDADD): Likewise.
12402 * Makefile.in: Regenerated.
12403
12404 2009-11-25 Doug Kwan <dougkwan@google.com>
12405
12406 Revert:
12407
12408 2009-11-25 Doug Kwan <dougkwan@google.com>
12409
12410 * arm.cc (Target_arm::Target_arm): Move method definition
12411 outside of class definition. Add code to handle
12412 --target1-rel, --target1-abs and --target2= options.
12413 (Target_arm::get_reloc_reloc_type): Change method to be
12414 non-static and const.
12415 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
12416 New data member declaration.
12417 (Target_arm::Scan::local, Target_arm::Scan::global,
12418 Target_arm::Relocate::relocate,
12419 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12420 Adjust call to Target_arm::get_real_reloc_type.
12421 (Target_arm::get_real_reloc_type): Use command line options
12422 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12423 * options.h (--target1-rel, --target1-abs, --target2): New
12424 ARM-only options.
12425
12426 2009-11-25 Doug Kwan <dougkwan@google.com>
12427
12428 * arm.cc (Target_arm::Target_arm): Move method definition outside of
12429 class definition. Add code to handle --target1-rel, --target1-abs
12430 and --target2= options.
12431 (Target_arm::get_reloc_reloc_type): Change method to be non-static
12432 and const.
12433 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
12434 member declaration.
12435 (Target_arm::Scan::local, Target_arm::Scan::global,
12436 Target_arm::Relocate::relocate,
12437 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
12438 call to Target_arm::get_real_reloc_type.
12439 (Target_arm::get_real_reloc_type): Use command line options to
12440 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12441 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
12442 options.
12443
12444 2009-11-25 Doug Kwan <dougkwan@google.com>
12445
12446 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
12447 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
12448 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
12449 formatting.
12450 (Arm_relocate_functions::thm_call): Replace body with a call to
12451 Arm_relocate_functions::thumb_branch_common.
12452 (Arm_relocate_functions::thm_jump24,
12453 Arm_relocate_functions::thm_xpc22): New method definitions.
12454 (Arm_relocate_functions::thumb_branch_common): New method definition.
12455 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
12456 operator.
12457 (Target_arm::Relocate::relocate): Adjust call to thm_call.
12458 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
12459
12460 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
12461
12462 * Makefile.am: Build incremental-dump
12463 * Makefile.in: Regenerate.
12464 * incremental-dump.cc: New.
12465 * incremental.cc (Incremental_inputs_header_data,
12466 Incremental_inputs_entry_data): Move to incremental.h
12467 * incremental.h: (Incremental_inputs_header_data,
12468 Incremental_inputs_entry_data): Move from incremental.cc
12469
12470 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
12471
12472 * incremental.cc (Incremental_inputs_header,
12473 Incremental_inputs_header_write, Incremental_inputs_entry,
12474 Incremental_inputs_entry_write): Add a typedef with the data type.
12475
12476 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
12477
12478 * incremental.cc (Incremental_inputs_header,
12479 Incremental_inputs_header_write, Incremental_inputs_entry,
12480 Incremental_inputs_entry_write): Update comment about which
12481 type has the filed descriptions.
12482
12483 2009-11-15 Doug Kwan <dougkwan@google.com>
12484
12485 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
12486 (Arm_relocate_functions::arm_branch_common): Change method defintion
12487 in class definition to a method declaration and update list of formal
12488 parameters.
12489 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
12490 Arm_relocation_functions::jump24): Adjust call to
12491 Arm_relocate_functions::arm_branch_common. Update list of formal
12492 parameters.
12493 (Arm_relocate_functions::xpc25): New method definition.
12494 (Arm_relocate_functions::arm_branch_common): Move method defintion
12495 out from class definition. Use stubs for mode-switching and extending
12496 branch ranges.
12497 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
12498 specially. Change code to enable use of stubs in ARM branches.
12499
12500 2009-11-10 Doug Kwan <dougkwan@google.com>
12501
12502 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
12503 in method declaration.
12504 (Target_arm::relocate_stub): New method declaration.
12505 (Target_arm::default_target): Change to return a pointer instead of
12506 a const reference.
12507 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
12508 Target_arm::default_target.
12509 (Arm_Relobj::do_relocate_sections): Remove options paramater in
12510 method definition.
12511 (Target_arm::relocate_section): Adjust view.
12512 (Target_arm::relocate_stub): New method definition.
12513
12514 2009-11-10 Doug Kwan <dougkwan@google.com>
12515
12516 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
12517 a format warning.
12518 * incremental.cc (open_incremental_binary): Initialized local
12519 variables to avoid warnings.
12520 * object.cc (make_elf_object): Ditto.
12521 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
12522 a format warning.
12523
12524 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
12525
12526 PR gold/10930
12527 * testsuite/plugin_test.c: Include "config.h".
12528
12529 2009-11-09 Doug Kwan <dougkwan@google.com>
12530
12531 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
12532 (arm_symbol_value): Remove.
12533 (Arm_relocate_functions::arm_branch_common,
12534 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
12535 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
12536 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
12537 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
12538 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
12539 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
12540 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
12541 Arm_relocate_functions::thm_mobw_abs_nc,
12542 Arm_relocate_functions::thm_mov_abs,
12543 Arm_relocate_functions::movw_prel_nc,
12544 Arm_relocate_functions::thm_movt_abs,
12545 Arm_relocate_functions::movt_prel,
12546 Arm_relocate_functions::thm_movw_prel_nc,
12547 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
12548 (Target_arm::Relocate::relocate): Only decompose address into two
12549 parts if relocation type uses the thumb-bit and pass the actual
12550 bit instead of a flag indicating that the thumb-bit is used. Adjust
12551 calls to methods in Arm_relocate_functions for this change.
12552
12553 2009-11-08 Ian Lance Taylor <iant@google.com>
12554
12555 PR 10925
12556 * reloc.cc: Instantiate
12557 Sized_relobj::initialize_input_to_output_maps and
12558 Sized_relobj:free_input_to_output_maps.
12559
12560 2009-11-06 Ian Lance Taylor <iant@google.com>
12561
12562 PR 10876
12563 * defstd.cc (in_segment): Set only_if_ref true for "end".
12564
12565 2009-11-06 Doug Kwan <dougkwan@google.com>
12566
12567 * arm.cc (class Reloc_stub): Correct a comment.
12568 (Target_arm::Target_arm): Initialize arm_input_section_map_.
12569 (Target_arm::scan_section_for_stubs): New method declaration.
12570 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
12571 Change methods from private to protected.
12572 (Target_arm::do_may_relax): New method definition.
12573 (Target_arm::do_relax, Target_arm::group_sections,
12574 Target_arm::scan_reloc_for_stub,
12575 Target_arm::scan_reloc_section_for_stubs): New method declarations.
12576 (Target_arm::arm_input_section_map_): New data member declaration.
12577 (Target_arm::scan_reloc_for_stub,
12578 Target_arm::scan_reloc_section_for_stubs,
12579 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
12580 Target_arm::do_relax): New method definitions.
12581
12582 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
12583
12584 * configure.ac: Check for (struct stat)::st_mtim
12585 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
12586 * config.in: Regenerate.
12587 * configure: Regenerate.
12588
12589 2009-11-05 Ian Lance Taylor <iant@google.com>
12590
12591 PR 10910
12592 * output.cc (Output_segment::add_output_section): Add missing
12593 return statement.
12594
12595 2009-11-04 Ian Lance Taylor <iant@google.com>
12596
12597 PR 10880
12598 * object.h (class Object): Add is_needed and set_is_needed
12599 methods. Add is_needed_ field. Make bool fields into bitfields.
12600 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
12601 defined in a dynamic object and referenced by a regular object,
12602 set is_needed for the dynamic object.
12603 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
12604 if the file is marked with as_needed and it is not needed.
12605
12606 2009-11-04 Ian Lance Taylor <iant@google.com>
12607
12608 PR 10887
12609 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
12610 tags if data is discarded by linker script.
12611 * i386.cc (Target_i386::do_finalize_sections): Likewise.
12612 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12613 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12614 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12615
12616 2009-11-04 Ian Lance Taylor <iant@google.com>
12617
12618 * layout.cc (Layout::get_output_section): Add is_interp and
12619 is_dynamic_linker_section parameters. Change all callers.
12620 (Layout::choose_output_section): Likewise.
12621 (Layout::make_output_section): Likewise.
12622 (Layout::add_output_section_data): Add is_dynamic_linker_section
12623 parameter. Change all callers.
12624 * layout.h (class Layout): Update declarations.
12625 * output.h (class Output_section): Add is_interp, set_is_interp,
12626 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
12627 Add is_interp_, is_dynamic_linker_section_ fields. Change
12628 generate_code_fills_at_write_ to a bitfield.
12629 * output.cc (Output_section::Output_sections): Initialize new
12630 fields.
12631 (Output_segment::add_output_section): Add do_sort parameter.
12632 Change all callers.
12633
12634 2009-11-03 Ian Lance Taylor <iant@google.com>
12635
12636 PR 10860
12637 * options.h (class General_options): Add --warn-common.
12638 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
12639 merging two common symbols.
12640 (Symbol_table::should_override): Handle --warn-common when merging
12641 a common symbol with a defined symbol. Use report_resolve_problem
12642 for multiple definitions.
12643 (Symbol_table::report_resolve_problem): New function.
12644 * symtab.h (class Symbol_table): Declare report_resolve_problem.
12645
12646 2009-11-03 Doug Kwan <dougkwan@google.com>
12647
12648 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
12649 stub_factory_.
12650 (Target_arm::stub_factory): New method definition.
12651 (Target_arm::new_arm_input_section,
12652 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
12653 Target_arm::reloc_uses_thumb_bit): New method declarations.
12654 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
12655 New type definitions.
12656 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
12657 member declarations.
12658 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
12659 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
12660 New method definitions.
12661
12662 2009-11-03 Ian Lance Taylor <iant@google.com>
12663
12664 * options.h (class General_options): Add --warn_constructors.
12665
12666 2009-11-03 Ian Lance Taylor <iant@google.com>
12667
12668 PR 10893
12669 * defstd.cc (in_section): Add entries for __rel_iplt_start,
12670 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
12671
12672 2009-11-03 Ian Lance Taylor <iant@google.com>
12673
12674 PR 10895
12675 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
12676 --msgid-bugs-address.
12677 (install-pdf): New target.
12678 (install-data_yes): Look up one directory to find mkinstalldirs.
12679
12680 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
12681
12682 * po/Make-in (.po.gmo): Don't generate .gmo files in source
12683 tree.
12684
12685 2009-10-30 Doug Kwan <dougkwan@google.com>
12686
12687 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
12688
12689 2009-10-30 Doug Kwan <dougkwan@google.com>
12690
12691 * arm.cc (Stub_addend_reader): New struct template definition
12692 and partial specializations.
12693 (Stub_addend_reader::operator()): New method definition for a
12694 partially specialized template.
12695
12696 2009-10-30 Doug Kwan <dougkwan@google.com>
12697
12698 * arm.cc (Arm_relobj::processor_specific_flags): New method
12699 definition.
12700 (Arm_relobj::do_read_symbols): New method declaration.
12701 (Arm_relobj::processor_specific_flags_): New data member declaration.
12702 (Arm_dynobj): New class definition.
12703 (Target_arm::do_finalize_sections): Add input_objects parameter.
12704 (Target_arm::do_adjust_elf_header): New method declaration.
12705 (Target_arm::are_eabi_versions_compatible,
12706 (Target_arm::merge_processor_specific_flags): New method declaration.
12707 (Target_arm::do_make_elf_object): New overloaded method definitions
12708 and declaration.
12709 (Arm_relobj::do_read_symbols): New method definition.
12710 (Arm_dynobj::do_read_symbols): Ditto.
12711 (Target_arm::do_finalize_sections): Add input_objects parameters.
12712 Merge processor-specific flags from all input objects.
12713 (Target_arm::are_eabi_versions_compatible,
12714 Target_arm::merge_processor_specific_flags,
12715 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
12716 New method definitions.
12717 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
12718 Input_objects pointer type parameter.
12719 * layout.cc (Layout::finalize): Pass input objects to target's.
12720 finalize_sections function.
12721 * output.cc (Output_file_header::do_sized_write): Set ELF file
12722 header's processor-specific flags.
12723 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
12724 Input_objects pointer type parameter.
12725 * sparc.cc (Target_sparc::do_finalize_sections): Same.
12726 * target.h (Input_objects): New forward class declaration.
12727 (Target::processor_specific_flags,
12728 Target::are_processor_specific_flags_sect): New method definitions.
12729 (Target::finalize_sections): Add input_objects parameter.
12730 (Target::Target): Initialize processor_specific_flags_ and
12731 are_processor_specific_flags_set_.
12732 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
12733 parameter.
12734 (Target::set_processor_specific_flags): New method definition.
12735 (Target::processor_specific_flags_,
12736 Target::are_processor_specific_flags_set_): New data member
12737 declarations.
12738 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
12739 Input_objects pointer type parameter.
12740
12741 2009-10-30 Doug Kwan <dougkwan@google.com>
12742
12743 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
12744
12745 2009-10-28 Ian Lance Taylor <iant@google.com>
12746
12747 * object.h (class Relobj): Drop options parameter from
12748 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
12749 do_scan_relocs, do_relocate. Change all callers.
12750 (class Sized_relobj): Drop options parameters from
12751 do_gc_process_relocs, do_scan_relocs, do_relocate,
12752 do_relocate_sections, relocate_sections, emit_relocs_scan,
12753 emit_relocs_scan_reltype. Change all callers.
12754 (struct Relocate_info): Remove options field and all references to
12755 it.
12756 * reloc.h (class Read_relocs): Remove options constructor
12757 parameter and options_ field. Change all callers.
12758 (class Gc_process_relocs, class Scan_relocs): Likewise.
12759 (class Relocate_task): Likewise.
12760 * target-reloc.h (scan_relocs): Remove options parameter. Change
12761 all callers.
12762 (scan_relocatable_relocs): Likewise.
12763 * target.h (class Sized_target): Remove options parameter from
12764 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
12765 all callers.
12766 * gc.h (gc_process_relocs): Remove options parameter. Change all
12767 callers.
12768 * arm.cc: Update functions to remove options parameters.
12769 * i386.cc: Likewise.
12770 * powerpc.cc: Likewise.
12771 * sparc.cc: Likewise.
12772 * x86_64.cc: Likewise.
12773 * testsuite/testfile.cc: Likewise.
12774
12775 2009-10-28 Doug Kwan <dougkwan@google.com>
12776
12777 * arm.cc (Arm_relobj): New class definition.
12778 (Arm_relobj::scan_sections_for_stubs,
12779 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
12780 New method definitions.
12781
12782 2009-10-28 Cary Coutant <ccoutant@google.com>
12783
12784 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
12785 (Plugin::cleanup_done_): New member.
12786 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
12787 (Plugin_manager::cleanup_done_): Remove.
12788 (Plugin_manager::add_input_file): Edit error message.
12789 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
12790 (Plugin_manager::cleanup): Remove use of cleanup_done_.
12791
12792 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
12793
12794 * fileread.cc: (File_read::View::~View): Use the new
12795 data_ownership_ filed.
12796 (File_read::~File_read): Dispose the new whole_file_view_.
12797 (File_read::open): Mmap the whole file if needed.
12798 (File_read::open): Use whole_file_view_ instead of contents_.
12799 (File_read::find_view): Use whole_file_view_ if applicable.
12800 (File_read::do_read): Use whole_file_view_ instead of contents_.
12801 (File_read::make_view): Use whole_file_view_ instead of contents_,
12802 update File_read::View::View call.
12803 (File_read::find_or_make_view): Update File_read::View::View
12804 call.
12805 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
12806 remove contents_
12807 (File_read::View::Data_ownership): New enum.
12808 (File_read::View::View): Replace bool mapped_ with Data_ownership
12809 argument.
12810 (File_read::View::mapped_): Remove (replaced by data_ownership_).
12811 (File_read::View::data_ownership_): New field.
12812 (File_read::contents_): Remove (replaced by whole_file_view_).
12813 (File_read::whole_file_view_): New field.
12814 * options.h (class General_options): Add --keep-files-mapped.
12815
12816 2009-10-27 Cary Coutant <ccoutant@google.com>
12817
12818 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
12819 * testsuite/Makefile.am (plugin_test_5): New test case.
12820 * testsuite/Makefile.in: Regenerate.
12821
12822 2009-10-25 Doug Kwan <dougkwan@google.com>
12823
12824 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
12825 from private to protected to allow access by child class.
12826 (Sized_relobj::do_relocate_sections): New method declaration.
12827 (Sized_relobj::relocate_sections): Virtualize.
12828 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
12829 Sized_relobj::relocate_sections. Instantiate template explicitly
12830 for different target sizes and endianity.
12831
12832 2009-10-24 Doug Kwan <dougkwan@google.com>
12833
12834 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
12835 (Arm_input_section::as_arm_input_section): New method.
12836 (Arm_output_section): New class definition.
12837 (Arm_output_section::create_stub_group,
12838 Arm_output_section::group_sections): New method definitions.
12839
12840 2009-10-22 Doug Kwan <dougkwan@google.com>
12841
12842 * arm.cc (Arm_input_section): New class definition.
12843 (Arm_input_section::init, Arm_input_section:do_write,
12844 Arm_input_section::set_final_data_size,
12845 Arm_input_section::do_reset_address_and_file_offset): New method
12846 definitions.
12847
12848 2009-10-21 Doug Kwan <dougkwan@google.com>
12849
12850 * arm.cc (Stub_table, Arm_input_section): New forward class
12851 declarations.
12852 (Stub_table): New class defintion.
12853 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
12854 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
12855 New method definition.
12856
12857 2009-10-21 Doug Kwan <dougkwan@google.com>
12858
12859 * arm.cc: Update copyright comments.
12860 (Target_arm): New forward class template declaration.
12861 (Arm_address): New type.
12862 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
12863 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
12864 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
12865 constants.
12866 (Insn_template): Same.
12867 (DEF_STUBS): New macro.
12868 (Stub_type): New enum type.
12869 (Stub_template): New class definition.
12870 (Stub): Same.
12871 (Reloc_stub): Same.
12872 (Stub_factory): Same.
12873 (Target_arm::Target_arm): Initialize may_use_blx_ and
12874 should_force_pic_veneer_.
12875 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
12876 Target_arm::should_force_pic_veneer,
12877 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
12878 Target_arm::using_thumb_only, Target_arm:;default_target): New
12879 method defintions.
12880 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
12881 New data member declarations.
12882 (Insn_template::size, Insn_template::alignment): New method defintions.
12883 (Stub_template::Stub_template): New method definition.
12884 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
12885 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
12886 (Stub_factory::Stub_factory): New method definition.
12887 * gold.h (string_hash): New template.
12888 * output.h (Input_section_specifier::hash_value): Use
12889 gold::string_hash.
12890 (Input_section_specifier::string_hash): Remove.
12891 * stringpool.cc (Stringpool_template::string_hash): Use
12892 gold::string_hash.
12893
12894 2009-10-20 Doug Kwan <dougkwan@google.com>
12895
12896 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
12897 symbols of relaxed input sections.
12898 * output.h (Output_section::find_relaxed_input_section): Make
12899 method public.
12900
12901 2009-10-16 Doug Kwan <dougkwan@google.com>
12902
12903 * dynobj.cc (Versions::Versions): Initialize version_script_.
12904 Only insert base version symbol definition for a shared object
12905 if version script defines any version versions.
12906 (Versions::define_base_version): New method definition.
12907 (Versions::add_def): Check that base version is not needed.
12908 (Versions::add_need): Define base version lazily.
12909 * dynobj.h (Versions::define_base_version): New method declaration.
12910 (Versions::needs_base_version_): New data member declaration.
12911 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
12912 (check_DATA): Add no_version_test.stdout.
12913 (libno_version_test.so, no_version_test.o no_version_test.stdout):
12914 New make rules.
12915 * testsuite/Makefile.in: Regenerate.
12916 * testsuite/no_version_test.c: New file.
12917 * testsuite/no_version_test.sh: Ditto.
12918
12919 2009-10-16 Doug Kwan <dougkwan@google.com>
12920
12921 * expression.cc (class Segment_start_expression): New class definition.
12922 (Segment_start_expression::value): New method definition.
12923 (script_exp_function_segment_start): Return a new
12924 Segment_start_expression.
12925 * gold/script-c.h (script_saw_segment_start_expression): New function
12926 prototype.
12927 * script-sections.cc (Script_sections::Script_sections): Initialize
12928 SAW_SEGMENT_START_EXPRESSION_ to false.
12929 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
12930 and -Tbbs options to specify section addresses if given in
12931 command line and no SEGMENT_START expression is seen in a script.
12932 * script-sections.h (Script_sections::saw_segment_start_expression,
12933 Script_sections::set_saw_segment_start_expression): New method
12934 definition.
12935 (Script_sections::saw_segment_start_expression_): New data member
12936 declaration.
12937 * script.cc (script_saw_segment_start_expression): New function.
12938 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
12939 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
12940 script_test_7.sh and script_test_8.sh.
12941 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
12942 script_test_8.stdout.
12943 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
12944 (script_test_6, script_test_6.stdout, script_test_7,
12945 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
12946 * Makefile.in: Regenerate.
12947 * testsuite/script_test_6.sh: New file.
12948 * testsuite/script_test_6.t: Same.
12949 * testsuite/script_test_7.sh: Same.
12950 * testsuite/script_test_7.t: Same.
12951 * testsuite/script_test_8.sh: Same.
12952
12953 2009-10-16 Doug Kwan <dougkwan@google.com>
12954
12955 * output.cc (Output_segment::set_section_list_address): Cast
12956 expressions to unsigned long long type to avoid format warnings.
12957
12958 2009-10-15 Ian Lance Taylor <iant@google.com>
12959
12960 * script.cc (Script_options::add_symbol_assignment): Always add a
12961 dot assignment to script_sections_.
12962 * script-sections.cc (Script_sections::add_dot_assignment):
12963 Initialize if necessary.
12964
12965 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
12966 program headers with no load segment if there is a linker script.
12967
12968 * layout.cc (Layout::set_segment_offsets): Align the file offset
12969 to the segment aligment for -N or -n with no load segment.
12970 * output.cc (Output_segment::add_output_section): Don't crash if
12971 the first section is a TLS section.
12972 (Output_segment::set_section_list_addresses): Print an error
12973 message if the address moves backward in a linker script.
12974 * script-sections.cc
12975 (Output_section_element_input::set_section_addresses): Don't
12976 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
12977 (Orphan_output_section::set_section_addresses): Likewise.
12978
12979 2009-10-15 Doug Kwan <dougkwan@google.com>
12980
12981 * layout.cc (Layout::finish_dynamic_section): Generate tags
12982 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
12983 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
12984 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
12985
12986 2009-10-14 Ian Lance Taylor <iant@google.com>
12987
12988 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
12989 fields.
12990 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
12991 data_shdr fields of relinfo.
12992 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
12993 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
12994 R_386_TLS_LDO_32, adjust based on section flags.
12995 (Target_i386::Relocate::fix_up_ldo): Remove.
12996
12997 2009-10-13 Ian Lance Taylor <iant@google.com>
12998
12999 Add support for -pie.
13000 * options.h (class General_options): Add -pie and
13001 --pic-executable.
13002 (General_options::output_is_position_independent): Test -pie.
13003 (General_options::output_is_executable): Return true if not shared
13004 and not relocatable.
13005 (General_options::output_is_pie): Remove.
13006 * options.cc (General_options::finalize): Reject incompatible uses
13007 of -pie.
13008 * gold.cc (queue_middle_tasks): A -pie link is not static.
13009 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
13010 * symtab.cc (Symbol::final_value_is_known): Return false if
13011 output_is_position_independent.
13012 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
13013 output_is_position_independent.
13014 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
13015 output_is_position_independent.
13016 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
13017 output_is_position_independent.
13018 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
13019 two_file_pie_test.
13020 (basic_pie_test.o, basic_pie_test): New targets.
13021 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
13022 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
13023 (two_file_pie_test): New target.
13024 * testsuite/Makefile.in: Rebuild.
13025 * README: Remove note saying that -pie is not supported.
13026
13027 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
13028
13029 * options.h (class General_options): Add -init and -fini.
13030 * layout.cc (Layout::finish_dynamic_section): Emit
13031 given init and fini functions.
13032
13033 2009-10-13 Sriraman Tallam <tmsriram@google.com>
13034
13035 * gc.h (gc_process_relocs): Check if icf is enabled using new
13036 function.
13037 * gold.cc (queue_initial_tasks): Likewise.
13038 (queue_middle_tasks): Likewise.
13039 * object.cc (do_layout): Likewise.
13040 * symtab.cc (is_section_folded): Likewise.
13041 * main.cc (main): Likewise.
13042 * reloc.cc (Read_relocs::run): Likewise.
13043 (Sized_relobj::do_scan_relocs): Likewise.
13044 * icf.cc (is_function_ctor_or_dtor): New function.
13045 (Icf::find_identical_sections): Check if function is ctor or dtor when
13046 safe icf is chosen.
13047 * options.h (General_options::icf): Change option to be an enum.
13048 (Icf_status): New enum.
13049 (icf_enabled): New method.
13050 (icf_safe_folding): New method.
13051 (set_icf_status): New method.
13052 (icf_status_): New variable.
13053 * (options.cc) (General_options::finalize): Set icf_status_.
13054 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
13055 icf_test and icf_keep_unique_test to use the --icf enum flag.
13056 * testsuite/icf_safe_test.sh: New file.
13057 * testsuite/icf_safe_test.cc: New file.
13058
13059 2009-10-12 Sriraman Tallam <tmsriram@google.com>
13060
13061 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
13062 includes to gc.h and icf.h.
13063 * arm.cc: Include gc.h.
13064 * gold.cc: Likewise.
13065 * i386.cc: Likewise.
13066 * powerpc.cc: Likewise.
13067 * sparc.cc: Likewise.
13068 * x86_64.cc: Likewise.
13069 * gc.h: Include icf.h.
13070
13071 2009-10-11 Ian Lance Taylor <iant@google.com>
13072
13073 * plugin.cc: Include "gold.h" before other header files.
13074
13075 2009-10-10 Chris Demetriou <cgd@google.com>
13076
13077 * options.h (Input_file_argument::Input_file_type): New enum.
13078 (Input_file_argument::is_lib_): Replace with...
13079 (Input_file_argument::type_): New member.
13080 (Input_file_argument::Input_file_argument): Take Input_file_type
13081 'type' rather than boolean 'is_lib' as second argument.
13082 (Input_file_argument::is_lib): Use type_.
13083 (Input_file_argument::is_searched_file): New function.
13084 (Input_file_argument::may_need_search): Handle is_searched_file.
13085 * options.cc (General_options::parse_library): Support -l:filename.
13086 (General_options::parse_just_symbols): Update for Input_file_argument
13087 changes.
13088 (Command_line::process): Likewise.
13089 * archive.cc (Archive::get_file_and_offset): Likewise.
13090 * plugin.cc (Plugin_manager::release_input_file): Likewise.
13091 * script.cc (read_script_file, script_add_file): Likewise.
13092 * fileread.cc (Input_file::Input_file): Likewise.
13093 (Input_file::will_search_for): Handle is_searched_file.
13094 (Input_file::open): Likewise.
13095 * readsyms.cc (Read_symbols::get_name): Likewise.
13096 * testsuite/Makefile.am (searched_file_test): New test.
13097 * testsuite/Makefile.in: Regenerate.
13098 * testsuite/searched_file_test.cc: New file.
13099 * testsuite/searched_file_test_lib.cc: New file.
13100
13101 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
13102 Ian Lance Taylor <iant@google.com>
13103
13104 * descriptor.cc: Include <cstdio> and "binary-io.h".
13105 (Descriptors::open): Open the files in binary mode always.
13106 * script.cc (Lex::get_token): Treat \r as whitespace.
13107
13108 2009-10-09 Ian Lance Taylor <iant@google.com>
13109
13110 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
13111
13112 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
13113 Ian Lance Taylor <iant@google.com>
13114
13115 * configure.ac: Check for readv function also.
13116 * fileread.cc (readv): Define if not HAVE_READV.
13117 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
13118 does not exist.
13119 * config.in: Regenerate.
13120 * configure: Regenerate.
13121
13122 2009-10-09 Doug Kwan <dougkwan@google.com>
13123
13124 * layout.cc (Layout::make_output_section): Call target hook to make
13125 ordinary output section.
13126 (Layout::finalize): Adjust parameter list of call the
13127 Target::may_relax().
13128 * layout.h (class Layout::section_list): New method.
13129 * merge.h (Output_merge_base::entsize): Change visibility to public.
13130 (Output_merge_base::is_string, Output_merge_base::do_is_string):
13131 New methods.
13132 (Output_merge_string::do_is_string): New method.
13133 * object.cc (Sized_relobj::do_setup): renamed from
13134 Sized_relobj::set_up.
13135 * object.h (Sized_relobj::adjust_shndx,
13136 Sized_relobj::initializ_input_to_output_maps,
13137 Sized_relobj::free_input_to_output_maps): Change visibilities to
13138 protected.
13139 (Sized_relobj::setup): Virtualize.
13140 (Sized_relobj::do_setup): New method declaration.
13141 (Sized_relobj::invalidate_section_offset,
13142 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
13143 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
13144 * options.cc (parse_int): New function.
13145 * options.h (parse_int): New declaration.
13146 (DEFINE_int): New macro.
13147 (stub_group_size): New option.
13148 * output.cc (Output_section::Output_section): Initialize memebers
13149 merge_section_map_, merge_section_by_properties_map_,
13150 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
13151 (Output_section::add_input_section): Handled deferred code-fill
13152 generation and remove an old comment.
13153 (Output_section::add_relaxed_input_section): New method definition.
13154 (Output_section::add_merge_input_section): Use merge section by
13155 properties map to speed to search. Update merge section maps
13156 as appropriate.
13157 (Output_section::build_relaxation_map): New method definition.
13158 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
13159 Same.
13160 (Output_section::relax_input_section): Renamed to
13161 Output_section::convert_input_sections_to_relaxed_sections and change
13162 interface to take a vector of pointers to relaxed sections.
13163 (Output_section::find_merge_section,
13164 Output_section::find_relaxed_input_section): New method definitions.
13165 (Output_section::is_input_address_mapped,
13166 Output_section::output_offset, Output_section::output_address):
13167 Use output section data maps to speed up searching.
13168 (Output_section::find_starting_output_address): Add comments.
13169 (Output_section::do_write,
13170 Output_section::write_to_postprocessing_buffer): Do code-fill
13171 generation as appropriate.
13172 (Output_section::get_input_sections): Invalidate relaxed input section
13173 map.
13174 (Output_section::restore_states): Adjust type of checkpoint .
13175 Invalidate relaxed input section map.
13176 * output.h (Output_merge_base): New class declaration.
13177 (Input_section_specifier): New class defintion.
13178 (class Output_relaxed_input_section) Change base class to
13179 Output_section_data_build.
13180 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
13181 base class initializer.
13182 (Output_section::add_relaxed_input_section): New method declaration.
13183 (Output_section::Input_section): Change visibility to protected.
13184 (Output_section::Input_section::relobj,
13185 Output_section::Input_section::shndx): Handle relaxed input sections.
13186 Output_section::input_sections) Change visibility to protected. Also
13187 define overload to return a non-const pointer.
13188 (Output_section::Merge_section_properties): New class defintion.
13189 (Output_section::Merge_section_by_properties_map,
13190 Output_section::Output_section_data_by_input_section_map,
13191 Output_section::Relaxation_map): New types.
13192 (Output_section::relax_input_section): Rename method to
13193 Output_section::convert_input_sections_to_relaxed_sections and change
13194 interface to take a vector of relaxed section pointers.
13195 (Output_section::find_merge_section,
13196 Output_section::find_relaxed_input_section,
13197 Output_section::build_relaxation_map,
13198 Output_section::convert_input_sections_in_list_to_relaxed_sections):
13199 New method declarations.
13200 (Output_section::merge_section_map_
13201 Output_section::merge_section_by_properties_map_,
13202 Output_section::relaxed_input_section_map_,
13203 Output_section::is_relaxed_input_section_map_valid_,
13204 Output_section::generate_code_fills_at_write_): New data members.
13205 * script-sections.cc
13206 (Output_section_element_input::set_section_addresses): Call
13207 current_data_size and addralign methods of relaxed input sections.
13208 (Orphan_output_section::set_section_addresses): Call current_data_size
13209 and addralign methods of relaxed input sections.
13210 * symtab.cc (Symbol_table::compute_final_value): Extract template
13211 from the body of Symbol_table::sized_finalize_symbol.
13212 (Symbol_table::sized_finalized_symbol): Call
13213 Symbol_table::compute_final_value.
13214 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
13215 (Symbol_table::compute_final_value): New templated method declaration.
13216 * target.cc (Target::do_make_output_section): New method defintion.
13217 * target.h (Target::make_output_section): New method declaration.
13218 (Target::relax): Add more parameters for input objects, symbol table
13219 and layout. Adjust call to do_relax.
13220 (Target::do_make_output_section): New method declaration.
13221 (Target::do_relax): Add parameters for input objects, symbol table
13222 and layout.
13223
13224 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
13225
13226 * pread.c: Include stdio.h.
13227
13228 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
13229
13230 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
13231 defined.
13232
13233 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
13234
13235 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
13236 Change read_shndx type to unsigned int.
13237 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13238 int.
13239 (Sized_dwarf_line_info::read_line_mappings): Likewise.
13240 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
13241 Change read_shndx type to unsigned int.
13242 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13243 int.
13244 (Sized_dwarf_line_info::read_line_mappings): Likewise.
13245 * layout.cc (Layout::create_symtab_sections): Cast the result of
13246 local_symcount * symsize to off_t in the gold_assert.
13247
13248 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
13249
13250 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
13251 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
13252 R_ARM_BASE_ABS.
13253 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
13254 (Arm_relocate_functions::thm_abs5): New function.
13255 (Arm_relocate_functions::abs12): New function.
13256 (Arm_relocate_functions::abs16): New function.
13257 (Arm_relocate_functions::base_abs): New function.
13258 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
13259 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
13260 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
13261 R_ARM_BASE_ABS.
13262 (Scan::global): Likewise.
13263 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
13264 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
13265 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
13266 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
13267 R_ARM_BASE_ABS.
13268
13269 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
13270
13271 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
13272 (Arm_relocate_functions::movt_prel): New function.
13273 (Arm_relocate_functions::thm_movw_prel_nc): New function.
13274 (Arm_relocate_functions::thm_movt_prel): New function.
13275 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
13276 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
13277 (Scan::global, Relocate::relocate): Likewise.
13278 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13279
13280 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
13281
13282 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
13283 Incremental_checker.
13284 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
13285 unsigned int.
13286 (class Incremental_inputs_header): New class.
13287 (Incremental_inputs_header_writer): Edit comment.
13288 (Incremental_inputs_entry): New class.
13289 (Incremental_inputs_entry_writer): Edit comment.
13290 (Sized_incremental_binary::do_find_incremental_inputs_section):
13291 Add *strtab_shndx parameter, fill it.
13292 (Sized_incremental_binary::do_check_inputs): New method.
13293 (Incremental_checker::can_incrementally_link_output_file): Use
13294 Sized_incremental_binary::check_inputs.
13295 (Incremental_inputs::report_command_line): Save command line in
13296 command_line_.
13297 * incremental.h:
13298 (Incremental_binary::find_incremental_inputs_section): New
13299 method.
13300 (Incremental_binary::do_find_incremental_inputs_section): Add
13301 strtab_shndx parameter.
13302 (Incremental_binary::do_check_inputs): New pure virtual method.
13303 (Sized_incremental_binary::do_check_inputs): Declare.
13304 (Incremental_checker::Incremental_checker): Add incremental_inputs
13305 parameter, use it to initialize incremental_inputs_.
13306 (Incremental_checker::incremental_inputs_): New field.
13307 (Incremental_checker::command_line): New method.
13308 (Incremental_checker::inputs): New method.
13309 (Incremental_checker::command_line_): New field.
13310
13311 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
13312
13313 * incremental.cc: Include <cstdarg> and "target-select.h".
13314 (vexplain_no_incremental): New function.
13315 (explain_no_incremental): New function.
13316 (Incremental_binary::error): New method.
13317 (Sized_incremental_binary::do_find_incremental_inputs_section): New
13318 method.
13319 (make_sized_incremental_binary): New function.
13320 (open_incremental_binary): New function.
13321 (can_incrementally_link_file): Add checks if output is ELF and has
13322 inputs section.
13323 * incremental.h: Include "elfcpp_file.h" and "output.h".
13324 (Incremental_binary): New class.
13325 (Sized_incremental_binary): New class.
13326 (open_incremental_binary): Declare.
13327 * object.cc (is_elf_object): Use
13328 elfcpp::Elf_recognizer::is_elf_file.
13329 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
13330 * output.h (Output_file::filesize): New method.
13331
13332 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
13333
13334 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
13335 New function.
13336 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
13337 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
13338 function.
13339 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
13340 function.
13341 (Arm_relocate_functions::movw_abs_nc): New function.
13342 (Arm_relocate_functions::movt_abs): New function.
13343 (Arm_relocate_functions::thm_movw_abs_nc): New function.
13344 (Arm_relocate_functions::thm_movt_abs): New function.
13345 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
13346 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
13347 (Scan::global): Likewise.
13348 (Relocate::relocate): Likewise.
13349 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13350
13351 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
13352
13353 * arm.cc (Arm_relocate_functions::got_prel) New function.
13354 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
13355 (Relocate::relocate): Likewise.
13356 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13357
13358 2009-10-06 Ian Lance Taylor <iant@google.com>
13359
13360 * options.h (class General_options): Define
13361 split_stack_adjust_size parameter.
13362 * object.h (class Object): Add uses_split_stack_ and
13363 has_no_split_stack_ fields. Add uses_split_stack and
13364 has_no_split_stack accessor functions. Declare
13365 handle_split_stack_section.
13366 (class Reloc_symbol_changes): Define.
13367 (class Sized_relobj): Define Function_offsets. Declare
13368 split_stack_adjust, split_stack_adjust_reltype, and
13369 find_functions.
13370 * object.cc (Object::handle_split_stack_section): New function.
13371 (Sized_relobj::do_layout): Call handle_split_stack_section.
13372 * dynobj.cc (Sized_dynobj::do_layout): Call
13373 handle_split_stack_section.
13374 * reloc.cc (Sized_relobj::relocate_sections): Call
13375 split_stack_adjust for executable sections in split_stack
13376 objects. Pass reloc_map to relocate_section.
13377 (Sized_relobj::split_stack_adjust): New function.
13378 (Sized_relobj::split_stack_adjust_reltype): New function.
13379 (Sized_relobj::find_functions): New function.
13380 * target-reloc.h: Include "object.h".
13381 (relocate_section): Add reloc_symbol_changes parameter. Change
13382 all callers.
13383 * target.h (class Target): Add calls_non_split method. Declare
13384 do_calls_non_split virtual method. Declare match_view and
13385 set_view_to_nop.
13386 * target.cc: Include "elfcpp.h".
13387 (Target::do_calls_non_split): New function.
13388 (Target::match_view): New function.
13389 (Target::set_view_to_nop): New function.
13390 * gold.cc (queue_middle_tasks): Give an error if mixing
13391 split-stack and non-split-stack objects with -r.
13392 * i386.cc (Target_i386::relocate_section): Add
13393 reloc_symbol_changes parameter.
13394 (Target_i386::do_calls_non_split): New function.
13395 * x86_64.cc (Target_x86_64::relocate_section): Add
13396 reloc_symbol_changes parameter.
13397 (Target_x86_64::do_calls_non_split): New function.
13398 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
13399 parameter.
13400 * powerpc.cc (Target_powerpc::relocate_section): Add
13401 reloc_symbol_changes parameter.
13402 * sparc.cc (Target_sparc::relocate_section): Add
13403 reloc_symbol_changes parameter.
13404 * configure.ac: Call AM_CONDITIONAL for the default target.
13405 * configure: Rebuild.
13406 * testsuite/Makefile.am (TEST_AS): New variable.
13407 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
13408 (check_DATA): Add split_i386 and split_x86_64 files.
13409 (SPLIT_DEFSYMS): Define.
13410 (split_i386_[1234n].o): New targets.
13411 (split_i386_[124]): New targets.
13412 (split_i386_[1234r].stdout): New targets.
13413 (split_x86_64_[1234n].o): New targets.
13414 (split_x86_64_[124]): New targets.
13415 (split_x86_64_[1234r].stdout): New targets.
13416 (MOSTLYCLEANFILES): Add new executables.
13417 * testsuite/split_i386.sh: New file.
13418 * testsuite/split_x86_64.sh: New file.
13419 * testsuite/split_i386_1.s: New file.
13420 * testsuite/split_i386_2.s: New file.
13421 * testsuite/split_i386_3.s: New file.
13422 * testsuite/split_i386_4.s: New file.
13423 * testsuite/split_i386_n.s: New file.
13424 * testsuite/split_x86_64_1.s: New file.
13425 * testsuite/split_x86_64_2.s: New file.
13426 * testsuite/split_x86_64_3.s: New file.
13427 * testsuite/split_x86_64_4.s: New file.
13428 * testsuite/split_x86_64_n.s: New file.
13429 * testsuite/testfile.cc (Target_test): Update relocation_section
13430 function.
13431 * testsuite/Makefile.in: Rebuild.
13432
13433 2009-10-06 Ian Lance Taylor <iant@google.com>
13434
13435 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
13436 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
13437 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
13438 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
13439 the address on ldo_addrs_.
13440 (Target_i386::Relocate::fix_up_ldo): New function.
13441
13442 2009-10-06 Rafael Espindola <espindola@google.com>
13443
13444 * plugin.cc (add_input_library): New.
13445 (Plugin::load): Add add_input_library to tv.
13446 (Plugin_manager::add_input_file): Add the is_lib argument.
13447 (add_input_file): Update call to Plugin_manager::add_input_file.
13448 (add_input_library): New.
13449 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
13450
13451 2009-09-30 Doug Kwan <dougkwan@google.com>
13452
13453 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
13454 symbol and call Symbol::may_need_copy_reloc to determine if
13455 a copy reloc is needed.
13456 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
13457 nocopyreloc is given in command line.
13458 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
13459 given in command line.
13460 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
13461 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
13462 of the removed Target_i386::may_need_copy_reloc.
13463 * options.h (copyreloc): New option with default value false.
13464 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13465 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
13466 instead of the removed Target_powerpc::may_need_copy_reloc.
13467 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13468 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
13469 instead of the removed Target_sparc::may_need_copy_reloc.
13470 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
13471 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
13472 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
13473 instead of the removed Target_x86_64::may_need_copy_reloc.
13474
13475 2009-09-30 Ian Lance Taylor <iant@google.com>
13476
13477 * object.h (class Object): Remove target_ field, and target,
13478 sized_target, and set_target methods.
13479 (Object::sized_target): Remove.
13480 (class Sized_relobj): Update declarations. Remove sized_target.
13481 * object.cc (Sized_relobj::setup): Remove target parameter.
13482 Change all callers.
13483 (Input_objects::add_object): Don't do anything with the target.
13484 (make_elf_sized_object): Add punconfigured parameter. Change all
13485 callers. Set or test parameter target.
13486 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
13487 Change all callers.
13488 * parameters.cc (Parameters::set_target): Change parameter type to
13489 be non-const.
13490 (Parameters::default_target): Remove.
13491 (set_parameters_target): Change parameter type to be non-const.
13492 (parameters_force_valid_target): New function.
13493 (parameters_clear_target): New function.
13494 * parameters.h (class Parameters): Update declarations. Remove
13495 default_target method. Add sized_target and clear_target
13496 methods. Change target_ to be non-const.
13497 (set_parameters_target): Update declaration.
13498 (parameters_force_valid_target): Declare.
13499 (parameters_clear_target): Declare.
13500 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
13501 as NULL if we aren't searching.
13502 (Add_symbols::run): Don't check for compatible target.
13503 * fileread.cc (Input_file::open_binary): Call
13504 parameters_force_valid_target.
13505 * gold.cc (queue_middle_tasks): Likewise.
13506 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
13507 set_target on object.
13508 * dynobj.h (class Sized_dynobj): Update declarations.
13509 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
13510 make_elf_object returns NULL.
13511 (Archive::include_member): Don't check whether object target is
13512 compatible.
13513 * output.cc (Output_section::add_input_section): Get target from
13514 parameters.
13515 (Output_section::relax_input_section): Likewise.
13516 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
13517 parameters.
13518 (Sized_relobj::do_scan_relocs): Likewise.
13519 (Sized_relobj::relocate_sections): Likewise.
13520 * resolve.cc (Symbol_table::resolve): Likewise.
13521 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
13522 parameter. Change all callers.
13523 (Symbol_table::add_from_object): Get target from parameters.
13524 (Symbol_table::add_from_relobj): Don't check object target.
13525 (Symbol_table::add_from_dynobj): Likewise.
13526 (Symbol_table::define_special_symbol): Get target from
13527 parameters.
13528 * symtab.h (class Symbol_table): Update declaration.
13529 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
13530 parameter. Change all callers. Clear parameter target.
13531 (Binary_test): Test target here.
13532 * testsuite/object_unittest.cc (gold_testsuite): Remove
13533 target_test_pointer parameter. Change all callers.
13534 (Object_test): Test target here.
13535
13536 2009-09-26 Ian Lance Taylor <iant@google.com>
13537
13538 * testsuite/initpri1.c: Don't try to use constructor priorities if
13539 compiling with gcc before 4.3.
13540
13541 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
13542
13543 * testsuite/retain_symbols_file_test.sh (check_present): Change
13544 output file name to retain_symbols_file_test.stdout.
13545 (check_absent): Likewise.
13546
13547 2009-09-18 Craig Silverstein <csilvers@google.com>
13548
13549 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
13550 * options.cc: Include <cerrno> and <fstream>.
13551 (General_options::finalize): Parse -retain-symbols-file tag.
13552 * options.h: New flag.
13553 (General_options): New method should_retain_symbol, new
13554 variable symbols_to_retain.
13555 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
13556 should_retain_symbol map.
13557 * testsuite/Makefile.am (retain_symbols_file_test): New test.
13558 * testsuite/Makefile.in: Regenerate.
13559 * testsuite/retain_symbols_file_test.sh: New file.
13560
13561 2009-09-18 Nick Clifton <nickc@redhat.com>
13562
13563 * po/es.po: Updated Spanish translation.
13564
13565 2009-09-17 Doug Kwan <dougkwan@google.com>
13566
13567 * debug.h (DEBUG_RELAXATION): New constant.
13568 (DEBUG_ALL): Add DEBUG_RELAXATION.
13569 (debug_string_to_enum): Add relaxation debug option.
13570 * layout.cc
13571 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
13572 Layout::Relaxation_debug_check::read_sections,
13573 Layout::Relaxation_debug_check::read_sections): New method definitions.
13574 (Layout::Layout): Initialize data members
13575 record_output_section_data_from_scrips_,
13576 script_output_section_data_list_ and relaxation_debug_check_.
13577 (Layout::save_segments, Layout::restore_segments,
13578 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13579 Layout::relaxation_loop_body): New method definitions.
13580 (Layout::finalize): Support relaxation. Move section layout code to
13581 Layout::relaxation_loop_body.
13582 (Layout::set_asection_address_from_script): Move code for orphan
13583 section placement out.
13584 (Layout::place_orphan_sections_in_script): New method definition.
13585 * layout.h (Output_segment_headers, Output_file_header):
13586 New forward class declarations.
13587 (Layout::~Layout): Define.
13588 (Layout::new_output_section_data_from_script): New method definition.
13589 (Layout::place_orphan_sections_in_script): New method declaration.
13590 (Layout::Segment_states): New type declaration.
13591 (Layout::save_segments, Layout::restore_segments,
13592 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13593 Layout::relaxation_loop_body): New method declarations.
13594 (Layout::Output_section_data_list): New type declaration.
13595 (Layout::Relaxation_debug_check): New class definition.
13596 (Layout::record_output_section_data_from_script_,
13597 Layout::script_output_section_data_list_, Layout::segment_states_,
13598 Layout::relaxation_debug_check_): New data members.
13599 * output.cc: (Output_section_headers::do_size): New method definition.
13600 (Output_section_headers::Output_section_headers): Move size
13601 computation to Output_section_headers::do_size.
13602 (Output_segment_headers::do_size): New method definition.
13603 (Output_file_header::Output_file_header): Move size computation to
13604 Output_file_header::do_size and call it.
13605 (Output_file_header::do_size): New method definition.
13606 (Output_data_group::Output_data_group): Adjust call to
13607 Output_section_data.
13608 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
13609 (Output_symtab_xindex::do_write): Add array bound check.
13610 (Output_section::Input_section::print_to_mapfile): Handle
13611 RELAXED_INPUT_SECTION_CODE.
13612 (Output_section::Output_section): Initialize data member checkpoint_.
13613 (Output_section::~Output_section): Delete checkpoint object pointed
13614 by checkpoint_.
13615 (Output_section::add_input_section): Always add an Input_section if
13616 relaxing.
13617 (Output_section::add_merge_input_section): Add assert.
13618 (Output_section::relax_input_section): New method definition.
13619 (Output_section::set_final_data_size): Set load address to zero for
13620 an unallocated section.
13621 (Output_section::do_address_and_file_offset_have_reset_values):
13622 New method definition.
13623 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
13624 Handle relaxed input section.
13625 (Output_section::sort_attached_input_sections): Checkpoint input
13626 section list lazily.
13627 (Output_section::get_input_sections): Change type of input_sections to
13628 list of Simple_input_section pointers. Checkpoint input section list
13629 lazily. Also handle relaxed input sections.
13630 (Output_section::add_input_section_for_script): Take a reference to
13631 a Simple_input_section object instead of Relobj pointer and section
13632 index as parameter. Handle relaxed input sections.
13633 (Output_section::save_states, Output_section::restore_states): New
13634 method definitions.
13635 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
13636 (Output_data::is_data_size_fixed): New method definition.
13637 (Output_data::reset_addresss_and_file_offset): Do not reset data size
13638 if it is fixed.
13639 (Output_data::address_and_file_offset_have_reset_values): New method
13640 definition.
13641 (Output_data::do_address_and_file_offset_have_reset_values): New method
13642 definition.
13643 (Output_data::set_data_size): Check that data size is not fixed.
13644 (Output_data::fix_data_size): New method definition.
13645 (Output_data::is_data_size_fixed_): New data member.
13646 (Output_section_headers::set_final_data_size): New method definition.
13647 (Output_section_headers::do_size): New method declaration.
13648 (Output_segment_headers::set_final_data_size): New method definition.
13649 (Output_segment_headers::do_size): New method declaration.
13650 (Output_file_header::set_final_data_size)::New method definition.
13651 (Output_file_header::do_size)::New method declaration.
13652 (Output_section_data::Output_section_data): Add new parameter
13653 is_data_size_fixed and use it to fix data size.
13654 (Output_data_const::Output_data_const): Adjust call to base class
13655 constructor and fix data size.
13656 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
13657 base class constructor and fix data size.
13658 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
13659 base class constructor and fix data size.
13660 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
13661 class constructor and fix data size.
13662 (Output_data_group::set_final_data_size): New method definition.
13663 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
13664 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
13665 class constructor and fix data size.
13666 (Output_relaxed_input_section): New class definition.
13667 (Output_section::Simple_input_section): New class definition.
13668 (Output_section::get_input_sections): Adjust parameter list.
13669 (Output_section::add_input_section_for_script): Same.
13670 (Output_section::save_states, Output_section::restore_states,
13671 Output_section::do_address_and_file_offset_have_reset_values,
13672 (Output_section::Input_section::Input_section): Handle
13673 RELAXED_INPUT_SECTION_CODE. Add new overload for
13674 Output_relaxed_input_section.
13675 (Output_section::Input_section::is_input_section,
13676 Output_section::Input_section::set_output_section): Handle relaxed
13677 input section.
13678 (Output_section::Input_section::is_relaxed_input_section,
13679 Output_section::Input_section::output_section_data,
13680 Output_section::Input_section::relaxed_input_section): New method
13681 definitions.
13682 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
13683 value.
13684 (Output_section::Input_section::u1_): Update comments.
13685 (Output_section::Input_section::u2_): Add new union member poris.
13686 (Output_section::Checkpoint_output_section): New classs definition.
13687 (Output_section::relax_input_section): New method declaration.
13688 (Output_section::checkpoint_): New data member.
13689 (Output_segment): Update comments.
13690 (Output_segment::Output_segment): Un-privatize copy constructor.
13691 (Output_segment::operator=): Un-privatize.
13692 * script-sections.cc (Output_section_element::Input_section_list):
13693 Change element type to Output_section::Simple_input_section.
13694 (Output_section_element_dot_assignment::set_section_addresses):
13695 Register output section data for relaxation clean up.
13696 (Output_data_exression::Output_data_expression): Adjust call to base
13697 constructor to fix data size.
13698 (Output_section_element_data::set_section_addresses): Register
13699 Output_data_expression object for relaxation clean up.
13700 (struct Input_section_info): Replace Relobj pointer and section index
13701 pair with Output_section::Simple_input_section and Convert struct to a
13702 class.
13703 (Input_section_sorter::operator()): Adjust access to
13704 Input_section_info data member to use accessors.
13705 (Output_section_element_input::set_section_addresses): Use layout
13706 parameter. Adjust code to use Output_section::Simple_input_section
13707 and Input_secction_info classes. Register filler for relaxation
13708 clean up.
13709 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
13710 and section index pair with Output_section::Simple_input_section
13711 class. Adjust code accordingly.
13712 (Phdrs_element::release_segment): New method definition.
13713 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
13714 segment list.
13715 (Script_sections::release_segments): New method definition.
13716 * gold/script-sections.h (Script_sections::release_segments): New
13717 method declaration.
13718 * gold/target.h (Target::may_relax, Target::relax,
13719 Target::do_may_relax, Target::do_relax): New method definitions.
13720
13721 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
13722
13723 * arm.cc (has_signed_unsigned_overflow): New function.
13724 (Arm_relocate_functions::abs8): New function.
13725 (Target_arm::Scan::local): Handle R_ARM_ABS8.
13726 (Target_arm::Scan::global): Likewise.
13727 (Target_arm::relocate::relocate): Likewise.
13728 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
13729 Likewise.
13730
13731 2009-09-16 Cary Coutant <ccoutant@google.com>
13732
13733 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
13734 * testsuite/Makefile.in: Regenerate.
13735
13736 2009-09-11 Nick Clifton <nickc@redhat.com>
13737
13738 * po/gold.pot: Updated by the Translation project.
13739
13740 2009-09-08 Cary Coutant <ccoutant@google.com>
13741
13742 * output.cc (Output_file::open): Add execute permission to empty file.
13743 * testsuite/Makefile.am (permission_test): New test.
13744 * testsuite/Makefile.in: Regenerate.
13745
13746 2009-09-02 Ian Lance Taylor <iant@google.com>
13747
13748 * output.cc (Output_file::resize): Call map_no_anonymous rather
13749 than map.
13750
13751 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
13752
13753 * gold.cc: Include "incremental.h".
13754 (queue_initial_tasks): Call Incremental_checker methods.
13755 * incremental.cc: Include "output.h".
13756 (Incremental_checker::can_incrementally_link_output_file): New
13757 method.
13758 * incremental.h (Incremental_checker): New class.
13759
13760 * output.cc (Output_file::open_for_modification): New method.
13761 (Output_file::map_anonymous): Changed return type to bool. Record
13762 map in base_ field.
13763 (Output_file::map_no_anonymous): New method, broken out of map.
13764 (Output_file::map): Use map_no_anonymous and map_anonymous.
13765 * output.h (class Output_file): Update declarations.
13766
13767 2009-08-24 Cary Coutant <ccoutant@google.com>
13768
13769 * options.h (Command_line::Pre_options): New class.
13770 (Command_line::pre_options): New member.
13771 * options.cc (gold::options::ready_to_register): New variable.
13772 (One_option::register_option): Do nothing if not registering options.
13773 Assert if same short option registered twice.
13774 (General_options::General_options): Turn off option registration when
13775 done constructing.
13776 (Command_line::Pre_options::Pre_options): New constructor.
13777
13778 2009-08-24 Cary Coutant <ccoutant@google.com>
13779
13780 * options.h (General_options::no_keep_memory): Remove incorrect
13781 short option.
13782
13783 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
13784
13785 * Makefile.am (am__skiplex, am__skipyacc): New.
13786 * Makefile.in: Regenerate.
13787
13788 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
13789
13790 * Makefile.am (AM_CPPFLAGS): Renamed from ...
13791 (INCLUDES): ... this.
13792 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
13793 (AM_CPPFLAGS): Renamed from ...
13794 (INCLUDE): ... this.
13795 * Makefile.in, testsuite/Makefile.in: Regenerate.
13796
13797 * Makefile.in: Regenerate.
13798 * aclocal.m4: Likewise.
13799 * config.in: Likewise.
13800 * configure: Likewise.
13801 * testsuite/Makefile.in: Likewise.
13802
13803 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13804 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13805 * Makefile.in: Regenerate.
13806 * testsuite/Makefile.in: Regenerate.
13807
13808 2009-08-19 Cary Coutant <ccoutant@google.com>
13809
13810 * resolve.cc (Symbol_table::resolve): Don't complain about defined
13811 symbols in shared libraries overridden by hidden or internal symbols
13812 in the main program.
13813
13814 2009-08-19 Chris Demetriou <cgd@google.com>
13815
13816 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
13817 checking source file names in error messages.
13818
13819 2009-08-18 Doug Kwan <dougkwan@google.com>
13820
13821 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
13822 an elcpp::Ehdr as parameter. Adjust call to set_target.
13823 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
13824 an elfcpp::Ehdr as parameter.
13825 * object.cc (Object::set_target): Remove the version that looks up
13826 a target and sets it.
13827 (Sized_relobj::setup): Take a Target object instead of
13828 an elfcpp::Ehdr as parameter. Adjust call to set_target.
13829 (make_elf_sized_object): Find target and ask target to
13830 make an ELF object.
13831 * object.h: (Object::set_target): Remove the version that looks up
13832 a target and sets it.
13833 (Sized_relobj::setup): Take a Target object instead of
13834 an elfcpp:Ehdr as parameter.
13835 * target.cc: Include dynobj.h.
13836 (Target::do_make_elf_object_implementation): New.
13837 (Target::do_make_elf_object): New.
13838 * target.h (Target::make_elf_object): New template declaration.
13839 (Target::do_make_elf_object): New method declarations.
13840 (Target::do_make_elf_object_implementation): New template declaration.
13841
13842 2009-08-14 Ian Lance Taylor <iant@google.com>
13843
13844 * gold.h (FUNCTION_NAME): Define.
13845 (gold_unreachable): Use FUNCTION_NAME.
13846
13847 2009-08-12 Sriraman Tallam <tmsriram@google.com>
13848
13849 * icf.cc (Icf::find_identical_sections): Issue a warning when a
13850 symbol in the --keep-unique list is not found.
13851
13852 2009-08-12 Sriraman Tallam <tmsriram@google.com>
13853
13854 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
13855 been maked as --keep-unique.
13856 (Icf::unfold_section): New function.
13857 * icf.h (Icf::unfold_section): New function.
13858 * options.h (General_options::keep_unique): New option.
13859 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
13860 * testsuite/Makefile.in: Regenerate.
13861 * testsuite/icf_keep_unique_test.sh: New file.
13862 * testsuite/icf_keep_unique_test.cc: New file.
13863
13864 2009-08-12 Cary Coutant <ccoutant@google.com>
13865
13866 PR 10471
13867 * resolve.cc (Symbol_table::resolve): Check for references from
13868 dynamic objects to hidden and internal symbols.
13869 * testsuite/Makefile.am (hidden_test.sh): New test.
13870 * testsuite/Makefile.in: Regenerate.
13871 * testsuite/hidden_test.sh: New script.
13872 * testsuite/hidden_test_1.c: New test source.
13873 * testsuite/hidden_test_main.c: New test source.
13874
13875 2009-08-11 Doug Kwan <dougkwan@google.com>
13876
13877 * arm.cc: Update comments.
13878 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
13879 segment to locate the .ARM.exidx section if present.
13880
13881 2009-08-09 Doug Kwan <dougkwan@google.com>
13882
13883 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
13884 patch.
13885
13886 2009-08-07 Sriraman Tallam <tmsriram@google.com>
13887 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
13888 compiler warnings.
13889
13890 2009-08-06 Sriraman Tallam <tmsriram@google.com>
13891
13892 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
13893 valid tls_segment only for non-debug-section relocations.
13894 * testsuite/Makefile.am: Add gc_tls_test.
13895 * testsuite/Makefile.in: Regenerate.
13896 * testsuite/gc_tls_test.cc: New file.
13897 * testsuite/gc_tls_test.sh: New file.
13898
13899 2009-08-05 Sriraman Tallam <tmsriram@google.com>
13900
13901 * icf.cc: New file.
13902 * icf.h: New file.
13903 * Makefile.am (CCFILES): Add icf.cc.
13904 (HFILES): Add icf.h
13905 * Makefile.in: Regenerate.
13906 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
13907 * gc.h (gc_process_relocs): Populate lists used by icf to contain
13908 section, symbol and addend information for the relocs.
13909 * gold.cc (queue_middle_tasks): Call identical code folding.
13910 * gold.h: Add defines for multimap.
13911 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
13912 to the call of finalize_local_symbols.
13913 * main.cc (main): Create object of class Icf.
13914 * object.cc (Sized_relobj::do_layout): Allow this function to be
13915 called twice during icf.
13916 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
13917 to sections marked as identical by icf.
13918 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
13919 when available.
13920 (Sized_relobj::do_section_entsize): New function.
13921 * object.h (Object::section_entsize): New function.
13922 (Object::do_section_entsize): New pure virtual function.
13923 (Relobj::finalize_local_symbols): Add new parameter.
13924 (Relobj::do_section_entsize): New function.
13925 * options.h (General_options::icf): New option.
13926 (General_options::icf_iterations): New option.
13927 (General_options::print_icf_sections): New option.
13928 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
13929 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
13930 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
13931 icf.
13932 * symtab.cc (Symbol_table::is_section_folded): New function.
13933 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
13934 to sections marked as identical by icf.
13935 * symtab.h (Symbol_table::set_icf): New function.
13936 (Symbol_table::icf): New function.
13937 (Symbol_table::is_section_folded): New function.
13938 (Symbol_table::icf_): New data member.
13939 * target-reloc.h (relocate_section): Ignore sections folded by icf.
13940 * testsuite/Makefile.am: Add commands to build icf_test.
13941 * testsuite/Makefile.in: Regenerate.
13942 * testsuite/icf_test.sh: New file.
13943 * testsuite/icf_test.cc: New file.
13944
13945 2009-07-24 Chris Demetriou <cgd@google.com>
13946
13947 * layout.cc (is_compressible_debug_section): Fix incorrect
13948 comment about compressed section names.
13949
13950 2009-07-20 Ian Lance Taylor <ian@airs.com>
13951
13952 PR 10419
13953 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
13954
13955 2009-07-16 Ian Lance Taylor <iant@google.com>
13956
13957 PR 10400
13958 * layout.h: #include <map>.
13959 (class Kept_section): Change from struct to class. Add accessors
13960 and setters. Add section size to Comdat_group mapping. Change
13961 Comdat_group to std::map. Add is_comdat_ field. Add
13962 linkonce_size field in union.
13963 (class Layout): Update declaration of find_or_add_kept_section.
13964 Don't declare find_kept_object.
13965 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
13966 parameter. Add object, shndx, is_comdat, and is_group_name
13967 parameters. Change all callers. Adjust for new Kept_section.
13968 (Layout::find_kept_object): Remove.
13969 * object.cc (Sized_relobj::include_section_group): Update use of
13970 Kept_section. Rename secnum to shndx. Only record
13971 Kept_comdat_section if sections are the same size.
13972 (Sized_relobj::include_linkonce_section): Update use of
13973 Kept_section. Only record Kept_comdat_section if sections are the
13974 same size. Set size of linkonce section.
13975 (Sized_relobj::map_to_kept_section): Update call to
13976 get_kept_comdat_section.
13977 * object.h (class Sized_relobj): Rename fields in
13978 Kept_comdat_section to drop trailing underscores; change object
13979 field to Relobj*. Change Kept_comdat_section_table to store
13980 struct rather than pointer.
13981 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
13982 Add kept_object and kept_shndx parameters. Change all callers.
13983 (Sized_relobj::get_kept_comdat_section): Change return type to
13984 bool. Add kept_object and kept_shndx parameters. Change all
13985 callers.
13986 * plugin.cc (Pluginobj::include_comdat_group): Update call to
13987 Layout::find_or_add_kept_section.
13988
13989 2009-07-09 Ian Lance Taylor <iant@google.com>
13990
13991 * merge.cc (Object_merge_map::initialize_input_to_output_map):
13992 Reserve space in the hash table.
13993
13994 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
13995
13996 * fileread.cc (File_read::get_mtime): New method.
13997 * fileread.h (Timespec): New structure.
13998 (File_read::get_mtime): New method.
13999 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
14000 Renamed from timestamp_nsec.
14001 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
14002 Elf_Xword.
14003 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
14004 timestamp_nsec.
14005 (Incremental_inputs::report_archive): Save mtime; style fix.
14006 (Incremental_inputs::report_obejct): Save mtime; style fix.
14007 (Incremental_inputs::report_script): Save mtime; style fix.
14008 (Incremental_inputs::finalize_inputs): Style fix.
14009 (Incremental_inputs::finalize): Style fix.
14010 (Incremental_inputs::create_input_section_data): Store inputs
14011 mtime.
14012 * incremental.h (Incremental_inputs::report_script): Add mtime
14013 argument.
14014 (Incremental_inputs::Input_info::Input_info): Intialize only one
14015 union member.
14016 (Incremental_inputs::Input_info::archive): Move to nameless
14017 union.
14018 (Incremental_inputs::Input_info::obejct): Move to nameless union.
14019 (Incremental_inputs::Input_info::script): Move to nameless union.
14020 (Incremental_inputs::mtime): New field.
14021 * script.cc (read_input_script): Pass file mtime to
14022 Incremental_input.
14023 * script.h (Script_info::inputs): Style fix.
14024
14025 2009-07-01 Ian Lance Taylor <ian@airs.com>
14026
14027 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
14028 instead of 32.
14029
14030 2009-06-24 Ian Lance Taylor <iant@google.com>
14031
14032 PR 10156
14033 * layout.cc (Layout::choose_output_section): If we find an
14034 existing section, update the flags.
14035 (Layout::create_notes): New function, broken out of
14036 Layout::finalize.
14037 (Layout::finalize): Don't create note sections.
14038 (Layout::create_note): Don't crash if linker script discards
14039 section.
14040 (Layout::create_gold_note): Likewise.
14041 (Layout::create_build_id): Likewise. Don't set
14042 after_input_sections on the section.
14043 (Layout::create_executable_stack_info): Remove target parameter.
14044 Change caller.
14045 * layout.h (class Layout): Declare create_notes. Update
14046 declaration of create_executable_stack_info.
14047 * gold.cc (queue_middle_tasks): Call create_notes.
14048 * output.cc (Output_section::update_flags_for_input_section): Move
14049 here from output.h. If SHF_ALLOC flag is newly set, mark address
14050 invalid.
14051 * output.h (Output_data::mark_address_invalid): New function.
14052 (class Output_section): Only declare, not define,
14053 update_flags_for_input_section. Remove set_flags.
14054
14055 2009-06-24 Ian Lance Taylor <iant@google.com>
14056
14057 * script-sections.cc (Output_section_definition::
14058 set_section_addresses): Rename shadowing local load_address to
14059 laddr.
14060
14061 2009-06-24 Ian Lance Taylor <iant@google.com>
14062
14063 PR 10244
14064 * reloc.cc (relocate_sections): Skip empty relocation sections.
14065
14066 2009-06-23 Ian Lance Taylor <iant@google.com>
14067
14068 PR 10156
14069 * layout.cc (Layout::create_note): Use choose_output_section
14070 rather than make_output_section.
14071
14072 2009-06-23 Ian Lance Taylor <iant@google.com>
14073
14074 PR 10237
14075 * options.cc (General_options::parse_V): Set printed_version_.
14076 (General_options::General_options): Initialize printed_version_.
14077 * options.h (class General_options): Add printed_version_ field.
14078 * gold.cc (queue_initial_tasks): If there are no input files,
14079 don't give a fatal error if we printed the version information.
14080 (queue_middle_tasks): If using -r with a shared object, give a
14081 fatal error rather than an ordinary error.
14082
14083 2009-06-23 Ian Lance Taylor <iant@google.com>
14084
14085 PR 10219
14086 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
14087 (Layout::make_output_section): Set have_stabstr_section_ if we see
14088 a .stab*str section.
14089 (Layout::finalize): Call link_stabs_sections.
14090 (Layout::link_stabs_sections): New file.
14091 * layout.h (class Layout): Add have_stabstr_section_ field.
14092 Declare link_stabs_sections.
14093
14094 2009-06-23 Doug Kwan <dougkwan@google.com>
14095
14096 * Makefile.am (libgold_a_LIBADD): New.
14097 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
14098 * Makefile.in: Regenerate.
14099 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
14100 * configure: Regenerate.
14101 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
14102 * fileread.cc: Include sys/state.h
14103 * gold.h: Declare memmem and strndup if found missing.
14104 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
14105
14106 2009-06-23 Ian Lance Taylor <iant@google.com>
14107
14108 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
14109 * configure: Rebuild.
14110
14111 2009-06-23 Ian Lance Taylor <iant@google.com>
14112
14113 PR 10147
14114 * object.cc (Object::section_contents): Don't try to get a view if
14115 the section has length zero.
14116 (Object::handle_gnu_warning_section): If the section is empty, use
14117 the name of the section as the warning.
14118
14119 2009-06-23 Ian Lance Taylor <iant@google.com>
14120
14121 PR 10133
14122 * stringpool.h (class Stringpool_template): Add optimize_ field.
14123 (Stringpool_template::set_optimize): New function.
14124 * stringpool.cc (Stringpool_template::Stringpool_template):
14125 Initialize optimize_ field.
14126 (Stringpool_template::set_string_offsets): Test local optimize
14127 fild rather than parameter.
14128 * layout.cc (Layout::Layout): Call set_optimize on the section
14129 name stringpool.
14130
14131 2009-06-22 Ian Lance Taylor <iant@google.com>
14132
14133 PR 10030
14134 * yyscript.y: Parse TARGET.
14135 * script.cc (script_set_target): New function.
14136 * script-c.h (script_set_target): Declare.
14137 * options.cc (General_options::string_to_object_format): Rename
14138 from string_to_object_format in anonymous namespace. Change
14139 callers.
14140 * options.h (class General_options): Declare
14141 string_to_object_format.
14142
14143 2009-06-22 Ian Lance Taylor <iant@google.com>
14144
14145 * script-sections.cc (Script_sections::create_segments): Don't put
14146 program headers in a PT_LOAD segment if -n or -N.
14147
14148 2009-06-22 Ian Lance Taylor <iant@google.com>
14149
14150 PR 10141
14151 * options.h (class General_options): Add -z lazy and -z now. Sort
14152 -z options into alphabetical order.
14153 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
14154
14155 2009-06-21 Ian Lance Taylor <iant@google.com>
14156
14157 * layout.cc (Layout::make_output_section): Call
14158 Target::new_output_section.
14159 (Layout::attach_allocated_section_to_segment): Put large section
14160 sections in a separate load segment with the large segment flag
14161 set.
14162 (Layout::segment_precedes): Sort large data segments after other
14163 load segments.
14164 (align_file_offset): New static function.
14165 (Layout::set_segment_offsets): Use align_file_offset.
14166 * output.h (class Output_section): Add is_small_section_ and
14167 is_large_section_ fields.
14168 (Output_section::is_small_section): New function.
14169 (Output_section::set_is_small_section): New function.
14170 (Output_section::is_large_section): New function.
14171 (Output_section::set_is_large_section): New function.
14172 (Output_section::is_large_data_section): New function.
14173 (class Output_segment): Add is_large_data_segment_ field.
14174 (Output_segment::is_large_data_segment): New function.
14175 (Output_segment::set_is_large_data_segment): New function.
14176 * output.cc (Output_section::Output_section): Initialize new
14177 fields.
14178 (Output_segment::Output_segment): Likewise.
14179 (Output_segment::add_output_section): Add assertion that large
14180 data sections always go in large data segments. Force small data
14181 sections to the end of the list of data sections. Force small BSS
14182 sections to the start of the list of BSS sections. For large BSS
14183 sections to the end of the list of BSS sections.
14184 * symtab.h (class Symbol): Declare is_common_shndx.
14185 (Symbol::is_defined): Check Symbol::is_common_shndx.
14186 (Symbol::is_common): Likewise.
14187 (class Symbol_table): Define enum Commons_section_type. Update
14188 declarations. Add small_commons_ and large_commons_ fields.
14189 * symtab.cc (Symbol::is_common_shndx): New function.
14190 (Symbol_table::Symbol_table): Initialize new fields.
14191 (Symbol_table::add_from_object): Put small and large common
14192 symbols in the right list.
14193 (Symbol_table::sized_finalized_symbol): Check
14194 Symbol::is_common_shndx.
14195 (Symbol_table::sized_write_globals): Likewise.
14196 * common.cc (Symbol_table::do_allocate_commons): Allocate new
14197 common symbol lists. Don't call do_allocate_commons_list if the
14198 list is empty.
14199 (Symbol_table::do_allocate_commons_list): Remove is_tls
14200 parameter. Add comons_section_type parameter. Change all
14201 callers. Handle small and large common symbols.
14202 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
14203 Symbol::is_common_shndx.
14204 * resolve.cc (symbol_to_bits): Likewise.
14205 * target.h (Target::small_common_shndx): New function.
14206 (Target::small_common_section_flags): New function.
14207 (Target::large_common_shndx): New function.
14208 (Target::large_common_section_flags): New function.
14209 (Target::new_output_section): New function.
14210 (Target::Target_info): Add small_common_shndx, large_common_shndx,
14211 small_common_section_flags, and large_common_section_flags
14212 fields.
14213 (Target::do_new_output_section): New virtual function.
14214 * arm.cc (Target_arm::arm_info): Initialize new fields.
14215 * i386.cc (Target_i386::i386_info): Likewise.
14216 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
14217 Likewise.
14218 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
14219 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14220 (Target_x86_64::do_new_output_section): New function.
14221 * configure.ac: Define conditional MCMODEL_MEDIUM.
14222 * testsuite/Makefile.am (check_PROGRAMS): Add large.
14223 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
14224 (large_LDFLAGS): Define.
14225 * testsuite/large.c: New file.
14226 * testsuite/testfile.cc (Target_test::test_target_info):
14227 Initialize new fields.
14228 * configure, testsuite/Makefile.in: Rebuild.
14229
14230 2009-06-05 Doug Kwan <dougkwan@google.com>
14231
14232 * Makefile.am (CCFILES): Add target.cc.
14233 * Makefile.in: Regenerate.
14234 * i386.cc (class Target_i386): Define new virtual method to
14235 override do_is_local_label_name in parent.
14236 * object.cc (Sized_relobj::do_count_local_symbols): Discard
14237 local symbols if --discard-locals or -X is given.
14238 * options.h (class General_options): Declare new options
14239 '--discard-locals' and '-X' for discarding locals.
14240 * target.h (class Target): Define new methods is_local_label_name.
14241 Declare new virtual method do_is_local_label_name.
14242 * target.cc: New file.
14243 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
14244 (check_SCRIPTS): Add discard_locals_test.sh.
14245 (check_DATA): Add discard_local_tests.syms.
14246 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
14247 (discard_local_tests.syms, discard_locals_test.o): New make rules.
14248 * testsuite/Makefile.in: Regenerate.
14249 * testsuite/discard_locals_test.c: New file.
14250 * testsuite/discard_locals_test.sh: Same.
14251
14252 2009-06-05 Doug Kwan <dougkwan@google.com>
14253
14254 * object.cc (Sized_relobj::Sized_relobj): Initialize
14255 discarded_eh_frame_shndx_ to -1U.
14256 (Sized_relobj::do_layout): Record index of a discard .eh_frame
14257 section.
14258 (Sized_relobj::do_count_local_symbols): Skip local symbols in
14259 a discarded .eh_frame section.
14260 (Sized_relobj::do_finalize_local_symbols): Ditto.
14261 * object.h (class Sized_relobj): Declare new member
14262 discarded_eh_frame_shndx_.
14263 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
14264 (local_labels_test.o, local_labels_test): New rules.
14265 * testsuite/Makefile.in: Regenerate.
14266
14267 2009-06-04 Doug Kwan <dougkwan@google.com>
14268
14269 * layout.cc (Layout::section_name_mapping): Add mapping for
14270 special ARM sections.
14271
14272 2009-06-03 Doug Kwan <dougkwan@google.com>
14273
14274 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
14275 (utils::has_overflow): Same.
14276
14277 2009-06-03 Ian Lance Taylor <iant@google.com>
14278
14279 * layout.cc (Layout::section_name_mapping): New array, replacing
14280 Layout::linkonce_mapping.
14281 (Layout::section_name_mapping_count): New variable, replacing
14282 Layout::linkonce_mapping_count.
14283 (Layout::linkonce_output_name): Remove.
14284 (Layout::output_section_name): Rewrite.
14285 * layout.h (class Layout): Rename Linkonce_mapping to
14286 Section_name_mapping, linkonce_mapping to section_name_mapping,
14287 linkonce_mapping_count to section_name_mapping_count. Don't
14288 declare linkonce_output_name.
14289
14290 2009-06-03 Doug Kwan <dougkwan@google.com>
14291
14292 * gold/arm.cc (namespace utils): New.
14293 (Target_arm::reloc_is_non_pic): Define new method.
14294 (class Arm_relocate_functions): New.
14295 (Target_arm::Relocate::relocate): Handle relocation types used by
14296 Android.
14297
14298 2009-06-03 Ian Lance Taylor <iant@google.com>
14299
14300 * arm.cc (Target_arm::scan::global): Use || instead of |.
14301
14302 2009-06-02 Doug Kwan <dougkwan@google.com>
14303
14304 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
14305 issued_non_pic_error_.
14306 (class Target_arm::Scan): Declare new method check_non_pic.
14307 Define new method symbol_needs_plt_entry.
14308 Declare new data member issued_non_pic_error_.
14309 (class Target_arm::Relocate): Declare new method
14310 should_apply_static_reloc.
14311 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
14312 (Target_arm::Scan::check_non_pic): Define new method.
14313 (Target_arm::Scan::local): Handle a small subset of reloc types used
14314 by Android.
14315 (Target_arm::Scan::local): Same.
14316 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
14317
14318 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
14319
14320 * incremental.cc (Incremental_inputs::report_command_line): Filter
14321 out --incremental-* options.
14322
14323 2009-05-29 Doug Kwan <dougkwan@google.com>
14324
14325 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
14326 template class.
14327 (class Target_arm): Update comment.
14328 (Target_arm::Target_arm): Initialize new data members GOT_,
14329 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
14330 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
14331 and Target_arm::rel_dyn_section.
14332 Declare new_enum Target_arm::Got_type.
14333 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
14334 and DYNBSS_.
14335 Update commments for member do_dynsym_value.
14336 (Target_arm::got_size, Target_arm::plt_section,
14337 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
14338 new methods inside class defintion.
14339 (Target_arm::got_section): Define new method.
14340 (Target_arm::rel_dyn_section): Same.
14341 (Output_data_plt_arm): New template class.
14342 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
14343 (Output_data_plt_arm:do_adjust_output_section): Define new method.
14344 (Output_data_plt_arm::add_entry): Same.
14345 (Output_data_plt_arm::first_plt_entry): Define new
14346 static data member for PLT instruction template.
14347 (Output_data_plt_arm::plt_entry): Same.
14348 (Output_data_plt_arm::do_write): Define new method.
14349 (Target_arm::make_plt_entry): Same.
14350 (Target_arm::do_finalize_sections): Same.
14351 (Target_arm::do_dynsym_value): Same.
14352
14353 2009-05-28 Doug Kwan <dougkwan@google.com>
14354
14355 * Makefile.am (TARGETSOURCES): Add arm.cc.
14356 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
14357 * Makefile.in: Regenerate.
14358 * arm.cc: New file.
14359 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
14360
14361 2009-05-26 Doug Kwan <dougkwan@google.com>
14362
14363 * options.cc (General_options::parse_exclude_libs). Fix a comment.
14364 (General_options::check_excluded_libs): Strip off directories in
14365 archive name before matching like GNU ld does.
14366 * testsuite/Makefile.am (MOSTLYCLEANFILES,
14367 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
14368 (exclude_libs_test_LDFLAGS): Add linker option
14369 -Wl,--exclude-libs,libexclude_libs_test_3
14370 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
14371 an explicit archive without using -l.
14372 (alt/libexclude_libs_test_3.a): New make rule.
14373 * testsuite/Makefile.in: Regenerate.
14374 * testsuite/exclude_libs_test.c : Declare lib3_default().
14375 (main): Call it.
14376 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
14377 * exclude_libs_test_3.c: New file.
14378
14379 2009-05-26 Nick Clifton <nickc@redhat.com>
14380
14381 * po/id.po: New Indonesian translation.
14382 * po/gold.pot: Updated template file.
14383
14384 2009-05-22 Sriraman Tallam <tmsriram@google.com>
14385
14386 * testsuite/Makefile.am: Add -ffunction-sections to compile
14387 gc_comdat_test files. Add -Wl,--gc-sections to build
14388 gc_comdat_test.
14389 * testsuite/Makefile.in: Regenerate.
14390 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
14391
14392 2009-05-21 Sriraman Tallam <tmsriram@google.com>
14393
14394 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
14395 kept comdat section was garbage collected.
14396 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
14397 * testsuite/Makefile.in: Regenerate.
14398 * testsuite/gc_comdat_test.sh: New file.
14399 * testsuite/gc_comdat_test_1.cc: New file.
14400 * testsuite/gc_comdat_test_2.cc: New file.
14401
14402 2009-05-19 Doug Kwan <dougkwan@google.com>
14403
14404 * archive.cc (Archive::Archive): Move constructor from archive.h
14405 to here. Initialize no_export_.
14406 (Archive::get_elf_object_for_member): Set no_export flag of object.
14407 * archive.h (Archive::Archive): Move constructor body to
14408 archive.cc.
14409 (Archive::no_export): New method.
14410 (Archive::no_export_): New field.
14411 * object.h (Object::Object): Initialize no_export_ to false.
14412 (Object::no_export, Object::set_no_export): New methods.
14413 (Object::no_export_): New field.
14414 * options.cc (General_options::parse_exclude_libs): New method.
14415 (General_options::check_excluded_libs) Same.
14416 * options.h (exclude_libs): New option.
14417 (General_options::check_excluded_libs): New method declaration.
14418 (General_options::excluded_libs_): New field.
14419 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
14420 default or protected visibility if an object has no-export flag set.
14421 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
14422 (check_SCRIPTS): Add exclude_libs_test.sh.
14423 (check_DATA): Add exclude_libs_test.syms.
14424 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
14425 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
14426 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
14427 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
14428 (exclude_libs_test.syms, libexclude_libs_test_1.a,
14429 libexclude_libs_test_2.a): New rules.
14430 * testsuite/Makefile.in: Regenerate.
14431 * testsuite/exclude_libs_test.c: New file.
14432 * testsuite/exclude_libs_test.sh: Ditto.
14433 * testsuite/exclude_libs_test_1.c: Ditto.
14434 * testsuite/exclude_libs_test_2.c: Ditto.
14435
14436 2009-05-15 Ian Lance Taylor <iant@google.com>
14437
14438 * configure.ac: Check for declarations for cases where libiberty.h
14439 checks HAVE_DECL_xxx.
14440 * configure, config.in: Rebuild.
14441
14442 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
14443
14444 * gold.h (Incremental_argument_list): Remove (invalid) forward
14445 declaration.
14446 * incremental.cc (Incremental_inputs::report_achive): New method.
14447 (Incremental_inputs::report_object): New method.
14448 (Incremental_inputs::report_script): New method.
14449 (Incremental_inputs::finalize_inputs): New method.
14450 (Incremental_inputs::finalize): Call finalize_inputs().
14451 (Incremental_inputs::sized_create_incremental_inputs_section_data):
14452 Create inputs entries.
14453 * incremental.h (Incremental_input_type): New enum.
14454 (Incremental_inputs::Incremental_input): Initialize new fields.
14455 (Incremental_inputs::report_inputs): New method.
14456 (Incremental_inputs::report_achive): New method.
14457 (Incremental_inputs::report_object): New method.
14458 (Incremental_inputs::report_script): New method.
14459 (Incremental_inputs::finalize_inputs): New method.
14460 (Incremental_inputs::Input_info): New struct.
14461 (Incremental_inputs::Input_info_map): New typedef.
14462 (Incremental_inputs::lock_): New field.
14463 (Incremental_inputs::Inputs_): New field.
14464 (Incremental_inputs::Inputs_map): New field.
14465 * main.cc (main): Call Incremental_input::report_inputs.
14466 * options.h (Input_argument_list): Typedef moved from
14467 Input_arguments.
14468 (Input_file_group::Files): Remove, use ::Input_argument_list.
14469 (Input_file_group::Input_argument_list): Remove, use
14470 ::Input_argument_list.
14471 * plugin.cc (Plugin_manager::add_input_file): Add error in
14472 incremental build.
14473 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
14474 functions.
14475 * script.cc (read_input_script): Call
14476 Incremental_input::report_script.
14477 * script.h (Script_info): New class.
14478
14479 2009-04-27 Ian Lance Taylor <iant@google.com>
14480
14481 * x86_64.cc (do_adjust_output_section): Set entsize to
14482 plt_entry_size.
14483
14484 2009-04-23 Elliott Hughes <enh@google.com>
14485
14486 * output.cc (Output_file::close): After short writes, continue
14487 writing from the correct offset in the buffer being written.
14488
14489 2009-04-23 Chris Demetriou <cgd@google.com>
14490
14491 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
14492 * configure: Regenerate.
14493 * config.in: Regenerate.
14494 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
14495 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
14496
14497 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
14498
14499 * incremental.cc (Incremental_inputs_header_data): Renamed from
14500 Incremental_input_header_data.
14501 (Incremental_inputs_header_data::data_size): New field.
14502 (Incremental_inputs_header_data::put_input_file_count): Renamed
14503 from input_file_count.
14504 (Incremental_inputs_header_data::put_command_line_offset): Renamed
14505 from command_line_offset.
14506 (Incremental_inputs_header_data::put_reserved): Renamed from
14507 put_reserved.
14508 (Incremental_inputs_entry_data): Renamed from
14509 Incremental_input_entry_data.
14510 (Incremental_inputs_entry_data::data_size): New field.
14511 (Incremental_inputs::report_command_line): New method.
14512 (Incremental_inputs::finalize): New method.
14513 (Incremental_inputs::create_incremental_inputs_data): New method.
14514 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
14515 * incremental.h: New file.
14516 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
14517 (Layout::finalize): Create incremental inputs section in
14518 incremental builds.
14519 (Layout::create_incremental_info_sections): New method.
14520 * layout.h (Layout::incremental_inputs): New method.
14521 (Layout::create_incremental_info_sections): New method.
14522 (Layout::incremental_inputs_): New field.
14523 * main.cc (main): Notify Incremental_input of the command line.
14524
14525 2009-04-01 Ian Lance Taylor <iant@google.com>
14526 Mikolaj Zalewski <mikolajz@google.com>
14527
14528 * gold.h (reserve_unordered_map): Define, three versions, one for
14529 each version of Unordered_map.
14530 * layout.cc (Layout::Layout): Remove options parameter. Add
14531 number_of_input_files parameter. Don't initialize options_.
14532 Initialize number_of_input_files_ and resized_signatures_. Move
14533 sections_are_attached_.
14534 (Layout::layout_group): Reserve space for group_signatures_.
14535 (Layout::find_or_add_kept_section): Change name parameter to be a
14536 reference. Resize signatures_ map when it gets large enough.
14537 (Layout::layout_eh_frame): Use parameters->options() instead of
14538 this->options_.
14539 (Layout::make_output_section): Likewise.
14540 (Layout::attach_allocated_section_to_segment): Likewise.
14541 (Layout::finalize, Layout::create_executable_stack): Likewise.
14542 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
14543 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
14544 * layout.h (class Layout): Update declarations. Remove options_
14545 field. Add number_of_input_files_ and resized_signatures_
14546 fields. Move sections_are_attached_ field.
14547 * main.cc (main): Pass number of input files to Layout
14548 constructor. Don't pass options.
14549
14550 2009-03-30 Ian Lance Taylor <iant@google.com>
14551
14552 * ffsll.c (ffsll): Correct implementation.
14553
14554 2009-03-27 Ian Lance Taylor <iant@google.com>
14555
14556 * ffsll.c: New file.
14557 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
14558 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
14559 * ftruncate.c (ftruncate): Declare before definition.
14560 * mremap.c (mremap): Likewise.
14561 * pread.c (pread): Likewise.
14562 * configure, Makefile.in, config.in: Rebuild.
14563
14564 * mremap.c: New file.
14565 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
14566 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
14567 (mremap): Declare if HAVE_MREMAP is not defined.
14568 * configure, Makefile.in, config.in: Rebuild.
14569
14570 2009-03-27 Cary Coutant <ccoutant@google.com>
14571
14572 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
14573 position independent.
14574 * sparc.cc (Target_sparc::check_non_pic): Likewise.
14575 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
14576
14577 2009-03-24 Cary Coutant <ccoutant@google.com>
14578
14579 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
14580 an executable.
14581 (needs_dynamic_reloc): Likewise.
14582
14583 2009-03-24 Ian Lance Taylor <iant@google.com>
14584
14585 * yyscript.y (file_cmd): Recognize EXTERN.
14586 (extern_name_list, extern_name_list_body): New nonterminals.
14587 * script.cc (script_add_extern): Define.
14588 * script-c.h (script_add_extern): Declare.
14589
14590 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
14591
14592 * object.cc (is_elf_object): Define.
14593 * object.h (is_elf_object): Declare.
14594 * archive.cc (Archive::get_elf_object_for_member): Call
14595 is_elf_object.
14596 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
14597
14598 2009-03-24 Elliott Hughes <enh@google.com>
14599
14600 * output.cc (Output_file::map_anonymous): Define.
14601 (Output_file::map): Use map_anonymous. If the regular mmap fails,
14602 try an anonymous one. Report the size if the mmap fails.
14603 * output.h (class Output_file): Declare map_anonymous.
14604
14605 2009-03-24 Ian Lance Taylor <iant@google.com>
14606
14607 * target-select.cc (instantiate_target): Don't acquire the lock if
14608 the instantiated_target_ field has already been set.
14609
14610 2009-03-23 Ian Lance Taylor <iant@google.com>
14611
14612 * gold-threads.h (class Initialize_lock): Define.
14613 * gold-threads.cc (class Initialize_lock_once): Define.
14614 (initialize_lock_control): New static variable.
14615 (initialize_lock_pointer): New static variable.
14616 (initialize_lock_once): New static function.
14617 (Initialize_lock::Initialize_lock): Define.
14618 (Initialize_lock::initialize): Define.
14619 * target-select.h: Include "gold-threads.h".
14620 (class Target_selector): Add lock_ and initialize_lock_ fields.
14621 Don't define instantiate_target, just declare it.
14622 * target-select.cc (Target_selector::Target_selector): Initialize
14623 new fields.
14624 (Target_selector::instantiate_target): Define.
14625 * descriptors.h: Include "gold-threads.h".
14626 (class Descriptors): Add initialize_lock_ field.
14627 * descriptors.cc (Descriptors::Descriptors): Initialize new
14628 field.
14629 (Descriptors::open): Use initialize_lock_ field
14630 * errors.h (class Errors): Add initialize_lock_ field.
14631 * errors.cc (Errors::Errors): Initialize new field.
14632 (Errors::initialize_lock): Use initialize_lock_ field.
14633 * powerpc.cc (class Target_selector_powerpc): Remove
14634 instantiated_target_ field. In do_recognize call
14635 instantiate_target rather than do_instantiate_target. In
14636 do_instantiate_target just allocate a new target.
14637 * sparc.cc (class Target_selector_sparc): Likewise.
14638
14639 * freebsd.h: New file.
14640 * i386.cc: Include "freebsd.h".
14641 (Target_i386): Derive from Target_freebsd rather than
14642 Sized_target.
14643 (Target_selector_i386): Derive from Target_selector_freebsd rather
14644 than Target_selector.
14645 * x86_64.cc: Include "freebsd.h".
14646 (Target_x86_64): Derive from Target_freebsd rather than
14647 Sized_target.
14648 (Target_selector_x86_64): Derive from Target_selector_freebsd
14649 rather than Target_selector.
14650 * target.h (class Target): Add adjust_elf_header and
14651 do_adjust_elf_header.
14652 * output.cc (Output_file_header:: do_sized_write): Call target
14653 adjust_elf_header routine.
14654 * configure.tgt: Set targ_osabi.
14655 * configure.ac: Define GOLD_DEFAULT_OSABI.
14656 * parameters.cc (Parameters::default_target): Pass
14657 GOLD_DEFAULT_OSABI to select_target.
14658 * target-select.h (class Target_selector): Make instantiate_target
14659 protected rather than private.
14660 * Makefile.am (HFILES): Add freebsd.h.
14661 * configure, Makefile.in, config.in: Rebuild.
14662
14663 * merge.cc (do_add_input_section): Correct pend value. Change
14664 message about last entry not being null terminated from error to
14665 warning.
14666
14667 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
14668
14669 * incremental.cc: New file.
14670 * Makefile.am (CCFILES): Add incremental.cc.
14671 * Makefile.in: Rebuild.
14672
14673 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
14674
14675 * layout.cc (Layout::output_section_name): Preserve names
14676 of '.note.' sections.
14677
14678 2009-03-19 Ian Lance Taylor <iant@google.com>
14679
14680 * descriptors.cc (Descriptors::open): Check that the options are
14681 valid before using them.
14682
14683 2009-03-18 Ian Lance Taylor <iant@google.com>
14684
14685 * script-sections.h: Include <list>.
14686 (class Script_sections): Change Sections_elements from std::vector
14687 to std::list. Typedef public Elements_iterator. Add
14688 orphan_section_placement_, data_segment_align_start_, and
14689 saw_data_segment_align_ fields. Remove data_segment_align_index_
14690 field.
14691 * script-sections.cc (class Orphan_section_placement): New class.
14692 (class Sections_element): Add virtual functions is_relro and
14693 orphan_section_init. Remove virtual function place_orphan_here.
14694 (class Output_section_definition): Add is_relro and
14695 orphan_section_init. Remove place_orphan_here.
14696 (class Orphan_output_section): Likewise.
14697 (Script_sections::Script_sections): Update for field changes.
14698 (Script_sections::data_segment_align): Set saw_data_segment_align_
14699 and data_segment_align_start_, not data_segment_align_index.
14700 (Script_sections::data_segment_relro_end): Check
14701 saw_data_segment_align_. Use data_segment_align_start_ rather
14702 than data_segment_align_index_.
14703 (Script_sections::place_orphan): Rewrite to use
14704 Orphan_section_placement.
14705
14706 2009-03-17 Ian Lance Taylor <iant@google.com>
14707
14708 * archive.cc (Archive::add_symbols): Check for a version attached
14709 to the symbol name in the archive map.
14710 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
14711 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
14712 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
14713 (ver_test_11.a): New target.
14714 * testsuite/Makefile.in: Rebuild.
14715
14716 * configure.ac: Check for chsize and posix_fallocate. Replace
14717 ftruncate.
14718 * ftruncate.c: New file, from gnulib.
14719 * output.cc (posix_fallocate): Define dummy version if not
14720 HAVE_POSIX_FALLOCATE.
14721 (Output_file::map): Call posix_fallocate rather than lseek and
14722 write.
14723 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
14724 * configure, Makefile.in, config.in: Rebuild.
14725
14726 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
14727
14728 * layout.h (Layout::create_note): Add section_name parameter.
14729 * layout.cc (Layout::create_note): Likewise.
14730 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
14731
14732 2009-03-17 Ian Lance Taylor <iant@google.com>
14733
14734 * descriptors.cc: Include "options.h".
14735 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
14736 (Descriptors::open): Always use O_CLOEXEC when opening a new
14737 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
14738 then set FD_CLOEXEC.
14739
14740 * sparc.cc (class Target_sparc): Add has_got_section.
14741 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
14742 make sure we have a GOT section.
14743
14744 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
14745 (Target_sparc::Scan::local): Likewise.
14746 (Target_sparc::Scan::global): Likewise.
14747 (Target_sparc::Relocate::relocate): Likewise.
14748 (Target_sparc::Relocate::relocate_tls): Likewise.
14749
14750 * symtab.cc (Symbol_table::define_default_version): New function,
14751 broken out of add_from_object.
14752 (Symbol_table::add_from_object): Call define_default_version.
14753 (Symbol_table::define_special_symbol): Add resolve_oldsym
14754 parameter. Change all callers. If the version for a symbol comes
14755 from a version script, resolve it with the symbol with the same
14756 name with no version. Also add the symbol without a version if
14757 appropriate.
14758 (do_define_in_output_data): If resolving with oldsym, don't delete
14759 sym.
14760 (do_define_in_output_segment): Likewise.
14761 (do_define_as_constant): Likewise.
14762 * symtab.h (class Symbol_table): Update declarations.
14763
14764 2009-03-13 Ian Lance Taylor <iant@google.com>
14765
14766 * readsyms.cc (Read_symbols::incompatible_warning): New function.
14767 (Read_symbols::requeue): New function.
14768 (Read_symbols::do_read_symbols): If make_elf_object fails because
14769 the target type is not configured, and the file was searched for,
14770 issue a warning and retry with the next directory.
14771 (Add_symbols::run): If the file has an incompatible format, and
14772 it was searched for, requeue the Read_symbols task. On error,
14773 release the object.
14774 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
14775 dirindex parameter to constructor. Change all callers. Declare
14776 incompatible_warning and requeue.
14777 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
14778 input_argument_ and input_group_ fields. Add them to
14779 constructor. Change all callers.
14780 (class Read_script): Add dirindex_ field. Add it to constructor.
14781 Change all callers.
14782 * archive.cc (Archive::setup): Remove input_objects parameter.
14783 Change all callers.
14784 (Archive::get_file_and_offset): Likewise.
14785 (Archive::read_all_symbols): Likewise.
14786 (Archive::read_symbols): Likewise.
14787 (Archive::get_elf_object_for_member): Remove input_objects
14788 parameter. Add punconfigured parameter. Change all callers.
14789 (Archive::add_symbols): Change return type to bool. Check return
14790 value of include_member.
14791 (Archive::include_all_members): Likewise.
14792 (Archive::include_member): Change return type to bool. Return
14793 false if first included object has incompatible target. Set
14794 included_member_ field.
14795 (Add_archive_symbols::run): If add_symbols returns false, requeue
14796 Read_symbols task.
14797 * archive.h (class Archive): Add included_member_ field.
14798 Initialize it in constructor. Add input_file and searched_for
14799 methods. Update declarations.
14800 (class Add_archive_symbols): Add dirpath_, dirindex_, and
14801 input_argument_ fields. Add them to constructor. Change all
14802 callers.
14803 * script.cc: Include "target-select.h".
14804 (class Parser_closure): Add skip_on_incompatible_target_ and
14805 found_incompatible_target_ fields. Add
14806 skip_on_incompatible_target parameter to constructor. Change all
14807 callers. Add methods skip_on_incompatible_target,
14808 clear_skip_on_incompatible_target, found_incompatible_target, and
14809 set_found_incompatible_target.
14810 (read_input_script): Add dirindex parameter. Change all callers.
14811 If parser finds an incompatible target, requeue Read_symbols
14812 task.
14813 (script_set_symbol): Clear skip_on_incompatible_target in
14814 closure.
14815 (script_add_assertion, script_parse_option): Likewise.
14816 (script_start_sections, script_add_phdr): Likewise.
14817 (script_check_output_format): New function.
14818 * script.h (read_input_script): Update declaration.
14819 * script-c.h (script_check_output_format): Declare.
14820 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
14821 (ignore_cmd): Remove OUTPUT_FORMAT.
14822 * fileread.cc (Input_file::Input_file): Add explicit this.
14823 (Input_file::will_search_for): New function.
14824 (Input_file::open): Add pindex parameter. Change all callers.
14825 * fileread.h (class Input_file): Add input_file_argument method.
14826 Declare will_search_for. Update declarations.
14827 * object.cc (make_elf_object): Add punconfigured parameter.
14828 Change all callers.
14829 * object.h (class Object): Make input_file public. Add
14830 searched_for method.
14831 (make_elf_object): Update declaration.
14832 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
14833 restart search.
14834 * dirsearch.h (class Dirsearch): Update declaration.
14835 * options.h (class General_options): Add --warn-search-mismatch.
14836 * parameters.cc (Parameters::is_compatible_target): New function.
14837 * parameters.h (class Parameters): Declare is_compatible_target.
14838 * workqueue.cc (Workqueue::add_blocker): New function.
14839 * workqueue.h (class Workqueue): Declare add_blocker.
14840
14841 * fileread.cc (Input_file::open): Remove options parameter.
14842 Change all callers.
14843 (Input_file::open_binary): Likewise.
14844 * script.cc (read_input_script): Likewise.
14845 * readsyms.h (class Read_symbols): Remove options_ field. Remove
14846 options parameter from constructor. Change all callers.
14847 (class Read_script): Likewise.
14848 * fileread.h (class Input_file): Update declarations.
14849 * script.h (read_input_script): Update declaration.
14850
14851 2009-03-10 Nick Clifton <nickc@redhat.com>
14852
14853 * po/es.po: New Spanish translation.
14854
14855 2009-03-06 Cary Coutant <ccoutant@google.com>
14856
14857 * options.cc (parse_short_option): Keep dash_z from registering itself.
14858
14859 2009-03-03 Ian Lance Taylor <iant@google.com>
14860
14861 PR 9918
14862 * target-reloc.h (relocate_section): Pass output_section to
14863 relocate.
14864 * i386.cc (Target_i386::should_apply_static_reloc): Add
14865 output_section parameter. Change all callers.
14866 (Target_i386::Relocate::relocate): Add output_section parameter.
14867 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14868 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
14869 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
14870 * testsuite/two_file_shared.sh: New script.
14871 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
14872 (check_DATA): Add two_file_shared.dbg.
14873 (two_file_shared.dbg): New target.
14874 * testsuite/Makefile.in: Rebuild.
14875
14876 2009-03-01 Ian Lance Taylor <iant@google.com>
14877
14878 * configure.ac: Check for byteswap.h.
14879 * configure: Rebuild.
14880 * config.in: Rebuild.
14881
14882 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
14883
14884 * layout.cc (Layout::find_or_add_kept_section): New function.
14885 (Layout::add_comdat): Removed.
14886 * layout.h (struct Kept_section): Move out of class Layout.
14887 Remove trailing underscores from field names. Add group_sections
14888 field. Rename group_ field to is_group. Change all uses.
14889 (class Layout): Declare find_or_add_kept_section, not add_comdat.
14890 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
14891 comdat_groups_ field.
14892 (Sized_relobj::include_section_group): Use
14893 find_or_add_kept_section and Kept_section::group_sections.
14894 (Sized_relobj::include_linkonce_section): Likewise.
14895 * object.cc (class Sized_relobj): Don't define Comdat_group or
14896 Comdat_group_table. Remove find_comdat_group and
14897 add_comdat_group. Remove comdat_groups_ field.
14898 * plugin.cc (include_comdat_group): Use
14899 Layout::find_or_add_kept_section.
14900
14901 2009-02-28 Ian Lance Taylor <iant@google.com>
14902
14903 * README: --gc-sections and map files are now supported. Document
14904 some build requirements.
14905
14906 PR 6992
14907 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
14908 relocatable link set the value of the section symbol to zero.
14909 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
14910 relocatable link don't include the section address in the local
14911 symbol value.
14912
14913 2009-02-27 Ian Lance Taylor <iant@google.com>
14914
14915 PR 6811
14916 * options.h (class Search_directory): Add is_system_directory.
14917 (class General_options): Declare is_in_system_directory.
14918 * options.cc (get_relative_sysroot): Make static.
14919 (get_default_sysroot): Make static.
14920 (General_optoins::is_in_system_directory): New function.
14921 * fileread.cc (Input_file::is_in_system_directory): New function.
14922 * fileread.h (class Input_file): Declare is_in_system_directory.
14923 * object.h (class Object): Add is_in_system_directory.
14924 (class Input_objects): Remove system_library_directory_ field.
14925 * object.cc (Input_objects::add_object): Don't set
14926 system_library_directory_.
14927 (input_objects::found_in_system_library_directory): Remove.
14928 * symtab.cc (Symbol_table::write_globals): Remove input_objects
14929 parameter. Change all callers.
14930 (Symbol_table::sized_write_globals): Likewise.
14931 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
14932 Call Object::is_in_system_directory.
14933 * symtab.h (class Symbol_table): Update declarations.
14934
14935 PR 5990
14936 * descriptors.h (Open_descriptor): Add is_on_stack field.
14937 * descriptors.cc (Descriptors::open): If the descriptor is on the
14938 top of the stack, remove it. Initialize is_on_stack field.
14939 (Descriptors::release): Only add pod to stack if it is not on the
14940 stack already.
14941 (Descriptors::close_some_descriptor): Clear stack_next and
14942 is_on_stack fields.
14943
14944 PR 7091
14945 * output.cc (Output_section::find_starting_output_address): Rename
14946 from starting_output_address; add PADDR parameter; change return
14947 type.
14948 * output.h (class Output_section): Declare
14949 find_starting_output_address instead of starting_output_address.
14950 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
14951 section symbol for which we can't find a merge section.
14952
14953 PR 9836
14954 * symtab.cc (Symbol_table::add_from_object): If the visibility is
14955 hidden or internal, force the symbol to be local.
14956 * resolve.cc (Symbol::override_visibility): Define.
14957 (Symbol::override_base): Use override_visibility.
14958 (Symbol_table::resolve): Likewise.
14959 (Symbol::override_base_with_special): Likewise.
14960 (Symbol_table::override_with_special): If the visibility is hidden
14961 or internal, force the symbol to be local.
14962 * symtab.h (class Symbol): Add set_visibility and
14963 override_visibility.
14964 * testsuite/ver_test_1.sh: New file.
14965 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
14966 (check_DATA): Add ver_test_1.syms.
14967 (ver_test_1.syms): New target.
14968 * testsuite/Makefile.in: Rebuild.
14969
14970 2009-02-25 Cary Coutant <ccoutant@google.com>
14971
14972 * layout.cc (Layout::choose_output_section): Don't rename sections
14973 when using a linker script that has a SECTIONS clause.
14974 * Makefile.in: Regenerate.
14975
14976 * testsuite/Makefile.am (script_test_5.sh): New test case.
14977 * testsuite/Makefile.in: Regenerate.
14978 * testsuite/script_test_5.cc: New file.
14979 * testsuite/script_test_5.sh: New file.
14980 * testsuite/script_test_5.t: New file.
14981
14982 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
14983
14984 * archive.cc (Archive::include_member): Update calls to add_symbols.
14985 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
14986 the Layout argument.
14987 * dynobj.h (do_add_symbols): Add the Layout argument.
14988 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
14989 Layout argument.
14990 * object.h (Object::add_symbols): Add the Layout argument.
14991 (Object::do_add_symbols): Add the Layout argument.
14992 (Sized_relobj::do_add_symbols): Add the Layout argument.
14993 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
14994 Unify the two versions.
14995 (Add_plugin_symbols): Remove.
14996 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
14997 (Sized_pluginobj::do_add_symbols): Unify the two versions.
14998 (Add_plugin_symbols): Remove.
14999 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
15000 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
15001 (Add_symbols::run): Make it work with Pulginobj.
15002
15003 2009-02-06 Ian Lance Taylor <iant@google.com>
15004
15005 * object.cc (Sized_relobj::do_layout): Make info message start
15006 with lower case letter.
15007
15008 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
15009
15010 * binary.cc: Fix file comment.
15011
15012 * options.h (enum Incremental_disposition): Define.
15013 (class General_options): Add new options: --incremental,
15014 --incremental_changed, --incremental_unchanged,
15015 --incremental_unknown. Add incremental_disposition_ and
15016 implicit_incremental_ fields.
15017 (General_options::incremental_disposition): New function.
15018 (class Position_dependent_options): Add incremental_disposition
15019 option.
15020 (Position_dependent_options::copy_from_options): Set incremental
15021 dispositions.
15022 * options.cc (General_options::parse_incremental_changed): New
15023 function.
15024 (General_options::parse_incremental_unchanged): New function.
15025 (General_options::parse_incremental_unknown): New function.
15026 (General_options::General_options): Initialize new fields
15027 incremental_disposition_ and implicit_incremental_.
15028 (General_options::finalize): Check for uasge of --incremental-*
15029 without --incremental.
15030
15031 2009-02-06 Chris Demetriou <cgd@google.com>
15032
15033 * gold.h (gold_undefined_symbol): Change to take only a Symbol
15034 pointer and to report location as the file name associated with
15035 the symbol.
15036 (gold_undefined_symbol_at_location): New function to replace the
15037 old gold_undefined_symbol functionality.
15038 * target-reloc.h (relocate_section): Update to use
15039 gold_undefined_symbol_at_location.
15040 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15041 Call gold_undefined_symbol function rather than gold_error.
15042 * errors.h (Errors::undefined_symbol): Take location as a
15043 string, rather than calculating it from a relocation.
15044 * errors.cc (Errors::fatal): Print "fatal error:" before the
15045 formatted message.
15046 (Errors::error, Errors::error_at_location): Print "error: "
15047 before the formatted message.
15048 (Errors::undefined_symbol): Take location as a string, rather
15049 than calculating it from a relocation.
15050 (gold_undefined_symbol_at_location): New function akin to
15051 old gold_undefined_symbol, calculates location from relocation.
15052 (gold_undefined_symbol): Change to take only a Symbol pointer
15053 and to report location as the file name associated with the symbol.
15054 * testsuite/debug_msg.sh: Update for changed error messages.
15055 * testsuite/undef_symbol.sh: Likewise.
15056
15057 2009-02-04 Duncan Sands <baldrick@free.fr>
15058
15059 PR 9812
15060 * reduced_debug_output.h
15061 (Output_reduced_debug_abbrev_section::failed): Use format for
15062 gold_warning.
15063 (Output_reduced_debug_info_section::faild): Likewise.
15064
15065 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
15066
15067 * script.cc (Lazy_demangler): New class.
15068 (Version_script_info::get_symbol_version_helper): Demangle a
15069 symbol only once.
15070
15071 2009-01-29 Cary Coutant <ccoutant@google.com>
15072
15073 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
15074 to __tls_get_addr.
15075 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15076
15077 2009-01-28 Ian Lance Taylor <iant@google.com>
15078
15079 * version.cc (version_string): Bump to 1.9.
15080
15081 * gold.h: Include <cstring> and <stdint.h>.
15082 * version.cc: Include <cstdio>.
15083 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
15084 warning.
15085 * reduced_debug_output.cc (insert_into_vector): Rename from
15086 Insert_into_vector; change all callers. Use Swap_unaligned to
15087 avoid aliasing issue; remove union since it is unnecessary.
15088
15089 2009-01-27 Sriraman Tallam <tmsriram@google.com>
15090
15091 * Makefile.am (CCFILES): Add gc.cc.
15092 (HFILES): Add gc.h.
15093 * Makefile.in: Regenerate.
15094 * gold.cc (Gc_runner): New class.
15095 (queue_initial_tasks): Call garbage collection related tasks
15096 when corresponding options are invoked.
15097 (queue_middle_gc_tasks): New function.
15098 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
15099 processed early before laying out sections during garbage collection.
15100 * gold.h (queue_middle_gc_tasks): New function.
15101 (is_prefix_of): Move from "layout.cc".
15102 * i386.cc (Target_i386::gc_process_relocs): New function.
15103 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
15104 * main.cc (main): Create object of class "Garbage_collection".
15105 * object.cc (Relobj::copy_symbols_data): New function.
15106 (Relobj::is_section_name_included): New function.
15107 (Sized_relobj::do_layout): Allow this function to be called twice
15108 during garbage collection and defer layout of section during the
15109 first call.
15110 * object.h (Relobj::get_symbols_data): New function.
15111 (Relobj::is_section_name_included): New function.
15112 (Relobj::copy_symbols_data): New function.
15113 (Relobj::set_symbols_data): New function.
15114 (Relobj::get_relocs_data): New function.
15115 (Relobj::set_relocs_data): New function.
15116 (Relobj::is_output_section_offset_invalid): New pure virtual function.
15117 (Relobj::gc_process_relocs): New function.
15118 (Relobj::do_gc_process_relocs): New pure virtual function.
15119 (Relobj::sd_): New data member.
15120 (Sized_relobj::is_output_section_offset_invalid): New function.
15121 (Sized_relobj::do_gc_process_relocs): New function.
15122 * options.h (General_options::gc_sections): Modify to not be a no-op.
15123 (General_options::print_gc_sections): New option.
15124 * plugin.cc (Plugin_finish::run): Remove function call to
15125 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
15126 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
15127 * reloc.cc (Read_relocs::run): Add task to process relocs and
15128 determine unreferenced sections when doing garbage collection.
15129 (Gc_process_relocs): New class.
15130 (Sized_relobj::do_gc_process_relocs): New function.
15131 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
15132 sections that are garbage collected.
15133 * reloc.h (Gc_process_relocs): New class.
15134 * sparc.cc (Target_sparc::gc_process_relocs): New function.
15135 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
15136 symbols whose corresponding sections are garbage collected.
15137 (Symbol_table::Symbol_table): Add new parameter for the garbage
15138 collection object.
15139 (Symbol_table::gc_mark_undef_symbols): New function.
15140 (Symbol_table::gc_mark_symbol_for_shlib): New function.
15141 (Symbol_table::gc_mark_dyn_syms): New function.
15142 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
15143 as garbage.
15144 (Symbol_table::add_from_object): Likewise.
15145 (Symbol_table::add_from_relobj): When building shared objects, do not
15146 treat externally visible symbols as garbage.
15147 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
15148 table information for static and relocatable links.
15149 * symtab.h (Symbol_table::set_gc): New function.
15150 (Symbol_table::gc): New function.
15151 (Symbol_table::gc_mark_undef_symbols): New function.
15152 (Symbol_table::gc_mark_symbol_for_shlib): New function.
15153 (Symbol_table::gc_mark_dyn_syms): New function.
15154 (Symbol_table::gc_): New data member.
15155 * target.h (Sized_target::gc_process_relocs): New pure virtual
15156 function.
15157 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
15158 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
15159
15160 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
15161
15162 * options.h (General_options::gc_sections): Define as a no-op for now.
15163 (General_options::no_keep_memory): Ditto.
15164 (General_options::Bshareable): Define.
15165 * options.cc (General_options::finalize): Honor -Bshareable.
15166
15167 2009-01-20 Andreas Schwab <schwab@suse.de>
15168
15169 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
15170 read the value in the contents, since we don't use it. Use the
15171 template endianness when writing.
15172 (Relocate::relocate): Use it for R_PPC_REL16_HA.
15173
15174 2009-01-19 Andreas Schwab <schwab@suse.de>
15175
15176 * configure.tgt (powerpc64-*): Fix targ_obj.
15177
15178 2009-01-15 Ian Lance Taylor <iant@google.com>
15179
15180 * object.cc (Sized_relobj::write_local_symbols): Don't write out
15181 local symbols when stripping all symbols.
15182
15183 2009-01-14 Cary Coutant <ccoutant@google.com>
15184
15185 * output.cc (Output_reloc): Add explicit instantiations.
15186
15187 2009-01-14 Cary Coutant <ccoutant@google.com>
15188
15189 * archive.cc (Archive::get_elf_object_for_member): Remove call
15190 to File_read::claim_for_plugin.
15191 * descriptors.cc (Descriptors::open): Remove reference to
15192 is_claimed.
15193 (Descriptors::claim_for_plugin): Remove.
15194 * descriptors.h (Descriptors::claim_for_plugin): Remove.
15195 (Descriptors::is_claimed): Remove.
15196 (claim_descriptor_for_plugin): Remove.
15197 * fileread.cc (File_read::claim_for_plugin): Remove.
15198 * fileread.h (File_read::claim_for_plugin): Remove.
15199 (File_read::descriptor): Reopen descriptor if necessary.
15200 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
15201 (Plugin_manager::all_symbols_read): Add task parameter. Change
15202 all callers.
15203 (Plugin_manager::get_input_file): New function.
15204 (Plugin_manager::release_input_file): New function.
15205 (Pluginobj::Pluginobj): Add filesize parameter and initialize
15206 corresponding data member.
15207 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
15208 and pass to base constructor. Change all callers.
15209 (get_input_file, release_input_file): New functions.
15210 (make_sized_plugin_object): Add filesize parameter. Change all callers.
15211 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
15212 (Plugin_manager::all_symbols_read): Add task parameter.
15213 (Plugin_manager::get_input_file): New function.
15214 (Plugin_manager::release_input_file): New function.
15215 (Plugin_manager::task_): New data member.
15216 (Pluginobj::Pluginobj): Add filesize parameter.
15217 (Pluginobj::filename): New function.
15218 (Pluginobj::descriptor): New function.
15219 (Pluginobj::filesize): New function.
15220 (Pluginobj::filesize_): New data member.
15221 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
15222 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
15223 File_read::claim_for_plugin; use Object::unlock to unlock the file.
15224
15225 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
15226 with archive libraries.
15227 * testsuite/Makefile.in: Regenerate.
15228 * testsuite/plugin_test.c (struct sym_info): New type.
15229 (get_input_file, release_input_file): New static variables.
15230 (onload): Capture new transfer vector entries.
15231 (claim_file_hook): Stop reading at end of file according to filesize.
15232 Factor out parsing of readelf output into separate function.
15233 (all_symbols_read_hook): Exercise get_input_file and release_input_file
15234 APIs and get the source file name from the symbol table. Convert
15235 source file name to corresponding object file name. Print info
15236 message when adding new input files.
15237 (parse_readelf_line): New function.
15238 * testsuite/plugin_test_1.sh: Add checks for new info messages.
15239 * testsuite/plugin_test_2.sh: Likewise.
15240 * testsuite/plugin_test_3.sh: Likewise.
15241 * testsuite/plugin_test_4.sh: New test case.
15242
15243 2009-01-07 Ian Lance Taylor <iant@google.com>
15244
15245 * version.cc (version_string): Bump to 1.8.
15246
15247 2008-12-23 Cary Coutant <ccoutant@google.com>
15248
15249 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
15250 * plugin.cc (Plugin_manager::finish): Rename as
15251 layout_deferred_objects. Move cleanup to separate function.
15252 (Plugin_manager::cleanup): New function.
15253 (Plugin_finish::run): Call layout_deferred_objects and cleanup
15254 separately.
15255 * plugin.h (Plugin_manager::finish): Rename as
15256 layout_deferred_objects.
15257 (Plugin_manager::cleanup): New function.
15258 (Plugin_manager::cleanup_done): New field.
15259
15260 2008-12-23 Cary Coutant <ccoutant@google.com>
15261
15262 * plugin.cc (is_visible_from_outside): New function.
15263 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
15264 so we don't return "IR only" status for exported symbols or -r links.
15265
15266 * testsuite/Makefile.am (plugin_test_3): New test case.
15267 * testsuite/Makefile.in: Regenerate.
15268 * testsuite/plugin_test_3.sh: New file.
15269
15270 2008-12-22 Cary Coutant <ccoutant@google.com>
15271
15272 * object.cc (Sized_relobj::layout_section): New function.
15273 (Sized_relobj::do_layout): Defer layout of input sections until after
15274 plugin has provided replacement files.
15275 (Sized_relobj::do_layout_deferred_sections): New function.
15276 * object.h (Relobj::set_section_offset): Remove virtual keyword.
15277 (Relobj::layout_deferred_sections): New function.
15278 (Relobj::do_layout_deferred_sections): New function.
15279 (Sized_relobj::do_layout_deferred_sections): New function.
15280 (Sized_relobj::layout_section): New function.
15281 (Sized_relobj::Deferred_layout): New structure.
15282 (Sized_relobj::deferred_layout_): New field.
15283 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
15284 Change all callers. Layout deferred sections.
15285 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
15286 references.
15287 (Plugin_hook::run): Move code from do_plugin_hook inline.
15288 (Plugin_hook::do_plugin_hook): Remove.
15289 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
15290 (Plugin_manager::finish): Renamed, was cleanup.
15291 (Plugin_manager::should_defer_layout): New function.
15292 (Plugin_manager::add_deferred_layout_object): New function.
15293 (Plugin_manager::Deferred_layout_list): New type.
15294 (Plugin_manager::deferred_layout_objects_): New field.
15295 (Plugin_hook::do_plugin_hook): Remove.
15296
15297 2008-12-17 Ian Lance Taylor <iant@google.com>
15298
15299 * options.h (class General_options): Add --no case for
15300 --export-dynamic.
15301
15302 2008-12-16 Cary Coutant <ccoutant@google.com>
15303
15304 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
15305 vector.
15306 (Plugin_manager::claim_file): Create plugin object even if
15307 plugin did not call the add_symbols callback.
15308 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
15309 asking for more symbols than were added.
15310 * testsuite/Makefile.am (plugin_test_1): Add test case with
15311 no global symbols.
15312 (empty.syms): New target.
15313 * testsuite/Makefile.in: Regenerate.
15314 * testsuite/plugin_test.c (claim_file_hook): Add new debug
15315 message. Don't call add_symbols if no globals.
15316 (all_symbols_read_hook): Don't provide replacement for empty
15317 claimed file.
15318
15319 2008-12-12 Ian Lance Taylor <iant@google.com>
15320
15321 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
15322 r_type == 0 for a local symbol with r_sym == 0.
15323 (scan_relocatable_relocs): Pass r_sym to
15324 local_non_section_strategy.
15325 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
15326 r_sym parameter.
15327
15328 * configure.ac: Update test for TLS descriptors: they are
15329 supported as of glibc 2.9.
15330 * configure: Rebuild.
15331
15332 2008-12-11 Ian Lance Taylor <iant@google.com>
15333
15334 PR 7091
15335 * target-reloc.h (Default_scan_relocatable_relocs): For each
15336 function, map r_type == 0 to RELOC_DISCARD.
15337
15338 2008-12-10 Cary Coutant <ccoutant@google.com>
15339
15340 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
15341 object to override a kept COMDAT group from a plugin object.
15342
15343 2008-12-09 Ian Lance Taylor <iant@google.com>
15344
15345 PR 7088
15346 * yyscript.y (file_cmd): Handle INPUT.
15347
15348 * testsuite/initpri1.c: Change all declarations to be full
15349 prototypes by adding void, to avoid compiler warnings.
15350
15351 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
15352
15353 * options.cc (General_options::parse_plugin_opt): New.
15354 (General_options::add_plugin): The argument now is just the filename.
15355 (General_options::add_plugin_option): New.
15356 * options.h (plugin_opt): New.
15357 (add_plugin): Change argument name.
15358 (add_plugin_option): New.
15359 * plugin.cc (Plugin::load): Don't parse the plugin option.
15360 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
15361 (Plugin::add_option): New.
15362 (Plugin::args_): Change type.
15363 (Plugin::filename_): New.
15364 (Plugin_manager::add_plugin_option): New.
15365 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
15366 * testsuite/Makefile.in: Regenerate.
15367
15368 2008-12-05 Cary Coutant <ccoutant@google.com>
15369
15370 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
15371 Handle --strip-lto-sections option.
15372 * options.h (strip_lto_sections): New option.
15373
15374 2008-12-01 Cary Coutant <ccoutant@google.com>
15375
15376 * plugin.cc (ld_plugin_message): Change format parameter to const.
15377 Fix mismatch between new[] and delete.
15378
15379 2008-11-14 Cary Coutant <ccoutant@google.com>
15380
15381 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
15382 instead of -1U.
15383
15384 2008-11-05 Craig Silverstein <csilvers@google.com>
15385
15386 * options.cc (General_options::parse_dynamic_list): New function.
15387 * options.h (General_options): New flags dynamic_list,
15388 dynamic_list_data, dynamic_list_cpp_new, and
15389 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
15390 (General_options::in_dynamic_list): New function.
15391 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
15392 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
15393 (Lex::can_continue_name): Likewise.
15394 (yylex): Likewise.
15395 (read_script_file): New parameter script_options.
15396 (read_dynamic_list): New function.
15397 (Script_options::define_dynamic_list): New function.
15398 (dynamic_list_keyword_parsecodes): New variable.
15399 (dynamic_list_keywords): New variable.
15400 * script.h (Script_options::define_dynamic_list): New function
15401 prototype.
15402 (read_dynamic_list): New function prototype.
15403 * symtab.cc (strprefix): New macro.
15404 (Symbol::should_add_dynsym_entry): Support dynamic_list,
15405 dynamic_list_data, dynamic_list_cpp_new, and
15406 dynamic_list_cpp_typeinfo.
15407 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
15408 (dynamic_list_expr): New rule.
15409 (dynamic_list_nodes): Likewise.
15410 (dynamic_list_node): Likewise.
15411 * testsuite/Makefile.am (dynamic_list): New test.
15412 * testsuite/Makefile.in: Regenerated.
15413 * testsuite/dynamic_list.t: New file.
15414 * testsuite/dynamic_list.sh: New file.
15415
15416 2008-11-05 Craig Silverstein <csilvers@google.com>
15417
15418 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
15419 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
15420 (t11_last): Likewise.
15421 * testsuite/ver_test_6.c (main): Likewise.
15422
15423 2008-10-07 Cary Coutant <ccoutant@google.com>
15424
15425 * options.c (General_options::finalize): Add check for -static and
15426 -shared.
15427 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
15428 is not empty.
15429
15430 2008-10-02 Cary Coutant <ccoutant@google.com>
15431
15432 * plugin.cc (make_sized_plugin_object): Fix conditional
15433 compilation to work when not all targets are enabled.
15434
15435 2008-09-29 Cary Coutant <ccoutant@google.com>
15436
15437 * archive.cc (Archive::get_file_and_offset): Use filename instead
15438 of name to get library path.
15439 (Archive::include_member): Unlock external member of a thin archive.
15440
15441 * testsuite/Makefile.am (TEST_AR): New variable.
15442 (thin_archive_test_1): New test.
15443 (thin_archive_test_2): New test.
15444 * testsuite/Makefile.in: Regenerate.
15445 * testsuite/thin_archive_main.cc: New file.
15446 * testsuite/thin_archive_test_1.cc: New file.
15447 * testsuite/thin_archive_test_2.cc: New file.
15448 * testsuite/thin_archive_test_3.cc: New file.
15449 * testsuite/thin_archive_test_4.cc: New file.
15450
15451 2008-09-29 Cary Coutant <ccoutant@google.com>
15452
15453 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
15454 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
15455 instead of -1U.
15456 (Sized_relobj::do_finalize_local_symbols): Likewise.
15457 (Sized_relobj::map_to_kept_section): Likewise.
15458 * object.h (Sized_relobj::invalid_address): New constant.
15459 (Sized_relobj::do_output_section_offset): Check for invalid_address
15460 and return -1ULL.
15461 * output.cc (Output_reloc::local_section_offset): Use constant
15462 invalid_address instead of -1U.
15463 (Output_reloc::get_address): Likewise.
15464 (Output_section::output_address): Change -1U to -1ULL.
15465 * output.h (Output_reloc::invalid_address): New constant.
15466 * reloc.cc (Sized_relobj::write_sections): Use constant
15467 invalid_address instead of -1U.
15468 (Sized_relobj::relocate_sections): Likewise.
15469 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
15470 values for merge sections.
15471 * target-reloc.h (relocate_for_relocatable): Use constant
15472 invalid_address instead of -1U.
15473
15474 2008-09-19 Cary Coutant <ccoutant@google.com>
15475
15476 Add plugin functionality for link-time optimization (LTO).
15477 * configure.ac (plugins): Add --enable-plugins option.
15478 * configure: Regenerate.
15479 * config.in: Regenerate.
15480 * Makefile.am (LIBDL): New variable.
15481 (CCFILES): Add plugin.cc.
15482 (HFILES): Add plugin.h.
15483 (ldadd_var): Add LIBDL.
15484 * Makefile.in: Regenerate.
15485
15486 * archive.cc: Include "plugin.h".
15487 (Archive::setup): Don't preread archive symbols when using a plugin.
15488 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
15489 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
15490 files.
15491 (Archive::include_member): Add symbols from plugin objects.
15492 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
15493 * descriptors.cc (Descriptors::open): Check for file descriptors
15494 abandoned by plugins.
15495 (Descriptors::claim_for_plugin): New function.
15496 * descriptors.h (Descriptors::claim_for_plugin): New function.
15497 (Open_descriptor::is_claimed): New field.
15498 (claim_descriptor_for_plugin): New function.
15499 * fileread.cc (File_read::claim_for_plugin): New function.
15500 * fileread.h (File_read::claim_for_plugin): New function.
15501 (File_read::descriptor): New function.
15502 * gold.cc: Include "plugin.h".
15503 (queue_initial_tasks): Add task to call plugin hooks for generating
15504 new object files.
15505 * main.cc: Include "plugin.h".
15506 (main): Load plugin libraries.
15507 * object.h (Pluginobj): Declare.
15508 (Object::pluginobj): New function.
15509 (Object::do_pluginobj): New function.
15510 (Object::set_target): New function.
15511 * options.cc: Include "plugin.h".
15512 (General_options::parse_plugin): New function.
15513 (General_options::General_options): Initialize plugins_ field.
15514 (General_options::add_plugin): New function.
15515 * options.h (Plugin_manager): Declare.
15516 (General_options): Add --plugin option.
15517 (General_options::has_plugins): New function.
15518 (General_options::plugins): New function.
15519 (General_options::add_plugin): New function.
15520 (General_options::plugins_): New field.
15521 * plugin.cc: New file.
15522 * plugin.h: New file.
15523 * readsyms.cc: Include "plugin.h".
15524 (Read_symbols::do_read_symbols): Check for archive before checking
15525 for ELF file. Call plugin hooks to claim files.
15526 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
15527 from a real object file; force override when processing replacement
15528 files.
15529 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
15530 (Symbol::init_base_object): Likewise.
15531 (Symbol::init_base_output_data): Likewise.
15532 (Symbol::init_base_output_segment): Likewise.
15533 (Symbol::init_base_constant): Likewise.
15534 (Symbol::init_base_undefined): Likewise.
15535 (Symbol::output_section): Assert that object is not a plugin.
15536 (Symbol_table::add_from_pluginobj): New function.
15537 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
15538 undefined.
15539 (Symbol_table::sized_write_globals): Likewise.
15540 (Symbol_table::add_from_pluginobj): Instantiate template.
15541 * symtab.h (Sized_pluginobj): Declare.
15542 (Symbol::in_real_elf): New function.
15543 (Symbol::set_in_real_elf): New function.
15544 (Symbol::in_real_elf_): New field.
15545 (Symbol_table::add_from_pluginobj): New function.
15546
15547 * testsuite/Makefile.am (AM_CFLAGS): New variable.
15548 (LIBDL): New variable.
15549 (LDADD): Add LIBDL.
15550 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
15551 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
15552 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
15553 (MOSTLYCLEANFILES): Likewise.
15554 * testsuite/Makefile.in: Regenerate.
15555 * testsuite/plugin_test.c: New file.
15556 * testsuite/plugin_test_1.sh: New file.
15557 * testsuite/plugin_test_2.sh: New file.
15558
15559 2008-09-16 Ian Lance Taylor <iant@google.com>
15560
15561 * target-reloc.h (relocate_section): Check whether a symbol is
15562 defined by the ABI before reporting an undefined symbol error.
15563 * target.h (Target::is_defined_by_abi): Make parameter const.
15564 (Target::do_is_defined_by_abi): Likewise.
15565 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
15566 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
15567 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
15568 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
15569 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
15570 * testsuite/Makefile.in: Rebuild.
15571
15572 * fileread.cc (make_view): Add casts to avoid warning.
15573
15574 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
15575
15576 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
15577 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15578
15579 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
15580
15581 * options.h (General_options::output_is_executable): New.
15582 (General_options::output_is_pie): New.
15583 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
15584 for shared libraries.
15585 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15586
15587 2008-09-11 Chris Demetriou <cgd@google.com>
15588
15589 * options.h (origin): New -z option.
15590 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
15591 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
15592 in DT_FLAGS_1.
15593
15594 2008-09-05 Cary Coutant <ccoutant@google.com>
15595
15596 * fileread.cc (File_read::make_view): Add check for attempt to map
15597 beyond end of file.
15598
15599 2008-09-05 Cary Coutant <ccoutant@google.com>
15600
15601 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
15602 explicit instantiations.
15603
15604 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
15605
15606 PR gold/6858
15607 * options.cc (General_options::finalize): Allow undefined symbols
15608 in shlibs if linking -shared.
15609
15610 PR gold/6859
15611 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
15612 symbols as not needing a dynsym entry.
15613
15614 2008-08-20 Craig Silverstein <csilvers@google.com>
15615
15616 * fileread.cc (File_read::open): Do not lock the file unless it
15617 was successfully opened.
15618
15619 2008-08-14 Cary Coutant <ccoutant@google.com>
15620
15621 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
15622 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
15623 * testsuite/tls_test.cc (struct int128): 128-bit struct
15624 for testing TLS relocs with non-zero addend.
15625 (v12): New TLS variable.
15626 (t12): New test.
15627 (t_last): Add check for v12.
15628 * testsuite/tls_test.h (t12): New function.
15629 * testsuite/tls_test_main.cc (thread_routine): Call new test.
15630
15631 2008-08-13 Ian Lance Taylor <iant@google.com>
15632
15633 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
15634 set tls_segment_ or relro_segment_.
15635 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
15636 when appropriate.
15637 * output.h (Output_section::clear_is_relro): New function.
15638 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
15639 sections specially even when output_data_ is empty.
15640 (Output_segment::maximum_alignment): When first section is relro,
15641 only force alignment for PT_LOAD segments.
15642 * script.cc (script_data_segment_align): New function.
15643 (script_data_segment_relro_end): New function.
15644 * script-c.h (script_data_segment_align): Declare.
15645 (script_data_segment_relro_end): Declare.
15646 * script-sections.h (class Script_sections): Declare
15647 data_segment_align and data_segment_relro_end. Add fields
15648 segment_align_index_ and saw_relro_end_.
15649 * script-sections.cc (class Sections_element): Add set_is_relro
15650 virtual function. Add new bool* parameter to place_orphan_here.
15651 Add get_output_section virtual function.
15652 (class Output_section_definition): Add set_is_relro. Add new
15653 bool* parameter to place_orphan_here. Add get_output_section.
15654 Add is_relro_ field.
15655 (Output_section_definition::Output_section_definition): Initialize
15656 evaluated_address_, evaluated_load_address, evaluated_addralign_,
15657 and is_relro_ fields.
15658 (Output_section_definition::place_orphan_here): Add is_relro
15659 parameter.
15660 (Output_section_definition::set_section_addresses): Set relro for
15661 output section.
15662 (Output_section_definition::alternate_constraint): Likewise.
15663 (class Orphan_output_section): Add new bool* parameter to
15664 place_orphan_here. Add get_output_section.
15665 (Orphan_output_section::place_orphan_here): Add is_relro
15666 parameter.
15667 (Script_sections::Script_sections): Initialize
15668 data_segment_align_index_ and saw_relro_end_.
15669 (Script_sections::data_segment_align): New function.
15670 (Script_sections::data_segment_relro_end): New function.
15671 (Script_sections::place_orphan): Set or clear is_relro.
15672 (Script_sections::set_section_addresses): Force alignment of first
15673 TLS section.
15674 * yyscript.y (exp): Call script_data_segment_align and
15675 script_data_segment_relro_end.
15676 * testsuite/relro_script_test.t: New file.
15677 * testsuite/relro_test.cc (using_script): Declare.
15678 (t1, t2): Test using_script.
15679 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
15680 (relro_script_test_SOURCES): Define.
15681 (relro_script_test_DEPENDENCIES): Define.
15682 (relro_script_test_LDFLAGS): Define.
15683 (relro_script_test_LDADD): Define.
15684 (relro_script_test.so): New target.
15685 * testsuite/Makefile.in: Rebuild.
15686
15687 2008-08-06 Cary Coutant <ccoutant@google.com>
15688
15689 * archive.cc (Archive::total_archives, Archive::total_members)
15690 (Archive::total_members_loaded): New variables.
15691 (Archive::setup): Add parameter. Add option to preread
15692 archive symbols.
15693 (Archive::read_armap): Add counter.
15694 (Archive::get_file_and_offset): New function.
15695 (Archive::get_elf_object_for_member): New function.
15696 (Archive::read_all_symbols): New function.
15697 (Archive::read_symbols): New function.
15698 (Archive::add_symbols): Add counters.
15699 (Archive::include_all_members): Use armap to find members if it's
15700 already built.
15701 (Archive::include_member): Skip reading symbols if already read.
15702 Factored code into Archive::get_file_and_offset and
15703 Archive::get_elf_object_for_member. Changed call to
15704 Mapfile::report_include_archive_member.
15705 (Archive::print_stats): New function.
15706 * archive.h: Declare Object and Read_symbols_data classes.
15707 (Archive::Archive): Add initializers for new members.
15708 (Archive::setup): Add parameter.
15709 (Archive::print_stats): New function.
15710 (Archive::total_archives, Archive::total_members)
15711 (Archive::total_members_loaded): New variables.
15712 (Archive::get_file_and_offset): New function.
15713 (Archive::get_elf_object_for_member): New function.
15714 (Archive::read_all_symbols): New function.
15715 (Archive::read_symbols): New function.
15716 (Archive::Archive_member): New class.
15717 (Archive::members_): New member.
15718 (Archive::num_members_): New member.
15719 * main.cc: Include archive.h.
15720 (main): Call Archive::print_stats.
15721 * mapfile.cc (Mapfile::report_include_archive_member): Delete
15722 archive parameter; member_name is now the fully-decorated name.
15723 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
15724 * options.h: (General_options): Add --preread-archive-symbols option.
15725 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
15726 Archive::setup.
15727
15728 2008-08-04 Ian Lance Taylor <iant@google.com>
15729
15730 * symtab.h (Symbol::use_plt_offset): New function.
15731 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
15732 * powerpc.cc (Relocate::relocate): Likewise.
15733 * sparc.cc (Relocate::relocate): Likewise.
15734 * x86_64.cc (Relocate::relocate): Likewise.
15735 * testsuite/weak_plt.sh: New test.
15736 * testsuite/weak_plt_main.cc: New test.
15737 * testsuite/weak_plt_shared.cc: New test.
15738 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
15739 (check_PROGRAMS): Add weak_plt.
15740 (check_DATA): Add weak_plt_shared.so.
15741 (weak_plt_main_pic.o, weak_plt): New targets.
15742 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
15743 * testsuite/Makefile.in: Rebuild.
15744
15745 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
15746 gcctestdir/ld.
15747 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
15748 * testsuite/Makefile.in: Rebuild.
15749
15750 2008-08-04 Alan Modra <amodra@bigpond.net.au>
15751
15752 * Makefile.am (POTFILES.in): Set LC_ALL=C.
15753 * Makefile.in: Regenerate.
15754 * po/POTFILES.in: Regenerate.
15755
15756 2008-07-29 Ian Lance Taylor <iant@google.com>
15757
15758 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
15759 symbols before other symbols.
15760 * testsuite/script_test_2.cc (test_addr): Declare.
15761 (test_addr_alias): Declare.
15762 (main): Check that test_addr and test_addr_alias have the right
15763 values.
15764 * testsuite/script_test_2.t: Define test_addr_alias and
15765 test_addr.
15766
15767 2008-07-24 Ian Lance Taylor <iant@google.com>
15768
15769 PR 5990
15770 * descriptors.cc: New file.
15771 * descriptors.h: New file.
15772 * gold-threads.h (class Hold_optional_lock): New class.
15773 * fileread.cc: Include "descriptors.h".
15774 (File_read::~File_read): Release descriptor rather than closing
15775 it.
15776 (File_read::open) [file]: Call open_descriptor rather than open.
15777 Set is_descriptor_opened_.
15778 (File_read::open) [memory]: Assert that descriptor is not open.
15779 (File_read::reopen_descriptor): New function.
15780 (File_read::release): Release descriptor.
15781 (File_read::do_read): Make non-const. Reopen descriptor.
15782 (File_read::read): Make non-const.
15783 (File_read::make_view): Reopen descriptor.
15784 (File_read::do_readv): Likewise.
15785 * fileread.h (class File_read): Add is_descriptor_opened_ field.
15786 Update declarations.
15787 * layout.cc: Include "descriptors.h".
15788 (Layout::create_build_id): Use open_descriptor rather than open.
15789 * output.cc: Include "descriptors.h".
15790 (Output_file::open): Use open_descriptor rather than open.
15791 * archive.cc (Archive::const_iterator): Change Archive to be
15792 non-const.
15793 (Archive::begin, Archive::end): Make non-const.
15794 (Archive::count_members): Likewise.
15795 * archive.h (class Archive): Update declarations.
15796 * object.h (Object::read): Make non-const.
15797 * Makefile.am (CCFILES): Add descriptors.cc.
15798 (HFILES): Add descriptors.h.
15799 * Makefile.in: Rebuild.
15800
15801 PR 6716
15802 * gold.h: Always include <clocale>. Add Solaris workarounds
15803 following code in binutils/sysdep.h.
15804
15805 PR 6048
15806 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
15807 this->eh_frame_hdr_ is NULL before using it.
15808
15809 * dynobj.cc (Versions::Versions): Update comment.
15810
15811 * dynobj.cc (Versions::Versions): If there is an soname, use it as
15812 the base version name.
15813
15814 * stringpool.cc (Stringpool_template::add_with_length): Set key to
15815 array size plus one.
15816 (Stringpool_template::set_string_offsets): Subtract one from key
15817 before using it as an array index.
15818 (Stringpool_template::get_offset_with_length): Likewise.
15819 (Stringpool_template::write_to_buffer): Likewise.
15820 * stringpool.h (Stringpool_template::get_offset_from_key):
15821 Likewise.
15822
15823 2008-07-23 Ian Lance Taylor <iant@google.com>
15824
15825 PR 6658
15826 * object.h (Merged_symbol_value::value): Do our best to handle a
15827 negative addend.
15828
15829 PR 6647
15830 * script.cc (Version_script_info::get_versions): Don't add empty
15831 version tag to return value.
15832 (Version_script_info::get_symbol_version_helper): Change return
15833 type to bool. Add pversion parameter. Change all callers.
15834 (script_register_vers_node): Don't require a non-NULL tag.
15835 * script.h (class Version_script_info): Update declarations.
15836 (Version_script_info::get_symbol_version): Change return type to
15837 bool. Add version parameter. Change all callers.
15838 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
15839 handling. Handle an empty version from a version script.
15840 (Symbol_table::define_special_symbol): Likewise.
15841 * testsuite/ver_test_10.script: New file.
15842 * testsuite/ver_test_10.sh: New file.
15843 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
15844 (check_DATA): Add ver_test_10.syms.
15845 (ver_test_10.syms, ver_test_10.so): New target.
15846 * testsuite/Makefile.in: Rebuild.
15847
15848 2008-07-23 Simon Baldwin <simonb@google.com>
15849
15850 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
15851 to zero for undefined symbols from dynamic libraries.
15852
15853 2008-07-23 Ian Lance Taylor <iant@google.com>
15854
15855 * symtab.cc (Symbol_table::resolve): Remove version parameter.
15856 Change all callers.
15857 * symtab.h (class Symbol_table): Update declaration.
15858 * testsuite/ver_test_9.cc: New file.
15859 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
15860 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
15861 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
15862 (ver_test_9.so, ver_test_9.o): New targets.
15863 * testsuite/Makefile.in: Rebuild.
15864
15865 2008-07-22 Ian Lance Taylor <iant@google.com>
15866
15867 * options.h (class General_options): Define --check-sections.
15868 * layout.cc (Layout::set_segment_offsets): Handle
15869 --check-sections.
15870
15871 * options.h (class General_options): Define -n/--nmagic and
15872 -N/--omagic.
15873 * options.cc (General_options::finalize): For -n/--nmagic or
15874 -N/--omagic, set -static.
15875 * layout.cc (Layout::attach_allocated_section_to_segment): If
15876 -N/--omagic, don't put read-only and read-write sections in
15877 different segments.
15878 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
15879 finding a read-only segment.
15880 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
15881 don't set the minimum segment alignment to the common page size,
15882 and don't set the file offset to the address modulo the page size.
15883 * script-sections.cc (Script_sections::create_segments): If
15884 -n/--omagic, don't put read-only and read-write sections in
15885 different segments.
15886
15887 * cref.cc: New file.
15888 * cref.h: New file.
15889 * options.h (class General_options): Add --print-symbol-counts.
15890 * main.cc (main): Issue defined symbol report if requested.
15891 * archive.cc (Archive::interpret_header): Make into a const member
15892 function.
15893 (Archive::add_symbols): Call Input_objects::archive_start and
15894 archive_stop.
15895 (Archive::const_iterator): Define new class.
15896 (Archive::begin, Archive::end): New functions.
15897 (Archive::include_all_members): Rewrite to use iterator.
15898 (Archive::count_members): New function.
15899 * archive.h (class Archive): Update declarations.
15900 (Archive::filename): New function.
15901 * object.cc: Include "cref.h".
15902 (Sized_relobj::Sized_relobj): Initialize defined_count_.
15903 (Sized_relobj::do_get_global_symbol_counts): New function.
15904 (Input_objects::add_object): Add object to cross-referencer.
15905 (Input_objects::archive_start): New function.
15906 (Input_objects::archive_stop): New function.
15907 (Input_objects::print_symbol_counts): New function.
15908 * object.h: Declare Cref and Archive.
15909 (Object::get_global_symbol_counts): New function.
15910 (Object::do_get_global_symbol_counts): New pure virtual function.
15911 (class Sized_relobj): Add defined_count_ field. Update
15912 declarations.
15913 (class Input_objects): Add cref_ field. Update constructor.
15914 Update declarations.
15915 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
15916 defined_count_.
15917 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
15918 symbol counts.
15919 (Sized_dynobj::do_get_global_symbol_counts): New function.
15920 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
15921 defined_count_. Update declarations. Define Symbols typedef.
15922 * symtab.cc (Symbol_table::add_from_relobj): Add defined
15923 parameter. Change all callers.
15924 (Symbol_table::add_from_dynobj): Add sympointers and defined
15925 parameters. Change all callers.
15926 * symtab.h (class Symbol_table): Update declarations.
15927 * Makefile.am (CCFILES): Add cref.cc.
15928 (HFILES): Add cref.h.
15929 * Makefile.in: Rebuild.
15930
15931 2008-07-22 Simon Baldwin <simonb@google.com>
15932
15933 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
15934 to zero when writing undefined symbols.
15935
15936 2008-07-22 Ian Lance Taylor <iant@google.com>
15937
15938 * output.cc (Output_section::add_input_section): Don't try to
15939 merge empty merge sections.
15940
15941 2008-07-21 Craig Silverstein <csilvers@google.com>
15942
15943 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15944 Include symbol version in error message.
15945
15946 2008-07-20 Chris Demetriou <cgd@google.com>
15947
15948 * configure.ac (gold_cv_c_random_seed): New configured variable.
15949 (RANDOM_SEED_CFLAGS): New substituted variable.
15950 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
15951 * configure: Rebuild.
15952 * Makefile.in: Likewise.
15953 * testsuite/Makefile.in: Likewise.
15954
15955 2008-07-18 Ian Lance Taylor <iant@google.com>
15956
15957 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
15958 where we see NAME/NULL and NAME/VERSION as separate symbols.
15959 * testsuite/ver_test_main.cc (main): Call t4.
15960 (t4, t4_2a): Define.
15961 * testsuite/ver_test_2.cc (t4_2): Define.
15962 * testsuite/ver_test_2.script: Put t4_2a in VER2.
15963 * testsuite/ver_test_4.cc (t4_2a): Define.
15964 * testsuite/ver_test_4.script: Put t4_2a in VER2.
15965 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
15966
15967 2008-07-17 Ian Lance Taylor <iant@google.com>
15968
15969 * dynobj.cc (Versions::add_def): If we give an error about a
15970 missing version, go ahead and create the version anyhow.
15971
15972 2008-07-10 Ian Lance Taylor <iant@google.com>
15973
15974 Handle output sections with more than 0x7fffffff bytes.
15975 * object.h (class Relobj): Change map_to_output_ to
15976 output_sections_, and just keep a section pointer. Change all
15977 uses. Move comdat group support to Sized_relobj.
15978 (Relobj::is_section_specially_mapped): Remove.
15979 (Relobj::output_section): Remove poff parameter. Change all
15980 callers.
15981 (Relobj::output_section_offset): New function.
15982 (Relobj::set_section_offset): Rewrite.
15983 (Relobj::map_to_output): Remove.
15984 (Relobj::output_sections): New function.
15985 (Relobj::do_output_section_offset): New pure virtual function.
15986 (Relobj::do_set_section_offset): Likewise.
15987 (class Sized_relobj): Add section_offsets_ field. Add comdat
15988 group support from Relobj. Update declarations.
15989 (Sized_relobj::get_output_section_offset): New function.
15990 (Sized_relobj::do_output_section_offset): New function.
15991 (Sized_relobj::do_set_section_offset): New function.
15992 * object.cc (Relobj::output_section_address): Remove.
15993 (Sized_relobj::Sized_relobj): Initialize new fields.
15994 (Sized_relobj::include_section_group): Cast find_kept_object to
15995 Sized_relobj.
15996 (Sized_relobj::include_linkonce_section): Likewise.
15997 (Sized_relobj::do_layout): Use separate arrays for output section
15998 and output offset.
15999 (Sized_relobj::do_count_local_symbols): Change map_to_output to
16000 output_sections.
16001 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
16002 output_sections and section_offsets.
16003 (Sized_relobj::write_local_symbols): Likewise.
16004 (map_to_kept_section): Compute output address directly.
16005 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
16006 output_sections and section_offsets.
16007 (Sized_relobj::write_sections): Likewise.
16008 (Sized_relobj::relocate_sections): Likewise.
16009 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
16010 * output.h (class Output_reloc): Update declarations. Change
16011 u2_.relobj to Sized_relobj*.
16012 (class Output_data_reloc): Change add functions to use
16013 Sized_relobj*.
16014 * output.cc (Output_reloc::Output_reloc): Change relobj to
16015 Sized_relobj*.
16016 (Output_reloc::local_section_offset): Change return type to
16017 Elf_Addr. Use get_output_section_offset.
16018 (Output_reloc::get_address): Likewise.
16019 (Output_section::is_input_address_mapped): Don't call
16020 is_section_specially_mapped.
16021 (Output_section::output_offset): Likewise.
16022 (Output_section::output_address): Likewise.
16023 (Output_section::starting_output_address): Likewise.
16024 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
16025 parameter to Sized_relobj*.
16026 (Copy_relocs::need_copy_reloc): Likewise.
16027 (Copy_relocs::save): Likewise.
16028 * copy-relocs.h (class Copy_relocs): Update declarations.
16029 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
16030 Sized_relobj*. Change relobj_ field to Sized_relobj*.
16031 * target-reloc.h (relocate_for_relocatable): Change
16032 offset_in_output_section type to Elf_Addr. Change code that uses
16033 it as well.
16034 * layout.cc (Layout::layout): Always set *off.
16035 * mapfile.cc (Mapfile::print_input_section): Use
16036 output_section_offset.
16037 * i386.cc (Target_i386::copy_reloc): Change object parameter to
16038 Sized_relobj*.
16039 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
16040 * sparc.cc (Target_sparc::copy_reloc): Likewise.
16041 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
16042
16043 2008-07-03 Ian Lance Taylor <iant@google.com>
16044
16045 * layout.cc (Layout::include_section): Do not discard unrecognized
16046 SHT_STRTAB sections.
16047
16048 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
16049
16050 * script.cc (Lex::can_continue_name): Make '?' allowable in
16051 version-script names.
16052 * testsuite/version_script.map: Change glob pattern to use '?'
16053
16054 2008-06-30 Manish Singh <yosh@gimp.org>
16055
16056 PR 6585
16057 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
16058 Correct typo.
16059
16060 2008-06-30 Ian Lance Taylor <iant@google.com>
16061
16062 PR 6660
16063 PR 6682
16064 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
16065 versions]: Don't try to read the value in the contents, since we
16066 don't use it. Use the template endianness when writing.
16067
16068 2008-06-25 Cary Coutant <ccoutant@google.com>
16069
16070 * fileread.cc (File_read::make_view): Assert on zero-length view.
16071 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
16072 symbol table when there are no symbols to read.
16073
16074 2008-06-23 Craig Silverstein <csilvers@google.com>
16075
16076 * version.cc (version_string): Bump to 1.7
16077
16078 2008-06-18 Craig Silverstein <csilvers@google.com>
16079
16080 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
16081 constant 0xFFFF to type Valtype.
16082 (Powerpc_relocate_functions::rel16_ha): Likewise.
16083
16084 2008-06-17 Ian Lance Taylor <iant@google.com>
16085
16086 * output.h (Output_section::Input_section): Initialize p2align_ to
16087 zero for Output_section_data constructors.
16088 (Output_section::Input_section::addralign): If not an input
16089 section, return the alignment of the Output_section_data.
16090 * testsuite/copy_test.cc: New file.
16091 * testsuite/copy_test_1.cc: New file.
16092 * testsuite/copy_test_2.cc: New file.
16093 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
16094 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
16095 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
16096 (copy_test_1_pic.o, copy_test_1.so): New targets.
16097 (copy_test_2_pic.o, copy_test_2.so): New targets.
16098 * testsuite/Makefile.in: Rebuild.
16099
16100 * script-sections.cc (Script_sections::place_orphan): Initialize
16101 local variable exact.
16102
16103 2008-06-13 David Edelsohn <edelsohn@gnu.org>
16104
16105 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
16106
16107 2008-06-12 David Edelsohn <edelsohn@gnu.org>
16108 David S. Miller <davem@davemloft.net>
16109
16110 * powerpc.cc: New file.
16111 * Makefile.am (TARGETSOURCES): Add powerpc.cc
16112 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
16113 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
16114 * Makefile.in: Rebuild.
16115
16116 2008-06-09 Ian Lance Taylor <iant@google.com>
16117
16118 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
16119 <exception>.
16120 (throwing, orig_terminate): New static variables.
16121 (terminate_handler): New static function.
16122 (t2): Set terminate handler.
16123
16124 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
16125
16126 PR 6584
16127 * binary.cc (Binary_to_elf::sized_convert): Fix .data
16128 alignment.
16129
16130 2008-05-30 Cary Coutant <ccoutant@google.com>
16131
16132 * archive.cc (Archive::include_all_members) Correct to step
16133 over symbol table and extended name table in thin archives.
16134
16135 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
16136
16137 PR 6407
16138 * target-reloc.h (relocate_for_relocatable): Fix new_offset
16139 calculation.
16140
16141 2008-05-28 Caleb Howe <cshowe@google.com>
16142
16143 * reduced_debug_output.cc: New file.
16144 * reduced_debug_output.h: New file.
16145 * options.h (class General_options): Add --strip-debug-non-line.
16146 * options.cc (General_options::finalize): Add strip_debug_non_line
16147 to the strip heirarchy.
16148 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
16149 fields.
16150 * layout.cc: Include "reduced_debug_output.h".
16151 (Layout::Layout): Initialize new fields.
16152 (line_only_debug_sections): New static array.
16153 (is_lines_only_debug_sections): New static inline function.
16154 (Layout::include_section): Handle --strip-debug-non-line.
16155 (Layout::make_output_section): If --strip-debug-non-line, build
16156 new output sections for .debug_abbrev and .debug_info.
16157 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
16158 gold. Warn about possible overflow.
16159 (read_signed_LEB_128): Likewise.
16160 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
16161 (read_signed_LEB_128): Declare.
16162 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
16163 (HFILES): Add reduced_debug_output.h.
16164 * Makefile.in: Rebuild.
16165
16166 2008-05-21 Ian Lance Taylor <iant@google.com>
16167
16168 * mapfile.cc: New file.
16169 * mapfile.h: New file.
16170 * options.h (class General_options): Add -M/--print-map and -Map.
16171 * options.cc (General_options::finalize): Make -M equivalent to
16172 -Map -.
16173 * main.cc: Include <cstdio> and "mapfile.h".
16174 (main): Open mapfile if requested.
16175 * gold.cc (class Middle_runner): Add mapfile_ field. Update
16176 constructor. Change caller.
16177 (queue_initial_tasks): Add mapfile parameter. Change caller.
16178 (queue_middle_tasks): Likewise.
16179 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
16180 declarations.
16181 * archive.cc: Include "mapfile.h".
16182 (Archive::add_symbols): Add mapfile parameter. Change all
16183 callers. Pass mapfile, symbol, and reason to include_member.
16184 (Archive::include_all_members): Add mapfile parameter. Change all
16185 callers.
16186 (Archive::include_member): Add mapfile, sym, and why parameters.
16187 Change all callers. Report inclusion to map file.
16188 * archive.h: Include "fileread.h".
16189 (class Archive): Update declarations.
16190 (Archive::file): New const method.
16191 (class Add_archive_symbols): Add mapfile_ field. Update
16192 constructor. Change all callers.
16193 * readsyms.h (class Read_symbols): Likewise.
16194 (class Finish_group): Likewise.
16195 (class Read_script): Likewise.
16196 * common.cc: Include "mapfile.h".
16197 (Symbol_table::allocate_commons): Add mapfile parameter. Change
16198 all callers.
16199 (Symbol_table::do_allocate_commons): Likewise.
16200 (Symbol_table::do_allocate_commons_list): Likewise. Report common
16201 symbol allocation to mapfile.
16202 * common.h (class Allocate_commons_task): Add mapfile_ field.
16203 Update constructor. Change all callers.
16204 * symtab.h (class Symbol_table): Update declarations.
16205 * layout.cc: Include "mapfile.h".
16206 (Layout_task_runner::run): Print information to mapfile.
16207 (Layout::create_gold_note): Change Output_data_fixed_space to
16208 Output_data_zero_fill.
16209 (Layout::create_build_id): Likewise.
16210 (Layout::print_to_mapfile): New function.
16211 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
16212 constructor. Change caller.
16213 (class Layout): Declare print_to_mapfile.
16214 * output.cc (Output_section::Input_section::print_to_mapfile): New
16215 function.
16216 (Output_section::add_input_section): If producing a map, always
16217 add to input_sections_ list.
16218 (Output_section::do_print_to_mapfile): New function.
16219 (Output_segment::print_sections_to_mapfile): New function.
16220 (Output_segment::print_section_list_to_mapfile): New function.
16221 * output.h: Include "mapfile.h".
16222 (Output_data::print_to_mapfile): New function.
16223 (Output_data::do_print_to_mapfile): New virtual function.
16224 (Output_segment_headers::do_print_to_mapfile): New function.
16225 (Output_file_header::do_print_to_mapfile): New function.
16226 (Output_data_const::do_print_to_mapfile): New function.
16227 (class Output_data_const_buffer): Add map_name_ field. Update
16228 constructor. Change all callers. Add do_print_to_mapfile
16229 function.
16230 (class Output_data_fixed_space): Likewise.
16231 (class Output_data_space): Likewise.
16232 (class Output_data_zero_fill): New class.
16233 (Output_data_strtab::do_print_to_mapfile): New function.
16234 (Output_data_reloc_base::do_print_to_mapfile): New function.
16235 (Output_relocatable_relocs::do_print_to_mapfile): New function.
16236 (Output_data_group::do_print_to_mapfile): New function.
16237 (Output_data_got::do_print_to_mapfile): New function.
16238 (Output_data_dynamic::do_print_to_mapfile): New function.
16239 (Output_symtab_xindex::do_print_to_mapfile): New function.
16240 (class Output_section): Declare do_print_to_mapflie. Declare
16241 print_to_mapfile in Input_section.
16242 (class Output_segment): Declare new functions.
16243 * object.h (Sized_relobj::symbol_count): New function.
16244 * script-sections.cc
16245 (Output_section_element_dot_assignment::set_section_addresses):
16246 Change Output_data_fixed_space to Output_data_zero_fill.
16247 (Output_data_expression::do_print_to_mapfile): New function.
16248 * script.cc (read_input_script): Add mapfile parameter. Change
16249 all callers.
16250 * script.h (read_input_script): Update declaration.
16251 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
16252 (Eh_frame::do_print_to_mapfile): New function.
16253 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
16254 (Output_merge_string::do_print_to_mapfile): New function.
16255 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
16256 function.
16257 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
16258 function.
16259 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
16260 function.
16261 * Makefile.am (CCFILES): Add mapfile.cc.
16262 (HFILES): Add mapfile.h.
16263 * Makefile.in: Rebuild.
16264
16265 2008-05-19 Ian Lance Taylor <iant@google.com>
16266
16267 * options.h (class General_options): Add -z relro.
16268 * layout.cc (Layout::Layout): Initialize relro_segment_.
16269 (Layout::add_output_section_data): Return the output section.
16270 (Layout::make_output_section): Rcognize relro sections and mark
16271 them appropriately.
16272 (Layout::attach_allocated_section_to_segment): Put relro sections
16273 in a PT_GNU_RELRO segment.
16274 (Layout::create_initial_dynamic_sections): Mark the .dynamic
16275 section as relro.
16276 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
16277 PT_TLS segments.
16278 (Layout::linkonce_mapping): Map d.rel.ro.local to
16279 .data.rel.ro.local.
16280 (Layout::output_section_name): Us .data.rel.ro.local for any
16281 section which begins with that.
16282 * layout.h (class Layout): Update add_output_section_data
16283 declaration. Add relro_segment_ field.
16284 * output.cc (Output_section::Output_section): Initialize is_relro_
16285 and is_relro_local_ fields.
16286 (Output_segment::add_output_section): Group relro sections.
16287 (Output_segment::is_first_section_relro): New function.
16288 (Output_segment::maximum_alignment): If there is a relro section,
16289 align the segment to the common page size.
16290 (Output_segment::set_section_addresses): Track whether we are
16291 looking at relro sections. If the last section is a relro
16292 section, align to the common page size.
16293 (Output_segment::set_section_list_addresses): Add in_relro
16294 parameter. Change all callers. Align to the page size when
16295 moving from relro to non-relro section.
16296 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
16297 segment.
16298 * output.h (class Output_section): Add is_relro_ and
16299 is_relro_local_ fields.
16300 (Output_section::is_relro): New function.
16301 (Output_section::set_is_relro): New function.
16302 (Output_section::is_relro_local): New function.
16303 (Output_section::set_is_relro_local): New function.
16304 (class Output_segment): Update declarations.
16305 * i386.cc (Target_i386::got_section): Mark .got section as relro.
16306 * sparc.cc (Target_sparc::got_section): Likewise.
16307 * x86_64.cc (Target_x86_64::got_section): Likewise.
16308 * testsuite/relro_test_main.cc: New file.
16309 * testsuite/relro_test.cc: New file.
16310 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
16311 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
16312 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
16313 (relro_test.so, relro_test_pic.o): New targets.
16314 * testsuite/Makefile.in: Rebuild.
16315
16316 2008-05-16 Ian Lance Taylor <iant@google.com>
16317
16318 * output.cc (Output_segment::add_output_section): Remove front
16319 parameter.
16320 * output.h (class Output_segment): Remove
16321 add_initial_output_section and overloaded add_output_section.
16322 Update declaration of remaining add_output_section.
16323 * layout.cc (Layout::create_interp): Call add_output_section
16324 rather than add_initial_output_section.
16325 (Layout::finish_dynamic_section): Likewise.
16326
16327 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
16328 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
16329 know the dynamic type.
16330 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
16331 field. Initialize it in constructor.
16332 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
16333 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
16334 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
16335 reloc.
16336
16337 * output.cc (Output_reloc::get_address): Change return type to
16338 Elf_Addr.
16339 * output.h (class Output_reloc): Update get_address declaration.
16340 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
16341 for section addresses.
16342
16343 2008-05-09 Ian Lance Taylor <iant@google.com>
16344
16345 PR 6493
16346 * gold.cc (gold_nomem): Use return value of write.
16347
16348 2008-05-08 Ian Lance Taylor <iant@google.com>
16349
16350 * symtab.c (Symbol::init_base_output_data): Add version
16351 parameter. Change all callers.
16352 (Symbol::init_base_output_segment): Likewise.
16353 (Symbol::init_base_constant): Likewise.
16354 (Symbol::init_base_undefined): Likewise.
16355 (Sized_symbol::init_output_data): Likewise.
16356 (Sized_symbol::init_output_segment): Likewise.
16357 (Sized_symbol::init_constant): Likewise.
16358 (Sized_symbol::init_undefined): Likewise.
16359 (Symbol_table::do_define_in_output_data): If the new symbol has a
16360 version, mark it as the default.
16361 (Symbol_table::do_define_in_output_segment): Likewise.
16362 (Symbol_table::do_define_as_constant): Likewise.
16363 * symtab.h (class Symbol): Update declarations.
16364 (class Sized_symbol): Likewise.
16365 * resolve.cc (Symbol::override_version): New function.
16366 (Symbol::override_base): Call override_version.
16367 (Symbol::override_base_with_special): Likewise.
16368 * testsuite/ver_script_8.script: New file.
16369 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
16370 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
16371 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
16372 (ver_test_8_1.so, ver_test_8_2.so): New targets.
16373
16374 2008-05-06 Ian Lance Taylor <iant@google.com>
16375
16376 PR 6049
16377 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
16378 functions.
16379 (class General_options): Remove existing --undefined, and add
16380 --no-undefined instead. Add new --undefined as synonym for -u.
16381 * archive.cc (Archive::add_symbols): Check whether symbol was
16382 named with -u.
16383 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
16384 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
16385 all uses. Add IS_UNDEFINED. Update declarations to split
16386 different versions of init_base. Declare init_base_undefined.
16387 (Symbol::is_defined): Handle IS_UNDEFINED.
16388 (Symbol::is_undefined): Likewise.
16389 (Symbol::is_weak_undefined): Call is_undefined.
16390 (Symbol::is_absolute): Handle IS_CONSTANT.
16391 (class Sized_symbol): Update declarations to split different
16392 versions of init. Declare init_undefined.
16393 (class Symbol_table): Declare new functions.
16394 * symtab.cc (Symbol::init_base_object): Rename from init_base.
16395 Change all callers.
16396 (Symbol::init_base_output_data): Likewise.
16397 (Symbol::init_base_output_segment): Likewise.
16398 (Symbol::init_base_constant): Likewise.
16399 (Symbol::init_base_undefined): New function.
16400 (Sized_symbol::init_object): Rename from init. Change all
16401 callers.
16402 (Sized_symbol::init_output_data): Likewise.
16403 (Sized_symbol::init_output_segment): Likewise.
16404 (Sized_symbol::init_constant): Likewise.
16405 (Sized_symbol::init_undefined): New function.
16406 (Symbol_table::add_undefined_symbols_from_command_line): New
16407 function.
16408 (Symbol_table::do_add_undefined_symbols_from_command_line): New
16409 function.
16410 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
16411 (Symbol::output_section): Likewise.
16412 (Symbol::set_output_section): Likewise.
16413 (Symbol_table::sized_finalize_symbol): Likewise.
16414 (Symbol_table::sized_write_globals): Likewise.
16415 * resolve.cc (Symbol_table::should_override): Likewise.
16416 (Symbol::override_base_with_special): Likewise.
16417
16418 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
16419 symbol, change it to have default visibility.
16420 * testsuite/protected_1.cc: New file.
16421 * testsuite/protected_2.cc: New file.
16422 * testsuite/protected_3.cc: New file.
16423 * testsuite/protected_main_1.cc: New file.
16424 * testsuite/protected_main_2.cc: New file.
16425 * testsuite/protected_main_3.cc: New file.
16426 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
16427 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
16428 (protected_1_LDFLAGS, protected_1_LDADD): Define.
16429 (protected_1.so): New target.
16430 (protected_1_pic.o, protected_2_pic.o): New targets.
16431 (protected_3_pic.o): New target.
16432 (check_PROGRAMS): Add protected_2.
16433 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
16434 (protected_2_LDFLAGS, protected_2_LDADD): Define.
16435 * testsuite/Makefile.in: Rebuild.
16436
16437 * options.h (DEFINE_var): Add set_user_set_##varname__.
16438 (DEFINE_bool_alias): New macro.
16439 (class General_options): Define -Bstatic using DEFINE_bool_alias
16440 rather than DEFINE_special. Add --undefined as an alias for -z
16441 defs.
16442 * options.cc (General_options::parse_Bstatic): Remove.
16443
16444 * options.h (class General_options): Add --fatal-warnings.
16445 * main.cc (main): Implement --fatal-warnings.
16446 * errors.h (Errors::warning_count): New function.
16447
16448 * options.h (class General_options): Add -Bsymbolic-functions.
16449 * symtab.h (Symbol::is_preemptible): Check for
16450 -Bsymbolic-functions.
16451
16452 2008-05-05 Ian Lance Taylor <iant@google.com>
16453
16454 * options.h (DEFINE_bool): For DASH_Z, create the negative option
16455 as noVARNAME rather than no-VARNAME.
16456 (class General_options): Add option -z combreloc.
16457 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
16458 get_address.
16459 (Output_reloc::sort_before) [SHT_REL]: New function.
16460 (Output_reloc::sort_before) [SHT_RELA]: New function.
16461 (class Output_data_reloc_base): Add sort_relocs_ field. Define
16462 Sort_relocs_comparison.
16463 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
16464 parameter. Change all callers.
16465 (Output_data_reloc::Output_data_reloc) [both versions]: Add
16466 sort_relocs parameter. Change all callers.
16467 * output.cc (Output_reloc::get_address): New function, broken out
16468 of write_rel.
16469 (Output_reloc::write_rel): Call it.
16470 (Output_reloc::compare): New function.
16471 (Output_data_reloc_base::do_write): Optionally sort relocs.
16472
16473 * configure.ac: If targ_extra_obj is set, link it in.
16474 * configure.tgt: Initialize all variables.
16475 (x86_64*): Set targ_extra_obj and targ_extra_size.
16476 * configure: Rebuild.
16477
16478 * object.cc (Sized_relobj::include_section_group): Adjust section
16479 indexes read from group data. Build vector to pass to
16480 layout_group.
16481 * layout.cc (Layout::layout_group): Add flags and shndxes
16482 parameters. Remove contents parameter. Change caller. Update
16483 explicit instantiations.
16484 * layout.h (class Layout): Update layout_group declaration.
16485 * output.cc (Output_data_group::Output_data_group): Add flags and
16486 input_shndxes parameters. Remove contents parameter. Change
16487 caller.
16488 (Output_data_group::do_write): Change input_sections_ to
16489 input_shndxes_.
16490 * output.h (class Output_data_group): Update constructor
16491 declaration. Rename input_sections_ to input_shndxes_.
16492 * testsuite/many_sections_test.cc: Add template.
16493
16494 2008-04-30 Cary Coutant <ccoutant@google.com>
16495
16496 * target-reloc.h (relocate_section): Fix dead-pointer bug.
16497
16498 * layout.cc (Layout::include_section): Refactored check for debug
16499 info section.
16500 (Layout::add_comdat): Add new parameters. Change type
16501 of signature parameter. Add object and shndx to signatures table.
16502 (Layout::find_kept_object): New function.
16503 * layout.h: Include <cstring>.
16504 (Layout::is_debug_info_section): New function.
16505 (Layout::add_comdat): Add new parameters.
16506 (Layout::find_kept_object): New function.
16507 (Layout::Kept_section): New struct.
16508 (Layout::Signatures): Change type of map range.
16509 * object.cc (Relobj::output_section_address): New function.
16510 (Sized_relobj::include_section_group): Add new parameters. Change
16511 calls to Layout::add_comdat. Change to build table of kept comdat
16512 groups and table mapping discarded sections to kept sections.
16513 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
16514 (Sized_relobj::do_layout): Change calls to include_section_group and
16515 include_linkonce_section.
16516 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
16517 value to zero when section is discarded.
16518 (Sized_relobj::map_to_kept_section): New function.
16519 * object.h (Relobj::output_section_address): New function.
16520 (Relobj::Comdat_group): New type.
16521 (Relobj::find_comdat_group): New function.
16522 (Relobj::Comdat_group_table): New type.
16523 (Relobj::Kept_comdat_section): New type.
16524 (Relobj::Kept_comdat_section_table): New type.
16525 (Relobj::add_comdat_group): New function.
16526 (Relobj::set_kept_comdat_section): New function.
16527 (Relobj::get_kept_comdat_section): New function.
16528 (Relobj::comdat_groups_): New field.
16529 (Relobj::kept_comdat_sections_): New field.
16530 (Symbol_value::input_value): Update comment.
16531 (Sized_relobj::map_to_kept_section) New function.
16532 (Sized_relobj::include_linkonce_section): Add new parameter.
16533 * target-reloc.h (Comdat_behavior): New type.
16534 (get_comdat_behavior): New function.
16535 (relocate_section): Add code to map a discarded section to the
16536 corresponding kept section when applying a relocation.
16537
16538 2008-04-30 Craig Silverstein <csilvers@google.com>
16539
16540 * dwarf_reader.cc (next_generation_count): New static var.
16541 (Addr2line_cache_entry): New struct.
16542 (addr2line_cache): New static var.
16543 (Dwarf_line_info::one_addr2line): Added caching.
16544 (Dwarf_line_info::clear_addr2line_cache): New function.
16545 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
16546 cache-size parameter.
16547 (Dwarf_line_info::one_addr2line_cache): New function.
16548 * symtab.cc (Symbol_table::detect_odr_violations): Pass
16549 new cache-size argument to one_addr2line(), and clear cache.
16550
16551 2008-04-28 Cary Coutant <ccoutant@google.com>
16552
16553 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
16554 R_386_PC8 relocations.
16555
16556 2008-04-23 Ian Lance Taylor <iant@google.com>
16557
16558 * object.cc (Sized_relobj::include_section_group): Check for
16559 invalid section group.
16560
16561 * object.cc (make_elf_object): Correct test for 64-bit ELF file
16562 header size.
16563
16564 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
16565 than read for file header.
16566 * archive.cc (Archive::include_member): Likewise.
16567
16568 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
16569
16570 * aclocal.m4: Regenerate.
16571 * configure: Regenerate.
16572
16573 2008-04-19 Ian Lance Taylor <iant@google.com>
16574
16575 * version.cc (version_string): Bump to 1.6.
16576
16577 * testsuite/Makefile.am (many_sections_r_test): New target.
16578 (many_sections_r_test_SOURCES): Remove.
16579 (many_sections_r_test_DEPENDENCIES): Remove.
16580 (many_sections_r_test_LDFLAGS): Remove.
16581 (many_sections_r_test_LDADD): Remove.
16582
16583 * object.cc (Sized_relobj::do_add_symbols): Always pass
16584 local_symbol_count_ to add_from_relobj.
16585
16586 * testsuite/Makefile.am (many_sections_check.h): Only check one in
16587 every thousand variables.
16588 * testsuite/Makefile.in: Rebuild.
16589
16590 * object.cc (Xindex::initialize_symtab_xindex): New function.
16591 (Xindex::read_symtab_xindex): New function.
16592 (Xindex::sym_xindex_to_shndx): New function.
16593 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
16594 available.
16595 (Sized_relobj::do_initialize_xindex): New function.
16596 (Sized_relobj::do_read_symbols): Adjust section links.
16597 (Sized_relobj::symbol_section_and_value): Add is_ordinary
16598 parameter. Change all callers.
16599 (Sized_relobj::include_section_group): Adjust section links and
16600 symbol section indexes.
16601 (Sized_relobj::do_layout): Adjust section links.
16602 (Sized_relobj::do_count_local_symbols): Adjust section links and
16603 symbol section indexes.
16604 (Sized_relobj::do_finalize_local_symbols): Distinguish between
16605 ordinary and special symbols.
16606 (Sized_relobj::write_local_symbols): Add symtab_xindex and
16607 dynsym_xindex parameters. Change all callers. Adjust section
16608 links. Use SHN_XINDEX when needed.
16609 (Sized_relobj::get_symbol_location_info): Adjust section links.
16610 Don't get fooled by special symbols.
16611 * object.h (class Xindex): Define.
16612 (class Object): Add xindex_ parameter. Declare virtual functoin
16613 do_initialize_xindex.
16614 (Object::adjust_sym_shndx): New function.
16615 (Object::set_xindex): New protected function.
16616 (class Symbol_value): Add is_ordinary_shndx_ field.
16617 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
16618 (Symbol_value::value): Assert ordinary section.
16619 (Symbol_value::initialize_input_to_output_map): Likewise.
16620 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
16621 Change all callers.
16622 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
16623 all callers.
16624 (class Sized_relobj): Update declarations.
16625 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
16626 parameter. Change all callers.
16627 (Sized_relobj::adjust_shndx): New function.
16628 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
16629 field.
16630 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
16631 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
16632 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
16633 (Sized_dynobj::read_dynsym_section): Adjust section links.
16634 (Sized_dynobj::read_dynamic): Likewise.
16635 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
16636 section links.
16637 (Sized_dynobj::do_initialize_xindex): New function.
16638 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
16639 do_initialize_xindex.
16640 (Sized_dynobj::adjust_shndx): New function.
16641 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
16642 dynsym_xindex_ fields.
16643 (Layout::finalize): Add a call to set_section_indexes before
16644 creating the symtab sections.
16645 (Layout::set_section_indexes): Don't do anything if the section
16646 already has a section index.
16647 (Layout::create_symtab_sections): Add shnum parameter. Change
16648 caller. Create .symtab_shndx section if needed.
16649 (Layout::create_shdrs): Add shstrtab_section parameter. Change
16650 caller.
16651 (Layout::allocated_output_section_count): New function.
16652 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
16653 needed.
16654 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
16655 fields. Update declarations.
16656 (Layout::symtab_xindex): New function.
16657 (Layout::dynsym_xindex): New function.
16658 (class Write_symbols_task): Add layout_ field.
16659 (Write_symbols_task::Write_symbols_task): Add layout parameter.
16660 Change caller.
16661 * output.cc (Output_section_headers::Output_section_headers): Add
16662 shstrtab_section parameter. Change all callers.
16663 (Output_section_headers::do_sized_write): Store overflow values
16664 for section count and section string table section index in
16665 section header zero.
16666 (Output_file_header::do_sized_write): Check for overflow of
16667 section count and section string table section index.
16668 (Output_symtab_xindex::do_write): New function.
16669 (Output_symtab_xindex::endian_do_write): New function.
16670 * output.h (class Output_section_headers): Add shstrtab_section_.
16671 Update declarations.
16672 (class Output_symtab_xindex): Define.
16673 (Output_section::has_out_shndx): New function.
16674 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
16675 field.
16676 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
16677 Change all callers.
16678 (Sized_symbol::init): Likewise.
16679 (Symbol::output_section): Check for ordinary symbol.
16680 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
16681 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
16682 callers.
16683 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
16684 Change all callers. Simplify handling of symbols from sections
16685 not included in the link.
16686 (Symbol_table::add_from_dynobj): Handle ordinary symbol
16687 distinction.
16688 (Weak_alias_sorter::operator()): Assert that symbols are
16689 ordinary.
16690 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
16691 distinction.
16692 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
16693 parameters. Change all callers.
16694 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
16695 symbol distinction. Use SHN_XINDEX when needed.
16696 (Symbol_table::write_section_symbol): Add symtab_xindex
16697 parameter. Change all callers.
16698 (Symbol_table::sized_write_section_symbol): Likewise. Use
16699 SHN_XINDEX when needed.
16700 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
16701 declarations.
16702 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
16703 (Symbol::is_defined): Check is_ordinary.
16704 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
16705 (Symbol::is_absolute, Symbol::is_common): Likewise.
16706 (class Sized_symbol): Update declarations.
16707 (class Symbol_table): Update declarations.
16708 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
16709 parameters. Change all callers.
16710 (Sized_symbol::override): Likewise.
16711 (Symbol_table::override): Likewise.
16712 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
16713 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
16714 is_ordinary, and orig_st_shndx parameters. Change all callers.
16715 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
16716 to be in an ordinary section.
16717 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
16718 object and is_ordinary parameters. Change all callers.
16719 (Sized_dwarf_line_info::read_relocs): Add object parameter.
16720 Change all callers. Don't add undefined or non-ordinary symbols
16721 to reloc_map_.
16722 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
16723 Change all callers.
16724 * dwarf_reader.h (class Sized_dwarf_line_info): Update
16725 declarations.
16726 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
16727 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
16728 (Sized_relobj::relocate_sections): Likewise.
16729 * target-reloc.h (scan_relocs): Adjust section symbol index.
16730 (scan_relocatable_relocs): Likewise.
16731 * i386.cc (Scan::local): Check for ordinary symbols.
16732 * sparc.cc (Scan::local): Likewise.
16733 * x86_64.cc (Scan::local): Likewise.
16734 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
16735 to symbol_section_and_value.
16736 * testsuite/many_sections_test.cc: New file.
16737 * testsuite/Makefile.am (BUILT_SOURCES): Define.
16738 (check_PROGRAMS): Add many_sections_test.
16739 (many_sections_test_SOURCES): Define.
16740 (many_sections_test_DEPENDENCIES): Define.
16741 (many_sections_test_LDFLAGS): Define.
16742 (BUILT_SOURCES): Add many_sections_define.h.
16743 (many_sections_define.h): New target.
16744 (BUILT_SOURCES): Add many_sections_check.h.
16745 (many_sections_check.h): New target.
16746 (check_PROGRAMS): Add many_sections_r_test.
16747 (many_sections_r_test_SOURCES): Define.
16748 (many_sections_r_test_DEPENDENCIES): Define.
16749 (many_sections_r_test_LDFLAGS): Define.
16750 (many_sections_r_test_LDADD): Define.
16751 (many_sections_r_test.o): New target.
16752 * testsuite/Makefile.in: Rebuild.
16753
16754 2008-04-17 Cary Coutant <ccoutant@google.com>
16755
16756 * errors.cc (Errors::info): New function.
16757 (gold_info): New function.
16758 * errors.h (Errors::info): New function.
16759 * gold.h (gold_info): New function.
16760 * object.cc (Input_objects::add_object): Print trace output.
16761 * options.cc (options::parse_set): New function.
16762 (General_options::parse_wrap): Deleted.
16763 (General_options::General_options): Deleted initializer.
16764 * options.h (options::String_set): New typedef.
16765 (options::parse_set): New function.
16766 (DEFINE_set): New macro.
16767 (General_options::wrap): Changed to use DEFINE_set. Changed
16768 callers of any_wrap_symbols and is_wrap_symbol.
16769 (General_options::trace, General_options::trace_symbol):
16770 New options.
16771 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
16772 (General_options::wrap_symbols_): Deleted.
16773 * symtab.cc (Symbol_table::add_from_object): Print trace output.
16774
16775 2008-04-17 David S. Miller <davem@davemloft.net>
16776
16777 * options.cc (General_options::parse_V): New function.
16778 * options.h: Add entries for -V and -Qy.
16779
16780 2008-04-17 Ian Lance Taylor <iant@google.com>
16781
16782 * common.cc (Symbol_table::allocate_commons): Remove options
16783 parameter. Change caller.
16784 (Symbol_table::do_allocate_commons): Remove options parameter.
16785 Change caller. Just call do_allocate_commons_list twice.
16786 (Symbol_table::do_allocate_commons_list): New function, broken out
16787 of do_allocate_commons.
16788 * common.h (class Allocate_commons_task): Remove options_ field.
16789 Update constructor.
16790 * symtab.cc (Symbol_table::Symbol_table): Initialize
16791 tls_commons_.
16792 (Symbol_table::add_from_object): Put TLS common symbols on
16793 tls_commons_ list.
16794 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
16795 which are IN_OUTPUT_DATA.
16796 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
16797 allocate_commons and do_allocate_commons declarations. Declare
16798 do_allocate_commons_list.
16799 * gold.cc (queue_middle_tasks): Update creation of
16800 Allocate_commons_task to not pass options.
16801 * testsuite/Makefile.am (INCLUDES): Add -I.. .
16802 (TLS_TEST_C_FLAGS): New variable.
16803 (tls_test_c_pic.o): New target.
16804 (tls_test_shared.so): Link in tls_test_c_pic.o.
16805 (tls_test_c_pic_ie.o): New target.
16806 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
16807 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
16808 (tls_test_c.o): New target.
16809 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
16810 (tls_pic_test_LDADD): Likewise.
16811 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
16812 (tls_shared_gd_to_ie_test_LDADD): Likewise.
16813 (tls_test_c_gnu2.o): New target.
16814 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
16815 tls_test_c_gnu2.o.
16816 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
16817 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
16818 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
16819 * testsuite/tls_test.cc: Include "config.h".
16820 (t_last): Call t11_last.
16821 * testsuite/tls_test.h (t11, t11_last): Declare.
16822 * testsuite/tls_test_c.c: New file.
16823 * testsuite/tls_test_main.cc (thread_routine): Call t11.
16824 * configure.ac: Check for OpenMP support.
16825 * configure, config.in, Makefile.in: Rebuild.
16826 * testsuite/Makefile.in: Rebuild.
16827
16828 2008-04-16 Cary Coutant <ccoutant@google.com>
16829
16830 * i386.cc (Target_i386::define_tls_base_symbol): New function.
16831 (Target_i386::tls_base_symbol_defined_): New field.
16832 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16833 (Target_i386::Scan::global): Likewise.
16834 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
16835 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
16836 (Target_x86_64::tls_base_symbol_defined_): New field.
16837 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16838 (Target_x86_64::Scan::global): Likewise.
16839
16840 2008-04-16 Cary Coutant <ccoutant@google.com>
16841
16842 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
16843 (Symbol::needs_plt_entry): Allow weak undefined symbols.
16844 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
16845 building shared libraries.
16846 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
16847 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
16848 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
16849 * testsuite/Makefile.in: Rebuild.
16850 * testsuite/weak_undef.h: New file.
16851 * testsuite/weak_undef_file1.cc: Add extra test cases.
16852 * testsuite/weak_undef_file2.cc: Likewise.
16853 * testsuite/weak_undef_test.cc: Likewise.
16854
16855 2008-04-16 David S. Miller <davem@davemloft.net>
16856
16857 * sparc.cc (Target_sparc::Scan): Change from struct to class.
16858 Add issued_non_pic_error_ field. Declare check_non_pic.
16859 (Target_sparc::Scan::check_non_pic): New function.
16860 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
16861 (Target_sparc::Scan::global): Likewise.
16862
16863 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
16864 * configure: Rebuild.
16865
16866 * options.h (DEFINE_enable): New macro.
16867 (new_dtags): New enable option.
16868 (initfirst, interpose, loadfltr, nodefaultlib,
16869 nodelete, nodlopen, nodump): New -z options.
16870 * layout.cc (Layout:finish_dynamic_section): If new
16871 dtags enabled, emit DT_RUNPATH. Also, emit a
16872 DT_FLAGS_1 containing any specified -z flags.
16873
16874 2008-04-16 Ian Lance Taylor <iant@google.com>
16875
16876 * copy-relocs.cc: New file.
16877 * copy-relocs.h: New file.
16878 * reloc.cc: Remove Copy_relocs code.
16879 * reloc.h: Likewise.
16880 * reloc-types.h (struct Reloc_types) [both versions]: Add
16881 get_reloc_addend_noerror.
16882 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
16883 variants of add_global which take an addend which must be zero.
16884 * i386.cc: Include "copy-relocs.h".
16885 (class Target_i386): Change type of copy_relocs_ to variable,
16886 update initializer.
16887 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
16888 Change all callers.
16889 (Target_i386::do_finalize_sections): Change handling of
16890 copy_relocs_.
16891 * sparc.cc: Include "copy-relocs.h".
16892 (class Target_sparc): Change type of copy_relocs_ to variable,
16893 update initializer.
16894 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
16895 Change all callers.
16896 (Target_sparc::do_finalize_sections): Change handling of
16897 copy_relocs_.
16898 * x86_64.cc: Include "copy-relocs.h".
16899 (class Target_x86_64): Change type of copy_relocs_ to variable,
16900 update initializer.
16901 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
16902 class. Change all callers.
16903 (Target_x86_64::do_finalize_sections): Change handling of
16904 copy_relocs_.
16905 * Makefile.am (CCFILES): Add copy-relocs.cc.
16906 (HFILES): Add copy-relocs.h.
16907
16908 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
16909
16910 * testsuite/script_test_4.sh: Permit leading zeroes.
16911
16912 2008-04-15 Ian Lance Taylor <iant@google.com>
16913
16914 * script-sections.cc (Script_sections::create_segments): Use
16915 header_size_adjustment even when there is enough room for the
16916 headers.
16917 * testsuite/script_test_4.sh: New file.
16918 * testsuite/script_test_4.t: New file.
16919 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
16920 (check_DATA): Add script_test_4.stdout.
16921 (MOSTLYCLEANFILES): Likewise.
16922 (script_test_4): New target.
16923 (script_test_4.stdout): New target.
16924 * testsuite/Makefile.in: Rebuild.
16925
16926 * sparc.cc: Add definitions for Output_data_plt_sparc class
16927 constants.
16928
16929 2008-04-14 David S. Miller <davem@davemloft.net>
16930
16931 * sparc.cc: New file.
16932 * Makefile.am (TARGETSOURCES): Add sparc.cc
16933 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
16934 * configure.tgt: Document targ_extra_size and
16935 targ_extra_big_endian. Add entries for sparc-* and
16936 sparc64-*.
16937 * configure.ac: Handle targ_extra_size and
16938 targ_extra_big_endian.
16939 * Makefile.in: Rebuild.
16940 * configure: Likewise.
16941 * po/POTFILES.in: Likewise.
16942 * po/gold.pot: Likewise.
16943
16944 2008-04-14 Ian Lance Taylor <iant@google.com>
16945
16946 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
16947 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
16948 in the name/type/flags to section mapping. Don't call
16949 allocate_output_section.
16950 (Layout::choose_output_section): Change parameter from adjust_name
16951 to is_input_section. Don't permit input sections after sections
16952 are attached to segments. Don't call allocate_output_section.
16953 (Layout::layout_eh_frame): Call update_flags_for_input_section,
16954 not write_enable_output_section.
16955 (Layout::make_output_section): Don't push to
16956 unattached_section_list_ nor call attach_to_segment. Call
16957 attach_section_to_segment if sections are attached.
16958 (Layout::attach_sections_to_segments): New function.
16959 (Layout::attach_section_to_segment): New function.
16960 (Layout::attach_allocated_section_to_segment): Rename from
16961 attach_to_segment. Remove flags parameter.
16962 (Layout::allocate_output_section): Remove function.
16963 (Layout::write_enable_output_section): Remove function.
16964 * layout.h (class Layout): Update for above changes. Add new
16965 field sections_are_attached_.
16966 * output.h (Output_section::update_flags_for_input_section): New
16967 function.
16968 * output.cc (Output_section::add_input_section): Call
16969 update_flags_for_input_section.
16970 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
16971
16972 2008-04-11 Cary Coutant <ccoutant@google.com>
16973
16974 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
16975 thought unnecessary.
16976 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
16977
16978 2008-04-11 Ian Lance Taylor <iant@google.com>
16979
16980 * output.h (class Output_section_data): Remove inline definition
16981 of set_addralign.
16982 * output.cc (Output_section_data::set_addralign): New function.
16983
16984 2008-04-11 Cary Coutant <ccoutant@google.com>
16985
16986 Add support for TLS descriptors for i386 and x86_64.
16987 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
16988 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
16989 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
16990 GOT_TYPE_TLS_DESC.
16991 (Target_i386::got_mod_index_entry): Remove unnecessary code.
16992 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
16993 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
16994 relocations.
16995 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
16996 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
16997 Fix problem with initial-exec relocations.
16998 (Target_i386::Relocate::relocate_tls): Likewise.
16999 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
17000 relaxation.
17001 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
17002 support for section-plus-offset dynamic table entries.
17003 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
17004 (Output_data_dynamic::Dynamic_entry): Add support for
17005 section-plus-offset dynamic table entries.
17006 (Output_data_dynamic::Classification): Likewise.
17007 (Output_data_dynamic::classification_): Renamed offset_.
17008 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
17009 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
17010 (Target_x86_64::make_plt_section): New function.
17011 (Target_x86_64::reserve_tlsdesc_entries): New function.
17012 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
17013 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
17014 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
17015 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
17016 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
17017 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
17018 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
17019 add extra PLT entry for TLS descriptors.
17020 (Output_data_plt_x86_64::got_): New field.
17021 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
17022 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
17023 fields.
17024 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
17025 descriptors.
17026 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
17027 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
17028 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
17029 R_386_TLS_DESC_CALL relocations.
17030 (Target_x86_64::Scan::global): Likewise.
17031 (Target_x86_64::do_finalize_sections): Add dynamic table entries
17032 for TLS descriptors.
17033 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
17034 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
17035 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
17036 GD-to-IE relaxation.
17037 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
17038 and TLS_DESCRIPTORS.
17039 * Makefile.in: Rebuild.
17040 * configure: Rebuild.
17041 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
17042 (tls_test_shared2.so): New target.
17043 (tls_shared_gd_to_ie_test_SOURCES): New variable.
17044 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
17045 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
17046 (tls_shared_gd_to_ie_test_LDADD): New variable.
17047 (tls_shared_gnu2_gd_to_ie_test): New target.
17048 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
17049 New targets.
17050 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
17051 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
17052 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
17053 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
17054 (tls_shared_gnu2_test): New target.
17055 (tls_test_gnu2_shared.so): New target.
17056 (tls_shared_gnu2_test_SOURCES): New variable.
17057 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
17058 (tls_shared_gnu2_test_LDFLAGS): New variable.
17059 (tls_shared_gnu2_test_LDADD): New variable.
17060 * testsuite/Makefile.in: Rebuild.
17061 * testsuite/Makefile.
17062
17063 2008-04-11 Ian Lance Taylor <iant@google.com>
17064
17065 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
17066 justsyms.t.
17067 * testsuite/Makefile.in: Rebuild.
17068
17069 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
17070 long.
17071 * testsuite/script_test_2.cc (main): Adjust test.
17072
17073 2008-04-11 David S. Miller <davem@davemloft.net>
17074 Ian Lance Taylor <iant@google.com>
17075
17076 * options.h (General_options): Add entries for '-Y' and
17077 '-relax'.
17078 * options.cc (General_options:finalize): If -Y was used, add those
17079 entries to the library path instead of the default "/lib" and
17080 "/usr/lib".
17081
17082 2008-04-11 David S. Miller <davem@davemloft.net>
17083
17084 * testsuite/justsyms.t: Start at 0x100.
17085 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
17086 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
17087 long.
17088 * testsuite/script_test_2.cc: Adjust string and section length
17089 checks.
17090
17091 2008-04-09 Ian Lance Taylor <iant@google.com>
17092
17093 PR gold/5996
17094 * script-sections.cc (Sections_element::allocate_to_segment): Add
17095 orphan parameter.
17096 (Output_section_definition::allocate_to_segment): Likewise.
17097 (Orphan_output_section::allocate_to_segment): Likewise.
17098 (Script_sections::attach_sections_using_phdrs_clause): Don't
17099 propagate non-PT_LOAD segments to orphan sections.
17100 * testsuite/Makefile.am (script_test_3.stdout): Generate using
17101 readelf rather than objdump.
17102 * testsuite/script_test_3.sh: Adjust accordingly. Test that
17103 .interp section and PT_INTERP segment are the same size.
17104 * testsuite/Makefile.in: Rebuild.
17105
17106 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
17107 aliases for symbols defined in the same object.
17108 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
17109 (weak_alias_test_SOURCES): New variable.
17110 (weak_alias_test_DEPENDENCIES): New variable.
17111 (weak_alias_test_LDFLAGS): New variable.
17112 (weak_alias_test_LDADD): New variable.
17113 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
17114 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
17115 (weak_alias_test_3.o): New target.
17116 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
17117 * testsuite/weak_alias_test_main.cc: New file.
17118 * testsuite/weak_alias_test_1.cc: New file.
17119 * testsuite/weak_alias_test_2.cc: New file.
17120 * testsuite/weak_alias_test_3.cc: New file.
17121
17122 2008-04-08 Ian Lance Taylor <iant@google.com>
17123
17124 * options.h (class General_options): Add --noinhibit-exec option.
17125 * main.cc (main): Check --noinhibit-exec.
17126
17127 * options.h (class General_options): Define --wrap as a special
17128 option. Add wrap_symbols_ field.
17129 (General_options::any_wrap_symbols): New function.
17130 (General_options::is_wrap_symbol): New function.
17131 * options.cc (General_options::parse_wrap): New function.
17132 (General_options::General_options): Initialize wrap_symbols_.
17133 * symtab.cc (Symbol_table::wrap_symbol): New function.
17134 (Symbol_table::add_from_object): Handle --wrap.
17135 * symtab.h (class Symbol_table): Declare wrap_symbol.
17136 * target.h (Target::wrap_char): New function.
17137 (Target::Target_info): Add wrap_char field.
17138 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
17139 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
17140 * testsuite/testfile.cc (Target_test::test_target_info):
17141 Likewise.
17142
17143 * errors.cc (Errors::undefined_symbol): Mention symbol version if
17144 there is one.
17145
17146 * layout.h (class Layout): Add added_eh_frame_data_ field.
17147 * layout.cc (Layout::Layout): Initialize new field.
17148 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
17149 output section until we find a section we merged successfully.
17150 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
17151 that the size be non-zero.
17152
17153 * merge.cc (Object_merge_map::get_output_offset): Remove inline
17154 qualifier.
17155
17156 2008-04-08 Craig Silverstein <csilvers@google.com>
17157
17158 * configure.ac: Export new conditional variable HAVE_ZLIB.
17159 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
17160 on HAVE_ZLIB.
17161 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
17162 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17163
17164 2008-04-07 Ian Lance Taylor <iant@google.com>
17165
17166 * version.cc (version_string): Set to "1.5".
17167
17168 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
17169 Add issued_non_pic_error_ field. Declare check_non_pic.
17170 (Target_x86_64::Scan::check_non_pic): New function.
17171 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
17172 (Target_x86_64::Scan::global): Likewise.
17173
17174 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
17175 addend parameter. Change caller. Handle merge sections.
17176 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
17177 Address to Addend. Don't add in the result of
17178 local_section_offset, pass down the addend and use the returned
17179 value.
17180 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
17181 Update declarations of local_section_offset and symbol_value.
17182 * testsuite/two_file_test_1.cc (t18): New function.
17183 * testsuite/two_file_test_2.cc (f18): New function.
17184 * testsuite/two_file_test_main.cc (main): Call t18.
17185 * testsuite/two_file_test.h (t18, f18): Declare.
17186
17187 * configure.ac: Don't test for objdump, c++filt, or readelf.
17188 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
17189 conditionals.
17190 (TEST_READELF): New variable.
17191 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
17192 (check_PROGRAMS): Add two_file_strip_test.
17193 (two_file_strip_test): New target.
17194 (check_PROGRAMS): Add two_file_same_shared_strip_test.
17195 (two_file_same_shared_strip_test_SOURCES): New variable.
17196 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
17197 (two_file_same_shared_strip_test_LDFLAGS): New variable.
17198 (two_file_same_shared_strip_test_LDADD): New variable.
17199 (two_file_shared_strip.so): New target.
17200 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
17201 (ver_test_5.syms, ver_test_7.syms): Likewise.
17202 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
17203 (strip_test_3.stdout): Use TEST_OBJDUMP.
17204 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17205
17206 2008-04-04 Cary Coutant <ccoutant@google.com>
17207
17208 * symtab.h (Symbol::is_weak_undefined): New function.
17209 (Symbol::is_strong_undefined): New function.
17210 (Symbol::is_absolute): New function.
17211 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
17212 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
17213 absolute symbols.
17214 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
17215 (weak_undef_test): New target.
17216 * testsuite/Makefile.in: Rebuild.
17217 * testsuite/weak_undef_file1.cc: New file.
17218 * testsuite/weak_undef_file2.cc: New file.
17219 * testsuite/weak_undef_test.cc: New file.
17220
17221 2008-04-03 Craig Silverstein <csilvers@google.com>
17222
17223 * compressed_output.h (class Output_compressed_section): Use
17224 unsigned buffer.
17225 * compressed_output.cc (zlib_compress): Use unsigned buffers,
17226 add zlib header.
17227 (zlib_compressed_suffix): Removed.
17228 (Output_compressed_section::set_final_data_size): Use unsigned
17229 buffers.
17230 * testsuite/Makefile.am (flagstest_compress_debug_sections):
17231 Fix linker invocation.
17232 (flagstest_o_specialfile_and_compress_debug_sections):
17233 Likewise.
17234 * testsuite/Makefile.in: Regenerated.
17235
17236 2008-04-02 David S. Miller <davem@davemloft.net>
17237
17238 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
17239 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
17240
17241 2008-04-02 Craig Silverstein <csilvers@google.com>
17242
17243 * TODO: New file.
17244
17245 2008-04-02 Ian Lance Taylor <iant@google.com>
17246
17247 * fileread.cc (File_read::find_view): Add byteshift and vshifted
17248 parameters. Update for new key type to views_. Change all
17249 callers.
17250 (File_read::read): Adjust for byteshift in returned view.
17251 (File_read::add_view): New function, broken out of
17252 find_and_make_view.
17253 (File_read::make_view): New function, broken out of
17254 find_and_make_view.
17255 (File_read::find_or_make_view): Add offset and aligned
17256 parameters. Rewrite accordingly. Change all callers.
17257 (File_read::get_view): Add offset and aligned parameters. Adjust
17258 for byteshift in return value.
17259 (File_read::get_lasting_view): Likewise.
17260 * fileread.h (class File_read): Update declarations.
17261 (class File_read::View): Add byteshift_ field. Add byteshift to
17262 constructor. Add byteshift method.
17263 * archive.h (Archive::clear_uncached_views): New function.
17264 (Archive::get_view): Add aligned parameter. Change all callers.
17265 * object.h (Object::get_view): Add aligned parameter. Change all
17266 callers.
17267 (Object::get_lasting_view): Likewise.
17268
17269 * fileread.cc (File_read::release): Don't call clear_views if
17270 there are multiple objects.
17271 * fileread.h (File_read::clear_uncached_views): New function.
17272 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
17273 on the archive.
17274
17275 2008-03-31 Cary Coutant <ccoutant@google.com>
17276
17277 Add thin archive support.
17278 * archive.cc (Archive::armagt): New const.
17279 (Archive::setup): Remove task parameter and calls to unlock.
17280 (Archive::unlock_nested_archives): New function.
17281 (Archive::read_header): Add nested_off parameter. Change
17282 all callers.
17283 (Archive::interpret_header): Likewise.
17284 (Archive::include_all_members): Change to handle thin
17285 archives.
17286 (Archive::include_member): Likewise.
17287 * archive.h (Archive::Archive): Add new parameters and
17288 initializers.
17289 (Archive::armagt): New const.
17290 (Archive::setup): Remove task parameter.
17291 (Archive::unlock_nested_archives): New function.
17292 (Archive::read_header): Add nested_off parameter.
17293 (Archive::interpret_header): Likewise.
17294 (Archive::Nested_archive_table): New typedef.
17295 (Archive::is_thin_archive_): New field.
17296 (Archive::nested_archives_): New field.
17297 (Archive::options_): New field.
17298 (Archive::dirpath_): New field.
17299 (Archive::task_): New field.
17300 * readsyms.cc (Read_symbols::do_read_symbols): Add check
17301 for thin archives. Pass additional parameters to
17302 Archive::Archive. Unlock the archive file after calling
17303 Archive::setup.
17304
17305 2008-03-29 Ian Lance Taylor <iant@google.com>
17306
17307 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
17308 version symbol to be local.
17309 * testsuite/ver_test_4.sh: New file.
17310 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
17311 (check_DATA): Add ver_test_4.syms.
17312 (ver_test_4.syms): New target.
17313 * testsuite/Makefile.in: Rebuild.
17314
17315 * output.cc
17316 (Output_section::Input_section_sort_entry::has_priority): New
17317 function.
17318 (Output_section::Input_section_sort_entry::match_file_name): New
17319 function.
17320 (Output_section::Input_section_sort_entry::match_section_name):
17321 Remove.
17322 (Output_section::Input_section_sort_entry::match_section_name_prefix):
17323 Remove.
17324 (Output_section::Input_section_sort_entry::match_section_file):
17325 Remove.
17326 (Output_section::Input_section_sort_compare::operator()): Rewrite
17327 using new Input_section_sort_entry functions. Sort crtbegin and
17328 crtend first. Sort sections with no priority before sections with
17329 a priority.
17330 * testsuite/initpri1.c (d3): Check j != 4.
17331 (cd5): New constructor/destructor function.
17332 (main): Check j != 2.
17333
17334 * symtab.cc (Symbol_table::add_from_object): If we don't use the
17335 new symbol when resolving, don't call set_is_default.
17336 * testsuite/ver_test_7.cc: New file.
17337 * testsuite/ver_test_7.sh: New file.
17338 * testsuite/Makefile.am (ver_test_7.so): New target.
17339 (ver_test_7.o): New target.
17340 (check_SCRIPTS): Add ver_test_7.sh.
17341 (check_DATA): Add ver_test_7.syms.
17342 (ver_test_7.syms): New target.
17343
17344 2008-03-28 Ian Lance Taylor <iant@google.com>
17345
17346 * layout.cc (Layout::layout): If we see an input section with a
17347 name that needs sorting, set the must_sort flag for the output
17348 section.
17349 (Layout::make_output_section): If the name of the output section
17350 indicates that it might require sorting, set the may_sort flag.
17351 * output.h (Output_section::may_sort_attached_input_sections): New
17352 function.
17353 (Output_section::set_may_sort_attached_input_sections): New
17354 function.
17355 (Output_section::must_sort_attached_input_sections): New
17356 function.
17357 (Output_section::set_must_sort_attached_input_sections): New
17358 function.
17359 (class Output_section): Declare Input_section_sort_entry. Define
17360 Input_section_sort_compare. Declare
17361 sort_attached_input_sections. Add new fields:
17362 may_sort_attached_input_sections_,
17363 must_sort_attached_input_sections_,
17364 attached_input_sections_are_sorted_.
17365 * output.cc (Output_section::Output_section): Initialize new
17366 fields.
17367 (Output_section::add_input_section): Add an entry to
17368 input_sections_ if may_sort or must_sort are true.
17369 (Output_section::set_final_data_size): Call
17370 sort_attached_input_sections if necessary.
17371 (Output_section::Input_section_sort_entry): Define new class.
17372 (Output_section::Input_section_sort_compare::operator()): New
17373 function.
17374 (Output_section::sort_attached_input_sections): New function.
17375 * configure.ac: Check whether the compiler supports constructor
17376 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
17377 * testsuite/initpri1.c: New file.
17378 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
17379 CONSTRUCTOR_PRIORITY.
17380 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
17381 (initpri1_LDFLAGS): New variable.
17382 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17383
17384 2008-03-27 Ian Lance Taylor <iant@google.com>
17385
17386 * common.cc (Sort_commons::operator): Correct sorting algorithm.
17387 * testsuite/common_test_1.c: New file.
17388 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
17389 (common_test_1_SOURCES): New variable.
17390 (common_test_1_DEPENDENCIES): New variable.
17391 (common_test_1_LDFLAGS): New variable.
17392
17393 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
17394 and commons_ correctly when NAME/VERSION does not override
17395 NAME/NULL.
17396 * testsuite/ver_test_6.c: New file.
17397 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
17398 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
17399 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
17400
17401 2008-03-26 Ian Lance Taylor <iant@google.com>
17402
17403 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
17404 of an undefined symbol from a version script.
17405 * testsuite/Makefile.am (ver_test_5.so): New target.
17406 (ver_test_5.o): New target.
17407 (check_SCRIPTS): Add ver_test_5.sh.
17408 (check_DATA): Add ver_test_5.syms.
17409 (ver_test_5.syms): New target.
17410 * testsuite/ver_test_5.cc: New file.
17411 * testsuite/ver_test_5.script: New file.
17412 * testsuite/ver_test_5.sh: New file.
17413 * Makefile.in, testsuite/Makefile.in: Rebuild.
17414
17415 PR gold/5986
17416 Fix problems building gold with gcc 4.3.0.
17417 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
17418 (gold_error_at_location, gold_warning_at_location): Use it.
17419 * configure.ac: Check whether we can compile and use a template
17420 function with a printf attribute.
17421 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
17422 when jumping over bytes.
17423 * object.cc: Instantiate Object::read_section_data.
17424 * debug.h: Include <cstring>
17425 * dwarf_reader.cc: Include <algorithm>
17426 * main.cc: Include <cstring>.
17427 * options.cc: Include <cstring>.
17428 * output.cc: Include <cstring>.
17429 * script.cc: Include <cstring>.
17430 * script.h: Include <string>.
17431 * symtab.cc: Include <cstring> and <algorithm>.
17432 * target-select.cc: Include <cstring>.
17433 * version.cc: Include <string>.
17434 * testsuite/testmain.cc: Include <cstdlib>.
17435 * configure, config.in: Rebuild.
17436
17437 2008-03-25 Ian Lance Taylor <iant@google.com>
17438
17439 * options.cc: Include "../bfd/bfdver.h".
17440 (options::help): Print bug reporting address.
17441
17442 * version.cc (print_version): Adjust output for current value of
17443 BFD_VERSION_STRING.
17444
17445 * NEWS: New file.
17446
17447 * options.cc (options::help): Print list of supported targets.
17448 * target-select.h: Include <vector>.
17449 (class Target_selector): Make machine_, size_, and is_big_endian_
17450 fields const. Add bfd_name_ and instantiated_target_ fields.
17451 (Target_selector::Target_selector): Add bfd_name parameter.
17452 (Target_selector::recognize): Make non-virtual, call
17453 do_recognize.
17454 (Target_selector::recognize_by_name): Make non-virtual, call
17455 do_recognize_by_name.
17456 (Target_selector::supported_names): New function.
17457 (Target_selector::bfd_name): New function.
17458 (Target_selector::do_instantiate_target): New pure virtual
17459 function.
17460 (Target_selector::do_recognize): New virtual function.
17461 (Target_selector::do_recognize_by_name): New virtual function.
17462 (Target_selector::instantiate_target): New private function.
17463 (supported_target_names): Declare.
17464 * target-select.cc (Target_selector::Target_selector): Update for
17465 new parameter and fields.
17466 (select_target_by_name): Check that the name matches before
17467 calling recognize_by_name.
17468 (supported_target_names): New function.
17469 * i386.cc (class Target_selector_i386): Update Target_selector
17470 constructor call. Remove recognize and recognize_by_name. Add
17471 do_instantiate_target.
17472 * x86_64.cc (class Target_selector_x86_64): Likewise.
17473 * testsuite/testfile.cc (class Target_selector_test): Update for
17474 changes to Target_selector.
17475
17476 * README: Rewrite, with some notes on unsupported features.
17477
17478 2008-03-24 Cary Coutant <ccoutant@google.com>
17479
17480 * i386.cc (Target_i386::Got_type): New enum declaration.
17481 (Target_i386::Scan::local): Updated callers of Output_data_got
17482 member functions.
17483 (Target_i386::Scan::global): Likewise.
17484 (Target_i386::Relocate::relocate): Likewise.
17485 (Target_i386::Relocate::relocate_tls): Likewise.
17486 * object.h (Got_offset_list): New class.
17487 (Sized_relobj::local_has_got_offset): Added got_type parameter.
17488 (Sized_relobj::local_got_offset): Likewise.
17489 (Sized_relobj::set_local_got_offset): Likewise.
17490 (Sized_relobj::local_has_tls_got_offset): Removed.
17491 (Sized_relobj::local_tls_got_offset): Removed.
17492 (Sized_relobj::set_local_tls_got_offset): Removed.
17493 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
17494 * output.cc (Output_data_got::add_global): Added got_type parameter.
17495 (Output_data_got::add_global_with_rel): Likewise.
17496 (Output_data_got::add_global_with_rela): Likewise.
17497 (Output_data_got::add_global_pair_with_rel): New function.
17498 (Output_data_got::add_global_pair_with_rela): New function.
17499 (Output_data_got::add_local): Added got_type parameter.
17500 (Output_data_got::add_local_with_rel): Likewise.
17501 (Output_data_got::add_local_with_rela): Likewise.
17502 (Output_data_got::add_local_pair_with_rel): New function.
17503 (Output_data_got::add_local_pair_with_rela): New function.
17504 (Output_data_got::add_global_tls): Removed.
17505 (Output_data_got::add_global_tls_with_rel): Removed.
17506 (Output_data_got::add_global_tls_with_rela): Removed.
17507 (Output_data_got::add_local_tls): Removed.
17508 (Output_data_got::add_local_tls_with_rel): Removed.
17509 (Output_data_got::add_local_tls_with_rela): Removed.
17510 * output.h (Output_data_got::add_global): Added got_type parameter.
17511 (Output_data_got::add_global_with_rel): Likewise.
17512 (Output_data_got::add_global_with_rela): Likewise.
17513 (Output_data_got::add_global_pair_with_rel): New function.
17514 (Output_data_got::add_global_pair_with_rela): New function.
17515 (Output_data_got::add_local): Added got_type parameter.
17516 (Output_data_got::add_local_with_rel): Likewise.
17517 (Output_data_got::add_local_with_rela): Likewise.
17518 (Output_data_got::add_local_pair_with_rel): New function.
17519 (Output_data_got::add_local_pair_with_rela): New function.
17520 (Output_data_got::add_global_tls): Removed.
17521 (Output_data_got::add_global_tls_with_rel): Removed.
17522 (Output_data_got::add_global_tls_with_rela): Removed.
17523 (Output_data_got::add_local_tls): Removed.
17524 (Output_data_got::add_local_tls_with_rel): Removed.
17525 (Output_data_got::add_local_tls_with_rela): Removed.
17526 * resolve.cc (Symbol::override_base_with_special): Removed
17527 reference to has_got_offset_ field.
17528 * symtab.cc (Symbol::init_fields): Replaced initialization
17529 of got_offset_ with got_offsets_. Removed initialization
17530 of has_got_offset_
17531 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
17532 (Symbol::got_offset): Likewise.
17533 (Symbol::set_got_offset): Likewise.
17534 (Symbol::has_tls_got_offset): Removed.
17535 (Symbol::tls_got_offset): Removed.
17536 (Symbol::set_tls_got_offset): Removed.
17537 (Symbol::got_offset_): Removed.
17538 (Symbol::tls_mod_got_offset_): Removed.
17539 (Symbol::tls_pair_got_offset_): Removed.
17540 (Symbol::got_offsets_): New field.
17541 (Symbol::has_got_offset): Removed.
17542 (Symbol::has_tls_mod_got_offset): Removed.
17543 (Symbol::has_tls_pair_got_offset): Removed.
17544 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
17545 (Target_x86_64::Scan::local): Updated callers of Output_data_got
17546 member functions.
17547 (Target_x86_64::Scan::global): Likewise.
17548 (Target_x86_64::Relocate::relocate): Likewise.
17549 (Target_x86_64::Relocate::relocate_tls): Likewise.
17550
17551 2008-03-25 Ben Elliston <bje@au.ibm.com>
17552
17553 * yyscript.y: Fix spelling error in comment.
17554
17555 2008-03-24 Ian Lance Taylor <iant@google.com>
17556
17557 * options.h (class General_options): Define build_id option.
17558 * layout.h (class Layout): Declare write_build_id, create_note,
17559 create_build_id. Add build_id_note_ member.
17560 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
17561 "libiberty.h", "md5.h", "sha1.h".
17562 (Layout::Layout): Initialize eh_frame_data_,
17563 eh_frame_hdr_section_, and build_id_note_.
17564 (Layout::finalize): Call create_build_id.
17565 (Layout::create_note): New function, broken out of
17566 Layout::create_gold_note.
17567 (Layout::create_gold_note): Call create_note.
17568 (Layout::create_build_id): New function.
17569 (Layout::write_build_id): New function.
17570 (Close_task_runner::run): Call write_build_id.
17571
17572 * x86_64.cc: Correct license to GPLv3.
17573
17574 2008-03-23 Ian Lance Taylor <iant@google.com>
17575
17576 * options.cc: Include "demangle.h".
17577 (parse_optional_string): New function.
17578 (parse_long_option): Handle takes_optional_argument.
17579 (parse_short_option): Update dash_z initializer. Handle
17580 takes_optional_argument.
17581 (General_options::General_options): Initialize do_demangle_.
17582 (General_options::finalize): Set do_demangle_. Handle demangling
17583 style.
17584 * options.h (parse_optional_string): Declare.
17585 (struct One_option): Add optional_arg field. Update constructor.
17586 Update call constructor calls. Add takes_optional_argument
17587 function.
17588 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
17589 (DEFINE_optional_string): Define.
17590 (General_options::demangle): Change from DEFINE_bool to
17591 DEFINE_optional_string.
17592 (General_options::no_demangle): New function.
17593 (General_options::do_demangle): New function.
17594 (General_options::set_do_demangle): New function.
17595 (General_options::execstack_status_): Move definition to end of
17596 class definition.
17597 (General_options::static_): Likewise.
17598 (General_options::do_demangle_): New field.
17599 * object.cc (big_endian>::get_symbol_location_info): Call
17600 Options::do_demangle, not Options::demangle.
17601 * symtab.cc (demangle): Likewise.
17602
17603 2008-03-22 Ian Lance Taylor <iant@google.com>
17604
17605 * gold.h: Include <cstddef> and <sys/types.h>
17606 * options.h: Include <cstring>.
17607
17608 2008-03-21 Ian Lance Taylor <iant@google.com>
17609
17610 * Added source code to GNU binutils.
17611 \f
17612 Copyright (C) 2008-2015 Free Software Foundation, Inc.
17613
17614 Copying and distribution of this file, with or without modification,
17615 are permitted in any medium without royalty provided the copyright
17616 notice and this notice are preserved.
17617
17618 Local Variables:
17619 mode: change-log
17620 left-margin: 8
17621 fill-column: 74
17622 version-control: never
17623 End:
This page took 0.378823 seconds and 5 git commands to generate.