Support 64-bit entry size in SHT_HASH (for s390).
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2015-10-28 Marcin Koƛcielnicki <koriakin@0x04.net>
2
3 * dynobj.cc (Dynobj::create_elf_hash_table): Create hash table with
4 target-specific entry size.
5 (Dynobj::sized_create_elf_hash_table): Add size template parameter.
6 * dynobj.h (Dynobj::sized_create_elf_hash_table): Likewise.
7 * layout.cc (Layout::create_dynamic_symtab): Set entsize to
8 hash_entry_size.
9 * target.h (Target::hash_entry_size): New method.
10 (Target::Target_info::hash_entry_size): New data member.
11
12 * aarch64.cc (Target_aarch64::aarch64_info): Add hash_entry_size.
13 * arm.cc (Target_arm::arm_info): Likewise.
14 (Target_arm_nacl::arm_nacl_info): Likewise.
15 * i386.cc (Target_i386::i386_info): Likewise.
16 (Target_i386_nacl::i386_nacl_info): Likewise.
17 (Target_iamcu::iamcu_info): Likewise.
18 * mips.cc (Target_mips::mips_info): Likewise.
19 (Target_mips_nacl::mips_nacl_info): Likewise.
20 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
21 * sparc.cc (Target_sparc::sparc_info): Likewise.
22 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
23 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
24 (Target_x86_64_nacl::x86_64_nacl_info): Likewise.
25 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
26
27 2015-10-28 H.J. Lu <hongjiu.lu@intel.com>
28
29 PR gold/19177
30 * i386.cc (Target_i386::Relocate::relocate): Check R_386_GOT32
31 and R_386_GOT32X relocations without base register.
32
33 2015-10.27 Han Shen <shenhan@google.com>
34
35 PR gold/19042 - unsupported reloc 311/312.
36
37 * aarch64.cc (Target_aarch64::Scan::local): Add support for
38 reloc 311/312.
39
40 2015-10-22 H.J. Lu <hongjiu.lu@intel.com>
41
42 * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
43 Treat R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX the same
44 as R_X86_64_GOTPCREL.
45 (Target_x86_64<size>::Scan::local): Likewise.
46 (Target_x86_64<size>::Scan::possible_function_pointer_reloc):
47 Likewise.
48 (Target_x86_64<size>::Scan::global): Likewise.
49 (Target_x86_64<size>::Relocate::relocate): Likewise.
50 (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
51 Likewise.
52
53 2015-10-22 H.J. Lu <hongjiu.lu@intel.com>
54
55 * i386.cc (Target_i386::Scan::get_reference_flags(): Treat
56 R_386_GOT32X the same as R_386_GOT32.
57 (Target_i386::Scan::local): Likewise.
58 (Target_i386::Scan::possible_function_pointer_reloc): Likewise.
59 (Target_i386::Scan::global): Likewise.
60 (Target_i386::Relocate::relocate): Likewise.
61 (Target_i386::Relocatable_size_for_reloc::get_size_for_reloc):
62 Likewise.
63
64 2015-10-20 H.J. Lu <hongjiu.lu@intel.com>
65
66 * testsuite/Makefile.am (x86_64_mov_to_lea11): Replace
67 x86_64_mov_to_lea1.o with x86_64_mov_to_lea2.o.
68 (x86_64_mov_to_lea12): Replace x86_64_mov_to_lea2.o with
69 x86_64_mov_to_lea1.o.
70 * testsuite/Makefile.in: Regenerated.
71
72 2015-10-16 H.J. Lu <hongjiu.lu@intel.com>
73
74 PR gold/19119
75 * options.h (General_options): Remove "obsolete" from -m.
76 * parameters.cc (set_parameters_target): Check if input target
77 is compatible with output emulation set by "-m emulation".
78
79 2015-10-13 H.J. Lu <hongjiu.lu@intel.com>
80
81 PR gold/19118
82 * i386.cc (Target_iamcu): New class.
83 (Target_selector_iamcu): Likewise.
84 (Target_iamcu::iamcu_info): New variable.
85 (target_selector_iamcu): Likewise.
86
87 2015-10-07 Andreas Schwab <schwab@suse.de>
88
89 * aarch64.cc (aarch64_info): Set abi_pagesize to 64K.
90
91 2015-10-06 Cary Coutant <ccoutant@gmail.com>
92
93 PR gold/18855
94 * sparc.cc (Sparc_relocate_functions::gdop_hix22): Remove addend
95 parameter.
96 (Sparc_relocate_functions::gdop_lox10): Likewise.
97 (Target_sparc::Relocate::relocate): Use addend when computing
98 symbol value for R_SPARC_GOTDATA_OP*.
99
100 2015-09-07 Cary Coutant <ccoutant@gmail.com>
101
102 PR gold/18930
103 PR gold/18886
104 * resolve.cc (Symbol::override_base): Don't convert IFUNC symbols here.
105 * symtab.cc (Symbol_table::add_from_dynobj): Convert them here instead.
106
107 2015-09-02 H.J. Lu <hongjiu.lu@intel.com>
108
109 PR gold/18886
110 * resolve.cc (Symbol::override_base): Turn IFUNC symbols from
111 shared libraries into normal FUNC symbols.
112 * symtab.cc (Symbol_table::sized_write_symbol): Assert IFUNC
113 symbols aren't from shared libraries.
114
115 2015-09-02 Alan Modra <amodra@gmail.com>
116
117 PR 18878
118 * powerpc.cc (Target_powerpc): Add savres_section_ and accessor.
119 (Target_powerpc::Branch_info::make_stub): Determine whether long
120 branch stub is for save/restore function.
121 (Branch_stub_ent): Add save_res_, and extra parm to constructor.
122 (Stub_table): Add need_save_res_.
123 (Stub_table:clear_stubs): Clear need_save_res_.
124 (Stub_table:set_address_and_size): Add save/restore section size.
125 (Stub_table::add_long_branch_entry): Add save_res param. Set
126 need_save_res_, but don't add space for save/restore stubs.
127 (Stub_table::find_long_branch_entry): Return offset to local copy
128 of save/restore func.
129 (Stub_table::do_write): Don't output save/restore stubs. Instead
130 copy the save/restore functions.
131 (Output_data_save_res:contents): New accessor.
132 (Target_powerpc::define_save_restore_funcs): Set savres_section_.
133
134 2015-08-25 Cary Coutant <ccoutant@gmail.com>
135
136 PR gold/18847
137 * script-sections.cc (Memory_region::set_address): New method.
138 (Script_sections::find_memory_region): Add explicit_only parameter.
139 (Output_section_definition::set_section_addresses): Handle case where
140 script specifies both address and vma region.
141 * script-sections.h (Script_sections::find_memory_region): Add
142 explicit_only parameter.
143
144 2015-08-25 Cary Coutant <ccoutant@gmail.com>
145
146 PR gold/18859
147 * object.cc (Input_objects::add_object): Store objects in a map,
148 indexed by soname; update as-needed flag when necessary.
149 * object.h (Object::clear_as_needed): New method.
150 (Input_objects::so_names_): Change from set to map.
151
152 2015-08-25 Cary Coutant <ccoutant@gmail.com>
153
154 PR gold/14746
155 * expression.cc (Expression::Expression_eval_info): Add
156 is_valid_pointer field.
157 (Expression::eval_maybe_dot): Add is_valid_pointer parameter.
158 Adjust all callers.
159 (Addr_expression::value_from_output_section): Check whether address
160 is valid.
161 * script.cc (Symbol_assignment::set_if_absolute): Defer assignment
162 if evaluation failed due to address that is not yet valid.
163 * script.h: (Expression::eval_maybe_dot): Add is_valid_pointer
164 parameter.
165
166 2015-08-25 Cary Coutant <ccoutant@gmail.com>
167
168 PR gold/18866
169 PR gold/18703
170 * symtab.cc (Symbol_table): Reorder conditions to avoid internal error.
171
172 2015-08-20 Alan Modra <amodra@gmail.com>
173
174 PR gold/18846
175 * target-reloc.h (relocate_relocs <RELOC_ADJUST_FOR_SECTION_RELA>):
176 Subtract os->address() from addend.
177 * powerpc.cc (relocate_relocs): Likewise.
178
179 2015-08-12 Simon Dardis <simon.dardis@imgtec.com>
180
181 * mips.cc (plt0_entry_o32, plt0_entry_n32, plt0_entry_n64,
182 lazy_stub_normal_1, lazy_stub_normal_1_n64,
183 lazy_stub_normal_2, lazy_stub_normal_2_n64, lazy_stub_big,
184 lazy_stub_big_n64, lazy_stub_micromips32_normal_1_n64,
185 lazy_stub_micromips32_normal_2_n64, lazy_stub_micromips32_big,
186 lazy_stub_micromips32_big_n64): Update to use 'or' for move instead
187 of 'addu/daddu'.
188
189 2015-07-27 H.J. Lu <hongjiu.lu@intel.com>
190
191 * configure: Regenerated.
192
193 2015-07-26 Doug Kwan <dougkwan@google.com>
194
195 * testsuite/arm_unaligned_reloc.{s,sh}: Make test less sensitive to
196 disassembler output format.
197
198 2015-07-23 Ian Coolidge <icoolidge@google.com>
199 Plumb --pic-veneer option for gold.
200
201 * arm.cc (Reloc_stub::stub_type_for_reloc): Plumb to stub
202 generation.
203 * options.h (General_options): Add --pic-veneer option.
204
205 2015-07-22 H.J. Lu <hongjiu.lu@intel.com>
206
207 PR gold/18663
208 * testsuite/Makefile.am (script_test_1_SOURCES): Set to
209 script_test_1a.cc script_test_1b.cc.
210 (script_test_11_r.o): Replace script_test_11.o with
211 script_test_11a.o script_test_11b.o.
212 (script_test_11.o): Removed.
213 (script_test_11a.o): New.
214 (script_test_11b.o): Likewise.
215 * testsuite/Makefile.in: Regenerated.
216 * testsuite/script_test_1.h: New file.
217 * testsuite/script_test_1b.cc: Likewise.
218 * testsuite/script_test_11.h: Likewise.
219 * testsuite/script_test_11b.c: Likewise.
220 * testsuite/script_test_1.cc: Renamed to ...
221 * testsuite/script_test_1a.cc: This.
222 Include "script_test_1.h".
223 (main): Call check_int and check_ptr.
224 * testsuite/script_test_11.c: Renamed to ...
225 * testsuite/script_test_11a.c: This.
226 Include "script_test_11.h".
227 (main): Call ptr_equal.
228
229 2015-07-22 H.J. Lu <hongjiu.lu@intel.com>
230
231 PR gold/18628
232 * testsuite/ifuncdep2.c (global): Change protected to hidden.
233 * testsuite/ifuncmod1.c (global): Likewise.
234 * testsuite/ifuncmod5.c (global): Likewise.
235
236 2015-07-22 Alan Modra <amodra@gmail.com>
237
238 * aarch64.cc (try_fix_erratum_843419_optimized): Warning fix.
239
240 2015-07-21 Cary Coutant <ccoutant@gmail.com>
241
242 PR gold/18548
243 * symtab.cc (Symbol_table::do_define_in_output_data): Check for
244 forced local symbol even when oldsym != NULL.
245 (Symbol_table::do_define_in_output_segment): Likewise.
246 (Symbol_table::do_define_as_constant): Likewise.
247
248 2015-07-21 Cary Coutant <ccoutant@gmail.com>
249
250 PR gold/18698
251 * archive.cc (Library_base::should_include_member): Don't use entry
252 point for relocatable links, or if target is not yet valid.
253 * parameters.cc (Parameters::entry): Check target_valid().
254
255 2015-07-20 Han Shen <shenhan@google.com>
256
257 Optimize erratum 843419 fix.
258
259 * aarch64.cc (AArch64_insn_utilities::is_adr): New method.
260 (AArch64_insn_utilities::aarch64_adr_encode_imm): New method.
261 (AArch64_insn_utilities::aarch64_adrp_decode_imm): New method.
262 (E843419_stub): New sub-class of Erratum_stub.
263 (AArch64_relobj::try_fix_erratum_843419_optimized): New method.
264 (AArch64_relobj::section_needs_reloc_stub_scanning): Try optimized fix.
265 (AArch64_relobj::create_erratum_stub): Add 1 argument.
266 (Target_aarch64::scan_erratum_843419_span): Pass in adrp insn offset.
267
268 2015-07-20 Han Shen <shenhan@google.com>
269
270 Fix arm elf header flags wrt hardfp bit.
271
272 * arm.cc (Target_arm::do_adjust_elf_header): Set flags into view.
273
274 2015-07-20 H.J. Lu <hongjiu.lu@intel.com>
275
276 PR gold/18689
277 * layout.cc (Layout::layout): Clear the SHF_COMPRESSED flag bit
278 from input group section for relocatable link.
279 * testsuite/Makefile.am (check_SCRIPTS): Add pr18689.sh.
280 (check_DATA): Add pr18689.stdout.
281 (MOSTLYCLEANFILES): Add pr18689a.o pr18689b.o.
282 (pr18689.stdout): New rule.
283 (pr18689a.o): Likewise.
284 (pr18689b.o): Likewise.
285 (pr18689.o): Likewise.
286 * testsuite/pr18689.c: New file.
287 * testsuite/pr18689.sh: Likewise.
288 * testsuite/Makefile.in: Regenerated.
289
290 2015-07-20 Yiran Wang <yiran@google.com>
291 Cary Coutant <ccoutant@gmail.com>
292
293 PR gold/15574
294 * resolve.cc (Symbol_table): Remove warning about references
295 from shared objects to hidden symbols.
296 * testsuite/Makefile.am (hidden_test): Add hidden_test.syms.
297 * testsuite/Makefile.in: Regenerate.
298 * testsuite/hidden_test.sh: Check dynamic symbol table; update
299 expected error messages.
300
301 2015-07-14 H.J. Lu <hongjiu.lu@intel.com>
302
303 * compressed_output.cc (Output_compressed_section::set_final_data_size):
304 Make --compress-debug-sections=zlib the same as
305 --compress-debug-sections=zlib-gabi.
306 * testsuite/Makefile.am (flagstest_compress_debug_sections.check):
307 Expect ".debug_.*" with the SHF_COMPRESSED bit, instead of
308 ".zdebug_".
309 * testsuite/Makefile.in: Regenerated.
310
311 2015-07-12 H.J. Lu <hongjiu.lu@intel.com>
312
313 PR gold/18322
314 * compressed_output.cc (zlib_compress): Add argument for
315 compression header size. Set header size to compression header
316 size if it isn't 0. Don't write out the zlib header here.
317 (Output_compressed_section::set_final_data_size): Support
318 zlib-gnu and zlib-gabi compressions. Pass compression header
319 size to zlib_compress and write out compression header. Set
320 the SHF_COMPRESSED bit for zlib-gabi compression. Otherwise
321 clear the SHF_COMPRESSED bit
322 * options.h (compress_debug_sections): Add zlib-gnu and
323 zlib-gabi.
324 * output.h (Output_section::set_flags): New.
325 * testsuite/Makefile.am (check_PROGRAMS): Add
326 flagstest_compress_debug_sections_none,
327 flagstest_compress_debug_sections_gnu and
328 flagstest_compress_debug_sections_gabi.
329 (check_DATA): Add flagstest_compress_debug_sections_none.stdout.
330 flagstest_compress_debug_sections.stdout,
331 flagstest_compress_debug_sections.cmp,
332 flagstest_compress_debug_sections.check,
333 flagstest_compress_debug_sections_gnu.stdout,
334 flagstest_compress_debug_sections_gnu.cmp,
335 flagstest_compress_debug_sections_gnu.check,
336 flagstest_compress_debug_sections_gabi.stdout,
337 flagstest_compress_debug_sections_gabi.cmp and
338 flagstest_compress_debug_sections_gabi.check.
339 (flagstest_compress_debug_sections_none): New.
340 (flagstest_compress_debug_sections_none.stdout): Likewise.
341 (flagstest_compress_debug_sections.stdout): Likewise.
342 (flagstest_compress_debug_sections.check): Likewise.
343 (flagstest_compress_debug_sections.cmp): Likewise.
344 (flagstest_compress_debug_sections_gnu): Likewise.
345 (flagstest_compress_debug_sections_gnu.stdout): Likewise.
346 (flagstest_compress_debug_sections_gnu.check): Likewise.
347 (flagstest_compress_debug_sections_gnu.cmp): Likewise.
348 (flagstest_compress_debug_sections_gabi): Likewise.
349 (flagstest_compress_debug_sections_gabi.stdout): Likewise.
350 (flagstest_compress_debug_sections_gnu.check): Likewise.
351 (flagstest_compress_debug_sections_gnu.cmp): Likewise.
352 * testsuite/Makefile.in: Regenerated.
353
354 2015-07-12 H.J. Lu <hongjiu.lu@intel.com>
355
356 PR gold/18321
357 * compressed_output.h (decompress_input_section): Add arguments
358 for ELF class, big endian and sh_flags.
359 * compressed_output.cc (decompress_input_section): Likewise.
360 Support the SHF_COMPRESSED section.
361 * dynobj.h (Dynobj): Add elfsize and is_big_endian member
362 functions.
363 * plugin.h (Pluginobj): Likewise.
364 * layout.cc (Layout::get_output_section_flags): Also clear the
365 SHF_COMPRESSED bit.
366 * object.h (Compressed_section_info): Add flag to store sh_flags.
367 (Object): Add pure virtual elfsize and is_big_endian member
368 functions.
369 * object.cc (need_decompressed_section): Don't skip the ".zdebug"
370 prefix here.
371 (build_compressed_section_map): Check SHF_COMPRESSED for
372 uncompressed size. Store sh_flags in Compressed_section_info.
373 Pass size, big_endian and sh_flags to decompress_input_section.
374 Skip the ".debug"/".zdebug" prefix when passing section name to
375 need_decompressed_section.
376 (Sized_relobj_file<size, big_endian>::do_find_special_section):
377 Don't check ".zdebug_*" sections.
378 (Object::decompressed_section_contents): Pass ELF class, big
379 endian and sh_flags to decompress_input_section.
380 * reloc.cc (Sized_relobj_file<size, big_endian>::write_sections):
381 Likewise.
382 * testsuite/Makefile.am (check_DATA): Add
383 debug_msg_cdebug_gabi.err and gdb_index_test_2_gabi.stdout.
384 (MOSTLYCLEANFILES): Add debug_msg_cdebug_gabi.err and
385 gdb_index_test_2_gabi.stdout.
386 (debug_msg_cdebug_gabi.o): New.
387 (odr_violation1_cdebug_gabi.o): Likewise.
388 (odr_violation2_cdebug_gabi.o): Likewise.
389 (debug_msg_cdebug_gabi.err): Likewise.
390 (check_SCRIPTS): Add gdb_index_test_2_gabi.sh.
391 (gdb_index_test_cdebug_gabi.o): Likewise.
392 (gdb_index_test_2_gabi): Likewise.
393 (gdb_index_test_2_gabi.stdout): Likewise.
394 * testsuite/gdb_index_test_2_gabi.sh: New file.
395 * testsuite/Makefile.in: Regenerated.
396
397 2015-07-09 Han Shen <shenhan@google.com>
398
399 Use "gold_info" instead of "gold_warning" for erratum fix.
400
401 * aarch64.cc (Target_aarch64::scan_erratum_843419_span): Use
402 'gold_info'.
403 (Target_aarch64::scan_erratum_835769_span): USe 'gold_info'.
404
405 2015-07-09 Han Shen <shenhan@google.com>
406
407 Drop missing symbol warning for arm/aarch64.
408
409 * aarch64.cc (AArch64_relobj::scan_errata): Drop missing symbol warning.
410 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Drop missing
411 symbol warning.
412
413 2015-07-07 Han Shen <shenhan@google.com>
414
415 Make gold aarch64 accept long form of mapping symbols.
416
417 * aarch64.cc (AArch64_relobj::do_count_local_symbols): Make legal
418 of mapping symbols.
419
420 2015-06-29 Doug Kwan <dougkwan@google.com>
421
422 * testsuite/arm_bl_out_of_range.s: Align stub table so that it appears
423 at address expected by test.
424 * testsuite/arm_cortex_a8_b.s: Ditto.
425 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
426 * testsuite/arm_cortex_a8_bl.s: Ditto.
427 * testsuite/arm_cortex_a8_blx.s: Ditto.
428 * testsuite/arm_cortex_a8_local.s: Ditto.
429 * testsuite/arm_fix_v4bx.s: Ditto.
430 * testsuite/arm_unaligned_reloc.s: Ditto.
431 * testsuite/thumb_bl_out_of_range.s: Ditto.
432 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
433 * testsuite/thumb_blx_out_of_range.s: Ditto.
434
435 2015-06-29 Han Shen <shenhan@google.com>
436
437 Patch for erratum 843419 internal error.
438
439 * aarch64.cc (Erratum_stub::Insn_utilities): New typedef.
440 (Erratum_stub::update_erratum_insn): New method.
441 (Stub_table::relocate_stubs): Modified to place relocated insn.
442 (AArch64_relobj::fix_errata): Modified gold_assert.
443
444 2015-06-12 Han Shen <shenhan@google.com>
445
446 Fix erratum 835769.
447
448 * aarch64.cc (AArch64_insn_utilities::BYTES_PER_INSN): Move
449 defintion outside class definition.
450 (AArch64_insn_utilities::AARCH64_ZR): New static constant.
451 (AArch64_insn_utilities::aarch64_op31): New member.
452 (AArch64_insn_utilities::aarch64_ra): New member.
453 (AArch64_insn_utilities::aarch64_mac): New member.
454 (AArch64_insn_utilities::aarch64_mlxl): New member.
455 (ST_E_835769): New global enum member.
456 (Stub_table::relocate_stubs): Add 835769 handler.
457 (Stub_template_repertoire::Stub_template_repertoire): Install new
458 stub type.
459 (AArch64_relobj::scan_errata): This func is renamed from
460 scan_erratum_843419.
461 (AArch64_relobj::do_count_local_symbols): Add 835769 handler.
462 (AArch64_relobj::do_relocate_sections): Add 835769 handler.
463 (AArch64_relobj::scan_sections_for_stubs): Add 835769 handler.
464 (Target_aarch64::scan_erratum_835769_span): New method.
465 (Target_aarch64::create_erratum_stub): New method.
466 (Target_aarch64::is_erratum_835769_sequence): New method.
467 (Target_aarch64::scan_erratum_843419_sequence): Move part of the
468 code into create_erratum_stub.
469 * options.h (fix_cortex_a53_835769): New option.
470
471 2015-06-11 Cary Coutant <ccoutant@gmail.com>
472
473 * aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization
474 outside class body.
475 (Reloc_stub::STUB_ADDR_ALIGN): Likewise.
476
477 2015-06-11 Cary Coutant <ccoutant@gmail.com>
478
479 PR gold/17731
480 * layout.cc (corresponding_uncompressed_section_name): New function.
481 (Layout::choose_output_section): Call it.
482 * layout.h (corresponding_uncompressed_section_name): New function.
483 * script-sections.cc (Input_section_info::set_section_name): Check
484 for compressed debug section (.zdebug style).
485
486 2015-06-11 Jing Yu <jingyu@google.com>
487
488 * testsuite/Makefile.am: Add -O0 for script_test_12 test.
489 * testsuite/Makefile.in: Regenerate.
490
491 2015-06-11 Davide Italiano <dccitaliano@gmail.com>
492
493 * gold.h (is_cident): Correct typo.
494
495 2015-06-10 Han Shen <shenhan@google.com>
496 Patch for erratum-843419 (2 of 2 - fix erratum occurrences).
497
498 Now fixing for 843419 is fully functional.
499
500 The first part of the erratum fix CL is here -
501 https://sourceware.org/ml/binutils/2015-04/msg00229.html
502
503 * aarch64.cc(global enum): New constants representing stub types.
504 (Stub_template): New POD struct.
505 (Stub_template_repertoire): New class.
506 (Stub_base): New class.
507 (Erratum_stub): New class.
508 (Reloc_stub): Refactored to be a subclass of Stub_base.
509 (Reloc_stub::Stub_type): Removed.
510 (Reloc_stub::offset): Moved to Stub_base.
511 (Reloc_stub::set_offset): Moved to Stub_base.
512 (Reloc_stub::destination_address): Moved to Stub_base.
513 (Reloc_stub::set_destination_address): Moved to Stub_base.
514 (Reloc_stub::reset_destination_address): Moved to Stub_base.
515 (Reloc_stub::stub_type): Renamed and moved to Stub_base.
516 (Reloc_stub::stub_size): Renamed and moved to Stub_base.
517 (Reloc_stub::stub_insns): Renamed and moved to Stub_base.
518 (Reloc_stub::write): Moved to Stub_base.
519 (Reloc_stub::invalid_offset): Moved to Stub_base.
520 (Reloc_stub::invalid_address): Moved to Stub_base.
521 (Reloc_stub::stub_type_): Renamed and moved to Stub_base.
522 (Reloc_stub::stub_insns_): Moved to Stub_base.
523 (Reloc_stub::offset_): Moved to Stub_base.
524 (Reloc_stub::destination_address_): Moved to Stub_base.
525 (Stub_table::The_aarch64_relobj): New typedef.
526 (Stub_table::The_erratum_stub): New typedef.
527 (Stub_table::The_erratum_stub_less): New typedef.
528 (Stub_table::The_erratum_stub_set): New typedef.
529 (Stub_table::The_erratum_stub_set_iter): New typedef.
530 (Stub_table::empty): Added emptiness testing for erratum stubs.
531 (Stub_table::add_erratum_stub): New method to add an erratum stub.
532 (Stub_table::find_erratum_stub): New method.
533 (Stub_table::find_erratum_stubs_for_input_section): New method.
534 (Stub_table::erratum_stub_address): New method.
535 (Stub_table::update_date_size_changed_p): Modified to handle erratum stubs.
536 (Stub_table::do_addralign): Modified to handle erratum stubs.
537 (Stub_table::erratum_stubs_): New member.
538 (Stub_table::erratum_stub_size_): New member.
539 (Stub_table::relocate_stubs): Modified to handle erratum stubs.
540 (Stub_table::do_write): Modified to handle erratum stubs.
541 (AArch64_relobj::The_erratum_stub): New typedef.
542 (AArch64_relobj::Erratum_stub_set_iter): New typedef.
543 (AArch64_relobj::fix_errata): New method.
544 (Target_aarch64::The_reloc_stub_type): Removed.
545 (Target_aarch64::The_erratum_stub): New typede.
546 (AArch64_relocate_functions::construct_b): New method.
547
548 2015-06-08 Nick Clifton <nickc@redhat.com>
549
550 * po/fr.po: New French Translation.
551
552 2015-06-07 Cary Coutant <ccoutant@gmail.com>
553
554 PR gold/18288
555 * resolve.cc (symbol_to_bits): Remove type parameter; adjust all
556 callers. Don't use STT_COMMON to check for common symbols.
557 (Symbol_table::resolve): Warn if relocatable object has STT_COMMON
558 symbol that's not in a common section.
559 * symtab.h (Symbol::is_common): Don't use STT_COMMON to check for
560 common symbols.
561
562 2015-06-04 Cary Coutant <ccoutant@gmail.com>
563
564 PR gold/18200
565 * Makefile.am (diststuff): Add target.
566 * Makefile.in: Regenerate.
567
568 2015-06-04 Cary Coutant <ccoutant@gmail.com>
569
570 PR gold/17498
571 * object.cc (Sized_relobj_file::do_count_local_symbols): Discard
572 temporary locals in merge sections.
573 * options.cc (General_options::parse_discard_all): New method.
574 (General_options::parse_discard_locals): New method.
575 (General_options::parse_discard_none): New method.
576 (General_options::General_options): Initialize discard_locals_.
577 * options.h (--discard-all): Convert to special option.
578 (--discard-locals): Likewise.
579 (--discard-none): New option.
580 (General_options::discard_all): New method.
581 (General_options::discard_locals): New method.
582 (General_options::discard_sec_merge): New method.
583 (General_options::Discard_locals): New enum.
584 (General_options::discard_locals_): New data member.
585
586 2015-06-03 Cary Coutant <cary@google.com>
587
588 * script-sections.cc (Script_sections::Script_sections): Initialize
589 segments_created_.
590 (Script_sections::create_note_and_tls_segments): Set flag when
591 segments are created.
592 (Script_sections::expected_segment_count): Count PT_INTERP.
593 (Script_sections::attach_sections_using_phdrs_clause): Set flag when
594 segments are created.
595 * script-sections.h (Script_sections::segments_created_): New data
596 member.
597
598 2015-06-03 Cary Coutant <ccoutant@gmail.com>
599
600 PR gold/15370
601 * script-sections.cc
602 (Output_section_element_input::set_section_addresses): When there
603 are several patterns with no sort spec, put all sections in the same
604 bin.
605 * testsuite/Makefile.am (script_test_12): New testcase.
606 (script_test_12i): New testcase.
607 * testsuite/Makefile.in: Regenerate.
608 * testsuite/script_test_12.t: New test linker script.
609 * testsuite/script_test_12i.t: New test linker script.
610 * testsuite/script_test_12a.c: New test source file.
611 * testsuite/script_test_12b.c: New test source file.
612
613 2015-06-02 Cary Coutant <ccoutant@gmail.com>
614
615 * nacl.h (Sniff_file): Switch parameters to get_view to get an
616 aligned view.
617
618 2015-06-03 Cary Coutant <ccoutant@gmail.com>
619
620 PR gold/17819
621 * gold.cc (queue_final_tasks): When --build-id=tree, queue a
622 separate task to schedule the build id computation.
623 * layout.cc (Hash_task::Hash_task): Remove build_id_blocker,
624 add Output_file and offset.
625 (Hash_task::run): Get and release the input views.
626 (Hash_task::is_runnable): Always return NULL (always runnable).
627 (Layout::queue_build_id_tasks): Remove.
628 (Layout::write_build_id): Add array_of_hashes and size_of_hashes
629 parameters; use them instead of class members.
630 (Build_id_task_runner::run): New function.
631 (Close_task_runner::run): Pass array_of_hashes and size_of_hashes
632 to write_build_id.
633 * layout.h (Layout::queue_build_id_tasks): Remove.
634 (Layout::write_build_id): Add array_of_hashes and size_of_hashes
635 parameters.
636 (Layout::array_of_hashes_): Remove.
637 (Layout::size_of_array_of_hashes_): Remove.
638 (Layout::input_view_): Remove.
639 (Build_id_task_runner): New class.
640 (Close_task_runner::Close_task_runner): Add array_of_hashes and
641 size_of_hashes parameters.
642 (Close_task_runner::array_of_hashes_): New data member.
643 (Close_task_runner::size_of_hashes_): New data member.
644 * testsuite/Makefile.am
645 (flagstest_compress_debug_sections_and_build_id_tree): New test.
646 * testsuite/Makefile.in: Regenerate.
647
648 2015-06-01 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
649
650 * merge.cc (get_input_merge_map): Update for data structure change.
651 (get_or_make_input_merge_map): Update for data structure change.
652 * merge.h (Object_merge_map): Use a std::vector<std::pair>> instead of
653 a std::map. Remove first_shnum_, first_map_, second_shnum_, second_map_.
654
655 2015-05-16 Alan Modra <amodra@gmail.com>
656
657 * reloc.cc (Sized_relobj_file::find_functions): Use function_location.
658 * powerpc.cc (Target_powerpc::do_calls_non_split): New function.
659 (addi_12_1, addis_2_12, addis_12_1, cmpld_7_12_0): New constants.
660 (lis_0): Rename from lis_0_0.
661
662 2015-04-29 Cary Coutant <cary@google.com>
663 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
664
665 * gc.h (Garbage_collection::is_section_garbage): Change Object*
666 to Relobj*.
667 (Garbage_collection::add_reference): Likewise.
668 (Garbage_collection::gc_process_relocs): Likewise. Don't push
669 object/shndx pair onto *secvec for dynamic objects. Don't follow
670 relocations pointing to dynamic objects for GC.
671 * icf.cc (Icf::find_identical_sections): Change Object* to Relobj*.
672 (Icf::unfold_section): Likewise.
673 (Icf::is_section_folded): Likewise.
674 (Icf::get_folded_section): Likewise.
675 * icf.h: (Icf::get_folded_section): Likewise.
676 (Icf::unfold_section): Likewise.
677 (Icf::is_section_folded): Likewise.
678 (Icf::section_has_function_pointers): Likewise.
679 (Icf::set_section_has_function_pointers): Likewise.
680 * object.h (Section_id): Likewise.
681 (Const_section_id): Likewise.
682 * output.cc (Output_section::update_section_layout): Likewise.
683 * output.h: (Output_section_lookup_maps::find_relaxed_input_section):
684 Likewise.
685 * plugin.cc (update_section_order): Likewise.
686 (unique_segment_for_sections): Likewise.
687 * powerpc.cc (Powerpc_relobj::add_reference): Likewise.
688 (Target_powerpc::do_gc_add_reference): Likewise.
689 (Target_powerpc::gc_process_relocs): Likewise.
690 (Target_powerpc::do_gc_add_reference): Likewise.
691 * symtab.cc (Symbol_table::is_section_folded): Likewise.
692 (Symbol_table::gc_mark_symbol): Likewise.
693 * symtab.h: (Symbol_table::is_section_folded): Likewise.
694 * target.h: (Sized_target::gc_add_reference): Likewise.
695 (Sized_target::do_gc_add_reference): Likewise.
696
697 2015-04-29 Nick Clifton <nickc@redhat.com>
698
699 * po/fi.po: Updated Finnish translation.
700
701 2015-04-28 Alan Modra <amodra@gmail.com>
702
703 * powerpc.cc (Target_powerpc::do_dynsym_value): Use Address rather
704 than unsigned int for find_global_entry result temp. Compare
705 against invalid_address.
706 (Target_powerpc::do_plt_address_for_global): Likewise.
707 (Target_powerpc::Relocate::relocate): Likewise. Don't assert
708 on plt call stub existence for debug info. Do assert for plt
709 and global entry stub existence if an alloc section.
710
711 2015-04-28 Alan Modra <amodra@gmail.com>
712
713 * powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert
714 on missing global entry stub due to bogus debug info.
715
716 2015-04-27 Han Shen <shenhan@google.com>
717
718 * options.h (--fix-cortex-a53-843419): Rename option.
719 * aarch64.cc (AArch64_relobj::do_count_local_symbols): Use renamed
720 option.
721 (AArch64_relobj::scan_sections_for_stubs): Use renamed option.
722
723 2015-04-27 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
724
725 PR gold/18327
726 * output.cc (Output_section::is_input_address_mapped): Assume a missing
727 entry is mapped.
728 * testsuite/Makefile.am: Add the eh_test test.
729 * testsuite/Makefile.in: Regenerate.
730 * testsuite/eh_test_a.cc: New test.
731 * testsuite/eh_test_b.cc: New test.
732
733 2015-04-23 Sriraman Tallam <tmsriram@google.com>
734
735 * options.h (--weak-unresolved-symbols): New option.
736 * symtab.cc (Symbol_table::sized_write_globals): Change symbol
737 binding to weak with new option.
738 * symtab.h (is_weak_undefined): Check for new option.
739 (is_strong_undefined): Check for new option.
740 * testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
741 * testsuite/Makefile.in: Regenerate.
742 * testsuite/weak_unresolved_symbols_test.cc: New file.
743
744 2015-04-20 Ian Coolidge <icoolidge@google.com>
745
746 * symtab.cc (Symbol::should_add_dynsym_entry): Return true for
747 GNU_UNIQUE.
748
749 2015-04-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
750
751 * gc.cc (Garbage_collection::do_transitive_closure): Use back and
752 push_back.
753 * gc.h (Garbage_collection): Use a std::vector instead of a std::queue.
754 * object.cc (Sized_relobj_file::do_layout): Use push_back.
755 * powerpc.cc (process_gc_mark): Use push_back.
756 (Target_powerpc::do_gc_mark_symbol): Use push_back.
757 * symtab.cc (Symbol_table::gc_mark_symbol): Use push_back.
758
759 2015-04-16 Han Shen <shenhan@google.com>
760
761 * aarch64.cc (AArch64_insn_utilities): New utility class.
762 (AArch64_relobj::Mapping_symbol_position): New struct.
763 (AArch64_relobj::Mapping_symbol_info): New typedef.
764 (AArch64_relobj::do_count_local_symbols): New function overriding
765 parent's implementation.
766 (AArch64_relobj::mapping_symbol_info_): New member
767 (AArch64_relobj::scan_erratum_843419): New method.
768 (Target_aarch64::scan_erratum_843419_span): New method.
769 (Target_aarch64::is_erratum_843419_sequence): New method.
770 * options.h (fix_cortex_a53): New option.
771
772 2015-04-09 Cary Coutant <ccoutant@google.com>
773
774 * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
775 in a PIE link.
776 * testsuite/Makefile.am (tls_pie_test.sh): New test.
777 * testsuite/Makefile.in: Regenerate.
778 * testsuite/tls_pie_test.sh: New.
779
780 2015-04-09 Cary Coutant <ccoutant@google.com>
781
782 * debug.h (DEBUG_LOCATION): New.
783 (DEBUG_ALL): Include DEBUG_LOCATION.
784 (debug_string_to_enum): Add DEBUG_LOCATION.
785 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
786 output to print correct context.
787 (Sized_dwarf_line_info::do_addr2line): Add debug output. Return
788 up to 4 more locations at the beginning of the function.
789 * symtab.cc (Symbol_table::detect_odr_violations): Get canonical
790 result before sorting list of line numbers.
791 * testsuite/debug_msg.sh: Allow range of line numbers for
792 canonical results on optimized code.
793
794 2015-04-07 HC Yen <hc.yen@mediatek.com>
795
796 Add AArch32 support for gold linker.
797 gold/
798 * arm.cc: Add V8 arch combine table.
799
800 2015-04-06 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
801
802 * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
803
804 2015-04-06 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
805
806 * gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
807 to find by using the return value of insert.
808
809 2015-04-06 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
810
811 * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
812 constructor call.
813
814 2015-04-06 Ilya Tocar <ilya.tocar@intel.com>
815
816 PR gold/17641
817 * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
818 (Target_x86_64::Scan::local): Don't create GOT entry, when we
819 can convert mov to lea.
820 (Target_x86_64::Scan::global): Ditto.
821 (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
822 %reg to lea foo(%rip), %reg if possible.
823 * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
824 * testsuite/x86_64_mov_to_lea1.s: New.
825 * testsuite/x86_64_mov_to_lea2.s: Ditto.
826 * testsuite/x86_64_mov_to_lea3.s: Ditto.
827 * testsuite/x86_64_mov_to_lea4.s: Ditto.
828 * testsuite/x86_64_mov_to_lea.sh: Ditto.
829
830 2015-04-02 H.J. Lu <hongjiu.lu@intel.com>
831
832 * configure: Regenerated.
833
834 2015-04-01 Ilya Tocar <ilya.tocar@intel.com>
835
836 PR gold/17640
837 * i386.cc (Target_i386::can_convert_mov_to_lea): New.
838 (Target_i386::Scan::local): Don't create GOT entry, when we
839 can convert GOT to GOTOFF.
840 (Target_i386::Scan::global): Ditto.
841 (Target_i386::Relocate::relocate): Convert mov foo@GOT(%reg), %reg to
842 lea foo@GOTOFF(%reg), %reg if possible.
843 * testsuite/Makefile.am (i386_mov_to_lea): New test.
844 * testsuite/i386_mov_to_lea1.s: New.
845 * testsuite/i386_mov_to_lea2.s: Ditto.
846 * testsuite/i386_mov_to_lea3.s: Ditto.
847 * testsuite/i386_mov_to_lea4.s: Ditto.
848 * testsuite/i386_mov_to_lea5.s: Ditto.
849 * testsuite/i386_mov_to_lea.sh: Ditto.
850
851 2015-04-01 H.J. Lu <hongjiu.lu@intel.com>
852
853 * Makefile.am (ZLIB): New.
854 (ZLIBINC): Likewise.
855 (AM_CFLAGS): Add $(ZLIBINC).
856 (AM_CXXFLAGS): Likewise.
857 (ldadd_varldadd_var): Add $(ZLIB).
858 (incremental_dump_LDADD): Likewise.
859 (dwp_LDADD): Likewise.
860 * compressed_output.cc: Don't check HAVE_ZLIB_H to include
861 <zlib.h>.
862 (zlib_compress): Don't check HAVE_ZLIB_H.
863 (zlib_decompress): Likewise.
864 * options.h (compress_debug_sections): Likewise.
865 * configure.ac (AM_CONDITIONAL): Removed.
866 * testsuite/Makefile.am (ZLIB): New.
867 (LDADD): Add $(ZLIB).
868 Don't check HAVE_ZLIB.
869 * Makefile.in: Regenerated.
870 * config.in: Likewise.
871 * configure: Likewise.
872 * testsuite/Makefile.in: Likewise.
873
874 2015-03-30 Jing Yu <jingyu@google.com>
875
876 * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
877 TLSLD_ADD_DTPREL_LO12_NC.
878 * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
879 _TLS_MODULE_BASE_ point to the start of tls segment.
880 (Target_aarch64::optimize_tls_reloc): Add cases for
881 R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
882 R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
883 (Target_aarch64::Scan::local): Likewise.
884 (Target_aarch64::Scan::global): Likewise.
885 (Target_aarch64::Relocate::relocate): Likewise.
886 (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
887 subtracting tls segment size from symbol value for TLSLD_*_DTPREL
888 relocations.
889
890 2015-03-27 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
891
892 * merge.cc (Object_merge_map::add_mapping): call
893 Object_merge_map::Input_merge_map::add_mapping.
894 (Object_merge_map::Input_merge_map::add_mapping): New.
895 (Output_merge_data::do_add_input_section): Call
896 get_or_make_input_merge_map before a loop.
897 (Output_merge_string<Char_type>::finalize_merged_data): Call
898 get_or_make_input_merge_map before a loop.
899 * merge.h (Object_merge_map): Make Input_merge_map public.
900 * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
901 (Relobj::get_or_create_merge_map): New.
902 * object.h (Relobj::get_or_create_merge_map): New.
903
904 2015-03-24 Alan Modra <amodra@gmail.com>
905
906 PR 18147
907 * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
908 relocation errors for branches to strong undefined symbols.
909
910 2015-03-23 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
911
912 * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
913 (Object_merge_map::is_merge_section_for): Remove.
914 (Object_merge_map::find_merge_section): New.
915 * merge.h (Object_merge_map::is_merge_section_for): Remove.
916 (Object_merge_map::find_merge_section): New.
917 (Object_merge_map::get_input_merge_map): Add a const version.
918 * object.cc (Relobj::is_merge_section_for): Remove.
919 (Relobj::find_merge_section): New.
920 * object.h (Relobj::is_merge_section_for): Remove.
921 (Relobj::find_merge_section): New.
922 * output.cc
923 (Output_section::Input_section::is_merge_section_for): Remove.
924 (Output_section::add_merge_input_section): Don't call
925 add_merge_input_section.
926 (Output_section::find_merge_section): Return const. Use
927 object->find_merge_section.
928 (Output_section::build_lookup_maps): Don't build a map for
929 merge sections.
930 (Output_section::is_input_address_mapped): Return false if
931 section is not found.
932 (Output_section::find_starting_output_address): Use
933 find_merge_section instead of is_merge_section_for.
934 (Output_section::add_script_input_section): Don't build a map for
935 merge sections.
936 * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
937 (Output_section_lookup_maps::find_merge_section): Remove.
938 (Output_section_lookup_maps::add_merge_input_section) Remove.
939 (Output_section::find_merge_section): Return const.
940
941 2015-03-22 Cary Coutant <cary@google.com>
942
943 PR gold/18106
944 * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
945 non-SIB form of lea, with nop after the call.
946
947 2015-03-21 Cary Coutant <cary@google.com>
948
949 PR gold/14217
950 * output.cc (Output_segment::is_first_section_relro): Don't ignore
951 .tdata section.
952 (Output_segment::set_section_addresses): Don't align size of relro
953 segment for .tbss.
954
955 2015-03-21 Cary Coutant <cary@google.com>
956
957 PR gold/18010
958 * stringpool.cc (Stringpool_template): Don't optimize if section
959 alignment is greater than sizeof(char).
960
961 2015-03-21 Cary Coutant <cary@google.com>
962
963 PR gold/18048
964 * script-c.h (script_include_directive): Add first_token parameter.
965 * script.cc (script_include_directive): Add first_token parameter, and
966 pass it to read_script_file.
967 * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
968 (PARSING_MEMORY_DEF): New tokens.
969 (top): Add new productions for INCLUDE files.
970 (file_cmd): Replace file_or_sections_cmd with copy of its productions.
971 Pass PARSING_LINKER_SCRIPT to script_include_directive.
972 (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
973 (section_cmd): Pass PARSING_SECTION_CMDS.
974 (file_or_sections_cmd): Remove.
975 (memory_def): Pass PARSING_MEMORY_DEF.
976 * testsuite/Makefile.am (memory_test_2): New test.
977 * testsuite/Makefile.in: Regenerate.
978 * testsuite/memory_test_inc.t: New script file.
979 * testsuite/memory_test_inc_1.t.src: New script file.
980 * testsuite/memory_test_inc_2.t.src: New script file.
981 * testsuite/memory_test_inc_3.t.src: New script file.
982
983 2015-03-21 Cary Coutant <cary@google.com>
984
985 * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
986 (Sized_relobj_dwo::setup): Build compressed section map.
987 (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
988 * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
989 section map.
990 * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
991 compressed_sections_ field.
992 (build_compressed_section_map): Take Object instead of
993 Sized_relobj_file parameter; add decompress_if_needed parameter.
994 (Sized_relobj_file::do_find_special_sections): Store compressed
995 section map in parent Object.
996 (Sized_relobj_file::do_decompressed_section_contents): Move
997 implementation to Object::decompressed_section_contents.
998 (Sized_relobj_file::do_discard_decompressed_sections): Move
999 implementation to Object::discard_decompressed_sections.
1000 * object.h (build_compressed_section_map): Declare.
1001 (Object::Object): Add compressed_sections_ field.
1002 (Object::section_is_compressed): Move implementation here.
1003 (Object::decompressed_section_contents): De-virtualize.
1004 (Object::discard_decompressed_sections): De-virtualize.
1005 (Object::do_section_is_compressed): Delete.
1006 (Object::do_decompressed_section_contents): Delete.
1007 (Object::set_compressed_sections): New method.
1008 (Object::compressed_sections): New method.
1009 (Object::compressed_sections_): New data member.
1010 (Compressed_section_info, Compressed_section_map): Move to top of file.
1011 (Sized_relobj_file::do_section_is_compressed): Delete.
1012 (Sized_relobj_file::do_decompressed_section_contents): Delete.
1013 (Sized_relobj_file::do_discard_decompressed_sections): Delete.
1014 (Sized_relobj_file::compressed_sections_): Move to Object class.
1015
1016 2015-03-21 Cary Coutant <ccoutant@google.com>
1017
1018 PR gold/18152
1019 * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
1020 deferred objects.
1021
1022 2015-03-11 Cary Coutant <ccoutant@google.com>
1023
1024 * options.cc (General_options::finalize): Don't allow -z relro
1025 with incremental linking.
1026 * testsuite/Makefile.am (incremental_test): Add -z norelro.
1027 (incremental_test_2): Likewise.
1028 (incremental_test_3): Likewise.
1029 (incremental_test_4): Likewise.
1030 (incremental_test_5): Likewise.
1031 (incremental_test_6): Likewise.
1032 (incremental_copy_test): Likewise.
1033 (incremental_common_test_1): Likewise.
1034 (incremental_comdat_test_1): Likewise.
1035 * testsuite/Makefile.in: Regenerate.
1036
1037 2015-03-09 Cary Coutant <ccoutant@google.com>
1038
1039 PR gold/14675
1040 * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
1041 return enum indicating whether .eh_frame section is empty, optimizable,
1042 unrecognized, or an end marker. Adjust explicit instantiations.
1043 * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
1044 (Eh_frame::add_ehframe_input_section): Change return type.
1045 * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
1046 * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
1047 to the .eh_frame output section until we see the end marker.
1048 (Layout::finalize_eh_frame_section): New.
1049 * layout.h: (Layout::finalize_eh_frame_section): New.
1050
1051 2015-03-05 H.J. Lu <hongjiu.lu@intel.com>
1052
1053 * output.cc (Relobj::initialize_input_to_output_map<size>):
1054 Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
1055
1056 2015-03-04 Cary Coutant <ccoutant@google.com>
1057
1058 * parameters.cc (Parameters::set_target_once): Call
1059 Target::select_as_default_target just once from here...
1060 (set_parameters_target): ...instead of from here.
1061
1062 2015-03-04 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1063
1064 * ehframe.cc (Cie::set_output_offset): Pass in and use a
1065 Output_section_data instead of a Merge_map.
1066 (Eh_frame::Eh_frame): Don't initialize merge_map_.
1067 (Eh_frame::read_cie): Use add_merge_mapping instead of
1068 Merge_map::add_mapping.
1069 (Eh_frame::read_fde): Ditto.
1070 (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
1071 (Eh_frame::do_output_offset): Use merge_output_offset istead of
1072 merge_map_->get_output_offset.
1073 (Eh_frame::do_is_merge_section_for): Delete.
1074 * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
1075 instead of a Merge_map.
1076 (Cie::set_output_offset): Pass in a Output_section_data instead of a
1077 Merge_map.
1078 (Eh_frame::do_is_merge_section_for): Delete.
1079 (Eh_frame::merge_map_): Delete.
1080 * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
1081 and use a Output_section_data instead of a Merge_map.
1082 (Object_merge_map::add_mapping): Ditto.
1083 (Object_merge_map::get_output_offset): Remove the merge_map argument.
1084 (Object_merge_map::is_merge_section_for): Pass in and use a
1085 Output_section_data instead of a Merge_map.
1086 (Merge_map): Delete.
1087 (Output_merge_base::do_output_offset): Use merge_output_offset instead
1088 of merge_map_.get_output_offset.
1089 (Output_merge_base::do_is_merge_section_for): Delete.
1090 (Output_merge_data::do_add_input_section): Use
1091 object->add_merge_mapping instead of add_mapping.
1092 (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
1093 * merge.h (Merge_map): Delete forward declaration.
1094 (Object_merge_map::add_mapping): Pass in and use a Output_section_data
1095 instead of a Merge_map.
1096 (Object_merge_map::get_output_offset): Remove the merge_map argument.
1097 (Object_merge_map::is_merge_section_for): Pass in and use a
1098 Output_section_data instead of a Merge_map.
1099 (Input_merge_map::Object_merge_map::merge_map): Replace with
1100 output_data.
1101 (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
1102 Output_section_data instead of a Merge_map.
1103 (Merge_map): Delete.
1104 (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
1105 (Output_merge_base::do_is_merge_section_for): Delete.
1106 (Output_merge_base::add_mapping): Delete.
1107 (Output_merge_base::merge_map_): Delete.
1108 * object.cc (Relobj::initialize_input_to_output_map): New.
1109 (Relobj::initialize_input_to_output_map): New.
1110 (Relobj::merge_output_offset): New.
1111 (Relobj::is_merge_section_for): New.
1112 (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
1113 bits.
1114 * object.h (Relobj::merge_map): Delete.
1115 (initialize_input_to_output_map): New.
1116 (set_merge_map): Delete.
1117 (add_merge_mapping): New.
1118 (merge_output_offset): New.
1119 (is_merge_section_for): New.
1120 * output.cc (Output_section::Input_section::is_merge_section_for):
1121 Use object->is_merge_section_for.
1122 * output.h (Output_section_data::is_merge_section_for): Delete.
1123 (Output_section_data::do_is_merge_section_for): Delete.
1124 * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
1125 Use object->initialize_input_to_output_map.
1126 (Merged_symbol_value<size>::value_from_output_section): Use
1127 object->merge_output_offset.
1128
1129 2015-03-02 Peter Collingbourne <pcc@google.com>
1130 Cary Coutant <ccoutant@google.com>
1131
1132 * output.cc (Output_section::add_merge_input_section): Do not
1133 attempt to merge sections with an entsize of 0.
1134
1135 2015-03-02 Khem Raj <raj.khem@gmail.com>
1136
1137 * attributes.h (class Output_attributes_section_data ): Add
1138 do_print_to_mapfile function.
1139
1140 2015-02-24 Alan Modra <amodra@gmail.com>
1141
1142 PR 18010
1143 * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
1144 complain if value is not a multiple of four.
1145 (Target_powerpc::Relocate::relocate): Correct handling of
1146 R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
1147
1148 2015-02-21 H.J. Lu <hongjiu.lu@intel.com>
1149
1150 * configure.ac (default_size): Set to 32 for x32.
1151 * configure: Regenerated.
1152
1153 2015-02-18 Alan Modra <amodra@gmail.com>
1154
1155 PR 17954
1156 * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
1157 visibility.
1158
1159 2015-02-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1160
1161 * gc.h (Garbage_collection::add_reference): Don't use find.
1162
1163 2015-02-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1164
1165 * object.cc (write_local_symbols): avoid std::vector copy.
1166
1167 2015-02-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1168
1169 * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
1170
1171 2015-02-09 Mark Wielaard <mjw@redhat.com>
1172
1173 * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
1174 DW_LANG_Fortran03 and DW_LANG_Fortran08.
1175
1176 2015-02-16 Cary Coutant <ccoutant@google.com>
1177
1178 PR gold/13577
1179 PR gold/16992
1180 * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
1181 DF_SYMBOLIC if --dynamic-list option is used.
1182 * options.cc (General_options::finalize): --dynamic-list is not
1183 mutually exclusive with -Bsymbolic.
1184 * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
1185 listed in --dynamic-list.
1186 * testsuite/Makefile.am (dynamic_list_lib2.so): Add
1187 -Bsymbolic-functions.
1188 * testsuite/Makefile.in: Regenerate.
1189
1190 2015-02-16 Cary Coutant <ccoutant@google.com>
1191
1192 PR gold/17971
1193 * incremental.cc: Remove redundant include of "output.h".
1194
1195 2015-02-12 Jing Yu <jingyu@google.com>
1196
1197 * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
1198 TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
1199 New relocation.
1200 * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
1201 TLSLE_MOVW_* relocations.
1202 (Target_aarch64::Scan::global): Likewise.
1203 (Target_aarch64::Relocate::relocate): Likewise.
1204 (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
1205 for new TLSLE_MOVW_* relocations.
1206
1207 2015-02-11 Will Newton <will.newton@linaro.org>
1208
1209 PR gold/13321
1210 * arm.cc (Target_arm::make_plt_section): Create an ARM
1211 state mapping symbol at the start of the PLT.
1212
1213 2015-02-09 H.J. Lu <hongjiu.lu@intel.com>
1214
1215 * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
1216 Replace two_file_shared_2.so with two_file_shared_1.so.
1217 * testsuite/Makefile.in: Regenerated.
1218
1219 2015-02-09 Alan Modra <amodra@gmail.com>
1220
1221 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
1222 plugin_test_thin.a and defsym_test.
1223 * testsuite/Makefile.in: Regenerate.
1224
1225 2015-02-04 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1226
1227 * merge.cc (do_add_input_section): Combine loop epilogue into main loop
1228 body.
1229
1230 2015-02-04 Peter Collingbourne <pcc@google.com>
1231
1232 * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
1233 forwarding symbols when computing symbol resolution info for plugins.
1234 * plugin.h (Plugin_manager::symtab): New method.
1235 (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
1236
1237 2015-02-03 Cary Coutant <ccoutant@google.com>
1238 Peter Collingbourne <pcc@google.com>
1239
1240 PR gold/15660
1241 * archive.cc (Thin_archive_object_unlocker): New class.
1242 (Archive::include_member): Unlock external members of thin archives.
1243 * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
1244 (plugin_test_2): Likewise.
1245 (plugin_test_3): Likewise.
1246 (plugin_test_4): Likewise.
1247 (plugin_test_5): Likewise.
1248 (plugin_test_6): Likewise.
1249 (plugin_test_7): Likewise.
1250 (plugin_test_8): Likewise.
1251 (plugin_test_9): Likewise.
1252 (plugin_test_10): Likewise.
1253 (plugin_test_11): New test case.
1254 * testsuite/Makefile.in: Regenerate.
1255 * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
1256 file to decide whether to claim file.
1257 (all_symbols_read_hook): Likewise.
1258 * testsuite/plugin_test_1.sh: Adjust expected output.
1259 * testsuite/plugin_test_2.sh: Likewise.
1260 * testsuite/plugin_test_3.sh: Likewise.
1261 * testsuite/plugin_test_6.sh: Likewise.
1262 * testsuite/plugin_test_tls.sh: Likewise.
1263 * testsuite/plugin_test_11.sh: New testcase.
1264
1265 2015-02-03 Cary Coutant <ccoutant@google.com>
1266
1267 * descriptors.cc (Descriptors::open): Set artificially-low limit for
1268 file descriptors when debugging enabled. Add debug output.
1269 (Descriptors::release): Add debug output.
1270 (Descriptors::close_some_descriptor): Likewise.
1271 (Descriptors::close_all): Likewise.
1272 * fileread.cc (File_read::lock): Likewise.
1273 (File_read::unlock): Likewise.
1274
1275 2015-02-02 Cary Coutant <ccoutant@google.com>
1276
1277 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
1278 executable output file.
1279
1280 2015-01-22 Han Shen <shenhan@google.com>
1281
1282 * arm.cc (Target_arm::Target_arm): Add initialization for new members.
1283 (Target_arm::do_plt_address_for_global): New method.
1284 (Target_arm::do_plt_address_for_local): New method.
1285 (Target_arm::rel_irelative_section): New method.
1286 (Target_arm::make_data_plt): Add more parameters for plt ctor.
1287 (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
1288 (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
1289 (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
1290 (Target_arm::Scan::check_non_pic): Add ifunc support.
1291 (Target_arm::Scan::local): Add ifunc support.
1292 (Target_arm::Scan::global): Add ifunc support.
1293 (Target_arm::make_plt_section): New method.
1294 (Target_arm::make_plt_entry): Change to call to make_plt_section.
1295 (Target_arm::make_local_ifunc_plt_entry): New method.
1296 (Target_arm::got_irelative_): New member.
1297 (Target_arm::rel_irelative_): New member.
1298 (Target_arm::got_section): Add creation for got_irelative_.
1299 (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
1300 (Target_arm::Relocate::relocate): Properly set local ifunc address.
1301 (Target_arm::do_dynsym_value): Properly set global ifunc address.
1302 (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
1303 (Output_data_plt_arm::IRelative_data): New type.
1304 (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
1305 (Output_data_plt_arm::add_entry): Add more parameters.
1306 (Output_data_plt_arm::add_relocation): New method.
1307 (Output_data_plt_arm::add_local_ifunc_entry): New method.
1308 (Output_data_plt_arm::rel_irelative): New method.
1309 (Output_data_plt_arm::entry_count): Modified.
1310 (Output_data_plt_arm::address_for_global): New method.
1311 (Output_data_plt_arm::address_for_local): New method.
1312 gold/
1313 (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
1314 (Output_data_plt_arm::insert_irelative_data): New method.
1315 (Output_data_plt_arm::irelative_rel_): New member.
1316 (Output_data_plt_arm::got_): New member.
1317 (Output_data_plt_arm::got_irelative_): New member.
1318 (Output_data_plt_arm::irelative_count_): New member.
1319 (Output_data_plt_arm::IRelative_data_vec): New typedef.
1320 (Output_data_plt_arm::irelative_data_vec_): New member.
1321 (Output_data_plt_arm::do_write): Write out irelative entries.
1322 (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
1323 more parameters to ctor.
1324 (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
1325 more parameters to ctor.
1326 * output.h (Output_data_reloc::add_local_relative): New method.
1327 * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
1328
1329 2015-01-29 Alan Modra <amodra@gmail.com>
1330
1331 * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
1332 and GOT_TLSGD to LE optimization.
1333
1334 2015-01-28 Cary Coutant <ccoutant@google.com>
1335
1336 * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
1337 for undef TLS symbols.
1338 (Target_x86_64::Relocate::relocate_tls): Likewise.
1339 (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
1340
1341 2015-01-25 Cary Coutant <ccoutant@google.com>
1342
1343 * output.cc (Output_segment::set_section_addresses): Fix calculation
1344 of size of relro segment.
1345
1346 2015-01-22 Alan Modra <amodra@gmail.com>
1347
1348 * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
1349 condition for need of ifunc plt entry.
1350 (Target_powerpc::Scan::global <got relocs>): Likewise.
1351
1352 2015-01-14 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1353
1354 * mips.cc (reloc_high): Add r_sym.
1355 (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
1356 reloc_high constructor.
1357 (Mips_relocate_functions::relgot16_local): Likewise.
1358 (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
1359 r_type to decide whether LO16 matches HI16.
1360 (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
1361 rello16 and relgot16_local.
1362
1363 2015-01-09 Cary Coutant <ccoutant@google.com>
1364
1365 * layout.cc (Layout::set_segment_offsets): Don't align start of segment
1366 unless alignment is larger than page size.
1367
1368 2015-01-06 H.J. Lu <hongjiu.lu@intel.com>
1369 Cary Coutant <ccoutant@google.com>
1370
1371 PR gold/17729
1372 * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
1373 (DEFAULT_TARGET_X32): Set for x32.
1374 * x86_64.cc (cmp_insn_32): New.
1375 (lea_r10_insn_32): Likewise.
1376 (lea_r11_insn_32): Likewise.
1377 (cmp_insn_64): Likewise.
1378 (lea_r10_insn_64): Likewise.
1379 (lea_r11_insn_64): Likewise.
1380 (Target_x86_64<size>::do_calls_non_split): Handle x32.
1381 * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
1382 (check_DATA): Add split_x32 files.
1383 (split_x32_[1234n].o): New targets.
1384 (split_x32_[124]): New targets.
1385 (split_x32_[1234r].stdout): New targets.
1386 * testsuite/split_x32.sh: New file.
1387 * testsuite/split_x32_1.s: Likewise.
1388 * testsuite/split_x32_2.s: Likewise.
1389 * testsuite/split_x32_3.s: Likewise.
1390 * testsuite/split_x32_4.s: Likewise.
1391 * testsuite/split_x32_n.s: Likewise.
1392 * configure: Regenerated.
1393 * testsuite/Makefile.in: Likewise.
1394
1395 2015-01-06 H.J. Lu <hongjiu.lu@intel.com>
1396
1397 PR gold/17809
1398 * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
1399 x32.
1400
1401 2015-01-02 Alan Modra <amodra@gmail.com>
1402
1403 * version.cc (print_version): Just print current year.
1404 * dwp.cc (print_version): Likewise.
1405
1406 2015-01-01 Alan Modra <amodra@gmail.com>
1407
1408 Update year range in copyright notice of all files.
1409
1410 2014-12-25 Alan Modra <amodra@gmail.com>
1411
1412 * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
1413 new enums.
1414 (Target_arm::merge_object_attributes, ): Likewise.
1415
1416 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com>
1417
1418 * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
1419 as hard float only when Tag_ABI_VFP_args is 1, using new enum value
1420 AEABI_VFP_args_vfp to check that.
1421 (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
1422 value and replace hardcoded values by enum values.
1423
1424 2014-12-22 Cary Coutant <ccoutant@google.com>
1425
1426 * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
1427
1428 2014-12-20 H.J. Lu <hongjiu.lu@intel.com>
1429
1430 PR gold/14608
1431 * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
1432 to "return i * i * 3;".
1433
1434 2014-12-16 Cary Coutant <ccoutant@google.com>
1435
1436 * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
1437 (Mapfile::print_output_data): Use current_data_size() to avoid
1438 assert for sections requiring postprocessing; if address is not valid,
1439 print 0.
1440 (Mapfile::print_output_section): Use current_data_size(); print note
1441 that addresses and sizes are before compression.
1442
1443 2014-12-14 H.J. Lu <hongjiu.lu@intel.com>
1444
1445 * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1446 Cast current_group_size to unsigned long when reporting error.
1447
1448 2014-12-10 Jing Yu <jingyu@google.com>
1449
1450 * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
1451 (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
1452 Update error message.
1453 (Target_aarch64::do_relax): Use absolute value of option
1454 stub_group_size. Replace local variable with class member
1455 stub_group_size_.
1456
1457 2014-12-04 Alan Modra <amodra@gmail.com>
1458
1459 * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
1460 addend of PLTREL24 reloc when not generating a plt stub. Make
1461 max_branch_offset an "Address".
1462 (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
1463 (Target_powerpc::Relocate::relocate): Likewise.
1464
1465 2014-12-04 Alan Modra <amodra@gmail.com>
1466
1467 PR 17670
1468 * symtab.cc (Symbol::set_undefined): Remove assertion.
1469 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1470 on symbols defined in discarded sections, instead return false.
1471 Rearrange params, update all callers.
1472 (Target_powerpc::Branch_info::make_stub): Don't make stubs for
1473 branches to syms in discarded sections.
1474 (Global_symbol_visitor_opd::operator()): Set discarded opd syms
1475 undefined and flag as discarded.
1476 (Target_powerpc::Relocate::relocate): Localize variable.
1477
1478 2014-12-03 H.J. Lu <hongjiu.lu@intel.com>
1479
1480 PR gold/17675
1481 * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
1482 * testsuite/Makefile.in: Regenerated.
1483
1484 2014-12-03 Alan Modra <amodra@gmail.com>
1485
1486 PR 17566
1487 * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
1488 when adding dynamic relocations against section symbols.
1489
1490 2014-12-01 Dimitry Ivanov <dimitry@google.com>
1491
1492 * layout.cc (Layout::finish_dynamic_section): When '-z global'
1493 is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
1494 * options.h (General_options): New -z option (global).
1495
1496 2014-12-01 Cary Coutant <ccoutant@google.com>
1497
1498 PR gold/17578
1499 * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
1500 is given.
1501 (Layout::create_executable_stack_info): Warn when -z noexecstack is
1502 given but some inputs require executable stack.
1503
1504 2014-11-26 Cary Coutant <ccoutant@google.com>
1505
1506 * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
1507 .debug_str_offsets; strip .debug_gnu_pubnames and
1508 .debug_gnu_pubtypes.
1509 (lines_only_debug_sections): Strip all four new sections.
1510
1511 2014-11-26 Jing Yu <jingyu@google.com>
1512
1513 * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
1514 register to be x0 when to relax TLSDESC_LD64_LO12.
1515
1516 2014-11-26 Alan Modra <amodra@gmail.com>
1517
1518 * powerpc.cc (struct Stub_table_owner): New.
1519 (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
1520 unsigned int vector. Update all references.
1521 (powerpc_relobj::set_stub_table): Take an unsigned int param
1522 rather than a Stub_table. Update callers.
1523 (Powerpc_relobj::clear_stub_table): New function.
1524 (Target_powerpc): Add relax_failed_, relax_fail_count_ and
1525 stub_group_size_ vars.
1526 (Target_powerpc::new_stub_table): Delete.
1527 (max_branch_delta): New function, extracted from..
1528 (Target_powerpc::Relocate::relocate): ..here..
1529 (Target_powerpc::Branch_info::make_stub): ..and here. Return
1530 status on whether stub created successfully.
1531 (Stub_control::Stub_control): Add "no_size_errors" param. Move
1532 default sizing to..
1533 (Target_powerpc::do_relax): ..here. Init stub_group_size_ and
1534 reduce on relax failure.
1535 (Target_powerpc::group_sections): Add "no_size_errors" param.
1536 Use stub_group_size_. Set up group info in a temp vector,
1537 before building Stub_table vector. Account for input sections
1538 possibly already converted to relaxed sections.
1539 (Stub_table::init): Delete. Merge into..
1540 (Stub_table::Stub_table): ..here.
1541 (Stub_table::can_reach_stub): New function.
1542 (Stub_table::add_plt_call_entry): Add "from" parameter and
1543 return true iff stub could be reached.
1544 (Stub_table::add_long_branch_entry): Similarly. Add "r_type"
1545 param too.
1546 (Stub_table::clear_stubs): Add "all" param.
1547
1548 2014-11-26 Alan Modra <amodra@gmail.com>
1549
1550 * powerpc.cc (Stub_control::set_output_and_owner): New function.
1551 (Target_powerpc::group_sections): Use it.
1552
1553 2014-11-25 Cary Coutant <ccoutant@google.com>
1554
1555 * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
1556 (Binary_to_elf::write_symbol): Add st_size parameter.
1557 * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
1558
1559 2014-11-25 Cary Coutant <ccoutant@google.com>
1560
1561 PR gold/17639
1562 * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
1563 (Sized_relobj_file::do_layout): Handle deferred sections properly
1564 during GC pass 1. Don't add reloc sections to deferred list twice.
1565 * object.h (Sized_relobj_file::is_deferred_layout): New function.
1566 (Sized_relobj_file::is_deferred_layout_): New data member.
1567
1568 2014-11-21 H.J. Lu <hongjiu.lu@intel.com>
1569
1570 PR gold/17619
1571 * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
1572 Check PC-relative offset overflow in PLT entry.
1573
1574 2014-11-21 Alan Modra <amodra@gmail.com>
1575
1576 * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
1577 for undefined weaks.
1578
1579 2014-11-20 Alan Modra <amodra@gmail.com>
1580
1581 * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
1582 from --stub-group-size parameter divided by 1024.
1583 (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
1584 template parameter. Update all uses.
1585 (Target_powerpc::Relocate::relocate): Rename has_plt_value to
1586 has_stub_value. Set for long branches. Don't report overflow for
1587 branch to undefined weak symbols. Print info message on
1588 overflowing branch to stub.
1589
1590 2014-11-20 Alan Modra <amodra@gmail.com>
1591
1592 * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
1593
1594 2014-11-13 H.J. Lu <hongjiu.lu@intel.com>
1595
1596 * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
1597 entry for R_X86_64_GOTPLT64.
1598 (Target_x86_64<size>::Relocate::relocate): Update comments for
1599 R_X86_64_GOTPLT64.
1600
1601 2014-11-06 Evgeniy Dushistov <dushistov@mail.ru>
1602
1603 * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
1604 * plugin.h: add lock definition
1605
1606 2014-10-29 Han Shen <shenhan@google.com>
1607 Jing Yu <jingyu@google.com>
1608
1609 * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
1610 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1611 TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
1612 Symbol::TLS_REF.
1613 * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
1614 method.
1615 (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
1616 (Target_aarch64::tls_ld_to_le): New method.
1617 (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
1618 for 64bit targets.
1619 (Output_data_plt_aarch64::irelative_rel_): New data member.
1620 (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
1621 (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
1622 (Output_data_plt_aarch64::add_relocation): New method.
1623 (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
1624 offset. Add got_irelative size to got size.
1625 (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
1626 type string with the new typename.
1627 (AArch64_relocate_functions::update_adr): Replace parameter x with
1628 immed.
1629 (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
1630 (AArch64_relocate_functions::reloc_common): New method.
1631 (AArch64_relocate_funcsions::rela_general): Extract common part out
1632 into reloc_common method.
1633 (AArch64_relocate_functions::rela_general): Likewise.
1634 (AArch64_relocate_functions::pcrela_general): Likewise.
1635 (AArch64_relocate_functions::adr): New method.
1636 (AArch64_relocate_functions::adrp): Calculate immed before calling
1637 update_adr.
1638 (AArch64_relocate_functions::adrp): Likewise.
1639 (AArch64_relocate_functions::movnz): Cast x to SignedW type when
1640 comparing x to 0. Calculate immed from ~x when x < 0.
1641 (Target_aarch64::optimize_tls_reloc): Add new cases for
1642 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1643 TLSLD_MOVW_DTPREL_G0_NC.
1644 (Target_aarch64::possible_function_pointer_reloc): Implement this
1645 method.
1646 (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
1647 comment.
1648 (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
1649 symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1650 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1651 (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
1652 symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1653 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1654 (Target_aarch64::make_plt_entry): Call add_entry with two more
1655 parameters.
1656 (Target_aarch64::make_local_ifunc_plt_entry): New method.
1657 (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
1658 ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1659 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1660 (Target_aarch64::Relocate::relocate_tls): Add cases for
1661 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1662 TLSLD_MOVW_DTPREL_G0_NC.
1663 * testsuite/icf_safe_so_test.cc: Correct test comment.
1664 * testsuite/icf_safe_test.sh: Add AArch64 arch.
1665
1666 2014-10-22 Alan Modra <amodra@gmail.com>
1667
1668 * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
1669 thread_starter.
1670
1671 2014-10-18 Andreas Schwab <schwab@linux-m68k.org>
1672
1673 * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
1674
1675 2014-10-17 Cary Coutant <ccoutant@google.com>
1676
1677 * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1678 Add "typename" keyword.
1679
1680 2014-10-15 Han Shen <shenhan@google.com>
1681 Jing Yu <jingyu@google.com>
1682
1683 Patch for gold aarch64 backend to support relaxation.
1684 * aarch64-reloc.def: Change format.
1685 * aarch64.cc (class Reloc_stub): New class.
1686 (class Stub_table): New class.
1687 (class AArch64_relobj): New class.
1688 (class AArch64_input_section): New class.
1689 (class AArch64_output_section): New class.
1690 (Target_aarch64::new_stub_table): New method.
1691 (Target_aarch64::new_aarch64_input_section): New method.
1692 (Target_aarch64::find_aarch64_input_section): New method.
1693 (Target_aarch64::scan_section_for_stubs): New method.
1694 (Target_aarch64::scan_reloc_section_for_stubs): New method.
1695 (Target_aarch64::relocate_stub): New method.
1696 (Target_aarch64::current_target): New method.
1697 (Target_aarch64::do_make_elf_object): New method.
1698 (Target_aarch64::do_may_relax): New method.
1699 (Target_aarch64::do_relax): New method.
1700 (Target_aarch64::group_sections): New method.
1701 (Target_aarch64::scan_reloc_for_stub): New method.
1702 (Target_aarch64::do_make_output_section): New method.
1703 (Target_aarch64::stub_tables_): New data member.
1704 (Target_aarch64::aarch64_input_section_map_): New data member.
1705 (AArch64_relocate_functions::maybe_apply_stub): New method.
1706
1707 2014-09-30 Cary Coutant <ccoutant@google.com>
1708
1709 PR gold/17432
1710 * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
1711
1712 2014-09-30 Kito Cheng <kito@0xlab.org>
1713
1714 PR gold/13597
1715 * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
1716 hash table before sysv-style hash table.
1717
1718 2014-09-29 Sriraman Tallam <tmsriram@google.com>
1719
1720 * options.h (--pic-executable): Add negative to alias to -no-pie.
1721
1722 2014-09-26 Cary Coutant <ccoutant@google.com>
1723
1724 PR gold/16773
1725 * object.cc (Sized_relobj_file): Compute value of section symbols
1726 for TLS sections the same as TLS symbols.
1727
1728 2014-09-25 Cary Coutant <ccoutant@google.com>
1729
1730 PR gold/17432
1731 * resolve.cc (Symbol_table::resolve): Override common placeholder
1732 symbols, but adjust sizes.
1733 * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
1734 symbols to common lists.
1735
1736 2014-09-24 Alan Modra <amodra@gmail.com>
1737
1738 * po/POTFILES.in: Regenerate.
1739
1740 2014-09-23 Taiju Tsuiki <tzik@google.com>
1741 Cary Coutant <ccoutant@google.com>
1742
1743 PR gold/14860
1744 * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
1745 on input_sections_blocker.
1746 * layout.cc (Write_sections_task::locks): Unblock
1747 input_sections_blocker_.
1748 * layout.h (Write_sections_task::Write_sections_task): Add
1749 input_sections_blocker.
1750 * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
1751 to DEPENDENCIES.
1752 * testsuite/Makefile.in: Regenerate.
1753
1754 2014-09-18 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1755
1756 * testsuite/Makefile.am (plugin_test_10): New test.
1757 * testsuite/Makefile.in: Regenerate
1758 * testsuite/plugin_common_test_2.c (c1): Align to 8.
1759 * testsuite/plugin_test_10.sh: New file.
1760
1761 2014-09-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1762
1763 * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
1764 * resolve.cc (Symbol_table::resolve): Don't override common symbols
1765 during the replacement phase.
1766
1767 2014-09-17 Han Shen <shenhan@google.com>
1768 Jing Yu <jingyu@google.com>
1769
1770 * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
1771 TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
1772 * aarch64.cc (Target_aarch64): Add data members
1773 got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
1774 tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
1775 constructor.
1776 (Target_aarch64::do_reloc_symbol_index): New method.
1777 (Target_aarch64::do_reloc_addend): New method.
1778 (Target_aarch64::add_tlsdesc_info): New method.
1779 (Target_aarch64::do_dynsym_value): New method.
1780 (Target_aarch64::do_make_data_plt): Add new parameters: got,
1781 got_irelative. Pass them to Output_data_plt_aarch64_standard.
1782 (Target_aarch64::make_data_plt): Add new parameters: got,
1783 got_irelative. Pass them to do_make_data_plt.
1784 (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
1785 (Target_aarch64::Relocate:tls_gd_to_le): New method.
1786 (Target_aarch64::Relocate:tls_ie_to_le): New method.
1787 (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
1788 (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
1789 (Target_aarch64::got_tlsdesc_section): New method.
1790 (Target_aarch64::make_local_ifunc_plt_entry): New method.
1791 (Target_aarch64::define_tls_base_symbol): New method.
1792 (Target_aarch64::reserve_tlsdesc_entries): New method.
1793 (Target_aarch64::got_mod_index_entry): New method.
1794 (Target_aarch64::rela_tlsdesc_section): New method.
1795 (Target_aarch64::rela_irelative_section): New method.
1796 (Target_aarch64::Tlsdesc_info): New struct.
1797 (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
1798 relocations and tlsdesc relocations.
1799 (Target_aarch64::optimize_tls_reloc): Implement method.
1800 (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
1801 got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
1802 in constructor.
1803 (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
1804 (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
1805 (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
1806 (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
1807 (Output_data_plt_aarch64::rela_tlsdesc): New method.
1808 (Output_data_plt_aarch64::rela_irelative): New method.
1809 (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
1810 (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
1811 (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
1812 (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
1813 (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
1814 (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
1815 (Output_data_plt_aarch64_standard): New member variables:
1816 plt_tlsdesc_entry_size, tlsdesc_plt_entry.
1817 (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
1818 New parameter: got, got_irelative.
1819 (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
1820 (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
1821 (Output_data_plt_aarch64::do_write): Replace got_address with
1822 gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
1823 (AArch64_relocate_functions::update_movnz): New method.
1824 (AArch64_relocate_functions): Correct format.
1825 (AArch64_relocate_functions::movnz): New method.
1826 (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
1827 before the switch. Add new cases to switch.
1828 Check ie_to_le relaxation on tlsie relocations. Add code handling
1829 tlsgd tlsdesc cases.
1830 (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
1831 needed. Add new cases to switch. Insert dynamic RELATIVE relocation
1832 when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
1833 Call reloc_name_in_error_message to print unsupported reloc.
1834 (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
1835 make_data_plt.
1836 (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
1837 relocs. Fill in some more dynamic tags.
1838 (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
1839 Skip call tls_get_addr when tlsgd is relaxed.
1840 (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
1841 handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
1842 tlsdesc->ie relaxation.
1843
1844 2014-09-03 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1845
1846 * mips.cc (Target_mips_nacl): New class.
1847 (Target_selector_mips_nacl): New class.
1848 (target_selector_mips32): Rename from target_selector_mips32be and use
1849 Target_selector_mips_nacl instead of Target_selector_mips.
1850 (target_selector_mips32el): Rename from target_selector_mips32 and use
1851 Target_selector_mips_nacl instead of Target_selector_mips.
1852 (target_selector_mips64): Rename from target_selector_mips64be and use
1853 Target_selector_mips_nacl instead of Target_selector_mips.
1854 (target_selector_mips64el): Rename from target_selector_mips64 and use
1855 Target_selector_mips_nacl instead of Target_selector_mips.
1856 (Target_mips::mips_info): Add const attribute.
1857
1858 2014-09-02 Cary Coutant <ccoutant@google.com>
1859
1860 * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
1861 * dynobj.h (Sized_dynobj::do_section_name): Likewise.
1862 * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
1863 (Sized_incr_dynobj::do_section_name): Likewise.
1864 * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
1865 (Sized_incr_dynobj::do_section_name): Likewise.
1866 * object.h (Object::section_name): Likewise.
1867 (Object::do_section_name): Likewise.
1868 (Sized_relobj_file::do_section_name): Likewise.
1869 * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
1870 * plugin.h (Sized_pluginobj::do_section_name): Likewise.
1871
1872 2014-09-02 Cary Coutant <ccoutant@google.com>
1873
1874 PR gold/17005
1875 * ehframe.cc (Fde::write): Add output_offset parameter.
1876 (Cie::write): Likewise.
1877 (Eh_frame::set_final_data_size): Account for offset within output
1878 section.
1879 (Eh_frame::do_sized_write): Likewise.
1880 * ehframe.h (Fde::write): Add output_offset parameter.
1881 (Cie::write): Likewise.
1882 * output.cc (Output_section::Input_section_sort_entry): Remove
1883 section_has_name_; add output_section_name parameter. Use
1884 output section name for non-input sections.
1885 (Output_section::Input_section_sort_entry::section_has_name): Remove.
1886 (Output_section::Input_section_sort_entry::section_has_name_): Remove.
1887 (Output_section::Input_section_sort_compare): Remove logic for
1888 sections without names.
1889 (Output_section::Input_section_sort_init_fini_compare): Likewise.
1890 (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
1891 Likewise.
1892 (Output_section::Input_section_sort_section_name_compare): Likewise.
1893
1894 2014-08-29 Han Shen <shenhan@google.com>
1895 Jing Yu <jingyu@google.com>
1896
1897 * aarch64-reloc-property.cc
1898 (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
1899 reference reloc property in the table.
1900 * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
1901 3 other entries.
1902 * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
1903 2 new overloaded methods.
1904 (Output_data_got_aarch64::do_write): Add code to write out
1905 static relocs.
1906 (class Output_data_got_aarch64::Static_reloc): New class to wrap
1907 static relocs.
1908 (Output_data_got_aarch64::static_relocs): New vector to
1909 hold static relocs.
1910 (Target_aarch64::TCB_SIZE): New const static memeber.
1911 (Target_aarch64::tcb_size): New method.
1912 (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
1913 (Target_aarch64::Relocate::relocate_tls): New method.
1914 (Target_aarch64::Scan::local): Add code handling new reloc types.
1915 (Target_aarch64::Scan::global): Add code handling new reloc types.
1916
1917 2014-08-13 Sriraman Tallam <tmsriram@google.com>
1918
1919 * options.h (-no-pie): Add option.
1920
1921 2014-08-08 Jing Yu <jingyu@google.com>
1922 Han Shen <shenhan@google.com>
1923
1924 * Makefile.am (HFILES): Add aarch64-reloc-property.h.
1925 (DEFFILES): add aarch64-reloc.def.
1926 (TARGETSOURCES): Add aarch64-reloc-property.cc.
1927 (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
1928 * Makefile.in: Regenerate.
1929 * aarch64-reloc-property.cc: New file.
1930 * aarch64-reloc-property.h: New file.
1931 * aarch64-reloc.def: New file.
1932 * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
1933 with tab to make the format consistent.
1934 (Output_data_got_aarch64::symbol_table_): New method.
1935 (Target_aarch64::do_plt_address_for_global): New method.
1936 (Target_aarch64::do_plt_address_for_local): New method.
1937 (Target_aarch64::do_select_as_default_target): New method.
1938 (Target_aarch64::do_make_data_plt): New method.
1939 (Target_aarch64::make_data_plt): New method.
1940 (Output_data_plt_aarch64::has_irelative_section): New method.
1941 (Output_data_plt_aarch64::address_for_global): New method.
1942 (Output_data_plt_aarch64::address_for_local): New method.
1943 (Output_data_plt_aarch64::irelative_rel_): New parameter.
1944 (Output_data_plt_aarch64::add_entry): Implement contents.
1945 (Output_data_plt_aarch64::set_final_data_size): Fix typo.
1946 (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
1947 the got_pov entry to plt0.
1948 (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
1949 Implement contents.
1950 (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
1951 (AArch64_howto): New struct.
1952 (aarch64_howto[]): New static const array.
1953 (AArch64_relocate_functions): New class.
1954 (Target_aarch64::Scan::get_reference_flags): Remove method.
1955 (Target_aarch64::Scan::local): Implement to support a few relocations.
1956 (Target_aarch64::Scan::global): Implement to support a few relocations.
1957 (Target_aarch64::make_plt_section): Implement contents.
1958 (Target_aarch64::make_plt_entry): Implement contents.
1959 (Target_aarch64::do_finalize_sections): Implement contents.
1960 (Target_aarch64::Relocate::relocate): Implement a few relocations.
1961 (Target_aarch64::relocate_section): Implement contents.
1962
1963 2014-08-06 Alan Modra <amodra@gmail.com>
1964
1965 * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
1966
1967 2014-08-06 Alan Modra <amodra@gmail.com>
1968
1969 PR 13227
1970 * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
1971
1972 2014-07-21 Sriraman Tallam <tmsriram@google.com>
1973
1974 * object.cc (Relobj::is_section_name_included): Add
1975 ".rodata.nptl_version" to not garbage collect this section.
1976
1977 2014-07-08 Cary Coutant <ccoutant@google.com>
1978
1979 * expression.cc (struct Expression::Expression_eval_info): Add
1980 new fields type_pointer, vis_pointer, and nonvis_pointer.
1981 (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
1982 nonvis_pointer parameters. Adjust all calls.
1983 (Symbol_expression::value): Update type, visibility, and nonvis bits
1984 in caller.
1985 * script.cc (Symbol_assignment::sized_finalize): Update type,
1986 visibility, and remaining st_other bits for new symbol.
1987 * script.h: (Expression::eval_maybe_dot): Add type_pointer,
1988 vis_pointer, and nonvis_pointer parameters.
1989 * symtab.h (Symbol::set_type): New method.
1990
1991 * testsuite/Makefile.am (defsym_test): New test.
1992 * testsuite/Makefile.in: Regenerate.
1993 * testsuite/defsym_test.c: New file.
1994 * testsuite/defsym_test.sh: New file.
1995
1996 2014-07-08 Cary Coutant <ccoutant@google.com>
1997
1998 PR gold/15639
1999 * dynobj.h (Sized_dynobj::base_read_symbols): New method.
2000 * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
2001 (Sized_dynobj::base_read_symbols): ...new method.
2002 * object.h (Sized_relobj_file::base_read_symbols): New method.
2003 * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
2004 (Sized_relobj_file::base_read_symbols): ...new method.
2005 * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
2006 * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
2007 * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
2008
2009 2014-07-04 Alan Modra <amodra@gmail.com>
2010
2011 * po/POTFILES.in: Regenerate.
2012
2013 2014-07-02 Jing Yu <jingyu@google.com>
2014
2015 * aarch64.cc: New file
2016 * Makefile.am (TARGETSOURCES): Add aarch64.cc
2017 (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
2018 * Makefile.in: Regenerate.
2019 * configure.tgt: Add entries for aarch64*.
2020 * configure.ac: Likewise.
2021 * configure: Likewise.
2022
2023 2014-06-27 Alan Modra <amodra@gmail.com>
2024
2025 * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
2026
2027 2014-06-24 Cary Coutant <ccoutant@google.com>
2028
2029 * dwp.cc (Dwo_file::read): Allow files with no .debug_types
2030 sections.
2031 (Dwo_file::sized_read_unit_index): Likewise.
2032
2033 2014-06-23 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
2034
2035 * mips.cc: New file.
2036 * Makefile.am (TARGETSOURCES): Add mips.cc
2037 (ALL_TARGETOBJS): Add mips.$(OBJEXT)
2038 * configure.tgt: Add entries for mips*.
2039 * configure.ac: Likewise.
2040 * Makefile.in: Regenerate.
2041 * configure: Likewise.
2042
2043 2014-06-09 Cary Coutant <ccoutant@google.com>
2044
2045 * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
2046 unit_length is within section bounds.
2047
2048 2014-06-09 Cary Coutant <ccoutant@google.com>
2049
2050 PR gold/16980
2051 * layout.cc (Layout::print_to_mapfile): Print unattached sections in
2052 map.
2053
2054 2014-06-07 Alan Modra <amodra@gmail.com>
2055
2056 * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
2057
2058 2014-06-06 Cary Coutant <ccoutant@google.com>
2059
2060 * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
2061 * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
2062 (Dwarf_pubnames_table::read_header): Likewise.
2063 * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
2064 .debug_gnu_pubtypes.
2065
2066 2014-06-05 Joel Brobecker <brobecker@adacore.com>
2067
2068 * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
2069 * Makefile.in, configure: Regenerate.
2070
2071 2014-06-03 Alan Modra <amodra@gmail.com>
2072
2073 * powerpc.cc (addis_12_2): Define.
2074 (Stub_table::do_write): Support fusion on ELFv2 stubs.
2075
2076 2014-06-03 Alan Modra <amodra@gmail.com>
2077
2078 * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
2079 st_other output.
2080
2081 2014-06-02 Alan Modra <amodra@gmail.com>
2082
2083 * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
2084 Only ignore relocs on ELFv1.
2085 (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
2086
2087 2014-05-30 Cary Coutant <ccoutant@google.com>
2088
2089 * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
2090 * testsuite/Makefile.in: Regenerate.
2091 * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
2092
2093 2014-05-27 H.J. Lu <hongjiu.lu@intel.com>
2094
2095 PR gold/16945
2096 * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
2097 for got_offset. Properly get GOT address for R_X86_64_PLTOFF64.
2098
2099 2014-05-15 Alan Modra <amodra@gmail.com>
2100
2101 * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
2102 Compare FDE contents with DW_CFA_nop rather than 0.
2103
2104 2014-05-13 Sriraman Tallam <tmsriram@google.com>
2105
2106 * symtab.h (may_need_copy_reloc): Remove check for position independent
2107 code.
2108 * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
2109 position independence before pc absolute may_need_copy_reloc call.
2110 Add check for executable output befor pc relative may_need_copy_reloc
2111 call.
2112 * i386.cc: Ditto.
2113 * arm.cc: Ditto.
2114 * sparc.cc: Ditto.
2115 * tilegx.cc: Ditto.
2116 * powerpc.cc: Add check for no position independence before
2117 may_need_copy_reloc calls.
2118 * testsuite/pie_copyrelocs_test.cc: New file.
2119 * testsuite/pie_copyrelocs_shared_test.cc: New file.
2120 * Makefile.am (pie_copyrelocs_test): New test.
2121 * Makefile.in: Regenerate.
2122
2123 2014-05-08 Martin LiĆĄka <mliska@suse.cz>
2124
2125 * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
2126
2127 2014-05-06 Cary Coutant <ccoutant@google.com>
2128
2129 PR gold/16900
2130 * i386.cc (Output_data_got_plt_i386): New class.
2131 (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
2132 parameter. Change all callers.
2133 (Output_data_plt_i386::layout_): Remove.
2134 (Output_data_plt_i386::got_plt_): Change type.
2135 (Target_i386::got_plt_): Change type. Change all references.
2136 (Target_i386::got_section): Create instance of new class.
2137 (Output_data_got_plt_i386::do_write): New function.
2138 * x86_64.cc (Output_data_got_plt_x86_64): New class.
2139 (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
2140 parameter. Change all callers.
2141 (Output_data_plt_x86_64::layout_): Remove.
2142 (Output_data_plt_x86_64::got_plt_): Change type.
2143 (Target_x86_64::got_plt_): Change type. Change all references.
2144 (Target_x86_64::got_section): Create instance of new class.
2145 (Output_data_got_plt_x86_64::do_write): New function.
2146 (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
2147 (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
2148 class.
2149
2150 2014-05-05 Cary Coutant <ccoutant@google.com>
2151
2152 * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
2153 if we have pubnames/pubtypes.
2154
2155 2014-05-02 Cary Coutant <ccoutant@google.com>
2156
2157 * defstd.cc (in_segment): Define __ehdr_start here...
2158 * layout.cc (Layout::finalize): ...Instead of here. Set the
2159 output segment when known.
2160 * resolve.cc (Symbol::override_base_with_special): Remember
2161 the original binding.
2162 * symtab.cc (Symbol::set_output_segment): New function.
2163 (Symbol::set_undefined): New function.
2164 * symtab.h (Symbol::is_weak_undefined): Check original undef
2165 binding.
2166 (Symbol::is_strong_undefined): New function.
2167 (Symbol::set_output_segment): New function.
2168 (Symbol::set_undefined): New function.
2169 * target-reloc.h (is_strong_undefined): Remove.
2170 (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
2171 Check for hidden undefs.
2172 (relocate_section): Call Symbol::is_strong_undefined.
2173
2174 * testsuite/Makefile.am (ehdr_start_test_1)
2175 (ehdr_start_test_2, ehdr_start_test_3)
2176 (ehdr_start_test_4, ehdr_start_test_5): New test cases.
2177 * testsuite/Makefile.in: Regenerate.
2178 * testsuite/ehdr_start_def.cc: New source file.
2179 * testsuite/ehdr_start_test.cc: New source file.
2180 * testsuite/ehdr_start_test.t: New linker script.
2181 * testsuite/ehdr_start_test_4.sh: New shell script.
2182
2183 2014-04-23 Cary Coutant <ccoutant@google.com>
2184
2185 PR gold/16870
2186 * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
2187
2188 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
2189
2190 * layout.cc (Layout::include_section): Allow a target to decide
2191 whether to include a section.
2192 * target.h (Target::should_include_section): New function.
2193 (Target::do_should_include_section): New function.
2194
2195 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
2196
2197 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
2198 inline into ...
2199 (Copy_relocs::emit): ... here.
2200 * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
2201 (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
2202 (Copy_reloc_entry::entries_): Change from private to protected.
2203
2204 2014-04-02 Sriraman Tallam <tmsriram@google.com>
2205
2206 * icf.cc (get_section_contents): Replace copies of reloc
2207 vectors with const references.
2208
2209 2014-04-02 Cary Coutant <ccoutant@google.com>
2210
2211 * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
2212 (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
2213 * configure: Regenerate.
2214 * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
2215 -fno-use-linker-plugin.
2216 (LINK1, CXXLINK1): Add it to the link command.
2217 * testsuite/Makefile.in: Regenerate.
2218
2219 2014-03-12 Alan Modra <amodra@gmail.com>
2220
2221 * Makefile.in: Regenerate.
2222
2223 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
2224
2225 * symtab.h (Symbol::set_nonvis): New function.
2226
2227 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
2228
2229 * symtab.cc (Sized_symbol<32>::init_output_data):
2230 Instantiate the template.
2231 (Sized_symbol<64>::init_output_data): Likewise.
2232
2233 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
2234
2235 * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
2236 adjust dynamic symbol value.
2237 * target.h (Target::adjust_dyn_symbol): New function.
2238 (Target::do_adjust_dyn_symbol): New function.
2239
2240 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
2241
2242 * output.cc (Output_data_dynamic::Dynamic_entry::write):
2243 Get the value of DYNAMIC_CUSTOM dynamic entry.
2244 * output.h (Output_data_dynamic::add_custom): New function.
2245 (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
2246 dynamic entry.
2247 (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
2248 * target.h (Target::dynamic_tag_custom_value): New function.
2249 (Target::do_dynamic_tag_custom_value): New function.
2250
2251 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
2252
2253 * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
2254 dynsym indexes.
2255 * target.h (Target::has_custom_set_dynsym_indexes): New function.
2256 (Target::do_has_custom_set_dynsym_indexes): New function.
2257 (Target::set_dynsym_indexes): New function.
2258 (Target::do_set_dynsym_indexes): New function.
2259
2260 2014-03-07 Alan Modra <amodra@gmail.com>
2261
2262 * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
2263 CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
2264 (Powerpc_relocate_functions::has_overflow_unsigned): New function.
2265 (Powerpc_relocate_functions::has_overflow_bitfield,
2266 overflowed): Use the above.
2267 (Target_powerpc::Relocate::relocate): Correct overflow checking
2268 for a number of relocations. Modify overflow test for 16-bit
2269 fields in instructions to signed/unsigned according to whether
2270 the field takes a signed or unsigned value.
2271
2272 2014-03-05 Alan Modra <amodra@gmail.com>
2273
2274 Update copyright years.
2275
2276 2014-03-05 Alan Modra <amodra@gmail.com>
2277
2278 * powerpc.cc (Target_powerpc::Scan::local, global): Support
2279 R_PPC64_ADDR64_LOCAL.
2280 (Target_powerpc::Relocate::relocate): Likewise.
2281
2282 2014-03-03 Alan Modra <amodra@gmail.com>
2283
2284 * dwp.cc (print_version): Update copyright year to current.
2285
2286 2014-02-10 Alan Modra <amodra@gmail.com>
2287
2288 * po/gold.pot: Regenerate.
2289
2290 2014-02-06 Cary Coutant <ccoutant@google.com>
2291
2292 Fix problem where -u is ignored when a weak undef is seen.
2293
2294 * archive.cc (Library_base::should_include_member): Reorder
2295 code to check for -u option if a weak undef has already been seen.
2296 * testsuite/Makefile.am (weak_undef_test_2): New test case.
2297 * testsuite/Makefile.in: Regenerate.
2298 * testsuite/weak_undef_file3.cc: New file.
2299 * testsuite/weak_undef_file4.cc: New file.
2300 * testsuite/weak_undef_test_2.cc: New file.
2301
2302 2014-02-05 Cary Coutant <ccoutant@google.com>
2303
2304 Fix issues with gold undefined symbol diagnostics.
2305
2306 PR binutils/15435
2307 * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
2308 check to here.
2309 * target-reloc.h (is_strong_undefined): New function.
2310 (relocate_section): Move undef vtable symbol check from here.
2311 Check for is_strong_undefined.
2312
2313 2014-02-05 Cary Coutant <ccoutant@google.com>
2314
2315 Fix problems with the --dynamic-list option.
2316
2317 PR gold/13577
2318 * options.cc (General_options::parse_dynamic_list):
2319 Set have_dynamic_list_.
2320 (General_options::General_options): Initialize have_dynamic_list_.
2321 (General_options::finalize): Turn off -Bsymbolic and
2322 -Bsymbolic-functions if --dynamic-list provided.
2323 * options.h (General_options::have_dynamic_list): New function.
2324 (General_options::have_dynamic_list_): New data member.
2325 * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
2326 correctly.
2327
2328 PR gold/16530
2329 * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
2330 in --dynamic-list, mark it.
2331
2332 * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
2333 (dynamic_list_2): New test case.
2334 * testsuite/Makefile.in: Regenerate.
2335 * testsuite/dynamic_list_2.cc: New file.
2336 * testsuite/dynamic_list_2.t: New file.
2337 * testsuite/dynamic_list_lib1.cc: New file.
2338 * testsuite/dynamic_list_lib2.cc: New file.
2339 * testsuite/gc_dynamic_list_test.c: New file.
2340 * testsuite/gc_dynamic_list_test.sh: New file.
2341 * testsuite/gc_dynamic_list_test.t: New file.
2342
2343 2014-01-28 Cary Coutant <ccoutant@google.com>
2344
2345 Add .gdb_index version 7 support.
2346
2347 * gold/dwarf_reader.cc: include <utility> (for make_pair).
2348 (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
2349 debug sections.
2350 (Dwarf_ranges_table::read_ranges_table): Likewise.
2351 (Dwarf_pubnames_table::read_section): Check for GNU-style
2352 sections, and for compressed debug sections.
2353 (Dwarf_pubnames_table::read_header): Compute end address of table.
2354 (Dwarf_pubnames_table::next_name): Return flag_byte. Check
2355 for end of list by offset, not by offset == 0.
2356 (Dwarf_info_reader::do_read_string_table): Check for compressed
2357 debug sections.
2358 * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2359 Initialize new data members.
2360 (Dwarf_pubnames_table::next_name): return flag_byte.
2361 (Dwarf_pubnames_table::end_of_table_): New data member.
2362 (Dwarf_pubnames_table::is_gnu_style_): New data member.
2363 * gold/gdb-index.cc (gdb_index_version): Update to version 7.
2364 (Gdb_index_info_reader::read_pubtable): Read flag_byte.
2365 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
2366 read skeleton type unit DIEs.
2367 (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
2368 (Gdb_index::do_write): Write flag_byte.
2369 * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
2370 (Gdb_index::Cu_vector): Store flags along with cu indexes.
2371 * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
2372 * gold/testsuite/gdb_index_test_comm.sh: Likewise.
2373
2374 2014-01-08 H.J. Lu <hongjiu.lu@intel.com>
2375
2376 * version.cc (print_version): Update copyright year to 2014.
2377
2378 2013-12-19 Dimitry Andric <dimitry@andric.com>
2379
2380 * stringpool.cc (Stringpool_template::reserve): Add
2381 HAVE_UNORDERED_MAP case.
2382 * stringpool.cc (Stringpool_template::print_stats): Likewise.
2383
2384 2013-12-18 Cary Coutant <ccoutant@google.com>
2385
2386 * configure.ac: Check for <unordered_set> and <unordered_map>.
2387 * config.in: Regenerate.
2388 * configure: Regenerate.
2389 * system.h: Use <unordered_set> and <unordered_map> if available.
2390
2391 2013-12-10 Roland McGrath <mcgrathr@google.com>
2392
2393 * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
2394 with $(INSTALL_PROGRAM_ENV).
2395 * Makefile.in: Regenerate.
2396
2397 2013-11-22 Cary Coutant <ccoutant@google.com>
2398
2399 * configure.ac: Add check for which library is needed for
2400 dlopen.
2401 * configure: Regenerate.
2402
2403 2013-11-22 Cary Coutant <ccoutant@google.com>
2404
2405 * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
2406 assembler.
2407 * testsuite/Makefile.in: Regenerate.
2408
2409 2013-11-17 H.J. Lu <hongjiu.lu@intel.com>
2410
2411 * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
2412 Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
2413 R_X86_64_PC32 and R_X86_64_PLT32, respectively.
2414 (Target_x86_64<size>::Scan::local): Likewise.
2415 (Target_x86_64<size>::Scan::global): Likewise.
2416 (Target_x86_64<size>::Relocate::relocate): Likewise.
2417 (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
2418 Likewise.
2419 (Target_x86_64<size>::Scan::check_non_pic(): Handle
2420 R_X86_64_PC32_BND.
2421
2422 * testsuite/Makefile.am (check_PROGRAMS): Add
2423 exception_x86_64_bnd_test.
2424 (exception_x86_64_bnd_test_SOURCES): New macro.
2425 (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
2426 (exception_x86_64_bnd_test_LDFLAGS): Likewise.
2427 (exception_x86_64_bnd_test_LDADD): Likewise.
2428 (exception_x86_64_bnd_1.o): New rule.
2429 (exception_x86_64_bnd_2.o): Likewise.
2430 * testsuite/Makefile.in: Regenerated.
2431
2432 2013-11-15 Alan Modra <amodra@gmail.com>
2433
2434 * powerpc.cc (Target_powerpc::glink_section): Provide non-const
2435 accessor.
2436 (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
2437 Only call ppc64_local_entry_offset for 64-bit. Restrict
2438 symval_for_branch lookup to ELFv1.
2439 (Stub_table::add_plt_call_entry): Use unsigned int off.
2440 (Output_data_glink::Address, invalid_address): New.
2441 (Output_data_glink::add_eh_frame): Move out of line. Add
2442 support for ELFv2.
2443 (Output_data_glink::add_global_entry, find_global_entry,
2444 global_entry_address): New functions.
2445 (Output_data_glink::global_entry_stubs_, end_branch_table_,
2446 ge_size): New variables.
2447 (Output_data_glink::set_final_data_size): Add global entry
2448 stub sizing.
2449 (Output_data_glink::do_write): Write global entry stubs.
2450 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
2451 parameter. Return true for ELFv2. Adjust callers.
2452 (Target_powerpc::Scan::local, global): Restrict opd lookup to
2453 ELFv1. Similarly for ifunc and dynamic relocation processing
2454 specific to ELFv1. Recognize that symbols are defined on
2455 their plt entries for ELFv2.
2456 (Target_powerpc::symval_for_branch): Assert if called for
2457 ELFv2 or ppc32.
2458 (Target_powerpc::Relocate::relocate): Use global entry plt
2459 stub for symbol value if such exists on ELFv2.
2460 (Target_powerpc::Relocate::relocate): Don't call
2461 symval_for_branch when ELFv2. Do adjust for local entry
2462 offset when ELFv2.
2463 (Target_powerpc::do_dynsym_value): Set symbols to global entry
2464 plt stub for ELFv2.
2465 (Target_powerpc::do_plt_address_for_global): Similarly.
2466
2467 2013-11-14 Cary Coutant <ccoutant@google.com>
2468
2469 Revert patch -- this did not fix the problem, and there is
2470 no race there.
2471
2472 2013-11-14 Cary Coutant <ccoutant@google.com>
2473
2474 PR gold/14860
2475 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2476 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2477 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2478 updating fde_offsets_.
2479 (Eh_frame_hdr::lock_): New data member.
2480
2481 2013-11-14 Cary Coutant <ccoutant@google.com>
2482
2483 * dwp.cc (Dwo_file_entry): New type.
2484 (File_list): Use Dwo_file_entry.
2485 (Dwo_file::verify): New function.
2486 (Dwo_file::verify_dwo_list): New function.
2487 (Dwo_file::sized_verify_dwo_list): New function.
2488 (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
2489 list.
2490 (Dwp_options): New enum type.
2491 (dwp_options): Add --verify-only.
2492 (usage): Likewise.
2493 (main): Likewise.
2494 * dwp.h (gold_info): Add declaration.
2495
2496 2013-11-14 Cary Coutant <ccoutant@google.com>
2497
2498 PR gold/14860
2499 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2500 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2501 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2502 updating fde_offsets_.
2503 (Eh_frame_hdr::lock_): New data member.
2504
2505 2013-11-06 Cary Coutant <ccoutant@google.com>
2506
2507 PR gold/15758
2508 * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
2509 before reloc sections.
2510
2511 2013-11-04 Alan Modra <amodra@gmail.com>
2512
2513 * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
2514 (Symbol::needs_dynamic_reloc): Test new flag.
2515 * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
2516 (Target_powerpc::Scan::get_reference_flags): Add target param.
2517 Return FUNC_DESC_ABI for 64-bit ELFv1.
2518 (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
2519 call.
2520 (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
2521 (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
2522
2523 2013-10-31 Cary Coutant <ccoutant@google.com>
2524
2525 Restore support for dwp v2 DWARF package file format.
2526
2527 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2528 tu_length parameter. Adjust all callers.
2529 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2530 * dwp.cc: Include dwarf.h.
2531 (Section_bounds): New struct type.
2532 (Unit_set): New struct type.
2533 (Dwo_file::Dwo_file): Initialize new data member.
2534 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2535 Combine and rename to...
2536 (Dwo_file::read_unit_index): ...this.
2537 (Dwo_file::sized_read_compunit_index)
2538 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2539 (Dwo_file::sized_read_unit_index): ...this.
2540 (Dwo_file::copy_section): Remove section_name, is_str_offsets
2541 parameters; add section_id parameter.
2542 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2543 (Dwo_file::add_unit_set): ...this.
2544 (Dwo_file::shndx_map_): Remove.
2545 (Dwo_file::sect_offsets_): New data member.
2546 (Dwp_output_file::Dwp_output_file): Initialize new data members.
2547 (Dwp_output_file::add_section): Rename to...
2548 (Dwp_output_file::add_contribution): ...this.
2549 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2550 (Dwp_output_file::add_tu_set): Likewise.
2551 (Dwp_output_file::Contribution): New type.
2552 (Dwp_output_file::Section::contributions): New data member.
2553 (Dwp_output_file::Cu_or_tu_set): Remove.
2554 (Dwp_output_file::Section::Section): New ctor.
2555 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2556 (Dwp_output_file::Dwp_index::Section_table): New type.
2557 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2558 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2559 parameter.
2560 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2561 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2562 (Dwp_output_file::Dwp_index::section_table): New member function.
2563 (Dwp_output_file::Dwp_index::section_table_end): New member function.
2564 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2565 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2566 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2567 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2568 (Dwp_output_file::Dwp_index::section_table_): New data member.
2569 (Dwp_output_file::Dwp_index::section_mask_): New data member.
2570 (Dwp_output_file::add_output_section): New member function.
2571 (Dwp_output_file::write_new_section): New member function.
2572 (Dwp_output_file::write_contributions): New member function.
2573 (Dwp_output_file::section_id_map_): New data member.
2574 (class Dwo_id_info_reader): Remove.
2575 (class Unit_reader): New class.
2576 (get_dwarf_section_name): New function.
2577 (Dwo_file::read_executable): Adjust initializations of class data.
2578 (Dwo_file::read): Add support for v2 package file format.
2579 (Dwo_file::read_unit_index): Likewise.
2580 (Dwo_file::sized_read_unit_index): Likewise.
2581 (Dwo_file::copy_section): Likewise.
2582 (Dwo_file::add_unit_set): Likewise.
2583 (Dwp_output_file::add_output_section): Likewise.
2584 (Dwp_output_file::add_contribution): Likewise.
2585 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2586 for empty slot.
2587 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2588 file format.
2589 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2590 slot.
2591 (Dwp_output_file::initialize): Remove unused function.
2592 (Dwp_output_file::finalize): Add support for v2 package file format.
2593 (Dwp_output_file::write_index): Likewise.
2594 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2595 function prototype.
2596
2597 2013-10-31 Cary Coutant <ccoutant@google.com>
2598
2599 * configure.ac: Fix check for -fmerge-constants.
2600 * configure.ac: Regenerate.
2601
2602 2013-10-30 Roland McGrath <mcgrathr@google.com>
2603
2604 * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
2605 Correct 9-byte nop sequence to match what the assembler generates.
2606
2607 2013-10-30 Alan Modra <amodra@gmail.com>
2608
2609 * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
2610 ppc64_local_entry_offset, ppc64_local_entry_offset,
2611 do_read_symbols): New functions.
2612 (Powerpc_relobj::e_flags_, st_other_): New vars.
2613 (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
2614 (Powerpc_dynobj::abiversion, set_abiversion): New functions.
2615 (Powerpc_relobj::e_flags_): New var.
2616 (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
2617 and adjust for ELFv2.
2618 (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
2619 (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
2620 (Powerpc_dynobj::do_find_special_sections): Likewise.
2621 (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
2622 (Target_powerpc::Branch_info::make_stub): Adjust stub destination
2623 to ELFv2 local entry.
2624 (Target_powerpc::do_relax): No thread safe barriers needed for
2625 ELFv2.
2626 (Output_data_plt_powerpc::initial_plt_entry_size_,
2627 plt_entry_size): Delete. Replace all uses with
2628 first_plt_entry_offset() and plt_entry_size().
2629 (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
2630 reserved_size parm. Update callers.
2631 (Output_data_plt_powerpc::entry_count): Update.
2632 (Output_data_plt_powerpc::first_plt_entry_offset): Make private
2633 and use Target_powerpc::first_plt_entry_offset().
2634 (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
2635 rename to plt_entry_size.
2636 (Output_data_plt_powerpc::add_ifunc_entry,
2637 add_local_ifunc_entry): Adjust reloc for ELFv2.
2638 (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
2639 (glink_eh_frame_fde_64v2): New.
2640 (Stub_table::plt_call_size): Support ELFv2 sizing.
2641 (Output_data_glink::add_eh_frame): Use the new FDE.
2642 (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
2643 (Stub_table::do_write): Write ELFv2 stubs and glink.
2644 (Target_powerpc::Relocate::relocate): Replaces nop after call
2645 with ld 2,24(1) and adjust local offset destination for ELFv2.
2646
2647 2013-10-30 Alan Modra <amodra@gmail.com>
2648
2649 * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
2650 (Target_powerpc::Scan::global, local): Likewise.
2651 (Target_powerpc::Relocate::relocate): Likewise. Check for overflow
2652 on all ppc64 @h and @ha relocs.
2653
2654 2013-10-14 Alan Modra <amodra@gmail.com>
2655
2656 * output.h (Output_data_got::add_constant): Tidy.
2657 (Output_data_got::add_constant_pair): New function.
2658 * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
2659 methods used so as to first call reserve_ent().
2660
2661 2013-10-11 Roland McGrath <mcgrathr@google.com>
2662
2663 * powerpc.cc (Output_data_got_powerpc): Remove unused methods
2664 add_got_entry and add_got_entry_pair.
2665
2666 * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
2667 (HAVE_PUBNAMES): Likewise.
2668 * configure: Regenerate.
2669
2670 * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
2671 * testsuite/Makefile.in: Regenerate.
2672
2673 * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
2674 Remove const from declaration.
2675 * target.cc (Sized_target::do_adjust_elf_header): Update definition.
2676 * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
2677 * output.h (Output_file_header): Remove const from member target_
2678 and corresponding constructor argument.
2679 * output.cc (Output_file_header::Output_file_header): Update prototype.
2680 (Output_file_header::do_sized_write): Use this->target_ in place
2681 of parameters()->target().
2682
2683 * testsuite/undef_symbol.cc (Foo::get_a): New method.
2684
2685 * configure.ac (MERGE_CONSTANTS_FLAG): New check.
2686 * configure: Regenerate.
2687 * Makefile.in: Regenerate.
2688 * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
2689 * testsuite/merge_string_literals_2.c: Likewise.
2690 * testsuite/Makefile.am
2691 (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
2692 (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
2693 literal -fmerge-constants.
2694 * testsuite/Makefile.in: Regenerate.
2695
2696 * i386.cc (Target_i386): Remove unused member dynbss_.
2697 * arm.cc (Target_arm): Likewise.
2698 * powerpc.cc (Target_powerpc): Likewise.
2699 * sparc.cc (Target_sparc): Likewise.
2700 * tilegx.cc (Target_tilegx): Likewise.
2701 * x86_64.cc (Target_x86_64): Likewise.
2702 * dwarf_reader.h (Dwarf_info_reader): Remove unused members
2703 type_signature_, type_offset_.
2704 * plugin.h (Plugin_hook): Remove unused member layout_.
2705 * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
2706 mapfile_.
2707 (Read_member): Remove unused members input_objects_, symtab_,
2708 mapfile_, layout_.
2709 (Check_library): Remove unused member symtab_.
2710 * archive.h (Lib_group): Remove unused member lib_.
2711 * archive.cc (Lib_group::Lib_group): Update initializer.
2712 * incremental.h (Incremental_binary): Remove unused member target_.
2713 (Incremental_script_entry): Removed unused member script_.
2714 * layout.h (Write_symbols_task): Remove unused member input_objects_.
2715 * icf.h (Icf): Remove unused member num_tracked_relocs.
2716
2717 * gold-threads.h (Once): Conditionalize member was_run_lock_ on
2718 [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
2719 its only use.
2720 * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
2721
2722 * archive.h: Use struct rather than class for forward declaration
2723 of Read_symbols_data.
2724
2725 2013-10-07 Cary Coutant <ccoutant@google.com>
2726
2727 PR gold/16010
2728 * testsuite/Makefile.am (icf_test): Fix dependencies.
2729 (icf_safe_test): Likewise.
2730 (icf_safe_so_test): Likewise.
2731 (large_symbol_alignment): Add empty _LDADD rule.
2732 * testsuite/Makefile.in: Regenerate.
2733
2734 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
2735
2736 PR gold/15927
2737 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
2738 relocation for R_X86_64_32 on x32.
2739
2740 2013-08-27 Roland McGrath <mcgrathr@google.com>
2741
2742 * output.cc (Output_segment::set_section_addresses): Take new
2743 Target* argument. If target->isolate_execinstr() and the segment
2744 is executable and starts at a target->abi_pagesize() boundary,
2745 pad its end out to a target->abi_pagesize() boundary with code fill.
2746 * output.h (Output_segment::set_section_addresses): Update decl.
2747 * layout.h (Layout::check_output_data_for_reset_values): Take new
2748 argument RELAX_OUTPUTS.
2749 (Layout): New member relax_output_list_.
2750 (Layout::add_relax_output): New method.
2751 * layout.cc (Layout::Layout): Update constructor.
2752 (Layout::reset_relax_output): New method.
2753 (Layout::clean_up_after_relaxation): Call it.
2754 (Layout::prepare_for_relaxation): Update caller.
2755 (Layout::set_segment_offsets): Update callers of set_section_addresses.
2756 Call reset_relax_output before re-processing segments for
2757 isolate_execinstr case.
2758 (Layout::write_data): Handle relax_output_list_.
2759 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
2760 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
2761
2762 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
2763
2764 PR binutils/15834
2765 * object.h: Fix typos.
2766
2767 2013-08-16 Roland McGrath <mcgrathr@google.com>
2768
2769 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
2770 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
2771
2772 2013-08-07 Cary Coutant <ccoutant@google.com>
2773
2774 Revert support for v2 DWP files:
2775
2776 2013-03-01 Cary Coutant <ccoutant@google.com>
2777
2778 Add dwp support for v2 DWARF package file format.
2779 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2780 tu_length parameter. Adjust all callers.
2781 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2782 * dwp.cc: Include dwarf.h.
2783 (Section_bounds): New struct type.
2784 (Unit_set): New struct type.
2785 (Dwo_file::Dwo_file): Initialize new data member.
2786 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2787 Combine and rename to...
2788 (Dwo_file::read_unit_index): ...this.
2789 (Dwo_file::sized_read_compunit_index)
2790 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2791 (Dwo_file::sized_read_unit_index): ...this.
2792 (Dwo_file::copy_section): Remove section_name, is_str_offsets
2793 parameters; add section_id parameter.
2794 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2795 (Dwo_file::add_unit_set): ...this.
2796 (Dwo_file::shndx_map_): Remove.
2797 (Dwo_file::sect_offsets_): New data member.
2798 (Dwp_output_file::Dwp_output_file): Initialize new data members.
2799 (Dwp_output_file::add_section): Rename to...
2800 (Dwp_output_file::add_contribution): ...this.
2801 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2802 (Dwp_output_file::add_tu_set): Likewise.
2803 (Dwp_output_file::Contribution): New type.
2804 (Dwp_output_file::Section::contributions): New data member.
2805 (Dwp_output_file::Cu_or_tu_set): Remove.
2806 (Dwp_output_file::Section::Section): New ctor.
2807 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2808 (Dwp_output_file::Dwp_index::Section_table): New type.
2809 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2810 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2811 parameter.
2812 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2813 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2814 (Dwp_output_file::Dwp_index::section_table): New member function.
2815 (Dwp_output_file::Dwp_index::section_table_end): New member function.
2816 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2817 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2818 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2819 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2820 (Dwp_output_file::Dwp_index::section_table_): New data member.
2821 (Dwp_output_file::Dwp_index::section_mask_): New data member.
2822 (Dwp_output_file::add_output_section): New member function.
2823 (Dwp_output_file::write_new_section): New member function.
2824 (Dwp_output_file::write_contributions): New member function.
2825 (Dwp_output_file::section_id_map_): New data member.
2826 (class Dwo_id_info_reader): Remove.
2827 (class Unit_reader): New class.
2828 (get_dwarf_section_name): New function.
2829 (Dwo_file::read_executable): Adjust initializations of class data.
2830 (Dwo_file::read): Add support for v2 package file format.
2831 (Dwo_file::read_unit_index): Likewise.
2832 (Dwo_file::sized_read_unit_index): Likewise.
2833 (Dwo_file::copy_section): Likewise.
2834 (Dwo_file::add_unit_set): Likewise.
2835 (Dwp_output_file::add_output_section): Likewise.
2836 (Dwp_output_file::add_contribution): Likewise.
2837 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2838 for empty slot.
2839 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2840 file format.
2841 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2842 slot.
2843 (Dwp_output_file::initialize): Remove unused function.
2844 (Dwp_output_file::finalize): Add support for v2 package file format.
2845 (Dwp_output_file::write_index): Likewise.
2846 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2847 function prototype.
2848
2849 2013-07-31 Cary Coutant <ccoutant@google.com>
2850
2851 * object.cc (Sized_relobj::do_output_section_address): New function.
2852 (Sized_relobj): Instantiate explicitly.
2853 * object.h (Object::output_section_address): New function.
2854 (Object::do_output_section_address): New function.
2855 (Sized_relobj::do_output_section_address): New function.
2856 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
2857
2858 2013-07-30 Cary Coutant <ccoutant@google.com>
2859 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
2860
2861 * parameters.cc (Parameters::entry): Return target-specific entry
2862 symbol name.
2863 * target.h (Target::entry_symbol_name): New function.
2864 (Target_info::entry_symbol_name): New data member.
2865
2866 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
2867 * i386.cc (Target_i386::i386_info): Likewise.
2868 (Target_i386_nacl::i386_nacl_info): Likewise.
2869 * sparc.cc (Target_sparc::sparc_info): Likewise.
2870 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
2871 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
2872 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
2873 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2874
2875 2013-07-22 Sterling Augustine <saugustine@google.com>
2876
2877 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
2878 Convert parameter shndx to local variable. Add parameters symtab
2879 and symtab_size. Scan over section names. Find relocation
2880 section corresponding to current section. Create and initialize
2881 reloc_mapper_ and reloc_type_.
2882 (Dwarf_pubnames_table::read_header): Add assertion. Change
2883 unit_length to off_t. Initialize member unit_length_. Fill in field
2884 cu_offset_.
2885 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2886 Initialize new fields unit_length_ and cu_offset_.
2887 (Dwarf_pubnames_table::read_section): Update prototype.
2888 (Dwarf_pubnames_table::cu_offset): New member function.
2889 (Dwarf_pubnames_table::subsection_size): Likewise.
2890 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
2891 New fields.
2892 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
2893 member functions public.
2894 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
2895 Update comment. Rework logic. Move repeated parts to...
2896 (Gdb_index_info_reader::read_pubtable): ...here. New function.
2897 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
2898 pubtypes_table_, and stmt_list_offset.
2899 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2900 Gdb_index::find_pubtype_offset,
2901 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
2902 (Gdb_index::pubnames_read): Update prototype and rework logic.
2903 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
2904 Forward declare.
2905 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2906 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
2907 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
2908 Gdb_index::map_pubtable_to_dies):
2909 Declare functions.
2910 (Gdb_index::pubnames_read): Update declaration.
2911 (Gdb_index::Pubname_offset_map): New type.
2912 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
2913 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
2914 Gdb_index::stmt_list_offset): Declare.
2915 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
2916 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
2917 Gdb_index::pubtypes_offset_): Remove.
2918
2919 2013-07-19 Roland McGrath <mcgrathr@google.com>
2920
2921 * options.h (General_options): Add -Trodata-segment option.
2922 * parameters.cc (Parameters::check_rodata_segment): New function.
2923 (Parameters::set_target_once): Call it.
2924 * parameters.h (Parameters): Declare it (private member function).
2925 * layout.cc (load_seg_unusable_for_headers): New function, broken
2926 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
2927 then validate rodata segment rather than text segment.
2928 (relaxation_loop_body): Call that.
2929 (is_text_segment): New function. Don't admit a non-executable
2930 segment if TARGET->isolate_execinstr().
2931 (set_segment_offsets): Call it. Honor -Trodata-segment option.
2932
2933 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
2934
2935 PR gold/15070
2936 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
2937 * nacl.h (Sniff_file::View::View): Request aligned view.
2938
2939 2013-07-11 Cary Coutant <ccoutant@google.com>
2940
2941 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
2942 correct BRLT entry size.
2943
2944 2013-07-03 Alan Modra <amodra@gmail.com>
2945
2946 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
2947 comment.
2948
2949 2013-07-01 Cary Coutant <ccoutant@google.com>
2950
2951 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
2952 reloc_type_.
2953 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
2954 (Dwarf_ranges_table::lookup_reloc): New function.
2955 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
2956 reloc_type_.
2957 (Dwarf_ranges_table::lookup_reloc): New function.
2958 (Dwarf_ranges_table::reloc_type_): New data member.
2959
2960 2013-06-27 Jing Yu <jingyu@google.com>
2961
2962 PR gold/15662
2963 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
2964 function.
2965 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
2966 (Target_powerpc::do_relax): Call the above.
2967
2968 2013-06-27 Cary Coutant <ccoutant@google.com>
2969
2970 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
2971 on garbage collected .opd section.
2972
2973 2013-06-27 Alan Modra <amodra@gmail.com>
2974
2975 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
2976 is non-zero.
2977 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
2978 (Target_powerpc::do_function_location): Likewise for loc->shndx.
2979
2980 2013-06-14 Cary Coutant <ccoutant@google.com>
2981
2982 * resolve.cc (Symbol::override_base): Don't override st_type
2983 from plugin placeholder symbols.
2984 (Symbol_table::resolve): Likewise.
2985 (Symbol_table::should_override): Don't complain about TLS mismatch
2986 if the TO symbol is a plugin placeholder.
2987 * testsuite/Makefile.am (plugin_test_tls): New test.
2988 * testsuite/Makefile.in: Regenerate.
2989 * testsuite/plugin_test_tls.sh: New test script.
2990 * testsuite/two_file_test_2_tls.cc: New test source.
2991 * testsuite/two_file_test_tls.cc: New test source.
2992
2993 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
2994
2995 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
2996 the maximum segment alignment is larger than the page size.
2997 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
2998 correctly aligns the symbols with large alignemnt.
2999 * testsuite/Makefile.in: Regenerate.
3000 * testsuite/large_symbol_alignment.cc: New file.
3001
3002 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
3003 Sriraman Tallam <tmsriram@google.com>
3004
3005 * options.h (sort_section): New option.
3006 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
3007 Rename from Input_section_sort_section_name_special_ordering_compare.
3008 (Input_section_sort_section_name_compare): New struct.
3009 * output.cc (Output_section::Input_section_sort_section_name_compare::
3010 operator()): New function.
3011 (Output_section::sort_attached_input_sections): Use new sort function
3012 for .text if --sort-section=name is specified.
3013 * layout.cc (Layout::make_output_section):
3014 Add sorting by name when --sort-section=name is specified.
3015 * testsuite/Makefile.am (text_section_grouping): Test option
3016 --sort-section=name.
3017 * testsuite/Makefile.in: Regenerate.
3018 * testsuite/section_sorting_name.cc: New file.
3019 * testsuite/section_sorting_name.sh: New file.
3020
3021 2013-05-21 Cary Coutant <ccoutant@google.com>
3022
3023 * symtab.h (Symbol::is_cxx_vtable): New function.
3024 * target-reloc.h (relocate_section): Check for vtable symbol.
3025 * testsuite/Makefile.am (missing_key_func.sh): New test case.
3026 * testsuite/Makefile.in: Regenerate.
3027 * testsuite/missing_key_func.cc: New test source.
3028 * testsuite/missing_key_func.sh: New test script.
3029
3030 2013-05-21 Cary Coutant <ccoutant@google.com>
3031
3032 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
3033 type of enclosing symbol.
3034 (Relocate_info::location): Check symbol type when describing symbol.
3035 * object.h (Symbol_location_info): Remove unused line_number;
3036 add enclosing_symbol_type.
3037 * testsuite/debug_msg.sh: Adjust expected output.
3038
3039 2013-05-13 Cary Coutant <ccoutant@google.com>
3040
3041 * configure.ac: Export DEFAULT_TARGET.
3042 * configure: Regenerate.
3043 * Makefile.in: Regenerate.
3044 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
3045 * testsuite/Makefile.in: Regenerate.
3046 * testsuite/debug_msg.sh: Delete duplicate tests.
3047 Don't check undef_int error message match for powerpc where the
3048 source file and line number aren't available.
3049
3050 2013-05-10 Roland McGrath <mcgrathr@google.com>
3051
3052 * options.h (General_options): Add --rosegment-gap option.
3053 * options.cc (finalize): --rosegment-gap implies --rosegment.
3054 * layout.cc (set_segment_offsets): Let user option override
3055 target->rosegment_gap().
3056
3057 2013-05-10 Roland McGrath <mcgrathr@google.com>
3058
3059 * options.h (General_options): Remove leading space from help
3060 messages for -nostdlib and --rosegment.
3061
3062 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
3063
3064 PR ld/15365
3065 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
3066
3067 2013-05-03 Alan Modra <amodra@gmail.com>
3068
3069 * merge.cc (Output_merge_string::do_add_input_section): Correct
3070 scan for number of strings. Rename vars to avoid shadowing.
3071 Include missing terminator in input_size_.
3072
3073 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
3074
3075 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
3076 Restore empty string handling.
3077
3078 2013-05-01 Cary Coutant <ccoutant@google.com>
3079
3080 * stringpool.cc (Stringpool_template::new_key_offset): Fix
3081 uninitialized warning.
3082
3083 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
3084
3085 * output.cc (Output_section::add_merge_input_section): Allow
3086 to merge sections if the alignment is more than character size.
3087 * merge.h (Output_merge_string::Output_merge_string): Remove
3088 assert.
3089 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
3090 only not-null strings. Check the alignment of strings.
3091 * stringpool.h
3092 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
3093 alignment as the argument.
3094 (Stringpool_template<Stringpool_char>::addralign_): New class member.
3095 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
3096 Align non-zero length strings according to the addralign_.
3097 (Stringpool_template<Stringpool_char>::set_string_offsets):
3098 Updating offsets according to the given alignment.
3099 * testsuite/Makefile.am (text_section_grouping): Test if string
3100 literals are getting merged.
3101 * testsuite/Makefile.in: Regenerate.
3102 * testsuite/merge_string_literals_1.c: New file.
3103 * testsuite/merge_string_literals_2.c: Ditto.
3104 * testsuite/merge_string_literals.sh: Ditto.
3105
3106 2013-04-26 Ian Lance Taylor <iant@google.com>
3107
3108 * target-reloc.h (relocate_section): If the reloc offset is out of
3109 range, pass VIEW as NULL to relocate.relocate.
3110 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
3111 * i386.cc (Target_i386::Relocate::relocate): Likewise.
3112 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
3113 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
3114 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
3115 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3116
3117 2013-04-26 Geoff Pike <gpike@chromium.org>
3118
3119 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
3120 * layout.cc (Hash_task): New class.
3121 (Layout::queue_build_id_tasks): New function.
3122 (Layout::write_build_id): Handle single-thread portion of build ID
3123 computation. (In some cases, all of it is single-threaded.) Replace
3124 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
3125 functionality in fewer lines of code.
3126 * layout.h (Layout::queue_build_id_tasks): New function declaration.
3127 * options.h (General_options): make "--build-id" default to tree
3128 rather than sha1. Add two new options related to --build-id=tree:
3129 --build-id-chunk-size-for-treehash and
3130 --build-id-min-file-size-for-treehash.
3131 * Makefile.am: add testing of --build-id=tree and related new options
3132 (these tests will be invoked by "make check").
3133 * Makefile.in: Regenerate.
3134
3135 2013-04-25 Alan Modra <amodra@gmail.com>
3136
3137 * configure.tgt: Add powerpcle and powerpc64le.
3138
3139 2013-04-22 Alan Modra <amodra@gmail.com>
3140
3141 PR gold/15355
3142 * layout.cc (Layout::segment_precedes): Allow more than one
3143 segment with the same type and flags.
3144
3145 2013-04-15 Cary Coutant <ccoutant@google.com>
3146
3147 * layout.cc (Layout::set_relocatable_section_offsets): Don't
3148 allocate space in file for BSS sections.
3149
3150 2013-04-15 Cary Coutant <ccoutant@google.com>
3151
3152 * script-sections.cc (Orphan_output_section): Reset address
3153 to zero after each orphaned section for relocatable links.
3154
3155 2013-04-15 Cary Coutant <ccoutant@google.com>
3156
3157 * symtab.cc (Symbol_table::sized_write_globals): Subtract
3158 section starting address for relocatable link.
3159 * testsuite/Makefile.am (script_test_11): New test.
3160 * testsuite/Makefile.in: Regenerate.
3161 * testsuite/script_test_11.c: New source file.
3162 * testsuite/script_test_11.t: New linker script.
3163
3164 2013-04-13 Alan Modra <amodra@gmail.com>
3165
3166 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
3167 owner when sections are not adjacent and exceed group size.
3168 (Target_powerpc::group_sections): Handle corner case.
3169 (Target_powerpc::Branch_info::make_stub): Handle case where
3170 stub table doesn't exist due to branches in non-exec sections.
3171 (Target_powerpc::Relocate::relocate): Likewise.
3172
3173 2013-04-11 Alan Modra <amodra@gmail.com>
3174
3175 PR gold/15354
3176 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
3177 .branch_lt to match bfd ld. Adjust comments throughout file.
3178
3179 2013-04-04 Ian Lance Taylor <iant@google.com>
3180
3181 GCC PR c++/56840
3182 * object.cc (do_layout_deferred_sections): Handle .eh_frame
3183 sections before checking whether they are included in the link.
3184
3185 2013-03-29 Sriraman Tallam <tmsriram@google.com>
3186
3187 * archive.cc (Archive::get_elf_object_for_member): Create the elf
3188 object before calling the plugin claim_file handler. Pass the elf
3189 object of the archive to the plugin. Delete the elf object if the
3190 plugin claims the file.
3191
3192 2013-03-21 Alan Modra <amodra@gmail.com>
3193
3194 * layout.cc (Layout::set_segment_offsets): Accept writable .text
3195 segment when omagic.
3196
3197 2013-03-21 Alan Modra <amodra@gmail.com>
3198
3199 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
3200 comparison warning.
3201 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
3202 uninitialized" warning.
3203
3204 2013-03-20 Alan Modra <amodra@gmail.com>
3205
3206 * symtab.h (Symbol::clear_version): New function.
3207 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
3208 is_needed by weak references. Clear version for symbols defined
3209 in as-needed objects that are not needed.
3210
3211 2013-03-15 Alan Modra <amodra@gmail.com>
3212
3213 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
3214 static and public. Add report_err param. Return false for data refs.
3215 (Target_powerpc::rela_dyn_section): New overloaded function.
3216 (Target_powerpc::plt_, iplt_): Elucidate.
3217 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
3218 (Output_data_plt_powerpc::do_write): Don't write .iplt.
3219 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
3220 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
3221 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
3222 push_branch and make_plt_entry for ifunc syms when
3223 reloc_needs_plt_for_ifunc.
3224 (Target_powerpc::Relocate::relocate): Don't use plt entry value
3225 for ifunc unless reloc_needs_plt_for_ifunc.
3226
3227 2013-03-15 Alan Modra <amodra@gmail.com>
3228
3229 * gc.h (gc_process_relocs): Don't look through function descriptors.
3230 * icf.cc (get_section_contents): Do so here instead.
3231
3232 2013-03-13 Alan Modra <amodra@gmail.com>
3233
3234 * powerpc.cc (is_branch_reloc): Forward declare.
3235 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
3236 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
3237 false for 64-bit, true for 32-bit non-branch relocs.
3238 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
3239 * testsuite/Makefile.am (icf_test): Use linker map file instead of
3240 nm output.
3241 (icf_safe_test): Generate linker map file as well as nm output.
3242 (icf_safe_so_test): Likewise.
3243 * testsuite/Makefile.in: Regenerate.
3244 * testsuite/icf_test.sh: Parse linker map file to determine
3245 section folding.
3246 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
3247 * testsuite/icf_safe_so_test.sh: Likewise.
3248 (X86_32_or_ARM_specific_safe_fold): Merge into..
3249 (arch_specific_safe_fold): ..this.
3250 (X86_64_specific_safe_fold): Delete unused function.
3251
3252 2013-03-12 Alan Modra <amodra@gmail.com>
3253
3254 * gc.h (gc_process_relocs): Look through function descriptors
3255 to determine shndx, symvalue and addend used by ICF. Tidy
3256 variable duplication.
3257
3258 2013-03-11 Alan Modra <amodra@gmail.com>
3259
3260 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
3261 * layout.cc (Layout_task_runner::run): ..to here.
3262 * symtab.h (struct Symbol_location): Extract from..
3263 (class Symbol_table): ..here.
3264 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
3265 * target.h (class Target): Add function_location and
3266 do_function_location functions.
3267 (class Sized_target): Add do_function_location.
3268 * object.h (class Sized_relobj_file): Move find_shdr..
3269 (class Object): ..to here.
3270 * object.cc: Likewise. Update to suit. Instantiate.
3271 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
3272 * powerpc.cc (class Powerpc_dynobj): New.
3273 (Target_powerpc::do_function_location): New function.
3274 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
3275 (Powerpc_dynobj::do_read_symbols): New function.
3276 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
3277
3278 2013-03-08 Ian Lance Taylor <iant@google.com>
3279
3280 * options.cc (General_options::string_to_object_format): Accept
3281 "default".
3282
3283 2013-03-08 Alan Modra <amodra@gmail.com>
3284
3285 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
3286 pointer to Post_fde.
3287 (struct Post_fde): Move definition to here..
3288 * ehframe.cc (struct Post_fde): ..from here.
3289 (Cie::write): Don't alloc Post_fde.
3290 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
3291
3292 2013-03-07 Alan Modra <amodra@gmail.com>
3293
3294 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
3295 relocation referencing .LC0.
3296 * testsuite/discard_locals_test.sh: Remove FIXMEs.
3297
3298 2013-03-07 Alan Modra <amodra@gmail.com>
3299
3300 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
3301 always_inline. Add assembly for powerpc to avoid GOT.
3302
3303 2013-03-07 Alan Modra <amodra@gmail.com>
3304
3305 * testsuite/script_test_10.sh: Don't test .bss section
3306 header number.
3307
3308 2013-03-06 Alan Modra <amodra@gmail.com>
3309
3310 * powerpc.cc (class Powerpc_relobj): Move some member functions.
3311 (Target_powerpc::symval_for_branch): Add symtab param. Update
3312 all callers. Handle folded sections.
3313 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
3314 to Powerpc_relobj.
3315 (Global_symbol_visitor_opd::operator()): Likewise.
3316
3317 2013-03-04 Alan Modra <amodra@gmail.com>
3318
3319 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
3320 * testsuite/Makefile.in: Regenerate.
3321
3322 2013-03-01 Cary Coutant <ccoutant@google.com>
3323
3324 Add dwp support for v2 DWARF package file format.
3325 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
3326 tu_length parameter. Adjust all callers.
3327 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
3328 * dwp.cc: Include dwarf.h.
3329 (Section_bounds): New struct type.
3330 (Unit_set): New struct type.
3331 (Dwo_file::Dwo_file): Initialize new data member.
3332 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
3333 Combine and rename to...
3334 (Dwo_file::read_unit_index): ...this.
3335 (Dwo_file::sized_read_compunit_index)
3336 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
3337 (Dwo_file::sized_read_unit_index): ...this.
3338 (Dwo_file::copy_section): Remove section_name, is_str_offsets
3339 parameters; add section_id parameter.
3340 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
3341 (Dwo_file::add_unit_set): ...this.
3342 (Dwo_file::shndx_map_): Remove.
3343 (Dwo_file::sect_offsets_): New data member.
3344 (Dwp_output_file::Dwp_output_file): Initialize new data members.
3345 (Dwp_output_file::add_section): Rename to...
3346 (Dwp_output_file::add_contribution): ...this.
3347 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
3348 (Dwp_output_file::add_tu_set): Likewise.
3349 (Dwp_output_file::Contribution): New type.
3350 (Dwp_output_file::Section::contributions): New data member.
3351 (Dwp_output_file::Cu_or_tu_set): Remove.
3352 (Dwp_output_file::Section::Section): New ctor.
3353 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
3354 (Dwp_output_file::Dwp_index::Section_table): New type.
3355 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
3356 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
3357 parameter.
3358 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
3359 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
3360 (Dwp_output_file::Dwp_index::section_table): New member function.
3361 (Dwp_output_file::Dwp_index::section_table_end): New member function.
3362 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
3363 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
3364 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
3365 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
3366 (Dwp_output_file::Dwp_index::section_table_): New data member.
3367 (Dwp_output_file::Dwp_index::section_mask_): New data member.
3368 (Dwp_output_file::add_output_section): New member function.
3369 (Dwp_output_file::write_new_section): New member function.
3370 (Dwp_output_file::write_contributions): New member function.
3371 (Dwp_output_file::section_id_map_): New data member.
3372 (class Dwo_id_info_reader): Remove.
3373 (class Unit_reader): New class.
3374 (get_dwarf_section_name): New function.
3375 (Dwo_file::read_executable): Adjust initializations of class data.
3376 (Dwo_file::read): Add support for v2 package file format.
3377 (Dwo_file::read_unit_index): Likewise.
3378 (Dwo_file::sized_read_unit_index): Likewise.
3379 (Dwo_file::copy_section): Likewise.
3380 (Dwo_file::add_unit_set): Likewise.
3381 (Dwp_output_file::add_output_section): Likewise.
3382 (Dwp_output_file::add_contribution): Likewise.
3383 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
3384 for empty slot.
3385 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
3386 file format.
3387 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
3388 slot.
3389 (Dwp_output_file::initialize): Remove unused function.
3390 (Dwp_output_file::finalize): Add support for v2 package file format.
3391 (Dwp_output_file::write_index): Likewise.
3392 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
3393 function prototype.
3394
3395 2013-03-01 Cary Coutant <ccoutant@google.com>
3396
3397 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
3398 function into class definition in header file.
3399 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
3400 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
3401 New function.
3402 (Dwarf_info_reader::check_buffer): Move here from .cc file.
3403
3404 2013-02-28 Alan Modra <amodra@gmail.com>
3405
3406 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
3407 * target.cc (Target::do_plt_fde_location): New function.
3408 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
3409 accessor function, and constructor param.
3410 (struct Post_fde, Post_fdes): Declare.
3411 (Cie::write): Add post_fdes param.
3412 * ehframe.cc (Fde::write): Use plt_fde_location.
3413 (struct Post_fde): Define.
3414 (Cie::write): Stash FDEs added post merge mapping.
3415 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
3416 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
3417 (Eh_frame::do_sized_write): Arrange to write post map FDES after
3418 other FDEs.
3419 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
3420 (Target_powerpc::has_glink): New function.
3421 (Target_powerpc::do_relax): Add eh_frame info for stubs.
3422 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
3423 glink_eh_frame_fde_32, default_fde): New data.
3424 (Stub_table::eh_frame_added_): New var.
3425 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
3426 Make const.
3427 (Stub_table::add_eh_frame): New function.
3428 (Output_data_glink::add_eh_frame): New function.
3429 (Target_powerpc::make_glink_section): Call add_eh_frame.
3430
3431 2013-02-15 Ian Lance Taylor <iant@google.com>
3432
3433 * options.h (DEFINE_uint64_alias): Define.
3434 (class General_options): Add -Ttext-segment as an alias for
3435 -Ttext.
3436
3437 2013-02-15 Alan Modra <amodra@gmail.com>
3438
3439 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
3440 (Stub_table::do_write): ..here, two places.
3441 (Stub_table::plt_call_size): Use it here too.
3442
3443 2013-02-11 Ian Lance Taylor <iant@google.com>
3444
3445 * descriptors.cc (Descriptors::close_all): New function.
3446 * descriptors.h (class Descriptors): Declare close_all.
3447 (close_all_descriptors): New inline function.
3448 * plugin.cc: Include "descriptors.h".
3449 (Plugin_manager::cleanup): Call close_all_descriptors.
3450
3451 2013-02-06 Alan Modra <amodra@gmail.com>
3452
3453 * README: Update coding style link.
3454
3455 2013-01-28 Cary Coutant <ccoutant@google.com>
3456
3457 * dwp.cc (File_list): New typedef.
3458 (Dwo_name_info_reader): New class.
3459 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
3460 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
3461 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
3462 (Dwo_file::read_executable): New function.
3463 (Dwo_file::read): Move common setup code to ...
3464 (Dwo_file::make_object): ... here.
3465 (dwp_options): Add --exec/-e.
3466 (usage): Likewise.
3467 (main): Likewise.
3468
3469 2013-01-24 Sriraman Tallam <tmsriram@google.com>
3470
3471 * layout.cc (Layout::layout): Check for option text_reorder.
3472 (Layout::make_output_section): Ditto.
3473 * options.h (text_reorder): New option.
3474 * output.cc (Input_section_sort_compare): Remove special ordering
3475 of section names.
3476 (Output_section::
3477 Input_section_sort_section_name_special_ordering_compare::
3478 operator()): New function.
3479 (Output_section::sort_attached_input_sections): Use new sort function
3480 for .text.
3481 * output.h (Input_section_sort_section_name_special_ordering_compare):
3482 New struct.
3483 * testsuite/Makefile.am (text_section_grouping): Test option
3484 --no-text-reorder
3485 * testsuite/Makefile.in: Regenerate.
3486 * testsuite/text_section_grouping.sh: Check order of functions without
3487 default text reordering.
3488
3489 2013-01-18 Mike Frysinger <vapier@gentoo.org>
3490
3491 * options.h (General_options): Change default to true for new_dtags.
3492
3493 2013-01-18 Mike Frysinger <vapier@gentoo.org>
3494
3495 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
3496 when enable_new_dtags is false. Only add DT_RUNPATH when
3497 enable_new_dtags is true.
3498
3499 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
3500
3501 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
3502 used in declaration and definition consistent.
3503 (Target_powerpc::symval_for_branch): Ditto.
3504
3505 2013-01-16 Sriraman Tallam <tmsriram@google.com>
3506
3507 * testsuite/plugin_final_layout.cc: Fix comment.
3508
3509 2013-01-16 Sriraman Tallam <tmsriram@google.com>
3510
3511 * layout.cc (Layout::layout): Do not do default sorting for
3512 text sections when section ordering is specified.
3513 (make_output_section): Ditto.
3514 * testsuite/plugin_final_layout.cc: Name the function sections
3515 to catch reordering issues.
3516
3517 2013-01-15 Alan Modra <amodra@gmail.com>
3518
3519 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
3520 plt-thread-safe.
3521
3522 2013-01-15 Alan Modra <amodra@gmail.com>
3523
3524 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
3525 * testsuite/Makefile.in: Regenerate.
3526
3527 2013-01-14 Alan Modra <amodra@gmail.com>
3528
3529 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
3530 * testsuite/Makefile.in: Regenerate.
3531
3532 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
3533
3534 PR bfd/14430
3535 Fix mingw gold build with plugins enabled
3536 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
3537 * configure.ac: Export DLOPEN_LIBS and add headers check.
3538 * plugin.cc: Handle non-dlfcn case.
3539 * Makefile.in: Regenerate.
3540 * config.in: Regenerate.
3541 * configure: Regenerate.
3542 * testsuite/Makefile.in: Regenerate.
3543
3544 2013-01-09 Sriraman Tallam <tmsriram@google.com>
3545
3546 * output.h (sort_attached_input_sections): Change to be public.
3547 * script-sections.cc
3548 (Output_section_definition::set_section_addresses): Sort
3549 attached input sections according to section order before linker
3550 script assigns section addresses.
3551 (Orphan_output_section::set_section_addresses): Sort
3552 attached input sections according to section order before linker
3553 script assigns section addresses.
3554 * Makefile.am (final_layout.sh): Use a simple linker script to
3555 check if section ordering still works.
3556 * Makefile.in: Regenerate.
3557
3558 2013-01-09 Ben Cheng <bccheng@google.com>
3559
3560 * arm.cc (Target_arm::attributes_accept_div): New function.
3561 (Target_arm::attributes_forbid_div): New function.
3562 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
3563 attribute using the same new functions as what bfd/elf32_arm.c
3564 does.
3565
3566 2013-01-07 Cary Coutant <ccoutant@google.com>
3567
3568 PR gold/14993
3569 * output.cc (Output_section::add_input_section): For incremental
3570 updates, don't track input sections that are allocated from patch
3571 space.
3572
3573 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
3574 Ian Lance Taylor <iant@google.com>
3575
3576 PR gold/14897
3577 * configure.ac (--enable-ld): Removed.
3578 (install_as_default): Set to yes only for --enable-gold=default
3579 or --disable-ld.
3580 * configure: Regenerated.
3581
3582 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
3583
3584 * options.h (General_options): Add -fuse-ld= for GCC linker
3585 option compatibility.
3586
3587 2013-01-04 Cary Coutant <ccoutant@google.com>
3588
3589 * configure.ac: Fix typo restoring CXXFLAGS.
3590 * configure: Regenerate.
3591
3592 2013-01-04 Cary Coutant <ccoutant@google.com>
3593
3594 * testsuite/Makefile.am (CXXLINK_S): New macro.
3595 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
3596 * testsuite/Makefile.in: Regenerate.
3597
3598 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
3599
3600 * version.cc (print_version): Update copyright year to 2013.
3601
3602 2012-12-20 Ian Lance Taylor <iant@google.com>
3603
3604 * layout.cc (Layout::special_ordering_of_input_section): New
3605 function.
3606 (Layout::layout): If input section requires special ordering, must
3607 sort input sections.
3608 (Layout::make_output_section): May sort .text input sections.
3609 (Layout::is_section_name_prefix_grouped): Remove.
3610 * layout.h (class Layout): Declare
3611 special_ordering_of_input_section. Don't declare
3612 is_section_name_prefix_grouped.
3613 * output.cc (Output_section::add_input_section): Revert last
3614 change.
3615 (Output_section::Input_section_sort::match_file_name): Don't crash
3616 if called on output section data.
3617 (Output_section::Input_section_sort_compare): Sort based on
3618 special ordering.
3619 (Output_section::Input_section_sort_section_order_index_compare):
3620 Revert last patch.
3621 (Output_section::sort_attached_input_sections): Likewise.
3622
3623 2012-12-18 Sriraman Tallam <tmsriram@google.com>
3624
3625 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
3626 * layout.h (Layout::is_section_name_prefix_grouped): New function.
3627 * output.cc (Output_section::add_input_section): Check if section
3628 name contains special prefix. Keep input sections to sort such
3629 sections.
3630 (Output_section::Input_section_sort_section_order_index_compare
3631 ::operator()): Group sections according to prefixes.
3632 (Output_section::sort_attached_input_sections): Add condition to
3633 Input_section_entry constructor call.
3634 * testsuite/Makefile.am (text_section_grouping): New test.
3635 * testsuite/Makefile.in: Regenerate.
3636 * testsuite/text_section_grouping.cc: New file.
3637 * testsuite/text_section_grouping.sh: New file.
3638
3639 2012-12-17 Nick Clifton <nickc@redhat.com>
3640
3641 * Makefile.am: Add copyright notice.
3642 * NEWS: Likewise.
3643 * README: Likewise.
3644 * configure.ac: Likewise.
3645 * ftruncate.c: Likewise.
3646 * Makefile.in: Regenerate.
3647
3648 2012-12-14 Cary Coutant <ccoutant@google.com>
3649
3650 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
3651 --no-as-needed flag.
3652 (exception_separate_shared_12_test): Likewise.
3653 (incremental_copy_test): Likewise.
3654 * testsuite/Makefile.in: Regenerate.
3655
3656 2012-12-14 Cary Coutant <ccoutant@google.com>
3657
3658 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
3659 (Dwp_output_file::Dwp_index::enter_set): Add assert.
3660
3661 2012-12-12 Alan Modra <amodra@gmail.com>
3662
3663 * powerpc.cc (class Track_tls): New.
3664 (class Relocate, class Scan): Inherit Track_tls.
3665 (Target_powerpc::Scan::local, global): Track tls optimization
3666 and avoid creating plt entry for __tls_get_addr if all uses
3667 are optimized away.
3668 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
3669
3670 2012-12-12 Alan Modra <amodra@gmail.com>
3671
3672 * options.h (General_options): Add --toc-sort/--no-toc-sort.
3673 Replace no_toc_optimize with toc_optimize.
3674 * output.h (Output_section::input_sections): Provide non-const variant.
3675 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
3676 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
3677 accessors.
3678 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
3679 (class Sort_toc_sections): New.
3680 (Target_powerpc::do_finalize_sections): Sort toc sections.
3681 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
3682
3683 2012-12-10 Roland McGrath <mcgrathr@google.com>
3684
3685 * testsuite/binary_unittest.cc (read_all): New function.
3686 (Sized_binary_test): Use it instead of ::read.
3687 * fileread.cc (do_read): Don't assume pread always reads the whole
3688 amount in a single call.
3689
3690 2012-12-10 Alan Modra <amodra@gmail.com>
3691
3692 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
3693 Set EM_PPC64 or EM_PPC here.
3694 (Target_selector_powerpc::do_recognize): Delete.
3695
3696 2012-12-10 Alan Modra <amodra@gmail.com>
3697
3698 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
3699 stub_table_.
3700 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
3701
3702 2012-12-07 Roland McGrath <mcgrathr@google.com>
3703
3704 * testsuite/binary_unittest.cc (Sized_binary_test):
3705 Use open_descriptor rather than ::open.
3706
3707 2012-12-07 Alan Modra <amodra@gmail.com>
3708
3709 * powerpc.cc (Stub_table::do_write): Delete redundant Address
3710 typedef and invalid_address constant.
3711 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
3712 instantiate constants.
3713
3714 2012-12-06 Roland McGrath <mcgrathr@google.com>
3715
3716 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
3717 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
3718 * aclocal.m4: Regenerate.
3719 * configure: Regenerate.
3720 * Makefile.in: Regenerate.
3721 * testsuite/Makefile.in: Regenerate.
3722
3723 2012-12-07 Alan Modra <amodra@gmail.com>
3724
3725 * options.h (General_options): Add no_toc_optimize.
3726 * powerpc.cc (ok_lo_toc_insn): New function.
3727 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
3728
3729 2012-12-06 Alan Modra <amodra@gmail.com>
3730
3731 * options.h (General_options): Add plt_align, plt_static_chain,
3732 plt_thread_safe. Update stub_group_size help text.
3733 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
3734 for new plt_thread_safe_ var.
3735 (use_plt_offset): Correct comments.
3736 (Target_powerpc::do_relax): Look for thread creation symbols to
3737 determine default plt_thread_safe value. Clear plt call stubs
3738 as well as branch stubs each iteration.
3739 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
3740 insn constants.
3741 (l, hi, ha, write_insn): Move earlier.
3742 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
3743 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
3744 plt stubs too.
3745 (Stub_table::update_size): Adjust.
3746 (Stub_table::prev_size, set_prev_size): Delete.
3747 (Stub_table::stub_align): Let --plt-align affect result.
3748 (Stub_table::plt_call_size): Calculate sizes for various stubs.
3749 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
3750 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
3751 (Stub_table::do_write): Support more stub variants.
3752
3753 2012-12-04 Alan Modra <amodra@gmail.com>
3754
3755 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
3756 (Target_powerpc::do_define_standard_symbols): New function.
3757
3758 2012-12-03 Alan Modra <amodra@gmail.com>
3759
3760 * output.h: Formatting, whitespace.
3761
3762 2012-12-03 Alan Modra <amodra@gmail.com>
3763
3764 * layout.h (Layout::get_executable_sections): Declare.
3765 * layout.cc (Layout::get_executable_sections): New function.
3766 * arm.cc (Target_arm::group_sections): Use it.
3767 (Arm_output_section::group_sections): Delete now redundant test.
3768 * output.cc (Output_reloc::Output_reloc): Add is_relative.
3769 param to handle relative relocs.
3770 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
3771 (Output_data_reloc::add_absolute): Adjust.
3772 (Output_data_reloc::add_relative): New function.
3773 (Output_data::reset_data_size): New function.
3774 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
3775 (Output_section::set_addralign): New function.
3776 (Output_section::checkpoint_set_addralign): New function.
3777 (Output_section::clear_section_offsets_need_adjustment): New function.
3778 (Output_section::input_sections): Make public.
3779 * powerpc.cc (class Output_data_brlt_powerpc): New.
3780 (class Stub_table, class Stub_control): New.
3781 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
3782 stub_table_, set_stub_table, stub_table): New vectors and accessor
3783 functions.
3784 (Target_powerpc::do_may_relax, do_relax, push_branch,
3785 new_stub_table, stub_tables, brlt_section, group_sections,
3786 add_branch_lookup_table, find_branch_lookup_table,
3787 write_branch_lookup_table, make_brlt_section): New functions.
3788 (Target_powerpc::struct Sort_sections, class Branch_info): New.
3789 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
3790 branch_info_): New vars.
3791 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
3792 make call stubs here.
3793 (Output_data_glink): Remove all call stub handling from this class.
3794 (Target_powerpc::Scan::local, global): Save interesting branch
3795 relocs and relocs for ifunc. Adjust calls to plt entry functions.
3796 (Target_powerpc::do_finalize_sections): Only make reg save/restore
3797 functions on final link.
3798 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
3799 Handle long branch destinations too.
3800 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
3801 do_plt_address_for_local): Adjust lookup of plt call stubs.
3802
3803 2012-11-30 Alan Modra <amodra@gmail.com>
3804
3805 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
3806 relocs against protected symbols when building 32-bit shared libs.
3807
3808 2012-11-30 Alan Modra <amodra@gmail.com>
3809
3810 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
3811 param. Call got_section() to make .got. Update all callers
3812 and their callers and so on.
3813
3814 2012-11-30 Alan Modra <amodra@gmail.com>
3815
3816 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
3817 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
3818 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
3819 value if it already exists.
3820
3821 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
3822
3823 PR gold/14858
3824 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
3825
3826 2012-11-14 Roland McGrath <mcgrathr@google.com>
3827
3828 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
3829 than bfc instruction for data sandboxing.
3830
3831 2012-11-08 Alan Modra <amodra@gmail.com>
3832
3833 * po/POTFILES.in: Regenerate.
3834
3835 2012-11-05 Alan Modra <amodra@gmail.com>
3836
3837 * configure.ac: Apply 2012-09-10 change to config.in here.
3838 * configure: Regenerate.
3839
3840 2012-11-05 Alan Modra <amodra@gmail.com>
3841
3842 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
3843 (struct Opd_ent): Use "Address" rather than "Offset".
3844 (Output_data_got_powerpc::got_base_offset): Return Valtype.
3845 (Target_powerpc::got_section): Make public.
3846 (Target_powerpc::scan_relocs): Move code setting symbols..
3847 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
3848 Create _SDA_BASE_ only when referenced.
3849
3850 2012-11-02 Roland McGrath <mcgrathr@google.com>
3851
3852 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
3853 from last change.
3854
3855 2012-11-01 Roland McGrath <mcgrathr@google.com>
3856
3857 * target.h (Sized_target::relocate_relocs): Use Elf_Off
3858 for offset_in_output_section parameter.
3859 (Sized_target::relocate_special_relocatable): Likewise.
3860 * arm.cc (Target_arm::relocate_relocs): Likewise.
3861 (Target_arm::relocate_special_relocatable): Likewise.
3862 * i386.cc (Target_i386::relocate_relocs): Likewise.
3863 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
3864 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
3865 * target-reloc.h (relocate_relocs): Likewise.
3866 * testsuite/testfile.cc (Target_test): Likewise.
3867 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
3868 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
3869
3870 * system.h: Move inclusion of <clocale> to after <libintl.h> in
3871 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
3872
3873 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
3874 parameter, which is unused in the [!F_SETFD] case.
3875
3876 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
3877 SYMNDX to off_t before comparing it to this->data_size().
3878 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
3879 * incremental.cc (Output_section_incremental_inputs::do_write):
3880 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
3881
3882 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
3883
3884 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
3885
3886 * gold.cc (Target_arm::do_adjust_elf_header): Add the
3887 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
3888 in EABI_VER5.
3889
3890 2012-10-29 Cary Coutant <ccoutant@google.com>
3891
3892 * dwp.cc (usage): Add file and exit status parameters;
3893 add --help and --version options.
3894 (print_version): New function.
3895 (main): Add --help and --version options.
3896
3897 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
3898
3899 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
3900 final_layout_sequence.txt.
3901 * testsuite/Makefile.in: Regenerated.
3902
3903 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
3904
3905 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
3906 COMPILE generated by automake.
3907 (LINK1): Likewise.
3908 (CXXCOMPILE1): Likewise.
3909 (CXXLINK1): Likewise.
3910 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
3911 (LINK): Likewise.
3912 (CXXCOMPILE): Likewise.
3913 (CXXLINK): Likewise.
3914 * testsuite/Makefile.in: Regenerated.
3915
3916 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
3917
3918 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
3919 on bad fwrite return.
3920
3921 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
3922
3923 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
3924 on val.
3925
3926 2012-10-23 Cary Coutant <ccoutant@google.com>
3927
3928 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
3929 * testsuite/Makefile.in: Regenerate.
3930 * testsuite/dwp_test.h: New source file.
3931 * testsuite/dwp_test_1.cc: New source file.
3932 * testsuite/dwp_test_1.s: New source file.
3933 * testsuite/dwp_test_1.sh: New source file.
3934 * testsuite/dwp_test_1b.cc: New source file.
3935 * testsuite/dwp_test_1b.s: New source file.
3936 * testsuite/dwp_test_2.cc: New source file.
3937 * testsuite/dwp_test_2.s: New source file.
3938 * testsuite/dwp_test_2.sh: New source file.
3939 * testsuite/dwp_test_main.cc: New source file.
3940 * testsuite/dwp_test_main.s: New source file.
3941
3942 2012-10-23 Cary Coutant <ccoutant@google.com>
3943
3944 * dwp.h: New header file.
3945 * dwp.cc: New source file.
3946 * gold.h: Move shared declarations to system.h.
3947 * system.h: New header file.
3948 * Makefile.am: Add dwp.
3949 * Makefile.in: Regenerate.
3950
3951 2012-10-23 Cary Coutant <ccoutant@google.com>
3952
3953 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
3954 Dwarf_info_reader::read_from_pointer.
3955 (Dwarf_pubnames_table::read_header): Likewise.
3956 (Dwarf_pubnames_table::next_name): Likewise.
3957 (Dwarf_die::read_attributes): Likewise.
3958 (Dwarf_die::skip_attributes): Likewise.
3959 (Dwarf_info_reader::read_from_pointer): New function template.
3960 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
3961 (Dwarf_pubnames_table): Likewise.
3962 (Dwarf_info_reader::read_from_pointer): New function template.
3963 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
3964 Dwarf_pubnames_table ctor.
3965
3966 2012-10-23 Cary Coutant <ccoutant@google.com>
3967
3968 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
3969 abbrev_shndx.
3970 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
3971 abbrev_shndx_.
3972 (Dwarf_info_reader::set_abbrev_shndx): New method.
3973 (Dwarf_info_reader::abbrev_shndx_): New data member.
3974
3975 2012-10-23 Cary Coutant <ccoutant@google.com>
3976
3977 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
3978 from object, not parameters.
3979 (Dwarf_info_reader::parse): Likewise.
3980 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
3981 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
3982 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
3983 methods.
3984
3985 2012-10-23 Cary Coutant <ccoutant@google.com>
3986
3987 * fileread.cc (Input_file::Input_file): New constructor.
3988 * fileread.h (class Input_file): Add new constructor.
3989
3990 2012-10-18 Alan Modra <amodra@gmail.com>
3991
3992 PR gold/14727
3993 * object.cc (Relobj::is_section_name_included): Also match
3994 .sdata personality section.
3995
3996 2012-10-18 Alan Modra <amodra@gmail.com>
3997
3998 * target-reloc.h (class Default_comdat_behavior): New, package up..
3999 (get_comdat_behaviour): ..this.
4000 (relocate_section): Add Relocate_comdat_behavior template arg,
4001 adjust code to suit.
4002 * arm.cc (Target_arm::relocate_section): Adjust to suit.
4003 (Target_arm::scan_reloc_section): Likewise.
4004 * i386.cc (Target_i386::relocate_section): Likewise.
4005 * sparc.cc (Target_sparc::relocate_section): Likewise.
4006 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
4007 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
4008 * powerpc.cc (class Relocate_comdat_behavior): New.
4009 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
4010 gold::relocate_section with new template arg.
4011
4012 2012-10-18 Alan Modra <amodra@gmail.com>
4013
4014 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
4015 dynamic relocs for GOT_TPREL got entries, without symbol if
4016 resolving locally.
4017 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
4018 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
4019 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
4020
4021 2012-10-17 Alan Modra <amodra@gmail.com>
4022
4023 PR gold/14726
4024 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
4025
4026 2012-10-16 Sriraman Tallam <tmsriram@google.com>
4027
4028 * layout.cc (Layout::include_section): Keep sections marked
4029 SHF_EXCLUDE when doing relocatable links.
4030
4031 2012-10-16 Alan Modra <amodra@gmail.com>
4032
4033 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
4034 (Target_powerpc::do_finalize_sections): Call it.
4035 (Output_data_save_res): New class and supporting functions.
4036 (Target_powerpc::symval_for_branch): Only look up .opd entry for
4037 normal symbols defined in object files.
4038
4039 2012-10-12 Alan Modra <amodra@gmail.com>
4040
4041 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
4042 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
4043 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
4044 section if scan_opd_relocs not yet called.
4045 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
4046
4047 2012-10-12 Alan Modra <amodra@gmail.com>
4048
4049 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
4050 add_local_ifunc_entry): Revert last change.
4051 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
4052
4053 2012-10-05 Alan Modra <amodra@gmail.com>
4054
4055 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
4056 do_plt_address_for_global): New functions.
4057 (Output_data_got_powerpc::do_write): Don't segfault when linking
4058 statically.
4059 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
4060 add_local_ifunc_entry): Return true on adding entry..
4061 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
4062 glink->add_entry call. Remove unused symtab param. Adjust calls.
4063 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
4064 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
4065 set up symbols here.
4066 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
4067 syms here. Do so even when no .iplt. Don't segfault when linking
4068 statically.
4069 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
4070 new variants without reloc param.
4071 (Glink_sym_ent::Glink_sym_ent): Likewise.
4072 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
4073 reloc when refs will resolve to plt call stub.
4074 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
4075 R_PPC_PLTREL24 to resolve locally.
4076 (Target_powerpc::Scan::global): Correct ifunc handling.
4077 (Target_powerpc::Relocate::relocate): Correct local sym glink
4078 lookup. Don't destroy "value" when we have a plt call stub,
4079 and when checking plt call validity.
4080 (Target_powerpc::do_dynsym_value): Simplify.
4081
4082 2012-10-05 Alan Modra <amodra@gmail.com>
4083
4084 * i386.cc (Output_data_plt_i386::address_for_global,
4085 address_for_local): Add plt offset to returned value. Adjust uses.
4086 * sparc.cc (Output_data_plt_sparc::address_for_global,
4087 address_for_local): Likewise.
4088 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
4089 address_for_local): Likewise.
4090 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
4091 address_for_local): Likewise.
4092 * target.h (Target::plt_address_for_global, plt_address_for_local):
4093 Update comment.
4094 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
4095 (Output_data_got::Got_entry::write): Nor here.
4096 * output.h: Comment fix.
4097
4098 2012-10-02 Jiong Wang <jiwang@tilera.com>
4099
4100 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
4101 global_offset_table_ value for larget got.
4102 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
4103
4104 2012-09-29 Alan Modra <amodra@gmail.com>
4105
4106 * powerpc.cc (Target_powerpc::iplt_): New output section.
4107 (Target_powerpc::iplt_section, make_iplt_section,
4108 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
4109 (Target_powerpc::make_plt_entry): Handle ifunc syms.
4110 Target_powerpc::plt_entry_count): Count iplt entries too.
4111 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
4112 reloc section in constructor. New params.
4113 (Target_powerpc::make_plt_section): Create reloc section here instead.
4114 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
4115 functions.
4116 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
4117 (Output_data_glink::add_entry, find_entry): New functions to
4118 deal with local syms.
4119 (Glink_sym_ent): Add support for local syms.
4120 (Output_data_glink::do_write): Handle ifunc plt entries.
4121 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4122 (Target_powerpc::Scan::local, global): Handle ifunc syms.
4123 (Target_powerpc::Relocate::relocate): Likewise.
4124 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
4125
4126 2012-09-25 Alan Modra <amodra@gmail.com>
4127
4128 * object.h (Sized_relobj_file::adjust_local_symbol,
4129 do_adjust_local_symbol): New functions.
4130 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
4131 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
4132 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
4133 and irregular opd entry spacing.
4134 (Powerpc_relobj::do_read_relocs): Add opd size checks.
4135 (Global_symbol_visitor_opd): New functor.
4136 (Target_powerpc::do_finalize_sections): Omit global symbols defined
4137 on deleted opd entries.
4138
4139 2012-09-15 Jiong Wang <jiwang@tilera.com>
4140
4141 * tilegx.cc: New file.
4142 * Makefile.am (TARGETSOURCES): Add tilegx.cc
4143 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
4144 * configure.tgt: Add entries for tilegx*.
4145 * configure.ac: Likewise.
4146 * Makefile.in: Rebuild.
4147 * configure: Likewise.
4148 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
4149 tilegx.
4150
4151 2012-09-13 Alan Modra <amodra@gmail.com>
4152
4153 * target-reloc.h (scan_relocs): Call scan.local for relocs
4154 against symbols in discarded sections. Pass is_discarded
4155 param.
4156 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
4157 Add is_discarded param.
4158 * powerpc (Target_powerpc::Scan::local): Likewise. Use
4159 is_discarded to flag opd entry as discarded. Don't emit dyn
4160 relocs on such entries.
4161 (Target_powerpc::Scan::global): Similarly detect and handle
4162 such opd entries.
4163 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
4164 opd_ent_. Update all uses.
4165 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
4166 (Target_powerpc::relocate_section): Zero out discarded opd
4167 entry relocs.
4168
4169 2012-09-12 Ian Lance Taylor <iant@google.com>
4170
4171 PR gold/14570
4172 * output.cc: Rename Output_data_got template parameter from size
4173 to got_size for all functions. Compile all variants of
4174 Output_data_got.
4175 (Output_data_got::Got_entry::write): Correct use of size for
4176 symbol value. Use local_is_tls rather than casting to
4177 Sized_relobj_file.
4178 * object.h (class Object): Add local_is_tls and do_local_is_tls.
4179 (class Sized_relobj_file): Add do_local_is_tls.
4180 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
4181
4182 2012-09-11 Alan Modra <amodra@gmail.com>
4183
4184 PR gold/14566
4185 * layout.cc (Layout::set_segment_offsets): When using
4186 common-page-size alignment, ensure we are on a new max-page-size
4187 page.
4188 * output.cc (Output_segment::set_section_addresses): Use
4189 abi_pagesize, not common_pagesize for relro boundary.
4190 (Output_segment::set_offset): Likewise.
4191
4192 2012-09-11 Alan Modra <amodra@gmail.com>
4193
4194 * output.h (Output_data_got::add_global_tls, add_local_tls,
4195 add_local_tls_pair): New functions.
4196 (Output_data_got::add_local_pair_with_rel): Remove second
4197 reloc param. Expand comment.
4198 (Output_data_got::Got_entry): Rename use_plt_offset_ to
4199 use_plt_or_tls_offset_, similarly for constructor param.
4200 (Output_data_got::Got_entry::write): Add got_index param.
4201 * output.cc (Output_data_got::add_global_tls, add_local_tls,
4202 add_local_tls_pair): New functions.
4203 (Output_data_got::Got_entry::write): Handle tls symbols
4204 with use_plt_or_tls_offset_ set specially.
4205 (Output_data_got::add_local_pair_with_rel): Only one reloc.
4206 (Output_data_got::do_write): Replace iterator with index, pass
4207 index to entry write function.
4208 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
4209 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
4210 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
4211 call.
4212 * i386.cc (Target_i386::Scan::local): Likewise.
4213 * sparc.cc (Target_sparc::Scan::local): Likewise.
4214 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
4215 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
4216 do_tls_offset_for_global): New functions.
4217 (Target_powerpc::Scan::local): Correct TLS relocations and got
4218 entry values.
4219 (Target_powerpc::Scan::global): Don't emit unnecessary
4220 dynamic relocations on TLS GOT entries.
4221
4222 2012-09-10 Matthias Klose <doko@ubuntu.com>
4223
4224 * config.in: Disable sanity check for kfreebsd.
4225
4226 2012-09-10 Sterling Augustine <saugustine@google.com>
4227
4228 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
4229 (Gdb_index::pubtypes_read): New parameter.
4230 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
4231 to calls.
4232 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
4233 pubtypes_object_.
4234
4235 2012-09-09 Alan Modra <amodra@gmail.com>
4236
4237 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
4238 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
4239 * gc.h (gc_process_relocs): Call target gc_add_reference.
4240 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
4241 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
4242 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
4243 unnecessary cast.
4244 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
4245 to cater for when we don't need code offset. Update use.
4246 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
4247 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
4248 set_opd_valid): New functions.
4249 (Target_powerpc::do_gc_add_reference): New function.
4250 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
4251 stashed refs.
4252 (Target_powerpc::do_gc_mark_symbol): New function.
4253
4254 2012-09-06 Cary Coutant <ccoutant@google.com>
4255
4256 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
4257 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
4258 (Dwarf_die::skip_attributes): Likewise.
4259 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
4260 * testsuite/gdb_index_test.cc (inline_func_1): New function.
4261 (main): Call it.
4262 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
4263
4264 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
4265
4266 * testsuite/script_test_3.t: Add .got.plt output section
4267 statement.
4268 * testsuite/script_test_4.t: Likewise.
4269
4270 2012-09-05 Alan Modra <amodra@gmail.com>
4271
4272 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
4273 update all uses and lose "enum" when using type.
4274
4275 2012-09-05 Alan Modra <amodra@gmail.com>
4276
4277 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
4278 * configure: Regenerate.
4279 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
4280 (plugin_final_layout.stdout): Likewise.
4281 (memory_test): Set page sizes to 0x1000.
4282 * testsuite/Makefile.in: Regenerate.
4283 * testsuite/discard_locals_test.sh: Add FIXME comment.
4284 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
4285 * testsuite/pr14265.t: Add .got output section statement.
4286 * testsuite/script_test_2.t: Likewise.
4287 * testsuite/script_test_3.t: Likewise.
4288 * testsuite/script_test_4.t: Likewise.
4289 * testsuite/script_test_5.t: Likewise.
4290 * testsuite/script_test_6.t: Likewise.
4291 * testsuite/script_test_7.t: Likewise.
4292 * testsuite/script_test_9.t: Likewise.
4293
4294 2012-09-05 Alan Modra <amodra@gmail.com>
4295
4296 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
4297 (Powerpc_relocate_functions::Status): New typedef.
4298 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4299 (Target_powerpc::Scan::local): Handle REL64.
4300 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
4301 for REL32 and REL64.
4302 (Target_powerpc::symval_for_branch): New function, extracted from..
4303 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
4304 checks. Report overflow errors.
4305
4306 2012-09-05 Alan Modra <amodra@gmail.com>
4307
4308 * object.h (Sized_relobj_file::emit_relocs): Delete.
4309 (Sized_relobj_file::emit_relocs_reltype): Delete.
4310 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
4311 relocate_relocs for --emit-relocs.
4312 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
4313 * output.h: Update comment.
4314 (Output_segment::first_section): New function.
4315 (Output_segment::first_section_load_address): Use first_section.
4316 * output.cc (Output_segment::first_section): New function extracted..
4317 (Output_segment::first_section_load_address): ..from here. Delete.
4318 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
4319 * target.h (Sized_target::relocate_for_relocatable): Likewise.
4320 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
4321 adjust call to target.h function.
4322 * i386.cc (Target_i386): Likewise.
4323 * sparc.cc (Target_sparc): Likewise.
4324 * x86_64.cc (Target_x86_64): Likewise.
4325 * powerpc.cc (Target_powerpc): Likewise.
4326 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
4327 first tls section has section symbol for optimised local dynamic
4328 output relocs.
4329 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
4330 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
4331 optimised tls code.
4332 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
4333 Rename to relocate_relocs. Update error message.
4334
4335 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
4336
4337 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
4338 --just-symbols.
4339
4340 2012-08-31 Alan Modra <amodra@gmail.com>
4341
4342 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
4343 (Powerpc_relobj::toc_base_offset): New stub function.
4344 (Target_powerpc): Add tp_offset, dtp_offset. Rename
4345 got_mod_index_offset to tlsld_got_offset. Update all refs.
4346 (Target_powerpc::Relocate::enum skip_tls): New.
4347 (Target_powerpc::call_tls_get_addr_): New var.
4348 (Target_powerpc::is_branch_reloc): Move to file scope.
4349 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
4350 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
4351 New functions.
4352 (Target_powerpc::enum Got_type): Delete old values, add new ones.
4353 (powerpc_info): Correct common_pagesize for ppc64.
4354 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
4355 (Powerpc_relocate_functions): Add overflow check enums and functions.
4356 Add non-shift version of rela, rela_ua. Delete all rel public
4357 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
4358 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
4359 addr16_ha3, addr14 functions.
4360 (Output_data_got_powerpc::add_constant_pair): New function.
4361 (Output_data_got_powerpc::got_base_offset): Likewise.
4362 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
4363 (instruction constants): Sort, add some more.
4364 (Output_data_glink::do_write): Add and use Address typedef. Use
4365 object->toc_base_offset() stub for 64-bit.
4366 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
4367 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4368 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
4369 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
4370 Always treat .opd relocs as against locally defined symbol.
4371 Correct condition for RELATIVE relocs.
4372 (Target_powerpc::do_finalize_sections): Test for NULL sections.
4373 (Target_powerpc::Relocate::relocate): Use plt call stub as value
4374 for 32-bit syms with a plt entry. Correct ppc64 toc base
4375 calculations. Handle TLS relocs, and more. Add overflow
4376 checking and adjust for Powerpc_relocate_functions changes.
4377 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
4378 Reinstate --emit-relocs code with FIXME.
4379
4380 2012-08-30 Alan Modra <amodra@gmail.com>
4381
4382 * layout.cc (Layout::set_segment_offsets): Set p_align to
4383 abi_pagesize, not common_pagesize.
4384 (Layout::relaxation_loop_body): Similarly use abi_pagesize
4385 to determine whether file header can go in segment.
4386
4387 2012-08-30 Alan Modra <amodra@gmail.com>
4388
4389 * output.h (Output_reloc::Output_reloc <output section>): Add
4390 is_relative param. Adjust calls.
4391 (Output_reloc::add_output_section_relative): New functions.
4392 * output.cc (Output_reloc::Output_reloc <output section>): Handle
4393 is_relative.
4394 (Output_reloc::symbol_value): Handle SECTION_CODE.
4395
4396 2012-08-24 Sriraman Tallam <tmsriram@google.com>
4397
4398 * gold.cc (queue_middle_tasks): Call layout again when unique
4399 segments for sections is desired.
4400 * layout.cc (Layout::Layout): Initialize new members.
4401 (Layout::get_output_section_flags): New function.
4402 (Layout::choose_output_section): Call get_output_section_flags.
4403 (Layout::layout): Make output section for mapping to a unique segment.
4404 (Layout::insert_section_segment_map): New function.
4405 (Layout::attach_allocated_section_to_segment): Make unique segment for
4406 output sections marked so.
4407 (Layout::segment_precedes): Check for unique segments when sorting.
4408 * layout.h (Layout::Unique_segment_info): New struct.
4409 (Layout::Section_segment_map): New typedef.
4410 (Layout::insert_section_segment_map): New function.
4411 (Layout::get_output_section_flags): New function.
4412 (Layout::is_unique_segment_for_sections_specified): New function.
4413 (Layout::set_unique_segment_for_sections_specified): New function.
4414 (Layout::unique_segment_for_sections_specified_): New member.
4415 (Layout::section_segment_map_): New member.
4416 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
4417 Rename is_gc_pass_one to is_pass_one.
4418 Rename is_gc_pass_two to is_pass_two.
4419 Rename is_gc_or_icf to is_two_pass.
4420 Check for which pass based on whether symbols data is present.
4421 Make it two pass when unique segments for sections is desired.
4422 * output.cc (Output_section::Output_section): Initialize new
4423 members.
4424 * output.h (Output_section::is_unique_segment): New function.
4425 (Output_section::set_is_unique_segment): New function.
4426 (Output_section::is_unique_segment_): New member.
4427 (Output_section::extra_segment_flags): New function.
4428 (Output_section::set_extra_segment_flags): New function.
4429 (Output_section::extra_segment_flags_): New member.
4430 (Output_section::segment_alignment): New function.
4431 (Output_section::set_segment_alignment): New function.
4432 (Output_section::segment_alignment_): New member.
4433 (Output_segment::Output_segment): Initialize is_unique_segment_.
4434 (Output_segment::is_unique_segment): New function.
4435 (Output_segment::set_is_unique_segment): New function.
4436 (Output_segment::is_unique_segment_): New member.
4437 * plugin.cc (allow_unique_segment_for_sections): New function.
4438 (unique_segment_for_sections): New function.
4439 (Plugin::load): Add new functions to transfer vector.
4440 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
4441 * Makefile.in: Regenerate.
4442 * testsuite/plugin_final_layout.sh: Check if unique segment
4443 functionality works.
4444 * testsuite/plugin_section_order.c (onload): Check if new interfaces
4445 are available.
4446 (allow_unique_segment_for_sections): New global.
4447 (unique_segment_for_sections): New global.
4448 (claim_file_hook): Call allow_unique_segment_for_sections.
4449 (all_symbols_read_hook): Call unique_segment_for_sections.
4450
4451 2012-08-22 Cary Coutant <ccoutant@google.com>
4452
4453 * layout.cc (Layout::include_section): Don't assert on GROUP
4454 sections with --emit-relocs.
4455
4456 2012-08-21 Cary Coutant <ccoutant@google.com>
4457
4458 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
4459 if --export-dynamic-symbol names an undef symbol.
4460
4461 2012-08-18 Alan Modra <amodra@gmail.com>
4462
4463 * powerpc.cc: Formatting and white space.
4464 (Powerpc_relobj): Rename got2_section_ to special_.
4465 Add opd_ent_shndx_ and opd_ent_off_ vectors.
4466 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
4467 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
4468 (Target_powerpc): Add Address typedef and invalid_address. Use
4469 throughout.
4470 (Target_powerpc::is_branch_reloc): New function.
4471 (Powerpc_relocate_functions): Add Address typedef, use throughout.
4472 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
4473 for dst_mask, value and addend.
4474 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
4475 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
4476 (Output_data_glink::do_write): Correct toc base. Don't try to use
4477 uint16_t for 24-bit offset. Use get_output_section_offset and
4478 check return.
4479 (Target_powerpc::Scan::local): Handle more relocs.
4480 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
4481 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
4482 Plug in toc restoring insn after plt calls. Translate branches
4483 to function descriptor symbols to corresponding entry point.
4484 (Target_powerpc::relocate_for_relocatable): Check return from
4485 get_output_section_offset.
4486 * symtab.h: Comment typo.
4487
4488 2012-08-14 Ian Lance Taylor <iant@google.com>
4489
4490 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
4491 unsupported_relocal_local to call unsupported_reloc_global.
4492
4493 2012-08-14 Nick Clifton <nickc@redhat.com>
4494
4495 PR ld/14265
4496 * script-sections.cc (Sections_element::output_section_name): Add
4497 keep return parameter.
4498 (Output_section_element::match_name): Add keep return parameter.
4499 Return the value of the keep_ member.
4500 * script-sections.h (class Output_section): Update
4501 output_section_name prototype.
4502 * layout.cc (Layout::keep_input_section): New public member
4503 function.
4504 (Layout::choose_output_section): Pass keep parameter to
4505 output_section_name.
4506 * layout.h (class Layout): Add keep_input_section.
4507 * object.cc (Sized_relobj_file::do_layout): Check for kept input
4508 sections.
4509 * testsuite/Makefile.am: Add a test.
4510 * testsuite/Makefile.in: Regenerate.
4511 * testsuite/pr14265.c: Source file for the test.
4512 * testsuite/pr14265.t: Linker script for the test.
4513 * testsuite/pr14265.sh: Shell script for the test.
4514
4515 2012-08-14 Alan Modra <amodra@gmail.com>
4516
4517 * target.h (Target::output_section_name): New function.
4518 (Target::do_output_section_name): New function.
4519 * layout.cc (Layout::choose_output_section): Call the above.
4520 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
4521
4522 2012-08-14 Alan Modra <amodra@gmail.com>
4523
4524 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
4525 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
4526 for replace_constant call.
4527 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
4528 (Output_data_glink::do_print_to_mapfile): New function.
4529 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
4530 (Target_powerpc::Relocate::relocate): Likewise.
4531
4532 2012-08-14 Alan Modra <amodra@gmail.com>
4533
4534 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
4535 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
4536 (Output_data_glink::add_entry,find_entry): Remove shndx param.
4537 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
4538 all references to shndx_. Handle special case for R_PPC_PLTREL24
4539 here.
4540 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
4541 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
4542 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
4543 here.
4544 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
4545 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
4546
4547 2012-08-12 Alan Modra <amodra@gmail.com>
4548
4549 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
4550 (glink insn constants): Use uint32_t.
4551 (Output_data_glink::add_entry): Use insert, not [] operator.
4552
4553 2012-08-11 Alan Modra <amodra@gmail.com>
4554
4555 * object.h (Sized_relobj_file::find_shdr): New function.
4556 (Sized_relobj_file::find_special_sections): New function.
4557 * object.cc (Sized_relobj_file::find_shdr): New function.
4558 (Sized_relobj_file::find_eh_frame): Use find_shdr.
4559 (Sized_relobj_file::find_special_sections): New function, split out..
4560 (Sized_relobj_file::do_read_symbols): ..from here.
4561 * output.h (Output_data_got::replace_constant): New function.
4562 (Output_data_got::num_entries): New function.
4563 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
4564 (Output_data_got::got_offset): Protected rather than private.
4565 (Output_data_got::replace_got_entry): New function.
4566 * output.cc (Output_data_got::replace_got_entry): New function.
4567 * powerpc.cc (class Powerpc_relobj): New.
4568 (class Powerpc_relocate_functions): Delete all psymval variants or
4569 convert to value,addend type. Delete pcrela, pcrela_unaligned.
4570 Implement _ha functions using corresponding _hi function.
4571 (Powerpc_relobj::find_special_sections): New function.
4572 (Target_powerpc::do_make_elf_object): New function.
4573 (class Output_data_got_powerpc): New.
4574 (class Output_data_glink): New.
4575 (class Powerpc_scan_relocatable_reloc): New.
4576 Many more changes througout file.
4577
4578 2012-08-09 Nick Clifton <nickc@redhat.com>
4579
4580 * po/vi.po: Updated Vietnamese translation.
4581
4582 2012-08-07 Ian Lance Taylor <iant@google.com>
4583
4584 * layout.cc (Layout::add_target_dynamic_tags): If
4585 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
4586 plt_rel.
4587
4588 2012-07-30 Nick Clifton <nickc@redhat.com>
4589
4590 * po/gold.pot: Updated template.
4591 * po/es.po: Updated Spanish translation.
4592
4593 2012-07-18 Cary Coutant <ccoutant@google.com>
4594
4595 PR gold/14344
4596 * configure.ac: Add check for -gpubnames support.
4597 * configure: Regenerate.
4598 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
4599 support; force -gno-pubnames.
4600 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
4601 support.
4602 (gdb_index_test_4): New test.
4603 * testsuite/Makefile.in: Regenerate.
4604 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
4605 * testsuite/gdb_index_test_2.sh: Likewise.
4606 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
4607 * testsuite/gdb_index_test_4.sh: New script.
4608 * testsuite/gdb_index_test_comm.sh: New script with common code;
4609 don't look for space after colon.
4610
4611 2012-07-16 Sriraman Tallam <tmsriram@google.com>
4612
4613 * gold.cc (queue_middle_tasks): Update function order only after
4614 deferred objects due to plugins are processed.
4615
4616 2012-07-11 Ian Lance Taylor <iant@google.com>
4617
4618 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
4619 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
4620 (Target_arm::scan_reloc_for_stub): Likewise.
4621 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
4622 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
4623 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
4624 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
4625 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
4626
4627 2012-07-10 Dodji Seketeli <dodji@redhat.com>
4628 Ian Lance Taylor <iant@google.com>
4629
4630 PR gold/14309
4631 * configure.ac: Test whether std::tr1::hash<off_t> works.
4632 * gold.h: Add a specialization for std::tr1::hash<off_t> if
4633 needed.
4634 * output.h (class Output_fill): Add virtual destructor.
4635 * configure, config.in: Rebuild.
4636
4637 2012-06-22 Roland McGrath <mcgrathr@google.com>
4638
4639 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
4640
4641 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
4642
4643 * plugin.cc (Plugin::load): Handle position independent executables.
4644
4645 2012-06-06 Cary Coutant <ccoutant@google.com>
4646
4647 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
4648 add .debug_macro.
4649 (lines_only_debug_sections): Likewise.
4650 (gdb_fast_lookup_sections): New static array.
4651 (is_gdb_debug_section): Rename formal parameter.
4652 (is_lines_only_debug_section): Likewise.
4653 (is_gdb_fast_lookup_section): New function.
4654 (Layout::include_section): Check for ".zdebug_" prefix; pass
4655 section name suffix to is_gdb_debug_section, et al.; check for
4656 fast-lookup sections when building .gdb_index.
4657 * options.h (--strip-debug-gdb): Update GDB version number.
4658
4659 2012-06-06 Cary Coutant <ccoutant@google.com>
4660
4661 * configure.ac: Add check for fallocate.
4662 * configure: Regenerate.
4663 * config.in: Regenerate.
4664
4665 * options.h (class General_options): Add --mmap-output-file and
4666 --posix-fallocate options.
4667 * output.cc: (posix_fallocate): Remove; replace with...
4668 (gold_fallocate): New function.
4669 (Output_file::map_no_anonymous): Call gold_fallocate.
4670 (Output_file::map): Check --mmap-output-file option.
4671
4672 2012-06-05 Jing Yu <jingyu@google.com>
4673
4674 * gold.h (textdomain): Add do {} to empty while(0).
4675 (bindtextdomain): Likewise.
4676
4677 2012-06-04 Cary Coutant <ccoutant@google.com>
4678
4679 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
4680 has_dynsym_index.
4681
4682 2012-05-25 Sriraman Tallam <tmsriram@google.com>
4683
4684 * symtab.cc (Symbol_table::define_special_symbol):
4685 Initialize *poldsym to prevent uninitialized variable errors.
4686
4687 2012-05-23 Cary Coutant <ccoutant@google.com>
4688
4689 * layout.cc (Layout::section_name_mapping): Add rules to handle
4690 exact match on .data.rel.ro.local or .data.rel.ro.
4691 (Layout::output_section_name): Check for exact matches.
4692
4693 2012-05-23 Cary Coutant <ccoutant@google.com>
4694
4695 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
4696 more carefully.
4697
4698 2012-05-22 Cary Coutant <ccoutant@google.com>
4699
4700 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
4701 object before exporting symbol.
4702
4703 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
4704
4705 * testsuite/tls_test.cc: Include "config.h" first.
4706 * testsuite/tls_test_c.c: Likewise.
4707
4708 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
4709 Nick Clifton <nickc@redhat.com>
4710
4711 PR 14072
4712 * configure.in: Add check that sysdep.h has been included before
4713 any system header files.
4714 * configure: Regenerate.
4715 * config.in: Regenerate.
4716
4717 2012-05-14 Cary Coutant <ccoutant@google.com>
4718
4719 * layout.cc (Layout::make_output_section): Mark .tdata section
4720 as RELRO.
4721 * testsuite/relro_test.cc: Add a TLS variable.
4722
4723 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
4724
4725 PR gold/14091
4726 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
4727 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
4728 R_X86_64_64.
4729
4730 2012-05-08 Cary Coutant <ccoutant@google.com>
4731
4732 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
4733 (lines_only_debug_sections): Likewise.
4734
4735 2012-05-02 Roland McGrath <mcgrathr@google.com>
4736
4737 * nacl.cc: New file.
4738 * nacl.h: New file.
4739 * Makefile.am (CCFILES, HFILES): Add them.
4740 * Makefile.in: Regenerate.
4741 * i386.cc (Output_data_plt_i386_nacl): New class.
4742 (Output_data_plt_i386_nacl_exec): New class.
4743 (Output_data_plt_i386_nacl_dyn): New class.
4744 (Target_i386_nacl): New class.
4745 (Target_selector_i386_nacl): New class.
4746 (target_selector_i386): Use it instead of Target_selector_i386.
4747 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
4748 (Target_x86_64_nacl): New class.
4749 (Target_selector_x86_64_nacl): New class.
4750 (target_selector_x86_64, target_selector_x32): Use it instead of
4751 Target_selector_x86_64.
4752 * arm.cc (Output_data_plt_arm_nacl): New class.
4753 (Target_arm_nacl): New class.
4754 (Target_selector_arm_nacl): New class.
4755 (target_selector_arm, target_selector_armbe): Use it instead of
4756 Target_selector_arm.
4757
4758 * target-select.cc (select_target): Take new Input_file* and off_t
4759 arguments, pass them on to recognize method of selector.
4760 * object.cc (make_elf_sized_object): Update caller.
4761 * parameters.cc (parameters_force_valid_target): Likewise.
4762 * incremental.cc (make_sized_incremental_binary): Likewise.
4763 * target-select.h: Update decl.
4764 (Target_selector::recognize): Take new Input_file* argument,
4765 pass it on to do_recognize.
4766 (Target_selector::do_recognize): Take new Input_file* argument.
4767 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
4768 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
4769 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
4770 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
4771
4772 * target.h (Target::Target_info): New members isolate_execinstr
4773 and rosegment_gap.
4774 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
4775 * arm.cc (Target_arm::arm_info): Update initializer.
4776 * i386.cc (Target_i386::i386_info): Likewise.
4777 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
4778 * sparc.cc (Target_sparc::sparc_info): Likewise.
4779 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4780 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
4781 * layout.cc (Layout::attach_allocated_section_to_segment):
4782 Take new const Target* argument. If target->isolate_execinstr(), act
4783 like --rosegment.
4784 (Layout::find_first_load_seg): Take new const Target* argument;
4785 if target->isolate_execinstr(), reject PF_X segments.
4786 (Layout::relaxation_loop_body): Update caller.
4787 (Layout::set_segment_offsets): If target->isolate_execinstr(),
4788 reset file offset to zero when we hit LOAD_SEG, and then do a second
4789 loop over the segments before LOAD_SEG to reassign offsets after
4790 addresses have been determined. Handle target->rosegment_gap().
4791 (Layout::attach_section_to_segment): Take new const Target* argument;
4792 pass it to attach_allocated_section_to_segment.
4793 (Layout::make_output_section): Update caller.
4794 (Layout::attach_sections_to_segments): Take new const Target* argument;
4795 pass it to attach_section_to_segment.
4796 * gold.cc (queue_middle_tasks): Update caller.
4797 * layout.h (Layout): Update method decls with new arguments.
4798
4799 * arm.cc (Target_arm::Target_arm): Take optional argument for the
4800 Target_info pointer to use.
4801 (Target_arm::do_make_data_plt): New virtual method.
4802 (Target_arm::make_data_plt): New method that calls it.
4803 (Target_arm::make_plt_entry): Use it.
4804 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
4805 for the section alignment.
4806 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
4807 method.
4808 (Output_data_plt_arm::first_plt_entry_offset): Call it.
4809 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
4810 method.
4811 (Output_data_plt_arm::get_plt_entry_size): Call it.
4812 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
4813 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
4814 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
4815 method.
4816 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
4817 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
4818 method instead of sizeof(plt_entry).
4819 (Output_data_plt_arm::add_entry): Likewise.
4820 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
4821 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
4822 than static method.
4823 (Target_arm::plt_entry_size): Likewise.
4824 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
4825 Move to ...
4826 (Output_data_plt_arm_standard): ... here, new class.
4827 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
4828 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
4829 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
4830
4831 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4832 Take additional argument for the PLT entry size.
4833 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
4834 Use get_plt_entry_size method rather than plt_entry_size variable.
4835 (Output_data_plt_x86_64::reserve_slot): Likewise.
4836 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
4837 (Output_data_plt_x86_64::add_entry): Likewise.
4838 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
4839 (Output_data_plt_x86_64::address_for_global): Likewise.
4840 (Output_data_plt_x86_64::address_for_local): Likewise.
4841 (Output_data_plt_x86_64::set_final_data_size): Likewise.
4842 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
4843 Make method non-static.
4844 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
4845 method.
4846 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
4847 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
4848 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
4849 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
4850 virtual method.
4851 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
4852 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
4853 virtual method.
4854 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
4855 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
4856 virtual method.
4857 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
4858 (Output_data_plt_x86_64::plt_entry_size)
4859 (Output_data_plt_x86_64::first_plt_entry)
4860 (Output_data_plt_x86_64::plt_entry)
4861 (Output_data_plt_x86_64::tlsdesc_plt_entry)
4862 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
4863 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
4864 (Output_data_plt_x86_64_standard): ... here, new class.
4865 (Target_x86_64::Target_x86_64): Take optional argument for the
4866 Target_info pointer to use.
4867 (Target_x86_64::do_make_data_plt): New virtual method.
4868 (Target_x86_64::make_data_plt): New method to call it.
4869 (Target_x86_64::init_got_plt_for_update): Use that.
4870 Call this->plt_->add_eh_frame method here.
4871 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
4872 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
4873 rather than static method.
4874 (Target_x86_64::plt_entry_size): Likewise.
4875 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
4876 rather than plt_entry_size variable. Move guts of PLT filling to...
4877 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
4878 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
4879 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
4880
4881 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
4882 additional argument for the section alignment.
4883 Don't do add_eh_frame_for_plt here.
4884 (Output_data_plt_i386::first_plt_entry_offset): Make the method
4885 non-static. Use get_plt_entry_size method rather than plt_entry_size
4886 variable.
4887 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
4888 method.
4889 (Output_data_plt_i386::get_plt_entry_size): Call it.
4890 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
4891 (Output_data_plt_i386::add_eh_frame): New method to call it.
4892 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
4893 method.
4894 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
4895 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
4896 method.
4897 (Output_data_plt_i386::fill_plt_entry): New method to call it.
4898 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
4899 method instead of plt_entry_size.
4900 (Output_data_plt_i386::plt_entry_size)
4901 (Output_data_plt_i386::plt_eh_frame_fde_size)
4902 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
4903 (Output_data_plt_i386_standard): ... here, new class.
4904 (Output_data_plt_i386_exec): New class.
4905 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
4906 (Output_data_plt_i386_exec::first_plt_entry): ... here.
4907 (Output_data_plt_i386::exec_plt_entry): Move to ...
4908 (Output_data_plt_i386_exec::plt_entry): ... here.
4909 (Output_data_plt_i386_dyn): New class.
4910 (Output_data_plt_i386::first_plt_entry): Move to ...
4911 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
4912 (Output_data_plt_i386::dyn_plt_entry): Move to ...
4913 (Output_data_plt_i386_dyn::plt_entry): ... here.
4914 (Target_i386::Target_i386): Take optional argument for the Target_info
4915 pointer to use.
4916 (Target_i386::do_make_data_plt): New virtual method.
4917 (Target_i386::make_data_plt): New method to call it.
4918 (Target_i386::make_plt_section): Use that.
4919 Call this->plt_->add_eh_frame method here.
4920 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
4921 rather than plt_entry_size variable.
4922 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
4923 (Output_data_plt_i386::address_for_local): Likewise.
4924 (Output_data_plt_i386::do_write): Likewise.
4925 Move guts of PLT filling to...
4926 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
4927 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
4928 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
4929 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
4930
4931 2012-05-01 Cary Coutant <ccoutant@google.com>
4932
4933 * dwarf_reader.cc (Dwarf_die::read_attributes)
4934 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
4935 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
4936 * reduced_debug_output.cc
4937 (Output_reduced_debug_info_section::get_die_end): Remove
4938 DW_FORM_GNU_ref_index. Add default case.
4939
4940 2012-04-26 Mark Wielaard <mjw@redhat.com>
4941
4942 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
4943 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
4944 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
4945 DW_AT_high_pc as offset from DW_AT_low_pc.
4946
4947 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
4948 * testsuite/Makefile.in: Regenerate.
4949 * testsuite/gdb_index_test_3.c: New test source file.
4950 * testsuite/gdb_index_test_3.sh: New test source file.
4951
4952 2012-04-25 Ian Lance Taylor <iant@google.com>
4953
4954 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
4955 pointer.
4956 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
4957 as a class, not a struct.
4958 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
4959 (Target_arm::apply_cortex_a8_workaround): Likewise.
4960 * gc.h: Declare Reloc_types as a struct, not a class.
4961 * object.h: Declare Symbols_data as a struct.
4962 * reloc.h: Declare Read_relocs_data as a struct.
4963 * target.h: Declare Relocate_info as a struct.
4964
4965 2012-04-24 David S. Miller <davem@davemloft.net>
4966
4967 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
4968 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
4969 and R_SPARC_WPLT30.
4970
4971 2012-04-24 Cary Coutant <ccoutant@google.com>
4972
4973 * incremental-dump.cc (find_input_containing_global): Replace
4974 magic number with symbolic constant.
4975 (dump_incremental_inputs): Update version number.
4976 * incremental.cc (Output_section_incremental_inputs): Update version
4977 number; import symbolic constants from Incremental_inputs_reader.
4978 (Incremental_inputs::create_data_sections): Align relocations
4979 section correctly for 64-bit targets.
4980 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
4981 constants; add padding.
4982 (Output_section_incremental_inputs::write_header): Add assert for
4983 header_size.
4984 (Output_section_incremental_inputs::write_input_files): Add assert
4985 for input_entry_size.
4986 (Output_section_incremental_inputs::write_info_blocks): Add padding;
4987 add assert for object_info_size, input_section_entry_size,
4988 global_sym_entry_size.
4989 * incremental.h (Incremental_inputs_reader): Add symbolic constants
4990 for data structure sizes; use them.
4991 (Incremental_input_entry_reader): Import symbolic constants from
4992 Incremental_inputs_reader; use them.
4993
4994 2012-04-23 David S. Miller <davem@davemloft.net>
4995
4996 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
4997 and elf_flags_set_.
4998 (Target_sparc::Target_sparc): Initialize new fields.
4999 (Target_sparc::do_make_elf_object): New function.
5000 (Target_sparc::do_adjust_elf_header): New function.
5001
5002 2012-04-23 Cary Coutant <ccoutant@google.com>
5003
5004 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
5005 CU range table of gdb index.
5006
5007 2012-04-20 David S. Miller <davem@davemloft.net>
5008
5009 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
5010 instead of false.
5011
5012 2012-04-16 David S. Miller <davem@davemloft.net>
5013
5014 * sparc.cc (Target_sparc::got_address): New function.
5015 (Sparc_relocate_functions::gdop_hix22): New function.
5016 (Sparc_relocate_functions::gdop_lox10): New function.
5017 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
5018 relocs.
5019 (Target_sparc::Scan::local): Likewise if the global symbol is not
5020 preemptible and is not IFUNC.
5021 (Target_sparc::Relocate::relocate): Perform GOTDATA code
5022 transformations for local and non-preemptible non-IFUNC global
5023 symbols.
5024
5025 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
5026 writing out 64-bit part of ranges.
5027
5028 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
5029 -fpic and -fpie respectively.
5030 * Makefile.in: Regenerate.
5031
5032 * sparc.cc (class Target_sparc): Add rela_ifunc_.
5033 (Target_sparc::Target_sparc): Initialize new field.
5034 (Target_sparc::do_plt_section_for_global): New function.
5035 (Target_sparc::do_plt_section_for_local): New function.
5036 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
5037 (Target_sparc::make_plt_section): New function, broken out of
5038 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
5039 (Target_sparc::make_plt_entry): Call make_plt_section.
5040 (Target_sparc::make_local_ifunc_plt_entry): New function.
5041 (Target_sparc::rela_ifunc_section): New function.
5042 (Target_sparc::plt_section): Remove const.
5043 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
5044 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
5045 and ifunc_count_ fields.
5046 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
5047 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
5048 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
5049 (Output_data_plt_sparc::rela_ifunc): New function.
5050 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
5051 (Output_data_plt_sparc::has_ifunc_section): New function.
5052 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
5053 (Output_data_plt_sparc::address_for_global): New function.
5054 (Output_data_plt_sparc::address_for_local): New function.
5055 (Output_data_plt_sparc::plt_index_to_offset): New function.
5056 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
5057 and entry_count.
5058 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
5059 entry_count.
5060 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
5061 R_SPARC_JMP_IREL to switch.
5062 (Target_sparc::Scan::check_non_pic): Likewise.
5063 (Target_sparc::Scan::local): Handle IFUNC symbols.
5064 (Target_sparc::Scan::local): Likewise.
5065 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
5066 and plt_address_for_local.
5067 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
5068 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
5069
5070 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
5071 (class Output_data_reloc): Adjust calls to Output_reloc_type.
5072 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
5073 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
5074 global relocs too.
5075 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
5076 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
5077 calls.
5078 * sparc.cc (Target_sparc::Scan::global): Likewise.
5079 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5080
5081 2012-04-16 Cary Coutant <ccoutant@google.com>
5082
5083 * archive.cc (Library_base::should_include_member): Check for
5084 --export-dynamic-symbol.
5085 * options.h (class General_options): Add --export-dynamic-symbol.
5086 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
5087 --export-dynamic-symbol.
5088 (Symbol_table::gc_mark_undef_symbols): Likewise.
5089 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
5090
5091 2012-04-12 David S. Miller <davem@davemloft.net>
5092
5093 * sparc.cc (Reloc::wdisp10): New relocation method.
5094 (Reloc::h34): Likewise.
5095 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
5096 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
5097 R_SPARC_WDISP10.
5098 (Target_sparc::Scan::local): Likewise.
5099 (Target_sparc::Scan::global): Likewise.
5100 (Target_sparc::Relocate::relocate): Likewise.
5101
5102 2012-04-09 Cary Coutant <ccoutant@google.com>
5103
5104 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
5105 low_pc == 0.
5106
5107 2012-04-06 Ian Lance Taylor <iant@google.com>
5108
5109 * timer.cc: #include <unistd.h>.
5110
5111 2012-04-06 Roland McGrath <mcgrathr@google.com>
5112
5113 * configure.in (AC_CHECK_HEADERS): Add locale.h.
5114 * config.in: Regenerate.
5115 * configure: Regenerate.
5116
5117 2012-04-05 Nick Clifton <nickc@redhat.com>
5118
5119 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
5120 (AM_LC_MESSAGES): Add.
5121 * aclocal.m4: Regenerate.
5122 * config.in: Regenerate.
5123 * configure: Regenerate.
5124
5125 2012-03-21 Cary Coutant <ccoutant@google.com>
5126
5127 * Makefile.am: Add gdb-index.cc, gdb-index.h.
5128 * Makefile.in: Regenerate.
5129 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
5130 (Sized_elf_reloc_mapper::symbol_section): New function.
5131 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
5132 (make_elf_reloc_mapper): New function.
5133 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
5134 (Dwarf_abbrev_table::do_read_abbrevs): New function.
5135 (Dwarf_abbrev_table::do_get_abbrev): New function.
5136 (Dwarf_ranges_table::read_ranges_table): New function.
5137 (Dwarf_ranges_table::read_range_list): New function.
5138 (Dwarf_pubnames_table::read_section): New function.
5139 (Dwarf_pubnames_table::read_header): New function.
5140 (Dwarf_pubnames_table::next_name): New function.
5141 (Dwarf_die::Dwarf_die): New function.
5142 (Dwarf_die::read_attributes): New function.
5143 (Dwarf_die::skip_attributes): New function.
5144 (Dwarf_die::set_name): New function.
5145 (Dwarf_die::set_linkage_name): New function.
5146 (Dwarf_die::attribute): New function.
5147 (Dwarf_die::string_attribute): New function.
5148 (Dwarf_die::int_attribute): New function.
5149 (Dwarf_die::uint_attribute): New function.
5150 (Dwarf_die::ref_attribute): New function.
5151 (Dwarf_die::child_offset): New function.
5152 (Dwarf_die::sibling_offset): New function.
5153 (Dwarf_info_reader::check_buffer): New function.
5154 (Dwarf_info_reader::parse): New function.
5155 (Dwarf_info_reader::do_parse): New function.
5156 (Dwarf_info_reader::do_read_string_table): New function.
5157 (Dwarf_info_reader::lookup_reloc): New function.
5158 (Dwarf_info_reader::get_string): New function.
5159 (Dwarf_info_reader::visit_compilation_unit): New function.
5160 (Dwarf_info_reader::visit_type_unit): New function.
5161 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
5162 Sized_elf_reloc_mapper.
5163 (Sized_dwarf_line_info::symbol_section): Remove function.
5164 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
5165 (Sized_dwarf_line_info::read_line_mappings): Remove object
5166 parameter, adjust callers.
5167 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
5168 * dwarf_reader.h: Include <sys/types.h>.
5169 (class Track_relocs): Remove forward declaration.
5170 (class Elf_reloc_mapper): New class.
5171 (class Sized_elf_reloc_mapper): New class.
5172 (class Dwarf_abbrev_table): New class.
5173 (class Dwarf_range_list): New class.
5174 (class Dwarf_ranges_table): New class.
5175 (class Dwarf_pubnames_table): New class.
5176 (class Dwarf_die): New class.
5177 (class Dwarf_info_reader): New class.
5178 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
5179 (Sized_dwarf_line_info::symbol_section): Remove member function.
5180 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
5181 base class.
5182 * gdb-index.cc: New source file.
5183 * gdb-index.h: New source file.
5184 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
5185 and .debug_types sections, call Layout::add_to_gdb_index.
5186 (Sized_relobj_incr::do_section_name): Implement.
5187 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
5188 return type; Implement.
5189 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
5190 return type.
5191 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
5192 parameter list and return type.
5193 (Sized_incr_dynobj::do_section_contents): Likewise.
5194 * layout.cc: Include gdb-index.h.
5195 (Layout::Layout): Initialize gdb_index_data_.
5196 (Layout::init_fixed_output_section): Check for .gdb_index section.
5197 (Layout::add_to_gdb_index): New function. Instantiate.
5198 * layout.h: Add forward declaration for class Gdb_index.
5199 (Layout::add_to_gdb_index): New member function.
5200 (Layout::gdb_index_data_): New data member.
5201 * main.cc: Include gdb-index.h.
5202 (main): Print statistics for gdb index.
5203 * object.cc (Object::section_contents): Move code into
5204 do_section_contents.
5205 (need_decompressed_section): Check for sections needed when building
5206 gdb index.
5207 (build_compressed_section_map): Likewise.
5208 (Sized_relobj_file::do_read_symbols): Need local symbols when building
5209 gdb index.
5210 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
5211 sections; call Layout::add_to_gdb_index.
5212 (Sized_relobj_file::do_decompressed_section_contents): Call
5213 do_section_contents directly.
5214 * object.h (Object::do_section_contents): Adjust parameter list and
5215 return type.
5216 (Object::do_decompressed_section_contents): Call do_section_contents
5217 directly.
5218 (Sized_relobj_file::do_section_contents): Adjust parameter list and
5219 return type.
5220 * options.h (class General_options): Add --gdb-index option.
5221 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
5222 list and return type.
5223 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
5224 * reloc.h (Track_relocs::checkpoint): New function.
5225 (Track_relocs::reset): New function.
5226
5227 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
5228 New test cases.
5229 * testsuite/Makefile.in: Regenerate.
5230 * testsuite/gdb_index_test.cc: New test source file.
5231 * testsuite/gdb_index_test_1.sh: New test source file.
5232 * testsuite/gdb_index_test_2.sh: New test source file.
5233
5234 2012-03-19 Doug Kwan <dougkwan@google.com>
5235
5236 * arm.cc (Target_arm::do_define_standard_symbols): New method.
5237 (Target_arm::do_finalize_sections): Remove code which defines
5238 __exidx_start and __exidx_end. Make symbol table parameter
5239 anonymous as it is not used.
5240 * gold.cc (queue_middle_tasks): Call target hook to define any
5241 target-specific symbols.
5242 * target.h (Target::define_standard_symbols): New method.
5243 (Target::do_define_standard_symbols): Same.
5244 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
5245 * testsuite/Makefile.in: Regenerate.
5246 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
5247 and __exidx_end.
5248 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
5249 relocations are generated for __exidx_start and __exidx_end.
5250
5251 2012-03-16 Doug Kwan <dougkwan@google.com>
5252
5253 * testsuite/Makefile.am: Disable test initpri3b.
5254 * testsuite/Makefile.in: Regenerate.
5255
5256 2012-03-15 Doug Kwan <dougkwan@google.com>
5257
5258 * arm.cc (Target_arm::got_section): Make .got section read-only
5259 if -z now is given.
5260
5261 2012-03-15 Ian Lance Taylor <iant@google.com>
5262
5263 PR gold/13850
5264 * layout.cc (Layout::make_output_section): Correctly mark
5265 SHT_INIT_ARRAY, et. al., as relro.
5266
5267 2012-03-14 Doug Kwan <dougkwan@google.com>
5268
5269 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
5270 dynamic relocations for protected symbols in shared objects.
5271
5272 2012-03-13 Ian Lance Taylor <iant@google.com>
5273
5274 * resolve.cc (Symbol_table::resolve): When merging common symbols,
5275 keep the larger alignment.
5276
5277 2012-03-12 Cary Coutant <ccoutant@google.com>
5278
5279 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
5280 handling of DW_LNE_define_file.
5281
5282 2012-03-12 Cary Coutant <ccoutant@google.com>
5283
5284 * reduced_debug_output.cc
5285 (Output_reduced_debug_info_section::get_die_end): Add new FORM
5286 codes to switch.
5287
5288 2012-02-29 Cary Coutant <ccoutant@google.com>
5289
5290 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
5291
5292 2012-02-29 Cary Coutant <ccoutant@google.com>
5293
5294 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5295 Call Object::decompressed_section_contents.
5296 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
5297 New dtor.
5298 (Sized_dwarf_line_info::buffer_start_): New data member.
5299 * merge.cc (Output_merge_data::do_add_input_section): Call
5300 Object::decompressed_section_contents.
5301 (Output_merge_string::do_add_input_section): Likewise.
5302 * object.cc (need_decompressed_section): New function.
5303 (build_compressed_section_map): Decompress sections needed later.
5304 (Sized_relobj_file::do_decompressed_section_contents): New function.
5305 (Sized_relobj_file::do_discard_decompressed_sections): New function.
5306 * object.h (Object::decompressed_section_contents): New function.
5307 (Object::discard_decompressed_sections): New function.
5308 (Object::do_decompressed_section_contents): New function.
5309 (Object::do_discard_decompressed_sections): New function.
5310 (Compressed_section_info): New type.
5311 (Compressed_section_map): Include decompressed section contents.
5312 (Sized_relobj_file::do_decompressed_section_contents): New function.
5313 (Sized_relobj_file::do_discard_decompressed_sections): New function.
5314
5315 2012-02-16 Cary Coutant <ccoutant@google.com>
5316
5317 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
5318 * testsuite/Makefile.in: Regenerate.
5319
5320 2012-02-14 Cary Coutant <ccoutant@google.com>
5321
5322 * options.cc (General_options::finalize): Disallow -pie and -static.
5323
5324 2012-02-03 Doug Kwan <dougkwan@google.com>
5325
5326 * arm.cc (Arm_relocate_functions::abs8,
5327 Arm_relocate_functions::abs16): Use
5328 Bits::has_signed_unsigned_overflow32.
5329 (Arm_relocate_functions::thm_abs8): Correct range of
5330 overflow check.
5331 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
5332 in assertions.
5333
5334 2012-02-02 Doug Kwan <dougkwan@google.com>
5335
5336 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
5337 position independent outputs, not just shared objects.
5338
5339 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
5340
5341 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
5342 * configure: Regenerated.
5343
5344 2012-01-27 Ian Lance Taylor <iant@google.com>
5345
5346 * reloc.h (Bits): New class with static functions, copied from
5347 namespace utils in arm.cc.
5348 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
5349 instead.
5350
5351 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
5352
5353 * incremental.cc (write_info_blocks): Correct relocation offset.
5354
5355 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
5356
5357 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
5358 (Relocate::tls_gd_to_le): Likewise.
5359
5360 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
5361
5362 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
5363
5364 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
5365
5366 * configure.ac: Check if -mcmodel=medium works.
5367 * configure: Regenerated.
5368
5369 2012-01-24 Cary Coutant <ccoutant@google.com>
5370
5371 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
5372 definition and ...
5373 (read_unsigned_LEB_128_x): ... this new function.
5374 (read_signed_LEB_128): Replaced with inline definition and ...
5375 (read_signed_LEB_128_x): ... this new function.
5376 * int_encoding.h (read_unsigned_LEB_128_x): New function.
5377 (read_unsigned_LEB_128): Add inline definition.
5378 (read_signed_LEB_128_x): New function.
5379 (read_signed_LEB_128): Add inline definition.
5380 * testsuite/Makefile.am (leb128_unittest): New unit test.
5381 * testsuite/Makefile.in: Regenerate.
5382 * testsuite/leb128_unittest.cc: New unit test.
5383
5384 2012-01-23 Ian Lance Taylor <iant@google.com>
5385
5386 PR gold/13617
5387 * i386.cc (Target_i386::do_code_fill): When using a jmp
5388 instruction, pad with nop instructions.
5389 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5390
5391 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
5392
5393 * x86_64.cc (gc_process_relocs): Add typename on types used in
5394 template.
5395 (scan_relocs): Likewise.
5396 (relocate_section): Likewise.
5397 (apply_relocation): Likewise.
5398
5399 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
5400
5401 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
5402 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
5403 under x32.
5404
5405 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
5406
5407 * x86_64.cc: Initial support for x32.
5408
5409 2012-01-03 Cary Coutant <ccoutant@google.com>
5410
5411 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
5412 Use abstract base class for GOT.
5413 * gold/output.h (class Output_data_got_base): New abstract base class.
5414 (class Output_data_got): Derive from new base class, adjust ctors.
5415 (Output_data_got::reserve_slot): Make virtual; rename to
5416 do_reserve_slot; Adjust callers.
5417 * gold/target.h (Sized_target::init_got_plt_for_update): Return
5418 pointer to abstract base class.
5419 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
5420
5421 2011-12-18 Ian Lance Taylor <iant@google.com>
5422
5423 * object.h (Relobj::local_symbol_value): New function.
5424 (Relobj::local_plt_offset): New function.
5425 (Relobj::local_has_got_offset): New function.
5426 (Relobj::local_got_offset): New function.
5427 (Relobj::set_local_got_offset): New function.
5428 (Relobj::do_local_symbol_value): New pure virtual function.
5429 (Relobj::do_local_plt_offset): Likewise.
5430 (Relobj::do_local_has_got_offset): Likewise.
5431 (Relobj::do_local_got_offset): Likewise.
5432 (Relobj::do_set_local_got_offset): Likewise.
5433 (Sized_relobj::do_local_has_got_offset): Rename from
5434 local_has_got_offset.
5435 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
5436 (Sized_relobj::do_set_local_got_offset): Rename from
5437 set_local_got_offset.
5438 (Sized_relobj_file::do_local_plt_offset): Rename from
5439 local_plt_offset.
5440 (Sized_relobj_file::do_local_symbol_value): New function.
5441 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
5442 local_plt_offset.
5443 * output.cc (Output_data_got::Got_entry::write): Change object to
5444 Relobj. Use local_symbol_value.
5445 (Output_data_got::add_global_with_rel): Change rel_dyn to
5446 Output_data_reloc_generic*. Use add_global_generic.
5447 (Output_data_got::add_global_with_rela): Remove. Change all
5448 callers to use add_global_with_rel.
5449 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
5450 Output_data_reloc_generic*. Use add_global_generic.
5451 (Output_data_got::add_global_pair_with_rela): Remove. Change all
5452 callers to use add_global_pair_with_rel.
5453 (Output_data_got::add_local): Change object to Relobj*.
5454 (Output_data_got::add_local_plt): Likewise.
5455 (Output_data_got::add_local_with_rel): Change object to Relobj*,
5456 change rel_dyn to Output_data_reloc_generic*. Use
5457 add_local_generic.
5458 (Output_data_got::add_local_with_rela): Remove. Change all
5459 callers to use all_local_with_rel.
5460 (Output_data_got::add_local_pair_with_rel): Change object to
5461 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
5462 add_output_section_generic.
5463 (Output_data_got::add_local_pair_with_rela): Remove. Change all
5464 callers to use add_local_pair_with_rel.
5465 (Output_data_got::reserve_local): Change object to Relobj*.
5466 * output.h: (class Output_data_reloc_generic): Add pure virtual
5467 declarations for add_global_generic, add_local_generic,
5468 add_output_section_generic.
5469 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
5470 functions for Output_data_reloc_generic. Update declarations for
5471 changes listed in output.cc.
5472 (class Output_data_got): Change template parameter to got_size.
5473 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
5474 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
5475 function.
5476 (Sized_relobj_incr::do_local_plt_offset): New function.
5477 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
5478 add_global_generic.
5479
5480 2011-12-17 Cary Coutant <ccoutant@google.com>
5481
5482 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
5483 * resolve.cc (Symbol_table::resolve): Likewise.
5484 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
5485 arrays.
5486 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5487
5488 2011-12-16 Ian Lance Taylor <iant@google.com>
5489
5490 * output.h (Output_data_reloc_generic::add): Only call
5491 add_dynamic_reloc if this is a dynamic reloc section.
5492
5493 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
5494
5495 PR gold/13505
5496 * target-reloc.h (apply_relocation): Replace <64, false> with
5497 <size, big_endian>.
5498
5499 2011-11-25 Nick Clifton <nickc@redhat.com>
5500
5501 * po/it.po: New Italian translation.
5502
5503 2011-11-17 Sterling Augustine <saugustine@google.com>
5504
5505 * script.cc (script_include_directive): Implement.
5506 (read_script_file): New local variables name and search_path. Update
5507 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
5508 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
5509 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
5510
5511 2011-11-11 Sterling Augustine <saugustine@google.com>
5512
5513 * yyscript.y (section_cmd): Add support for INCLUDE directive.
5514 (file_or_sections_cmd): Likewise.
5515
5516 2011-11-11 Doug Kwan <dougkwan@google.com>
5517
5518 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
5519 if --just-symbols is given.
5520
5521 2011-11-10 Doug Kwan <dougkwan@google.com>
5522
5523 PR gold/13362
5524 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
5525 when processing data relocs.
5526 * reloc.h (Relocate_functions::rel_unaligned): New method.
5527 (Relocate_functions::pcrel_unaligned): Ditto.
5528 (Relocate_functions::rel32_unaligned): Ditto.
5529 (Relocate_functions::pcrel32_unaligned): Ditto.
5530
5531 2011-11-09 Doug Kwan <dougkwan@google.com>
5532
5533 PR gold/13362
5534 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
5535 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
5536 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
5537 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5538 (Relocate_functions::rel_unaligned): New.
5539 (Relocate_functions::rel32_unaligned): New.
5540 * target-reloc.h (relocate_for_relocatable): Add code to handle
5541 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5542 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
5543 arm_unaligned_reloc_r): New targets.
5544 * testsuite/Makefile.in: Regenerate.
5545 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
5546 linking.
5547
5548 2011-11-02 Ian Lance Taylor <iant@google.com>
5549
5550 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
5551 NATIVE_LINKER.
5552 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
5553 * options.cc (General_options::finalize): Use library search path
5554 from configure script if specified. If not native and no sysroot,
5555 only search TOOLLIBDIR.
5556 * options.h (Search_directory::Search_directory): Change name to
5557 const std::string&.
5558 (General_options::add_to_library_path_with_sysroot): Change arg to
5559 const std::string&.
5560 * configure, Makefile.in, config.in: Rebuild.
5561
5562 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
5563
5564 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
5565 we are working around the ARM1176 Erratum.
5566 * options.h (General_options::fix_arm1176): Add option.
5567 * testsuite/Makefile.am: Add testcases, and keep current ones
5568 working.
5569 * testsuite/Makefile.in: Regenerate.
5570 * testsuite/arm_fix_1176.s: New file.
5571 * testsuite/arm_fix_1176.sh: Likewise.
5572
5573 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
5574
5575 * arm.cc (Target_arm::Target_arm): Remove initialisation of
5576 may_use_blx_.
5577 (Target_arm::may_use_blx): Remove method.
5578 (Target_arm::set_may_use_blx): Likewise.
5579 (Target_arm::may_use_v4t_interworking): New method.
5580 (Target_arm::may_use_v5t_interworking): Likewise.
5581 (Target_arm::may_use_blx_): Remove member variable.
5582 (Arm_relocate_functions::arm_branch_common): Check for v5T
5583 interworking.
5584 (Arm_relocate_functions::thumb_branch_common): Likewise.
5585 (Reloc_stub::stub_type_for_reloc): Likewise.
5586 (Target_arm::do_finalize_sections): Correct interworking checks.
5587 * testsuite/Makefile.am: Add new tests.
5588 * testsuite/Makefile.in: Regenerate.
5589 * testsuite/arm_farcall_arm_arm.s: New test.
5590 * testsuite/arm_farcall_arm_arm.sh: Likewise.
5591 * testsuite/arm_farcall_arm_thumb.s: Likewise.
5592 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
5593 * testsuite/arm_farcall_thumb_arm.s: Likewise.
5594 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
5595 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
5596 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
5597
5598 2011-10-31 Cary Coutant <ccoutant@google.com>
5599
5600 PR gold/13023
5601 * expression.cc (Expression::eval_with_dot): Add
5602 is_section_dot_assignment parameter.
5603 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
5604 absolute and assigning to dot within a section.
5605 * script-sections.cc
5606 (Output_section_element_assignment::set_section_addresses): Pass
5607 dot_section to set_if_absolute.
5608 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
5609 as is_section_dot_assignment flag to eval_with_dot.
5610 (Output_section_element_dot_assignment::set_section_addresses):
5611 Likewise.
5612 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
5613 parameter. Also set value if relative to dot_section; set the
5614 symbol's output_section.
5615 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
5616 parameter. Adjust all callers.
5617 (Expression::eval_maybe_dot): Likewise.
5618 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
5619 Adjust all callers.
5620 * testsuite/script_test_2.t: Test assignment of an absolute value
5621 to dot within an output section element.
5622
5623 2011-10-31 Cary Coutant <ccoutant@google.com>
5624
5625 * options.h (class General_options): Add --[no-]gnu-unique options.
5626 * symtab.cc (Symbol_table::sized_write_globals): Convert
5627 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
5628
5629 2011-10-31 Cary Coutant <ccoutant@google.com>
5630
5631 PR gold/13359
5632 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
5633 unnecessary assertion.
5634 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
5635
5636 2011-10-31 Sriraman Tallam <tmsriram@google.com>
5637
5638 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5639 gc_mark_symbol.
5640 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5641 gc_mark_symbol.
5642 Change to just keep the section associated with symbol.
5643 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
5644 they are externally visible and --export-dynamic is turned on.
5645 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
5646
5647 2011-10-19 Ian Lance Taylor <iant@google.com>
5648
5649 PR gold/13163
5650 * script-sections.cc
5651 (Output_section_element_dot_assignment::needs_output_section): New
5652 function.
5653
5654 2011-10-19 Ian Lance Taylor <iant@google.com>
5655
5656 PR gold/13204
5657 * layout.cc (Layout::segment_precedes): Don't assert failure if a
5658 --section-start option was seen.
5659 * options.h (General_options::any_section_start): New function.
5660
5661 2011-10-18 David S. Miller <davem@davemloft.net>
5662
5663 PR binutils/13301
5664 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
5665 member to track relocation locations that have moved during TLS
5666 reloc optimizations.
5667 (Target_sparc::Relocate::Relocate): Initialize to NULL.
5668 (Target_sparc::Relocate::relocate): Adjust view down by 4
5669 bytes if it matches reloc_adjust_addr_.
5670 (Target_sparc::Relocate::relocate_tls): Always move the
5671 __tls_get_addr call delay slot instruction forward 4 bytes when
5672 performing relaxation.
5673
5674 2011-10-18 Cary Coutant <ccoutant@google.com>
5675
5676 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
5677 (Output_file::map_no_anonymous): Check for non-zero
5678 return code from posix_fallocate.
5679
5680 2011-10-17 Cary Coutant <ccoutant@google.com>
5681
5682 PR gold/13245
5683 * plugin.cc (is_visible_from_outside): Check for symbols
5684 referenced from dynamic objects.
5685 * resolve.cc (Symbol_table::resolve): Don't count references
5686 from dynamic objects as references from real ELF files.
5687 * testsuite/plugin_test_2.sh: Adjust expected result.
5688
5689 2011-10-17 Cary Coutant <ccoutant@google.com>
5690
5691 * gold.cc: Include timer.h.
5692 (queue_middle_tasks): Stamp time.
5693 (queue_final_tasks): Likewise.
5694 * main.cc (main): Store timer in parameters. Print timers
5695 for each pass.
5696 * parameters.cc (Parameters::Parameters): Initialize timer_.
5697 (Parameters::set_timer): New function.
5698 (set_parameters_timer): New function.
5699 * parameters.h (Parameters::set_timer): New function.
5700 (Parameters::timer): New function.
5701 (Parameters::timer_): New data member.
5702 (set_parameters_timer): New function.
5703 * timer.cc (Timer::stamp): New function.
5704 (Timer::get_pass_time): New function.
5705 * timer.h (Timer::stamp): New function.
5706 (Timer::get_pass_time): New function.
5707 (Timer::pass_times_): New data member.
5708
5709 2011-10-17 Cary Coutant <ccoutant@google.com>
5710
5711 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
5712 task for members of lib groups.
5713
5714 2011-10-17 Cary Coutant <ccoutant@google.com>
5715
5716 PR gold/13288
5717 * fileread.cc (File_read::find_view): Add assert.
5718 (File_read::make_view): Move bounds check (replace with assert)...
5719 (File_read::find_or_make_view): ... to here.
5720
5721 2011-10-12 Cary Coutant <ccoutant@google.com>
5722
5723 * output.cc (Output_file::open_base_file): Handle case where
5724 ::read returns less than requested size.
5725
5726 2011-10-10 Cary Coutant <ccoutant@google.com>
5727
5728 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
5729 Initialize defined_count_.
5730 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
5731 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
5732 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
5733 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
5734 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
5735 * incremental.h (Sized_relobj_incr::defined_count_): New data
5736 member.
5737 (Sized_incr_dynobj::defined_count_): New data member.
5738 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
5739 Return zeroes instead of internal error.
5740
5741 2011-10-10 Cary Coutant <ccoutant@google.com>
5742
5743 PR gold/13249
5744 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
5745 (Output_reloc::symbol_value): Return PLT offset if flag is set.
5746 * output.h (class Output_reloc): Add use_plt_offset flag.
5747 (Output_reloc::type_): Adjust size of bit field.
5748 (Output_reloc::use_plt_offset_): New bit field.
5749 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
5750 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
5751 flag. Adjust all callers.
5752 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
5753 creating RELATIVE relocations.
5754
5755 2011-10-10 Nick Clifton <nickc@redhat.com>
5756
5757 * po/es.po: Updated Spanish translation.
5758 * po/fi.po: Updated Finnish translation.
5759
5760 2011-10-03 Diego Novillo <dnovillo@google.com>
5761
5762 * options.cc (parse_uint): Fix dereference of RETVAL.
5763
5764 2011-09-29 Sriraman Tallam <tmsriram@google.com>
5765
5766 * layout.h (section_order_map_): New member.
5767 (get_section_order_map): New member function.
5768 * output.cc (Output_section::add_input_section): Check for patterns
5769 only when --section-ordering-file is specified.
5770 * gold.cc (queue_middle_tasks): Delay updating order of sections till
5771 output_sections have been formed.
5772 * layout.cc (Layout_Layout): Initialize section_order_map_.
5773 * plugin.cc (update_section_order): Store order in order_map. Do not
5774 update the order.
5775 * testsuite/Makefile.am: Add test case for plugin_final_layout.
5776 * testsuite/Makefile.in: Regenerate.
5777 * testsuite/plugin_section_order.c: New file.
5778 * testsuite/plugin_final_layout.cc: New file.
5779 * testsuite/plugin_final_layout.sh: New file.
5780
5781 2011-09-29 Cary Coutant <ccoutant@google.com>
5782
5783 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5784 Check for NULL.
5785 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
5786 symbols during incremental update.
5787 (Symbol_table::add_from_dynobj): Likewise.
5788
5789 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5790 Ian Lance Taylor <iant@google.com>
5791
5792 * symtab.cc (Symbol_table::define_special_symbol): Always
5793 canonicalize version string.
5794
5795 2011-09-26 Cary Coutant <ccoutant@google.com>
5796
5797 * gold.cc (queue_initial_tasks): Move option checks ...
5798 * options.cc (General_options::finalize): ... to here. Disable
5799 some options; make others fatal.
5800
5801 2011-09-26 Cary Coutant <ccoutant@google.com>
5802
5803 gcc PR lto/47247
5804 * plugin.cc (get_symbols_v2): New function.
5805 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
5806 (is_referenced_from_outside): New function.
5807 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
5808 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
5809 (get_symbols): Pass version parameter.
5810 (get_symbols_v2): New function.
5811 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
5812 parameter.
5813 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
5814 (onload): Add LDPT_GET_SYMBOLS_V2.
5815 (all_symbols_read_hook): Use get_symbols_v2; check for
5816 LDPR_PREVAILING_DEF_IRONLY_EXP.
5817 * testsuite/plugin_test_3.sh: Update expected results.
5818
5819 2011-09-23 Simon Baldwin <simonb@google.com>
5820
5821 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
5822 configuration options.
5823 * configure: Regenerate.
5824 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
5825 * Makefile.in: Regenerate.
5826 * testsuite/Makefile.in: Regenerate.
5827
5828 2011-09-19 Sriraman Tallam <tmsriram@google.com>
5829
5830 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
5831
5832 2011-09-19 Cary Coutant <ccoutant@google.com>
5833
5834 * incremental.cc (can_incremental_update): Fix typo in comment.
5835 * incremental.h (can_incremental_update): Likewise.
5836
5837 2011-09-18 Cary Coutant <ccoutant@google.com>
5838
5839 * incremental.cc (can_incremental_update): New function.
5840 * incremental.h (can_incremental_update): New function.
5841 * layout.cc (Layout::init_fixed_output_section): Call it.
5842 (Layout::make_output_section): Don't allow patch space in .eh_frame.
5843 * object.cc (Sized_relobj_file::do_layout): Call
5844 can_incremental_update.
5845
5846 2011-09-13 Cary Coutant <ccoutant@google.com>
5847
5848 * configure.ac: Check for glibc support for gnu_indirect_function
5849 support with static linking, setting automake conditional
5850 IFUNC_STATIC.
5851 * Makefile.in: Regenerate.
5852 * configure: Regenerate.
5853
5854 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
5855 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
5856 for IFUNC_STATIC.
5857 * testsuite/Makefile.in: Regenerate.
5858
5859 2011-09-13 Cary Coutant <ccoutant@google.com>
5860
5861 * incremental.cc (Sized_relobj_incr::do_layout): Call
5862 report_comdat_group for kept comdat sections.
5863 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
5864 * testsuite/Makefile.in: Regenerate.
5865 * testsuite/incr_comdat_test_1.cc: New source file.
5866 * testsuite/incr_comdat_test_2_v1.cc: New source file.
5867 * testsuite/incr_comdat_test_2_v2.cc: New source file.
5868 * testsuite/incr_comdat_test_2_v3.cc: New source file.
5869
5870 2011-09-13 Ian Lance Taylor <iant@google.com>
5871
5872 * object.cc (Sized_relobj_file::do_layout): Remove unused local
5873 variable external_symbols_offset.
5874
5875 2011-09-12 Ian Lance Taylor <iant@google.com>
5876
5877 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
5878 triggered if object has no symbols.
5879
5880 2011-09-09 David S. Miller <davem@davemloft.net>
5881
5882 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
5883 (Output_fill_debug_line::do_write): Likewise.
5884
5885 2011-08-29 Cary Coutant <ccoutant@google.com>
5886
5887 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
5888 casts to match formatting specs.
5889 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
5890
5891 2011-08-26 Cary Coutant <ccoutant@google.com>
5892
5893 * layout.cc (Free_list::allocate): Provide guarantee of minimum
5894 remaining hole size when allocating.
5895 (Layout::make_output_section): Set fill methods for debug sections.
5896 * layout.h (Free_list::Free_list_node): Move from private to
5897 public.
5898 (Free_list::set_min_hole_size): New function.
5899 (Free_list::begin, Free_list::end): New functions.
5900 (Free_list::min_hole_): New data member.
5901 * output.cc: Include dwarf.h.
5902 (Output_fill_debug_info::do_minimum_hole_size): New function.
5903 (Output_fill_debug_info::do_write): New function.
5904 (Output_fill_debug_line::do_minimum_hole_size): New function.
5905 (Output_fill_debug_line::do_write): New function.
5906 (Output_section::Output_section): Initialize new data member.
5907 (Output_section::set_final_data_size): Ensure patch space is larger
5908 than minimum hole size.
5909 (Output_section::do_write): Fill holes in debug sections.
5910 * output.h (Output_fill): New class.
5911 (Output_fill_debug_info): New class.
5912 (Output_fill_debug_line): New class.
5913 (Output_section::set_free_space_fill): New function.
5914 (Output_section::free_space_fill_): New data member.
5915 * testsuite/Makefile.am (incremental_test_3): Add
5916 --incremental-patch option.
5917 (incremental_test_4): Likewise.
5918 (incremental_test_5): Likewise.
5919 (incremental_test_6): Likewise.
5920 (incremental_copy_test): Likewise.
5921 (incremental_common_test_1): Likewise.
5922 * testsuite/Makefile.in: Regenerate.
5923
5924 2011-08-26 Nick Clifton <nickc@redhat.com>
5925
5926 * po/es.po: Updated Spanish translation.
5927
5928 2011-08-01 Cary Coutant <ccoutant@google.com>
5929
5930 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
5931 * gold/testsuite/Makefile.in: Regenerate.
5932 * gold/testsuite/justsyms_exec.c: New source file.
5933 * gold/testsuite/justsyms_lib.c: New source file.
5934
5935 2011-08-01 Cary Coutant <ccoutant@google.com>
5936
5937 * layout.cc (Layout::set_segment_offsets): Don't realign text
5938 segment if -Ttext was specified.
5939 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
5940 file type.
5941 * object.h (Sized_relobj_file::e_type): New function.
5942 (Sized_relobj_file::e_type_): New data member.
5943 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
5944 base address for ET_EXEC files.
5945 * target.cc (Target::do_make_elf_object_implementation): Allow
5946 ET_EXEC files with --just-symbols option.
5947
5948 2011-07-28 Cary Coutant <ccoutant@google.com>
5949
5950 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
5951 Add thread_number parameter.
5952 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
5953 * workqueue-threads.cc
5954 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
5955 current thread if its thread number is greater than desired thread
5956 count.
5957 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
5958 Add thread_number parameter.
5959 (Workqueue::should_cancel_thread): Likewise.
5960 (Workqueue::find_runnable_or_wait): Pass thread_number to
5961 should_cancel_thread.
5962 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
5963 parameter.
5964
5965 2011-07-22 Sriraman Tallam <tmsriram@google.com>
5966
5967 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
5968 only after checking if it cannot be forced local.
5969 * symtab.h (is_externally_visible): Check if the symbol is not forced
5970 local.
5971
5972 2011-07-15 Ian Lance Taylor <iant@google.com>
5973
5974 * options.h (class General_options): Add --print-output-format.
5975 Move -EL next to -EB, for better --help output.
5976 * target-select.cc: Include <cstdio>, "options.h", and
5977 "parameters.h".
5978 (Target_selector::do_target_bfd_name): New function.
5979 (print_output_format): New function.
5980 * target-select.h (class Target_selector): Update declarations.
5981 (Target_selector::target_bfd_name): New function.
5982 (print_output_format): Declare.
5983 * main.cc: Include "target-select.h".
5984 (main): Handle --print-output-format.
5985 * gold.cc: Include "target-select.h".
5986 (queue_initial_tasks): Handle --print-output-format when there are
5987 no input files.
5988 * parameters.cc (parameters_force_valid_target): Give a better
5989 error message if -EB/-EL does not match target.
5990 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
5991 function.
5992
5993 2011-07-15 Ian Lance Taylor <iant@google.com>
5994
5995 * i386.cc (class Output_data_plt_i386): Add layout_ field.
5996 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
5997 (Output_data_plt_i386::do_write): Write address of .dynamic
5998 section to first entry in .got.plt section.
5999 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
6000 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
6001 Initialize layout_.
6002 (Output_data_plt_x86_64::do_write): Write address of .dynamic
6003 section to first entry in .got.plt section.
6004 * layout.h (Layout::dynamic_section): New function.
6005
6006 2011-07-13 Sriraman Tallam <tmsriram@google.com>
6007
6008 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
6009 to claim_file call.
6010 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
6011 input_section_position_, and input_section_glob_.
6012 (read_layout_from_file): Call function section_ordering_specified.
6013 * layout.h (is_section_ordering_specified): New function.
6014 (section_ordering_specified): New function.
6015 (section_ordering_specified_): New boolean member.
6016 * main.cc(main): Call load_plugins after layout object is defined.
6017 * output.cc (Output_section::add_input_section): Use
6018 function section_ordering_specified to check if section ordering is
6019 needed.
6020 * output.cc (Output_section::add_relaxed_input_section): Use
6021 function section_ordering_specified to check if section ordering is
6022 needed.
6023 (Output_section::update_section_layout): New function.
6024 (Output_section::sort_attached_input_sections): Check if input section
6025 must be reordered.
6026 * output.h (Output_section::update_section_layout): New function.
6027 * plugin.cc (get_section_count): New function.
6028 (get_section_type): New function.
6029 (get_section_name): New function.
6030 (get_section_contents): New function.
6031 (update_section_order): New function.
6032 (allow_section_ordering): New function.
6033 (Plugin::load): Add the new interfaces to the transfer vector.
6034 (Plugin_manager::load_plugins): New parameter.
6035 (Plugin_manager::all_symbols_read): New parameter.
6036 (Plugin_manager::claim_file): New parameter. Save the elf object for
6037 unclaimed objects.
6038 (Plugin_manager::get_elf_object): New function.
6039 (Plugin_manager::get_view): Change to directly use the bool to check
6040 if get_view is called from claim_file_hook.
6041 * plugin.h (input_objects): New function
6042 (Plugin__manager::load_plugins): New parameter.
6043 (Plugin_manager::claim_file): New parameter.
6044 (Plugin_manager::get_elf_object): New function.
6045 (Plugin_manager::in_claim_file_handler): New function.
6046 (Plugin_manager::in_claim_file_handler_): New member.
6047 (layout): New function.
6048 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
6049 handler with an extra parameter. Make the elf object before calling
6050 claim_file handler.
6051 * testsuite/plugin_test.c (get_section_count): New function pointer.
6052 (get_section_type): New function pointer.
6053 (get_section_name): New function pointer.
6054 (get_section_contents): New function pointer.
6055 (update_section_order): New function pointer.
6056 (allow_section_ordering): New function pointer.
6057 (onload): Check if the new interfaces exist.
6058
6059 2011-07-13 Ian Lance Taylor <iant@google.com>
6060
6061 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
6062 relro section.
6063 * x86_64.cc (Target_x86_64::got_section): Likewise.
6064 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
6065 (relro_now_test_SOURCES): New variable.
6066 (relro_now_test_DEPENDENCIES): New variable.
6067 (relro_now_test_LDFLAGS): New variable.
6068 (relro_now_test_LDADD): New variable.
6069 (relro_now_test.so): New target.
6070 * testsuite/Makefile.in: Rebuild.
6071
6072 2011-07-12 Ian Lance Taylor <iant@google.com>
6073
6074 PR gold/12980
6075 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
6076 GLOB_DAT relocation rather than a RELATIVE relocation for a
6077 protected symbol when creating a shared library.
6078 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6079 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
6080 * testsuite/protected_main_1.cc (main): Test that protected
6081 function has same address.
6082
6083 2011-07-11 Ian Lance Taylor <iant@google.com>
6084
6085 PR gold/12979
6086 * options.h (class General_options): Add -Bgroup.
6087 * options.cc (General_options::finalize): If -Bgroup is set,
6088 default to --unresolved-symbols=report-all.
6089 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
6090 * target-reloc.h (issue_undefined_symbol_error): Handle
6091 --unresolved-symbols=report-all.
6092
6093 2011-07-08 Ian Lance Taylor <iant@google.com>
6094
6095 PR gold/11985
6096 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
6097 if linker script discards key sections.
6098 (Layout::create_dynamic_symtab): Likewise.
6099 (Layout::assign_local_dynsym_offsets): Likewise.
6100 (Layout::sized_create_version_sections): Likewise.
6101 (Layout::create_interp): Likewise.
6102 (Layout::finish_dynamic_section): Likewise.
6103 (Layout::set_dynamic_symbol_size): Likewise.
6104
6105 2011-07-08 Ian Lance Taylor <iant@google.com>
6106
6107 PR gold/12386
6108 * options.h (class General_options): Add --unresolved-symbols.
6109 * target-reloc.h (issue_undefined_symbol_error): Check
6110 --unresolved-symbols. Add comments.
6111
6112 2011-07-08 Ian Lance Taylor <iant@google.com>
6113
6114 * testsuite/odr_violation2.cc (Ordering::operator()): Make
6115 expression more complex.
6116
6117 2011-07-08 Ian Lance Taylor <iant@google.com>
6118
6119 PR gold/11317
6120 * target-reloc.h (issue_undefined_symbol_error): New inline
6121 function, broken out of relocate_section.
6122 (relocate_section): Call issue_undefined_symbol_error.
6123 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
6124 there is no TLS segment if we are about to issue an undefined
6125 symbol error.
6126 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
6127
6128 2011-07-08 Ian Lance Taylor <iant@google.com>
6129
6130 PR gold/12279
6131 * resolve.cc (Symbol_table::should_override): Add fromtype
6132 parameter. Change all callers. Give error when linking together
6133 TLS and non-TLS symbol.
6134 (Symbol_table::should_override_with_special): Add fromtype
6135 parameter. Change all callers.
6136 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
6137 there is no TLS segment if we have reported some errors.
6138 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
6139
6140 2011-07-08 Ian Lance Taylor <iant@google.com>
6141
6142 PR gold/12372
6143 * target.h (Target::plt_address_for_global): New function.
6144 (Target::plt_address_for_local): New function.
6145 (Target::plt_section_for_global): Remove.
6146 (Target::plt_section_for_local): Remove.
6147 (Target::do_plt_address_for_global): New virtual function.
6148 (Target::do_plt_address_for_local): New virtual function.
6149 (Target::do_plt_section_for_global): Remove.
6150 (Target::do_plt_section_for_local): Remove.
6151 (Target::register_global_plt_entry): Add Symbol_table and Layout
6152 parameters.
6153 * output.cc (Output_data_got::Got_entry::write): Use
6154 plt_address_for_global and plt_address_for_local.
6155 * layout.cc (Layout::add_target_dynamic_tags): Use size and
6156 address of output section.
6157 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
6158 got_irelative_, and irelative_count_ fields. Update
6159 declarations.
6160 (Output_data_plt_i386::has_irelative_section): New function.
6161 (Output_data_plt_i386::entry_count): Add irelative_count_.
6162 (Output_data_plt_i386::set_final_data_size): Likewise.
6163 (class Target_i386): Add got_irelative_ and rel_irelative_
6164 fields. Update declarations.
6165 (Target_i386::Target_i386): Initialize new fields.
6166 (Target_i386::do_plt_address_for_global): New function replacing
6167 do_plt_section_for_global.
6168 (Target_i386::do_plt_address_for_local): New function replacing
6169 do_plt_section_for_local.
6170 (Target_i386::got_section): Create got_irelative_.
6171 (Target_i386::rel_irelative_section): New function.
6172 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
6173 fields. Don't define __rel_iplt_{start,end}.
6174 (Output_data_plt_i386::add_entry): Add symtab and layout
6175 parameters. Change all callers. Use different PLT and GOT for
6176 IFUNC symbols.
6177 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
6178 layout parameters. Change all callers. Use different PLT and
6179 GOT.
6180 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
6181 (Output_data_plt_i386::rel_irelative): New function.
6182 (Output_data_plt_i386::address_for_global): New function.
6183 (Output_data_plt_i386::address_for_local): New function.
6184 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
6185 IRELATIVE GOT when changing IFUNC GOT entries.
6186 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
6187 reloc.
6188 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
6189 if we didn't create an IRELATIVE GOT.
6190 (Target_i386::Relocate::relocate): Use plt_address_for_global and
6191 plt_address_for_local.
6192 (Target_i386::do_dynsym_value): Use plt_address_for_global.
6193 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
6194 got_irelative_, and irelative_count_ fields. Update
6195 declarations.
6196 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
6197 Initialize new fields. Remove symtab parameter. Change all
6198 callers.
6199 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
6200 irelative_count_.
6201 (Output_data_plt_x86_64::has_irelative_section): New function.
6202 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
6203 (class Target_x86_64): Add got_irelative_ and rel_irelative_
6204 fields. Update declarations.
6205 (Target_x86_64::Target_x86_64): Initialize new fields.
6206 (Target_x86_64::do_plt_address_for_global): New function replacing
6207 do_plt_section_for_global.
6208 (Target_x86_64::do_plt_address_for_local): New function replacing
6209 do_plt_section_for_local.
6210 (Target_x86_64::got_section): Create got_irelative_.
6211 (Target_x86_64::rela_irelative_section): New function.
6212 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
6213 all callers. Don't create __rel_iplt_{start,end}.
6214 (Output_data_plt_x86_64::add_entry): Add symtab and layout
6215 parameters. Change all callers. Use different PLT and GOT for
6216 IFUNC symbols.
6217 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
6218 layout parameters. Change all callers. Use different PLT and
6219 GOT.
6220 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
6221 parameters. Change all callers. Use different PLT and GOT for
6222 IFUNC symbols.
6223 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
6224 (Output_data_plt_x86_64::rela_irelative): New function.
6225 (Output_data_plt_x86_64::address_for_global): New function.
6226 (Output_data_plt_x86_64::address_for_local): New function.
6227 (Output_data_plt_x86_64::set_final_data_size): Likewise.
6228 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
6229 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
6230 (Target_x86_64::register_global_plt_entry): Add symtab and layout
6231 parameters.
6232 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
6233 reloc.
6234 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
6235 symbols if we didn't create an IRELATIVE GOT.
6236 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
6237 plt_address_for_local.
6238 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
6239 * testsuite/ifuncvar1.c: New test file.
6240 * testsuite/ifuncvar2.c: New test file.
6241 * testsuite/ifuncvar3.c: New test file.
6242 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
6243 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
6244 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
6245 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
6246 * testsuite/Makefile.in: Rebuild.
6247
6248 2011-07-07 Cary Coutant <ccoutant@google.com>
6249
6250 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
6251 (two_file_test_1_ndebug.o): Likewise.
6252 (two_file_test_1b_ndebug.o): Likewise.
6253 (two_file_test_2_ndebug.o): Likewise.
6254 (two_file_test_main_ndebug.o): Likewise.
6255 (incremental_test_2): Link with no-debug versions.
6256
6257 2011-07-06 Cary Coutant <ccoutant@google.com>
6258
6259 * gold/incremental.cc
6260 (Output_section_incremental_inputs::write_info_blocks): Check for
6261 hidden and internal symbols.
6262
6263 2011-07-06 Cary Coutant <ccoutant@google.com>
6264
6265 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
6266 Check disposition for startup file.
6267 (Incremental_inputs::report_command_line): Ignore
6268 --incremental-startup-unchanged option.
6269 * options.cc (General_options::parse_incremental_startup_unchanged):
6270 New function.
6271 (General_options::General_options): Initialize new data member.
6272 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
6273 (General_options): Add --incremental-startup-unchanged option.
6274 (General_options::incremental_startup_disposition): New function.
6275 (General_options::incremental_startup_disposition_): New data member.
6276
6277 2011-07-06 Cary Coutant <ccoutant@google.com>
6278
6279 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
6280 input file index to Script_info ctor.
6281 (Sized_incremental_binary::do_file_has_changed): Find the
6282 command-line argument for files named in scripts.
6283 * incremental.h (Script_info::Script_info): New ctor
6284 with input file index.
6285 (Script_info::input_file_index): New function.
6286 (Script_info::input_file_index_): New data member.
6287 (Incremental_binary::get_library): Add const.
6288 (Incremental_binary::get_script_info): Add const.
6289 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
6290 * testsuite/Makefile.am (incremental_test_5): New test case.
6291 (incremental_test_6): New test case.
6292 * testsuite/Makefile.in: Regenerate.
6293
6294 2011-07-06 Cary Coutant <ccoutant@google.com>
6295
6296 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
6297 debug output when command lines differ.
6298
6299 2011-07-06 Cary Coutant <ccoutant@google.com>
6300
6301 * incremental.cc (Incremental_inputs::report_command_line): Ignore
6302 --incremental-patch option.
6303 * layout.cc (Free_list::allocate): Extend allocation beyond original
6304 end if enabled.
6305 (Layout::make_output_section): Mark sections that should get
6306 patch space.
6307 * options.cc (parse_percent): New function.
6308 * options.h (parse_percent): New function.
6309 (DEFINE_percent): New macro.
6310 (General_options): Add --incremental-patch option.
6311 * output.cc (Output_section::Output_section): Initialize new data
6312 members.
6313 (Output_section::add_input_section): Print section name when out
6314 of patch space.
6315 (Output_section::add_output_section_data): Likewise.
6316 (Output_section::set_final_data_size): Add patch space when
6317 doing --incremental-full.
6318 (Output_section::do_reset_address_and_file_offset): Remove patch
6319 space.
6320 (Output_segment::set_section_list_addresses): Print debug output
6321 only if --incremental-update.
6322 * output.h (Output_section::set_is_patch_space_allowed): New function.
6323 (Output_section::is_patch_space_allowed_): New data member.
6324 (Output_section::patch_space_): New data member.
6325 * parameters.cc (Parameters::incremental_full): New function.
6326 * parameters.h (Parameters::incremental_full): New function
6327 * testsuite/Makefile.am (incremental_test_2): Add test for
6328 --incremental-patch option.
6329 * testsuite/Makefile.in: Regenerate.
6330 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
6331 (t18): Remove function body.
6332
6333 2011-07-05 Doug Kwan <dougkwan@google.com>
6334
6335 PR gold/12771
6336 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
6337 Arm_Address type for relocation result.
6338 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
6339 overflow check.
6340 (Arm_relocate_functions::abs32): Use unaligned access.
6341 (Arm_relocate_functions::rel32): Ditto.
6342 (Arm_relocate_functions::prel31): Ditto.
6343 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
6344 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
6345 static data relocations.
6346 * testsuite/Makefile.in: Regnerate.
6347 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
6348
6349 2011-07-05 Ian Lance Taylor <iant@google.com>
6350
6351 PR gold/12392
6352 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
6353 symbols if necessary.
6354 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6355
6356 2011-07-05 Ian Lance Taylor <iant@google.com>
6357
6358 PR gold/12952
6359 * resolve.cc (Symbol::override_base_with_special): Simply override
6360 version with special symbol version, ignoring previous version.
6361
6362 2011-07-05 Ian Lance Taylor <iant@google.com>
6363
6364 * object.cc (Sized_relobj_file::include_section_group): Add
6365 information to comment about signature location.
6366
6367 2011-07-02 Ian Lance Taylor <iant@google.com>
6368
6369 PR gold/12957
6370 * options.h (class General_options): Add -f and -F.
6371 * options.cc (General_options::finalize): Fatal error if -f/-F
6372 are used without -shared.
6373 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
6374
6375 2011-07-02 Ian Lance Taylor <iant@google.com>
6376
6377 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
6378
6379 2011-07-01 Ian Lance Taylor <iant@google.com>
6380
6381 PR gold/12525
6382 PR gold/12952
6383 * resolve.cc (Symbol::override_base_with_special): Don't override
6384 the version if the overriding symbol has a different name.
6385 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
6386 all callers. If we give an error about an undefined version,
6387 define the base version if necessary.
6388 * dynobj.h (class Versions): Update declaration.
6389 * testsuite/weak_alias_test_5.cc: New file.
6390 * testsuite/weak_alias_test.script: New file.
6391 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
6392 and versioned_alias have the right value, and call t2.
6393 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
6394 weak_alias_test_5.so.
6395 (weak_alias_test_LDADD): Likewise.
6396 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
6397 * testsuite/Makefile.in: Rebuild.
6398
6399 2011-07-01 Ian Lance Taylor <iant@google.com>
6400
6401 PR gold/12525
6402 * options.h (class General_options): Support -z notext.
6403 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
6404 -Wl,-z,notext.
6405 (two_file_shared_nonpic.so): Likewise.
6406 (two_file_shared_mixed.so): Likewise.
6407 (two_file_shared_mixed_1.so): Likewise.
6408 (weak_undef_lib_nonpic.so): Likewise.
6409 (alt/weak_undef_lib_nonpic.so): Likewise.
6410 (tls_test_shared_nonpic.so): Likewise.
6411 * testsuite/Makefile.in: Rebuild.
6412
6413 2011-07-01 Ian Lance Taylor <iant@google.com>
6414
6415 PR gold/12525
6416 * configure.ac: Test whether static linking works, setting
6417 the automake conditional HAVE_STATIC.
6418 * testsuite/Makefile.am: Disable tests using -static if
6419 HAVE_STATIC is not true.
6420 * configure, testsuite/Makefile.in: Rebuild.
6421
6422 2011-07-01 Ian Lance Taylor <iant@google.com>
6423
6424 PR gold/12525
6425 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
6426 Assert if we see DW_EH_PE_indirect.
6427 * target.h (Target::ehframe_datarel_base): New function.
6428 (Target::do_ehframe_datarel_base): New target function.
6429 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
6430 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
6431 function.
6432
6433 2011-07-01 Ian Lance Taylor <iant@google.com>
6434
6435 PR gold/12571
6436 * options.h (class General_options): Add
6437 --ld-generated-unwind-info.
6438 * ehframe.cc (Fde::write): Add address parameter. Change all
6439 callers. If associated with PLT, fill in address and size.
6440 (Cie::set_output_offset): Only add merge mapping if there is an
6441 object.
6442 (Cie::write): Add address parameter. Change all callers.
6443 (Eh_frame::add_ehframe_for_plt): New function.
6444 * ehframe.h (class Fde): Update declarations. Move shndx_ and
6445 input_offset_ fields into union u_, with new plt field.
6446 (Fde::Fde): Adjust for new union field.
6447 (Fde::Fde) [Output_data version]: New constructor.
6448 (Fde::add_mapping): Only add merge mapping if there is an object.
6449 (class Cie): Update declarations.
6450 (class Eh_frame): Declare add_ehframe_for_plt.
6451 * layout.cc (Layout::layout_eh_frame): Break out code into
6452 make_eh_frame_section, and call it.
6453 (Layout::make_eh_frame_section): New function.
6454 (Layout::add_eh_frame_for_plt): New function.
6455 * layout.h (class Layout): Update declarations.
6456 * merge.cc (Merge_map::add_mapping): Add assertion.
6457 * i386.cc: Include "dwarf.h".
6458 (class Output_data_plt_i386): Make first_plt_entry,
6459 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
6460 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6461 and plt_eh_frame_fde.
6462 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
6463 boundary. Call add_eh_frame_for_plt if appropriate.
6464 * x86_64.cc: Include "dwarf.h".
6465 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
6466 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
6467 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6468 and plt_eh_frame_fde.
6469 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
6470 appropriate.
6471
6472 2011-06-29 Ian Lance Taylor <iant@google.com>
6473
6474 PR gold/12629
6475 * object.cc (Sized_relobj_file::layout_section): Change shdr
6476 parameter to be const.
6477 (Sized_relobj_file::layout_eh_frame_section): New function, broken
6478 out of do_layout.
6479 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
6480 appropriate. Call layout_eh_frame_section.
6481 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
6482 sections.
6483 * object.h (class Sized_relobj_file): Update declarations.
6484
6485 2011-06-29 Ian Lance Taylor <iant@google.com>
6486
6487 PR gold/12652
6488 * script.cc (Token::integer_value): Accept trailing M/m/K/k
6489 modifier.
6490 (Lex::gather_token): Accept trailing M/m/K/k for integers.
6491
6492 2011-06-29 Ian Lance Taylor <iant@google.com>
6493
6494 PR gold/12675
6495 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
6496 SHT_X86_64_UNWIND.
6497 * layout.cc (Layout::layout_eh_frame): Likewise.
6498
6499 2011-06-29 Ian Lance Taylor <iant@google.com>
6500
6501 PR gold/12695
6502 * layout.cc (Layout::symtab_section_shndx): New function.
6503 * layout.h (class Layout): Declare symtab_section_shndx.
6504 * output.cc (Output_section::write_header): Call it.
6505
6506 2011-06-29 Ian Lance Taylor <iant@google.com>
6507
6508 PR gold/12818
6509 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
6510 symbols which are not used in a relocation.
6511
6512 2011-06-28 Ian Lance Taylor <iant@google.com>
6513
6514 PR gold/12898
6515 * layout.cc (Layout::segment_precedes): Don't crash if a linker
6516 script create indistinguishable segments.
6517 (Layout::set_segment_offsets): Use stable_sort when sorting
6518 segments. Pass this to Compare_segments constructor.
6519 * layout.h (class Layout): Make segment_precedes non-static.
6520 (class Compare_segments): Change from struct to class. Add
6521 layout_ field. Add constructor.
6522 * script-sections.cc
6523 (Script_sections::attach_sections_using_phdrs_clause): Rename
6524 local orphan to is_orphan. Don't report failure to put empty
6525 section in segment. On attachment failure, report name of
6526 section, and attach to first PT_LOAD segment.
6527
6528 2011-06-28 Ian Lance Taylor <iant@google.com>
6529
6530 PR gold/12934
6531 * target-select.cc (Target_selector::Target_selector): Add
6532 emulation parameter. Change all callers.
6533 (select_target_by_bfd_name): Rename from select_target_by_name.
6534 Change all callers.
6535 (select_target_by_emulation): New function.
6536 (supported_emulation_names): New function.
6537 * target-select.h (class Target_selector): Add emulation_ field.
6538 Update declarations.
6539 (Target_selector::recognize_by_bfd_name): Rename from
6540 recognize_by_name. Change all callers.
6541 (Target_selector::supported_bfd_names): Rename from
6542 supported_names. Change all callers.
6543 (Target_selector::recognize_by_emulation): New function.
6544 (Target_selector::supported_emulations): New function.
6545 (Target_selector::emulation): New function.
6546 (Target_selector::do_recognize_by_bfd_name): Rename from
6547 do_recognize_by_name. Change all callers.
6548 (Target_selector::do_supported_bfd_names): Rename from
6549 do_supported_names. Change all callers.
6550 (Target_selector::do_recognize_by_emulation): New function.
6551 (Target_selector::do_supported_emulations): New function.
6552 (select_target_by_bfd_name): Change name in declaration.
6553 (select_target_by_emulation): Declare.
6554 (supported_emulation_names): Declare.
6555 * parameters.cc (parameters_force_valid_target): Try to find
6556 target based on emulation from -m option.
6557 * options.h (class General_options): Change doc string for -m.
6558 * options.cc (help): Print emulations.
6559 (General_options::parse_V): Likewise.
6560 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
6561 Add emulation parameter. Change all callers.
6562
6563 2011-06-28 Ian Lance Taylor <iant@google.com>
6564
6565 * target.h (class Target): Add osabi_ field.
6566 (Target::osabi): New function.
6567 (Target::set_osabi): New function.
6568 (Target::Target): Initialize osabi_.
6569 (Target::do_adjust_elf_header): Make pure virtual.
6570 (Sized_target::do_adjust_elf_header): Declare.
6571 * target.cc (Sized_target::do_adjust_elf_header): New function.
6572 (class Sized_target): Instantiate all versions.
6573 * freebsd.h (class Target_freebsd): Remove.
6574 (Target_selector_freebsd::do_recognize): Call set_osabi on
6575 Target.
6576 (Target_selector_freebsd::do_recognize_by_name): Likewise.
6577 (Target_selector_freebsd::set_osabi): Remove.
6578 * i386.cc (class Target_i386): Inherit from Sized_target rather
6579 than Target_freebsd.
6580 * x86_64.cc (class Target_x86_64): Likewise.
6581
6582 2011-06-28 Ian Lance Taylor <iant@google.com>
6583
6584 * target.h (Target::can_check_for_function_pointers): Rewrite.
6585 Make non-virtual.
6586 (Target::can_icf_inline_merge_sections): Likewise.
6587 (Target::section_may_have_icf_unsafe_poineters): Likewise.
6588 (Target::Target_info): Add can_icf_inline_merge_sections field.
6589 (Target::do_can_check_for_function_pointers): New virtual
6590 function.
6591 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
6592 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
6593 from can_check_for_function_pointers, move in file.
6594 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
6595 section_may_have_icf_unsafe_poineters, move in file.
6596 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
6597 * i386.cc (Target_i386::do_can_check_for_function_pointers):
6598 Rename from can_check_for_function_pointers, move in file.
6599 (Target_i386::can_icf_inline_merge_sections): Remove.
6600 (Target_i386::i386_info): Initialize
6601 can_icf_inline_merge_sections.
6602 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6603 Initialize can_icf_inline_merge_sections.
6604 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
6605 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
6606 Rename from can_check_for_function_pointers, move in file.
6607 (Target_x86_64::can_icf_inline_merge_sections): Remove.
6608 (Target_x86_64::x86_64_info): Initialize
6609 can_icf_inline_merge_sections.
6610 * testsuite/testfile.cc (Target_test::test_target_info):
6611 Likewise.
6612 * icf.cc (get_section_contents): Correct formatting.
6613
6614 2011-06-27 Ian Lance Taylor <iant@google.com>
6615
6616 * symtab.cc (Symbol::versioned_name): New function.
6617 (Symbol_table::add_to_final_symtab): Use versioned_name when
6618 appropriate.
6619 (Symbol_table::sized_write_symbol): Likewise.
6620 * symtab.h (class Symbol): Declare versioned_name.
6621 * stringpool.h (class Stringpool_template): Add variant of add
6622 which takes a std::basic_string.
6623 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
6624 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
6625 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
6626 (ver_test_12.o): New target.
6627 * testsuite/Makefile.in: Rebuild.
6628
6629 2011-06-27 Doug Kwan <dougkwan@google.com>
6630
6631 * arm.cc (Arm_relocate_functions::thm_jump8,
6632 Arm_relocate_functions::thm_jump11): Use a wider signed
6633 type to compute offset.
6634 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
6635 arm_thm_jump8.
6636 * testsuite/Makefile.in: Regenerate.
6637 * testsuite/arm_branch_in_range.sh: Check test results of
6638 arm_thm_jump11 and arm_thm_jump8.
6639 * testsuite/arm_thm_jump11.s: New test source file.
6640 * testsuite/arm_thm_jump11.t: New linker script.
6641 * testsuite/arm_thm_jump8.s: New test source file.
6642 * testsuite/arm_thm_jump8.t: New linker script.
6643
6644 2011-06-24 Ian Lance Taylor <iant@google.com>
6645
6646 * layout.cc: Include "object.h".
6647 (ctors_sections_in_init_array): New static variable.
6648 (Layout::is_ctors_in_init_array): New function.
6649 (Layout::layout): Add entry to ctors_sections_in_init_array if
6650 appropriate.
6651 * layout.h (class Layout): Declare is_ctors_in_init_array.
6652 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
6653 is_ctors_reverse_view is set.
6654 (Sized_relobj_file::write_sections): Add layout parameter. Change
6655 all callers. Set is_ctors_reverse_view field of View_size.
6656 (Sized_relobj_file::reverse_words): New function.
6657 * object.h (Sized_relobj_file::View_size): Add
6658 is_ctors_reverse_view field.
6659 (class Sized_relobj_file): Update declarations.
6660 * testsuite/initpri3.c: New test.
6661 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
6662 initpri3b.
6663 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
6664 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
6665 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
6666 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
6667 * testsuite/Makefile.in: Rebuild.
6668
6669 2011-06-24 Cary Coutant <ccoutant@google.com>
6670
6671 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
6672 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
6673 (debug_msg_cdebug.err): New targets.
6674 * testsuite/Makefile.in: Regenerate.
6675 * testsuite/debug_msg.sh: Check output of link with compressed debug.
6676 Fix checks for link with shared library.
6677
6678 2011-06-24 Doug Kwan <dougkwan@google.com>
6679
6680 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
6681 skip empty text sections.
6682 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
6683
6684 2011-06-22 Ian Lance Taylor <iant@google.com>
6685
6686 PR gold/12910
6687 * options.h (class General_options): Add --ctors-in-init-array.
6688 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
6689 friends as SHT_PROGBITS for merging sections.
6690 (Layout::layout): Remove special handling of .init_array and
6691 friends. Don't sort if doing relocatable link. Sort for .ctors
6692 and .dtors if ctors_in_init_array.
6693 (Layout::make_output_section): Force correct section types for
6694 .init_array and friends. Don't sort if doing relocatable link,
6695 Don't sort .ctors and .dtors if ctors_in_init_array.
6696 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
6697 (Layout::output_section_name): Add relobj parameter. Change all
6698 callers. Handle .ctors. and .dtors. in code rather than table.
6699 Handle .ctors and .dtors if ctors_in_init_array.
6700 (Layout::match_file_name): New function, moved from output.cc.
6701 * layout.h (class Layout): Update declarations.
6702 * output.cc: Include "layout.h".
6703 (Input_section_sort_entry::get_priority): New function.
6704 (Input_section_sort_entry::match_file_name): Just call
6705 Layout::match_file_name.
6706 (Output_section::Input_section_sort_init_fini_compare::operator()):
6707 Handle .ctors and .dtors. Sort by explicit priority rather than
6708 by name.
6709 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
6710 * testsuite/initpri2.c: New test.
6711 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
6712 (check_PROGRAMS): Add initpri2.
6713 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
6714 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
6715 * configure, testsuite/Makefile.in: Rebuild.
6716
6717 2011-06-19 Ian Lance Taylor <iant@google.com>
6718
6719 PR gold/12880
6720 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
6721 .interp section to a PT_INTERP segment even if we have seen a
6722 --dynamic-linker option. Don't do it if we have seen a PHDRS
6723 clause in a linker script.
6724 (Layout::finalize): Don't create a .interp section if we've
6725 already create a PT_INTERP segment.
6726 (Layout::create_interp): Always call choose_output_section (revert
6727 patch of 2011-06-17). Don't create PT_INTERP segment.
6728 * script-sections.cc
6729 (Script_sections::create_note_and_tls_segments): Add a .interp
6730 section to a PT_INTERP segment even if we have seen a
6731 --dynamic-linker option.
6732
6733 2011-06-18 Ian Lance Taylor <iant@google.com>
6734
6735 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
6736 merely because a non-PT_LOAD segment has a dynamic reloc.
6737
6738 2011-06-18 Ian Lance Taylor <iant@google.com>
6739
6740 * layout.cc (Layout::finish_dynamic_section): Don't create
6741 DT_FLAGS entry if not needed.
6742
6743 2011-06-18 Ian Lance Taylor <iant@google.com>
6744
6745 PR gold/12745
6746 * layout.cc (Layout::layout_eh_frame): Correct handling of
6747 writable .eh_frame section.
6748
6749 2011-06-17 Ian Lance Taylor <iant@google.com>
6750
6751 PR gold/12893
6752 * resolve.cc (Symbol_table::resolve): Don't give an error if a
6753 symbol is redefined with the exact same object and value.
6754
6755 2011-06-17 Ian Lance Taylor <iant@google.com>
6756
6757 PR gold/12880
6758 * layout.h (class Layout): Add interp_segment_ field.
6759 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
6760 (Layout::attach_allocated_section_to_segment): If making shared
6761 library, put .interp section in PT_INTERP segment.
6762 (Layout::finalize): Also call create_interp if -dynamic-linker
6763 option was used.
6764 (Layout::create_interp): Assert that there is no PT_INTERP
6765 segment. If not using a SECTIONS clause, use make_output_section.
6766 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
6767 * script-sections.cc
6768 (Script_sections::create_note_and_tls_segments): If making shared
6769 library, put .interp section in PT_INTERP segment.
6770
6771 2011-06-17 Ian Lance Taylor <iant@google.com>
6772
6773 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
6774 when making a shared library.
6775
6776 2011-06-17 Ian Lance Taylor <iant@google.com>
6777
6778 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
6779 parameter. Change all callers. Don't issue warning about PC32
6780 against locally defined symbol.
6781
6782 2011-06-16 Ian Lance Taylor <iant@google.com>
6783
6784 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
6785 occurs in same object.
6786
6787 2011-06-14 Alan Modra <amodra@gmail.com>
6788
6789 * po/POTFILES.in: Regenerate.
6790
6791 2011-06-09 Ian Lance Taylor <iant@google.com>
6792
6793 * script-sections.cc
6794 (Orphan_output_section::set_section_addresses): For a relocatable
6795 link set address to 0.
6796
6797 2011-06-09 Cary Coutant <ccoutant@google.com>
6798
6799 PR gold/12804
6800 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
6801 used with --compress-debug-sections.
6802 * gold/object.cc (Sized_relobj_file::do_layout): Report
6803 uncompressed size of compressed input sections.
6804
6805 2011-06-08 Cary Coutant <ccoutant@google.com>
6806
6807 PR gold/12804
6808 * testsuite/two_file_test_2_v1.cc: Change initialization of
6809 v2 to keep it in .data.
6810
6811 2011-06-07 Cary Coutant <ccoutant@google.com>
6812
6813 * common.cc (Symbol_table::do_allocate_commons_list): Call
6814 gold_fallback.
6815 * errors.cc (Errors::fatal): Adjust call to gold_exit.
6816 (Errors::fallback): New function.
6817 (gold_fallback): New function.
6818 * errors.h (Errors::fallback): New function.
6819 * gold.cc (gold_exit): Change status parameter to enum; adjust
6820 all callers.
6821 (queue_initial_tasks): Call gold_fallback.
6822 * gold.h: Include cstdlib.
6823 (Exit_status): New enum type.
6824 (gold_exit): Change status parameter to enum.
6825 (gold_fallback): New function.
6826 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
6827 (Layout::create_symtab_sections): Likewise.
6828 (Layout::create_shdrs): Likewise.
6829 * main.cc (main): Adjust call to gold_exit.
6830 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
6831 (Output_data_got::add_got_entry_pair): Likewise.
6832 (Output_section::add_input_section): Likewise.
6833 (Output_section::add_output_section_data): Likewise.
6834 (Output_segment::set_section_list_addresses): Likewise.
6835 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
6836
6837 2011-06-07 Cary Coutant <ccoutant@google.com>
6838
6839 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
6840 for incremental links.
6841 * output.cc (Output_segment::set_section_list_addresses): Remove
6842 FIXME and test for TLS or BSS.
6843
6844 2011-06-07 Cary Coutant <ccoutant@google.com>
6845
6846 * testsuite/Makefile.am: Add incremental_copy_test,
6847 incremental_common_test_1.
6848 * testsuite/Makefile.in: Regenerate.
6849 * testsuite/common_test_1_v1.c: New source file.
6850 * testsuite/common_test_1_v2.c: New source file.
6851 * testsuite/copy_test_v1.cc: New source file.
6852
6853 2011-06-07 Cary Coutant <ccoutant@google.com>
6854
6855 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
6856 update, allocate common from bss section's free list.
6857 * incremental-dump.cc (dump_incremental_inputs): Print flag for
6858 linker-defined symbols.
6859 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
6860 Skip GOT and PLT entries that are no longer referenced.
6861 (Output_section_incremental_inputs::write_info_blocks): Mark
6862 linker-defined symbols.
6863 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
6864 * output.cc (Output_section::allocate): New function.
6865 * output.h (Output_section::allocate): New function.
6866 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
6867 linker-defined symbols.
6868 (Symbol::override_base_with_special): Copy is_predefined_ flag.
6869 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
6870 (Symbol::init_base_output_data): Likewise.
6871 (Symbol::init_base_output_segment): Likewise.
6872 (Symbol::init_base_constant): Likewise.
6873 (Sized_symbol::init_output_data): Likewise.
6874 (Sized_symbol::init_output_segment): Likewise.
6875 (Sized_symbol::init_constant): Likewise.
6876 (Symbol_table::do_define_in_output_data): Likewise.
6877 (Symbol_table::do_define_in_output_segment): Likewise.
6878 (Symbol_table::do_define_as_constant): Likewise.
6879 * symtab.h (Symbol::is_predefined): New function.
6880 (Symbol::init_base_output_data): Add is_predefined parameter.
6881 (Symbol::init_base_output_segment): Likewise.
6882 (Symbol::init_base_constant): Likewise.
6883 (Symbol::is_predefined_): New data member.
6884 (Sized_symbol::init_output_data): Add is_predefined parameter.
6885 (Sized_symbol::init_output_segment): Likewise.
6886 (Sized_symbol::init_constant): Likewise.
6887 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
6888
6889 2011-06-07 Cary Coutant <ccoutant@google.com>
6890
6891 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
6892 instead of emit_copy_reloc.
6893 (Copy_relocs::emit_copy_reloc): Refactor.
6894 (Copy_relocs::make_copy_reloc): New function.
6895 (Copy_relocs::add_copy_reloc): Remove.
6896 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
6897 section.
6898 (Copy_relocs::make_copy_reloc): New function.
6899 (Copy_relocs::add_copy_reloc): Remove.
6900 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
6901 unchanged input files.
6902 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
6903 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
6904 Reserve BSS space for COPY relocations.
6905 (Sized_incremental_binary::do_emit_copy_relocs): New function.
6906 (Output_section_incremental_inputs::write_info_blocks): Record
6907 whether a symbol is copied from a shared object.
6908 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
6909 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
6910 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
6911 (Incremental_input_entry_reader::get_output_symbol_index): Add
6912 is_copy parameter.
6913 (Incremental_binary::emit_copy_relocs): New function.
6914 (Incremental_binary::do_emit_copy_relocs): New function.
6915 (Sized_incremental_binary::Sized_incremental_binary): Initialize
6916 new data member.
6917 (Sized_incremental_binary::add_copy_reloc): New function.
6918 (Sized_incremental_binary::do_emit_copy_relocs): New function.
6919 (Sized_incremental_binary::Copy_reloc): New struct.
6920 (Sized_incremental_binary::Copy_relocs): New typedef.
6921 (Sized_incremental_binary::copy_relocs_): New data member.
6922 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
6923 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
6924 * target.h (Sized_target::emit_copy_reloc): New function.
6925 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
6926
6927 2011-06-02 Cary Coutant <ccoutant@google.com>
6928
6929 PR gold/12163
6930 * gold/archive.cc (Archive::Archive): Initialize new data member.
6931 (Archive::include_all_members): Return if archive has already been
6932 included.
6933 * gold/archive.h (Archive::include_all_members_): New data member.
6934
6935 2011-06-02 Nick Clifton <nickc@redhat.com>
6936
6937 * dynobj.h: Fix spelling mistake in comment.
6938 * output.cc: Likewise.
6939
6940 2011-05-31 Doug Kwan <dougkwan@google.com>
6941 Asier Llano
6942
6943 PR gold/12826
6944 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
6945 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
6946 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
6947 redundant arm_exidx_test.so.
6948 * testsuite/Makefile.in: Regenerate.
6949 (check_SCRIPTS): Add pr12826.sh
6950 (check_DATA): Add pr12826.stdout
6951 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
6952 * testsuite/pr12826.sh: New file.
6953 * testsuite/pr12826_1.s: Ditto.
6954 * testsuite/pr12826_1.s: Ditto.
6955
6956 2011-05-30 Ian Lance Taylor <iant@google.com>
6957
6958 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
6959 sections.
6960
6961 2011-05-29 Ian Lance Taylor <iant@google.com>
6962
6963 PR gold/12804
6964 * testsuite/Makefile.am: Use different file name for two_file_test
6965 temporary file for each incremental test.
6966 * testsuite/Makefile.in: Rebuild.
6967
6968 2011-05-29 Ian Lance Taylor <iant@google.com>
6969
6970 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
6971 binary input file is empty.
6972
6973 2011-05-27 Ian Lance Taylor <iant@google.com>
6974
6975 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
6976 (ver_test_9.so): Likewise.
6977 * testsuite/Makefile.in: Rebuild.
6978
6979 2011-05-26 Cary Coutant <ccoutant@google.com>
6980
6981 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
6982 * incremental.cc (Incremental_inputs::report_input_section): Fix
6983 comment, indentation.
6984 (Incremental_inputs::report_comdat_group): New function.
6985 (Output_section_incremental_inputs::set_final_data_size): Adjust size
6986 of data for incremental input file entry.
6987 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
6988 group count, COMDAT group signatures.
6989 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
6990 an unchanged input file.
6991 * incremental.h (Incremental_object_entry::Incremental_object_entry):
6992 Initialize new data member.
6993 (Incremental_object_entry::add_comdat_group): New function.
6994 (Incremental_object_entry::get_comdat_group_count): New function.
6995 (Incremental_object_entry::get_comdat_signature_key): New function.
6996 (Incremental_object_entry::groups_): New data member.
6997 (Incremental_inputs::report_comdat_group): New function.
6998 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
6999 data for incremental input file entry.
7000 (Incremental_input_entry_reader::get_comdat_group_count): New function.
7001 (Incremental_input_entry_reader::get_input_section): Adjust size of
7002 data for incremental input file entry.
7003 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
7004 (Incremental_input_entry_reader::get_comdat_group_signature): New
7005 function.
7006 * object.cc (Sized_relobj::include_section_group): Report kept
7007 COMDAT groups for incremental links.
7008
7009 2011-05-24 David Meyer <pdox@google.com>
7010
7011 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
7012 with name parameter. Add found_name parameter.
7013 * fileread.cc (Input_file::find_file): Adjust code accordingly.
7014 * dirsearch.h (class Dirsearch): Update declaration.
7015
7016 2011-05-24 Ian Lance Taylor <iant@google.com>
7017
7018 * archive.cc (Library_base::should_include_member): Pull in object
7019 from archive if it defines the entry symbol.
7020 * parameters.cc (Parameters::entry): New function.
7021 * parameters.h (class Parameters): Declare entry.
7022 * output.h (class Output_file_header): Remove entry_ field.
7023 * output.cc (Output_file_header::Output_file_header): Remove entry
7024 parameter. Change all callers.
7025 (Output_file_header::entry): Use parameters->entry.
7026 * gold.cc (queue_middle_tasks): Likewise.
7027 * plugin.cc (Plugin_hook::run): Likewise.
7028
7029 2011-05-24 Cary Coutant <ccoutant@google.com>
7030
7031 * gold.cc (queue_initial_tasks): Pass incremental base filename
7032 to Output_file::open_base_file; don't print error message.
7033 * incremental-dump.cc (main): Adjust call to
7034 Output_file::open_for_modification.
7035 * incremental-dump.cc (main): Likewise.
7036 * incremental.cc (Incremental_inputs::report_command_line):
7037 Ignore --incremental-base option when comparing command lines.
7038 Ignore parameter when given as separate argument.
7039 * options.h (class General_options): Add --incremental-base.
7040 * output.cc (Output_file::Output_file):
7041 (Output_file::open_base_file): Add base_name and writable parameters;
7042 read base file into new file; print error message here.
7043 (Output_file::map_no_anonymous): Add writable parameter; adjust all
7044 callers.
7045 * output.h (Output_file::open_for_modification): Rename to...
7046 (Output_file::open_base_file): ...this; add base_name and
7047 writable parameters; adjust all callers.
7048 (Output_file::map_no_anonymous): Add writable parameter; adjust all
7049 callers.
7050 * testsuite/Makefile.am (incremental_test_4): Test
7051 --incremental-base.
7052 * testsuite/Makefile.in: Regenerate.
7053
7054 2011-05-24 Cary Coutant <ccoutant@google.com>
7055
7056 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
7057 incremental_test_4.
7058 * testsuite/Makefile.in: Regenerate.
7059 * testsuite/two_file_test_1_v1.cc: New test source file.
7060 * testsuite/two_file_test_1b_v1.cc: New test source file.
7061 * testsuite/two_file_test_2_v1.cc: New test source file.
7062
7063 2011-05-24 Cary Coutant <ccoutant@google.com>
7064
7065 * dynobj.h (Dynobj::do_dynobj): New function.
7066 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
7067 flag and soname for shared objects.
7068 * incremental.cc (Incremental_inputs::report_object): Make
7069 either Incremental_object_entry or Incremental_dynobj_entry; add
7070 soname to string table.
7071 (Incremental_inputs::report_input_section): Add assertion.
7072 (Output_section_incremental_inputs::set_final_data_size): Adjust
7073 type of input file entry for shared libraries; adjust size of
7074 shared library info entry.
7075 (Output_section_incremental_inputs::write_input_files): Write
7076 as_needed flag for shared libraries.
7077 (Output_section_incremental_inputs::write_info_blocks): Adjust type
7078 of input file entry for shared libraries; write soname.
7079 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
7080 soname from incremental info.
7081 * incremental.h (enum Incremental_input_flags): Add
7082 INCREMENTAL_INPUT_AS_NEEDED.
7083 (Incremental_input_entry::Incremental_input_entry): Initialize new
7084 data member.
7085 (Incremental_input_entry::set_as_needed): New function.
7086 (Incremental_input_entry::as_needed): New function.
7087 (Incremental_input_entry::do_dynobj_entry): New function.
7088 (Incremental_input_entry::as_needed_): New data member.
7089 (Incremental_object_entry::Incremental_object_entry): Don't check
7090 for shared library.
7091 (Incremental_object_entry::do_type): Likewise.
7092 (class Incremental_dynobj_entry): New class.
7093 (Incremental_input_entry_reader::as_needed): New function.
7094 (Incremental_input_entry_reader::get_soname): New function.
7095 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
7096 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
7097 size of shared library info entry.
7098 * layout.cc (Layout::finish_dynamic_section): Don't test for
7099 incremental link when adding DT_NEEDED entries.
7100 * object.h (Object::Object): Initialize new data member.
7101 (Object::dynobj): New function.
7102 (Object::set_as_needed): New function.
7103 (Object::as_needed): New function.
7104 (Object::do_dynobj): New function.
7105 (Object::as_needed_): New data member.
7106
7107 2011-05-24 Cary Coutant <ccoutant@google.com>
7108
7109 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
7110 info; adjust display of GOT entries.
7111 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7112 vector of input objects; remove file_status_.
7113 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
7114 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
7115 got_plt reader; call target hooks to reserve GOT entries.
7116 (Output_section_incremental_inputs::set_final_data_size): Adjust size
7117 of input file info header and GOT info entry.
7118 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
7119 relocation info.
7120 (Got_plt_view_info::got_descriptor): Remove.
7121 (Got_plt_view_info::sym_index): New data member.
7122 (Got_plt_view_info::input_index): New data member.
7123 (Local_got_offset_visitor::visit): Write input file index.
7124 (Global_got_offset_visitor::visit): Write 0 for input file index.
7125 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
7126 with sym_index and input_index.
7127 (Output_section_incremental_inputs::write_got_plt): Adjust size of
7128 incremental info GOT entry; replace got_descriptor with input_index.
7129 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
7130 map from input file index to object.
7131 (Sized_relobj_incr::do_layout): Replace direct data member reference
7132 with accessor function.
7133 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
7134 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
7135 Adjust size of input file info header.
7136 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
7137 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
7138 (Incremental_input_entry_reader::get_input_section): Adjust size of
7139 input file info header.
7140 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
7141 of incremental info GOT entry.
7142 (Incremental_got_plt_reader::get_got_desc): Remove.
7143 (Incremental_got_plt_reader::get_got_symndx): New function.
7144 (Incremental_got_plt_reader::get_got_input_index): New function.
7145 (Sized_incremental_binary::Sized_incremental_binary): Remove
7146 file_status_; add input_objects_.
7147 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
7148 (Sized_incremental_binary::set_file_is_unchanged): Remove.
7149 (Sized_incremental_binary::file_is_unchanged): Remove.
7150 (Sized_incremental_binary::set_input_object): New function.
7151 (Sized_incremental_binary::input_object): New function.
7152 (Sized_incremental_binary::file_status_): Remove.
7153 (Sized_incremental_binary::input_objects_): New data member.
7154 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
7155 references.
7156 (Sized_relobj_incr::invalid_address): Move to base class.
7157 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
7158 class.
7159 (Sized_relobj_incr::do_output_section_offset): Likewise.
7160 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
7161 (Sized_relobj_incr::section_offsets_): Likewise.
7162 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
7163 function.
7164 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
7165 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
7166 with accessor function.
7167 (Sized_relobj_file::do_layout): Likewise.
7168 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
7169 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
7170 (Sized_relobj_file::compute_final_local_value): Replace refs to
7171 section_offsets_ with accessor function.
7172 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
7173 * object.h (Relobj::Relobj): Initialize new data members.
7174 (Relobj::add_dyn_reloc): New function.
7175 (Relobj::first_dyn_reloc): New function.
7176 (Relobj::dyn_reloc_count): New function.
7177 (Relobj::first_dyn_reloc_): New data member.
7178 (Relobj::dyn_reloc_count_): New data member.
7179 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
7180 references.
7181 (Sized_relobj::Address): New typedef.
7182 (Sized_relobj::invalid_address): Move here from child class.
7183 (Sized_relobj::Sized_relobj): Initialize new data members.
7184 (Sized_relobj::sized_relobj): New function.
7185 (Sized_relobj::is_output_section_offset_invalid): Move here from
7186 child class.
7187 (Sized_relobj::get_output_section_offset): Likewise.
7188 (Sized_relobj::local_has_got_offset): Likewise.
7189 (Sized_relobj::local_got_offset): Likewise.
7190 (Sized_relobj::set_local_got_offset): Likewise.
7191 (Sized_relobj::do_for_all_local_got_entries): Likewise.
7192 (Sized_relobj::clear_got_offsets): New function.
7193 (Sized_relobj::section_offsets): Move here from child class.
7194 (Sized_relobj::do_output_section_offset): Likewise.
7195 (Sized_relobj::do_set_section_offset): Likewise.
7196 (Sized_relobj::Local_got_offsets): Likewise.
7197 (Sized_relobj::local_got_offsets_): Likewise.
7198 (Sized_relobj::section_offsets_): Likewise.
7199 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
7200 references.
7201 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
7202 class.
7203 (Sized_relobj_file::sized_relobj): New function
7204 (Sized_relobj_file::local_has_got_offset): Move to base class.
7205 (Sized_relobj_file::local_got_offset): Likewise.
7206 (Sized_relobj_file::set_local_got_offset): Likewise.
7207 (Sized_relobj_file::get_output_section_offset): Likewise.
7208 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
7209 (Sized_relobj_file::do_output_section_offset): Likewise.
7210 (Sized_relobj_file::do_set_section_offset): Likewise.
7211 (Sized_relobj_file::Local_got_offsets): Likewise.
7212 (Sized_relobj_file::local_got_offsets_): Likewise.
7213 (Sized_relobj_file::section_offsets_): Likewise.
7214 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
7215 (all constructors).
7216 (set_needs_dynsym_index): Convert relobj to derived class pointer.
7217 (Output_reloc::get_symbol_index): Likewise.
7218 (Output_reloc::local_section_offset): Likewise.
7219 (Output_reloc::get_address): Likewise.
7220 (Output_reloc::symbol_value): Likewise.
7221 (Output_data_got::reserve_slot): Move to class definition.
7222 (Output_data_got::reserve_local): New function.
7223 (Output_data_got::reserve_slot_for_global): Remove.
7224 (Output_data_got::reserve_global): New function.
7225 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
7226 (all constructors, two instantiations).
7227 (Output_reloc::get_relobj): New function (two instantiations).
7228 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
7229 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
7230 (Output_data_reloc::add_global): Adjust type of relobj.
7231 (Output_data_reloc::add_global_relative): Likewise.
7232 (Output_data_reloc::add_symbolless_global_addend): Likewise.
7233 (Output_data_reloc::add_local): Likewise.
7234 (Output_data_reloc::add_local_relative): Likewise.
7235 (Output_data_reloc::add_symbolless_local_addend): Likewise.
7236 (Output_data_reloc::add_local_section): Likewise.
7237 (Output_data_reloc::add_output_section): Likewise.
7238 (Output_data_reloc::add_absolute): Likewise.
7239 (Output_data_reloc::add_target_specific): Likewise.
7240 (Output_data_got::reserve_slot): Move definition here.
7241 (Output_data_got::reserve_local): New function.
7242 (Output_data_got::reserve_global): New function.
7243 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
7244 section_offsets_ with accessor function.
7245 (Sized_relobj_file::write_sections): Likewise.
7246 (Sized_relobj_file::do_relocate_sections): Likewise.
7247 * target.h (Sized_target::reserve_local_got_entry): New function.
7248 (Sized_target::reserve_global_got_entry): New function.
7249 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
7250 (Target_x86_64::reserve_global_got_entry): New function.
7251 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
7252
7253 2011-05-23 Cary Coutant <ccoutant@google.com>
7254
7255 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
7256 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
7257 bit when checking got_type.
7258 * incremental.cc (Sized_incremental_binary::setup_readers):
7259 Store symbol table and string table locations; initialize bit vector
7260 of file status flags.
7261 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
7262 unchanged files.
7263 (Sized_incremental_binary::do_process_got_plt): New function.
7264 (Sized_incremental_binary::get_symtab_view): Use stored locations.
7265 (Output_section_incremental_inputs::set_final_data_size): Record
7266 file index for each input file.
7267 (Output_section_incremental_inputs::write_got_plt): Store file index
7268 instead of input entry offset for each GOT entry.
7269 * incremental.h
7270 (Incremental_input_entry::Incremental_input_entry): Initialize new
7271 data member.
7272 (Incremental_input_entry::set_offset): Store file index.
7273 (Incremental_input_entry::get_file_index): New function.
7274 (Incremental_input_entry::file_index_): New data member.
7275 (Incremental_binary::process_got_plt): New function.
7276 (Incremental_binary::do_process_got_plt): New function.
7277 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7278 data members.
7279 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
7280 (Sized_incremental_binary::set_file_is_unchanged): New function.
7281 (Sized_incremental_binary::file_is_unchanged): New function.
7282 (Sized_incremental_binary::do_process_got_plt): New function.
7283 (Sized_incremental_binary::file_status_): New data member.
7284 (Sized_incremental_binary::main_symtab_loc_): New data member.
7285 (Sized_incremental_binary::main_strtab_loc_): New data member.
7286 * output.cc (Output_data_got::Got_entry::write): Add case
7287 RESERVED_CODE.
7288 (Output_data_got::add_global): Call add_got_entry.
7289 (Output_data_got::add_global_plt): Likewise.
7290 (Output_data_got::add_global_with_rel): Likewise.
7291 (Output_data_got::add_global_with_rela): Likewise.
7292 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
7293 (Output_data_got::add_global_pair_with_rela): Likewise.
7294 (Output_data_got::add_local): Call add_got_entry.
7295 (Output_data_got::add_local_plt): Likewise.
7296 (Output_data_got::add_local_with_rel): Likewise.
7297 (Output_data_got::add_local_with_rela): Likewise.
7298 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
7299 (Output_data_got::add_local_pair_with_rela): Likewise.
7300 (Output_data_got::reserve_slot): New function.
7301 (Output_data_got::reserve_slot_for_global): New function.
7302 (Output_data_got::add_got_entry): New function.
7303 (Output_data_got::add_got_entry_pair): New function.
7304 (Output_section::add_output_section_data): Edit FIXME.
7305 * output.h
7306 (Output_section_data_build::Output_section_data_build): New
7307 constructor with size parameter.
7308 (Output_data_space::Output_data_space): Likewise.
7309 (Output_data_got::Output_data_got): Initialize new data member; new
7310 constructor with size parameter.
7311 (Output_data_got::add_constant): Call add_got_entry.
7312 (Output_data_got::reserve_slot): New function.
7313 (Output_data_got::reserve_slot_for_global): New function.
7314 (class Output_data_got::Got_entry): Add RESERVED_CODE.
7315 (Output_data_got::add_got_entry): New function.
7316 (Output_data_got::add_got_entry_pair): New function.
7317 (Output_data_got::free_list_): New data member.
7318 * target.h (Sized_target::init_got_plt_for_update): New function.
7319 (Sized_target::register_global_plt_entry): New function.
7320 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
7321 Initialize new data member; call init; add constructor with PLT count.
7322 (Output_data_plt_x86_64::init): New function.
7323 (Output_data_plt_x86_64::add_relocation): New function.
7324 (Output_data_plt_x86_64::reserve_slot): New function.
7325 (Output_data_plt_x86_64::free_list_): New data member.
7326 (Target_x86_64::init_got_plt_for_update): New function.
7327 (Target_x86_64::register_global_plt_entry): New function.
7328 (Output_data_plt_x86_64::add_entry): Allocate from free list for
7329 incremental updates.
7330 (Output_data_plt_x86_64::add_relocation): New function.
7331 * testsuite/object_unittest.cc (Object_test): Set default options.
7332
7333 2011-05-16 Ian Lance Taylor <iant@google.com>
7334
7335 * options.h (class General_options): Make -i a synonym for -r.
7336
7337 2011-05-16 Ian Lance Taylor <iant@google.com>
7338
7339 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
7340
7341 2011-05-10 Cary Coutant <ccoutant@google.com>
7342
7343 * object.cc (Sized_relobj::do_count_local_symbols): Check for
7344 strip_all (-s).
7345
7346 2011-05-06 Ian Lance Taylor <iant@google.com>
7347
7348 * layout.cc (Layout::layout): If the output section flags change,
7349 update the ordering.
7350
7351 2011-04-25 Cary Coutant <ccoutant@google.com>
7352
7353 * incremental-dump.cc (dump_incremental_inputs): Print local
7354 symbol info for each input file.
7355 * incremental.cc
7356 (Output_section_incremental_inputs::set_final_data_size): Add local
7357 symbol info to input file entries in incremental info.
7358 (Output_section_incremental_inputs::write_info_blocks): Likewise.
7359 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
7360 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
7361 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
7362 implementation.
7363 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
7364 (Sized_incr_relobj::do_relocate): Write the local symbols.
7365 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
7366 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
7367 Adjust size of input file header.
7368 (Incremental_inputs_reader::get_local_symbol_offset): New function.
7369 (Incremental_inputs_reader::get_local_symbol_count): New function.
7370 (Incremental_inputs_reader::get_input_section): Adjust size of input
7371 file header.
7372 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
7373 (Sized_incr_relobj::This): New typedef.
7374 (Sized_incr_relobj::sym_size): New const data member.
7375 (Sized_incr_relobj::Local_symbol): New struct.
7376 (Sized_incr_relobj::do_output_local_symbol_count): New function.
7377 (Sized_incr_relobj::do_local_symbol_offset): New function.
7378 (Sized_incr_relobj::local_symbol_count_): New data member.
7379 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
7380 (Sized_incr_relobj::local_symbol_index_): New data member.
7381 (Sized_incr_relobj::local_symbol_offset_): New data member.
7382 (Sized_incr_relobj::local_dynsym_offset_): New data member.
7383 (Sized_incr_relobj::local_symbols_): New data member.
7384 * object.h (Relobj::output_local_symbol_count): New function.
7385 (Relobj::local_symbol_offset): New function.
7386 (Relobj::do_output_local_symbol_count): New function.
7387 (Relobj::do_local_symbol_offset): New function.
7388 (Sized_relobj::do_output_local_symbol_count): New function.
7389 (Sized_relobj::do_local_symbol_offset): New function.
7390
7391 2011-04-22 Vladimir Simonov <sv@sw.ru>
7392
7393 * descriptors.cc (set_close_on_exec): New function.
7394 (Descriptors::open): Use set_close_on_exec.
7395 * output.cc (S_ISLNK): Define if not defined.
7396
7397 2011-04-22 Cary Coutant <ccoutant@google.com>
7398
7399 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7400 global symbol map.
7401 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7402 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
7403 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
7404 relocations.
7405 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
7406 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
7407 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
7408 * incremental.h
7409 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
7410 function.
7411 (Incremental_binary::apply_incremental_relocs): New function.
7412 (Incremental_binary::do_apply_incremental_relocs): New function.
7413 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7414 data member.
7415 (Sized_incremental_binary::add_global_symbol): New function.
7416 (Sized_incremental_binary::global_symbol): New function.
7417 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7418 (Sized_incremental_binary::symbol_map_): New data member.
7419 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
7420 * target.h (Sized_target::apply_relocation): New function.
7421 * target-reloc.h (apply_relocation): New function.
7422 * x86_64.cc (Target_x86_64::apply_relocation): New function.
7423
7424 2011-04-22 Doug Kwan <dougkwan@google.com>
7425
7426 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
7427 flag of a SHT_ARM_EXIDX section.
7428 * testsuite/Makefile.am (arm_exidx_test): New test rules.
7429 * testsuite/Makefile.in: Regenerate.
7430 * testsuite/arm_exidx_test.s: New file.
7431 * testsuite/arm_exidx_test.sh: Same.
7432
7433 2011-04-20 Cary Coutant <ccoutant@google.com>
7434
7435 PR gold/12689
7436 * archive.h (Incremental_archive_entry::Archive_member):
7437 Initialize arg_serial_ (second constructor).
7438
7439 2011-04-17 Ian Lance Taylor <iant@google.com>
7440
7441 * object.cc (Relocate_info::location): Simplify location string.
7442 * errors.cc (Errors::error_at_location): Don't print program
7443 name.
7444 (Errors::warning_at_location): Likewise.
7445 (Errors::undefined_symbol): Likewise.
7446 * testsuite/debug_msg.sh: Update accordingly.
7447
7448 2011-04-14 Cary Coutant <ccoutant@google.com>
7449
7450 * gold/layout.cc (Layout::symtab_section_offset): New function.
7451 * gold/layout.h (Layout::symtab_section_offset): New function.
7452 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
7453
7454 2011-04-12 Ian Lance Taylor <iant@google.com>
7455
7456 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
7457 with MREMAP_MAYMOVE.
7458 * output.h (class Output_file): Add map_is_allocated_ field.
7459 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
7460 not available, provide stubs. If mremap is not available, #define
7461 it to gold_mremap.
7462 (MREMAP_MAYMOVE): Define if not defined.
7463 (Output_file::Output_file): Initialize map_is_allocated_.
7464 (Output_file::resize): Check map_is_allocated_.
7465 (Output_file::map_anonymous): If mmap fails, use malloc.
7466 (Output_file::unmap): Don't do anything for an anonymous map.
7467 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
7468 is not available, provide stubs.
7469 (File_read::View::~View): Use free rather than delete[].
7470 (File_read::make_view): Use malloc rather than new[]. If mmap
7471 fails, use malloc.
7472 (File_read::find_or_make_view): Use malloc rather than new[].
7473 * gold.h: Remove HAVE_REMAP code.
7474 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
7475 exists. Rename mremap to gold_mremap. If mmap is not available
7476 don't do anything.
7477 * configure, config.in: Rebuild.
7478
7479 2011-04-11 Ian Lance Taylor <iant@google.com>
7480
7481 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
7482 initialize local variable v.
7483
7484 2011-04-11 Cary Coutant <ccoutant@google.com>
7485
7486 * archive.cc (Archive::include_member): Adjust call to
7487 report_object.
7488 (Add_archive_symbols::run): Track argument serial numbers.
7489 (Lib_group::include_member): Likewise.
7490 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
7491 * archive.h (Incremental_archive_entry::Archive_member):
7492 Initialize arg_serial_.
7493 (Archive_member::arg_serial_): New data member.
7494 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
7495 (Sized_dynobj::do_add_symbols): Track symbols when doing an
7496 incremental link.
7497 (Sized_dynobj::do_for_all_local_got_entries): New function.
7498 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
7499 function.
7500 * fileread.cc (get_mtime): New function.
7501 * fileread.h (get_mtime): New function.
7502 * gold.cc (queue_initial_tasks): Check for incremental update.
7503 (process_incremental_input): New function.
7504 (queue_middle_tasks): Don't force valid target for incremental
7505 update.
7506 * incremental-dump.cc (find_input_containing_global): Adjust
7507 size of symbol info entry.
7508 (dump_incremental_inputs): Dump argument serial number and
7509 in_system_directory flag; bias shndx by 1; print symbol names
7510 when dumping per-file symbol lists; use new symbol info readers.
7511 * incremental.cc
7512 (Output_section_incremental_inputs:update_data_size): New function.
7513 (Sized_incremental_binary::setup_readers): Setup input readers
7514 for each input file; build maps for files added from libraries
7515 and scripts.
7516 (Sized_incremental_binary::check_input_args): New function.
7517 (Sized_incremental_binary::do_check_inputs): Build map of argument
7518 serial numbers to input arguments.
7519 (Sized_incremental_binary::do_file_has_changed): Rename
7520 do_file_is_unchanged to this; compare file modification times.
7521 (Sized_incremental_binary::do_init_layout): New function.
7522 (Sized_incremental_binary::do_reserve_layout): New function.
7523 (Sized_incremental_binary::do_get_input_reader): Remove.
7524 (Sized_incremental_binary::get_symtab_view): New function.
7525 (Incremental_checker::can_incrementally_link_output_file): Remove.
7526 (Incremental_inputs::report_command_line): Exclude --debug options.
7527 (Incremental_inputs::report_archive_begin): Add parameter; track
7528 argument serial numbers; don't put input file entry for archive
7529 before archive members.
7530 (Incremental_inputs::report_archive_end): Put input file entry
7531 for archive after archive members.
7532 (Incremental_inputs::report_object): Add parameter; track argument
7533 serial numbers and in_system_directory flag.
7534 (Incremental_inputs::report_script): Add parameter; track argument
7535 serial numbers.
7536 (Output_section_incremental_inputs::set_final_data_size): Adjust
7537 size of symbol info entry; check for forwarding symbols.
7538 (Output_section_incremental_inputs::write_input_files): Write
7539 in_system_directory flag and argument serial number.
7540 (Output_section_incremental_inputs::write_info_blocks): Map section
7541 indices between incremental info and original input file; store
7542 input section index for each symbol.
7543 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
7544 change operator() to visit().
7545 (class Global_got_offset_visitor): Likewise.
7546 (class Global_symbol_visitor_got_plt):
7547 (Output_section_incremental_inputs::write_got_plt): Use new visitor
7548 classes.
7549 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
7550 (Sized_incr_relobj::do_read_symbols): New function.
7551 (Sized_incr_relobj::do_layout): New function.
7552 (Sized_incr_relobj::do_layout_deferred_sections): New function.
7553 (Sized_incr_relobj::do_add_symbols): New function.
7554 (Sized_incr_relobj::do_should_include_member): New function.
7555 (Sized_incr_relobj::do_for_all_global_symbols): New function.
7556 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
7557 (Sized_incr_relobj::do_section_size): New function.
7558 (Sized_incr_relobj::do_section_name): New function.
7559 (Sized_incr_relobj::do_section_contents): New function.
7560 (Sized_incr_relobj::do_section_flags): New function.
7561 (Sized_incr_relobj::do_section_entsize): New function.
7562 (Sized_incr_relobj::do_section_address): New function.
7563 (Sized_incr_relobj::do_section_type): New function.
7564 (Sized_incr_relobj::do_section_link): New function.
7565 (Sized_incr_relobj::do_section_info): New function.
7566 (Sized_incr_relobj::do_section_addralign): New function.
7567 (Sized_incr_relobj::do_initialize_xindex): New function.
7568 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
7569 (Sized_incr_relobj::do_read_relocs): New function.
7570 (Sized_incr_relobj::do_gc_process_relocs): New function.
7571 (Sized_incr_relobj::do_scan_relocs): New function.
7572 (Sized_incr_relobj::do_count_local_symbols): New function.
7573 (Sized_incr_relobj::do_finalize_local_symbols): New function.
7574 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
7575 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
7576 (Sized_incr_relobj::do_relocate): New function.
7577 (Sized_incr_relobj::do_set_section_offset): New function.
7578 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
7579 (Sized_incr_dynobj::do_read_symbols): New function.
7580 (Sized_incr_dynobj::do_layout): New function.
7581 (Sized_incr_dynobj::do_add_symbols): New function.
7582 (Sized_incr_dynobj::do_should_include_member): New function.
7583 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
7584 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
7585 (Sized_incr_dynobj::do_section_size): New function.
7586 (Sized_incr_dynobj::do_section_name): New function.
7587 (Sized_incr_dynobj::do_section_contents): New function.
7588 (Sized_incr_dynobj::do_section_flags): New function.
7589 (Sized_incr_dynobj::do_section_entsize): New function.
7590 (Sized_incr_dynobj::do_section_address): New function.
7591 (Sized_incr_dynobj::do_section_type): New function.
7592 (Sized_incr_dynobj::do_section_link): New function.
7593 (Sized_incr_dynobj::do_section_info): New function.
7594 (Sized_incr_dynobj::do_section_addralign): New function.
7595 (Sized_incr_dynobj::do_initialize_xindex): New function.
7596 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
7597 (make_sized_incremental_object): New function.
7598 (Incremental_library::copy_unused_symbols): New function.
7599 (Incremental_library::do_for_all_unused_symbols): New function.
7600 * incremental.h (enum Incremental_input_flags): New type.
7601 (class Incremental_checker): Remove.
7602 (Incremental_input_entry::Incremental_input_entry): Add argument
7603 serial number.
7604 (Incremental_input_entry::arg_serial): New function.
7605 (Incremental_input_entry::set_is_in_system_directory): New function.
7606 (Incremental_input_entry::is_in_system_directory): New function.
7607 (Incremental_input_entry::arg_serial_): New data member.
7608 (Incremental_input_entry::is_in_system_directory_): New data member.
7609 (class Script_info): Move here from script.h.
7610 (Script_info::Script_info): Add filename parameter.
7611 (Script_info::filename): New function.
7612 (Script_info::filename_): New data member.
7613 (Incremental_script_entry::Incremental_script_entry): Add argument
7614 serial number.
7615 (Incremental_object_entry::Incremental_object_entry): Likewise.
7616 (Incremental_object_entry::add_input_section): Build list of input
7617 sections with map to original shndx.
7618 (Incremental_object_entry::get_input_section_index): New function.
7619 (Incremental_object_entry::shndx_): New data member.
7620 (Incremental_object_entry::name_key_): Rename; adjust all refs.
7621 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
7622 (Incremental_archive_entry::Incremental_archive_entry): Add argument
7623 serial number.
7624 (Incremental_inputs::report_archive_begin): Likewise.
7625 (Incremental_inputs::report_object): Likewise.
7626 (Incremental_inputs::report_script): Likewise.
7627 (class Incremental_global_symbol_reader): New class.
7628 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
7629 and store flags and input file type.
7630 (Incremental_input_entry_reader::arg_serial): New function.
7631 (Incremental_input_entry_reader::type): Extract type from flags.
7632 (Incremental_input_entry_reader::is_in_system_directory): New function.
7633 (Incremental_input_entry_reader::get_input_section_count): Call
7634 accessor function for type.
7635 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
7636 function for type; adjust size of global symbol entry.
7637 (Incremental_input_entry_reader::get_global_symbol_count): Call
7638 accessor function for type.
7639 (Incremental_input_entry_reader::get_object_count): Likewise.
7640 (Incremental_input_entry_reader::get_object_offset): Likewise.
7641 (Incremental_input_entry_reader::get_member_count): Likewise.
7642 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
7643 (Incremental_input_entry_reader::get_member_offset): Likewise.
7644 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
7645 (Incremental_input_entry_reader::Global_symbol_info): Remove.
7646 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
7647 (Incremental_input_entry_reader::get_global_symbol_reader): New
7648 function.
7649 (Incremental_input_entry_reader::get_output_symbol_index): New
7650 function.
7651 (Incremental_input_entry_reader::type_): Remove.
7652 (Incremental_input_entry_reader::flags_): New data member.
7653 (Incremental_inputs_reader::input_file_offset): New function.
7654 (Incremental_inputs_reader::input_file_index): New function.
7655 (Incremental_inputs_reader::input_file): Call input_file_offset.
7656 (Incremental_inputs_reader::input_file_at_offset): New function.
7657 (Incremental_relocs_reader::get_r_type): Reformat.
7658 (Incremental_relocs_reader::get_r_shndx): Reformat.
7659 (Incremental_relocs_reader::get_r_offset): Reformat.
7660 (Incremental_relocs_reader::data): New function.
7661 (Incremental_binary::Incremental_binary): Initialize new data members.
7662 (Incremental_binary::check_inputs): Add cmdline parameter.
7663 (Incremental_binary::file_is_unchanged): Remove.
7664 (Input_reader::arg_serial): New function.
7665 (Input_reader::get_unused_symbol_count): New function.
7666 (Input_reader::get_unused_symbol): New function.
7667 (Input_reader::do_arg_serial): New function.
7668 (Input_reader::do_get_unused_symbol_count): New function.
7669 (Input_reader::do_get_unused_symbol): New function.
7670 (Incremental_binary::input_file_count): New function.
7671 (Incremental_binary::get_input_reader): Change signature to use
7672 index instead of filename.
7673 (Incremental_binary::file_has_changed): New function.
7674 (Incremental_binary::get_input_argument): New function.
7675 (Incremental_binary::get_library): New function.
7676 (Incremental_binary::get_script_info): New function.
7677 (Incremental_binary::init_layout): New function.
7678 (Incremental_binary::reserve_layout): New function.
7679 (Incremental_binary::output_file): New function.
7680 (Incremental_binary::do_check_inputs): New function.
7681 (Incremental_binary::do_file_is_unchanged): Remove.
7682 (Incremental_binary::do_file_has_changed): New function.
7683 (Incremental_binary::do_init_layout): New function.
7684 (Incremental_binary::do_reserve_layout): New function.
7685 (Incremental_binary::do_input_file_count): New function.
7686 (Incremental_binary::do_get_input_reader): Change signature.
7687 (Incremental_binary::input_args_map_): New data member.
7688 (Incremental_binary::library_map_): New data member.
7689 (Incremental_binary::script_map_): New data member.
7690 (Sized_incremental_binary::Sized_incremental_binary): Initialize
7691 new data members.
7692 (Sized_incremental_binary::output_section): New function.
7693 (Sized_incremental_binary::inputs_reader): Add const.
7694 (Sized_incremental_binary::symtab_reader): Add const.
7695 (Sized_incremental_binary::relocs_reader): Add const.
7696 (Sized_incremental_binary::got_plt_reader): Add const.
7697 (Sized_incremental_binary::get_symtab_view): New function.
7698 (Sized_incremental_binary::Inputs_reader): New typedef.
7699 (Sized_incremental_binary::Input_entry_reader): New typedef.
7700 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
7701 (Sized_incremental_binary::do_file_is_unchanged): Remove.
7702 (Sized_incremental_binary::do_file_has_changed): New function.
7703 (Sized_incremental_binary::do_init_layout): New function.
7704 (Sized_incremental_binary::do_reserve_layout): New function.
7705 (Sized_input_reader::Inputs_reader): Remove.
7706 (Sized_input_reader::Input_entry_reader): Remove.
7707 (Sized_input_reader::do_arg_serial): New function.
7708 (Sized_input_reader::do_get_unused_symbol_count): New function.
7709 (Sized_input_reader::do_get_unused_symbol): New function.
7710 (Sized_incremental_binary::do_input_file_count): New function.
7711 (Sized_incremental_binary::do_get_input_reader): Change signature;
7712 use index instead of filename.
7713 (Sized_incremental_binary::section_map_): New data member.
7714 (Sized_incremental_binary::input_entry_readers_): New data member.
7715 (class Sized_incr_relobj): New class.
7716 (class Sized_incr_dynobj): New class.
7717 (make_sized_incremental_object): New function.
7718 (class Incremental_library): New class.
7719 * layout.cc (Free_list::num_lists): New static data member.
7720 (Free_list::num_nodes): New static data member.
7721 (Free_list::num_removes): New static data member.
7722 (Free_list::num_remove_visits): New static data member.
7723 (Free_list::num_allocates): New static data member.
7724 (Free_list::num_allocate_visits): New static data member.
7725 (Free_list::init): New function.
7726 (Free_list::remove): New function.
7727 (Free_list::allocate): New function.
7728 (Free_list::dump): New function.
7729 (Free_list::print_stats): New function.
7730 (Layout_task_runner::run): Resize output file for incremental updates.
7731 (Layout::Layout): Initialize new data members.
7732 (Layout::set_incremental_base): New function.
7733 (Layout::init_fixed_output_section): New function.
7734 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
7735 incremental updates.
7736 (Layout::create_gold_note): Do not create gold note section for
7737 incremental updates.
7738 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
7739 for incremental updates.
7740 (Layout::set_section_offsets): For incremental updates, allocate space
7741 from free list.
7742 (Layout::create_symtab_sections): Layout with offsets relative to
7743 start of section; for incremental updates, allocate space from free
7744 list.
7745 (Layout::create_shdrs): For incremental updates, allocate space from
7746 free list.
7747 (Layout::finish_dynamic_section): For incremental updates, do not
7748 check --as-needed (fixed in subsequent patch).
7749 * layout.h (class Free_list): New class.
7750 (Layout::set_incremental_base): New function.
7751 (Layout::incremental_base): New function.
7752 (Layout::init_fixed_output_section): New function.
7753 (Layout::allocate): New function.
7754 (Layout::incremental_base_): New data member.
7755 (Layout::free_list_): New data member.
7756 * main.cc (main): Print Free_list statistics.
7757 * object.cc (Relobj::finalize_incremental_relocs): Add
7758 clear_counts parameter; clear counts only when clear_counts is set.
7759 (Sized_relobj::Sized_relobj): Initialize new base class.
7760 (Sized_relobj::do_layout): Don't report special sections.
7761 (Sized_relobj::do_for_all_local_got_entries): New function.
7762 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
7763 symtab_off to all symbol table offsets.
7764 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
7765 * object.h (class Got_offset_list): Move to top of file.
7766 (Object::Object): Allow case where input_file == NULL.
7767 (Object::~Object): Likewise.
7768 (Object::input_file): Assert that input_file != NULL.
7769 (Object::lock): Allow case where input_file == NULL.
7770 (Object::unlock): Likewise.
7771 (Object::is_locked): Likewise.
7772 (Object::token): Likewise.
7773 (Object::release): Likewise.
7774 (Object::is_incremental): New function.
7775 (Object::get_mtime): New function.
7776 (Object::for_all_local_got_entries): New function.
7777 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
7778 (Object::set_is_in_system_directory): New function.
7779 (Object::is_in_system_directory): New function.
7780 (Object::do_is_incremental): New function.
7781 (Object::do_get_mtime): New function.
7782 (Object::do_for_all_local_got_entries): New function.
7783 (Object::is_in_system_directory_): New data member.
7784 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
7785 (class Sized_relobj_base): New class.
7786 (class Sized_relobj): Derive from Sized_relobj_base.
7787 (class Sized_relobj::Symbols): Redeclare from base class.
7788 (class Sized_relobj::local_got_offset_list): Remove.
7789 (class Sized_relobj::Output_sections): Redeclare from base class.
7790 (class Sized_relobj::do_for_all_local_got_entries): New function.
7791 (class Sized_relobj::write_local_symbols): Add offset parameter.
7792 (class Sized_relobj::local_symbol_offset_): Update comment.
7793 (class Sized_relobj::local_dynsym_offset_): Update comment.
7794 * options.cc (Input_arguments::add_file): Remove const.
7795 * options.h (Input_file_argument::Input_file_argument):
7796 Initialize arg_serial_ (all constructors).
7797 (Input_file_argument::set_arg_serial): New function.
7798 (Input_file_argument::arg_serial): New function.
7799 (Input_file_argument::arg_serial_): New data member.
7800 (Input_arguments::Input_arguments): Initialize file_count_.
7801 (Input_arguments::add_file): Remove const.
7802 (Input_arguments::number_of_input_files): New function.
7803 (Input_arguments::file_count_): New data member.
7804 (Command_line::number_of_input_files): Call
7805 Input_arguments::number_of_input_files.
7806 * output.cc (Output_segment_headers::Output_segment_headers):
7807 Set current size.
7808 (Output_section::Input_section::current_data_size): New function.
7809 (Output_section::Output_section): Initialize new data members.
7810 (Output_section::add_input_section): Don't do merge sections for
7811 an incremental link; allocate space from free list for an
7812 incremental update.
7813 (Output_section::add_output_section_data): Allocate space from
7814 free list for an incremental update.
7815 (Output_section::update_data_size): New function.
7816 (Output_section::set_fixed_layout): New function.
7817 (Output_section::reserve): New function.
7818 (Output_segment::set_section_addresses): Remove const.
7819 (Output_segment::set_section_list_addresses): Remove const; allocate
7820 space from free list for an incremental update.
7821 (Output_segment::set_offset): Adjust size of RELRO segment for an
7822 incremental update.
7823 * output.h (Output_data::current_data_size): Move here from
7824 child classes.
7825 (Output_data::pre_finalize_data_size): New function.
7826 (Output_data::update_data_size): New function.
7827 (Output_section_headers::update_data_size): new function.
7828 (Output_section_data_build::current_data_size): Move to Output_data.
7829 (Output_data_strtab::update_data_size): New function.
7830 (Output_section::current_data_size): Move to Output_data.
7831 (Output_section::set_fixed_layout): New function.
7832 (Output_section::has_fixed_layout): New function.
7833 (Output_section::reserve): New function.
7834 (Output_section::update_data_size): New function.
7835 (Output_section::has_fixed_layout_): New data member.
7836 (Output_section::free_list_): New data member.
7837 (Output_segment::set_section_addresses): Remove const.
7838 (Output_segment::set_section_list_addresses): Remove const.
7839 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
7840 New function.
7841 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
7842 New function.
7843 * readsyms.cc (Read_symbols::do_read_symbols): Add library
7844 parameter when calling Add_symbols constructor; store argument
7845 serial number for members of a lib group.
7846 (Add_symbols::locks): Allow case where token == NULL.
7847 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
7848 (Read_member::~Read_member): New function.
7849 (Read_member::is_runnable): New function.
7850 (Read_member::locks): New function.
7851 (Read_member::run): New function.
7852 (Check_script::~Check_script): New function.
7853 (Check_script::is_runnable): New function.
7854 (Check_script::locks): New function.
7855 (Check_script::run): New function.
7856 (Check_library::~Check_library): New function.
7857 (Check_library::is_runnable): New function.
7858 (Check_library::locks): New function.
7859 (Check_library::run): New function.
7860 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
7861 (Add_symbols::library_): New data member.
7862 (class Read_member): New class.
7863 (class Check_script): New class.
7864 (class Check_library): New class.
7865 * reloc.cc (Read_relocs::is_runnable): Allow case where
7866 token == NULL.
7867 (Read_relocs::locks): Likewise.
7868 (Scan_relocs::locks): Likewise.
7869 (Relocate_task::locks): Likewise.
7870 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
7871 to clear counters.
7872 (Sized_relobj::incremental_relocs_scan): Fix comment.
7873 (Sized_relobj::do_relocate): Pass output file offset to
7874 write_local_symbols.
7875 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
7876 from class declaration.
7877 * script.cc (read_input_script): Allocate Script_info; pass
7878 argument serial number to report_script.
7879 * script.h (class Script_info): Move to incremental.h.
7880 * symtab.cc (Symbol_table::add_from_incrobj): New function.
7881 * symtab.h (Symbol_table::add_from_incrobj): New function.
7882 (Symbol_table::set_file_offset): New function.
7883
7884 2011-04-05 Cary Coutant <ccoutant@google.com>
7885
7886 * incremental-dump.cc (dump_incremental_inputs): Change signature
7887 to take a Sized_incremental_binary; change caller. Use readers
7888 in Sized_incremental_binary.
7889 * incremental.cc
7890 (Sized_incremental_binary::find_incremental_inputs_sections):
7891 Rename do_find_incremental_inputs_sections to this.
7892 (Sized_incremental_binary::setup_readers): New function.
7893 (Sized_incremental_binary::do_check_inputs): Check
7894 has_incremental_info_ flag; move setup code to setup_readers;
7895 use input readers.
7896 (Sized_incremental_binary::do_file_is_unchanged): New function.
7897 (Sized_incremental_binary::do_get_input_reader): New function.
7898 * incremental.h (class Incremental_binary): Move to end of file.
7899 (Incremental_binary::file_is_unchanged): New function.
7900 (Incremental_binary::do_file_is_unchanged): New function.
7901 (Incremental_binary::Input_reader): New class.
7902 (Incremental_binary::get_input_reader): New function.
7903 (class Sized_incremental_binary): Move to end of file.
7904 (Sized_incremental_binary::Sized_incremental_binary): Setup the
7905 input section reader classes.
7906 (Sized_incremental_binary::has_incremental_info): New function.
7907 (Sized_incremental_binary::inputs_reader): New function.
7908 (Sized_incremental_binary::symtab_reader): New function.
7909 (Sized_incremental_binary::relocs_reader): New function.
7910 (Sized_incremental_binary::got_plt_reader): New function.
7911 (Sized_incremental_binary::do_file_is_unchanged): New function.
7912 (Sized_incremental_binary::Sized_input_reader): New class.
7913 (Sized_incremental_binary::get_input_reader): New function.
7914 (Sized_incremental_binary::find_incremental_inputs_sections):
7915 Rename do_find_incremental_inputs_sections to this.
7916 (Sized_incremental_binary::setup_readers): New function.
7917 (Sized_incremental_binary::has_incremental_info_): New data member.
7918 (Sized_incremental_binary::inputs_reader_): New data member.
7919 (Sized_incremental_binary::symtab_reader_): New data member.
7920 (Sized_incremental_binary::relocs_reader_): New data member.
7921 (Sized_incremental_binary::got_plt_reader_): New data member.
7922 (Sized_incremental_binary::current_input_file_): New data member.
7923
7924 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
7925
7926 PR gold/12640
7927 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
7928 violation.
7929
7930 2011-03-30 Cary Coutant <ccoutant@google.com>
7931
7932 * archive.cc (Archive::include_member): Adjust call to report_object.
7933 (Add_archive_symbols::run): Add script_info to call to
7934 report_archive_begin.
7935 (Lib_group::include_member): Adjust call to report_object.
7936 (Add_lib_group_symbols::run): Adjust call to report_object.
7937 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
7938 blocks. Add object count for script input files.
7939 * incremental.cc (Incremental_inputs::report_archive_begin): Add
7940 script_info parameter; change all callers.
7941 (Incremental_inputs::report_object): Add script_info parameter;
7942 change all callers.
7943 (Incremental_inputs::report_script): Store backpointer to
7944 incremental info entry.
7945 (Output_section_incremental_inputs::set_final_data_size): Record
7946 additional information for scripts.
7947 (Output_section_incremental_inputs::write_info_blocks): Likewise.
7948 * incremental.h (Incremental_script_entry::add_object): New function.
7949 (Incremental_script_entry::get_object_count): New function.
7950 (Incremental_script_entry::get_object): New function.
7951 (Incremental_script_entry::objects_): New data member; adjust
7952 constructor.
7953 (Incremental_inputs::report_archive_begin): Add script_info parameter.
7954 (Incremental_inputs::report_object): Add script_info parameter.
7955 (Incremental_inputs_reader::get_object_count): New function.
7956 (Incremental_inputs_reader::get_object_offset): New function.
7957 * options.cc (Input_arguments::add_file): Return reference to
7958 new input argument.
7959 * options.h (Input_argument::set_script_info): New function.
7960 (Input_argument::script_info): New function.
7961 (Input_argument::script_info_): New data member; adjust all
7962 constructors.
7963 (Input_file_group::add_file): Return reference to new input argument.
7964 (Input_file_lib::add_file): Likewise.
7965 (Input_arguments::add_file): Likewise.
7966 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
7967 * script.cc (Parser_closure::Parser_closure): Add script_info
7968 parameter; adjust all callers.
7969 (Parser_closure::script_info): New function.
7970 (Parser_closure::script_info_): New data member.
7971 (read_input_script): Report scripts earlier to incremental info.
7972 (script_add_file): Set script_info in Input_argument.
7973 (script_add_library): Likewise.
7974 * script.h (Script_options::Script_info): Rewrite class.
7975
7976 2011-03-29 Cary Coutant <ccoutant@google.com>
7977
7978 * archive.cc (Library_base::should_include_member): Move
7979 method here from class Archive.
7980 (Archive::Archive): Initialize base class.
7981 (Archive::should_include_member): Move to base class.
7982 (Archive::do_for_all_unused_symbols): New function.
7983 (Add_archive_symbols::run): Remove redundant access to
7984 incremental_inputs.
7985 (Lib_group::Lib_group): Initialize base class.
7986 (Lib_group::do_filename): New function.
7987 (Lib_group::include_member): Pass pointer to Lib_group to
7988 report_object.
7989 (Lib_group::do_for_all_unused_symbols): New function.
7990 (Add_lib_group_symbols::run): Report archive information for
7991 incremental links.
7992 * archive.h (class Library_base): New base class.
7993 (class Archive): Derive from Library_base.
7994 (Archive::filename): Move to base class.
7995 (Archive::set_incremental_info): Likewise.
7996 (Archive::incremental_info): Likewise.
7997 (Archive::Should_include): Likewise.
7998 (Archive::should_include_member): Likewise.
7999 (Archive::Armap_entry): Remove.
8000 (Archive::Unused_symbol_iterator): Remove.
8001 (Archive::unused_symbols_begin): Remove.
8002 (Archive::unused_symbols_end): Remove.
8003 (Archive::do_filename): New function.
8004 (Archive::do_get_mtime): New function.
8005 (Archive::do_for_all_unused_symbols): New function.
8006 (Archive::task_): Move to base class.
8007 (Archive::incremental_info_): Likewise.
8008 (class Lib_group): Derive from Library_base.
8009 (Lib_group::do_filename): New function.
8010 (Lib_group::do_get_mtime): New function.
8011 (Lib_group::do_for_all_unused_symbols): New function.
8012 (Lib_group::task_): Move to base class.
8013 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
8014 function.
8015 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
8016 function.
8017 * incremental.cc (Incremental_inputs::report_archive_begin):
8018 Use Library_base; call library's get_mtime; add incremental inputs
8019 entry before members.
8020 (class Unused_symbol_visitor): New class.
8021 (Incremental_inputs::report_archive_end): Use Library_base; use
8022 visitor class to record unused symbols; don't add incremental inputs
8023 entry after members.
8024 (Incremental_inputs::report_object): Use Library_base.
8025 * incremental.h
8026 (Incremental_archive_entry::Incremental_archive_entry): Remove
8027 unused Archive parameter.
8028 (Incremental_inputs::report_archive_begin): Use Library_base.
8029 (Incremental_inputs::report_archive_end): Likewise.
8030 (Incremental_inputs::report_object): Likewise.
8031 * object.cc (Sized_relobj::do_for_all_global_symbols): New
8032 function.
8033 * object.h (Object::for_all_global_symbols): New function.
8034 (Object::do_for_all_global_symbols): New function.
8035 (Sized_relobj::do_for_all_global_symbols): New function.
8036 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
8037 function.
8038 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
8039 function.
8040
8041 2011-03-27 Ian Lance Taylor <iant@google.com>
8042
8043 * archive.cc (Archive::interpret_header): Return -1 if something
8044 goes wrong. Change callers accordingly.
8045
8046 2011-03-25 Cary Coutant <ccoutant@google.com>
8047
8048 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
8049 * testsuite/Makefile.in: Regenerate.
8050
8051 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
8052
8053 * plugin.cc (get_view): New.
8054 (Plugin::load): Pass get_view to the plugin.
8055 (Plugin_manager::get_view): New.
8056
8057 2011-03-21 Ian Lance Taylor <iant@google.com>
8058
8059 * testsuite/final_layout.sh: Rewrite to not use dc.
8060 * testsuite/relro_test.sh: Fail if dc is not present.
8061
8062 2011-03-21 Sriraman Tallam <tmsriram@google.com>
8063
8064 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
8065 Change == to -eq.
8066 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
8067 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
8068 Change == to -eq.
8069 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
8070 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
8071
8072 2011-03-14 Ian Lance Taylor <iant@google.com>
8073
8074 * script-sections.cc (Sort_output_sections::script_compare):
8075 Rename from is_before, change return type.
8076 (Sort_output_sections::operator()): Adjust accordingly.
8077
8078 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
8079
8080 PR gold/12572
8081 * testsuite/odr_violation2.cc: Add comment to make all error line
8082 numbers double digits.
8083 * testsuite/debug_msg.sh: Adjust expected errors.
8084
8085 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
8086
8087 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
8088 but mark earlier ones as non-canonical
8089 (offset_to_iterator): Update search target and example
8090 (do_addr2line): Return extra lines in a vector*
8091 (format_file_lineno): Extract from do_addr2line
8092 (one_addr2line): Add vector* out-param
8093 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
8094 when a lineno entry appeared last for its instruction
8095 (Dwarf_line_info): Add vector* out-param
8096 * object.cc (Relocate_info): Pass NULL for the vector* out-param
8097 * symtab.cc (Odr_violation_compare): Include the lineno in the
8098 comparison again.
8099 (linenos_from_loc): New. Combine the canonical line for an
8100 address with its other lines.
8101 (True_if_intersect): New. Helper functor to make
8102 std::set_intersection a query.
8103 (detect_odr_violations): Compare sets of lines instead of just
8104 one line for each function. This became less deterministic, but
8105 has fewer false positives.
8106 * symtab.h: Declarations.
8107 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
8108 mix an optimized and non-optimized object in the same binary
8109 (odr_violation2.so): Same.
8110 * testsuite/Makefile.in: Regenerate from Makefile.am.
8111 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
8112 * testsuite/debug_msg.sh: Update line numbers and add
8113 assertions.
8114 * testsuite/odr_violation1.cc: Use OdrDerived, in a
8115 non-optimized context.
8116 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
8117 isn't inlined, and use OdrDerived in an optimized context.
8118 * testsuite/odr_header1.h: Defines OdrDerived, where
8119 optimization will change the
8120 first-instruction-in-the-destructor's file and line number.
8121 * testsuite/odr_header2.h: Defines OdrBase.
8122
8123 2011-03-09 Ian Lance Taylor <iant@google.com>
8124
8125 * fileread.cc (File_read::clear_views): Don't delete the whole
8126 file view.
8127
8128 2011-03-08 Ian Lance Taylor <iant@google.com>
8129
8130 PR gold/12525
8131 * fileread.cc: #include <climits>.
8132 (GOLD_IOV_MAX): Define.
8133 (File_read::read_multiple): Limit number of entries by iov_max.
8134 * fileread.h (class File_read): Always set max_readv_entries to
8135 128.
8136
8137 2011-03-07 Ian Lance Taylor <iant@google.com>
8138
8139 PR gold/12525
8140 * options.h (class General_options): Add -dy and -dn.
8141
8142 2011-03-02 Cary Coutant <ccoutant@google.com>
8143
8144 * testsuite/script_test_9.t: Add TLS segment.
8145
8146 2011-03-02 Simon Baldwin <simonb@google.com>
8147
8148 * configure.ac: Add check for gnu_indirect_function support in
8149 the toolchain building binutils.
8150 * configure: Rebuild.
8151
8152 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
8153
8154 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
8155 plugin only symbols.
8156 (Symbol_table::sized_finalize_symbol) Mark symbol only present
8157 in plugin files as not needed in the symbol table.
8158
8159 2011-02-11 Sriraman Tallam <tmsriram@google.com>
8160
8161 * output.cc (Output_section::add_input_section): Delay fill
8162 generation for section ordering.
8163
8164 2011-02-09 Ian Lance Taylor <iant@google.com>
8165
8166 PR gold/12316
8167 * object.h (class Sized_relobj): Remove clear_local_symbols.
8168 * reloc.cc (Sized_relobj::do_relocate): Don't call
8169 clear_local_symbols.
8170
8171 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
8172
8173 * plugin.cc (is_visible_from_outside): Return true for symbols
8174 in the -u option.
8175
8176 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
8177
8178 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
8179 filename.
8180
8181 2011-02-02 Sriraman Tallam <tmsriram@google.com>
8182
8183 * icf.h (is_section_foldable_candidate): Change type of parameter
8184 to std::string.
8185 * icf.cc (Icf::find_identical_sections): Change type of local variable
8186 section_name to be std::string.
8187 (is_function_ctor_or_dtor): Change type of parameter to std::string.
8188
8189 2011-01-25 Ian Lance Taylor <iant@google.com>
8190
8191 * script.cc (script_add_extern): Rewrite to use
8192 add_symbol_reference.
8193
8194 2011-01-25 Doug Kwan <dougkwan@google.com>
8195
8196 * icf.cc (get_section_contents): Always lock section's object.
8197
8198 2011-01-24 Ian Lance Taylor <iant@google.com>
8199
8200 * options.h (class General_options): Accept
8201 --no-detect-odr-violations.
8202
8203 2011-01-24 Ian Lance Taylor <iant@google.com>
8204
8205 * version.cc (version_string): Bump to 1.11.
8206
8207 2011-01-24 Ian Lance Taylor <iant@google.com>
8208
8209 * plugin.cc (class Plugin_rescan): Define new class.
8210 (Plugin_manager::claim_file): Set any_claimed_.
8211 (Plugin_manager::save_archive): New function.
8212 (Plugin_manager::save_input_group): New function.
8213 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
8214 necessary.
8215 (Plugin_manager::new_undefined_symbol): New function.
8216 (Plugin_manager::rescan): New function.
8217 (Plugin_manager::rescannable_defines): New function.
8218 (Plugin_manager::add_input_file): Set any_added_.
8219 * plugin.h (class Plugin_manager): define new fields rescannable_,
8220 undefined_symbols_, any_claimed_, and any_added_. Declare
8221 Plugin_rescan as friend. Declare new functions.
8222 (Plugin_manager::Rescannable): Define type.
8223 (Plugin_manager::Rescannable_list): Define type.
8224 (Plugin_manager::Undefined_symbol_list): Define type.
8225 (Plugin_manager::Plugin_manager): Initialize new fields.
8226 * archive.cc (Archive::defines_symbol): New function.
8227 (Add_archive_symbols::run): Pass archive to plugins if any.
8228 * archive.h (class Archive): Declare defines_symbol.
8229 * readsyms.cc (Input_group::~Input_group): New function.
8230 (Finish_group::run): Pass input_group to plugins if any.
8231 * readsyms.h (class Input_group): Declare destructor.
8232 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
8233 any.
8234
8235 2011-01-10 Ian Lance Taylor <iant@google.com>
8236
8237 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
8238 section as relro.
8239 (Layout::set_segment_offsets): Reset increase_relro before calling
8240 set_section_addresses a second time.
8241
8242 2011-01-04 Cary Coutant <ccoutant@google.com>
8243
8244 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
8245 sections before NOBITS sections.
8246
8247 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
8248
8249 * version.cc (print_version): Update copyright to 2011.
8250
8251 2010-12-23 Cary Coutant <ccoutant@google.com>
8252
8253 * output.h (Output_data_reloc::add_output_section): Pass OD instead
8254 of OS to this->add. Add OD parameter to second form of the function.
8255
8256 2010-12-20 Ian Lance Taylor <iant@google.com>
8257
8258 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
8259 second of two consecutive entries with same offset.
8260
8261 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8262
8263 * testsuite/Makefile.am (ifuncmain2static_LDADD)
8264 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
8265 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
8266 to avoid unneeded links against $(LDADD).
8267 * testsuite/Makefile.in: Regenerate.
8268
8269 2010-12-15 Ian Lance Taylor <iant@google.com>
8270
8271 PR gold/12324
8272 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
8273 for R_X86_64_32 and R_X86_64_PC32.
8274 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
8275 ver_matching_def_pic.o.
8276 (ver_matching_def_pic.o): New target.
8277
8278 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8279
8280 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
8281 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
8282 Move definition before File_read::View member definitions.
8283 (File_read::View::~View): Initialize and hold lock before
8284 updating current_mapped_bytes.
8285
8286 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8287
8288 * dwarf_reader.cc: Remove outdated comment.
8289 * gold-threads.cc: Fix typo in error message.
8290 * archive.cc: Fix typos in comments.
8291 * archive.h: Likewise.
8292 * arm-reloc-property.cc: Likewise.
8293 * arm-reloc-property.h: Likewise.
8294 * arm-reloc.def: Likewise.
8295 * arm.cc: Likewise.
8296 * attributes.h: Likewise.
8297 * cref.cc: Likewise.
8298 * ehframe.cc: Likewise.
8299 * fileread.h: Likewise.
8300 * gold.h: Likewise.
8301 * i386.cc: Likewise.
8302 * icf.cc: Likewise.
8303 * incremental.h: Likewise.
8304 * int_encoding.cc: Likewise.
8305 * layout.h: Likewise.
8306 * main.cc: Likewise.
8307 * merge.h: Likewise.
8308 * object.cc: Likewise.
8309 * object.h: Likewise.
8310 * options.cc: Likewise.
8311 * readsyms.cc: Likewise.
8312 * reduced_debug_output.cc: Likewise.
8313 * reloc.cc: Likewise.
8314 * script-sections.cc: Likewise.
8315 * sparc.cc: Likewise.
8316 * symtab.h: Likewise.
8317 * target-reloc.h: Likewise.
8318 * target.cc: Likewise.
8319 * target.h: Likewise.
8320 * timer.cc: Likewise.
8321 * timer.h: Likewise.
8322 * x86_64.cc: Likewise.
8323
8324 2010-12-09 Cary Coutant <ccoutant@google.com>
8325
8326 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
8327 stack.
8328 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
8329 parameter; change all callers.
8330 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
8331 * options.h (warn_execstack): New option.
8332
8333 2010-12-07 Doug Kwan <dougkwan@google.com>
8334
8335 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
8336 like function call relocations.
8337
8338 2010-12-07 Ian Lance Taylor <iant@google.com>
8339
8340 * archive.cc (Archive::get_elf_object_for_member): Permit
8341 punconfigured to be NULL.
8342 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
8343 (Archive::include_member): Pass NULL to get_elf_object_for_member
8344 if we searched for the archive and this is the first included
8345 object.
8346
8347 2010-12-01 Ian Lance Taylor <iant@google.com>
8348
8349 * dwarf_reader.h (class Sized_dwarf_line_info): Add
8350 track_relocs_type_ field.
8351 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8352 Set track_relocs_type_.
8353 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
8354 contents when using RELA relocs.
8355 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
8356 reloc_map_.
8357 * reloc.cc (Track_relocs::next_addend): New function.
8358 * reloc.h (class Track_relocs): Declare next_addend.
8359
8360 2010-12-01 Ian Lance Taylor <iant@google.com>
8361
8362 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
8363 virtual destructor.
8364
8365 2010-12-01 Ian Lance Taylor <iant@google.com>
8366
8367 * README: Update compilers known to work and fail.
8368
8369 2010-11-23 Matthias Klose <doko@ubuntu.com>
8370
8371 * configure.in: For --enable-gold, handle value `default' instead of
8372 `both*'. Always install ld as ld.bfd, install as ld if gold is
8373 not the default.
8374 * configure: Regenerate.
8375
8376 2010-11-18 Doug Kwan <dougkwan@google.com>
8377
8378 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
8379 and right_alignment to be zero. Store result alignment only if it is
8380 greater than existing alignment.
8381
8382 2010-11-16 Cary Coutant <ccoutant@google.com>
8383
8384 PR gold/12220
8385 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8386 Check for ".zdebug_line".
8387
8388 2010-11-16 Doug Kwan <dougkwan@google.com>
8389 Cary Coutant <ccoutant@google.com>
8390
8391 * output.h (Output_segment::set_section_addresses): Pass increase_relro
8392 by reference; adjust all callers.
8393 * output.cc (Output_segment::set_section_addresses): Adjust references
8394 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
8395 list is empty.
8396 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
8397 end at page boundary.
8398
8399 2010-11-16 Cary Coutant <ccoutant@google.com>
8400
8401 PR gold/12220
8402 * layout.cc (Layout::choose_output_section): Transform names of
8403 compressed sections even when using a script with a SECTIONS clause.
8404 (Layout::output_section_name): Remove code to transform
8405 compressed debug section names.
8406 * output.cc (Output_section::add_input_section): Use uncompressed
8407 section size when tracking input sections.
8408
8409 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
8410
8411 * symtab.h (Symbol::NON_PIC_REF): Remove.
8412 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
8413 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
8414 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
8415 (Symbol::use_plt_offset): Take a flags argument and pass it
8416 directly to needs_dynamic_reloc. Restrict check for undefined
8417 weak symbols to function calls.
8418 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
8419 (Target_arm::Scan::global): Use it.
8420 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
8421 (Target_arm::Relocate::relocate): Likewise.
8422 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
8423 parameter with an r_type parameter. Use get_reference_flags
8424 to get the flags.
8425 (Target_arm::Relocate::relocate): Update accordingly.
8426 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
8427 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
8428 (Target_i386::Scan::global): Likewise.
8429 (Target_i386::Relocate::relocate): Likewise.
8430 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
8431 parameter with an r_type parameter. Use get_reference_flags
8432 to get the flags.
8433 (Target_i386::Relocate::relocate): Update accordingly.
8434 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
8435 (Target_powerpc::Scan::global): Use it.
8436 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
8437 (Target_powerpc::Relocate::relocate): Likewise.
8438 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
8439 (Target_sparc::Scan::global): Use it.
8440 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
8441 (Target_sparc::Relocate::relocate): Likewise.
8442 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
8443 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
8444 (Target_x86_64::Scan::global): Likewise.
8445 (Target_x86_64::Relocate::relocate): Likewise.
8446
8447 2010-11-08 Doug Kwan <dougkwan@google.com>
8448 Cary Coutant <ccoutant@google.com>
8449
8450 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
8451 (Arm_exidx_merge_section::section_contents_): New data member.
8452 (Arm_input_section::Arm_input_section): Initialize original_contents_.
8453 (Arm_input_section::~Arm_input_section): De-allocate memory.
8454 (Arm_input_section::original_contents_): New data member.
8455 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
8456 in parameters instead of calling Object::section_contents without
8457 locking.
8458 (Arm_output_section::group_section): New parameter TASK. Pass it
8459 to callees that need locking objects.
8460 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
8461 to lock EXIDX input sections. Fix a formatting issue. Call
8462 Arm_exidx_merged_section::build_contents to create merged section
8463 contents.
8464 (Arm_output_section::create_stub_group): New parameter TASK. Use it
8465 to lock object of stub table owner.
8466 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
8467 TEXT_SIZE to initialize data member TEXT_SIZE_.
8468 (Arm_exidx_input_section::addralign): Fix typo in comment.
8469 (Arm_exidx_input_section::text_size): New method.
8470 (Target_arm::do_relax): New parameter TASK. Pass it to callees
8471 that require locking objects. Lock objects before scanning for stubs
8472 and updating local symbols.
8473 (Arm_input_section<big_endian>::init): Copy contents of original
8474 input section.
8475 (Arm_input_section<big_endian>::do_write): Use saved contents of
8476 original input section instead of calling Object::section_contents
8477 without locking.
8478 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
8479 size without calling Object::section_size().
8480 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
8481 for size. Allocate a buffer for merged EXIDX entries.
8482 (Arm_exidx_merged_section::build_contents): New method.
8483 (Arm_exidx_merged_section::do_write): Move merge section contents
8484 building code to Arm_exidx_merged_section::build_contetns. Write
8485 out contetns in buffer instead of building it on the fly.
8486 (Arm_relobj::make_exidx_input_section): Also pass text section size
8487 to Arm_exidx_input_section constructor.
8488 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
8489 (Arm_dynobj::do_read_symbols): Fix memory leak.
8490 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
8491 * target.h: (class Task): Add forward declaration.
8492 (Target::relax): Add new parameter TASK and pass it to
8493 Target::do_relax().
8494 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
8495
8496 2010-11-05 Cary Coutant <ccoutant@google.com>
8497
8498 PR gold/10708
8499 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
8500 object when reading from the file.
8501 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
8502 second layout pass.
8503 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
8504 when reading section contents.
8505 (get_section_contents): Likewise.
8506 (icf::find_identical_sections): Likewise.
8507 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
8508 object when reading from the file.
8509 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
8510 the object when doing deferred section layout.
8511
8512 2010-11-03 Nick Clifton <nickc@redhat.com>
8513
8514 PR gold/12001
8515 * script.h (class Symbol_assignment: name): New member. Returns
8516 the name of the symbol.
8517 * scrfipt.cc (Script_options::is_pending_assignment): New member.
8518 Returns true if the given symbol name is on the list of
8519 assignments wating to be processed.
8520 * archive.cc (should_incldue_member): If the symbol is undefined,
8521 check to see if it is on the list of symbols pending assignment.
8522
8523 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
8524
8525 * script-sections.cc (Script_sections::find_memory_region): Check
8526 for a NULL output section pointer.
8527
8528 2010-10-29 Doug Kwan <dougkwan@google.com>
8529
8530 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
8531 Output_section::add_relaxed_input_section.
8532 * output.cc (Output_section::add_relaxed_input_section): Add new
8533 arguments LAYOUT and NAME. Set section order index.
8534 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8535 Copy section order index.
8536 * output.h (Output_section::add_relaxed_input_section): Add new
8537 arguments LAYOUT and NAME.
8538
8539 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8540
8541 * testsuite/Makefile.am: Move gcctestdir/ld rule to
8542 NATIVE_OR_CROSS_LINKER.
8543 * testsuite/Makefile.in: Regenerate.
8544
8545 2010-10-20 Doug Kwan <dougkwan@google.com>
8546
8547 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
8548 without SHF_LINK_ORDER flags.
8549 * layout.cc (Layout::choose_output_section): Do not filter
8550 SHF_LINK_ORDER flag in a relocatable link.
8551
8552 2010-10-17 Cary Coutant <ccoutant@google.com>
8553
8554 * output.h (Output_segment::set_section_addresses): Change function
8555 signature. Update all callers.
8556 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
8557 sections.
8558 (Output_segment::set_section_addresses): Align after last TLS
8559 section. Add padding before last relro section instead of after.
8560
8561 2010-10-17 Doug Kwan <dougkwan@google.com>
8562
8563 * gold/arm.cc (Target_arm::got_section): Use correct order and set
8564 GOT output section to be writable.
8565
8566 2010-10-14 Cary Coutant <ccoutant@google.com>
8567
8568 * debug.h (DEBUG_INCREMENTAL): New flag.
8569 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
8570 * gold.cc (queue_initial_tasks): Check parameters for incremental link
8571 mode.
8572 * incremental.cc (report_command_line): Ignore all forms of
8573 --incremental.
8574 * layout.cc (Layout::Layout): Check parameters for incremental link
8575 mode.
8576 * options.cc (General_options::parse_incremental): New function.
8577 (General_options::parse_no_incremental): New function.
8578 (General_options::parse_incremental_full): New function.
8579 (General_options::parse_incremental_update): New function.
8580 (General_options::incremental_mode_): New data member.
8581 (General_options::finalize): Check incremental_mode_.
8582 * options.h (General_options): Update help text for --incremental.
8583 Add --no-incremental, --incremental-full, --incremental-update.
8584 (General_options::Incremental_mode): New enum type.
8585 (General_options::incremental_mode): New function.
8586 (General_options::incremental_mode_): New data member.
8587 * parameters.cc (Parameters::incremental_mode_): New data member.
8588 (Parameters::set_options): Set incremental_mode_.
8589 (Parameters::set_incremental_full): New function.
8590 (Parameters::incremental): New function.
8591 (Parameters::incremental_update): New function.
8592 (set_parameters_incremental_full): New function.
8593 * parameters.h (Parameters::set_incremental_full): New function.
8594 (Parameters::incremental): New function.
8595 (Parameters::incremental_update): New function.
8596 (Parameters::incremental_mode_): New data member.
8597 (set_parameters_incremental_full): New function.
8598 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
8599 incremental link mode.
8600 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
8601 (Sized_relobj::do_relocate_sections): Likewise.
8602 * testsuite/Makefile.am (incremental_test): Use --incremental-full
8603 option.
8604 * testsuite/Makefile.in: Regenerate.
8605 * testsuite/incremental_test.sh: Filter all forms of --incremental.
8606
8607 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8608
8609 * script-sections.h (class Script_sections): Make
8610 Sections_elements typedef public.
8611 * script-sections.cc (class Sort_output_sections): Add elements_
8612 field. Add constructor which sets it; change all callers.
8613 (Sort_output_sections::is_before): New function.
8614 (Sort_output_sections::operator()): Call is_before.
8615 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
8616 conditional.
8617 * testsuite/script_test_10.sh: New test. Test script section
8618 order.
8619 * testsuite/script_test_10.t: Likewise.
8620 * testsuite/script_test_10.s: Likewise.
8621 * testsuite/Makefile.am: Wrap the cross linker tests and the
8622 common tests into NATIVE_OR_CROSS_LINKER.
8623 (check_SCRIPTS): Add script_test_10.sh.
8624 (check_DATA): Add script_test_10.stdout.
8625 (script_test_10.o, script_test_10): New targets.
8626 (script_test_10.stdout): New target.
8627 * configure, testsuite/Makefile.in: Regenerate.
8628
8629 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8630
8631 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
8632 error for the deprecated relocations.
8633 (Target_arm::Scan::global): Likewise.
8634 (Target_arm::Relocate::relocate): Likewise.
8635
8636 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
8637
8638 * fileread.cc (Input_file::find_file): Initialize *found_name
8639 and *namep when using the fallback search for case 4.
8640
8641 2010-10-11 Cary Coutant <ccoutant@google.com>
8642
8643 * options.h (class General_options): Redefine -z lazy as an alias for
8644 the negation of -z now.
8645
8646 2010-10-11 Ian Lance Taylor <iant@google.com>
8647
8648 * resolve.cc (symbol_to_bits): Report the value of the unsupported
8649 binding.
8650
8651 2010-10-06 Nick Clifton <nickc@redhat.com>
8652
8653 * script-sections.cc(class Memory_region): Remove
8654 current_lma_offset_ field. Rename current_vma_offset_ to
8655 current_offset_. Add last_section_ field.
8656 (Memory_region::get_current_vma_address): Rename to
8657 get_current_address.
8658 (Memory_region::get_current_lma_address): Delete.
8659 (Memory_region::increment_vma_offset): Rename to
8660 increment_offset.
8661 (Memory_region::increment_lma_offset): Delete.
8662 (Memory_region::attributes_compatible): New method. Returns
8663 true if the provided section is compatible with the region.
8664 (Memory_region::get_last_section): New method. Returns the last
8665 section to use the region.
8666 (Memory_region::set_last_section): New method. Stores the last
8667 section to use the region.
8668 (Script_sections::block_in_region): New method. Returns true if
8669 a block of memory is contained within a region.
8670 (Script_sections::find_memory_region): New method. Locates a
8671 memory region to be used to set a VMA or LMA address.
8672 (Output_section_definition::set_section_addresses): Add code to
8673 check for addresses set by memory regions.
8674 (Output_segment::set_section_addresses): Remove memory region
8675 walking code.
8676 (Script_sections::create_segment): Add a warning if a header
8677 segment is created outside of any region.
8678 * script-sections.h (class Script_sections): Add prototypes for
8679 find_memory_region and block_in_region methods.
8680 * testsuite/memory_test.s: Use .long instead of .word.
8681 * testsuite/memory_test.t: Add some more output sections.
8682 * testsuite/memory_test.sh: Update expected output.
8683
8684 2010-10-02 Doug Kwan <dougkwan@google.com>
8685
8686 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
8687 defintion to symtab.h
8688 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
8689 declaration to defintion.
8690
8691 2010-10-01 Nick Clifton <nickc@redhat.com>
8692
8693 * expression.cc (eval): Replace dummy argument with NULL.
8694 (eval_maybe_dot): Check for a NULL result section pointer.
8695 (Symbol_expression::value): Likewise.
8696 (Dot_expression::value): Likewise.
8697 (BINARY_EXPRESSION): Likewise.
8698 (Max_expression::value): Likewise.
8699 (Min_expression::value): Likewise.
8700 (Absolute_expression::value): Likewise.
8701 (Addr_expression::value_from_output_section): Likewise.
8702 (Loaddddr_expression::value_from_output_section): Likewise.
8703 (Segment_start_expression::value): Likewise.
8704 * script-sections.cc
8705 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
8706 argument with NULL.
8707 (Sections_elememt_dot_assignment::set_section_addresses):
8708 Likewise.
8709 (Output_data_expression::do_write_to_buffer): Likewise.
8710 (Output_section_definition::finalize_symbols): Likewise.
8711 (Output_section_definition::set_section_addresses): Likewise.
8712
8713 2010-09-30 Doug Kwan <dougkwan@google.com>
8714
8715 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
8716
8717 2010-09-28 Sriraman Tallam <tmsriram@google.com>
8718
8719 * target.h (Target::can_icf_inline_merge_sections): New virtual
8720 function.
8721 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
8722 virtual function.
8723 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
8724 virtual function.
8725 * icf.cc (get_section_contents): Inline merge sections only when
8726 target allows it.
8727
8728 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8729
8730 * configure: Regenerate.
8731
8732 2010-09-17 Ian Lance Taylor <iant@google.com>
8733
8734 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
8735 * testsuite/Makefile.am (memory_test.o): New target.
8736 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
8737 memory_test.t.
8738 * testsuite/Makefile.in: Rebuild.
8739
8740 2010-09-17 Doug Kwan <dougkwan@google.com>
8741
8742 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
8743 defintion if relocation uses GOT entries of the symbol.
8744 * testsuite/icf_safe_test.sh: Fix test.
8745 * testsuite/icf_safe_so_test.sh: Fix test.
8746
8747 2010-09-16 Cary Coutant <ccoutant@google.com>
8748
8749 * script_sections.cc (class Memory_region): Remove "NULL" from
8750 vector initializations.
8751
8752 2010-09-15 Cary Coutant <ccoutant@google.com>
8753
8754 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
8755 Resolve forwarding symbols.
8756
8757 2010-09-15 Doug Kwan <dougkwan@google.com>
8758
8759 * gold/testsuite/script_test_3.t: Add ARM special sections.
8760 * gold/testsuite/script_test_4.t: Same.
8761 * gold/testsuite/script_test_5.t: Same.
8762 * gold/testsuite/script_test_6.t: Same.
8763 * gold/testsuite/script_test_7.t: Same.
8764 * gold/testsuite/script_test_7.t: Same.
8765 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
8766
8767 2010-09-14 Cary Coutant <ccoutant@google.com>
8768
8769 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
8770 (Target_x86_64::Relocate::relocate_tls): Replace check for
8771 saw_tls_block_reloc_ with test for executable section.
8772
8773 2010-09-12 Cary Coutant <ccoutant@google.com>
8774
8775 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
8776 position-independent executables to shared libraries need dynamic
8777 relocations.
8778 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
8779 position-independent executables.
8780 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
8781 * testsuite/Makefile.in: Regenerate.
8782
8783 2010-09-10 Nick Clifton <nickc@redhat.com>
8784
8785 PR gold/11997
8786 * testsuite/memory_test.t: Discard any sections that are not
8787 needed.
8788
8789 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
8790
8791 PR gold/11996
8792 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
8793 "This::" to work around a bug in gcc 4.2.
8794
8795 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
8796
8797 2010-09-09 Rafael Espindola <espindola@google.com>
8798
8799 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
8800 sections with different PF_X flags in the same segment.
8801 (Layout::find_first_load_seg): Search all segments to find the first
8802 one.
8803 * options.h (rosegment): New.
8804
8805 2010-09-08 Rafael Espindola <espindola@google.com>
8806
8807 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
8808
8809 2010-09-08 Doug Kwan <dougkwan@google.com>
8810
8811 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
8812 (Arm_relobj::do_relocate_sections): Add new parameter for output
8813 file to match the parent.
8814 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
8815 of local symbols instead of input values. Update code to track
8816 changes in gold::relocate_section.
8817 * object.cc (Sized_relobj::compute_final_local_value): New methods.
8818 (Sized_relobj::compute_final_local_value_internal): New methods.
8819 (Sized_relobj::do_finalize_local_symbols): Move code from loop
8820 body into private version of Sized_relobj::compute_final_local_value.
8821 Call the inline method.
8822 * object.h (Symbol_value::Symbol_value): Define destructor. Free
8823 merged symbol value if there is one.
8824 (Symbol_value::has_output_value): New method defintiion.
8825 (Sized_relobj::Compute_final_local_value_status): New enum type.
8826 (Sized_relobj::compute_final_local_value): New methods.
8827 (Sized_relobj::compute_final_local_value_internal): New methods.
8828 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
8829 and arm_cortex_a8.sh.
8830 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
8831 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
8832 New tests.
8833 * Makefile.in: Regenerate.
8834 * testsuite/arm_bl_out_of_range.s: Update test.
8835 * testsuite/thumb_bl_out_of_range.s: Ditto.
8836 * testsuite/thumb_blx_out_of_range.s: Ditto.
8837 * testsuite/arm_branch_out_of_range.sh: New file.
8838 * testsuite/arm_cortex_a8.sh: Ditto.
8839 * testsuite/arm_cortex_a8_b.s: Ditto.
8840 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
8841 * testsuite/arm_cortex_a8_b_local.s: Ditto.
8842 * testsuite/arm_cortex_a8_bl.s: Ditto.
8843 * testsuite/arm_cortex_a8_blx.s: Ditto.
8844 * testsuite/arm_cortex_a8_local.s: Ditto.
8845 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
8846 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
8847
8848 2010-09-08 Rafael Espindola <espindola@google.com>
8849
8850 * Makefile.am (memory_test.stdout): Run readelf with -W.
8851 * Makefile.in: Regenerate.
8852 * testsuite/memory_test.sh: Make the regexps accept both 32 and
8853 64 bit output.
8854
8855 2010-09-08 Rafael Espindola <espindola@google.com>
8856
8857 * script-sections.cc (Script_sections::add_memory_region): Convert
8858 field precision to int.
8859 * script.cc (script_set_section_region, script_set_section_region):
8860 Convert field precision to int.
8861
8862 2010-09-08 Rafael Espindola <espindola@google.com>
8863
8864 * arm.cc (do_finalize_sections): Create the __exidx_start and
8865 __exdix_end symbols even when the section is missing.
8866
8867 2010-09-08 Nick Clifton <nickc@redhat.com>
8868
8869 * README: Remove claim that MEMORY is not supported.
8870 * expression.cc (script_exp_function_origin)
8871 (script_exp_function_length): Move from here to ...
8872 * script.cc: ... here.
8873 (script_set_section_region, script_add_memory)
8874 (script_parse_memory_attr, script_include_directive): New
8875 functions.
8876 * script-sections.cc
8877 (class Memory_region): New class.
8878 (class Output_section_definition): Add set_memory_region,
8879 set_section_vma, set_section_lma and get_section_name methods.
8880 (class Script_Sections): Add add_memory_region,
8881 find_memory_region, find_memory_region_origin,
8882 find_memory_region_length and set_memory_region methods.
8883 Have set_section_addresses method walk the list of set memory
8884 regions.
8885 Extend the print methos to display memory regions.
8886 * script-sections.h: Add prototypes for new methods.
8887 Add enum for MEMORY region attributes.
8888 * yyscript.y: Add support for parsing MEMORY regions.
8889 * script-c.h: Add prototypes for new functions.
8890 * testsuite/Makefile.am: Add test of MEMORY region functionality.
8891 * testsuite/Makefile.in: Regenerate.
8892 * testsuite/memory_test.sh: New script.
8893 * testsuite/memory_test.s: New assembler source file.
8894 * testsuite/memory_test.t: New linker script.
8895
8896 2010-08-27 Doug Kwan <dougkwan@google.com>
8897
8898 * gold/resolve.cc (Symbol_table::should_override): Let a weak
8899 reference override an existing dynamic weak reference.
8900 * testsuite/Makefile.am: Add new test dyn_weak_ref.
8901 * testsuite/Makefile.in: Regenerate.
8902 * testsuite/dyn_weak_ref.sh: New file.
8903 * testsuite/dyn_weak_ref_1.c: Ditto.
8904 * testsuite/dyn_weak_ref_2.c: Ditto.
8905
8906 2010-08-27 Ian Lance Taylor <iant@google.com>
8907
8908 * incremental.h (class Incremental_input_entry): Add virtual
8909 destructor.
8910
8911 2010-08-27 Ian Lance Taylor <iant@google.com>
8912
8913 * testsuite/start_lib_test_3.c: Mark t3 as used.
8914
8915 2010-08-27 Nick Clifton <nickc@redhat.com>
8916
8917 * options.cc (version_script): Fix small typo in previous
8918 whitespace tidyup.
8919
8920 2010-08-25 Nick Clifton <nickc@redhat.com>
8921
8922 * archive.cc: Formatting fixes: Remove whitespace between
8923 typename and following asterisk. Remove whitespace between
8924 function name and opening parenthesis.
8925 * archive.h: Likewise.
8926 * arm.cc: Likewise.
8927 * attributes.cc: Likewise.
8928 * attributes.h: Likewise.
8929 * common.cc: Likewise.
8930 * copy-relocs.cc: Likewise.
8931 * dirsearch.h: Likewise.
8932 * dynobj.cc: Likewise.
8933 * ehframe.cc: Likewise.
8934 * ehframe.h: Likewise.
8935 * expression.cc: Likewise.
8936 * fileread.cc: Likewise.
8937 * fileread.h: Likewise.
8938 * gc.h: Likewise.
8939 * gold-threads.cc: Likewise.
8940 * gold.cc: Likewise.
8941 * i386.cc: Likewise.
8942 * icf.h: Likewise.
8943 * incremental-dump.cc: Likewise.
8944 * incremental.cc: Likewise.
8945 * layout.cc: Likewise.
8946 * layout.h: Likewise.
8947 * main.cc: Likewise.
8948 * merge.cc: Likewise.
8949 * merge.h: Likewise.
8950 * object.cc: Likewise.
8951 * object.h: Likewise.
8952 * options.cc: Likewise.
8953 * options.h: Likewise.
8954 * output.cc: Likewise.
8955 * output.h: Likewise.
8956 * plugin.cc: Likewise.
8957 * plugin.h: Likewise.
8958 * powerpc.cc: Likewise.
8959 * reloc.cc: Likewise.
8960 * script-c.h: Likewise.
8961 * script-sections.cc: Likewise.
8962 * script.cc: Likewise.
8963 * stringpool.cc: Likewise.
8964 * symtab.cc: Likewise.
8965 * symtab.h: Likewise.
8966 * target.cc: Likewise.
8967 * timer.cc: Likewise.
8968 * timer.h: Likewise.
8969 * version.cc: Likewise.
8970 * x86_64.cc: Likewise.
8971
8972 2010-08-24 Nick Clifton <nickc@redhat.com>
8973
8974 PR 11899
8975 * layout.cc (segment_precedes): Sort segments by their physical
8976 addresses, if they have been set.
8977
8978 2010-08-23 Cary Coutant <ccoutant@google.com>
8979
8980 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
8981 symbols data.
8982 (Lib_group::include_member): Unlock object after deleting its
8983 symbols data.
8984 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
8985 the bug fixed here.
8986
8987 2010-08-19 Neil Vachharajani <nvachhar@google.com>
8988 Cary Coutant <ccoutant@google.com>
8989
8990 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
8991 constructor, and set_blocker.
8992 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
8993 readsyms_blocker_.
8994 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
8995 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
8996 * testsuite/Makefile.am (start_lib_test): New test case.
8997 * testsuite/Makefile.in: Regenerate.
8998 * testsuite/start_lib_test_main.c: New file.
8999 * testsuite/start_lib_test_1.c: New file.
9000 * testsuite/start_lib_test_2.c: New file.
9001 * testsuite/start_lib_test_3.c: New file.
9002
9003 2010-08-19 Ian Lance Taylor <iant@google.com>
9004
9005 * Makefile.in: Rebuild with automake 1.11.1.
9006 * aclocal.m4: Likewise.
9007 * testsuite/Makefile.in: Likewise.
9008
9009 2010-08-19 Ian Lance Taylor <iant@google.com>
9010
9011 PR 10893
9012 * i386.cc (class Output_data_plt_i386): Update declarations.
9013 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
9014 local_ifuncs_ fields.
9015 (Target_i386::do_plt_section_for_global): New function.
9016 (Target_i386::do_plt_section_for_local): New function.
9017 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
9018 parameter; change all callers. Initialize global_ifuncs_ and
9019 local_ifuncs_. If doing a static link define __rel_iplt_start and
9020 __rel_iplt_end.
9021 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
9022 (Output_data_plt_i386::add_local_ifunc_entry): New function.
9023 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
9024 symbols.
9025 (Target_i386::make_plt_section): New function, broken out of
9026 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
9027 (Target_i386::make_plt_entry): Call make_plt_section.
9028 (Target_i386::make_local_ifunc_plt_entry): New function.
9029 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
9030 (Target_i386::Scan::local): Handle IFUNC symbols. Add
9031 R_386_IRELATIVE to switch.
9032 (Target_i386::Scan::global): Likewise.
9033 (Target_i386::Relocate::relocate): Likewise.
9034 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
9035 switch.
9036 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
9037 (Target_x86_64::do_plt_section_for_global): New function.
9038 (Target_x86_64::do_plt_section_for_local): New function.
9039 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
9040 parameter; change all callers. If doing a static link define
9041 __rela_iplt_start and __rela_iplt_end.
9042 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
9043 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
9044 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
9045 to point to .plt.
9046 (Target_x86_64::make_local_ifunc_plt_entry): New function.
9047 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
9048 switch.
9049 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
9050 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
9051 R_X86_64_IRELATIVE to switch.
9052 (Target_x86_64::Scan::global): Likewise.
9053 (Target_x86_64::Relocate::relocate): Likewise.
9054 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
9055 switch.
9056 * target.h (class Target): Add plt_section_for_global and
9057 plt_section_for_local functions. Add do_plt_section_for_global
9058 and do_plt_section_for_local virtual functions.
9059 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
9060 clarifying comments.
9061 (Symbol::use_plt_offset): Handle IFUNC symbol.
9062 * object.cc (Sized_relobj::Sized_relobj): Initialize
9063 local_plt_offsets_.
9064 (Sized_relobj::local_has_plt_offset): New function.
9065 (Sized_relobj::local_plt_offset): New function.
9066 (Sized_relobj::set_local_plt_offset): New function.
9067 (Sized_relobj::do_count): Handle IFUNC symbol.
9068 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
9069 a bit away from input_shndx_ field. Add set_is_func_symbol and
9070 is_ifunc_symbol functions.
9071 (class Sized_relobj): Update declarations. Remove Tls_got_entry
9072 and Local_tls_got_offsets. Define Local_plt_offsets. Add
9073 local_plt_offsets_ field.
9074 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
9075 * output.h (class Output_section_data): Add non-const
9076 output_section function.
9077 (class Output_data_got): Update declarations.
9078 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
9079 Add use_plt_offset parameter to global and local constructors.
9080 Change all callers. Change local_sym_index_ field to 31 bits.
9081 Change GSYM_CODE and CONSTANT_CODE accordingly.
9082 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
9083 doing a static link don't set sh_link field.
9084 (Output_data_got::Got_entry::write): Use PLT offset if
9085 appropriate.
9086 (Output_data_got::add_global_plt): New function.
9087 (Output_data_got::add_local_plt): New function.
9088 * target-reloc.h (relocate_section): Handle IFUNC symbol.
9089 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
9090 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
9091 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
9092 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
9093 IFUNC conditional.
9094 * testsuite/ifunc-sel.h: New file.
9095 * testsuite/ifuncmain1.c: New file.
9096 * testsuite/ifuncmain1vis.c: New file.
9097 * testsuite/ifuncmod1.c: New file.
9098 * testsuite/ifuncdep2.c: New file.
9099 * testsuite/ifuncmain2.c: New file.
9100 * testsuite/ifuncmain3.c: New file.
9101 * testsuite/ifuncmod3.c: New file.
9102 * testsuite/ifuncmain4.c: New file.
9103 * testsuite/ifuncmain5.c: New file.
9104 * testsuite/ifuncmod5.c: New file.
9105 * testsuite/ifuncmain6pie.c: New file.
9106 * testsuite/ifuncmod6.c: New file.
9107 * testsuite/ifuncmain7.c: New file.
9108 * configure, testsuite/Makefile.in: Rebuild.
9109
9110 2010-08-18 Ian Lance Taylor <iant@google.com>
9111
9112 * incremental.cc
9113 (Output_section_incremental_inputs::write_input_files): Add cast
9114 to avoid signed/unsigned comparison warning.
9115 (Output_section_incremental_inputs::write_info_blocks): Likewise.
9116
9117 2010-08-12 Cary Coutant <ccoutant@google.com>
9118
9119 * common.cc (Sort_commons::operator()): Remove unnecessary code.
9120
9121 2010-08-13 Ian Lance Taylor <iant@google.com>
9122
9123 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
9124
9125 2010-08-12 Cary Coutant <ccoutant@google.com>
9126 Doug Kwan <dougkwan@google.com>
9127
9128 * resolve.cc (Symbol_table::should_override): When a weak dynamic
9129 defintion overrides non-weak undef, remember that the original undef
9130 is not weak.
9131 * symtab.cc (Symbol_table::sized_write_global): For undef without
9132 an original weak binding, set binding to global in output.
9133 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
9134 * testsuite/Makefile.in: Regenerate.
9135 * testsuite/strong_ref_weak_def.sh: New file.
9136 * testsuite/strong_ref_weak_def_1.c: Ditto.
9137 * testsuite/strong_ref_weak_def_2.c: Ditto.
9138
9139 2010-08-12 Cary Coutant <ccoutant@google.com>
9140
9141 * testsuite/incremental_test.sh: Rewrite.
9142 * testsuite/incremental_test_1.c: Rewrite.
9143 * testsuite/incremental_test_2.c: Rewrite.
9144
9145 2010-08-12 Cary Coutant <ccoutant@google.com>
9146
9147 * arm.cc (Target_arm::got_size): Add const.
9148 (Target_arm::got_entry_count): New function.
9149 (Target_arm::plt_entry_count): New function.
9150 (Target_arm::first_plt_entry_offset): New function.
9151 (Target_arm::plt_entry_size): New function.
9152 (Output_data_plt_arm::entry_count): New function.
9153 (Output_data_plt_arm::first_plt_entry_offset): New function.
9154 (Output_data_plt_arm::get_plt_entry_size): New function.
9155 * i386.cc (Target_i386::got_size): Add const.
9156 (Target_i386::got_entry_count): New function.
9157 (Target_i386::plt_entry_count): New function.
9158 (Target_i386::first_plt_entry_offset): New function.
9159 (Target_i386::plt_entry_size): New function.
9160 (Output_data_plt_i386::entry_count): New function.
9161 (Output_data_plt_i386::first_plt_entry_offset): New function.
9162 (Output_data_plt_i386::get_plt_entry_size): New function.
9163 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
9164 find_incremental_inputs_sections. Dump incremental_got_plt section.
9165 * incremental.cc: Include target.h.
9166 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
9167 parameter. Adjust all callers. Find incremental_got_plt section.
9168 (Incremental_inputs::create_data_sections): Create incremental_got_plt
9169 section.
9170 (Output_section_incremental_inputs::set_final_data_size): Calculate
9171 size of incremental_got_plt section.
9172 (Output_section_incremental_inputs::do_write): Write the
9173 incremental_got_plt section.
9174 (Got_plt_view_info): New struct.
9175 (Local_got_offset_visitor): New class.
9176 (Global_got_offset_visitor): New class.
9177 (Global_symbol_visitor_got_plt): New class.
9178 (Output_section_incremental_inputs::write_got_plt): New function.
9179 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
9180 Add parameter. Adjust all callers.
9181 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9182 (Incremental_inputs::got_plt_section): New function.
9183 (Incremental_inputs::got_plt_section_): New data member.
9184 (Incremental_got_plt_reader): New class.
9185 * layout.cc (Layout::create_incremental_info_sections): Add the
9186 incremental_got_plt section.
9187 * object.h (Got_offset_list::get_list): New function.
9188 (Got offset_list::for_all_got_offsets): New function.
9189 (Sized_relobj::local_got_offset_list): New function.
9190 * powerpc.cc (Target_powerpc::got_size): Add const.
9191 (Target_powerpc::got_entry_count): New function.
9192 (Target_powerpc::plt_entry_count): New function.
9193 (Target_powerpc::first_plt_entry_offset): New function.
9194 (Target_powerpc::plt_entry_size): New function.
9195 (Output_data_plt_powerpc::entry_count): New function.
9196 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
9197 (Output_data_plt_powerpc::get_plt_entry_size): New function.
9198 * sparc.cc (Target_sparc::got_size): Add const.
9199 (Target_sparc::got_entry_count): New function.
9200 (Target_sparc::plt_entry_count): New function.
9201 (Target_sparc::first_plt_entry_offset): New function.
9202 (Target_sparc::plt_entry_size): New function.
9203 (Output_data_plt_sparc::entry_count): New function.
9204 (Output_data_plt_sparc::first_plt_entry_offset): New function.
9205 (Output_data_plt_sparc::get_plt_entry_size): New function.
9206 * symtab.h (Symbol::got_offset_list): New function.
9207 (Symbol_table::for_all_symbols): New function.
9208 * target.h (Sized_target::got_entry_count): New function.
9209 (Sized_target::plt_entry_count): New function.
9210 (Sized_target::plt_entry_size): New function.
9211 * x86_64.cc (Target_x86_64::got_size): Add const.
9212 (Target_x86_64::got_entry_count): New function.
9213 (Target_x86_64::plt_entry_count): New function.
9214 (Target_x86_64::first_plt_entry_offset): New function.
9215 (Target_x86_64::plt_entry_size): New function.
9216 (Output_data_plt_x86_64::entry_count): New function.
9217 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
9218 (Output_data_plt_x86_64::get_plt_entry_size): New function.
9219
9220 2010-08-12 Cary Coutant <ccoutant@google.com>
9221
9222 * archive.cc: Include incremental.h.
9223 (Archive::Archive): Initialize incremental_info_.
9224 (Archive::include_member): Record archive members in incremental info.
9225 (Add_archive_symbols::run): Record begin and end of an archive in
9226 incremental info.
9227 (Lib_group::include_member): Record objects in incremental info.
9228 * archive.h (Incremental_archive_entry): Forward declaration.
9229 (Archive::set_incremental_info): New member function.
9230 (Archive::incremental_info): New member function.
9231 (Archive::Unused_symbol_iterator): New class.
9232 (Archive::unused_symbols_begin): New member function.
9233 (Archive::unused_symbols_end): New member function.
9234 (Archive::incremental_info_): New data member.
9235 * incremental-dump.cc (find_input_containing_global): New function.
9236 (dump_incremental_inputs): Dump new incremental info sections.
9237 * incremental.cc: Include symtab.h.
9238 (Output_section_incremental_inputs): New class.
9239 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
9240 new incremental info sections.
9241 (Sized_incremental_binary::do_check_inputs): Likewise.
9242 (Incremental_inputs::report_archive): Remove.
9243 (Incremental_inputs::report_archive_begin): New function.
9244 (Incremental_inputs::report_archive_end): New function.
9245 (Incremental_inputs::report_object): New function.
9246 (Incremental_inputs::finalize_inputs): Remove.
9247 (Incremental_inputs::report_input_section): New function.
9248 (Incremental_inputs::report_script): Rewrite.
9249 (Incremental_inputs::finalize): Do nothing but finalize string table.
9250 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9251 (Incremental_inputs::sized_create_inputs_section_data): Remove.
9252 (Incremental_inputs::create_data_sections): New function.
9253 (Incremental_inputs::relocs_entsize): New function.
9254 (Output_section_incremental_inputs::set_final_data_size): New function.
9255 (Output_section_incremental_inputs::do_write): New function.
9256 (Output_section_incremental_inputs::write_header): New function.
9257 (Output_section_incremental_inputs::write_input_files): New function.
9258 (Output_section_incremental_inputs::write_info_blocks): New function.
9259 (Output_section_incremental_inputs::write_symtab): New function.
9260 * incremental.h (Incremental_script_entry): Forward declaration.
9261 (Incremental_object_entry): Forward declaration.
9262 (Incremental_archive_entry): Forward declaration.
9263 (Incremental_inputs): Forward declaration.
9264 (Incremental_inputs_header_data): Remove.
9265 (Incremental_inputs_header): Remove.
9266 (Incremental_inputs_header_write): Remove.
9267 (Incremental_inputs_entry_data): Remove.
9268 (Incremental_inputs_entry): Remove.
9269 (Incremental_inputs_entry_write): Remove.
9270 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
9271 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
9272 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9273 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
9274 Likewise.
9275 (Incremental_input_entry): New class.
9276 (Incremental_script_entry): New class.
9277 (Incremental_object_entry): New class.
9278 (Incremental_archive_entry): New class.
9279 (Incremental_inputs::Incremental_inputs): Initialize new data members.
9280 (Incremental_inputs::report_inputs): Remove.
9281 (Incremental_inputs::report_archive): Remove.
9282 (Incremental_inputs::report_archive_begin): New function.
9283 (Incremental_inputs::report_archive_end): New function.
9284 (Incremental_inputs::report_object): Change prototype.
9285 (Incremental_inputs::report_input_section): New function.
9286 (Incremental_inputs::report_script): Change prototype.
9287 (Incremental_inputs::get_reloc_count): New function.
9288 (Incremental_inputs::set_reloc_count): New function.
9289 (Incremental_inputs::create_data_sections): New function.
9290 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9291 (Incremental_inputs::inputs_section): New function.
9292 (Incremental_inputs::symtab_section): New function.
9293 (Incremental_inputs::relocs_section): New function.
9294 (Incremental_inputs::get_stringpool): Add const.
9295 (Incremental_inputs::command_line): Add const.
9296 (Incremental_inputs::inputs): Remove.
9297 (Incremental_inputs::command_line_key): New function.
9298 (Incremental_inputs::input_file_count): New function.
9299 (Incremental_inputs::input_files): New function.
9300 (Incremental_inputs::relocs_entsize): New function.
9301 (Incremental_inputs::sized_create_inputs_section_data): Remove.
9302 (Incremental_inputs::finalize_inputs): Remove.
9303 (Incremental_inputs::Input_info): Remove.
9304 (Incremental_inputs::lock_): Remove.
9305 (Incremental_inputs::inputs_): Change type.
9306 (Incremental_inputs::inputs_map_): Remove.
9307 (Incremental_inputs::current_object_entry_): New data member.
9308 (Incremental_inputs::inputs_section_): New data member.
9309 (Incremental_inputs::symtab_section_): New data member.
9310 (Incremental_inputs::relocs_section_): New data member.
9311 (Incremental_inputs::reloc_count_): New data member.
9312 (Incremental_inputs_reader): New class.
9313 (Incremental_symtab_reader): New class.
9314 (Incremental_relocs_reader): New class.
9315 * layout.cc (Layout::finalize): Move finalization of incremental info
9316 and creation of incremental info sections to follow finalization of
9317 symbol table. Set offsets for postprocessing sections.
9318 (Layout::create_incremental_info_sections): Call
9319 Incremental_inputs::create_data_sections. Add incremental symtab
9320 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
9321 sections to layout after input sections.
9322 * layout.h (struct Timespec): Forward declaration.
9323 (Layout::incremental_inputs): Add const.
9324 (Layout::create_incremental_info_sections): Add parameter.
9325 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
9326 * object.cc: Include incremental.h.
9327 (Relobj::finalize_incremental_relocs): New function.
9328 (Sized_relobj::do_layout): Record input sections in incremental info.
9329 * object.h (Object::output_section): New function.
9330 (Object::output_section_offset): Moved from Relobj.
9331 (Object::get_incremental_reloc_base): New function.
9332 (Object::get_incremental_reloc_count): New function.
9333 (Object::do_output_section): New function.
9334 (Object::do_output_section_offset): Moved from Relobj.
9335 (Object::do_get_incremental_reloc_base): New function.
9336 (Object::do_get_incremental_reloc_count): New function.
9337 (Object::Object): Initialize new data members.
9338 (Relobj::output_section): Renamed do_output_section and moved to
9339 protected.
9340 (Relobj::output_section_offset): Moved to Object.
9341 (Relobj::do_get_incremental_reloc_base): New function.
9342 (Relobj::do_get_incremental_reloc_count): New function.
9343 (Relobj::allocate_incremental_reloc_counts): New function.
9344 (Relobj::count_incremental_reloc): New function.
9345 (Relobj::finalize_incremental_relocs): New function.
9346 (Relobj::next_incremental_reloc_index): New function.
9347 (Relobj::reloc_counts_): New data member.
9348 (Relobj::reloc_bases_): New data member.
9349 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
9350 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
9351 (Sized_relobj::incremental_relocs_scan): New function.
9352 (Sized_relobj::incremental_relocs_scan_reltype): New function.
9353 (Sized_relobj::incremental_relocs_write): New function.
9354 (Sized_relobj::incremental_relocs_write_reltype): New function.
9355 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
9356 incremental link.
9357 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
9358 archives and object files elsewhere.
9359 (Add_symbols::run): Report object files here.
9360 (Finish_group::run): Report end of archive at end of group.
9361 * reloc.cc: Include layout.h, incremental.h.
9362 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
9363 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
9364 (Sized_relobj::incremental_relocs_scan): New function.
9365 (Sized_relobj::incremental_relocs_scan_reltype): New function.
9366 (Sized_relobj::do_relocate_sections): Write incremental relocations.
9367 (Sized_relobj::incremental_relocs_write): New function.
9368 (Sized_relobj::incremental_relocs_write_reltype): New function.
9369 * script.cc (read_input_script): Rewrite test for incremental link.
9370 Change call to Incremental_inputs::report_script.
9371 * symtab.h (Symbol_table::first_global_index): New function.
9372 (Symbol_table::output_count): New function.
9373
9374 2010-08-12 Doug Kwan <dougkwan@google.com>
9375
9376 * arm.cc (Target_arm::merge_object_attributes): Check command line
9377 options --no-wchar-size-warning and --no-enum-size-warning.
9378 * options.h (General_options): Add ld-compatible options
9379 --no-enum-size-warning and --no-wchar-size-warning.
9380
9381 2010-08-04 Ian Lance Taylor <iant@google.com>
9382
9383 * x86_64.cc (Target_x86_64::Scan::local): Use
9384 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
9385 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
9386 (Target_x86_64::Scan::global): Likewise.
9387 (Target_x86_64::Relocate::relocate): Likewise.
9388 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
9389 Likewise.
9390
9391 2010-08-03 Cary Coutant <ccoutant@google.com>
9392
9393 * merge.cc (Output_merge_string::do_add_input_section): Count strings
9394 to reserve space in merged_strings vector. Keep total input size
9395 for stats.
9396 (Output_merge_string::do_print_merge_stats): Print total input size.
9397 * merge.h (Output_merge_string): Add input_size_ field.
9398 * stringpool.cc (Stringpool_template::string_length): Move
9399 implementations out of Stringpool_template class and place in
9400 stringpool.h.
9401 * stringpool.h (string_length): Move out of Stringpool_template.
9402
9403 2010-08-03 Ian Lance Taylor <iant@google.com>
9404
9405 PR 11712
9406 * layout.cc (relaxation_loop_body): If address of load segment is
9407 set, adjust address to include headers if possible.
9408
9409 2010-08-03 Ian Lance Taylor <iant@google.com>
9410
9411 * version.cc (version_string): Bump to 1.10.
9412
9413 2010-08-03 Ian Lance Taylor <iant@google.com>
9414
9415 PR 11805
9416 * layout.h (enum Output_section_order): Define.
9417 (class Layout): Update declarations.
9418 * layout.cc (Layout::get_output_section): Add order parameter.
9419 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
9420 is_first_non_relro parameters. Change all callers.
9421 (Layout::choose_output_section): Likewise.
9422 (Layout::add_output_section_data): Likewise.
9423 (Layout::make_output_section): Likewise. Set order.
9424 (Layout::default_section_order): New function.
9425 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
9426 * output.cc (Output_section::Output_section): Initialize order_.
9427 Don't initialize deleted fields.
9428 (Output_segment::Output_segment): Don't initialize deleted
9429 fields.
9430 (Output_segment::add_output_section_to_load): New function
9431 replacing add_output_section. Change all callers to call this or
9432 add_output_section_to_nonload.
9433 (Output_segment::add_output_section_to_nonload): New function.
9434 (Output_segment::remove_output_section): Rewrite.
9435 (Output_segment::add_initial_output_data): Likewise.
9436 (Output_segment::has_any_data_sections): Likewise.
9437 (Output_segment::is_first_section_relro): Likewise.
9438 (Output_segment::maximum_alignment): Likewise.
9439 (Output_segment::has_dynamic_reloc): New function replacing
9440 dynamic_reloc_count. Change all callers.
9441 (Output_segment::has_dynamic_reloc_list): New function replacing
9442 dynamic_reloc_count_list. Change all callers.
9443 (Output_segment::set_section_addresses): Rewrite.
9444 (Output_segment::set_offset): Rewrite.
9445 (Output_segment::find_first_and_last_list): Remove.
9446 (Output_segment::set_tls_offsets): Rewrite.
9447 (Output_segment::first_section_load_address): Likewise.
9448 (Output_segment::output_section_count): Likewise.
9449 (Output_segment::section_with_lowest_load_address): Likewise.
9450 (Output_segment::write_section_headers): Likewise.
9451 (Output_segment::print_sections_to_map): Likewise.
9452 * output.h (class Output_data): Remove dynamic_reloc_count_
9453 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
9454 (Output_data::add_dynamic_reloc): Rewrite.
9455 (Output_data::has_dynamic_reloc): New function.
9456 (Output_data::dynamic_reloc_count): Remove.
9457 (class Output_section): Add order_ field. Remvoe is_relro_local_,
9458 is_last_relro_, is_first_non_relro_, is_interp_,
9459 is_dynamic_linker_section_ fields. Add order and set_order
9460 functions. Remove is_relro_local, set_is_relro_local,
9461 is_last_relro, set_is_last_relro, is_first_non_relro,
9462 set_is_first_non_relro functions, is_interp, set_is_interp,
9463 is_dynamic_linker_section, and set_is_dynamic_linker_section
9464 functions.
9465 (class Output_segment): Change Output_data_list from std::list to
9466 std:;vector. Add output_lists_ field. Remove output_data_ and
9467 output_bss_ fields. Update declarations.
9468
9469 2010-08-02 Ian Lance Taylor <iant@google.com>
9470
9471 * arm.cc (Target_arm::gc_process_relocs): Use typename.
9472 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
9473 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
9474
9475 2010-08-02 Ian Lance Taylor <iant@google.com>
9476
9477 PR 11855
9478 * script.cc (Script_options::Script_options): Initialize
9479 symbol_definitions_ and symbol_references_.
9480 (Script_options::add_symbol_assignment): Update
9481 symbol_definitions_ and symbol_references_.
9482 (Script_options::add_symbol_reference): New function.
9483 (script_symbol): New function.
9484 * script.h (class Script_options): Add symbol_definitions_ and
9485 symbol_references_ fields.
9486 (Script_options::referenced_const_iterator): New type.
9487 (Script_options::referenced_begin): New function.
9488 (Script_options::referenced_end): New function.
9489 (Script_options::is_referenced): New function.
9490 (Script_options::any_unreferenced): New function.
9491 * script-c.h (script_symbol): Declare.
9492 * yyscript.y (exp): Call script_symbol.
9493 * symtab.cc: Include "script.h".
9494 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
9495 Change all callers. Check symbols referenced by scripts.
9496 (Symbol_table::add_undefined_symbols_from_command_line): Add
9497 layout parameter. Change all callers.
9498 (Symbol_table::do_add_undefined_symbols_from_command_line):
9499 Likewise. Break out loop body. Check symbols referenced by
9500 scripts.
9501 (Symbol_table::add_undefined_symbol_from_command_line): New
9502 function broken out of
9503 do_add_undefined_symbols_from_command_line.
9504 * symtab.h (class Symbol_table): Update declarations.
9505 * archive.cc: Include "layout.h".
9506 (Archive::should_include_member): Add layout parameter. Change
9507 all callers. Check for symbol mentioned in expression.
9508 * archive.h (class Archive): Update declaration.
9509 * object.cc (Sized_relobj::do_should_include_member): Add layout
9510 parameter.
9511 * object.h (Object::should_include_member): Add layout parameter.
9512 Change all callers.
9513 (Object::do_should_include_member): Add layout parameter.
9514 (class Sized_relobj): Update declaration.
9515 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
9516 parameter.
9517 * dynobj.h (class Sized_dynobj): Update declaration.
9518 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
9519 layout parameter.
9520 * plugin.h (class Sized_pluginobj): Update declaration.
9521
9522 2010-08-02 Ian Lance Taylor <iant@google.com>
9523
9524 PR 11866
9525 * output.cc (Output_segment::set_offset): Search for the first and
9526 last sections rather than assuming that the list is in order.
9527 (Output_segment::find_first_and_last_list): New function.
9528 * output.h (class Output_segment): Update declarations.
9529 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
9530 (relro_strip_test_SOURCES): New variable.
9531 (relro_strip_test_DEPENDENCIES): New variable.
9532 (relro_strip_test_LDFLAGS): New variable.
9533 (relro_strip_test_LDADD): New variable.
9534 (relro_strip_test.so): New target.
9535
9536 2010-08-02 Ian Lance Taylor <iant@google.com>
9537
9538 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
9539 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
9540 (Target_i386::got_tlsdesc_section): New function.
9541 (Target_i386::got_section): Create space for GOT entries for
9542 TLSDESC relocations.
9543 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
9544 R_386_TLS_GOTDESC.
9545 (Target_i386::Scan::global): Likewise.
9546 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
9547 using TLSDESC GOT.
9548 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
9549 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
9550 (Target_x86_64::got_tlsdesc_section): New function.
9551 (Target_x86_64::got_section): Create space for GOT entries for
9552 TLSDESC relocations.
9553 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
9554 R_386_TLS_GOTDESC.
9555 (Target_x86_64::Scan::global): Likewise.
9556 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
9557 using TLSDESC GOT.
9558
9559 2010-08-02 Ian Lance Taylor <iant@google.com>
9560
9561 * testsuite/final_layout.sh: Use dc to convert from hex to
9562 decimal.
9563
9564 2010-07-29 Sriraman Tallam <tmsriram@google.com>
9565
9566 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
9567 paramter to the call to gold::gc_process_relocs.
9568 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
9569 paramter to the call to gold::gc_process_relocs.
9570 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
9571 parameter to the call to gold::gc_process_relocs.
9572 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
9573 template parameter to the call to gold::gc_process_relocs.
9574 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
9575 paramter to the call to gold::gc_process_relocs.
9576 * gc.h (get_embedded_addend_size): New function.
9577 (gc_process_relocs): Save the size of the reloc for use by ICF.
9578 * icf.cc (get_section_contents): Get the addend from the text section
9579 for SHT_REL relocation sections.
9580 * icf.h (Icf::Reloc_addend_size_info): New typedef.
9581 (Icf::Reloc_info): Add new member reloc_addend_size_info.
9582 * int_encoding.h (read_from_pointer): New overloaded function.
9583 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
9584 * testsuite/icf_sht_rel_addend_test.sh: New file.
9585 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
9586 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
9587
9588 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9589
9590 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
9591 * Makefile.in: Regenerate.
9592 * testsuite/Makefile.in: Regenerate.
9593
9594 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
9595
9596 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
9597 * gold/testsuite/debug_msg.cc: Likewise.
9598 * gold/testsuite/odr_violation1.cc
9599 * gold/testsuite/odr_violation2.cc
9600
9601 2010-07-21 Cary Coutant <ccoutant@google.com>
9602
9603 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
9604 string, and length fields.
9605 (Output_merge_string::Merged_strings_list): New type.
9606 (Output_merge_string::Merged_strings_lists): New typedef.
9607 (Output_merge_string): Replace merged_strings_ with
9608 merged_strings_lists_.
9609 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
9610 Merged_strings_list per input object and section. Don't store pointer
9611 to the string. Don't store length with each merged string entry.
9612 (Output_merge_string::finalize_merged_data): Loop over list of merged
9613 strings lists. Recompute length of each merged string.
9614
9615 2010-07-15 Cary Coutant <ccoutant@google.com>
9616
9617 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
9618 here.
9619
9620 2010-07-14 Ian Lance Taylor <iant@google.com>
9621
9622 * descriptors.cc (Descriptors::open): Report correct name in error
9623 message.
9624
9625 2010-07-13 Doug Kwan <dougkwan@google.com>
9626
9627 * arm.cc (Arm_input_section::Arm_input_section): For a
9628 SHT_ARM_EXIDX section, always keeps the input sections.
9629 (Arm_input_section::set_exidx_section_link): New method.
9630 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
9631 has_errors_ to false.
9632 (Arm_exidx_input_section::has_errors,
9633 Arm_exidx_input_section::set_has_errors): New methods.
9634 (Arm_exidx_input_section::has_errors_): New data member.
9635 (Arm_relobj::get_exidx_shndx_list): New method.
9636 (Arm_output_section::append_text_sections_to_list): Do not skip
9637 section without SHF_EXECINSTR.
9638 (Arm_output_section::fix_exidx_coverage): Skip input sections with
9639 errors.
9640 (Arm_relobj::make_exidx_input_section): Add new parameter for text
9641 section header. Make error messages more verbose. Check for
9642 a non-executable section linked to an EXIDX section.
9643 (Arm_relobj::do_read_symbols): Remove error checking, which has been
9644 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
9645 check that there is no deferred EXIDX section if we exit early.
9646 Instead of not making an EXIDX section in case of an error, make one
9647 and set the has_errors flag of it.
9648 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
9649 in a relocatable link.
9650 (Target_arm::do_relax): Look for the EXIDX output section instead of
9651 assuming that it is called .ARM.exidx.
9652 (Target_arm::fix_exidx_coverage): Add a new parameter for input
9653 section list. Do not check for SHF_EXECINSTR section flags but
9654 skip any input section with errors.
9655 * output.cc (Output_section::Output_section): Initialize
9656 always_keeps_input_sections_ to false.
9657 (Output_section::add_input_section): Check for
9658 always_keeps_input_sections_.
9659 * output.h (Output_section::always_keeps_input_sections,
9660 Output_section::set_always_keeps_input_sections): New methods.
9661 (Output_section::always_keeps_input_sections): New data member.
9662
9663 2010-07-13 Rafael Espindola <espindola@google.com>
9664
9665 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
9666 * fileread.h (Input_file): Add try_extra_search_path and find_file.
9667
9668 2010-07-13 Philip Herron <herron.philip@googlemail.com>
9669 Ian Lance Taylor <iant@google.com>
9670
9671 * output.h (Output_section_lookup_maps::add_merge_section):
9672 Correct check of whether value was inserted.
9673 (Output_section_lookup_maps::add_merge_input_section): Likewise.
9674 (Output_section_lookup_maps::add_relaxed_input_section):
9675 Likewise.
9676 * arm.cc (Target_arm::got_section): Remove used local os.
9677 * i386.cc (Target_i386::got_section): Likewise.
9678 * x86_64.cc (Target_x86_64::got_section): Likewise.
9679 * sparc.cc (Target_sparc::got_section): Likewise.
9680 (Target_sparc::relocate): Remove unused local have_got_offset.
9681 * powerpc.cc (Target_powerpc::relocate): Likewise.
9682
9683 2010-07-13 Ian Lance Taylor <iant@google.com>
9684
9685 * compressed_output.cc (zlib_decompress): Fix signature in
9686 !HAVE_ZLIB_H case.
9687
9688 * archive.cc (Archive::include_member): Unlock an external member
9689 of a thin archive. Don't bother to delete an object we know is
9690 NULL.
9691
9692 2010-07-12 Cary Coutant <ccoutant@google.com>
9693
9694 * compressed_output.cc (zlib_decompress): New function.
9695 (get_uncompressed_size): New function.
9696 (decompress_input_section): New function.
9697 * compressed_output.h (get_uncompressed_size): New function.
9698 (decompress_input_section): New function.
9699 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
9700 Handle compressed debug sections.
9701 * layout.cc (is_compressed_debug_section): New function.
9702 (Layout::output_section_name): Map compressed section names to
9703 canonical names.
9704 * layout.h (is_compressed_debug_section): New function.
9705 (is_debug_info_section): Recognize compressed debug sections.
9706 * merge.cc: Include compressed_output.h.
9707 (Output_merge_data::do_add_input_section): Handle compressed
9708 debug sections.
9709 (Output_merge_string::do_add_input_section): Handle compressed
9710 debug sections.
9711 * object.cc: Include compressed_output.h.
9712 (Sized_relobj::Sized_relobj): Initialize new data members.
9713 (build_compressed_section_map): New function.
9714 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
9715 * object.h (Object::section_is_compressed): New method.
9716 (Object::do_section_is_compressed): New method.
9717 (Sized_relobj::Compressed_section_map): New type.
9718 (Sized_relobj::do_section_is_compressed): New method.
9719 (Sized_relobj::compressed_sections_): New data member.
9720 * output.cc (Output_section::add_input_section): Handle compressed
9721 debug sections.
9722 * reloc.cc: Include compressed_output.h.
9723 (Sized_relobj::write_sections): Handle compressed debug sections.
9724
9725 2010-07-08 Cary Coutant <ccoutant@google.com>
9726
9727 * resolve.cc (Symbol_table::resolve): Remember whether undef was
9728 weak when resolving to a dynamic def.
9729 (Symbol_table::should_override): Add adjust_dyndef flag; set it
9730 for weak undef/dynamic def cases. Adjust callers.
9731 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
9732 undef_binding_weak_.
9733 (Symbol_table::sized_write_globals): Adjust symbol binding.
9734 (Symbol_table::sized_write_symbol): Add binding parameter.
9735 * symtab.h (Symbol::set_undef_binding): New method.
9736 (Symbol::is_undef_binding_weak): New method.
9737 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
9738 (Symbol_table::should_override): Add new parameter.
9739 (Symbol_table::sized_write_symbol): Add new parameter.
9740
9741 * testsuite/weak_undef_file1.cc: Add new test case.
9742 * testsuite/weak_undef_file2.cc: Fix header comment.
9743 * testsuite/weak_undef_test.cc: Add new test case.
9744
9745 2010-06-29 Doug Kwan <dougkwan@google.com>
9746
9747 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
9748 Initialize USE_SYMBOL_.
9749 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
9750 definition.
9751 (Arm_reloc_property::uses_symbol_): New data member declaration.
9752 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
9753 uses symbol value and symbol is undefined but not weakly undefined.
9754
9755 2010-06-28 Rafael Espindola <espindola@google.com>
9756
9757 * plugin.cc (Plugin::load): Use dlerror.
9758
9759 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
9760
9761 * symtab.cc (detect_odr_violations): When reporting an ODR
9762 violation, report an object where the symbol is defined.
9763
9764 2010-06-25 Doug Kwan <dougkwan@google.com>
9765
9766 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
9767 (Target_arm::section_may_have_icf_unsafe_pointers): New method
9768 definition.
9769 (Target_arm::Scan::local_reloc_may_be_function_pointer,
9770 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
9771 target hook to detect function points.
9772 (Target_arm::Scan::possible_function_pointer_reloc): New method.
9773 * icf.h (Icf::check_section_for_function_pointers): Change type of
9774 parameter SECTION_NAME to const reference to std::string. Use
9775 target hook to determine if section may have unsafe pointers.
9776 * target.h (Target::section_may_have_icf_unsafe_pointers): New
9777 method definition.
9778
9779 2010-06-21 Rafael Espindola <espindola@google.com>
9780
9781 * fileread.cc (Input_file::find_fie): New
9782 (Input_file::open): Use Input_file::find_fie.
9783 * fileread.h (Input_file::find_fie): New
9784 * plugin.cc (set_extra_library_path): New.
9785 (Plugin::load): Add set_extra_library_path to the transfer vector.
9786 (Plugin_manager::set_extra_library_path): New.
9787 (Plugin_manager::add_input_file): Use the extra search path if set.
9788 (set_extra_library_path(): New.
9789 * plugin.h (Plugin_manager): Add set_extra_library_path and
9790 extra_search_path_.
9791
9792 2010-06-19 Cary Coutant <ccoutant@google.com>
9793
9794 * layout.cc (gdb_sections): Add .debug_types.
9795 (lines_only_debug_sections): Likewise.
9796
9797 2010-06-18 Rafael Espindola <espindola@google.com>
9798
9799 * plugin.cc (add_input_file,add_input_library)
9800 (Plugin_manager::add_input_file): Make filename arguments const.
9801 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
9802 const.
9803
9804 2010-06-16 Doug Kwan <dougkwan@google.com>
9805
9806 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
9807 .ARM.attributes section if we have not merged any input
9808 attributes sections.
9809
9810 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9811
9812 * arm.cc: Allow combining objects with no EABI version
9813 information.
9814
9815 2010-06-15 Rafael Espindola <espindola@google.com>
9816
9817 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
9818
9819 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9820
9821 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
9822 (struct iovec): Correct !HAVE_READV definition.
9823
9824 2010-06-10 Cary Coutant <ccoutant@google.com>
9825
9826 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
9827 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
9828 reloc sections.
9829 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
9830
9831 PR 11683
9832 * symtab.h (Symbol::is_placeholder): New member function.
9833 * target-reloc.h (relocate_section): Check for placeholder symbols.
9834
9835 * testsuite/Makefile.am (plugin_test_8): New test.
9836 (plugin_test_9): New test.
9837 * testsuite/Makefile.in: Regenerate.
9838
9839 2010-06-09 Nick Clifton <nickc@redhat.com>
9840
9841 * yyscript.y (input_list_element): Allow strings prefixed with
9842 the '-' character. Treat these as libraries.
9843 * script.cc (script_add_library): New function. Adds a library
9844 specified by "-l<name>" found in an input script.
9845 * script-c.h: Add prototype for script_add_library.
9846
9847 2010-06-07 Doug Kwan <dougkwan@google.com>
9848
9849 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
9850 Restrict stub-group size to be within long conditional branch
9851 range when working around cortex-A8 erratum.
9852
9853 2010-06-07 Damien Diederen <dd@crosstwine.com>
9854
9855 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
9856 #ifdef typo.
9857
9858 2010-06-03 Sriraman Tallam <tmsriram@google.com>
9859
9860 PR gold/11658
9861 * output.cc
9862 (Output_section::Input_section_sort_entry::compare_section_ordering):
9863 Change to return non-zero correctly.
9864 (Output_section::Input_section_sort_section_order_index_compare
9865 ::operator()): Change to fix ambiguity in comparisons.
9866
9867 2010-06-01 Sriraman Tallam <tmsriram@google.com>
9868
9869 * gold.h (is_wildcard_string): New function.
9870 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
9871 (Layout::layout_eh_frame): Ditto.
9872 (Layout::find_section_order_index): New method.
9873 (Layout::read_layout_from_file): New method.
9874 * layout.h (Layout::find_section_order_index): New method.
9875 (Layout::read_layout_from_file): New method.
9876 (Layout::input_section_position_): New private member.
9877 (Layout::input_section_glob_): New private member.
9878 * main.cc (main): Call read_layout_from_file here.
9879 * options.h (--section-ordering-file): New option.
9880 * output.cc (Output_section::input_section_order_specified_): New
9881 member.
9882 (Output_section::Output_section): Initialize new member.
9883 (Output_section::add_input_section): Add new parameter.
9884 Keep input sections when --section-ordering-file is used.
9885 (Output_section::set_final_data_size): Sort input sections when
9886 section ordering file is specified.
9887 (Output_section::Input_section_sort_entry): Add new parameter.
9888 Check sorting type.
9889 (Output_section::Input_section_sort_entry::compare_section_ordering):
9890 New method.
9891 (Output_section::Input_section_sort_compare::operator()): Change to
9892 consider section_order_index.
9893 (Output_section::Input_section_sort_init_fini_compare::operator()):
9894 Change to consider section_order_index.
9895 (Output_section::Input_section_sort_section_order_index_compare
9896 ::operator()): New method.
9897 (Output_section::sort_attached_input_sections): Change to sort
9898 according to section order when specified.
9899 (Output_section::add_input_section<32, true>): Add new parameter.
9900 (Output_section::add_input_section<64, true>): Add new parameter.
9901 (Output_section::add_input_section<32, false>): Add new parameter.
9902 (Output_section::add_input_section<64, false>): Add new parameter.
9903 * output.h (Output_section::add_input_section): Add new parameter.
9904 (Output_section::input_section_order_specified): New
9905 method.
9906 (Output_section::set_input_section_order_specified): New method.
9907 (Input_section::Input_section): Initialize section_order_index_.
9908 (Input_section::section_order_index): New method.
9909 (Input_section::set_section_order_index): New method.
9910 (Input_section::section_order_index_): New member.
9911 (Input_section::Input_section_sort_section_order_index_compare): New
9912 struct.
9913 (Output_section::input_section_order_specified_): New member.
9914 * script-sections.cc (is_wildcard_string): Delete and move modified
9915 method to gold.h.
9916 (Output_section_element_input::Output_section_element_input): Modify
9917 call to is_wildcard_string.
9918 (Output_section_element_input::Input_section_pattern
9919 ::Input_section_pattern): Ditto.
9920 (Output_section_element_input::Output_section_element_input): Ditto.
9921 * testsuite/Makefile.am (final_layout): New test case.
9922 * testsuite/Makefile.in: Regenerate.
9923 * testsuite/final_layout.cc: New file.
9924 * testsuite/final_layout.sh: New file.
9925
9926 2010-06-01 Rafael Espindola <espindola@google.com>
9927
9928 * plugin.cc (Plugin::load): Pass the output name to the plugin.
9929
9930 2010-06-01 Rafael Espindola <espindola@google.com>
9931
9932 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
9933 visibility of symbols.
9934
9935 2010-05-27 Doug Kwan <dougkwan@google.com>
9936
9937 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
9938 from start of output section instead of address for a local symbol
9939 in a merged or relaxed section when doing a relocatable link.
9940
9941 2010-05-26 Rafael Espindola <espindola@google.com>
9942
9943 PR 11604
9944 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
9945 adding sections the garbage collector removed.
9946 * gold/testsuite/Makefile.am: Add test.
9947 * gold/testsuite/Makefile.in: Regenerate.
9948 * gold/testsuite/plugin_test_7.sh: New.
9949 * gold/testsuite/plugin_test_7_1.c: New.
9950 * gold/testsuite/plugin_test_7_2.c: New.
9951
9952 2010-05-26 Rafael Espindola <espindola@google.com>
9953
9954 * script-sections.cc (Output_section_definition::set_section_addresses):
9955 Check for --section-start.
9956
9957 2010-05-26 Doug Kwan <dougkwan@google.com>
9958
9959 * arm.cc (Arm_scan_relocatable_relocs): New class.
9960 (Target_arm::relocate_special_relocatable): New method.
9961 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
9962 (Arm_relocate_functions::thumb_branch_common): Same.
9963 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
9964 instead of Default_scan_relocatable_relocs.
9965 * target-reloc.h (relocate_for_relocatable): Let target handle
9966 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
9967 * target.h (Sized_target::relocate_special_relocatable): New method.
9968
9969 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9970
9971 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
9972
9973 2010-05-23 Doug Kwan <dougkwan@google.com>
9974
9975 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
9976 instead of a cast.
9977 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
9978 with a direct branch, not a conditional branch, to a stub.
9979 * merge.cc (Output_merge_base::record_input_section): New method
9980 defintion.
9981 (Output_merge_data::do_add_input_section): Record input section if
9982 keeps-input-sections flag is set.
9983 (Output_merge_string::do_add_input_section): Ditto.
9984 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
9985 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
9986 INPUT_SECTIONS_.
9987 (Output_merge_base::keeps_input_sections,
9988 Output_merge_base::set_keeps_input_sections,
9989 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
9990 method definitions.
9991 (Output_merge_base::Input_sections): New type declaration.
9992 (Output_merge_base::input_sections_begin,
9993 Output_merge_base::input_sections_end,
9994 Output_merge_base::do_set_keeps_input_sections): New method definitions.
9995 (Output_merge_base::bool keeps_input_sections_,
9996 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
9997 Output_merge_base::input_sections_): New data members.
9998 (Output_merge_data::do_set_keeps_input_sections): New method
9999 defintion.
10000 (Output_merge_string::do_set_keeps_input_sections): Ditto.
10001 * output.cc (Output_section::Input_section::relobj): Move method
10002 defintion from class declaration to here and handle merge sections.
10003 (Output_section::Input_section::shndx): Ditto.
10004 (Output_section::Output_section): Remove initializations of removed
10005 data members and initialize new data member LOOKUP_MAPS_.
10006 (Output_section::add_input_section): Set keeps-input-sections flag
10007 for a newly created merge output section as appropriate. Adjust code
10008 to use Output_section_lookup_maps class.
10009 (Output_section::add_relaxed_input_section): Adjst code for lookup
10010 maps code refactoring.
10011 (Output_section::add_merge_input_section): Add a new parameter
10012 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
10013 class. If adding input section to a newly created merge output
10014 section fails, remove the new merge section.
10015 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
10016 Adjust code for use of the Output_section_lookup_maps class.
10017 (Output_section::find_merge_section): Ditto.
10018 (Output_section::build_lookup_maps): New method defintion.
10019 (Output_section::find_relaxed_input_section): Adjust code to use
10020 Output_section_lookup_maps class.
10021 (Output_section::get_input_sections): Export merge sections. Adjust
10022 code to use Output_section_lookup_maps class.
10023 (Output_section:::add_script_input_section): Adjust code to use
10024 Output_section_lookup_maps class. Update lookup maps for merge
10025 sections also.
10026 (Output_section::discard_states): Use Output_section_lookup_maps.
10027 (Output_section::restore_states): Same.
10028 * output.h (Merge_section_properties): Move class defintion out of
10029 Output_section.
10030 (Output_section_lookup_maps): New class.
10031 (Output_section::Input_section::is_merge_section): New method
10032 defintion.
10033 (Output_section::Input_section::relobj): Move defintion out of class
10034 defintion. Declare method only.
10035 (Output_section::Input_section::shndx): Ditto.
10036 (Output_section::Input_section::output_merge_base): New method defintion.
10037 (Output_section::Input_section::u2_.pomb): New union field.
10038 (Output_section::Merge_section_by_properties_map,
10039 Output_section::Output_section_data_by_input_section_map,
10040 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
10041 Remove types.
10042 (Output_section::add_merge_input_section): Add new parameter
10043 KEEPS_INPUT_SECTIONS.
10044 (Output_section::build_lookup_maps): New method declaration.
10045 (Output_section::merge_section_map_,
10046 Output_section::merge_section_by_properties_map_,
10047 Output_section::relaxed_input_section_map_,
10048 Output_section::is_relaxed_input_section_map_valid_): Remove data
10049 members.
10050 (Output_section::lookup_maps_): New data member.
10051
10052 2010-05-21 Doug Kwan <dougkwan@google.com>
10053
10054 PR gold/11619
10055 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
10056 avoid a compilation error.
10057
10058 2010-05-19 Rafael Espindola <espindola@google.com>
10059
10060 * script-sections.cc (Output_section_definition::allocate_to_segment):
10061 Update the phdrs_list even when the output section is NULL.
10062 * testsuite/Makefile.am: Add test.
10063 * testsuite/Makefile.in: Regenerate.
10064 * testsuite/script_test_9.cc: New.
10065 * testsuite/script_test_9.sh: New.
10066 * testsuite/script_test_9.t: New.
10067
10068 2010-05-19 Doug Kwan <dougkwan@google.com>
10069
10070 * arm.cc (Arm_input_section::original_size): New method.
10071 (Arm_input_section::do_addralign): Add a cast.
10072 (Arm_input_section::do_output_offset): Remove static cast.
10073 (Arm_input_section::original_addralign,
10074 Arm_input_section::original_size_): Change type to uint32_t.
10075 (Arm_input_section::init): Add safe casts for section alignment
10076 and size.
10077 (Arm_input_section::set_final_data_size): Do not set address and
10078 offset of stub table.
10079 (Arm_output_section::fix_exidx_coverage): Change use of of
10080 Output_section::Simple_input_section to that of
10081 Output_section::Input_section.
10082 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
10083 except for the first pass.
10084 * output.cc (Output_section::get_input_sections): Change type of
10085 input_sections to std::list<Input_section>.
10086 (Output_section::add_script_input_section): Rename from
10087 Output_section::add_simple_input_section. Change type of SIS
10088 parameter from Simple_input_section to Input_section.
10089 * output.h (Output_section::Simple_input_section): Remove class.
10090 (Output_section::Input_section): Change class visibility to public.
10091 (Output_section::Input_section::addralign): Use stored alignments
10092 for special input sections if set.
10093 (Output_section::Input_section::set_addralign): New method.
10094 (Output_section::get_input_sections): Change parameter type from
10095 list of Simple_input_section to list of Input_section.
10096 (Output_section::add_script_input_section): Rename from
10097 Output_section::add_simple_input_section. Change first parameter's
10098 type from Simple_input_section to Input_section and remove the
10099 second and third parameters.
10100 * script-sections.cc (Input_section::Input_section_list): Change
10101 type to list of Output_section::Input_section/
10102 (Input_section_info::Input_section_info): Change parameter type of
10103 INPUT_SECTION to Output_section::Input_section.
10104 (Input_section_info::input_section): Change return type.
10105 (Input_section_info::input_section_): Change type to
10106 Output_section::Input_section.
10107 (Output_section_element_input::set_section_addresses): Adjust code
10108 to use Output_section::Input_section instead of
10109 Output_section::Simple_input_section. Adjust code for renaming
10110 of Output_section::add_simple_input_section.
10111 (Orphan_output_section::set_section_addresses): Ditto.
10112
10113 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10114
10115 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
10116 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
10117
10118 2010-05-18 Rafael Espindola <espindola@google.com>
10119
10120 * options.cc (General_options::finalize): Handle -nostdlib.
10121 * options.h (nostdlib): New option.
10122 * script.cc (script_add_search_dir): Handle -nostdlib.
10123
10124 2010-05-12 Doug Kwan <dougkwan@google.com>
10125
10126 * arm.cc (Target_arm::do_finalize_sections): Create an empty
10127 attributes section only if there no attributes section after merging.
10128 (Target_arm::merge_object_attributes): Move value of
10129 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
10130 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
10131 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
10132 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
10133 and arm_attr_merge_7.stdout.
10134 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
10135 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
10136 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
10137 arm_attr_merge_7b.o): New rules.
10138 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
10139 arm_attr_merge_7
10140 * testsuite/Makefile.in: Regenerate.
10141 * testsuite/arm_attr_merge.sh: New file.
10142 * testsuite/arm_attr_merge_[67][ab].s: Same.
10143
10144 2010-05-05 Nick Clifton <nickc@redhat.com>
10145
10146 * po/es.po: Updated Spanish translation.
10147
10148 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
10149
10150 * Makefile.am (install-exec-local): Properly install gold as
10151 default cross linker.
10152 * Makefile.in: Regenerated.
10153
10154 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
10155 Nick Clifton <nickc@redhat.com>
10156
10157 * configure.ac (install_as_default): Define and set to false
10158 unless --enable-gold or --enable-gold=both/gold has been
10159 specified.
10160 * configure: Regenerate.
10161
10162 * Makefile.am (install-exec-local): Install the executable as
10163 'ld.gold'. If install_as_default is true then also install it as
10164 'ld'.
10165 * Makefile.in: Regenerated.
10166
10167 2010-04-24 Ian Lance Taylor <iant@google.com>
10168
10169 * layout.cc (Layout::layout_reloc): In relocatable link don't
10170 combine reloc sections for grouped sections.
10171
10172 2010-04-23 Sriraman Tallam <tmsriram@google.com>
10173
10174 * gc.h (gc_process_relocs): Pass information on relocs pointing to
10175 sections that are not ordinary to icf.
10176 * icf.cc (get_section_contents): Handle relocation pointing to section
10177 with no object or shndx information.
10178 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
10179 * testsuite/Makefile.in: Regenerate.
10180 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
10181 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
10182
10183 2010-04-22 Ian Lance Taylor <iant@google.com>
10184
10185 * expression.cc (Expression::Expression_eval_info): Add
10186 result_alignment_pointer field.
10187 (Expression::eval_with_dot): Add result_alignment_pointer
10188 parameter. Change all callers.
10189 (Expression::eval_maybe_dot): Likewise.
10190 (class Binary_expression): Add alignment_pointer parameter to
10191 left_value and right_value. Change all callers.
10192 (BINARY_EXPRESSION): Set result alignment.
10193 (class Trinary_expression): Add alignment_pointer parameter to
10194 arg2_value and arg3_value. Change all callers.
10195 (Trinary_cond::value): Set result alignment.
10196 (Max_expression::value, Min_expression::value): Likewise.
10197 (Align_expression::value): Likewise.
10198 * script-sections.cc (class Sections_element): Add dot_alignment
10199 parameter to set_section_addresses virtual function. Update
10200 instantiations.
10201 (class Output_section_element): Likewise.
10202 (Script_sections::create_segments): Add dot_alignment parameter.
10203 Change all callers.
10204 (Script_sections::create_segments_from_phdrs_clause): Likewise.
10205 (Script_sections::set_phdrs_clause_addresses): Likewise.
10206 * script-sections.h: Update declarations.
10207 * script.h: Update declarations.
10208 * output.h (Output_segment::set_minimum_p_align): Don't decrease
10209 min_p_align.
10210 * testsuite/script_test_3.t: Set large alignment.
10211 * testsuite/script_test_3.sh: Make sure that at least one LOAD
10212 segment has expected alignment.
10213
10214 2010-04-22 Nick Clifton <nickc@redhat.com>
10215
10216 * po/gold.pot: Updated by the Translation project.
10217 * po/vi.po: Updated Vietnamese translation.
10218
10219 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
10220
10221 * testsuite/Makefile.am (check_PROGRAMS): Add
10222 icf_virtual_function_folding_test.
10223 * testsuite/Makefile.in: Regenerated.
10224
10225 2010-04-15 Andrew Haley <aph@redhat.com>
10226
10227 * options.h (merge_exidx_entries): New option.
10228 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
10229 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
10230 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
10231 (Target_arm::merge_exidx_entries): New function.
10232 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
10233 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
10234 to Arm_exidx_fixup constructor.
10235 Add new arg, merge_exidx_entries.
10236 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
10237 Arm_output_section::fix_exidx_coverage.
10238
10239 2010-04-18 Sriraman Tallam <tmsriram@google.com>
10240
10241 * icf.cc (get_section_contents): Check for preemptible functions.
10242 Ignore addend when appropriate.
10243 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
10244 section folded.
10245 (add_from_relobj): Check for section folded.
10246 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
10247 * symtab.h (should_add_dynsym_entry): Add new parameter.
10248 * target-reloc.h (scan_relocs): Check for section folded.
10249 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
10250 Check reloc types for function pointers in shared objects.
10251 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
10252 case.
10253 (icf_preemptible_functions_test): New test case.
10254 (icf_string_merge_test): New test case.
10255 * testsuite.Makefile.in: Regenerate.
10256 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
10257 bar_glob. Refactor code.
10258 * testsuite/icf_preemptible_functions_test.cc: New file.
10259 * testsuite/icf_preemptible_functions_test.sh: New file.
10260 * testsuite/icf_string_merge_test.cc: New file.
10261 * testsuite/icf_string_merge_test.sh: New file.
10262 * testsuite/icf_virtual_function_folding_test.cc: New file.
10263 * testsuite/icf_virtual_function_folding_test.sh: New file.
10264
10265 2010-04-14 Doug Kwan <dougkwan@google.com>
10266
10267 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
10268 for local symbol recounting if we remove a section due to ICF.
10269 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
10270 there are no regular objects in input.
10271
10272 2010-04-13 Doug Kwan <dougkwan@google.com>
10273
10274 * arm.cc (Arm_input_section::set_final_data_size): Compute
10275 accurate final data size instead of using current data size.
10276
10277 2010-04-09 Doug Kwan <dougkwan@google.com>
10278
10279 * layout.cc (Layout::choose_output_section): Handle script section
10280 types.
10281 (Layout::make_output_section_for_script): Add section type parameter.
10282 Handle script section types.
10283 * layout.h (Layout::make_output_section_for_script): Add section
10284 type parameter.
10285 * output.cc (Output_section::Output_section): Initialize data member
10286 is_noload_.
10287 (Output_section::do_reset_address_and_file_offset): Do not set address
10288 to 0 if section is a NOLOAD section.
10289 * output.h (Output_section::is_noload): New method.
10290 (Output_section::set_is_noload): Ditto.
10291 (Output_section::is_noload_): New data member.
10292 * script-c.h (Script_section_type): New enum type.
10293 (struct Parser_output_section_header): Add new file section_type.
10294 * script-sections.cc (Sections_element::output_section_name): Add
10295 parameter for returning script section type.
10296 (Output_section_definition::output_section_name): Ditto.
10297 (Output_section_definition::section_type)P; New method.
10298 (Output_section_definiton::script_section_type_name): Ditto.
10299 (Output_section_definition::script_section_type_): New data member.
10300 (Output_section_definition::Output_section_definition): Initialize
10301 data member Output_section_definition::script_section_type_.
10302 (Output_section_definition::create_sections): Pass script section type
10303 to Layout::make_output_section_for_script.
10304 (Output_section_definition::output_section_name): Return script
10305 section type to caller.
10306 (Output_section_definition::set_section_address): Do not advance
10307 dot value and load address if section type is NOLOAD. Set address
10308 of NOLOAD sections regardless of section flags.
10309 (Output_section_definition::print): Print section type if it is
10310 not SCRIPT_SECTION_TYPE_NONE.
10311 (Output_section_definition::section_type): New method.
10312 (Output_section_definition::script_section_type_name): Ditto.
10313 (Script_sections::output_section_name): Add new parameter
10314 PSECTION_TYPE for returning script section type. Pass it to
10315 section elements. Handle discard sections.
10316 (Sort_output_sections::operator()): Handle NOLOAD sections.
10317 * script-sections.h (Script_sections::Section_type): New enum type.
10318 (Script_sections::output_section_name): Add a new parameter for
10319 returning script section type.
10320 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
10321 INFO and NOLOAD.
10322 * yyscript.y (union): Add new field SECTION_TYPE.
10323 (COPY, DSECT, INFO, NOLOAD): New tokens.
10324 (opt_address_and_section_type): Change type to output_section_header.
10325 (section_type): New non-terminal
10326 (section_header): Handle section type.
10327 (opt_address_and_section_type): Return section type value.
10328
10329 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
10330
10331 * testsuite/plugin_common_test_1.c (foo): Add prototype.
10332 * testsuite/plugin_common_test_2.c (foo): Likewise.
10333
10334 2010-04-08 Doug Kwan <dougkwan@google.com>
10335
10336 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
10337 Output_merge_data.
10338 * output.cc (Output_section::add_merge_input_section): Simplify
10339 code and return status of Output_merge_base::add_input_section.
10340 Update merge section map only if Output_merge_base::add_input_section
10341 returns true.
10342
10343 2010-04-07 Doug Kwan <dougkwan@google.com>
10344
10345 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
10346 if section is marked as containing instructions but has no mapping
10347 symbols.
10348 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
10349 correct section index.
10350 (Arm_relobj::find_linked_text_section): Ditto.
10351
10352 2010-04-07 Cary Coutant <ccoutant@google.com>
10353
10354 * archive.cc (include_member): Destroy Read_symbols_data object before
10355 releasing file.
10356 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
10357 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
10358 (Read_symbols_data::~Read_symbols_data) New destructor.
10359 (Section_relocs::Section_relocs) New constructor.
10360 (Section_relocs::~Section_relocs) New destructor.
10361 (Read_relocs_data::Read_relocs_data) New constructor.
10362 (Read_relocs_data::~Read_relocs_data) New destructor.
10363 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
10364 pointers to NULL after deleting.
10365
10366 2010-04-07 Doug Kwan <dougkwan@google.com>
10367
10368 * arm.cc: Replace "endianity" with "endianness" in comments.
10369 (Arm_exidx_cantunwind): Ditto.
10370 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
10371 (Arm_relobj::merge_flags_and_attributes): New method.
10372 (Arm_relobj::merge_flags_and_attributes_): New data member.
10373 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
10374 (Arm_relobj::scan_sections_for_stubs): Ditto.
10375 (Arm_relobj::do_read_symbols): Check to see if we really want to
10376 merge processor-specific flags and attributes. Exit early if
10377 an object is empty except for section names and the undefined symbol.
10378 (Target_arm::do_finalize_sections): Move check for ELF format to
10379 Arm_relobj::do_read_symbols. Merge processor specific flags and
10380 attributes from a regular object only when we have determined that
10381 it is aapropriate. Do not create an .ARM.attributes section in
10382 output if there is no regular input object.
10383 (Target_arm::merge_processor_specific_flags): Check
10384 --warn-mismatch before printing any error.
10385 (Target_arm::merge_object_attributes): Ditto.
10386 * gold.cc (queue_middle_tasks): Handle the case in which there is
10387 no regular object in input.
10388 * options.cc (General_options::parse_EB): New method.
10389 (General_options::parse_EL): Same.
10390 (General_options::General_options): Initialize endianness_.
10391 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
10392 New options.
10393 (General_options::Endianness): New enum.
10394 (General_options::endianness): New method.
10395 (General_options::endianness_): New data member.
10396 * parameters.cc (Parameters::set_options): Check target endianness.
10397 (Parameters::set_target_once): Ditto.
10398 (Parameters::check_target_endianness): New method.
10399 (parameters_force_valid_target): If either -EL or -EB is specified,
10400 use it to define endianness of default target.
10401 * parameters.h (Parameters::check_target_endianness): New method
10402 declaration.
10403 * target.h (class Target): Change "endianity" to "endianness"
10404 in comments.
10405
10406 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10407
10408 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
10409 * configure: Regenerate.
10410 * Makefile.in: Regenerate.
10411 * testsuite/Makefile.in: Regenerate.
10412
10413 2010-04-06 Cary Coutant <ccoutant@google.com>
10414
10415 gcc PR lto/42757
10416 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
10417 prevailing definitions of common symbols.
10418 * testsuite/plugin_test_6.sh: New test case.
10419 * testsuite/plugin_common_test_1.c: New test case.
10420 * testsuite/plugin_common_test_2.c: New test case.
10421 * testsuite/Makefile.am (plugin_test_6): New test case.
10422 * testsuite/Makefile.in: Regenerate.
10423
10424 2010-04-06 Nick Clifton <nickc@redhat.com>
10425
10426 * po/vi.po: New Vietnamese translation.
10427
10428 2010-03-30 Doug Kwan <dougkwan@google.com>
10429
10430 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
10431
10432 2010-03-25 Doug Kwan <dougkwan@google.com>
10433
10434 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
10435 to avoid a conversion warning on a 32-bit host.
10436
10437 2010-03-24 Ian Lance Taylor <iant@google.com>
10438
10439 * testsuite/script_test_3.t: Add a TLS segment.
10440 * testsuite/Makefile.am (check_PROGRAMS): Add
10441 tls_phdrs_script_test.
10442 (tls_phdrs_script_test_SOURCES): Define.
10443 (tls_phdrs_script_test_DEPENDENCIES): Define.
10444 (tls_phdrs_script_test_LDFLAGS): Define.
10445 (tls_phdrs_script_test_LDADD): Define.
10446 * testsuite/Makefile.in: Rebuild.
10447
10448 2010-03-23 Cary Coutant <ccoutant@google.com>
10449
10450 * fileread.cc (find_or_make_view): Fix comment.
10451
10452 2010-03-23 Ian Lance Taylor <iant@google.com>
10453
10454 * script-sections.cc (class Orphan_section_placement): Define
10455 PLACE_TLS and PLACE_TLS_BSS.
10456 (Orphan_section_placement::Orphan_section_placement): Initialize
10457 new places.
10458 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
10459 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
10460 (tls_script_test_SOURCES): Define.
10461 (tls_script_test_DEPENDENCIES): Define.
10462 (tls_script_test_LDFLAGS): Define.
10463 (tls_script_test_LDADD): Define.
10464 * testsuite/Makefile.in: Rebuild.
10465
10466 2010-03-22 Doug Kwan <dougkwan@google.com>
10467
10468 * arm.cc (Arm_relocate_functions::abs8,
10469 Arm_relocate_functions::abs16): Use correct check for overflow
10470 specified in the ARM ELF specs.
10471 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
10472 target of a BLX instruction specially.
10473 (Reloc_stub::stub_type_for_reloc): Ditto.
10474 (Relocate::relocate): Use symbolic names instead of numeric relocation
10475 codes to report error.
10476 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
10477 workaround.
10478 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
10479 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
10480 thumb2_blx_out_of_range.stdout
10481 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
10482 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
10483 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
10484 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
10485 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
10486 thumb2_blx_in_range, thumb2_blx_in_range.o,
10487 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
10488 thumb2_blx_out_of_range.o): New rules.
10489 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
10490 thumb2_blx_in_range and thumb2_blx_out_of_range.
10491 * testsuite/Makefile.in: Regenerate.
10492 * arm_branch_in_range.sh: Add tests for THUMB BLX.
10493 * testsuite/thumb_blx_in_range.s: New file.
10494 * testsuite/thumb_blx_out_of_range.s: New file.
10495
10496 2010-03-22 Rafael Espindola <espindola@google.com>
10497
10498 * archive.cc (Should_include): Move to archive.h.
10499 (should_include_member): Make it a member of Archive.
10500 (Lib_group): New.
10501 (Add_lib_group_symbols): New.
10502 * archive.h: Include options.h.
10503 (Archive_member): Moved from Archive.
10504 (Should_include): Moved from archive.cc.
10505 (Lib_group): New.
10506 (Add_lib_group_symbols): New.
10507 * dynobj.cc (do_should_include_member): New.
10508 * dynobj.h (do_should_include_member): New.
10509 * gold.cc (queue_initial_tasks): Update call to queue.
10510 * main.cc (main): Print lib group stats.
10511 * object.cc (do_should_include_member): New.
10512 * object.h: Include archive.h.
10513 (Object::should_include_member): New.
10514 (Object::do_should_include_member): New.
10515 (Sized_relobj::do_should_include_member): New.
10516 * options.cc (General_options::parse_start_lib): New.
10517 (General_options::parse_end_lib): New.
10518 (Input_arguments::add_file): Handle lib groups.
10519 (Input_arguments::start_group): Check we are not in a lib.
10520 (Input_arguments::start_lib): New.
10521 (Input_arguments::end_lib): New.
10522 * options.h (General_options): Add start_lib and end_lib.
10523 (Input_argument::lib_): New.
10524 (Input_argument::lib): New.
10525 (Input_argument::is_lib): New.
10526 (Input_file_lib): New.
10527 (Input_arguments::in_lib_): New.
10528 (Input_arguments::in_lib): New.
10529 (Input_arguments::start_lib): New.
10530 (Input_arguments::end_lib_): New.
10531 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
10532 in unused members as preempted.
10533 (Sized_pluginobj::do_should_include_member): New.
10534 * plugin.h (Sized_pluginobj::do_should_include_member): New.
10535 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
10536 return the blocker.
10537 (Read_symbols::do_whole_lib_group): New.
10538 (Read_symbols::do_lib_group): New.
10539 (Read_symbols::do_read_symbols): Handle lib groups.
10540 (Read_symbols::get_name): Handle lib groups.
10541 * readsyms.h (Read_symbols): Add an archive member pointer.
10542 (Read_symbols::do_whole_lib_group): New.
10543 (Read_symbols::do_lib_group): New.
10544 (Read_symbols::member_): New.
10545 * script.cc (read_input_script): Update call to queue_soon.
10546
10547 2010-03-19 Doug Kwan <dougkwan@google.com>
10548
10549 * arm.cc (Stub_table::Stub_table): Initialize new data members
10550 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10551 (Stub_table::add_reloc_stub): Assign stub offset and update
10552 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10553 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
10554 New data members.
10555 (Stub_table::update_data_size_and_addralign): Use
10556 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
10557 instead of going over all reloc stubs.
10558 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
10559 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10560 Stringpool_template::offset_ to size of Stringpool_char.
10561 (Stringpool_template::new_key_offset): Remove code to initialize
10562 Stringpool_template::offset_.
10563 * stringpool.h (Stringpool_template::set_no_zero_null): Set
10564 Stringpool_template::offset_ to zero.
10565
10566 2010-03-15 Doug Kwan <dougkwan@google.com>
10567
10568 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10569 offset_.
10570 (Stringpool_template::new_key_offset): New method.
10571 (Stringpool_template::add_string): Assign offsets when adding new
10572 strings.
10573 (Stringpool_template::set_string_offsets): Do not set string offsets
10574 when not optimizing.
10575 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
10576 member size_.
10577 (Chunked_vector::clear): Clear size_.
10578 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
10579 (Chunked_vector::size): Return size_.
10580 (Chunked_vector::push_back): Use size_ to find insert position.
10581 (Chunked_vector::size_): New data member.
10582 (Stringpool_template::set_no_zero_null): Assert string set is empty.
10583 (Stringpool_template::new_key_offset): New method declaration.
10584 (Stringpool_template::offset_): New data member.
10585
10586 2010-03-15 Rafael Espindola <espindola@google.com>
10587
10588 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
10589 Add_symbols' constructor.
10590 * readsyms.h (Add_symbols): Remove the input_group member.
10591
10592 2010-03-10 Ian Lance Taylor <iant@google.com>
10593
10594 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
10595 target to ask whether a reference to a symbol requires a stack
10596 split.
10597 * target.h (Target::is_call_to_non_split): New function.
10598 (Target::do_is_call_to_non_split): Declare virtual function.
10599 * target.cc: Include "symtab.h".
10600 (Target::do_is_call_to_non_split): New function.
10601 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
10602
10603 2010-03-10 Cary Coutant <ccoutant@google.com>
10604
10605 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
10606 (File_read::open[1]): Remove initial mapping of whole_file_view_.
10607 (File_read::open[2]): Add whole_file_view_ to list of views.
10608 (File_read::make_view): Remove test of whole_file_view_.
10609 (File_read::find_or_make_view): Create whole_file_view_ if
10610 necessary.
10611 (File_read::clear_views): Replace bool parameter with enum;
10612 adjust all callers. Don't delete views with permanent data;
10613 do delete cached views and views from archives if
10614 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
10615 if clearing the corresponding view.
10616 * fileread.h (File_read::Clear_views_mode): New enum.
10617 (File_read::View::is_permanent_view): New method.
10618 (File_read::clear_views): Replace bool parameter
10619 with enum; adjust all callers.
10620 * options.h (General_options): Change keep_files_mapped option;
10621 add map_whole_files.
10622 * readsyms.cc (Add_symbols::run): Delete sd_ object before
10623 releasing the file.
10624 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
10625 the file.
10626
10627 2010-03-10 David S. Miller <davem@davemloft.net>
10628
10629 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
10630
10631 2010-03-09 Sriraman Tallam <tmsriram@google.com>
10632
10633 * icf.cc (get_section_contents): Add '@' marker after processing the
10634 merge reloc.
10635
10636 2010-03-08 Doug Kwan <dougkwan@google.com>
10637
10638 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
10639 due to a conversion warning.
10640 (Arm_relobj::update_output_local_symbol_count): Check for local
10641 symbol with unset output index.
10642
10643 2010-03-05 Ian Lance Taylor <iant@google.com>
10644
10645 * options.h (class General_options): Add --spare-dynamic-tags.
10646 * output.cc (Output_data_dynamic::set_final_data_size): Implement
10647 --spare-dynamic-tags.
10648
10649 2010-03-05 Ian Lance Taylor <iant@google.com>
10650
10651 * incremental.cc: Include "libiberty.h".
10652
10653 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
10654
10655 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
10656 function, is_info_ member.
10657 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
10658 (Versions::Versions): Update caller.
10659 (Versions::define_base_version): Likewise.
10660 (Versions::add_def): Likewise.
10661
10662 2010-03-03 Sriraman Tallam <tmsriram@google.com>
10663
10664 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
10665 (Scan::possible_function_pointer_reloc): New function.
10666 (Scan::local_reloc_may_be_function_pointer): Change to call
10667 possible_function_pointer_reloc.
10668 (Scan::global_reloc_may_be_function_pointer): Ditto.
10669 * icf.h (Icf::check_section_for_function_pointers): Change to reject
10670 relocations in ".data.rel.ro._ZTV" section.
10671 * testsuite/icf_safe_so_test.sh: Change to pass i386.
10672 * testsuite/icf_safe_so_test.cc: Ditto.
10673 * testsuite/icf_safe_test.cc: Ditto.
10674 * testsuite/icf_safe_test.sh: Ditto.
10675
10676 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10677 Ian Lance Taylor <iant@google.com>
10678
10679 * target-reloc.h (relocate_section): Check the symbol table index
10680 for -1U before setting the local symbol index.
10681 (scan_relocatable_relocs): If copying the relocation, record that
10682 the local symbol is required.
10683 * object.h (Symbol_value::is_output_symtab_index_set): New
10684 function.
10685 (Symbol_value::may_be_discarded_from_output_symtab): New
10686 function.
10687 (Symbol_value::has_output_symtab_entry): New function.
10688 (Symbol_value::needs_output_symtab_entry): Remove.
10689 (Symbol_value::output_symtab_index): Make sure the symbol index is
10690 set.
10691 (Symbol_value::set_output_symtab_index): Make sure the symbol
10692 index is not set. Make sure the new index is valid.
10693 (Symbol_value::set_must_have_output_symtab_entry): New function.
10694 (Symbol_value::has_output_dynsym_entry): New function.
10695 (Symbol_value::set_output_dynsym_index): Make sure the new index
10696 is valid.
10697 (Sized_relobj::set_must_have_output_symtab_entry): New function.
10698 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
10699 local symbol if permitted.
10700 (Sized_relobj::do_finalize_local_symbols): Call
10701 is_output_symtab_index_set rather than needs_output_symtab_entry.
10702 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
10703 rather than needs_output_symtab_entry. Call
10704 has_output_dynsym_entry rather than needs_output_dynsym_entry.
10705 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
10706 is_output_symtab_index_set rather than needs_output_symtab_entry.
10707 * testsuite/discard_locals_relocatable_test.c: New file.
10708 * testsuite/discard_locals_test.sh: Test -r.
10709 * testsuite/Makefile.am (check_DATA): Add
10710 discard_locals_relocatable_test1.syms,
10711 discard_local_relocatable_test2.syms.
10712 (MOSTLYCLEANFILES): Likewise. Also add
10713 discard_locals_relocatable_test1.lout and
10714 discard_locals_relocatable_test2.out.
10715 (discard_locals_relocatable_test1.syms): New target.
10716 (discard_locals_relocatable_test.o): New target.
10717 (discard_locals_relocatable_test1.out): New target.
10718 (discard_locals_relocatable_test2.syms): New target.
10719 (discard_locals_relocatable_test2.out): New target.
10720 (various): Add missing ../ld-new dependencies.
10721 * testsuite/Makefile.in: Rebuild.
10722
10723 2010-03-03 Nick Clifton <nickc@redhat.com>
10724
10725 * po/fi.po: New Finnish translation.
10726
10727 2010-03-01 Doug Kwan <dougkwan@google.com>
10728
10729 * layout.cc (Layout::Layout): Force section types of .init_array*,
10730 .preinit_array* and .fini_array* sections.
10731 * output.cc (Output_section::Input_section_sort_entry::has_priority):
10732 Fix check of return value of std::string::find.().
10733 (Output_section::Input_section_sort_compare::operator()): Remove
10734 comment about .init_array.
10735 (Output_section::Input_section_sort_init_fini_compare::operator()):
10736 New method.
10737 (Output_section::sort_attached_input_sections): Handle .init_array
10738 and .fini_array specially.
10739 * output.h (Output_section::Inut_section_sort_compare): Update
10740 comment.
10741 (Output_section::Input_section_sort_init_fini_compare): New struct.
10742
10743 2010-02-26 Doug Kwan <dougkwan@google.com>
10744
10745 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
10746 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
10747 * testsuite/debug_msg.sh: Avoid matching source line number for
10748 use of global variable undef_int.
10749
10750 2010-02-26 Doug Kwan <dougkwan@google.com>
10751
10752 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
10753 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
10754 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
10755 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
10756 * options.cc (General_options::General_options): Initialize member
10757 fix_v4bx_.
10758 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
10759 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
10760 and rm_no_fix_v4bx.stdout
10761 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
10762 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
10763 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
10764 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
10765 and arm_no_fix_v4bx.
10766 * Makefile.in: Regenerate.
10767 * testsuite/arm_fix_v4bx.s: New file.
10768 * testsuite/arm_fix_v4bx.sh: Ditto.
10769
10770 2010-02-24 Doug Kwan <dougkwan@google.com>
10771
10772 * arm.cc (Target_arm::got_section): Make the .got section the first
10773 non RELRO section in the data segment.
10774 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
10775 suffixes of section names.
10776
10777 2010-02-24 Doug Kwan <dougkwan@google.com>
10778
10779 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
10780 flags and attributes merging if an input file is a binary file.
10781 * fileread.cc (Input_file::open): Record format of original file.
10782 * fileread.h (Input_file::Format): New enum type.
10783 (Input_file::Input_file): Initialize data member format_.
10784 (Input_file::format): New method definition.
10785 (Input_file::format_):: New data member.
10786
10787 2010-02-24 Doug Kwan <dougkwan@google.com>
10788
10789 * arm.cc (Arm_output_data_got): New class.
10790 (ARM_TCB_SIZE): New constant
10791 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
10792 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
10793 If user uses a script with a SECTIONS clause, issue only a warning
10794 for a misplaced EXIDX input section. Otherwise, issue an error.
10795 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
10796 garbage collection.
10797 (Target_arm::got_mode_index_entry): Handle static linking.
10798 (Target_arm::Scan::local): Ditto.
10799 (Target_arm::Scan::global): Ditto.
10800 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
10801 all incorrectly implemented relocations.
10802 (Target_arm::fix_exidx_coverage): Pass layout to
10803 Arm_output_section::fix_exidx_coverage.
10804 * layout.cc (Layout::section_name_mapping): Remove trailing dots
10805 from ".ARM.exidx." and ".ARM.extab.".
10806
10807 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10808
10809 * arm.cc (Target_arm::do_finalize_sections): Create attribute
10810 section if it does not already exist.
10811 * attributes.cc (Attributes_section_data::Attributes_section_data):
10812 Don't crash if size is zero.
10813
10814 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10815 Ian Lance Taylor <iant@google.com>
10816
10817 * gold.cc (queue_middle_tasks): If no input files were opened,
10818 exit.
10819 * workqueue.h (Task_function::Task_function): Assert that there is
10820 a blocker.
10821
10822 2010-02-22 Doug Kwan <dougkwan@google.com>
10823
10824 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
10825 * icf.cc (get_section_contents): Cast snprintf arguments to long long
10826 types to avoid warnings due to different uint64_t implementations
10827 on different hosts.
10828
10829 2010-02-21 Doug Kwan <dougkwan@google.com>
10830
10831 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
10832 handling of the maximum backward branch offset.
10833 (Arm_relocate_functions::thumb_branch_common): Ditto.
10834 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
10835 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
10836 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
10837 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
10838 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
10839 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
10840 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
10841 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
10842 thumb_bl_out_of_range thumb_bl_out_of_range.o,
10843 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
10844 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
10845 thumb2_bl_out_of_range.o): New rules.
10846 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
10847 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
10848 thumb2_bl_out_of_range
10849 * testsuite/Makefile.in: Regenerate.
10850 * testsuite/arm_bl_in_range.s: New file.
10851 * testsuite/arm_bl_out_of_range.s: Ditto.
10852 * testsuite/arm_branch_in_range.sh: Ditto.
10853 * testsuite/arm_branch_range.t: Ditto.
10854 * testsuite/thumb2_branch_range.t: Ditto.
10855 * testsuite/thumb_bl_in_range.s: Ditto.
10856 * testsuite/thumb_bl_out_of_range.s: Ditto.
10857 * testsuite/thumb_branch_range.t: Ditto.
10858
10859 2010-02-20 Sriraman Tallam <tmsriram@google.com>
10860
10861 * gc.h (gc_process_relocs): Change vectors to point to the new list.
10862 Add reloc offset information.
10863 * icf.cc (get_section_contents): Change iterators to point to the new
10864 vectors. Add reloc offset information to the contents.
10865 * icf.h (Icf::Sections_reachable_info): New typedef.
10866 (Icf::Sections_reachable_list): New typedef.
10867 (Icf::Offset_info): New typedef.
10868 (Icf::Reloc_info): New struct typedef.
10869 (Icf::Reloc_info_list): New typedef.
10870 (Icf::symbol_reloc_list): Delete method.
10871 (Icf::addend_reloc_list): Delete method.
10872 (Icf::section_reloc_list): Delete method.
10873 (Icf::reloc_info_list): New method.
10874 (Icf::reloc_info_list_): New member.
10875
10876 2010-02-19 Doug Kwan <dougkwan@google.com>
10877
10878 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
10879 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
10880 * arm.cc (Arm_relocation_functions): New forward declaration.
10881 (Target_arm::Target_arm): Initialize new data members
10882 got_mod_index_offset_ and tls_base_symbol_defined_.
10883 (Target_arm::Relocate::relocate_tls): New method.
10884 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
10885 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
10886 New methods.
10887 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
10888 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
10889 (Target_arm::got_mod_index_offset_,
10890 Target_arm::tls_base_symbol_defined_): New data members.
10891 (Target_arm::Scan::local, Target::Scan::global,
10892 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
10893 relocations.
10894
10895 2010-02-18 Doug Kwan <dougkwan@google.com>
10896
10897 * arm.cc (Arm_relobj::find_linked_text_section): New method.
10898 (Arm_relobj::make_exidx_input_section): Pass section index of linked
10899 text section as a parameter becuase some broken tools may not set
10900 the link in section header.
10901 (Target_arm::has_got_section): New method.
10902 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
10903 without any mapping symbol as data only. Remove warning.
10904 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
10905 link in its section header, try to discover the link by inspecting the
10906 REL31 relocation at the beginning of the section.
10907 (Target_arm::Scan::check_non_pic): Report name of offending relocation
10908 in error message.
10909 (Target_arm::Scan::global): Treat any reference to the symbol
10910 _GLOBAL_OFFSET_TABLE_ as a GOT access.
10911
10912 2010-02-12 Sriraman Tallam <tmsriram@google.com>
10913
10914 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
10915 (Scan::global_reloc_may_be_function_pointer): New function.
10916 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10917 (Scan::global_reloc_may_be_function_pointer): New function.
10918 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10919 (Scan::global_reloc_may_be_function_pointer): New function.
10920 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
10921 (Scan::global_reloc_may_be_function_pointer): New function.
10922 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
10923 (Scan::global_reloc_may_be_function_pointer): New function.
10924 (Scan::possible_function_pointer_reloc): New function.
10925 (Target_x86_64::can_check_for_function_pointers): New function.
10926 * gc.h (gc_process_relocs): Scan relocation types to determine if
10927 function pointers were taken for targets that support it.
10928 * icf.cc (Icf::find_identical_sections): Include functions for
10929 folding in safe ICF whose pointer is not taken.
10930 * icf.h (Secn_fptr_taken_set): New typedef.
10931 (fptr_section_id_): New member.
10932 (section_has_function_pointers): New function.
10933 (set_section_has_function_pointers): New function.
10934 (check_section_for_function_pointers): New function.
10935 * options.h: Fix comment for safe ICF option.
10936 * target.h (can_check_for_function_pointers): New function.
10937 * testsuite/Makefile.am: Add icf_safe_so_test test case.
10938 Modify icf_safe_test for X86-64.
10939 * testsuite/Makefile.in: Regenerate.
10940 * testsuite/icf_safe_so_test.cc: New file.
10941 * testsuite/icf_safe_so_test.sh: New file.
10942 * testsuite/icf_safe_test.cc (kept_func_3): New function.
10943 (main): Change to take pointer to function kept_func_3.
10944 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
10945 folding is done correctly for X86-64.
10946
10947 2010-02-12 David S. Miller <davem@davemloft.net>
10948
10949 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
10950 is_symbolless parameter.
10951 (Output_reloc<SHT_REL>::is_symbolless): New.
10952 (Output_reloc<SHT_REL>::is_symbolless_): New.
10953 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
10954 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
10955 (Output_reloc<SHT_RELA>::is_symbolless): New.
10956 (Output_data_reloc::add_global): Handle is_symbolless.
10957 (Output_data_reloc::add_global_relative): Likewise.
10958 (Output_data_reloc::add_local): Likewise.
10959 (Output_data_reloc::add_local_relative): Likewise.
10960 (Output_data_reloc::add_symbolless_global_addend): New.
10961 (Output_data_reloc::add_symbolless_local_addend): New.
10962 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
10963 is_symbolless.
10964 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
10965 instead of ->is_relative_
10966 (Output_reloc::write): Likewise.
10967 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
10968 (Output_reloc::write_rel): Simplify.
10969
10970 * sparc.cc (Target_sparc::Scan::local): Use
10971 ->add_symbolless_local_addend as needed.
10972 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
10973 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
10974 based upon relocation offset.
10975
10976 2010-02-11 Doug Kwan <dougkwan@google.com>
10977
10978 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
10979 (Target_arm::Scan::global): Ditto. Also remove a comment before the
10980 beginning of function.
10981 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
10982 and MOVT_ABS relocations. Those are non issued in scanning. Fix
10983 parameter is_32bit in calls to should_apply_static_reloc.
10984 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
10985 (check_DATA): Add arm_abs_global.stdout.
10986 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
10987 arm_abs_global.stdout): New rules.
10988 (MOSTLLYCLEANFILES): Add arm_abs_global
10989 * Makefile.in: Regenerate.
10990 * testsuite/arm_abs_global.s: New file.
10991 * testsuite/arm_abs_global.sh: Ditto.
10992 * testsuite/arm_abs_lib.s: Ditto.
10993
10994 2010-02-11 Ian Lance Taylor <iant@google.com>
10995
10996 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
10997 Read_relocs task.
10998 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
10999 Allocate_commons_task first.
11000 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
11001 task, rather than symtab_lock_.
11002 (Gc_process_relocs::~Gc_process_relocs): New function.
11003 (Gc_process_relocs::is_runnable): Check this_blocker_.
11004 (Gc_process_relocs::locks): Use next_blocker_ rather than
11005 blocker_.
11006 (Scan_relocs::~Scan_relocs): New function.
11007 (Scan_relocs::is_runnable): Check this_blocker_ rather than
11008 symtab_lock_.
11009 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
11010 next_blocker_.
11011 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
11012 fields. Add this_blocker_ and next_blocker_ fields. Adjust
11013 constructor accordingly.
11014 (class Gc_process_relocs): Likewise.
11015 (class Scan_relocs): Likewise.
11016 * common.h (class Allocate_commons_task): Remove symtab_lock_
11017 field, and corresponding constructor parameter.
11018 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
11019 symtab_lock_.
11020 (Allocate_commons_task::locks): Likewise.
11021
11022 2010-02-11 Ian Lance Taylor <iant@google.com>
11023
11024 * gold-threads.h (class Once): Define.
11025 (class Initialize_lock): Rewrite as child of Once.
11026 * gold-threads.cc (class Once_initialize): Define.
11027 (once_pointer_control): New static variable.
11028 (once_pointer, once_arg): New static variables.
11029 (c_run_once): New static function.
11030 (Once::Once, Once::run_once, Once::internal_run): New functions.
11031 (class Initialize_lock_once): Remove.
11032 (initialize_lock_control): Remove.
11033 (initialize_lock_pointer): Remove.
11034 (initialize_lock_once): Remove.
11035 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
11036 (Initialize_lock::initialize): Rewrite.
11037 (Initialize_lock::do_run_once): New function.
11038 * archive.cc (Archive::interpret_header): Only clear name if it is
11039 not already empty.
11040 * fileread.cc: Include "gold-threads.h"
11041 (file_counts_lock): New static variable.
11042 (file_counts_initialize_lock): Likewise.
11043 (File_read::release): Only increment counts when using --stats.
11044 Use a lock around the increment.
11045 * parameters.cc (class Set_parameters_target_once): Define.
11046 (set_parameters_target_once): New static variable.
11047 (Parameters::Parameters): Move here from parameters.h.
11048 (Parameters::set_target): Rewrite.
11049 (Parameters::set_target_once): New function.
11050 (Parameters::clear_target): Move here and rewrite.
11051 * parameters.h (class Parameters): Update declarations. Add
11052 set_parameters_target_once_ field.
11053 (Parameters::Parameters): Move to parameters.cc.
11054 (Parameters::clear_target): Likewise.
11055 * readsyms.cc (Read_symbols::do_group): Create a Start_group
11056 task.
11057 (Start_group::~Start_group): New function.
11058 (Start_group::is_runnable): New function.
11059 (Start_group::locks, Start_group::run): New functions.
11060 (Finish_group::run): Change saw_undefined to size_t.
11061 * readsyms.h (class Start_group): Define.
11062 (class Finish_group): Change saw_undefined_ field to size_t.
11063 (Finish_group::Finish_group): Remove saw_undefined and
11064 this_blocker parameters. Change all callers.
11065 (Finish_group::set_saw_undefined): New function.
11066 (Finish_group::set_blocker): New function.
11067 * symtab.h (class Symbol_table): Change saw_undefined to return
11068 size_t. Change saw_undefined_ field to size_t.
11069 * target-select.cc (Set_target_once::do_run_once): New function.
11070 (Target_selector::Target_selector): Initialize set_target_once_
11071 field. Don't initialize lock_ and initialize_lock_ fields.
11072 (Target_selector::instantiate_target): Rewrite.
11073 (Target_selector::set_target): New function.
11074 * target-select.h (class Set_target_once): Define.
11075 (class Target_selector): Update declarations. Make
11076 Set_target_once a friend. Remove lock_ and initialize_lock_
11077 fields. Add set_target_once_ field.
11078
11079 2010-02-10 Ian Lance Taylor <iant@google.com>
11080
11081 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
11082 queueing any tasks.
11083 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
11084 (queue_middle_tasks): Add all blockers before queueing any tasks.
11085 (queue_final_tasks): Likewise.
11086 * token.h (Task_token::add_blockers): New function.
11087 * object.h (Input_objects::number_of_relobjs): New function.
11088
11089 2010-02-10 Ian Lance Taylor <iant@google.com>
11090
11091 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
11092 shared, not if not position independent.
11093 * x86_64.cc (Relocate::relocate_tls): Likewise.
11094 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
11095 (tls_pie_pic_test): New target.
11096 * testsuite/Makefile.in: Rebuild.
11097
11098 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
11099 (tls_test_main_pie.o, tls_test_pie.o): New targets.
11100 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
11101 * testsuite/Makefile.in: Rebuild.
11102
11103 2010-02-09 David S. Miller <davem@davemloft.net>
11104
11105 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
11106 R_SPARC_RELATIVE using ->add_local_relative().
11107 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
11108
11109 * output.h (Output_data_dynamic::add_section_size): New method
11110 that takes two Output_data objects.
11111 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
11112 entry param. Handle it in initializers.
11113 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
11114 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
11115 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
11116 arg.
11117 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
11118 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
11119 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
11120 for dynrel_includes_plt.
11121 * i386.cc (Target_i386::do_finalize_sections): Likewise.
11122 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11123 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
11124 before .rela.plt
11125 (Target_sparc::do_finalize_sections): Update to pass true for
11126 dynrel_includes_plt.
11127 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
11128 output before .rela.plt
11129 (Target_powerpc::do_finalize_sections): Update to pass true for
11130 dynrel_includes_plt when 32-bit.
11131
11132 2010-02-08 Doug Kwan <dougkwan@google.com>
11133
11134 * arm.cc (Arm_relobj::simple_input_section_output_address): New
11135 method.
11136 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
11137 Arm_relobj::scan_section_for_cortex_a8_stubs,
11138 Arm_relobj::do_relocation_section): Instead of calling
11139 Output_section::output_address, use faster
11140 Arm_relobj::simple_input_section_output_address.
11141
11142 2010-02-08 David S. Miller <davem@davemloft.net>
11143
11144 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
11145 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
11146 relocation helper function.
11147
11148 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
11149 just like R_SPARC_GOT{10,13,22}.
11150 (Target_sparc::Scan::local): Likewise.
11151 (Target_sparc::Relocate:relocate): Likewise.
11152
11153 2010-02-06 Ian Lance Taylor <iant@google.com>
11154
11155 * configure.ac: Rewrite targetobjs duplicate removal code to use
11156 only shell constructs.
11157 * configure: Rebuild.
11158
11159 2010-02-05 Doug Kwan <dougkwan@google.com>
11160
11161 PR 11247
11162 * arm.cc (Arm_relobj::section_is_scannable): New method.
11163 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
11164 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
11165
11166 2010-02-04 Doug Kwan <dougkwan@google.com>
11167
11168 PR 11247
11169 * arm-reloc-property.cc (cstdio): Include.
11170 * configure.ac (targetobjs): Remove duplicates.
11171 * configure: Regenerate.
11172 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
11173 big and little endian version for a given address size.
11174
11175 2010-02-03 Doug Kwan <dougkwan@google.com>
11176
11177 * arm-reloc-property.cc
11178 (Arm_reloc_property_table::reloc_name_in_error_message): New method
11179 definition.
11180 * arm-reloc-property.h
11181 (Arm_reloc_property_table::get_implemented_static_reloc_property):
11182 New method definition.
11183 (Arm_reloc_property_table::reloc_name_in_error_message): New method
11184 declaration.
11185 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
11186 overflow to N.
11187 (GOT_PREL): Change implemented to Y.
11188 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
11189 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
11190 (Arm_relocate_functions::movw_abs_nc): Remove method.
11191 (Arm_relocate_functions::movt_abs): Ditto.
11192 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
11193 (Arm_relocate_functions::thm_movt_abs): Ditto.
11194 (Arm_relocate_functions::movw_rel_nc): Ditto.
11195 (Arm_relocate_functions::movw_rel): Ditto.
11196 (Arm_relocate_functions::movt_rel): Ditto.
11197 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
11198 (Arm_relocate_functions:thm_movw_rel): Ditto.
11199 (Arm_relocate_functions:thm_movt_rel): Ditto.
11200 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
11201 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
11202 New method definitions.
11203 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
11204 (Arm_relocation_functions::arm_grp_ldr): Ditto.
11205 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
11206 (Arm_relocation_functions::arm_grp_ldc): Ditto.
11207 (Target_arm::Relocate::relocate): Check for non-static or
11208 unimplemented relocation code and exit early. Change calls to
11209 Target_arm::reloc_uses_thumb_bit and
11210 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
11211 instead. Refactor code to handle similar relocations to increase
11212 code sharing. Remove check for unsupported relocation code in switch
11213 statement.
11214 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
11215 relocation property table to find out size. Change error message to
11216 print out the name of a relocation code instead of the numeric value.
11217 (Target_arm::scan_reloc_for_stub): Use relocation property table
11218 instead of calling Target_arm::reloc_uses_thumb_bit().
11219
11220 2010-02-02 Doug Kwan <dougkwan@google.com>
11221
11222 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
11223 types of relaxed input section.
11224
11225 2010-02-02 Doug Kwan <dougkwan@google.com>
11226
11227 * Makefile.am (HFILES): Add arm-reloc-property.h.
11228 (DEFFILES): New.
11229 (TARGETSOURCES): Add arm-reloc-property.cc
11230 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
11231 (libgold_a_SOURCES): $(DEFFILES)
11232 * Makefile.in: Regenerate.
11233 * arm-reloc-property.cc: New file.
11234 * arm-reloc-property.h: New file.
11235 * arm-reloc.def: New file.
11236 * arm.cc: Update comments.
11237 (arm-reloc-property.h): New included header.
11238 (arm_reloc_property_table): New global variable.
11239 (Target_arm::do_select_as_default_target): New method definition.
11240 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
11241 arm-reloc-property to targ_extra_obj.
11242 * parameters.cc (set_parameters_target): Call
11243 Target::select_as_default_target().
11244 * target.h (Target::select_as_default_target): New method definition.
11245 (Target::do_select_as_default_target): Same.
11246
11247 2010-02-01 Doug Kwan <dougkwan@google.com>
11248
11249 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
11250 first_output_text_section_.
11251 (Arm_exidx_fixup::first_output_text_section): New method definition.
11252 (Arm_exidx_fixup::first_output_text_section_): New data member.
11253 (Arm_exidx_fixup::process_exidx_section): Record the first text
11254 output section seen.
11255 (Arm_output_section::fix_exidx_coverage): Set correct linked section
11256 and entsize in output section header.
11257
11258 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11259
11260 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
11261 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
11262 (Arm_relocate_functions::thm_alu11): New Method.
11263 (Arm_relocate_functions::thm_pc8): New Method.
11264 (Arm_relocate_functions::thm_pc12): New Method.
11265 (Target_arm::Scan::local): Handle the relocations.
11266 (Target_arm::Scan::global): Likewise.
11267 (Target_arm::Relocate::relocate): Likewise.
11268 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11269
11270 2010-01-29 Doug Kwan <dougkwan@google.com>
11271
11272 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
11273 of relocation types as ld.
11274
11275 2010-01-29 Doug Kwan <dougkwan@google.com>
11276
11277 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
11278 to public.
11279 (Arm_relocate_functions::thumb_branch_common): Ditto.
11280 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
11281 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
11282 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
11283 Arm_relocate_functions::jump24): Remove.
11284 (Target_arm::Relocate::relocate): Adjust code to call
11285 Arm_relocation_functions::arm_branch_common and
11286 Arm_relocation_functions::thumb_branch_common instead of their removed
11287 wrappers. Merge switch-cases together to reduce source code size.
11288
11289 2010-01-29 Doug Kwan <dougkwan@google.com>
11290
11291 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
11292 output_local_symbol_count_needs_update_.
11293 (Arm_relobj::output_local_symbol_count_needs_update,
11294 Arm_relobj::set_output_local_symbol_count_needs_update,
11295 Arm_relobj::update_output_local_symbol_count): New methods.
11296 (Arm_relobj::output_local_symbol_count_needs_update_): New data
11297 member.
11298 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
11299 of pointed function as in a R_ARM_PREL31 relocation.
11300 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
11301 for output local symbol count updating.
11302 (Target_arm::do_relax): Update output local symbol counts in objects
11303 if necessary.
11304 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
11305
11306 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11307
11308 * arm.cc: Added support for the ARM relocations:
11309 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
11310 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
11311 (Arm_relocate_functions::movw_rel_nc): Renamed (was
11312 movw_prel_nc).
11313 (Arm_relocate_functions::movw_rel): New method.
11314 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
11315 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
11316 thm_movw_prel_nc).
11317 (Arm_relocate_functions::thm_movw_rel): New method.
11318 (Arm_relocate_functions::thm_movt_rel): Renamed (was
11319 thm_movt_prel).
11320 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
11321 relocations.
11322 (Target_arm::Scan::global): Likewise.
11323 (Target_arm::Relocate::relocate): Likewise.
11324 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11325 Likewise.
11326
11327 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11328
11329 * arm.cc: Added support for ARM group relocations.
11330 (Target_arm::reloc_needs_sym_origin): New method.
11331 (Arm_relocate_functions::calc_grp_kn): New method.
11332 (Arm_relocate_functions::calc_grp_residual): New method.
11333 (Arm_relocate_functions::calc_grp_gn): New method.
11334 (Arm_relocate_functions::arm_grp_alu): New Method.
11335 (Arm_relocate_functions::arm_grp_ldr): New Method.
11336 (Arm_relocate_functions::arm_grp_ldrs): New Method.
11337 (Arm_relocate_functions::arm_grp_ldc): New Method.
11338 (Target_arm::Scan::local): Handle the ARM group relocations.
11339 (Target_arm::Scan::global): Likewise.
11340 (Target_arm::Relocate::relocate): Likewise.
11341 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11342 Likewise.
11343
11344 2010-01-26 Doug Kwan <dougkwan@google.com>
11345
11346 * arm.cc (set): Include.
11347 (class Arm_exidx_fixup): Change type of last_input_section_ to const
11348 pointer type.
11349 (Arm_output_section::Text_section_list): New type.
11350 (Arm_output_section::append_text_sections_to_list): New method.
11351 (Arm_output_section::fix_exidx_coverage): Ditto.
11352 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
11353 (Arm_relobj::convert_input_section_to_relaxed_section): Use
11354 Relobj::set_section_offset() instead of
11355 Sized_relobj::invalidate_section_offset().
11356 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
11357 parameter for section headers. Ignore relocation sections for
11358 unallocated sections and EXIDX sections.
11359 (Target_arm::fix_exidx_coverage): New method.
11360 (Target_arm::output_section_address_less_than): New type.
11361 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
11362 linked text section instead of the EXIDX section.
11363 (Arm_output_section::create_stub_group): Add an assertion to check
11364 that this is not an EXIDX output section.
11365 (Arm_output_section::append_text_sections_to_list): New method.
11366 (Arm_output_section::fix_exidx_coverage): Ditto.
11367 (Arm_relobj::scan_sections_for_stubs): Adjust call to
11368 Arm_relobj::section_needs_reloc_stub_scanning.
11369 (Target_arm::do_relax): Fix EXIDX output section coverage in the
11370 first pass.
11371 (Target_arm::fix_exidx_coverage): New method.
11372 * object.h (Relobj::set_output_section): New method.
11373 (Sized_relobj::invalidate_section_offset): Remove method.
11374 (Sized_relobj::do_invalidate_section_offset): Remove method.
11375 (Sized_relobj::do_set_section_offset): Handle offset value -1.
11376
11377 2010-01-25 Doug Kwan <dougkwan@google.com>
11378
11379 * arm.cc (Arm_exidx_merged_section::do_output_offset):
11380 Fix warning due to signed and unsigned comparison on a 32-bit host.
11381
11382 2010-01-22 Doug Kwan <dougkwan@google.com>
11383
11384 * arm.cc (Target_arm::do_relax): Record an output section for section
11385 offset adjustment it contains any stub table that has changed.
11386 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
11387 offsets in an output section if necessary.
11388 * output.cc (Output_section::Output_section): Initialize
11389 section_offsets_need_adjustments_.
11390 (Output_section::add_input_section_for_script): Renamed to
11391 Output_section::add_simple_input_section.
11392 (Output_section::save_states): Add a comment.
11393 (Output_section::discard_states): New method defintion.
11394 (Output_section::adjust_section_offsets): Same.
11395 * output.h (Output_section::add_input_section_for_script): Renamed to
11396 Output_section::add_simple_input_section.
11397 (Output_section::discard_states): New method declaration.
11398 (Output_section::adjust_section_offsets): Same.
11399 (Output_section::section_offsets_need_adjustment,
11400 Output_section::set_section_offsets_need_adjustment): New method
11401 definitions.
11402 (Output_section::section_offsets_need_adjustment_): New data member.
11403 * script-sections.cc
11404 (Output_section_element_input::set_section_address): Adjust code for
11405 renaming of Output_section::add_input_section_for_script.
11406 (Orphan_output_section::set_section_address): Same.
11407
11408 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11409
11410 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
11411 Fix_v4bx enum values .
11412 * gold/options.h (General_options): New option definitions.
11413 (General_options::fix_v4bx): New method.
11414 (General_options::Fix_v4bx): New enum.
11415 * gold/options.cc (General_options::parse_fix_v4bx): New method.
11416 (General_options::parse_fix_v4bx_interworking): New method.
11417
11418 2010-01-22 Doug Kwan <dougkwan@google.com>
11419
11420 * arm.cc (Arm_exidx_fixup): New class.
11421
11422 2010-01-21 Doug Kwan <dougkwan@google.com>
11423
11424 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
11425 classes.
11426 (Arm_exidx_section_offset_map): New type.
11427
11428 2010-01-21 Doug Kwan <dougkwan@google.com>
11429
11430 * arm.cc (Arm_exidx_input_section): New class.
11431 (Arm_relobj::exidx_input_section_by_link,
11432 Arm_relobj::exidx_input_section_by_shndx,
11433 Arm_relobj::make_exidx_input_section): New methods.
11434 (read_arm_attributes_section): Remove.
11435 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
11436 information about them.
11437 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
11438 to here.
11439
11440 2010-01-20 Doug Kwan <dougkwan@google.com>
11441
11442 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
11443 Input_section_specifier to Section_id.
11444 (Target_arm::new_arm_input_section: Adjust code for change of key
11445 type.
11446 (Target_arm::find_arm_input_section): Ditto.
11447 * gc.h (object.h): Include for Section_id nand Section_id_hash.
11448 (Section_id): Remove.
11449 (Garbage_collection::Section_id_hash): Remove.
11450 * icf.h (object.h): Include for Section_id nand Section_id_hash.
11451 (Section_id): Remove.
11452 (Icf::Section_id_hash): Remove.
11453 * object.h (Section_id, Const_section_id, Section_id_hash,
11454 Const_section_id_hash): New type definitions.
11455 * output.cc (Output_section::add_relaxed_input_section): Change to
11456 use Const_section_id instead of Input_section_specifier as key type.
11457 (Output_section::add_merge_input_section): Ditto.
11458 (Output_section::build_relaxation_map): Change to use Section_id
11459 instead of Input_section_specifier as key type.
11460 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11461 Ditto.
11462 (Output_section::convert_input_sections_to_relaxed_sections): Change
11463 to use Const_section_id instead of Input_section_specifier as key type.
11464 (Output_section::find_merge_section): Ditto.
11465 (Output_section::find_relaxed_input_section): Ditto.
11466 * output.h (Input_section_specifier): Remove class.
11467 (Output_section::Output_section_data_by_input_section_map): Change
11468 key type to Const_section_id.
11469 (Output_section::Output_relaxed_input_section_by_input_section_map):
11470 Ditto.
11471 (Output_section::Relaxation_map): Change key type to Section_id.
11472
11473 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11474
11475 * gold/arm.cc: Added support for R_ARM_V4BX relocation
11476 (class Arm_v4bx_stub): New class.
11477 (DEF_STUBS): Updated definition to support v4_veneer_bx.
11478 (Stub_factory::make_arm_v4bx_stub): New method.
11479 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
11480 (Stub_table::empty): Handle v4bx stubs.
11481 (Stub_table::add_arm_v4bx_stub): New method.
11482 (Stub_table::find_arm_v4bx_stub): New method.
11483 (Arm_relocate_functions::v4bx): New method.
11484 (Target_arm::fix_v4bx): New method.
11485 (Target_arm::Target_arm): Handle R_ARM_V4BX.
11486 (Stub_table::relocate_stubs): Likewise.
11487 (Stub_table::do_write): Likewise.
11488 (Stub_table::update_data_size_and_addralign): Likewise.
11489 (Stub_table::finalize_stubs): Likewise.
11490 (Target_arm::Scan::local): Likewise.
11491 (Target_arm::Scan::global): Likewise.
11492 (Target_arm::do_finalize_sections): Likewise.
11493 (Target_arm::Relocate::relocate): Likewise.
11494 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11495 Likewise.
11496 (Target_arm::scan_reloc_for_stub): Likewise.
11497 (Target_arm::scan_reloc_section_for_stubs): Likewise.
11498
11499 2010-01-19 Ian Lance Taylor <iant@google.com>
11500
11501 * output.cc (Output_section_headers::do_sized_write): Write large
11502 segment count to sh_info field.
11503 (Output_file_header::do_sized_write): For large segment count,
11504 write PN_XNUM to e_phnum field.
11505
11506 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11507
11508 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
11509 (Arm_relocate_functions::thm_jump8): New function.
11510 (Arm_relocate_functions::thm_jump11): New function.
11511 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
11512 R_ARM_THM_JUMP11.
11513 (Target_arm::Scan::global): Likewise.
11514 (Target_arm::Relocate::relocate): Likewise.
11515 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11516 Likewise.
11517
11518 2010-01-14 Doug Kwan <dougkwan@google.com>
11519
11520 * arm.cc (map, utility): Include headers.
11521 (Target_arm::apply_cortex_a8_workaround): New method.
11522 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
11523 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
11524 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
11525 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
11526 the --[no-]fix-cortex-a8 command line options.
11527 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
11528 (Target_arm::relocate_stub): Use addend in instruction template.
11529 * options.h (DEFINE_bool): Set the user-set flag.
11530 (General_options): Add --[no-]-fix-cortex options.
11531 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
11532 : Update fast look-up map after conversion.
11533
11534 2010-01-14 Sriraman Tallam <tmsriram@google.com>
11535
11536 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
11537 in the first pass of do_layout.
11538
11539 2010-01-13 Doug Kwan <dougkwan@google.com>
11540
11541 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11542 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
11543 apparent compiler problem of not folding static constant integral
11544 data members of elfcpp::Elf_sizes<32>.
11545
11546 2010-01-13 Doug Kwan <dougkwan@google.com>
11547
11548 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11549 Arm_relobj::section_needs_cortex_a8_stub_scanning,
11550 Arm_relobj::scan_section_for_cortex_a8_erratum,
11551 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
11552 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
11553 sections to scan for relocation stubs into a new method
11554 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
11555 relocation and Cortex-A8 stub scanning.
11556 (Target_arm::do_relax): Force stubs to be after stubbed sections
11557 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
11558 the beginning of a new relaxation pass. Update a comment.
11559 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
11560
11561 2010-01-12 Ian Lance Taylor <iant@google.com>
11562
11563 * target-reloc.h (visibility_error): New inline function.
11564 (relocate_section): Call visibility_error.
11565 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
11566 (MOSTLYCLEANFILES): Likewise.
11567 (protected_4_pic.o, protected_3.err): New targets.
11568 * testsuite/protected_4.cc: New file.
11569
11570 2010-01-12 Doug Kwan <dougkwan@google.com>
11571
11572 * arm.cc (Cortex_a8_reloc): New class.
11573 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
11574 and cortex_a8_relocs_info_.
11575 (Target_arm::fix_cortex_a8): New method definition.
11576 (Target_arm::Cortex_a8_relocs_info): New type.
11577 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
11578 New data member declarations.
11579 (Target_arm::scan_reloc_for_stub): Record information about
11580 relocations for THUMB branches that might be exempted from the
11581 Cortex-A8 workaround.
11582 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
11583 at the beginning of a relaxation pass.
11584
11585 2010-01-12 Doug Kwan <dougkwan@google.com>
11586
11587 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
11588 (Arm_relobj::Mapping_symbol_position,
11589 Arm_reloj::Mapping_symbol_position_less,
11590 Arm_relobj::Mapping_symbols_info): New types.
11591 (Target_arm::is_mapping_symbol_name): New method definition.
11592 (Arm_relobj::do_count_local_symbols): Save information about mapping
11593 symbols.
11594
11595 2010-01-11 Doug Kwan <dougkwan@google.com>
11596
11597 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
11598 Arm_relocate_functions::thumb32_branch_upper,
11599 Arm_relocate_functions::thumb32_branch_lower,
11600 Arm_relocate_functions::thumb32_cond_branch_offset,
11601 Arm_relocate_functions::thumb32_cond_branch_upper,
11602 Arm_relocate_functions::thumb32_cond_branch_lower,
11603 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
11604 branch offset encoding.
11605 (Arm_relocate_functions::thumb_branch_common): Use new branch
11606 offset encoding methods to avoid code duplication.
11607 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
11608 (Stub_addend_reader::operator()): Use new branch encoding method
11609 to avoid code duplication.
11610
11611 2010-01-11 Doug Kwan <dougkwan@google.com>
11612
11613 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
11614 (Target_arm::do_finalize_sections): Define special EXIDX section
11615 symbols only if referenced.
11616 * gc.h (Garbage_collection::add_reference): New method.
11617 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
11618 code duplication.
11619
11620 2010-01-11 Ian Lance Taylor <iant@google.com>
11621
11622 * script.cc (Version_script_info::build_expression_list_lookup):
11623 Change complaing about duplicate wildcard match from error to
11624 warning.
11625
11626 * script.cc (class Lazy_demangler): Recreate--revert part of patch
11627 of 2009-12-30.
11628 (Version_script_info::Version_script_info): Initialize globs_,
11629 default_version_, default_is_global_, and exact_. Don't
11630 initialize globals_ or locals_.
11631 (Version_script_info::build_lookup_tables): Build local symbols
11632 first.
11633 (Version_script_info::unquote): New function.
11634 (Version_script_info::add_exact_match): New function.
11635 (Version_script_info::build_expression_list_lookup): Remove lookup
11636 parameter. Add is_global parameter. Change all callers. Handle
11637 wildcard pattern specially. Unquote pattern. Call
11638 add_exact_match.
11639 (Version_script_info::get_name_to_match): New function.
11640 (Version_script_info::get_symbol_version): New function.
11641 (Version_script_info::get_symbol_version_helper): Remove.
11642 (Version_script_info::check_unmatched_names): Call unquote.
11643 * script.h (class Version_script_info): Change get_symbol_version
11644 to be non-inline and add is_global parameter; change all callers.
11645 Rewrite symbol_is_local. Update declarations. Define struct
11646 Version_tree_match, Exact, Globs. Don't define struct Lookup.
11647 Remove globals_ and locals_ members. Add exact_, globs_,
11648 default_version_, is_global_.
11649 (Version_script_info::Glob): Remove pattern, add expression and
11650 is_global. Update constructor. Change all callers.
11651 * dynobj.cc (Versions::finalize): Mark the version symbol as the
11652 default version.
11653 (Versions::symbol_section_contents): If a symbol is undefined, or
11654 defined in a dynamic object, set the version index to
11655 VER_NDX_LOCAL.
11656 * symtab.cc (Symbol_table::add_from_relobj): Don't call
11657 symbol_is_local.
11658 (Symbol_table::add_from_pluginobj): Likewise.
11659 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
11660
11661 2010-01-11 Doug Kwan <dougkwan@google.com>
11662
11663 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
11664 (incremental_dump_LDADD): Add linking option for libintl.
11665 * Makefile.in: Regenerate.
11666
11667 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
11668
11669 PR gold/11144
11670 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
11671 instead of -Ds.
11672 * testsuite/Makefile.in: Regenerated.
11673
11674 2010-01-10 Doug Kwan <dougkwan@google.com>
11675
11676 * options.h (DEFINE_var): Use parentheses around argument varname__
11677 in macro body to avoid any unintended subsequent substitutions.
11678
11679 2010-01-10 Ian Lance Taylor <iant@google.com>
11680
11681 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
11682 candidates before doing symbol resolution.
11683
11684 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
11685 ODR candidates if only one is weak.
11686
11687 2010-01-08 Ian Lance Taylor <iant@google.com>
11688
11689 * script.cc (Version_script_info::build_expression_list_lookup):
11690 Don't warn about ambiguous version, just record the ambiguity.
11691 (Version_script_info::get_symbol_version_helper): Give error if
11692 version is ambiguous.
11693
11694 2010-01-08 Doug Kwan <dougkwan@google.com>
11695
11696 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
11697 prev_data_size_ and prev_addralign_. Remove initializer for
11698 deleted data member has_been_changed_.
11699 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
11700 to determine if the table is empty.
11701 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
11702 Remove.
11703 (Stub_table::add_reloc_stub): Define method in class definition
11704 instead of just declaring it there.
11705 (Stub_table::add_cortex_a8_stub): New method definition.
11706 (Stub_table::update_data_size_and_addralign): Ditto.
11707 (Stub_table::finalize_stubs): Ditto.
11708 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
11709 (Stub_table::do_addralign_): Return address alignment in the
11710 (Stub_table::do_reset_address_and_file_offset): Define method in
11711 class definition instead of declaring it there. Set current data
11712 size to be the data size of the previous pass.
11713 (Stub_table::set_final_data_size): Use current data size as the
11714 final data size.
11715 (Stub_table::relocate_stub): Change parameter type of stub from
11716 Reloc_stub pointer to Stub pointer.
11717 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
11718 (Stub_table::Cortex_a8_stub_list): New typedef.
11719 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
11720 Stub_table::prev_addralign_): New data member.
11721 (Arm_relobj::Arm_relobj): Initialize data member
11722 section_has_cortex_a8_workaround_.
11723 (Arm_relobj::section_has_cortex_a8_workaround,
11724 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
11725 definitions.
11726 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
11727 declarations.
11728 (Target_arm::relocate_stub): Change parameter type of stub from
11729 Reloc_stub pointer to Stub pointer.
11730 (Insn_template::size, Insn_template::alignment): Handle
11731 THUMB16_SPECIAL_TYPE.
11732 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
11733 Stub_table::update_data_size_and_addralign,
11734 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
11735 definitions.
11736 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
11737 (Stub_table::do_write): Ditto.
11738 (Target_arm::do_relax): Adjust code for changes in Stub_table.
11739
11740 2010-01-08 Ian Lance Taylor <iant@google.com>
11741
11742 PR 11108
11743 * symtab.h (class Symbol): Remove fields is_target_special_ and
11744 has_plt_offset_. Add field is_defined_in_discarded_section_.
11745 (Symbol::is_defined_in_discarded_section): New function.
11746 (Symbol::set_is_defined_in_discarded_section): New function.
11747 (Symbol::has_plt_offset): Rewrite.
11748 (Symbol::set_plt_offset): Verify that new offset is not -1U.
11749 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
11750 Don't initialize is_target_special_ or has_plt_offset_.
11751 Initialize is_defined_in_discarded_section_.
11752 (Symbol_table::add_from_relobj): If appropriate, set
11753 is_defined_in_discarded_section.
11754 * resolve.cc (Symbol::override_base_with_special): Don't test
11755 is_target_special_. Change has_plt_offset_ to has_plt_offset().
11756 * target-reloc.h (relocate_section): Do special handling for
11757 symbols defined in discarded sections for global symbols as well
11758 as local symbols.
11759
11760 2010-01-08 Ian Lance Taylor <iant@google.com>
11761
11762 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
11763 the SHT_SYMTAB case.
11764
11765 2010-01-08 Ian Lance Taylor <iant@google.com>
11766
11767 * object.cc (Sized_relobj::do_layout): Don't get confused if
11768 layout_eh_frame returns NULL.
11769
11770 2010-01-08 Ian Lance Taylor <iant@google.com>
11771
11772 PR 11084
11773 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
11774 dynamic symbol table, use the normal symbol table.
11775 (Sized_dynobj::do_read_symbols): Remove assertion about type of
11776 symbol table.
11777
11778 2010-01-08 Ian Lance Taylor <iant@google.com>
11779
11780 PR 11072
11781 * layout.cc (Layout::include_section): Remove .gnu_debuglink
11782 sections.
11783
11784 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
11785
11786 * version.cc (print_version): Change to "Copyright 2010".
11787
11788 2010-01-08 Ian Lance Taylor <iant@google.com>
11789
11790 PR 10287
11791 PR 11063
11792 * i386.cc (class Target_i386): Change return type of plt_section
11793 to be non-const.
11794 (class Output_data_plt_i386): Add tls_desc_rel_ field.
11795 (Output_data_plt_i386::Output_data_plt_i386): Initialize
11796 tls_desc_rel_ field.
11797 (Output_data_plt_i386::rel_tls_desc): New function.
11798 (Target_i386::rel_tls_desc_section): New function.
11799 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
11800 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
11801 R_386_TLS_DESC reloc in rel_tls_desc_section.
11802 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
11803 Define struct Tlsdesc_info.
11804 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
11805 (Target_x86_64::do_reloc_symbol_index): New function.
11806 (Target_x86_64::add_tlsdesc_info): New function.
11807 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
11808 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
11809 tlsdesc_rel_ field.
11810 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
11811 all callers.
11812 (Output_data_plt_x86_64::rela_tlsdesc): New function.
11813 (Target_x86_64::rela_tlsdesc_section): New function.
11814 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
11815 handling.
11816 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
11817 (Target_x86_64::do_reloc_addend): New function.
11818 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
11819 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
11820 declarations. Define TARGET_CODE. Add arg field to u1_ union.
11821 (Output_reloc::type): New function.
11822 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
11823 (Output_reloc::is_target_specific): New function.
11824 (Output_reloc::target_arg): New function.
11825 (class Output_reloc) [SHT_RELA]: Add four new constructors for
11826 absolute relocs and target specific relocs.
11827 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
11828 add_target_specific.
11829 (class Output_data_reloc) [SHT_RELA]: Likewise.
11830 * output.cc (Output_reloc::Output_reloc): Add four new versions
11831 for absolute relocs and target specific relocs.
11832 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
11833 (Output_reloc::get_symbol_index): Likewise.
11834 (Output_reloc::local_section_offset): Check that local_sym_index_
11835 is not TARGET_CODE or 0.
11836 (Output_reloc::symbol_value): Likewise.
11837 (Output_reloc::write) [SHT_RELA]: Call target for target specific
11838 reloc.
11839 * target.h (class Target): Add reloc_symbol_index and reloc_addend
11840 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
11841 functions.
11842 * layout.cc (add_target_dynamic_tags): Use output section for
11843 DT_PLTRELSZ and DT_JMPREL.
11844
11845 2010-01-07 Ian Lance Taylor <iant@google.com>
11846
11847 PR 11061
11848 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
11849 function.
11850 (class Output_data_reloc_generic): Define.
11851 (class Output_data_reloc_base): Change base class to
11852 Output_data_reloc_generic. Change add() method to call
11853 bump_relative_reloc_count for a relative reloc. Remove
11854 sort_relocs_ field.
11855 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
11856 to sort_relocs().
11857 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
11858 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
11859 appropriate.
11860 * layout.h (class Layout): Update declaration.
11861
11862 2010-01-07 Ian Lance Taylor <iant@google.com>
11863
11864 * output.h (class Output_data): Add const version of
11865 output_section and do_output_section.
11866 (class Output_section_data): Add const version of
11867 do_output_section.
11868 (class Output_section): Likewise.
11869 * layout.cc (Layout::add_target_dynamic_tags): New function.
11870 * layout.h (class Layout): Update declarations.
11871 * arm.cc (Target_arm::do_finalize_sections): Use
11872 add_target_dynamic_tags.
11873 * i386.cc (Target_i386::do_finalize_sections): Likewise.
11874 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11875 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11876 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11877
11878 2010-01-07 Ian Lance Taylor <iant@google.com>
11879
11880 PR 11042
11881 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
11882 object as needed.
11883
11884 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
11885 Ian Lance Taylor <iant@google.com>
11886
11887 PR 11019
11888 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
11889 Xindex::read_symtab_xindex.
11890
11891 2010-01-07 Doug Kwan <dougkwan@google.com>
11892
11893 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
11894 (Insn_template::thumb16_bcond_insn): New method declaration.
11895 (Insn_template): Fix spelling.
11896 (Stub::thumb16_special): New method declaration.
11897 (Stub::do_write): Define virtual method which was previously pure
11898 virtual.
11899 (Stub::do_thumb16_special): New method declaration.
11900 (Stub::do_fixed_endian_write): New template member.
11901 (Reloc_stub::do_write): Remove.
11902 (Reloc_stub::do_fixed_endian_write): Remove.
11903 (Cortex_a8_stub): New class definition.
11904 (Stub_factory::make_cortex_a8_stub): New method definition.
11905 (Stub_factory::Stub_factory): Add missing static storage class
11906 qualifier for elf32_arm_stub_a8_veneer_blx.
11907
11908 2010-01-07 Ian Lance Taylor <iant@google.com>
11909
11910 PR 10980
11911 * options.h (class General_options): Add --warn-unresolved-symbols
11912 and --error-unresolved-symbols.
11913 * errors.cc (Errors::undefined_symbol): Implement
11914 --warn-unresolved-symbols.
11915
11916 * options.h (class General_options): Add -z text and -z textoff.
11917 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
11918
11919 2010-01-06 Sriraman Tallam <tmsriram@google.com>
11920
11921 * gc.h (Garbage_collection::Cident_section_map): New typedef.
11922 (Garbage_collection::cident_sections): New function.
11923 (Garbage_collection::add_cident_section): New function.
11924 (Garbage_collection::cident_sections_): New member.
11925 (gc_process_relocs): Add references to sections whose names are C
11926 identifiers.
11927 * gold.h (cident_section_start_prefix): New constant.
11928 (cident_section_stop_prefix): New constant.
11929 (is_cident): New function.
11930 * layout.cc (Layout::define_section_symbols): Replace string constants
11931 with the newly defined constants.
11932 * object.cc (Sized_relobj::do_layout): Track sections whose names are
11933 C identifiers.
11934 * testsuite/Makefile.am: Add gc_orphan_section_test.
11935 * testsuite/Makefile.in: Regenerate.
11936 * testsuite/gc_orphan_section_test.cc: New file.
11937 * testsuite/gc_orphan_section_test.sh: New file.
11938
11939 2010-01-06 Ian Lance Taylor <iant@google.com>
11940
11941 PR 10980
11942 * options.h (class General_options): Add --warn-shared-textrel.
11943 * layout.cc (Layout::finish_dynamic_section): Implement
11944 --warn-shared-textrel.
11945
11946 PR 10980
11947 * options.h (class General_options): Add --warn-multiple-gp.
11948
11949 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11950
11951 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
11952 $(THREADSLIB) and $(LIBDL).
11953 * Makefile.in: Rebuild.
11954
11955 2010-01-06 Ian Lance Taylor <iant@google.com>
11956
11957 PR 10980
11958 * options.cc (General_options::parse_section_start): New function.
11959 (General_options::section_start): New function.
11960 (General_options::General_options): Initialize all members.
11961 * options.h: Include <map>
11962 (class General_options): Add --section-start. Add section_starts_
11963 member.
11964 * layout.cc (Layout::attach_allocated_section_to_segment): If
11965 --section-start was used, set the address of the segment. Remove
11966 local sort_sections.
11967 (Layout::relaxation_loop_body): If the address of the load segment
11968 has been set by --section-start, don't use it.
11969 * output.h (Output_segment::update_flags_for_output_section): New
11970 function.
11971 * output.cc (Output_segment::add_output_section): Call
11972 update_flags_for_output_section.
11973
11974 2010-01-05 Ian Lance Taylor <iant@google.com>
11975
11976 PR 10980
11977 * options.h (class General_options): Add --undefined-version.
11978 * script.cc (struct Version_expression): Add was_matched_by_symbol
11979 field.
11980 (Version_script_info::matched_symbol): New function.
11981 (Version_script_info::get_symbol_version_helper): Call
11982 matched_symbol.
11983 (Version_script_info::check_unmatched_names): New function.
11984 * script.h (class Version_script_info): Update declarations.
11985 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
11986
11987 * options.h (class General_options): Use DEFINE_bool_alias for
11988 allow_multiple_definition.
11989 * resolve.cc (Symbol_table::should_override): Don't test
11990 allow_multiple_definition.
11991
11992 PR 10980
11993 * options.h (class General_options): Add --cref.
11994 * main.cc (main): Print cref table if --cref. Don't close mapfile
11995 until after printing cref table.
11996 * cref.cc: Include "symtab.h".
11997 (class Cref_inputs): Define Cref_table_compare and Cref_table.
11998 (Cref_table_compare::operator()): New function.
11999 (Cref_inputs::gather_cref): New function.
12000 (filecol): New static const.
12001 (Cref_inputs::print_cref): New function.
12002 (Cref::print_cref): New function.
12003 * cref.h: Include <cstdio>.
12004 (class Cref): Update declarations.
12005 * mapfile.h (Mapfile::file): New function.
12006 * object.h (class Object): Define Symbols. Declare virtual
12007 do_get_global_symbols.
12008 (Object::get_global_symbols): New function.
12009 * object.cc (Input_objects::add_object): Pass object to cref_ if
12010 --cref.
12011 (Input_objects::archive_start): Likewise.
12012 (Input_objects::archive_stop): Likewise.
12013 (Input_objects::print_cref): New function.
12014 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
12015 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
12016 --cref.
12017 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
12018 function.
12019 * plugin.h (class Sized_pluginobj): Update declarations.
12020
12021 2010-01-05 Ian Lance Taylor <iant@google.com>
12022
12023 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
12024 to is_default_version. Rename insdef to insdefault.
12025 (Symbol_table::add_from_relobj): Rename def to is_default_version
12026 and local to is_forced_local.
12027 (Symbol_table::add_from_pluginobj): Likewise.
12028 (Symbol_table::add_from_dynobj): Likewise.
12029 (Symbol_table::define_special_symbol): Rename insdef to
12030 insdefault.
12031
12032 2010-01-04 Ian Lance Taylor <iant@google.com>
12033
12034 PR 10980
12035 * options.h (class General_options): Add
12036 --allow-multiple-definition and -z muldefs.
12037 * resolve.cc (Symbol_table::should_override): Don't warn about a
12038 multiple symbol definition if --allow-multiple-definition or -z
12039 muldefs.
12040
12041 PR 10980
12042 * options.h (class General_options): Add --add-needed and
12043 --copy-dt-needed-entries. Tweak --as-needed help entry.
12044 * object.cc (Input_objects::check_dynamic_dependencies): Give an
12045 error if --copy-dt-needed-entries aka --add-needed is used and
12046 would cause a change in behaviour.
12047
12048 PR 10980
12049 * options.h (class General_options): Add -G as a short version of
12050 --shared. Add no-op options -assert, -g, and -i.
12051
12052 2010-01-04 Sriraman Tallam <tmsriram@google.com>
12053
12054 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
12055 check for .text or .gnu.linkonce.t sections.
12056 * icf.cc (Icf::find_identical_sections): Ditto.
12057 Change the detection for mangled function name within the section
12058 name.
12059 * icf.h (is_section_foldable_candidate): New function.
12060
12061 2009-12-30 Ian Lance Taylor <iant@google.com>
12062
12063 PR 10980
12064 * options.h (class General_options): Permit two dashes with
12065 --retain-symbols-file.
12066
12067 2009-12-30 Ian Lance Taylor <iant@google.com>
12068
12069 PR 10979
12070 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
12071 don't put the file header and segment headers in the text
12072 segment.
12073
12074 PR 10979
12075 * common.cc (Sort_commons::operator()): Stabilize sort when both
12076 entries are NULL.
12077 (Symbol_table::do_allocate_commons_list): When allocating common
12078 symbols, skip a symbol which is no longer common.
12079 * symtab.h (Symbol::is_common): Test whether the symbol comes from
12080 an object before checking its type.
12081 * testsuite/common_test_2.c: New file.
12082 * testsuite/common_test_3.c: New file.
12083 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
12084 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
12085 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
12086 (common_test_2_pic.o, common_test_2.so): New targets.
12087 (common_test_3_pic.o, common_test_3.so): New targets.
12088 * testsuite/Makefile.in: Rebuild.
12089
12090 PR 10979
12091 * script.cc (read_input_script): If we see a new SECTIONS clause,
12092 and we have added an input section, give an error.
12093 * layout.h (class Layout): Add have_added_input_section function.
12094 Add have_added_input_section_ field.
12095 * layout.cc (Layout::Layout): Initialize
12096 have_added_input_section_.
12097 (Layout::layout): Set have_added_input_section_.
12098 (Layout::layout_eh_frame): Likewise.
12099
12100 2009-12-30 Ian Lance Taylor <iant@google.com>
12101
12102 PR 10931
12103 * options.h (class General_options): Add --sort-common option.
12104 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
12105 * common.cc (Sort_common): Add sort_order parameter to
12106 constructor. Add sort_order_ field.
12107 (Sort_commons::operator): Check sort_order_.
12108 (Symbol_table::allocate_commons): Determine the sort order.
12109 (Symbol_table::do_allocate_commons): Add sort_order parameter.
12110 Change all callers.
12111 (Symbol_table::do_allocate_commons_list): Likewise.
12112
12113 2009-12-30 Ian Lance Taylor <iant@google.com>
12114
12115 PR 10916
12116 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
12117 symbols from this object, don't change the visibility of an
12118 undefined symbol.
12119 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
12120
12121 2009-12-30 Ian Lance Taylor <iant@google.com>
12122
12123 PR 10861
12124 * script.h (class Version_script_info): Define Language enum.
12125 Update declarations. Define Glob, Exact, and Lookup types. Add
12126 new fields globals_, locals_, and is_finalized_.
12127 * script.cc: Various formatting fixes.
12128 (class Parser_closure): Change language_stack_ from a vector of
12129 std::string to one of Version_script_info::Language. Adjust all
12130 uses accordingly.
12131 (class Lazy_demangler): Remove.
12132 (struct Version_expression): Change language from std::string to
12133 Version_script_info::Language.
12134 (Version_script_info::Version_script_info): New function.
12135 (Version_script_info::~Version_script_info): Don't call clear.
12136 (Version_script_info::finalize): New function.
12137 (Version_script_info::build_lookup_tables): New function.
12138 (Version_script_info::build_expression_list_lookup): New
12139 function.
12140 (Version_script_info::get_symbol_version_helper): Rewrite to use
12141 lookup tables.
12142 (Version_script_info::print_expression_list): Adjust to use
12143 Version_script_info::Language.
12144 (script_push_lex_into_version_mode): Check that the version script
12145 has not been finalized.
12146 (version_script_push_lang): Change language string to
12147 Version_script_info::Language.
12148 * options.cc (Command_line::version_script): New function.
12149 * options.h (class General_options): Add finalize_dynamic_list
12150 function. Change version_script from declaration to definition.
12151 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
12152 * testsuite/version_script.map: Remove duplicate def of foo.
12153 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
12154 version_script.map.
12155 * testsuite/Makefile.in: Rebuild.
12156
12157 2009-12-30 Ian Lance Taylor <iant@google.com>
12158
12159 PR 10843
12160 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
12161 if the input symbol index is 0, make the output symbol index 0.
12162
12163 2009-12-30 Ian Lance Taylor <iant@google.com>
12164
12165 PR 10670
12166 * options.h (class General_options): Add -x/--discard-all.
12167 * object.cc (Sized_relobj::do_count_local_symbols): Handle
12168 --discard-all. If the local symbol needs a dynamic entry, check
12169 that before handling --discard-locals.
12170
12171 2009-12-30 Ian Lance Taylor <iant@google.com>
12172
12173 PR 10450
12174 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
12175 flags to PF_R.
12176 (Output_segment::add_output_section): Don't change the flags if
12177 the type is PT_TLS.
12178
12179 PR 10450
12180 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
12181 GNU hash table if they need a dynamic value. Otherwise, don't add
12182 them if they are defined in a dynamic object or are forced local.
12183
12184 2009-12-29 Ian Lance Taylor <iant@google.com>
12185
12186 PR 10450
12187 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
12188 .gnu.hash table for a 32-bit target.
12189
12190 PR 10450
12191 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
12192 regular and a dynamic object only needs a dynamic symbol table
12193 entry if it is externally visible.
12194
12195 PR 10450
12196 * i386.cc (class Target_i386): Initialize global_offset_table_ in
12197 constructor. Add global_offset_table_ field.
12198 (Target_i386::got_section): Set global_offset_table_.
12199 (Target_i386::do_finalize_sections): Set global_offset_table_
12200 size.
12201 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
12202 in constructor. Add global_offset_table_ field.
12203 (Target_x86_64::got_section): Set global_offset_table_.
12204 (Target_x86_64::do_finalize_sections): Set global_offset_table_
12205 size.
12206
12207 * layout.cc (Layout::Layout): Initialize increase_relro_.
12208 (Layout::get_output_section): Add is_relro, is_last_relro, and
12209 is_first_non_relro parameters. Change all callers.
12210 (Layout::choose_output_section): Likewise.
12211 (Layout::add_output_section_data): Likewise.
12212 (Layout::make_output_section): Likewise.
12213 (Layout::set_segment_offsets): Clear increase_relro when using a
12214 linker script.
12215 * layout.h (class Layout): Add increase_relro method. Add
12216 increase_relro_ field. Update declarations.
12217 * output.cc (Output_section::Output_section): Initialize
12218 is_last_relro_ and is_first_non_relro_.
12219 (Output_segment::add_output_section): Group relro sections is
12220 do_sort is true. Handle is_last_relro and is_first_non_relro.
12221 (Output_segment::maximum_alignment): Remove relro handling.
12222 (Output_segment::set_section_addresses): Add increase_relro
12223 parameter. Change all callers. Add initial alignment to align
12224 relro sections on separate page. Remove old relro handling.
12225 (Output_segment::set_section_list_addresses): Remove in_relro
12226 parameter. Change all callers.
12227 (Output_segment::set_offset): Add increase parameter. Change all
12228 callers. Remove old relro handling.
12229 * output.h (class Output_section): Add new methods: is_last_relro,
12230 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
12231 Add is_last_relro_ and is_first_non_relro_ fields.
12232 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
12233 Create separate .got.plt section. Call increase_relro.
12234 * x86_64.cc (Target_x86_64::got_section): Likewise.
12235 * testsuite/relro_script_test.t: Add .got.plt.
12236
12237 PR 10450
12238 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
12239 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
12240 (Layout::finalize): Call set_dynamic_symbol_size.
12241 (Layout::set_dynamic_symbol_size): New function.
12242 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
12243 set_dynamic_symbol_size.
12244
12245 PR 10450
12246 * output.h (class Output_section): Add is_entsize_zero_ field.
12247 * output.cc (Output_section::Output_section): Initialize
12248 is_entsize_zero_.
12249 (Output_section::set_entsize): If two different entsizes are
12250 requested, force it to zero.
12251 (Output_section::add_input_section): Set flags for .debug_str
12252 before updating section flags. Set entsize.
12253 (Output_section::update_flags_for_input_section): Set SHF_MERGE
12254 and SHF_STRING if all input sections have those flags.
12255
12256 2009-12-29 Rafael Espindola <espindola@google.com>
12257
12258 * main.cc (main): Fix the sys time reporting.
12259 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
12260 reporting.
12261
12262 2009-12-29 Sriraman Tallam <tmsriram@google.com>
12263
12264 * options.cc (General_options::parse_version): Allow -v to exit
12265 without an error if there is nothing to link.
12266
12267 2009-12-29 Ian Lance Taylor <iant@google.com>
12268
12269 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
12270 using a version of gcc before 4.1.
12271 * configure: Rebuild.
12272
12273 2009-12-28 Chris Demetriou <cgd@google.com>
12274
12275 * attributes.cc (Output_attributes_section_data::do_write): Use
12276 std::vector::front rather than std::vector::data.
12277
12278 2009-12-28 Ian Lance Taylor <iant@google.com>
12279
12280 * symtab.h (class Symbol_table): Add enum Defined.
12281 * resolve.cc (Symbol_table::should_override): Add defined
12282 parameter. Change all callers. Test whether object is NULL
12283 before calling a method on it.
12284 (Symbol_table::report_resolve_problem): Add defined parameter.
12285 Change all callers.
12286 (Symbol_table::should_override_with_special): Likewise.
12287 * symtab.cc (Symbol_table::define_in_output_data): Add defined
12288 parameter. Change all callers.
12289 (Symbol_table::do_define_in_output_data): Likewise.
12290 (Symbol_table::define_in_output_segment): Likewise.
12291 (Symbol_table::do_define_in_output_segment): Likewise.
12292 (Symbol_table::define_as_constant): Likewise.
12293 (Symbol_table::do_define_as_constant): Likewise.
12294 * script.h (class Symbol_assignment): Add is_defsym parameter to
12295 constructor; change all callers.
12296 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
12297 parameter. Change all callers. Add is_defsym_ field.
12298 (class Parser_closure): Add parsing_defsym parameter to
12299 constructor; change all callers. Add parsing_defsym accessor
12300 function. Add parsing_defsym_ field.
12301
12302 2009-12-28 Ian Lance Taylor <iant@google.com>
12303
12304 * gold.cc (queue_middle_tasks): Fix formatting.
12305 * object.cc (Relobj::is_section_name_included): Likewise.
12306
12307 2009-12-23 Ian Lance Taylor <iant@google.com>
12308
12309 * i386.cc (Target_i386::do_calls_non_split): Recognize
12310 -fsplit-stack prologue for a function with a static chain.
12311 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
12312 -fsplit-stack prologue when using %r11.
12313
12314 2009-12-21 Sriraman Tallam <tmsriram@google.com>
12315
12316 * options.cc (General_options::parse_version): Make -v continue and do
12317 the link like GNU ld does.
12318
12319 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
12320
12321 * Makefile.am (CCFILES): Add timer.cc.
12322 (HFILES): Add timer.h.
12323 * configure.ac: Check for sysconf and times.
12324 * main.cc: include timer.h.
12325 (main): Use Timer instead of get_run_time.
12326 * timer.cc: New.
12327 * timer.h: New.
12328 * workqueue.cc: include timer.h.
12329 (Workqueue::find_and_run_task):
12330 Report user, sys and wall time.
12331 * Makefile.in: Regenerate.
12332 * config.in: Regenerate.
12333 * configure: Regenerate.
12334
12335 2009-12-16 Doug Kwan <dougkwan@google.com>
12336
12337 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
12338 sections.
12339 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
12340 relaxed input sections.
12341 * output.cc (Output_section::find_relaxed_input_section): Change
12342 return type to Output_relaxed_input_section pointer. Adjust code
12343 for new type of relaxed_input_section_map_.
12344 * output.h (Output_section::find_relaxed_input_section): Change
12345 return type to Output_relaxed_input_section pointer.
12346 (Output_section::Output_relaxed_input_section_by_input_section_map):
12347 New type.
12348 (Output_section::relaxed_input_section_map_): Change type to
12349 Output_section::Output_relaxed_input_section_by_input_section_map.
12350 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
12351 input section.
12352
12353 2009-12-15 Ian Lance Taylor <iant@google.com>
12354
12355 * layout.cc (Layout::create_shstrtab): Only write out after input
12356 sections if we are compressing debug sections.
12357
12358 2009-12-15 Ian Lance Taylor <iant@google.com>
12359
12360 * archive.cc (Archive::add_symbols): Only look up a symbol without
12361 a version if there is, in fact, a version.
12362
12363 2009-12-14 Ian Lance Taylor <iant@google.com>
12364
12365 Revert -Wshadow changes, all changes from:
12366 2009-12-11 Doug Kwan <dougkwan@google.com>
12367 2009-12-11 Nick Clifton <nickc@redhat.com>
12368 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
12369
12370 2009-12-11 Doug Kwan <dougkwan@google.com>
12371
12372 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
12373 due to -Wshadow.
12374 * attributes.cc (Object_attribute::size): Ditto.
12375 (Attributes_section_data::size): Ditto.
12376 (Attributes_section_data::Attributes_section_data): Ditto.
12377 (Output_attributes_section_data::do_write): Ditto.
12378 * attributes.h (Object_attribute::set_type): Ditto.
12379 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
12380
12381 2009-12-11 Nick Clifton <nickc@redhat.com>
12382
12383 * archive.cc: Fix shadowed variable warnings.
12384 * arm.cc: Likewise.
12385 * compressed_output.cc: Likewise.
12386 * compressed_output.h: Likewise.
12387 * configure: Likewise.
12388 * dwarf_reader.cc: Likewise.
12389 * dynobj.cc: Likewise.
12390 * dynobj.h: Likewise.
12391 * ehframe.cc: Likewise.
12392 * ehframe.h: Likewise.
12393 * errors.cc: Likewise.
12394 * expression.cc: Likewise.
12395 * fileread.cc: Likewise.
12396 * fileread.h: Likewise.
12397 * freebsd.h: Likewise.
12398 * i386.cc: Likewise.
12399 * icf.cc: Likewise.
12400 * incremental.h: Likewise.
12401 * layout.cc: Likewise.
12402 * layout.h: Likewise.
12403 * mapfile.cc: Likewise.
12404 * merge.cc: Likewise.
12405 * merge.h: Likewise.
12406 * object.cc: Likewise.
12407 * object.h: Likewise.
12408 * options.h: Likewise.
12409 * output.cc: Likewise.
12410 * output.h: Likewise.
12411 * parameters.cc: Likewise.
12412 * plugin.cc: Likewise.
12413 * powerpc.cc: Likewise.
12414 * reduced_debug_output.cc: Likewise.
12415 * reduced_debug_output.h: Likewise.
12416 * reloc.cc: Likewise.
12417 * reloc.h: Likewise.
12418 * resolve.cc: Likewise.
12419 * script-sections.cc: Likewise.
12420 * script.cc: Likewise.
12421 * script.h: Likewise.
12422 * sparc.cc: Likewise.
12423 * symtab.cc: Likewise.
12424 * symtab.h: Likewise.
12425 * target-select.cc: Likewise.
12426 * target-select.h: Likewise.
12427 * token.h: Likewise.
12428 * workqueue.cc: Likewise.
12429 * workqueue.h: Likewise.
12430 * x86_64.cc: Likewise.
12431
12432 2009-12-10 Doug Kwan <dougkwan@google.com>
12433
12434 * arm.cc (attributes.h): New include.
12435 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
12436 (Arm_relobj::~Arm_relobj): Delete object pointed by
12437 attributes_section_data_.
12438 (Arm_relobj::attributes_section_data): New method definition.
12439 (Arm_relobj::attributes_section_data_): New data member declaration.
12440 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
12441 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
12442 attributes_section_data_.
12443 (Arm_dynobj::attributes_section_data): New method definition.
12444 (Arm_dynobj::attributes_section_data_): New data member declaration.
12445 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
12446 initialization value of may_use_blx_ to false.
12447 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
12448 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
12449 object attributes to compute results instead of hard-coding.
12450 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
12451 Target_arm::get_secondary_compatible_arch,
12452 Target_arm::set_secondary_compatible_arch
12453 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12454 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
12455 New method declarations.
12456 (Target_arm::get_aeabi_object_attribute): New method definition.
12457 (Target_arm::attributes_section_data_): New data member declaration.
12458 (read_arm_attributes_section): New template definition.
12459 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
12460 (Arm_dynobj::do_read_symbols): Ditto.
12461 (Target_arm::do_finalize_sections): Merge attributes sections from
12462 input. Check for BLX use after attributes section merging.
12463 Fix __exidx_start and __exidx_end visibility. Create an
12464 .ARM.attributes section if necessary.
12465 (Target_arm::get_secondary_compatible_arch,
12466 Target_arm::set_secondary_compatible_arch,
12467 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12468 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
12469 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
12470 New method definitions.
12471
12472 2009-12-09 Ian Lance Taylor <iant@google.com>
12473
12474 * plugin.cc (Plugin::load): Don't cast from void* to a function
12475 pointer.
12476
12477 2009-12-09 Ian Lance Taylor <iant@google.com>
12478
12479 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
12480 information fields.
12481
12482 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
12483
12484 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
12485 Replace two_file_shared_1.so with two_file_shared_2.so.
12486 * testsuite/Makefile.in: Regenerated.
12487
12488 2009-12-08 Doug Kwan <dougkwan@google.com>
12489
12490 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
12491 (HFILES): Add attributes.h and int_encoding.h.
12492 * Makefile.in: Regenerate.
12493 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
12494 function definitions to int_encoding.cc
12495 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
12496 prototypes to int_encoding.h
12497 * reduced_debug_output.cc (int_encoding.h): New include.
12498 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
12499 function definitions to int_encoding.cc
12500 (insert_into_vector, read_from_pointer): Move template definitions to
12501 int_encoding.h
12502 * attributes.cc: New file.
12503 * attributes.h: New file.
12504 * int_encoding.cc: New file.
12505 * int_encoding.h: New file.
12506
12507 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
12508
12509 PR gold/11055
12510 * incremental-dump.cc (dump_incremental_inputs): New.
12511 (main): Use dump_incremental_inputs.
12512
12513 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
12514
12515 PR gold/10893
12516 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
12517 checking elfcpp::STT_FUNC.
12518 (Target_i386::Relocate::relocate): Likewise.
12519 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
12520
12521 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
12522 symbols from shared libraries into normal FUNC symbols.
12523
12524 * symtab.h (Symbol): Add is_func and use it.
12525
12526 2009-12-05 Doug Kwan <dougkwan@google.com>
12527
12528 * arm.cc (Target_arm::arm_info): Initialize new fields
12529 attributes_section and attributes_vendor.
12530 * i386.cc (Target_i386::i386_info): Same.
12531 * object.cc (Sized_relobj::do_layout): Skip attribute section.
12532 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
12533 fields attributes_section and attributes_vendor.
12534 * sparc.cc (Target_sparc::sparc_info): Same.
12535 * target.h (Target::attributes_section, Target::attributes_vendor,
12536 Target::is_attributes_section, Target::attribute_arg_type,
12537 Target::attributes_order): New method definitions.
12538 (Target::Target_info::attributes_section,
12539 Target::Target_info::attributes_vendor): New fields.
12540 (Target::do_attribute_arg_type, Target::do_attributes_order): New
12541 virtual method definitions.
12542 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
12543 attributes_section and attributes_vendor.
12544 * testsuite/testfile.cc (Target_test::test_target_info): Same.
12545
12546 2009-12-05 Doug Kwan <dougkwan@google.com>
12547
12548 * arm.cc: Update comments about interworking and stub generation.
12549 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
12550 considered as non-PIC.
12551 (Arm_relocate_functions::base_abs): Fix formatting.
12552 (Arm_relocate_functions::got_prel): Fix comment. Change interface
12553 of function to use GOT entry address instead of offset.
12554 (Target_arm::Scan::global): Issue an error if a symbol would need a
12555 PLT does not get one because it is untyped. Remove code to create
12556 dynamic symbols for relative branches.
12557 (Target_arm::Relocate::relocate: Use 0 instead of false since function
12558 takes unsigned integer instead of boolean.
12559
12560 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
12561
12562 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
12563 (two_file_test_LDADD): Likewise.
12564 (common_test_1_LDADD): Likewise.
12565 (exception_test_LDADD) Likewise.
12566 (weak_test_LDADD): Likewise.
12567 (many_sections_test_LDADD): Likewise.
12568 (initpri1_LDADD): Likewise.
12569 (script_test_1_LDADD): Likewise.
12570 (script_test_2_LDADD): Likewise.
12571 (justsyms_LDADD): Likewise.
12572 (binary_test_LDADD): Likewise.
12573 (large_LDADD): Likewise.
12574 * testsuite/Makefile.in: Regenerated.
12575
12576 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
12577
12578 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
12579 (Symbol_table::override_with_special): Likewise.
12580 (Symbol_table::add_from_object): Likewise.
12581
12582 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
12583
12584 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12585 Don't set the data_offset twice.
12586
12587 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
12588
12589 * testsuite/Makefile.in: Regenerate.
12590
12591 2009-12-03 Doug Kwan <dougkwan@google.com>
12592
12593 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
12594 (Target_arm::do_finalize_sections): Add parameter for symbol table
12595 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
12596 * i386.cc (Target_i386::do_finalize_sections): Add an additional
12597 parameter for symbol table pointer.
12598 * layout.cc (Layout::finalize): Call Target::finalize_sections with
12599 an additional parameter for a pointer to symbol table.
12600 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
12601 parameter for a symbol table pointer.
12602 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
12603 * target.h (Target::finalize_sections, Target::do_finalize_sections):
12604 Ditto.
12605 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
12606 parameter for a symbol table pointer.
12607
12608 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
12609
12610 * incremental.cc (Incremental_inputs_header)
12611 (Incremental_inputs_header_write, Incremental_inputs_entry)
12612 (Incremental_inputs_entry_write): Move ...
12613 * incremental.h (Incremental_inputs_header)
12614 (Incremental_inputs_header_write, Incremental_inputs_entry)
12615 (Incremental_inputs_entry_write): here.
12616
12617 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
12618
12619 * incremental.cc (make_sized_incremental_binary): Set the target.
12620 Error if it is incompatible.
12621 * output.h (Output_file): Add filename method.
12622
12623 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
12624
12625 * incremental.cc (Incremental_inputs_entry): Remove unused argument
12626 from the get_* methods.
12627
12628 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
12629
12630 * incremental-dump.cc (main): Check that the offeset of a script is 0.
12631 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12632 Write 0 for the data_offset of scripts.
12633
12634 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
12635
12636 * testsuite/Makefile.am: Add the incremental_test.sh test.
12637 * testsuite/incremental_test.sh: New.
12638 * testsuite/incremental_test_1.c: New.
12639 * testsuite/incremental_test_2.c: New.
12640
12641 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
12642
12643 * incremental-dump.cc (main): Fix typos.
12644
12645 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
12646
12647 PR gold/11025
12648 * incremental-dump.cc (main): Use llu to print 64 bit values.
12649
12650 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
12651 H.J. Lu <hongjiu.lu@intel.com>
12652
12653 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
12654 $(LIBDL).
12655 (incremental_dump_LDADD): Likewise.
12656 * Makefile.in: Regenerated.
12657
12658 2009-11-25 Doug Kwan <dougkwan@google.com>
12659
12660 Revert:
12661
12662 2009-11-25 Doug Kwan <dougkwan@google.com>
12663
12664 * arm.cc (Target_arm::Target_arm): Move method definition
12665 outside of class definition. Add code to handle
12666 --target1-rel, --target1-abs and --target2= options.
12667 (Target_arm::get_reloc_reloc_type): Change method to be
12668 non-static and const.
12669 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
12670 New data member declaration.
12671 (Target_arm::Scan::local, Target_arm::Scan::global,
12672 Target_arm::Relocate::relocate,
12673 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12674 Adjust call to Target_arm::get_real_reloc_type.
12675 (Target_arm::get_real_reloc_type): Use command line options
12676 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12677 * options.h (--target1-rel, --target1-abs, --target2): New
12678 ARM-only options.
12679
12680 2009-11-25 Doug Kwan <dougkwan@google.com>
12681
12682 * arm.cc (Target_arm::Target_arm): Move method definition outside of
12683 class definition. Add code to handle --target1-rel, --target1-abs
12684 and --target2= options.
12685 (Target_arm::get_reloc_reloc_type): Change method to be non-static
12686 and const.
12687 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
12688 member declaration.
12689 (Target_arm::Scan::local, Target_arm::Scan::global,
12690 Target_arm::Relocate::relocate,
12691 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
12692 call to Target_arm::get_real_reloc_type.
12693 (Target_arm::get_real_reloc_type): Use command line options to
12694 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12695 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
12696 options.
12697
12698 2009-11-25 Doug Kwan <dougkwan@google.com>
12699
12700 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
12701 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
12702 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
12703 formatting.
12704 (Arm_relocate_functions::thm_call): Replace body with a call to
12705 Arm_relocate_functions::thumb_branch_common.
12706 (Arm_relocate_functions::thm_jump24,
12707 Arm_relocate_functions::thm_xpc22): New method definitions.
12708 (Arm_relocate_functions::thumb_branch_common): New method definition.
12709 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
12710 operator.
12711 (Target_arm::Relocate::relocate): Adjust call to thm_call.
12712 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
12713
12714 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
12715
12716 * Makefile.am: Build incremental-dump
12717 * Makefile.in: Regenerate.
12718 * incremental-dump.cc: New.
12719 * incremental.cc (Incremental_inputs_header_data,
12720 Incremental_inputs_entry_data): Move to incremental.h
12721 * incremental.h: (Incremental_inputs_header_data,
12722 Incremental_inputs_entry_data): Move from incremental.cc
12723
12724 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
12725
12726 * incremental.cc (Incremental_inputs_header,
12727 Incremental_inputs_header_write, Incremental_inputs_entry,
12728 Incremental_inputs_entry_write): Add a typedef with the data type.
12729
12730 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
12731
12732 * incremental.cc (Incremental_inputs_header,
12733 Incremental_inputs_header_write, Incremental_inputs_entry,
12734 Incremental_inputs_entry_write): Update comment about which
12735 type has the filed descriptions.
12736
12737 2009-11-15 Doug Kwan <dougkwan@google.com>
12738
12739 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
12740 (Arm_relocate_functions::arm_branch_common): Change method defintion
12741 in class definition to a method declaration and update list of formal
12742 parameters.
12743 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
12744 Arm_relocation_functions::jump24): Adjust call to
12745 Arm_relocate_functions::arm_branch_common. Update list of formal
12746 parameters.
12747 (Arm_relocate_functions::xpc25): New method definition.
12748 (Arm_relocate_functions::arm_branch_common): Move method defintion
12749 out from class definition. Use stubs for mode-switching and extending
12750 branch ranges.
12751 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
12752 specially. Change code to enable use of stubs in ARM branches.
12753
12754 2009-11-10 Doug Kwan <dougkwan@google.com>
12755
12756 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
12757 in method declaration.
12758 (Target_arm::relocate_stub): New method declaration.
12759 (Target_arm::default_target): Change to return a pointer instead of
12760 a const reference.
12761 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
12762 Target_arm::default_target.
12763 (Arm_Relobj::do_relocate_sections): Remove options paramater in
12764 method definition.
12765 (Target_arm::relocate_section): Adjust view.
12766 (Target_arm::relocate_stub): New method definition.
12767
12768 2009-11-10 Doug Kwan <dougkwan@google.com>
12769
12770 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
12771 a format warning.
12772 * incremental.cc (open_incremental_binary): Initialized local
12773 variables to avoid warnings.
12774 * object.cc (make_elf_object): Ditto.
12775 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
12776 a format warning.
12777
12778 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
12779
12780 PR gold/10930
12781 * testsuite/plugin_test.c: Include "config.h".
12782
12783 2009-11-09 Doug Kwan <dougkwan@google.com>
12784
12785 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
12786 (arm_symbol_value): Remove.
12787 (Arm_relocate_functions::arm_branch_common,
12788 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
12789 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
12790 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
12791 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
12792 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
12793 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
12794 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
12795 Arm_relocate_functions::thm_mobw_abs_nc,
12796 Arm_relocate_functions::thm_mov_abs,
12797 Arm_relocate_functions::movw_prel_nc,
12798 Arm_relocate_functions::thm_movt_abs,
12799 Arm_relocate_functions::movt_prel,
12800 Arm_relocate_functions::thm_movw_prel_nc,
12801 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
12802 (Target_arm::Relocate::relocate): Only decompose address into two
12803 parts if relocation type uses the thumb-bit and pass the actual
12804 bit instead of a flag indicating that the thumb-bit is used. Adjust
12805 calls to methods in Arm_relocate_functions for this change.
12806
12807 2009-11-08 Ian Lance Taylor <iant@google.com>
12808
12809 PR 10925
12810 * reloc.cc: Instantiate
12811 Sized_relobj::initialize_input_to_output_maps and
12812 Sized_relobj:free_input_to_output_maps.
12813
12814 2009-11-06 Ian Lance Taylor <iant@google.com>
12815
12816 PR 10876
12817 * defstd.cc (in_segment): Set only_if_ref true for "end".
12818
12819 2009-11-06 Doug Kwan <dougkwan@google.com>
12820
12821 * arm.cc (class Reloc_stub): Correct a comment.
12822 (Target_arm::Target_arm): Initialize arm_input_section_map_.
12823 (Target_arm::scan_section_for_stubs): New method declaration.
12824 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
12825 Change methods from private to protected.
12826 (Target_arm::do_may_relax): New method definition.
12827 (Target_arm::do_relax, Target_arm::group_sections,
12828 Target_arm::scan_reloc_for_stub,
12829 Target_arm::scan_reloc_section_for_stubs): New method declarations.
12830 (Target_arm::arm_input_section_map_): New data member declaration.
12831 (Target_arm::scan_reloc_for_stub,
12832 Target_arm::scan_reloc_section_for_stubs,
12833 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
12834 Target_arm::do_relax): New method definitions.
12835
12836 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
12837
12838 * configure.ac: Check for (struct stat)::st_mtim
12839 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
12840 * config.in: Regenerate.
12841 * configure: Regenerate.
12842
12843 2009-11-05 Ian Lance Taylor <iant@google.com>
12844
12845 PR 10910
12846 * output.cc (Output_segment::add_output_section): Add missing
12847 return statement.
12848
12849 2009-11-04 Ian Lance Taylor <iant@google.com>
12850
12851 PR 10880
12852 * object.h (class Object): Add is_needed and set_is_needed
12853 methods. Add is_needed_ field. Make bool fields into bitfields.
12854 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
12855 defined in a dynamic object and referenced by a regular object,
12856 set is_needed for the dynamic object.
12857 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
12858 if the file is marked with as_needed and it is not needed.
12859
12860 2009-11-04 Ian Lance Taylor <iant@google.com>
12861
12862 PR 10887
12863 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
12864 tags if data is discarded by linker script.
12865 * i386.cc (Target_i386::do_finalize_sections): Likewise.
12866 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12867 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12868 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12869
12870 2009-11-04 Ian Lance Taylor <iant@google.com>
12871
12872 * layout.cc (Layout::get_output_section): Add is_interp and
12873 is_dynamic_linker_section parameters. Change all callers.
12874 (Layout::choose_output_section): Likewise.
12875 (Layout::make_output_section): Likewise.
12876 (Layout::add_output_section_data): Add is_dynamic_linker_section
12877 parameter. Change all callers.
12878 * layout.h (class Layout): Update declarations.
12879 * output.h (class Output_section): Add is_interp, set_is_interp,
12880 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
12881 Add is_interp_, is_dynamic_linker_section_ fields. Change
12882 generate_code_fills_at_write_ to a bitfield.
12883 * output.cc (Output_section::Output_sections): Initialize new
12884 fields.
12885 (Output_segment::add_output_section): Add do_sort parameter.
12886 Change all callers.
12887
12888 2009-11-03 Ian Lance Taylor <iant@google.com>
12889
12890 PR 10860
12891 * options.h (class General_options): Add --warn-common.
12892 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
12893 merging two common symbols.
12894 (Symbol_table::should_override): Handle --warn-common when merging
12895 a common symbol with a defined symbol. Use report_resolve_problem
12896 for multiple definitions.
12897 (Symbol_table::report_resolve_problem): New function.
12898 * symtab.h (class Symbol_table): Declare report_resolve_problem.
12899
12900 2009-11-03 Doug Kwan <dougkwan@google.com>
12901
12902 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
12903 stub_factory_.
12904 (Target_arm::stub_factory): New method definition.
12905 (Target_arm::new_arm_input_section,
12906 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
12907 Target_arm::reloc_uses_thumb_bit): New method declarations.
12908 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
12909 New type definitions.
12910 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
12911 member declarations.
12912 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
12913 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
12914 New method definitions.
12915
12916 2009-11-03 Ian Lance Taylor <iant@google.com>
12917
12918 * options.h (class General_options): Add --warn_constructors.
12919
12920 2009-11-03 Ian Lance Taylor <iant@google.com>
12921
12922 PR 10893
12923 * defstd.cc (in_section): Add entries for __rel_iplt_start,
12924 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
12925
12926 2009-11-03 Ian Lance Taylor <iant@google.com>
12927
12928 PR 10895
12929 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
12930 --msgid-bugs-address.
12931 (install-pdf): New target.
12932 (install-data_yes): Look up one directory to find mkinstalldirs.
12933
12934 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
12935
12936 * po/Make-in (.po.gmo): Don't generate .gmo files in source
12937 tree.
12938
12939 2009-10-30 Doug Kwan <dougkwan@google.com>
12940
12941 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
12942
12943 2009-10-30 Doug Kwan <dougkwan@google.com>
12944
12945 * arm.cc (Stub_addend_reader): New struct template definition
12946 and partial specializations.
12947 (Stub_addend_reader::operator()): New method definition for a
12948 partially specialized template.
12949
12950 2009-10-30 Doug Kwan <dougkwan@google.com>
12951
12952 * arm.cc (Arm_relobj::processor_specific_flags): New method
12953 definition.
12954 (Arm_relobj::do_read_symbols): New method declaration.
12955 (Arm_relobj::processor_specific_flags_): New data member declaration.
12956 (Arm_dynobj): New class definition.
12957 (Target_arm::do_finalize_sections): Add input_objects parameter.
12958 (Target_arm::do_adjust_elf_header): New method declaration.
12959 (Target_arm::are_eabi_versions_compatible,
12960 (Target_arm::merge_processor_specific_flags): New method declaration.
12961 (Target_arm::do_make_elf_object): New overloaded method definitions
12962 and declaration.
12963 (Arm_relobj::do_read_symbols): New method definition.
12964 (Arm_dynobj::do_read_symbols): Ditto.
12965 (Target_arm::do_finalize_sections): Add input_objects parameters.
12966 Merge processor-specific flags from all input objects.
12967 (Target_arm::are_eabi_versions_compatible,
12968 Target_arm::merge_processor_specific_flags,
12969 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
12970 New method definitions.
12971 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
12972 Input_objects pointer type parameter.
12973 * layout.cc (Layout::finalize): Pass input objects to target's.
12974 finalize_sections function.
12975 * output.cc (Output_file_header::do_sized_write): Set ELF file
12976 header's processor-specific flags.
12977 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
12978 Input_objects pointer type parameter.
12979 * sparc.cc (Target_sparc::do_finalize_sections): Same.
12980 * target.h (Input_objects): New forward class declaration.
12981 (Target::processor_specific_flags,
12982 Target::are_processor_specific_flags_sect): New method definitions.
12983 (Target::finalize_sections): Add input_objects parameter.
12984 (Target::Target): Initialize processor_specific_flags_ and
12985 are_processor_specific_flags_set_.
12986 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
12987 parameter.
12988 (Target::set_processor_specific_flags): New method definition.
12989 (Target::processor_specific_flags_,
12990 Target::are_processor_specific_flags_set_): New data member
12991 declarations.
12992 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
12993 Input_objects pointer type parameter.
12994
12995 2009-10-30 Doug Kwan <dougkwan@google.com>
12996
12997 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
12998
12999 2009-10-28 Ian Lance Taylor <iant@google.com>
13000
13001 * object.h (class Relobj): Drop options parameter from
13002 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
13003 do_scan_relocs, do_relocate. Change all callers.
13004 (class Sized_relobj): Drop options parameters from
13005 do_gc_process_relocs, do_scan_relocs, do_relocate,
13006 do_relocate_sections, relocate_sections, emit_relocs_scan,
13007 emit_relocs_scan_reltype. Change all callers.
13008 (struct Relocate_info): Remove options field and all references to
13009 it.
13010 * reloc.h (class Read_relocs): Remove options constructor
13011 parameter and options_ field. Change all callers.
13012 (class Gc_process_relocs, class Scan_relocs): Likewise.
13013 (class Relocate_task): Likewise.
13014 * target-reloc.h (scan_relocs): Remove options parameter. Change
13015 all callers.
13016 (scan_relocatable_relocs): Likewise.
13017 * target.h (class Sized_target): Remove options parameter from
13018 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
13019 all callers.
13020 * gc.h (gc_process_relocs): Remove options parameter. Change all
13021 callers.
13022 * arm.cc: Update functions to remove options parameters.
13023 * i386.cc: Likewise.
13024 * powerpc.cc: Likewise.
13025 * sparc.cc: Likewise.
13026 * x86_64.cc: Likewise.
13027 * testsuite/testfile.cc: Likewise.
13028
13029 2009-10-28 Doug Kwan <dougkwan@google.com>
13030
13031 * arm.cc (Arm_relobj): New class definition.
13032 (Arm_relobj::scan_sections_for_stubs,
13033 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
13034 New method definitions.
13035
13036 2009-10-28 Cary Coutant <ccoutant@google.com>
13037
13038 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
13039 (Plugin::cleanup_done_): New member.
13040 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
13041 (Plugin_manager::cleanup_done_): Remove.
13042 (Plugin_manager::add_input_file): Edit error message.
13043 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
13044 (Plugin_manager::cleanup): Remove use of cleanup_done_.
13045
13046 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
13047
13048 * fileread.cc: (File_read::View::~View): Use the new
13049 data_ownership_ filed.
13050 (File_read::~File_read): Dispose the new whole_file_view_.
13051 (File_read::open): Mmap the whole file if needed.
13052 (File_read::open): Use whole_file_view_ instead of contents_.
13053 (File_read::find_view): Use whole_file_view_ if applicable.
13054 (File_read::do_read): Use whole_file_view_ instead of contents_.
13055 (File_read::make_view): Use whole_file_view_ instead of contents_,
13056 update File_read::View::View call.
13057 (File_read::find_or_make_view): Update File_read::View::View
13058 call.
13059 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
13060 remove contents_
13061 (File_read::View::Data_ownership): New enum.
13062 (File_read::View::View): Replace bool mapped_ with Data_ownership
13063 argument.
13064 (File_read::View::mapped_): Remove (replaced by data_ownership_).
13065 (File_read::View::data_ownership_): New field.
13066 (File_read::contents_): Remove (replaced by whole_file_view_).
13067 (File_read::whole_file_view_): New field.
13068 * options.h (class General_options): Add --keep-files-mapped.
13069
13070 2009-10-27 Cary Coutant <ccoutant@google.com>
13071
13072 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
13073 * testsuite/Makefile.am (plugin_test_5): New test case.
13074 * testsuite/Makefile.in: Regenerate.
13075
13076 2009-10-25 Doug Kwan <dougkwan@google.com>
13077
13078 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
13079 from private to protected to allow access by child class.
13080 (Sized_relobj::do_relocate_sections): New method declaration.
13081 (Sized_relobj::relocate_sections): Virtualize.
13082 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
13083 Sized_relobj::relocate_sections. Instantiate template explicitly
13084 for different target sizes and endianity.
13085
13086 2009-10-24 Doug Kwan <dougkwan@google.com>
13087
13088 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
13089 (Arm_input_section::as_arm_input_section): New method.
13090 (Arm_output_section): New class definition.
13091 (Arm_output_section::create_stub_group,
13092 Arm_output_section::group_sections): New method definitions.
13093
13094 2009-10-22 Doug Kwan <dougkwan@google.com>
13095
13096 * arm.cc (Arm_input_section): New class definition.
13097 (Arm_input_section::init, Arm_input_section:do_write,
13098 Arm_input_section::set_final_data_size,
13099 Arm_input_section::do_reset_address_and_file_offset): New method
13100 definitions.
13101
13102 2009-10-21 Doug Kwan <dougkwan@google.com>
13103
13104 * arm.cc (Stub_table, Arm_input_section): New forward class
13105 declarations.
13106 (Stub_table): New class defintion.
13107 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
13108 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
13109 New method definition.
13110
13111 2009-10-21 Doug Kwan <dougkwan@google.com>
13112
13113 * arm.cc: Update copyright comments.
13114 (Target_arm): New forward class template declaration.
13115 (Arm_address): New type.
13116 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
13117 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
13118 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
13119 constants.
13120 (Insn_template): Same.
13121 (DEF_STUBS): New macro.
13122 (Stub_type): New enum type.
13123 (Stub_template): New class definition.
13124 (Stub): Same.
13125 (Reloc_stub): Same.
13126 (Stub_factory): Same.
13127 (Target_arm::Target_arm): Initialize may_use_blx_ and
13128 should_force_pic_veneer_.
13129 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
13130 Target_arm::should_force_pic_veneer,
13131 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
13132 Target_arm::using_thumb_only, Target_arm:;default_target): New
13133 method defintions.
13134 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
13135 New data member declarations.
13136 (Insn_template::size, Insn_template::alignment): New method defintions.
13137 (Stub_template::Stub_template): New method definition.
13138 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
13139 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
13140 (Stub_factory::Stub_factory): New method definition.
13141 * gold.h (string_hash): New template.
13142 * output.h (Input_section_specifier::hash_value): Use
13143 gold::string_hash.
13144 (Input_section_specifier::string_hash): Remove.
13145 * stringpool.cc (Stringpool_template::string_hash): Use
13146 gold::string_hash.
13147
13148 2009-10-20 Doug Kwan <dougkwan@google.com>
13149
13150 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
13151 symbols of relaxed input sections.
13152 * output.h (Output_section::find_relaxed_input_section): Make
13153 method public.
13154
13155 2009-10-16 Doug Kwan <dougkwan@google.com>
13156
13157 * dynobj.cc (Versions::Versions): Initialize version_script_.
13158 Only insert base version symbol definition for a shared object
13159 if version script defines any version versions.
13160 (Versions::define_base_version): New method definition.
13161 (Versions::add_def): Check that base version is not needed.
13162 (Versions::add_need): Define base version lazily.
13163 * dynobj.h (Versions::define_base_version): New method declaration.
13164 (Versions::needs_base_version_): New data member declaration.
13165 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
13166 (check_DATA): Add no_version_test.stdout.
13167 (libno_version_test.so, no_version_test.o no_version_test.stdout):
13168 New make rules.
13169 * testsuite/Makefile.in: Regenerate.
13170 * testsuite/no_version_test.c: New file.
13171 * testsuite/no_version_test.sh: Ditto.
13172
13173 2009-10-16 Doug Kwan <dougkwan@google.com>
13174
13175 * expression.cc (class Segment_start_expression): New class definition.
13176 (Segment_start_expression::value): New method definition.
13177 (script_exp_function_segment_start): Return a new
13178 Segment_start_expression.
13179 * gold/script-c.h (script_saw_segment_start_expression): New function
13180 prototype.
13181 * script-sections.cc (Script_sections::Script_sections): Initialize
13182 SAW_SEGMENT_START_EXPRESSION_ to false.
13183 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
13184 and -Tbbs options to specify section addresses if given in
13185 command line and no SEGMENT_START expression is seen in a script.
13186 * script-sections.h (Script_sections::saw_segment_start_expression,
13187 Script_sections::set_saw_segment_start_expression): New method
13188 definition.
13189 (Script_sections::saw_segment_start_expression_): New data member
13190 declaration.
13191 * script.cc (script_saw_segment_start_expression): New function.
13192 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
13193 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
13194 script_test_7.sh and script_test_8.sh.
13195 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
13196 script_test_8.stdout.
13197 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
13198 (script_test_6, script_test_6.stdout, script_test_7,
13199 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
13200 * Makefile.in: Regenerate.
13201 * testsuite/script_test_6.sh: New file.
13202 * testsuite/script_test_6.t: Same.
13203 * testsuite/script_test_7.sh: Same.
13204 * testsuite/script_test_7.t: Same.
13205 * testsuite/script_test_8.sh: Same.
13206
13207 2009-10-16 Doug Kwan <dougkwan@google.com>
13208
13209 * output.cc (Output_segment::set_section_list_address): Cast
13210 expressions to unsigned long long type to avoid format warnings.
13211
13212 2009-10-15 Ian Lance Taylor <iant@google.com>
13213
13214 * script.cc (Script_options::add_symbol_assignment): Always add a
13215 dot assignment to script_sections_.
13216 * script-sections.cc (Script_sections::add_dot_assignment):
13217 Initialize if necessary.
13218
13219 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
13220 program headers with no load segment if there is a linker script.
13221
13222 * layout.cc (Layout::set_segment_offsets): Align the file offset
13223 to the segment aligment for -N or -n with no load segment.
13224 * output.cc (Output_segment::add_output_section): Don't crash if
13225 the first section is a TLS section.
13226 (Output_segment::set_section_list_addresses): Print an error
13227 message if the address moves backward in a linker script.
13228 * script-sections.cc
13229 (Output_section_element_input::set_section_addresses): Don't
13230 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
13231 (Orphan_output_section::set_section_addresses): Likewise.
13232
13233 2009-10-15 Doug Kwan <dougkwan@google.com>
13234
13235 * layout.cc (Layout::finish_dynamic_section): Generate tags
13236 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
13237 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
13238 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
13239
13240 2009-10-14 Ian Lance Taylor <iant@google.com>
13241
13242 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
13243 fields.
13244 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
13245 data_shdr fields of relinfo.
13246 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
13247 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
13248 R_386_TLS_LDO_32, adjust based on section flags.
13249 (Target_i386::Relocate::fix_up_ldo): Remove.
13250
13251 2009-10-13 Ian Lance Taylor <iant@google.com>
13252
13253 Add support for -pie.
13254 * options.h (class General_options): Add -pie and
13255 --pic-executable.
13256 (General_options::output_is_position_independent): Test -pie.
13257 (General_options::output_is_executable): Return true if not shared
13258 and not relocatable.
13259 (General_options::output_is_pie): Remove.
13260 * options.cc (General_options::finalize): Reject incompatible uses
13261 of -pie.
13262 * gold.cc (queue_middle_tasks): A -pie link is not static.
13263 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
13264 * symtab.cc (Symbol::final_value_is_known): Return false if
13265 output_is_position_independent.
13266 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
13267 output_is_position_independent.
13268 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
13269 output_is_position_independent.
13270 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
13271 output_is_position_independent.
13272 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
13273 two_file_pie_test.
13274 (basic_pie_test.o, basic_pie_test): New targets.
13275 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
13276 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
13277 (two_file_pie_test): New target.
13278 * testsuite/Makefile.in: Rebuild.
13279 * README: Remove note saying that -pie is not supported.
13280
13281 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
13282
13283 * options.h (class General_options): Add -init and -fini.
13284 * layout.cc (Layout::finish_dynamic_section): Emit
13285 given init and fini functions.
13286
13287 2009-10-13 Sriraman Tallam <tmsriram@google.com>
13288
13289 * gc.h (gc_process_relocs): Check if icf is enabled using new
13290 function.
13291 * gold.cc (queue_initial_tasks): Likewise.
13292 (queue_middle_tasks): Likewise.
13293 * object.cc (do_layout): Likewise.
13294 * symtab.cc (is_section_folded): Likewise.
13295 * main.cc (main): Likewise.
13296 * reloc.cc (Read_relocs::run): Likewise.
13297 (Sized_relobj::do_scan_relocs): Likewise.
13298 * icf.cc (is_function_ctor_or_dtor): New function.
13299 (Icf::find_identical_sections): Check if function is ctor or dtor when
13300 safe icf is chosen.
13301 * options.h (General_options::icf): Change option to be an enum.
13302 (Icf_status): New enum.
13303 (icf_enabled): New method.
13304 (icf_safe_folding): New method.
13305 (set_icf_status): New method.
13306 (icf_status_): New variable.
13307 * (options.cc) (General_options::finalize): Set icf_status_.
13308 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
13309 icf_test and icf_keep_unique_test to use the --icf enum flag.
13310 * testsuite/icf_safe_test.sh: New file.
13311 * testsuite/icf_safe_test.cc: New file.
13312
13313 2009-10-12 Sriraman Tallam <tmsriram@google.com>
13314
13315 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
13316 includes to gc.h and icf.h.
13317 * arm.cc: Include gc.h.
13318 * gold.cc: Likewise.
13319 * i386.cc: Likewise.
13320 * powerpc.cc: Likewise.
13321 * sparc.cc: Likewise.
13322 * x86_64.cc: Likewise.
13323 * gc.h: Include icf.h.
13324
13325 2009-10-11 Ian Lance Taylor <iant@google.com>
13326
13327 * plugin.cc: Include "gold.h" before other header files.
13328
13329 2009-10-10 Chris Demetriou <cgd@google.com>
13330
13331 * options.h (Input_file_argument::Input_file_type): New enum.
13332 (Input_file_argument::is_lib_): Replace with...
13333 (Input_file_argument::type_): New member.
13334 (Input_file_argument::Input_file_argument): Take Input_file_type
13335 'type' rather than boolean 'is_lib' as second argument.
13336 (Input_file_argument::is_lib): Use type_.
13337 (Input_file_argument::is_searched_file): New function.
13338 (Input_file_argument::may_need_search): Handle is_searched_file.
13339 * options.cc (General_options::parse_library): Support -l:filename.
13340 (General_options::parse_just_symbols): Update for Input_file_argument
13341 changes.
13342 (Command_line::process): Likewise.
13343 * archive.cc (Archive::get_file_and_offset): Likewise.
13344 * plugin.cc (Plugin_manager::release_input_file): Likewise.
13345 * script.cc (read_script_file, script_add_file): Likewise.
13346 * fileread.cc (Input_file::Input_file): Likewise.
13347 (Input_file::will_search_for): Handle is_searched_file.
13348 (Input_file::open): Likewise.
13349 * readsyms.cc (Read_symbols::get_name): Likewise.
13350 * testsuite/Makefile.am (searched_file_test): New test.
13351 * testsuite/Makefile.in: Regenerate.
13352 * testsuite/searched_file_test.cc: New file.
13353 * testsuite/searched_file_test_lib.cc: New file.
13354
13355 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
13356 Ian Lance Taylor <iant@google.com>
13357
13358 * descriptor.cc: Include <cstdio> and "binary-io.h".
13359 (Descriptors::open): Open the files in binary mode always.
13360 * script.cc (Lex::get_token): Treat \r as whitespace.
13361
13362 2009-10-09 Ian Lance Taylor <iant@google.com>
13363
13364 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
13365
13366 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
13367 Ian Lance Taylor <iant@google.com>
13368
13369 * configure.ac: Check for readv function also.
13370 * fileread.cc (readv): Define if not HAVE_READV.
13371 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
13372 does not exist.
13373 * config.in: Regenerate.
13374 * configure: Regenerate.
13375
13376 2009-10-09 Doug Kwan <dougkwan@google.com>
13377
13378 * layout.cc (Layout::make_output_section): Call target hook to make
13379 ordinary output section.
13380 (Layout::finalize): Adjust parameter list of call the
13381 Target::may_relax().
13382 * layout.h (class Layout::section_list): New method.
13383 * merge.h (Output_merge_base::entsize): Change visibility to public.
13384 (Output_merge_base::is_string, Output_merge_base::do_is_string):
13385 New methods.
13386 (Output_merge_string::do_is_string): New method.
13387 * object.cc (Sized_relobj::do_setup): renamed from
13388 Sized_relobj::set_up.
13389 * object.h (Sized_relobj::adjust_shndx,
13390 Sized_relobj::initializ_input_to_output_maps,
13391 Sized_relobj::free_input_to_output_maps): Change visibilities to
13392 protected.
13393 (Sized_relobj::setup): Virtualize.
13394 (Sized_relobj::do_setup): New method declaration.
13395 (Sized_relobj::invalidate_section_offset,
13396 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
13397 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
13398 * options.cc (parse_int): New function.
13399 * options.h (parse_int): New declaration.
13400 (DEFINE_int): New macro.
13401 (stub_group_size): New option.
13402 * output.cc (Output_section::Output_section): Initialize memebers
13403 merge_section_map_, merge_section_by_properties_map_,
13404 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
13405 (Output_section::add_input_section): Handled deferred code-fill
13406 generation and remove an old comment.
13407 (Output_section::add_relaxed_input_section): New method definition.
13408 (Output_section::add_merge_input_section): Use merge section by
13409 properties map to speed to search. Update merge section maps
13410 as appropriate.
13411 (Output_section::build_relaxation_map): New method definition.
13412 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
13413 Same.
13414 (Output_section::relax_input_section): Renamed to
13415 Output_section::convert_input_sections_to_relaxed_sections and change
13416 interface to take a vector of pointers to relaxed sections.
13417 (Output_section::find_merge_section,
13418 Output_section::find_relaxed_input_section): New method definitions.
13419 (Output_section::is_input_address_mapped,
13420 Output_section::output_offset, Output_section::output_address):
13421 Use output section data maps to speed up searching.
13422 (Output_section::find_starting_output_address): Add comments.
13423 (Output_section::do_write,
13424 Output_section::write_to_postprocessing_buffer): Do code-fill
13425 generation as appropriate.
13426 (Output_section::get_input_sections): Invalidate relaxed input section
13427 map.
13428 (Output_section::restore_states): Adjust type of checkpoint .
13429 Invalidate relaxed input section map.
13430 * output.h (Output_merge_base): New class declaration.
13431 (Input_section_specifier): New class defintion.
13432 (class Output_relaxed_input_section) Change base class to
13433 Output_section_data_build.
13434 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
13435 base class initializer.
13436 (Output_section::add_relaxed_input_section): New method declaration.
13437 (Output_section::Input_section): Change visibility to protected.
13438 (Output_section::Input_section::relobj,
13439 Output_section::Input_section::shndx): Handle relaxed input sections.
13440 Output_section::input_sections) Change visibility to protected. Also
13441 define overload to return a non-const pointer.
13442 (Output_section::Merge_section_properties): New class defintion.
13443 (Output_section::Merge_section_by_properties_map,
13444 Output_section::Output_section_data_by_input_section_map,
13445 Output_section::Relaxation_map): New types.
13446 (Output_section::relax_input_section): Rename method to
13447 Output_section::convert_input_sections_to_relaxed_sections and change
13448 interface to take a vector of relaxed section pointers.
13449 (Output_section::find_merge_section,
13450 Output_section::find_relaxed_input_section,
13451 Output_section::build_relaxation_map,
13452 Output_section::convert_input_sections_in_list_to_relaxed_sections):
13453 New method declarations.
13454 (Output_section::merge_section_map_
13455 Output_section::merge_section_by_properties_map_,
13456 Output_section::relaxed_input_section_map_,
13457 Output_section::is_relaxed_input_section_map_valid_,
13458 Output_section::generate_code_fills_at_write_): New data members.
13459 * script-sections.cc
13460 (Output_section_element_input::set_section_addresses): Call
13461 current_data_size and addralign methods of relaxed input sections.
13462 (Orphan_output_section::set_section_addresses): Call current_data_size
13463 and addralign methods of relaxed input sections.
13464 * symtab.cc (Symbol_table::compute_final_value): Extract template
13465 from the body of Symbol_table::sized_finalize_symbol.
13466 (Symbol_table::sized_finalized_symbol): Call
13467 Symbol_table::compute_final_value.
13468 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
13469 (Symbol_table::compute_final_value): New templated method declaration.
13470 * target.cc (Target::do_make_output_section): New method defintion.
13471 * target.h (Target::make_output_section): New method declaration.
13472 (Target::relax): Add more parameters for input objects, symbol table
13473 and layout. Adjust call to do_relax.
13474 (Target::do_make_output_section): New method declaration.
13475 (Target::do_relax): Add parameters for input objects, symbol table
13476 and layout.
13477
13478 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
13479
13480 * pread.c: Include stdio.h.
13481
13482 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
13483
13484 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
13485 defined.
13486
13487 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
13488
13489 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
13490 Change read_shndx type to unsigned int.
13491 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13492 int.
13493 (Sized_dwarf_line_info::read_line_mappings): Likewise.
13494 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
13495 Change read_shndx type to unsigned int.
13496 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13497 int.
13498 (Sized_dwarf_line_info::read_line_mappings): Likewise.
13499 * layout.cc (Layout::create_symtab_sections): Cast the result of
13500 local_symcount * symsize to off_t in the gold_assert.
13501
13502 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
13503
13504 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
13505 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
13506 R_ARM_BASE_ABS.
13507 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
13508 (Arm_relocate_functions::thm_abs5): New function.
13509 (Arm_relocate_functions::abs12): New function.
13510 (Arm_relocate_functions::abs16): New function.
13511 (Arm_relocate_functions::base_abs): New function.
13512 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
13513 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
13514 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
13515 R_ARM_BASE_ABS.
13516 (Scan::global): Likewise.
13517 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
13518 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
13519 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
13520 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
13521 R_ARM_BASE_ABS.
13522
13523 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
13524
13525 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
13526 (Arm_relocate_functions::movt_prel): New function.
13527 (Arm_relocate_functions::thm_movw_prel_nc): New function.
13528 (Arm_relocate_functions::thm_movt_prel): New function.
13529 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
13530 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
13531 (Scan::global, Relocate::relocate): Likewise.
13532 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13533
13534 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
13535
13536 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
13537 Incremental_checker.
13538 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
13539 unsigned int.
13540 (class Incremental_inputs_header): New class.
13541 (Incremental_inputs_header_writer): Edit comment.
13542 (Incremental_inputs_entry): New class.
13543 (Incremental_inputs_entry_writer): Edit comment.
13544 (Sized_incremental_binary::do_find_incremental_inputs_section):
13545 Add *strtab_shndx parameter, fill it.
13546 (Sized_incremental_binary::do_check_inputs): New method.
13547 (Incremental_checker::can_incrementally_link_output_file): Use
13548 Sized_incremental_binary::check_inputs.
13549 (Incremental_inputs::report_command_line): Save command line in
13550 command_line_.
13551 * incremental.h:
13552 (Incremental_binary::find_incremental_inputs_section): New
13553 method.
13554 (Incremental_binary::do_find_incremental_inputs_section): Add
13555 strtab_shndx parameter.
13556 (Incremental_binary::do_check_inputs): New pure virtual method.
13557 (Sized_incremental_binary::do_check_inputs): Declare.
13558 (Incremental_checker::Incremental_checker): Add incremental_inputs
13559 parameter, use it to initialize incremental_inputs_.
13560 (Incremental_checker::incremental_inputs_): New field.
13561 (Incremental_checker::command_line): New method.
13562 (Incremental_checker::inputs): New method.
13563 (Incremental_checker::command_line_): New field.
13564
13565 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
13566
13567 * incremental.cc: Include <cstdarg> and "target-select.h".
13568 (vexplain_no_incremental): New function.
13569 (explain_no_incremental): New function.
13570 (Incremental_binary::error): New method.
13571 (Sized_incremental_binary::do_find_incremental_inputs_section): New
13572 method.
13573 (make_sized_incremental_binary): New function.
13574 (open_incremental_binary): New function.
13575 (can_incrementally_link_file): Add checks if output is ELF and has
13576 inputs section.
13577 * incremental.h: Include "elfcpp_file.h" and "output.h".
13578 (Incremental_binary): New class.
13579 (Sized_incremental_binary): New class.
13580 (open_incremental_binary): Declare.
13581 * object.cc (is_elf_object): Use
13582 elfcpp::Elf_recognizer::is_elf_file.
13583 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
13584 * output.h (Output_file::filesize): New method.
13585
13586 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
13587
13588 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
13589 New function.
13590 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
13591 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
13592 function.
13593 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
13594 function.
13595 (Arm_relocate_functions::movw_abs_nc): New function.
13596 (Arm_relocate_functions::movt_abs): New function.
13597 (Arm_relocate_functions::thm_movw_abs_nc): New function.
13598 (Arm_relocate_functions::thm_movt_abs): New function.
13599 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
13600 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
13601 (Scan::global): Likewise.
13602 (Relocate::relocate): Likewise.
13603 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13604
13605 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
13606
13607 * arm.cc (Arm_relocate_functions::got_prel) New function.
13608 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
13609 (Relocate::relocate): Likewise.
13610 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13611
13612 2009-10-06 Ian Lance Taylor <iant@google.com>
13613
13614 * options.h (class General_options): Define
13615 split_stack_adjust_size parameter.
13616 * object.h (class Object): Add uses_split_stack_ and
13617 has_no_split_stack_ fields. Add uses_split_stack and
13618 has_no_split_stack accessor functions. Declare
13619 handle_split_stack_section.
13620 (class Reloc_symbol_changes): Define.
13621 (class Sized_relobj): Define Function_offsets. Declare
13622 split_stack_adjust, split_stack_adjust_reltype, and
13623 find_functions.
13624 * object.cc (Object::handle_split_stack_section): New function.
13625 (Sized_relobj::do_layout): Call handle_split_stack_section.
13626 * dynobj.cc (Sized_dynobj::do_layout): Call
13627 handle_split_stack_section.
13628 * reloc.cc (Sized_relobj::relocate_sections): Call
13629 split_stack_adjust for executable sections in split_stack
13630 objects. Pass reloc_map to relocate_section.
13631 (Sized_relobj::split_stack_adjust): New function.
13632 (Sized_relobj::split_stack_adjust_reltype): New function.
13633 (Sized_relobj::find_functions): New function.
13634 * target-reloc.h: Include "object.h".
13635 (relocate_section): Add reloc_symbol_changes parameter. Change
13636 all callers.
13637 * target.h (class Target): Add calls_non_split method. Declare
13638 do_calls_non_split virtual method. Declare match_view and
13639 set_view_to_nop.
13640 * target.cc: Include "elfcpp.h".
13641 (Target::do_calls_non_split): New function.
13642 (Target::match_view): New function.
13643 (Target::set_view_to_nop): New function.
13644 * gold.cc (queue_middle_tasks): Give an error if mixing
13645 split-stack and non-split-stack objects with -r.
13646 * i386.cc (Target_i386::relocate_section): Add
13647 reloc_symbol_changes parameter.
13648 (Target_i386::do_calls_non_split): New function.
13649 * x86_64.cc (Target_x86_64::relocate_section): Add
13650 reloc_symbol_changes parameter.
13651 (Target_x86_64::do_calls_non_split): New function.
13652 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
13653 parameter.
13654 * powerpc.cc (Target_powerpc::relocate_section): Add
13655 reloc_symbol_changes parameter.
13656 * sparc.cc (Target_sparc::relocate_section): Add
13657 reloc_symbol_changes parameter.
13658 * configure.ac: Call AM_CONDITIONAL for the default target.
13659 * configure: Rebuild.
13660 * testsuite/Makefile.am (TEST_AS): New variable.
13661 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
13662 (check_DATA): Add split_i386 and split_x86_64 files.
13663 (SPLIT_DEFSYMS): Define.
13664 (split_i386_[1234n].o): New targets.
13665 (split_i386_[124]): New targets.
13666 (split_i386_[1234r].stdout): New targets.
13667 (split_x86_64_[1234n].o): New targets.
13668 (split_x86_64_[124]): New targets.
13669 (split_x86_64_[1234r].stdout): New targets.
13670 (MOSTLYCLEANFILES): Add new executables.
13671 * testsuite/split_i386.sh: New file.
13672 * testsuite/split_x86_64.sh: New file.
13673 * testsuite/split_i386_1.s: New file.
13674 * testsuite/split_i386_2.s: New file.
13675 * testsuite/split_i386_3.s: New file.
13676 * testsuite/split_i386_4.s: New file.
13677 * testsuite/split_i386_n.s: New file.
13678 * testsuite/split_x86_64_1.s: New file.
13679 * testsuite/split_x86_64_2.s: New file.
13680 * testsuite/split_x86_64_3.s: New file.
13681 * testsuite/split_x86_64_4.s: New file.
13682 * testsuite/split_x86_64_n.s: New file.
13683 * testsuite/testfile.cc (Target_test): Update relocation_section
13684 function.
13685 * testsuite/Makefile.in: Rebuild.
13686
13687 2009-10-06 Ian Lance Taylor <iant@google.com>
13688
13689 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
13690 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
13691 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
13692 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
13693 the address on ldo_addrs_.
13694 (Target_i386::Relocate::fix_up_ldo): New function.
13695
13696 2009-10-06 Rafael Espindola <espindola@google.com>
13697
13698 * plugin.cc (add_input_library): New.
13699 (Plugin::load): Add add_input_library to tv.
13700 (Plugin_manager::add_input_file): Add the is_lib argument.
13701 (add_input_file): Update call to Plugin_manager::add_input_file.
13702 (add_input_library): New.
13703 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
13704
13705 2009-09-30 Doug Kwan <dougkwan@google.com>
13706
13707 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
13708 symbol and call Symbol::may_need_copy_reloc to determine if
13709 a copy reloc is needed.
13710 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
13711 nocopyreloc is given in command line.
13712 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
13713 given in command line.
13714 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
13715 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
13716 of the removed Target_i386::may_need_copy_reloc.
13717 * options.h (copyreloc): New option with default value false.
13718 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13719 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
13720 instead of the removed Target_powerpc::may_need_copy_reloc.
13721 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13722 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
13723 instead of the removed Target_sparc::may_need_copy_reloc.
13724 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
13725 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
13726 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
13727 instead of the removed Target_x86_64::may_need_copy_reloc.
13728
13729 2009-09-30 Ian Lance Taylor <iant@google.com>
13730
13731 * object.h (class Object): Remove target_ field, and target,
13732 sized_target, and set_target methods.
13733 (Object::sized_target): Remove.
13734 (class Sized_relobj): Update declarations. Remove sized_target.
13735 * object.cc (Sized_relobj::setup): Remove target parameter.
13736 Change all callers.
13737 (Input_objects::add_object): Don't do anything with the target.
13738 (make_elf_sized_object): Add punconfigured parameter. Change all
13739 callers. Set or test parameter target.
13740 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
13741 Change all callers.
13742 * parameters.cc (Parameters::set_target): Change parameter type to
13743 be non-const.
13744 (Parameters::default_target): Remove.
13745 (set_parameters_target): Change parameter type to be non-const.
13746 (parameters_force_valid_target): New function.
13747 (parameters_clear_target): New function.
13748 * parameters.h (class Parameters): Update declarations. Remove
13749 default_target method. Add sized_target and clear_target
13750 methods. Change target_ to be non-const.
13751 (set_parameters_target): Update declaration.
13752 (parameters_force_valid_target): Declare.
13753 (parameters_clear_target): Declare.
13754 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
13755 as NULL if we aren't searching.
13756 (Add_symbols::run): Don't check for compatible target.
13757 * fileread.cc (Input_file::open_binary): Call
13758 parameters_force_valid_target.
13759 * gold.cc (queue_middle_tasks): Likewise.
13760 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
13761 set_target on object.
13762 * dynobj.h (class Sized_dynobj): Update declarations.
13763 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
13764 make_elf_object returns NULL.
13765 (Archive::include_member): Don't check whether object target is
13766 compatible.
13767 * output.cc (Output_section::add_input_section): Get target from
13768 parameters.
13769 (Output_section::relax_input_section): Likewise.
13770 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
13771 parameters.
13772 (Sized_relobj::do_scan_relocs): Likewise.
13773 (Sized_relobj::relocate_sections): Likewise.
13774 * resolve.cc (Symbol_table::resolve): Likewise.
13775 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
13776 parameter. Change all callers.
13777 (Symbol_table::add_from_object): Get target from parameters.
13778 (Symbol_table::add_from_relobj): Don't check object target.
13779 (Symbol_table::add_from_dynobj): Likewise.
13780 (Symbol_table::define_special_symbol): Get target from
13781 parameters.
13782 * symtab.h (class Symbol_table): Update declaration.
13783 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
13784 parameter. Change all callers. Clear parameter target.
13785 (Binary_test): Test target here.
13786 * testsuite/object_unittest.cc (gold_testsuite): Remove
13787 target_test_pointer parameter. Change all callers.
13788 (Object_test): Test target here.
13789
13790 2009-09-26 Ian Lance Taylor <iant@google.com>
13791
13792 * testsuite/initpri1.c: Don't try to use constructor priorities if
13793 compiling with gcc before 4.3.
13794
13795 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
13796
13797 * testsuite/retain_symbols_file_test.sh (check_present): Change
13798 output file name to retain_symbols_file_test.stdout.
13799 (check_absent): Likewise.
13800
13801 2009-09-18 Craig Silverstein <csilvers@google.com>
13802
13803 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
13804 * options.cc: Include <cerrno> and <fstream>.
13805 (General_options::finalize): Parse -retain-symbols-file tag.
13806 * options.h: New flag.
13807 (General_options): New method should_retain_symbol, new
13808 variable symbols_to_retain.
13809 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
13810 should_retain_symbol map.
13811 * testsuite/Makefile.am (retain_symbols_file_test): New test.
13812 * testsuite/Makefile.in: Regenerate.
13813 * testsuite/retain_symbols_file_test.sh: New file.
13814
13815 2009-09-18 Nick Clifton <nickc@redhat.com>
13816
13817 * po/es.po: Updated Spanish translation.
13818
13819 2009-09-17 Doug Kwan <dougkwan@google.com>
13820
13821 * debug.h (DEBUG_RELAXATION): New constant.
13822 (DEBUG_ALL): Add DEBUG_RELAXATION.
13823 (debug_string_to_enum): Add relaxation debug option.
13824 * layout.cc
13825 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
13826 Layout::Relaxation_debug_check::read_sections,
13827 Layout::Relaxation_debug_check::read_sections): New method definitions.
13828 (Layout::Layout): Initialize data members
13829 record_output_section_data_from_scrips_,
13830 script_output_section_data_list_ and relaxation_debug_check_.
13831 (Layout::save_segments, Layout::restore_segments,
13832 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13833 Layout::relaxation_loop_body): New method definitions.
13834 (Layout::finalize): Support relaxation. Move section layout code to
13835 Layout::relaxation_loop_body.
13836 (Layout::set_asection_address_from_script): Move code for orphan
13837 section placement out.
13838 (Layout::place_orphan_sections_in_script): New method definition.
13839 * layout.h (Output_segment_headers, Output_file_header):
13840 New forward class declarations.
13841 (Layout::~Layout): Define.
13842 (Layout::new_output_section_data_from_script): New method definition.
13843 (Layout::place_orphan_sections_in_script): New method declaration.
13844 (Layout::Segment_states): New type declaration.
13845 (Layout::save_segments, Layout::restore_segments,
13846 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13847 Layout::relaxation_loop_body): New method declarations.
13848 (Layout::Output_section_data_list): New type declaration.
13849 (Layout::Relaxation_debug_check): New class definition.
13850 (Layout::record_output_section_data_from_script_,
13851 Layout::script_output_section_data_list_, Layout::segment_states_,
13852 Layout::relaxation_debug_check_): New data members.
13853 * output.cc: (Output_section_headers::do_size): New method definition.
13854 (Output_section_headers::Output_section_headers): Move size
13855 computation to Output_section_headers::do_size.
13856 (Output_segment_headers::do_size): New method definition.
13857 (Output_file_header::Output_file_header): Move size computation to
13858 Output_file_header::do_size and call it.
13859 (Output_file_header::do_size): New method definition.
13860 (Output_data_group::Output_data_group): Adjust call to
13861 Output_section_data.
13862 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
13863 (Output_symtab_xindex::do_write): Add array bound check.
13864 (Output_section::Input_section::print_to_mapfile): Handle
13865 RELAXED_INPUT_SECTION_CODE.
13866 (Output_section::Output_section): Initialize data member checkpoint_.
13867 (Output_section::~Output_section): Delete checkpoint object pointed
13868 by checkpoint_.
13869 (Output_section::add_input_section): Always add an Input_section if
13870 relaxing.
13871 (Output_section::add_merge_input_section): Add assert.
13872 (Output_section::relax_input_section): New method definition.
13873 (Output_section::set_final_data_size): Set load address to zero for
13874 an unallocated section.
13875 (Output_section::do_address_and_file_offset_have_reset_values):
13876 New method definition.
13877 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
13878 Handle relaxed input section.
13879 (Output_section::sort_attached_input_sections): Checkpoint input
13880 section list lazily.
13881 (Output_section::get_input_sections): Change type of input_sections to
13882 list of Simple_input_section pointers. Checkpoint input section list
13883 lazily. Also handle relaxed input sections.
13884 (Output_section::add_input_section_for_script): Take a reference to
13885 a Simple_input_section object instead of Relobj pointer and section
13886 index as parameter. Handle relaxed input sections.
13887 (Output_section::save_states, Output_section::restore_states): New
13888 method definitions.
13889 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
13890 (Output_data::is_data_size_fixed): New method definition.
13891 (Output_data::reset_addresss_and_file_offset): Do not reset data size
13892 if it is fixed.
13893 (Output_data::address_and_file_offset_have_reset_values): New method
13894 definition.
13895 (Output_data::do_address_and_file_offset_have_reset_values): New method
13896 definition.
13897 (Output_data::set_data_size): Check that data size is not fixed.
13898 (Output_data::fix_data_size): New method definition.
13899 (Output_data::is_data_size_fixed_): New data member.
13900 (Output_section_headers::set_final_data_size): New method definition.
13901 (Output_section_headers::do_size): New method declaration.
13902 (Output_segment_headers::set_final_data_size): New method definition.
13903 (Output_segment_headers::do_size): New method declaration.
13904 (Output_file_header::set_final_data_size)::New method definition.
13905 (Output_file_header::do_size)::New method declaration.
13906 (Output_section_data::Output_section_data): Add new parameter
13907 is_data_size_fixed and use it to fix data size.
13908 (Output_data_const::Output_data_const): Adjust call to base class
13909 constructor and fix data size.
13910 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
13911 base class constructor and fix data size.
13912 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
13913 base class constructor and fix data size.
13914 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
13915 class constructor and fix data size.
13916 (Output_data_group::set_final_data_size): New method definition.
13917 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
13918 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
13919 class constructor and fix data size.
13920 (Output_relaxed_input_section): New class definition.
13921 (Output_section::Simple_input_section): New class definition.
13922 (Output_section::get_input_sections): Adjust parameter list.
13923 (Output_section::add_input_section_for_script): Same.
13924 (Output_section::save_states, Output_section::restore_states,
13925 Output_section::do_address_and_file_offset_have_reset_values,
13926 (Output_section::Input_section::Input_section): Handle
13927 RELAXED_INPUT_SECTION_CODE. Add new overload for
13928 Output_relaxed_input_section.
13929 (Output_section::Input_section::is_input_section,
13930 Output_section::Input_section::set_output_section): Handle relaxed
13931 input section.
13932 (Output_section::Input_section::is_relaxed_input_section,
13933 Output_section::Input_section::output_section_data,
13934 Output_section::Input_section::relaxed_input_section): New method
13935 definitions.
13936 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
13937 value.
13938 (Output_section::Input_section::u1_): Update comments.
13939 (Output_section::Input_section::u2_): Add new union member poris.
13940 (Output_section::Checkpoint_output_section): New classs definition.
13941 (Output_section::relax_input_section): New method declaration.
13942 (Output_section::checkpoint_): New data member.
13943 (Output_segment): Update comments.
13944 (Output_segment::Output_segment): Un-privatize copy constructor.
13945 (Output_segment::operator=): Un-privatize.
13946 * script-sections.cc (Output_section_element::Input_section_list):
13947 Change element type to Output_section::Simple_input_section.
13948 (Output_section_element_dot_assignment::set_section_addresses):
13949 Register output section data for relaxation clean up.
13950 (Output_data_exression::Output_data_expression): Adjust call to base
13951 constructor to fix data size.
13952 (Output_section_element_data::set_section_addresses): Register
13953 Output_data_expression object for relaxation clean up.
13954 (struct Input_section_info): Replace Relobj pointer and section index
13955 pair with Output_section::Simple_input_section and Convert struct to a
13956 class.
13957 (Input_section_sorter::operator()): Adjust access to
13958 Input_section_info data member to use accessors.
13959 (Output_section_element_input::set_section_addresses): Use layout
13960 parameter. Adjust code to use Output_section::Simple_input_section
13961 and Input_secction_info classes. Register filler for relaxation
13962 clean up.
13963 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
13964 and section index pair with Output_section::Simple_input_section
13965 class. Adjust code accordingly.
13966 (Phdrs_element::release_segment): New method definition.
13967 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
13968 segment list.
13969 (Script_sections::release_segments): New method definition.
13970 * gold/script-sections.h (Script_sections::release_segments): New
13971 method declaration.
13972 * gold/target.h (Target::may_relax, Target::relax,
13973 Target::do_may_relax, Target::do_relax): New method definitions.
13974
13975 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
13976
13977 * arm.cc (has_signed_unsigned_overflow): New function.
13978 (Arm_relocate_functions::abs8): New function.
13979 (Target_arm::Scan::local): Handle R_ARM_ABS8.
13980 (Target_arm::Scan::global): Likewise.
13981 (Target_arm::relocate::relocate): Likewise.
13982 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
13983 Likewise.
13984
13985 2009-09-16 Cary Coutant <ccoutant@google.com>
13986
13987 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
13988 * testsuite/Makefile.in: Regenerate.
13989
13990 2009-09-11 Nick Clifton <nickc@redhat.com>
13991
13992 * po/gold.pot: Updated by the Translation project.
13993
13994 2009-09-08 Cary Coutant <ccoutant@google.com>
13995
13996 * output.cc (Output_file::open): Add execute permission to empty file.
13997 * testsuite/Makefile.am (permission_test): New test.
13998 * testsuite/Makefile.in: Regenerate.
13999
14000 2009-09-02 Ian Lance Taylor <iant@google.com>
14001
14002 * output.cc (Output_file::resize): Call map_no_anonymous rather
14003 than map.
14004
14005 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
14006
14007 * gold.cc: Include "incremental.h".
14008 (queue_initial_tasks): Call Incremental_checker methods.
14009 * incremental.cc: Include "output.h".
14010 (Incremental_checker::can_incrementally_link_output_file): New
14011 method.
14012 * incremental.h (Incremental_checker): New class.
14013
14014 * output.cc (Output_file::open_for_modification): New method.
14015 (Output_file::map_anonymous): Changed return type to bool. Record
14016 map in base_ field.
14017 (Output_file::map_no_anonymous): New method, broken out of map.
14018 (Output_file::map): Use map_no_anonymous and map_anonymous.
14019 * output.h (class Output_file): Update declarations.
14020
14021 2009-08-24 Cary Coutant <ccoutant@google.com>
14022
14023 * options.h (Command_line::Pre_options): New class.
14024 (Command_line::pre_options): New member.
14025 * options.cc (gold::options::ready_to_register): New variable.
14026 (One_option::register_option): Do nothing if not registering options.
14027 Assert if same short option registered twice.
14028 (General_options::General_options): Turn off option registration when
14029 done constructing.
14030 (Command_line::Pre_options::Pre_options): New constructor.
14031
14032 2009-08-24 Cary Coutant <ccoutant@google.com>
14033
14034 * options.h (General_options::no_keep_memory): Remove incorrect
14035 short option.
14036
14037 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
14038
14039 * Makefile.am (am__skiplex, am__skipyacc): New.
14040 * Makefile.in: Regenerate.
14041
14042 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
14043
14044 * Makefile.am (AM_CPPFLAGS): Renamed from ...
14045 (INCLUDES): ... this.
14046 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
14047 (AM_CPPFLAGS): Renamed from ...
14048 (INCLUDE): ... this.
14049 * Makefile.in, testsuite/Makefile.in: Regenerate.
14050
14051 * Makefile.in: Regenerate.
14052 * aclocal.m4: Likewise.
14053 * config.in: Likewise.
14054 * configure: Likewise.
14055 * testsuite/Makefile.in: Likewise.
14056
14057 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
14058 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
14059 * Makefile.in: Regenerate.
14060 * testsuite/Makefile.in: Regenerate.
14061
14062 2009-08-19 Cary Coutant <ccoutant@google.com>
14063
14064 * resolve.cc (Symbol_table::resolve): Don't complain about defined
14065 symbols in shared libraries overridden by hidden or internal symbols
14066 in the main program.
14067
14068 2009-08-19 Chris Demetriou <cgd@google.com>
14069
14070 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
14071 checking source file names in error messages.
14072
14073 2009-08-18 Doug Kwan <dougkwan@google.com>
14074
14075 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
14076 an elcpp::Ehdr as parameter. Adjust call to set_target.
14077 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
14078 an elfcpp::Ehdr as parameter.
14079 * object.cc (Object::set_target): Remove the version that looks up
14080 a target and sets it.
14081 (Sized_relobj::setup): Take a Target object instead of
14082 an elfcpp::Ehdr as parameter. Adjust call to set_target.
14083 (make_elf_sized_object): Find target and ask target to
14084 make an ELF object.
14085 * object.h: (Object::set_target): Remove the version that looks up
14086 a target and sets it.
14087 (Sized_relobj::setup): Take a Target object instead of
14088 an elfcpp:Ehdr as parameter.
14089 * target.cc: Include dynobj.h.
14090 (Target::do_make_elf_object_implementation): New.
14091 (Target::do_make_elf_object): New.
14092 * target.h (Target::make_elf_object): New template declaration.
14093 (Target::do_make_elf_object): New method declarations.
14094 (Target::do_make_elf_object_implementation): New template declaration.
14095
14096 2009-08-14 Ian Lance Taylor <iant@google.com>
14097
14098 * gold.h (FUNCTION_NAME): Define.
14099 (gold_unreachable): Use FUNCTION_NAME.
14100
14101 2009-08-12 Sriraman Tallam <tmsriram@google.com>
14102
14103 * icf.cc (Icf::find_identical_sections): Issue a warning when a
14104 symbol in the --keep-unique list is not found.
14105
14106 2009-08-12 Sriraman Tallam <tmsriram@google.com>
14107
14108 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
14109 been maked as --keep-unique.
14110 (Icf::unfold_section): New function.
14111 * icf.h (Icf::unfold_section): New function.
14112 * options.h (General_options::keep_unique): New option.
14113 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
14114 * testsuite/Makefile.in: Regenerate.
14115 * testsuite/icf_keep_unique_test.sh: New file.
14116 * testsuite/icf_keep_unique_test.cc: New file.
14117
14118 2009-08-12 Cary Coutant <ccoutant@google.com>
14119
14120 PR 10471
14121 * resolve.cc (Symbol_table::resolve): Check for references from
14122 dynamic objects to hidden and internal symbols.
14123 * testsuite/Makefile.am (hidden_test.sh): New test.
14124 * testsuite/Makefile.in: Regenerate.
14125 * testsuite/hidden_test.sh: New script.
14126 * testsuite/hidden_test_1.c: New test source.
14127 * testsuite/hidden_test_main.c: New test source.
14128
14129 2009-08-11 Doug Kwan <dougkwan@google.com>
14130
14131 * arm.cc: Update comments.
14132 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
14133 segment to locate the .ARM.exidx section if present.
14134
14135 2009-08-09 Doug Kwan <dougkwan@google.com>
14136
14137 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
14138 patch.
14139
14140 2009-08-07 Sriraman Tallam <tmsriram@google.com>
14141 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
14142 compiler warnings.
14143
14144 2009-08-06 Sriraman Tallam <tmsriram@google.com>
14145
14146 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
14147 valid tls_segment only for non-debug-section relocations.
14148 * testsuite/Makefile.am: Add gc_tls_test.
14149 * testsuite/Makefile.in: Regenerate.
14150 * testsuite/gc_tls_test.cc: New file.
14151 * testsuite/gc_tls_test.sh: New file.
14152
14153 2009-08-05 Sriraman Tallam <tmsriram@google.com>
14154
14155 * icf.cc: New file.
14156 * icf.h: New file.
14157 * Makefile.am (CCFILES): Add icf.cc.
14158 (HFILES): Add icf.h
14159 * Makefile.in: Regenerate.
14160 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
14161 * gc.h (gc_process_relocs): Populate lists used by icf to contain
14162 section, symbol and addend information for the relocs.
14163 * gold.cc (queue_middle_tasks): Call identical code folding.
14164 * gold.h: Add defines for multimap.
14165 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
14166 to the call of finalize_local_symbols.
14167 * main.cc (main): Create object of class Icf.
14168 * object.cc (Sized_relobj::do_layout): Allow this function to be
14169 called twice during icf.
14170 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
14171 to sections marked as identical by icf.
14172 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
14173 when available.
14174 (Sized_relobj::do_section_entsize): New function.
14175 * object.h (Object::section_entsize): New function.
14176 (Object::do_section_entsize): New pure virtual function.
14177 (Relobj::finalize_local_symbols): Add new parameter.
14178 (Relobj::do_section_entsize): New function.
14179 * options.h (General_options::icf): New option.
14180 (General_options::icf_iterations): New option.
14181 (General_options::print_icf_sections): New option.
14182 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
14183 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
14184 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
14185 icf.
14186 * symtab.cc (Symbol_table::is_section_folded): New function.
14187 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
14188 to sections marked as identical by icf.
14189 * symtab.h (Symbol_table::set_icf): New function.
14190 (Symbol_table::icf): New function.
14191 (Symbol_table::is_section_folded): New function.
14192 (Symbol_table::icf_): New data member.
14193 * target-reloc.h (relocate_section): Ignore sections folded by icf.
14194 * testsuite/Makefile.am: Add commands to build icf_test.
14195 * testsuite/Makefile.in: Regenerate.
14196 * testsuite/icf_test.sh: New file.
14197 * testsuite/icf_test.cc: New file.
14198
14199 2009-07-24 Chris Demetriou <cgd@google.com>
14200
14201 * layout.cc (is_compressible_debug_section): Fix incorrect
14202 comment about compressed section names.
14203
14204 2009-07-20 Ian Lance Taylor <ian@airs.com>
14205
14206 PR 10419
14207 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
14208
14209 2009-07-16 Ian Lance Taylor <iant@google.com>
14210
14211 PR 10400
14212 * layout.h: #include <map>.
14213 (class Kept_section): Change from struct to class. Add accessors
14214 and setters. Add section size to Comdat_group mapping. Change
14215 Comdat_group to std::map. Add is_comdat_ field. Add
14216 linkonce_size field in union.
14217 (class Layout): Update declaration of find_or_add_kept_section.
14218 Don't declare find_kept_object.
14219 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
14220 parameter. Add object, shndx, is_comdat, and is_group_name
14221 parameters. Change all callers. Adjust for new Kept_section.
14222 (Layout::find_kept_object): Remove.
14223 * object.cc (Sized_relobj::include_section_group): Update use of
14224 Kept_section. Rename secnum to shndx. Only record
14225 Kept_comdat_section if sections are the same size.
14226 (Sized_relobj::include_linkonce_section): Update use of
14227 Kept_section. Only record Kept_comdat_section if sections are the
14228 same size. Set size of linkonce section.
14229 (Sized_relobj::map_to_kept_section): Update call to
14230 get_kept_comdat_section.
14231 * object.h (class Sized_relobj): Rename fields in
14232 Kept_comdat_section to drop trailing underscores; change object
14233 field to Relobj*. Change Kept_comdat_section_table to store
14234 struct rather than pointer.
14235 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
14236 Add kept_object and kept_shndx parameters. Change all callers.
14237 (Sized_relobj::get_kept_comdat_section): Change return type to
14238 bool. Add kept_object and kept_shndx parameters. Change all
14239 callers.
14240 * plugin.cc (Pluginobj::include_comdat_group): Update call to
14241 Layout::find_or_add_kept_section.
14242
14243 2009-07-09 Ian Lance Taylor <iant@google.com>
14244
14245 * merge.cc (Object_merge_map::initialize_input_to_output_map):
14246 Reserve space in the hash table.
14247
14248 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
14249
14250 * fileread.cc (File_read::get_mtime): New method.
14251 * fileread.h (Timespec): New structure.
14252 (File_read::get_mtime): New method.
14253 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
14254 Renamed from timestamp_nsec.
14255 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
14256 Elf_Xword.
14257 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
14258 timestamp_nsec.
14259 (Incremental_inputs::report_archive): Save mtime; style fix.
14260 (Incremental_inputs::report_obejct): Save mtime; style fix.
14261 (Incremental_inputs::report_script): Save mtime; style fix.
14262 (Incremental_inputs::finalize_inputs): Style fix.
14263 (Incremental_inputs::finalize): Style fix.
14264 (Incremental_inputs::create_input_section_data): Store inputs
14265 mtime.
14266 * incremental.h (Incremental_inputs::report_script): Add mtime
14267 argument.
14268 (Incremental_inputs::Input_info::Input_info): Intialize only one
14269 union member.
14270 (Incremental_inputs::Input_info::archive): Move to nameless
14271 union.
14272 (Incremental_inputs::Input_info::obejct): Move to nameless union.
14273 (Incremental_inputs::Input_info::script): Move to nameless union.
14274 (Incremental_inputs::mtime): New field.
14275 * script.cc (read_input_script): Pass file mtime to
14276 Incremental_input.
14277 * script.h (Script_info::inputs): Style fix.
14278
14279 2009-07-01 Ian Lance Taylor <ian@airs.com>
14280
14281 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
14282 instead of 32.
14283
14284 2009-06-24 Ian Lance Taylor <iant@google.com>
14285
14286 PR 10156
14287 * layout.cc (Layout::choose_output_section): If we find an
14288 existing section, update the flags.
14289 (Layout::create_notes): New function, broken out of
14290 Layout::finalize.
14291 (Layout::finalize): Don't create note sections.
14292 (Layout::create_note): Don't crash if linker script discards
14293 section.
14294 (Layout::create_gold_note): Likewise.
14295 (Layout::create_build_id): Likewise. Don't set
14296 after_input_sections on the section.
14297 (Layout::create_executable_stack_info): Remove target parameter.
14298 Change caller.
14299 * layout.h (class Layout): Declare create_notes. Update
14300 declaration of create_executable_stack_info.
14301 * gold.cc (queue_middle_tasks): Call create_notes.
14302 * output.cc (Output_section::update_flags_for_input_section): Move
14303 here from output.h. If SHF_ALLOC flag is newly set, mark address
14304 invalid.
14305 * output.h (Output_data::mark_address_invalid): New function.
14306 (class Output_section): Only declare, not define,
14307 update_flags_for_input_section. Remove set_flags.
14308
14309 2009-06-24 Ian Lance Taylor <iant@google.com>
14310
14311 * script-sections.cc (Output_section_definition::
14312 set_section_addresses): Rename shadowing local load_address to
14313 laddr.
14314
14315 2009-06-24 Ian Lance Taylor <iant@google.com>
14316
14317 PR 10244
14318 * reloc.cc (relocate_sections): Skip empty relocation sections.
14319
14320 2009-06-23 Ian Lance Taylor <iant@google.com>
14321
14322 PR 10156
14323 * layout.cc (Layout::create_note): Use choose_output_section
14324 rather than make_output_section.
14325
14326 2009-06-23 Ian Lance Taylor <iant@google.com>
14327
14328 PR 10237
14329 * options.cc (General_options::parse_V): Set printed_version_.
14330 (General_options::General_options): Initialize printed_version_.
14331 * options.h (class General_options): Add printed_version_ field.
14332 * gold.cc (queue_initial_tasks): If there are no input files,
14333 don't give a fatal error if we printed the version information.
14334 (queue_middle_tasks): If using -r with a shared object, give a
14335 fatal error rather than an ordinary error.
14336
14337 2009-06-23 Ian Lance Taylor <iant@google.com>
14338
14339 PR 10219
14340 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
14341 (Layout::make_output_section): Set have_stabstr_section_ if we see
14342 a .stab*str section.
14343 (Layout::finalize): Call link_stabs_sections.
14344 (Layout::link_stabs_sections): New file.
14345 * layout.h (class Layout): Add have_stabstr_section_ field.
14346 Declare link_stabs_sections.
14347
14348 2009-06-23 Doug Kwan <dougkwan@google.com>
14349
14350 * Makefile.am (libgold_a_LIBADD): New.
14351 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
14352 * Makefile.in: Regenerate.
14353 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
14354 * configure: Regenerate.
14355 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
14356 * fileread.cc: Include sys/state.h
14357 * gold.h: Declare memmem and strndup if found missing.
14358 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
14359
14360 2009-06-23 Ian Lance Taylor <iant@google.com>
14361
14362 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
14363 * configure: Rebuild.
14364
14365 2009-06-23 Ian Lance Taylor <iant@google.com>
14366
14367 PR 10147
14368 * object.cc (Object::section_contents): Don't try to get a view if
14369 the section has length zero.
14370 (Object::handle_gnu_warning_section): If the section is empty, use
14371 the name of the section as the warning.
14372
14373 2009-06-23 Ian Lance Taylor <iant@google.com>
14374
14375 PR 10133
14376 * stringpool.h (class Stringpool_template): Add optimize_ field.
14377 (Stringpool_template::set_optimize): New function.
14378 * stringpool.cc (Stringpool_template::Stringpool_template):
14379 Initialize optimize_ field.
14380 (Stringpool_template::set_string_offsets): Test local optimize
14381 fild rather than parameter.
14382 * layout.cc (Layout::Layout): Call set_optimize on the section
14383 name stringpool.
14384
14385 2009-06-22 Ian Lance Taylor <iant@google.com>
14386
14387 PR 10030
14388 * yyscript.y: Parse TARGET.
14389 * script.cc (script_set_target): New function.
14390 * script-c.h (script_set_target): Declare.
14391 * options.cc (General_options::string_to_object_format): Rename
14392 from string_to_object_format in anonymous namespace. Change
14393 callers.
14394 * options.h (class General_options): Declare
14395 string_to_object_format.
14396
14397 2009-06-22 Ian Lance Taylor <iant@google.com>
14398
14399 * script-sections.cc (Script_sections::create_segments): Don't put
14400 program headers in a PT_LOAD segment if -n or -N.
14401
14402 2009-06-22 Ian Lance Taylor <iant@google.com>
14403
14404 PR 10141
14405 * options.h (class General_options): Add -z lazy and -z now. Sort
14406 -z options into alphabetical order.
14407 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
14408
14409 2009-06-21 Ian Lance Taylor <iant@google.com>
14410
14411 * layout.cc (Layout::make_output_section): Call
14412 Target::new_output_section.
14413 (Layout::attach_allocated_section_to_segment): Put large section
14414 sections in a separate load segment with the large segment flag
14415 set.
14416 (Layout::segment_precedes): Sort large data segments after other
14417 load segments.
14418 (align_file_offset): New static function.
14419 (Layout::set_segment_offsets): Use align_file_offset.
14420 * output.h (class Output_section): Add is_small_section_ and
14421 is_large_section_ fields.
14422 (Output_section::is_small_section): New function.
14423 (Output_section::set_is_small_section): New function.
14424 (Output_section::is_large_section): New function.
14425 (Output_section::set_is_large_section): New function.
14426 (Output_section::is_large_data_section): New function.
14427 (class Output_segment): Add is_large_data_segment_ field.
14428 (Output_segment::is_large_data_segment): New function.
14429 (Output_segment::set_is_large_data_segment): New function.
14430 * output.cc (Output_section::Output_section): Initialize new
14431 fields.
14432 (Output_segment::Output_segment): Likewise.
14433 (Output_segment::add_output_section): Add assertion that large
14434 data sections always go in large data segments. Force small data
14435 sections to the end of the list of data sections. Force small BSS
14436 sections to the start of the list of BSS sections. For large BSS
14437 sections to the end of the list of BSS sections.
14438 * symtab.h (class Symbol): Declare is_common_shndx.
14439 (Symbol::is_defined): Check Symbol::is_common_shndx.
14440 (Symbol::is_common): Likewise.
14441 (class Symbol_table): Define enum Commons_section_type. Update
14442 declarations. Add small_commons_ and large_commons_ fields.
14443 * symtab.cc (Symbol::is_common_shndx): New function.
14444 (Symbol_table::Symbol_table): Initialize new fields.
14445 (Symbol_table::add_from_object): Put small and large common
14446 symbols in the right list.
14447 (Symbol_table::sized_finalized_symbol): Check
14448 Symbol::is_common_shndx.
14449 (Symbol_table::sized_write_globals): Likewise.
14450 * common.cc (Symbol_table::do_allocate_commons): Allocate new
14451 common symbol lists. Don't call do_allocate_commons_list if the
14452 list is empty.
14453 (Symbol_table::do_allocate_commons_list): Remove is_tls
14454 parameter. Add comons_section_type parameter. Change all
14455 callers. Handle small and large common symbols.
14456 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
14457 Symbol::is_common_shndx.
14458 * resolve.cc (symbol_to_bits): Likewise.
14459 * target.h (Target::small_common_shndx): New function.
14460 (Target::small_common_section_flags): New function.
14461 (Target::large_common_shndx): New function.
14462 (Target::large_common_section_flags): New function.
14463 (Target::new_output_section): New function.
14464 (Target::Target_info): Add small_common_shndx, large_common_shndx,
14465 small_common_section_flags, and large_common_section_flags
14466 fields.
14467 (Target::do_new_output_section): New virtual function.
14468 * arm.cc (Target_arm::arm_info): Initialize new fields.
14469 * i386.cc (Target_i386::i386_info): Likewise.
14470 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
14471 Likewise.
14472 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
14473 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14474 (Target_x86_64::do_new_output_section): New function.
14475 * configure.ac: Define conditional MCMODEL_MEDIUM.
14476 * testsuite/Makefile.am (check_PROGRAMS): Add large.
14477 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
14478 (large_LDFLAGS): Define.
14479 * testsuite/large.c: New file.
14480 * testsuite/testfile.cc (Target_test::test_target_info):
14481 Initialize new fields.
14482 * configure, testsuite/Makefile.in: Rebuild.
14483
14484 2009-06-05 Doug Kwan <dougkwan@google.com>
14485
14486 * Makefile.am (CCFILES): Add target.cc.
14487 * Makefile.in: Regenerate.
14488 * i386.cc (class Target_i386): Define new virtual method to
14489 override do_is_local_label_name in parent.
14490 * object.cc (Sized_relobj::do_count_local_symbols): Discard
14491 local symbols if --discard-locals or -X is given.
14492 * options.h (class General_options): Declare new options
14493 '--discard-locals' and '-X' for discarding locals.
14494 * target.h (class Target): Define new methods is_local_label_name.
14495 Declare new virtual method do_is_local_label_name.
14496 * target.cc: New file.
14497 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
14498 (check_SCRIPTS): Add discard_locals_test.sh.
14499 (check_DATA): Add discard_local_tests.syms.
14500 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
14501 (discard_local_tests.syms, discard_locals_test.o): New make rules.
14502 * testsuite/Makefile.in: Regenerate.
14503 * testsuite/discard_locals_test.c: New file.
14504 * testsuite/discard_locals_test.sh: Same.
14505
14506 2009-06-05 Doug Kwan <dougkwan@google.com>
14507
14508 * object.cc (Sized_relobj::Sized_relobj): Initialize
14509 discarded_eh_frame_shndx_ to -1U.
14510 (Sized_relobj::do_layout): Record index of a discard .eh_frame
14511 section.
14512 (Sized_relobj::do_count_local_symbols): Skip local symbols in
14513 a discarded .eh_frame section.
14514 (Sized_relobj::do_finalize_local_symbols): Ditto.
14515 * object.h (class Sized_relobj): Declare new member
14516 discarded_eh_frame_shndx_.
14517 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
14518 (local_labels_test.o, local_labels_test): New rules.
14519 * testsuite/Makefile.in: Regenerate.
14520
14521 2009-06-04 Doug Kwan <dougkwan@google.com>
14522
14523 * layout.cc (Layout::section_name_mapping): Add mapping for
14524 special ARM sections.
14525
14526 2009-06-03 Doug Kwan <dougkwan@google.com>
14527
14528 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
14529 (utils::has_overflow): Same.
14530
14531 2009-06-03 Ian Lance Taylor <iant@google.com>
14532
14533 * layout.cc (Layout::section_name_mapping): New array, replacing
14534 Layout::linkonce_mapping.
14535 (Layout::section_name_mapping_count): New variable, replacing
14536 Layout::linkonce_mapping_count.
14537 (Layout::linkonce_output_name): Remove.
14538 (Layout::output_section_name): Rewrite.
14539 * layout.h (class Layout): Rename Linkonce_mapping to
14540 Section_name_mapping, linkonce_mapping to section_name_mapping,
14541 linkonce_mapping_count to section_name_mapping_count. Don't
14542 declare linkonce_output_name.
14543
14544 2009-06-03 Doug Kwan <dougkwan@google.com>
14545
14546 * gold/arm.cc (namespace utils): New.
14547 (Target_arm::reloc_is_non_pic): Define new method.
14548 (class Arm_relocate_functions): New.
14549 (Target_arm::Relocate::relocate): Handle relocation types used by
14550 Android.
14551
14552 2009-06-03 Ian Lance Taylor <iant@google.com>
14553
14554 * arm.cc (Target_arm::scan::global): Use || instead of |.
14555
14556 2009-06-02 Doug Kwan <dougkwan@google.com>
14557
14558 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
14559 issued_non_pic_error_.
14560 (class Target_arm::Scan): Declare new method check_non_pic.
14561 Define new method symbol_needs_plt_entry.
14562 Declare new data member issued_non_pic_error_.
14563 (class Target_arm::Relocate): Declare new method
14564 should_apply_static_reloc.
14565 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
14566 (Target_arm::Scan::check_non_pic): Define new method.
14567 (Target_arm::Scan::local): Handle a small subset of reloc types used
14568 by Android.
14569 (Target_arm::Scan::local): Same.
14570 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
14571
14572 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
14573
14574 * incremental.cc (Incremental_inputs::report_command_line): Filter
14575 out --incremental-* options.
14576
14577 2009-05-29 Doug Kwan <dougkwan@google.com>
14578
14579 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
14580 template class.
14581 (class Target_arm): Update comment.
14582 (Target_arm::Target_arm): Initialize new data members GOT_,
14583 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
14584 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
14585 and Target_arm::rel_dyn_section.
14586 Declare new_enum Target_arm::Got_type.
14587 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
14588 and DYNBSS_.
14589 Update commments for member do_dynsym_value.
14590 (Target_arm::got_size, Target_arm::plt_section,
14591 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
14592 new methods inside class defintion.
14593 (Target_arm::got_section): Define new method.
14594 (Target_arm::rel_dyn_section): Same.
14595 (Output_data_plt_arm): New template class.
14596 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
14597 (Output_data_plt_arm:do_adjust_output_section): Define new method.
14598 (Output_data_plt_arm::add_entry): Same.
14599 (Output_data_plt_arm::first_plt_entry): Define new
14600 static data member for PLT instruction template.
14601 (Output_data_plt_arm::plt_entry): Same.
14602 (Output_data_plt_arm::do_write): Define new method.
14603 (Target_arm::make_plt_entry): Same.
14604 (Target_arm::do_finalize_sections): Same.
14605 (Target_arm::do_dynsym_value): Same.
14606
14607 2009-05-28 Doug Kwan <dougkwan@google.com>
14608
14609 * Makefile.am (TARGETSOURCES): Add arm.cc.
14610 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
14611 * Makefile.in: Regenerate.
14612 * arm.cc: New file.
14613 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
14614
14615 2009-05-26 Doug Kwan <dougkwan@google.com>
14616
14617 * options.cc (General_options::parse_exclude_libs). Fix a comment.
14618 (General_options::check_excluded_libs): Strip off directories in
14619 archive name before matching like GNU ld does.
14620 * testsuite/Makefile.am (MOSTLYCLEANFILES,
14621 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
14622 (exclude_libs_test_LDFLAGS): Add linker option
14623 -Wl,--exclude-libs,libexclude_libs_test_3
14624 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
14625 an explicit archive without using -l.
14626 (alt/libexclude_libs_test_3.a): New make rule.
14627 * testsuite/Makefile.in: Regenerate.
14628 * testsuite/exclude_libs_test.c : Declare lib3_default().
14629 (main): Call it.
14630 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
14631 * exclude_libs_test_3.c: New file.
14632
14633 2009-05-26 Nick Clifton <nickc@redhat.com>
14634
14635 * po/id.po: New Indonesian translation.
14636 * po/gold.pot: Updated template file.
14637
14638 2009-05-22 Sriraman Tallam <tmsriram@google.com>
14639
14640 * testsuite/Makefile.am: Add -ffunction-sections to compile
14641 gc_comdat_test files. Add -Wl,--gc-sections to build
14642 gc_comdat_test.
14643 * testsuite/Makefile.in: Regenerate.
14644 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
14645
14646 2009-05-21 Sriraman Tallam <tmsriram@google.com>
14647
14648 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
14649 kept comdat section was garbage collected.
14650 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
14651 * testsuite/Makefile.in: Regenerate.
14652 * testsuite/gc_comdat_test.sh: New file.
14653 * testsuite/gc_comdat_test_1.cc: New file.
14654 * testsuite/gc_comdat_test_2.cc: New file.
14655
14656 2009-05-19 Doug Kwan <dougkwan@google.com>
14657
14658 * archive.cc (Archive::Archive): Move constructor from archive.h
14659 to here. Initialize no_export_.
14660 (Archive::get_elf_object_for_member): Set no_export flag of object.
14661 * archive.h (Archive::Archive): Move constructor body to
14662 archive.cc.
14663 (Archive::no_export): New method.
14664 (Archive::no_export_): New field.
14665 * object.h (Object::Object): Initialize no_export_ to false.
14666 (Object::no_export, Object::set_no_export): New methods.
14667 (Object::no_export_): New field.
14668 * options.cc (General_options::parse_exclude_libs): New method.
14669 (General_options::check_excluded_libs) Same.
14670 * options.h (exclude_libs): New option.
14671 (General_options::check_excluded_libs): New method declaration.
14672 (General_options::excluded_libs_): New field.
14673 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
14674 default or protected visibility if an object has no-export flag set.
14675 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
14676 (check_SCRIPTS): Add exclude_libs_test.sh.
14677 (check_DATA): Add exclude_libs_test.syms.
14678 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
14679 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
14680 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
14681 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
14682 (exclude_libs_test.syms, libexclude_libs_test_1.a,
14683 libexclude_libs_test_2.a): New rules.
14684 * testsuite/Makefile.in: Regenerate.
14685 * testsuite/exclude_libs_test.c: New file.
14686 * testsuite/exclude_libs_test.sh: Ditto.
14687 * testsuite/exclude_libs_test_1.c: Ditto.
14688 * testsuite/exclude_libs_test_2.c: Ditto.
14689
14690 2009-05-15 Ian Lance Taylor <iant@google.com>
14691
14692 * configure.ac: Check for declarations for cases where libiberty.h
14693 checks HAVE_DECL_xxx.
14694 * configure, config.in: Rebuild.
14695
14696 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
14697
14698 * gold.h (Incremental_argument_list): Remove (invalid) forward
14699 declaration.
14700 * incremental.cc (Incremental_inputs::report_achive): New method.
14701 (Incremental_inputs::report_object): New method.
14702 (Incremental_inputs::report_script): New method.
14703 (Incremental_inputs::finalize_inputs): New method.
14704 (Incremental_inputs::finalize): Call finalize_inputs().
14705 (Incremental_inputs::sized_create_incremental_inputs_section_data):
14706 Create inputs entries.
14707 * incremental.h (Incremental_input_type): New enum.
14708 (Incremental_inputs::Incremental_input): Initialize new fields.
14709 (Incremental_inputs::report_inputs): New method.
14710 (Incremental_inputs::report_achive): New method.
14711 (Incremental_inputs::report_object): New method.
14712 (Incremental_inputs::report_script): New method.
14713 (Incremental_inputs::finalize_inputs): New method.
14714 (Incremental_inputs::Input_info): New struct.
14715 (Incremental_inputs::Input_info_map): New typedef.
14716 (Incremental_inputs::lock_): New field.
14717 (Incremental_inputs::Inputs_): New field.
14718 (Incremental_inputs::Inputs_map): New field.
14719 * main.cc (main): Call Incremental_input::report_inputs.
14720 * options.h (Input_argument_list): Typedef moved from
14721 Input_arguments.
14722 (Input_file_group::Files): Remove, use ::Input_argument_list.
14723 (Input_file_group::Input_argument_list): Remove, use
14724 ::Input_argument_list.
14725 * plugin.cc (Plugin_manager::add_input_file): Add error in
14726 incremental build.
14727 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
14728 functions.
14729 * script.cc (read_input_script): Call
14730 Incremental_input::report_script.
14731 * script.h (Script_info): New class.
14732
14733 2009-04-27 Ian Lance Taylor <iant@google.com>
14734
14735 * x86_64.cc (do_adjust_output_section): Set entsize to
14736 plt_entry_size.
14737
14738 2009-04-23 Elliott Hughes <enh@google.com>
14739
14740 * output.cc (Output_file::close): After short writes, continue
14741 writing from the correct offset in the buffer being written.
14742
14743 2009-04-23 Chris Demetriou <cgd@google.com>
14744
14745 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
14746 * configure: Regenerate.
14747 * config.in: Regenerate.
14748 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
14749 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
14750
14751 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
14752
14753 * incremental.cc (Incremental_inputs_header_data): Renamed from
14754 Incremental_input_header_data.
14755 (Incremental_inputs_header_data::data_size): New field.
14756 (Incremental_inputs_header_data::put_input_file_count): Renamed
14757 from input_file_count.
14758 (Incremental_inputs_header_data::put_command_line_offset): Renamed
14759 from command_line_offset.
14760 (Incremental_inputs_header_data::put_reserved): Renamed from
14761 put_reserved.
14762 (Incremental_inputs_entry_data): Renamed from
14763 Incremental_input_entry_data.
14764 (Incremental_inputs_entry_data::data_size): New field.
14765 (Incremental_inputs::report_command_line): New method.
14766 (Incremental_inputs::finalize): New method.
14767 (Incremental_inputs::create_incremental_inputs_data): New method.
14768 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
14769 * incremental.h: New file.
14770 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
14771 (Layout::finalize): Create incremental inputs section in
14772 incremental builds.
14773 (Layout::create_incremental_info_sections): New method.
14774 * layout.h (Layout::incremental_inputs): New method.
14775 (Layout::create_incremental_info_sections): New method.
14776 (Layout::incremental_inputs_): New field.
14777 * main.cc (main): Notify Incremental_input of the command line.
14778
14779 2009-04-01 Ian Lance Taylor <iant@google.com>
14780 Mikolaj Zalewski <mikolajz@google.com>
14781
14782 * gold.h (reserve_unordered_map): Define, three versions, one for
14783 each version of Unordered_map.
14784 * layout.cc (Layout::Layout): Remove options parameter. Add
14785 number_of_input_files parameter. Don't initialize options_.
14786 Initialize number_of_input_files_ and resized_signatures_. Move
14787 sections_are_attached_.
14788 (Layout::layout_group): Reserve space for group_signatures_.
14789 (Layout::find_or_add_kept_section): Change name parameter to be a
14790 reference. Resize signatures_ map when it gets large enough.
14791 (Layout::layout_eh_frame): Use parameters->options() instead of
14792 this->options_.
14793 (Layout::make_output_section): Likewise.
14794 (Layout::attach_allocated_section_to_segment): Likewise.
14795 (Layout::finalize, Layout::create_executable_stack): Likewise.
14796 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
14797 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
14798 * layout.h (class Layout): Update declarations. Remove options_
14799 field. Add number_of_input_files_ and resized_signatures_
14800 fields. Move sections_are_attached_ field.
14801 * main.cc (main): Pass number of input files to Layout
14802 constructor. Don't pass options.
14803
14804 2009-03-30 Ian Lance Taylor <iant@google.com>
14805
14806 * ffsll.c (ffsll): Correct implementation.
14807
14808 2009-03-27 Ian Lance Taylor <iant@google.com>
14809
14810 * ffsll.c: New file.
14811 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
14812 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
14813 * ftruncate.c (ftruncate): Declare before definition.
14814 * mremap.c (mremap): Likewise.
14815 * pread.c (pread): Likewise.
14816 * configure, Makefile.in, config.in: Rebuild.
14817
14818 * mremap.c: New file.
14819 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
14820 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
14821 (mremap): Declare if HAVE_MREMAP is not defined.
14822 * configure, Makefile.in, config.in: Rebuild.
14823
14824 2009-03-27 Cary Coutant <ccoutant@google.com>
14825
14826 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
14827 position independent.
14828 * sparc.cc (Target_sparc::check_non_pic): Likewise.
14829 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
14830
14831 2009-03-24 Cary Coutant <ccoutant@google.com>
14832
14833 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
14834 an executable.
14835 (needs_dynamic_reloc): Likewise.
14836
14837 2009-03-24 Ian Lance Taylor <iant@google.com>
14838
14839 * yyscript.y (file_cmd): Recognize EXTERN.
14840 (extern_name_list, extern_name_list_body): New nonterminals.
14841 * script.cc (script_add_extern): Define.
14842 * script-c.h (script_add_extern): Declare.
14843
14844 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
14845
14846 * object.cc (is_elf_object): Define.
14847 * object.h (is_elf_object): Declare.
14848 * archive.cc (Archive::get_elf_object_for_member): Call
14849 is_elf_object.
14850 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
14851
14852 2009-03-24 Elliott Hughes <enh@google.com>
14853
14854 * output.cc (Output_file::map_anonymous): Define.
14855 (Output_file::map): Use map_anonymous. If the regular mmap fails,
14856 try an anonymous one. Report the size if the mmap fails.
14857 * output.h (class Output_file): Declare map_anonymous.
14858
14859 2009-03-24 Ian Lance Taylor <iant@google.com>
14860
14861 * target-select.cc (instantiate_target): Don't acquire the lock if
14862 the instantiated_target_ field has already been set.
14863
14864 2009-03-23 Ian Lance Taylor <iant@google.com>
14865
14866 * gold-threads.h (class Initialize_lock): Define.
14867 * gold-threads.cc (class Initialize_lock_once): Define.
14868 (initialize_lock_control): New static variable.
14869 (initialize_lock_pointer): New static variable.
14870 (initialize_lock_once): New static function.
14871 (Initialize_lock::Initialize_lock): Define.
14872 (Initialize_lock::initialize): Define.
14873 * target-select.h: Include "gold-threads.h".
14874 (class Target_selector): Add lock_ and initialize_lock_ fields.
14875 Don't define instantiate_target, just declare it.
14876 * target-select.cc (Target_selector::Target_selector): Initialize
14877 new fields.
14878 (Target_selector::instantiate_target): Define.
14879 * descriptors.h: Include "gold-threads.h".
14880 (class Descriptors): Add initialize_lock_ field.
14881 * descriptors.cc (Descriptors::Descriptors): Initialize new
14882 field.
14883 (Descriptors::open): Use initialize_lock_ field
14884 * errors.h (class Errors): Add initialize_lock_ field.
14885 * errors.cc (Errors::Errors): Initialize new field.
14886 (Errors::initialize_lock): Use initialize_lock_ field.
14887 * powerpc.cc (class Target_selector_powerpc): Remove
14888 instantiated_target_ field. In do_recognize call
14889 instantiate_target rather than do_instantiate_target. In
14890 do_instantiate_target just allocate a new target.
14891 * sparc.cc (class Target_selector_sparc): Likewise.
14892
14893 * freebsd.h: New file.
14894 * i386.cc: Include "freebsd.h".
14895 (Target_i386): Derive from Target_freebsd rather than
14896 Sized_target.
14897 (Target_selector_i386): Derive from Target_selector_freebsd rather
14898 than Target_selector.
14899 * x86_64.cc: Include "freebsd.h".
14900 (Target_x86_64): Derive from Target_freebsd rather than
14901 Sized_target.
14902 (Target_selector_x86_64): Derive from Target_selector_freebsd
14903 rather than Target_selector.
14904 * target.h (class Target): Add adjust_elf_header and
14905 do_adjust_elf_header.
14906 * output.cc (Output_file_header:: do_sized_write): Call target
14907 adjust_elf_header routine.
14908 * configure.tgt: Set targ_osabi.
14909 * configure.ac: Define GOLD_DEFAULT_OSABI.
14910 * parameters.cc (Parameters::default_target): Pass
14911 GOLD_DEFAULT_OSABI to select_target.
14912 * target-select.h (class Target_selector): Make instantiate_target
14913 protected rather than private.
14914 * Makefile.am (HFILES): Add freebsd.h.
14915 * configure, Makefile.in, config.in: Rebuild.
14916
14917 * merge.cc (do_add_input_section): Correct pend value. Change
14918 message about last entry not being null terminated from error to
14919 warning.
14920
14921 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
14922
14923 * incremental.cc: New file.
14924 * Makefile.am (CCFILES): Add incremental.cc.
14925 * Makefile.in: Rebuild.
14926
14927 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
14928
14929 * layout.cc (Layout::output_section_name): Preserve names
14930 of '.note.' sections.
14931
14932 2009-03-19 Ian Lance Taylor <iant@google.com>
14933
14934 * descriptors.cc (Descriptors::open): Check that the options are
14935 valid before using them.
14936
14937 2009-03-18 Ian Lance Taylor <iant@google.com>
14938
14939 * script-sections.h: Include <list>.
14940 (class Script_sections): Change Sections_elements from std::vector
14941 to std::list. Typedef public Elements_iterator. Add
14942 orphan_section_placement_, data_segment_align_start_, and
14943 saw_data_segment_align_ fields. Remove data_segment_align_index_
14944 field.
14945 * script-sections.cc (class Orphan_section_placement): New class.
14946 (class Sections_element): Add virtual functions is_relro and
14947 orphan_section_init. Remove virtual function place_orphan_here.
14948 (class Output_section_definition): Add is_relro and
14949 orphan_section_init. Remove place_orphan_here.
14950 (class Orphan_output_section): Likewise.
14951 (Script_sections::Script_sections): Update for field changes.
14952 (Script_sections::data_segment_align): Set saw_data_segment_align_
14953 and data_segment_align_start_, not data_segment_align_index.
14954 (Script_sections::data_segment_relro_end): Check
14955 saw_data_segment_align_. Use data_segment_align_start_ rather
14956 than data_segment_align_index_.
14957 (Script_sections::place_orphan): Rewrite to use
14958 Orphan_section_placement.
14959
14960 2009-03-17 Ian Lance Taylor <iant@google.com>
14961
14962 * archive.cc (Archive::add_symbols): Check for a version attached
14963 to the symbol name in the archive map.
14964 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
14965 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
14966 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
14967 (ver_test_11.a): New target.
14968 * testsuite/Makefile.in: Rebuild.
14969
14970 * configure.ac: Check for chsize and posix_fallocate. Replace
14971 ftruncate.
14972 * ftruncate.c: New file, from gnulib.
14973 * output.cc (posix_fallocate): Define dummy version if not
14974 HAVE_POSIX_FALLOCATE.
14975 (Output_file::map): Call posix_fallocate rather than lseek and
14976 write.
14977 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
14978 * configure, Makefile.in, config.in: Rebuild.
14979
14980 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
14981
14982 * layout.h (Layout::create_note): Add section_name parameter.
14983 * layout.cc (Layout::create_note): Likewise.
14984 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
14985
14986 2009-03-17 Ian Lance Taylor <iant@google.com>
14987
14988 * descriptors.cc: Include "options.h".
14989 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
14990 (Descriptors::open): Always use O_CLOEXEC when opening a new
14991 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
14992 then set FD_CLOEXEC.
14993
14994 * sparc.cc (class Target_sparc): Add has_got_section.
14995 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
14996 make sure we have a GOT section.
14997
14998 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
14999 (Target_sparc::Scan::local): Likewise.
15000 (Target_sparc::Scan::global): Likewise.
15001 (Target_sparc::Relocate::relocate): Likewise.
15002 (Target_sparc::Relocate::relocate_tls): Likewise.
15003
15004 * symtab.cc (Symbol_table::define_default_version): New function,
15005 broken out of add_from_object.
15006 (Symbol_table::add_from_object): Call define_default_version.
15007 (Symbol_table::define_special_symbol): Add resolve_oldsym
15008 parameter. Change all callers. If the version for a symbol comes
15009 from a version script, resolve it with the symbol with the same
15010 name with no version. Also add the symbol without a version if
15011 appropriate.
15012 (do_define_in_output_data): If resolving with oldsym, don't delete
15013 sym.
15014 (do_define_in_output_segment): Likewise.
15015 (do_define_as_constant): Likewise.
15016 * symtab.h (class Symbol_table): Update declarations.
15017
15018 2009-03-13 Ian Lance Taylor <iant@google.com>
15019
15020 * readsyms.cc (Read_symbols::incompatible_warning): New function.
15021 (Read_symbols::requeue): New function.
15022 (Read_symbols::do_read_symbols): If make_elf_object fails because
15023 the target type is not configured, and the file was searched for,
15024 issue a warning and retry with the next directory.
15025 (Add_symbols::run): If the file has an incompatible format, and
15026 it was searched for, requeue the Read_symbols task. On error,
15027 release the object.
15028 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
15029 dirindex parameter to constructor. Change all callers. Declare
15030 incompatible_warning and requeue.
15031 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
15032 input_argument_ and input_group_ fields. Add them to
15033 constructor. Change all callers.
15034 (class Read_script): Add dirindex_ field. Add it to constructor.
15035 Change all callers.
15036 * archive.cc (Archive::setup): Remove input_objects parameter.
15037 Change all callers.
15038 (Archive::get_file_and_offset): Likewise.
15039 (Archive::read_all_symbols): Likewise.
15040 (Archive::read_symbols): Likewise.
15041 (Archive::get_elf_object_for_member): Remove input_objects
15042 parameter. Add punconfigured parameter. Change all callers.
15043 (Archive::add_symbols): Change return type to bool. Check return
15044 value of include_member.
15045 (Archive::include_all_members): Likewise.
15046 (Archive::include_member): Change return type to bool. Return
15047 false if first included object has incompatible target. Set
15048 included_member_ field.
15049 (Add_archive_symbols::run): If add_symbols returns false, requeue
15050 Read_symbols task.
15051 * archive.h (class Archive): Add included_member_ field.
15052 Initialize it in constructor. Add input_file and searched_for
15053 methods. Update declarations.
15054 (class Add_archive_symbols): Add dirpath_, dirindex_, and
15055 input_argument_ fields. Add them to constructor. Change all
15056 callers.
15057 * script.cc: Include "target-select.h".
15058 (class Parser_closure): Add skip_on_incompatible_target_ and
15059 found_incompatible_target_ fields. Add
15060 skip_on_incompatible_target parameter to constructor. Change all
15061 callers. Add methods skip_on_incompatible_target,
15062 clear_skip_on_incompatible_target, found_incompatible_target, and
15063 set_found_incompatible_target.
15064 (read_input_script): Add dirindex parameter. Change all callers.
15065 If parser finds an incompatible target, requeue Read_symbols
15066 task.
15067 (script_set_symbol): Clear skip_on_incompatible_target in
15068 closure.
15069 (script_add_assertion, script_parse_option): Likewise.
15070 (script_start_sections, script_add_phdr): Likewise.
15071 (script_check_output_format): New function.
15072 * script.h (read_input_script): Update declaration.
15073 * script-c.h (script_check_output_format): Declare.
15074 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
15075 (ignore_cmd): Remove OUTPUT_FORMAT.
15076 * fileread.cc (Input_file::Input_file): Add explicit this.
15077 (Input_file::will_search_for): New function.
15078 (Input_file::open): Add pindex parameter. Change all callers.
15079 * fileread.h (class Input_file): Add input_file_argument method.
15080 Declare will_search_for. Update declarations.
15081 * object.cc (make_elf_object): Add punconfigured parameter.
15082 Change all callers.
15083 * object.h (class Object): Make input_file public. Add
15084 searched_for method.
15085 (make_elf_object): Update declaration.
15086 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
15087 restart search.
15088 * dirsearch.h (class Dirsearch): Update declaration.
15089 * options.h (class General_options): Add --warn-search-mismatch.
15090 * parameters.cc (Parameters::is_compatible_target): New function.
15091 * parameters.h (class Parameters): Declare is_compatible_target.
15092 * workqueue.cc (Workqueue::add_blocker): New function.
15093 * workqueue.h (class Workqueue): Declare add_blocker.
15094
15095 * fileread.cc (Input_file::open): Remove options parameter.
15096 Change all callers.
15097 (Input_file::open_binary): Likewise.
15098 * script.cc (read_input_script): Likewise.
15099 * readsyms.h (class Read_symbols): Remove options_ field. Remove
15100 options parameter from constructor. Change all callers.
15101 (class Read_script): Likewise.
15102 * fileread.h (class Input_file): Update declarations.
15103 * script.h (read_input_script): Update declaration.
15104
15105 2009-03-10 Nick Clifton <nickc@redhat.com>
15106
15107 * po/es.po: New Spanish translation.
15108
15109 2009-03-06 Cary Coutant <ccoutant@google.com>
15110
15111 * options.cc (parse_short_option): Keep dash_z from registering itself.
15112
15113 2009-03-03 Ian Lance Taylor <iant@google.com>
15114
15115 PR 9918
15116 * target-reloc.h (relocate_section): Pass output_section to
15117 relocate.
15118 * i386.cc (Target_i386::should_apply_static_reloc): Add
15119 output_section parameter. Change all callers.
15120 (Target_i386::Relocate::relocate): Add output_section parameter.
15121 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15122 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
15123 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
15124 * testsuite/two_file_shared.sh: New script.
15125 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
15126 (check_DATA): Add two_file_shared.dbg.
15127 (two_file_shared.dbg): New target.
15128 * testsuite/Makefile.in: Rebuild.
15129
15130 2009-03-01 Ian Lance Taylor <iant@google.com>
15131
15132 * configure.ac: Check for byteswap.h.
15133 * configure: Rebuild.
15134 * config.in: Rebuild.
15135
15136 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
15137
15138 * layout.cc (Layout::find_or_add_kept_section): New function.
15139 (Layout::add_comdat): Removed.
15140 * layout.h (struct Kept_section): Move out of class Layout.
15141 Remove trailing underscores from field names. Add group_sections
15142 field. Rename group_ field to is_group. Change all uses.
15143 (class Layout): Declare find_or_add_kept_section, not add_comdat.
15144 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
15145 comdat_groups_ field.
15146 (Sized_relobj::include_section_group): Use
15147 find_or_add_kept_section and Kept_section::group_sections.
15148 (Sized_relobj::include_linkonce_section): Likewise.
15149 * object.cc (class Sized_relobj): Don't define Comdat_group or
15150 Comdat_group_table. Remove find_comdat_group and
15151 add_comdat_group. Remove comdat_groups_ field.
15152 * plugin.cc (include_comdat_group): Use
15153 Layout::find_or_add_kept_section.
15154
15155 2009-02-28 Ian Lance Taylor <iant@google.com>
15156
15157 * README: --gc-sections and map files are now supported. Document
15158 some build requirements.
15159
15160 PR 6992
15161 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
15162 relocatable link set the value of the section symbol to zero.
15163 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
15164 relocatable link don't include the section address in the local
15165 symbol value.
15166
15167 2009-02-27 Ian Lance Taylor <iant@google.com>
15168
15169 PR 6811
15170 * options.h (class Search_directory): Add is_system_directory.
15171 (class General_options): Declare is_in_system_directory.
15172 * options.cc (get_relative_sysroot): Make static.
15173 (get_default_sysroot): Make static.
15174 (General_optoins::is_in_system_directory): New function.
15175 * fileread.cc (Input_file::is_in_system_directory): New function.
15176 * fileread.h (class Input_file): Declare is_in_system_directory.
15177 * object.h (class Object): Add is_in_system_directory.
15178 (class Input_objects): Remove system_library_directory_ field.
15179 * object.cc (Input_objects::add_object): Don't set
15180 system_library_directory_.
15181 (input_objects::found_in_system_library_directory): Remove.
15182 * symtab.cc (Symbol_table::write_globals): Remove input_objects
15183 parameter. Change all callers.
15184 (Symbol_table::sized_write_globals): Likewise.
15185 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
15186 Call Object::is_in_system_directory.
15187 * symtab.h (class Symbol_table): Update declarations.
15188
15189 PR 5990
15190 * descriptors.h (Open_descriptor): Add is_on_stack field.
15191 * descriptors.cc (Descriptors::open): If the descriptor is on the
15192 top of the stack, remove it. Initialize is_on_stack field.
15193 (Descriptors::release): Only add pod to stack if it is not on the
15194 stack already.
15195 (Descriptors::close_some_descriptor): Clear stack_next and
15196 is_on_stack fields.
15197
15198 PR 7091
15199 * output.cc (Output_section::find_starting_output_address): Rename
15200 from starting_output_address; add PADDR parameter; change return
15201 type.
15202 * output.h (class Output_section): Declare
15203 find_starting_output_address instead of starting_output_address.
15204 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
15205 section symbol for which we can't find a merge section.
15206
15207 PR 9836
15208 * symtab.cc (Symbol_table::add_from_object): If the visibility is
15209 hidden or internal, force the symbol to be local.
15210 * resolve.cc (Symbol::override_visibility): Define.
15211 (Symbol::override_base): Use override_visibility.
15212 (Symbol_table::resolve): Likewise.
15213 (Symbol::override_base_with_special): Likewise.
15214 (Symbol_table::override_with_special): If the visibility is hidden
15215 or internal, force the symbol to be local.
15216 * symtab.h (class Symbol): Add set_visibility and
15217 override_visibility.
15218 * testsuite/ver_test_1.sh: New file.
15219 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
15220 (check_DATA): Add ver_test_1.syms.
15221 (ver_test_1.syms): New target.
15222 * testsuite/Makefile.in: Rebuild.
15223
15224 2009-02-25 Cary Coutant <ccoutant@google.com>
15225
15226 * layout.cc (Layout::choose_output_section): Don't rename sections
15227 when using a linker script that has a SECTIONS clause.
15228 * Makefile.in: Regenerate.
15229
15230 * testsuite/Makefile.am (script_test_5.sh): New test case.
15231 * testsuite/Makefile.in: Regenerate.
15232 * testsuite/script_test_5.cc: New file.
15233 * testsuite/script_test_5.sh: New file.
15234 * testsuite/script_test_5.t: New file.
15235
15236 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
15237
15238 * archive.cc (Archive::include_member): Update calls to add_symbols.
15239 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
15240 the Layout argument.
15241 * dynobj.h (do_add_symbols): Add the Layout argument.
15242 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
15243 Layout argument.
15244 * object.h (Object::add_symbols): Add the Layout argument.
15245 (Object::do_add_symbols): Add the Layout argument.
15246 (Sized_relobj::do_add_symbols): Add the Layout argument.
15247 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
15248 Unify the two versions.
15249 (Add_plugin_symbols): Remove.
15250 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
15251 (Sized_pluginobj::do_add_symbols): Unify the two versions.
15252 (Add_plugin_symbols): Remove.
15253 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
15254 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
15255 (Add_symbols::run): Make it work with Pulginobj.
15256
15257 2009-02-06 Ian Lance Taylor <iant@google.com>
15258
15259 * object.cc (Sized_relobj::do_layout): Make info message start
15260 with lower case letter.
15261
15262 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
15263
15264 * binary.cc: Fix file comment.
15265
15266 * options.h (enum Incremental_disposition): Define.
15267 (class General_options): Add new options: --incremental,
15268 --incremental_changed, --incremental_unchanged,
15269 --incremental_unknown. Add incremental_disposition_ and
15270 implicit_incremental_ fields.
15271 (General_options::incremental_disposition): New function.
15272 (class Position_dependent_options): Add incremental_disposition
15273 option.
15274 (Position_dependent_options::copy_from_options): Set incremental
15275 dispositions.
15276 * options.cc (General_options::parse_incremental_changed): New
15277 function.
15278 (General_options::parse_incremental_unchanged): New function.
15279 (General_options::parse_incremental_unknown): New function.
15280 (General_options::General_options): Initialize new fields
15281 incremental_disposition_ and implicit_incremental_.
15282 (General_options::finalize): Check for uasge of --incremental-*
15283 without --incremental.
15284
15285 2009-02-06 Chris Demetriou <cgd@google.com>
15286
15287 * gold.h (gold_undefined_symbol): Change to take only a Symbol
15288 pointer and to report location as the file name associated with
15289 the symbol.
15290 (gold_undefined_symbol_at_location): New function to replace the
15291 old gold_undefined_symbol functionality.
15292 * target-reloc.h (relocate_section): Update to use
15293 gold_undefined_symbol_at_location.
15294 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15295 Call gold_undefined_symbol function rather than gold_error.
15296 * errors.h (Errors::undefined_symbol): Take location as a
15297 string, rather than calculating it from a relocation.
15298 * errors.cc (Errors::fatal): Print "fatal error:" before the
15299 formatted message.
15300 (Errors::error, Errors::error_at_location): Print "error: "
15301 before the formatted message.
15302 (Errors::undefined_symbol): Take location as a string, rather
15303 than calculating it from a relocation.
15304 (gold_undefined_symbol_at_location): New function akin to
15305 old gold_undefined_symbol, calculates location from relocation.
15306 (gold_undefined_symbol): Change to take only a Symbol pointer
15307 and to report location as the file name associated with the symbol.
15308 * testsuite/debug_msg.sh: Update for changed error messages.
15309 * testsuite/undef_symbol.sh: Likewise.
15310
15311 2009-02-04 Duncan Sands <baldrick@free.fr>
15312
15313 PR 9812
15314 * reduced_debug_output.h
15315 (Output_reduced_debug_abbrev_section::failed): Use format for
15316 gold_warning.
15317 (Output_reduced_debug_info_section::faild): Likewise.
15318
15319 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
15320
15321 * script.cc (Lazy_demangler): New class.
15322 (Version_script_info::get_symbol_version_helper): Demangle a
15323 symbol only once.
15324
15325 2009-01-29 Cary Coutant <ccoutant@google.com>
15326
15327 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
15328 to __tls_get_addr.
15329 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15330
15331 2009-01-28 Ian Lance Taylor <iant@google.com>
15332
15333 * version.cc (version_string): Bump to 1.9.
15334
15335 * gold.h: Include <cstring> and <stdint.h>.
15336 * version.cc: Include <cstdio>.
15337 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
15338 warning.
15339 * reduced_debug_output.cc (insert_into_vector): Rename from
15340 Insert_into_vector; change all callers. Use Swap_unaligned to
15341 avoid aliasing issue; remove union since it is unnecessary.
15342
15343 2009-01-27 Sriraman Tallam <tmsriram@google.com>
15344
15345 * Makefile.am (CCFILES): Add gc.cc.
15346 (HFILES): Add gc.h.
15347 * Makefile.in: Regenerate.
15348 * gold.cc (Gc_runner): New class.
15349 (queue_initial_tasks): Call garbage collection related tasks
15350 when corresponding options are invoked.
15351 (queue_middle_gc_tasks): New function.
15352 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
15353 processed early before laying out sections during garbage collection.
15354 * gold.h (queue_middle_gc_tasks): New function.
15355 (is_prefix_of): Move from "layout.cc".
15356 * i386.cc (Target_i386::gc_process_relocs): New function.
15357 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
15358 * main.cc (main): Create object of class "Garbage_collection".
15359 * object.cc (Relobj::copy_symbols_data): New function.
15360 (Relobj::is_section_name_included): New function.
15361 (Sized_relobj::do_layout): Allow this function to be called twice
15362 during garbage collection and defer layout of section during the
15363 first call.
15364 * object.h (Relobj::get_symbols_data): New function.
15365 (Relobj::is_section_name_included): New function.
15366 (Relobj::copy_symbols_data): New function.
15367 (Relobj::set_symbols_data): New function.
15368 (Relobj::get_relocs_data): New function.
15369 (Relobj::set_relocs_data): New function.
15370 (Relobj::is_output_section_offset_invalid): New pure virtual function.
15371 (Relobj::gc_process_relocs): New function.
15372 (Relobj::do_gc_process_relocs): New pure virtual function.
15373 (Relobj::sd_): New data member.
15374 (Sized_relobj::is_output_section_offset_invalid): New function.
15375 (Sized_relobj::do_gc_process_relocs): New function.
15376 * options.h (General_options::gc_sections): Modify to not be a no-op.
15377 (General_options::print_gc_sections): New option.
15378 * plugin.cc (Plugin_finish::run): Remove function call to
15379 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
15380 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
15381 * reloc.cc (Read_relocs::run): Add task to process relocs and
15382 determine unreferenced sections when doing garbage collection.
15383 (Gc_process_relocs): New class.
15384 (Sized_relobj::do_gc_process_relocs): New function.
15385 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
15386 sections that are garbage collected.
15387 * reloc.h (Gc_process_relocs): New class.
15388 * sparc.cc (Target_sparc::gc_process_relocs): New function.
15389 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
15390 symbols whose corresponding sections are garbage collected.
15391 (Symbol_table::Symbol_table): Add new parameter for the garbage
15392 collection object.
15393 (Symbol_table::gc_mark_undef_symbols): New function.
15394 (Symbol_table::gc_mark_symbol_for_shlib): New function.
15395 (Symbol_table::gc_mark_dyn_syms): New function.
15396 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
15397 as garbage.
15398 (Symbol_table::add_from_object): Likewise.
15399 (Symbol_table::add_from_relobj): When building shared objects, do not
15400 treat externally visible symbols as garbage.
15401 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
15402 table information for static and relocatable links.
15403 * symtab.h (Symbol_table::set_gc): New function.
15404 (Symbol_table::gc): New function.
15405 (Symbol_table::gc_mark_undef_symbols): New function.
15406 (Symbol_table::gc_mark_symbol_for_shlib): New function.
15407 (Symbol_table::gc_mark_dyn_syms): New function.
15408 (Symbol_table::gc_): New data member.
15409 * target.h (Sized_target::gc_process_relocs): New pure virtual
15410 function.
15411 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
15412 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
15413
15414 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
15415
15416 * options.h (General_options::gc_sections): Define as a no-op for now.
15417 (General_options::no_keep_memory): Ditto.
15418 (General_options::Bshareable): Define.
15419 * options.cc (General_options::finalize): Honor -Bshareable.
15420
15421 2009-01-20 Andreas Schwab <schwab@suse.de>
15422
15423 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
15424 read the value in the contents, since we don't use it. Use the
15425 template endianness when writing.
15426 (Relocate::relocate): Use it for R_PPC_REL16_HA.
15427
15428 2009-01-19 Andreas Schwab <schwab@suse.de>
15429
15430 * configure.tgt (powerpc64-*): Fix targ_obj.
15431
15432 2009-01-15 Ian Lance Taylor <iant@google.com>
15433
15434 * object.cc (Sized_relobj::write_local_symbols): Don't write out
15435 local symbols when stripping all symbols.
15436
15437 2009-01-14 Cary Coutant <ccoutant@google.com>
15438
15439 * output.cc (Output_reloc): Add explicit instantiations.
15440
15441 2009-01-14 Cary Coutant <ccoutant@google.com>
15442
15443 * archive.cc (Archive::get_elf_object_for_member): Remove call
15444 to File_read::claim_for_plugin.
15445 * descriptors.cc (Descriptors::open): Remove reference to
15446 is_claimed.
15447 (Descriptors::claim_for_plugin): Remove.
15448 * descriptors.h (Descriptors::claim_for_plugin): Remove.
15449 (Descriptors::is_claimed): Remove.
15450 (claim_descriptor_for_plugin): Remove.
15451 * fileread.cc (File_read::claim_for_plugin): Remove.
15452 * fileread.h (File_read::claim_for_plugin): Remove.
15453 (File_read::descriptor): Reopen descriptor if necessary.
15454 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
15455 (Plugin_manager::all_symbols_read): Add task parameter. Change
15456 all callers.
15457 (Plugin_manager::get_input_file): New function.
15458 (Plugin_manager::release_input_file): New function.
15459 (Pluginobj::Pluginobj): Add filesize parameter and initialize
15460 corresponding data member.
15461 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
15462 and pass to base constructor. Change all callers.
15463 (get_input_file, release_input_file): New functions.
15464 (make_sized_plugin_object): Add filesize parameter. Change all callers.
15465 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
15466 (Plugin_manager::all_symbols_read): Add task parameter.
15467 (Plugin_manager::get_input_file): New function.
15468 (Plugin_manager::release_input_file): New function.
15469 (Plugin_manager::task_): New data member.
15470 (Pluginobj::Pluginobj): Add filesize parameter.
15471 (Pluginobj::filename): New function.
15472 (Pluginobj::descriptor): New function.
15473 (Pluginobj::filesize): New function.
15474 (Pluginobj::filesize_): New data member.
15475 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
15476 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
15477 File_read::claim_for_plugin; use Object::unlock to unlock the file.
15478
15479 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
15480 with archive libraries.
15481 * testsuite/Makefile.in: Regenerate.
15482 * testsuite/plugin_test.c (struct sym_info): New type.
15483 (get_input_file, release_input_file): New static variables.
15484 (onload): Capture new transfer vector entries.
15485 (claim_file_hook): Stop reading at end of file according to filesize.
15486 Factor out parsing of readelf output into separate function.
15487 (all_symbols_read_hook): Exercise get_input_file and release_input_file
15488 APIs and get the source file name from the symbol table. Convert
15489 source file name to corresponding object file name. Print info
15490 message when adding new input files.
15491 (parse_readelf_line): New function.
15492 * testsuite/plugin_test_1.sh: Add checks for new info messages.
15493 * testsuite/plugin_test_2.sh: Likewise.
15494 * testsuite/plugin_test_3.sh: Likewise.
15495 * testsuite/plugin_test_4.sh: New test case.
15496
15497 2009-01-07 Ian Lance Taylor <iant@google.com>
15498
15499 * version.cc (version_string): Bump to 1.8.
15500
15501 2008-12-23 Cary Coutant <ccoutant@google.com>
15502
15503 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
15504 * plugin.cc (Plugin_manager::finish): Rename as
15505 layout_deferred_objects. Move cleanup to separate function.
15506 (Plugin_manager::cleanup): New function.
15507 (Plugin_finish::run): Call layout_deferred_objects and cleanup
15508 separately.
15509 * plugin.h (Plugin_manager::finish): Rename as
15510 layout_deferred_objects.
15511 (Plugin_manager::cleanup): New function.
15512 (Plugin_manager::cleanup_done): New field.
15513
15514 2008-12-23 Cary Coutant <ccoutant@google.com>
15515
15516 * plugin.cc (is_visible_from_outside): New function.
15517 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
15518 so we don't return "IR only" status for exported symbols or -r links.
15519
15520 * testsuite/Makefile.am (plugin_test_3): New test case.
15521 * testsuite/Makefile.in: Regenerate.
15522 * testsuite/plugin_test_3.sh: New file.
15523
15524 2008-12-22 Cary Coutant <ccoutant@google.com>
15525
15526 * object.cc (Sized_relobj::layout_section): New function.
15527 (Sized_relobj::do_layout): Defer layout of input sections until after
15528 plugin has provided replacement files.
15529 (Sized_relobj::do_layout_deferred_sections): New function.
15530 * object.h (Relobj::set_section_offset): Remove virtual keyword.
15531 (Relobj::layout_deferred_sections): New function.
15532 (Relobj::do_layout_deferred_sections): New function.
15533 (Sized_relobj::do_layout_deferred_sections): New function.
15534 (Sized_relobj::layout_section): New function.
15535 (Sized_relobj::Deferred_layout): New structure.
15536 (Sized_relobj::deferred_layout_): New field.
15537 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
15538 Change all callers. Layout deferred sections.
15539 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
15540 references.
15541 (Plugin_hook::run): Move code from do_plugin_hook inline.
15542 (Plugin_hook::do_plugin_hook): Remove.
15543 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
15544 (Plugin_manager::finish): Renamed, was cleanup.
15545 (Plugin_manager::should_defer_layout): New function.
15546 (Plugin_manager::add_deferred_layout_object): New function.
15547 (Plugin_manager::Deferred_layout_list): New type.
15548 (Plugin_manager::deferred_layout_objects_): New field.
15549 (Plugin_hook::do_plugin_hook): Remove.
15550
15551 2008-12-17 Ian Lance Taylor <iant@google.com>
15552
15553 * options.h (class General_options): Add --no case for
15554 --export-dynamic.
15555
15556 2008-12-16 Cary Coutant <ccoutant@google.com>
15557
15558 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
15559 vector.
15560 (Plugin_manager::claim_file): Create plugin object even if
15561 plugin did not call the add_symbols callback.
15562 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
15563 asking for more symbols than were added.
15564 * testsuite/Makefile.am (plugin_test_1): Add test case with
15565 no global symbols.
15566 (empty.syms): New target.
15567 * testsuite/Makefile.in: Regenerate.
15568 * testsuite/plugin_test.c (claim_file_hook): Add new debug
15569 message. Don't call add_symbols if no globals.
15570 (all_symbols_read_hook): Don't provide replacement for empty
15571 claimed file.
15572
15573 2008-12-12 Ian Lance Taylor <iant@google.com>
15574
15575 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
15576 r_type == 0 for a local symbol with r_sym == 0.
15577 (scan_relocatable_relocs): Pass r_sym to
15578 local_non_section_strategy.
15579 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
15580 r_sym parameter.
15581
15582 * configure.ac: Update test for TLS descriptors: they are
15583 supported as of glibc 2.9.
15584 * configure: Rebuild.
15585
15586 2008-12-11 Ian Lance Taylor <iant@google.com>
15587
15588 PR 7091
15589 * target-reloc.h (Default_scan_relocatable_relocs): For each
15590 function, map r_type == 0 to RELOC_DISCARD.
15591
15592 2008-12-10 Cary Coutant <ccoutant@google.com>
15593
15594 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
15595 object to override a kept COMDAT group from a plugin object.
15596
15597 2008-12-09 Ian Lance Taylor <iant@google.com>
15598
15599 PR 7088
15600 * yyscript.y (file_cmd): Handle INPUT.
15601
15602 * testsuite/initpri1.c: Change all declarations to be full
15603 prototypes by adding void, to avoid compiler warnings.
15604
15605 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
15606
15607 * options.cc (General_options::parse_plugin_opt): New.
15608 (General_options::add_plugin): The argument now is just the filename.
15609 (General_options::add_plugin_option): New.
15610 * options.h (plugin_opt): New.
15611 (add_plugin): Change argument name.
15612 (add_plugin_option): New.
15613 * plugin.cc (Plugin::load): Don't parse the plugin option.
15614 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
15615 (Plugin::add_option): New.
15616 (Plugin::args_): Change type.
15617 (Plugin::filename_): New.
15618 (Plugin_manager::add_plugin_option): New.
15619 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
15620 * testsuite/Makefile.in: Regenerate.
15621
15622 2008-12-05 Cary Coutant <ccoutant@google.com>
15623
15624 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
15625 Handle --strip-lto-sections option.
15626 * options.h (strip_lto_sections): New option.
15627
15628 2008-12-01 Cary Coutant <ccoutant@google.com>
15629
15630 * plugin.cc (ld_plugin_message): Change format parameter to const.
15631 Fix mismatch between new[] and delete.
15632
15633 2008-11-14 Cary Coutant <ccoutant@google.com>
15634
15635 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
15636 instead of -1U.
15637
15638 2008-11-05 Craig Silverstein <csilvers@google.com>
15639
15640 * options.cc (General_options::parse_dynamic_list): New function.
15641 * options.h (General_options): New flags dynamic_list,
15642 dynamic_list_data, dynamic_list_cpp_new, and
15643 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
15644 (General_options::in_dynamic_list): New function.
15645 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
15646 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
15647 (Lex::can_continue_name): Likewise.
15648 (yylex): Likewise.
15649 (read_script_file): New parameter script_options.
15650 (read_dynamic_list): New function.
15651 (Script_options::define_dynamic_list): New function.
15652 (dynamic_list_keyword_parsecodes): New variable.
15653 (dynamic_list_keywords): New variable.
15654 * script.h (Script_options::define_dynamic_list): New function
15655 prototype.
15656 (read_dynamic_list): New function prototype.
15657 * symtab.cc (strprefix): New macro.
15658 (Symbol::should_add_dynsym_entry): Support dynamic_list,
15659 dynamic_list_data, dynamic_list_cpp_new, and
15660 dynamic_list_cpp_typeinfo.
15661 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
15662 (dynamic_list_expr): New rule.
15663 (dynamic_list_nodes): Likewise.
15664 (dynamic_list_node): Likewise.
15665 * testsuite/Makefile.am (dynamic_list): New test.
15666 * testsuite/Makefile.in: Regenerated.
15667 * testsuite/dynamic_list.t: New file.
15668 * testsuite/dynamic_list.sh: New file.
15669
15670 2008-11-05 Craig Silverstein <csilvers@google.com>
15671
15672 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
15673 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
15674 (t11_last): Likewise.
15675 * testsuite/ver_test_6.c (main): Likewise.
15676
15677 2008-10-07 Cary Coutant <ccoutant@google.com>
15678
15679 * options.c (General_options::finalize): Add check for -static and
15680 -shared.
15681 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
15682 is not empty.
15683
15684 2008-10-02 Cary Coutant <ccoutant@google.com>
15685
15686 * plugin.cc (make_sized_plugin_object): Fix conditional
15687 compilation to work when not all targets are enabled.
15688
15689 2008-09-29 Cary Coutant <ccoutant@google.com>
15690
15691 * archive.cc (Archive::get_file_and_offset): Use filename instead
15692 of name to get library path.
15693 (Archive::include_member): Unlock external member of a thin archive.
15694
15695 * testsuite/Makefile.am (TEST_AR): New variable.
15696 (thin_archive_test_1): New test.
15697 (thin_archive_test_2): New test.
15698 * testsuite/Makefile.in: Regenerate.
15699 * testsuite/thin_archive_main.cc: New file.
15700 * testsuite/thin_archive_test_1.cc: New file.
15701 * testsuite/thin_archive_test_2.cc: New file.
15702 * testsuite/thin_archive_test_3.cc: New file.
15703 * testsuite/thin_archive_test_4.cc: New file.
15704
15705 2008-09-29 Cary Coutant <ccoutant@google.com>
15706
15707 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
15708 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
15709 instead of -1U.
15710 (Sized_relobj::do_finalize_local_symbols): Likewise.
15711 (Sized_relobj::map_to_kept_section): Likewise.
15712 * object.h (Sized_relobj::invalid_address): New constant.
15713 (Sized_relobj::do_output_section_offset): Check for invalid_address
15714 and return -1ULL.
15715 * output.cc (Output_reloc::local_section_offset): Use constant
15716 invalid_address instead of -1U.
15717 (Output_reloc::get_address): Likewise.
15718 (Output_section::output_address): Change -1U to -1ULL.
15719 * output.h (Output_reloc::invalid_address): New constant.
15720 * reloc.cc (Sized_relobj::write_sections): Use constant
15721 invalid_address instead of -1U.
15722 (Sized_relobj::relocate_sections): Likewise.
15723 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
15724 values for merge sections.
15725 * target-reloc.h (relocate_for_relocatable): Use constant
15726 invalid_address instead of -1U.
15727
15728 2008-09-19 Cary Coutant <ccoutant@google.com>
15729
15730 Add plugin functionality for link-time optimization (LTO).
15731 * configure.ac (plugins): Add --enable-plugins option.
15732 * configure: Regenerate.
15733 * config.in: Regenerate.
15734 * Makefile.am (LIBDL): New variable.
15735 (CCFILES): Add plugin.cc.
15736 (HFILES): Add plugin.h.
15737 (ldadd_var): Add LIBDL.
15738 * Makefile.in: Regenerate.
15739
15740 * archive.cc: Include "plugin.h".
15741 (Archive::setup): Don't preread archive symbols when using a plugin.
15742 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
15743 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
15744 files.
15745 (Archive::include_member): Add symbols from plugin objects.
15746 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
15747 * descriptors.cc (Descriptors::open): Check for file descriptors
15748 abandoned by plugins.
15749 (Descriptors::claim_for_plugin): New function.
15750 * descriptors.h (Descriptors::claim_for_plugin): New function.
15751 (Open_descriptor::is_claimed): New field.
15752 (claim_descriptor_for_plugin): New function.
15753 * fileread.cc (File_read::claim_for_plugin): New function.
15754 * fileread.h (File_read::claim_for_plugin): New function.
15755 (File_read::descriptor): New function.
15756 * gold.cc: Include "plugin.h".
15757 (queue_initial_tasks): Add task to call plugin hooks for generating
15758 new object files.
15759 * main.cc: Include "plugin.h".
15760 (main): Load plugin libraries.
15761 * object.h (Pluginobj): Declare.
15762 (Object::pluginobj): New function.
15763 (Object::do_pluginobj): New function.
15764 (Object::set_target): New function.
15765 * options.cc: Include "plugin.h".
15766 (General_options::parse_plugin): New function.
15767 (General_options::General_options): Initialize plugins_ field.
15768 (General_options::add_plugin): New function.
15769 * options.h (Plugin_manager): Declare.
15770 (General_options): Add --plugin option.
15771 (General_options::has_plugins): New function.
15772 (General_options::plugins): New function.
15773 (General_options::add_plugin): New function.
15774 (General_options::plugins_): New field.
15775 * plugin.cc: New file.
15776 * plugin.h: New file.
15777 * readsyms.cc: Include "plugin.h".
15778 (Read_symbols::do_read_symbols): Check for archive before checking
15779 for ELF file. Call plugin hooks to claim files.
15780 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
15781 from a real object file; force override when processing replacement
15782 files.
15783 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
15784 (Symbol::init_base_object): Likewise.
15785 (Symbol::init_base_output_data): Likewise.
15786 (Symbol::init_base_output_segment): Likewise.
15787 (Symbol::init_base_constant): Likewise.
15788 (Symbol::init_base_undefined): Likewise.
15789 (Symbol::output_section): Assert that object is not a plugin.
15790 (Symbol_table::add_from_pluginobj): New function.
15791 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
15792 undefined.
15793 (Symbol_table::sized_write_globals): Likewise.
15794 (Symbol_table::add_from_pluginobj): Instantiate template.
15795 * symtab.h (Sized_pluginobj): Declare.
15796 (Symbol::in_real_elf): New function.
15797 (Symbol::set_in_real_elf): New function.
15798 (Symbol::in_real_elf_): New field.
15799 (Symbol_table::add_from_pluginobj): New function.
15800
15801 * testsuite/Makefile.am (AM_CFLAGS): New variable.
15802 (LIBDL): New variable.
15803 (LDADD): Add LIBDL.
15804 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
15805 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
15806 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
15807 (MOSTLYCLEANFILES): Likewise.
15808 * testsuite/Makefile.in: Regenerate.
15809 * testsuite/plugin_test.c: New file.
15810 * testsuite/plugin_test_1.sh: New file.
15811 * testsuite/plugin_test_2.sh: New file.
15812
15813 2008-09-16 Ian Lance Taylor <iant@google.com>
15814
15815 * target-reloc.h (relocate_section): Check whether a symbol is
15816 defined by the ABI before reporting an undefined symbol error.
15817 * target.h (Target::is_defined_by_abi): Make parameter const.
15818 (Target::do_is_defined_by_abi): Likewise.
15819 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
15820 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
15821 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
15822 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
15823 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
15824 * testsuite/Makefile.in: Rebuild.
15825
15826 * fileread.cc (make_view): Add casts to avoid warning.
15827
15828 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
15829
15830 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
15831 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15832
15833 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
15834
15835 * options.h (General_options::output_is_executable): New.
15836 (General_options::output_is_pie): New.
15837 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
15838 for shared libraries.
15839 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15840
15841 2008-09-11 Chris Demetriou <cgd@google.com>
15842
15843 * options.h (origin): New -z option.
15844 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
15845 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
15846 in DT_FLAGS_1.
15847
15848 2008-09-05 Cary Coutant <ccoutant@google.com>
15849
15850 * fileread.cc (File_read::make_view): Add check for attempt to map
15851 beyond end of file.
15852
15853 2008-09-05 Cary Coutant <ccoutant@google.com>
15854
15855 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
15856 explicit instantiations.
15857
15858 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
15859
15860 PR gold/6858
15861 * options.cc (General_options::finalize): Allow undefined symbols
15862 in shlibs if linking -shared.
15863
15864 PR gold/6859
15865 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
15866 symbols as not needing a dynsym entry.
15867
15868 2008-08-20 Craig Silverstein <csilvers@google.com>
15869
15870 * fileread.cc (File_read::open): Do not lock the file unless it
15871 was successfully opened.
15872
15873 2008-08-14 Cary Coutant <ccoutant@google.com>
15874
15875 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
15876 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
15877 * testsuite/tls_test.cc (struct int128): 128-bit struct
15878 for testing TLS relocs with non-zero addend.
15879 (v12): New TLS variable.
15880 (t12): New test.
15881 (t_last): Add check for v12.
15882 * testsuite/tls_test.h (t12): New function.
15883 * testsuite/tls_test_main.cc (thread_routine): Call new test.
15884
15885 2008-08-13 Ian Lance Taylor <iant@google.com>
15886
15887 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
15888 set tls_segment_ or relro_segment_.
15889 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
15890 when appropriate.
15891 * output.h (Output_section::clear_is_relro): New function.
15892 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
15893 sections specially even when output_data_ is empty.
15894 (Output_segment::maximum_alignment): When first section is relro,
15895 only force alignment for PT_LOAD segments.
15896 * script.cc (script_data_segment_align): New function.
15897 (script_data_segment_relro_end): New function.
15898 * script-c.h (script_data_segment_align): Declare.
15899 (script_data_segment_relro_end): Declare.
15900 * script-sections.h (class Script_sections): Declare
15901 data_segment_align and data_segment_relro_end. Add fields
15902 segment_align_index_ and saw_relro_end_.
15903 * script-sections.cc (class Sections_element): Add set_is_relro
15904 virtual function. Add new bool* parameter to place_orphan_here.
15905 Add get_output_section virtual function.
15906 (class Output_section_definition): Add set_is_relro. Add new
15907 bool* parameter to place_orphan_here. Add get_output_section.
15908 Add is_relro_ field.
15909 (Output_section_definition::Output_section_definition): Initialize
15910 evaluated_address_, evaluated_load_address, evaluated_addralign_,
15911 and is_relro_ fields.
15912 (Output_section_definition::place_orphan_here): Add is_relro
15913 parameter.
15914 (Output_section_definition::set_section_addresses): Set relro for
15915 output section.
15916 (Output_section_definition::alternate_constraint): Likewise.
15917 (class Orphan_output_section): Add new bool* parameter to
15918 place_orphan_here. Add get_output_section.
15919 (Orphan_output_section::place_orphan_here): Add is_relro
15920 parameter.
15921 (Script_sections::Script_sections): Initialize
15922 data_segment_align_index_ and saw_relro_end_.
15923 (Script_sections::data_segment_align): New function.
15924 (Script_sections::data_segment_relro_end): New function.
15925 (Script_sections::place_orphan): Set or clear is_relro.
15926 (Script_sections::set_section_addresses): Force alignment of first
15927 TLS section.
15928 * yyscript.y (exp): Call script_data_segment_align and
15929 script_data_segment_relro_end.
15930 * testsuite/relro_script_test.t: New file.
15931 * testsuite/relro_test.cc (using_script): Declare.
15932 (t1, t2): Test using_script.
15933 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
15934 (relro_script_test_SOURCES): Define.
15935 (relro_script_test_DEPENDENCIES): Define.
15936 (relro_script_test_LDFLAGS): Define.
15937 (relro_script_test_LDADD): Define.
15938 (relro_script_test.so): New target.
15939 * testsuite/Makefile.in: Rebuild.
15940
15941 2008-08-06 Cary Coutant <ccoutant@google.com>
15942
15943 * archive.cc (Archive::total_archives, Archive::total_members)
15944 (Archive::total_members_loaded): New variables.
15945 (Archive::setup): Add parameter. Add option to preread
15946 archive symbols.
15947 (Archive::read_armap): Add counter.
15948 (Archive::get_file_and_offset): New function.
15949 (Archive::get_elf_object_for_member): New function.
15950 (Archive::read_all_symbols): New function.
15951 (Archive::read_symbols): New function.
15952 (Archive::add_symbols): Add counters.
15953 (Archive::include_all_members): Use armap to find members if it's
15954 already built.
15955 (Archive::include_member): Skip reading symbols if already read.
15956 Factored code into Archive::get_file_and_offset and
15957 Archive::get_elf_object_for_member. Changed call to
15958 Mapfile::report_include_archive_member.
15959 (Archive::print_stats): New function.
15960 * archive.h: Declare Object and Read_symbols_data classes.
15961 (Archive::Archive): Add initializers for new members.
15962 (Archive::setup): Add parameter.
15963 (Archive::print_stats): New function.
15964 (Archive::total_archives, Archive::total_members)
15965 (Archive::total_members_loaded): New variables.
15966 (Archive::get_file_and_offset): New function.
15967 (Archive::get_elf_object_for_member): New function.
15968 (Archive::read_all_symbols): New function.
15969 (Archive::read_symbols): New function.
15970 (Archive::Archive_member): New class.
15971 (Archive::members_): New member.
15972 (Archive::num_members_): New member.
15973 * main.cc: Include archive.h.
15974 (main): Call Archive::print_stats.
15975 * mapfile.cc (Mapfile::report_include_archive_member): Delete
15976 archive parameter; member_name is now the fully-decorated name.
15977 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
15978 * options.h: (General_options): Add --preread-archive-symbols option.
15979 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
15980 Archive::setup.
15981
15982 2008-08-04 Ian Lance Taylor <iant@google.com>
15983
15984 * symtab.h (Symbol::use_plt_offset): New function.
15985 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
15986 * powerpc.cc (Relocate::relocate): Likewise.
15987 * sparc.cc (Relocate::relocate): Likewise.
15988 * x86_64.cc (Relocate::relocate): Likewise.
15989 * testsuite/weak_plt.sh: New test.
15990 * testsuite/weak_plt_main.cc: New test.
15991 * testsuite/weak_plt_shared.cc: New test.
15992 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
15993 (check_PROGRAMS): Add weak_plt.
15994 (check_DATA): Add weak_plt_shared.so.
15995 (weak_plt_main_pic.o, weak_plt): New targets.
15996 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
15997 * testsuite/Makefile.in: Rebuild.
15998
15999 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
16000 gcctestdir/ld.
16001 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
16002 * testsuite/Makefile.in: Rebuild.
16003
16004 2008-08-04 Alan Modra <amodra@bigpond.net.au>
16005
16006 * Makefile.am (POTFILES.in): Set LC_ALL=C.
16007 * Makefile.in: Regenerate.
16008 * po/POTFILES.in: Regenerate.
16009
16010 2008-07-29 Ian Lance Taylor <iant@google.com>
16011
16012 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
16013 symbols before other symbols.
16014 * testsuite/script_test_2.cc (test_addr): Declare.
16015 (test_addr_alias): Declare.
16016 (main): Check that test_addr and test_addr_alias have the right
16017 values.
16018 * testsuite/script_test_2.t: Define test_addr_alias and
16019 test_addr.
16020
16021 2008-07-24 Ian Lance Taylor <iant@google.com>
16022
16023 PR 5990
16024 * descriptors.cc: New file.
16025 * descriptors.h: New file.
16026 * gold-threads.h (class Hold_optional_lock): New class.
16027 * fileread.cc: Include "descriptors.h".
16028 (File_read::~File_read): Release descriptor rather than closing
16029 it.
16030 (File_read::open) [file]: Call open_descriptor rather than open.
16031 Set is_descriptor_opened_.
16032 (File_read::open) [memory]: Assert that descriptor is not open.
16033 (File_read::reopen_descriptor): New function.
16034 (File_read::release): Release descriptor.
16035 (File_read::do_read): Make non-const. Reopen descriptor.
16036 (File_read::read): Make non-const.
16037 (File_read::make_view): Reopen descriptor.
16038 (File_read::do_readv): Likewise.
16039 * fileread.h (class File_read): Add is_descriptor_opened_ field.
16040 Update declarations.
16041 * layout.cc: Include "descriptors.h".
16042 (Layout::create_build_id): Use open_descriptor rather than open.
16043 * output.cc: Include "descriptors.h".
16044 (Output_file::open): Use open_descriptor rather than open.
16045 * archive.cc (Archive::const_iterator): Change Archive to be
16046 non-const.
16047 (Archive::begin, Archive::end): Make non-const.
16048 (Archive::count_members): Likewise.
16049 * archive.h (class Archive): Update declarations.
16050 * object.h (Object::read): Make non-const.
16051 * Makefile.am (CCFILES): Add descriptors.cc.
16052 (HFILES): Add descriptors.h.
16053 * Makefile.in: Rebuild.
16054
16055 PR 6716
16056 * gold.h: Always include <clocale>. Add Solaris workarounds
16057 following code in binutils/sysdep.h.
16058
16059 PR 6048
16060 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
16061 this->eh_frame_hdr_ is NULL before using it.
16062
16063 * dynobj.cc (Versions::Versions): Update comment.
16064
16065 * dynobj.cc (Versions::Versions): If there is an soname, use it as
16066 the base version name.
16067
16068 * stringpool.cc (Stringpool_template::add_with_length): Set key to
16069 array size plus one.
16070 (Stringpool_template::set_string_offsets): Subtract one from key
16071 before using it as an array index.
16072 (Stringpool_template::get_offset_with_length): Likewise.
16073 (Stringpool_template::write_to_buffer): Likewise.
16074 * stringpool.h (Stringpool_template::get_offset_from_key):
16075 Likewise.
16076
16077 2008-07-23 Ian Lance Taylor <iant@google.com>
16078
16079 PR 6658
16080 * object.h (Merged_symbol_value::value): Do our best to handle a
16081 negative addend.
16082
16083 PR 6647
16084 * script.cc (Version_script_info::get_versions): Don't add empty
16085 version tag to return value.
16086 (Version_script_info::get_symbol_version_helper): Change return
16087 type to bool. Add pversion parameter. Change all callers.
16088 (script_register_vers_node): Don't require a non-NULL tag.
16089 * script.h (class Version_script_info): Update declarations.
16090 (Version_script_info::get_symbol_version): Change return type to
16091 bool. Add version parameter. Change all callers.
16092 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
16093 handling. Handle an empty version from a version script.
16094 (Symbol_table::define_special_symbol): Likewise.
16095 * testsuite/ver_test_10.script: New file.
16096 * testsuite/ver_test_10.sh: New file.
16097 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
16098 (check_DATA): Add ver_test_10.syms.
16099 (ver_test_10.syms, ver_test_10.so): New target.
16100 * testsuite/Makefile.in: Rebuild.
16101
16102 2008-07-23 Simon Baldwin <simonb@google.com>
16103
16104 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
16105 to zero for undefined symbols from dynamic libraries.
16106
16107 2008-07-23 Ian Lance Taylor <iant@google.com>
16108
16109 * symtab.cc (Symbol_table::resolve): Remove version parameter.
16110 Change all callers.
16111 * symtab.h (class Symbol_table): Update declaration.
16112 * testsuite/ver_test_9.cc: New file.
16113 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
16114 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
16115 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
16116 (ver_test_9.so, ver_test_9.o): New targets.
16117 * testsuite/Makefile.in: Rebuild.
16118
16119 2008-07-22 Ian Lance Taylor <iant@google.com>
16120
16121 * options.h (class General_options): Define --check-sections.
16122 * layout.cc (Layout::set_segment_offsets): Handle
16123 --check-sections.
16124
16125 * options.h (class General_options): Define -n/--nmagic and
16126 -N/--omagic.
16127 * options.cc (General_options::finalize): For -n/--nmagic or
16128 -N/--omagic, set -static.
16129 * layout.cc (Layout::attach_allocated_section_to_segment): If
16130 -N/--omagic, don't put read-only and read-write sections in
16131 different segments.
16132 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
16133 finding a read-only segment.
16134 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
16135 don't set the minimum segment alignment to the common page size,
16136 and don't set the file offset to the address modulo the page size.
16137 * script-sections.cc (Script_sections::create_segments): If
16138 -n/--omagic, don't put read-only and read-write sections in
16139 different segments.
16140
16141 * cref.cc: New file.
16142 * cref.h: New file.
16143 * options.h (class General_options): Add --print-symbol-counts.
16144 * main.cc (main): Issue defined symbol report if requested.
16145 * archive.cc (Archive::interpret_header): Make into a const member
16146 function.
16147 (Archive::add_symbols): Call Input_objects::archive_start and
16148 archive_stop.
16149 (Archive::const_iterator): Define new class.
16150 (Archive::begin, Archive::end): New functions.
16151 (Archive::include_all_members): Rewrite to use iterator.
16152 (Archive::count_members): New function.
16153 * archive.h (class Archive): Update declarations.
16154 (Archive::filename): New function.
16155 * object.cc: Include "cref.h".
16156 (Sized_relobj::Sized_relobj): Initialize defined_count_.
16157 (Sized_relobj::do_get_global_symbol_counts): New function.
16158 (Input_objects::add_object): Add object to cross-referencer.
16159 (Input_objects::archive_start): New function.
16160 (Input_objects::archive_stop): New function.
16161 (Input_objects::print_symbol_counts): New function.
16162 * object.h: Declare Cref and Archive.
16163 (Object::get_global_symbol_counts): New function.
16164 (Object::do_get_global_symbol_counts): New pure virtual function.
16165 (class Sized_relobj): Add defined_count_ field. Update
16166 declarations.
16167 (class Input_objects): Add cref_ field. Update constructor.
16168 Update declarations.
16169 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
16170 defined_count_.
16171 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
16172 symbol counts.
16173 (Sized_dynobj::do_get_global_symbol_counts): New function.
16174 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
16175 defined_count_. Update declarations. Define Symbols typedef.
16176 * symtab.cc (Symbol_table::add_from_relobj): Add defined
16177 parameter. Change all callers.
16178 (Symbol_table::add_from_dynobj): Add sympointers and defined
16179 parameters. Change all callers.
16180 * symtab.h (class Symbol_table): Update declarations.
16181 * Makefile.am (CCFILES): Add cref.cc.
16182 (HFILES): Add cref.h.
16183 * Makefile.in: Rebuild.
16184
16185 2008-07-22 Simon Baldwin <simonb@google.com>
16186
16187 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
16188 to zero when writing undefined symbols.
16189
16190 2008-07-22 Ian Lance Taylor <iant@google.com>
16191
16192 * output.cc (Output_section::add_input_section): Don't try to
16193 merge empty merge sections.
16194
16195 2008-07-21 Craig Silverstein <csilvers@google.com>
16196
16197 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
16198 Include symbol version in error message.
16199
16200 2008-07-20 Chris Demetriou <cgd@google.com>
16201
16202 * configure.ac (gold_cv_c_random_seed): New configured variable.
16203 (RANDOM_SEED_CFLAGS): New substituted variable.
16204 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
16205 * configure: Rebuild.
16206 * Makefile.in: Likewise.
16207 * testsuite/Makefile.in: Likewise.
16208
16209 2008-07-18 Ian Lance Taylor <iant@google.com>
16210
16211 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
16212 where we see NAME/NULL and NAME/VERSION as separate symbols.
16213 * testsuite/ver_test_main.cc (main): Call t4.
16214 (t4, t4_2a): Define.
16215 * testsuite/ver_test_2.cc (t4_2): Define.
16216 * testsuite/ver_test_2.script: Put t4_2a in VER2.
16217 * testsuite/ver_test_4.cc (t4_2a): Define.
16218 * testsuite/ver_test_4.script: Put t4_2a in VER2.
16219 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
16220
16221 2008-07-17 Ian Lance Taylor <iant@google.com>
16222
16223 * dynobj.cc (Versions::add_def): If we give an error about a
16224 missing version, go ahead and create the version anyhow.
16225
16226 2008-07-10 Ian Lance Taylor <iant@google.com>
16227
16228 Handle output sections with more than 0x7fffffff bytes.
16229 * object.h (class Relobj): Change map_to_output_ to
16230 output_sections_, and just keep a section pointer. Change all
16231 uses. Move comdat group support to Sized_relobj.
16232 (Relobj::is_section_specially_mapped): Remove.
16233 (Relobj::output_section): Remove poff parameter. Change all
16234 callers.
16235 (Relobj::output_section_offset): New function.
16236 (Relobj::set_section_offset): Rewrite.
16237 (Relobj::map_to_output): Remove.
16238 (Relobj::output_sections): New function.
16239 (Relobj::do_output_section_offset): New pure virtual function.
16240 (Relobj::do_set_section_offset): Likewise.
16241 (class Sized_relobj): Add section_offsets_ field. Add comdat
16242 group support from Relobj. Update declarations.
16243 (Sized_relobj::get_output_section_offset): New function.
16244 (Sized_relobj::do_output_section_offset): New function.
16245 (Sized_relobj::do_set_section_offset): New function.
16246 * object.cc (Relobj::output_section_address): Remove.
16247 (Sized_relobj::Sized_relobj): Initialize new fields.
16248 (Sized_relobj::include_section_group): Cast find_kept_object to
16249 Sized_relobj.
16250 (Sized_relobj::include_linkonce_section): Likewise.
16251 (Sized_relobj::do_layout): Use separate arrays for output section
16252 and output offset.
16253 (Sized_relobj::do_count_local_symbols): Change map_to_output to
16254 output_sections.
16255 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
16256 output_sections and section_offsets.
16257 (Sized_relobj::write_local_symbols): Likewise.
16258 (map_to_kept_section): Compute output address directly.
16259 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
16260 output_sections and section_offsets.
16261 (Sized_relobj::write_sections): Likewise.
16262 (Sized_relobj::relocate_sections): Likewise.
16263 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
16264 * output.h (class Output_reloc): Update declarations. Change
16265 u2_.relobj to Sized_relobj*.
16266 (class Output_data_reloc): Change add functions to use
16267 Sized_relobj*.
16268 * output.cc (Output_reloc::Output_reloc): Change relobj to
16269 Sized_relobj*.
16270 (Output_reloc::local_section_offset): Change return type to
16271 Elf_Addr. Use get_output_section_offset.
16272 (Output_reloc::get_address): Likewise.
16273 (Output_section::is_input_address_mapped): Don't call
16274 is_section_specially_mapped.
16275 (Output_section::output_offset): Likewise.
16276 (Output_section::output_address): Likewise.
16277 (Output_section::starting_output_address): Likewise.
16278 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
16279 parameter to Sized_relobj*.
16280 (Copy_relocs::need_copy_reloc): Likewise.
16281 (Copy_relocs::save): Likewise.
16282 * copy-relocs.h (class Copy_relocs): Update declarations.
16283 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
16284 Sized_relobj*. Change relobj_ field to Sized_relobj*.
16285 * target-reloc.h (relocate_for_relocatable): Change
16286 offset_in_output_section type to Elf_Addr. Change code that uses
16287 it as well.
16288 * layout.cc (Layout::layout): Always set *off.
16289 * mapfile.cc (Mapfile::print_input_section): Use
16290 output_section_offset.
16291 * i386.cc (Target_i386::copy_reloc): Change object parameter to
16292 Sized_relobj*.
16293 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
16294 * sparc.cc (Target_sparc::copy_reloc): Likewise.
16295 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
16296
16297 2008-07-03 Ian Lance Taylor <iant@google.com>
16298
16299 * layout.cc (Layout::include_section): Do not discard unrecognized
16300 SHT_STRTAB sections.
16301
16302 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
16303
16304 * script.cc (Lex::can_continue_name): Make '?' allowable in
16305 version-script names.
16306 * testsuite/version_script.map: Change glob pattern to use '?'
16307
16308 2008-06-30 Manish Singh <yosh@gimp.org>
16309
16310 PR 6585
16311 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
16312 Correct typo.
16313
16314 2008-06-30 Ian Lance Taylor <iant@google.com>
16315
16316 PR 6660
16317 PR 6682
16318 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
16319 versions]: Don't try to read the value in the contents, since we
16320 don't use it. Use the template endianness when writing.
16321
16322 2008-06-25 Cary Coutant <ccoutant@google.com>
16323
16324 * fileread.cc (File_read::make_view): Assert on zero-length view.
16325 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
16326 symbol table when there are no symbols to read.
16327
16328 2008-06-23 Craig Silverstein <csilvers@google.com>
16329
16330 * version.cc (version_string): Bump to 1.7
16331
16332 2008-06-18 Craig Silverstein <csilvers@google.com>
16333
16334 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
16335 constant 0xFFFF to type Valtype.
16336 (Powerpc_relocate_functions::rel16_ha): Likewise.
16337
16338 2008-06-17 Ian Lance Taylor <iant@google.com>
16339
16340 * output.h (Output_section::Input_section): Initialize p2align_ to
16341 zero for Output_section_data constructors.
16342 (Output_section::Input_section::addralign): If not an input
16343 section, return the alignment of the Output_section_data.
16344 * testsuite/copy_test.cc: New file.
16345 * testsuite/copy_test_1.cc: New file.
16346 * testsuite/copy_test_2.cc: New file.
16347 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
16348 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
16349 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
16350 (copy_test_1_pic.o, copy_test_1.so): New targets.
16351 (copy_test_2_pic.o, copy_test_2.so): New targets.
16352 * testsuite/Makefile.in: Rebuild.
16353
16354 * script-sections.cc (Script_sections::place_orphan): Initialize
16355 local variable exact.
16356
16357 2008-06-13 David Edelsohn <edelsohn@gnu.org>
16358
16359 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
16360
16361 2008-06-12 David Edelsohn <edelsohn@gnu.org>
16362 David S. Miller <davem@davemloft.net>
16363
16364 * powerpc.cc: New file.
16365 * Makefile.am (TARGETSOURCES): Add powerpc.cc
16366 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
16367 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
16368 * Makefile.in: Rebuild.
16369
16370 2008-06-09 Ian Lance Taylor <iant@google.com>
16371
16372 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
16373 <exception>.
16374 (throwing, orig_terminate): New static variables.
16375 (terminate_handler): New static function.
16376 (t2): Set terminate handler.
16377
16378 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
16379
16380 PR 6584
16381 * binary.cc (Binary_to_elf::sized_convert): Fix .data
16382 alignment.
16383
16384 2008-05-30 Cary Coutant <ccoutant@google.com>
16385
16386 * archive.cc (Archive::include_all_members) Correct to step
16387 over symbol table and extended name table in thin archives.
16388
16389 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
16390
16391 PR 6407
16392 * target-reloc.h (relocate_for_relocatable): Fix new_offset
16393 calculation.
16394
16395 2008-05-28 Caleb Howe <cshowe@google.com>
16396
16397 * reduced_debug_output.cc: New file.
16398 * reduced_debug_output.h: New file.
16399 * options.h (class General_options): Add --strip-debug-non-line.
16400 * options.cc (General_options::finalize): Add strip_debug_non_line
16401 to the strip heirarchy.
16402 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
16403 fields.
16404 * layout.cc: Include "reduced_debug_output.h".
16405 (Layout::Layout): Initialize new fields.
16406 (line_only_debug_sections): New static array.
16407 (is_lines_only_debug_sections): New static inline function.
16408 (Layout::include_section): Handle --strip-debug-non-line.
16409 (Layout::make_output_section): If --strip-debug-non-line, build
16410 new output sections for .debug_abbrev and .debug_info.
16411 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
16412 gold. Warn about possible overflow.
16413 (read_signed_LEB_128): Likewise.
16414 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
16415 (read_signed_LEB_128): Declare.
16416 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
16417 (HFILES): Add reduced_debug_output.h.
16418 * Makefile.in: Rebuild.
16419
16420 2008-05-21 Ian Lance Taylor <iant@google.com>
16421
16422 * mapfile.cc: New file.
16423 * mapfile.h: New file.
16424 * options.h (class General_options): Add -M/--print-map and -Map.
16425 * options.cc (General_options::finalize): Make -M equivalent to
16426 -Map -.
16427 * main.cc: Include <cstdio> and "mapfile.h".
16428 (main): Open mapfile if requested.
16429 * gold.cc (class Middle_runner): Add mapfile_ field. Update
16430 constructor. Change caller.
16431 (queue_initial_tasks): Add mapfile parameter. Change caller.
16432 (queue_middle_tasks): Likewise.
16433 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
16434 declarations.
16435 * archive.cc: Include "mapfile.h".
16436 (Archive::add_symbols): Add mapfile parameter. Change all
16437 callers. Pass mapfile, symbol, and reason to include_member.
16438 (Archive::include_all_members): Add mapfile parameter. Change all
16439 callers.
16440 (Archive::include_member): Add mapfile, sym, and why parameters.
16441 Change all callers. Report inclusion to map file.
16442 * archive.h: Include "fileread.h".
16443 (class Archive): Update declarations.
16444 (Archive::file): New const method.
16445 (class Add_archive_symbols): Add mapfile_ field. Update
16446 constructor. Change all callers.
16447 * readsyms.h (class Read_symbols): Likewise.
16448 (class Finish_group): Likewise.
16449 (class Read_script): Likewise.
16450 * common.cc: Include "mapfile.h".
16451 (Symbol_table::allocate_commons): Add mapfile parameter. Change
16452 all callers.
16453 (Symbol_table::do_allocate_commons): Likewise.
16454 (Symbol_table::do_allocate_commons_list): Likewise. Report common
16455 symbol allocation to mapfile.
16456 * common.h (class Allocate_commons_task): Add mapfile_ field.
16457 Update constructor. Change all callers.
16458 * symtab.h (class Symbol_table): Update declarations.
16459 * layout.cc: Include "mapfile.h".
16460 (Layout_task_runner::run): Print information to mapfile.
16461 (Layout::create_gold_note): Change Output_data_fixed_space to
16462 Output_data_zero_fill.
16463 (Layout::create_build_id): Likewise.
16464 (Layout::print_to_mapfile): New function.
16465 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
16466 constructor. Change caller.
16467 (class Layout): Declare print_to_mapfile.
16468 * output.cc (Output_section::Input_section::print_to_mapfile): New
16469 function.
16470 (Output_section::add_input_section): If producing a map, always
16471 add to input_sections_ list.
16472 (Output_section::do_print_to_mapfile): New function.
16473 (Output_segment::print_sections_to_mapfile): New function.
16474 (Output_segment::print_section_list_to_mapfile): New function.
16475 * output.h: Include "mapfile.h".
16476 (Output_data::print_to_mapfile): New function.
16477 (Output_data::do_print_to_mapfile): New virtual function.
16478 (Output_segment_headers::do_print_to_mapfile): New function.
16479 (Output_file_header::do_print_to_mapfile): New function.
16480 (Output_data_const::do_print_to_mapfile): New function.
16481 (class Output_data_const_buffer): Add map_name_ field. Update
16482 constructor. Change all callers. Add do_print_to_mapfile
16483 function.
16484 (class Output_data_fixed_space): Likewise.
16485 (class Output_data_space): Likewise.
16486 (class Output_data_zero_fill): New class.
16487 (Output_data_strtab::do_print_to_mapfile): New function.
16488 (Output_data_reloc_base::do_print_to_mapfile): New function.
16489 (Output_relocatable_relocs::do_print_to_mapfile): New function.
16490 (Output_data_group::do_print_to_mapfile): New function.
16491 (Output_data_got::do_print_to_mapfile): New function.
16492 (Output_data_dynamic::do_print_to_mapfile): New function.
16493 (Output_symtab_xindex::do_print_to_mapfile): New function.
16494 (class Output_section): Declare do_print_to_mapflie. Declare
16495 print_to_mapfile in Input_section.
16496 (class Output_segment): Declare new functions.
16497 * object.h (Sized_relobj::symbol_count): New function.
16498 * script-sections.cc
16499 (Output_section_element_dot_assignment::set_section_addresses):
16500 Change Output_data_fixed_space to Output_data_zero_fill.
16501 (Output_data_expression::do_print_to_mapfile): New function.
16502 * script.cc (read_input_script): Add mapfile parameter. Change
16503 all callers.
16504 * script.h (read_input_script): Update declaration.
16505 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
16506 (Eh_frame::do_print_to_mapfile): New function.
16507 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
16508 (Output_merge_string::do_print_to_mapfile): New function.
16509 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
16510 function.
16511 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
16512 function.
16513 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
16514 function.
16515 * Makefile.am (CCFILES): Add mapfile.cc.
16516 (HFILES): Add mapfile.h.
16517 * Makefile.in: Rebuild.
16518
16519 2008-05-19 Ian Lance Taylor <iant@google.com>
16520
16521 * options.h (class General_options): Add -z relro.
16522 * layout.cc (Layout::Layout): Initialize relro_segment_.
16523 (Layout::add_output_section_data): Return the output section.
16524 (Layout::make_output_section): Rcognize relro sections and mark
16525 them appropriately.
16526 (Layout::attach_allocated_section_to_segment): Put relro sections
16527 in a PT_GNU_RELRO segment.
16528 (Layout::create_initial_dynamic_sections): Mark the .dynamic
16529 section as relro.
16530 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
16531 PT_TLS segments.
16532 (Layout::linkonce_mapping): Map d.rel.ro.local to
16533 .data.rel.ro.local.
16534 (Layout::output_section_name): Us .data.rel.ro.local for any
16535 section which begins with that.
16536 * layout.h (class Layout): Update add_output_section_data
16537 declaration. Add relro_segment_ field.
16538 * output.cc (Output_section::Output_section): Initialize is_relro_
16539 and is_relro_local_ fields.
16540 (Output_segment::add_output_section): Group relro sections.
16541 (Output_segment::is_first_section_relro): New function.
16542 (Output_segment::maximum_alignment): If there is a relro section,
16543 align the segment to the common page size.
16544 (Output_segment::set_section_addresses): Track whether we are
16545 looking at relro sections. If the last section is a relro
16546 section, align to the common page size.
16547 (Output_segment::set_section_list_addresses): Add in_relro
16548 parameter. Change all callers. Align to the page size when
16549 moving from relro to non-relro section.
16550 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
16551 segment.
16552 * output.h (class Output_section): Add is_relro_ and
16553 is_relro_local_ fields.
16554 (Output_section::is_relro): New function.
16555 (Output_section::set_is_relro): New function.
16556 (Output_section::is_relro_local): New function.
16557 (Output_section::set_is_relro_local): New function.
16558 (class Output_segment): Update declarations.
16559 * i386.cc (Target_i386::got_section): Mark .got section as relro.
16560 * sparc.cc (Target_sparc::got_section): Likewise.
16561 * x86_64.cc (Target_x86_64::got_section): Likewise.
16562 * testsuite/relro_test_main.cc: New file.
16563 * testsuite/relro_test.cc: New file.
16564 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
16565 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
16566 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
16567 (relro_test.so, relro_test_pic.o): New targets.
16568 * testsuite/Makefile.in: Rebuild.
16569
16570 2008-05-16 Ian Lance Taylor <iant@google.com>
16571
16572 * output.cc (Output_segment::add_output_section): Remove front
16573 parameter.
16574 * output.h (class Output_segment): Remove
16575 add_initial_output_section and overloaded add_output_section.
16576 Update declaration of remaining add_output_section.
16577 * layout.cc (Layout::create_interp): Call add_output_section
16578 rather than add_initial_output_section.
16579 (Layout::finish_dynamic_section): Likewise.
16580
16581 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
16582 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
16583 know the dynamic type.
16584 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
16585 field. Initialize it in constructor.
16586 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
16587 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
16588 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
16589 reloc.
16590
16591 * output.cc (Output_reloc::get_address): Change return type to
16592 Elf_Addr.
16593 * output.h (class Output_reloc): Update get_address declaration.
16594 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
16595 for section addresses.
16596
16597 2008-05-09 Ian Lance Taylor <iant@google.com>
16598
16599 PR 6493
16600 * gold.cc (gold_nomem): Use return value of write.
16601
16602 2008-05-08 Ian Lance Taylor <iant@google.com>
16603
16604 * symtab.c (Symbol::init_base_output_data): Add version
16605 parameter. Change all callers.
16606 (Symbol::init_base_output_segment): Likewise.
16607 (Symbol::init_base_constant): Likewise.
16608 (Symbol::init_base_undefined): Likewise.
16609 (Sized_symbol::init_output_data): Likewise.
16610 (Sized_symbol::init_output_segment): Likewise.
16611 (Sized_symbol::init_constant): Likewise.
16612 (Sized_symbol::init_undefined): Likewise.
16613 (Symbol_table::do_define_in_output_data): If the new symbol has a
16614 version, mark it as the default.
16615 (Symbol_table::do_define_in_output_segment): Likewise.
16616 (Symbol_table::do_define_as_constant): Likewise.
16617 * symtab.h (class Symbol): Update declarations.
16618 (class Sized_symbol): Likewise.
16619 * resolve.cc (Symbol::override_version): New function.
16620 (Symbol::override_base): Call override_version.
16621 (Symbol::override_base_with_special): Likewise.
16622 * testsuite/ver_script_8.script: New file.
16623 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
16624 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
16625 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
16626 (ver_test_8_1.so, ver_test_8_2.so): New targets.
16627
16628 2008-05-06 Ian Lance Taylor <iant@google.com>
16629
16630 PR 6049
16631 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
16632 functions.
16633 (class General_options): Remove existing --undefined, and add
16634 --no-undefined instead. Add new --undefined as synonym for -u.
16635 * archive.cc (Archive::add_symbols): Check whether symbol was
16636 named with -u.
16637 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
16638 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
16639 all uses. Add IS_UNDEFINED. Update declarations to split
16640 different versions of init_base. Declare init_base_undefined.
16641 (Symbol::is_defined): Handle IS_UNDEFINED.
16642 (Symbol::is_undefined): Likewise.
16643 (Symbol::is_weak_undefined): Call is_undefined.
16644 (Symbol::is_absolute): Handle IS_CONSTANT.
16645 (class Sized_symbol): Update declarations to split different
16646 versions of init. Declare init_undefined.
16647 (class Symbol_table): Declare new functions.
16648 * symtab.cc (Symbol::init_base_object): Rename from init_base.
16649 Change all callers.
16650 (Symbol::init_base_output_data): Likewise.
16651 (Symbol::init_base_output_segment): Likewise.
16652 (Symbol::init_base_constant): Likewise.
16653 (Symbol::init_base_undefined): New function.
16654 (Sized_symbol::init_object): Rename from init. Change all
16655 callers.
16656 (Sized_symbol::init_output_data): Likewise.
16657 (Sized_symbol::init_output_segment): Likewise.
16658 (Sized_symbol::init_constant): Likewise.
16659 (Sized_symbol::init_undefined): New function.
16660 (Symbol_table::add_undefined_symbols_from_command_line): New
16661 function.
16662 (Symbol_table::do_add_undefined_symbols_from_command_line): New
16663 function.
16664 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
16665 (Symbol::output_section): Likewise.
16666 (Symbol::set_output_section): Likewise.
16667 (Symbol_table::sized_finalize_symbol): Likewise.
16668 (Symbol_table::sized_write_globals): Likewise.
16669 * resolve.cc (Symbol_table::should_override): Likewise.
16670 (Symbol::override_base_with_special): Likewise.
16671
16672 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
16673 symbol, change it to have default visibility.
16674 * testsuite/protected_1.cc: New file.
16675 * testsuite/protected_2.cc: New file.
16676 * testsuite/protected_3.cc: New file.
16677 * testsuite/protected_main_1.cc: New file.
16678 * testsuite/protected_main_2.cc: New file.
16679 * testsuite/protected_main_3.cc: New file.
16680 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
16681 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
16682 (protected_1_LDFLAGS, protected_1_LDADD): Define.
16683 (protected_1.so): New target.
16684 (protected_1_pic.o, protected_2_pic.o): New targets.
16685 (protected_3_pic.o): New target.
16686 (check_PROGRAMS): Add protected_2.
16687 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
16688 (protected_2_LDFLAGS, protected_2_LDADD): Define.
16689 * testsuite/Makefile.in: Rebuild.
16690
16691 * options.h (DEFINE_var): Add set_user_set_##varname__.
16692 (DEFINE_bool_alias): New macro.
16693 (class General_options): Define -Bstatic using DEFINE_bool_alias
16694 rather than DEFINE_special. Add --undefined as an alias for -z
16695 defs.
16696 * options.cc (General_options::parse_Bstatic): Remove.
16697
16698 * options.h (class General_options): Add --fatal-warnings.
16699 * main.cc (main): Implement --fatal-warnings.
16700 * errors.h (Errors::warning_count): New function.
16701
16702 * options.h (class General_options): Add -Bsymbolic-functions.
16703 * symtab.h (Symbol::is_preemptible): Check for
16704 -Bsymbolic-functions.
16705
16706 2008-05-05 Ian Lance Taylor <iant@google.com>
16707
16708 * options.h (DEFINE_bool): For DASH_Z, create the negative option
16709 as noVARNAME rather than no-VARNAME.
16710 (class General_options): Add option -z combreloc.
16711 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
16712 get_address.
16713 (Output_reloc::sort_before) [SHT_REL]: New function.
16714 (Output_reloc::sort_before) [SHT_RELA]: New function.
16715 (class Output_data_reloc_base): Add sort_relocs_ field. Define
16716 Sort_relocs_comparison.
16717 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
16718 parameter. Change all callers.
16719 (Output_data_reloc::Output_data_reloc) [both versions]: Add
16720 sort_relocs parameter. Change all callers.
16721 * output.cc (Output_reloc::get_address): New function, broken out
16722 of write_rel.
16723 (Output_reloc::write_rel): Call it.
16724 (Output_reloc::compare): New function.
16725 (Output_data_reloc_base::do_write): Optionally sort relocs.
16726
16727 * configure.ac: If targ_extra_obj is set, link it in.
16728 * configure.tgt: Initialize all variables.
16729 (x86_64*): Set targ_extra_obj and targ_extra_size.
16730 * configure: Rebuild.
16731
16732 * object.cc (Sized_relobj::include_section_group): Adjust section
16733 indexes read from group data. Build vector to pass to
16734 layout_group.
16735 * layout.cc (Layout::layout_group): Add flags and shndxes
16736 parameters. Remove contents parameter. Change caller. Update
16737 explicit instantiations.
16738 * layout.h (class Layout): Update layout_group declaration.
16739 * output.cc (Output_data_group::Output_data_group): Add flags and
16740 input_shndxes parameters. Remove contents parameter. Change
16741 caller.
16742 (Output_data_group::do_write): Change input_sections_ to
16743 input_shndxes_.
16744 * output.h (class Output_data_group): Update constructor
16745 declaration. Rename input_sections_ to input_shndxes_.
16746 * testsuite/many_sections_test.cc: Add template.
16747
16748 2008-04-30 Cary Coutant <ccoutant@google.com>
16749
16750 * target-reloc.h (relocate_section): Fix dead-pointer bug.
16751
16752 * layout.cc (Layout::include_section): Refactored check for debug
16753 info section.
16754 (Layout::add_comdat): Add new parameters. Change type
16755 of signature parameter. Add object and shndx to signatures table.
16756 (Layout::find_kept_object): New function.
16757 * layout.h: Include <cstring>.
16758 (Layout::is_debug_info_section): New function.
16759 (Layout::add_comdat): Add new parameters.
16760 (Layout::find_kept_object): New function.
16761 (Layout::Kept_section): New struct.
16762 (Layout::Signatures): Change type of map range.
16763 * object.cc (Relobj::output_section_address): New function.
16764 (Sized_relobj::include_section_group): Add new parameters. Change
16765 calls to Layout::add_comdat. Change to build table of kept comdat
16766 groups and table mapping discarded sections to kept sections.
16767 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
16768 (Sized_relobj::do_layout): Change calls to include_section_group and
16769 include_linkonce_section.
16770 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
16771 value to zero when section is discarded.
16772 (Sized_relobj::map_to_kept_section): New function.
16773 * object.h (Relobj::output_section_address): New function.
16774 (Relobj::Comdat_group): New type.
16775 (Relobj::find_comdat_group): New function.
16776 (Relobj::Comdat_group_table): New type.
16777 (Relobj::Kept_comdat_section): New type.
16778 (Relobj::Kept_comdat_section_table): New type.
16779 (Relobj::add_comdat_group): New function.
16780 (Relobj::set_kept_comdat_section): New function.
16781 (Relobj::get_kept_comdat_section): New function.
16782 (Relobj::comdat_groups_): New field.
16783 (Relobj::kept_comdat_sections_): New field.
16784 (Symbol_value::input_value): Update comment.
16785 (Sized_relobj::map_to_kept_section) New function.
16786 (Sized_relobj::include_linkonce_section): Add new parameter.
16787 * target-reloc.h (Comdat_behavior): New type.
16788 (get_comdat_behavior): New function.
16789 (relocate_section): Add code to map a discarded section to the
16790 corresponding kept section when applying a relocation.
16791
16792 2008-04-30 Craig Silverstein <csilvers@google.com>
16793
16794 * dwarf_reader.cc (next_generation_count): New static var.
16795 (Addr2line_cache_entry): New struct.
16796 (addr2line_cache): New static var.
16797 (Dwarf_line_info::one_addr2line): Added caching.
16798 (Dwarf_line_info::clear_addr2line_cache): New function.
16799 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
16800 cache-size parameter.
16801 (Dwarf_line_info::one_addr2line_cache): New function.
16802 * symtab.cc (Symbol_table::detect_odr_violations): Pass
16803 new cache-size argument to one_addr2line(), and clear cache.
16804
16805 2008-04-28 Cary Coutant <ccoutant@google.com>
16806
16807 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
16808 R_386_PC8 relocations.
16809
16810 2008-04-23 Ian Lance Taylor <iant@google.com>
16811
16812 * object.cc (Sized_relobj::include_section_group): Check for
16813 invalid section group.
16814
16815 * object.cc (make_elf_object): Correct test for 64-bit ELF file
16816 header size.
16817
16818 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
16819 than read for file header.
16820 * archive.cc (Archive::include_member): Likewise.
16821
16822 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
16823
16824 * aclocal.m4: Regenerate.
16825 * configure: Regenerate.
16826
16827 2008-04-19 Ian Lance Taylor <iant@google.com>
16828
16829 * version.cc (version_string): Bump to 1.6.
16830
16831 * testsuite/Makefile.am (many_sections_r_test): New target.
16832 (many_sections_r_test_SOURCES): Remove.
16833 (many_sections_r_test_DEPENDENCIES): Remove.
16834 (many_sections_r_test_LDFLAGS): Remove.
16835 (many_sections_r_test_LDADD): Remove.
16836
16837 * object.cc (Sized_relobj::do_add_symbols): Always pass
16838 local_symbol_count_ to add_from_relobj.
16839
16840 * testsuite/Makefile.am (many_sections_check.h): Only check one in
16841 every thousand variables.
16842 * testsuite/Makefile.in: Rebuild.
16843
16844 * object.cc (Xindex::initialize_symtab_xindex): New function.
16845 (Xindex::read_symtab_xindex): New function.
16846 (Xindex::sym_xindex_to_shndx): New function.
16847 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
16848 available.
16849 (Sized_relobj::do_initialize_xindex): New function.
16850 (Sized_relobj::do_read_symbols): Adjust section links.
16851 (Sized_relobj::symbol_section_and_value): Add is_ordinary
16852 parameter. Change all callers.
16853 (Sized_relobj::include_section_group): Adjust section links and
16854 symbol section indexes.
16855 (Sized_relobj::do_layout): Adjust section links.
16856 (Sized_relobj::do_count_local_symbols): Adjust section links and
16857 symbol section indexes.
16858 (Sized_relobj::do_finalize_local_symbols): Distinguish between
16859 ordinary and special symbols.
16860 (Sized_relobj::write_local_symbols): Add symtab_xindex and
16861 dynsym_xindex parameters. Change all callers. Adjust section
16862 links. Use SHN_XINDEX when needed.
16863 (Sized_relobj::get_symbol_location_info): Adjust section links.
16864 Don't get fooled by special symbols.
16865 * object.h (class Xindex): Define.
16866 (class Object): Add xindex_ parameter. Declare virtual functoin
16867 do_initialize_xindex.
16868 (Object::adjust_sym_shndx): New function.
16869 (Object::set_xindex): New protected function.
16870 (class Symbol_value): Add is_ordinary_shndx_ field.
16871 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
16872 (Symbol_value::value): Assert ordinary section.
16873 (Symbol_value::initialize_input_to_output_map): Likewise.
16874 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
16875 Change all callers.
16876 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
16877 all callers.
16878 (class Sized_relobj): Update declarations.
16879 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
16880 parameter. Change all callers.
16881 (Sized_relobj::adjust_shndx): New function.
16882 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
16883 field.
16884 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
16885 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
16886 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
16887 (Sized_dynobj::read_dynsym_section): Adjust section links.
16888 (Sized_dynobj::read_dynamic): Likewise.
16889 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
16890 section links.
16891 (Sized_dynobj::do_initialize_xindex): New function.
16892 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
16893 do_initialize_xindex.
16894 (Sized_dynobj::adjust_shndx): New function.
16895 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
16896 dynsym_xindex_ fields.
16897 (Layout::finalize): Add a call to set_section_indexes before
16898 creating the symtab sections.
16899 (Layout::set_section_indexes): Don't do anything if the section
16900 already has a section index.
16901 (Layout::create_symtab_sections): Add shnum parameter. Change
16902 caller. Create .symtab_shndx section if needed.
16903 (Layout::create_shdrs): Add shstrtab_section parameter. Change
16904 caller.
16905 (Layout::allocated_output_section_count): New function.
16906 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
16907 needed.
16908 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
16909 fields. Update declarations.
16910 (Layout::symtab_xindex): New function.
16911 (Layout::dynsym_xindex): New function.
16912 (class Write_symbols_task): Add layout_ field.
16913 (Write_symbols_task::Write_symbols_task): Add layout parameter.
16914 Change caller.
16915 * output.cc (Output_section_headers::Output_section_headers): Add
16916 shstrtab_section parameter. Change all callers.
16917 (Output_section_headers::do_sized_write): Store overflow values
16918 for section count and section string table section index in
16919 section header zero.
16920 (Output_file_header::do_sized_write): Check for overflow of
16921 section count and section string table section index.
16922 (Output_symtab_xindex::do_write): New function.
16923 (Output_symtab_xindex::endian_do_write): New function.
16924 * output.h (class Output_section_headers): Add shstrtab_section_.
16925 Update declarations.
16926 (class Output_symtab_xindex): Define.
16927 (Output_section::has_out_shndx): New function.
16928 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
16929 field.
16930 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
16931 Change all callers.
16932 (Sized_symbol::init): Likewise.
16933 (Symbol::output_section): Check for ordinary symbol.
16934 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
16935 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
16936 callers.
16937 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
16938 Change all callers. Simplify handling of symbols from sections
16939 not included in the link.
16940 (Symbol_table::add_from_dynobj): Handle ordinary symbol
16941 distinction.
16942 (Weak_alias_sorter::operator()): Assert that symbols are
16943 ordinary.
16944 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
16945 distinction.
16946 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
16947 parameters. Change all callers.
16948 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
16949 symbol distinction. Use SHN_XINDEX when needed.
16950 (Symbol_table::write_section_symbol): Add symtab_xindex
16951 parameter. Change all callers.
16952 (Symbol_table::sized_write_section_symbol): Likewise. Use
16953 SHN_XINDEX when needed.
16954 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
16955 declarations.
16956 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
16957 (Symbol::is_defined): Check is_ordinary.
16958 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
16959 (Symbol::is_absolute, Symbol::is_common): Likewise.
16960 (class Sized_symbol): Update declarations.
16961 (class Symbol_table): Update declarations.
16962 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
16963 parameters. Change all callers.
16964 (Sized_symbol::override): Likewise.
16965 (Symbol_table::override): Likewise.
16966 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
16967 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
16968 is_ordinary, and orig_st_shndx parameters. Change all callers.
16969 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
16970 to be in an ordinary section.
16971 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
16972 object and is_ordinary parameters. Change all callers.
16973 (Sized_dwarf_line_info::read_relocs): Add object parameter.
16974 Change all callers. Don't add undefined or non-ordinary symbols
16975 to reloc_map_.
16976 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
16977 Change all callers.
16978 * dwarf_reader.h (class Sized_dwarf_line_info): Update
16979 declarations.
16980 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
16981 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
16982 (Sized_relobj::relocate_sections): Likewise.
16983 * target-reloc.h (scan_relocs): Adjust section symbol index.
16984 (scan_relocatable_relocs): Likewise.
16985 * i386.cc (Scan::local): Check for ordinary symbols.
16986 * sparc.cc (Scan::local): Likewise.
16987 * x86_64.cc (Scan::local): Likewise.
16988 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
16989 to symbol_section_and_value.
16990 * testsuite/many_sections_test.cc: New file.
16991 * testsuite/Makefile.am (BUILT_SOURCES): Define.
16992 (check_PROGRAMS): Add many_sections_test.
16993 (many_sections_test_SOURCES): Define.
16994 (many_sections_test_DEPENDENCIES): Define.
16995 (many_sections_test_LDFLAGS): Define.
16996 (BUILT_SOURCES): Add many_sections_define.h.
16997 (many_sections_define.h): New target.
16998 (BUILT_SOURCES): Add many_sections_check.h.
16999 (many_sections_check.h): New target.
17000 (check_PROGRAMS): Add many_sections_r_test.
17001 (many_sections_r_test_SOURCES): Define.
17002 (many_sections_r_test_DEPENDENCIES): Define.
17003 (many_sections_r_test_LDFLAGS): Define.
17004 (many_sections_r_test_LDADD): Define.
17005 (many_sections_r_test.o): New target.
17006 * testsuite/Makefile.in: Rebuild.
17007
17008 2008-04-17 Cary Coutant <ccoutant@google.com>
17009
17010 * errors.cc (Errors::info): New function.
17011 (gold_info): New function.
17012 * errors.h (Errors::info): New function.
17013 * gold.h (gold_info): New function.
17014 * object.cc (Input_objects::add_object): Print trace output.
17015 * options.cc (options::parse_set): New function.
17016 (General_options::parse_wrap): Deleted.
17017 (General_options::General_options): Deleted initializer.
17018 * options.h (options::String_set): New typedef.
17019 (options::parse_set): New function.
17020 (DEFINE_set): New macro.
17021 (General_options::wrap): Changed to use DEFINE_set. Changed
17022 callers of any_wrap_symbols and is_wrap_symbol.
17023 (General_options::trace, General_options::trace_symbol):
17024 New options.
17025 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
17026 (General_options::wrap_symbols_): Deleted.
17027 * symtab.cc (Symbol_table::add_from_object): Print trace output.
17028
17029 2008-04-17 David S. Miller <davem@davemloft.net>
17030
17031 * options.cc (General_options::parse_V): New function.
17032 * options.h: Add entries for -V and -Qy.
17033
17034 2008-04-17 Ian Lance Taylor <iant@google.com>
17035
17036 * common.cc (Symbol_table::allocate_commons): Remove options
17037 parameter. Change caller.
17038 (Symbol_table::do_allocate_commons): Remove options parameter.
17039 Change caller. Just call do_allocate_commons_list twice.
17040 (Symbol_table::do_allocate_commons_list): New function, broken out
17041 of do_allocate_commons.
17042 * common.h (class Allocate_commons_task): Remove options_ field.
17043 Update constructor.
17044 * symtab.cc (Symbol_table::Symbol_table): Initialize
17045 tls_commons_.
17046 (Symbol_table::add_from_object): Put TLS common symbols on
17047 tls_commons_ list.
17048 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
17049 which are IN_OUTPUT_DATA.
17050 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
17051 allocate_commons and do_allocate_commons declarations. Declare
17052 do_allocate_commons_list.
17053 * gold.cc (queue_middle_tasks): Update creation of
17054 Allocate_commons_task to not pass options.
17055 * testsuite/Makefile.am (INCLUDES): Add -I.. .
17056 (TLS_TEST_C_FLAGS): New variable.
17057 (tls_test_c_pic.o): New target.
17058 (tls_test_shared.so): Link in tls_test_c_pic.o.
17059 (tls_test_c_pic_ie.o): New target.
17060 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
17061 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
17062 (tls_test_c.o): New target.
17063 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
17064 (tls_pic_test_LDADD): Likewise.
17065 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
17066 (tls_shared_gd_to_ie_test_LDADD): Likewise.
17067 (tls_test_c_gnu2.o): New target.
17068 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
17069 tls_test_c_gnu2.o.
17070 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
17071 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
17072 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
17073 * testsuite/tls_test.cc: Include "config.h".
17074 (t_last): Call t11_last.
17075 * testsuite/tls_test.h (t11, t11_last): Declare.
17076 * testsuite/tls_test_c.c: New file.
17077 * testsuite/tls_test_main.cc (thread_routine): Call t11.
17078 * configure.ac: Check for OpenMP support.
17079 * configure, config.in, Makefile.in: Rebuild.
17080 * testsuite/Makefile.in: Rebuild.
17081
17082 2008-04-16 Cary Coutant <ccoutant@google.com>
17083
17084 * i386.cc (Target_i386::define_tls_base_symbol): New function.
17085 (Target_i386::tls_base_symbol_defined_): New field.
17086 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
17087 (Target_i386::Scan::global): Likewise.
17088 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
17089 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
17090 (Target_x86_64::tls_base_symbol_defined_): New field.
17091 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
17092 (Target_x86_64::Scan::global): Likewise.
17093
17094 2008-04-16 Cary Coutant <ccoutant@google.com>
17095
17096 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
17097 (Symbol::needs_plt_entry): Allow weak undefined symbols.
17098 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
17099 building shared libraries.
17100 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
17101 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
17102 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
17103 * testsuite/Makefile.in: Rebuild.
17104 * testsuite/weak_undef.h: New file.
17105 * testsuite/weak_undef_file1.cc: Add extra test cases.
17106 * testsuite/weak_undef_file2.cc: Likewise.
17107 * testsuite/weak_undef_test.cc: Likewise.
17108
17109 2008-04-16 David S. Miller <davem@davemloft.net>
17110
17111 * sparc.cc (Target_sparc::Scan): Change from struct to class.
17112 Add issued_non_pic_error_ field. Declare check_non_pic.
17113 (Target_sparc::Scan::check_non_pic): New function.
17114 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
17115 (Target_sparc::Scan::global): Likewise.
17116
17117 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
17118 * configure: Rebuild.
17119
17120 * options.h (DEFINE_enable): New macro.
17121 (new_dtags): New enable option.
17122 (initfirst, interpose, loadfltr, nodefaultlib,
17123 nodelete, nodlopen, nodump): New -z options.
17124 * layout.cc (Layout:finish_dynamic_section): If new
17125 dtags enabled, emit DT_RUNPATH. Also, emit a
17126 DT_FLAGS_1 containing any specified -z flags.
17127
17128 2008-04-16 Ian Lance Taylor <iant@google.com>
17129
17130 * copy-relocs.cc: New file.
17131 * copy-relocs.h: New file.
17132 * reloc.cc: Remove Copy_relocs code.
17133 * reloc.h: Likewise.
17134 * reloc-types.h (struct Reloc_types) [both versions]: Add
17135 get_reloc_addend_noerror.
17136 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
17137 variants of add_global which take an addend which must be zero.
17138 * i386.cc: Include "copy-relocs.h".
17139 (class Target_i386): Change type of copy_relocs_ to variable,
17140 update initializer.
17141 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
17142 Change all callers.
17143 (Target_i386::do_finalize_sections): Change handling of
17144 copy_relocs_.
17145 * sparc.cc: Include "copy-relocs.h".
17146 (class Target_sparc): Change type of copy_relocs_ to variable,
17147 update initializer.
17148 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
17149 Change all callers.
17150 (Target_sparc::do_finalize_sections): Change handling of
17151 copy_relocs_.
17152 * x86_64.cc: Include "copy-relocs.h".
17153 (class Target_x86_64): Change type of copy_relocs_ to variable,
17154 update initializer.
17155 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
17156 class. Change all callers.
17157 (Target_x86_64::do_finalize_sections): Change handling of
17158 copy_relocs_.
17159 * Makefile.am (CCFILES): Add copy-relocs.cc.
17160 (HFILES): Add copy-relocs.h.
17161
17162 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
17163
17164 * testsuite/script_test_4.sh: Permit leading zeroes.
17165
17166 2008-04-15 Ian Lance Taylor <iant@google.com>
17167
17168 * script-sections.cc (Script_sections::create_segments): Use
17169 header_size_adjustment even when there is enough room for the
17170 headers.
17171 * testsuite/script_test_4.sh: New file.
17172 * testsuite/script_test_4.t: New file.
17173 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
17174 (check_DATA): Add script_test_4.stdout.
17175 (MOSTLYCLEANFILES): Likewise.
17176 (script_test_4): New target.
17177 (script_test_4.stdout): New target.
17178 * testsuite/Makefile.in: Rebuild.
17179
17180 * sparc.cc: Add definitions for Output_data_plt_sparc class
17181 constants.
17182
17183 2008-04-14 David S. Miller <davem@davemloft.net>
17184
17185 * sparc.cc: New file.
17186 * Makefile.am (TARGETSOURCES): Add sparc.cc
17187 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
17188 * configure.tgt: Document targ_extra_size and
17189 targ_extra_big_endian. Add entries for sparc-* and
17190 sparc64-*.
17191 * configure.ac: Handle targ_extra_size and
17192 targ_extra_big_endian.
17193 * Makefile.in: Rebuild.
17194 * configure: Likewise.
17195 * po/POTFILES.in: Likewise.
17196 * po/gold.pot: Likewise.
17197
17198 2008-04-14 Ian Lance Taylor <iant@google.com>
17199
17200 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
17201 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
17202 in the name/type/flags to section mapping. Don't call
17203 allocate_output_section.
17204 (Layout::choose_output_section): Change parameter from adjust_name
17205 to is_input_section. Don't permit input sections after sections
17206 are attached to segments. Don't call allocate_output_section.
17207 (Layout::layout_eh_frame): Call update_flags_for_input_section,
17208 not write_enable_output_section.
17209 (Layout::make_output_section): Don't push to
17210 unattached_section_list_ nor call attach_to_segment. Call
17211 attach_section_to_segment if sections are attached.
17212 (Layout::attach_sections_to_segments): New function.
17213 (Layout::attach_section_to_segment): New function.
17214 (Layout::attach_allocated_section_to_segment): Rename from
17215 attach_to_segment. Remove flags parameter.
17216 (Layout::allocate_output_section): Remove function.
17217 (Layout::write_enable_output_section): Remove function.
17218 * layout.h (class Layout): Update for above changes. Add new
17219 field sections_are_attached_.
17220 * output.h (Output_section::update_flags_for_input_section): New
17221 function.
17222 * output.cc (Output_section::add_input_section): Call
17223 update_flags_for_input_section.
17224 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
17225
17226 2008-04-11 Cary Coutant <ccoutant@google.com>
17227
17228 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
17229 thought unnecessary.
17230 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
17231
17232 2008-04-11 Ian Lance Taylor <iant@google.com>
17233
17234 * output.h (class Output_section_data): Remove inline definition
17235 of set_addralign.
17236 * output.cc (Output_section_data::set_addralign): New function.
17237
17238 2008-04-11 Cary Coutant <ccoutant@google.com>
17239
17240 Add support for TLS descriptors for i386 and x86_64.
17241 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
17242 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
17243 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
17244 GOT_TYPE_TLS_DESC.
17245 (Target_i386::got_mod_index_entry): Remove unnecessary code.
17246 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
17247 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
17248 relocations.
17249 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
17250 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
17251 Fix problem with initial-exec relocations.
17252 (Target_i386::Relocate::relocate_tls): Likewise.
17253 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
17254 relaxation.
17255 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
17256 support for section-plus-offset dynamic table entries.
17257 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
17258 (Output_data_dynamic::Dynamic_entry): Add support for
17259 section-plus-offset dynamic table entries.
17260 (Output_data_dynamic::Classification): Likewise.
17261 (Output_data_dynamic::classification_): Renamed offset_.
17262 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
17263 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
17264 (Target_x86_64::make_plt_section): New function.
17265 (Target_x86_64::reserve_tlsdesc_entries): New function.
17266 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
17267 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
17268 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
17269 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
17270 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
17271 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
17272 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
17273 add extra PLT entry for TLS descriptors.
17274 (Output_data_plt_x86_64::got_): New field.
17275 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
17276 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
17277 fields.
17278 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
17279 descriptors.
17280 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
17281 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
17282 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
17283 R_386_TLS_DESC_CALL relocations.
17284 (Target_x86_64::Scan::global): Likewise.
17285 (Target_x86_64::do_finalize_sections): Add dynamic table entries
17286 for TLS descriptors.
17287 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
17288 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
17289 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
17290 GD-to-IE relaxation.
17291 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
17292 and TLS_DESCRIPTORS.
17293 * Makefile.in: Rebuild.
17294 * configure: Rebuild.
17295 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
17296 (tls_test_shared2.so): New target.
17297 (tls_shared_gd_to_ie_test_SOURCES): New variable.
17298 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
17299 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
17300 (tls_shared_gd_to_ie_test_LDADD): New variable.
17301 (tls_shared_gnu2_gd_to_ie_test): New target.
17302 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
17303 New targets.
17304 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
17305 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
17306 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
17307 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
17308 (tls_shared_gnu2_test): New target.
17309 (tls_test_gnu2_shared.so): New target.
17310 (tls_shared_gnu2_test_SOURCES): New variable.
17311 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
17312 (tls_shared_gnu2_test_LDFLAGS): New variable.
17313 (tls_shared_gnu2_test_LDADD): New variable.
17314 * testsuite/Makefile.in: Rebuild.
17315 * testsuite/Makefile.
17316
17317 2008-04-11 Ian Lance Taylor <iant@google.com>
17318
17319 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
17320 justsyms.t.
17321 * testsuite/Makefile.in: Rebuild.
17322
17323 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
17324 long.
17325 * testsuite/script_test_2.cc (main): Adjust test.
17326
17327 2008-04-11 David S. Miller <davem@davemloft.net>
17328 Ian Lance Taylor <iant@google.com>
17329
17330 * options.h (General_options): Add entries for '-Y' and
17331 '-relax'.
17332 * options.cc (General_options:finalize): If -Y was used, add those
17333 entries to the library path instead of the default "/lib" and
17334 "/usr/lib".
17335
17336 2008-04-11 David S. Miller <davem@davemloft.net>
17337
17338 * testsuite/justsyms.t: Start at 0x100.
17339 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
17340 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
17341 long.
17342 * testsuite/script_test_2.cc: Adjust string and section length
17343 checks.
17344
17345 2008-04-09 Ian Lance Taylor <iant@google.com>
17346
17347 PR gold/5996
17348 * script-sections.cc (Sections_element::allocate_to_segment): Add
17349 orphan parameter.
17350 (Output_section_definition::allocate_to_segment): Likewise.
17351 (Orphan_output_section::allocate_to_segment): Likewise.
17352 (Script_sections::attach_sections_using_phdrs_clause): Don't
17353 propagate non-PT_LOAD segments to orphan sections.
17354 * testsuite/Makefile.am (script_test_3.stdout): Generate using
17355 readelf rather than objdump.
17356 * testsuite/script_test_3.sh: Adjust accordingly. Test that
17357 .interp section and PT_INTERP segment are the same size.
17358 * testsuite/Makefile.in: Rebuild.
17359
17360 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
17361 aliases for symbols defined in the same object.
17362 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
17363 (weak_alias_test_SOURCES): New variable.
17364 (weak_alias_test_DEPENDENCIES): New variable.
17365 (weak_alias_test_LDFLAGS): New variable.
17366 (weak_alias_test_LDADD): New variable.
17367 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
17368 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
17369 (weak_alias_test_3.o): New target.
17370 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
17371 * testsuite/weak_alias_test_main.cc: New file.
17372 * testsuite/weak_alias_test_1.cc: New file.
17373 * testsuite/weak_alias_test_2.cc: New file.
17374 * testsuite/weak_alias_test_3.cc: New file.
17375
17376 2008-04-08 Ian Lance Taylor <iant@google.com>
17377
17378 * options.h (class General_options): Add --noinhibit-exec option.
17379 * main.cc (main): Check --noinhibit-exec.
17380
17381 * options.h (class General_options): Define --wrap as a special
17382 option. Add wrap_symbols_ field.
17383 (General_options::any_wrap_symbols): New function.
17384 (General_options::is_wrap_symbol): New function.
17385 * options.cc (General_options::parse_wrap): New function.
17386 (General_options::General_options): Initialize wrap_symbols_.
17387 * symtab.cc (Symbol_table::wrap_symbol): New function.
17388 (Symbol_table::add_from_object): Handle --wrap.
17389 * symtab.h (class Symbol_table): Declare wrap_symbol.
17390 * target.h (Target::wrap_char): New function.
17391 (Target::Target_info): Add wrap_char field.
17392 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
17393 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
17394 * testsuite/testfile.cc (Target_test::test_target_info):
17395 Likewise.
17396
17397 * errors.cc (Errors::undefined_symbol): Mention symbol version if
17398 there is one.
17399
17400 * layout.h (class Layout): Add added_eh_frame_data_ field.
17401 * layout.cc (Layout::Layout): Initialize new field.
17402 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
17403 output section until we find a section we merged successfully.
17404 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
17405 that the size be non-zero.
17406
17407 * merge.cc (Object_merge_map::get_output_offset): Remove inline
17408 qualifier.
17409
17410 2008-04-08 Craig Silverstein <csilvers@google.com>
17411
17412 * configure.ac: Export new conditional variable HAVE_ZLIB.
17413 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
17414 on HAVE_ZLIB.
17415 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
17416 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17417
17418 2008-04-07 Ian Lance Taylor <iant@google.com>
17419
17420 * version.cc (version_string): Set to "1.5".
17421
17422 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
17423 Add issued_non_pic_error_ field. Declare check_non_pic.
17424 (Target_x86_64::Scan::check_non_pic): New function.
17425 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
17426 (Target_x86_64::Scan::global): Likewise.
17427
17428 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
17429 addend parameter. Change caller. Handle merge sections.
17430 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
17431 Address to Addend. Don't add in the result of
17432 local_section_offset, pass down the addend and use the returned
17433 value.
17434 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
17435 Update declarations of local_section_offset and symbol_value.
17436 * testsuite/two_file_test_1.cc (t18): New function.
17437 * testsuite/two_file_test_2.cc (f18): New function.
17438 * testsuite/two_file_test_main.cc (main): Call t18.
17439 * testsuite/two_file_test.h (t18, f18): Declare.
17440
17441 * configure.ac: Don't test for objdump, c++filt, or readelf.
17442 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
17443 conditionals.
17444 (TEST_READELF): New variable.
17445 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
17446 (check_PROGRAMS): Add two_file_strip_test.
17447 (two_file_strip_test): New target.
17448 (check_PROGRAMS): Add two_file_same_shared_strip_test.
17449 (two_file_same_shared_strip_test_SOURCES): New variable.
17450 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
17451 (two_file_same_shared_strip_test_LDFLAGS): New variable.
17452 (two_file_same_shared_strip_test_LDADD): New variable.
17453 (two_file_shared_strip.so): New target.
17454 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
17455 (ver_test_5.syms, ver_test_7.syms): Likewise.
17456 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
17457 (strip_test_3.stdout): Use TEST_OBJDUMP.
17458 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17459
17460 2008-04-04 Cary Coutant <ccoutant@google.com>
17461
17462 * symtab.h (Symbol::is_weak_undefined): New function.
17463 (Symbol::is_strong_undefined): New function.
17464 (Symbol::is_absolute): New function.
17465 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
17466 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
17467 absolute symbols.
17468 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
17469 (weak_undef_test): New target.
17470 * testsuite/Makefile.in: Rebuild.
17471 * testsuite/weak_undef_file1.cc: New file.
17472 * testsuite/weak_undef_file2.cc: New file.
17473 * testsuite/weak_undef_test.cc: New file.
17474
17475 2008-04-03 Craig Silverstein <csilvers@google.com>
17476
17477 * compressed_output.h (class Output_compressed_section): Use
17478 unsigned buffer.
17479 * compressed_output.cc (zlib_compress): Use unsigned buffers,
17480 add zlib header.
17481 (zlib_compressed_suffix): Removed.
17482 (Output_compressed_section::set_final_data_size): Use unsigned
17483 buffers.
17484 * testsuite/Makefile.am (flagstest_compress_debug_sections):
17485 Fix linker invocation.
17486 (flagstest_o_specialfile_and_compress_debug_sections):
17487 Likewise.
17488 * testsuite/Makefile.in: Regenerated.
17489
17490 2008-04-02 David S. Miller <davem@davemloft.net>
17491
17492 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
17493 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
17494
17495 2008-04-02 Craig Silverstein <csilvers@google.com>
17496
17497 * TODO: New file.
17498
17499 2008-04-02 Ian Lance Taylor <iant@google.com>
17500
17501 * fileread.cc (File_read::find_view): Add byteshift and vshifted
17502 parameters. Update for new key type to views_. Change all
17503 callers.
17504 (File_read::read): Adjust for byteshift in returned view.
17505 (File_read::add_view): New function, broken out of
17506 find_and_make_view.
17507 (File_read::make_view): New function, broken out of
17508 find_and_make_view.
17509 (File_read::find_or_make_view): Add offset and aligned
17510 parameters. Rewrite accordingly. Change all callers.
17511 (File_read::get_view): Add offset and aligned parameters. Adjust
17512 for byteshift in return value.
17513 (File_read::get_lasting_view): Likewise.
17514 * fileread.h (class File_read): Update declarations.
17515 (class File_read::View): Add byteshift_ field. Add byteshift to
17516 constructor. Add byteshift method.
17517 * archive.h (Archive::clear_uncached_views): New function.
17518 (Archive::get_view): Add aligned parameter. Change all callers.
17519 * object.h (Object::get_view): Add aligned parameter. Change all
17520 callers.
17521 (Object::get_lasting_view): Likewise.
17522
17523 * fileread.cc (File_read::release): Don't call clear_views if
17524 there are multiple objects.
17525 * fileread.h (File_read::clear_uncached_views): New function.
17526 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
17527 on the archive.
17528
17529 2008-03-31 Cary Coutant <ccoutant@google.com>
17530
17531 Add thin archive support.
17532 * archive.cc (Archive::armagt): New const.
17533 (Archive::setup): Remove task parameter and calls to unlock.
17534 (Archive::unlock_nested_archives): New function.
17535 (Archive::read_header): Add nested_off parameter. Change
17536 all callers.
17537 (Archive::interpret_header): Likewise.
17538 (Archive::include_all_members): Change to handle thin
17539 archives.
17540 (Archive::include_member): Likewise.
17541 * archive.h (Archive::Archive): Add new parameters and
17542 initializers.
17543 (Archive::armagt): New const.
17544 (Archive::setup): Remove task parameter.
17545 (Archive::unlock_nested_archives): New function.
17546 (Archive::read_header): Add nested_off parameter.
17547 (Archive::interpret_header): Likewise.
17548 (Archive::Nested_archive_table): New typedef.
17549 (Archive::is_thin_archive_): New field.
17550 (Archive::nested_archives_): New field.
17551 (Archive::options_): New field.
17552 (Archive::dirpath_): New field.
17553 (Archive::task_): New field.
17554 * readsyms.cc (Read_symbols::do_read_symbols): Add check
17555 for thin archives. Pass additional parameters to
17556 Archive::Archive. Unlock the archive file after calling
17557 Archive::setup.
17558
17559 2008-03-29 Ian Lance Taylor <iant@google.com>
17560
17561 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
17562 version symbol to be local.
17563 * testsuite/ver_test_4.sh: New file.
17564 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
17565 (check_DATA): Add ver_test_4.syms.
17566 (ver_test_4.syms): New target.
17567 * testsuite/Makefile.in: Rebuild.
17568
17569 * output.cc
17570 (Output_section::Input_section_sort_entry::has_priority): New
17571 function.
17572 (Output_section::Input_section_sort_entry::match_file_name): New
17573 function.
17574 (Output_section::Input_section_sort_entry::match_section_name):
17575 Remove.
17576 (Output_section::Input_section_sort_entry::match_section_name_prefix):
17577 Remove.
17578 (Output_section::Input_section_sort_entry::match_section_file):
17579 Remove.
17580 (Output_section::Input_section_sort_compare::operator()): Rewrite
17581 using new Input_section_sort_entry functions. Sort crtbegin and
17582 crtend first. Sort sections with no priority before sections with
17583 a priority.
17584 * testsuite/initpri1.c (d3): Check j != 4.
17585 (cd5): New constructor/destructor function.
17586 (main): Check j != 2.
17587
17588 * symtab.cc (Symbol_table::add_from_object): If we don't use the
17589 new symbol when resolving, don't call set_is_default.
17590 * testsuite/ver_test_7.cc: New file.
17591 * testsuite/ver_test_7.sh: New file.
17592 * testsuite/Makefile.am (ver_test_7.so): New target.
17593 (ver_test_7.o): New target.
17594 (check_SCRIPTS): Add ver_test_7.sh.
17595 (check_DATA): Add ver_test_7.syms.
17596 (ver_test_7.syms): New target.
17597
17598 2008-03-28 Ian Lance Taylor <iant@google.com>
17599
17600 * layout.cc (Layout::layout): If we see an input section with a
17601 name that needs sorting, set the must_sort flag for the output
17602 section.
17603 (Layout::make_output_section): If the name of the output section
17604 indicates that it might require sorting, set the may_sort flag.
17605 * output.h (Output_section::may_sort_attached_input_sections): New
17606 function.
17607 (Output_section::set_may_sort_attached_input_sections): New
17608 function.
17609 (Output_section::must_sort_attached_input_sections): New
17610 function.
17611 (Output_section::set_must_sort_attached_input_sections): New
17612 function.
17613 (class Output_section): Declare Input_section_sort_entry. Define
17614 Input_section_sort_compare. Declare
17615 sort_attached_input_sections. Add new fields:
17616 may_sort_attached_input_sections_,
17617 must_sort_attached_input_sections_,
17618 attached_input_sections_are_sorted_.
17619 * output.cc (Output_section::Output_section): Initialize new
17620 fields.
17621 (Output_section::add_input_section): Add an entry to
17622 input_sections_ if may_sort or must_sort are true.
17623 (Output_section::set_final_data_size): Call
17624 sort_attached_input_sections if necessary.
17625 (Output_section::Input_section_sort_entry): Define new class.
17626 (Output_section::Input_section_sort_compare::operator()): New
17627 function.
17628 (Output_section::sort_attached_input_sections): New function.
17629 * configure.ac: Check whether the compiler supports constructor
17630 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
17631 * testsuite/initpri1.c: New file.
17632 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
17633 CONSTRUCTOR_PRIORITY.
17634 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
17635 (initpri1_LDFLAGS): New variable.
17636 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17637
17638 2008-03-27 Ian Lance Taylor <iant@google.com>
17639
17640 * common.cc (Sort_commons::operator): Correct sorting algorithm.
17641 * testsuite/common_test_1.c: New file.
17642 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
17643 (common_test_1_SOURCES): New variable.
17644 (common_test_1_DEPENDENCIES): New variable.
17645 (common_test_1_LDFLAGS): New variable.
17646
17647 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
17648 and commons_ correctly when NAME/VERSION does not override
17649 NAME/NULL.
17650 * testsuite/ver_test_6.c: New file.
17651 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
17652 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
17653 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
17654
17655 2008-03-26 Ian Lance Taylor <iant@google.com>
17656
17657 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
17658 of an undefined symbol from a version script.
17659 * testsuite/Makefile.am (ver_test_5.so): New target.
17660 (ver_test_5.o): New target.
17661 (check_SCRIPTS): Add ver_test_5.sh.
17662 (check_DATA): Add ver_test_5.syms.
17663 (ver_test_5.syms): New target.
17664 * testsuite/ver_test_5.cc: New file.
17665 * testsuite/ver_test_5.script: New file.
17666 * testsuite/ver_test_5.sh: New file.
17667 * Makefile.in, testsuite/Makefile.in: Rebuild.
17668
17669 PR gold/5986
17670 Fix problems building gold with gcc 4.3.0.
17671 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
17672 (gold_error_at_location, gold_warning_at_location): Use it.
17673 * configure.ac: Check whether we can compile and use a template
17674 function with a printf attribute.
17675 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
17676 when jumping over bytes.
17677 * object.cc: Instantiate Object::read_section_data.
17678 * debug.h: Include <cstring>
17679 * dwarf_reader.cc: Include <algorithm>
17680 * main.cc: Include <cstring>.
17681 * options.cc: Include <cstring>.
17682 * output.cc: Include <cstring>.
17683 * script.cc: Include <cstring>.
17684 * script.h: Include <string>.
17685 * symtab.cc: Include <cstring> and <algorithm>.
17686 * target-select.cc: Include <cstring>.
17687 * version.cc: Include <string>.
17688 * testsuite/testmain.cc: Include <cstdlib>.
17689 * configure, config.in: Rebuild.
17690
17691 2008-03-25 Ian Lance Taylor <iant@google.com>
17692
17693 * options.cc: Include "../bfd/bfdver.h".
17694 (options::help): Print bug reporting address.
17695
17696 * version.cc (print_version): Adjust output for current value of
17697 BFD_VERSION_STRING.
17698
17699 * NEWS: New file.
17700
17701 * options.cc (options::help): Print list of supported targets.
17702 * target-select.h: Include <vector>.
17703 (class Target_selector): Make machine_, size_, and is_big_endian_
17704 fields const. Add bfd_name_ and instantiated_target_ fields.
17705 (Target_selector::Target_selector): Add bfd_name parameter.
17706 (Target_selector::recognize): Make non-virtual, call
17707 do_recognize.
17708 (Target_selector::recognize_by_name): Make non-virtual, call
17709 do_recognize_by_name.
17710 (Target_selector::supported_names): New function.
17711 (Target_selector::bfd_name): New function.
17712 (Target_selector::do_instantiate_target): New pure virtual
17713 function.
17714 (Target_selector::do_recognize): New virtual function.
17715 (Target_selector::do_recognize_by_name): New virtual function.
17716 (Target_selector::instantiate_target): New private function.
17717 (supported_target_names): Declare.
17718 * target-select.cc (Target_selector::Target_selector): Update for
17719 new parameter and fields.
17720 (select_target_by_name): Check that the name matches before
17721 calling recognize_by_name.
17722 (supported_target_names): New function.
17723 * i386.cc (class Target_selector_i386): Update Target_selector
17724 constructor call. Remove recognize and recognize_by_name. Add
17725 do_instantiate_target.
17726 * x86_64.cc (class Target_selector_x86_64): Likewise.
17727 * testsuite/testfile.cc (class Target_selector_test): Update for
17728 changes to Target_selector.
17729
17730 * README: Rewrite, with some notes on unsupported features.
17731
17732 2008-03-24 Cary Coutant <ccoutant@google.com>
17733
17734 * i386.cc (Target_i386::Got_type): New enum declaration.
17735 (Target_i386::Scan::local): Updated callers of Output_data_got
17736 member functions.
17737 (Target_i386::Scan::global): Likewise.
17738 (Target_i386::Relocate::relocate): Likewise.
17739 (Target_i386::Relocate::relocate_tls): Likewise.
17740 * object.h (Got_offset_list): New class.
17741 (Sized_relobj::local_has_got_offset): Added got_type parameter.
17742 (Sized_relobj::local_got_offset): Likewise.
17743 (Sized_relobj::set_local_got_offset): Likewise.
17744 (Sized_relobj::local_has_tls_got_offset): Removed.
17745 (Sized_relobj::local_tls_got_offset): Removed.
17746 (Sized_relobj::set_local_tls_got_offset): Removed.
17747 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
17748 * output.cc (Output_data_got::add_global): Added got_type parameter.
17749 (Output_data_got::add_global_with_rel): Likewise.
17750 (Output_data_got::add_global_with_rela): Likewise.
17751 (Output_data_got::add_global_pair_with_rel): New function.
17752 (Output_data_got::add_global_pair_with_rela): New function.
17753 (Output_data_got::add_local): Added got_type parameter.
17754 (Output_data_got::add_local_with_rel): Likewise.
17755 (Output_data_got::add_local_with_rela): Likewise.
17756 (Output_data_got::add_local_pair_with_rel): New function.
17757 (Output_data_got::add_local_pair_with_rela): New function.
17758 (Output_data_got::add_global_tls): Removed.
17759 (Output_data_got::add_global_tls_with_rel): Removed.
17760 (Output_data_got::add_global_tls_with_rela): Removed.
17761 (Output_data_got::add_local_tls): Removed.
17762 (Output_data_got::add_local_tls_with_rel): Removed.
17763 (Output_data_got::add_local_tls_with_rela): Removed.
17764 * output.h (Output_data_got::add_global): Added got_type parameter.
17765 (Output_data_got::add_global_with_rel): Likewise.
17766 (Output_data_got::add_global_with_rela): Likewise.
17767 (Output_data_got::add_global_pair_with_rel): New function.
17768 (Output_data_got::add_global_pair_with_rela): New function.
17769 (Output_data_got::add_local): Added got_type parameter.
17770 (Output_data_got::add_local_with_rel): Likewise.
17771 (Output_data_got::add_local_with_rela): Likewise.
17772 (Output_data_got::add_local_pair_with_rel): New function.
17773 (Output_data_got::add_local_pair_with_rela): New function.
17774 (Output_data_got::add_global_tls): Removed.
17775 (Output_data_got::add_global_tls_with_rel): Removed.
17776 (Output_data_got::add_global_tls_with_rela): Removed.
17777 (Output_data_got::add_local_tls): Removed.
17778 (Output_data_got::add_local_tls_with_rel): Removed.
17779 (Output_data_got::add_local_tls_with_rela): Removed.
17780 * resolve.cc (Symbol::override_base_with_special): Removed
17781 reference to has_got_offset_ field.
17782 * symtab.cc (Symbol::init_fields): Replaced initialization
17783 of got_offset_ with got_offsets_. Removed initialization
17784 of has_got_offset_
17785 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
17786 (Symbol::got_offset): Likewise.
17787 (Symbol::set_got_offset): Likewise.
17788 (Symbol::has_tls_got_offset): Removed.
17789 (Symbol::tls_got_offset): Removed.
17790 (Symbol::set_tls_got_offset): Removed.
17791 (Symbol::got_offset_): Removed.
17792 (Symbol::tls_mod_got_offset_): Removed.
17793 (Symbol::tls_pair_got_offset_): Removed.
17794 (Symbol::got_offsets_): New field.
17795 (Symbol::has_got_offset): Removed.
17796 (Symbol::has_tls_mod_got_offset): Removed.
17797 (Symbol::has_tls_pair_got_offset): Removed.
17798 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
17799 (Target_x86_64::Scan::local): Updated callers of Output_data_got
17800 member functions.
17801 (Target_x86_64::Scan::global): Likewise.
17802 (Target_x86_64::Relocate::relocate): Likewise.
17803 (Target_x86_64::Relocate::relocate_tls): Likewise.
17804
17805 2008-03-25 Ben Elliston <bje@au.ibm.com>
17806
17807 * yyscript.y: Fix spelling error in comment.
17808
17809 2008-03-24 Ian Lance Taylor <iant@google.com>
17810
17811 * options.h (class General_options): Define build_id option.
17812 * layout.h (class Layout): Declare write_build_id, create_note,
17813 create_build_id. Add build_id_note_ member.
17814 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
17815 "libiberty.h", "md5.h", "sha1.h".
17816 (Layout::Layout): Initialize eh_frame_data_,
17817 eh_frame_hdr_section_, and build_id_note_.
17818 (Layout::finalize): Call create_build_id.
17819 (Layout::create_note): New function, broken out of
17820 Layout::create_gold_note.
17821 (Layout::create_gold_note): Call create_note.
17822 (Layout::create_build_id): New function.
17823 (Layout::write_build_id): New function.
17824 (Close_task_runner::run): Call write_build_id.
17825
17826 * x86_64.cc: Correct license to GPLv3.
17827
17828 2008-03-23 Ian Lance Taylor <iant@google.com>
17829
17830 * options.cc: Include "demangle.h".
17831 (parse_optional_string): New function.
17832 (parse_long_option): Handle takes_optional_argument.
17833 (parse_short_option): Update dash_z initializer. Handle
17834 takes_optional_argument.
17835 (General_options::General_options): Initialize do_demangle_.
17836 (General_options::finalize): Set do_demangle_. Handle demangling
17837 style.
17838 * options.h (parse_optional_string): Declare.
17839 (struct One_option): Add optional_arg field. Update constructor.
17840 Update call constructor calls. Add takes_optional_argument
17841 function.
17842 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
17843 (DEFINE_optional_string): Define.
17844 (General_options::demangle): Change from DEFINE_bool to
17845 DEFINE_optional_string.
17846 (General_options::no_demangle): New function.
17847 (General_options::do_demangle): New function.
17848 (General_options::set_do_demangle): New function.
17849 (General_options::execstack_status_): Move definition to end of
17850 class definition.
17851 (General_options::static_): Likewise.
17852 (General_options::do_demangle_): New field.
17853 * object.cc (big_endian>::get_symbol_location_info): Call
17854 Options::do_demangle, not Options::demangle.
17855 * symtab.cc (demangle): Likewise.
17856
17857 2008-03-22 Ian Lance Taylor <iant@google.com>
17858
17859 * gold.h: Include <cstddef> and <sys/types.h>
17860 * options.h: Include <cstring>.
17861
17862 2008-03-21 Ian Lance Taylor <iant@google.com>
17863
17864 * Added source code to GNU binutils.
17865 \f
17866 Copyright (C) 2008-2015 Free Software Foundation, Inc.
17867
17868 Copying and distribution of this file, with or without modification,
17869 are permitted in any medium without royalty provided the copyright
17870 notice and this notice are preserved.
17871
17872 Local Variables:
17873 mode: change-log
17874 left-margin: 8
17875 fill-column: 74
17876 version-control: never
17877 End:
This page took 0.429096 seconds and 5 git commands to generate.